@gem-sdk/components 12.0.0-staging.80 → 12.0.0-staging.81
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/post-purchase/product/components/product-subscription/helpers/findDefaultValue.js +1 -1
- package/dist/cjs/post-purchase/product/components/product-subscription/helpers/findMatchedGroup.js +1 -1
- package/dist/esm/post-purchase/product/components/product-subscription/helpers/findDefaultValue.js +1 -1
- package/dist/esm/post-purchase/product/components/product-subscription/helpers/findMatchedGroup.js +1 -1
- package/package.json +1 -1
package/dist/cjs/post-purchase/product/components/product-subscription/helpers/findDefaultValue.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var calculateBestSellingPlan=require("./calculateBestSellingPlan.js"),core=require("@gem-sdk/core");const findDefaultValue=e=>{let{validPlans:l,extractedSettings:t,currentVariant:a,plans:i}=e;if(t.defaultOptions){let e=l.find(e=>e.baseID===t.defaultOptions),a=l.find(e=>e.id===t.defaultOptions)
|
|
1
|
+
"use strict";var calculateBestSellingPlan=require("./calculateBestSellingPlan.js"),core=require("@gem-sdk/core");const findDefaultValue=e=>{let{validPlans:l,extractedSettings:t,currentVariant:a,plans:i}=e;if(t.defaultOptions){let e=l.find(e=>e.baseID===t.defaultOptions),a=l.find(e=>e.id===t.defaultOptions),i=e?.baseID??a?.baseID;if(i)return i}if(l.length>0){let e="number"==typeof a?.price?String(a.price):a?.price??void 0,t=core.convertDecimalToNumber(e)??0,i=calculateBestSellingPlan.findBestPlanFromList({plans:l,variantPrice:t});if(i)return i.baseID}return i[0]?.value};exports.findDefaultValue=findDefaultValue;
|
package/dist/cjs/post-purchase/product/components/product-subscription/helpers/findMatchedGroup.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var calculateBestSellingPlan=require("./calculateBestSellingPlan.js"),core=require("@gem-sdk/core");const getAllValidPlans=e=>{let r=[];for(let
|
|
1
|
+
"use strict";var calculateBestSellingPlan=require("./calculateBestSellingPlan.js"),core=require("@gem-sdk/core");const DEFAULT_SOURCE_APP="__unknown__",getAllValidPlans=e=>{let r=[];for(let n of e)if(n?.sellingPlans){let e=n.sellingPlans.filter(e=>null!=e);r.push(...e)}return r},getVariantPrice=e=>{if(!e)return 0;let r="number"==typeof e.price?String(e.price):e.price??void 0;return core.convertDecimalToNumber(r)??0},findGroupByPlanId=(e,r)=>e.find(e=>e?.sellingPlans?.some(e=>e?.baseID===r||e?.id===r)),findGroupByBestPlan=(e,r)=>{let n=getAllValidPlans(e);if(0===n.length)return;let i=calculateBestSellingPlan.findBestPlanFromList({plans:n,variantPrice:r});if(i)return findGroupByPlanId(e,i.baseID||i.id||"")},findGroupByExactMeta=({sellingPlanGroups:e,extractedSettings:r,hasGroup:n,hasSourceApp:i,isUnknownSourceApp:l})=>n?l?e.find(e=>e?.id===r.group):i?e.find(e=>e?.appID===r.sourceApp&&e?.id===r.group):void 0:void 0,findMatchedGroup=e=>{let{sellingPlanGroups:r,extractedSettings:n,currentVariant:i}=e,l=getAllValidPlans(r),t=getVariantPrice(i),p=!!n.group,u=n.sourceApp===DEFAULT_SOURCE_APP,o=!!n.sourceApp,a=findGroupByExactMeta({sellingPlanGroups:r,extractedSettings:n,hasGroup:p,hasSourceApp:o,isUnknownSourceApp:u}),d=n.defaultOptions?findGroupByPlanId(r,n.defaultOptions):void 0,s=n.sourceApp&&n.sourceApp!==DEFAULT_SOURCE_APP?r.find(e=>e?.appID===n.sourceApp):void 0,f=!p||void 0===n.sourceApp||!!a,c=!n.defaultOptions||!!d,P=!n.sourceApp||n.sourceApp===DEFAULT_SOURCE_APP||!!s,A=!(f&&c&&P);if(A){let e=findGroupByBestPlan(r,t);return e||(l.length?r[0]:void 0)}if(n.defaultOptions){let e=findGroupByPlanId(r,n.defaultOptions);if(e)return e}if(n.sourceApp){let e=r.find(e=>e?.appID===n.sourceApp);if(e)return e}if(t>0){let e=findGroupByBestPlan(r,t);if(e)return e}return r[0]};exports.findMatchedGroup=findMatchedGroup;
|
package/dist/esm/post-purchase/product/components/product-subscription/helpers/findDefaultValue.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{findBestPlanFromList as e}from"./calculateBestSellingPlan.js";import{convertDecimalToNumber as t}from"@gem-sdk/core";let findDefaultValue=i=>{let{validPlans:l,extractedSettings:r,currentVariant:a,plans:f}=i;if(r.defaultOptions){let e=l.find(e=>e.baseID===r.defaultOptions),t=l.find(e=>e.id===r.defaultOptions)
|
|
1
|
+
import{findBestPlanFromList as e}from"./calculateBestSellingPlan.js";import{convertDecimalToNumber as t}from"@gem-sdk/core";let findDefaultValue=i=>{let{validPlans:l,extractedSettings:r,currentVariant:a,plans:f}=i;if(r.defaultOptions){let e=l.find(e=>e.baseID===r.defaultOptions),t=l.find(e=>e.id===r.defaultOptions),i=e?.baseID??t?.baseID;if(i)return i}if(l.length>0){let i="number"==typeof a?.price?String(a.price):a?.price??void 0,r=t(i)??0,f=e({plans:l,variantPrice:r});if(f)return f.baseID}return f[0]?.value};export{findDefaultValue};
|
package/dist/esm/post-purchase/product/components/product-subscription/helpers/findMatchedGroup.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{findBestPlanFromList as e}from"./calculateBestSellingPlan.js";import{convertDecimalToNumber as r}from"@gem-sdk/core";let getAllValidPlans=e=>{let r=[];for(let i of e)if(i?.sellingPlans){let e=i.sellingPlans.filter(e=>null!=e);r.push(...e)}return r},getVariantPrice=e=>{if(!e)return 0;let i="number"==typeof e.price?String(e.price):e.price??void 0;return r(i)??0},findGroupByPlanId=(e,r)=>e.find(e=>e?.sellingPlans?.some(e=>e?.baseID===r||e?.id===r)),findGroupByBestPlan=(r,i)=>{let
|
|
1
|
+
import{findBestPlanFromList as e}from"./calculateBestSellingPlan.js";import{convertDecimalToNumber as r}from"@gem-sdk/core";let DEFAULT_SOURCE_APP="__unknown__",getAllValidPlans=e=>{let r=[];for(let i of e)if(i?.sellingPlans){let e=i.sellingPlans.filter(e=>null!=e);r.push(...e)}return r},getVariantPrice=e=>{if(!e)return 0;let i="number"==typeof e.price?String(e.price):e.price??void 0;return r(i)??0},findGroupByPlanId=(e,r)=>e.find(e=>e?.sellingPlans?.some(e=>e?.baseID===r||e?.id===r)),findGroupByBestPlan=(r,i)=>{let n=getAllValidPlans(r);if(0===n.length)return;let t=e({plans:n,variantPrice:i});if(t)return findGroupByPlanId(r,t.baseID||t.id||"")},findGroupByExactMeta=({sellingPlanGroups:e,extractedSettings:r,hasGroup:i,hasSourceApp:n,isUnknownSourceApp:t})=>i?t?e.find(e=>e?.id===r.group):n?e.find(e=>e?.appID===r.sourceApp&&e?.id===r.group):void 0:void 0,findMatchedGroup=e=>{let{sellingPlanGroups:r,extractedSettings:i,currentVariant:n}=e,t=getAllValidPlans(r),l=getVariantPrice(n),p=!!i.group,o=i.sourceApp===DEFAULT_SOURCE_APP,u=!!i.sourceApp,d=findGroupByExactMeta({sellingPlanGroups:r,extractedSettings:i,hasGroup:p,hasSourceApp:u,isUnknownSourceApp:o}),a=i.defaultOptions?findGroupByPlanId(r,i.defaultOptions):void 0,f=i.sourceApp&&i.sourceApp!==DEFAULT_SOURCE_APP?r.find(e=>e?.appID===i.sourceApp):void 0,s=!p||void 0===i.sourceApp||!!d,P=!i.defaultOptions||!!a,c=!i.sourceApp||i.sourceApp===DEFAULT_SOURCE_APP||!!f,A=!(s&&P&&c);if(A){let e=findGroupByBestPlan(r,l);return e||(t.length?r[0]:void 0)}if(i.defaultOptions){let e=findGroupByPlanId(r,i.defaultOptions);if(e)return e}if(i.sourceApp){let e=r.find(e=>e?.appID===i.sourceApp);if(e)return e}if(l>0){let e=findGroupByBestPlan(r,l);if(e)return e}return r[0]};export{findMatchedGroup};
|