Trying to solve cust id issue
This commit is contained in:
parent
841900e781
commit
9d6e3e0d5b
@ -17,8 +17,12 @@ if (typeof window !== 'undefined' && window.parent !== window) {
|
||||
if (key === 'customer' && typeof value === 'object' && value !== null) {
|
||||
// Handle customer object separately
|
||||
postMessageCustomer = value as Partial<ICustomer>;
|
||||
// Trim customer.id if it exists
|
||||
if (postMessageCustomer.id && typeof postMessageCustomer.id === 'string') {
|
||||
postMessageCustomer.id = postMessageCustomer.id.trim();
|
||||
}
|
||||
} else if (key !== 'type' && typeof value === 'string') {
|
||||
postMessageParams[key] = value;
|
||||
postMessageParams[key] = value.trim();
|
||||
} else if (typeof value === 'number' || typeof value === 'boolean') {
|
||||
postMessageParams[key] = String(value);
|
||||
}
|
||||
@ -127,7 +131,7 @@ export function getCashierConfig(): ICashierConfig {
|
||||
config.merchantId = merchantId;
|
||||
}
|
||||
|
||||
const userId = params.get('userId');
|
||||
const userId = params.get('userId')?.trim();
|
||||
if (userId) {
|
||||
config.userId = userId;
|
||||
} else if (import.meta.env.DEV) {
|
||||
@ -151,7 +155,7 @@ export function getCashierConfig(): ICashierConfig {
|
||||
// Start with postMessage customer if available, otherwise create new object
|
||||
const customer: Partial<ICustomer> = postMessageCustomer ? { ...postMessageCustomer } : {};
|
||||
|
||||
const customerId = params.get('customer_id') || userId;
|
||||
const customerId = params.get('customer_id')?.trim() || userId;
|
||||
if (customerId) {
|
||||
customer.id = customerId;
|
||||
} else if (userId && !customer.id) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user