@schematichq/schematic-components 1.1.2 → 1.1.4
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 +401 -302
- package/dist/schematic-components.d.ts +179 -0
- package/dist/schematic-components.esm.js +408 -303
- package/package.json +4 -4
|
@@ -5317,7 +5317,7 @@ var Interpolator = class {
|
|
|
5317
5317
|
};
|
|
5318
5318
|
this.regexp = getOrResetRegExp(this.regexp, `${this.prefix}(.+?)${this.suffix}`);
|
|
5319
5319
|
this.regexpUnescape = getOrResetRegExp(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`);
|
|
5320
|
-
this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}(
|
|
5320
|
+
this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
|
|
5321
5321
|
}
|
|
5322
5322
|
interpolate(str, data, lng, options2) {
|
|
5323
5323
|
let match2;
|
|
@@ -7319,17 +7319,24 @@ function BillingCreditBundleViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
7319
7319
|
return json;
|
|
7320
7320
|
}
|
|
7321
7321
|
return {
|
|
7322
|
+
billingInvoiceId: json["billing_invoice_id"] == null ? void 0 : json["billing_invoice_id"],
|
|
7322
7323
|
bundleType: json["bundle_type"],
|
|
7323
7324
|
createdAt: new Date(json["created_at"]),
|
|
7325
|
+
creditDescription: json["credit_description"] == null ? void 0 : json["credit_description"],
|
|
7326
|
+
creditIcon: json["credit_icon"] == null ? void 0 : json["credit_icon"],
|
|
7324
7327
|
creditId: json["credit_id"],
|
|
7328
|
+
creditName: json["credit_name"],
|
|
7325
7329
|
expiryType: json["expiry_type"],
|
|
7326
7330
|
expiryUnit: json["expiry_unit"],
|
|
7327
7331
|
expiryUnitCount: json["expiry_unit_count"] == null ? void 0 : json["expiry_unit_count"],
|
|
7328
7332
|
id: json["id"],
|
|
7329
7333
|
name: json["name"],
|
|
7334
|
+
pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
|
|
7330
7335
|
price: json["price"] == null ? void 0 : BillingProductPriceResponseDataFromJSON(json["price"]),
|
|
7331
7336
|
quantity: json["quantity"] == null ? void 0 : json["quantity"],
|
|
7337
|
+
singularName: json["singular_name"] == null ? void 0 : json["singular_name"],
|
|
7332
7338
|
status: json["status"],
|
|
7339
|
+
unitPrice: json["unit_price"] == null ? void 0 : BillingProductPriceResponseDataFromJSON(json["unit_price"]),
|
|
7333
7340
|
updatedAt: new Date(json["updated_at"])
|
|
7334
7341
|
};
|
|
7335
7342
|
}
|
|
@@ -8190,6 +8197,32 @@ function FeatureDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8190
8197
|
};
|
|
8191
8198
|
}
|
|
8192
8199
|
|
|
8200
|
+
// src/api/checkoutexternal/models/PlanCreditGrantView.ts
|
|
8201
|
+
function PlanCreditGrantViewFromJSON(json) {
|
|
8202
|
+
return PlanCreditGrantViewFromJSONTyped(json, false);
|
|
8203
|
+
}
|
|
8204
|
+
function PlanCreditGrantViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
8205
|
+
if (json == null) {
|
|
8206
|
+
return json;
|
|
8207
|
+
}
|
|
8208
|
+
return {
|
|
8209
|
+
createdAt: new Date(json["created_at"]),
|
|
8210
|
+
creditAmount: json["credit_amount"],
|
|
8211
|
+
creditDescription: json["credit_description"],
|
|
8212
|
+
creditIcon: json["credit_icon"] == null ? void 0 : json["credit_icon"],
|
|
8213
|
+
creditId: json["credit_id"],
|
|
8214
|
+
creditName: json["credit_name"],
|
|
8215
|
+
id: json["id"],
|
|
8216
|
+
planId: json["plan_id"],
|
|
8217
|
+
planName: json["plan_name"],
|
|
8218
|
+
pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
|
|
8219
|
+
resetCadence: json["reset_cadence"],
|
|
8220
|
+
resetStart: json["reset_start"],
|
|
8221
|
+
singularName: json["singular_name"] == null ? void 0 : json["singular_name"],
|
|
8222
|
+
updatedAt: new Date(json["updated_at"])
|
|
8223
|
+
};
|
|
8224
|
+
}
|
|
8225
|
+
|
|
8193
8226
|
// src/api/checkoutexternal/models/PlanResponseData.ts
|
|
8194
8227
|
function PlanResponseDataFromJSON(json) {
|
|
8195
8228
|
return PlanResponseDataFromJSONTyped(json, false);
|
|
@@ -8290,6 +8323,9 @@ function CompanyPlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8290
8323
|
),
|
|
8291
8324
|
icon: json["icon"],
|
|
8292
8325
|
id: json["id"],
|
|
8326
|
+
includedCreditGrants: json["included_credit_grants"].map(
|
|
8327
|
+
PlanCreditGrantViewFromJSON
|
|
8328
|
+
),
|
|
8293
8329
|
isCustom: json["is_custom"],
|
|
8294
8330
|
isDefault: json["is_default"],
|
|
8295
8331
|
isFree: json["is_free"],
|
|
@@ -8427,16 +8463,20 @@ function CreditCompanyGrantViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8427
8463
|
companyId: json["company_id"],
|
|
8428
8464
|
companyName: json["company_name"],
|
|
8429
8465
|
createdAt: new Date(json["created_at"]),
|
|
8466
|
+
creditDescription: json["credit_description"],
|
|
8467
|
+
creditIcon: json["credit_icon"] == null ? void 0 : json["credit_icon"],
|
|
8430
8468
|
creditName: json["credit_name"],
|
|
8431
8469
|
expiresAt: json["expires_at"] == null ? void 0 : new Date(json["expires_at"]),
|
|
8432
8470
|
grantReason: json["grant_reason"],
|
|
8433
8471
|
id: json["id"],
|
|
8434
8472
|
planId: json["plan_id"] == null ? void 0 : json["plan_id"],
|
|
8435
8473
|
planName: json["plan_name"] == null ? void 0 : json["plan_name"],
|
|
8474
|
+
pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
|
|
8436
8475
|
price: json["price"] == null ? void 0 : BillingProductPriceResponseDataFromJSON(json["price"]),
|
|
8437
8476
|
quantity: json["quantity"],
|
|
8438
8477
|
quantityRemaining: json["quantity_remaining"],
|
|
8439
8478
|
quantityUsed: json["quantity_used"],
|
|
8479
|
+
singularName: json["singular_name"] == null ? void 0 : json["singular_name"],
|
|
8440
8480
|
sourceLabel: json["source_label"],
|
|
8441
8481
|
updatedAt: new Date(json["updated_at"]),
|
|
8442
8482
|
validFrom: json["valid_from"] == null ? void 0 : new Date(json["valid_from"]),
|
|
@@ -10188,7 +10228,7 @@ var EmbedProvider = ({
|
|
|
10188
10228
|
});
|
|
10189
10229
|
const customHeaders = (0, import_react12.useMemo)(
|
|
10190
10230
|
() => ({
|
|
10191
|
-
"X-Schematic-Components-Version": "1.1.
|
|
10231
|
+
"X-Schematic-Components-Version": "1.1.4",
|
|
10192
10232
|
"X-Schematic-Session-ID": sessionIdRef.current
|
|
10193
10233
|
}),
|
|
10194
10234
|
[]
|
|
@@ -10592,8 +10632,8 @@ function useTrialEnd() {
|
|
|
10592
10632
|
const end = typeof billingSubscription?.trialEnd === "number" ? new Date(billingSubscription.trialEnd * 1e3) : void 0;
|
|
10593
10633
|
let formatted2;
|
|
10594
10634
|
if (end) {
|
|
10595
|
-
const
|
|
10596
|
-
const difference = end.getTime() -
|
|
10635
|
+
const now = /* @__PURE__ */ new Date();
|
|
10636
|
+
const difference = end.getTime() - now.getTime();
|
|
10597
10637
|
let amount;
|
|
10598
10638
|
let unit;
|
|
10599
10639
|
if (difference >= DAYS_IN_MS) {
|
|
@@ -12335,8 +12375,8 @@ var Sidebar = ({
|
|
|
12335
12375
|
const inEditMode = settings.mode === "edit";
|
|
12336
12376
|
const hasPaymentMethod = typeof paymentMethod !== "undefined" || typeof paymentMethodId === "string";
|
|
12337
12377
|
const isSelectedPlanTrialable = isHydratedPlan(selectedPlan) && selectedPlan?.companyCanTrial === true && selectedPlan?.isTrialable === true;
|
|
12338
|
-
const
|
|
12339
|
-
const trialEndsOn = new Date(
|
|
12378
|
+
const now = /* @__PURE__ */ new Date();
|
|
12379
|
+
const trialEndsOn = new Date(now);
|
|
12340
12380
|
if (isSelectedPlanTrialable && selectedPlan.trialDays) {
|
|
12341
12381
|
trialEndsOn.setDate(trialEndsOn.getDate() + selectedPlan.trialDays);
|
|
12342
12382
|
}
|
|
@@ -13138,7 +13178,7 @@ var PlanButtonGroup = ({
|
|
|
13138
13178
|
children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : !isValidPlan ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
13139
13179
|
Tooltip,
|
|
13140
13180
|
{
|
|
13141
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: t2("Over usage limit") }),
|
|
13181
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
|
|
13142
13182
|
content: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: t2("Current usage exceeds the limit of this plan.") })
|
|
13143
13183
|
}
|
|
13144
13184
|
) : t2("Start X day trial", { days: plan.trialDays })
|
|
@@ -13159,7 +13199,7 @@ var PlanButtonGroup = ({
|
|
|
13159
13199
|
children: !isValidPlan ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
13160
13200
|
Tooltip,
|
|
13161
13201
|
{
|
|
13162
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: t2("Over usage limit") }),
|
|
13202
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
|
|
13163
13203
|
content: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: t2("Current usage exceeds the limit of this plan.") })
|
|
13164
13204
|
}
|
|
13165
13205
|
) : t2("Choose plan")
|
|
@@ -13189,7 +13229,7 @@ var PlanButtonGroup = ({
|
|
|
13189
13229
|
children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : !isValidPlan ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
13190
13230
|
Tooltip,
|
|
13191
13231
|
{
|
|
13192
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: t2("Over usage limit") }),
|
|
13232
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
|
|
13193
13233
|
content: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: t2("Current usage exceeds the limit of this plan.") })
|
|
13194
13234
|
}
|
|
13195
13235
|
) : t2("Choose plan")
|
|
@@ -14615,7 +14655,7 @@ var TieredPricingDetails = ({
|
|
|
14615
14655
|
Y: formatCurrency(perUnitPrice, currency),
|
|
14616
14656
|
unit: getFeatureName(entitlement.feature, 1),
|
|
14617
14657
|
Z: formatCurrency(flatAmount, currency),
|
|
14618
|
-
period
|
|
14658
|
+
period
|
|
14619
14659
|
});
|
|
14620
14660
|
}
|
|
14621
14661
|
};
|
|
@@ -15016,7 +15056,8 @@ var UsageDetails = ({
|
|
|
15016
15056
|
feature,
|
|
15017
15057
|
priceBehavior,
|
|
15018
15058
|
usage,
|
|
15019
|
-
softLimit
|
|
15059
|
+
softLimit,
|
|
15060
|
+
metricResetAt
|
|
15020
15061
|
} = entitlement;
|
|
15021
15062
|
const { t: t2 } = useTranslation();
|
|
15022
15063
|
const { data } = useEmbed();
|
|
@@ -15121,23 +15162,38 @@ var UsageDetails = ({
|
|
|
15121
15162
|
);
|
|
15122
15163
|
index += 1;
|
|
15123
15164
|
}
|
|
15124
|
-
if (
|
|
15125
|
-
|
|
15126
|
-
|
|
15127
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.
|
|
15128
|
-
|
|
15129
|
-
|
|
15130
|
-
|
|
15131
|
-
|
|
15165
|
+
if (typeof cost === "number" && cost > 0) {
|
|
15166
|
+
acc.push(
|
|
15167
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react40.Fragment, { children: [
|
|
15168
|
+
acc.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children: " \u2022 " }),
|
|
15169
|
+
formatCurrency(cost, currency)
|
|
15170
|
+
] }, index)
|
|
15171
|
+
);
|
|
15172
|
+
index += 1;
|
|
15173
|
+
if (feature.featureType === "trait" /* Trait */ && typeof period === "string") {
|
|
15174
|
+
acc.push(/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react40.Fragment, { children: [
|
|
15175
|
+
"/",
|
|
15176
|
+
shortenPeriod(period)
|
|
15177
|
+
] }, index));
|
|
15132
15178
|
index += 1;
|
|
15133
|
-
if (feature.featureType === "trait" /* Trait */ && typeof period === "string") {
|
|
15134
|
-
acc.push(/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react40.Fragment, { children: [
|
|
15135
|
-
"/",
|
|
15136
|
-
shortenPeriod(period)
|
|
15137
|
-
] }, index));
|
|
15138
|
-
index += 1;
|
|
15139
|
-
}
|
|
15140
15179
|
}
|
|
15180
|
+
}
|
|
15181
|
+
if (metricResetAt) {
|
|
15182
|
+
acc.push(
|
|
15183
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react40.Fragment, { children: [
|
|
15184
|
+
acc.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children: " \u2022 " }),
|
|
15185
|
+
t2("Resets", {
|
|
15186
|
+
date: toPrettyDate(metricResetAt, {
|
|
15187
|
+
month: "numeric",
|
|
15188
|
+
day: "numeric",
|
|
15189
|
+
year: void 0
|
|
15190
|
+
})
|
|
15191
|
+
})
|
|
15192
|
+
] }, index)
|
|
15193
|
+
);
|
|
15194
|
+
index += 1;
|
|
15195
|
+
}
|
|
15196
|
+
if (acc.length > 0) {
|
|
15141
15197
|
return acc;
|
|
15142
15198
|
}
|
|
15143
15199
|
if (typeof usage === "number") {
|
|
@@ -15155,6 +15211,7 @@ var UsageDetails = ({
|
|
|
15155
15211
|
priceBehavior,
|
|
15156
15212
|
allocation,
|
|
15157
15213
|
usage,
|
|
15214
|
+
metricResetAt,
|
|
15158
15215
|
billingPrice,
|
|
15159
15216
|
cost
|
|
15160
15217
|
]);
|
|
@@ -15386,8 +15443,10 @@ function resolveDesignProps3(props) {
|
|
|
15386
15443
|
}
|
|
15387
15444
|
};
|
|
15388
15445
|
}
|
|
15389
|
-
function formatInvoices(invoices) {
|
|
15390
|
-
|
|
15446
|
+
function formatInvoices(invoices, options2) {
|
|
15447
|
+
const { hideUpcoming = true } = options2 || {};
|
|
15448
|
+
const now = /* @__PURE__ */ new Date();
|
|
15449
|
+
return (invoices || []).filter(({ dueDate }) => !hideUpcoming || dueDate && +dueDate <= +now).sort((a2, b2) => a2.dueDate && b2.dueDate ? +b2.dueDate - +a2.dueDate : 1).map(({ amountDue, dueDate, url, currency }) => ({
|
|
15391
15450
|
amount: formatCurrency(amountDue, currency),
|
|
15392
15451
|
date: dueDate ? toPrettyDate(dueDate) : void 0,
|
|
15393
15452
|
url: url || void 0
|
|
@@ -15648,7 +15707,7 @@ var Container2 = dt.div`
|
|
|
15648
15707
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
15649
15708
|
var Limit = ({ entitlement, usageDetails, fontStyle }) => {
|
|
15650
15709
|
const { t: t2 } = useTranslation();
|
|
15651
|
-
const { feature, priceBehavior, usage, metricResetAt } = entitlement;
|
|
15710
|
+
const { feature, priceBehavior, allocation, usage, metricResetAt } = entitlement;
|
|
15652
15711
|
const { billingPrice, limit, cost, currentTier } = usageDetails;
|
|
15653
15712
|
const acc = [];
|
|
15654
15713
|
acc.push(
|
|
@@ -15659,15 +15718,15 @@ var Limit = ({ entitlement, usageDetails, fontStyle }) => {
|
|
|
15659
15718
|
feature: getFeatureName(feature)
|
|
15660
15719
|
}) : priceBehavior === "overage" /* Overage */ && typeof limit === "number" ? t2("X included", {
|
|
15661
15720
|
amount: formatNumber(limit)
|
|
15662
|
-
}) : priceBehavior === "pay_in_advance" /* PayInAdvance */ && typeof usage === "number" ? `${formatNumber(usage)} ${t2("used")}` : priceBehavior === "pay_as_you_go" /* PayAsYouGo */ && typeof cost === "number" ? formatCurrency(cost, billingPrice?.currency) : typeof
|
|
15663
|
-
amount: formatNumber(
|
|
15721
|
+
}) : priceBehavior === "pay_in_advance" /* PayInAdvance */ && typeof usage === "number" ? `${formatNumber(usage)} ${t2("used")}` : priceBehavior === "pay_as_you_go" /* PayAsYouGo */ && typeof cost === "number" ? formatCurrency(cost, billingPrice?.currency) : typeof allocation === "number" ? t2("Limit of", {
|
|
15722
|
+
amount: formatNumber(allocation)
|
|
15664
15723
|
}) : t2("No limit")
|
|
15665
15724
|
);
|
|
15666
15725
|
if (metricResetAt) {
|
|
15667
15726
|
acc.push(
|
|
15668
15727
|
t2("Resets", {
|
|
15669
15728
|
date: toPrettyDate(metricResetAt, {
|
|
15670
|
-
month: "
|
|
15729
|
+
month: "numeric",
|
|
15671
15730
|
day: "numeric",
|
|
15672
15731
|
year: void 0
|
|
15673
15732
|
})
|
|
@@ -16060,9 +16119,9 @@ var PaymentMethod = (0, import_react45.forwardRef)(({ children, className, porta
|
|
|
16060
16119
|
const paymentMethod2 = data.subscription?.paymentMethod || data.company?.defaultPaymentMethod;
|
|
16061
16120
|
let monthsToExpiration2;
|
|
16062
16121
|
if (typeof paymentMethod2?.cardExpYear === "number" && typeof paymentMethod2?.cardExpMonth === "number") {
|
|
16063
|
-
const
|
|
16064
|
-
const currentYear =
|
|
16065
|
-
const currentMonth =
|
|
16122
|
+
const now = /* @__PURE__ */ new Date();
|
|
16123
|
+
const currentYear = now.getFullYear();
|
|
16124
|
+
const currentMonth = now.getMonth();
|
|
16066
16125
|
const timeToExpiration = Math.round(
|
|
16067
16126
|
+new Date(paymentMethod2.cardExpYear, paymentMethod2.cardExpMonth - 1) - +new Date(currentYear, currentMonth)
|
|
16068
16127
|
);
|
|
@@ -16136,7 +16195,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
|
|
|
16136
16195
|
}
|
|
16137
16196
|
stripe._registerWrapper({
|
|
16138
16197
|
name: "stripe-js",
|
|
16139
|
-
version: "7.
|
|
16198
|
+
version: "7.8.0",
|
|
16140
16199
|
startTime
|
|
16141
16200
|
});
|
|
16142
16201
|
};
|
|
@@ -16211,7 +16270,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
|
|
|
16211
16270
|
var version = runtimeVersionToUrlVersion(maybeStripe.version);
|
|
16212
16271
|
var expectedVersion = RELEASE_TRAIN;
|
|
16213
16272
|
if (isTestKey && version !== expectedVersion) {
|
|
16214
|
-
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("7.
|
|
16273
|
+
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("7.8.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
|
|
16215
16274
|
}
|
|
16216
16275
|
var stripe = maybeStripe.apply(void 0, args);
|
|
16217
16276
|
registerWrapper(stripe, startTime);
|
|
@@ -16299,9 +16358,9 @@ var PaymentMethodDetails = ({
|
|
|
16299
16358
|
const monthsToExpiration = (0, import_react46.useMemo)(() => {
|
|
16300
16359
|
let expiration;
|
|
16301
16360
|
if (typeof currentPaymentMethod?.cardExpYear === "number" && typeof currentPaymentMethod?.cardExpMonth === "number") {
|
|
16302
|
-
const
|
|
16303
|
-
const currentYear =
|
|
16304
|
-
const currentMonth =
|
|
16361
|
+
const now = /* @__PURE__ */ new Date();
|
|
16362
|
+
const currentYear = now.getFullYear();
|
|
16363
|
+
const currentMonth = now.getMonth();
|
|
16305
16364
|
const timeToExpiration = Math.round(
|
|
16306
16365
|
+new Date(
|
|
16307
16366
|
currentPaymentMethod.cardExpYear,
|
|
@@ -16369,9 +16428,10 @@ var PaymentMethodDetails = ({
|
|
|
16369
16428
|
);
|
|
16370
16429
|
(0, import_react46.useEffect)(() => {
|
|
16371
16430
|
if (!stripe && setupIntent) {
|
|
16372
|
-
|
|
16431
|
+
let publishableKey = setupIntent.publishableKey || setupIntent.schematicPublishableKey;
|
|
16373
16432
|
const stripeOptions = {};
|
|
16374
16433
|
if (setupIntent.accountId) {
|
|
16434
|
+
publishableKey = setupIntent.schematicPublishableKey;
|
|
16375
16435
|
stripeOptions.stripeAccount = setupIntent.accountId;
|
|
16376
16436
|
}
|
|
16377
16437
|
setStripe(loadStripe(publishableKey, stripeOptions));
|
|
@@ -17008,24 +17068,34 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
|
|
|
17008
17068
|
rounded: true
|
|
17009
17069
|
}
|
|
17010
17070
|
),
|
|
17011
|
-
|
|
17012
|
-
entitlement.valueType === "unlimited" /* Unlimited */ ?
|
|
17013
|
-
|
|
17014
|
-
|
|
17015
|
-
|
|
17016
|
-
|
|
17017
|
-
|
|
17018
|
-
|
|
17019
|
-
|
|
17020
|
-
|
|
17021
|
-
|
|
17022
|
-
|
|
17023
|
-
|
|
17024
|
-
|
|
17025
|
-
|
|
17026
|
-
|
|
17027
|
-
|
|
17028
|
-
|
|
17071
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
17072
|
+
entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Flex, { $alignItems: "center", $flexGrow: 1, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { children: entitlement.valueType === "numeric" /* Numeric */ || entitlement.valueType === "unlimited" /* Unlimited */ || entitlement.valueType === "trait" /* Trait */ ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
17073
|
+
entitlement.valueType === "unlimited" /* Unlimited */ ? t2("Unlimited", {
|
|
17074
|
+
item: getFeatureName(entitlement.feature)
|
|
17075
|
+
}) : typeof entitlement.valueNumeric === "number" && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
17076
|
+
formatNumber(entitlement.valueNumeric),
|
|
17077
|
+
" ",
|
|
17078
|
+
getFeatureName(
|
|
17079
|
+
entitlement.feature,
|
|
17080
|
+
entitlement.valueNumeric
|
|
17081
|
+
)
|
|
17082
|
+
] }),
|
|
17083
|
+
metricPeriodName && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
17084
|
+
" ",
|
|
17085
|
+
t2("per"),
|
|
17086
|
+
" ",
|
|
17087
|
+
t2(metricPeriodName)
|
|
17088
|
+
] })
|
|
17089
|
+
] }) : entitlement.feature.name }) }),
|
|
17090
|
+
layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
17091
|
+
Text,
|
|
17092
|
+
{
|
|
17093
|
+
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
17094
|
+
$color: `color-mix(in oklch, ${settings.theme.typography.text.color}, ${settings.theme.card.background})`,
|
|
17095
|
+
children: entitlement.feature.description
|
|
17096
|
+
}
|
|
17097
|
+
)
|
|
17098
|
+
] })
|
|
17029
17099
|
] })
|
|
17030
17100
|
},
|
|
17031
17101
|
entitlementIndex
|
|
@@ -17105,85 +17175,95 @@ var Entitlement = ({
|
|
|
17105
17175
|
rounded: true
|
|
17106
17176
|
}
|
|
17107
17177
|
),
|
|
17108
|
-
entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Flex, { $flexDirection: "column", $
|
|
17109
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.
|
|
17110
|
-
|
|
17111
|
-
|
|
17112
|
-
t2("per"),
|
|
17113
|
-
" ",
|
|
17114
|
-
entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
17115
|
-
entitlementPackageSize,
|
|
17116
|
-
" "
|
|
17117
|
-
] }),
|
|
17118
|
-
getFeatureName(entitlement.feature, entitlementPackageSize),
|
|
17119
|
-
entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
17178
|
+
entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
17179
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Flex, { $flexDirection: "column", $justifyContent: "center", $flexGrow: 1, children: [
|
|
17180
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text, { children: typeof entitlementPrice === "number" && (entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ || entitlement.priceBehavior === "pay_as_you_go" /* PayAsYouGo */) ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
17181
|
+
formatCurrency(entitlementPrice, entitlementCurrency),
|
|
17120
17182
|
" ",
|
|
17121
17183
|
t2("per"),
|
|
17122
17184
|
" ",
|
|
17123
|
-
|
|
17124
|
-
|
|
17125
|
-
|
|
17126
|
-
|
|
17127
|
-
|
|
17128
|
-
entitlement,
|
|
17129
|
-
period: selectedPeriod
|
|
17130
|
-
}
|
|
17131
|
-
) : entitlement.valueType === "numeric" /* Numeric */ || entitlement.valueType === "unlimited" /* Unlimited */ || entitlement.valueType === "trait" /* Trait */ ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
17132
|
-
entitlement.valueType === "unlimited" /* Unlimited */ && !entitlement.priceBehavior ? t2("Unlimited", {
|
|
17133
|
-
item: getFeatureName(entitlement.feature)
|
|
17134
|
-
}) : typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
17135
|
-
formatNumber(limit),
|
|
17136
|
-
" ",
|
|
17137
|
-
getFeatureName(entitlement.feature, limit)
|
|
17138
|
-
] }),
|
|
17139
|
-
metricPeriodName && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
17140
|
-
" ",
|
|
17141
|
-
t2("per"),
|
|
17142
|
-
" ",
|
|
17143
|
-
t2(metricPeriodName)
|
|
17144
|
-
] })
|
|
17145
|
-
] }) : entitlement.feature.name }),
|
|
17146
|
-
entitlement.priceBehavior === "overage" /* Overage */ && typeof entitlementPrice === "number" ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
17147
|
-
Text,
|
|
17148
|
-
{
|
|
17149
|
-
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
17150
|
-
$color: `color-mix(in oklch, ${settings.theme.typography.text.color}, ${settings.theme.card.background})`,
|
|
17151
|
-
children: [
|
|
17152
|
-
t2("then"),
|
|
17185
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
17186
|
+
entitlementPackageSize,
|
|
17187
|
+
" "
|
|
17188
|
+
] }),
|
|
17189
|
+
getFeatureName(entitlement.feature, entitlementPackageSize),
|
|
17190
|
+
entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
17153
17191
|
" ",
|
|
17154
|
-
|
|
17155
|
-
"
|
|
17156
|
-
|
|
17157
|
-
|
|
17158
|
-
|
|
17159
|
-
|
|
17160
|
-
getFeatureName(entitlement.feature, entitlementPackageSize),
|
|
17161
|
-
entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
17162
|
-
"/",
|
|
17163
|
-
shortenPeriod(selectedPeriod)
|
|
17164
|
-
] })
|
|
17165
|
-
]
|
|
17166
|
-
}
|
|
17167
|
-
) : entitlement.priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Flex, { $alignItems: "center", children: [
|
|
17168
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
17169
|
-
PricingTiersTooltip,
|
|
17192
|
+
t2("per"),
|
|
17193
|
+
" ",
|
|
17194
|
+
selectedPeriod
|
|
17195
|
+
] })
|
|
17196
|
+
] }) : entitlement.priceBehavior === "tier" /* Tiered */ ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
17197
|
+
TieredPricingDetails,
|
|
17170
17198
|
{
|
|
17171
|
-
|
|
17172
|
-
period: selectedPeriod
|
|
17173
|
-
currency: entitlementCurrency,
|
|
17174
|
-
priceTiers: entitlementPriceTiers
|
|
17199
|
+
entitlement,
|
|
17200
|
+
period: selectedPeriod
|
|
17175
17201
|
}
|
|
17176
|
-
),
|
|
17177
|
-
|
|
17202
|
+
) : entitlement.valueType === "numeric" /* Numeric */ || entitlement.valueType === "unlimited" /* Unlimited */ || entitlement.valueType === "trait" /* Trait */ ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
17203
|
+
entitlement.valueType === "unlimited" /* Unlimited */ && !entitlement.priceBehavior ? t2("Unlimited", {
|
|
17204
|
+
item: getFeatureName(entitlement.feature)
|
|
17205
|
+
}) : typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
17206
|
+
formatNumber(limit),
|
|
17207
|
+
" ",
|
|
17208
|
+
getFeatureName(entitlement.feature, limit)
|
|
17209
|
+
] }),
|
|
17210
|
+
metricPeriodName && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
17211
|
+
" ",
|
|
17212
|
+
t2("per"),
|
|
17213
|
+
" ",
|
|
17214
|
+
t2(metricPeriodName)
|
|
17215
|
+
] })
|
|
17216
|
+
] }) : entitlement.feature.name }),
|
|
17217
|
+
entitlement.priceBehavior === "overage" /* Overage */ && typeof entitlementPrice === "number" ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
17178
17218
|
Text,
|
|
17179
17219
|
{
|
|
17180
|
-
style: { opacity: 0.54 },
|
|
17181
17220
|
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
17182
|
-
$color: settings.theme.typography.text.color,
|
|
17183
|
-
children:
|
|
17221
|
+
$color: `color-mix(in oklch, ${settings.theme.typography.text.color}, ${settings.theme.card.background})`,
|
|
17222
|
+
children: [
|
|
17223
|
+
t2("then"),
|
|
17224
|
+
" ",
|
|
17225
|
+
formatCurrency(entitlementPrice, entitlementCurrency),
|
|
17226
|
+
"/",
|
|
17227
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
17228
|
+
entitlementPackageSize,
|
|
17229
|
+
" "
|
|
17230
|
+
] }),
|
|
17231
|
+
getFeatureName(entitlement.feature, entitlementPackageSize),
|
|
17232
|
+
entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
17233
|
+
"/",
|
|
17234
|
+
shortenPeriod(selectedPeriod)
|
|
17235
|
+
] })
|
|
17236
|
+
]
|
|
17184
17237
|
}
|
|
17185
|
-
)
|
|
17186
|
-
|
|
17238
|
+
) : entitlement.priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Flex, { $alignItems: "center", children: [
|
|
17239
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
17240
|
+
PricingTiersTooltip,
|
|
17241
|
+
{
|
|
17242
|
+
feature: entitlement.feature,
|
|
17243
|
+
period: selectedPeriod,
|
|
17244
|
+
currency: entitlementCurrency,
|
|
17245
|
+
priceTiers: entitlementPriceTiers
|
|
17246
|
+
}
|
|
17247
|
+
),
|
|
17248
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
17249
|
+
Text,
|
|
17250
|
+
{
|
|
17251
|
+
style: { opacity: 0.54 },
|
|
17252
|
+
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
17253
|
+
$color: settings.theme.typography.text.color,
|
|
17254
|
+
children: t2("Tier-based")
|
|
17255
|
+
}
|
|
17256
|
+
)
|
|
17257
|
+
] })
|
|
17258
|
+
] }),
|
|
17259
|
+
layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
17260
|
+
Text,
|
|
17261
|
+
{
|
|
17262
|
+
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
17263
|
+
$color: `color-mix(in oklch, ${settings.theme.typography.text.color}, ${settings.theme.card.background})`,
|
|
17264
|
+
children: entitlement.feature.description
|
|
17265
|
+
}
|
|
17266
|
+
)
|
|
17187
17267
|
] })
|
|
17188
17268
|
] });
|
|
17189
17269
|
};
|
|
@@ -17199,7 +17279,7 @@ var Plan2 = ({
|
|
|
17199
17279
|
entitlementCounts,
|
|
17200
17280
|
handleToggleShowAll
|
|
17201
17281
|
}) => {
|
|
17202
|
-
const { layout
|
|
17282
|
+
const { layout } = sharedProps;
|
|
17203
17283
|
const { t: t2 } = useTranslation();
|
|
17204
17284
|
const { data, settings, setCheckoutState } = useEmbed();
|
|
17205
17285
|
const isLightBackground = useIsLightBackground();
|
|
@@ -17231,9 +17311,24 @@ var Plan2 = ({
|
|
|
17231
17311
|
isTrialSubscription: false,
|
|
17232
17312
|
willSubscriptionCancel: false,
|
|
17233
17313
|
isStandalone: true,
|
|
17234
|
-
showCallToAction: typeof callToActionUrl === "string"
|
|
17314
|
+
showCallToAction: typeof sharedProps.callToActionUrl === "string" || typeof sharedProps.onCallToAction === "function"
|
|
17235
17315
|
};
|
|
17236
|
-
}, [data, callToActionUrl]);
|
|
17316
|
+
}, [data, sharedProps.callToActionUrl, sharedProps.onCallToAction]);
|
|
17317
|
+
const callToActionTarget = (0, import_react50.useMemo)(() => {
|
|
17318
|
+
if (sharedProps.callToActionTarget) {
|
|
17319
|
+
return sharedProps.callToActionTarget;
|
|
17320
|
+
}
|
|
17321
|
+
if (sharedProps.callToActionUrl) {
|
|
17322
|
+
try {
|
|
17323
|
+
const ctaUrlOrigin = new URL(sharedProps.callToActionUrl).origin;
|
|
17324
|
+
if (ctaUrlOrigin === window.location.hostname) {
|
|
17325
|
+
return "_self";
|
|
17326
|
+
}
|
|
17327
|
+
} catch {
|
|
17328
|
+
}
|
|
17329
|
+
}
|
|
17330
|
+
return "_blank";
|
|
17331
|
+
}, [sharedProps.callToActionUrl, sharedProps.callToActionTarget]);
|
|
17237
17332
|
const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
|
|
17238
17333
|
const currentPlanIndex = plans.findIndex(
|
|
17239
17334
|
(plan2) => isHydratedPlan(plan2) && plan2.current
|
|
@@ -17332,7 +17427,7 @@ var Plan2 = ({
|
|
|
17332
17427
|
Entitlement,
|
|
17333
17428
|
{
|
|
17334
17429
|
entitlement,
|
|
17335
|
-
sharedProps: { layout
|
|
17430
|
+
sharedProps: { layout },
|
|
17336
17431
|
selectedPeriod
|
|
17337
17432
|
},
|
|
17338
17433
|
idx
|
|
@@ -17410,14 +17505,14 @@ var Plan2 = ({
|
|
|
17410
17505
|
href: plan.customPlanConfig?.ctaWebSite ?? "#",
|
|
17411
17506
|
target: "_blank",
|
|
17412
17507
|
rel: "noreferrer"
|
|
17413
|
-
} : callToActionUrl ? {
|
|
17508
|
+
} : sharedProps.callToActionUrl ? {
|
|
17414
17509
|
as: "a",
|
|
17415
|
-
href: callToActionUrl,
|
|
17416
|
-
target:
|
|
17510
|
+
href: sharedProps.callToActionUrl,
|
|
17511
|
+
target: callToActionTarget,
|
|
17417
17512
|
rel: "noreferrer"
|
|
17418
17513
|
} : {
|
|
17419
17514
|
onClick: () => {
|
|
17420
|
-
onCallToAction?.(plan);
|
|
17515
|
+
sharedProps.onCallToAction?.(plan);
|
|
17421
17516
|
if (!isStandalone && isHydratedPlan(plan) && !plan.custom) {
|
|
17422
17517
|
setCheckoutState({
|
|
17423
17518
|
period: selectedPeriod,
|
|
@@ -17431,7 +17526,7 @@ var Plan2 = ({
|
|
|
17431
17526
|
children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : isHydratedPlan(plan) && !plan.valid ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
17432
17527
|
Tooltip,
|
|
17433
17528
|
{
|
|
17434
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text, { children: t2("Over usage limit") }),
|
|
17529
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
|
|
17435
17530
|
content: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text, { children: t2("Current usage exceeds the limit of this plan.") })
|
|
17436
17531
|
}
|
|
17437
17532
|
) : isHydratedPlan(plan) && plan.companyCanTrial && plan.isTrialable ? t2("Start X day trial", { days: plan.trialDays }) : t2("Choose plan")
|
|
@@ -17466,12 +17561,14 @@ var resolveDesignProps8 = (props) => {
|
|
|
17466
17561
|
},
|
|
17467
17562
|
showInclusionText: props.plans?.showInclusionText ?? true,
|
|
17468
17563
|
showFeatureIcons: props.plans?.showFeatureIcons ?? true,
|
|
17564
|
+
showFeatureDescriptions: props.plans?.showFeatureDescriptions ?? true,
|
|
17469
17565
|
showEntitlements: props.plans?.showEntitlements ?? true
|
|
17470
17566
|
},
|
|
17471
17567
|
addOns: {
|
|
17472
17568
|
isVisible: props.addOns?.isVisible ?? true,
|
|
17473
17569
|
showDescription: props.addOns?.showDescription ?? true,
|
|
17474
17570
|
showFeatureIcons: props.addOns?.showFeatureIcons ?? true,
|
|
17571
|
+
showFeatureDescriptions: props.plans?.showFeatureDescriptions ?? true,
|
|
17475
17572
|
showEntitlements: props.addOns?.showEntitlements ?? true
|
|
17476
17573
|
},
|
|
17477
17574
|
upgrade: {
|
|
@@ -17486,181 +17583,183 @@ var resolveDesignProps8 = (props) => {
|
|
|
17486
17583
|
}
|
|
17487
17584
|
};
|
|
17488
17585
|
};
|
|
17489
|
-
var PricingTable = (0, import_react51.forwardRef)(
|
|
17490
|
-
|
|
17491
|
-
|
|
17492
|
-
|
|
17493
|
-
|
|
17494
|
-
|
|
17495
|
-
|
|
17496
|
-
|
|
17497
|
-
|
|
17498
|
-
|
|
17499
|
-
currentPeriod: data.company?.plan?.planPeriod || "month",
|
|
17500
|
-
currentAddOns: data.company?.addOns || [],
|
|
17501
|
-
canCheckout: data.capabilities?.checkout ?? true,
|
|
17502
|
-
isTrialSubscription,
|
|
17503
|
-
willSubscriptionCancel,
|
|
17504
|
-
isStandalone: false,
|
|
17505
|
-
showCallToAction: true
|
|
17506
|
-
};
|
|
17507
|
-
}
|
|
17508
|
-
return {
|
|
17509
|
-
currentPeriod: "month",
|
|
17510
|
-
currentAddOns: [],
|
|
17511
|
-
canCheckout: true,
|
|
17512
|
-
isTrialSubscription: false,
|
|
17513
|
-
willSubscriptionCancel: false,
|
|
17514
|
-
isStandalone: true,
|
|
17515
|
-
showCallToAction: typeof callToActionUrl === "string"
|
|
17516
|
-
};
|
|
17517
|
-
}, [data, callToActionUrl]);
|
|
17518
|
-
const [selectedPeriod, setSelectedPeriod] = (0, import_react51.useState)(currentPeriod);
|
|
17519
|
-
const { plans, addOns, periods } = useAvailablePlans(selectedPeriod);
|
|
17520
|
-
const [entitlementCounts, setEntitlementCounts] = (0, import_react51.useState)(
|
|
17521
|
-
() => plans.reduce(entitlementCountsReducer, {})
|
|
17522
|
-
);
|
|
17523
|
-
const handleToggleShowAll = (id) => {
|
|
17524
|
-
setEntitlementCounts((prev2) => {
|
|
17525
|
-
const count = prev2[id] ? { ...prev2[id] } : void 0;
|
|
17526
|
-
if (count) {
|
|
17586
|
+
var PricingTable = (0, import_react51.forwardRef)(
|
|
17587
|
+
({ className, callToActionUrl, callToActionTarget, onCallToAction, ...rest }, ref) => {
|
|
17588
|
+
const props = resolveDesignProps8(rest);
|
|
17589
|
+
const { t: t2 } = useTranslation();
|
|
17590
|
+
const { data, settings, hydratePublic } = useEmbed();
|
|
17591
|
+
const { currentPeriod, isStandalone } = (0, import_react51.useMemo)(() => {
|
|
17592
|
+
if (isCheckoutData(data)) {
|
|
17593
|
+
const billingSubscription = data.company?.billingSubscription;
|
|
17594
|
+
const isTrialSubscription = billingSubscription?.status === "trialing";
|
|
17595
|
+
const willSubscriptionCancel = billingSubscription?.cancelAt;
|
|
17527
17596
|
return {
|
|
17528
|
-
|
|
17529
|
-
[
|
|
17530
|
-
|
|
17531
|
-
|
|
17532
|
-
|
|
17597
|
+
currentPeriod: data.company?.plan?.planPeriod || "month",
|
|
17598
|
+
currentAddOns: data.company?.addOns || [],
|
|
17599
|
+
canCheckout: data.capabilities?.checkout ?? true,
|
|
17600
|
+
isTrialSubscription,
|
|
17601
|
+
willSubscriptionCancel,
|
|
17602
|
+
isStandalone: false
|
|
17533
17603
|
};
|
|
17534
17604
|
}
|
|
17535
|
-
return
|
|
17536
|
-
|
|
17537
|
-
|
|
17538
|
-
|
|
17539
|
-
|
|
17540
|
-
|
|
17541
|
-
|
|
17542
|
-
|
|
17543
|
-
|
|
17544
|
-
|
|
17545
|
-
|
|
17546
|
-
|
|
17547
|
-
|
|
17548
|
-
|
|
17549
|
-
{
|
|
17550
|
-
|
|
17551
|
-
|
|
17552
|
-
|
|
17553
|
-
|
|
17554
|
-
|
|
17555
|
-
|
|
17556
|
-
|
|
17557
|
-
|
|
17558
|
-
|
|
17559
|
-
|
|
17560
|
-
|
|
17561
|
-
|
|
17562
|
-
|
|
17563
|
-
|
|
17564
|
-
|
|
17565
|
-
|
|
17566
|
-
|
|
17567
|
-
|
|
17568
|
-
|
|
17569
|
-
|
|
17570
|
-
|
|
17571
|
-
|
|
17572
|
-
|
|
17605
|
+
return {
|
|
17606
|
+
currentPeriod: "month",
|
|
17607
|
+
currentAddOns: [],
|
|
17608
|
+
canCheckout: true,
|
|
17609
|
+
isTrialSubscription: false,
|
|
17610
|
+
willSubscriptionCancel: false,
|
|
17611
|
+
isStandalone: true
|
|
17612
|
+
};
|
|
17613
|
+
}, [data]);
|
|
17614
|
+
const [selectedPeriod, setSelectedPeriod] = (0, import_react51.useState)(currentPeriod);
|
|
17615
|
+
const { plans, addOns, periods } = useAvailablePlans(selectedPeriod);
|
|
17616
|
+
const [entitlementCounts, setEntitlementCounts] = (0, import_react51.useState)(
|
|
17617
|
+
() => plans.reduce(entitlementCountsReducer, {})
|
|
17618
|
+
);
|
|
17619
|
+
const handleToggleShowAll = (id) => {
|
|
17620
|
+
setEntitlementCounts((prev2) => {
|
|
17621
|
+
const count = prev2[id] ? { ...prev2[id] } : void 0;
|
|
17622
|
+
if (count) {
|
|
17623
|
+
return {
|
|
17624
|
+
...prev2,
|
|
17625
|
+
[id]: {
|
|
17626
|
+
size: count.size,
|
|
17627
|
+
limit: count.limit > VISIBLE_ENTITLEMENT_COUNT ? VISIBLE_ENTITLEMENT_COUNT : count.size
|
|
17628
|
+
}
|
|
17629
|
+
};
|
|
17630
|
+
}
|
|
17631
|
+
return prev2;
|
|
17632
|
+
});
|
|
17633
|
+
};
|
|
17634
|
+
(0, import_react51.useEffect)(() => {
|
|
17635
|
+
if (isStandalone) {
|
|
17636
|
+
hydratePublic();
|
|
17637
|
+
}
|
|
17638
|
+
}, [isStandalone, hydratePublic]);
|
|
17639
|
+
(0, import_react51.useEffect)(() => {
|
|
17640
|
+
setEntitlementCounts(plans.reduce(entitlementCountsReducer, {}));
|
|
17641
|
+
}, [plans]);
|
|
17642
|
+
const Wrapper = isStandalone ? Container : import_react51.Fragment;
|
|
17643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
17644
|
+
FussyChild,
|
|
17645
|
+
{
|
|
17646
|
+
ref,
|
|
17647
|
+
className: `sch-PricingTable ${className}`,
|
|
17648
|
+
as: Flex,
|
|
17649
|
+
$flexDirection: "column",
|
|
17650
|
+
$gap: "2rem",
|
|
17651
|
+
children: [
|
|
17652
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(Box, { children: [
|
|
17653
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
17654
|
+
Flex,
|
|
17655
|
+
{
|
|
17656
|
+
$flexDirection: "column",
|
|
17657
|
+
$justifyContent: "center",
|
|
17658
|
+
$alignItems: "center",
|
|
17659
|
+
$gap: "1rem",
|
|
17660
|
+
$marginBottom: "1rem",
|
|
17661
|
+
$viewport: {
|
|
17662
|
+
md: {
|
|
17663
|
+
$flexDirection: "row",
|
|
17664
|
+
$justifyContent: "space-between"
|
|
17665
|
+
}
|
|
17666
|
+
},
|
|
17667
|
+
children: [
|
|
17668
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
17669
|
+
Text,
|
|
17670
|
+
{
|
|
17671
|
+
display: props.header.fontStyle,
|
|
17672
|
+
$color: settings.theme.card.background,
|
|
17673
|
+
children: props.header.isVisible && props.plans.isVisible && plans.length > 0 && t2("Plans")
|
|
17674
|
+
}
|
|
17675
|
+
),
|
|
17676
|
+
props.showPeriodToggle && periods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
17677
|
+
PeriodToggle,
|
|
17678
|
+
{
|
|
17679
|
+
options: periods,
|
|
17680
|
+
selectedOption: selectedPeriod,
|
|
17681
|
+
onSelect: (period) => {
|
|
17682
|
+
if (period !== selectedPeriod) {
|
|
17683
|
+
setSelectedPeriod(period);
|
|
17684
|
+
}
|
|
17685
|
+
}
|
|
17686
|
+
}
|
|
17687
|
+
)
|
|
17688
|
+
]
|
|
17689
|
+
}
|
|
17690
|
+
),
|
|
17691
|
+
props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
17692
|
+
Box,
|
|
17693
|
+
{
|
|
17694
|
+
$display: "grid",
|
|
17695
|
+
$gridTemplateColumns: "repeat(auto-fill, minmax(320px, 1fr))",
|
|
17696
|
+
$gap: "1rem",
|
|
17697
|
+
children: plans.map((plan, index, self2) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
17698
|
+
Plan2,
|
|
17699
|
+
{
|
|
17700
|
+
plan,
|
|
17701
|
+
index,
|
|
17702
|
+
sharedProps: {
|
|
17703
|
+
layout: props,
|
|
17704
|
+
callToActionUrl,
|
|
17705
|
+
callToActionTarget,
|
|
17706
|
+
onCallToAction
|
|
17707
|
+
},
|
|
17708
|
+
plans: self2,
|
|
17709
|
+
selectedPeriod,
|
|
17710
|
+
entitlementCounts,
|
|
17711
|
+
handleToggleShowAll
|
|
17712
|
+
},
|
|
17713
|
+
index
|
|
17714
|
+
))
|
|
17715
|
+
}
|
|
17716
|
+
)
|
|
17717
|
+
] }),
|
|
17718
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
17719
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
17720
|
+
Flex,
|
|
17721
|
+
{
|
|
17722
|
+
$justifyContent: "space-between",
|
|
17723
|
+
$alignItems: "center",
|
|
17724
|
+
$marginBottom: "1rem",
|
|
17725
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
17573
17726
|
Text,
|
|
17574
17727
|
{
|
|
17575
17728
|
display: props.header.fontStyle,
|
|
17576
17729
|
$color: settings.theme.card.background,
|
|
17577
|
-
children:
|
|
17578
|
-
}
|
|
17579
|
-
),
|
|
17580
|
-
props.showPeriodToggle && periods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
17581
|
-
PeriodToggle,
|
|
17582
|
-
{
|
|
17583
|
-
options: periods,
|
|
17584
|
-
selectedOption: selectedPeriod,
|
|
17585
|
-
onSelect: (period) => {
|
|
17586
|
-
if (period !== selectedPeriod) {
|
|
17587
|
-
setSelectedPeriod(period);
|
|
17588
|
-
}
|
|
17589
|
-
}
|
|
17730
|
+
children: t2("Add-ons")
|
|
17590
17731
|
}
|
|
17591
17732
|
)
|
|
17592
|
-
|
|
17593
|
-
|
|
17594
|
-
|
|
17595
|
-
|
|
17596
|
-
|
|
17597
|
-
|
|
17598
|
-
|
|
17599
|
-
|
|
17600
|
-
|
|
17601
|
-
|
|
17602
|
-
|
|
17603
|
-
|
|
17604
|
-
|
|
17605
|
-
|
|
17606
|
-
|
|
17607
|
-
|
|
17608
|
-
|
|
17609
|
-
|
|
17610
|
-
|
|
17611
|
-
plans: self2,
|
|
17612
|
-
selectedPeriod,
|
|
17613
|
-
entitlementCounts,
|
|
17614
|
-
handleToggleShowAll
|
|
17615
|
-
},
|
|
17616
|
-
index
|
|
17617
|
-
))
|
|
17618
|
-
}
|
|
17619
|
-
)
|
|
17620
|
-
] }),
|
|
17621
|
-
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
17622
|
-
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
17623
|
-
Flex,
|
|
17624
|
-
{
|
|
17625
|
-
$justifyContent: "space-between",
|
|
17626
|
-
$alignItems: "center",
|
|
17627
|
-
$marginBottom: "1rem",
|
|
17628
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
17629
|
-
Text,
|
|
17630
|
-
{
|
|
17631
|
-
display: props.header.fontStyle,
|
|
17632
|
-
$color: settings.theme.card.background,
|
|
17633
|
-
children: t2("Add-ons")
|
|
17634
|
-
}
|
|
17635
|
-
)
|
|
17636
|
-
}
|
|
17637
|
-
),
|
|
17638
|
-
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
17639
|
-
Box,
|
|
17640
|
-
{
|
|
17641
|
-
$display: "grid",
|
|
17642
|
-
$gridTemplateColumns: "repeat(auto-fill, minmax(320px, 1fr))",
|
|
17643
|
-
$gap: "1rem",
|
|
17644
|
-
children: addOns.map((addOn, index) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
17645
|
-
AddOn2,
|
|
17646
|
-
{
|
|
17647
|
-
addOn,
|
|
17648
|
-
sharedProps: {
|
|
17649
|
-
layout: props,
|
|
17650
|
-
callToActionUrl,
|
|
17651
|
-
onCallToAction
|
|
17733
|
+
}
|
|
17734
|
+
),
|
|
17735
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
17736
|
+
Box,
|
|
17737
|
+
{
|
|
17738
|
+
$display: "grid",
|
|
17739
|
+
$gridTemplateColumns: "repeat(auto-fill, minmax(320px, 1fr))",
|
|
17740
|
+
$gap: "1rem",
|
|
17741
|
+
children: addOns.map((addOn, index) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
17742
|
+
AddOn2,
|
|
17743
|
+
{
|
|
17744
|
+
addOn,
|
|
17745
|
+
sharedProps: {
|
|
17746
|
+
layout: props,
|
|
17747
|
+
callToActionUrl,
|
|
17748
|
+
callToActionTarget,
|
|
17749
|
+
onCallToAction
|
|
17750
|
+
},
|
|
17751
|
+
selectedPeriod
|
|
17652
17752
|
},
|
|
17653
|
-
|
|
17654
|
-
|
|
17655
|
-
|
|
17656
|
-
|
|
17657
|
-
|
|
17658
|
-
|
|
17659
|
-
|
|
17660
|
-
|
|
17661
|
-
|
|
17662
|
-
|
|
17663
|
-
});
|
|
17753
|
+
index
|
|
17754
|
+
))
|
|
17755
|
+
}
|
|
17756
|
+
)
|
|
17757
|
+
] }) })
|
|
17758
|
+
]
|
|
17759
|
+
}
|
|
17760
|
+
) });
|
|
17761
|
+
}
|
|
17762
|
+
);
|
|
17664
17763
|
PricingTable.displayName = "PricingTable";
|
|
17665
17764
|
|
|
17666
17765
|
// src/components/elements/text/Text.tsx
|