@disconetwork/shopify 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DiscoPrepurchaseThankYou-0LqiJGuU.js → DiscoPrepurchaseThankYou-COYkyyEU.js} +26 -2
- package/dist/DiscoPrepurchaseThankYou-COYkyyEU.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/internal.js +1 -1
- package/package.json +5 -5
- package/dist/DiscoPrepurchaseThankYou-0LqiJGuU.js.map +0 -1
|
@@ -261,6 +261,8 @@ const getRecommendationsRequest = ({ payload, widgetId }) => {
|
|
|
261
261
|
currencyCode: payload.currencyCode,
|
|
262
262
|
id: shopifyOrderIdFormatter(payload.orderId) ?? void 0
|
|
263
263
|
},
|
|
264
|
+
shipping: payload.shippingAddress,
|
|
265
|
+
billing: payload.billingAddress,
|
|
264
266
|
purchases: payload.cartLines.map((cartLine) => {
|
|
265
267
|
return {
|
|
266
268
|
name: cartLine.merchandise.title,
|
|
@@ -359,7 +361,7 @@ const RecommendationsWidgetSkeleton = () => /* @__PURE__ */ jsx$1("s-box", {
|
|
|
359
361
|
//#region src/sdkIdentity.ts
|
|
360
362
|
const SDK_IDENTITY = {
|
|
361
363
|
name: "@disconetwork/shopify",
|
|
362
|
-
version: "0.0.
|
|
364
|
+
version: "0.0.9"
|
|
363
365
|
};
|
|
364
366
|
//#endregion
|
|
365
367
|
//#region ../react-shared/dist/sdk-internals.js
|
|
@@ -425,6 +427,26 @@ const RecommendationsContent = ({ children, request }) => {
|
|
|
425
427
|
});
|
|
426
428
|
};
|
|
427
429
|
//#endregion
|
|
430
|
+
//#region src/utils/address.ts
|
|
431
|
+
/**
|
|
432
|
+
* Map a Shopify `MailingAddress` onto the recommendations `Address`, dropping
|
|
433
|
+
* empty fields. `undefined` when Shopify gives no address (e.g. no protected
|
|
434
|
+
* customer data access) or the address has none of the fields we forward.
|
|
435
|
+
*/
|
|
436
|
+
const toRecommendationsAddress = (address) => {
|
|
437
|
+
if (!address) return void 0;
|
|
438
|
+
const mapped = {
|
|
439
|
+
addressLine1: address.address1 || void 0,
|
|
440
|
+
addressLine2: address.address2 || void 0,
|
|
441
|
+
city: address.city || void 0,
|
|
442
|
+
state: address.provinceCode || void 0,
|
|
443
|
+
zip: address.zip || void 0,
|
|
444
|
+
phone: address.phone || void 0,
|
|
445
|
+
countryCode: address.countryCode || void 0
|
|
446
|
+
};
|
|
447
|
+
return Object.values(mapped).some(Boolean) ? mapped : void 0;
|
|
448
|
+
};
|
|
449
|
+
//#endregion
|
|
428
450
|
//#region src/managers/PayloadManager.tsx
|
|
429
451
|
const GenericPayloadProvider = ({ target, children, payload, additionalPayload, isB2BPurchase }) => {
|
|
430
452
|
useEffect(() => {
|
|
@@ -455,6 +477,8 @@ function createGenericPayload({ buyerPhone, buyerEmail, customer, shippingAddres
|
|
|
455
477
|
billingLastName: billingAddress?.lastName,
|
|
456
478
|
billingZipCode: billingAddress?.zip,
|
|
457
479
|
shippingZipCode: shippingAddress?.zip,
|
|
480
|
+
shippingAddress: toRecommendationsAddress(shippingAddress),
|
|
481
|
+
billingAddress: toRecommendationsAddress(billingAddress),
|
|
458
482
|
extrapolatedFirstName: customer?.firstName || derivedFirstName,
|
|
459
483
|
extrapolatedPhone: buyerPhone || shippingAddress?.phone || billingAddress?.phone || "",
|
|
460
484
|
totalCost: totalAmount.amount,
|
|
@@ -4893,4 +4917,4 @@ function OrderSubmitter({ trackingTicketId, idempotencyKey, insertionId }) {
|
|
|
4893
4917
|
//#endregion
|
|
4894
4918
|
export { DiscoRecommendations as a, PrepurchaseIncentive as i, PrepurchaseThankYou as n, Recommendations as o, DiscoPrepurchaseIncentive as r, DiscoPrepurchaseThankYou as t };
|
|
4895
4919
|
|
|
4896
|
-
//# sourceMappingURL=DiscoPrepurchaseThankYou-
|
|
4920
|
+
//# sourceMappingURL=DiscoPrepurchaseThankYou-COYkyyEU.js.map
|