@rechargeapps/storefront-client 1.48.0 → 1.50.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.
- package/dist/cjs/api/auth.js +1 -1
- package/dist/cjs/api/bundle.js.map +1 -1
- package/dist/cjs/api/bundleData.js +50 -0
- package/dist/cjs/api/bundleData.js.map +1 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils/bundleData.js +224 -0
- package/dist/cjs/utils/bundleData.js.map +1 -0
- package/dist/cjs/utils/request.js +1 -1
- package/dist/esm/api/auth.js +1 -1
- package/dist/esm/api/bundle.js.map +1 -1
- package/dist/esm/api/bundleData.js +48 -0
- package/dist/esm/api/bundleData.js.map +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/bundleData.js +222 -0
- package/dist/esm/utils/bundleData.js.map +1 -0
- package/dist/esm/utils/request.js +1 -1
- package/dist/index.d.ts +489 -11
- package/dist/umd/recharge-client.min.js +11 -11
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { applyDiscountToAddress, createAddress, deleteAddress, getAddress, listAddresses, mergeAddresses, removeDiscountsFromAddress, skipFutureCharge, updateAddress } from './api/address.js';
|
|
2
2
|
export { loginCustomerPortal, loginShopifyApi, loginShopifyAppProxy, loginWithShopifyCustomerAccount, loginWithShopifyStorefront, sendPasswordlessCode, sendPasswordlessCodeAppProxy, validatePasswordlessCode, validatePasswordlessCodeAppProxy } from './api/auth.js';
|
|
3
3
|
export { createBundleSelection, deleteBundleSelection, getBundleId, getBundleSelection, getBundleSelectionId, getDynamicBundleItems, listBundleSelections, updateBundle, updateBundleSelection, validateBundle, validateBundleSelection, validateDynamicBundle } from './api/bundle.js';
|
|
4
|
+
export { loadBundleData } from './api/bundleData.js';
|
|
4
5
|
export { getCDNBundleSettings, getCDNProduct, getCDNProductAndSettings, getCDNProducts, getCDNProductsAndSettings, getCDNStoreSettings, getCDNWidgetSettings, resetCDNCache } from './api/cdn.js';
|
|
5
6
|
export { applyDiscountToCharge, getCharge, listCharges, processCharge, removeDiscountsFromCharge, skipCharge, unskipCharge } from './api/charge.js';
|
|
6
7
|
export { getCollection, listCollectionProducts, listCollections } from './api/collection.js';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
const mapBundleSettings = (bundleSettings) => {
|
|
2
|
+
const addons = bundleSettings.layout_settings.addons;
|
|
3
|
+
const crossSells = bundleSettings.layout_settings.crossSells;
|
|
4
|
+
const customizationWindow = bundleSettings.customization_window;
|
|
5
|
+
const defaultVariantId = bundleSettings.default_bundle_variant_id;
|
|
6
|
+
return {
|
|
7
|
+
default_variant_id: defaultVariantId ? String(defaultVariantId) : null,
|
|
8
|
+
is_customizable: bundleSettings.is_customizable,
|
|
9
|
+
price_rule: String(bundleSettings.price_rule).toUpperCase(),
|
|
10
|
+
customization_window: customizationWindow ? {
|
|
11
|
+
active_days: customizationWindow,
|
|
12
|
+
disabled_message: bundleSettings.customization_window_disabled_message || ""
|
|
13
|
+
} : null,
|
|
14
|
+
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
|
+
};
|
|
17
|
+
};
|
|
18
|
+
const mapIncentives = (incentives) => {
|
|
19
|
+
if (incentives.tiered_discounts.length === 0)
|
|
20
|
+
return null;
|
|
21
|
+
return {
|
|
22
|
+
tiered_discounts: incentives.tiered_discounts.map((tieredDiscount) => ({
|
|
23
|
+
eligible_charge_types: tieredDiscount.eligible_charge_types,
|
|
24
|
+
eligible_line_item_types: tieredDiscount.eligible_line_item_types,
|
|
25
|
+
external_product_id: tieredDiscount.external_product_id,
|
|
26
|
+
name: tieredDiscount.name,
|
|
27
|
+
status: tieredDiscount.status,
|
|
28
|
+
tiers: tieredDiscount.tiers.map((tiered) => ({
|
|
29
|
+
discount_type: tiered.discount_type,
|
|
30
|
+
discount_value: tiered.discount_value,
|
|
31
|
+
condition_quantity_gte: tiered.condition_quantity_gte
|
|
32
|
+
}))
|
|
33
|
+
}))
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
const mapSellingPlan = (sellingPlan) => ({
|
|
37
|
+
id: sellingPlan.id,
|
|
38
|
+
name: sellingPlan.name,
|
|
39
|
+
options: sellingPlan.options.map((option) => ({ name: option.name, values: option.values })),
|
|
40
|
+
recurring_deliveries: sellingPlan.recurring_deliveries,
|
|
41
|
+
price_adjustments: sellingPlan.price_adjustments.map(({ value, value_type }) => ({
|
|
42
|
+
value,
|
|
43
|
+
value_type
|
|
44
|
+
}))
|
|
45
|
+
});
|
|
46
|
+
const mapSellingPlanGroups = (sellingPlanGroup) => ({
|
|
47
|
+
name: sellingPlanGroup.name,
|
|
48
|
+
options: sellingPlanGroup.options.map((option) => ({ name: option.name, values: option.values })),
|
|
49
|
+
selling_plans: sellingPlanGroup.selling_plans.map(mapSellingPlan)
|
|
50
|
+
});
|
|
51
|
+
const mapBasicVariant = (variant) => ({
|
|
52
|
+
id: String(variant.id),
|
|
53
|
+
title: variant.title,
|
|
54
|
+
price: variant.price,
|
|
55
|
+
compare_at_price: variant.compare_at_price,
|
|
56
|
+
options: variant.options,
|
|
57
|
+
available_for_sale: variant.available
|
|
58
|
+
});
|
|
59
|
+
const mapBasicProduct = (product) => ({
|
|
60
|
+
id: String(product.id),
|
|
61
|
+
title: product.title,
|
|
62
|
+
description: product.description,
|
|
63
|
+
available_for_sale: product.available,
|
|
64
|
+
featured_image: product.featured_image,
|
|
65
|
+
images: product.images,
|
|
66
|
+
requires_selling_plan: product.requires_selling_plan,
|
|
67
|
+
selling_plan_groups: product.selling_plan_groups.map(mapSellingPlanGroups)
|
|
68
|
+
});
|
|
69
|
+
const mapProduct = (product) => {
|
|
70
|
+
const productPlansLookup = productSellingPlansGroupLookup(product.selling_plan_groups);
|
|
71
|
+
return {
|
|
72
|
+
...mapBasicProduct(product),
|
|
73
|
+
handle: product.handle,
|
|
74
|
+
tags: product.tags,
|
|
75
|
+
price_range: { min: product.price_min, max: product.price_max },
|
|
76
|
+
compare_at_price_range: { min: product.compare_at_price_min, max: product.compare_at_price_max },
|
|
77
|
+
options: product.options,
|
|
78
|
+
variants: product.variants.map((variant) => ({
|
|
79
|
+
...mapBasicVariant(variant),
|
|
80
|
+
selling_plan_allocations: variant.selling_plan_allocations.map((sellingPlan) => ({
|
|
81
|
+
price: sellingPlan.price,
|
|
82
|
+
compare_at_price: sellingPlan.compare_at_price,
|
|
83
|
+
selling_plan: mapSellingPlan(
|
|
84
|
+
productPlansLookup[`${sellingPlan.selling_plan_group_id}-${sellingPlan.selling_plan_id}`]
|
|
85
|
+
)
|
|
86
|
+
})),
|
|
87
|
+
option1: variant.option1,
|
|
88
|
+
option2: variant.option2,
|
|
89
|
+
option3: variant.option3,
|
|
90
|
+
sku: variant.sku,
|
|
91
|
+
requires_shipping: variant.requires_shipping,
|
|
92
|
+
taxable: variant.taxable,
|
|
93
|
+
featured_image: variant.featured_image,
|
|
94
|
+
public_title: variant.public_title,
|
|
95
|
+
requires_selling_plan: variant.requires_selling_plan
|
|
96
|
+
}))
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
const mapBundleVariantRanges = ({
|
|
100
|
+
items_count,
|
|
101
|
+
ranges
|
|
102
|
+
}) => {
|
|
103
|
+
if (ranges.length > 0) {
|
|
104
|
+
return ranges.map(({ quantity_max, quantity_min }) => ({ min: quantity_min, max: quantity_max }));
|
|
105
|
+
}
|
|
106
|
+
return [{ min: items_count, max: items_count }];
|
|
107
|
+
};
|
|
108
|
+
const productSellingPlansGroupLookup = (sellingPlanGroups) => sellingPlanGroups.reduce((acc, current) => {
|
|
109
|
+
current.selling_plans.forEach((sellingPlan) => {
|
|
110
|
+
const key = `${current.id}-${sellingPlan.id}`;
|
|
111
|
+
acc[key] = sellingPlan;
|
|
112
|
+
});
|
|
113
|
+
return acc;
|
|
114
|
+
}, {});
|
|
115
|
+
function mapOnlineStoreToPublicBundleData(bundleData) {
|
|
116
|
+
const bundleSettings = mapBundleSettings(bundleData.bundle_settings);
|
|
117
|
+
const variantsLookup = bundleData.variants.reduce(
|
|
118
|
+
(acc, variant) => {
|
|
119
|
+
acc[variant.id] = variant;
|
|
120
|
+
return acc;
|
|
121
|
+
},
|
|
122
|
+
{}
|
|
123
|
+
);
|
|
124
|
+
return {
|
|
125
|
+
id: String(bundleData.id),
|
|
126
|
+
title: bundleData.title,
|
|
127
|
+
handle: bundleData.handle,
|
|
128
|
+
options: bundleData.options.map((option) => ({
|
|
129
|
+
name: option.name,
|
|
130
|
+
position: option.position,
|
|
131
|
+
values: option.values
|
|
132
|
+
})),
|
|
133
|
+
default_variant_id: bundleSettings.default_variant_id,
|
|
134
|
+
available_for_sale: bundleData.available,
|
|
135
|
+
requires_selling_plan: bundleData.requires_selling_plan,
|
|
136
|
+
bundle_settings: {
|
|
137
|
+
is_customizable: bundleSettings.is_customizable,
|
|
138
|
+
price_rule: bundleSettings.price_rule,
|
|
139
|
+
customization_window: bundleSettings.customization_window,
|
|
140
|
+
max_quantity_per_variant: null
|
|
141
|
+
},
|
|
142
|
+
variants: bundleData.bundle_settings.variants.filter(({ enabled }) => enabled).map((item, index) => {
|
|
143
|
+
const variant = variantsLookup[String(item.external_variant_id)];
|
|
144
|
+
return {
|
|
145
|
+
id: String(item.external_variant_id),
|
|
146
|
+
title: variant.title,
|
|
147
|
+
price: variant.price,
|
|
148
|
+
compare_at_price: variant.compare_at_price,
|
|
149
|
+
image: variant.image || "",
|
|
150
|
+
available_for_sale: variant.available,
|
|
151
|
+
options: variant.options,
|
|
152
|
+
requires_selling_plan: variant.requires_selling_plan,
|
|
153
|
+
selling_plan_allocations: variant.selling_plan_allocations.map((sellingPlan) => ({
|
|
154
|
+
price: sellingPlan.price,
|
|
155
|
+
compare_at_price: sellingPlan.compare_at_price,
|
|
156
|
+
selling_plan: mapSellingPlan(sellingPlan.selling_plan)
|
|
157
|
+
})),
|
|
158
|
+
ranges: mapBundleVariantRanges(item),
|
|
159
|
+
collections: item.option_sources.map((source) => ({
|
|
160
|
+
id: source.option_source_id,
|
|
161
|
+
source_platform: "shopify",
|
|
162
|
+
min: source.quantity_min || 0,
|
|
163
|
+
max: source.quantity_max
|
|
164
|
+
})),
|
|
165
|
+
default_selections: item.selection_defaults.map((selectionDefault) => ({
|
|
166
|
+
quantity: selectionDefault.quantity,
|
|
167
|
+
product: {
|
|
168
|
+
id: String(selectionDefault.product.id),
|
|
169
|
+
handle: selectionDefault.handle,
|
|
170
|
+
title: selectionDefault.product.title,
|
|
171
|
+
description: selectionDefault.product.description,
|
|
172
|
+
images: selectionDefault.product.images
|
|
173
|
+
},
|
|
174
|
+
variant: {
|
|
175
|
+
id: selectionDefault.external_variant_id,
|
|
176
|
+
title: selectionDefault.variant.title,
|
|
177
|
+
featured_image: selectionDefault.variant.featured_image,
|
|
178
|
+
sku: selectionDefault.sku
|
|
179
|
+
}
|
|
180
|
+
})),
|
|
181
|
+
position: index
|
|
182
|
+
};
|
|
183
|
+
}),
|
|
184
|
+
selling_plan_groups: bundleData.selling_plan_groups.map(mapSellingPlanGroups),
|
|
185
|
+
collections: Object.values(bundleData.collections).reduce((acc, current) => {
|
|
186
|
+
acc[String(current.id)] = {
|
|
187
|
+
id: String(current.id),
|
|
188
|
+
title: current.title,
|
|
189
|
+
handle: current.handle,
|
|
190
|
+
products: current.products.map(mapProduct)
|
|
191
|
+
};
|
|
192
|
+
return acc;
|
|
193
|
+
}, {}),
|
|
194
|
+
addons: bundleData.addons.products.length ? {
|
|
195
|
+
collection_id: bundleSettings.addons?.collection_id || "",
|
|
196
|
+
collection_handle: bundleSettings.addons?.collection_handle || "",
|
|
197
|
+
products: bundleData.addons.products.map((product) => ({
|
|
198
|
+
...mapBasicProduct(product),
|
|
199
|
+
price_range: { min: product.price, max: product.price },
|
|
200
|
+
compare_at_price_range: { min: product.compare_at_price || 0, max: product.compare_at_price },
|
|
201
|
+
variants: product.variants.map((variant) => ({
|
|
202
|
+
...mapBasicVariant(variant),
|
|
203
|
+
image: variant.image,
|
|
204
|
+
selling_plan_allocations: variant.selling_plan_allocations.map((sellingPlan) => ({
|
|
205
|
+
price: sellingPlan.price,
|
|
206
|
+
compare_at_price: sellingPlan.compare_at_price,
|
|
207
|
+
selling_plan: mapSellingPlan(sellingPlan.selling_plan)
|
|
208
|
+
}))
|
|
209
|
+
}))
|
|
210
|
+
}))
|
|
211
|
+
} : null,
|
|
212
|
+
cross_sells: bundleData.cross_sells.products.length ? {
|
|
213
|
+
collection_id: bundleSettings.cross_sells?.collection_id || "",
|
|
214
|
+
collection_handle: bundleSettings.cross_sells?.collection_handle || "",
|
|
215
|
+
products: bundleData.cross_sells.products.map(mapProduct)
|
|
216
|
+
} : null,
|
|
217
|
+
incentives: mapIncentives(bundleData.incentives)
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export { mapOnlineStoreToPublicBundleData };
|
|
222
|
+
//# sourceMappingURL=bundleData.js.map
|
|
@@ -0,0 +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_product_id: tieredDiscount.external_product_id,\n name: tieredDiscount.name,\n status: tieredDiscount.status,\n tiers: tieredDiscount.tiers.map(tiered => ({\n discount_type: tiered.discount_type,\n discount_value: tiered.discount_value,\n condition_quantity_gte: tiered.condition_quantity_gte,\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,mBAAmB,cAAe,CAAA,yBAAA,CAAA;AAExC,EAAO,OAAA;AAAA,IACL,kBAAoB,EAAA,gBAAA,GAAmB,MAAO,CAAA,gBAAgB,CAAI,GAAA,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A,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.
|
|
50
|
+
"X-Recharge-Sdk-Version": "1.50.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 : {}
|