@rebuy/rebuy 2.6.0-rc.2 → 2.7.0-rc.1

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 (34) hide show
  1. package/dist/index.js +60 -51
  2. package/dist/index.js.map +2 -2
  3. package/dist/index.mjs +60 -51
  4. package/dist/index.mjs.map +2 -2
  5. package/dist/schema/metadata.d.ts +2 -2
  6. package/dist/schema/metadata.d.ts.map +1 -1
  7. package/dist/schema/product.d.ts +15 -15
  8. package/dist/schema/product.d.ts.map +1 -1
  9. package/dist/schema/widgetData.d.ts +50 -0
  10. package/dist/schema/widgetData.d.ts.map +1 -1
  11. package/dist/schema/widgets/checkout-and-beyond/button.d.ts +9 -242
  12. package/dist/schema/widgets/checkout-and-beyond/button.d.ts.map +1 -1
  13. package/dist/schema/widgets/checkout-and-beyond/common.d.ts +11 -3
  14. package/dist/schema/widgets/checkout-and-beyond/common.d.ts.map +1 -1
  15. package/dist/schema/widgets/checkout-and-beyond/image.d.ts +1 -0
  16. package/dist/schema/widgets/checkout-and-beyond/image.d.ts.map +1 -1
  17. package/dist/schema/widgets/checkout-and-beyond/layout.d.ts +29 -1
  18. package/dist/schema/widgets/checkout-and-beyond/layout.d.ts.map +1 -1
  19. package/dist/schema/widgets/checkout-and-beyond/offers.d.ts +25 -0
  20. package/dist/schema/widgets/checkout-and-beyond/offers.d.ts.map +1 -1
  21. package/dist/schema/widgets/checkout-and-beyond/product.d.ts +2 -0
  22. package/dist/schema/widgets/checkout-and-beyond/product.d.ts.map +1 -1
  23. package/dist/schema/widgets/checkout-and-beyond/products.d.ts +2 -0
  24. package/dist/schema/widgets/checkout-and-beyond/products.d.ts.map +1 -1
  25. package/dist/schema/widgets/checkout-and-beyond/regex.d.ts.map +1 -1
  26. package/dist/schema/widgets/checkout-and-beyond/root.d.ts +25 -0
  27. package/dist/schema/widgets/checkout-and-beyond/root.d.ts.map +1 -1
  28. package/dist/schema/widgets/checkout-and-beyond/text.d.ts +1 -0
  29. package/dist/schema/widgets/checkout-and-beyond/text.d.ts.map +1 -1
  30. package/dist/schema/widgets/contentBlock.d.ts +25 -0
  31. package/dist/schema/widgets/contentBlock.d.ts.map +1 -1
  32. package/dist/schema/widgets/rebuyButton.d.ts +25 -0
  33. package/dist/schema/widgets/rebuyButton.d.ts.map +1 -1
  34. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -740,7 +740,7 @@ import { z as z2 } from "zod/v4";
740
740
  // src/schema/product.ts
741
741
  import { z } from "zod/v4";
742
742
  var zDatetime = z.iso.datetime({ offset: true });
