@rebuy/rebuy 2.27.0 → 2.28.0

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.
Files changed (58) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +1352 -366
  4. package/dist/index.js.map +4 -4
  5. package/dist/index.mjs +1351 -365
  6. package/dist/index.mjs.map +4 -4
  7. package/dist/schema/checkout-and-beyond/constants.js +1 -0
  8. package/dist/schema/checkout-and-beyond/constants.js.map +2 -2
  9. package/dist/schema/checkout-and-beyond/constants.mjs +1 -0
  10. package/dist/schema/checkout-and-beyond/constants.mjs.map +2 -2
  11. package/dist/schema/checkout-and-beyond/index.js +285 -92
  12. package/dist/schema/checkout-and-beyond/index.js.map +4 -4
  13. package/dist/schema/checkout-and-beyond/index.mjs +285 -92
  14. package/dist/schema/checkout-and-beyond/index.mjs.map +4 -4
  15. package/dist/schema/widget-data.js +165 -148
  16. package/dist/schema/widget-data.js.map +4 -4
  17. package/dist/schema/widget-data.mjs +165 -148
  18. package/dist/schema/widget-data.mjs.map +4 -4
  19. package/dist/schema/widgets/checkout-and-beyond/common.d.ts +2 -1
  20. package/dist/schema/widgets/checkout-and-beyond/common.d.ts.map +1 -1
  21. package/dist/schema/widgets/checkout-and-beyond/discount.d.ts +30 -0
  22. package/dist/schema/widgets/checkout-and-beyond/discount.d.ts.map +1 -0
  23. package/dist/schema/widgets/checkout-and-beyond/index.d.ts +2 -0
  24. package/dist/schema/widgets/checkout-and-beyond/index.d.ts.map +1 -1
  25. package/dist/schema/widgets/checkout-and-beyond/offerLabels.d.ts +178 -0
  26. package/dist/schema/widgets/checkout-and-beyond/offerLabels.d.ts.map +1 -0
  27. package/dist/schema/widgets/checkout-and-beyond/shared.d.ts +2 -1
  28. package/dist/schema/widgets/checkout-and-beyond/shared.d.ts.map +1 -1
  29. package/dist/schema/widgets/checkout-and-beyond/utils.d.ts +2 -0
  30. package/dist/schema/widgets/checkout-and-beyond/utils.d.ts.map +1 -1
  31. package/dist/server/dataSourceResults.d.ts +18 -0
  32. package/dist/server/dataSourceResults.d.ts.map +1 -0
  33. package/dist/server/index.d.ts +6 -2
  34. package/dist/server/index.d.ts.map +1 -1
  35. package/dist/server/index.js +1162 -435
  36. package/dist/server/index.js.map +4 -4
  37. package/dist/server/index.mjs +1161 -434
  38. package/dist/server/index.mjs.map +4 -4
  39. package/dist/server/userConfig.d.ts +8 -0
  40. package/dist/server/userConfig.d.ts.map +1 -0
  41. package/dist/server/widgetSettings.d.ts.map +1 -1
  42. package/dist/transforms/index.d.ts +4 -0
  43. package/dist/transforms/index.d.ts.map +1 -1
  44. package/dist/transforms/index.js +1004 -81
  45. package/dist/transforms/index.js.map +4 -4
  46. package/dist/transforms/index.mjs +1004 -81
  47. package/dist/transforms/index.mjs.map +4 -4
  48. package/dist/transforms/offerV1/buildOfferTemplate.d.ts +13 -0
  49. package/dist/transforms/offerV1/buildOfferTemplate.d.ts.map +1 -0
  50. package/dist/transforms/offerV1/convertOfferToV2.d.ts +18 -0
  51. package/dist/transforms/offerV1/convertOfferToV2.d.ts.map +1 -0
  52. package/dist/transforms/offerV1/offerCard.d.ts +17 -0
  53. package/dist/transforms/offerV1/offerCard.d.ts.map +1 -0
  54. package/dist/transforms/offerV1/offerTemplateSeed.d.ts +339 -0
  55. package/dist/transforms/offerV1/offerTemplateSeed.d.ts.map +1 -0
  56. package/dist/transforms/offerV1/types.d.ts +145 -0
  57. package/dist/transforms/offerV1/types.d.ts.map +1 -0
  58. package/package.json +1 -1
