@disconetwork/shopify 0.0.10 → 0.0.11
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-Cu3yyFVs.js → DiscoPrepurchaseThankYou-3hTT7PYy.js} +313 -27
- package/dist/DiscoPrepurchaseThankYou-3hTT7PYy.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/internal.js +1 -1
- package/package.json +3 -3
- package/dist/DiscoPrepurchaseThankYou-Cu3yyFVs.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useCallback, useContext, useEffect, useMemo, useRef, useState } from "preact/hooks";
|
|
2
|
-
import { createContext, createElement } from "preact";
|
|
2
|
+
import { Fragment, createContext, createElement } from "preact";
|
|
3
3
|
import { cloneElement, createContext as createContext$1, createElement as createElement$1, isValidElement, useCallback as useCallback$1, useContext as useContext$1, useEffect as useEffect$1, useMemo as useMemo$1, useState as useState$1 } from "preact/compat";
|
|
4
4
|
import { withImpressionDedupe } from "@disconetwork/core";
|
|
5
|
-
import { Fragment, jsx } from "preact/jsx-runtime";
|
|
5
|
+
import { Fragment as Fragment$1, jsx } from "preact/jsx-runtime";
|
|
6
6
|
import { INTERNAL_BASE_URL, InternalDiscoClient, parseScreens } from "@disconetwork/core/internal";
|
|
7
|
-
import { Fragment as Fragment$
|
|
7
|
+
import { Fragment as Fragment$2, jsx as jsx$1, jsxs } from "preact/jsx-runtime";
|
|
8
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
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";
|
|
@@ -289,7 +289,7 @@ const CardContainer = ({ children, ...rest }) => {
|
|
|
289
289
|
};
|
|
290
290
|
//#endregion
|
|
291
291
|
//#region src/components/RecommendationsWidget/RecommendationsWidgetSkeleton.tsx
|
|
292
|
-
const WIDE = "@container (inline-size > 450px)";
|
|
292
|
+
const WIDE$1 = "@container (inline-size > 450px)";
|
|
293
293
|
const TILE_COUNT = 4;
|
|
294
294
|
const Block = ({ blockSize }) => /* @__PURE__ */ jsx$1("s-box", {
|
|
295
295
|
blockSize,
|
|
@@ -309,10 +309,10 @@ const HeroOfferSkeleton = () => /* @__PURE__ */ jsx$1("s-box", {
|
|
|
309
309
|
gap: "small-200",
|
|
310
310
|
children: [/* @__PURE__ */ jsx$1("s-skeleton-paragraph", { content: "Exclusive offer from a brand you'll love" }), /* @__PURE__ */ jsx$1("s-skeleton-paragraph", { content: "Get a special discount on your next order" })]
|
|
311
311
|
}), /* @__PURE__ */ jsx$1("s-stack", {
|
|
312
|
-
direction: `${WIDE} inline, block`,
|
|
312
|
+
direction: `${WIDE$1} inline, block`,
|
|
313
313
|
gap: "base",
|
|
314
314
|
children: [0, 1].map((index) => /* @__PURE__ */ jsx$1("s-box", {
|
|
315
|
-
inlineSize: `${WIDE} 160px, 100%`,
|
|
315
|
+
inlineSize: `${WIDE$1} 160px, 100%`,
|
|
316
316
|
children: /* @__PURE__ */ jsx$1(Block, { blockSize: "44px" })
|
|
317
317
|
}, index))
|
|
318
318
|
})]
|
|
@@ -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.11"
|
|
365
365
|
};
|
|
366
366
|
//#endregion
|
|
367
367
|
//#region ../react-shared/dist/sdk-internals.js
|
|
@@ -844,15 +844,19 @@ const LinkGenerator = { link: ({ node, nodesToJSX }) => {
|
|
|
844
844
|
} };
|
|
845
845
|
//#endregion
|
|
846
846
|
//#region src/components/Essential/generation/ParagraphGenerator.tsx
|
|
847
|
-
const
|
|
847
|
+
const createParagraphGenerator = ({ strong }) => ({ paragraph: ({ node, nodesToJSX }) => {
|
|
848
|
+
const children = nodesToJSX({ nodes: node.children });
|
|
848
849
|
return /* @__PURE__ */ jsx$1("s-paragraph", {
|
|
849
850
|
color: "subdued",
|
|
850
|
-
children: /* @__PURE__ */ jsx$1("s-text", {
|
|
851
|
+
children: strong ? /* @__PURE__ */ jsx$1("s-text", {
|
|
851
852
|
type: "strong",
|
|
852
|
-
children
|
|
853
|
-
})
|
|
853
|
+
children
|
|
854
|
+
}) : children
|
|
854
855
|
});
|
|
855
|
-
} };
|
|
856
|
+
} });
|
|
857
|
+
const ParagraphGenerator = createParagraphGenerator({ strong: true });
|
|
858
|
+
/** Regular-weight paragraphs, for layouts where the offer body is secondary copy. */
|
|
859
|
+
const PlainParagraphGenerator = createParagraphGenerator({ strong: false });
|
|
856
860
|
//#endregion
|
|
857
861
|
//#region src/components/Essential/generation/ScrollViewGenerator.tsx
|
|
858
862
|
const DEFAULT_MAX_BLOCK_SIZE = 300;
|
|
@@ -864,11 +868,14 @@ const ScrollViewGenerator = { scrollview: ({ node, nodesToJSX }) => {
|
|
|
864
868
|
});
|
|
865
869
|
} };
|
|
866
870
|
//#endregion
|
|
871
|
+
//#region src/components/Essential/generation/TextGenerator.tsx
|
|
872
|
+
const TextGenerator = { text: ({ node }) => {
|
|
873
|
+
return node.text;
|
|
874
|
+
} };
|
|
875
|
+
//#endregion
|
|
867
876
|
//#region src/components/Essential/EssentialOfferContent.tsx
|
|
868
|
-
const renderers = {
|
|
869
|
-
|
|
870
|
-
return node.text;
|
|
871
|
-
},
|
|
877
|
+
const renderers$1 = {
|
|
878
|
+
...TextGenerator,
|
|
872
879
|
...LinkGenerator,
|
|
873
880
|
...ParagraphGenerator,
|
|
874
881
|
...ScrollViewGenerator
|
|
@@ -878,7 +885,7 @@ const EssentialOfferContent = ({ heading: offerHeading, subheading: offerSubhead
|
|
|
878
885
|
gap: "small-200",
|
|
879
886
|
children: [/* @__PURE__ */ jsx$1("s-heading", { children: offerHeading }), /* @__PURE__ */ jsx$1(ScreensRenderer, {
|
|
880
887
|
jsonContent: incentiveJson,
|
|
881
|
-
renderers,
|
|
888
|
+
renderers: renderers$1,
|
|
882
889
|
fallback: /* @__PURE__ */ jsx$1("s-paragraph", {
|
|
883
890
|
color: "subdued",
|
|
884
891
|
children: /* @__PURE__ */ jsx$1("s-text", {
|
|
@@ -903,7 +910,7 @@ const EssentialLayoutType = ({ onLastOffer, compact }) => {
|
|
|
903
910
|
display: "@container (inline-size > 450px) none, auto",
|
|
904
911
|
children: /* @__PURE__ */ jsx$1("s-stack", {
|
|
905
912
|
alignItems: "center",
|
|
906
|
-
children: /* @__PURE__ */ jsx$1(AdvertiserLogo, { recommendation })
|
|
913
|
+
children: /* @__PURE__ */ jsx$1(AdvertiserLogo$1, { recommendation })
|
|
907
914
|
})
|
|
908
915
|
}),
|
|
909
916
|
isFirstOffer && !compact && /* @__PURE__ */ jsx$1(FirstOfferHeading, {}),
|
|
@@ -930,14 +937,14 @@ const EssentialLayoutType = ({ onLastOffer, compact }) => {
|
|
|
930
937
|
})]
|
|
931
938
|
}), renderBrandLogo && /* @__PURE__ */ jsx$1("s-box", {
|
|
932
939
|
display: "@container (inline-size > 450px) auto, none",
|
|
933
|
-
children: /* @__PURE__ */ jsx$1(AdvertiserLogo, { recommendation })
|
|
940
|
+
children: /* @__PURE__ */ jsx$1(AdvertiserLogo$1, { recommendation })
|
|
934
941
|
})]
|
|
935
942
|
})
|
|
936
943
|
]
|
|
937
944
|
})
|
|
938
945
|
}) });
|
|
939
946
|
};
|
|
940
|
-
function AdvertiserLogo({ recommendation }) {
|
|
947
|
+
function AdvertiserLogo$1({ recommendation }) {
|
|
941
948
|
const { advertiser } = recommendation;
|
|
942
949
|
const env = useDiscoEnv();
|
|
943
950
|
const imageSize = 140;
|
|
@@ -1409,6 +1416,281 @@ const TrackedEssentialLayout = ({ onLastOffer }) => {
|
|
|
1409
1416
|
return /* @__PURE__ */ jsx$1(EssentialLayoutType, { onLastOffer });
|
|
1410
1417
|
};
|
|
1411
1418
|
//#endregion
|
|
1419
|
+
//#region src/components/RecommendationsWidget/EssentialList/EssentialListOfferBody.tsx
|
|
1420
|
+
const renderers = {
|
|
1421
|
+
...TextGenerator,
|
|
1422
|
+
...LinkGenerator,
|
|
1423
|
+
...PlainParagraphGenerator,
|
|
1424
|
+
...ScrollViewGenerator
|
|
1425
|
+
};
|
|
1426
|
+
/**
|
|
1427
|
+
* The offer's rich `jsonContent` in regular-weight, subdued paragraphs, or
|
|
1428
|
+
* `fallback` when the offer has none.
|
|
1429
|
+
*
|
|
1430
|
+
* The content sits in its own stack because switching screens (an internal
|
|
1431
|
+
* link) replaces every node in it, and the checkout host can append the
|
|
1432
|
+
* replacements to the end of their parent. Without a parent of their own they
|
|
1433
|
+
* would land after the CTA that follows the body on narrow containers.
|
|
1434
|
+
*/
|
|
1435
|
+
const EssentialListOfferBody = ({ jsonContent, fallback }) => /* @__PURE__ */ jsx$1("s-stack", {
|
|
1436
|
+
gap: "small-200",
|
|
1437
|
+
children: /* @__PURE__ */ jsx$1(ScreensRenderer, {
|
|
1438
|
+
jsonContent,
|
|
1439
|
+
renderers,
|
|
1440
|
+
fallback
|
|
1441
|
+
})
|
|
1442
|
+
});
|
|
1443
|
+
/** Container query prefix for the wide (side-by-side CTA) row layout. */
|
|
1444
|
+
const WIDE = "@container (inline-size > 450px)";
|
|
1445
|
+
//#endregion
|
|
1446
|
+
//#region src/components/RecommendationsWidget/EssentialList/EssentialListOfferRow.tsx
|
|
1447
|
+
const LOGO_SIZE = 56;
|
|
1448
|
+
/**
|
|
1449
|
+
* One offer in the list: brand logo, brand name, offer heading and body, and
|
|
1450
|
+
* a CTA that sits beside the copy on wide containers and below it on narrow
|
|
1451
|
+
* ones.
|
|
1452
|
+
*/
|
|
1453
|
+
const EssentialListOfferRow = ({ recommendation }) => {
|
|
1454
|
+
const { track } = useEventTracker$1();
|
|
1455
|
+
const { offer, advertiser, insertionId } = recommendation;
|
|
1456
|
+
useEffect(() => {
|
|
1457
|
+
track({
|
|
1458
|
+
type: "BRAND_DISPLAY",
|
|
1459
|
+
target: "INLINE_SLOT",
|
|
1460
|
+
brand: {
|
|
1461
|
+
offerId: offer.id,
|
|
1462
|
+
advertiserId: advertiser.id,
|
|
1463
|
+
insertionId
|
|
1464
|
+
}
|
|
1465
|
+
});
|
|
1466
|
+
}, [
|
|
1467
|
+
track,
|
|
1468
|
+
insertionId,
|
|
1469
|
+
offer.id,
|
|
1470
|
+
advertiser.id
|
|
1471
|
+
]);
|
|
1472
|
+
return /* @__PURE__ */ jsxs("s-grid", {
|
|
1473
|
+
gridTemplateColumns: `${WIDE} ${LOGO_SIZE}px 1fr auto, ${LOGO_SIZE}px 1fr`,
|
|
1474
|
+
gap: "base",
|
|
1475
|
+
alignItems: "start",
|
|
1476
|
+
children: [
|
|
1477
|
+
/* @__PURE__ */ jsx$1(AdvertiserLogo, { recommendation }),
|
|
1478
|
+
/* @__PURE__ */ jsxs("s-stack", {
|
|
1479
|
+
gap: "small-200",
|
|
1480
|
+
children: [
|
|
1481
|
+
/* @__PURE__ */ jsxs("s-stack", {
|
|
1482
|
+
gap: "none",
|
|
1483
|
+
children: [/* @__PURE__ */ jsx$1("s-text", {
|
|
1484
|
+
color: "subdued",
|
|
1485
|
+
children: advertiser.name
|
|
1486
|
+
}), /* @__PURE__ */ jsx$1("s-heading", { children: offer.heading })]
|
|
1487
|
+
}),
|
|
1488
|
+
/* @__PURE__ */ jsx$1(EssentialListOfferBody, {
|
|
1489
|
+
jsonContent: offer.jsonContent,
|
|
1490
|
+
fallback: /* @__PURE__ */ jsx$1(OfferBodyFallback, { recommendation })
|
|
1491
|
+
}),
|
|
1492
|
+
/* @__PURE__ */ jsx$1("s-box", {
|
|
1493
|
+
display: `${WIDE} none, auto`,
|
|
1494
|
+
children: /* @__PURE__ */ jsx$1(OfferCta, {
|
|
1495
|
+
recommendation,
|
|
1496
|
+
inlineSize: "fill"
|
|
1497
|
+
})
|
|
1498
|
+
})
|
|
1499
|
+
]
|
|
1500
|
+
}),
|
|
1501
|
+
/* @__PURE__ */ jsx$1("s-box", {
|
|
1502
|
+
display: `${WIDE} auto, none`,
|
|
1503
|
+
children: /* @__PURE__ */ jsx$1(OfferCta, {
|
|
1504
|
+
recommendation,
|
|
1505
|
+
inlineSize: "auto"
|
|
1506
|
+
})
|
|
1507
|
+
})
|
|
1508
|
+
]
|
|
1509
|
+
});
|
|
1510
|
+
};
|
|
1511
|
+
/** Subheading plus the disclosure link, for offers without `jsonContent`. */
|
|
1512
|
+
function OfferBodyFallback({ recommendation }) {
|
|
1513
|
+
const { subheading, disclosureDetails } = recommendation.offer;
|
|
1514
|
+
const disclosureUrl = disclosureDetails?.targetUrl;
|
|
1515
|
+
return /* @__PURE__ */ jsxs("s-stack", {
|
|
1516
|
+
gap: "small-200",
|
|
1517
|
+
children: [subheading && /* @__PURE__ */ jsx$1("s-paragraph", {
|
|
1518
|
+
color: "subdued",
|
|
1519
|
+
children: subheading
|
|
1520
|
+
}), disclosureDetails && disclosureUrl && /* @__PURE__ */ jsx$1("s-text", {
|
|
1521
|
+
color: "subdued",
|
|
1522
|
+
children: /* @__PURE__ */ jsx$1("s-link", {
|
|
1523
|
+
href: disclosureUrl,
|
|
1524
|
+
target: "_blank",
|
|
1525
|
+
tone: "neutral",
|
|
1526
|
+
children: disclosureDetails.copy
|
|
1527
|
+
})
|
|
1528
|
+
})]
|
|
1529
|
+
});
|
|
1530
|
+
}
|
|
1531
|
+
function OfferCta({ recommendation, inlineSize }) {
|
|
1532
|
+
const { track } = useEventTracker$1();
|
|
1533
|
+
const { offer, advertiser, insertionId } = recommendation;
|
|
1534
|
+
const handleClick = () => {
|
|
1535
|
+
track({
|
|
1536
|
+
type: "BRAND_CLICK",
|
|
1537
|
+
target: "INLINE_ACTION_BUTTON",
|
|
1538
|
+
brand: {
|
|
1539
|
+
offerId: offer.id,
|
|
1540
|
+
advertiserId: advertiser.id,
|
|
1541
|
+
insertionId
|
|
1542
|
+
}
|
|
1543
|
+
});
|
|
1544
|
+
};
|
|
1545
|
+
return /* @__PURE__ */ jsx$1("s-button", {
|
|
1546
|
+
href: offer.targetUrl,
|
|
1547
|
+
target: "_blank",
|
|
1548
|
+
variant: "secondary",
|
|
1549
|
+
inlineSize,
|
|
1550
|
+
onClick: handleClick,
|
|
1551
|
+
children: /* @__PURE__ */ jsxs("s-stack", {
|
|
1552
|
+
direction: "inline",
|
|
1553
|
+
gap: "small-300",
|
|
1554
|
+
alignItems: "center",
|
|
1555
|
+
children: [offer.ctaDetails.acceptCopy, /* @__PURE__ */ jsx$1("s-icon", { type: "external" })]
|
|
1556
|
+
})
|
|
1557
|
+
});
|
|
1558
|
+
}
|
|
1559
|
+
function AdvertiserLogo({ recommendation }) {
|
|
1560
|
+
const { advertiser } = recommendation;
|
|
1561
|
+
const env = useDiscoEnv();
|
|
1562
|
+
const image = getImageSources(advertiser.logoUrl, {
|
|
1563
|
+
env,
|
|
1564
|
+
size: LOGO_SIZE * 2
|
|
1565
|
+
});
|
|
1566
|
+
return /* @__PURE__ */ jsx$1("s-box", {
|
|
1567
|
+
inlineSize: `${LOGO_SIZE}px`,
|
|
1568
|
+
blockSize: `${LOGO_SIZE}px`,
|
|
1569
|
+
border: "base",
|
|
1570
|
+
borderRadius: "base",
|
|
1571
|
+
overflow: "hidden",
|
|
1572
|
+
children: /* @__PURE__ */ jsx$1("s-image", {
|
|
1573
|
+
aspectRatio: "1",
|
|
1574
|
+
objectFit: "contain",
|
|
1575
|
+
src: image.src,
|
|
1576
|
+
srcSet: image.srcSet,
|
|
1577
|
+
alt: `${advertiser.name} logo`,
|
|
1578
|
+
inlineSize: "fill"
|
|
1579
|
+
})
|
|
1580
|
+
});
|
|
1581
|
+
}
|
|
1582
|
+
//#endregion
|
|
1583
|
+
//#region src/components/RecommendationsWidget/EssentialList/EssentialListPager.tsx
|
|
1584
|
+
const EssentialListPager = ({ page, pageCount, onPrevious, onNext }) => {
|
|
1585
|
+
if (pageCount <= 1) return null;
|
|
1586
|
+
const isFirstPage = page === 0;
|
|
1587
|
+
const isLastPage = page === pageCount - 1;
|
|
1588
|
+
return /* @__PURE__ */ jsxs("s-stack", {
|
|
1589
|
+
direction: "inline",
|
|
1590
|
+
alignItems: "center",
|
|
1591
|
+
gap: "small-200",
|
|
1592
|
+
children: [
|
|
1593
|
+
/* @__PURE__ */ jsx$1(PagerButton, {
|
|
1594
|
+
icon: "chevron-left",
|
|
1595
|
+
label: "Previous offers",
|
|
1596
|
+
disabled: isFirstPage,
|
|
1597
|
+
onClick: onPrevious
|
|
1598
|
+
}),
|
|
1599
|
+
/* @__PURE__ */ jsx$1("s-text", {
|
|
1600
|
+
color: "subdued",
|
|
1601
|
+
children: `${page + 1} / ${pageCount}`
|
|
1602
|
+
}),
|
|
1603
|
+
/* @__PURE__ */ jsx$1(PagerButton, {
|
|
1604
|
+
icon: "chevron-right",
|
|
1605
|
+
label: "Next offers",
|
|
1606
|
+
disabled: isLastPage,
|
|
1607
|
+
onClick: onNext
|
|
1608
|
+
})
|
|
1609
|
+
]
|
|
1610
|
+
});
|
|
1611
|
+
};
|
|
1612
|
+
function PagerButton({ icon, label, disabled, onClick }) {
|
|
1613
|
+
return /* @__PURE__ */ jsx$1("s-clickable", {
|
|
1614
|
+
accessibilityLabel: label,
|
|
1615
|
+
disabled,
|
|
1616
|
+
inlineSize: "32px",
|
|
1617
|
+
blockSize: "32px",
|
|
1618
|
+
borderRadius: "base",
|
|
1619
|
+
onClick,
|
|
1620
|
+
children: /* @__PURE__ */ jsx$1("s-stack", {
|
|
1621
|
+
blockSize: "100%",
|
|
1622
|
+
alignItems: "center",
|
|
1623
|
+
justifyContent: "center",
|
|
1624
|
+
children: /* @__PURE__ */ jsx$1("s-icon", {
|
|
1625
|
+
type: icon,
|
|
1626
|
+
size: "small",
|
|
1627
|
+
tone: disabled ? "neutral" : "auto"
|
|
1628
|
+
})
|
|
1629
|
+
})
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
//#endregion
|
|
1633
|
+
//#region src/components/RecommendationsWidget/EssentialList/index.tsx
|
|
1634
|
+
/**
|
|
1635
|
+
* Essential list layout: the hero offers stacked as rows, a page at a time,
|
|
1636
|
+
* with a pager beside the heading.
|
|
1637
|
+
*/
|
|
1638
|
+
const EssentialListRecommendationsWidget = ({ heroRecommendationGroup }) => {
|
|
1639
|
+
const { track } = useEventTracker$1();
|
|
1640
|
+
const [page, setPage] = useState(0);
|
|
1641
|
+
useEffect(() => {
|
|
1642
|
+
track({ type: "WIDGET_LOAD" });
|
|
1643
|
+
track({ type: "WIDGET_DISPLAY" });
|
|
1644
|
+
}, [track]);
|
|
1645
|
+
const { recommendations } = heroRecommendationGroup;
|
|
1646
|
+
const pageCount = Math.ceil(recommendations.length / 2);
|
|
1647
|
+
const currentPage = Math.min(page, Math.max(pageCount - 1, 0));
|
|
1648
|
+
const pageRecommendations = recommendations.slice(currentPage * 2, (currentPage + 1) * 2);
|
|
1649
|
+
const firstRecommendation = pageRecommendations[0];
|
|
1650
|
+
if (!firstRecommendation) return null;
|
|
1651
|
+
const goToPage = (nextPage) => {
|
|
1652
|
+
const { offer, advertiser, insertionId } = firstRecommendation;
|
|
1653
|
+
track({
|
|
1654
|
+
type: "ELEMENT_CLICK",
|
|
1655
|
+
target: nextPage > currentPage ? "EXPLICIT_NAV_FORWARD" : "EXPLICIT_NAV_BACKWARD",
|
|
1656
|
+
brand: {
|
|
1657
|
+
offerId: offer.id,
|
|
1658
|
+
advertiserId: advertiser.id,
|
|
1659
|
+
insertionId
|
|
1660
|
+
}
|
|
1661
|
+
});
|
|
1662
|
+
setPage(nextPage);
|
|
1663
|
+
};
|
|
1664
|
+
return /* @__PURE__ */ jsxs(CardContainer, {
|
|
1665
|
+
background: "base",
|
|
1666
|
+
children: [
|
|
1667
|
+
/* @__PURE__ */ jsx$1("s-query-container", { children: /* @__PURE__ */ jsxs("s-stack", {
|
|
1668
|
+
padding: "base",
|
|
1669
|
+
gap: "base",
|
|
1670
|
+
children: [/* @__PURE__ */ jsxs("s-grid", {
|
|
1671
|
+
gridTemplateColumns: "1fr auto",
|
|
1672
|
+
gap: "base",
|
|
1673
|
+
alignItems: "center",
|
|
1674
|
+
children: [/* @__PURE__ */ jsx$1("s-heading", { children: /* @__PURE__ */ jsx$1(EssentialListHeading, {}) }), /* @__PURE__ */ jsx$1(EssentialListPager, {
|
|
1675
|
+
page: currentPage,
|
|
1676
|
+
pageCount,
|
|
1677
|
+
onPrevious: () => goToPage(currentPage - 1),
|
|
1678
|
+
onNext: () => goToPage(currentPage + 1)
|
|
1679
|
+
})]
|
|
1680
|
+
}), pageRecommendations.map((recommendation) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx$1("s-divider", {}), /* @__PURE__ */ jsx$1(EssentialListOfferRow, { recommendation })] }, recommendation.id))]
|
|
1681
|
+
}) }),
|
|
1682
|
+
/* @__PURE__ */ jsx$1("s-divider", {}),
|
|
1683
|
+
/* @__PURE__ */ jsx$1(Footer, {})
|
|
1684
|
+
]
|
|
1685
|
+
});
|
|
1686
|
+
};
|
|
1687
|
+
function EssentialListHeading() {
|
|
1688
|
+
const { user } = useIdentity();
|
|
1689
|
+
const { applyCustomizationOrFallback } = useRecommendationsCustomization();
|
|
1690
|
+
const firstName = user?.extrapolatedFirstName;
|
|
1691
|
+
return applyCustomizationOrFallback("widget_heading", firstName ? `${firstName}, you’ve unlocked exclusive offers.` : "You’ve unlocked exclusive offers.");
|
|
1692
|
+
}
|
|
1693
|
+
//#endregion
|
|
1412
1694
|
//#region src/components/RecommendationsWidget/LeadGen/LeadGenHeader.tsx
|
|
1413
1695
|
const LeadGenHeader = () => {
|
|
1414
1696
|
const { claimedOffers } = useHeroOffer();
|
|
@@ -1718,7 +2000,7 @@ function LeadGenActionOffer() {
|
|
|
1718
2000
|
const { activeRecommendation, isOfferClaimed } = useHeroOffer();
|
|
1719
2001
|
const { heading, subheading, metadata } = activeRecommendation.offer;
|
|
1720
2002
|
const primaryHeading = isOfferClaimed ? `You've got ${heading}` : heading;
|
|
1721
|
-
const secondaryHeading = isOfferClaimed && metadata.type === "PROMO_CODE" ? /* @__PURE__ */ jsxs(Fragment$
|
|
2003
|
+
const secondaryHeading = isOfferClaimed && metadata.type === "PROMO_CODE" ? /* @__PURE__ */ jsxs(Fragment$2, { children: ["Use code: ", /* @__PURE__ */ jsx$1("s-text", {
|
|
1722
2004
|
type: "strong",
|
|
1723
2005
|
children: metadata.code
|
|
1724
2006
|
})] }) : subheading || "On your next purchase";
|
|
@@ -1794,6 +2076,10 @@ const Widget = () => {
|
|
|
1794
2076
|
heroRecommendationGroup,
|
|
1795
2077
|
scrollableRecommendationGroup
|
|
1796
2078
|
});
|
|
2079
|
+
if (layoutId === "SHOPIFY_NATIVE_ESSENTIAL_0.3") {
|
|
2080
|
+
if (!heroRecommendationGroup) return null;
|
|
2081
|
+
return /* @__PURE__ */ jsx$1(EssentialListRecommendationsWidget, { heroRecommendationGroup });
|
|
2082
|
+
}
|
|
1797
2083
|
if (layoutId === "SHOPIFY_NATIVE_COVER") {
|
|
1798
2084
|
if (!heroRecommendationGroup) return null;
|
|
1799
2085
|
return /* @__PURE__ */ jsx$1(CoverRecommendationsWidget, { heroRecommendationGroup });
|
|
@@ -2208,7 +2494,7 @@ function PortableText({ value: input, components: componentOverrides, listNestin
|
|
|
2208
2494
|
let handleMissingComponent = missingComponentHandler || noop, blocks;
|
|
2209
2495
|
blocks = Array.isArray(input) ? input : input == null ? [] : [input];
|
|
2210
2496
|
let nested = nestLists(blocks, listNestingMode || "html"), components = useMemo$1(() => componentOverrides ? mergeComponents(defaultComponents, componentOverrides) : defaultComponents, [componentOverrides]), renderNode = useMemo$1(() => getNodeRenderer(components, handleMissingComponent), [components, handleMissingComponent]);
|
|
2211
|
-
return /* @__PURE__ */ jsx(Fragment, { children: nested.map((node, index) => renderNode({
|
|
2497
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: nested.map((node, index) => renderNode({
|
|
2212
2498
|
node,
|
|
2213
2499
|
index,
|
|
2214
2500
|
isInline: !1,
|
|
@@ -2817,7 +3103,7 @@ function OptInYesNoRadios({ label, optInLabel, checked, onToggle }) {
|
|
|
2817
3103
|
* is worse than the layout this variant is measured against.
|
|
2818
3104
|
*/
|
|
2819
3105
|
function WithPartnerLogo({ source, children, format = "square", logoWidth }) {
|
|
2820
|
-
if (!source) return /* @__PURE__ */ jsx$1(Fragment$
|
|
3106
|
+
if (!source) return /* @__PURE__ */ jsx$1(Fragment$2, { children });
|
|
2821
3107
|
const aspectRatio = format === "wordmark" ? "5/2" : "1";
|
|
2822
3108
|
return /* @__PURE__ */ jsxs("s-grid", {
|
|
2823
3109
|
gridTemplateColumns: typeof logoWidth === "object" ? `@container (inline-size > ${logoWidth.containerAbove}) 1fr ${logoWidth.wide}, 1fr ${logoWidth.narrow}` : `minmax(0, 1fr) ${logoWidth ?? (format === "wordmark" ? "128px" : "48px")}`,
|
|
@@ -2936,7 +3222,7 @@ function OptInError({ message }) {
|
|
|
2936
3222
|
function TotalCashBack({ total, earned }) {
|
|
2937
3223
|
const tone = earned ? "success" : void 0;
|
|
2938
3224
|
const color = earned ? void 0 : "subdued";
|
|
2939
|
-
return /* @__PURE__ */ jsxs(Fragment$
|
|
3225
|
+
return /* @__PURE__ */ jsxs(Fragment$2, { children: [/* @__PURE__ */ jsx$1("s-divider", {}), /* @__PURE__ */ jsxs("s-grid", {
|
|
2940
3226
|
gridTemplateColumns: "1fr auto",
|
|
2941
3227
|
alignItems: "center",
|
|
2942
3228
|
children: [/* @__PURE__ */ jsxs("s-stack", {
|
|
@@ -3172,7 +3458,7 @@ function InlineRadioConfirmationWidget(props) {
|
|
|
3172
3458
|
return /* @__PURE__ */ jsxs("s-stack", {
|
|
3173
3459
|
gap: "small-200",
|
|
3174
3460
|
children: [
|
|
3175
|
-
checked ? /* @__PURE__ */ jsx$1(OptInConfirmation, { label: addedLabel }) : /* @__PURE__ */ jsxs(Fragment$
|
|
3461
|
+
checked ? /* @__PURE__ */ jsx$1(OptInConfirmation, { label: addedLabel }) : /* @__PURE__ */ jsxs(Fragment$2, { children: [/* @__PURE__ */ jsx$1(RewardHeading, { label: rewardLabel }), /* @__PURE__ */ jsx$1(OptInYesNoChoice, {
|
|
3176
3462
|
label: rewardLabel,
|
|
3177
3463
|
optInLabel: optInChoiceLabel,
|
|
3178
3464
|
onOptIn: () => onToggle(true)
|
|
@@ -3302,7 +3588,7 @@ function InlineRadioConfirmationUndoWidget(props) {
|
|
|
3302
3588
|
return /* @__PURE__ */ jsxs("s-stack", {
|
|
3303
3589
|
gap: "small-200",
|
|
3304
3590
|
children: [
|
|
3305
|
-
checked ? /* @__PURE__ */ jsx$1(OptInConfirmation, { label: addedLabel }) : /* @__PURE__ */ jsxs(Fragment$
|
|
3591
|
+
checked ? /* @__PURE__ */ jsx$1(OptInConfirmation, { label: addedLabel }) : /* @__PURE__ */ jsxs(Fragment$2, { children: [/* @__PURE__ */ jsx$1(RewardHeading, { label: rewardLabel }), /* @__PURE__ */ jsx$1(OptInYesNoChoice, {
|
|
3306
3592
|
label: rewardLabel,
|
|
3307
3593
|
optInLabel: optInChoiceLabel,
|
|
3308
3594
|
onOptIn: () => onToggle(true)
|
|
@@ -4907,4 +5193,4 @@ function OrderSubmitter({ trackingTicketId, idempotencyKey, insertionId }) {
|
|
|
4907
5193
|
//#endregion
|
|
4908
5194
|
export { DiscoRecommendations as a, PrepurchaseIncentive as i, PrepurchaseThankYou as n, Recommendations as o, DiscoPrepurchaseIncentive as r, DiscoPrepurchaseThankYou as t };
|
|
4909
5195
|
|
|
4910
|
-
//# sourceMappingURL=DiscoPrepurchaseThankYou-
|
|
5196
|
+
//# sourceMappingURL=DiscoPrepurchaseThankYou-3hTT7PYy.js.map
|