@disconetwork/shopify 0.0.9 → 0.0.10
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-COYkyyEU.js → DiscoPrepurchaseThankYou-Cu3yyFVs.js} +19 -29
- package/dist/DiscoPrepurchaseThankYou-Cu3yyFVs.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/internal.js +1 -1
- package/package.json +3 -3
- package/dist/DiscoPrepurchaseThankYou-COYkyyEU.js.map +0 -1
|
@@ -5,8 +5,8 @@ import { withImpressionDedupe } from "@disconetwork/core";
|
|
|
5
5
|
import { Fragment, jsx } from "preact/jsx-runtime";
|
|
6
6
|
import { INTERNAL_BASE_URL, InternalDiscoClient, parseScreens } from "@disconetwork/core/internal";
|
|
7
7
|
import { Fragment as Fragment$1, jsx as jsx$1, jsxs } from "preact/jsx-runtime";
|
|
8
|
-
import { useApi, useApplyAttributeChange, useApplyCartLinesChange, useAttributeValues, useBillingAddress, useCartLines, useCheckoutToken, useCustomer, useDiscountCodes, useEmail, useExtensionEditor, useInstructions, useLocalizationCountry,
|
|
9
|
-
import { useApi as useApi$1,
|
|
8
|
+
import { useApi, useApplyAttributeChange, useApplyCartLinesChange, useAttributeValues, useBillingAddress, useCartLines, useCheckoutToken, useCustomer, useDiscountCodes, useEmail, useExtensionEditor, useInstructions, useLocalizationCountry, usePurchasingCompany, useShippingAddress, useShop, useSubscription, useSubtotalAmount, useTotalAmount } from "@shopify/ui-extensions/checkout/preact";
|
|
9
|
+
import { useApi as useApi$1, useCartLines as useCartLines$1, useDiscountCodes as useDiscountCodes$1, useOrder, usePurchasingCompany as usePurchasingCompany$1, useShop as useShop$1, useSubscription as useSubscription$1, useTotalAmount as useTotalAmount$1 } from "@shopify/ui-extensions/customer-account/preact";
|
|
10
10
|
import { QueryClient, QueryClientProvider, useMutation, useQuery } from "@tanstack/preact-query";
|
|
11
11
|
import { boolean, email, nullable, object, optional, string } from "zod/mini";
|
|
12
12
|
//#region ../react-shared/dist/createHeadlessBindings-CPuF5wZQ.js
|
|
@@ -361,7 +361,7 @@ const RecommendationsWidgetSkeleton = () => /* @__PURE__ */ jsx$1("s-box", {
|
|
|
361
361
|
//#region src/sdkIdentity.ts
|
|
362
362
|
const SDK_IDENTITY = {
|
|
363
363
|
name: "@disconetwork/shopify",
|
|
364
|
-
version: "0.0.
|
|
364
|
+
version: "0.0.10"
|
|
365
365
|
};
|
|
366
366
|
//#endregion
|
|
367
367
|
//#region ../react-shared/dist/sdk-internals.js
|
|
@@ -493,12 +493,7 @@ function createGenericPayload({ buyerPhone, buyerEmail, customer, shippingAddres
|
|
|
493
493
|
}
|
|
494
494
|
const ThankYouPayloadManager = ({ children }) => {
|
|
495
495
|
const target = PAYLOAD_MANAGER_TARGET.THANK_YOU;
|
|
496
|
-
const customer = useCustomer();
|
|
497
|
-
const buyerEmail = useEmail();
|
|
498
|
-
const buyerPhone = usePhone();
|
|
499
496
|
const purchasingCompany = usePurchasingCompany();
|
|
500
|
-
const shippingAddress = useShippingAddress();
|
|
501
|
-
const billingAddress = useBillingAddress();
|
|
502
497
|
const totalAmount = useTotalAmount();
|
|
503
498
|
const cartLines = useCartLines();
|
|
504
499
|
const checkoutToken = useCheckoutToken();
|
|
@@ -510,11 +505,11 @@ const ThankYouPayloadManager = ({ children }) => {
|
|
|
510
505
|
return /* @__PURE__ */ jsx$1(GenericPayloadProvider, {
|
|
511
506
|
target,
|
|
512
507
|
payload: createGenericPayload({
|
|
513
|
-
buyerPhone,
|
|
514
|
-
buyerEmail,
|
|
515
|
-
customer,
|
|
516
|
-
shippingAddress,
|
|
517
|
-
billingAddress,
|
|
508
|
+
buyerPhone: shopify.buyerIdentity?.phone.value,
|
|
509
|
+
buyerEmail: shopify.buyerIdentity?.email.value,
|
|
510
|
+
customer: shopify.buyerIdentity?.customer.value,
|
|
511
|
+
shippingAddress: shopify.shippingAddress?.value,
|
|
512
|
+
billingAddress: shopify.billingAddress?.value,
|
|
518
513
|
totalAmount,
|
|
519
514
|
cartLines,
|
|
520
515
|
checkoutToken,
|
|
@@ -532,29 +527,25 @@ const ThankYouPayloadManager = ({ children }) => {
|
|
|
532
527
|
};
|
|
533
528
|
const OrderStatusPayloadManager = ({ children }) => {
|
|
534
529
|
const target = PAYLOAD_MANAGER_TARGET.ORDER_STATUS;
|
|
535
|
-
const customer = useCustomer$1();
|
|
536
|
-
const buyerEmail = useEmail$1();
|
|
537
|
-
const buyerPhone = usePhone$1();
|
|
538
530
|
const purchasingCompany = usePurchasingCompany$1();
|
|
539
|
-
const shippingAddress = useShippingAddress$1();
|
|
540
|
-
const billingAddress = useBillingAddress$1();
|
|
541
531
|
const totalAmount = useTotalAmount$1();
|
|
542
532
|
const cartLines = useCartLines$1();
|
|
543
533
|
const discountCodes = useDiscountCodes$1();
|
|
544
534
|
const shop = useShop$1();
|
|
545
535
|
const order = useOrder();
|
|
546
536
|
const api = useApi$1();
|
|
537
|
+
const checkoutToken = useSubscription$1(api.checkoutToken);
|
|
547
538
|
return /* @__PURE__ */ jsx$1(GenericPayloadProvider, {
|
|
548
539
|
target,
|
|
549
540
|
payload: createGenericPayload({
|
|
550
|
-
buyerPhone,
|
|
551
|
-
buyerEmail,
|
|
552
|
-
customer,
|
|
553
|
-
shippingAddress,
|
|
554
|
-
billingAddress,
|
|
541
|
+
buyerPhone: shopify.buyerIdentity?.phone.value,
|
|
542
|
+
buyerEmail: shopify.buyerIdentity?.email.value,
|
|
543
|
+
customer: shopify.buyerIdentity?.customer.value,
|
|
544
|
+
shippingAddress: shopify.shippingAddress?.value,
|
|
545
|
+
billingAddress: shopify.billingAddress?.value,
|
|
555
546
|
totalAmount,
|
|
556
547
|
cartLines,
|
|
557
|
-
checkoutToken
|
|
548
|
+
checkoutToken,
|
|
558
549
|
discountCodes,
|
|
559
550
|
shopGid: shop.id,
|
|
560
551
|
extensionTarget: api.extension.target
|
|
@@ -577,13 +568,12 @@ const EXTENSION_TARGETS = {
|
|
|
577
568
|
"purchase.thank-you.block.render": PAYLOAD_MANAGER_TARGET.THANK_YOU,
|
|
578
569
|
"customer-account.order-status.block.render": PAYLOAD_MANAGER_TARGET.ORDER_STATUS
|
|
579
570
|
};
|
|
580
|
-
const getExtensionTarget = () => globalThis.shopify?.extension?.target;
|
|
581
571
|
const PayloadManager = ({ children }) => {
|
|
582
|
-
const extensionTarget =
|
|
583
|
-
const target =
|
|
572
|
+
const extensionTarget = shopify.extension.target;
|
|
573
|
+
const target = EXTENSION_TARGETS[extensionTarget];
|
|
584
574
|
if (target === PAYLOAD_MANAGER_TARGET.THANK_YOU) return /* @__PURE__ */ jsx$1(ThankYouPayloadManager, { children });
|
|
585
575
|
if (target === PAYLOAD_MANAGER_TARGET.ORDER_STATUS) return /* @__PURE__ */ jsx$1(OrderStatusPayloadManager, { children });
|
|
586
|
-
throw new Error(`[Disco]: Unsupported extension target ${extensionTarget
|
|
576
|
+
throw new Error(`[Disco]: Unsupported extension target ${extensionTarget}`);
|
|
587
577
|
};
|
|
588
578
|
//#endregion
|
|
589
579
|
//#region src/managers/UserManager.tsx
|
|
@@ -4917,4 +4907,4 @@ function OrderSubmitter({ trackingTicketId, idempotencyKey, insertionId }) {
|
|
|
4917
4907
|
//#endregion
|
|
4918
4908
|
export { DiscoRecommendations as a, PrepurchaseIncentive as i, PrepurchaseThankYou as n, Recommendations as o, DiscoPrepurchaseIncentive as r, DiscoPrepurchaseThankYou as t };
|
|
4919
4909
|
|
|
4920
|
-
//# sourceMappingURL=DiscoPrepurchaseThankYou-
|
|
4910
|
+
//# sourceMappingURL=DiscoPrepurchaseThankYou-Cu3yyFVs.js.map
|