@@ -21,18 +21,23 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var transforms_exports = {};
22
22
  __export(transforms_exports, {
23
23
  CONTENT_BLOCK_MAX_IMAGE_WIDTH: () => CONTENT_BLOCK_MAX_IMAGE_WIDTH,
24
+ SHOPIFY_CHECKOUT_EXTENSION: () => SHOPIFY_CHECKOUT_EXTENSION,
24
25
  SHOPIFY_CHECKOUT_EXTENSION_CONTENT_BLOCK: () => SHOPIFY_CHECKOUT_EXTENSION_CONTENT_BLOCK,
26
+ buildOfferCard: () => buildOfferCard,
27
+ buildOfferTemplate: () => buildOfferTemplate,
25
28
  convertContentBlockImageToV2: () => convertContentBlockImageToV2,
26
29
  convertContentBlockTextToV2: () => convertContentBlockTextToV2,
27
30
  convertContentBlockToV2: () => convertContentBlockToV2,
28
31
  convertLineItemEditorToV2: () => convertLineItemEditorToV2,
29
32
  convertNumericObjects: () => convertNumericObjects,
33
+ convertOfferToV2: () => convertOfferToV2,
30
34
  convertTextToTiptapParagraph: () => convertTextToTiptapParagraph,
31
35
  deepCamelCase: () => deepCamelCase,
32
36
  htmlToTiptap: () => htmlToTiptap,
33
37
  isCABRootSection: () => isCABRootSection,
34
38
  isContentBlockV1: () => isContentBlockV1,
35
39
  isLineItemEditorV1: () => isLineItemEditorV1,
40
+ isOfferV1: () => isOfferV1,
36
41
  normalizeTextContent: () => normalizeTextContent,
37
42
  normalizeTokens: () => normalizeTokens,
38
43
  parseShielded: () => parseShielded
@@ -40,8 +45,8 @@ __export(transforms_exports, {
40
45
  module.exports = __toCommonJS(transforms_exports);
41
46
 
42
47
  // src/schema/widgets/checkout-and-beyond/image.ts
43
- var import_uuid12 = require("uuid");
44
- var import_v418 = require("zod/v4");
48
+ var import_uuid13 = require("uuid");
49
+ var import_v419 = require("zod/v4");
45
50
 
46
51
  // src/schema/widgets/checkout-and-beyond/common.ts
47
52
  var freezeEnum = (values) => Object.freeze(Object.fromEntries(values.map((v) => [v, v])));
@@ -161,6 +166,7 @@ var sectionTypes = [
161
166
  "carousel",
162
167
  "cartLine",
163
168
  "dataSource",
169
+ "discount",
164
170
  "image",
165
171
  "layout",
166
172
  "monetize",
@@ -262,7 +268,7 @@ var CABRule = import_v4.z.object({
262
268
  });
263
269
 
264
270
  // src/schema/widgets/checkout-and-beyond/shared.ts
265
- var import_v417 = require("zod/v4");
271
+ var import_v418 = require("zod/v4");
266
272
 
267
273
  // src/schema/widgets/checkout-and-beyond/banner.ts
268
274
  var import_v43 = require("zod/v4");
@@ -633,39 +639,54 @@ var CABCartLineSection = import_v411.z.lazy(
633
639
  })
634
640
  );
635
641
 
636
- // src/schema/widgets/checkout-and-beyond/monetize.ts
642
+ // src/schema/widgets/checkout-and-beyond/discount.ts
637
643
  var import_uuid7 = require("uuid");
638
644
  var import_v412 = require("zod/v4");
639
- var CABMonetizeSection = import_v412.z.object({
645
+ var CABDiscountSection = import_v412.z.object({
646
+ amount: import_v412.z.union([import_v412.z.number(), import_v412.z.string()]).catch(0),
647
+ discountedBy: import_v412.z.string().optional(),
648
+ discountedFrom: import_v412.z.enum(discountSources).optional().catch(void 0),
649
+ message: import_v412.z.string().optional(),
640
650
  name: import_v412.z.string().optional(),
641
- rule: CABRule.optional(),
651
+ quantity: import_v412.z.number().default(1),
642
652
  sectionId: import_v412.z.uuid().default(() => (0, import_uuid7.v7)()),
643
- sectionType: import_v412.z.literal(SectionType.monetize).default(SectionType.monetize)
653
+ sectionType: import_v412.z.literal(SectionType.discount).default(SectionType.discount),
654
+ type: import_v412.z.enum(discountTypes).catch("none")
644
655
  });
645
656
 
646
- // src/schema/widgets/checkout-and-beyond/progressBar.ts
657
+ // src/schema/widgets/checkout-and-beyond/monetize.ts
647
658
  var import_uuid8 = require("uuid");
648
659
  var import_v413 = require("zod/v4");
649
- var CABProgressBarSection = import_v413.z.object({
650
- /** Empty = shown everywhere; otherwise uppercase ISO country codes. */
651
- countryCodes: import_v413.z.array(import_v413.z.string()).default(() => []),
660
+ var CABMonetizeSection = import_v413.z.object({
652
661
  name: import_v413.z.string().optional(),
653
662
  rule: CABRule.optional(),
654
663
  sectionId: import_v413.z.uuid().default(() => (0, import_uuid8.v7)()),
655
- sections: import_v413.z.union([import_v413.z.array(CABTextSection), import_v413.z.strictObject({}).transform(() => [])]).default(() => []),
656
- sectionType: import_v413.z.literal(SectionType.progressBar).default(SectionType.progressBar)
664
+ sectionType: import_v413.z.literal(SectionType.monetize).default(SectionType.monetize)
657
665
  });
658
666
 
659
- // src/schema/widgets/checkout-and-beyond/quantity.ts
667
+ // src/schema/widgets/checkout-and-beyond/progressBar.ts
660
668
  var import_uuid9 = require("uuid");
661
669
  var import_v414 = require("zod/v4");
662
- var CABQuantitySection = import_v414.z.object({
663
- errorMessages: import_v414.z.record(
664
- import_v414.z.string(),
665
- import_v414.z.object({
666
- max: import_v414.z.string().optional(),
667
- min: import_v414.z.string().optional(),
668
- neg: import_v414.z.string().optional()
670
+ var CABProgressBarSection = import_v414.z.object({
671
+ /** Empty = shown everywhere; otherwise uppercase ISO country codes. */
672
+ countryCodes: import_v414.z.array(import_v414.z.string()).default(() => []),
673
+ name: import_v414.z.string().optional(),
674
+ rule: CABRule.optional(),
675
+ sectionId: import_v414.z.uuid().default(() => (0, import_uuid9.v7)()),
676
+ sections: import_v414.z.union([import_v414.z.array(CABTextSection), import_v414.z.strictObject({}).transform(() => [])]).default(() => []),
677
+ sectionType: import_v414.z.literal(SectionType.progressBar).default(SectionType.progressBar)
678
+ });
679
+
680
+ // src/schema/widgets/checkout-and-beyond/quantity.ts
681
+ var import_uuid10 = require("uuid");
682
+ var import_v415 = require("zod/v4");
683
+ var CABQuantitySection = import_v415.z.object({
684
+ errorMessages: import_v415.z.record(
685
+ import_v415.z.string(),
686
+ import_v415.z.object({
687
+ max: import_v415.z.string().optional(),
688
+ min: import_v415.z.string().optional(),
689
+ neg: import_v415.z.string().optional()
669
690
  })
670
691
  ).default({
671
692
  en: {
@@ -674,58 +695,59 @@ var CABQuantitySection = import_v414.z.object({
674
695
  neg: "Quantity cannot be negative"
675
696
  }
676
697
  }),
677
- inputType: import_v414.z.enum(quantityInputs).default(QuantityInput.select),
678
- max: import_v414.z.number().min(1).max(100).default(10),
679
- min: import_v414.z.number().min(1).default(1),
680
- name: import_v414.z.string().optional(),
681
- rule: CABRule.optional(),
682
- sectionId: import_v414.z.uuid().default(() => (0, import_uuid9.v7)()),
683
- sectionType: import_v414.z.literal(SectionType.quantity).default(SectionType.quantity)
684
- });
685
-
686
- // src/schema/widgets/checkout-and-beyond/reviews.ts
687
- var import_uuid10 = require("uuid");
688
- var import_v415 = require("zod/v4");
689
- var CABReviewsSection = import_v415.z.object({
690
- color: import_v415.z.string().default("#fadb14"),
698
+ inputType: import_v415.z.enum(quantityInputs).default(QuantityInput.select),
699
+ max: import_v415.z.number().min(1).max(100).default(10),
700
+ min: import_v415.z.number().min(1).default(1),
691
701
  name: import_v415.z.string().optional(),
692
702
  rule: CABRule.optional(),
693
703
  sectionId: import_v415.z.uuid().default(() => (0, import_uuid10.v7)()),
694
- sectionType: import_v415.z.literal(SectionType.reviews).default(SectionType.reviews),
695
- size: import_v415.z.enum(reviewsSizes).default(ReviewsSize.default)
704
+ sectionType: import_v415.z.literal(SectionType.quantity).default(SectionType.quantity)
696
705
  });
697
706
 
698
- // src/schema/widgets/checkout-and-beyond/variants.ts
699
- var import_compat3 = require("es-toolkit/compat");
707
+ // src/schema/widgets/checkout-and-beyond/reviews.ts
700
708
  var import_uuid11 = require("uuid");
701
709
  var import_v416 = require("zod/v4");
702
- var CABVariantsSection = import_v416.z.object({
703
- hideOutOfStockVariants: import_v416.z.boolean().default(false),
710
+ var CABReviewsSection = import_v416.z.object({
711
+ color: import_v416.z.string().default("#fadb14"),
704
712
  name: import_v416.z.string().optional(),
705
713
  rule: CABRule.optional(),
706
714
  sectionId: import_v416.z.uuid().default(() => (0, import_uuid11.v7)()),
707
- sectionType: import_v416.z.literal(SectionType.variants).default(SectionType.variants),
708
- selector: import_v416.z.enum((0, import_compat3.slice)(variantSelectors, 0, 3)).default(VariantSelector.menu),
709
- variantMode: import_v416.z.enum(variantModes).default(VariantMode.multiple)
715
+ sectionType: import_v416.z.literal(SectionType.reviews).default(SectionType.reviews),
716
+ size: import_v416.z.enum(reviewsSizes).default(ReviewsSize.default)
717
+ });
718
+
719
+ // src/schema/widgets/checkout-and-beyond/variants.ts
720
+ var import_compat3 = require("es-toolkit/compat");
721
+ var import_uuid12 = require("uuid");
722
+ var import_v417 = require("zod/v4");
723
+ var CABVariantsSection = import_v417.z.object({
724
+ hideOutOfStockVariants: import_v417.z.boolean().default(false),
725
+ name: import_v417.z.string().optional(),
726
+ rule: CABRule.optional(),
727
+ sectionId: import_v417.z.uuid().default(() => (0, import_uuid12.v7)()),
728
+ sectionType: import_v417.z.literal(SectionType.variants).default(SectionType.variants),
729
+ selector: import_v417.z.enum((0, import_compat3.slice)(variantSelectors, 0, 3)).default(VariantSelector.menu),
730
+ variantMode: import_v417.z.enum(variantModes).default(VariantMode.multiple)
710
731
  });
711
732
 
712
733
  // src/schema/widgets/checkout-and-beyond/shared.ts
713
- var CABBorder = import_v417.z.object({
714
- radius: import_v417.z.enum(borderRadii).default(BorderRadius.base),
715
- style: import_v417.z.enum(borderStyles).default(BorderStyle.none),
716
- width: import_v417.z.enum(borderWidths).default(BorderWidth.base)
734
+ var CABBorder = import_v418.z.object({
735
+ radius: import_v418.z.enum(borderRadii).default(BorderRadius.base),
736
+ style: import_v418.z.enum(borderStyles).default(BorderStyle.none),
737
+ width: import_v418.z.enum(borderWidths).default(BorderWidth.base)
717
738
  }).default({
718
739
  radius: BorderRadius.base,
719
740
  style: BorderStyle.none,
720
741
  width: BorderWidth.base
721
742
  });
722
- var CABSection = import_v417.z.lazy(
723
- () => import_v417.z.discriminatedUnion("sectionType", [
743
+ var CABSection = import_v418.z.lazy(
744
+ () => import_v418.z.discriminatedUnion("sectionType", [
724
745
  CABBannerSection,
725
746
  CABButtonSection,
726
747
  CABCarouselSection,
727
748
  CABCartLineSection,
728
749
  CABDataSourceSection,
750
+ CABDiscountSection,
729
751
  CABImageSection,
730
752
  CABLayoutSection,
731
753
  CABMonetizeSection,
@@ -741,25 +763,25 @@ var CABSection = import_v417.z.lazy(
741
763
  );
742
764
 
743
765
  // src/schema/widgets/checkout-and-beyond/image.ts
744
- var CABImageSection = import_v418.z.object({
745
- altText: import_v418.z.string().refine(checkForHTML, NO_HTML).default(""),
746
- aspectRatio: import_v418.z.literal(1).nullable().default(null),
747
- border: import_v418.z.lazy(() => CABBorder),
748
- buttonField: import_v418.z.enum(buttonFields).optional(),
749
- category: import_v418.z.enum(["gallery", "icons", "payment-methods", "secure-checkout"]).nullable().default(null),
750
- name: import_v418.z.string().optional(),
751
- naturalHeight: import_v418.z.number().default(0),
752
- naturalWidth: import_v418.z.number().default(0),
766
+ var CABImageSection = import_v419.z.object({
767
+ altText: import_v419.z.string().refine(checkForHTML, NO_HTML).default(""),
768
+ aspectRatio: import_v419.z.literal(1).nullable().default(null),
769
+ border: import_v419.z.lazy(() => CABBorder),
770
+ buttonField: import_v419.z.enum(buttonFields).optional(),
771
+ category: import_v419.z.enum(["gallery", "icons", "payment-methods", "secure-checkout"]).nullable().default(null),
772
+ name: import_v419.z.string().optional(),
773
+ naturalHeight: import_v419.z.number().default(0),
774
+ naturalWidth: import_v419.z.number().default(0),
753
775
  /**
754
776
  * `contain` (the component default): dimensionless images render in s-image's 1/1 default frame, and
755
777
  * `cover` would crop non-square art (payment badges lost their edges — 15993); `contain` letterboxes.
756
778
  */
757
- objectFit: import_v418.z.enum(objectFits).default(ObjectFit.contain),
779
+ objectFit: import_v419.z.enum(objectFits).default(ObjectFit.contain),
758
780
  rule: CABRule.optional(),
759
- sectionId: import_v418.z.uuid().default(() => (0, import_uuid12.v7)()),
760
- sectionType: import_v418.z.literal(SectionType.image).default(SectionType.image),
761
- source: import_v418.z.union([import_v418.z.url(), import_v418.z.literal(""), import_v418.z.string().regex(DYNAMIC_TOKEN_REGEX)]).default(""),
762
- width: import_v418.z.number().default(100)
781
+ sectionId: import_v419.z.uuid().default(() => (0, import_uuid13.v7)()),
782
+ sectionType: import_v419.z.literal(SectionType.image).default(SectionType.image),
783
+ source: import_v419.z.union([import_v419.z.url(), import_v419.z.literal(""), import_v419.z.string().regex(DYNAMIC_TOKEN_REGEX)]).default(""),
784
+ width: import_v419.z.number().default(100)
763
785
  });
764
786
 
765
787
  // src/transforms/contentBlockV1/stripContentBlockHtml.ts
@@ -878,28 +900,28 @@ var convertContentBlockTextToV2 = (language) => {
878
900
  };
879
901
 
880
902
  // src/schema/widgets/checkout-and-beyond/root.ts
881
- var import_v419 = require("zod/v4");
882
- var TargetArea = import_v419.z.object({
883
- fill: import_v419.z.boolean().optional(),
884
- flip: import_v419.z.enum(["both", "horizontal", "vertical"]).optional(),
885
- icon: import_v419.z.string(),
886
- label: import_v419.z.string(),
887
- width: import_v419.z.string()
903
+ var import_v420 = require("zod/v4");
904
+ var TargetArea = import_v420.z.object({
905
+ fill: import_v420.z.boolean().optional(),
906
+ flip: import_v420.z.enum(["both", "horizontal", "vertical"]).optional(),
907
+ icon: import_v420.z.string(),
908
+ label: import_v420.z.string(),
909
+ width: import_v420.z.string()
888
910
  }).default(targetAreas[EditorMode.checkoutExtension][1]);
889
- var CABTracking = import_v419.z.object({
890
- enableAttribution: import_v419.z.boolean().default(true),
891
- enableSource: import_v419.z.boolean().default(true),
892
- enableWidget: import_v419.z.boolean().default(true)
911
+ var CABTracking = import_v420.z.object({
912
+ enableAttribution: import_v420.z.boolean().default(true),
913
+ enableSource: import_v420.z.boolean().default(true),
914
+ enableWidget: import_v420.z.boolean().default(true)
893
915
  }).default({ enableAttribution: true, enableSource: true, enableWidget: true });
894
916
  var CABRootSection = CABLayoutSection.extend({
895
- editorMode: import_v419.z.enum(editorModes).default(EditorMode.checkoutExtension),
896
- previewMode: import_v419.z.boolean().default(false),
897
- storeId: import_v419.z.number().nullable().default(null),
917
+ editorMode: import_v420.z.enum(editorModes).default(EditorMode.checkoutExtension),
918
+ previewMode: import_v420.z.boolean().default(false),
919
+ storeId: import_v420.z.number().nullable().default(null),
898
920
  targetArea: TargetArea.nullable(),
899
921
  tracking: CABTracking,
900
- type: import_v419.z.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
901
- version: import_v419.z.literal(2).default(2),
902
- widgetId: import_v419.z.number().nullable().default(null)
922
+ type: import_v420.z.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
923
+ version: import_v420.z.literal(2).default(2),
924
+ widgetId: import_v420.z.number().nullable().default(null)
903
925
  });
904
926
 
905
927
  // src/transforms/contentBlockV1/convertContentBlockToV2.ts
@@ -1450,6 +1472,907 @@ var normalizeTextContent = (node) => {
1450
1472
  return node;
1451
1473
  };
1452
1474
 
1475
+ // src/transforms/offerV1/offerTemplateSeed.ts
1476
+ var OFFER_TEMPLATE_SEED = {
1477
+ alignment: {
1478
+ horizontal: "center",
1479
+ vertical: "top"
1480
+ },
1481
+ border: {
1482
+ radius: "base",
1483
+ style: "none",
1484
+ width: "thick"
1485
+ },
1486
+ direction: "rows",
1487
+ editorMode: "checkoutExtension",
1488
+ grid: {
1489
+ columns: ["auto"],
1490
+ rows: ["auto"]
1491
+ },
1492
+ padding: "tight",
1493
+ previewMode: false,
1494
+ sections: [
1495
+ {
1496
+ alignment: {
1497
+ horizontal: "end",
1498
+ vertical: "top"
1499
+ },
1500
+ autoAdvanceInterval: 0,
1501
+ border: {
1502
+ radius: "base",
1503
+ style: "none",
1504
+ width: "base"
1505
+ },
1506
+ direction: "rows",
1507
+ grid: {
1508
+ columns: ["auto"],
1509
+ rows: ["auto", "auto"]
1510
+ },
1511
+ itemsAtOnce: 2,
1512
+ padding: "none",
1513
+ sections: [
1514
+ {
1515
+ alignment: {
1516
+ horizontal: "start",
1517
+ vertical: "middle"
1518
+ },
1519
+ border: {
1520
+ radius: "base",
1521
+ style: "none",
1522
+ width: "base"
1523
+ },
1524
+ direction: "columns",
1525
+ grid: {
1526
+ columns: ["auto", "auto"],
1527
+ rows: ["auto"]
1528
+ },
1529
+ name: "pagination",
1530
+ padding: "none",
1531
+ sections: [
1532
+ {
1533
+ action: "goToPrevPage",
1534
+ buttonStyle: "plain",
1535
+ disableDowngrade: false,
1536
+ popover: {
1537
+ alignment: "center",
1538
+ position: "blockStart"
1539
+ },
1540
+ sections: [
1541
+ {
1542
+ buttonField: "buttonLabel",
1543
+ content: {
1544
+ ar: "\u2039",
1545
+ cs: "\u2039",
1546
+ da: "\u2039",
1547
+ de: "\u2039",
1548
+ en: "\u2039",
1549
+ es: "\u2039",
1550
+ fi: "\u2039",
1551
+ fr: "\u2039",
1552
+ ga: "\u2039",
1553
+ he: "\u2039",
1554
+ hi: "\u2039",
1555
+ id: "\u2039",
1556
+ it: "\u2039",
1557
+ ja: "\u2039",
1558
+ ko: "\u2039",
1559
+ nl: "\u2039",
1560
+ no: "\u2039",
1561
+ pl: "\u2039",
1562
+ pt: "\u2039",
1563
+ ru: "\u2039",
1564
+ sv: "\u2039",
1565
+ th: "\u2039",
1566
+ tr: "\u2039",
1567
+ uk: "\u2039",
1568
+ vi: "\u2039",
1569
+ zh: "\u2039"
1570
+ },
1571
+ sectionType: "text"
1572
+ }
1573
+ ],
1574
+ sectionType: "button"
1575
+ },
1576
+ {
1577
+ action: "goToNextPage",
1578
+ buttonStyle: "plain",
1579
+ disableDowngrade: false,
1580
+ popover: {
1581
+ alignment: "center",
1582
+ position: "blockStart"
1583
+ },
1584
+ sections: [
1585
+ {
1586
+ buttonField: "buttonLabel",
1587
+ content: {
1588
+ ar: "\u203A",
1589
+ cs: "\u203A",
1590
+ da: "\u203A",
1591
+ de: "\u203A",
1592
+ en: "\u203A",
1593
+ es: "\u203A",
1594
+ fi: "\u203A",
1595
+ fr: "\u203A",
1596
+ ga: "\u203A",
1597
+ he: "\u203A",
1598
+ hi: "\u203A",
1599
+ id: "\u203A",
1600
+ it: "\u203A",
1601
+ ja: "\u203A",
1602
+ ko: "\u203A",
1603
+ nl: "\u203A",
1604
+ no: "\u203A",
1605
+ pl: "\u203A",
1606
+ pt: "\u203A",
1607
+ ru: "\u203A",
1608
+ sv: "\u203A",
1609
+ th: "\u203A",
1610
+ tr: "\u203A",
1611
+ uk: "\u203A",
1612
+ vi: "\u203A",
1613
+ zh: "\u203A"
1614
+ },
1615
+ sectionType: "text"
1616
+ }
1617
+ ],
1618
+ sectionType: "button"
1619
+ }
1620
+ ],
1621
+ sectionType: "layout",
1622
+ spacing: "base",
1623
+ width: 100
1624
+ },
1625
+ {
1626
+ alignment: {
1627
+ horizontal: "start",
1628
+ vertical: "middle"
1629
+ },
1630
+ border: {
1631
+ radius: "base",
1632
+ style: "base",
1633
+ width: "base"
1634
+ },
1635
+ direction: "rows",
1636
+ grid: {
1637
+ columns: ["15%"],
1638
+ rows: ["auto", "auto"]
1639
+ },
1640
+ padding: "base",
1641
+ sections: [
1642
+ {
1643
+ alignment: {
1644
+ horizontal: "start",
1645
+ vertical: "middle"
1646
+ },
1647
+ border: {
1648
+ radius: "base",
1649
+ style: "none",
1650
+ width: "base"
1651
+ },
1652
+ direction: "grid",
1653
+ grid: {
1654
+ columns: ["15%", "fill", "auto"],
1655
+ rows: ["auto"]
1656
+ },
1657
+ padding: "none",
1658
+ sections: [
1659
+ {
1660
+ altText: "",
1661
+ aspectRatio: null,
1662
+ border: {
1663
+ radius: "base",
1664
+ style: "none",
1665
+ width: "base"
1666
+ },
1667
+ category: null,
1668
+ name: "Product Image",
1669
+ naturalHeight: 0,
1670
+ naturalWidth: 0,
1671
+ objectFit: "cover",
1672
+ sectionType: "image",
1673
+ source: "{{productImage}}",
1674
+ width: 100
1675
+ },
1676
+ {
1677
+ content: {
1678
+ en: {
1679
+ attrs: {
1680
+ blockSpacing: "none"
1681
+ },
1682
+ content: [
1683
+ {
1684
+ attrs: {
1685
+ textAlign: "start"
1686
+ },
1687
+ content: [
1688
+ {
1689
+ marks: [
1690
+ {
1691
+ attrs: {
1692
+ color: "base",
1693
+ fontSize: "medium"
1694
+ },
1695
+ type: "textStyle"
1696
+ },
1697
+ {
1698
+ type: "bold"
1699
+ }
1700
+ ],
1701
+ text: "{{productAndVariantTitle}}",
1702
+ type: "text"
1703
+ }
1704
+ ],
1705
+ type: "paragraph"
1706
+ },
1707
+ {
1708
+ attrs: {
1709
+ textAlign: "start"
1710
+ },
1711
+ content: [
1712
+ {
1713
+ marks: [
1714
+ {
1715
+ attrs: {
1716
+ color: "accent",
1717
+ fontSize: "medium"
1718
+ },
1719
+ type: "textStyle"
1720
+ }
1721
+ ],
1722
+ text: "{{variantPrice}}",
1723
+ type: "text"
1724
+ }
1725
+ ],
1726
+ type: "paragraph"
1727
+ }
1728
+ ],
1729
+ type: "doc"
1730
+ }
1731
+ },
1732
+ name: "Product Info",
1733
+ sectionType: "text"
1734
+ },
1735
+ {
1736
+ action: "addToOrder",
1737
+ buttonStyle: "primary",
1738
+ disableDowngrade: false,
1739
+ popover: {
1740
+ alignment: "center",
1741
+ position: "blockStart"
1742
+ },
1743
+ sections: [
1744
+ {
1745
+ buttonField: "addingToCart",
1746
+ content: {
1747
+ ar: "\u064A\u062A\u0645 \u0627\u0644\u0625\u0636\u0627\u0641\u0629 \u0625\u0644\u0649 \u0627\u0644\u0633\u0644\u0629",
1748
+ cs: "P\u0159id\xE1v\xE1m do ko\u0161\xEDku",
1749
+ da: "Tilf\xF8jer til kurv",
1750
+ de: "Wird zum Warenkorb hinzugef\xFCgt",
1751
+ en: "Adding...",
1752
+ es: "Agregando al carrito",
1753
+ fi: "Lis\xE4t\xE4\xE4n ostoskoriin",
1754
+ fr: "Ajout au panier",
1755
+ ga: "\xC1 Chur le Cairt",
1756
+ he: "\u05DE\u05D5\u05E1\u05D9\u05E3 \u05DC\u05E2\u05D2\u05DC\u05D4",
1757
+ hi: "\u0915\u093E\u0930\u094D\u091F \u092E\u0947\u0902 \u091C\u094B\u0921\u093C \u0930\u0939\u0947 \u0939\u0948\u0902",
1758
+ id: "Menambahkan ke Keranjang",
1759
+ it: "Aggiungendo al carrello",
1760
+ ja: "\u30AB\u30FC\u30C8\u306B\u8FFD\u52A0\u4E2D",
1761
+ ko: "\uC7A5\uBC14\uAD6C\uB2C8\uC5D0 \uCD94\uAC00 \uC911",
1762
+ nl: "Toevoegen aan winkelwagen",
1763
+ no: "Legger i handlekurv",
1764
+ pl: "Dodaj\u0119 do koszyka",
1765
+ pt: "Adicionando ao carrinho",
1766
+ ru: "\u0414\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0443",
1767
+ sv: "L\xE4gger till i varukorg",
1768
+ th: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E25\u0E07\u0E43\u0E19\u0E23\u0E16\u0E40\u0E02\u0E47\u0E19",
1769
+ tr: "Sepete Ekleniyor",
1770
+ uk: "\u0414\u043E\u0434\u0430\u0454\u043C\u043E \u0434\u043E \u043A\u043E\u0448\u0438\u043A\u0430",
1771
+ vi: "\u0110ang th\xEAm v\xE0o gi\u1ECF h\xE0ng",
1772
+ zh: "\u6B63\u5728\u52A0\u5165\u8D2D\u7269\u8F66"
1773
+ },
1774
+ sectionType: "text"
1775
+ },
1776
+ {
1777
+ buttonField: "addToCart",
1778
+ content: {
1779
+ ar: "\u0623\u0636\u0641 \u0625\u0644\u0649 \u0627\u0644\u0633\u0644\u0629",
1780
+ cs: "P\u0159idat do ko\u0161\xEDku",
1781
+ da: "F\xF8j til kurv",
1782
+ de: "In den Warenkorb",
1783
+ en: "Add",
1784
+ es: "Agregar al carrito",
1785
+ fi: "Lis\xE4\xE4 ostoskoriin",
1786
+ fr: "Ajouter au panier",
1787
+ ga: "Cuir le Cairt",
1788
+ he: "\u05D4\u05D5\u05E1\u05E3 \u05DC\u05E2\u05D2\u05DC\u05D4",
1789
+ hi: "\u0915\u093E\u0930\u094D\u091F \u092E\u0947\u0902 \u091C\u094B\u0921\u093C\u0947\u0902",
1790
+ id: "Tambah ke Keranjang",
1791
+ it: "Aggiungi al carrello",
1792
+ ja: "\u30AB\u30FC\u30C8\u306B\u8FFD\u52A0",
1793
+ ko: "\uC7A5\uBC14\uAD6C\uB2C8\uC5D0 \uCD94\uAC00",
1794
+ nl: "Toevoegen aan winkelwagen",
1795
+ no: "Legg i handlekurv",
1796
+ pl: "Dodaj do koszyka",
1797
+ pt: "Adicionar ao carrinho",
1798
+ ru: "\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0443",
1799
+ sv: "L\xE4gg i varukorg",
1800
+ th: "\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E25\u0E07\u0E43\u0E19\u0E23\u0E16\u0E40\u0E02\u0E47\u0E19",
1801
+ tr: "Sepete Ekle",
1802
+ uk: "\u0414\u043E\u0434\u0430\u0442\u0438 \u0434\u043E \u043A\u043E\u0448\u0438\u043A\u0430",
1803
+ vi: "Th\xEAm v\xE0o gi\u1ECF h\xE0ng",
1804
+ zh: "\u52A0\u5165\u8D2D\u7269\u8F66"
1805
+ },
1806
+ sectionType: "text"
1807
+ }
1808
+ ],
1809
+ sectionType: "button"
1810
+ }
1811
+ ],
1812
+ sectionType: "layout",
1813
+ spacing: "base",
1814
+ width: 100
1815
+ },
1816
+ {
1817
+ alignment: {
1818
+ horizontal: "start",
1819
+ vertical: "top"
1820
+ },
1821
+ border: {
1822
+ radius: "base",
1823
+ style: "none",
1824
+ width: "base"
1825
+ },
1826
+ direction: "rows",
1827
+ grid: {
1828
+ columns: ["auto"],
1829
+ rows: ["auto"]
1830
+ },
1831
+ padding: "none",
1832
+ sections: [
1833
+ {
1834
+ errorMessages: {
1835
+ en: {
1836
+ max: "Maximum quantity allowed is {{max}}",
1837
+ min: "Minimum quantity required is {{min}}",
1838
+ neg: "Quantity cannot be negative"
1839
+ }
1840
+ },
1841
+ inputType: "select",
1842
+ max: 10,
1843
+ min: 1,
1844
+ sectionType: "quantity"
1845
+ }
1846
+ ],
1847
+ sectionType: "layout",
1848
+ spacing: "base",
1849
+ width: 100
1850
+ },
1851
+ {
1852
+ limit: 3,
1853
+ sectionType: "dataSource"
1854
+ },
1855
+ {
1856
+ sectionType: "products"
1857
+ }
1858
+ ],
1859
+ sectionType: "offers",
1860
+ spacing: "base",
1861
+ width: 100
1862
+ }
1863
+ ],
1864
+ sectionType: "carousel",
1865
+ spacing: "base",
1866
+ width: 100
1867
+ }
1868
+ ],
1869
+ sectionType: "layout",
1870
+ spacing: "base",
1871
+ targetArea: {
1872
+ icon: "splitscreen_left",
1873
+ label: "Main Column",
1874
+ width: "503px"
1875
+ },
1876
+ type: "shopify_checkout_extension",
1877
+ version: 2,
1878
+ width: 100
1879
+ };
1880
+
1881
+ // src/transforms/offerV1/types.ts
1882
+ var SHOPIFY_CHECKOUT_EXTENSION = "shopify_checkout_extension";
1883
+ var isOfferV1 = (data) => {
1884
+ if (!data || typeof data !== "object") return false;
1885
+ return data.type === SHOPIFY_CHECKOUT_EXTENSION;
1886
+ };
1887
+
1888
+ // src/transforms/offerV1/buildOfferTemplate.ts
1889
+ var LOCATION_TO_EDITOR_MODE2 = {
1890
+ checkout: "checkoutExtension",
1891
+ "order-status": "orderStatusPage",
1892
+ "thank-you": "thankYouPage"
1893
+ };
1894
+ var buildOfferTemplate = ({ location, name } = {}) => CABRootSection.parse({
1895
+ ...OFFER_TEMPLATE_SEED,
1896
+ editorMode: LOCATION_TO_EDITOR_MODE2[location ?? "checkout"],
1897
+ ...name && { name },
1898
+ previewMode: false,
1899
+ type: SHOPIFY_CHECKOUT_EXTENSION
1900
+ });
1901
+
1902
+ // src/schema/widgets/checkout-and-beyond/offerLabels.ts
1903
+ var OFFER_LABELS = {
1904
+ addToCart: {
1905
+ ar: "\u0623\u0636\u0641 \u0625\u0644\u0649 \u0627\u0644\u0633\u0644\u0629",
1906
+ cs: "P\u0159idat do ko\u0161\xEDku",
1907
+ da: "L\xE6g i kurv",
1908
+ de: "In den Warenkorb",
1909
+ en: "Add to cart",
1910
+ es: "A\xF1adir al carrito",
1911
+ fi: "Lis\xE4\xE4 ostoskoriin",
1912
+ fr: "Ajouter au panier",
1913
+ ga: "Cuir sa chairt",
1914
+ he: "\u05D4\u05D5\u05E1\u05E3 \u05DC\u05E2\u05D2\u05DC\u05D4",
1915
+ hi: "\u0915\u093E\u0930\u094D\u091F \u092E\u0947\u0902 \u091C\u094B\u0921\u093C\u0947\u0902",
1916
+ id: "Tambahkan ke keranjang",
1917
+ it: "Aggiungi al carrello",
1918
+ ja: "\u30AB\u30FC\u30C8\u306B\u8FFD\u52A0",
1919
+ ko: "\uC7A5\uBC14\uAD6C\uB2C8\uC5D0 \uCD94\uAC00",
1920
+ nl: "In winkelwagen",
1921
+ no: "Legg i handlekurven",
1922
+ pl: "Dodaj do koszyka",
1923
+ pt: "Adicionar ao carrinho",
1924
+ ru: "\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0443",
1925
+ sv: "L\xE4gg i varukorgen",
1926
+ th: "\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E25\u0E07\u0E15\u0E30\u0E01\u0E23\u0E49\u0E32",
1927
+ tr: "Sepete ekle",
1928
+ uk: "\u0414\u043E\u0434\u0430\u0442\u0438 \u0432 \u043A\u043E\u0448\u0438\u043A",
1929
+ vi: "Th\xEAm v\xE0o gi\u1ECF h\xE0ng",
1930
+ zh: "\u52A0\u5165\u8D2D\u7269\u8F66"
1931
+ },
1932
+ addedToCart: {
1933
+ ar: "\u062A\u0645\u062A \u0627\u0644\u0625\u0636\u0627\u0641\u0629!",
1934
+ cs: "P\u0159id\xE1no!",
1935
+ da: "Tilf\xF8jet!",
1936
+ de: "Hinzugef\xFCgt!",
1937
+ en: "Added!",
1938
+ es: "\xA1A\xF1adido!",
1939
+ fi: "Lis\xE4tty!",
1940
+ fr: "Ajout\xE9 !",
1941
+ ga: "Curtha leis!",
1942
+ he: "\u05E0\u05D5\u05E1\u05E3!",
1943
+ hi: "\u091C\u094B\u0921\u093C\u093E \u0917\u092F\u093E!",
1944
+ id: "Ditambahkan!",
1945
+ it: "Aggiunto!",
1946
+ ja: "\u8FFD\u52A0\u3057\u307E\u3057\u305F\uFF01",
1947
+ ko: "\uCD94\uAC00\uB428!",
1948
+ nl: "Toegevoegd!",
1949
+ no: "Lagt til!",
1950
+ pl: "Dodano!",
1951
+ pt: "Adicionado!",
1952
+ ru: "\u0414\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u043E!",
1953
+ sv: "Tillagd!",
1954
+ th: "\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E41\u0E25\u0E49\u0E27!",
1955
+ tr: "Eklendi!",
1956
+ uk: "\u0414\u043E\u0434\u0430\u043D\u043E!",
1957
+ vi: "\u0110\xE3 th\xEAm!",
1958
+ zh: "\u5DF2\u6DFB\u52A0\uFF01"
1959
+ },
1960
+ addedToCartMessage: {
1961
+ ar: "\u062A\u0645\u062A \u0625\u0636\u0627\u0641\u0629 {{quantity}} {{productTitle}} \u0625\u0644\u0649 \u0627\u0644\u0633\u0644\u0629.",
1962
+ cs: "{{quantity}} {{productTitle}} p\u0159id\xE1no do ko\u0161\xEDku.",
1963
+ da: "{{quantity}} {{productTitle}} lagt i kurven.",
1964
+ de: "{{quantity}} {{productTitle}} zum Warenkorb hinzugef\xFCgt.",
1965
+ en: "{{quantity}} {{productTitle}} added to cart.",
1966
+ es: "{{quantity}} {{productTitle}} a\xF1adido al carrito.",
1967
+ fi: "{{quantity}} {{productTitle}} lis\xE4tty ostoskoriin.",
1968
+ fr: "{{quantity}} {{productTitle}} ajout\xE9 au panier.",
1969
+ ga: "Cuireadh {{quantity}} {{productTitle}} sa chairt.",
1970
+ he: "{{quantity}} {{productTitle}} \u05E0\u05D5\u05E1\u05E3 \u05DC\u05E2\u05D2\u05DC\u05D4.",
1971
+ hi: "{{quantity}} {{productTitle}} \u0915\u093E\u0930\u094D\u091F \u092E\u0947\u0902 \u091C\u094B\u0921\u093C\u093E \u0917\u092F\u093E\u0964",
1972
+ id: "{{quantity}} {{productTitle}} ditambahkan ke keranjang.",
1973
+ it: "{{quantity}} {{productTitle}} aggiunto al carrello.",
1974
+ ja: "{{quantity}} {{productTitle}}\u3092\u30AB\u30FC\u30C8\u306B\u8FFD\u52A0\u3057\u307E\u3057\u305F\u3002",
1975
+ ko: "{{quantity}} {{productTitle}}\uC774(\uAC00) \uC7A5\uBC14\uAD6C\uB2C8\uC5D0 \uCD94\uAC00\uB418\uC5C8\uC2B5\uB2C8\uB2E4.",
1976
+ nl: "{{quantity}} {{productTitle}} toegevoegd aan winkelwagen.",
1977
+ no: "{{quantity}} {{productTitle}} lagt i handlekurven.",
1978
+ pl: "{{quantity}} {{productTitle}} dodano do koszyka.",
1979
+ pt: "{{quantity}} {{productTitle}} adicionado ao carrinho.",
1980
+ ru: "{{quantity}} {{productTitle}} \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u043E \u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0443.",
1981
+ sv: "{{quantity}} {{productTitle}} har lagts i varukorgen.",
1982
+ th: "\u0E40\u0E1E\u0E34\u0E48\u0E21 {{quantity}} {{productTitle}} \u0E25\u0E07\u0E15\u0E30\u0E01\u0E23\u0E49\u0E32\u0E41\u0E25\u0E49\u0E27",
1983
+ tr: "{{quantity}} {{productTitle}} sepete eklendi.",
1984
+ uk: "{{quantity}} {{productTitle}} \u0434\u043E\u0434\u0430\u043D\u043E \u0434\u043E \u043A\u043E\u0448\u0438\u043A\u0430.",
1985
+ vi: "\u0110\xE3 th\xEAm {{quantity}} {{productTitle}} v\xE0o gi\u1ECF h\xE0ng.",
1986
+ zh: "{{quantity}} {{productTitle}} \u5DF2\u52A0\u5165\u8D2D\u7269\u8F66\u3002"
1987
+ },
1988
+ addingToCart: {
1989
+ ar: "\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0636\u0627\u0641\u0629...",
1990
+ cs: "P\u0159id\xE1v\xE1n\xED...",
1991
+ da: "Tilf\xF8jer...",
1992
+ de: "Wird hinzugef\xFCgt...",
1993
+ en: "Adding...",
1994
+ es: "A\xF1adiendo...",
1995
+ fi: "Lis\xE4t\xE4\xE4n...",
1996
+ fr: "Ajout en cours...",
1997
+ ga: "\xC1 chur leis...",
1998
+ he: "\u05DE\u05D5\u05E1\u05D9\u05E3...",
1999
+ hi: "\u091C\u094B\u0921\u093C\u093E \u091C\u093E \u0930\u0939\u093E \u0939\u0948...",
2000
+ id: "Menambahkan...",
2001
+ it: "Aggiunta in corso...",
2002
+ ja: "\u8FFD\u52A0\u4E2D...",
2003
+ ko: "\uCD94\uAC00 \uC911...",
2004
+ nl: "Toevoegen...",
2005
+ no: "Legger til...",
2006
+ pl: "Dodawanie...",
2007
+ pt: "Adicionando...",
2008
+ ru: "\u0414\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u0435...",
2009
+ sv: "L\xE4gger till...",
2010
+ th: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E40\u0E1E\u0E34\u0E48\u0E21...",
2011
+ tr: "Ekleniyor...",
2012
+ uk: "\u0414\u043E\u0434\u0430\u0432\u0430\u043D\u043D\u044F...",
2013
+ vi: "\u0110ang th\xEAm...",
2014
+ zh: "\u6B63\u5728\u6DFB\u52A0..."
2015
+ },
2016
+ soldOut: {
2017
+ ar: "\u0646\u0641\u062F\u062A \u0627\u0644\u0643\u0645\u064A\u0629",
2018
+ cs: "Vyprod\xE1no",
2019
+ da: "Udsolgt",
2020
+ de: "Ausverkauft",
2021
+ en: "Sold out",
2022
+ es: "Agotado",
2023
+ fi: "Loppuunmyyty",
2024
+ fr: "\xC9puis\xE9",
2025
+ ga: "D\xEDolta amach",
2026
+ he: "\u05D0\u05D6\u05DC \u05DE\u05D4\u05DE\u05DC\u05D0\u05D9",
2027
+ hi: "\u0938\u094D\u091F\u0949\u0915 \u0916\u093C\u0924\u094D\u092E",
2028
+ id: "Habis terjual",
2029
+ it: "Esaurito",
2030
+ ja: "\u58F2\u308A\u5207\u308C",
2031
+ ko: "\uD488\uC808",
2032
+ nl: "Uitverkocht",
2033
+ no: "Utsolgt",
2034
+ pl: "Wyprzedane",
2035
+ pt: "Esgotado",
2036
+ ru: "\u0420\u0430\u0441\u043F\u0440\u043E\u0434\u0430\u043D\u043E",
2037
+ sv: "Sluts\xE5ld",
2038
+ th: "\u0E2A\u0E34\u0E19\u0E04\u0E49\u0E32\u0E2B\u0E21\u0E14",
2039
+ tr: "T\xFCkendi",
2040
+ uk: "\u0420\u043E\u0437\u043F\u0440\u043E\u0434\u0430\u043D\u043E",
2041
+ vi: "H\u1EBFt h\xE0ng",
2042
+ zh: "\u5DF2\u552E\u7F44"
2043
+ },
2044
+ undo: {
2045
+ ar: "\u062A\u0631\u0627\u062C\u0639",
2046
+ cs: "Zp\u011Bt",
2047
+ da: "Fortryd",
2048
+ de: "R\xFCckg\xE4ngig",
2049
+ en: "Undo",
2050
+ es: "Deshacer",
2051
+ fi: "Kumoa",
2052
+ fr: "Annuler",
2053
+ ga: "Cealaigh",
2054
+ he: "\u05D1\u05D8\u05DC",
2055
+ hi: "\u092A\u0942\u0930\u094D\u0935\u0935\u0924 \u0915\u0930\u0947\u0902",
2056
+ id: "Urungkan",
2057
+ it: "Annulla",
2058
+ ja: "\u5143\u306B\u623B\u3059",
2059
+ ko: "\uC2E4\uD589 \uCDE8\uC18C",
2060
+ nl: "Ongedaan maken",
2061
+ no: "Angre",
2062
+ pl: "Cofnij",
2063
+ pt: "Desfazer",
2064
+ ru: "\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C",
2065
+ sv: "\xC5ngra",
2066
+ th: "\u0E40\u0E25\u0E34\u0E01\u0E17\u0E33",
2067
+ tr: "Geri al",
2068
+ uk: "\u0421\u043A\u0430\u0441\u0443\u0432\u0430\u0442\u0438",
2069
+ vi: "Ho\xE0n t\xE1c",
2070
+ zh: "\u64A4\u9500"
2071
+ }
2072
+ };
2073
+
2074
+ // src/transforms/offerV1/offerCard.ts
2075
+ var VARIANT_SELECTOR = { button: "button", radio: "radio", select: "menu" };
2076
+ var localizedContent = (defaults, override) => {
2077
+ const trimmed = override?.trim();
2078
+ return trimmed ? { ...defaults, en: trimmed } : defaults;
2079
+ };
2080
+ var buildStyledText = (token, style, color = "base") => {
2081
+ const marks = [
2082
+ { attrs: { color, fontSize: style?.textSize ?? "base" }, type: "textStyle" }
2083
+ ];
2084
+ if (style?.textEmphasis === "bold") marks.push({ type: "bold" });
2085
+ if (style?.textEmphasis === "italic") marks.push({ type: "italic" });
2086
+ return { content: [{ content: [{ marks, text: token, type: "text" }], type: "paragraph" }], type: "doc" };
2087
+ };
2088
+ var buildPriceContent = (settings) => {
2089
+ const content = [{ text: "{{variantPrice}}", type: "text" }];
2090
+ if (settings.discount?.showSavingAmount !== false) {
2091
+ content.push(
2092
+ { text: " ", type: "text" },
2093
+ {
2094
+ marks: [{ type: "strike" }, { attrs: { color: "subdued" }, type: "textStyle" }],
2095
+ text: "{{variantCompareAtPrice}}",
2096
+ type: "text"
2097
+ }
2098
+ );
2099
+ }
2100
+ return { content: [{ content, type: "paragraph" }], type: "doc" };
2101
+ };
2102
+ var buildReviews = (settings) => {
2103
+ if (!settings.integrations || !Object.values(settings.integrations).some(Boolean)) return [];
2104
+ const reviews = settings.displaySettings?.reviews;
2105
+ return [
2106
+ {
2107
+ ...reviews?.color && { color: reviews.color },
2108
+ sectionType: "reviews",
2109
+ ...reviews?.size && { size: reviews.size }
2110
+ }
2111
+ ];
2112
+ };
2113
+ var buildImage = (settings) => ({
2114
+ ...settings.displaySettings?.image?.imageFit && {
2115
+ objectFit: settings.displaySettings.image.imageFit
2116
+ },
2117
+ sectionType: "image",
2118
+ source: settings.images?.source === "product" ? "{{productImage}}" : "{{variantImage}}",
2119
+ width: 100
2120
+ });
2121
+ var buildTitle = (settings) => ({
2122
+ content: { en: buildStyledText("{{productTitle}}", settings.displaySettings?.product) },
2123
+ sectionType: "text"
2124
+ });
2125
+ var buildPrice = (settings) => ({
2126
+ content: { en: buildPriceContent(settings) },
2127
+ sectionType: "text"
2128
+ });
2129
+ var buildVariantTitle = (settings) => {
2130
+ const show = settings.productOptions?.showVariantTitle;
2131
+ if (!show || show === "hide") return [];
2132
+ return [
2133
+ {
2134
+ content: { en: buildStyledText("{{variantTitle}}", settings.displaySettings?.variant) },
2135
+ sectionType: "text"
2136
+ }
2137
+ ];
2138
+ };
2139
+ var buildDescription = (settings) => {
2140
+ const show = settings.productOptions?.showProductDescription;
2141
+ if (!show || show === "hide") return [];
2142
+ return [{ content: { en: buildStyledText("{{productDescription}}", void 0) }, sectionType: "text" }];
2143
+ };
2144
+ var buildVariants = (settings) => {
2145
+ if (settings.productOptions?.showVariantOptions === "never") return [];
2146
+ const selector = settings.viewOptions?.variantSelector;
2147
+ return [
2148
+ {
2149
+ hideOutOfStockVariants: !!settings.productOptions?.hideOutOfStockVariants,
2150
+ ...selector && { selector: VARIANT_SELECTOR[selector] },
2151
+ sectionType: "variants"
2152
+ }
2153
+ ];
2154
+ };
2155
+ var QUANTITY_INPUT_TYPE = {
2156
+ "buttons-manual-input": "number",
2157
+ "dropdown-select": "select"
2158
+ };
2159
+ var buildQuantityErrors = (quantity) => {
2160
+ const en = {
2161
+ ...quantity.maxError && { max: quantity.maxError },
2162
+ ...quantity.minError && { min: quantity.minError },
2163
+ ...quantity.negativeError && { neg: quantity.negativeError }
2164
+ };
2165
+ return Object.keys(en).length ? { errorMessages: { en } } : {};
2166
+ };
2167
+ var buildQuantity = (settings) => {
2168
+ const quantity = settings.quantityInputs;
2169
+ if (!quantity?.enabled) return [];
2170
+ const inputType = quantity.type ? QUANTITY_INPUT_TYPE[quantity.type] : void 0;
2171
+ return [
2172
+ {
2173
+ ...buildQuantityErrors(quantity),
2174
+ ...inputType && { inputType },
2175
+ max: quantity.maxValue ?? 10,
2176
+ min: quantity.minValue ?? 1,
2177
+ sectionType: "quantity"
2178
+ }
2179
+ ];
2180
+ };
2181
+ var buildSubscriptionButton = (settings) => {
2182
+ if (settings.productType !== "both" && settings.productType !== "subscription") return [];
2183
+ const language = settings.language;
2184
+ const slot = (buttonField, override) => ({
2185
+ buttonField,
2186
+ content: localizedContent(SWITCH_LABELS[buttonField], override),
2187
+ sectionType: "text"
2188
+ });
2189
+ return [
2190
+ {
2191
+ action: "switchToSubscription",
2192
+ buttonStyle: "plain",
2193
+ sections: [
2194
+ slot("subscriptionOption", void 0),
2195
+ slot("switchToOneTimePurchase", language?.cartSwitchToOnetime),
2196
+ slot("switchToSubscriptionNoDiscount", language?.cartSwitchToSubscription),
2197
+ slot("switchToSubscriptionWithDiscount", language?.upgradeToSubscription)
2198
+ ],
2199
+ sectionType: "button"
2200
+ }
2201
+ ];
2202
+ };
2203
+ var BUTTON_KINDS2 = ["plain", "primary", "secondary"];
2204
+ var buildAddButton = (settings) => {
2205
+ const kind = settings.button?.kind;
2206
+ const slot = (buttonField, override) => ({
2207
+ buttonField,
2208
+ content: localizedContent(OFFER_LABELS[buttonField], override),
2209
+ sectionType: "text"
2210
+ });
2211
+ return {
2212
+ action: "addToOrder",
2213
+ buttonStyle: BUTTON_KINDS2.includes(kind) ? kind : "primary",
2214
+ sections: [
2215
+ slot("addToCart", settings.language?.addToCart),
2216
+ slot("addingToCart", settings.language?.addingToCart),
2217
+ slot("addedToCart", settings.language?.addedToCart),
2218
+ slot("soldOut", settings.language?.soldOutLabel)
2219
+ ],
2220
+ sectionType: "button"
2221
+ };
2222
+ };
2223
+ var rowsLayout = (sections) => ({
2224
+ direction: "rows",
2225
+ sections,
2226
+ sectionType: "layout"
2227
+ });
2228
+ var buildOfferCard = (settings, horizontal) => {
2229
+ const image = buildImage(settings);
2230
+ const title = buildTitle(settings);
2231
+ const variantTitle = buildVariantTitle(settings);
2232
+ const price = buildPrice(settings);
2233
+ const description = buildDescription(settings);
2234
+ const reviews = buildReviews(settings);
2235
+ const variants = buildVariants(settings);
2236
+ const quantity = buildQuantity(settings);
2237
+ const subscription = buildSubscriptionButton(settings);
2238
+ const addButton = buildAddButton(settings);
2239
+ if (!horizontal) {
2240
+ return [
2241
+ image,
2242
+ title,
2243
+ ...variantTitle,
2244
+ price,
2245
+ ...description,
2246
+ ...reviews,
2247
+ ...variants,
2248
+ ...quantity,
2249
+ ...subscription,
2250
+ addButton
2251
+ ];
2252
+ }
2253
+ const info = rowsLayout([title, ...variantTitle, price, ...description, ...reviews, ...variants]);
2254
+ const actions = [...subscription, addButton];
2255
+ const actionsCell = actions.length === 1 ? actions[0] : rowsLayout(actions);
2256
+ const card = {
2257
+ direction: "grid",
2258
+ grid: { columns: ["15%", "fill", "auto"], rows: ["auto"] },
2259
+ sections: [image, info, actionsCell],
2260
+ sectionType: "layout"
2261
+ };
2262
+ return [card, ...quantity];
2263
+ };
2264
+
2265
+ // src/transforms/offerV1/convertOfferToV2.ts
2266
+ var LOCATION_TO_EDITOR_MODE3 = {
2267
+ checkout: "checkoutExtension",
2268
+ "order-status": "orderStatusPage",
2269
+ "thank-you": "thankYouPage"
2270
+ };
2271
+ var STYLE_TO_DIRECTION = {
2272
+ grid: "grid",
2273
+ line: "columns",
2274
+ list: "rows",
2275
+ none: "rows"
2276
+ };
2277
+ var directionForStyle = (style) => style ? STYLE_TO_DIRECTION[style] : "rows";
2278
+ var buildProductListLayout = (direction, columns) => direction === "grid" ? { direction, grid: { columns: Array.from({ length: Math.max(columns, 1) }, () => "fill"), rows: ["auto"] } } : { direction };
2279
+ var hasHeaderText = (language) => !!(language?.title || language?.superTitle || language?.description);
2280
+ var DISCOUNTED_FROM = {
2281
+ compare_at_price: "compare_at_price",
2282
+ original_price: "price",
2283
+ price: "price"
2284
+ };
2285
+ var buildDiscountSection = (discount) => {
2286
+ if (!discount?.type || discount.type === "none") return [];
2287
+ const discountedFrom = discount.discountedFrom ? DISCOUNTED_FROM[discount.discountedFrom] : void 0;
2288
+ return [
2289
+ {
2290
+ amount: discount.amount ?? 0,
2291
+ ...discount.discountedBy && { discountedBy: discount.discountedBy },
2292
+ ...discountedFrom && { discountedFrom },
2293
+ ...discount.message && { message: discount.message },
2294
+ ...discount.quantity != null && { quantity: discount.quantity },
2295
+ sectionType: "discount",
2296
+ type: discount.type
2297
+ }
2298
+ ];
2299
+ };
2300
+ var buildBanner = (language) => language?.successBannerEnabled ? [
2301
+ {
2302
+ color: "success",
2303
+ dismissible: true,
2304
+ sections: [
2305
+ {
2306
+ /**
2307
+ * A defined v1 message (RTE doc or string) passes through verbatim as `en`;
2308
+ * absent falls back to the localized defaults (P4 language policy).
2309
+ */
2310
+ content: language.successBannerMessageRte ? { ...OFFER_LABELS.addedToCartMessage, en: language.successBannerMessageRte } : OFFER_LABELS.addedToCartMessage,
2311
+ sectionType: "text"
2312
+ },
2313
+ {
2314
+ action: "undoAddToOrder",
2315
+ buttonStyle: "plain",
2316
+ sections: [{ buttonField: "buttonLabel", content: OFFER_LABELS.undo, sectionType: "text" }],
2317
+ sectionType: "button"
2318
+ }
2319
+ ],
2320
+ sectionType: "banner"
2321
+ }
2322
+ ] : [];
2323
+ var convertOfferToV2 = ({ id, name, settings }) => {
2324
+ const layout = settings.layout?.large ?? settings.layout?.medium ?? settings.layout?.small;
2325
+ const columns = layout?.columns ?? 1;
2326
+ const direction = directionForStyle(layout?.style);
2327
+ const listLayout = buildProductListLayout(direction, columns);
2328
+ const horizontalCard = direction === "rows";
2329
+ const dataSource = {
2330
+ ...settings.endpoint && { dataSourcePath: settings.endpoint },
2331
+ ...settings.integrations && { integrations: settings.integrations },
2332
+ ...settings.limit !== void 0 && { limit: settings.limit },
2333
+ matchVariant: !!settings.productOptions?.matchVariant,
2334
+ matchVariantOutOfStock: !!settings.productOptions?.matchVariantOutOfStock,
2335
+ ...settings.productType && { productType: settings.productType },
2336
+ sectionType: "dataSource",
2337
+ ...settings.treatAsGwp && { treatAsGwp: true }
2338
+ };
2339
+ const offers = {
2340
+ sections: [
2341
+ ...buildOfferCard(settings, horizontalCard),
2342
+ dataSource,
2343
+ ...buildDiscountSection(settings.discount),
2344
+ ...buildBanner(settings.language)
2345
+ ],
2346
+ sectionType: "offers"
2347
+ };
2348
+ const display = {
2349
+ autoAdvanceInterval: 0,
2350
+ itemsAtOnce: layout?.carousel ? columns : settings.limit ?? columns,
2351
+ ...listLayout,
2352
+ sections: [offers],
2353
+ sectionType: "carousel"
2354
+ };
2355
+ return CABRootSection.parse({
2356
+ direction: "rows",
2357
+ editorMode: LOCATION_TO_EDITOR_MODE3[settings.location ?? "checkout"],
2358
+ // The widget name is required by the admin save schema; carry the legacy widget's name through.
2359
+ ...name && { name },
2360
+ previewMode: settings.previewMode,
2361
+ sections: [
2362
+ ...hasHeaderText(settings.language) ? [{ content: { en: convertContentBlockTextToV2(settings.language) }, sectionType: "text" }] : [],
2363
+ display
2364
+ ],
2365
+ tracking: {
2366
+ enableAttribution: settings.tracking?.enableAttribution ?? true,
2367
+ enableSource: settings.tracking?.enableSource ?? true,
2368
+ enableWidget: settings.tracking?.enableWidget ?? true
2369
+ },
2370
+ type: SHOPIFY_CHECKOUT_EXTENSION,
2371
+ version: 2,
2372
+ widgetId: id
2373
+ });
2374
+ };
2375
+
1453
2376
  // src/transforms/parseShielded.ts
1454
2377
  var parseShielded = (schema, raw, transform = (input) => input) => schema.parse(transform(convertNumericObjects(deepCamelCase(raw))));
1455
2378
  //# sourceMappingURL=index.js.map