@rechargeapps/storefront-client 1.53.0 → 1.54.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/auth.js +1 -1
- package/dist/cjs/api/bundleData.js +1 -1
- package/dist/cjs/utils/bundleData.js +11 -5
- package/dist/cjs/utils/bundleData.js.map +1 -1
- package/dist/cjs/utils/request.js +1 -1
- package/dist/esm/api/auth.js +1 -1
- package/dist/esm/api/bundleData.js +1 -1
- package/dist/esm/utils/bundleData.js +11 -5
- package/dist/esm/utils/bundleData.js.map +1 -1
- package/dist/esm/utils/request.js +1 -1
- package/dist/index.d.ts +37 -61
- package/dist/umd/recharge-client.min.js +8 -8
- package/package.json +1 -1
package/dist/cjs/api/auth.js
CHANGED
|
@@ -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.
|
|
184
|
+
"X-Recharge-Sdk-Version": "1.54.1",
|
|
185
185
|
...headers ? headers : {}
|
|
186
186
|
};
|
|
187
187
|
return request.request(method, `${rechargeBaseUrl}${url}`, { id, query, data, headers: reqHeaders });
|
|
@@ -23,7 +23,7 @@ async function loadFromOnlineStore(id, country_code) {
|
|
|
23
23
|
payload.append("country_code", country_code);
|
|
24
24
|
const headers = {
|
|
25
25
|
"X-Recharge-Sdk-Fn": "loadFromOnlineStore",
|
|
26
|
-
"X-Recharge-Sdk-Version": "1.
|
|
26
|
+
"X-Recharge-Sdk-Version": "1.54.1"
|
|
27
27
|
};
|
|
28
28
|
try {
|
|
29
29
|
const data = await request.request("post", "/localization", {
|
|
@@ -24,13 +24,19 @@ const mapIncentives = (incentives) => {
|
|
|
24
24
|
tiered_discounts: incentives.tiered_discounts.map((tieredDiscount) => ({
|
|
25
25
|
eligible_charge_types: tieredDiscount.eligible_charge_types,
|
|
26
26
|
eligible_line_item_types: tieredDiscount.eligible_line_item_types,
|
|
27
|
-
|
|
27
|
+
external_bundle_product_id: {
|
|
28
|
+
ecommerce: tieredDiscount.external_bundle_product_id.ecommerce
|
|
29
|
+
},
|
|
30
|
+
lookup_key: tieredDiscount.lookup_key,
|
|
28
31
|
name: tieredDiscount.name,
|
|
29
32
|
status: tieredDiscount.status,
|
|
30
|
-
tiers: tieredDiscount.tiers.map((
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
tiers: tieredDiscount.tiers.map(({ tier }) => ({
|
|
34
|
+
tier: {
|
|
35
|
+
lookup_key: tier.lookup_key,
|
|
36
|
+
discount_type: tier.discount_type,
|
|
37
|
+
discount_value: tier.discount_value,
|
|
38
|
+
condition_quantity_gte: tier.condition_quantity_gte
|
|
39
|
+
}
|
|
34
40
|
}))
|
|
35
41
|
}))
|
|
36
42
|
};
|
|
@@ -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_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,IAAA;AAAA,IAClE,iBAAiB,cAAe,CAAA,eAAA;AAAA,IAChC,UAAY,EAAA,MAAA,CAAO,cAAe,CAAA,UAAU,EAAE,WAAY,EAAA;AAAA,IAC1D,sBAAsB,mBAClB,GAAA;AAAA,MACE,WAAa,EAAA,mBAAA;AAAA,MACb,gBAAA,EAAkB,eAAe,qCAAyC,IAAA,EAAA;AAAA,K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QAAQ,KAAO,EAAA,GAAA,EAAK,QAAQ,KAAM,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;;;;"}
|
|
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,UA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AA;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.
|
|
52
|
+
"X-Recharge-Sdk-Version": "1.54.1",
|
|
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 : {}
|
package/dist/esm/api/auth.js
CHANGED
|
@@ -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.
|
|
182
|
+
"X-Recharge-Sdk-Version": "1.54.1",
|
|
183
183
|
...headers ? headers : {}
|
|
184
184
|
};
|
|
185
185
|
return request(method, `${rechargeBaseUrl}${url}`, { id, query, data, headers: reqHeaders });
|
|
@@ -21,7 +21,7 @@ async function loadFromOnlineStore(id, country_code) {
|
|
|
21
21
|
payload.append("country_code", country_code);
|
|
22
22
|
const headers = {
|
|
23
23
|
"X-Recharge-Sdk-Fn": "loadFromOnlineStore",
|
|
24
|
-
"X-Recharge-Sdk-Version": "1.
|
|
24
|
+
"X-Recharge-Sdk-Version": "1.54.1"
|
|
25
25
|
};
|
|
26
26
|
try {
|
|
27
27
|
const data = await request("post", "/localization", {
|
|
@@ -22,13 +22,19 @@ const mapIncentives = (incentives) => {
|
|
|
22
22
|
tiered_discounts: incentives.tiered_discounts.map((tieredDiscount) => ({
|
|
23
23
|
eligible_charge_types: tieredDiscount.eligible_charge_types,
|
|
24
24
|
eligible_line_item_types: tieredDiscount.eligible_line_item_types,
|
|
25
|
-
|
|
25
|
+
external_bundle_product_id: {
|
|
26
|
+
ecommerce: tieredDiscount.external_bundle_product_id.ecommerce
|
|
27
|
+
},
|
|
28
|
+
lookup_key: tieredDiscount.lookup_key,
|
|
26
29
|
name: tieredDiscount.name,
|
|
27
30
|
status: tieredDiscount.status,
|
|
28
|
-
tiers: tieredDiscount.tiers.map((
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
tiers: tieredDiscount.tiers.map(({ tier }) => ({
|
|
32
|
+
tier: {
|
|
33
|
+
lookup_key: tier.lookup_key,
|
|
34
|
+
discount_type: tier.discount_type,
|
|
35
|
+
discount_value: tier.discount_value,
|
|
36
|
+
condition_quantity_gte: tier.condition_quantity_gte
|
|
37
|
+
}
|
|
32
38
|
}))
|
|
33
39
|
}))
|
|
34
40
|
};
|
|
@@ -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_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,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AAA,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\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,mBAAmB,cAAe,CAAA,yBAAA,CAAA;AAExC,EAAO,OAAA;AAAA,IACL,kBAAoB,EAAA,gBAAA,GAAmB,MAAO,CAAA,gBAAgB,CAAI,GAAA,IAAA;AAAA,IAClE,iBAAiB,cAAe,CAAA,eAAA;AAAA,IAChC,UAAY,EAAA,MAAA,CAAO,cAAe,CAAA,UAAU,EAAE,WAAY,EAAA;AAAA,IAC1D,sBAAsB,mBAClB,GAAA;AAAA,MACE,WAAa,EAAA,mBAAA;AAAA,MACb,gBAAA,EAAkB,eAAe,qCAAyC,IAAA,EAAA;AAAA,KAE5E,GAAA,IAAA;AAAA,IACJ,MAAA,EAAQ,MAAO,CAAA,YAAA,GACX,EAAE,aAAA,EAAe,OAAO,YAAc,EAAA,iBAAA,EAAmB,MAAO,CAAA,gBAAA,EAChE,GAAA,IAAA;AAAA,IACJ,WAAA,EAAa,UAAW,CAAA,YAAA,GACpB,EAAE,aAAA,EAAe,OAAO,YAAc,EAAA,iBAAA,EAAmB,MAAO,CAAA,gBAAA,EAChE,GAAA,IAAA;AAAA,GACN,CAAA;AACF,CAAA,CAAA;AAEA,MAAM,aAAA,GAAgB,CAAC,UAAmF,KAAA;AACxG,EAAI,IAAA,UAAA,CAAW,iBAAiB,MAAW,KAAA,CAAA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AAO,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.
|
|
50
|
+
"X-Recharge-Sdk-Version": "1.54.1",
|
|
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
|
@@ -358,6 +358,40 @@ interface PaymentMethodListParams extends ListParams<PaymentMethodSortBy> {
|
|
|
358
358
|
include_deleted?: boolean;
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
+
interface Incentives {
|
|
362
|
+
tiered_discounts: TieredDiscount[];
|
|
363
|
+
}
|
|
364
|
+
/** Line item types eligible for tiered discounts */
|
|
365
|
+
type EligibleLineItemType = 'subscription' | 'onetime';
|
|
366
|
+
/** Charge types eligible for tiered discounts */
|
|
367
|
+
type EligibleChargeType = 'checkout' | 'recurring';
|
|
368
|
+
/** Tiered discount status */
|
|
369
|
+
type TieredDiscountStatus = 'draft' | 'unpublished' | 'published' | 'inactive';
|
|
370
|
+
/**
|
|
371
|
+
* Discount tier configuration
|
|
372
|
+
*/
|
|
373
|
+
type Tier = {
|
|
374
|
+
discount_type: 'percentage' | 'fixed_amount';
|
|
375
|
+
discount_value: number | string;
|
|
376
|
+
condition_quantity_gte: number | string;
|
|
377
|
+
lookup_key: string;
|
|
378
|
+
};
|
|
379
|
+
/**
|
|
380
|
+
* Tiered discount configuration
|
|
381
|
+
*/
|
|
382
|
+
interface TieredDiscount {
|
|
383
|
+
eligible_charge_types: EligibleChargeType[];
|
|
384
|
+
eligible_line_item_types: EligibleLineItemType[];
|
|
385
|
+
external_bundle_product_id: {
|
|
386
|
+
ecommerce: string;
|
|
387
|
+
};
|
|
388
|
+
lookup_key: string;
|
|
389
|
+
name: string;
|
|
390
|
+
status: TieredDiscountStatus;
|
|
391
|
+
tiers: {
|
|
392
|
+
tier: Tier;
|
|
393
|
+
}[];
|
|
394
|
+
}
|
|
361
395
|
interface AddonSettings {
|
|
362
396
|
collectionHandle: string;
|
|
363
397
|
collectionId: string;
|
|
@@ -485,6 +519,7 @@ interface BundleProduct {
|
|
|
485
519
|
dynamic_filter_products_by_discount: boolean;
|
|
486
520
|
show_product_and_variant_name_in_products_list: boolean;
|
|
487
521
|
};
|
|
522
|
+
incentives: Incentives | null;
|
|
488
523
|
}
|
|
489
524
|
|
|
490
525
|
interface BundleSelectionAppProxy {
|
|
@@ -662,34 +697,6 @@ interface BundleDataCollection$1 {
|
|
|
662
697
|
title: string;
|
|
663
698
|
products: BundleDataCollectionProduct[];
|
|
664
699
|
}
|
|
665
|
-
interface Incentives$1 {
|
|
666
|
-
tiered_discounts: TieredDiscount$1[];
|
|
667
|
-
}
|
|
668
|
-
/** Line item types eligible for tiered discounts */
|
|
669
|
-
type EligibleLineItemType$1 = 'subscription' | 'onetime';
|
|
670
|
-
/** Charge types eligible for tiered discounts */
|
|
671
|
-
type EligibleChargeType$1 = 'checkout' | 'recurring';
|
|
672
|
-
/** Tiered discount status */
|
|
673
|
-
type Status$1 = 'draft' | 'unpublished' | 'published' | 'inactive';
|
|
674
|
-
/**
|
|
675
|
-
* Discount tier configuration
|
|
676
|
-
*/
|
|
677
|
-
type Tier$1 = {
|
|
678
|
-
discount_type: 'percentage' | 'fixed_amount';
|
|
679
|
-
discount_value: number | string;
|
|
680
|
-
condition_quantity_gte: number | string;
|
|
681
|
-
};
|
|
682
|
-
/**
|
|
683
|
-
* Tiered discount configuration
|
|
684
|
-
*/
|
|
685
|
-
interface TieredDiscount$1 {
|
|
686
|
-
eligible_charge_types: EligibleChargeType$1[];
|
|
687
|
-
eligible_line_item_types: EligibleLineItemType$1[];
|
|
688
|
-
external_product_id: string;
|
|
689
|
-
name: string;
|
|
690
|
-
status: Status$1;
|
|
691
|
-
tiers: Tier$1[];
|
|
692
|
-
}
|
|
693
700
|
interface SellingPlan$1 {
|
|
694
701
|
id: number;
|
|
695
702
|
name: string;
|
|
@@ -767,7 +774,7 @@ interface BundleData {
|
|
|
767
774
|
}[];
|
|
768
775
|
}[];
|
|
769
776
|
};
|
|
770
|
-
incentives: Incentives
|
|
777
|
+
incentives: Incentives;
|
|
771
778
|
variants: {
|
|
772
779
|
id: number;
|
|
773
780
|
title: string;
|
|
@@ -1954,37 +1961,6 @@ interface CrossSellsSection {
|
|
|
1954
1961
|
collection_handle: string;
|
|
1955
1962
|
products: Product[];
|
|
1956
1963
|
}
|
|
1957
|
-
/**
|
|
1958
|
-
* Bundle incentives and promotions
|
|
1959
|
-
*/
|
|
1960
|
-
interface Incentives {
|
|
1961
|
-
tiered_discounts: TieredDiscount[];
|
|
1962
|
-
}
|
|
1963
|
-
/** Line item types eligible for tiered discounts */
|
|
1964
|
-
type EligibleLineItemType = 'subscription' | 'onetime';
|
|
1965
|
-
/** Charge types eligible for tiered discounts */
|
|
1966
|
-
type EligibleChargeType = 'checkout' | 'recurring';
|
|
1967
|
-
/** Tiered discount status */
|
|
1968
|
-
type Status = 'draft' | 'unpublished' | 'published' | 'inactive';
|
|
1969
|
-
/**
|
|
1970
|
-
* Discount tier configuration
|
|
1971
|
-
*/
|
|
1972
|
-
type Tier = {
|
|
1973
|
-
discount_type: 'percentage' | 'fixed_amount';
|
|
1974
|
-
discount_value: number | string;
|
|
1975
|
-
condition_quantity_gte: number | string;
|
|
1976
|
-
};
|
|
1977
|
-
/**
|
|
1978
|
-
* Tiered discount configuration
|
|
1979
|
-
*/
|
|
1980
|
-
interface TieredDiscount {
|
|
1981
|
-
eligible_charge_types: EligibleChargeType[];
|
|
1982
|
-
eligible_line_item_types: EligibleLineItemType[];
|
|
1983
|
-
external_product_id: string;
|
|
1984
|
-
name: string;
|
|
1985
|
-
status: Status;
|
|
1986
|
-
tiers: Tier[];
|
|
1987
|
-
}
|
|
1988
1964
|
|
|
1989
1965
|
type ProductInclude = 'collections';
|
|
1990
1966
|
type ProductSource = 'all' | 'in_recharge' | 'not_in_recharge';
|
|
@@ -3585,4 +3561,4 @@ declare const api: {
|
|
|
3585
3561
|
};
|
|
3586
3562
|
declare function initRecharge(opt?: InitOptions): void;
|
|
3587
3563
|
|
|
3588
|
-
export { type ActivateMembershipRequest, type AddToCartCallbackSettings, type AddonProduct, type AddonSettings, type AddonsSection, type Address, type AddressIncludes, type AddressListParams, type AddressListResponse, type AddressResponse, type AddressSortBy, type AnalyticsData, type ApplyCreditOptions, type AssociatedAddress, type BaseProduct, type BaseProductVariant, type BaseVariant, type BasicSubscriptionParams, type BooleanLike, type BooleanNumbers, type BooleanString, type BooleanStringNumbers, type BulkSubscriptionParams, type BundleAppProxy, type BundleData, type BundleDataBaseProduct, type BundleDataCollection, type BundleDataSellingPlan, type BundleDataSellingPlanGroup, type BundleDataVariant, type BundlePriceRule, type BundleProduct, type BundleProductLayoutSettings, type BundlePurchaseItem, type BundlePurchaseItemParams, type BundleSelection, type BundleSelectionAppProxy, type BundleSelectionItem, type BundleSelectionItemRequiredCreateProps, type BundleSelectionListParams, type BundleSelectionsResponse, type BundleSelectionsSortBy, type BundleSettings, type BundleTemplateSettings, type BundleTemplateType, type BundleTranslations, type BundleVariant, type BundleVariantOptionSource, type BundleVariantRange, type BundleVariantSelectionDefault, type CDNBaseWidgetSettings, type CDNBundleSettings, type CDNBundleVariant, type CDNBundleVariantOptionSource, type CDNPlan, type CDNProduct, type CDNProductAndSettings, type CDNProductKeyObject, type CDNProductQuery_2020_12, type CDNProductQuery_2022_06, type CDNProductRaw, type CDNProductResource, type CDNProductResponseType, type CDNProductType, type CDNProductVariant_2022_06, type CDNProduct_2022_06, type CDNProductsAndSettings, type CDNProductsAndSettingsResource, type CDNStoreSettings, type CDNSubscriptionOption, type CDNVariant, type CDNVersion, type CDNWidgetSettings, type CDNWidgetSettingsRaw, type CDNWidgetSettingsResource, type CRUDRequestOptions, type CancelMembershipRequest, type CancelSubscriptionRequest, type ChangeMembershipRequest, type ChannelSettings, type Charge, type ChargeIncludes, type ChargeListParams, type ChargeListResponse, type ChargeResponse, type ChargeSortBy, type ChargeStatus, type Collection, type CollectionBinding, type CollectionListParams, type CollectionTypes, type CollectionsResponse, type CollectionsSortBy, type ColorString, type CreateAddressRequest, type CreateBundleSelectionRequest, type CreateMetafieldRequest, type CreateOnetimeRequest, type CreatePaymentMethodRequest, type CreateRecipientAddress, type CreateSubscriptionRequest, type CreateSubscriptionsParams, type CreateSubscriptionsRequest, type CreditAccount, type CreditAccountIncludes, type CreditAccountListParams, type CreditAccountType, type CreditAccountsResponse, type CreditAccountsSortBy, type CreditSummaryIncludes, type CrossSellsSection, type CrossSellsSettings, type CurrencyPriceSet, type Customer, type CustomerCreditSummary, type CustomerDeliveryScheduleParams, type CustomerDeliveryScheduleResponse, type CustomerIncludes, type CustomerNotification, type CustomerNotificationOptions, type CustomerNotificationTemplate, type CustomerNotificationType, type CustomerPortalAccessOptions, type CustomerPortalAccessResponse, type CustomerPortalSettings, type DefaultProduct, type DefaultSelection, type DefaultVariant, type DeleteSubscriptionsParams, type DeleteSubscriptionsRequest, type Delivery, type DeliveryLineItem, type DeliveryOrder, type DeliveryPaymentMethod, type Discount, type DiscountType, type DynamicBundleItemAppProxy, type DynamicBundlePropertiesAppProxy, type EligibleChargeType, type EligibleLineItemType, type ExternalAttributeSchema, type ExternalId, type ExternalProductStatus, type ExternalTransactionId, type FirstOption, type GetAddressOptions, type GetChargeOptions, type GetCreditSummaryOptions, type GetCustomerOptions, type GetMembershipProgramOptions, type GetPaymentMethodOptions, type GetRequestOptions, type GetSubscriptionOptions, type GiftPurchase, type GiftPurchasesParams, type GiftPurchasesResponse, type HTMLString, type Incentives, type InitOptions, type InternalSession, type IntervalUnit, type IsoDateString, type LineItem, type ListParams, type LoginResponse, type Membership, type MembershipBenefit, type MembershipIncludes, type MembershipListParams, type MembershipListResponse, type MembershipProgram, type MembershipProgramIncludes, type MembershipProgramListParams, type MembershipProgramListResponse, type MembershipProgramResponse, type MembershipProgramSortBy, type MembershipProgramStatus, type MembershipResponse, type MembershipStatus, type MembershipsSortBy, type MergeAddressesRequest, type Metafield, type MetafieldOptionalCreateProps, type MetafieldOwnerResource, type MetafieldRequiredCreateProps, type Method, type Modifier, type MultiStepSettings, type OfferAttributes, type OnePageSettings, type Onetime, type OnetimeIncludes, type OnetimeListParams, type OnetimeOptionalCreateProps, type OnetimeRequiredCreateProps, type OnetimeSubscription, type OnetimesResponse, type OnetimesSortBy, type OnlineStoreOptions, type Options, type Order, type OrderIncludes, type OrderListParams, type OrderSortBy, type OrderStatus, type OrderType, type OrdersResponse, type PasswordlessCodeResponse, type PasswordlessOptions, type PasswordlessValidateResponse, type PaymentDetails, type PaymentMethod, type PaymentMethodIncludes, type PaymentMethodListParams, type PaymentMethodOptionalCreateProps, type PaymentMethodRequiredCreateProps, type PaymentMethodSortBy, type PaymentMethodStatus, type PaymentMethodsResponse, type PaymentType, type Plan, type PlanListParams, type PlanSortBy, type PlanType, type PlansResponse, type PriceRange, type PriceRule, type PriceSet, type ProcessorName, type Product, type ProductImage, type ProductInclude, type ProductListResponse, type ProductOption, type ProductSearchParams_2020_12, type ProductSearchParams_2022_06, type ProductSearchResponse_2020_12, type ProductSearchResponse_2022_06, type ProductSearchType, type ProductSource, type ProductValueOption, type ProductVariant_2020_12, type ProductVariant_2022_06, type Product_2020_12, type Product_2022_06, type Property, type PublicBundleData, type PublishStatus, type QuantityRange, type RecurringSubscription, type ReferralInfo, type ReferralUrl, type Request, type RequestHeaders, type RequestOptions, type SellingPlan, type SellingPlanAllocation, type SellingPlanGroup, type Session, type ShippingCountriesOptions, type ShippingCountriesResponse, type ShippingCountry, type ShippingLine, type ShippingProvince, type ShopifyStorefrontOptions, type ShopifyUpdatePaymentInfoOptions, type SkipChargeParams, type SkipFutureChargeAddressRequest, type SkipFutureChargeAddressResponse, type SortBy, type SortField, type SortKeys, type Status, type StepSettings, type StepSettingsCommon, type StepSettingsTypes, type StoreSettings, type StorefrontEnvironment, type StorefrontOptions, type StorefrontPurchaseOption, type SubType, type Subscription, type SubscriptionBase, type SubscriptionCancelled, type SubscriptionIncludes, type SubscriptionListParams, type SubscriptionOption, type SubscriptionOptionalCreateProps, type SubscriptionPreferences, type SubscriptionRequiredCreateProps, type SubscriptionSortBy, type SubscriptionStatus, type Subscription_2021_01, type SubscriptionsResponse, type TaxLine, type Tier, type TieredDiscount, type Translations, type UpdateAddressParams, type UpdateAddressRequest, type UpdateBundlePurchaseItem, type UpdateBundleSelectionRequest, type UpdateCustomerRequest, type UpdateMetafieldRequest, type UpdateOnetimeRequest, type UpdatePaymentMethodRequest, type UpdateSubscriptionChargeDateParams, type UpdateSubscriptionParams, type UpdateSubscriptionRequest, type UpdateSubscriptionsParams, type UpdateSubscriptionsRequest, type Variant, type VariantSelector, type VariantSelectorStepSetting, type WidgetIconColor, type WidgetTemplateType, type WidgetVisibility, activateMembership, activateSubscription, api, applyDiscountToAddress, applyDiscountToCharge, cancelMembership, cancelSubscription, changeMembership, createAddress, createBundleSelection, createMetafield, createOnetime, createPaymentMethod, createSubscription, createSubscriptions, delayOrder, deleteAddress, deleteBundleSelection, deleteMetafield, deleteOnetime, deleteSubscriptions, getActiveChurnLandingPageURL, getAddress, getBundleId, getBundleSelection, getBundleSelectionId, getCDNBundleSettings, getCDNProduct, getCDNProductAndSettings, getCDNProducts, getCDNProductsAndSettings, getCDNStoreSettings, getCDNWidgetSettings, getCharge, getCollection, getCreditSummary, getCustomer, getCustomerPortalAccess, getDeliverySchedule, getDynamicBundleItems, getFailedPaymentMethodRecoveryLandingPageURL, getGiftPurchase, getGiftRedemptionLandingPageURL, getMembership, getMembershipProgram, getOnetime, getOrder, getPaymentMethod, getPlan, getShippingCountries, getStoreSettings, getSubscription, initRecharge, type intervalUnit, listAddresses, listBundleSelections, listCharges, listCollectionProducts, listCollections, listCreditAccounts, listGiftPurchases, listMembershipPrograms, listMemberships, listOnetimes, listOrders, listPaymentMethods, listPlans, listSubscriptions, loadBundleData, loginCustomerPortal, loginShopifyApi, loginShopifyAppProxy, loginWithShopifyCustomerAccount, loginWithShopifyStorefront, type membershipIncludes, mergeAddresses, processCharge, productSearch, removeDiscountsFromAddress, removeDiscountsFromCharge, resetCDNCache, sendCustomerNotification, sendPasswordlessCode, sendPasswordlessCodeAppProxy, setApplyCreditsToNextCharge, skipCharge, skipFutureCharge, skipGiftSubscriptionCharge, skipSubscriptionCharge, unskipCharge, updateAddress, updateBundle, updateBundleSelection, updateCustomer, updateMetafield, updateOnetime, updatePaymentMethod, updateSubscription, updateSubscriptionAddress, updateSubscriptionChargeDate, updateSubscriptions, validateBundle, validateBundleSelection, validateDynamicBundle, validatePasswordlessCode, validatePasswordlessCodeAppProxy };
|
|
3564
|
+
export { type ActivateMembershipRequest, type AddToCartCallbackSettings, type AddonProduct, type AddonSettings, type AddonsSection, type Address, type AddressIncludes, type AddressListParams, type AddressListResponse, type AddressResponse, type AddressSortBy, type AnalyticsData, type ApplyCreditOptions, type AssociatedAddress, type BaseProduct, type BaseProductVariant, type BaseVariant, type BasicSubscriptionParams, type BooleanLike, type BooleanNumbers, type BooleanString, type BooleanStringNumbers, type BulkSubscriptionParams, type BundleAppProxy, type BundleData, type BundleDataBaseProduct, type BundleDataCollection, type BundleDataSellingPlan, type BundleDataSellingPlanGroup, type BundleDataVariant, type BundlePriceRule, type BundleProduct, type BundleProductLayoutSettings, type BundlePurchaseItem, type BundlePurchaseItemParams, type BundleSelection, type BundleSelectionAppProxy, type BundleSelectionItem, type BundleSelectionItemRequiredCreateProps, type BundleSelectionListParams, type BundleSelectionsResponse, type BundleSelectionsSortBy, type BundleSettings, type BundleTemplateSettings, type BundleTemplateType, type BundleTranslations, type BundleVariant, type BundleVariantOptionSource, type BundleVariantRange, type BundleVariantSelectionDefault, type CDNBaseWidgetSettings, type CDNBundleSettings, type CDNBundleVariant, type CDNBundleVariantOptionSource, type CDNPlan, type CDNProduct, type CDNProductAndSettings, type CDNProductKeyObject, type CDNProductQuery_2020_12, type CDNProductQuery_2022_06, type CDNProductRaw, type CDNProductResource, type CDNProductResponseType, type CDNProductType, type CDNProductVariant_2022_06, type CDNProduct_2022_06, type CDNProductsAndSettings, type CDNProductsAndSettingsResource, type CDNStoreSettings, type CDNSubscriptionOption, type CDNVariant, type CDNVersion, type CDNWidgetSettings, type CDNWidgetSettingsRaw, type CDNWidgetSettingsResource, type CRUDRequestOptions, type CancelMembershipRequest, type CancelSubscriptionRequest, type ChangeMembershipRequest, type ChannelSettings, type Charge, type ChargeIncludes, type ChargeListParams, type ChargeListResponse, type ChargeResponse, type ChargeSortBy, type ChargeStatus, type Collection, type CollectionBinding, type CollectionListParams, type CollectionTypes, type CollectionsResponse, type CollectionsSortBy, type ColorString, type CreateAddressRequest, type CreateBundleSelectionRequest, type CreateMetafieldRequest, type CreateOnetimeRequest, type CreatePaymentMethodRequest, type CreateRecipientAddress, type CreateSubscriptionRequest, type CreateSubscriptionsParams, type CreateSubscriptionsRequest, type CreditAccount, type CreditAccountIncludes, type CreditAccountListParams, type CreditAccountType, type CreditAccountsResponse, type CreditAccountsSortBy, type CreditSummaryIncludes, type CrossSellsSection, type CrossSellsSettings, type CurrencyPriceSet, type Customer, type CustomerCreditSummary, type CustomerDeliveryScheduleParams, type CustomerDeliveryScheduleResponse, type CustomerIncludes, type CustomerNotification, type CustomerNotificationOptions, type CustomerNotificationTemplate, type CustomerNotificationType, type CustomerPortalAccessOptions, type CustomerPortalAccessResponse, type CustomerPortalSettings, type DefaultProduct, type DefaultSelection, type DefaultVariant, type DeleteSubscriptionsParams, type DeleteSubscriptionsRequest, type Delivery, type DeliveryLineItem, type DeliveryOrder, type DeliveryPaymentMethod, type Discount, type DiscountType, type DynamicBundleItemAppProxy, type DynamicBundlePropertiesAppProxy, type EligibleChargeType, type EligibleLineItemType, type ExternalAttributeSchema, type ExternalId, type ExternalProductStatus, type ExternalTransactionId, type FirstOption, type GetAddressOptions, type GetChargeOptions, type GetCreditSummaryOptions, type GetCustomerOptions, type GetMembershipProgramOptions, type GetPaymentMethodOptions, type GetRequestOptions, type GetSubscriptionOptions, type GiftPurchase, type GiftPurchasesParams, type GiftPurchasesResponse, type HTMLString, type Incentives, type InitOptions, type InternalSession, type IntervalUnit, type IsoDateString, type LineItem, type ListParams, type LoginResponse, type Membership, type MembershipBenefit, type MembershipIncludes, type MembershipListParams, type MembershipListResponse, type MembershipProgram, type MembershipProgramIncludes, type MembershipProgramListParams, type MembershipProgramListResponse, type MembershipProgramResponse, type MembershipProgramSortBy, type MembershipProgramStatus, type MembershipResponse, type MembershipStatus, type MembershipsSortBy, type MergeAddressesRequest, type Metafield, type MetafieldOptionalCreateProps, type MetafieldOwnerResource, type MetafieldRequiredCreateProps, type Method, type Modifier, type MultiStepSettings, type OfferAttributes, type OnePageSettings, type Onetime, type OnetimeIncludes, type OnetimeListParams, type OnetimeOptionalCreateProps, type OnetimeRequiredCreateProps, type OnetimeSubscription, type OnetimesResponse, type OnetimesSortBy, type OnlineStoreOptions, type Options, type Order, type OrderIncludes, type OrderListParams, type OrderSortBy, type OrderStatus, type OrderType, type OrdersResponse, type PasswordlessCodeResponse, type PasswordlessOptions, type PasswordlessValidateResponse, type PaymentDetails, type PaymentMethod, type PaymentMethodIncludes, type PaymentMethodListParams, type PaymentMethodOptionalCreateProps, type PaymentMethodRequiredCreateProps, type PaymentMethodSortBy, type PaymentMethodStatus, type PaymentMethodsResponse, type PaymentType, type Plan, type PlanListParams, type PlanSortBy, type PlanType, type PlansResponse, type PriceRange, type PriceRule, type PriceSet, type ProcessorName, type Product, type ProductImage, type ProductInclude, type ProductListResponse, type ProductOption, type ProductSearchParams_2020_12, type ProductSearchParams_2022_06, type ProductSearchResponse_2020_12, type ProductSearchResponse_2022_06, type ProductSearchType, type ProductSource, type ProductValueOption, type ProductVariant_2020_12, type ProductVariant_2022_06, type Product_2020_12, type Product_2022_06, type Property, type PublicBundleData, type PublishStatus, type QuantityRange, type RecurringSubscription, type ReferralInfo, type ReferralUrl, type Request, type RequestHeaders, type RequestOptions, type SellingPlan, type SellingPlanAllocation, type SellingPlanGroup, type Session, type ShippingCountriesOptions, type ShippingCountriesResponse, type ShippingCountry, type ShippingLine, type ShippingProvince, type ShopifyStorefrontOptions, type ShopifyUpdatePaymentInfoOptions, type SkipChargeParams, type SkipFutureChargeAddressRequest, type SkipFutureChargeAddressResponse, type SortBy, type SortField, type SortKeys, type StepSettings, type StepSettingsCommon, type StepSettingsTypes, type StoreSettings, type StorefrontEnvironment, type StorefrontOptions, type StorefrontPurchaseOption, type SubType, type Subscription, type SubscriptionBase, type SubscriptionCancelled, type SubscriptionIncludes, type SubscriptionListParams, type SubscriptionOption, type SubscriptionOptionalCreateProps, type SubscriptionPreferences, type SubscriptionRequiredCreateProps, type SubscriptionSortBy, type SubscriptionStatus, type Subscription_2021_01, type SubscriptionsResponse, type TaxLine, type Tier, type TieredDiscount, type TieredDiscountStatus, type Translations, type UpdateAddressParams, type UpdateAddressRequest, type UpdateBundlePurchaseItem, type UpdateBundleSelectionRequest, type UpdateCustomerRequest, type UpdateMetafieldRequest, type UpdateOnetimeRequest, type UpdatePaymentMethodRequest, type UpdateSubscriptionChargeDateParams, type UpdateSubscriptionParams, type UpdateSubscriptionRequest, type UpdateSubscriptionsParams, type UpdateSubscriptionsRequest, type Variant, type VariantSelector, type VariantSelectorStepSetting, type WidgetIconColor, type WidgetTemplateType, type WidgetVisibility, activateMembership, activateSubscription, api, applyDiscountToAddress, applyDiscountToCharge, cancelMembership, cancelSubscription, changeMembership, createAddress, createBundleSelection, createMetafield, createOnetime, createPaymentMethod, createSubscription, createSubscriptions, delayOrder, deleteAddress, deleteBundleSelection, deleteMetafield, deleteOnetime, deleteSubscriptions, getActiveChurnLandingPageURL, getAddress, getBundleId, getBundleSelection, getBundleSelectionId, getCDNBundleSettings, getCDNProduct, getCDNProductAndSettings, getCDNProducts, getCDNProductsAndSettings, getCDNStoreSettings, getCDNWidgetSettings, getCharge, getCollection, getCreditSummary, getCustomer, getCustomerPortalAccess, getDeliverySchedule, getDynamicBundleItems, getFailedPaymentMethodRecoveryLandingPageURL, getGiftPurchase, getGiftRedemptionLandingPageURL, getMembership, getMembershipProgram, getOnetime, getOrder, getPaymentMethod, getPlan, getShippingCountries, getStoreSettings, getSubscription, initRecharge, type intervalUnit, listAddresses, listBundleSelections, listCharges, listCollectionProducts, listCollections, listCreditAccounts, listGiftPurchases, listMembershipPrograms, listMemberships, listOnetimes, listOrders, listPaymentMethods, listPlans, listSubscriptions, loadBundleData, loginCustomerPortal, loginShopifyApi, loginShopifyAppProxy, loginWithShopifyCustomerAccount, loginWithShopifyStorefront, type membershipIncludes, mergeAddresses, processCharge, productSearch, removeDiscountsFromAddress, removeDiscountsFromCharge, resetCDNCache, sendCustomerNotification, sendPasswordlessCode, sendPasswordlessCodeAppProxy, setApplyCreditsToNextCharge, skipCharge, skipFutureCharge, skipGiftSubscriptionCharge, skipSubscriptionCharge, unskipCharge, updateAddress, updateBundle, updateBundleSelection, updateCustomer, updateMetafield, updateOnetime, updatePaymentMethod, updateSubscription, updateSubscriptionAddress, updateSubscriptionChargeDate, updateSubscriptions, validateBundle, validateBundleSelection, validateDynamicBundle, validatePasswordlessCode, validatePasswordlessCodeAppProxy };
|