@rechargeapps/storefront-client 1.54.1 → 1.55.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.
@@ -181,7 +181,7 @@ async function rechargeAdminRequest(method, url, { id, query, data, headers } =
181
181
  ...storefrontAccessToken ? { "X-Recharge-Storefront-Access-Token": storefrontAccessToken } : {},
182
182
  ...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
183
183
  ...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
184
- "X-Recharge-Sdk-Version": "1.54.1",
184
+ "X-Recharge-Sdk-Version": "1.55.0",
185
185
  ...headers ? headers : {}
186
186
  };
187
187
  return request.request(method, `${rechargeBaseUrl}${url}`, { id, query, data, headers: reqHeaders });
@@ -12,8 +12,12 @@ async function loadBundleData(id, options) {
12
12
  return loadFromOnlineStore(id, options?.country_code);
13
13
  }
14
14
  async function loadFromOnlineStore(id, country_code) {
15
+ const headers = {
16
+ "X-Recharge-Sdk-Fn": "loadFromOnlineStore",
17
+ "X-Recharge-Sdk-Version": "1.55.0"
18
+ };
15
19
  if (!country_code) {
16
- const data = await request.shopifyAppProxyRequest("get", `/bundle-data/${id}`);
20
+ const data = await request.shopifyAppProxyRequest("get", `/bundle-data/${id}`, { headers });
17
21
  return bundleData.mapOnlineStoreToPublicBundleData(data);
18
22
  }
19
23
  const payload = new FormData();
@@ -21,10 +25,6 @@ async function loadFromOnlineStore(id, country_code) {
21
25
  payload.append("_method", "put");
22
26
  payload.append("return_to", `${api.SHOPIFY_APP_PROXY_URL}/bundle-data/${id}`);
23
27
  payload.append("country_code", country_code);
24
- const headers = {
25
- "X-Recharge-Sdk-Fn": "loadFromOnlineStore",
26
- "X-Recharge-Sdk-Version": "1.54.1"
27
- };
28
28
  try {
29
29
  const data = await request.request("post", "/localization", {
30
30
  headers: { "Content-Type": "multipart/form-data", ...headers },
@@ -1 +1 @@
1
- {"version":3,"file":"bundleData.js","sources":["../../../src/api/bundleData.ts"],"sourcesContent":["import { Options, PublicBundleData, ShopifyStorefrontOptions } from '../types/bundleData';\nimport { getOptions } from '../utils/options';\nimport { SHOPIFY_APP_PROXY_URL } from '../constants/api';\nimport { BundleData as StorefrontBundleData } from '../types/bundle';\nimport { request, shopifyAppProxyRequest } from '../utils/request';\nimport { mapOnlineStoreToPublicBundleData } from '../utils/bundleData';\n\n/**\n * Load bundle data from the specified source\n *\n * @param id - The external product ID (Shopify product ID)\n * @param options - Configuration for data source and parameters\n * @param options.source - The source of the data (online_store or shopify_storefront)\n * @param options.country_code - The country code for the online store\n * @param options.storefront_access_token - The storefront access token for the Shopify Storefront API\n * @returns Promise resolving to bundle data result with success/error handling\n *\n * @example\n * ```typescript\n * // Load from online store\n * const result = await loadBundleData({\n * source: 'online_store',\n * external_product_id: '123456789',\n * country_code: 'US'\n * });\n *\n * if (result.success) {\n * console.log('Bundle data:', result.data);\n * } else {\n * console.error('Error:', result.error.message);\n * }\n *\n * // Load from Shopify Storefront API\n * const result2 = await loadBundleData({\n * source: 'shopify_storefront',\n * external_product_id: '123456789',\n * country_code: 'US',\n * shopify_storefront_access_token: 'your-token-here'\n * });\n * ```\n */\nexport async function loadBundleData(id: string, options?: Options): Promise<PublicBundleData> {\n if (options?.source === 'shopify_storefront') {\n return loadFromShopifyStorefrontApi(id, options);\n }\n\n return loadFromOnlineStore(id, options?.country_code);\n}\n\n/**\n * Load bundle data from the online store endpoint\n */\nasync function loadFromOnlineStore(id: string, country_code?: string): Promise<PublicBundleData> {\n if (!country_code) {\n const data = await shopifyAppProxyRequest<StorefrontBundleData>('get', `/bundle-data/${id}`);\n return mapOnlineStoreToPublicBundleData(data);\n }\n\n const payload = new FormData();\n payload.append('form_type', 'localization');\n payload.append('_method', 'put');\n payload.append('return_to', `${SHOPIFY_APP_PROXY_URL}/bundle-data/${id}`);\n payload.append('country_code', country_code);\n\n const headers = {\n 'X-Recharge-Sdk-Fn': 'loadFromOnlineStore',\n 'X-Recharge-Sdk-Version': '__SDK_VERSION__',\n };\n try {\n const data = await request<StorefrontBundleData>('post', '/localization', {\n headers: { 'Content-Type': 'multipart/form-data', ...headers },\n data: payload,\n });\n return mapOnlineStoreToPublicBundleData(data);\n } catch (error) {\n const data = await shopifyAppProxyRequest<StorefrontBundleData>('get', `/bundle-data/${id}`, {\n headers,\n });\n return mapOnlineStoreToPublicBundleData(data);\n }\n}\n\n/**\n * Load bundle data from Shopify Storefront API\n */\nasync function loadFromShopifyStorefrontApi(id: string, options: ShopifyStorefrontOptions): Promise<PublicBundleData> {\n const opts = getOptions();\n\n if (!opts.storeIdentifier) {\n throw new Error('Store identifier is required for Shopify Storefront API requests');\n }\n\n // Request data from Shopify Storefront API\n return {} as PublicBundleData;\n}\n"],"names":["shopifyAppProxyRequest","mapOnlineStoreToPublicBundleData","SHOPIFY_APP_PROXY_URL","request","options","getOptions"],"mappings":";;;;;;;AAyCsB,eAAA,cAAA,CAAe,IAAY,OAA8C,EAAA;AAC7F,EAAI,IAAA,OAAA,EAAS,WAAW,oBAAsB,EAAA;AAC5C,IAAO,OAAA,4BAAA,CAAwC,CAAA,CAAA;AAAA,GACjD;AAEA,EAAO,OAAA,mBAAA,CAAoB,EAAI,EAAA,OAAA,EAAS,YAAY,CAAA,CAAA;AACtD,CAAA;AAKA,eAAe,mBAAA,CAAoB,IAAY,YAAkD,EAAA;AAC/F,EAAA,IAAI,CAAC,YAAc,EAAA;AACjB,IAAA,MAAM,OAAO,MAAMA,8BAAA,CAA6C,KAAO,EAAA,CAAA,aAAA,EAAgB,EAAE,CAAE,CAAA,CAAA,CAAA;AAC3F,IAAA,OAAOC,4CAAiC,IAAI,CAAA,CAAA;AAAA,GAC9C;AAEA,EAAM,MAAA,OAAA,GAAU,IAAI,QAAS,EAAA,CAAA;AAC7B,EAAQ,OAAA,CAAA,MAAA,CAAO,aAAa,cAAc,CAAA,CAAA;AAC1C,EAAQ,OAAA,CAAA,MAAA,CAAO,WAAW,KAAK,CAAA,CAAA;AAC/B,EAAA,OAAA,CAAQ,OAAO,WAAa,EAAA,CAAA,EAAGC,yBAAqB,CAAA,aAAA,EAAgB,EAAE,CAAE,CAAA,CAAA,CAAA;AACxE,EAAQ,OAAA,CAAA,MAAA,CAAO,gBAAgB,YAAY,CAAA,CAAA;AAE3C,EAAA,MAAM,OAAU,GAAA;AAAA,IACd,mBAAqB,EAAA,qBAAA;AAAA,IACrB,wBAA0B,EAAA,QAAA;AAAA,GAC5B,CAAA;AACA,EAAI,IAAA;AACF,IAAA,MAAM,IAAO,GAAA,MAAMC,eAA8B,CAAA,MAAA,EAAQ,eAAiB,EAAA;AAAA,MACxE,OAAS,EAAA,EAAE,cAAgB,EAAA,qBAAA,EAAuB,GAAG,OAAQ,EAAA;AAAA,MAC7D,IAAM,EAAA,OAAA;AAAA,KACP,CAAA,CAAA;AACD,IAAA,OAAOF,4CAAiC,IAAI,CAAA,CAAA;AAAA,WACrC,KAAO,EAAA;AACd,IAAA,MAAM,OAAO,MAAMD,8BAAA,CAA6C,KAAO,EAAA,CAAA,aAAA,EAAgB,EAAE,CAAI,CAAA,EAAA;AAAA,MAC3F,OAAA;AAAA,KACD,CAAA,CAAA;AACD,IAAA,OAAOC,4CAAiC,IAAI,CAAA,CAAA;AAAA,GAC9C;AACF,CAAA;AAKA,eAAe,4BAAA,CAA6B,IAAYG,SAA8D,EAAA;AACpH,EAAA,MAAM,OAAOC,kBAAW,EAAA,CAAA;AAExB,EAAI,IAAA,CAAC,KAAK,eAAiB,EAAA;AACzB,IAAM,MAAA,IAAI,MAAM,kEAAkE,CAAA,CAAA;AAAA,GACpF;AAGA,EAAA,OAAO,EAAC,CAAA;AACV;;;;"}
1
+ {"version":3,"file":"bundleData.js","sources":["../../../src/api/bundleData.ts"],"sourcesContent":["import { Options, PublicBundleData, ShopifyStorefrontOptions } from '../types/bundleData';\nimport { getOptions } from '../utils/options';\nimport { SHOPIFY_APP_PROXY_URL } from '../constants/api';\nimport { BundleData as StorefrontBundleData } from '../types/bundle';\nimport { request, shopifyAppProxyRequest } from '../utils/request';\nimport { mapOnlineStoreToPublicBundleData } from '../utils/bundleData';\n\n/**\n * Load bundle data from the specified source\n *\n * @param id - The external product ID (Shopify product ID)\n * @param options - Configuration for data source and parameters\n * @param options.source - The source of the data (online_store or shopify_storefront)\n * @param options.country_code - The country code for the online store\n * @param options.storefront_access_token - The storefront access token for the Shopify Storefront API\n * @returns Promise resolving to bundle data result with success/error handling\n *\n * @example\n * ```typescript\n * // Load from online store\n * const result = await loadBundleData({\n * source: 'online_store',\n * external_product_id: '123456789',\n * country_code: 'US'\n * });\n *\n * if (result.success) {\n * console.log('Bundle data:', result.data);\n * } else {\n * console.error('Error:', result.error.message);\n * }\n *\n * // Load from Shopify Storefront API\n * const result2 = await loadBundleData({\n * source: 'shopify_storefront',\n * external_product_id: '123456789',\n * country_code: 'US',\n * shopify_storefront_access_token: 'your-token-here'\n * });\n * ```\n */\nexport async function loadBundleData(id: string, options?: Options): Promise<PublicBundleData> {\n if (options?.source === 'shopify_storefront') {\n return loadFromShopifyStorefrontApi(id, options);\n }\n\n return loadFromOnlineStore(id, options?.country_code);\n}\n\n/**\n * Load bundle data from the online store endpoint\n */\nasync function loadFromOnlineStore(id: string, country_code?: string): Promise<PublicBundleData> {\n const headers = {\n 'X-Recharge-Sdk-Fn': 'loadFromOnlineStore',\n 'X-Recharge-Sdk-Version': '__SDK_VERSION__',\n };\n\n if (!country_code) {\n const data = await shopifyAppProxyRequest<StorefrontBundleData>('get', `/bundle-data/${id}`, { headers });\n return mapOnlineStoreToPublicBundleData(data);\n }\n\n const payload = new FormData();\n payload.append('form_type', 'localization');\n payload.append('_method', 'put');\n payload.append('return_to', `${SHOPIFY_APP_PROXY_URL}/bundle-data/${id}`);\n payload.append('country_code', country_code);\n\n try {\n const data = await request<StorefrontBundleData>('post', '/localization', {\n headers: { 'Content-Type': 'multipart/form-data', ...headers },\n data: payload,\n });\n return mapOnlineStoreToPublicBundleData(data);\n } catch (error) {\n const data = await shopifyAppProxyRequest<StorefrontBundleData>('get', `/bundle-data/${id}`, {\n headers,\n });\n return mapOnlineStoreToPublicBundleData(data);\n }\n}\n\n/**\n * Load bundle data from Shopify Storefront API\n */\nasync function loadFromShopifyStorefrontApi(id: string, options: ShopifyStorefrontOptions): Promise<PublicBundleData> {\n const opts = getOptions();\n\n if (!opts.storeIdentifier) {\n throw new Error('Store identifier is required for Shopify Storefront API requests');\n }\n\n // Request data from Shopify Storefront API\n return {} as PublicBundleData;\n}\n"],"names":["shopifyAppProxyRequest","mapOnlineStoreToPublicBundleData","SHOPIFY_APP_PROXY_URL","request","options","getOptions"],"mappings":";;;;;;;AAyCsB,eAAA,cAAA,CAAe,IAAY,OAA8C,EAAA;AAC7F,EAAI,IAAA,OAAA,EAAS,WAAW,oBAAsB,EAAA;AAC5C,IAAO,OAAA,4BAAA,CAAwC,CAAA,CAAA;AAAA,GACjD;AAEA,EAAO,OAAA,mBAAA,CAAoB,EAAI,EAAA,OAAA,EAAS,YAAY,CAAA,CAAA;AACtD,CAAA;AAKA,eAAe,mBAAA,CAAoB,IAAY,YAAkD,EAAA;AAC/F,EAAA,MAAM,OAAU,GAAA;AAAA,IACd,mBAAqB,EAAA,qBAAA;AAAA,IACrB,wBAA0B,EAAA,QAAA;AAAA,GAC5B,CAAA;AAEA,EAAA,IAAI,CAAC,YAAc,EAAA;AACjB,IAAM,MAAA,IAAA,GAAO,MAAMA,8BAA6C,CAAA,KAAA,EAAO,gBAAgB,EAAE,CAAA,CAAA,EAAI,EAAE,OAAA,EAAS,CAAA,CAAA;AACxG,IAAA,OAAOC,4CAAiC,IAAI,CAAA,CAAA;AAAA,GAC9C;AAEA,EAAM,MAAA,OAAA,GAAU,IAAI,QAAS,EAAA,CAAA;AAC7B,EAAQ,OAAA,CAAA,MAAA,CAAO,aAAa,cAAc,CAAA,CAAA;AAC1C,EAAQ,OAAA,CAAA,MAAA,CAAO,WAAW,KAAK,CAAA,CAAA;AAC/B,EAAA,OAAA,CAAQ,OAAO,WAAa,EAAA,CAAA,EAAGC,yBAAqB,CAAA,aAAA,EAAgB,EAAE,CAAE,CAAA,CAAA,CAAA;AACxE,EAAQ,OAAA,CAAA,MAAA,CAAO,gBAAgB,YAAY,CAAA,CAAA;AAE3C,EAAI,IAAA;AACF,IAAA,MAAM,IAAO,GAAA,MAAMC,eAA8B,CAAA,MAAA,EAAQ,eAAiB,EAAA;AAAA,MACxE,OAAS,EAAA,EAAE,cAAgB,EAAA,qBAAA,EAAuB,GAAG,OAAQ,EAAA;AAAA,MAC7D,IAAM,EAAA,OAAA;AAAA,KACP,CAAA,CAAA;AACD,IAAA,OAAOF,4CAAiC,IAAI,CAAA,CAAA;AAAA,WACrC,KAAO,EAAA;AACd,IAAA,MAAM,OAAO,MAAMD,8BAAA,CAA6C,KAAO,EAAA,CAAA,aAAA,EAAgB,EAAE,CAAI,CAAA,EAAA;AAAA,MAC3F,OAAA;AAAA,KACD,CAAA,CAAA;AACD,IAAA,OAAOC,4CAAiC,IAAI,CAAA,CAAA;AAAA,GAC9C;AACF,CAAA;AAKA,eAAe,4BAAA,CAA6B,IAAYG,SAA8D,EAAA;AACpH,EAAA,MAAM,OAAOC,kBAAW,EAAA,CAAA;AAExB,EAAI,IAAA,CAAC,KAAK,eAAiB,EAAA;AACzB,IAAM,MAAA,IAAI,MAAM,kEAAkE,CAAA,CAAA;AAAA,GACpF;AAGA,EAAA,OAAO,EAAC,CAAA;AACV;;;;"}
@@ -5,6 +5,7 @@ const mapBundleSettings = (bundleSettings) => {
5
5
  const crossSells = bundleSettings.layout_settings.crossSells;
6
6
  const customizationWindow = bundleSettings.customization_window;
7
7
  const defaultVariantId = bundleSettings.default_bundle_variant_id;
8
+ const defaultFrequency = bundleSettings.layout_settings.defaultFrequency;
8
9
  return {
9
10
  default_variant_id: defaultVariantId ? String(defaultVariantId) : null,
10
11
  is_customizable: bundleSettings.is_customizable,
@@ -14,7 +15,8 @@ const mapBundleSettings = (bundleSettings) => {
14
15
  disabled_message: bundleSettings.customization_window_disabled_message || ""
15
16
  } : null,
16
17
  addons: addons.collectionId ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle } : null,
17
- cross_sells: crossSells.collectionId ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle } : null
18
+ cross_sells: crossSells.collectionId ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle } : null,
19
+ default_selling_plan_id: defaultFrequency || null
18
20
  };
19
21
  };
20
22
  const mapIncentives = (incentives) => {
@@ -44,7 +46,7 @@ const mapIncentives = (incentives) => {
44
46
  const mapSellingPlan = (sellingPlan) => ({
45
47
  id: sellingPlan.id,
46
48
  name: sellingPlan.name,
47
- options: sellingPlan.options.map((option) => ({ name: option.name, values: option.values })),
49
+ options: sellingPlan.options.map((option) => ({ name: option.name, value: option.value })),
48
50
  recurring_deliveries: sellingPlan.recurring_deliveries,
49
51
  price_adjustments: sellingPlan.price_adjustments.map(({ value, value_type }) => ({
50
52
  value,
@@ -64,16 +66,25 @@ const mapBasicVariant = (variant) => ({
64
66
  options: variant.options,
65
67
  available_for_sale: variant.available
66
68
  });
67
- const mapBasicProduct = (product) => ({
68
- id: String(product.id),
69
- title: product.title,
70
- description: product.description,
71
- available_for_sale: product.available,
72
- featured_image: product.featured_image,
73
- images: product.images,
74
- requires_selling_plan: product.requires_selling_plan,
75
- selling_plan_groups: product.selling_plan_groups.map(mapSellingPlanGroups)
76
- });
69
+ const formatFeaturedImage = (featuredImage) => {
70
+ if (featuredImage == null || typeof featuredImage === "string")
71
+ return featuredImage;
72
+ if ("src" in featuredImage)
73
+ return featuredImage["src"];
74
+ return null;
75
+ };
76
+ const mapBasicProduct = (product) => {
77
+ return {
78
+ id: String(product.id),
79
+ title: product.title,
80
+ description: product.description,
81
+ available_for_sale: product.available,
82
+ featured_image: formatFeaturedImage(product.featured_image),
83
+ images: product.images,
84
+ requires_selling_plan: product.requires_selling_plan,
85
+ selling_plan_groups: product.selling_plan_groups.map(mapSellingPlanGroups)
86
+ };
87
+ };
77
88
  const mapProduct = (product) => {
78
89
  const productPlansLookup = productSellingPlansGroupLookup(product.selling_plan_groups);
79
90
  return {
@@ -95,10 +106,10 @@ const mapProduct = (product) => {
95
106
  option1: variant.option1,
96
107
  option2: variant.option2,
97
108
  option3: variant.option3,
98
- sku: variant.sku,
109
+ sku: variant.sku || "",
99
110
  requires_shipping: variant.requires_shipping,
100
111
  taxable: variant.taxable,
101
- featured_image: variant.featured_image,
112
+ featured_image: formatFeaturedImage(variant.featured_image),
102
113
  public_title: variant.public_title,
103
114
  requires_selling_plan: variant.requires_selling_plan
104
115
  }))
@@ -139,6 +150,7 @@ function mapOnlineStoreToPublicBundleData(bundleData) {
139
150
  values: option.values
140
151
  })),
141
152
  default_variant_id: bundleSettings.default_variant_id,
153
+ default_selling_plan_id: bundleSettings.default_selling_plan_id ? Number(bundleSettings.default_selling_plan_id) : null,
142
154
  available_for_sale: bundleData.available,
143
155
  requires_selling_plan: bundleData.requires_selling_plan,
144
156
  bundle_settings: {
@@ -182,8 +194,8 @@ function mapOnlineStoreToPublicBundleData(bundleData) {
182
194
  variant: {
183
195
  id: selectionDefault.external_variant_id,
184
196
  title: selectionDefault.variant.title,
185
- featured_image: selectionDefault.variant.featured_image,
186
- sku: selectionDefault.sku
197
+ featured_image: formatFeaturedImage(selectionDefault.variant.featured_image),
198
+ sku: selectionDefault.sku || ""
187
199
  }
188
200
  })),
189
201
  position: index
@@ -191,6 +203,9 @@ function mapOnlineStoreToPublicBundleData(bundleData) {
191
203
  }),
192
204
  selling_plan_groups: bundleData.selling_plan_groups.map(mapSellingPlanGroups),
193
205
  collections: Object.values(bundleData.collections).reduce((acc, current) => {
206
+ if (!Array.isArray(current.products)) {
207
+ return acc;
208
+ }
194
209
  acc[String(current.id)] = {
195
210
  id: String(current.id),
196
211
  title: current.title,
@@ -1 +1 @@
1
- {"version":3,"file":"bundleData.js","sources":["../../../src/utils/bundleData.ts"],"sourcesContent":["import { PublicBundleData, PriceRule } from '../types/bundleData';\nimport { BaseProduct, BaseProductVariant, BundleData as StorefrontBundleData } from '../types/bundle';\n\nconst mapBundleSettings = (bundleSettings: StorefrontBundleData['bundle_settings']) => {\n const addons = bundleSettings.layout_settings.addons;\n const crossSells = bundleSettings.layout_settings.crossSells;\n const customizationWindow = bundleSettings.customization_window;\n const defaultVariantId = bundleSettings.default_bundle_variant_id;\n\n return {\n default_variant_id: defaultVariantId ? String(defaultVariantId) : null,\n is_customizable: bundleSettings.is_customizable,\n price_rule: String(bundleSettings.price_rule).toUpperCase(),\n customization_window: customizationWindow\n ? {\n active_days: customizationWindow,\n disabled_message: bundleSettings.customization_window_disabled_message || '',\n }\n : null,\n addons: addons.collectionId\n ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle }\n : null,\n cross_sells: crossSells.collectionId\n ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle }\n : null,\n };\n};\n\nconst mapIncentives = (incentives: StorefrontBundleData['incentives']): PublicBundleData['incentives'] => {\n if (incentives.tiered_discounts.length === 0) return null;\n\n return {\n tiered_discounts: incentives.tiered_discounts.map(tieredDiscount => ({\n eligible_charge_types: tieredDiscount.eligible_charge_types,\n eligible_line_item_types: tieredDiscount.eligible_line_item_types,\n external_bundle_product_id: {\n ecommerce: tieredDiscount.external_bundle_product_id.ecommerce,\n },\n lookup_key: tieredDiscount.lookup_key,\n name: tieredDiscount.name,\n status: tieredDiscount.status,\n tiers: tieredDiscount.tiers.map(({ tier }) => ({\n tier: {\n lookup_key: tier.lookup_key,\n discount_type: tier.discount_type,\n discount_value: tier.discount_value,\n condition_quantity_gte: tier.condition_quantity_gte,\n },\n })),\n })),\n };\n};\n\nconst mapSellingPlan = (\n sellingPlan: StorefrontBundleData['selling_plan_groups'][number]['selling_plans'][number]\n): PublicBundleData['selling_plan_groups'][number]['selling_plans'][number] => ({\n id: sellingPlan.id,\n name: sellingPlan.name,\n options: sellingPlan.options.map(option => ({ name: option.name, values: option.values })),\n recurring_deliveries: sellingPlan.recurring_deliveries,\n price_adjustments: sellingPlan.price_adjustments.map(({ value, value_type }) => ({\n value,\n value_type,\n })),\n});\n\nconst mapSellingPlanGroups = (\n sellingPlanGroup: StorefrontBundleData['selling_plan_groups'][number]\n): PublicBundleData['selling_plan_groups'][number] => ({\n name: sellingPlanGroup.name,\n options: sellingPlanGroup.options.map(option => ({ name: option.name, values: option.values })),\n selling_plans: sellingPlanGroup.selling_plans.map(mapSellingPlan),\n});\n\nconst mapBasicVariant = (variant: BaseProductVariant) => ({\n id: String(variant.id),\n title: variant.title,\n price: variant.price,\n compare_at_price: variant.compare_at_price,\n options: variant.options,\n available_for_sale: variant.available,\n});\n\nconst mapBasicProduct = (product: BaseProduct) => ({\n id: String(product.id),\n title: product.title,\n description: product.description,\n available_for_sale: product.available,\n featured_image: product.featured_image,\n images: product.images,\n requires_selling_plan: product.requires_selling_plan,\n selling_plan_groups: product.selling_plan_groups.map(mapSellingPlanGroups),\n});\n\nconst mapProduct = (product: StorefrontBundleData['collections'][number]['products'][number]) => {\n const productPlansLookup = productSellingPlansGroupLookup(product.selling_plan_groups);\n\n return {\n ...mapBasicProduct(product),\n handle: product.handle,\n tags: product.tags,\n price_range: { min: product.price_min, max: product.price_max },\n compare_at_price_range: { min: product.compare_at_price_min, max: product.compare_at_price_max },\n options: product.options,\n variants: product.variants.map(variant => ({\n ...mapBasicVariant(variant),\n selling_plan_allocations: variant.selling_plan_allocations.map(sellingPlan => ({\n price: sellingPlan.price,\n compare_at_price: sellingPlan.compare_at_price,\n selling_plan: mapSellingPlan(\n productPlansLookup[`${sellingPlan.selling_plan_group_id}-${sellingPlan.selling_plan_id}`]\n ),\n })),\n option1: variant.option1,\n option2: variant.option2,\n option3: variant.option3,\n sku: variant.sku,\n requires_shipping: variant.requires_shipping,\n taxable: variant.taxable,\n featured_image: variant.featured_image,\n public_title: variant.public_title,\n requires_selling_plan: variant.requires_selling_plan,\n })),\n };\n};\n\nconst mapBundleVariantRanges = ({\n items_count,\n ranges,\n}: Pick<StorefrontBundleData['bundle_settings']['variants'][number], 'items_count' | 'ranges'>) => {\n if (ranges.length > 0) {\n return ranges.map(({ quantity_max, quantity_min }) => ({ min: quantity_min, max: quantity_max }));\n }\n\n return [{ min: items_count, max: items_count }];\n};\n\nconst productSellingPlansGroupLookup = (sellingPlanGroups: BaseProduct['selling_plan_groups']) =>\n sellingPlanGroups.reduce<\n Record<string, StorefrontBundleData['selling_plan_groups'][number]['selling_plans'][number]>\n >((acc, current) => {\n current.selling_plans.forEach(sellingPlan => {\n const key = `${current.id}-${sellingPlan.id}`;\n acc[key] = sellingPlan;\n });\n\n return acc;\n }, {});\n\nexport function mapOnlineStoreToPublicBundleData(bundleData: StorefrontBundleData): PublicBundleData {\n const bundleSettings = mapBundleSettings(bundleData.bundle_settings);\n const variantsLookup = bundleData.variants.reduce<Record<string, StorefrontBundleData['variants'][number]>>(\n (acc, variant) => {\n acc[variant.id] = variant;\n return acc;\n },\n {}\n );\n\n return {\n id: String(bundleData.id),\n title: bundleData.title,\n handle: bundleData.handle,\n options: bundleData.options.map(option => ({\n name: option.name,\n position: option.position,\n values: option.values,\n })),\n default_variant_id: bundleSettings.default_variant_id,\n available_for_sale: bundleData.available,\n requires_selling_plan: bundleData.requires_selling_plan,\n bundle_settings: {\n is_customizable: bundleSettings.is_customizable,\n price_rule: bundleSettings.price_rule as PriceRule,\n customization_window: bundleSettings.customization_window,\n max_quantity_per_variant: null,\n },\n variants: bundleData.bundle_settings.variants\n .filter(({ enabled }) => enabled)\n .map((item, index) => {\n const variant = variantsLookup[String(item.external_variant_id)];\n\n return {\n id: String(item.external_variant_id),\n title: variant.title,\n price: variant.price,\n compare_at_price: variant.compare_at_price,\n image: variant.image || '',\n available_for_sale: variant.available,\n options: variant.options,\n requires_selling_plan: variant.requires_selling_plan,\n selling_plan_allocations: variant.selling_plan_allocations.map(sellingPlan => ({\n price: sellingPlan.price,\n compare_at_price: sellingPlan.compare_at_price,\n selling_plan: mapSellingPlan(sellingPlan.selling_plan),\n })),\n ranges: mapBundleVariantRanges(item),\n collections: item.option_sources.map(source => ({\n id: source.option_source_id,\n source_platform: 'shopify',\n min: source.quantity_min || 0,\n max: source.quantity_max,\n })),\n default_selections: item.selection_defaults.map(selectionDefault => ({\n quantity: selectionDefault.quantity,\n product: {\n id: String(selectionDefault.product.id),\n handle: selectionDefault.handle,\n title: selectionDefault.product.title,\n description: selectionDefault.product.description,\n images: selectionDefault.product.images,\n },\n variant: {\n id: selectionDefault.external_variant_id,\n title: selectionDefault.variant.title,\n featured_image: selectionDefault.variant.featured_image,\n sku: selectionDefault.sku,\n },\n })),\n position: index,\n };\n }),\n selling_plan_groups: bundleData.selling_plan_groups.map(mapSellingPlanGroups),\n collections: Object.values(bundleData.collections).reduce<PublicBundleData['collections']>((acc, current) => {\n acc[String(current.id)] = {\n id: String(current.id),\n title: current.title,\n handle: current.handle,\n products: current.products.map(mapProduct),\n };\n\n return acc;\n }, {}),\n addons: bundleData.addons.products.length\n ? {\n collection_id: bundleSettings.addons?.collection_id || '',\n collection_handle: bundleSettings.addons?.collection_handle || '',\n products: bundleData.addons.products.map(product => ({\n ...mapBasicProduct(product),\n price_range: { min: product.price, max: product.price },\n compare_at_price_range: { min: product.compare_at_price || 0, max: product.compare_at_price },\n variants: product.variants.map(variant => ({\n ...mapBasicVariant(variant),\n image: variant.image,\n selling_plan_allocations: variant.selling_plan_allocations.map(sellingPlan => ({\n price: sellingPlan.price,\n compare_at_price: sellingPlan.compare_at_price,\n selling_plan: mapSellingPlan(sellingPlan.selling_plan),\n })),\n })),\n })),\n }\n : null,\n cross_sells: bundleData.cross_sells.products.length\n ? {\n collection_id: bundleSettings.cross_sells?.collection_id || '',\n collection_handle: bundleSettings.cross_sells?.collection_handle || '',\n products: bundleData.cross_sells.products.map(mapProduct),\n }\n : null,\n incentives: mapIncentives(bundleData.incentives),\n };\n}\n"],"names":[],"mappings":";;AAGA,MAAM,iBAAA,GAAoB,CAAC,cAA4D,KAAA;AACrF,EAAM,MAAA,MAAA,GAAS,eAAe,eA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A,CAAA;AAAA,SACF,CAAA,CAAA;AAAA,OACF,CAAA,CAAA;AAAA,KAEJ,GAAA,IAAA;AAAA,IACJ,WAAa,EAAA,UAAA,CAAW,WAAY,CAAA,QAAA,CAAS,MACzC,GAAA;AAAA,MACE,aAAA,EAAe,cAAe,CAAA,WAAA,EAAa,aAAiB,IAAA,EAAA;AAAA,MAC5D,iBAAA,EAAmB,cAAe,CAAA,WAAA,EAAa,iBAAqB,IAAA,EAAA;AAAA,MACpE,QAAU,EAAA,UAAA,CAAW,WAAY,CAAA,QAAA,CAAS,IAAI,UAAU,CAAA;AAAA,KAE1D,GAAA,IAAA;AAAA,IACJ,UAAA,EAAY,aAAc,CAAA,UAAA,CAAW,UAAU,CAAA;AAAA,GACjD,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"bundleData.js","sources":["../../../src/utils/bundleData.ts"],"sourcesContent":["import { PublicBundleData, PriceRule } from '../types/bundleData';\nimport { BaseProduct, BaseProductVariant, BundleData as StorefrontBundleData } from '../types/bundle';\n\nconst mapBundleSettings = (bundleSettings: StorefrontBundleData['bundle_settings']) => {\n const addons = bundleSettings.layout_settings.addons;\n const crossSells = bundleSettings.layout_settings.crossSells;\n const customizationWindow = bundleSettings.customization_window;\n const defaultVariantId = bundleSettings.default_bundle_variant_id;\n const defaultFrequency = bundleSettings.layout_settings.defaultFrequency;\n\n return {\n default_variant_id: defaultVariantId ? String(defaultVariantId) : null,\n is_customizable: bundleSettings.is_customizable,\n price_rule: String(bundleSettings.price_rule).toUpperCase(),\n customization_window: customizationWindow\n ? {\n active_days: customizationWindow,\n disabled_message: bundleSettings.customization_window_disabled_message || '',\n }\n : null,\n addons: addons.collectionId\n ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle }\n : null,\n cross_sells: crossSells.collectionId\n ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle }\n : null,\n default_selling_plan_id: defaultFrequency || null,\n };\n};\n\nconst mapIncentives = (incentives: StorefrontBundleData['incentives']): PublicBundleData['incentives'] => {\n if (incentives.tiered_discounts.length === 0) return null;\n\n return {\n tiered_discounts: incentives.tiered_discounts.map(tieredDiscount => ({\n eligible_charge_types: tieredDiscount.eligible_charge_types,\n eligible_line_item_types: tieredDiscount.eligible_line_item_types,\n external_bundle_product_id: {\n ecommerce: tieredDiscount.external_bundle_product_id.ecommerce,\n },\n lookup_key: tieredDiscount.lookup_key,\n name: tieredDiscount.name,\n status: tieredDiscount.status,\n tiers: tieredDiscount.tiers.map(({ tier }) => ({\n tier: {\n lookup_key: tier.lookup_key,\n discount_type: tier.discount_type,\n discount_value: tier.discount_value,\n condition_quantity_gte: tier.condition_quantity_gte,\n },\n })),\n })),\n };\n};\n\nconst mapSellingPlan = (\n sellingPlan: StorefrontBundleData['selling_plan_groups'][number]['selling_plans'][number]\n): PublicBundleData['selling_plan_groups'][number]['selling_plans'][number] => ({\n id: sellingPlan.id,\n name: sellingPlan.name,\n options: sellingPlan.options.map(option => ({ name: option.name, value: option.value })),\n recurring_deliveries: sellingPlan.recurring_deliveries,\n price_adjustments: sellingPlan.price_adjustments.map(({ value, value_type }) => ({\n value,\n value_type,\n })),\n});\n\nconst mapSellingPlanGroups = (\n sellingPlanGroup: StorefrontBundleData['selling_plan_groups'][number]\n): PublicBundleData['selling_plan_groups'][number] => ({\n name: sellingPlanGroup.name,\n options: sellingPlanGroup.options.map(option => ({ name: option.name, values: option.values })),\n selling_plans: sellingPlanGroup.selling_plans.map(mapSellingPlan),\n});\n\nconst mapBasicVariant = (variant: BaseProductVariant) => ({\n id: String(variant.id),\n title: variant.title,\n price: variant.price,\n compare_at_price: variant.compare_at_price,\n options: variant.options,\n available_for_sale: variant.available,\n});\n\nconst formatFeaturedImage = (featuredImage: BaseProduct['featured_image']): string | null => {\n if (featuredImage == null || typeof featuredImage === 'string') return featuredImage;\n\n if ('src' in featuredImage) return featuredImage['src'];\n\n return null;\n};\n\nconst mapBasicProduct = (product: BaseProduct) => {\n return {\n id: String(product.id),\n title: product.title,\n description: product.description,\n available_for_sale: product.available,\n featured_image: formatFeaturedImage(product.featured_image),\n images: product.images,\n requires_selling_plan: product.requires_selling_plan,\n selling_plan_groups: product.selling_plan_groups.map(mapSellingPlanGroups),\n };\n};\n\nconst mapProduct = (product: StorefrontBundleData['collections'][number]['products'][number]) => {\n const productPlansLookup = productSellingPlansGroupLookup(product.selling_plan_groups);\n\n return {\n ...mapBasicProduct(product),\n handle: product.handle,\n tags: product.tags,\n price_range: { min: product.price_min, max: product.price_max },\n compare_at_price_range: { min: product.compare_at_price_min, max: product.compare_at_price_max },\n options: product.options,\n variants: product.variants.map(variant => ({\n ...mapBasicVariant(variant),\n selling_plan_allocations: variant.selling_plan_allocations.map(sellingPlan => ({\n price: sellingPlan.price,\n compare_at_price: sellingPlan.compare_at_price,\n selling_plan: mapSellingPlan(\n productPlansLookup[`${sellingPlan.selling_plan_group_id}-${sellingPlan.selling_plan_id}`]\n ),\n })),\n option1: variant.option1,\n option2: variant.option2,\n option3: variant.option3,\n sku: variant.sku || '',\n requires_shipping: variant.requires_shipping,\n taxable: variant.taxable,\n featured_image: formatFeaturedImage(variant.featured_image),\n public_title: variant.public_title,\n requires_selling_plan: variant.requires_selling_plan,\n })),\n };\n};\n\nconst mapBundleVariantRanges = ({\n items_count,\n ranges,\n}: Pick<StorefrontBundleData['bundle_settings']['variants'][number], 'items_count' | 'ranges'>) => {\n if (ranges.length > 0) {\n return ranges.map(({ quantity_max, quantity_min }) => ({ min: quantity_min, max: quantity_max }));\n }\n\n return [{ min: items_count, max: items_count }];\n};\n\nconst productSellingPlansGroupLookup = (sellingPlanGroups: BaseProduct['selling_plan_groups']) =>\n sellingPlanGroups.reduce<\n Record<string, StorefrontBundleData['selling_plan_groups'][number]['selling_plans'][number]>\n >((acc, current) => {\n current.selling_plans.forEach(sellingPlan => {\n const key = `${current.id}-${sellingPlan.id}`;\n acc[key] = sellingPlan;\n });\n\n return acc;\n }, {});\n\nexport function mapOnlineStoreToPublicBundleData(bundleData: StorefrontBundleData): PublicBundleData {\n const bundleSettings = mapBundleSettings(bundleData.bundle_settings);\n const variantsLookup = bundleData.variants.reduce<Record<string, StorefrontBundleData['variants'][number]>>(\n (acc, variant) => {\n acc[variant.id] = variant;\n return acc;\n },\n {}\n );\n\n return {\n id: String(bundleData.id),\n title: bundleData.title,\n handle: bundleData.handle,\n options: bundleData.options.map(option => ({\n name: option.name,\n position: option.position,\n values: option.values,\n })),\n default_variant_id: bundleSettings.default_variant_id,\n default_selling_plan_id: bundleSettings.default_selling_plan_id\n ? Number(bundleSettings.default_selling_plan_id)\n : null,\n available_for_sale: bundleData.available,\n requires_selling_plan: bundleData.requires_selling_plan,\n bundle_settings: {\n is_customizable: bundleSettings.is_customizable,\n price_rule: bundleSettings.price_rule as PriceRule,\n customization_window: bundleSettings.customization_window,\n max_quantity_per_variant: null,\n },\n variants: bundleData.bundle_settings.variants\n .filter(({ enabled }) => enabled)\n .map((item, index) => {\n const variant = variantsLookup[String(item.external_variant_id)];\n\n return {\n id: String(item.external_variant_id),\n title: variant.title,\n price: variant.price,\n compare_at_price: variant.compare_at_price,\n image: variant.image || '',\n available_for_sale: variant.available,\n options: variant.options,\n requires_selling_plan: variant.requires_selling_plan,\n selling_plan_allocations: variant.selling_plan_allocations.map(sellingPlan => ({\n price: sellingPlan.price,\n compare_at_price: sellingPlan.compare_at_price,\n selling_plan: mapSellingPlan(sellingPlan.selling_plan),\n })),\n ranges: mapBundleVariantRanges(item),\n collections: item.option_sources.map(source => ({\n id: source.option_source_id,\n source_platform: 'shopify',\n min: source.quantity_min || 0,\n max: source.quantity_max,\n })),\n default_selections: item.selection_defaults.map(selectionDefault => ({\n quantity: selectionDefault.quantity,\n product: {\n id: String(selectionDefault.product.id),\n handle: selectionDefault.handle,\n title: selectionDefault.product.title,\n description: selectionDefault.product.description,\n images: selectionDefault.product.images,\n },\n variant: {\n id: selectionDefault.external_variant_id,\n title: selectionDefault.variant.title,\n featured_image: formatFeaturedImage(selectionDefault.variant.featured_image),\n sku: selectionDefault.sku || '',\n },\n })),\n position: index,\n };\n }),\n selling_plan_groups: bundleData.selling_plan_groups.map(mapSellingPlanGroups),\n collections: Object.values(bundleData.collections).reduce<PublicBundleData['collections']>((acc, current) => {\n if (!Array.isArray(current.products)) {\n /* If a collection is not published in Online store, it is included \n as _1:{ handle: \"<collection-handle\"} in the collections object.\n We need to skip these collections.\n */\n return acc;\n }\n\n acc[String(current.id)] = {\n id: String(current.id),\n title: current.title,\n handle: current.handle,\n products: current.products.map(mapProduct),\n };\n\n return acc;\n }, {}),\n addons: bundleData.addons.products.length\n ? {\n collection_id: bundleSettings.addons?.collection_id || '',\n collection_handle: bundleSettings.addons?.collection_handle || '',\n products: bundleData.addons.products.map(product => ({\n ...mapBasicProduct(product),\n price_range: { min: product.price, max: product.price },\n compare_at_price_range: { min: product.compare_at_price || 0, max: product.compare_at_price },\n variants: product.variants.map(variant => ({\n ...mapBasicVariant(variant),\n image: variant.image,\n selling_plan_allocations: variant.selling_plan_allocations.map(sellingPlan => ({\n price: sellingPlan.price,\n compare_at_price: sellingPlan.compare_at_price,\n selling_plan: mapSellingPlan(sellingPlan.selling_plan),\n })),\n })),\n })),\n }\n : null,\n cross_sells: bundleData.cross_sells.products.length\n ? {\n collection_id: bundleSettings.cross_sells?.collection_id || '',\n collection_handle: bundleSettings.cross_sells?.collection_handle || '',\n products: bundleData.cross_sells.products.map(mapProduct),\n }\n : null,\n incentives: mapIncentives(bundleData.incentives),\n };\n}\n"],"names":[],"mappings":";;AAGA,MAAM,iBAAA,GAAoB,CAAC,cAA4D,KAAA;AACrF,EAAM,MAAA,MAAA,GAAS,eAAe,eAAgB,CAAA,MAAA,CAAA;AAC9C,EAAM,MAAA,UAAA,GAAa,eAAe,eAAgB,CAAA,UAAA,CAAA;AAClD,EAAA,MAAM,sBAAsB,cAAe,CAAA,oBAAA,CAAA;AAC3C,EAAA,MAAM,mBAAmB,cAAe,CAAA,yBAAA,CAAA;AACxC,EAAM,MAAA,gBAAA,GAAm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AAM,EAAA;AAAA,QACtD,sBAAA,EAAwB,EAAE,GAAK,EAAA,OAAA,CAAQ,oBAAoB,CAAG,EAAA,GAAA,EAAK,QAAQ,gBAAiB,EAAA;AAAA,QAC5F,QAAU,EAAA,OAAA,CAAQ,QAAS,CAAA,GAAA,CAAI,CAAY,OAAA,MAAA;AAAA,UACzC,GAAG,gBAAgB,OAAO,CAAA;AAAA,UAC1B,OAAO,OAAQ,CAAA,KAAA;AAAA,UACf,wBAA0B,EAAA,OAAA,CAAQ,wBAAyB,CAAA,GAAA,CAAI,CAAgB,WAAA,MAAA;AAAA,YAC7E,OAAO,WAAY,CAAA,KAAA;AAAA,YACnB,kBAAkB,WAAY,CAAA,gBAAA;AAAA,YAC9B,YAAA,EAAc,cAAe,CAAA,WAAA,CAAY,YAAY,CAAA;AAAA,WACrD,CAAA,CAAA;AAAA,SACF,CAAA,CAAA;AAAA,OACF,CAAA,CAAA;AAAA,KAEJ,GAAA,IAAA;AAAA,IACJ,WAAa,EAAA,UAAA,CAAW,WAAY,CAAA,QAAA,CAAS,MACzC,GAAA;AAAA,MACE,aAAA,EAAe,cAAe,CAAA,WAAA,EAAa,aAAiB,IAAA,EAAA;AAAA,MAC5D,iBAAA,EAAmB,cAAe,CAAA,WAAA,EAAa,iBAAqB,IAAA,EAAA;AAAA,MACpE,QAAU,EAAA,UAAA,CAAW,WAAY,CAAA,QAAA,CAAS,IAAI,UAAU,CAAA;AAAA,KAE1D,GAAA,IAAA;AAAA,IACJ,UAAA,EAAY,aAAc,CAAA,UAAA,CAAW,UAAU,CAAA;AAAA,GACjD,CAAA;AACF;;;;"}
@@ -49,7 +49,7 @@ async function rechargeApiRequest(method, url, { id, query, data, headers } = {}
49
49
  "X-Recharge-Sdk-Fn": session.internalFnCall,
50
50
  ...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
51
51
  ...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
52
- "X-Recharge-Sdk-Version": "1.54.1",
52
+ "X-Recharge-Sdk-Version": "1.55.0",
53
53
  "X-Request-Id": session.internalRequestId,
54
54
  ...session.tmp_fn_identifier ? { "X-Recharge-Sdk-Fn-Identifier": session.tmp_fn_identifier } : {},
55
55
  ...headers ? headers : {}
@@ -179,7 +179,7 @@ async function rechargeAdminRequest(method, url, { id, query, data, headers } =
179
179
  ...storefrontAccessToken ? { "X-Recharge-Storefront-Access-Token": storefrontAccessToken } : {},
180
180
  ...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
181
181
  ...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
182
- "X-Recharge-Sdk-Version": "1.54.1",
182
+ "X-Recharge-Sdk-Version": "1.55.0",
183
183
  ...headers ? headers : {}
184
184
  };
185
185
  return request(method, `${rechargeBaseUrl}${url}`, { id, query, data, headers: reqHeaders });
@@ -10,8 +10,12 @@ async function loadBundleData(id, options) {
10
10
  return loadFromOnlineStore(id, options?.country_code);
11
11
  }
12
12
  async function loadFromOnlineStore(id, country_code) {
13
+ const headers = {
14
+ "X-Recharge-Sdk-Fn": "loadFromOnlineStore",
15
+ "X-Recharge-Sdk-Version": "1.55.0"
16
+ };
13
17
  if (!country_code) {
14
- const data = await shopifyAppProxyRequest("get", `/bundle-data/${id}`);
18
+ const data = await shopifyAppProxyRequest("get", `/bundle-data/${id}`, { headers });
15
19
  return mapOnlineStoreToPublicBundleData(data);
16
20
  }
17
21
  const payload = new FormData();
@@ -19,10 +23,6 @@ async function loadFromOnlineStore(id, country_code) {
19
23
  payload.append("_method", "put");
20
24
  payload.append("return_to", `${SHOPIFY_APP_PROXY_URL}/bundle-data/${id}`);
21
25
  payload.append("country_code", country_code);
22
- const headers = {
23
- "X-Recharge-Sdk-Fn": "loadFromOnlineStore",
24
- "X-Recharge-Sdk-Version": "1.54.1"
25
- };
26
26
  try {
27
27
  const data = await request("post", "/localization", {
28
28
  headers: { "Content-Type": "multipart/form-data", ...headers },
@@ -1 +1 @@
1
- {"version":3,"file":"bundleData.js","sources":["../../../src/api/bundleData.ts"],"sourcesContent":["import { Options, PublicBundleData, ShopifyStorefrontOptions } from '../types/bundleData';\nimport { getOptions } from '../utils/options';\nimport { SHOPIFY_APP_PROXY_URL } from '../constants/api';\nimport { BundleData as StorefrontBundleData } from '../types/bundle';\nimport { request, shopifyAppProxyRequest } from '../utils/request';\nimport { mapOnlineStoreToPublicBundleData } from '../utils/bundleData';\n\n/**\n * Load bundle data from the specified source\n *\n * @param id - The external product ID (Shopify product ID)\n * @param options - Configuration for data source and parameters\n * @param options.source - The source of the data (online_store or shopify_storefront)\n * @param options.country_code - The country code for the online store\n * @param options.storefront_access_token - The storefront access token for the Shopify Storefront API\n * @returns Promise resolving to bundle data result with success/error handling\n *\n * @example\n * ```typescript\n * // Load from online store\n * const result = await loadBundleData({\n * source: 'online_store',\n * external_product_id: '123456789',\n * country_code: 'US'\n * });\n *\n * if (result.success) {\n * console.log('Bundle data:', result.data);\n * } else {\n * console.error('Error:', result.error.message);\n * }\n *\n * // Load from Shopify Storefront API\n * const result2 = await loadBundleData({\n * source: 'shopify_storefront',\n * external_product_id: '123456789',\n * country_code: 'US',\n * shopify_storefront_access_token: 'your-token-here'\n * });\n * ```\n */\nexport async function loadBundleData(id: string, options?: Options): Promise<PublicBundleData> {\n if (options?.source === 'shopify_storefront') {\n return loadFromShopifyStorefrontApi(id, options);\n }\n\n return loadFromOnlineStore(id, options?.country_code);\n}\n\n/**\n * Load bundle data from the online store endpoint\n */\nasync function loadFromOnlineStore(id: string, country_code?: string): Promise<PublicBundleData> {\n if (!country_code) {\n const data = await shopifyAppProxyRequest<StorefrontBundleData>('get', `/bundle-data/${id}`);\n return mapOnlineStoreToPublicBundleData(data);\n }\n\n const payload = new FormData();\n payload.append('form_type', 'localization');\n payload.append('_method', 'put');\n payload.append('return_to', `${SHOPIFY_APP_PROXY_URL}/bundle-data/${id}`);\n payload.append('country_code', country_code);\n\n const headers = {\n 'X-Recharge-Sdk-Fn': 'loadFromOnlineStore',\n 'X-Recharge-Sdk-Version': '__SDK_VERSION__',\n };\n try {\n const data = await request<StorefrontBundleData>('post', '/localization', {\n headers: { 'Content-Type': 'multipart/form-data', ...headers },\n data: payload,\n });\n return mapOnlineStoreToPublicBundleData(data);\n } catch (error) {\n const data = await shopifyAppProxyRequest<StorefrontBundleData>('get', `/bundle-data/${id}`, {\n headers,\n });\n return mapOnlineStoreToPublicBundleData(data);\n }\n}\n\n/**\n * Load bundle data from Shopify Storefront API\n */\nasync function loadFromShopifyStorefrontApi(id: string, options: ShopifyStorefrontOptions): Promise<PublicBundleData> {\n const opts = getOptions();\n\n if (!opts.storeIdentifier) {\n throw new Error('Store identifier is required for Shopify Storefront API requests');\n }\n\n // Request data from Shopify Storefront API\n return {} as PublicBundleData;\n}\n"],"names":[],"mappings":";;;;;AAyCsB,eAAA,cAAA,CAAe,IAAY,OAA8C,EAAA;AAC7F,EAAI,IAAA,OAAA,EAAS,WAAW,oBAAsB,EAAA;AAC5C,IAAO,OAAA,4BAAA,CAAwC,CAAA,CAAA;AAAA,GACjD;AAEA,EAAO,OAAA,mBAAA,CAAoB,EAAI,EAAA,OAAA,EAAS,YAAY,CAAA,CAAA;AACtD,CAAA;AAKA,eAAe,mBAAA,CAAoB,IAAY,YAAkD,EAAA;AAC/F,EAAA,IAAI,CAAC,YAAc,EAAA;AACjB,IAAA,MAAM,OAAO,MAAM,sBAAA,CAA6C,KAAO,EAAA,CAAA,aAAA,EAAgB,EAAE,CAAE,CAAA,CAAA,CAAA;AAC3F,IAAA,OAAO,iCAAiC,IAAI,CAAA,CAAA;AAAA,GAC9C;AAEA,EAAM,MAAA,OAAA,GAAU,IAAI,QAAS,EAAA,CAAA;AAC7B,EAAQ,OAAA,CAAA,MAAA,CAAO,aAAa,cAAc,CAAA,CAAA;AAC1C,EAAQ,OAAA,CAAA,MAAA,CAAO,WAAW,KAAK,CAAA,CAAA;AAC/B,EAAA,OAAA,CAAQ,OAAO,WAAa,EAAA,CAAA,EAAG,qBAAqB,CAAA,aAAA,EAAgB,EAAE,CAAE,CAAA,CAAA,CAAA;AACxE,EAAQ,OAAA,CAAA,MAAA,CAAO,gBAAgB,YAAY,CAAA,CAAA;AAE3C,EAAA,MAAM,OAAU,GAAA;AAAA,IACd,mBAAqB,EAAA,qBAAA;AAAA,IACrB,wBAA0B,EAAA,QAAA;AAAA,GAC5B,CAAA;AACA,EAAI,IAAA;AACF,IAAA,MAAM,IAAO,GAAA,MAAM,OAA8B,CAAA,MAAA,EAAQ,eAAiB,EAAA;AAAA,MACxE,OAAS,EAAA,EAAE,cAAgB,EAAA,qBAAA,EAAuB,GAAG,OAAQ,EAAA;AAAA,MAC7D,IAAM,EAAA,OAAA;AAAA,KACP,CAAA,CAAA;AACD,IAAA,OAAO,iCAAiC,IAAI,CAAA,CAAA;AAAA,WACrC,KAAO,EAAA;AACd,IAAA,MAAM,OAAO,MAAM,sBAAA,CAA6C,KAAO,EAAA,CAAA,aAAA,EAAgB,EAAE,CAAI,CAAA,EAAA;AAAA,MAC3F,OAAA;AAAA,KACD,CAAA,CAAA;AACD,IAAA,OAAO,iCAAiC,IAAI,CAAA,CAAA;AAAA,GAC9C;AACF,CAAA;AAKA,eAAe,4BAAA,CAA6B,IAAY,OAA8D,EAAA;AACpH,EAAA,MAAM,OAAO,UAAW,EAAA,CAAA;AAExB,EAAI,IAAA,CAAC,KAAK,eAAiB,EAAA;AACzB,IAAM,MAAA,IAAI,MAAM,kEAAkE,CAAA,CAAA;AAAA,GACpF;AAGA,EAAA,OAAO,EAAC,CAAA;AACV;;;;"}
1
+ {"version":3,"file":"bundleData.js","sources":["../../../src/api/bundleData.ts"],"sourcesContent":["import { Options, PublicBundleData, ShopifyStorefrontOptions } from '../types/bundleData';\nimport { getOptions } from '../utils/options';\nimport { SHOPIFY_APP_PROXY_URL } from '../constants/api';\nimport { BundleData as StorefrontBundleData } from '../types/bundle';\nimport { request, shopifyAppProxyRequest } from '../utils/request';\nimport { mapOnlineStoreToPublicBundleData } from '../utils/bundleData';\n\n/**\n * Load bundle data from the specified source\n *\n * @param id - The external product ID (Shopify product ID)\n * @param options - Configuration for data source and parameters\n * @param options.source - The source of the data (online_store or shopify_storefront)\n * @param options.country_code - The country code for the online store\n * @param options.storefront_access_token - The storefront access token for the Shopify Storefront API\n * @returns Promise resolving to bundle data result with success/error handling\n *\n * @example\n * ```typescript\n * // Load from online store\n * const result = await loadBundleData({\n * source: 'online_store',\n * external_product_id: '123456789',\n * country_code: 'US'\n * });\n *\n * if (result.success) {\n * console.log('Bundle data:', result.data);\n * } else {\n * console.error('Error:', result.error.message);\n * }\n *\n * // Load from Shopify Storefront API\n * const result2 = await loadBundleData({\n * source: 'shopify_storefront',\n * external_product_id: '123456789',\n * country_code: 'US',\n * shopify_storefront_access_token: 'your-token-here'\n * });\n * ```\n */\nexport async function loadBundleData(id: string, options?: Options): Promise<PublicBundleData> {\n if (options?.source === 'shopify_storefront') {\n return loadFromShopifyStorefrontApi(id, options);\n }\n\n return loadFromOnlineStore(id, options?.country_code);\n}\n\n/**\n * Load bundle data from the online store endpoint\n */\nasync function loadFromOnlineStore(id: string, country_code?: string): Promise<PublicBundleData> {\n const headers = {\n 'X-Recharge-Sdk-Fn': 'loadFromOnlineStore',\n 'X-Recharge-Sdk-Version': '__SDK_VERSION__',\n };\n\n if (!country_code) {\n const data = await shopifyAppProxyRequest<StorefrontBundleData>('get', `/bundle-data/${id}`, { headers });\n return mapOnlineStoreToPublicBundleData(data);\n }\n\n const payload = new FormData();\n payload.append('form_type', 'localization');\n payload.append('_method', 'put');\n payload.append('return_to', `${SHOPIFY_APP_PROXY_URL}/bundle-data/${id}`);\n payload.append('country_code', country_code);\n\n try {\n const data = await request<StorefrontBundleData>('post', '/localization', {\n headers: { 'Content-Type': 'multipart/form-data', ...headers },\n data: payload,\n });\n return mapOnlineStoreToPublicBundleData(data);\n } catch (error) {\n const data = await shopifyAppProxyRequest<StorefrontBundleData>('get', `/bundle-data/${id}`, {\n headers,\n });\n return mapOnlineStoreToPublicBundleData(data);\n }\n}\n\n/**\n * Load bundle data from Shopify Storefront API\n */\nasync function loadFromShopifyStorefrontApi(id: string, options: ShopifyStorefrontOptions): Promise<PublicBundleData> {\n const opts = getOptions();\n\n if (!opts.storeIdentifier) {\n throw new Error('Store identifier is required for Shopify Storefront API requests');\n }\n\n // Request data from Shopify Storefront API\n return {} as PublicBundleData;\n}\n"],"names":[],"mappings":";;;;;AAyCsB,eAAA,cAAA,CAAe,IAAY,OAA8C,EAAA;AAC7F,EAAI,IAAA,OAAA,EAAS,WAAW,oBAAsB,EAAA;AAC5C,IAAO,OAAA,4BAAA,CAAwC,CAAA,CAAA;AAAA,GACjD;AAEA,EAAO,OAAA,mBAAA,CAAoB,EAAI,EAAA,OAAA,EAAS,YAAY,CAAA,CAAA;AACtD,CAAA;AAKA,eAAe,mBAAA,CAAoB,IAAY,YAAkD,EAAA;AAC/F,EAAA,MAAM,OAAU,GAAA;AAAA,IACd,mBAAqB,EAAA,qBAAA;AAAA,IACrB,wBAA0B,EAAA,QAAA;AAAA,GAC5B,CAAA;AAEA,EAAA,IAAI,CAAC,YAAc,EAAA;AACjB,IAAM,MAAA,IAAA,GAAO,MAAM,sBAA6C,CAAA,KAAA,EAAO,gBAAgB,EAAE,CAAA,CAAA,EAAI,EAAE,OAAA,EAAS,CAAA,CAAA;AACxG,IAAA,OAAO,iCAAiC,IAAI,CAAA,CAAA;AAAA,GAC9C;AAEA,EAAM,MAAA,OAAA,GAAU,IAAI,QAAS,EAAA,CAAA;AAC7B,EAAQ,OAAA,CAAA,MAAA,CAAO,aAAa,cAAc,CAAA,CAAA;AAC1C,EAAQ,OAAA,CAAA,MAAA,CAAO,WAAW,KAAK,CAAA,CAAA;AAC/B,EAAA,OAAA,CAAQ,OAAO,WAAa,EAAA,CAAA,EAAG,qBAAqB,CAAA,aAAA,EAAgB,EAAE,CAAE,CAAA,CAAA,CAAA;AACxE,EAAQ,OAAA,CAAA,MAAA,CAAO,gBAAgB,YAAY,CAAA,CAAA;AAE3C,EAAI,IAAA;AACF,IAAA,MAAM,IAAO,GAAA,MAAM,OAA8B,CAAA,MAAA,EAAQ,eAAiB,EAAA;AAAA,MACxE,OAAS,EAAA,EAAE,cAAgB,EAAA,qBAAA,EAAuB,GAAG,OAAQ,EAAA;AAAA,MAC7D,IAAM,EAAA,OAAA;AAAA,KACP,CAAA,CAAA;AACD,IAAA,OAAO,iCAAiC,IAAI,CAAA,CAAA;AAAA,WACrC,KAAO,EAAA;AACd,IAAA,MAAM,OAAO,MAAM,sBAAA,CAA6C,KAAO,EAAA,CAAA,aAAA,EAAgB,EAAE,CAAI,CAAA,EAAA;AAAA,MAC3F,OAAA;AAAA,KACD,CAAA,CAAA;AACD,IAAA,OAAO,iCAAiC,IAAI,CAAA,CAAA;AAAA,GAC9C;AACF,CAAA;AAKA,eAAe,4BAAA,CAA6B,IAAY,OAA8D,EAAA;AACpH,EAAA,MAAM,OAAO,UAAW,EAAA,CAAA;AAExB,EAAI,IAAA,CAAC,KAAK,eAAiB,EAAA;AACzB,IAAM,MAAA,IAAI,MAAM,kEAAkE,CAAA,CAAA;AAAA,GACpF;AAGA,EAAA,OAAO,EAAC,CAAA;AACV;;;;"}
@@ -3,6 +3,7 @@ const mapBundleSettings = (bundleSettings) => {
3
3
  const crossSells = bundleSettings.layout_settings.crossSells;
4
4
  const customizationWindow = bundleSettings.customization_window;
5
5
  const defaultVariantId = bundleSettings.default_bundle_variant_id;
6
+ const defaultFrequency = bundleSettings.layout_settings.defaultFrequency;
6
7
  return {
7
8
  default_variant_id: defaultVariantId ? String(defaultVariantId) : null,
8
9
  is_customizable: bundleSettings.is_customizable,
@@ -12,7 +13,8 @@ const mapBundleSettings = (bundleSettings) => {
12
13
  disabled_message: bundleSettings.customization_window_disabled_message || ""
13
14
  } : null,
14
15
  addons: addons.collectionId ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle } : null,
15
- cross_sells: crossSells.collectionId ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle } : null
16
+ cross_sells: crossSells.collectionId ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle } : null,
17
+ default_selling_plan_id: defaultFrequency || null
16
18
  };
17
19
  };
18
20
  const mapIncentives = (incentives) => {
@@ -42,7 +44,7 @@ const mapIncentives = (incentives) => {
42
44
  const mapSellingPlan = (sellingPlan) => ({
43
45
  id: sellingPlan.id,
44
46
  name: sellingPlan.name,
45
- options: sellingPlan.options.map((option) => ({ name: option.name, values: option.values })),
47
+ options: sellingPlan.options.map((option) => ({ name: option.name, value: option.value })),
46
48
  recurring_deliveries: sellingPlan.recurring_deliveries,
47
49
  price_adjustments: sellingPlan.price_adjustments.map(({ value, value_type }) => ({
48
50
  value,
@@ -62,16 +64,25 @@ const mapBasicVariant = (variant) => ({
62
64
  options: variant.options,
63
65
  available_for_sale: variant.available
64
66
  });
65
- const mapBasicProduct = (product) => ({
66
- id: String(product.id),
67
- title: product.title,
68
- description: product.description,
69
- available_for_sale: product.available,
70
- featured_image: product.featured_image,
71
- images: product.images,
72
- requires_selling_plan: product.requires_selling_plan,
73
- selling_plan_groups: product.selling_plan_groups.map(mapSellingPlanGroups)
74
- });
67
+ const formatFeaturedImage = (featuredImage) => {
68
+ if (featuredImage == null || typeof featuredImage === "string")
69
+ return featuredImage;
70
+ if ("src" in featuredImage)
71
+ return featuredImage["src"];
72
+ return null;
73
+ };
74
+ const mapBasicProduct = (product) => {
75
+ return {
76
+ id: String(product.id),
77
+ title: product.title,
78
+ description: product.description,
79
+ available_for_sale: product.available,
80
+ featured_image: formatFeaturedImage(product.featured_image),
81
+ images: product.images,
82
+ requires_selling_plan: product.requires_selling_plan,
83
+ selling_plan_groups: product.selling_plan_groups.map(mapSellingPlanGroups)
84
+ };
85
+ };
75
86
  const mapProduct = (product) => {
76
87
  const productPlansLookup = productSellingPlansGroupLookup(product.selling_plan_groups);
77
88
  return {
@@ -93,10 +104,10 @@ const mapProduct = (product) => {
93
104
  option1: variant.option1,
94
105
  option2: variant.option2,
95
106
  option3: variant.option3,
96
- sku: variant.sku,
107
+ sku: variant.sku || "",
97
108
  requires_shipping: variant.requires_shipping,
98
109
  taxable: variant.taxable,
99
- featured_image: variant.featured_image,
110
+ featured_image: formatFeaturedImage(variant.featured_image),
100
111
  public_title: variant.public_title,
101
112
  requires_selling_plan: variant.requires_selling_plan
102
113
  }))
@@ -137,6 +148,7 @@ function mapOnlineStoreToPublicBundleData(bundleData) {
137
148
  values: option.values
138
149
  })),
139
150
  default_variant_id: bundleSettings.default_variant_id,
151
+ default_selling_plan_id: bundleSettings.default_selling_plan_id ? Number(bundleSettings.default_selling_plan_id) : null,
140
152
  available_for_sale: bundleData.available,
141
153
  requires_selling_plan: bundleData.requires_selling_plan,
142
154
  bundle_settings: {
@@ -180,8 +192,8 @@ function mapOnlineStoreToPublicBundleData(bundleData) {
180
192
  variant: {
181
193
  id: selectionDefault.external_variant_id,
182
194
  title: selectionDefault.variant.title,
183
- featured_image: selectionDefault.variant.featured_image,
184
- sku: selectionDefault.sku
195
+ featured_image: formatFeaturedImage(selectionDefault.variant.featured_image),
196
+ sku: selectionDefault.sku || ""
185
197
  }
186
198
  })),
187
199
  position: index
@@ -189,6 +201,9 @@ function mapOnlineStoreToPublicBundleData(bundleData) {
189
201
  }),
190
202
  selling_plan_groups: bundleData.selling_plan_groups.map(mapSellingPlanGroups),
191
203
  collections: Object.values(bundleData.collections).reduce((acc, current) => {
204
+ if (!Array.isArray(current.products)) {
205
+ return acc;
206
+ }
192
207
  acc[String(current.id)] = {
193
208
  id: String(current.id),
194
209
  title: current.title,
@@ -1 +1 @@
1
- {"version":3,"file":"bundleData.js","sources":["../../../src/utils/bundleData.ts"],"sourcesContent":["import { PublicBundleData, PriceRule } from '../types/bundleData';\nimport { BaseProduct, BaseProductVariant, BundleData as StorefrontBundleData } from '../types/bundle';\n\nconst mapBundleSettings = (bundleSettings: StorefrontBundleData['bundle_settings']) => {\n const addons = bundleSettings.layout_settings.addons;\n const crossSells = bundleSettings.layout_settings.crossSells;\n const customizationWindow = bundleSettings.customization_window;\n const defaultVariantId = bundleSettings.default_bundle_variant_id;\n\n return {\n default_variant_id: defaultVariantId ? String(defaultVariantId) : null,\n is_customizable: bundleSettings.is_customizable,\n price_rule: String(bundleSettings.price_rule).toUpperCase(),\n customization_window: customizationWindow\n ? {\n active_days: customizationWindow,\n disabled_message: bundleSettings.customization_window_disabled_message || '',\n }\n : null,\n addons: addons.collectionId\n ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle }\n : null,\n cross_sells: crossSells.collectionId\n ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle }\n : null,\n };\n};\n\nconst mapIncentives = (incentives: StorefrontBundleData['incentives']): PublicBundleData['incentives'] => {\n if (incentives.tiered_discounts.length === 0) return null;\n\n return {\n tiered_discounts: incentives.tiered_discounts.map(tieredDiscount => ({\n eligible_charge_types: tieredDiscount.eligible_charge_types,\n eligible_line_item_types: tieredDiscount.eligible_line_item_types,\n external_bundle_product_id: {\n ecommerce: tieredDiscount.external_bundle_product_id.ecommerce,\n },\n lookup_key: tieredDiscount.lookup_key,\n name: tieredDiscount.name,\n status: tieredDiscount.status,\n tiers: tieredDiscount.tiers.map(({ tier }) => ({\n tier: {\n lookup_key: tier.lookup_key,\n discount_type: tier.discount_type,\n discount_value: tier.discount_value,\n condition_quantity_gte: tier.condition_quantity_gte,\n },\n })),\n })),\n };\n};\n\nconst mapSellingPlan = (\n sellingPlan: StorefrontBundleData['selling_plan_groups'][number]['selling_plans'][number]\n): PublicBundleData['selling_plan_groups'][number]['selling_plans'][number] => ({\n id: sellingPlan.id,\n name: sellingPlan.name,\n options: sellingPlan.options.map(option => ({ name: option.name, values: option.values })),\n recurring_deliveries: sellingPlan.recurring_deliveries,\n price_adjustments: sellingPlan.price_adjustments.map(({ value, value_type }) => ({\n value,\n value_type,\n })),\n});\n\nconst mapSellingPlanGroups = (\n sellingPlanGroup: StorefrontBundleData['selling_plan_groups'][number]\n): PublicBundleData['selling_plan_groups'][number] => ({\n name: sellingPlanGroup.name,\n options: sellingPlanGroup.options.map(option => ({ name: option.name, values: option.values })),\n selling_plans: sellingPlanGroup.selling_plans.map(mapSellingPlan),\n});\n\nconst mapBasicVariant = (variant: BaseProductVariant) => ({\n id: String(variant.id),\n title: variant.title,\n price: variant.price,\n compare_at_price: variant.compare_at_price,\n options: variant.options,\n available_for_sale: variant.available,\n});\n\nconst mapBasicProduct = (product: BaseProduct) => ({\n id: String(product.id),\n title: product.title,\n description: product.description,\n available_for_sale: product.available,\n featured_image: product.featured_image,\n images: product.images,\n requires_selling_plan: product.requires_selling_plan,\n selling_plan_groups: product.selling_plan_groups.map(mapSellingPlanGroups),\n});\n\nconst mapProduct = (product: StorefrontBundleData['collections'][number]['products'][number]) => {\n const productPlansLookup = productSellingPlansGroupLookup(product.selling_plan_groups);\n\n return {\n ...mapBasicProduct(product),\n handle: product.handle,\n tags: product.tags,\n price_range: { min: product.price_min, max: product.price_max },\n compare_at_price_range: { min: product.compare_at_price_min, max: product.compare_at_price_max },\n options: product.options,\n variants: product.variants.map(variant => ({\n ...mapBasicVariant(variant),\n selling_plan_allocations: variant.selling_plan_allocations.map(sellingPlan => ({\n price: sellingPlan.price,\n compare_at_price: sellingPlan.compare_at_price,\n selling_plan: mapSellingPlan(\n productPlansLookup[`${sellingPlan.selling_plan_group_id}-${sellingPlan.selling_plan_id}`]\n ),\n })),\n option1: variant.option1,\n option2: variant.option2,\n option3: variant.option3,\n sku: variant.sku,\n requires_shipping: variant.requires_shipping,\n taxable: variant.taxable,\n featured_image: variant.featured_image,\n public_title: variant.public_title,\n requires_selling_plan: variant.requires_selling_plan,\n })),\n };\n};\n\nconst mapBundleVariantRanges = ({\n items_count,\n ranges,\n}: Pick<StorefrontBundleData['bundle_settings']['variants'][number], 'items_count' | 'ranges'>) => {\n if (ranges.length > 0) {\n return ranges.map(({ quantity_max, quantity_min }) => ({ min: quantity_min, max: quantity_max }));\n }\n\n return [{ min: items_count, max: items_count }];\n};\n\nconst productSellingPlansGroupLookup = (sellingPlanGroups: BaseProduct['selling_plan_groups']) =>\n sellingPlanGroups.reduce<\n Record<string, StorefrontBundleData['selling_plan_groups'][number]['selling_plans'][number]>\n >((acc, current) => {\n current.selling_plans.forEach(sellingPlan => {\n const key = `${current.id}-${sellingPlan.id}`;\n acc[key] = sellingPlan;\n });\n\n return acc;\n }, {});\n\nexport function mapOnlineStoreToPublicBundleData(bundleData: StorefrontBundleData): PublicBundleData {\n const bundleSettings = mapBundleSettings(bundleData.bundle_settings);\n const variantsLookup = bundleData.variants.reduce<Record<string, StorefrontBundleData['variants'][number]>>(\n (acc, variant) => {\n acc[variant.id] = variant;\n return acc;\n },\n {}\n );\n\n return {\n id: String(bundleData.id),\n title: bundleData.title,\n handle: bundleData.handle,\n options: bundleData.options.map(option => ({\n name: option.name,\n position: option.position,\n values: option.values,\n })),\n default_variant_id: bundleSettings.default_variant_id,\n available_for_sale: bundleData.available,\n requires_selling_plan: bundleData.requires_selling_plan,\n bundle_settings: {\n is_customizable: bundleSettings.is_customizable,\n price_rule: bundleSettings.price_rule as PriceRule,\n customization_window: bundleSettings.customization_window,\n max_quantity_per_variant: null,\n },\n variants: bundleData.bundle_settings.variants\n .filter(({ enabled }) => enabled)\n .map((item, index) => {\n const variant = variantsLookup[String(item.external_variant_id)];\n\n return {\n id: String(item.external_variant_id),\n title: variant.title,\n price: variant.price,\n compare_at_price: variant.compare_at_price,\n image: variant.image || '',\n available_for_sale: variant.available,\n options: variant.options,\n requires_selling_plan: variant.requires_selling_plan,\n selling_plan_allocations: variant.selling_plan_allocations.map(sellingPlan => ({\n price: sellingPlan.price,\n compare_at_price: sellingPlan.compare_at_price,\n selling_plan: mapSellingPlan(sellingPlan.selling_plan),\n })),\n ranges: mapBundleVariantRanges(item),\n collections: item.option_sources.map(source => ({\n id: source.option_source_id,\n source_platform: 'shopify',\n min: source.quantity_min || 0,\n max: source.quantity_max,\n })),\n default_selections: item.selection_defaults.map(selectionDefault => ({\n quantity: selectionDefault.quantity,\n product: {\n id: String(selectionDefault.product.id),\n handle: selectionDefault.handle,\n title: selectionDefault.product.title,\n description: selectionDefault.product.description,\n images: selectionDefault.product.images,\n },\n variant: {\n id: selectionDefault.external_variant_id,\n title: selectionDefault.variant.title,\n featured_image: selectionDefault.variant.featured_image,\n sku: selectionDefault.sku,\n },\n })),\n position: index,\n };\n }),\n selling_plan_groups: bundleData.selling_plan_groups.map(mapSellingPlanGroups),\n collections: Object.values(bundleData.collections).reduce<PublicBundleData['collections']>((acc, current) => {\n acc[String(current.id)] = {\n id: String(current.id),\n title: current.title,\n handle: current.handle,\n products: current.products.map(mapProduct),\n };\n\n return acc;\n }, {}),\n addons: bundleData.addons.products.length\n ? {\n collection_id: bundleSettings.addons?.collection_id || '',\n collection_handle: bundleSettings.addons?.collection_handle || '',\n products: bundleData.addons.products.map(product => ({\n ...mapBasicProduct(product),\n price_range: { min: product.price, max: product.price },\n compare_at_price_range: { min: product.compare_at_price || 0, max: product.compare_at_price },\n variants: product.variants.map(variant => ({\n ...mapBasicVariant(variant),\n image: variant.image,\n selling_plan_allocations: variant.selling_plan_allocations.map(sellingPlan => ({\n price: sellingPlan.price,\n compare_at_price: sellingPlan.compare_at_price,\n selling_plan: mapSellingPlan(sellingPlan.selling_plan),\n })),\n })),\n })),\n }\n : null,\n cross_sells: bundleData.cross_sells.products.length\n ? {\n collection_id: bundleSettings.cross_sells?.collection_id || '',\n collection_handle: bundleSettings.cross_sells?.collection_handle || '',\n products: bundleData.cross_sells.products.map(mapProduct),\n }\n : null,\n incentives: mapIncentives(bundleData.incentives),\n };\n}\n"],"names":[],"mappings":"AAGA,MAAM,iBAAA,GAAoB,CAAC,cAA4D,KAAA;AACrF,EAAM,MAAA,MAAA,GAAS,eAAe,eAAgB,CAAA,MAAA,CAAA;AAC9C,EAAM,MAAA,UAAA,GAAa,eAAe,eAAgB,CAAA,UAAA,CAAA;AAClD,EAAA,MAAM,sBAAsB,cAAe,CAAA,oBAAA,CAAA;AAC3C,EAAA,MAAM,mBA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E,aAAA,EAAe,cAAe,CAAA,WAAA,EAAa,aAAiB,IAAA,EAAA;AAAA,MAC5D,iBAAA,EAAmB,cAAe,CAAA,WAAA,EAAa,iBAAqB,IAAA,EAAA;AAAA,MACpE,QAAU,EAAA,UAAA,CAAW,WAAY,CAAA,QAAA,CAAS,IAAI,UAAU,CAAA;AAAA,KAE1D,GAAA,IAAA;AAAA,IACJ,UAAA,EAAY,aAAc,CAAA,UAAA,CAAW,UAAU,CAAA;AAAA,GACjD,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"bundleData.js","sources":["../../../src/utils/bundleData.ts"],"sourcesContent":["import { PublicBundleData, PriceRule } from '../types/bundleData';\nimport { BaseProduct, BaseProductVariant, BundleData as StorefrontBundleData } from '../types/bundle';\n\nconst mapBundleSettings = (bundleSettings: StorefrontBundleData['bundle_settings']) => {\n const addons = bundleSettings.layout_settings.addons;\n const crossSells = bundleSettings.layout_settings.crossSells;\n const customizationWindow = bundleSettings.customization_window;\n const defaultVariantId = bundleSettings.default_bundle_variant_id;\n const defaultFrequency = bundleSettings.layout_settings.defaultFrequency;\n\n return {\n default_variant_id: defaultVariantId ? String(defaultVariantId) : null,\n is_customizable: bundleSettings.is_customizable,\n price_rule: String(bundleSettings.price_rule).toUpperCase(),\n customization_window: customizationWindow\n ? {\n active_days: customizationWindow,\n disabled_message: bundleSettings.customization_window_disabled_message || '',\n }\n : null,\n addons: addons.collectionId\n ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle }\n : null,\n cross_sells: crossSells.collectionId\n ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle }\n : null,\n default_selling_plan_id: defaultFrequency || null,\n };\n};\n\nconst mapIncentives = (incentives: StorefrontBundleData['incentives']): PublicBundleData['incentives'] => {\n if (incentives.tiered_discounts.length === 0) return null;\n\n return {\n tiered_discounts: incentives.tiered_discounts.map(tieredDiscount => ({\n eligible_charge_types: tieredDiscount.eligible_charge_types,\n eligible_line_item_types: tieredDiscount.eligible_line_item_types,\n external_bundle_product_id: {\n ecommerce: tieredDiscount.external_bundle_product_id.ecommerce,\n },\n lookup_key: tieredDiscount.lookup_key,\n name: tieredDiscount.name,\n status: tieredDiscount.status,\n tiers: tieredDiscount.tiers.map(({ tier }) => ({\n tier: {\n lookup_key: tier.lookup_key,\n discount_type: tier.discount_type,\n discount_value: tier.discount_value,\n condition_quantity_gte: tier.condition_quantity_gte,\n },\n })),\n })),\n };\n};\n\nconst mapSellingPlan = (\n sellingPlan: StorefrontBundleData['selling_plan_groups'][number]['selling_plans'][number]\n): PublicBundleData['selling_plan_groups'][number]['selling_plans'][number] => ({\n id: sellingPlan.id,\n name: sellingPlan.name,\n options: sellingPlan.options.map(option => ({ name: option.name, value: option.value })),\n recurring_deliveries: sellingPlan.recurring_deliveries,\n price_adjustments: sellingPlan.price_adjustments.map(({ value, value_type }) => ({\n value,\n value_type,\n })),\n});\n\nconst mapSellingPlanGroups = (\n sellingPlanGroup: StorefrontBundleData['selling_plan_groups'][number]\n): PublicBundleData['selling_plan_groups'][number] => ({\n name: sellingPlanGroup.name,\n options: sellingPlanGroup.options.map(option => ({ name: option.name, values: option.values })),\n selling_plans: sellingPlanGroup.selling_plans.map(mapSellingPlan),\n});\n\nconst mapBasicVariant = (variant: BaseProductVariant) => ({\n id: String(variant.id),\n title: variant.title,\n price: variant.price,\n compare_at_price: variant.compare_at_price,\n options: variant.options,\n available_for_sale: variant.available,\n});\n\nconst formatFeaturedImage = (featuredImage: BaseProduct['featured_image']): string | null => {\n if (featuredImage == null || typeof featuredImage === 'string') return featuredImage;\n\n if ('src' in featuredImage) return featuredImage['src'];\n\n return null;\n};\n\nconst mapBasicProduct = (product: BaseProduct) => {\n return {\n id: String(product.id),\n title: product.title,\n description: product.description,\n available_for_sale: product.available,\n featured_image: formatFeaturedImage(product.featured_image),\n images: product.images,\n requires_selling_plan: product.requires_selling_plan,\n selling_plan_groups: product.selling_plan_groups.map(mapSellingPlanGroups),\n };\n};\n\nconst mapProduct = (product: StorefrontBundleData['collections'][number]['products'][number]) => {\n const productPlansLookup = productSellingPlansGroupLookup(product.selling_plan_groups);\n\n return {\n ...mapBasicProduct(product),\n handle: product.handle,\n tags: product.tags,\n price_range: { min: product.price_min, max: product.price_max },\n compare_at_price_range: { min: product.compare_at_price_min, max: product.compare_at_price_max },\n options: product.options,\n variants: product.variants.map(variant => ({\n ...mapBasicVariant(variant),\n selling_plan_allocations: variant.selling_plan_allocations.map(sellingPlan => ({\n price: sellingPlan.price,\n compare_at_price: sellingPlan.compare_at_price,\n selling_plan: mapSellingPlan(\n productPlansLookup[`${sellingPlan.selling_plan_group_id}-${sellingPlan.selling_plan_id}`]\n ),\n })),\n option1: variant.option1,\n option2: variant.option2,\n option3: variant.option3,\n sku: variant.sku || '',\n requires_shipping: variant.requires_shipping,\n taxable: variant.taxable,\n featured_image: formatFeaturedImage(variant.featured_image),\n public_title: variant.public_title,\n requires_selling_plan: variant.requires_selling_plan,\n })),\n };\n};\n\nconst mapBundleVariantRanges = ({\n items_count,\n ranges,\n}: Pick<StorefrontBundleData['bundle_settings']['variants'][number], 'items_count' | 'ranges'>) => {\n if (ranges.length > 0) {\n return ranges.map(({ quantity_max, quantity_min }) => ({ min: quantity_min, max: quantity_max }));\n }\n\n return [{ min: items_count, max: items_count }];\n};\n\nconst productSellingPlansGroupLookup = (sellingPlanGroups: BaseProduct['selling_plan_groups']) =>\n sellingPlanGroups.reduce<\n Record<string, StorefrontBundleData['selling_plan_groups'][number]['selling_plans'][number]>\n >((acc, current) => {\n current.selling_plans.forEach(sellingPlan => {\n const key = `${current.id}-${sellingPlan.id}`;\n acc[key] = sellingPlan;\n });\n\n return acc;\n }, {});\n\nexport function mapOnlineStoreToPublicBundleData(bundleData: StorefrontBundleData): PublicBundleData {\n const bundleSettings = mapBundleSettings(bundleData.bundle_settings);\n const variantsLookup = bundleData.variants.reduce<Record<string, StorefrontBundleData['variants'][number]>>(\n (acc, variant) => {\n acc[variant.id] = variant;\n return acc;\n },\n {}\n );\n\n return {\n id: String(bundleData.id),\n title: bundleData.title,\n handle: bundleData.handle,\n options: bundleData.options.map(option => ({\n name: option.name,\n position: option.position,\n values: option.values,\n })),\n default_variant_id: bundleSettings.default_variant_id,\n default_selling_plan_id: bundleSettings.default_selling_plan_id\n ? Number(bundleSettings.default_selling_plan_id)\n : null,\n available_for_sale: bundleData.available,\n requires_selling_plan: bundleData.requires_selling_plan,\n bundle_settings: {\n is_customizable: bundleSettings.is_customizable,\n price_rule: bundleSettings.price_rule as PriceRule,\n customization_window: bundleSettings.customization_window,\n max_quantity_per_variant: null,\n },\n variants: bundleData.bundle_settings.variants\n .filter(({ enabled }) => enabled)\n .map((item, index) => {\n const variant = variantsLookup[String(item.external_variant_id)];\n\n return {\n id: String(item.external_variant_id),\n title: variant.title,\n price: variant.price,\n compare_at_price: variant.compare_at_price,\n image: variant.image || '',\n available_for_sale: variant.available,\n options: variant.options,\n requires_selling_plan: variant.requires_selling_plan,\n selling_plan_allocations: variant.selling_plan_allocations.map(sellingPlan => ({\n price: sellingPlan.price,\n compare_at_price: sellingPlan.compare_at_price,\n selling_plan: mapSellingPlan(sellingPlan.selling_plan),\n })),\n ranges: mapBundleVariantRanges(item),\n collections: item.option_sources.map(source => ({\n id: source.option_source_id,\n source_platform: 'shopify',\n min: source.quantity_min || 0,\n max: source.quantity_max,\n })),\n default_selections: item.selection_defaults.map(selectionDefault => ({\n quantity: selectionDefault.quantity,\n product: {\n id: String(selectionDefault.product.id),\n handle: selectionDefault.handle,\n title: selectionDefault.product.title,\n description: selectionDefault.product.description,\n images: selectionDefault.product.images,\n },\n variant: {\n id: selectionDefault.external_variant_id,\n title: selectionDefault.variant.title,\n featured_image: formatFeaturedImage(selectionDefault.variant.featured_image),\n sku: selectionDefault.sku || '',\n },\n })),\n position: index,\n };\n }),\n selling_plan_groups: bundleData.selling_plan_groups.map(mapSellingPlanGroups),\n collections: Object.values(bundleData.collections).reduce<PublicBundleData['collections']>((acc, current) => {\n if (!Array.isArray(current.products)) {\n /* If a collection is not published in Online store, it is included \n as _1:{ handle: \"<collection-handle\"} in the collections object.\n We need to skip these collections.\n */\n return acc;\n }\n\n acc[String(current.id)] = {\n id: String(current.id),\n title: current.title,\n handle: current.handle,\n products: current.products.map(mapProduct),\n };\n\n return acc;\n }, {}),\n addons: bundleData.addons.products.length\n ? {\n collection_id: bundleSettings.addons?.collection_id || '',\n collection_handle: bundleSettings.addons?.collection_handle || '',\n products: bundleData.addons.products.map(product => ({\n ...mapBasicProduct(product),\n price_range: { min: product.price, max: product.price },\n compare_at_price_range: { min: product.compare_at_price || 0, max: product.compare_at_price },\n variants: product.variants.map(variant => ({\n ...mapBasicVariant(variant),\n image: variant.image,\n selling_plan_allocations: variant.selling_plan_allocations.map(sellingPlan => ({\n price: sellingPlan.price,\n compare_at_price: sellingPlan.compare_at_price,\n selling_plan: mapSellingPlan(sellingPlan.selling_plan),\n })),\n })),\n })),\n }\n : null,\n cross_sells: bundleData.cross_sells.products.length\n ? {\n collection_id: bundleSettings.cross_sells?.collection_id || '',\n collection_handle: bundleSettings.cross_sells?.collection_handle || '',\n products: bundleData.cross_sells.products.map(mapProduct),\n }\n : null,\n incentives: mapIncentives(bundleData.incentives),\n };\n}\n"],"names":[],"mappings":"AAGA,MAAM,iBAAA,GAAoB,CAAC,cAA4D,KAAA;AACrF,EAAM,MAAA,MAAA,GAAS,eAAe,eAAgB,CAAA,MAAA,CAAA;AAC9C,EAAM,MAAA,UAAA,GAAa,eAAe,eAAgB,CAAA,UAAA,CAAA;AAClD,EAAA,MAAM,sBAAsB,cAAe,CAAA,oBAAA,CAAA;AAC3C,EAAA,MAAM,mBAAmB,cAAe,CAAA,yBAAA,CAAA;AACxC,EAAM,MAAA,gBAAA,GAAmB,eAAe,eAAgB,CAAA,gBAAA,CAAA;AAExD,EAAO,OAAA;AAAA,IACL,kBAAoB,EAAA,gBAAA,GAAmB,MAAO,CAAA,gBAAgB,CAAI,GAAA,IAAA;AAAA,IAClE,iBAAiB,cAAe,CAA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QAAS,CAAA,GAAA,CAAI,CAAY,OAAA,MAAA;AAAA,UACzC,GAAG,gBAAgB,OAAO,CAAA;AAAA,UAC1B,OAAO,OAAQ,CAAA,KAAA;AAAA,UACf,wBAA0B,EAAA,OAAA,CAAQ,wBAAyB,CAAA,GAAA,CAAI,CAAgB,WAAA,MAAA;AAAA,YAC7E,OAAO,WAAY,CAAA,KAAA;AAAA,YACnB,kBAAkB,WAAY,CAAA,gBAAA;AAAA,YAC9B,YAAA,EAAc,cAAe,CAAA,WAAA,CAAY,YAAY,CAAA;AAAA,WACrD,CAAA,CAAA;AAAA,SACF,CAAA,CAAA;AAAA,OACF,CAAA,CAAA;AAAA,KAEJ,GAAA,IAAA;AAAA,IACJ,WAAa,EAAA,UAAA,CAAW,WAAY,CAAA,QAAA,CAAS,MACzC,GAAA;AAAA,MACE,aAAA,EAAe,cAAe,CAAA,WAAA,EAAa,aAAiB,IAAA,EAAA;AAAA,MAC5D,iBAAA,EAAmB,cAAe,CAAA,WAAA,EAAa,iBAAqB,IAAA,EAAA;AAAA,MACpE,QAAU,EAAA,UAAA,CAAW,WAAY,CAAA,QAAA,CAAS,IAAI,UAAU,CAAA;AAAA,KAE1D,GAAA,IAAA;AAAA,IACJ,UAAA,EAAY,aAAc,CAAA,UAAA,CAAW,UAAU,CAAA;AAAA,GACjD,CAAA;AACF;;;;"}
@@ -47,7 +47,7 @@ async function rechargeApiRequest(method, url, { id, query, data, headers } = {}
47
47
  "X-Recharge-Sdk-Fn": session.internalFnCall,
48
48
  ...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
49
49
  ...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
50
- "X-Recharge-Sdk-Version": "1.54.1",
50
+ "X-Recharge-Sdk-Version": "1.55.0",
51
51
  "X-Request-Id": session.internalRequestId,
52
52
  ...session.tmp_fn_identifier ? { "X-Recharge-Sdk-Fn-Identifier": session.tmp_fn_identifier } : {},
53
53
  ...headers ? headers : {}
package/dist/index.d.ts CHANGED
@@ -703,7 +703,7 @@ interface SellingPlan$1 {
703
703
  options: {
704
704
  name: string;
705
705
  position: number;
706
- values: string[];
706
+ value: string;
707
707
  }[];
708
708
  recurring_deliveries: boolean;
709
709
  price_adjustments: {
@@ -740,7 +740,7 @@ interface BundleData {
740
740
  price_rule: BundleProduct['price_rule'];
741
741
  customization_window: BundleProduct['customization_window'];
742
742
  customization_window_disabled_message: BundleProduct['customization_window_disabled_message'];
743
- layout_settings: Pick<BundleProduct['layout_settings'], 'addons' | 'crossSells'>;
743
+ layout_settings: Pick<BundleProduct['layout_settings'], 'addons' | 'crossSells' | 'defaultFrequency'>;
744
744
  variants: {
745
745
  ranges: BundleProduct['variants'][number]['ranges'];
746
746
  enabled: BundleProduct['variants'][number]['enabled'];
@@ -1746,6 +1746,8 @@ interface PublicBundleData {
1746
1746
  values: string[];
1747
1747
  }[];
1748
1748
  default_variant_id: string | null;
1749
+ /** Default selling plan ID (from Shopify) or 0 if onetime purchase */
1750
+ default_selling_plan_id: number | null;
1749
1751
  /** Whether the bundle is available for purchase */
1750
1752
  available_for_sale: boolean;
1751
1753
  /** Whether the bundle requires a selling plan (subscription) */
@@ -1864,7 +1866,7 @@ interface BundleDataSellingPlan {
1864
1866
  name: string;
1865
1867
  options: {
1866
1868
  name: string;
1867
- values: string[];
1869
+ value: string;
1868
1870
  }[];
1869
1871
  recurring_deliveries: boolean;
1870
1872
  price_adjustments: {