743
- var cacheInfoSchema = z.object({
743
+ var CacheInfo = z.object({
744
744
  cachedAtTime: z.union([z.string(), z.number()]),
745
745
  cacheExpires: z.union([z.string(), z.number()]).optional(),
746
746
  cacheKey: z.string(),
@@ -748,24 +748,24 @@ var cacheInfoSchema = z.object({
748
748
  cacheType: z.string().optional(),
749
749
  loadedOptions: z.record(z.string(), z.boolean()).optional()
750
750
  });
751
- var categorySchema = z.object({
751
+ var Category = z.object({
752
752
  adminGraphqlApiId: z.string(),
753
753
  fullName: z.string(),
754
754
  name: z.string()
755
755
  });
756
- var metafieldSchema = z.object({
756
+ var Metafield = z.object({
757
757
  key: z.string(),
758
758
  namespace: z.string(),
759
759
  type: z.string(),
760
760
  value: z.string()
761
761
  });
762
- var imageSchema = z.object({
762
+ var Image = z.object({
763
763
  adminGraphqlApiId: z.string(),
764
764
  alt: z.string().nullable(),
765
765
  createdAt: zDatetime.optional(),
766
766
  height: z.number(),
767
767
  id: z.number(),
768
- metafields: z.array(metafieldSchema).optional(),
768
+ metafields: z.array(Metafield).optional(),
769
769
  position: z.number(),
770
770
  productId: z.number(),
771
771
  src: z.url(),
@@ -773,7 +773,7 @@ var imageSchema = z.object({
773
773
  variantIds: z.array(z.number()),
774
774
  width: z.number()
775
775
  });
776
- var mediaSchema = z.object({
776
+ var Media = z.object({
777
777
  adminGraphqlApiId: z.string(),
778
778
  alt: z.string().nullable(),
779
779
  createdAt: zDatetime,
@@ -786,20 +786,20 @@ var mediaSchema = z.object({
786
786
  updatedAt: zDatetime,
787
787
  variantIds: z.array(z.number())
788
788
  });
789
- var optionSchema = z.object({
789
+ var Option = z.object({
790
790
  id: z.number(),
791
791
  name: z.string(),
792
792
  position: z.number(),
793
793
  productId: z.number(),
794
794
  values: z.array(z.string())
795
795
  });
796
- var priceAdjustmentSchema = z.object({
796
+ var PriceAdjustment = z.object({
797
797
  orderCount: z.number().optional(),
798
798
  position: z.number(),
799
799
  value: z.string(),
800
800
  valueType: z.string()
801
801
  });
802
- var ratingsSchema = z.union([
802
+ var Ratings = z.union([
803
803
  z.object({ judgemeAverageStarRating: z.number(), judgemeTotalReviews: z.number() }),
804
804
  z.object({ junipAverageStarRating: z.number(), junipTotalReviews: z.number() }),
805
805
  z.object({ klaviyoAverageStarRating: z.number(), klaviyoTotalReviews: z.number() }),
@@ -811,7 +811,7 @@ var ratingsSchema = z.union([
811
811
  z.object({ stampedAverageStarRating: z.number(), stampedTotalReviews: z.number() }),
812
812
  z.object({ yotpoAverageStarRating: z.number(), yotpoTotalReviews: z.number() })
813
813
  ]);
814
- var sellingPlanSchema = z.object({
814
+ var SellingPlan = z.object({
815
815
  description: z.string().optional(),
816
816
  id: z.number(),
817
817
  name: z.string(),
@@ -819,30 +819,30 @@ var sellingPlanSchema = z.object({
819
819
  orderIntervalFrequency: z.string().optional(),
820
820
  orderIntervalUnitType: z.string().optional(),
821
821
  position: z.number().optional(),
822
- priceAdjustments: z.array(priceAdjustmentSchema),
822
+ priceAdjustments: z.array(PriceAdjustment),
823
823
  shopifyVariantId: z.string().optional()
824
824
  });
825
- var sellingPlanAllocationSchema = z.object({
825
+ var SellingPlanAllocation = z.object({
826
826
  compareAtPrice: z.number(),
827
827
  perDeliveryPrice: z.number(),
828
828
  price: z.number(),
829
- priceAdjustments: z.array(priceAdjustmentSchema),
829
+ priceAdjustments: z.array(PriceAdjustment),
830
830
  sellingPlanGroupId: z.string(),
831
831
  sellingPlanId: z.number()
832
832
  });
833
- var sellingPlanGroupSchema = z.object({
833
+ var SellingPlanGroup = z.object({
834
834
  appId: z.string().optional(),
835
835
  description: z.string().optional(),
836
836
  discountAmount: z.number().optional(),
837
837
  discountType: z.string().optional(),
838
838
  id: z.string(),
839
839
  name: z.string(),
840
- options: z.array(optionSchema),
840
+ options: z.array(Option),
841
841
  requiresSellingPlan: z.boolean().optional(),
842
- sellingPlans: z.array(sellingPlanSchema),
842
+ sellingPlans: z.array(SellingPlan),
843
843
  variants: z.array(z.number())
844
844
  });
845
- var variantSchema = z.object({
845
+ var Variant = z.object({
846
846
  adminGraphqlApiId: z.string(),
847
847
  barcode: z.string().nullable(),
848
848
  compareAtPrice: z.string().nullable(),
@@ -864,7 +864,7 @@ var variantSchema = z.object({
864
864
  price: z.string(),
865
865
  productId: z.number(),
866
866
  requiresShipping: z.boolean(),
867
- sellingPlanAllocations: z.array(sellingPlanAllocationSchema).optional(),
867
+ sellingPlanAllocations: z.array(SellingPlanAllocation).optional(),
868
868
  sku: z.string().nullable(),
869
869
  taxable: z.boolean(),
870
870
  taxCode: z.string().optional(),
@@ -873,32 +873,32 @@ var variantSchema = z.object({
873
873
  weight: z.number(),
874
874
  weightUnit: z.string().optional()
875
875
  });
876
- var productSchema = z.object({
876
+ var Product = z.object({
877
877
  adminGraphqlApiId: z.string(),
878
878
  bodyHtml: z.string().nullable(),
879
- cacheInfo: cacheInfoSchema,
880
- category: categorySchema.nullish(),
879
+ cacheInfo: CacheInfo,
880
+ category: Category.nullish(),
881
881
  collectionIds: z.array(z.number()),
882
882
  createdAt: zDatetime,
883
883
  description: z.string(),
884
884
  handle: z.string(),
885
885
  hasVariantsThatRequiresComponents: z.boolean().optional(),
886
886
  id: z.number(),
887
- image: imageSchema.nullable(),
888
- images: z.array(imageSchema).nullable(),
887
+ image: Image.nullable(),
888
+ images: z.array(Image).nullable(),
889
889
  link: z.url(),
890
- media: z.array(mediaSchema).optional(),
891
- metafields: z.array(metafieldSchema).optional(),
892
- options: z.array(optionSchema),
890
+ media: z.array(Media).optional(),
891
+ metafields: z.array(Metafield).optional(),
892
+ options: z.array(Option),
893
893
  owner: z.union([z.string(), z.number()]),
894
894
  productType: z.string(),
895
895
  publishedAt: zDatetime.nullable(),
896
896
  publishedScope: z.string().optional(),
897
897
  purchaseOptions: z.array(z.object({ discountOptions: z.array(z.never()) })).optional(),
898
- ratings: ratingsSchema.optional(),
898
+ ratings: Ratings.optional(),
899
899
  selectedIndexPurchasedOption: z.number().optional(),
900
- sellingPlanAllocation: sellingPlanAllocationSchema.optional(),
901
- sellingPlanGroups: z.array(sellingPlanGroupSchema).optional(),
900
+ sellingPlanAllocation: SellingPlanAllocation.optional(),
901
+ sellingPlanGroups: z.array(SellingPlanGroup).optional(),
902
902
  status: z.string(),
903
903
  tags: z.string(),
904
904
  templateSuffix: z.string().nullable(),
@@ -906,27 +906,27 @@ var productSchema = z.object({
906
906
  updatedAt: zDatetime,
907
907
  variantGids: z.array(z.object({ adminGraphqlApiId: z.string(), updatedAt: zDatetime })).optional(),
908
908
  variantIds: z.array(z.object({ id: z.number() })).optional(),
909
- variants: z.array(variantSchema),
909
+ variants: z.array(Variant),
910
910
  vendor: z.string()
911
911
  });
912
912
 
913
913
  // src/schema/metadata.ts
914
- var baseRuleSchema = z2.object({
914
+ var BaseRule = z2.object({
915
915
  operator: z2.string(),
916
916
  type: z2.string(),
917
917
  value: z2.union([z2.string(), z2.number()])
918
918
  });
919
- var ruleSchema = baseRuleSchema.extend({
919
+ var Rule = BaseRule.extend({
920
920
  conditions: z2.array(z2.object({ type: z2.string(), value: z2.union([z2.string(), z2.number()]) })).optional(),
921
921
  products: z2.array(
922
922
  z2.object({
923
923
  productId: z2.number(),
924
- subRules: z2.object({ logic: z2.array(z2.object({ rules: z2.array(baseRuleSchema) })) }).optional(),
924
+ subRules: z2.object({ logic: z2.array(z2.object({ rules: z2.array(BaseRule) })) }).optional(),
925
925
  variantIds: z2.array(z2.number())
926
926
  })
927
927
  ).optional()
928
928
  });
929
- var outputSchema = z2.object({
929
+ var Output = z2.object({
930
930
  channel: z2.string().optional(),
931
931
  collectionId: z2.number().optional(),
932
932
  collectionSort: z2.string().optional(),
@@ -943,25 +943,25 @@ var outputSchema = z2.object({
943
943
  type: z2.string(),
944
944
  value: z2.union([z2.string(), z2.number(), z2.boolean()]).optional()
945
945
  });
946
- var matchedRuleSchema = z2.object({
946
+ var MatchedRule = z2.object({
947
947
  collapsed: z2.boolean().optional(),
948
948
  exitIfMatched: z2.boolean(),
949
949
  index: z2.number(),
950
- logic: z2.array(z2.object({ rules: z2.array(ruleSchema) })),
951
- output: z2.array(outputSchema)
950
+ logic: z2.array(z2.object({ rules: z2.array(Rule) })),
951
+ output: z2.array(Output)
952
952
  });
953
- var metadataSchema = z2.object({
954
- cacheInfo: cacheInfoSchema.optional(),
953
+ var Metadata = z2.object({
954
+ cacheInfo: CacheInfo.optional(),
955
955
  cartItems: z2.array(z2.never()).optional(),
956
956
  errors: z2.array(z2.never()).optional(),
957
957
  filteredInputProducts: z2.array(z2.never()).optional(),
958
- filteredOosProducts: z2.array(productSchema).optional(),
959
- globalExcludedProducts: z2.array(productSchema).optional(),
958
+ filteredOosProducts: z2.array(Product).optional(),
959
+ globalExcludedProducts: z2.array(Product).optional(),
960
960
  inputProducts: z2.array(z2.never()).optional(),
961
- matchedRules: z2.array(matchedRuleSchema).optional(),
961
+ matchedRules: z2.array(MatchedRule).optional(),
962
962
  topSellersFilled: z2.boolean().optional(),
963
- unevaluatedRules: z2.array(matchedRuleSchema).optional(),
964
- unmatchedRules: z2.array(matchedRuleSchema).optional(),
963
+ unevaluatedRules: z2.array(MatchedRule).optional(),
964
+ unmatchedRules: z2.array(MatchedRule).optional(),
965
965
  widget: z2.object({
966
966
  discount: z2.object({ amount: z2.string(), type: z2.string() }).optional(),
967
967
  language: z2.record(z2.string(), z2.string()).optional()
@@ -1085,6 +1085,8 @@ var buttonActions = [
1085
1085
  "addToOrder",
1086
1086
  "declineAllOffers",
1087
1087
  "declineOffer",
1088
+ "displayContentInModal",
1089
+ "displayContentInPopover",
1088
1090
  "goToRebuyApp",
1089
1091
  "goToRebuyVault",
1090
1092
  "goToURL",
@@ -1102,6 +1104,7 @@ var buttonFields = [
1102
1104
  "declineAllOffers",
1103
1105
  "declineOffer",
1104
1106
  "destinationUrl",
1107
+ "overlayContent",
1105
1108
  "payNow",
1106
1109
  "removeFromCart",
1107
1110
  "showVariant",
@@ -1118,7 +1121,7 @@ var ButtonField = buttonField.enum;
1118
1121
  var buttonStyles = ["primary", "secondary", "plain", "custom"];
1119
1122
  var buttonStyle = z6.enum(buttonStyles);
1120
1123
  var ButtonStyle = buttonStyle.enum;
1121
- var directions = ["columns", "rows"];
1124
+ var directions = ["columns", "rows", "grid"];
1122
1125
  var direction = z6.enum(directions);
1123
1126
  var Direction = direction.enum;
1124
1127
  var editorModes = [
@@ -1316,7 +1319,7 @@ import { z as z9 } from "zod/v4";
1316
1319
  var ARRAY_INDEX_STRING = /^(0|[1-9]\d*)$/;
1317
1320
  var DYNAMIC_TOKEN_REGEX = /^\{\{\s*[A-Za-z]+\s*\}\}$/;
1318
1321
  var HEX_COLOR_REGEX = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
1319
- var HTML_TAGS_REGEX = /<[^>]*>/gi;
1322
+ var HTML_TAGS_REGEX = /<\/?[^>]+>/g;
1320
1323
 
1321
1324
  // src/schema/widgets/checkout-and-beyond/utils.ts
1322
1325
  import { entries, every, get as get2, isArray, isPlainObject, isString, map, mapValues, size } from "lodash-es";
@@ -1448,7 +1451,9 @@ var CABTextSection = z10.object({
1448
1451
  });
1449
1452
 
1450
1453
  // src/schema/widgets/checkout-and-beyond/button.ts
1451
- var CABButtonContent = z11.lazy(() => z11.discriminatedUnion("sectionType", [CABImageSection, CABTextSection]));
1454
+ var CABButtonContent = z11.lazy(
1455
+ () => z11.discriminatedUnion("sectionType", [CABImageSection, CABLayoutSection, CABTextSection])
1456
+ );
1452
1457
  var CABButtonSection = z11.object({
1453
1458
  action: z11.union([z11.literal(""), z11.enum(buttonActions)]).default(""),
1454
1459
  buttonStyle: z11.enum(buttonStyles).default(ButtonStyle.primary),
@@ -1625,6 +1630,7 @@ var CABSection = z21.lazy(
1625
1630
  );
1626
1631
 
1627
1632
  // src/schema/widgets/checkout-and-beyond/layout.ts
1633
+ var GridItem = z22.union([z22.literal("auto"), z22.literal("fill"), z22.string().regex(/^\d+%$/), z22.number()]);
1628
1634
  var CABLayoutSection = z22.object({
1629
1635
  alignment: z22.object({
1630
1636
  horizontal: z22.enum(horizontalAlignments).default(HorizontalAlignment.start),
@@ -1634,7 +1640,9 @@ var CABLayoutSection = z22.object({
1634
1640
  vertical: VerticalAlignment.top
1635
1641
  }),
1636
1642
  border: z22.lazy(() => CABBorder),
1643
+ buttonField: z22.enum(buttonFields).optional(),
1637
1644
  direction: z22.enum(directions).default(Direction.rows),
1645
+ grid: z22.object({ columns: z22.array(GridItem), rows: z22.array(GridItem) }).optional(),
1638
1646
  name: z22.string().optional(),
1639
1647
  padding: z22.enum(spacings).default(Spacing.none),
1640
1648
  sectionId: z22.uuid().default(() => uuidv712()),
@@ -1785,6 +1793,7 @@ export {
1785
1793
  CABTextSection,
1786
1794
  CABVariantsSection,
1787
1795
  COMBINED_ENDPOINTS,
1796
+ CacheInfo,
1788
1797
  CheckoutExtension,
1789
1798
  ContentBlock,
1790
1799
  ContentBlockV1,
@@ -1794,14 +1803,17 @@ export {
1794
1803
  EditorMode,
1795
1804
  Geolocation,
1796
1805
  GiftWithPurchase,
1806
+ GridItem,
1797
1807
  HEX_COLOR_REGEX,
1798
1808
  HTML_TAGS_REGEX,
1799
1809
  HorizontalAlignment,
1800
1810
  Identity,
1801
1811
  LanguageKey,
1802
1812
  LineItemEditor,
1813
+ Metadata,
1803
1814
  NO_HTML,
1804
1815
  ObjectFit,
1816
+ Product,
1805
1817
  ProductType,
1806
1818
  ProgressBar,
1807
1819
  QuantityInput,
@@ -1811,6 +1823,7 @@ export {
1811
1823
  RebuyMonetize,
1812
1824
  STATIC_ENDPOINTS,
1813
1825
  SectionType,
1826
+ SellingPlanGroup,
1814
1827
  Session,
1815
1828
  ShopConfig,
1816
1829
  Spacing,
@@ -1832,7 +1845,6 @@ export {
1832
1845
  buttonActions,
1833
1846
  buttonFields,
1834
1847
  buttonStyles,
1835
- cacheInfoSchema,
1836
1848
  checkForHTML,
1837
1849
  convertNumericObjects,
1838
1850
  convertProductToStorefrontFormat,
@@ -1867,16 +1879,13 @@ export {
1867
1879
  isTextType,
1868
1880
  isVariantsType,
1869
1881
  languageKeys,
1870
- metadataSchema,
1871
1882
  objectFits,
1872
1883
  productImageObject,
1873
- productSchema,
1874
1884
  productTypes,
1875
1885
  quantityInputs,
1876
1886
  queryStringToObject,
1877
1887
  sectionTypes,
1878
1888
  selectedVariantOptions,
1879
- sellingPlanGroupSchema,
1880
1889
  serialize,
1881
1890
  sessionId,
1882
1891
  set,