@disconetwork/shopify 0.0.9 → 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.
@@ -1,12 +1,12 @@
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$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, usePhone, usePurchasingCompany, useShippingAddress, useShop, useSubscription, useSubtotalAmount, useTotalAmount } from "@shopify/ui-extensions/checkout/preact";
9
- import { useApi as useApi$1, useBillingAddress as useBillingAddress$1, useCartLines as useCartLines$1, useCustomer as useCustomer$1, useDiscountCodes as useDiscountCodes$1, useEmail as useEmail$1, useOrder, usePhone as usePhone$1, usePurchasingCompany as usePurchasingCompany$1, useShippingAddress as useShippingAddress$1, useShop as useShop$1, useSubscription as useSubscription$1, useTotalAmount as useTotalAmount$1 } from "@shopify/ui-extensions/customer-account/preact";
7
+ import { Fragment as Fragment$2, jsx as jsx$1, jsxs } from "preact/jsx-runtime";
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
@@ -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.9"
364
+ version: "0.0.11"
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: useSubscription$1(api.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 = getExtensionTarget();
583
- const target = extensionTarget && EXTENSION_TARGETS[extensionTarget];
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 ?? "(none)"}`);
576
+ throw new Error(`[Disco]: Unsupported extension target ${extensionTarget}`);
587
577
  };
588
578
  //#endregion
589
579
  //#region src/managers/UserManager.tsx
@@ -854,15 +844,19 @@ const LinkGenerator = { link: ({ node, nodesToJSX }) => {
854
844
  } };
855
845
  //#endregion
856
846
  //#region src/components/Essential/generation/ParagraphGenerator.tsx
857
- const ParagraphGenerator = { paragraph: ({ node, nodesToJSX }) => {
847
+ const createParagraphGenerator = ({ strong }) => ({ paragraph: ({ node, nodesToJSX }) => {
848
+ const children = nodesToJSX({ nodes: node.children });
858
849
  return /* @__PURE__ */ jsx$1("s-paragraph", {
859
850
  color: "subdued",
860
- children: /* @__PURE__ */ jsx$1("s-text", {
851
+ children: strong ? /* @__PURE__ */ jsx$1("s-text", {
861
852
  type: "strong",
862
- children: nodesToJSX({ nodes: node.children })
863
- })
853
+ children
854
+ }) : children
864
855
  });
865
- } };
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 });
866
860
  //#endregion
867
861
  //#region src/components/Essential/generation/ScrollViewGenerator.tsx
868
862
  const DEFAULT_MAX_BLOCK_SIZE = 300;
@@ -874,11 +868,14 @@ const ScrollViewGenerator = { scrollview: ({ node, nodesToJSX }) => {
874
868
  });
875
869
  } };
876
870
  //#endregion
871
+ //#region src/components/Essential/generation/TextGenerator.tsx
872
+ const TextGenerator = { text: ({ node }) => {
873
+ return node.text;
874
+ } };
875
+ //#endregion
877
876
  //#region src/components/Essential/EssentialOfferContent.tsx
878
- const renderers = {
879
- text: ({ node }) => {
880
- return node.text;
881
- },
877
+ const renderers$1 = {
878
+ ...TextGenerator,
882
879
  ...LinkGenerator,
883
880
  ...ParagraphGenerator,
884
881
  ...ScrollViewGenerator
@@ -888,7 +885,7 @@ const EssentialOfferContent = ({ heading: offerHeading, subheading: offerSubhead
888
885
  gap: "small-200",
889
886
  children: [/* @__PURE__ */ jsx$1("s-heading", { children: offerHeading }), /* @__PURE__ */ jsx$1(ScreensRenderer, {
890
887
  jsonContent: incentiveJson,
891
- renderers,
888
+ renderers: renderers$1,
892
889
  fallback: /* @__PURE__ */ jsx$1("s-paragraph", {
893
890
  color: "subdued",
894
891
  children: /* @__PURE__ */ jsx$1("s-text", {
@@ -913,7 +910,7 @@ const EssentialLayoutType = ({ onLastOffer, compact }) => {
913
910
  display: "@container (inline-size > 450px) none, auto",
914
911
  children: /* @__PURE__ */ jsx$1("s-stack", {
915
912
  alignItems: "center",
916
- children: /* @__PURE__ */ jsx$1(AdvertiserLogo, { recommendation })
913
+ children: /* @__PURE__ */ jsx$1(AdvertiserLogo$1, { recommendation })
917
914
  })
918
915
  }),
919
916
  isFirstOffer && !compact && /* @__PURE__ */ jsx$1(FirstOfferHeading, {}),
@@ -940,14 +937,14 @@ const EssentialLayoutType = ({ onLastOffer, compact }) => {
940
937
  })]
941
938
  }), renderBrandLogo && /* @__PURE__ */ jsx$1("s-box", {
942
939
  display: "@container (inline-size > 450px) auto, none",
943
- children: /* @__PURE__ */ jsx$1(AdvertiserLogo, { recommendation })
940
+ children: /* @__PURE__ */ jsx$1(AdvertiserLogo$1, { recommendation })
944
941
  })]
945
942
  })
946
943
  ]
947
944
  })
948
945
  }) });
949
946
  };
950
- function AdvertiserLogo({ recommendation }) {
947
+ function AdvertiserLogo$1({ recommendation }) {
951
948
  const { advertiser } = recommendation;
952
949
  const env = useDiscoEnv();
953
950
  const imageSize = 140;
@@ -1419,6 +1416,281 @@ const TrackedEssentialLayout = ({ onLastOffer }) => {
1419
1416
  return /* @__PURE__ */ jsx$1(EssentialLayoutType, { onLastOffer });
1420
1417
  };
1421
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
1422
1694
  //#region src/components/RecommendationsWidget/LeadGen/LeadGenHeader.tsx
1423
1695
  const LeadGenHeader = () => {
1424
1696
  const { claimedOffers } = useHeroOffer();
@@ -1728,7 +2000,7 @@ function LeadGenActionOffer() {
1728
2000
  const { activeRecommendation, isOfferClaimed } = useHeroOffer();
1729
2001
  const { heading, subheading, metadata } = activeRecommendation.offer;
1730
2002
  const primaryHeading = isOfferClaimed ? `You've got ${heading}` : heading;
