@rebuy/rebuy 2.6.0 → 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.
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()
@@ -1121,7 +1121,7 @@ var ButtonField = buttonField.enum;
1121
1121
  var buttonStyles = ["primary", "secondary", "plain", "custom"];
1122
1122
  var buttonStyle = z6.enum(buttonStyles);
1123
1123
  var ButtonStyle = buttonStyle.enum;
1124
- var directions = ["columns", "rows"];
1124
+ var directions = ["columns", "rows", "grid"];
1125
1125
  var direction = z6.enum(directions);
1126
1126
  var Direction = direction.enum;
1127
1127
  var editorModes = [
@@ -1319,7 +1319,7 @@ import { z as z9 } from "zod/v4";
1319
1319
  var ARRAY_INDEX_STRING = /^(0|[1-9]\d*)$/;
1320
1320
  var DYNAMIC_TOKEN_REGEX = /^\{\{\s*[A-Za-z]+\s*\}\}$/;
1321
1321
  var HEX_COLOR_REGEX = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
1322
- var HTML_TAGS_REGEX = /<[^>]*>/gi;
1322
+ var HTML_TAGS_REGEX = /<\/?[^>]+>/g;
1323
1323
 
1324
1324
  // src/schema/widgets/checkout-and-beyond/utils.ts
1325
1325
  import { entries, every, get as get2, isArray, isPlainObject, isString, map, mapValues, size } from "lodash-es";
@@ -1630,6 +1630,7 @@ var CABSection = z21.lazy(
1630
1630
  );
1631
1631
 
1632
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()]);
1633
1634
  var CABLayoutSection = z22.object({
1634
1635
  alignment: z22.object({
1635
1636
  horizontal: z22.enum(horizontalAlignments).default(HorizontalAlignment.start),
@@ -1641,6 +1642,7 @@ var CABLayoutSection = z22.object({
1641
1642
  border: z22.lazy(() => CABBorder),
1642
1643
  buttonField: z22.enum(buttonFields).optional(),
1643
1644
  direction: z22.enum(directions).default(Direction.rows),
1645
+ grid: z22.object({ columns: z22.array(GridItem), rows: z22.array(GridItem) }).optional(),
1644
1646
  name: z22.string().optional(),
1645
1647
  padding: z22.enum(spacings).default(Spacing.none),
1646
1648
  sectionId: z22.uuid().default(() => uuidv712()),
@@ -1791,6 +1793,7 @@ export {
1791
1793
  CABTextSection,
1792
1794
  CABVariantsSection,
1793
1795
  COMBINED_ENDPOINTS,
1796
+ CacheInfo,
1794
1797
  CheckoutExtension,
1795
1798
  ContentBlock,
1796
1799
  ContentBlockV1,
@@ -1800,14 +1803,17 @@ export {
1800
1803
  EditorMode,
1801
1804
  Geolocation,
1802
1805
  GiftWithPurchase,
1806
+ GridItem,
1803
1807
  HEX_COLOR_REGEX,
1804
1808
  HTML_TAGS_REGEX,
1805
1809
  HorizontalAlignment,
1806
1810
  Identity,
1807
1811
  LanguageKey,
1808
1812
  LineItemEditor,
1813
+ Metadata,
1809
1814
  NO_HTML,
1810
1815
  ObjectFit,
1816
+ Product,
1811
1817
  ProductType,
1812
1818
  ProgressBar,
1813
1819
  QuantityInput,
@@ -1817,6 +1823,7 @@ export {
1817
1823
  RebuyMonetize,
1818
1824
  STATIC_ENDPOINTS,
1819
1825
  SectionType,
1826
+ SellingPlanGroup,
1820
1827
  Session,
1821
1828
  ShopConfig,
1822
1829
  Spacing,
@@ -1838,7 +1845,6 @@ export {
1838
1845
  buttonActions,
1839
1846
  buttonFields,
1840
1847
  buttonStyles,
1841
- cacheInfoSchema,
1842
1848
  checkForHTML,
1843
1849
  convertNumericObjects,
1844
1850
  convertProductToStorefrontFormat,
@@ -1873,16 +1879,13 @@ export {
1873
1879
  isTextType,
1874
1880
  isVariantsType,
1875
1881
  languageKeys,
1876
- metadataSchema,
1877
1882
  objectFits,
1878
1883
  productImageObject,
1879
- productSchema,
1880
1884
  productTypes,
1881
1885
  quantityInputs,
1882
1886
  queryStringToObject,
1883
1887
  sectionTypes,
1884
1888
  selectedVariantOptions,
1885
- sellingPlanGroupSchema,
1886
1889
  serialize,
1887
1890
  sessionId,
1888
1891
  set,