@schematichq/schematic-components 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/schematic-components.cjs.js +552 -146
- package/dist/schematic-components.d.ts +150 -7
- package/dist/schematic-components.esm.js +552 -146
- package/package.json +10 -10
|
@@ -579,10 +579,10 @@ var require_coreJsData = __commonJS({
|
|
|
579
579
|
var require_isMasked = __commonJS({
|
|
580
580
|
"node_modules/lodash/_isMasked.js"(exports, module2) {
|
|
581
581
|
var coreJsData = require_coreJsData();
|
|
582
|
-
var maskSrcKey = function() {
|
|
582
|
+
var maskSrcKey = (function() {
|
|
583
583
|
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
|
|
584
584
|
return uid ? "Symbol(src)_1." + uid : "";
|
|
585
|
-
}();
|
|
585
|
+
})();
|
|
586
586
|
function isMasked(func) {
|
|
587
587
|
return !!maskSrcKey && maskSrcKey in func;
|
|
588
588
|
}
|
|
@@ -945,14 +945,14 @@ var require_Stack = __commonJS({
|
|
|
945
945
|
var require_defineProperty = __commonJS({
|
|
946
946
|
"node_modules/lodash/_defineProperty.js"(exports, module2) {
|
|
947
947
|
var getNative = require_getNative();
|
|
948
|
-
var defineProperty = function() {
|
|
948
|
+
var defineProperty = (function() {
|
|
949
949
|
try {
|
|
950
950
|
var func = getNative(Object, "defineProperty");
|
|
951
951
|
func({}, "", {});
|
|
952
952
|
return func;
|
|
953
953
|
} catch (e2) {
|
|
954
954
|
}
|
|
955
|
-
}();
|
|
955
|
+
})();
|
|
956
956
|
module2.exports = defineProperty;
|
|
957
957
|
}
|
|
958
958
|
});
|
|
@@ -1094,7 +1094,7 @@ var require_baseCreate = __commonJS({
|
|
|
1094
1094
|
"node_modules/lodash/_baseCreate.js"(exports, module2) {
|
|
1095
1095
|
var isObject2 = require_isObject();
|
|
1096
1096
|
var objectCreate = Object.create;
|
|
1097
|
-
var baseCreate = /* @__PURE__ */ function() {
|
|
1097
|
+
var baseCreate = /* @__PURE__ */ (function() {
|
|
1098
1098
|
function object() {
|
|
1099
1099
|
}
|
|
1100
1100
|
return function(proto) {
|
|
@@ -1109,7 +1109,7 @@ var require_baseCreate = __commonJS({
|
|
|
1109
1109
|
object.prototype = void 0;
|
|
1110
1110
|
return result;
|
|
1111
1111
|
};
|
|
1112
|
-
}();
|
|
1112
|
+
})();
|
|
1113
1113
|
module2.exports = baseCreate;
|
|
1114
1114
|
}
|
|
1115
1115
|
});
|
|
@@ -1181,9 +1181,9 @@ var require_isArguments = __commonJS({
|
|
|
1181
1181
|
var objectProto = Object.prototype;
|
|
1182
1182
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
1183
1183
|
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
|
1184
|
-
var isArguments = baseIsArguments(/* @__PURE__ */ function() {
|
|
1184
|
+
var isArguments = baseIsArguments(/* @__PURE__ */ (function() {
|
|
1185
1185
|
return arguments;
|
|
1186
|
-
}()) ? baseIsArguments : function(value) {
|
|
1186
|
+
})()) ? baseIsArguments : function(value) {
|
|
1187
1187
|
return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
|
|
1188
1188
|
};
|
|
1189
1189
|
module2.exports = isArguments;
|
|
@@ -1345,7 +1345,7 @@ var require_nodeUtil = __commonJS({
|
|
|
1345
1345
|
var freeModule = freeExports && typeof module2 == "object" && module2 && !module2.nodeType && module2;
|
|
1346
1346
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
1347
1347
|
var freeProcess = moduleExports && freeGlobal.process;
|
|
1348
|
-
var nodeUtil = function() {
|
|
1348
|
+
var nodeUtil = (function() {
|
|
1349
1349
|
try {
|
|
1350
1350
|
var types = freeModule && freeModule.require && freeModule.require("util").types;
|
|
1351
1351
|
if (types) {
|
|
@@ -1354,7 +1354,7 @@ var require_nodeUtil = __commonJS({
|
|
|
1354
1354
|
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
|
1355
1355
|
} catch (e2) {
|
|
1356
1356
|
}
|
|
1357
|
-
}();
|
|
1357
|
+
})();
|
|
1358
1358
|
module2.exports = nodeUtil;
|
|
1359
1359
|
}
|
|
1360
1360
|
});
|
|
@@ -1848,6 +1848,7 @@ __export(index_exports, {
|
|
|
1848
1848
|
Button: () => Button,
|
|
1849
1849
|
ButtonElement: () => ButtonElement,
|
|
1850
1850
|
Card: () => Card,
|
|
1851
|
+
CheckoutDialog: () => CheckoutDialog,
|
|
1851
1852
|
Column: () => Column,
|
|
1852
1853
|
Container: () => Container,
|
|
1853
1854
|
Element: () => Element,
|
|
@@ -1881,6 +1882,7 @@ __export(index_exports, {
|
|
|
1881
1882
|
UpcomingBill: () => UpcomingBill,
|
|
1882
1883
|
Viewport: () => Viewport,
|
|
1883
1884
|
cardBoxShadow: () => cardBoxShadow,
|
|
1885
|
+
createActiveUsageBasedEntitlementsReducer: () => createActiveUsageBasedEntitlementsReducer,
|
|
1884
1886
|
defaultSettings: () => defaultSettings,
|
|
1885
1887
|
defaultTheme: () => defaultTheme,
|
|
1886
1888
|
iconsList: () => iconsList,
|
|
@@ -1943,8 +1945,8 @@ function getPriceValue(billingPrice) {
|
|
|
1943
1945
|
const price = typeof billingPrice.priceDecimal === "string" ? Number(billingPrice.priceDecimal) : billingPrice.price;
|
|
1944
1946
|
return price;
|
|
1945
1947
|
}
|
|
1946
|
-
function getPlanPrice(plan, period = "month") {
|
|
1947
|
-
const billingPrice = period === "year" ? plan.yearlyPrice : plan.monthlyPrice;
|
|
1948
|
+
function getPlanPrice(plan, period = "month", options2 = { useSelectedPeriod: true }) {
|
|
1949
|
+
const billingPrice = options2.useSelectedPeriod ? period === "year" ? plan.yearlyPrice : plan.monthlyPrice : plan.yearlyPrice && !plan.monthlyPrice ? plan.yearlyPrice : plan.monthlyPrice;
|
|
1948
1950
|
if (billingPrice) {
|
|
1949
1951
|
return { ...billingPrice, price: getPriceValue(billingPrice) };
|
|
1950
1952
|
}
|
|
@@ -3611,7 +3613,7 @@ function he(t2) {
|
|
|
3611
3613
|
for (var n = [], o2 = 1; o2 < arguments.length; o2++) n[o2 - 1] = arguments[o2];
|
|
3612
3614
|
return false ? new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(t2, " for more information.").concat(n.length > 0 ? " Args: ".concat(n.join(", ")) : "")) : new Error(de.apply(void 0, __spreadArray([pe[t2]], n, false)).trim());
|
|
3613
3615
|
}
|
|
3614
|
-
var fe = function() {
|
|
3616
|
+
var fe = (function() {
|
|
3615
3617
|
function e2(e3) {
|
|
3616
3618
|
this.groupSizes = new Uint32Array(512), this.length = 512, this.tag = e3;
|
|
3617
3619
|
}
|
|
@@ -3637,7 +3639,7 @@ var fe = function() {
|
|
|
3637
3639
|
for (var n = this.groupSizes[e3], o2 = this.indexOfGroup(e3), r2 = o2 + n, s2 = o2; s2 < r2; s2++) t2 += "".concat(this.tag.getRule(s2)).concat(g);
|
|
3638
3640
|
return t2;
|
|
3639
3641
|
}, e2;
|
|
3640
|
-
}();
|
|
3642
|
+
})();
|
|
3641
3643
|
var me = 1 << 30;
|
|
3642
3644
|
var ye = /* @__PURE__ */ new Map();
|
|
3643
3645
|
var ve = /* @__PURE__ */ new Map();
|
|
@@ -3679,24 +3681,24 @@ function Ce() {
|
|
|
3679
3681
|
return "undefined" != typeof __webpack_nonce__ ? __webpack_nonce__ : null;
|
|
3680
3682
|
}
|
|
3681
3683
|
var Ie = function(e2) {
|
|
3682
|
-
var t2 = document.head, n = e2 || t2, o2 = document.createElement("style"), r2 = function(e3) {
|
|
3684
|
+
var t2 = document.head, n = e2 || t2, o2 = document.createElement("style"), r2 = (function(e3) {
|
|
3683
3685
|
var t3 = Array.from(e3.querySelectorAll("style[".concat(f, "]")));
|
|
3684
3686
|
return t3[t3.length - 1];
|
|
3685
|
-
}(n), s2 = void 0 !== r2 ? r2.nextSibling : null;
|
|
3687
|
+
})(n), s2 = void 0 !== r2 ? r2.nextSibling : null;
|
|
3686
3688
|
o2.setAttribute(f, m), o2.setAttribute(y, v);
|
|
3687
3689
|
var i2 = Ce();
|
|
3688
3690
|
return i2 && o2.setAttribute("nonce", i2), n.insertBefore(o2, s2), o2;
|
|
3689
3691
|
};
|
|
3690
|
-
var Ae = function() {
|
|
3692
|
+
var Ae = (function() {
|
|
3691
3693
|
function e2(e3) {
|
|
3692
|
-
this.element = Ie(e3), this.element.appendChild(document.createTextNode("")), this.sheet = function(e4) {
|
|
3694
|
+
this.element = Ie(e3), this.element.appendChild(document.createTextNode("")), this.sheet = (function(e4) {
|
|
3693
3695
|
if (e4.sheet) return e4.sheet;
|
|
3694
3696
|
for (var t2 = document.styleSheets, n = 0, o2 = t2.length; n < o2; n++) {
|
|
3695
3697
|
var r2 = t2[n];
|
|
3696
3698
|
if (r2.ownerNode === e4) return r2;
|
|
3697
3699
|
}
|
|
3698
3700
|
throw he(17);
|
|
3699
|
-
}(this.element), this.length = 0;
|
|
3701
|
+
})(this.element), this.length = 0;
|
|
3700
3702
|
}
|
|
3701
3703
|
return e2.prototype.insertRule = function(e3, t2) {
|
|
3702
3704
|
try {
|
|
@@ -3710,8 +3712,8 @@ var Ae = function() {
|
|
|
3710
3712
|
var t2 = this.sheet.cssRules[e3];
|
|
3711
3713
|
return t2 && t2.cssText ? t2.cssText : "";
|
|
3712
3714
|
}, e2;
|
|
3713
|
-
}();
|
|
3714
|
-
var Oe = function() {
|
|
3715
|
+
})();
|
|
3716
|
+
var Oe = (function() {
|
|
3715
3717
|
function e2(e3) {
|
|
3716
3718
|
this.element = Ie(e3), this.nodes = this.element.childNodes, this.length = 0;
|
|
3717
3719
|
}
|
|
@@ -3726,8 +3728,8 @@ var Oe = function() {
|
|
|
3726
3728
|
}, e2.prototype.getRule = function(e3) {
|
|
3727
3729
|
return e3 < this.length ? this.nodes[e3].textContent : "";
|
|
3728
3730
|
}, e2;
|
|
3729
|
-
}();
|
|
3730
|
-
var De = function() {
|
|
3731
|
+
})();
|
|
3732
|
+
var De = (function() {
|
|
3731
3733
|
function e2(e3) {
|
|
3732
3734
|
this.rules = [], this.length = 0;
|
|
3733
3735
|
}
|
|
@@ -3738,19 +3740,19 @@ var De = function() {
|
|
|
3738
3740
|
}, e2.prototype.getRule = function(e3) {
|
|
3739
3741
|
return e3 < this.length ? this.rules[e3] : "";
|
|
3740
3742
|
}, e2;
|
|
3741
|
-
}();
|
|
3743
|
+
})();
|
|
3742
3744
|
var Re = S;
|
|
3743
3745
|
var Te = { isServer: !S, useCSSOMInjection: !w };
|
|
3744
|
-
var ke = function() {
|
|
3746
|
+
var ke = (function() {
|
|
3745
3747
|
function e2(e3, n, o2) {
|
|
3746
3748
|
void 0 === e3 && (e3 = C), void 0 === n && (n = {});
|
|
3747
3749
|
var r2 = this;
|
|
3748
3750
|
this.options = __assign(__assign({}, Te), e3), this.gs = n, this.names = new Map(o2), this.server = !!e3.isServer, !this.server && S && Re && (Re = false, _e(this)), ue(this, function() {
|
|
3749
|
-
return function(e4) {
|
|
3751
|
+
return (function(e4) {
|
|
3750
3752
|
for (var t2 = e4.getTag(), n2 = t2.length, o3 = "", r3 = function(n3) {
|
|
3751
|
-
var r4 = function(e5) {
|
|
3753
|
+
var r4 = (function(e5) {
|
|
3752
3754
|
return ve.get(e5);
|
|
3753
|
-
}(n3);
|
|
3755
|
+
})(n3);
|
|
3754
3756
|
if (void 0 === r4) return "continue";
|
|
3755
3757
|
var s3 = e4.names.get(r4), i2 = t2.getGroup(n3);
|
|
3756
3758
|
if (void 0 === s3 || !s3.size || 0 === i2.length) return "continue";
|
|
@@ -3760,7 +3762,7 @@ var ke = function() {
|
|
|
3760
3762
|
}), o3 += "".concat(i2).concat(a2, '{content:"').concat(c2, '"}').concat(g);
|
|
3761
3763
|
}, s2 = 0; s2 < n2; s2++) r3(s2);
|
|
3762
3764
|
return o3;
|
|
3763
|
-
}(r2);
|
|
3765
|
+
})(r2);
|
|
3764
3766
|
});
|
|
3765
3767
|
}
|
|
3766
3768
|
return e2.registerId = function(e3) {
|
|
@@ -3772,10 +3774,10 @@ var ke = function() {
|
|
|
3772
3774
|
}, e2.prototype.allocateGSInstance = function(e3) {
|
|
3773
3775
|
return this.gs[e3] = (this.gs[e3] || 0) + 1;
|
|
3774
3776
|
}, e2.prototype.getTag = function() {
|
|
3775
|
-
return this.tag || (this.tag = (e3 = function(e4) {
|
|
3777
|
+
return this.tag || (this.tag = (e3 = (function(e4) {
|
|
3776
3778
|
var t2 = e4.useCSSOMInjection, n = e4.target;
|
|
3777
3779
|
return e4.isServer ? new De(n) : t2 ? new Ae(n) : new Oe(n);
|
|
3778
|
-
}(this.options), new fe(e3)));
|
|
3780
|
+
})(this.options), new fe(e3)));
|
|
3779
3781
|
var e3;
|
|
3780
3782
|
}, e2.prototype.hasNameForId = function(e3, t2) {
|
|
3781
3783
|
return this.names.has(e3) && this.names.get(e3).has(t2);
|
|
@@ -3794,7 +3796,7 @@ var ke = function() {
|
|
|
3794
3796
|
}, e2.prototype.clearTag = function() {
|
|
3795
3797
|
this.tag = void 0;
|
|
3796
3798
|
}, e2;
|
|
3797
|
-
}();
|
|
3799
|
+
})();
|
|
3798
3800
|
var je = /&/g;
|
|
3799
3801
|
var xe = /^\s*\/\/.*$/gm;
|
|
3800
3802
|
function Ve(e2, t2) {
|
|
@@ -3847,7 +3849,7 @@ function Ye(e2) {
|
|
|
3847
3849
|
}, [e2.shouldForwardProp, l2, u2]);
|
|
3848
3850
|
return import_react.default.createElement($e.Provider, { value: d }, import_react.default.createElement(Le.Provider, { value: u2 }, e2.children));
|
|
3849
3851
|
}
|
|
3850
|
-
var We = function() {
|
|
3852
|
+
var We = (function() {
|
|
3851
3853
|
function e2(e3, t2) {
|
|
3852
3854
|
var n = this;
|
|
3853
3855
|
this.inject = function(e4, t3) {
|
|
@@ -3861,7 +3863,7 @@ var We = function() {
|
|
|
3861
3863
|
return e2.prototype.getName = function(e3) {
|
|
3862
3864
|
return void 0 === e3 && (e3 = ze), this.name + e3.hash;
|
|
3863
3865
|
}, e2;
|
|
3864
|
-
}();
|
|
3866
|
+
})();
|
|
3865
3867
|
var qe = function(e2) {
|
|
3866
3868
|
return e2 >= "A" && e2 <= "Z";
|
|
3867
3869
|
};
|
|
@@ -3905,7 +3907,7 @@ function Ze(e2) {
|
|
|
3905
3907
|
return true;
|
|
3906
3908
|
}
|
|
3907
3909
|
var Ke = z(v);
|
|
3908
|
-
var Qe = function() {
|
|
3910
|
+
var Qe = (function() {
|
|
3909
3911
|
function e2(e3, t2, n) {
|
|
3910
3912
|
this.rules = e3, this.staticRulesId = "", this.isStatic = false, this.componentId = t2, this.baseHash = M(Ke, t2), this.baseStyle = n, ke.registerId(t2);
|
|
3911
3913
|
}
|
|
@@ -3936,12 +3938,12 @@ var Qe = function() {
|
|
|
3936
3938
|
}
|
|
3937
3939
|
return o2;
|
|
3938
3940
|
}, e2;
|
|
3939
|
-
}();
|
|
3941
|
+
})();
|
|
3940
3942
|
var et = import_react.default.createContext(void 0);
|
|
3941
3943
|
var tt = et.Consumer;
|
|
3942
3944
|
function ot(e2) {
|
|
3943
3945
|
var n = import_react.default.useContext(et), r2 = (0, import_react.useMemo)(function() {
|
|
3944
|
-
return function(e3, n2) {
|
|
3946
|
+
return (function(e3, n2) {
|
|
3945
3947
|
if (!e3) throw he(14);
|
|
3946
3948
|
if (re(e3)) {
|
|
3947
3949
|
var o2 = e3(n2);
|
|
@@ -3950,21 +3952,21 @@ function ot(e2) {
|
|
|
3950
3952
|
}
|
|
3951
3953
|
if (Array.isArray(e3) || "object" != typeof e3) throw he(8);
|
|
3952
3954
|
return n2 ? __assign(__assign({}, n2), e3) : e3;
|
|
3953
|
-
}(e2.theme, n);
|
|
3955
|
+
})(e2.theme, n);
|
|
3954
3956
|
}, [e2.theme, n]);
|
|
3955
3957
|
return e2.children ? import_react.default.createElement(et.Provider, { value: r2 }, e2.children) : null;
|
|
3956
3958
|
}
|
|
3957
3959
|
var rt = {};
|
|
3958
3960
|
var st = /* @__PURE__ */ new Set();
|
|
3959
3961
|
function it(e2, r2, s2) {
|
|
3960
|
-
var i2 = se(e2), a2 = e2, c2 = !L(e2), p2 = r2.attrs, d = void 0 === p2 ? _ : p2, h = r2.componentId, f2 = void 0 === h ? function(e3, t2) {
|
|
3962
|
+
var i2 = se(e2), a2 = e2, c2 = !L(e2), p2 = r2.attrs, d = void 0 === p2 ? _ : p2, h = r2.componentId, f2 = void 0 === h ? (function(e3, t2) {
|
|
3961
3963
|
var n = "string" != typeof e3 ? "sc" : R(e3);
|
|
3962
3964
|
rt[n] = (rt[n] || 0) + 1;
|
|
3963
3965
|
var o2 = "".concat(n, "-").concat($(v + n + rt[n]));
|
|
3964
3966
|
return t2 ? "".concat(t2, "-").concat(o2) : o2;
|
|
3965
|
-
}(r2.displayName, r2.parentComponentId) : h, m2 = r2.displayName, y2 = void 0 === m2 ? function(e3) {
|
|
3967
|
+
})(r2.displayName, r2.parentComponentId) : h, m2 = r2.displayName, y2 = void 0 === m2 ? (function(e3) {
|
|
3966
3968
|
return L(e3) ? "styled.".concat(e3) : "Styled(".concat(B(e3), ")");
|
|
3967
|
-
}(e2) : m2, g2 = r2.displayName && r2.componentId ? "".concat(R(r2.displayName), "-").concat(r2.componentId) : r2.componentId || f2, S2 = i2 && a2.attrs ? a2.attrs.concat(d).filter(Boolean) : d, w2 = r2.shouldForwardProp;
|
|
3969
|
+
})(e2) : m2, g2 = r2.displayName && r2.componentId ? "".concat(R(r2.displayName), "-").concat(r2.componentId) : r2.componentId || f2, S2 = i2 && a2.attrs ? a2.attrs.concat(d).filter(Boolean) : d, w2 = r2.shouldForwardProp;
|
|
3968
3970
|
if (i2 && a2.shouldForwardProp) {
|
|
3969
3971
|
var b2 = a2.shouldForwardProp;
|
|
3970
3972
|
if (r2.shouldForwardProp) {
|
|
@@ -3976,37 +3978,37 @@ function it(e2, r2, s2) {
|
|
|
3976
3978
|
}
|
|
3977
3979
|
var N2 = new Qe(s2, g2, i2 ? a2.componentStyle : void 0);
|
|
3978
3980
|
function O2(e3, r3) {
|
|
3979
|
-
return function(e4, r4, s3) {
|
|
3981
|
+
return (function(e4, r4, s3) {
|
|
3980
3982
|
var i3 = e4.attrs, a3 = e4.componentStyle, c3 = e4.defaultProps, p3 = e4.foldedComponentIds, d2 = e4.styledComponentId, h2 = e4.target, f3 = import_react.default.useContext(et), m3 = Ge(), y3 = e4.shouldForwardProp || m3.shouldForwardProp;
|
|
3981
3983
|
(0, import_react.useDebugValue)(d2);
|
|
3982
|
-
var v2 = I(r4, f3, c3) || C, g3 = function(e5, n, o2) {
|
|
3984
|
+
var v2 = I(r4, f3, c3) || C, g3 = (function(e5, n, o2) {
|
|
3983
3985
|
for (var r5, s4 = __assign(__assign({}, n), { className: void 0, theme: o2 }), i4 = 0; i4 < e5.length; i4 += 1) {
|
|
3984
3986
|
var a4 = re(r5 = e5[i4]) ? r5(s4) : r5;
|
|
3985
3987
|
for (var c4 in a4) s4[c4] = "className" === c4 ? ie(s4[c4], a4[c4]) : "style" === c4 ? __assign(__assign({}, s4[c4]), a4[c4]) : a4[c4];
|
|
3986
3988
|
}
|
|
3987
3989
|
return n.className && (s4.className = ie(s4.className, n.className)), s4;
|
|
3988
|
-
}(i3, r4, v2), S3 = g3.as || h2, w3 = {};
|
|
3990
|
+
})(i3, r4, v2), S3 = g3.as || h2, w3 = {};
|
|
3989
3991
|
for (var b3 in g3) void 0 === g3[b3] || "$" === b3[0] || "as" === b3 || "theme" === b3 && g3.theme === v2 || ("forwardedAs" === b3 ? w3.as = g3.forwardedAs : y3 && !y3(b3, S3) || (w3[b3] = g3[b3], y3 || false || isPropValid(b3) || st.has(b3) || !A.has(S3) || (st.add(b3), console.warn('styled-components: it looks like an unknown prop "'.concat(b3, '" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));
|
|
3990
|
-
var E3 = function(e5, t2) {
|
|
3992
|
+
var E3 = (function(e5, t2) {
|
|
3991
3993
|
var n = Ge(), o2 = e5.generateAndInjectStyles(t2, n.styleSheet, n.stylis);
|
|
3992
3994
|
return (0, import_react.useDebugValue)(o2), o2;
|
|
3993
|
-
}(a3, g3);
|
|
3995
|
+
})(a3, g3);
|
|
3994
3996
|
e4.warnTooManyClasses && e4.warnTooManyClasses(E3);
|
|
3995
3997
|
var N3 = ie(p3, d2);
|
|
3996
3998
|
return E3 && (N3 += " " + E3), g3.className && (N3 += " " + g3.className), w3[L(S3) && !A.has(S3) ? "class" : "className"] = N3, s3 && (w3.ref = s3), (0, import_react.createElement)(S3, w3);
|
|
3997
|
-
}(D2, e3, r3);
|
|
3999
|
+
})(D2, e3, r3);
|
|
3998
4000
|
}
|
|
3999
4001
|
O2.displayName = y2;
|
|
4000
4002
|
var D2 = import_react.default.forwardRef(O2);
|
|
4001
4003
|
return D2.attrs = S2, D2.componentStyle = N2, D2.displayName = y2, D2.shouldForwardProp = w2, D2.foldedComponentIds = i2 ? ie(a2.foldedComponentIds, a2.styledComponentId) : "", D2.styledComponentId = g2, D2.target = i2 ? a2.target : e2, Object.defineProperty(D2, "defaultProps", { get: function() {
|
|
4002
4004
|
return this._foldedDefaultProps;
|
|
4003
4005
|
}, set: function(e3) {
|
|
4004
|
-
this._foldedDefaultProps = i2 ? function(e4) {
|
|
4006
|
+
this._foldedDefaultProps = i2 ? (function(e4) {
|
|
4005
4007
|
for (var t2 = [], n = 1; n < arguments.length; n++) t2[n - 1] = arguments[n];
|
|
4006
4008
|
for (var o2 = 0, r3 = t2; o2 < r3.length; o2++) le(e4, r3[o2], true);
|
|
4007
4009
|
return e4;
|
|
4008
|
-
}({}, a2.defaultProps, e3) : e3;
|
|
4009
|
-
} }), P(y2, g2), D2.warnTooManyClasses = /* @__PURE__ */ function(e3, t2) {
|
|
4010
|
+
})({}, a2.defaultProps, e3) : e3;
|
|
4011
|
+
} }), P(y2, g2), D2.warnTooManyClasses = /* @__PURE__ */ (function(e3, t2) {
|
|
4010
4012
|
var n = {}, o2 = false;
|
|
4011
4013
|
return function(r3) {
|
|
4012
4014
|
if (!o2 && (n[r3] = true, Object.keys(n).length >= 200)) {
|
|
@@ -4014,7 +4016,7 @@ function it(e2, r2, s2) {
|
|
|
4014
4016
|
console.warn("Over ".concat(200, " classes were generated for component ").concat(e3).concat(s3, ".\n") + "Consider using the attrs method, together with a style object for frequently changed styles.\nExample:\n const Component = styled.div.attrs(props => ({\n style: {\n background: props.background,\n },\n }))`width: 100%;`\n\n <Component />"), o2 = true, n = {};
|
|
4015
4017
|
}
|
|
4016
4018
|
};
|
|
4017
|
-
}(y2, g2), ue(D2, function() {
|
|
4019
|
+
})(y2, g2), ue(D2, function() {
|
|
4018
4020
|
return ".".concat(D2.styledComponentId);
|
|
4019
4021
|
}), c2 && oe(D2, e2, { attrs: true, componentStyle: true, displayName: true, foldedComponentIds: true, shouldForwardProp: true, styledComponentId: true, target: true }), D2;
|
|
4020
4022
|
}
|
|
@@ -4050,7 +4052,7 @@ var dt = pt;
|
|
|
4050
4052
|
A.forEach(function(e2) {
|
|
4051
4053
|
dt[e2] = pt(e2);
|
|
4052
4054
|
});
|
|
4053
|
-
var ht = function() {
|
|
4055
|
+
var ht = (function() {
|
|
4054
4056
|
function e2(e3, t2) {
|
|
4055
4057
|
this.rules = e3, this.componentId = t2, this.isStatic = Ze(e3), ke.registerId(this.componentId + 1);
|
|
4056
4058
|
}
|
|
@@ -4062,7 +4064,7 @@ var ht = function() {
|
|
|
4062
4064
|
}, e2.prototype.renderStyles = function(e3, t2, n, o2) {
|
|
4063
4065
|
e3 > 2 && ke.registerId(this.componentId + e3), this.removeStyles(e3, n), this.createStyles(e3, t2, n, o2);
|
|
4064
4066
|
}, e2;
|
|
4065
|
-
}();
|
|
4067
|
+
})();
|
|
4066
4068
|
function ft(n) {
|
|
4067
4069
|
for (var r2 = [], s2 = 1; s2 < arguments.length; s2++) r2[s2 - 1] = arguments[s2];
|
|
4068
4070
|
var i2 = lt.apply(void 0, __spreadArray([n], r2, false)), a2 = "sc-global-".concat($(JSON.stringify(i2))), c2 = new ht(i2, a2);
|
|
@@ -4092,7 +4094,7 @@ function mt(t2) {
|
|
|
4092
4094
|
var r2 = ae(lt.apply(void 0, __spreadArray([t2], n, false))), s2 = $(r2);
|
|
4093
4095
|
return new We(s2, r2);
|
|
4094
4096
|
}
|
|
4095
|
-
var vt = function() {
|
|
4097
|
+
var vt = (function() {
|
|
4096
4098
|
function e2() {
|
|
4097
4099
|
var e3 = this;
|
|
4098
4100
|
this._emitSheetCSS = function() {
|
|
@@ -4120,7 +4122,7 @@ var vt = function() {
|
|
|
4120
4122
|
}, e2.prototype.interleaveWithNodeStream = function(e3) {
|
|
4121
4123
|
throw he(3);
|
|
4122
4124
|
}, e2;
|
|
4123
|
-
}();
|
|
4125
|
+
})();
|
|
4124
4126
|
"undefined" != typeof navigator && "ReactNative" === navigator.product && console.warn("It looks like you've imported 'styled-components' on React Native.\nPerhaps you're looking to import 'styled-components/native'?\nRead more about this at https://www.styled-components.com/docs/basics#react-native");
|
|
4125
4127
|
var St = "__sc-".concat(f, "__");
|
|
4126
4128
|
"undefined" != typeof window && (window[St] || (window[St] = 0), 1 === window[St] && console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://s-c.sh/2BAXzed for more info."), window[St] += 1);
|
|
@@ -4143,7 +4145,7 @@ attr.rem = function propAsRem(key, value) {
|
|
|
4143
4145
|
};
|
|
4144
4146
|
|
|
4145
4147
|
// src/hooks/useAvailablePlans.ts
|
|
4146
|
-
function useAvailablePlans(activePeriod) {
|
|
4148
|
+
function useAvailablePlans(activePeriod, options2 = { useSelectedPeriod: true }) {
|
|
4147
4149
|
const { data, settings } = useEmbed();
|
|
4148
4150
|
const getAvailablePeriods = (0, import_react2.useCallback)(() => {
|
|
4149
4151
|
const periods = [];
|
|
@@ -4157,12 +4159,15 @@ function useAvailablePlans(activePeriod) {
|
|
|
4157
4159
|
}, [data?.activePlans, data?.activeAddOns]);
|
|
4158
4160
|
const getActivePlans = (0, import_react2.useCallback)(
|
|
4159
4161
|
(plans) => {
|
|
4160
|
-
const activePlans = settings.mode === "edit" ? plans.slice() : plans.filter(
|
|
4161
|
-
(
|
|
4162
|
-
|
|
4162
|
+
const activePlans = settings.mode === "edit" ? plans.slice() : plans.filter((plan) => {
|
|
4163
|
+
if (options2.useSelectedPeriod) {
|
|
4164
|
+
return activePeriod === "month" && plan.monthlyPrice || activePeriod === "year" && plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
|
|
4165
|
+
}
|
|
4166
|
+
return plan.monthlyPrice || plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
|
|
4167
|
+
});
|
|
4163
4168
|
return activePlans.map((plan) => ({ ...plan, isSelected: false }));
|
|
4164
4169
|
},
|
|
4165
|
-
[activePeriod, settings.mode]
|
|
4170
|
+
[activePeriod, options2.useSelectedPeriod, settings.mode]
|
|
4166
4171
|
);
|
|
4167
4172
|
return (0, import_react2.useMemo)(() => {
|
|
4168
4173
|
return {
|
|
@@ -4264,6 +4269,7 @@ var stub = () => {
|
|
|
4264
4269
|
var initialContext = {
|
|
4265
4270
|
...initialState,
|
|
4266
4271
|
hydratePublic: stub,
|
|
4272
|
+
hydrate: stub,
|
|
4267
4273
|
hydrateComponent: stub,
|
|
4268
4274
|
hydrateExternal: stub,
|
|
4269
4275
|
getUpcomingInvoice: stub,
|
|
@@ -4712,6 +4718,26 @@ var postProcessor = {
|
|
|
4712
4718
|
return value;
|
|
4713
4719
|
}
|
|
4714
4720
|
};
|
|
4721
|
+
var PATH_KEY = Symbol("i18next/PATH_KEY");
|
|
4722
|
+
function createProxy() {
|
|
4723
|
+
const state = [];
|
|
4724
|
+
const handler = /* @__PURE__ */ Object.create(null);
|
|
4725
|
+
let proxy;
|
|
4726
|
+
handler.get = (target, key) => {
|
|
4727
|
+
proxy?.revoke?.();
|
|
4728
|
+
if (key === PATH_KEY) return state;
|
|
4729
|
+
state.push(key);
|
|
4730
|
+
proxy = Proxy.revocable(target, handler);
|
|
4731
|
+
return proxy.proxy;
|
|
4732
|
+
};
|
|
4733
|
+
return Proxy.revocable(/* @__PURE__ */ Object.create(null), handler).proxy;
|
|
4734
|
+
}
|
|
4735
|
+
function keysFromSelector(selector, opts) {
|
|
4736
|
+
const {
|
|
4737
|
+
[PATH_KEY]: path
|
|
4738
|
+
} = selector(createProxy());
|
|
4739
|
+
return path.join(opts?.keySeparator ?? ".");
|
|
4740
|
+
}
|
|
4715
4741
|
var checkedLoadedFor = {};
|
|
4716
4742
|
var shouldHandleAsObject = (res) => !isString(res) && typeof res !== "boolean" && typeof res !== "number";
|
|
4717
4743
|
var Translator = class _Translator extends EventEmitter {
|
|
@@ -4773,6 +4799,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
4773
4799
|
};
|
|
4774
4800
|
if (!opt) opt = {};
|
|
4775
4801
|
if (keys == null) return "";
|
|
4802
|
+
if (typeof keys === "function") keys = keysFromSelector(keys, opt);
|
|
4776
4803
|
if (!Array.isArray(keys)) keys = [String(keys)];
|
|
4777
4804
|
const returnDetails = opt.returnDetails !== void 0 ? opt.returnDetails : this.options.returnDetails;
|
|
4778
4805
|
const keySeparator = opt.keySeparator !== void 0 ? opt.keySeparator : this.options.keySeparator;
|
|
@@ -5050,22 +5077,22 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
5050
5077
|
const zeroSuffix = `${this.options.pluralSeparator}zero`;
|
|
5051
5078
|
const ordinalPrefix = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
5052
5079
|
if (needsPluralHandling) {
|
|
5053
|
-
finalKeys.push(key + pluralSuffix);
|
|
5054
5080
|
if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
|
|
5055
5081
|
finalKeys.push(key + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
|
|
5056
5082
|
}
|
|
5083
|
+
finalKeys.push(key + pluralSuffix);
|
|
5057
5084
|
if (needsZeroSuffixLookup) {
|
|
5058
5085
|
finalKeys.push(key + zeroSuffix);
|
|
5059
5086
|
}
|
|
5060
5087
|
}
|
|
5061
5088
|
if (needsContextHandling) {
|
|
5062
|
-
const contextKey = `${key}${this.options.contextSeparator}${opt.context}`;
|
|
5089
|
+
const contextKey = `${key}${this.options.contextSeparator || "_"}${opt.context}`;
|
|
5063
5090
|
finalKeys.push(contextKey);
|
|
5064
5091
|
if (needsPluralHandling) {
|
|
5065
|
-
finalKeys.push(contextKey + pluralSuffix);
|
|
5066
5092
|
if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
|
|
5067
5093
|
finalKeys.push(contextKey + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
|
|
5068
5094
|
}
|
|
5095
|
+
finalKeys.push(contextKey + pluralSuffix);
|
|
5069
5096
|
if (needsZeroSuffixLookup) {
|
|
5070
5097
|
finalKeys.push(contextKey + zeroSuffix);
|
|
5071
5098
|
}
|
|
@@ -6026,7 +6053,7 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
6026
6053
|
});
|
|
6027
6054
|
const usingLegacyFormatFunction = this.options.interpolation.format && this.options.interpolation.format !== defOpts.interpolation.format;
|
|
6028
6055
|
if (usingLegacyFormatFunction) {
|
|
6029
|
-
this.logger.
|
|
6056
|
+
this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`);
|
|
6030
6057
|
}
|
|
6031
6058
|
if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
|
|
6032
6059
|
s2.formatter = createClassOnDemand(formatter);
|
|
@@ -6721,6 +6748,7 @@ var en_default = {
|
|
|
6721
6748
|
"Add new payment method": "Add new payment method",
|
|
6722
6749
|
"Add Seats": "Add More",
|
|
6723
6750
|
"Add-ons": "Add-ons",
|
|
6751
|
+
"Add-ons Quantity": "Add-ons Quantity",
|
|
6724
6752
|
Additional: "Additional",
|
|
6725
6753
|
"After the trial, cancel no default": "After the trial, you will be lose access to {{planName}} plan and your subscription will be cancelled.",
|
|
6726
6754
|
"After the trial, cancel": "After the trial, you will be downgraded to the {{defaultPlanName}} plan and your subscription will be cancelled.",
|
|
@@ -6791,6 +6819,7 @@ var en_default = {
|
|
|
6791
6819
|
"Powered by": "Powered by",
|
|
6792
6820
|
"Price by unit based on final tier reached.": "Price by unit based on final tier reached.",
|
|
6793
6821
|
Proration: "Proration",
|
|
6822
|
+
"Quantity to pay for in advance": "Quantity to pay for in advance",
|
|
6794
6823
|
"Remove add-on": "Remove add-on",
|
|
6795
6824
|
Resets: "Resets {{date}}",
|
|
6796
6825
|
"Save payment method": "Save payment method",
|
|
@@ -6805,6 +6834,7 @@ var en_default = {
|
|
|
6805
6834
|
"Select payment method": "Select payment method",
|
|
6806
6835
|
"Select plan": "Select plan",
|
|
6807
6836
|
"Select quantity": "Select quantity",
|
|
6837
|
+
"Select quantities for add-ons": "Select quantities for add-ons",
|
|
6808
6838
|
Selected: "Selected",
|
|
6809
6839
|
"Selected plan or associated price is missing.": "Selected plan or associated price is missing.",
|
|
6810
6840
|
"Session expired. Please refresh and try again.": "Session expired. Please refresh and try again.",
|
|
@@ -7844,6 +7874,33 @@ function CheckoutUnsubscribeResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
7844
7874
|
};
|
|
7845
7875
|
}
|
|
7846
7876
|
|
|
7877
|
+
// src/api/checkoutexternal/models/CurrencyBalance.ts
|
|
7878
|
+
function CurrencyBalanceFromJSON(json) {
|
|
7879
|
+
return CurrencyBalanceFromJSONTyped(json, false);
|
|
7880
|
+
}
|
|
7881
|
+
function CurrencyBalanceFromJSONTyped(json, ignoreDiscriminator) {
|
|
7882
|
+
if (json == null) {
|
|
7883
|
+
return json;
|
|
7884
|
+
}
|
|
7885
|
+
return {
|
|
7886
|
+
balance: json["balance"],
|
|
7887
|
+
currency: json["currency"]
|
|
7888
|
+
};
|
|
7889
|
+
}
|
|
7890
|
+
|
|
7891
|
+
// src/api/checkoutexternal/models/CompanyCustomerBalance.ts
|
|
7892
|
+
function CompanyCustomerBalanceFromJSON(json) {
|
|
7893
|
+
return CompanyCustomerBalanceFromJSONTyped(json, false);
|
|
7894
|
+
}
|
|
7895
|
+
function CompanyCustomerBalanceFromJSONTyped(json, ignoreDiscriminator) {
|
|
7896
|
+
if (json == null) {
|
|
7897
|
+
return json;
|
|
7898
|
+
}
|
|
7899
|
+
return {
|
|
7900
|
+
balances: json["balances"].map(CurrencyBalanceFromJSON)
|
|
7901
|
+
};
|
|
7902
|
+
}
|
|
7903
|
+
|
|
7847
7904
|
// src/api/checkoutexternal/models/CompanyEventPeriodMetricsResponseData.ts
|
|
7848
7905
|
function CompanyEventPeriodMetricsResponseDataFromJSON(json) {
|
|
7849
7906
|
return CompanyEventPeriodMetricsResponseDataFromJSONTyped(json, false);
|
|
@@ -8104,12 +8161,12 @@ function EventSummaryResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8104
8161
|
return json;
|
|
8105
8162
|
}
|
|
8106
8163
|
return {
|
|
8107
|
-
companyCount: json["company_count"]
|
|
8164
|
+
companyCount: json["company_count"],
|
|
8108
8165
|
environmentId: json["environment_id"],
|
|
8109
8166
|
eventCount: json["event_count"],
|
|
8110
8167
|
eventSubtype: json["event_subtype"],
|
|
8111
8168
|
lastSeenAt: json["last_seen_at"] == null ? void 0 : new Date(json["last_seen_at"]),
|
|
8112
|
-
userCount: json["user_count"]
|
|
8169
|
+
userCount: json["user_count"]
|
|
8113
8170
|
};
|
|
8114
8171
|
}
|
|
8115
8172
|
|
|
@@ -8674,6 +8731,7 @@ function ComponentHydrateResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8674
8731
|
),
|
|
8675
8732
|
defaultPlan: json["default_plan"] == null ? void 0 : PlanDetailResponseDataFromJSON(json["default_plan"]),
|
|
8676
8733
|
featureUsage: json["feature_usage"] == null ? void 0 : FeatureUsageDetailResponseDataFromJSON(json["feature_usage"]),
|
|
8734
|
+
showPeriodToggle: json["show_period_toggle"],
|
|
8677
8735
|
stripeEmbed: json["stripe_embed"] == null ? void 0 : StripeEmbedInfoFromJSON(json["stripe_embed"]),
|
|
8678
8736
|
subscription: json["subscription"] == null ? void 0 : CompanySubscriptionResponseDataFromJSON(json["subscription"]),
|
|
8679
8737
|
trialPaymentMethodRequired: json["trial_payment_method_required"] == null ? void 0 : json["trial_payment_method_required"],
|
|
@@ -8725,6 +8783,20 @@ function DeletePaymentMethodResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8725
8783
|
};
|
|
8726
8784
|
}
|
|
8727
8785
|
|
|
8786
|
+
// src/api/checkoutexternal/models/FetchCustomerBalanceResponse.ts
|
|
8787
|
+
function FetchCustomerBalanceResponseFromJSON(json) {
|
|
8788
|
+
return FetchCustomerBalanceResponseFromJSONTyped(json, false);
|
|
8789
|
+
}
|
|
8790
|
+
function FetchCustomerBalanceResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
8791
|
+
if (json == null) {
|
|
8792
|
+
return json;
|
|
8793
|
+
}
|
|
8794
|
+
return {
|
|
8795
|
+
data: CompanyCustomerBalanceFromJSON(json["data"]),
|
|
8796
|
+
params: json["params"]
|
|
8797
|
+
};
|
|
8798
|
+
}
|
|
8799
|
+
|
|
8728
8800
|
// src/api/checkoutexternal/models/GetSetupIntentResponse.ts
|
|
8729
8801
|
function GetSetupIntentResponseFromJSON(json) {
|
|
8730
8802
|
return GetSetupIntentResponseFromJSONTyped(json, false);
|
|
@@ -8753,6 +8825,20 @@ function HydrateComponentResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8753
8825
|
};
|
|
8754
8826
|
}
|
|
8755
8827
|
|
|
8828
|
+
// src/api/checkoutexternal/models/HydrateResponse.ts
|
|
8829
|
+
function HydrateResponseFromJSON(json) {
|
|
8830
|
+
return HydrateResponseFromJSONTyped(json, false);
|
|
8831
|
+
}
|
|
8832
|
+
function HydrateResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
8833
|
+
if (json == null) {
|
|
8834
|
+
return json;
|
|
8835
|
+
}
|
|
8836
|
+
return {
|
|
8837
|
+
data: ComponentHydrateResponseDataFromJSON(json["data"]),
|
|
8838
|
+
params: json["params"]
|
|
8839
|
+
};
|
|
8840
|
+
}
|
|
8841
|
+
|
|
8756
8842
|
// src/api/checkoutexternal/models/HydrateUpcomingInvoiceResponse.ts
|
|
8757
8843
|
function HydrateUpcomingInvoiceResponseFromJSON(json) {
|
|
8758
8844
|
return HydrateUpcomingInvoiceResponseFromJSONTyped(json, false);
|
|
@@ -9048,6 +9134,38 @@ var CheckoutexternalApi = class extends BaseAPI {
|
|
|
9048
9134
|
);
|
|
9049
9135
|
return await response.value();
|
|
9050
9136
|
}
|
|
9137
|
+
/**
|
|
9138
|
+
* Fetch customer balance
|
|
9139
|
+
*/
|
|
9140
|
+
async fetchCustomerBalanceRaw(initOverrides) {
|
|
9141
|
+
const queryParameters = {};
|
|
9142
|
+
const headerParameters = {};
|
|
9143
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
9144
|
+
headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
|
|
9145
|
+
"X-Schematic-Api-Key"
|
|
9146
|
+
);
|
|
9147
|
+
}
|
|
9148
|
+
const response = await this.request(
|
|
9149
|
+
{
|
|
9150
|
+
path: `/checkout/balance`,
|
|
9151
|
+
method: "GET",
|
|
9152
|
+
headers: headerParameters,
|
|
9153
|
+
query: queryParameters
|
|
9154
|
+
},
|
|
9155
|
+
initOverrides
|
|
9156
|
+
);
|
|
9157
|
+
return new JSONApiResponse(
|
|
9158
|
+
response,
|
|
9159
|
+
(jsonValue) => FetchCustomerBalanceResponseFromJSON(jsonValue)
|
|
9160
|
+
);
|
|
9161
|
+
}
|
|
9162
|
+
/**
|
|
9163
|
+
* Fetch customer balance
|
|
9164
|
+
*/
|
|
9165
|
+
async fetchCustomerBalance(initOverrides) {
|
|
9166
|
+
const response = await this.fetchCustomerBalanceRaw(initOverrides);
|
|
9167
|
+
return await response.value();
|
|
9168
|
+
}
|
|
9051
9169
|
/**
|
|
9052
9170
|
* Get setup intent
|
|
9053
9171
|
*/
|
|
@@ -9092,6 +9210,38 @@ var CheckoutexternalApi = class extends BaseAPI {
|
|
|
9092
9210
|
);
|
|
9093
9211
|
return await response.value();
|
|
9094
9212
|
}
|
|
9213
|
+
/**
|
|
9214
|
+
* Hydrate
|
|
9215
|
+
*/
|
|
9216
|
+
async hydrateRaw(initOverrides) {
|
|
9217
|
+
const queryParameters = {};
|
|
9218
|
+
const headerParameters = {};
|
|
9219
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
9220
|
+
headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
|
|
9221
|
+
"X-Schematic-Api-Key"
|
|
9222
|
+
);
|
|
9223
|
+
}
|
|
9224
|
+
const response = await this.request(
|
|
9225
|
+
{
|
|
9226
|
+
path: `/components/hydrate`,
|
|
9227
|
+
method: "GET",
|
|
9228
|
+
headers: headerParameters,
|
|
9229
|
+
query: queryParameters
|
|
9230
|
+
},
|
|
9231
|
+
initOverrides
|
|
9232
|
+
);
|
|
9233
|
+
return new JSONApiResponse(
|
|
9234
|
+
response,
|
|
9235
|
+
(jsonValue) => HydrateResponseFromJSON(jsonValue)
|
|
9236
|
+
);
|
|
9237
|
+
}
|
|
9238
|
+
/**
|
|
9239
|
+
* Hydrate
|
|
9240
|
+
*/
|
|
9241
|
+
async hydrate(initOverrides) {
|
|
9242
|
+
const response = await this.hydrateRaw(initOverrides);
|
|
9243
|
+
return await response.value();
|
|
9244
|
+
}
|
|
9095
9245
|
/**
|
|
9096
9246
|
* Hydrate component
|
|
9097
9247
|
*/
|
|
@@ -9782,12 +9932,12 @@ function EventSummaryResponseDataFromJSONTyped3(json, ignoreDiscriminator) {
|
|
|
9782
9932
|
return json;
|
|
9783
9933
|
}
|
|
9784
9934
|
return {
|
|
9785
|
-
companyCount: json["company_count"]
|
|
9935
|
+
companyCount: json["company_count"],
|
|
9786
9936
|
environmentId: json["environment_id"],
|
|
9787
9937
|
eventCount: json["event_count"],
|
|
9788
9938
|
eventSubtype: json["event_subtype"],
|
|
9789
9939
|
lastSeenAt: json["last_seen_at"] == null ? void 0 : new Date(json["last_seen_at"]),
|
|
9790
|
-
userCount: json["user_count"]
|
|
9940
|
+
userCount: json["user_count"]
|
|
9791
9941
|
};
|
|
9792
9942
|
}
|
|
9793
9943
|
|
|
@@ -9988,6 +10138,32 @@ function FeatureDetailResponseDataFromJSONTyped6(json, ignoreDiscriminator) {
|
|
|
9988
10138
|
};
|
|
9989
10139
|
}
|
|
9990
10140
|
|
|
10141
|
+
// src/api/componentspublic/models/PlanCreditGrantView.ts
|
|
10142
|
+
function PlanCreditGrantViewFromJSON2(json) {
|
|
10143
|
+
return PlanCreditGrantViewFromJSONTyped3(json, false);
|
|
10144
|
+
}
|
|
10145
|
+
function PlanCreditGrantViewFromJSONTyped3(json, ignoreDiscriminator) {
|
|
10146
|
+
if (json == null) {
|
|
10147
|
+
return json;
|
|
10148
|
+
}
|
|
10149
|
+
return {
|
|
10150
|
+
createdAt: new Date(json["created_at"]),
|
|
10151
|
+
creditAmount: json["credit_amount"],
|
|
10152
|
+
creditDescription: json["credit_description"],
|
|
10153
|
+
creditIcon: json["credit_icon"] == null ? void 0 : json["credit_icon"],
|
|
10154
|
+
creditId: json["credit_id"],
|
|
10155
|
+
creditName: json["credit_name"],
|
|
10156
|
+
id: json["id"],
|
|
10157
|
+
planId: json["plan_id"],
|
|
10158
|
+
planName: json["plan_name"],
|
|
10159
|
+
pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
|
|
10160
|
+
resetCadence: json["reset_cadence"],
|
|
10161
|
+
resetStart: json["reset_start"],
|
|
10162
|
+
singularName: json["singular_name"] == null ? void 0 : json["singular_name"],
|
|
10163
|
+
updatedAt: new Date(json["updated_at"])
|
|
10164
|
+
};
|
|
10165
|
+
}
|
|
10166
|
+
|
|
9991
10167
|
// src/api/componentspublic/models/PlanResponseData.ts
|
|
9992
10168
|
function PlanResponseDataFromJSON2(json) {
|
|
9993
10169
|
return PlanResponseDataFromJSONTyped4(json, false);
|
|
@@ -10071,6 +10247,9 @@ function PlanViewPublicResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
10071
10247
|
),
|
|
10072
10248
|
icon: json["icon"],
|
|
10073
10249
|
id: json["id"],
|
|
10250
|
+
includedCreditGrants: json["included_credit_grants"].map(
|
|
10251
|
+
PlanCreditGrantViewFromJSON2
|
|
10252
|
+
),
|
|
10074
10253
|
isCustom: json["is_custom"],
|
|
10075
10254
|
isDefault: json["is_default"],
|
|
10076
10255
|
isFree: json["is_free"],
|
|
@@ -10182,6 +10361,7 @@ var reducer = (state, action) => {
|
|
|
10182
10361
|
};
|
|
10183
10362
|
}
|
|
10184
10363
|
case "HYDRATE_PUBLIC":
|
|
10364
|
+
case "HYDRATE":
|
|
10185
10365
|
case "HYDRATE_COMPONENT":
|
|
10186
10366
|
case "HYDRATE_EXTERNAL": {
|
|
10187
10367
|
return {
|
|
@@ -10300,7 +10480,7 @@ var EmbedProvider = ({
|
|
|
10300
10480
|
});
|
|
10301
10481
|
const customHeaders = (0, import_react12.useMemo)(
|
|
10302
10482
|
() => ({
|
|
10303
|
-
"X-Schematic-Components-Version": "1.
|
|
10483
|
+
"X-Schematic-Components-Version": "1.4.0",
|
|
10304
10484
|
"X-Schematic-Session-ID": sessionIdRef.current
|
|
10305
10485
|
}),
|
|
10306
10486
|
[]
|
|
@@ -10336,6 +10516,28 @@ var EmbedProvider = ({
|
|
|
10336
10516
|
() => (0, import_debounce.default)(hydratePublic, FETCH_DEBOUNCE_TIMEOUT, debounceOptions),
|
|
10337
10517
|
[hydratePublic]
|
|
10338
10518
|
);
|
|
10519
|
+
const hydrate = (0, import_react12.useCallback)(async () => {
|
|
10520
|
+
dispatch({ type: "HYDRATE_STARTED" });
|
|
10521
|
+
try {
|
|
10522
|
+
const response = await api.checkout?.hydrate();
|
|
10523
|
+
if (response) {
|
|
10524
|
+
dispatch({
|
|
10525
|
+
type: "HYDRATE",
|
|
10526
|
+
data: response.data
|
|
10527
|
+
});
|
|
10528
|
+
}
|
|
10529
|
+
return response?.data;
|
|
10530
|
+
} catch (err2) {
|
|
10531
|
+
dispatch({
|
|
10532
|
+
type: "ERROR",
|
|
10533
|
+
error: isError(err2) ? err2 : ERROR_UNKNOWN
|
|
10534
|
+
});
|
|
10535
|
+
}
|
|
10536
|
+
}, [api.checkout]);
|
|
10537
|
+
const debouncedHydrate = (0, import_react12.useMemo)(
|
|
10538
|
+
() => (0, import_debounce.default)(hydrate, FETCH_DEBOUNCE_TIMEOUT, debounceOptions),
|
|
10539
|
+
[hydrate]
|
|
10540
|
+
);
|
|
10339
10541
|
const hydrateComponent = (0, import_react12.useCallback)(
|
|
10340
10542
|
async (id) => {
|
|
10341
10543
|
dispatch({ type: "HYDRATE_STARTED" });
|
|
@@ -10618,6 +10820,7 @@ var EmbedProvider = ({
|
|
|
10618
10820
|
layout: state.layout,
|
|
10619
10821
|
checkoutState: state.checkoutState,
|
|
10620
10822
|
hydratePublic: debouncedHydratePublic,
|
|
10823
|
+
hydrate: debouncedHydrate,
|
|
10621
10824
|
hydrateComponent: debouncedHydrateComponent,
|
|
10622
10825
|
hydrateExternal: debouncedHydrateExternal,
|
|
10623
10826
|
createSetupIntent: debouncedCreateSetupIntent,
|
|
@@ -12144,6 +12347,47 @@ var StageButton = ({
|
|
|
12144
12347
|
);
|
|
12145
12348
|
}
|
|
12146
12349
|
if (checkoutStage === "addons") {
|
|
12350
|
+
const hasAddonsUsageStage = checkoutStages?.some(
|
|
12351
|
+
(stage) => stage.id === "addonsUsage"
|
|
12352
|
+
);
|
|
12353
|
+
const hasCreditsStage = checkoutStages?.some(
|
|
12354
|
+
(stage) => stage.id === "credits"
|
|
12355
|
+
);
|
|
12356
|
+
if (!isPaymentMethodRequired && !hasAddonsUsageStage && !hasCreditsStage) {
|
|
12357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(NoPaymentRequired, {});
|
|
12358
|
+
}
|
|
12359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
12360
|
+
Button,
|
|
12361
|
+
{
|
|
12362
|
+
type: "button",
|
|
12363
|
+
disabled: isDisabled,
|
|
12364
|
+
onClick: async () => {
|
|
12365
|
+
setCheckoutStage?.(
|
|
12366
|
+
hasAddonsUsageStage ? "addonsUsage" : hasCreditsStage ? "credits" : "checkout"
|
|
12367
|
+
);
|
|
12368
|
+
},
|
|
12369
|
+
$isLoading: isLoading,
|
|
12370
|
+
$fullWidth: true,
|
|
12371
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
12372
|
+
Flex,
|
|
12373
|
+
{
|
|
12374
|
+
$gap: "0.5rem",
|
|
12375
|
+
$justifyContent: "center",
|
|
12376
|
+
$alignItems: "center",
|
|
12377
|
+
$padding: "0 1rem",
|
|
12378
|
+
children: [
|
|
12379
|
+
t2("Next"),
|
|
12380
|
+
":",
|
|
12381
|
+
" ",
|
|
12382
|
+
hasAddonsUsageStage ? t2("Add-ons Quantity") : hasCreditsStage ? t2("Credits") : t2("Checkout"),
|
|
12383
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon3, { name: "arrow-right" })
|
|
12384
|
+
]
|
|
12385
|
+
}
|
|
12386
|
+
)
|
|
12387
|
+
}
|
|
12388
|
+
);
|
|
12389
|
+
}
|
|
12390
|
+
if (checkoutStage === "addonsUsage") {
|
|
12147
12391
|
if (!isPaymentMethodRequired && !checkoutStages?.some((stage) => stage.id === "credits")) {
|
|
12148
12392
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(NoPaymentRequired, {});
|
|
12149
12393
|
}
|
|
@@ -13039,6 +13283,22 @@ var AddOns = ({ addOns, toggle, isLoading, period }) => {
|
|
|
13039
13283
|
const { price, currency } = getAddOnPrice(addOn, period) || {};
|
|
13040
13284
|
const isAddOnValid = isHydratedPlan(addOn) && addOn.valid;
|
|
13041
13285
|
const isAddOnCurrent = isHydratedPlan(addOn) && addOn.current;
|
|
13286
|
+
const overageEntitlement = addOn.entitlements?.find(
|
|
13287
|
+
(entitlement) => entitlement.priceBehavior === "overage" /* Overage */
|
|
13288
|
+
);
|
|
13289
|
+
let overageInfo = null;
|
|
13290
|
+
if (overageEntitlement) {
|
|
13291
|
+
const priceData = period === "year" ? overageEntitlement.meteredYearlyPrice : overageEntitlement.meteredMonthlyPrice;
|
|
13292
|
+
if (priceData?.priceTier && priceData.priceTier.length >= 2) {
|
|
13293
|
+
const overageTier = priceData.priceTier[priceData.priceTier.length - 1];
|
|
13294
|
+
overageInfo = {
|
|
13295
|
+
softLimit: overageEntitlement.softLimit,
|
|
13296
|
+
perUnitPrice: overageTier.perUnitPriceDecimal ? Number(overageTier.perUnitPriceDecimal) : overageTier.perUnitPrice || 0,
|
|
13297
|
+
currency: priceData.currency || currency,
|
|
13298
|
+
featureName: overageEntitlement.feature?.name
|
|
13299
|
+
};
|
|
13300
|
+
}
|
|
13301
|
+
}
|
|
13042
13302
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
13043
13303
|
Flex,
|
|
13044
13304
|
{
|
|
@@ -13058,19 +13318,34 @@ var AddOns = ({ addOns, toggle, isLoading, period }) => {
|
|
|
13058
13318
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Flex, { $flexDirection: "column", $gap: "0.75rem", children: [
|
|
13059
13319
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { display: "heading3", children: addOn.name }) }),
|
|
13060
13320
|
addOn.description && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { children: addOn.description }) }),
|
|
13061
|
-
(addOn[periodKey] || addOn.chargeType === ChargeType.oneTime) && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
13062
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.
|
|
13063
|
-
|
|
13064
|
-
|
|
13065
|
-
|
|
13066
|
-
|
|
13067
|
-
|
|
13068
|
-
|
|
13069
|
-
|
|
13070
|
-
|
|
13071
|
-
|
|
13072
|
-
|
|
13073
|
-
|
|
13321
|
+
(addOn[periodKey] || addOn.chargeType === ChargeType.oneTime) && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
|
|
13322
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box, { children: [
|
|
13323
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { display: "heading2", children: formatCurrency(price ?? 0, currency) }),
|
|
13324
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
13325
|
+
Text,
|
|
13326
|
+
{
|
|
13327
|
+
display: "heading2",
|
|
13328
|
+
$size: 16 / 30 * settings.theme.typography.heading2.fontSize,
|
|
13329
|
+
children: addOn.chargeType === ChargeType.oneTime ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
13330
|
+
" ",
|
|
13331
|
+
t2("one time")
|
|
13332
|
+
] }) : `/${period}`
|
|
13333
|
+
}
|
|
13334
|
+
)
|
|
13335
|
+
] }),
|
|
13336
|
+
overageInfo && overageInfo.softLimit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Text, { $size: 0.875, style: { opacity: 0.8 }, children: [
|
|
13337
|
+
overageInfo.softLimit,
|
|
13338
|
+
" ",
|
|
13339
|
+
overageInfo.featureName || "units",
|
|
13340
|
+
" included, then",
|
|
13341
|
+
" ",
|
|
13342
|
+
formatCurrency(
|
|
13343
|
+
overageInfo.perUnitPrice,
|
|
13344
|
+
overageInfo.currency
|
|
13345
|
+
),
|
|
13346
|
+
"/",
|
|
13347
|
+
overageInfo.featureName?.toLowerCase() || "unit"
|
|
13348
|
+
] }) })
|
|
13074
13349
|
] }),
|
|
13075
13350
|
isAddOnCurrent && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
13076
13351
|
Flex,
|
|
@@ -13491,7 +13766,8 @@ var Plan = ({
|
|
|
13491
13766
|
selectedPlan,
|
|
13492
13767
|
period,
|
|
13493
13768
|
selectPlan,
|
|
13494
|
-
shouldTrial
|
|
13769
|
+
shouldTrial,
|
|
13770
|
+
showPeriodToggle
|
|
13495
13771
|
}) => {
|
|
13496
13772
|
const { t: t2 } = useTranslation();
|
|
13497
13773
|
const { data, settings } = useEmbed();
|
|
@@ -13530,8 +13806,9 @@ var Plan = ({
|
|
|
13530
13806
|
$gap: "1rem",
|
|
13531
13807
|
$flexGrow: 1,
|
|
13532
13808
|
children: plans.map((plan, planIndex) => {
|
|
13533
|
-
const
|
|
13534
|
-
const
|
|
13809
|
+
const planPeriod = showPeriodToggle ? period : plan.yearlyPrice && !plan.monthlyPrice ? "year" /* Year */ : "month" /* Month */;
|
|
13810
|
+
const { price: planPrice, currency: planCurrency } = getPlanPrice(plan, planPeriod) || {};
|
|
13811
|
+
const credits = groupPlanCreditGrants(plan.includedCreditGrants);
|
|
13535
13812
|
const hasUsageBasedEntitlements = plan.entitlements.some(
|
|
13536
13813
|
(entitlement) => !!entitlement.priceBehavior
|
|
13537
13814
|
);
|
|
@@ -13590,7 +13867,7 @@ var Plan = ({
|
|
|
13590
13867
|
$size: 16 / 30 * settings.theme.typography.heading2.fontSize,
|
|
13591
13868
|
children: [
|
|
13592
13869
|
"/",
|
|
13593
|
-
|
|
13870
|
+
planPeriod
|
|
13594
13871
|
]
|
|
13595
13872
|
}
|
|
13596
13873
|
)
|
|
@@ -13686,7 +13963,7 @@ var Plan = ({
|
|
|
13686
13963
|
priceTier: entitlementPriceTiers,
|
|
13687
13964
|
currency: entitlementCurrency,
|
|
13688
13965
|
packageSize: entitlementPackageSize = 1
|
|
13689
|
-
} = getEntitlementPrice(entitlement,
|
|
13966
|
+
} = getEntitlementPrice(entitlement, planPeriod) || {};
|
|
13690
13967
|
const metricPeriodName = getMetricPeriodName(entitlement);
|
|
13691
13968
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
13692
13969
|
Flex,
|
|
@@ -13732,13 +14009,13 @@ var Plan = ({
|
|
|
13732
14009
|
" ",
|
|
13733
14010
|
t2("per"),
|
|
13734
14011
|
" ",
|
|
13735
|
-
|
|
14012
|
+
planPeriod
|
|
13736
14013
|
] })
|
|
13737
14014
|
] }) : entitlement.priceBehavior === "tier" /* Tiered */ ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
13738
14015
|
TieredPricingDetails,
|
|
13739
14016
|
{
|
|
13740
14017
|
entitlement,
|
|
13741
|
-
period
|
|
14018
|
+
period: planPeriod
|
|
13742
14019
|
}
|
|
13743
14020
|
) : entitlement.priceBehavior === "credit_burndown" /* Credit */ && entitlement.valueCredit ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
13744
14021
|
entitlement.consumptionRate,
|
|
@@ -13795,7 +14072,7 @@ var Plan = ({
|
|
|
13795
14072
|
),
|
|
13796
14073
|
entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
13797
14074
|
"/",
|
|
13798
|
-
shortenPeriod(
|
|
14075
|
+
shortenPeriod(planPeriod)
|
|
13799
14076
|
] })
|
|
13800
14077
|
]
|
|
13801
14078
|
}
|
|
@@ -13804,7 +14081,7 @@ var Plan = ({
|
|
|
13804
14081
|
PricingTiersTooltip,
|
|
13805
14082
|
{
|
|
13806
14083
|
feature: entitlement.feature,
|
|
13807
|
-
period,
|
|
14084
|
+
period: planPeriod,
|
|
13808
14085
|
currency: entitlementCurrency,
|
|
13809
14086
|
priceTiers: entitlementPriceTiers
|
|
13810
14087
|
}
|
|
@@ -14061,26 +14338,32 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14061
14338
|
addOns: availableAddOns,
|
|
14062
14339
|
periods: availablePeriods
|
|
14063
14340
|
} = useAvailablePlans(planPeriod);
|
|
14064
|
-
const {
|
|
14341
|
+
const {
|
|
14342
|
+
currentPlanId,
|
|
14343
|
+
currentEntitlements,
|
|
14344
|
+
showPeriodToggle,
|
|
14345
|
+
trialPaymentMethodRequired
|
|
14346
|
+
} = (0, import_react30.useMemo)(() => {
|
|
14065
14347
|
if (isCheckoutData(data)) {
|
|
14066
14348
|
return {
|
|
14067
14349
|
currentPlanId: data.company?.plan?.id,
|
|
14068
14350
|
currentEntitlements: data.featureUsage ? data.featureUsage.features : [],
|
|
14351
|
+
showPeriodToggle: data.showPeriodToggle,
|
|
14069
14352
|
trialPaymentMethodRequired: data.trialPaymentMethodRequired === true
|
|
14070
14353
|
};
|
|
14071
14354
|
}
|
|
14072
14355
|
return {
|
|
14073
14356
|
currentPlanId: void 0,
|
|
14074
14357
|
currentEntitlements: [],
|
|
14358
|
+
showPeriodToggle: true,
|
|
14075
14359
|
trialPaymentMethodRequired: false
|
|
14076
14360
|
};
|
|
14077
14361
|
}, [data]);
|
|
14078
14362
|
const [selectedPlan, setSelectedPlan] = (0, import_react30.useState)(
|
|
14079
14363
|
() => {
|
|
14080
|
-
|
|
14364
|
+
return availablePlans.find(
|
|
14081
14365
|
(plan) => checkoutState?.planId ? plan.id === checkoutState.planId : isHydratedPlan(plan) && plan.current
|
|
14082
14366
|
);
|
|
14083
|
-
return currentSelectedPlan;
|
|
14084
14367
|
}
|
|
14085
14368
|
);
|
|
14086
14369
|
const [shouldTrial, setShouldTrial] = (0, import_react30.useState)(false);
|
|
@@ -14113,6 +14396,23 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14113
14396
|
[]
|
|
14114
14397
|
)
|
|
14115
14398
|
);
|
|
14399
|
+
const [addOnUsageBasedEntitlements, setAddOnUsageBasedEntitlements] = (0, import_react30.useState)(() => {
|
|
14400
|
+
if (!isCheckoutData(data)) return [];
|
|
14401
|
+
const currentAddOns = data.company?.addOns || [];
|
|
14402
|
+
return currentAddOns.flatMap((currentAddOn) => {
|
|
14403
|
+
const availableAddOn = availableAddOns.find(
|
|
14404
|
+
(available) => available.id === currentAddOn.id
|
|
14405
|
+
);
|
|
14406
|
+
if (!availableAddOn) return [];
|
|
14407
|
+
return availableAddOn.entitlements.reduce(
|
|
14408
|
+
createActiveUsageBasedEntitlementsReducer(
|
|
14409
|
+
currentEntitlements,
|
|
14410
|
+
planPeriod
|
|
14411
|
+
),
|
|
14412
|
+
[]
|
|
14413
|
+
);
|
|
14414
|
+
});
|
|
14415
|
+
});
|
|
14116
14416
|
const payInAdvanceEntitlements = (0, import_react30.useMemo)(
|
|
14117
14417
|
() => usageBasedEntitlements.filter(
|
|
14118
14418
|
(entitlement) => entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */
|
|
@@ -14153,6 +14453,19 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14153
14453
|
description: t2("Optionally add features to your subscription")
|
|
14154
14454
|
});
|
|
14155
14455
|
}
|
|
14456
|
+
const hasUsageBasedAddOnSelected = addOns.some((addOn) => {
|
|
14457
|
+
return addOn.isSelected && addOn.entitlements.some((entitlement) => {
|
|
14458
|
+
return entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */;
|
|
14459
|
+
});
|
|
14460
|
+
});
|
|
14461
|
+
if (hasUsageBasedAddOnSelected) {
|
|
14462
|
+
stages.push({
|
|
14463
|
+
id: "addonsUsage",
|
|
14464
|
+
name: t2("Add-ons Quantity"),
|
|
14465
|
+
label: t2("Select quantities for add-ons"),
|
|
14466
|
+
description: t2("Quantity to pay for in advance")
|
|
14467
|
+
});
|
|
14468
|
+
}
|
|
14156
14469
|
if (creditBundles.length > 0) {
|
|
14157
14470
|
stages.push({
|
|
14158
14471
|
id: "credits",
|
|
@@ -14184,6 +14497,9 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14184
14497
|
if (checkoutState?.addOnId) {
|
|
14185
14498
|
return "addons";
|
|
14186
14499
|
}
|
|
14500
|
+
if (checkoutState?.addOnUsage) {
|
|
14501
|
+
return "addonsUsage";
|
|
14502
|
+
}
|
|
14187
14503
|
if (checkoutState?.usage) {
|
|
14188
14504
|
return "usage";
|
|
14189
14505
|
}
|
|
@@ -14191,7 +14507,19 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14191
14507
|
return "credits";
|
|
14192
14508
|
}
|
|
14193
14509
|
if (checkoutState?.planId !== currentPlanId) {
|
|
14194
|
-
|
|
14510
|
+
const hasUsageStage = checkoutStages.some(
|
|
14511
|
+
(stage) => stage.id === "usage"
|
|
14512
|
+
);
|
|
14513
|
+
const hasAddonsStage = checkoutStages.some(
|
|
14514
|
+
(stage) => stage.id === "addons"
|
|
14515
|
+
);
|
|
14516
|
+
const hasAddonsUsageStage = checkoutStages.some(
|
|
14517
|
+
(stage) => stage.id === "addonsUsage"
|
|
14518
|
+
);
|
|
14519
|
+
if (hasUsageStage) return "usage";
|
|
14520
|
+
if (hasAddonsStage) return "addons";
|
|
14521
|
+
if (hasAddonsUsageStage) return "addonsUsage";
|
|
14522
|
+
return "plan";
|
|
14195
14523
|
}
|
|
14196
14524
|
return "plan";
|
|
14197
14525
|
});
|
|
@@ -14228,19 +14556,34 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14228
14556
|
},
|
|
14229
14557
|
[]
|
|
14230
14558
|
),
|
|
14231
|
-
payInAdvance:
|
|
14232
|
-
(
|
|
14233
|
-
|
|
14234
|
-
|
|
14235
|
-
|
|
14236
|
-
|
|
14237
|
-
|
|
14238
|
-
|
|
14239
|
-
|
|
14240
|
-
|
|
14241
|
-
|
|
14242
|
-
|
|
14243
|
-
|
|
14559
|
+
payInAdvance: [
|
|
14560
|
+
...(updates.payInAdvanceEntitlements || payInAdvanceEntitlements).reduce(
|
|
14561
|
+
(acc, { meteredMonthlyPrice, meteredYearlyPrice, quantity }) => {
|
|
14562
|
+
const priceId = (period === "year" ? meteredYearlyPrice : meteredMonthlyPrice)?.priceId;
|
|
14563
|
+
if (priceId) {
|
|
14564
|
+
acc.push({
|
|
14565
|
+
priceId,
|
|
14566
|
+
quantity
|
|
14567
|
+
});
|
|
14568
|
+
}
|
|
14569
|
+
return acc;
|
|
14570
|
+
},
|
|
14571
|
+
[]
|
|
14572
|
+
),
|
|
14573
|
+
...(updates.addOnPayInAdvanceEntitlements || addOnUsageBasedEntitlements).reduce(
|
|
14574
|
+
(acc, { meteredMonthlyPrice, meteredYearlyPrice, quantity }) => {
|
|
14575
|
+
const priceId = (period === "year" ? meteredYearlyPrice : meteredMonthlyPrice)?.priceId;
|
|
14576
|
+
if (priceId) {
|
|
14577
|
+
acc.push({
|
|
14578
|
+
priceId,
|
|
14579
|
+
quantity
|
|
14580
|
+
});
|
|
14581
|
+
}
|
|
14582
|
+
return acc;
|
|
14583
|
+
},
|
|
14584
|
+
[]
|
|
14585
|
+
)
|
|
14586
|
+
],
|
|
14244
14587
|
creditBundles: (updates.creditBundles || creditBundles).reduce(
|
|
14245
14588
|
(acc, { id, count }) => {
|
|
14246
14589
|
if (count > 0) {
|
|
@@ -14297,6 +14640,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14297
14640
|
planPeriod,
|
|
14298
14641
|
selectedPlan,
|
|
14299
14642
|
payInAdvanceEntitlements,
|
|
14643
|
+
addOnUsageBasedEntitlements,
|
|
14300
14644
|
addOns,
|
|
14301
14645
|
creditBundles,
|
|
14302
14646
|
shouldTrial,
|
|
@@ -14370,6 +14714,17 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14370
14714
|
...addOn,
|
|
14371
14715
|
...addOn.id === id && { isSelected: !addOn.isSelected }
|
|
14372
14716
|
}));
|
|
14717
|
+
const updatedAddOnEntitlements = updated.filter((addOn) => addOn.isSelected).flatMap(
|
|
14718
|
+
(addOn) => addOn.entitlements.filter(
|
|
14719
|
+
(entitlement) => entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */
|
|
14720
|
+
).map((entitlement) => ({
|
|
14721
|
+
...entitlement,
|
|
14722
|
+
allocation: entitlement.valueNumeric || 0,
|
|
14723
|
+
usage: 0,
|
|
14724
|
+
quantity: 1
|
|
14725
|
+
}))
|
|
14726
|
+
);
|
|
14727
|
+
setAddOnUsageBasedEntitlements(updatedAddOnEntitlements);
|
|
14373
14728
|
handlePreviewCheckout({ addOns: updated });
|
|
14374
14729
|
return updated;
|
|
14375
14730
|
});
|
|
@@ -14410,6 +14765,23 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14410
14765
|
},
|
|
14411
14766
|
[handlePreviewCheckout]
|
|
14412
14767
|
);
|
|
14768
|
+
const updateAddOnEntitlementQuantity = (0, import_react30.useCallback)(
|
|
14769
|
+
(id, updatedQuantity) => {
|
|
14770
|
+
setAddOnUsageBasedEntitlements((prev2) => {
|
|
14771
|
+
const updated = prev2.map(
|
|
14772
|
+
(entitlement) => entitlement.id === id ? {
|
|
14773
|
+
...entitlement,
|
|
14774
|
+
quantity: updatedQuantity
|
|
14775
|
+
} : entitlement
|
|
14776
|
+
);
|
|
14777
|
+
handlePreviewCheckout({
|
|
14778
|
+
addOnPayInAdvanceEntitlements: updated
|
|
14779
|
+
});
|
|
14780
|
+
return updated;
|
|
14781
|
+
});
|
|
14782
|
+
},
|
|
14783
|
+
[handlePreviewCheckout]
|
|
14784
|
+
);
|
|
14413
14785
|
const updatePromoCode = (0, import_react30.useCallback)(
|
|
14414
14786
|
async (code) => {
|
|
14415
14787
|
handlePreviewCheckout({ promoCode: code });
|
|
@@ -14543,7 +14915,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14543
14915
|
),
|
|
14544
14916
|
activeCheckoutStage.description && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { as: "p", children: activeCheckoutStage.description })
|
|
14545
14917
|
] }),
|
|
14546
|
-
checkoutStage === "plan" && availablePeriods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
14918
|
+
checkoutStage === "plan" && showPeriodToggle && availablePeriods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
14547
14919
|
PeriodToggle,
|
|
14548
14920
|
{
|
|
14549
14921
|
options: availablePeriods,
|
|
@@ -14563,7 +14935,8 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14563
14935
|
plans: availablePlans,
|
|
14564
14936
|
selectedPlan,
|
|
14565
14937
|
selectPlan,
|
|
14566
|
-
shouldTrial
|
|
14938
|
+
shouldTrial,
|
|
14939
|
+
showPeriodToggle
|
|
14567
14940
|
}
|
|
14568
14941
|
),
|
|
14569
14942
|
checkoutStage === "usage" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
@@ -14585,6 +14958,16 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14585
14958
|
toggle: (id) => toggleAddOn(id)
|
|
14586
14959
|
}
|
|
14587
14960
|
),
|
|
14961
|
+
checkoutStage === "addonsUsage" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
14962
|
+
Usage,
|
|
14963
|
+
{
|
|
14964
|
+
isLoading,
|
|
14965
|
+
period: planPeriod,
|
|
14966
|
+
selectedPlan,
|
|
14967
|
+
entitlements: addOnUsageBasedEntitlements,
|
|
14968
|
+
updateQuantity: updateAddOnEntitlementQuantity
|
|
14969
|
+
}
|
|
14970
|
+
),
|
|
14588
14971
|
checkoutStage === "credits" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
14589
14972
|
Credits,
|
|
14590
14973
|
{
|
|
@@ -17999,7 +18382,7 @@ var Plan2 = ({
|
|
|
17999
18382
|
);
|
|
18000
18383
|
const isActivePlan = isHydratedPlan(plan) && plan.current && currentPeriod === selectedPeriod;
|
|
18001
18384
|
const { price: planPrice, currency: planCurrency } = getPlanPrice(plan, selectedPeriod) || {};
|
|
18002
|
-
const credits =
|
|
18385
|
+
const credits = groupPlanCreditGrants(plan.includedCreditGrants);
|
|
18003
18386
|
const hasUsageBasedEntitlements = plan.entitlements.some(
|
|
18004
18387
|
(entitlement) => !!entitlement.priceBehavior
|
|
18005
18388
|
);
|
|
@@ -18293,8 +18676,8 @@ var PricingTable = (0, import_react51.forwardRef)(
|
|
|
18293
18676
|
({ className, callToActionUrl, callToActionTarget, onCallToAction, ...rest }, ref) => {
|
|
18294
18677
|
const props = resolveDesignProps8(rest);
|
|
18295
18678
|
const { t: t2 } = useTranslation();
|
|
18296
|
-
const { data, settings, hydratePublic } = useEmbed();
|
|
18297
|
-
const { currentPeriod, isStandalone } = (0, import_react51.useMemo)(() => {
|
|
18679
|
+
const { data, settings, isPending, hydratePublic } = useEmbed();
|
|
18680
|
+
const { currentPeriod, showPeriodToggle, isStandalone } = (0, import_react51.useMemo)(() => {
|
|
18298
18681
|
if (isCheckoutData(data)) {
|
|
18299
18682
|
const billingSubscription = data.company?.billingSubscription;
|
|
18300
18683
|
const isTrialSubscription = billingSubscription?.status === "trialing";
|
|
@@ -18303,6 +18686,7 @@ var PricingTable = (0, import_react51.forwardRef)(
|
|
|
18303
18686
|
currentPeriod: data.company?.plan?.planPeriod || "month",
|
|
18304
18687
|
currentAddOns: data.company?.addOns || [],
|
|
18305
18688
|
canCheckout: data.capabilities?.checkout ?? true,
|
|
18689
|
+
showPeriodToggle: data.showPeriodToggle ?? props.showPeriodToggle,
|
|
18306
18690
|
isTrialSubscription,
|
|
18307
18691
|
willSubscriptionCancel,
|
|
18308
18692
|
isStandalone: false
|
|
@@ -18312,13 +18696,16 @@ var PricingTable = (0, import_react51.forwardRef)(
|
|
|
18312
18696
|
currentPeriod: "month",
|
|
18313
18697
|
currentAddOns: [],
|
|
18314
18698
|
canCheckout: true,
|
|
18699
|
+
showPeriodToggle: props.showPeriodToggle,
|
|
18315
18700
|
isTrialSubscription: false,
|
|
18316
18701
|
willSubscriptionCancel: false,
|
|
18317
18702
|
isStandalone: true
|
|
18318
18703
|
};
|
|
18319
|
-
}, [data]);
|
|
18704
|
+
}, [props.showPeriodToggle, data]);
|
|
18320
18705
|
const [selectedPeriod, setSelectedPeriod] = (0, import_react51.useState)(currentPeriod);
|
|
18321
|
-
const { plans, addOns, periods } = useAvailablePlans(selectedPeriod
|
|
18706
|
+
const { plans, addOns, periods } = useAvailablePlans(selectedPeriod, {
|
|
18707
|
+
useSelectedPeriod: showPeriodToggle
|
|
18708
|
+
});
|
|
18322
18709
|
const [entitlementCounts, setEntitlementCounts] = (0, import_react51.useState)(
|
|
18323
18710
|
() => plans.reduce(entitlementCountsReducer, {})
|
|
18324
18711
|
);
|
|
@@ -18345,6 +18732,19 @@ var PricingTable = (0, import_react51.forwardRef)(
|
|
|
18345
18732
|
(0, import_react51.useEffect)(() => {
|
|
18346
18733
|
setEntitlementCounts(plans.reduce(entitlementCountsReducer, {}));
|
|
18347
18734
|
}, [plans]);
|
|
18735
|
+
if (isStandalone && isPending) {
|
|
18736
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
18737
|
+
Flex,
|
|
18738
|
+
{
|
|
18739
|
+
$width: "100%",
|
|
18740
|
+
$height: "100%",
|
|
18741
|
+
$alignItems: "center",
|
|
18742
|
+
$justifyContent: "center",
|
|
18743
|
+
$padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
18744
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Loader, { $size: "2xl" })
|
|
18745
|
+
}
|
|
18746
|
+
);
|
|
18747
|
+
}
|
|
18348
18748
|
const Wrapper = isStandalone ? Container : import_react51.Fragment;
|
|
18349
18749
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
18350
18750
|
FussyChild,
|
|
@@ -18379,7 +18779,7 @@ var PricingTable = (0, import_react51.forwardRef)(
|
|
|
18379
18779
|
children: props.header.isVisible && props.plans.isVisible && plans.length > 0 && t2("Plans")
|
|
18380
18780
|
}
|
|
18381
18781
|
),
|
|
18382
|
-
|
|
18782
|
+
showPeriodToggle && periods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
18383
18783
|
PeriodToggle,
|
|
18384
18784
|
{
|
|
18385
18785
|
options: periods,
|
|
@@ -18400,24 +18800,27 @@ var PricingTable = (0, import_react51.forwardRef)(
|
|
|
18400
18800
|
$display: "grid",
|
|
18401
18801
|
$gridTemplateColumns: "repeat(auto-fill, minmax(320px, 1fr))",
|
|
18402
18802
|
$gap: "1rem",
|
|
18403
|
-
children: plans.map((plan, index, self2) =>
|
|
18404
|
-
|
|
18405
|
-
|
|
18406
|
-
|
|
18407
|
-
|
|
18408
|
-
|
|
18409
|
-
|
|
18410
|
-
|
|
18411
|
-
|
|
18412
|
-
|
|
18803
|
+
children: plans.map((plan, index, self2) => {
|
|
18804
|
+
const planPeriod = showPeriodToggle ? selectedPeriod : plan.yearlyPrice && !plan.monthlyPrice ? "year" /* Year */ : "month" /* Month */;
|
|
18805
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
18806
|
+
Plan2,
|
|
18807
|
+
{
|
|
18808
|
+
plan,
|
|
18809
|
+
index,
|
|
18810
|
+
sharedProps: {
|
|
18811
|
+
layout: props,
|
|
18812
|
+
callToActionUrl,
|
|
18813
|
+
callToActionTarget,
|
|
18814
|
+
onCallToAction
|
|
18815
|
+
},
|
|
18816
|
+
plans: self2,
|
|
18817
|
+
selectedPeriod: planPeriod,
|
|
18818
|
+
entitlementCounts,
|
|
18819
|
+
handleToggleShowAll
|
|
18413
18820
|
},
|
|
18414
|
-
|
|
18415
|
-
|
|
18416
|
-
|
|
18417
|
-
handleToggleShowAll
|
|
18418
|
-
},
|
|
18419
|
-
index
|
|
18420
|
-
))
|
|
18821
|
+
index
|
|
18822
|
+
);
|
|
18823
|
+
})
|
|
18421
18824
|
}
|
|
18422
18825
|
)
|
|
18423
18826
|
] }),
|
|
@@ -18444,20 +18847,23 @@ var PricingTable = (0, import_react51.forwardRef)(
|
|
|
18444
18847
|
$display: "grid",
|
|
18445
18848
|
$gridTemplateColumns: "repeat(auto-fill, minmax(320px, 1fr))",
|
|
18446
18849
|
$gap: "1rem",
|
|
18447
|
-
children: addOns.map((addOn, index) =>
|
|
18448
|
-
|
|
18449
|
-
|
|
18450
|
-
|
|
18451
|
-
|
|
18452
|
-
|
|
18453
|
-
|
|
18454
|
-
|
|
18455
|
-
|
|
18850
|
+
children: addOns.map((addOn, index) => {
|
|
18851
|
+
const addOnPeriod = showPeriodToggle ? selectedPeriod : addOn.yearlyPrice && !addOn.monthlyPrice ? "year" /* Year */ : "month" /* Month */;
|
|
18852
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
18853
|
+
AddOn2,
|
|
18854
|
+
{
|
|
18855
|
+
addOn,
|
|
18856
|
+
sharedProps: {
|
|
18857
|
+
layout: props,
|
|
18858
|
+
callToActionUrl,
|
|
18859
|
+
callToActionTarget,
|
|
18860
|
+
onCallToAction
|
|
18861
|
+
},
|
|
18862
|
+
selectedPeriod: addOnPeriod
|
|
18456
18863
|
},
|
|
18457
|
-
|
|
18458
|
-
|
|
18459
|
-
|
|
18460
|
-
))
|
|
18864
|
+
index
|
|
18865
|
+
);
|
|
18866
|
+
})
|
|
18461
18867
|
}
|
|
18462
18868
|
)
|
|
18463
18869
|
] }) })
|