1731
- const secondaryHeading = isOfferClaimed && metadata.type === "PROMO_CODE" ? /* @__PURE__ */ jsxs(Fragment$1, { children: ["Use code: ", /* @__PURE__ */ jsx$1("s-text", {
2003
+ const secondaryHeading = isOfferClaimed && metadata.type === "PROMO_CODE" ? /* @__PURE__ */ jsxs(Fragment$2, { children: ["Use code: ", /* @__PURE__ */ jsx$1("s-text", {
1732
2004
  type: "strong",
1733
2005
  children: metadata.code
1734
2006
  })] }) : subheading || "On your next purchase";
@@ -1804,6 +2076,10 @@ const Widget = () => {
1804
2076
  heroRecommendationGroup,
1805
2077
  scrollableRecommendationGroup
1806
2078
  });
2079
+ if (layoutId === "SHOPIFY_NATIVE_ESSENTIAL_0.3") {
2080
+ if (!heroRecommendationGroup) return null;
2081
+ return /* @__PURE__ */ jsx$1(EssentialListRecommendationsWidget, { heroRecommendationGroup });
2082
+ }
1807
2083
  if (layoutId === "SHOPIFY_NATIVE_COVER") {
1808
2084
  if (!heroRecommendationGroup) return null;
1809
2085
  return /* @__PURE__ */ jsx$1(CoverRecommendationsWidget, { heroRecommendationGroup });
@@ -2218,7 +2494,7 @@ function PortableText({ value: input, components: componentOverrides, listNestin
2218
2494
  let handleMissingComponent = missingComponentHandler || noop, blocks;
2219
2495
  blocks = Array.isArray(input) ? input : input == null ? [] : [input];
2220
2496
  let nested = nestLists(blocks, listNestingMode || "html"), components = useMemo$1(() => componentOverrides ? mergeComponents(defaultComponents, componentOverrides) : defaultComponents, [componentOverrides]), renderNode = useMemo$1(() => getNodeRenderer(components, handleMissingComponent), [components, handleMissingComponent]);
2221
- return /* @__PURE__ */ jsx(Fragment, { children: nested.map((node, index) => renderNode({
2497
+ return /* @__PURE__ */ jsx(Fragment$1, { children: nested.map((node, index) => renderNode({
2222
2498
  node,
2223
2499
  index,
2224
2500
  isInline: !1,
@@ -2827,7 +3103,7 @@ function OptInYesNoRadios({ label, optInLabel, checked, onToggle }) {
2827
3103
  * is worse than the layout this variant is measured against.
2828
3104
  */
2829
3105
  function WithPartnerLogo({ source, children, format = "square", logoWidth }) {
2830
- if (!source) return /* @__PURE__ */ jsx$1(Fragment$1, { children });
3106
+ if (!source) return /* @__PURE__ */ jsx$1(Fragment$2, { children });
2831
3107
  const aspectRatio = format === "wordmark" ? "5/2" : "1";
2832
3108
  return /* @__PURE__ */ jsxs("s-grid", {
2833
3109
  gridTemplateColumns: typeof logoWidth === "object" ? `@container (inline-size > ${logoWidth.containerAbove}) 1fr ${logoWidth.wide}, 1fr ${logoWidth.narrow}` : `minmax(0, 1fr) ${logoWidth ?? (format === "wordmark" ? "128px" : "48px")}`,
@@ -2946,7 +3222,7 @@ function OptInError({ message }) {
2946
3222
  function TotalCashBack({ total, earned }) {
2947
3223
  const tone = earned ? "success" : void 0;
2948
3224
  const color = earned ? void 0 : "subdued";
2949
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx$1("s-divider", {}), /* @__PURE__ */ jsxs("s-grid", {
3225
+ return /* @__PURE__ */ jsxs(Fragment$2, { children: [/* @__PURE__ */ jsx$1("s-divider", {}), /* @__PURE__ */ jsxs("s-grid", {
2950
3226
  gridTemplateColumns: "1fr auto",
2951
3227
  alignItems: "center",
2952
3228
  children: [/* @__PURE__ */ jsxs("s-stack", {
@@ -3182,7 +3458,7 @@ function InlineRadioConfirmationWidget(props) {
3182
3458
  return /* @__PURE__ */ jsxs("s-stack", {
3183
3459
  gap: "small-200",
3184
3460
  children: [
3185
- checked ? /* @__PURE__ */ jsx$1(OptInConfirmation, { label: addedLabel }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx$1(RewardHeading, { label: rewardLabel }), /* @__PURE__ */ jsx$1(OptInYesNoChoice, {
3461
+ checked ? /* @__PURE__ */ jsx$1(OptInConfirmation, { label: addedLabel }) : /* @__PURE__ */ jsxs(Fragment$2, { children: [/* @__PURE__ */ jsx$1(RewardHeading, { label: rewardLabel }), /* @__PURE__ */ jsx$1(OptInYesNoChoice, {
3186
3462
  label: rewardLabel,
3187
3463
  optInLabel: optInChoiceLabel,
3188
3464
  onOptIn: () => onToggle(true)
@@ -3312,7 +3588,7 @@ function InlineRadioConfirmationUndoWidget(props) {
3312
3588
  return /* @__PURE__ */ jsxs("s-stack", {
3313
3589
  gap: "small-200",
3314
3590
  children: [
3315
- checked ? /* @__PURE__ */ jsx$1(OptInConfirmation, { label: addedLabel }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx$1(RewardHeading, { label: rewardLabel }), /* @__PURE__ */ jsx$1(OptInYesNoChoice, {
3591
+ checked ? /* @__PURE__ */ jsx$1(OptInConfirmation, { label: addedLabel }) : /* @__PURE__ */ jsxs(Fragment$2, { children: [/* @__PURE__ */ jsx$1(RewardHeading, { label: rewardLabel }), /* @__PURE__ */ jsx$1(OptInYesNoChoice, {
3316
3592
  label: rewardLabel,
3317
3593
  optInLabel: optInChoiceLabel,
3318
3594
  onOptIn: () => onToggle(true)
@@ -4917,4 +5193,4 @@ function OrderSubmitter({ trackingTicketId, idempotencyKey, insertionId }) {
4917
5193
  //#endregion
4918
5194
  export { DiscoRecommendations as a, PrepurchaseIncentive as i, PrepurchaseThankYou as n, Recommendations as o, DiscoPrepurchaseIncentive as r, DiscoPrepurchaseThankYou as t };
4919
5195
 
4920
- //# sourceMappingURL=DiscoPrepurchaseThankYou-COYkyyEU.js.map
5196
+ //# sourceMappingURL=DiscoPrepurchaseThankYou-3hTT7PYy.js.map