@rechargeapps/storefront-client 1.56.0 → 1.57.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 -3
- 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 -3
- package/dist/esm/utils/bundleData.js.map +1 -1
- package/dist/esm/utils/request.js +1 -1
- package/dist/index.d.ts +15 -2
- package/dist/umd/recharge-client.min.js +3 -3
- 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.57.1",
|
|
185
185
|
...headers ? headers : {}
|
|
186
186
|
};
|
|
187
187
|
return request.request(method, `${rechargeBaseUrl}${url}`, { id, query, data, headers: reqHeaders });
|
|
@@ -14,7 +14,7 @@ async function loadBundleData(id, options) {
|
|
|
14
14
|
async function loadFromOnlineStore(id, country_code) {
|
|
15
15
|
const headers = {
|
|
16
16
|
"X-Recharge-Sdk-Fn": "loadFromOnlineStore",
|
|
17
|
-
"X-Recharge-Sdk-Version": "1.
|
|
17
|
+
"X-Recharge-Sdk-Version": "1.57.1"
|
|
18
18
|
};
|
|
19
19
|
if (!country_code) {
|
|
20
20
|
const data = await request.shopifyAppProxyRequest("get", `/bundle-data/${id}`, { headers });
|
|
@@ -16,7 +16,11 @@ const mapBundleSettings = (bundleSettings) => {
|
|
|
16
16
|
} : null,
|
|
17
17
|
addons: addons.collectionId ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle } : null,
|
|
18
18
|
cross_sells: crossSells.collectionId ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle } : null,
|
|
19
|
-
default_selling_plan_id: defaultFrequency || null
|
|
19
|
+
default_selling_plan_id: defaultFrequency || null,
|
|
20
|
+
collapsible_collections: bundleSettings.layout_settings.collapsibleSections,
|
|
21
|
+
max_quantity_per_variant: bundleSettings.max_quantity_per_variant,
|
|
22
|
+
show_product_variants: bundleSettings.layout_settings.showVariants,
|
|
23
|
+
product_details_modal_enabled: bundleSettings.layout_settings.learnMoreModal
|
|
20
24
|
};
|
|
21
25
|
};
|
|
22
26
|
const mapIncentives = (incentives) => {
|
|
@@ -157,7 +161,10 @@ function mapOnlineStoreToPublicBundleData(bundleData) {
|
|
|
157
161
|
is_customizable: bundleSettings.is_customizable,
|
|
158
162
|
price_rule: bundleSettings.price_rule,
|
|
159
163
|
customization_window: bundleSettings.customization_window,
|
|
160
|
-
max_quantity_per_variant:
|
|
164
|
+
max_quantity_per_variant: bundleSettings.max_quantity_per_variant,
|
|
165
|
+
collapsible_collections: bundleSettings.collapsible_collections,
|
|
166
|
+
show_product_variants: bundleSettings.show_product_variants,
|
|
167
|
+
product_details_modal_enabled: bundleSettings.product_details_modal_enabled
|
|
161
168
|
},
|
|
162
169
|
variants: bundleData.bundle_settings.variants.filter(({ enabled }) => enabled).map((item, index) => {
|
|
163
170
|
const variant = variantsLookup[String(item.external_variant_id)];
|
|
@@ -180,7 +187,8 @@ function mapOnlineStoreToPublicBundleData(bundleData) {
|
|
|
180
187
|
id: source.option_source_id,
|
|
181
188
|
source_platform: "shopify",
|
|
182
189
|
min: source.quantity_min || 0,
|
|
183
|
-
max: source.quantity_max
|
|
190
|
+
max: source.quantity_max,
|
|
191
|
+
position: source.position
|
|
184
192
|
})),
|
|
185
193
|
default_selections: item.selection_defaults.map((selectionDefault) => ({
|
|
186
194
|
quantity: selectionDefault.quantity,
|
|
@@ -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 const defaultFrequency = bundleSettings.layout_settings.defaultFrequency;\n\n return {\n default_variant_id: defaultVariantId ? String(defaultVariantId) : null,\n is_customizable: bundleSettings.is_customizable,\n price_rule: String(bundleSettings.price_rule).toUpperCase(),\n customization_window: customizationWindow\n ? {\n active_days: customizationWindow,\n disabled_message: bundleSettings.customization_window_disabled_message || '',\n }\n : null,\n addons: addons.collectionId\n ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle }\n : null,\n cross_sells: crossSells.collectionId\n ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle }\n : null,\n default_selling_plan_id: defaultFrequency || null,\n };\n};\n\nconst mapIncentives = (incentives: StorefrontBundleData['incentives']): PublicBundleData['incentives'] => {\n if (incentives.tiered_discounts.length === 0) return null;\n\n return {\n tiered_discounts: incentives.tiered_discounts.map(tieredDiscount => ({\n eligible_charge_types: tieredDiscount.eligible_charge_types,\n eligible_line_item_types: tieredDiscount.eligible_line_item_types,\n external_bundle_product_id: {\n ecommerce: tieredDiscount.external_bundle_product_id.ecommerce,\n },\n lookup_key: tieredDiscount.lookup_key,\n name: tieredDiscount.name,\n status: tieredDiscount.status,\n tiers: tieredDiscount.tiers.map(({ tier }) => ({\n tier: {\n lookup_key: tier.lookup_key,\n discount_type: tier.discount_type,\n discount_value: tier.discount_value,\n condition_quantity_gte: tier.condition_quantity_gte,\n },\n })),\n })),\n };\n};\n\nconst mapSellingPlan = (\n sellingPlan: StorefrontBundleData['selling_plan_groups'][number]['selling_plans'][number]\n): PublicBundleData['selling_plan_groups'][number]['selling_plans'][number] => ({\n id: sellingPlan.id,\n name: sellingPlan.name,\n options: sellingPlan.options.map(option => ({ name: option.name, value: option.value })),\n recurring_deliveries: sellingPlan.recurring_deliveries,\n price_adjustments: sellingPlan.price_adjustments.map(({ value, value_type }) => ({\n value,\n value_type,\n })),\n});\n\nconst mapSellingPlanGroups = (\n sellingPlanGroup: StorefrontBundleData['selling_plan_groups'][number]\n): PublicBundleData['selling_plan_groups'][number] => ({\n name: sellingPlanGroup.name,\n options: sellingPlanGroup.options.map(option => ({ name: option.name, values: option.values })),\n selling_plans: sellingPlanGroup.selling_plans.map(mapSellingPlan),\n});\n\nconst mapBasicVariant = (variant: BaseProductVariant) => ({\n id: String(variant.id),\n title: variant.title,\n price: variant.price,\n compare_at_price: variant.compare_at_price,\n options: variant.options,\n available_for_sale: variant.available,\n});\n\nconst formatFeaturedImage = (featuredImage: BaseProduct['featured_image']): string | null => {\n if (featuredImage == null || typeof featuredImage === 'string') return featuredImage;\n\n if ('src' in featuredImage) return featuredImage['src'];\n\n return null;\n};\n\nconst mapBasicProduct = (product: BaseProduct) => {\n return {\n id: String(product.id),\n title: product.title,\n description: product.description,\n available_for_sale: product.available,\n featured_image: formatFeaturedImage(product.featured_image),\n images: product.images,\n requires_selling_plan: product.requires_selling_plan,\n selling_plan_groups: product.selling_plan_groups.map(mapSellingPlanGroups),\n };\n};\n\nconst mapProduct = (product: StorefrontBundleData['collections'][number]['products'][number]) => {\n const productPlansLookup = productSellingPlansGroupLookup(product.selling_plan_groups);\n\n return {\n ...mapBasicProduct(product),\n handle: product.handle,\n tags: product.tags,\n price_range: { min: product.price_min, max: product.price_max },\n compare_at_price_range: { min: product.compare_at_price_min, max: product.compare_at_price_max },\n options: product.options,\n variants: product.variants.map(variant => ({\n ...mapBasicVariant(variant),\n selling_plan_allocations: variant.selling_plan_allocations.map(sellingPlan => ({\n price: sellingPlan.price,\n compare_at_price: sellingPlan.compare_at_price,\n selling_plan: mapSellingPlan(\n productPlansLookup[`${sellingPlan.selling_plan_group_id}-${sellingPlan.selling_plan_id}`]\n ),\n })),\n option1: variant.option1,\n option2: variant.option2,\n option3: variant.option3,\n sku: variant.sku || '',\n requires_shipping: variant.requires_shipping,\n taxable: variant.taxable,\n featured_image: formatFeaturedImage(variant.featured_image),\n public_title: variant.public_title,\n requires_selling_plan: variant.requires_selling_plan,\n })),\n };\n};\n\nconst mapBundleVariantRanges = ({\n items_count,\n ranges,\n}: Pick<StorefrontBundleData['bundle_settings']['variants'][number], 'items_count' | 'ranges'>) => {\n if (ranges.length > 0) {\n return ranges.map(({ quantity_max, quantity_min }) => ({ min: quantity_min, max: quantity_max }));\n }\n\n return [{ min: items_count, max: items_count }];\n};\n\nconst productSellingPlansGroupLookup = (sellingPlanGroups: BaseProduct['selling_plan_groups']) =>\n sellingPlanGroups.reduce<\n Record<string, StorefrontBundleData['selling_plan_groups'][number]['selling_plans'][number]>\n >((acc, current) => {\n current.selling_plans.forEach(sellingPlan => {\n const key = `${current.id}-${sellingPlan.id}`;\n acc[key] = sellingPlan;\n });\n\n return acc;\n }, {});\n\nexport function mapOnlineStoreToPublicBundleData(bundleData: StorefrontBundleData): PublicBundleData {\n const bundleSettings = mapBundleSettings(bundleData.bundle_settings);\n const variantsLookup = bundleData.variants.reduce<Record<string, StorefrontBundleData['variants'][number]>>(\n (acc, variant) => {\n acc[variant.id] = variant;\n return acc;\n },\n {}\n );\n\n return {\n id: String(bundleData.id),\n title: bundleData.title,\n handle: bundleData.handle,\n options: bundleData.options.map(option => ({\n name: option.name,\n position: option.position,\n values: option.values,\n })),\n default_variant_id: bundleSettings.default_variant_id,\n default_selling_plan_id: bundleSettings.default_selling_plan_id\n ? Number(bundleSettings.default_selling_plan_id)\n : null,\n available_for_sale: bundleData.available,\n requires_selling_plan: bundleData.requires_selling_plan,\n bundle_settings: {\n is_customizable: bundleSettings.is_customizable,\n price_rule: bundleSettings.price_rule as PriceRule,\n customization_window: bundleSettings.customization_window,\n max_quantity_per_variant: null,\n },\n variants: bundleData.bundle_settings.variants\n .filter(({ enabled }) => enabled)\n .map((item, index) => {\n const variant = variantsLookup[String(item.external_variant_id)];\n\n return {\n id: String(item.external_variant_id),\n title: variant.title,\n price: variant.price,\n compare_at_price: variant.compare_at_price,\n image: variant.image || '',\n available_for_sale: variant.available,\n options: variant.options,\n requires_selling_plan: variant.requires_selling_plan,\n selling_plan_allocations: variant.selling_plan_allocations.map(sellingPlan => ({\n price: sellingPlan.price,\n compare_at_price: sellingPlan.compare_at_price,\n selling_plan: mapSellingPlan(sellingPlan.selling_plan),\n })),\n ranges: mapBundleVariantRanges(item),\n collections: item.option_sources.map(source => ({\n id: source.option_source_id,\n source_platform: 'shopify',\n min: source.quantity_min || 0,\n max: source.quantity_max,\n })),\n default_selections: item.selection_defaults.map(selectionDefault => ({\n quantity: selectionDefault.quantity,\n product: {\n id: String(selectionDefault.product.id),\n handle: selectionDefault.handle,\n title: selectionDefault.product.title,\n description: selectionDefault.product.description,\n images: selectionDefault.product.images,\n },\n variant: {\n id: selectionDefault.external_variant_id,\n title: selectionDefault.variant.title,\n featured_image: formatFeaturedImage(selectionDefault.variant.featured_image),\n sku: selectionDefault.sku || '',\n },\n })),\n position: index,\n };\n }),\n selling_plan_groups: bundleData.selling_plan_groups.map(mapSellingPlanGroups),\n collections: Object.values(bundleData.collections).reduce<PublicBundleData['collections']>((acc, current) => {\n if (!Array.isArray(current.products)) {\n /* If a collection is not published in Online store, it is included \n as _1:{ handle: \"<collection-handle\"} in the collections object.\n We need to skip these collections.\n */\n return acc;\n }\n\n acc[String(current.id)] = {\n id: String(current.id),\n title: current.title,\n handle: current.handle,\n products: current.products.map(mapProduct),\n };\n\n return acc;\n }, {}),\n addons: bundleData.addons.products.length\n ? {\n collection_id: bundleSettings.addons?.collection_id || '',\n collection_handle: bundleSettings.addons?.collection_handle || '',\n products: bundleData.addons.products.map(product => ({\n ...mapBasicProduct(product),\n price_range: { min: product.price, max: product.price },\n compare_at_price_range: { min: product.compare_at_price || 0, max: product.compare_at_price },\n variants: product.variants.map(variant => ({\n ...mapBasicVariant(variant),\n image: variant.image,\n selling_plan_allocations: variant.selling_plan_allocations.map(sellingPlan => ({\n price: sellingPlan.price,\n compare_at_price: sellingPlan.compare_at_price,\n selling_plan: mapSellingPlan(sellingPlan.selling_plan),\n })),\n })),\n })),\n }\n : null,\n cross_sells: bundleData.cross_sells.products.length\n ? {\n collection_id: bundleSettings.cross_sells?.collection_id || '',\n collection_handle: bundleSettings.cross_sells?.collection_handle || '',\n products: bundleData.cross_sells.products.map(mapProduct),\n }\n : null,\n incentives: mapIncentives(bundleData.incentives),\n };\n}\n"],"names":[],"mappings":";;AAGA,MAAM,iBAAA,GAAoB,CAAC,cAA4D,KAAA;AACrF,EAAM,MAAA,MAAA,GAAS,eAAe,eAAgB,CAAA,MAAA,CAAA;AAC9C,EAAM,MAAA,UAAA,GAAa,eAAe,eAAgB,CAAA,UAAA,CAAA;AAClD,EAAA,MAAM,sBAAsB,cAAe,CAAA,oBAAA,CAAA;AAC3C,EAAA,MAAM,mBAAmB,cAAe,CAAA,yBAAA,CAAA;AACxC,EAAM,MAAA,gBAAA,GAAmB,eAAe,eAAgB,CAAA,gBAAA,CAAA;AAExD,EAAO,OAAA;AAAA,IACL,kBAAoB,EAAA,gBAAA,GAAmB,MAAO,CAAA,gBAAgB,CAAI,GAAA,IAAA;AAAA,IAClE,iBAAiB,cAAe,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;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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 const defaultFrequency = bundleSettings.layout_settings.defaultFrequency;\n\n return {\n default_variant_id: defaultVariantId ? String(defaultVariantId) : null,\n is_customizable: bundleSettings.is_customizable,\n price_rule: String(bundleSettings.price_rule).toUpperCase(),\n customization_window: customizationWindow\n ? {\n active_days: customizationWindow,\n disabled_message: bundleSettings.customization_window_disabled_message || '',\n }\n : null,\n addons: addons.collectionId\n ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle }\n : null,\n cross_sells: crossSells.collectionId\n ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle }\n : null,\n default_selling_plan_id: defaultFrequency || null,\n collapsible_collections: bundleSettings.layout_settings.collapsibleSections,\n max_quantity_per_variant: bundleSettings.max_quantity_per_variant,\n show_product_variants: bundleSettings.layout_settings.showVariants,\n product_details_modal_enabled: bundleSettings.layout_settings.learnMoreModal,\n };\n};\n\nconst mapIncentives = (incentives: StorefrontBundleData['incentives']): PublicBundleData['incentives'] => {\n if (incentives.tiered_discounts.length === 0) return null;\n\n return {\n tiered_discounts: incentives.tiered_discounts.map(tieredDiscount => ({\n eligible_charge_types: tieredDiscount.eligible_charge_types,\n eligible_line_item_types: tieredDiscount.eligible_line_item_types,\n external_bundle_product_id: {\n ecommerce: tieredDiscount.external_bundle_product_id.ecommerce,\n },\n lookup_key: tieredDiscount.lookup_key,\n name: tieredDiscount.name,\n status: tieredDiscount.status,\n tiers: tieredDiscount.tiers.map(({ tier }) => ({\n tier: {\n lookup_key: tier.lookup_key,\n discount_type: tier.discount_type,\n discount_value: tier.discount_value,\n condition_quantity_gte: tier.condition_quantity_gte,\n },\n })),\n })),\n };\n};\n\nconst mapSellingPlan = (\n sellingPlan: StorefrontBundleData['selling_plan_groups'][number]['selling_plans'][number]\n): PublicBundleData['selling_plan_groups'][number]['selling_plans'][number] => ({\n id: sellingPlan.id,\n name: sellingPlan.name,\n options: sellingPlan.options.map(option => ({ name: option.name, value: option.value })),\n recurring_deliveries: sellingPlan.recurring_deliveries,\n price_adjustments: sellingPlan.price_adjustments.map(({ value, value_type }) => ({\n value,\n value_type,\n })),\n});\n\nconst mapSellingPlanGroups = (\n sellingPlanGroup: StorefrontBundleData['selling_plan_groups'][number]\n): PublicBundleData['selling_plan_groups'][number] => ({\n name: sellingPlanGroup.name,\n options: sellingPlanGroup.options.map(option => ({ name: option.name, values: option.values })),\n selling_plans: sellingPlanGroup.selling_plans.map(mapSellingPlan),\n});\n\nconst mapBasicVariant = (variant: BaseProductVariant) => ({\n id: String(variant.id),\n title: variant.title,\n price: variant.price,\n compare_at_price: variant.compare_at_price,\n options: variant.options,\n available_for_sale: variant.available,\n});\n\nconst formatFeaturedImage = (featuredImage: BaseProduct['featured_image']): string | null => {\n if (featuredImage == null || typeof featuredImage === 'string') return featuredImage;\n\n if ('src' in featuredImage) return featuredImage['src'];\n\n return null;\n};\n\nconst mapBasicProduct = (product: BaseProduct) => {\n return {\n id: String(product.id),\n title: product.title,\n description: product.description,\n available_for_sale: product.available,\n featured_image: formatFeaturedImage(product.featured_image),\n images: product.images,\n requires_selling_plan: product.requires_selling_plan,\n selling_plan_groups: product.selling_plan_groups.map(mapSellingPlanGroups),\n };\n};\n\nconst mapProduct = (product: StorefrontBundleData['collections'][number]['products'][number]) => {\n const productPlansLookup = productSellingPlansGroupLookup(product.selling_plan_groups);\n\n return {\n ...mapBasicProduct(product),\n handle: product.handle,\n tags: product.tags,\n price_range: { min: product.price_min, max: product.price_max },\n compare_at_price_range: { min: product.compare_at_price_min, max: product.compare_at_price_max },\n options: product.options,\n variants: product.variants.map(variant => ({\n ...mapBasicVariant(variant),\n selling_plan_allocations: variant.selling_plan_allocations.map(sellingPlan => ({\n price: sellingPlan.price,\n compare_at_price: sellingPlan.compare_at_price,\n selling_plan: mapSellingPlan(\n productPlansLookup[`${sellingPlan.selling_plan_group_id}-${sellingPlan.selling_plan_id}`]\n ),\n })),\n option1: variant.option1,\n option2: variant.option2,\n option3: variant.option3,\n sku: variant.sku || '',\n requires_shipping: variant.requires_shipping,\n taxable: variant.taxable,\n featured_image: formatFeaturedImage(variant.featured_image),\n public_title: variant.public_title,\n requires_selling_plan: variant.requires_selling_plan,\n })),\n };\n};\n\nconst mapBundleVariantRanges = ({\n items_count,\n ranges,\n}: Pick<StorefrontBundleData['bundle_settings']['variants'][number], 'items_count' | 'ranges'>) => {\n if (ranges.length > 0) {\n return ranges.map(({ quantity_max, quantity_min }) => ({ min: quantity_min, max: quantity_max }));\n }\n\n return [{ min: items_count, max: items_count }];\n};\n\nconst productSellingPlansGroupLookup = (sellingPlanGroups: BaseProduct['selling_plan_groups']) =>\n sellingPlanGroups.reduce<\n Record<string, StorefrontBundleData['selling_plan_groups'][number]['selling_plans'][number]>\n >((acc, current) => {\n current.selling_plans.forEach(sellingPlan => {\n const key = `${current.id}-${sellingPlan.id}`;\n acc[key] = sellingPlan;\n });\n\n return acc;\n }, {});\n\nexport function mapOnlineStoreToPublicBundleData(bundleData: StorefrontBundleData): PublicBundleData {\n const bundleSettings = mapBundleSettings(bundleData.bundle_settings);\n const variantsLookup = bundleData.variants.reduce<Record<string, StorefrontBundleData['variants'][number]>>(\n (acc, variant) => {\n acc[variant.id] = variant;\n return acc;\n },\n {}\n );\n\n return {\n id: String(bundleData.id),\n title: bundleData.title,\n handle: bundleData.handle,\n options: bundleData.options.map(option => ({\n name: option.name,\n position: option.position,\n values: option.values,\n })),\n default_variant_id: bundleSettings.default_variant_id,\n default_selling_plan_id: bundleSettings.default_selling_plan_id\n ? Number(bundleSettings.default_selling_plan_id)\n : null,\n available_for_sale: bundleData.available,\n requires_selling_plan: bundleData.requires_selling_plan,\n bundle_settings: {\n is_customizable: bundleSettings.is_customizable,\n price_rule: bundleSettings.price_rule as PriceRule,\n customization_window: bundleSettings.customization_window,\n max_quantity_per_variant: bundleSettings.max_quantity_per_variant,\n collapsible_collections: bundleSettings.collapsible_collections,\n show_product_variants: bundleSettings.show_product_variants,\n product_details_modal_enabled: bundleSettings.product_details_modal_enabled,\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 position: source.position,\n })),\n default_selections: item.selection_defaults.map(selectionDefault => ({\n quantity: selectionDefault.quantity,\n product: {\n id: String(selectionDefault.product.id),\n handle: selectionDefault.handle,\n title: selectionDefault.product.title,\n description: selectionDefault.product.description,\n images: selectionDefault.product.images,\n },\n variant: {\n id: selectionDefault.external_variant_id,\n title: selectionDefault.variant.title,\n featured_image: formatFeaturedImage(selectionDefault.variant.featured_image),\n sku: selectionDefault.sku || '',\n },\n })),\n position: index,\n };\n }),\n selling_plan_groups: bundleData.selling_plan_groups.map(mapSellingPlanGroups),\n collections: Object.values(bundleData.collections).reduce<PublicBundleData['collections']>((acc, current) => {\n if (!Array.isArray(current.products)) {\n /* If a collection is not published in Online store, it is included \n as _1:{ handle: \"<collection-handle\"} in the collections object.\n We need to skip these collections.\n */\n return acc;\n }\n\n acc[String(current.id)] = {\n id: String(current.id),\n title: current.title,\n handle: current.handle,\n products: current.products.map(mapProduct),\n };\n\n return acc;\n }, {}),\n addons: bundleData.addons.products.length\n ? {\n collection_id: bundleSettings.addons?.collection_id || '',\n collection_handle: bundleSettings.addons?.collection_handle || '',\n products: bundleData.addons.products.map(product => ({\n ...mapBasicProduct(product),\n price_range: { min: product.price, max: product.price },\n compare_at_price_range: { min: product.compare_at_price || 0, max: product.compare_at_price },\n variants: product.variants.map(variant => ({\n ...mapBasicVariant(variant),\n image: variant.image,\n selling_plan_allocations: variant.selling_plan_allocations.map(sellingPlan => ({\n price: sellingPlan.price,\n compare_at_price: sellingPlan.compare_at_price,\n selling_plan: mapSellingPlan(sellingPlan.selling_plan),\n })),\n })),\n })),\n }\n : null,\n cross_sells: bundleData.cross_sells.products.length\n ? {\n collection_id: bundleSettings.cross_sells?.collection_id || '',\n collection_handle: bundleSettings.cross_sells?.collection_handle || '',\n products: bundleData.cross_sells.products.map(mapProduct),\n }\n : null,\n incentives: mapIncentives(bundleData.incentives),\n };\n}\n"],"names":[],"mappings":";;AAGA,MAAM,iBAAA,GAAoB,CAAC,cAA4D,KAAA;AACrF,EAAM,MAAA,MAAA,GAAS,eAAe,eAAgB,CAAA,MAAA,CAAA;AAC9C,EAAM,MAAA,UAAA,GAAa,eAAe,eAAgB,CAAA,UAAA,CAAA;AAClD,EAAA,MAAM,sBAAsB,cAAe,CAAA,oBAAA,CAAA;AAC3C,EAAA,MAAM,mBAAmB,cAAe,CAAA,yBAAA,CAAA;AACxC,EAAM,MAAA,gBAAA,GAAmB,eAAe,eAAgB,CAAA,gBAAA,CAAA;AAExD,EAAO,OAAA;AAAA,IACL,kBAAoB,EAAA,gBAAA,GAAmB,MAAO,CAAA,gBAAgB,CAAI,GAAA,IAAA;AAAA,IAClE,iBAAiB,cAAe,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,IACJ,yBAAyB,gBAAoB,IAAA,IAAA;AAAA,IAC7C,uBAAA,EAAyB,eAAe,eAAgB,CAAA,mBAAA;AAAA,IACxD,0BAA0B,cAAe,CAAA,wBAAA;AAAA,IACzC,qBAAA,EAAuB,e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EAAc,cAAe,CAAA,WAAA,CAAY,YAAY,CAAA;AAAA,WACrD,CAAA,CAAA;AAAA,SACF,CAAA,CAAA;AAAA,OACF,CAAA,CAAA;AAAA,KAEJ,GAAA,IAAA;AAAA,IACJ,WAAa,EAAA,UAAA,CAAW,WAAY,CAAA,QAAA,CAAS,MACzC,GAAA;AAAA,MACE,aAAA,EAAe,cAAe,CAAA,WAAA,EAAa,aAAiB,IAAA,EAAA;AAAA,MAC5D,iBAAA,EAAmB,cAAe,CAAA,WAAA,EAAa,iBAAqB,IAAA,EAAA;AAAA,MACpE,QAAU,EAAA,UAAA,CAAW,WAAY,CAAA,QAAA,CAAS,IAAI,UAAU,CAAA;AAAA,KAE1D,GAAA,IAAA;AAAA,IACJ,UAAA,EAAY,aAAc,CAAA,UAAA,CAAW,UAAU,CAAA;AAAA,GACjD,CAAA;AACF;;;;"}
|
|
@@ -49,7 +49,7 @@ async function rechargeApiRequest(method, url, { id, query, data, headers } = {}
|
|
|
49
49
|
"X-Recharge-Sdk-Fn": session.internalFnCall,
|
|
50
50
|
...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
|
|
51
51
|
...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
|
|
52
|
-
"X-Recharge-Sdk-Version": "1.
|
|
52
|
+
"X-Recharge-Sdk-Version": "1.57.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.57.1",
|
|
183
183
|
...headers ? headers : {}
|
|
184
184
|
};
|
|
185
185
|
return request(method, `${rechargeBaseUrl}${url}`, { id, query, data, headers: reqHeaders });
|
|
@@ -12,7 +12,7 @@ async function loadBundleData(id, options) {
|
|
|
12
12
|
async function loadFromOnlineStore(id, country_code) {
|
|
13
13
|
const headers = {
|
|
14
14
|
"X-Recharge-Sdk-Fn": "loadFromOnlineStore",
|
|
15
|
-
"X-Recharge-Sdk-Version": "1.
|
|
15
|
+
"X-Recharge-Sdk-Version": "1.57.1"
|
|
16
16
|
};
|
|
17
17
|
if (!country_code) {
|
|
18
18
|
const data = await shopifyAppProxyRequest("get", `/bundle-data/${id}`, { headers });
|
|
@@ -14,7 +14,11 @@ const mapBundleSettings = (bundleSettings) => {
|
|
|
14
14
|
} : null,
|
|
15
15
|
addons: addons.collectionId ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle } : null,
|
|
16
16
|
cross_sells: crossSells.collectionId ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle } : null,
|
|
17
|
-
default_selling_plan_id: defaultFrequency || null
|
|
17
|
+
default_selling_plan_id: defaultFrequency || null,
|
|
18
|
+
collapsible_collections: bundleSettings.layout_settings.collapsibleSections,
|
|
19
|
+
max_quantity_per_variant: bundleSettings.max_quantity_per_variant,
|
|
20
|
+
show_product_variants: bundleSettings.layout_settings.showVariants,
|
|
21
|
+
product_details_modal_enabled: bundleSettings.layout_settings.learnMoreModal
|
|
18
22
|
};
|
|
19
23
|
};
|
|
20
24
|
const mapIncentives = (incentives) => {
|
|
@@ -155,7 +159,10 @@ function mapOnlineStoreToPublicBundleData(bundleData) {
|
|
|
155
159
|
is_customizable: bundleSettings.is_customizable,
|
|
156
160
|
price_rule: bundleSettings.price_rule,
|
|
157
161
|
customization_window: bundleSettings.customization_window,
|
|
158
|
-
max_quantity_per_variant:
|
|
162
|
+
max_quantity_per_variant: bundleSettings.max_quantity_per_variant,
|
|
163
|
+
collapsible_collections: bundleSettings.collapsible_collections,
|
|
164
|
+
show_product_variants: bundleSettings.show_product_variants,
|
|
165
|
+
product_details_modal_enabled: bundleSettings.product_details_modal_enabled
|
|
159
166
|
},
|
|
160
167
|
variants: bundleData.bundle_settings.variants.filter(({ enabled }) => enabled).map((item, index) => {
|
|
161
168
|
const variant = variantsLookup[String(item.external_variant_id)];
|
|
@@ -178,7 +185,8 @@ function mapOnlineStoreToPublicBundleData(bundleData) {
|
|
|
178
185
|
id: source.option_source_id,
|
|
179
186
|
source_platform: "shopify",
|
|
180
187
|
min: source.quantity_min || 0,
|
|
181
|
-
max: source.quantity_max
|
|
188
|
+
max: source.quantity_max,
|
|
189
|
+
position: source.position
|
|
182
190
|
})),
|
|
183
191
|
default_selections: item.selection_defaults.map((selectionDefault) => ({
|
|
184
192
|
quantity: selectionDefault.quantity,
|
|
@@ -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 const defaultFrequency = bundleSettings.layout_settings.defaultFrequency;\n\n return {\n default_variant_id: defaultVariantId ? String(defaultVariantId) : null,\n is_customizable: bundleSettings.is_customizable,\n price_rule: String(bundleSettings.price_rule).toUpperCase(),\n customization_window: customizationWindow\n ? {\n active_days: customizationWindow,\n disabled_message: bundleSettings.customization_window_disabled_message || '',\n }\n : null,\n addons: addons.collectionId\n ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle }\n : null,\n cross_sells: crossSells.collectionId\n ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle }\n : null,\n default_selling_plan_id: defaultFrequency || null,\n };\n};\n\nconst mapIncentives = (incentives: StorefrontBundleData['incentives']): PublicBundleData['incentives'] => {\n if (incentives.tiered_discounts.length === 0) return null;\n\n return {\n tiered_discounts: incentives.tiered_discounts.map(tieredDiscount => ({\n eligible_charge_types: tieredDiscount.eligible_charge_types,\n eligible_line_item_types: tieredDiscount.eligible_line_item_types,\n external_bundle_product_id: {\n ecommerce: tieredDiscount.external_bundle_product_id.ecommerce,\n },\n lookup_key: tieredDiscount.lookup_key,\n name: tieredDiscount.name,\n status: tieredDiscount.status,\n tiers: tieredDiscount.tiers.map(({ tier }) => ({\n tier: {\n lookup_key: tier.lookup_key,\n discount_type: tier.discount_type,\n discount_value: tier.discount_value,\n condition_quantity_gte: tier.condition_quantity_gte,\n },\n })),\n })),\n };\n};\n\nconst mapSellingPlan = (\n sellingPlan: StorefrontBundleData['selling_plan_groups'][number]['selling_plans'][number]\n): PublicBundleData['selling_plan_groups'][number]['selling_plans'][number] => ({\n id: sellingPlan.id,\n name: sellingPlan.name,\n options: sellingPlan.options.map(option => ({ name: option.name, value: option.value })),\n recurring_deliveries: sellingPlan.recurring_deliveries,\n price_adjustments: sellingPlan.price_adjustments.map(({ value, value_type }) => ({\n value,\n value_type,\n })),\n});\n\nconst mapSellingPlanGroups = (\n sellingPlanGroup: StorefrontBundleData['selling_plan_groups'][number]\n): PublicBundleData['selling_plan_groups'][number] => ({\n name: sellingPlanGroup.name,\n options: sellingPlanGroup.options.map(option => ({ name: option.name, values: option.values })),\n selling_plans: sellingPlanGroup.selling_plans.map(mapSellingPlan),\n});\n\nconst mapBasicVariant = (variant: BaseProductVariant) => ({\n id: String(variant.id),\n title: variant.title,\n price: variant.price,\n compare_at_price: variant.compare_at_price,\n options: variant.options,\n available_for_sale: variant.available,\n});\n\nconst formatFeaturedImage = (featuredImage: BaseProduct['featured_image']): string | null => {\n if (featuredImage == null || typeof featuredImage === 'string') return featuredImage;\n\n if ('src' in featuredImage) return featuredImage['src'];\n\n return null;\n};\n\nconst mapBasicProduct = (product: BaseProduct) => {\n return {\n id: String(product.id),\n title: product.title,\n description: product.description,\n available_for_sale: product.available,\n featured_image: formatFeaturedImage(product.featured_image),\n images: product.images,\n requires_selling_plan: product.requires_selling_plan,\n selling_plan_groups: product.selling_plan_groups.map(mapSellingPlanGroups),\n };\n};\n\nconst mapProduct = (product: StorefrontBundleData['collections'][number]['products'][number]) => {\n const productPlansLookup = productSellingPlansGroupLookup(product.selling_plan_groups);\n\n return {\n ...mapBasicProduct(product),\n handle: product.handle,\n tags: product.tags,\n price_range: { min: product.price_min, max: product.price_max },\n compare_at_price_range: { min: product.compare_at_price_min, max: product.compare_at_price_max },\n options: product.options,\n variants: product.variants.map(variant => ({\n ...mapBasicVariant(variant),\n selling_plan_allocations: variant.selling_plan_allocations.map(sellingPlan => ({\n price: sellingPlan.price,\n compare_at_price: sellingPlan.compare_at_price,\n selling_plan: mapSellingPlan(\n productPlansLookup[`${sellingPlan.selling_plan_group_id}-${sellingPlan.selling_plan_id}`]\n ),\n })),\n option1: variant.option1,\n option2: variant.option2,\n option3: variant.option3,\n sku: variant.sku || '',\n requires_shipping: variant.requires_shipping,\n taxable: variant.taxable,\n featured_image: formatFeaturedImage(variant.featured_image),\n public_title: variant.public_title,\n requires_selling_plan: variant.requires_selling_plan,\n })),\n };\n};\n\nconst mapBundleVariantRanges = ({\n items_count,\n ranges,\n}: Pick<StorefrontBundleData['bundle_settings']['variants'][number], 'items_count' | 'ranges'>) => {\n if (ranges.length > 0) {\n return ranges.map(({ quantity_max, quantity_min }) => ({ min: quantity_min, max: quantity_max }));\n }\n\n return [{ min: items_count, max: items_count }];\n};\n\nconst productSellingPlansGroupLookup = (sellingPlanGroups: BaseProduct['selling_plan_groups']) =>\n sellingPlanGroups.reduce<\n Record<string, StorefrontBundleData['selling_plan_groups'][number]['selling_plans'][number]>\n >((acc, current) => {\n current.selling_plans.forEach(sellingPlan => {\n const key = `${current.id}-${sellingPlan.id}`;\n acc[key] = sellingPlan;\n });\n\n return acc;\n }, {});\n\nexport function mapOnlineStoreToPublicBundleData(bundleData: StorefrontBundleData): PublicBundleData {\n const bundleSettings = mapBundleSettings(bundleData.bundle_settings);\n const variantsLookup = bundleData.variants.reduce<Record<string, StorefrontBundleData['variants'][number]>>(\n (acc, variant) => {\n acc[variant.id] = variant;\n return acc;\n },\n {}\n );\n\n return {\n id: String(bundleData.id),\n title: bundleData.title,\n handle: bundleData.handle,\n options: bundleData.options.map(option => ({\n name: option.name,\n position: option.position,\n values: option.values,\n })),\n default_variant_id: bundleSettings.default_variant_id,\n default_selling_plan_id: bundleSettings.default_selling_plan_id\n ? Number(bundleSettings.default_selling_plan_id)\n : null,\n available_for_sale: bundleData.available,\n requires_selling_plan: bundleData.requires_selling_plan,\n bundle_settings: {\n is_customizable: bundleSettings.is_customizable,\n price_rule: bundleSettings.price_rule as PriceRule,\n customization_window: bundleSettings.customization_window,\n max_quantity_per_variant: null,\n },\n variants: bundleData.bundle_settings.variants\n .filter(({ enabled }) => enabled)\n .map((item, index) => {\n const variant = variantsLookup[String(item.external_variant_id)];\n\n return {\n id: String(item.external_variant_id),\n title: variant.title,\n price: variant.price,\n compare_at_price: variant.compare_at_price,\n image: variant.image || '',\n available_for_sale: variant.available,\n options: variant.options,\n requires_selling_plan: variant.requires_selling_plan,\n selling_plan_allocations: variant.selling_plan_allocations.map(sellingPlan => ({\n price: sellingPlan.price,\n compare_at_price: sellingPlan.compare_at_price,\n selling_plan: mapSellingPlan(sellingPlan.selling_plan),\n })),\n ranges: mapBundleVariantRanges(item),\n collections: item.option_sources.map(source => ({\n id: source.option_source_id,\n source_platform: 'shopify',\n min: source.quantity_min || 0,\n max: source.quantity_max,\n })),\n default_selections: item.selection_defaults.map(selectionDefault => ({\n quantity: selectionDefault.quantity,\n product: {\n id: String(selectionDefault.product.id),\n handle: selectionDefault.handle,\n title: selectionDefault.product.title,\n description: selectionDefault.product.description,\n images: selectionDefault.product.images,\n },\n variant: {\n id: selectionDefault.external_variant_id,\n title: selectionDefault.variant.title,\n featured_image: formatFeaturedImage(selectionDefault.variant.featured_image),\n sku: selectionDefault.sku || '',\n },\n })),\n position: index,\n };\n }),\n selling_plan_groups: bundleData.selling_plan_groups.map(mapSellingPlanGroups),\n collections: Object.values(bundleData.collections).reduce<PublicBundleData['collections']>((acc, current) => {\n if (!Array.isArray(current.products)) {\n /* If a collection is not published in Online store, it is included \n as _1:{ handle: \"<collection-handle\"} in the collections object.\n We need to skip these collections.\n */\n return acc;\n }\n\n acc[String(current.id)] = {\n id: String(current.id),\n title: current.title,\n handle: current.handle,\n products: current.products.map(mapProduct),\n };\n\n return acc;\n }, {}),\n addons: bundleData.addons.products.length\n ? {\n collection_id: bundleSettings.addons?.collection_id || '',\n collection_handle: bundleSettings.addons?.collection_handle || '',\n products: bundleData.addons.products.map(product => ({\n ...mapBasicProduct(product),\n price_range: { min: product.price, max: product.price },\n compare_at_price_range: { min: product.compare_at_price || 0, max: product.compare_at_price },\n variants: product.variants.map(variant => ({\n ...mapBasicVariant(variant),\n image: variant.image,\n selling_plan_allocations: variant.selling_plan_allocations.map(sellingPlan => ({\n price: sellingPlan.price,\n compare_at_price: sellingPlan.compare_at_price,\n selling_plan: mapSellingPlan(sellingPlan.selling_plan),\n })),\n })),\n })),\n }\n : null,\n cross_sells: bundleData.cross_sells.products.length\n ? {\n collection_id: bundleSettings.cross_sells?.collection_id || '',\n collection_handle: bundleSettings.cross_sells?.collection_handle || '',\n products: bundleData.cross_sells.products.map(mapProduct),\n }\n : null,\n incentives: mapIncentives(bundleData.incentives),\n };\n}\n"],"names":[],"mappings":"AAGA,MAAM,iBAAA,GAAoB,CAAC,cAA4D,KAAA;AACrF,EAAM,MAAA,MAAA,GAAS,eAAe,eAAgB,CAAA,MAAA,CAAA;AAC9C,EAAM,MAAA,UAAA,GAAa,eAAe,eAAgB,CAAA,UAAA,CAAA;AAClD,EAAA,MAAM,sB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AAA,QACnD,GAAG,gBAAgB,OAAO,CAAA;AAAA,QAC1B,aAAa,EAAE,GAAA,EAAK,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 const defaultFrequency = bundleSettings.layout_settings.defaultFrequency;\n\n return {\n default_variant_id: defaultVariantId ? String(defaultVariantId) : null,\n is_customizable: bundleSettings.is_customizable,\n price_rule: String(bundleSettings.price_rule).toUpperCase(),\n customization_window: customizationWindow\n ? {\n active_days: customizationWindow,\n disabled_message: bundleSettings.customization_window_disabled_message || '',\n }\n : null,\n addons: addons.collectionId\n ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle }\n : null,\n cross_sells: crossSells.collectionId\n ? { collection_id: addons.collectionId, collection_handle: addons.collectionHandle }\n : null,\n default_selling_plan_id: defaultFrequency || null,\n collapsible_collections: bundleSettings.layout_settings.collapsibleSections,\n max_quantity_per_variant: bundleSettings.max_quantity_per_variant,\n show_product_variants: bundleSettings.layout_settings.showVariants,\n product_details_modal_enabled: bundleSettings.layout_settings.learnMoreModal,\n };\n};\n\nconst mapIncentives = (incentives: StorefrontBundleData['incentives']): PublicBundleData['incentives'] => {\n if (incentives.tiered_discounts.length === 0) return null;\n\n return {\n tiered_discounts: incentives.tiered_discounts.map(tieredDiscount => ({\n eligible_charge_types: tieredDiscount.eligible_charge_types,\n eligible_line_item_types: tieredDiscount.eligible_line_item_types,\n external_bundle_product_id: {\n ecommerce: tieredDiscount.external_bundle_product_id.ecommerce,\n },\n lookup_key: tieredDiscount.lookup_key,\n name: tieredDiscount.name,\n status: tieredDiscount.status,\n tiers: tieredDiscount.tiers.map(({ tier }) => ({\n tier: {\n lookup_key: tier.lookup_key,\n discount_type: tier.discount_type,\n discount_value: tier.discount_value,\n condition_quantity_gte: tier.condition_quantity_gte,\n },\n })),\n })),\n };\n};\n\nconst mapSellingPlan = (\n sellingPlan: StorefrontBundleData['selling_plan_groups'][number]['selling_plans'][number]\n): PublicBundleData['selling_plan_groups'][number]['selling_plans'][number] => ({\n id: sellingPlan.id,\n name: sellingPlan.name,\n options: sellingPlan.options.map(option => ({ name: option.name, value: option.value })),\n recurring_deliveries: sellingPlan.recurring_deliveries,\n price_adjustments: sellingPlan.price_adjustments.map(({ value, value_type }) => ({\n value,\n value_type,\n })),\n});\n\nconst mapSellingPlanGroups = (\n sellingPlanGroup: StorefrontBundleData['selling_plan_groups'][number]\n): PublicBundleData['selling_plan_groups'][number] => ({\n name: sellingPlanGroup.name,\n options: sellingPlanGroup.options.map(option => ({ name: option.name, values: option.values })),\n selling_plans: sellingPlanGroup.selling_plans.map(mapSellingPlan),\n});\n\nconst mapBasicVariant = (variant: BaseProductVariant) => ({\n id: String(variant.id),\n title: variant.title,\n price: variant.price,\n compare_at_price: variant.compare_at_price,\n options: variant.options,\n available_for_sale: variant.available,\n});\n\nconst formatFeaturedImage = (featuredImage: BaseProduct['featured_image']): string | null => {\n if (featuredImage == null || typeof featuredImage === 'string') return featuredImage;\n\n if ('src' in featuredImage) return featuredImage['src'];\n\n return null;\n};\n\nconst mapBasicProduct = (product: BaseProduct) => {\n return {\n id: String(product.id),\n title: product.title,\n description: product.description,\n available_for_sale: product.available,\n featured_image: formatFeaturedImage(product.featured_image),\n images: product.images,\n requires_selling_plan: product.requires_selling_plan,\n selling_plan_groups: product.selling_plan_groups.map(mapSellingPlanGroups),\n };\n};\n\nconst mapProduct = (product: StorefrontBundleData['collections'][number]['products'][number]) => {\n const productPlansLookup = productSellingPlansGroupLookup(product.selling_plan_groups);\n\n return {\n ...mapBasicProduct(product),\n handle: product.handle,\n tags: product.tags,\n price_range: { min: product.price_min, max: product.price_max },\n compare_at_price_range: { min: product.compare_at_price_min, max: product.compare_at_price_max },\n options: product.options,\n variants: product.variants.map(variant => ({\n ...mapBasicVariant(variant),\n selling_plan_allocations: variant.selling_plan_allocations.map(sellingPlan => ({\n price: sellingPlan.price,\n compare_at_price: sellingPlan.compare_at_price,\n selling_plan: mapSellingPlan(\n productPlansLookup[`${sellingPlan.selling_plan_group_id}-${sellingPlan.selling_plan_id}`]\n ),\n })),\n option1: variant.option1,\n option2: variant.option2,\n option3: variant.option3,\n sku: variant.sku || '',\n requires_shipping: variant.requires_shipping,\n taxable: variant.taxable,\n featured_image: formatFeaturedImage(variant.featured_image),\n public_title: variant.public_title,\n requires_selling_plan: variant.requires_selling_plan,\n })),\n };\n};\n\nconst mapBundleVariantRanges = ({\n items_count,\n ranges,\n}: Pick<StorefrontBundleData['bundle_settings']['variants'][number], 'items_count' | 'ranges'>) => {\n if (ranges.length > 0) {\n return ranges.map(({ quantity_max, quantity_min }) => ({ min: quantity_min, max: quantity_max }));\n }\n\n return [{ min: items_count, max: items_count }];\n};\n\nconst productSellingPlansGroupLookup = (sellingPlanGroups: BaseProduct['selling_plan_groups']) =>\n sellingPlanGroups.reduce<\n Record<string, StorefrontBundleData['selling_plan_groups'][number]['selling_plans'][number]>\n >((acc, current) => {\n current.selling_plans.forEach(sellingPlan => {\n const key = `${current.id}-${sellingPlan.id}`;\n acc[key] = sellingPlan;\n });\n\n return acc;\n }, {});\n\nexport function mapOnlineStoreToPublicBundleData(bundleData: StorefrontBundleData): PublicBundleData {\n const bundleSettings = mapBundleSettings(bundleData.bundle_settings);\n const variantsLookup = bundleData.variants.reduce<Record<string, StorefrontBundleData['variants'][number]>>(\n (acc, variant) => {\n acc[variant.id] = variant;\n return acc;\n },\n {}\n );\n\n return {\n id: String(bundleData.id),\n title: bundleData.title,\n handle: bundleData.handle,\n options: bundleData.options.map(option => ({\n name: option.name,\n position: option.position,\n values: option.values,\n })),\n default_variant_id: bundleSettings.default_variant_id,\n default_selling_plan_id: bundleSettings.default_selling_plan_id\n ? Number(bundleSettings.default_selling_plan_id)\n : null,\n available_for_sale: bundleData.available,\n requires_selling_plan: bundleData.requires_selling_plan,\n bundle_settings: {\n is_customizable: bundleSettings.is_customizable,\n price_rule: bundleSettings.price_rule as PriceRule,\n customization_window: bundleSettings.customization_window,\n max_quantity_per_variant: bundleSettings.max_quantity_per_variant,\n collapsible_collections: bundleSettings.collapsible_collections,\n show_product_variants: bundleSettings.show_product_variants,\n product_details_modal_enabled: bundleSettings.product_details_modal_enabled,\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 position: source.position,\n })),\n default_selections: item.selection_defaults.map(selectionDefault => ({\n quantity: selectionDefault.quantity,\n product: {\n id: String(selectionDefault.product.id),\n handle: selectionDefault.handle,\n title: selectionDefault.product.title,\n description: selectionDefault.product.description,\n images: selectionDefault.product.images,\n },\n variant: {\n id: selectionDefault.external_variant_id,\n title: selectionDefault.variant.title,\n featured_image: formatFeaturedImage(selectionDefault.variant.featured_image),\n sku: selectionDefault.sku || '',\n },\n })),\n position: index,\n };\n }),\n selling_plan_groups: bundleData.selling_plan_groups.map(mapSellingPlanGroups),\n collections: Object.values(bundleData.collections).reduce<PublicBundleData['collections']>((acc, current) => {\n if (!Array.isArray(current.products)) {\n /* If a collection is not published in Online store, it is included \n as _1:{ handle: \"<collection-handle\"} in the collections object.\n We need to skip these collections.\n */\n return acc;\n }\n\n acc[String(current.id)] = {\n id: String(current.id),\n title: current.title,\n handle: current.handle,\n products: current.products.map(mapProduct),\n };\n\n return acc;\n }, {}),\n addons: bundleData.addons.products.length\n ? {\n collection_id: bundleSettings.addons?.collection_id || '',\n collection_handle: bundleSettings.addons?.collection_handle || '',\n products: bundleData.addons.products.map(product => ({\n ...mapBasicProduct(product),\n price_range: { min: product.price, max: product.price },\n compare_at_price_range: { min: product.compare_at_price || 0, max: product.compare_at_price },\n variants: product.variants.map(variant => ({\n ...mapBasicVariant(variant),\n image: variant.image,\n selling_plan_allocations: variant.selling_plan_allocations.map(sellingPlan => ({\n price: sellingPlan.price,\n compare_at_price: sellingPlan.compare_at_price,\n selling_plan: mapSellingPlan(sellingPlan.selling_plan),\n })),\n })),\n })),\n }\n : null,\n cross_sells: bundleData.cross_sells.products.length\n ? {\n collection_id: bundleSettings.cross_sells?.collection_id || '',\n collection_handle: bundleSettings.cross_sells?.collection_handle || '',\n products: bundleData.cross_sells.products.map(mapProduct),\n }\n : null,\n incentives: mapIncentives(bundleData.incentives),\n };\n}\n"],"names":[],"mappings":"AAGA,MAAM,iBAAA,GAAoB,CAAC,cAA4D,KAAA;AACrF,EAAM,MAAA,MAAA,GAAS,eAAe,eAAgB,CAAA,MAAA,CAAA;AAC9C,EAAM,MAAA,UAAA,GAAa,eAAe,eAAgB,CAAA,UAAA,CAAA;AAClD,EAAA,MAAM,sBAAsB,cAAe,CAAA,oBAAA,CAAA;AAC3C,EAAA,MAAM,mBAAmB,cAAe,CAAA,yBAAA,CAAA;AACxC,EAAM,MAAA,gBAAA,GAAmB,eAAe,eAAgB,CAAA,gBAAA,CAAA;AAExD,EAAO,OAAA;AAAA,IACL,kBAAoB,EAAA,gBAAA,GAAmB,MAAO,CAAA,gBAAgB,CAAI,GAAA,IAAA;AAAA,IAClE,iBAAiB,cAAe,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,gBA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Q,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;;;;"}
|
|
@@ -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.57.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
|
@@ -740,7 +740,7 @@ interface BundleData {
|
|
|
740
740
|
price_rule: BundleProduct['price_rule'];
|
|
741
741
|
customization_window: BundleProduct['customization_window'];
|
|
742
742
|
customization_window_disabled_message: BundleProduct['customization_window_disabled_message'];
|
|
743
|
-
layout_settings: Pick<BundleProduct['layout_settings'], 'addons' | 'crossSells' | 'defaultFrequency'>;
|
|
743
|
+
layout_settings: Pick<BundleProduct['layout_settings'], 'addons' | 'crossSells' | 'defaultFrequency' | 'collapsibleSections' | 'showVariants' | 'learnMoreModal'>;
|
|
744
744
|
variants: {
|
|
745
745
|
ranges: BundleProduct['variants'][number]['ranges'];
|
|
746
746
|
enabled: BundleProduct['variants'][number]['enabled'];
|
|
@@ -1063,6 +1063,14 @@ interface ReferralUrl {
|
|
|
1063
1063
|
interface ReferralInfo {
|
|
1064
1064
|
referral_url: ReferralUrl;
|
|
1065
1065
|
}
|
|
1066
|
+
interface Announcement {
|
|
1067
|
+
id: number;
|
|
1068
|
+
customer_id: number;
|
|
1069
|
+
flow_id: number;
|
|
1070
|
+
created_at: IsoDateString;
|
|
1071
|
+
updated_at: IsoDateString;
|
|
1072
|
+
view_schema: Record<string, unknown>;
|
|
1073
|
+
}
|
|
1066
1074
|
type CustomerIncludes = 'addresses' | 'metafields' | 'payment_methods' | 'subscriptions' | 'referral_info' | 'announcements';
|
|
1067
1075
|
interface GetCustomerOptions {
|
|
1068
1076
|
include?: CustomerIncludes[];
|
|
@@ -1119,6 +1127,7 @@ interface Customer {
|
|
|
1119
1127
|
payment_methods?: PaymentMethod[];
|
|
1120
1128
|
subscriptions?: Subscription[];
|
|
1121
1129
|
referral_info?: ReferralInfo;
|
|
1130
|
+
announcements?: Announcement[];
|
|
1122
1131
|
};
|
|
1123
1132
|
}
|
|
1124
1133
|
interface UpdateCustomerRequest extends Partial<Pick<Customer, 'email' | 'first_name' | 'last_name' | 'external_customer_id' | 'apply_credit_to_next_recurring_charge' | 'apply_credit_to_next_recurring_charge_channel' | 'phone' | 'backup_payment_methods_enabled'>> {
|
|
@@ -1777,6 +1786,9 @@ interface BundleSettings {
|
|
|
1777
1786
|
active_days: number;
|
|
1778
1787
|
disabled_message: string;
|
|
1779
1788
|
} | null;
|
|
1789
|
+
collapsible_collections: boolean;
|
|
1790
|
+
show_product_variants: boolean;
|
|
1791
|
+
product_details_modal_enabled: boolean;
|
|
1780
1792
|
}
|
|
1781
1793
|
/**
|
|
1782
1794
|
* A specific variant of a bundle product
|
|
@@ -1820,6 +1832,7 @@ interface QuantityRange {
|
|
|
1820
1832
|
interface CollectionBinding extends QuantityRange {
|
|
1821
1833
|
id: string;
|
|
1822
1834
|
source_platform: 'shopify';
|
|
1835
|
+
position: number;
|
|
1823
1836
|
}
|
|
1824
1837
|
/**
|
|
1825
1838
|
* Default selection for a bundle variant
|
|
@@ -3567,4 +3580,4 @@ declare const api: {
|
|
|
3567
3580
|
};
|
|
3568
3581
|
declare function initRecharge(opt?: InitOptions): void;
|
|
3569
3582
|
|
|
3570
|
-
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 };
|
|
3583
|
+
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 Announcement, 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 };
|