@schematichq/schematic-components 1.6.2 → 1.7.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 +572 -289
- package/dist/schematic-components.d.ts +394 -165
- package/dist/schematic-components.esm.js +473 -190
- package/package.json +7 -7
|
@@ -1975,6 +1975,18 @@ function getEntitlementCost(entitlement, period = "month") {
|
|
|
1975
1975
|
}
|
|
1976
1976
|
}
|
|
1977
1977
|
}
|
|
1978
|
+
function isBillingAddressRequiredForTax(financeData) {
|
|
1979
|
+
if (!financeData) {
|
|
1980
|
+
return false;
|
|
1981
|
+
}
|
|
1982
|
+
return financeData.taxRequireBillingDetails;
|
|
1983
|
+
}
|
|
1984
|
+
function shouldCollectBillingAddress(collectAddressSetting, financeData) {
|
|
1985
|
+
if (collectAddressSetting) {
|
|
1986
|
+
return true;
|
|
1987
|
+
}
|
|
1988
|
+
return isBillingAddressRequiredForTax(financeData);
|
|
1989
|
+
}
|
|
1978
1990
|
|
|
1979
1991
|
// src/utils/api/credit.ts
|
|
1980
1992
|
function getResetCadencePeriod(cadence) {
|
|
@@ -4221,7 +4233,8 @@ var initialContext = {
|
|
|
4221
4233
|
setCheckoutState: stub,
|
|
4222
4234
|
setData: stub,
|
|
4223
4235
|
updateSettings: stub,
|
|
4224
|
-
debug: stub
|
|
4236
|
+
debug: stub,
|
|
4237
|
+
finishCheckout: stub
|
|
4225
4238
|
};
|
|
4226
4239
|
var EmbedContext = createContext(initialContext);
|
|
4227
4240
|
|
|
@@ -6700,7 +6713,7 @@ var en_default = {
|
|
|
6700
6713
|
"Add-ons Quantity": "Add-ons Quantity",
|
|
6701
6714
|
Additional: "Additional",
|
|
6702
6715
|
"After the trial, cancel no default": "After the trial, you will be lose access to {{planName}} plan and your subscription will be cancelled.",
|
|
6703
|
-
"After the trial, cancel": "After the trial, you will be downgraded to the {{
|
|
6716
|
+
"After the trial, cancel": "After the trial, you will be downgraded to the {{postTrialPlanName}} plan and your subscription will be cancelled.",
|
|
6704
6717
|
"After the trial, subscribe": "After the trial, subscription starts and you will be billed.",
|
|
6705
6718
|
"Amount off": "{{amount}} off",
|
|
6706
6719
|
"An invoice is created when charges reach $X; the rest is billed monthly.": "An invoice is created when charges reach {{amount}}; the rest is billed monthly.",
|
|
@@ -6800,6 +6813,7 @@ var en_default = {
|
|
|
6800
6813
|
"Subscription canceled": "Subscription canceled",
|
|
6801
6814
|
Subscription: "Subscription",
|
|
6802
6815
|
"Talk to support": "Talk to support",
|
|
6816
|
+
"Tax (description):": "Tax ({{description}}):",
|
|
6803
6817
|
"There was a problem retrieving your upcoming invoice.": "There was a problem retrieving your upcoming invoice.",
|
|
6804
6818
|
"There was a problem retrieving your invoices.": "There was a problem retrieving your invoices.",
|
|
6805
6819
|
"Tiers apply progressively as quantity increases.": "Tiers apply progressively as quantity increases.",
|
|
@@ -7493,11 +7507,15 @@ function BillingPlanCreditGrantResponseDataFromJSONTyped(json, ignoreDiscriminat
|
|
|
7493
7507
|
creditName: json["credit_name"],
|
|
7494
7508
|
creditPluralName: json["credit_plural_name"] == null ? void 0 : json["credit_plural_name"],
|
|
7495
7509
|
creditSingularName: json["credit_singular_name"] == null ? void 0 : json["credit_singular_name"],
|
|
7510
|
+
expiryType: json["expiry_type"] == null ? void 0 : json["expiry_type"],
|
|
7511
|
+
expiryUnit: json["expiry_unit"] == null ? void 0 : json["expiry_unit"],
|
|
7512
|
+
expiryUnitCount: json["expiry_unit_count"] == null ? void 0 : json["expiry_unit_count"],
|
|
7496
7513
|
id: json["id"],
|
|
7497
7514
|
planId: json["plan_id"],
|
|
7498
7515
|
planName: json["plan_name"],
|
|
7499
7516
|
resetCadence: json["reset_cadence"],
|
|
7500
7517
|
resetStart: json["reset_start"],
|
|
7518
|
+
resetType: json["reset_type"] == null ? void 0 : json["reset_type"],
|
|
7501
7519
|
updatedAt: new Date(json["updated_at"])
|
|
7502
7520
|
};
|
|
7503
7521
|
}
|
|
@@ -7642,36 +7660,6 @@ function BillingSubscriptionDiscountViewFromJSONTyped(json, ignoreDiscriminator)
|
|
|
7642
7660
|
};
|
|
7643
7661
|
}
|
|
7644
7662
|
|
|
7645
|
-
// src/api/checkoutexternal/models/BillingSubscriptionResponseData.ts
|
|
7646
|
-
function BillingSubscriptionResponseDataFromJSON(json) {
|
|
7647
|
-
return BillingSubscriptionResponseDataFromJSONTyped(json, false);
|
|
7648
|
-
}
|
|
7649
|
-
function BillingSubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
7650
|
-
if (json == null) {
|
|
7651
|
-
return json;
|
|
7652
|
-
}
|
|
7653
|
-
return {
|
|
7654
|
-
cancelAt: json["cancel_at"] == null ? void 0 : json["cancel_at"],
|
|
7655
|
-
cancelAtPeriodEnd: json["cancel_at_period_end"],
|
|
7656
|
-
companyId: json["company_id"] == null ? void 0 : json["company_id"],
|
|
7657
|
-
createdAt: new Date(json["created_at"]),
|
|
7658
|
-
currency: json["currency"],
|
|
7659
|
-
customerExternalId: json["customer_external_id"],
|
|
7660
|
-
defaultPaymentMethodId: json["default_payment_method_id"] == null ? void 0 : json["default_payment_method_id"],
|
|
7661
|
-
expiredAt: json["expired_at"] == null ? void 0 : new Date(json["expired_at"]),
|
|
7662
|
-
id: json["id"],
|
|
7663
|
-
interval: json["interval"],
|
|
7664
|
-
metadata: json["metadata"] == null ? void 0 : json["metadata"],
|
|
7665
|
-
periodEnd: json["period_end"],
|
|
7666
|
-
periodStart: json["period_start"],
|
|
7667
|
-
status: json["status"],
|
|
7668
|
-
subscriptionExternalId: json["subscription_external_id"],
|
|
7669
|
-
totalPrice: json["total_price"],
|
|
7670
|
-
trialEnd: json["trial_end"] == null ? void 0 : json["trial_end"],
|
|
7671
|
-
trialEndSetting: json["trial_end_setting"] == null ? void 0 : json["trial_end_setting"]
|
|
7672
|
-
};
|
|
7673
|
-
}
|
|
7674
|
-
|
|
7675
7663
|
// src/api/checkoutexternal/models/InvoiceResponseData.ts
|
|
7676
7664
|
function InvoiceResponseDataFromJSON(json) {
|
|
7677
7665
|
return InvoiceResponseDataFromJSONTyped(json, false);
|
|
@@ -7825,6 +7813,38 @@ function ChangeSubscriptionRequestBodyToJSON(value) {
|
|
|
7825
7813
|
};
|
|
7826
7814
|
}
|
|
7827
7815
|
|
|
7816
|
+
// src/api/checkoutexternal/models/CheckoutResponseData.ts
|
|
7817
|
+
function CheckoutResponseDataFromJSON(json) {
|
|
7818
|
+
return CheckoutResponseDataFromJSONTyped(json, false);
|
|
7819
|
+
}
|
|
7820
|
+
function CheckoutResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
7821
|
+
if (json == null) {
|
|
7822
|
+
return json;
|
|
7823
|
+
}
|
|
7824
|
+
return {
|
|
7825
|
+
cancelAt: json["cancel_at"] == null ? void 0 : json["cancel_at"],
|
|
7826
|
+
cancelAtPeriodEnd: json["cancel_at_period_end"],
|
|
7827
|
+
companyId: json["company_id"] == null ? void 0 : json["company_id"],
|
|
7828
|
+
confirmPaymentIntentClientSecret: json["confirm_payment_intent_client_secret"] == null ? void 0 : json["confirm_payment_intent_client_secret"],
|
|
7829
|
+
confirmPaymentIntentId: json["confirm_payment_intent_id"] == null ? void 0 : json["confirm_payment_intent_id"],
|
|
7830
|
+
createdAt: new Date(json["created_at"]),
|
|
7831
|
+
currency: json["currency"],
|
|
7832
|
+
customerExternalId: json["customer_external_id"],
|
|
7833
|
+
defaultPaymentMethodId: json["default_payment_method_id"] == null ? void 0 : json["default_payment_method_id"],
|
|
7834
|
+
expiredAt: json["expired_at"] == null ? void 0 : new Date(json["expired_at"]),
|
|
7835
|
+
id: json["id"],
|
|
7836
|
+
interval: json["interval"],
|
|
7837
|
+
metadata: json["metadata"] == null ? void 0 : json["metadata"],
|
|
7838
|
+
periodEnd: json["period_end"],
|
|
7839
|
+
periodStart: json["period_start"],
|
|
7840
|
+
status: json["status"],
|
|
7841
|
+
subscriptionExternalId: json["subscription_external_id"],
|
|
7842
|
+
totalPrice: json["total_price"],
|
|
7843
|
+
trialEnd: json["trial_end"] == null ? void 0 : json["trial_end"],
|
|
7844
|
+
trialEndSetting: json["trial_end_setting"] == null ? void 0 : json["trial_end_setting"]
|
|
7845
|
+
};
|
|
7846
|
+
}
|
|
7847
|
+
|
|
7828
7848
|
// src/api/checkoutexternal/models/CheckoutResponse.ts
|
|
7829
7849
|
function CheckoutResponseFromJSON(json) {
|
|
7830
7850
|
return CheckoutResponseFromJSONTyped(json, false);
|
|
@@ -7834,7 +7854,7 @@ function CheckoutResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
7834
7854
|
return json;
|
|
7835
7855
|
}
|
|
7836
7856
|
return {
|
|
7837
|
-
data:
|
|
7857
|
+
data: CheckoutResponseDataFromJSON(json["data"]),
|
|
7838
7858
|
params: json["params"]
|
|
7839
7859
|
};
|
|
7840
7860
|
}
|
|
@@ -8072,6 +8092,24 @@ function CompanyDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8072
8092
|
};
|
|
8073
8093
|
}
|
|
8074
8094
|
|
|
8095
|
+
// src/api/checkoutexternal/models/CompanyOverrideNoteResponseData.ts
|
|
8096
|
+
function CompanyOverrideNoteResponseDataFromJSON(json) {
|
|
8097
|
+
return CompanyOverrideNoteResponseDataFromJSONTyped(json, false);
|
|
8098
|
+
}
|
|
8099
|
+
function CompanyOverrideNoteResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
8100
|
+
if (json == null) {
|
|
8101
|
+
return json;
|
|
8102
|
+
}
|
|
8103
|
+
return {
|
|
8104
|
+
createdAt: new Date(json["created_at"]),
|
|
8105
|
+
externalUserId: json["external_user_id"],
|
|
8106
|
+
externalUserName: json["external_user_name"],
|
|
8107
|
+
id: json["id"],
|
|
8108
|
+
note: json["note"],
|
|
8109
|
+
updatedAt: new Date(json["updated_at"])
|
|
8110
|
+
};
|
|
8111
|
+
}
|
|
8112
|
+
|
|
8075
8113
|
// src/api/checkoutexternal/models/FeatureResponseData.ts
|
|
8076
8114
|
function FeatureResponseDataFromJSON(json) {
|
|
8077
8115
|
return FeatureResponseDataFromJSONTyped(json, false);
|
|
@@ -8117,6 +8155,9 @@ function CompanyOverrideResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8117
8155
|
id: json["id"],
|
|
8118
8156
|
metricPeriod: json["metric_period"] == null ? void 0 : json["metric_period"],
|
|
8119
8157
|
metricPeriodMonthReset: json["metric_period_month_reset"] == null ? void 0 : json["metric_period_month_reset"],
|
|
8158
|
+
notes: json["notes"].map(
|
|
8159
|
+
CompanyOverrideNoteResponseDataFromJSON
|
|
8160
|
+
),
|
|
8120
8161
|
ruleId: json["rule_id"] == null ? void 0 : json["rule_id"],
|
|
8121
8162
|
ruleIdUsageExceeded: json["rule_id_usage_exceeded"] == null ? void 0 : json["rule_id_usage_exceeded"],
|
|
8122
8163
|
updatedAt: new Date(json["updated_at"]),
|
|
@@ -8333,12 +8374,16 @@ function PlanCreditGrantViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8333
8374
|
creditIcon: json["credit_icon"] == null ? void 0 : json["credit_icon"],
|
|
8334
8375
|
creditId: json["credit_id"],
|
|
8335
8376
|
creditName: json["credit_name"],
|
|
8377
|
+
expiryType: json["expiry_type"] == null ? void 0 : json["expiry_type"],
|
|
8378
|
+
expiryUnit: json["expiry_unit"] == null ? void 0 : json["expiry_unit"],
|
|
8379
|
+
expiryUnitCount: json["expiry_unit_count"] == null ? void 0 : json["expiry_unit_count"],
|
|
8336
8380
|
id: json["id"],
|
|
8337
8381
|
planId: json["plan_id"],
|
|
8338
8382
|
planName: json["plan_name"],
|
|
8339
8383
|
pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
|
|
8340
8384
|
resetCadence: json["reset_cadence"],
|
|
8341
8385
|
resetStart: json["reset_start"],
|
|
8386
|
+
resetType: json["reset_type"],
|
|
8342
8387
|
singularName: json["singular_name"] == null ? void 0 : json["singular_name"],
|
|
8343
8388
|
updatedAt: new Date(json["updated_at"])
|
|
8344
8389
|
};
|
|
@@ -8592,7 +8637,8 @@ function ComponentCheckoutSettingsFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8592
8637
|
return {
|
|
8593
8638
|
collectAddress: json["collect_address"],
|
|
8594
8639
|
collectEmail: json["collect_email"],
|
|
8595
|
-
collectPhone: json["collect_phone"]
|
|
8640
|
+
collectPhone: json["collect_phone"],
|
|
8641
|
+
taxCollectionEnabled: json["tax_collection_enabled"]
|
|
8596
8642
|
};
|
|
8597
8643
|
}
|
|
8598
8644
|
|
|
@@ -8779,6 +8825,8 @@ function ComponentHydrateResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8779
8825
|
),
|
|
8780
8826
|
defaultPlan: json["default_plan"] == null ? void 0 : PlanDetailResponseDataFromJSON(json["default_plan"]),
|
|
8781
8827
|
featureUsage: json["feature_usage"] == null ? void 0 : FeatureUsageDetailResponseDataFromJSON(json["feature_usage"]),
|
|
8828
|
+
postTrialPlan: json["post_trial_plan"] == null ? void 0 : PlanDetailResponseDataFromJSON(json["post_trial_plan"]),
|
|
8829
|
+
showCredits: json["show_credits"],
|
|
8782
8830
|
showPeriodToggle: json["show_period_toggle"],
|
|
8783
8831
|
showZeroPriceAsFree: json["show_zero_price_as_free"],
|
|
8784
8832
|
stripeEmbed: json["stripe_embed"] == null ? void 0 : StripeEmbedInfoFromJSON(json["stripe_embed"]),
|
|
@@ -8963,6 +9011,9 @@ function PreviewSubscriptionFinanceResponseDataFromJSONTyped(json, ignoreDiscrim
|
|
|
8963
9011
|
periodStart: new Date(json["period_start"]),
|
|
8964
9012
|
promoCodeApplied: json["promo_code_applied"],
|
|
8965
9013
|
proration: json["proration"],
|
|
9014
|
+
taxAmount: json["tax_amount"] == null ? void 0 : json["tax_amount"],
|
|
9015
|
+
taxDisplayName: json["tax_display_name"] == null ? void 0 : json["tax_display_name"],
|
|
9016
|
+
taxRequireBillingDetails: json["tax_require_billing_details"],
|
|
8966
9017
|
trialEnd: json["trial_end"] == null ? void 0 : new Date(json["trial_end"]),
|
|
8967
9018
|
upcomingInvoiceLineItems: json["upcoming_invoice_line_items"].map(PreviewSubscriptionUpcomingInvoiceLineItemsFromJSON)
|
|
8968
9019
|
};
|
|
@@ -10202,12 +10253,16 @@ function PlanCreditGrantViewFromJSONTyped3(json, ignoreDiscriminator) {
|
|
|
10202
10253
|
creditIcon: json["credit_icon"] == null ? void 0 : json["credit_icon"],
|
|
10203
10254
|
creditId: json["credit_id"],
|
|
10204
10255
|
creditName: json["credit_name"],
|
|
10256
|
+
expiryType: json["expiry_type"] == null ? void 0 : json["expiry_type"],
|
|
10257
|
+
expiryUnit: json["expiry_unit"] == null ? void 0 : json["expiry_unit"],
|
|
10258
|
+
expiryUnitCount: json["expiry_unit_count"] == null ? void 0 : json["expiry_unit_count"],
|
|
10205
10259
|
id: json["id"],
|
|
10206
10260
|
planId: json["plan_id"],
|
|
10207
10261
|
planName: json["plan_name"],
|
|
10208
10262
|
pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
|
|
10209
10263
|
resetCadence: json["reset_cadence"],
|
|
10210
10264
|
resetStart: json["reset_start"],
|
|
10265
|
+
resetType: json["reset_type"],
|
|
10211
10266
|
singularName: json["singular_name"] == null ? void 0 : json["singular_name"],
|
|
10212
10267
|
updatedAt: new Date(json["updated_at"])
|
|
10213
10268
|
};
|
|
@@ -10333,6 +10388,7 @@ function PublicPlansResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
10333
10388
|
CompatiblePlansFromJSON2
|
|
10334
10389
|
),
|
|
10335
10390
|
capabilities: json["capabilities"] == null ? void 0 : ComponentCapabilitiesFromJSON2(json["capabilities"]),
|
|
10391
|
+
showCredits: json["show_credits"],
|
|
10336
10392
|
showPeriodToggle: json["show_period_toggle"],
|
|
10337
10393
|
showZeroPriceAsFree: json["show_zero_price_as_free"]
|
|
10338
10394
|
};
|
|
@@ -10532,7 +10588,7 @@ var EmbedProvider = ({
|
|
|
10532
10588
|
});
|
|
10533
10589
|
const customHeaders = useMemo3(
|
|
10534
10590
|
() => ({
|
|
10535
|
-
"X-Schematic-Components-Version": "1.
|
|
10591
|
+
"X-Schematic-Components-Version": "1.7.0",
|
|
10536
10592
|
"X-Schematic-Session-ID": sessionIdRef.current
|
|
10537
10593
|
}),
|
|
10538
10594
|
[]
|
|
@@ -10546,6 +10602,15 @@ var EmbedProvider = ({
|
|
|
10546
10602
|
},
|
|
10547
10603
|
[options.debug]
|
|
10548
10604
|
);
|
|
10605
|
+
const finishCheckout = useCallback3(
|
|
10606
|
+
(checkoutData) => {
|
|
10607
|
+
dispatch({
|
|
10608
|
+
type: "CHECKOUT",
|
|
10609
|
+
data: checkoutData
|
|
10610
|
+
});
|
|
10611
|
+
},
|
|
10612
|
+
[dispatch]
|
|
10613
|
+
);
|
|
10549
10614
|
const hydratePublic = useCallback3(async () => {
|
|
10550
10615
|
dispatch({ type: "HYDRATE_STARTED" });
|
|
10551
10616
|
try {
|
|
@@ -10687,7 +10752,7 @@ var EmbedProvider = ({
|
|
|
10687
10752
|
const response = await api.checkout?.checkout({
|
|
10688
10753
|
changeSubscriptionRequestBody
|
|
10689
10754
|
});
|
|
10690
|
-
if (response) {
|
|
10755
|
+
if (response && !response.data.confirmPaymentIntentClientSecret) {
|
|
10691
10756
|
dispatch({
|
|
10692
10757
|
type: "CHECKOUT",
|
|
10693
10758
|
data: response.data
|
|
@@ -10898,6 +10963,7 @@ var EmbedProvider = ({
|
|
|
10898
10963
|
getUpcomingInvoice: debouncedGetUpcomingInvoice,
|
|
10899
10964
|
getCustomerBalance: debouncedGetCustomerBalance,
|
|
10900
10965
|
listInvoices: debouncedListInvoices,
|
|
10966
|
+
finishCheckout,
|
|
10901
10967
|
setError,
|
|
10902
10968
|
setAccessToken,
|
|
10903
10969
|
setLayout,
|
|
@@ -10927,23 +10993,131 @@ function useIsLightBackground() {
|
|
|
10927
10993
|
return isLightBackground;
|
|
10928
10994
|
}
|
|
10929
10995
|
|
|
10996
|
+
// src/hooks/usePaymentConfirmation.ts
|
|
10997
|
+
import { useCallback as useCallback4, useEffect as useEffect3, useRef as useRef3, useState as useState3 } from "react";
|
|
10998
|
+
var usePaymentConfirmation = ({
|
|
10999
|
+
stripe,
|
|
11000
|
+
clientSecret,
|
|
11001
|
+
onSuccess,
|
|
11002
|
+
onError: onError3,
|
|
11003
|
+
autoConfirm = false
|
|
11004
|
+
}) => {
|
|
11005
|
+
const [isConfirming, setIsConfirming] = useState3(false);
|
|
11006
|
+
const [error, setError] = useState3(null);
|
|
11007
|
+
const [status, setStatus] = useState3("idle");
|
|
11008
|
+
const confirmedSecrets = useRef3(/* @__PURE__ */ new Set());
|
|
11009
|
+
const abortControllerRef = useRef3(null);
|
|
11010
|
+
const confirmPayment = useCallback4(async () => {
|
|
11011
|
+
if (!stripe || !clientSecret) {
|
|
11012
|
+
const error2 = new Error(
|
|
11013
|
+
"Missing required parameters: stripe instance or client secret"
|
|
11014
|
+
);
|
|
11015
|
+
setError(error2);
|
|
11016
|
+
setStatus("failed");
|
|
11017
|
+
onError3?.(error2);
|
|
11018
|
+
return;
|
|
11019
|
+
}
|
|
11020
|
+
if (confirmedSecrets.current.has(clientSecret) || isConfirming) {
|
|
11021
|
+
console.warn("Payment confirmation already attempted or in progress");
|
|
11022
|
+
return;
|
|
11023
|
+
}
|
|
11024
|
+
if (abortControllerRef.current) {
|
|
11025
|
+
abortControllerRef.current.abort();
|
|
11026
|
+
}
|
|
11027
|
+
abortControllerRef.current = new AbortController();
|
|
11028
|
+
const { signal } = abortControllerRef.current;
|
|
11029
|
+
setIsConfirming(true);
|
|
11030
|
+
setError(null);
|
|
11031
|
+
setStatus("confirming");
|
|
11032
|
+
try {
|
|
11033
|
+
confirmedSecrets.current.add(clientSecret);
|
|
11034
|
+
const stripeInstance = await stripe;
|
|
11035
|
+
if (signal.aborted) {
|
|
11036
|
+
throw new Error("Payment confirmation was cancelled");
|
|
11037
|
+
}
|
|
11038
|
+
if (!stripeInstance) {
|
|
11039
|
+
throw new Error("Failed to load Stripe instance");
|
|
11040
|
+
}
|
|
11041
|
+
const result = await stripeInstance.confirmCardPayment(clientSecret);
|
|
11042
|
+
if (signal.aborted) {
|
|
11043
|
+
throw new Error("Payment confirmation was cancelled");
|
|
11044
|
+
}
|
|
11045
|
+
if (result.error) {
|
|
11046
|
+
throw new Error(result.error.message || "Payment confirmation failed");
|
|
11047
|
+
}
|
|
11048
|
+
setStatus("succeeded");
|
|
11049
|
+
onSuccess?.();
|
|
11050
|
+
} catch (err2) {
|
|
11051
|
+
if (!signal.aborted) {
|
|
11052
|
+
const error2 = err2 instanceof Error ? err2 : new Error("Unknown error occurred");
|
|
11053
|
+
setError(error2);
|
|
11054
|
+
setStatus("failed");
|
|
11055
|
+
onError3?.(error2);
|
|
11056
|
+
confirmedSecrets.current.delete(clientSecret);
|
|
11057
|
+
}
|
|
11058
|
+
} finally {
|
|
11059
|
+
if (!signal.aborted) {
|
|
11060
|
+
setIsConfirming(false);
|
|
11061
|
+
}
|
|
11062
|
+
abortControllerRef.current = null;
|
|
11063
|
+
}
|
|
11064
|
+
}, [stripe, clientSecret, onSuccess, onError3, isConfirming]);
|
|
11065
|
+
const reset = useCallback4(() => {
|
|
11066
|
+
if (clientSecret) {
|
|
11067
|
+
confirmedSecrets.current.delete(clientSecret);
|
|
11068
|
+
}
|
|
11069
|
+
setIsConfirming(false);
|
|
11070
|
+
setError(null);
|
|
11071
|
+
setStatus("idle");
|
|
11072
|
+
if (abortControllerRef.current) {
|
|
11073
|
+
abortControllerRef.current.abort();
|
|
11074
|
+
abortControllerRef.current = null;
|
|
11075
|
+
}
|
|
11076
|
+
}, [clientSecret]);
|
|
11077
|
+
useEffect3(() => {
|
|
11078
|
+
if (autoConfirm && status === "idle" && stripe && clientSecret) {
|
|
11079
|
+
confirmPayment();
|
|
11080
|
+
}
|
|
11081
|
+
}, [autoConfirm, stripe, clientSecret]);
|
|
11082
|
+
useEffect3(() => {
|
|
11083
|
+
return () => {
|
|
11084
|
+
if (abortControllerRef.current) {
|
|
11085
|
+
abortControllerRef.current.abort();
|
|
11086
|
+
abortControllerRef.current = null;
|
|
11087
|
+
}
|
|
11088
|
+
};
|
|
11089
|
+
}, []);
|
|
11090
|
+
useEffect3(() => {
|
|
11091
|
+
if (clientSecret && status !== "idle") {
|
|
11092
|
+
reset();
|
|
11093
|
+
}
|
|
11094
|
+
}, [clientSecret]);
|
|
11095
|
+
return {
|
|
11096
|
+
confirmPayment,
|
|
11097
|
+
isConfirming,
|
|
11098
|
+
error,
|
|
11099
|
+
status,
|
|
11100
|
+
reset
|
|
11101
|
+
};
|
|
11102
|
+
};
|
|
11103
|
+
|
|
10930
11104
|
// src/hooks/usePrevious.ts
|
|
10931
|
-
import { useEffect as
|
|
11105
|
+
import { useEffect as useEffect4, useRef as useRef4 } from "react";
|
|
10932
11106
|
function usePrevious2(value) {
|
|
10933
|
-
const ref =
|
|
10934
|
-
|
|
11107
|
+
const ref = useRef4(void 0);
|
|
11108
|
+
useEffect4(() => {
|
|
10935
11109
|
ref.current = value;
|
|
10936
11110
|
}, [value]);
|
|
10937
11111
|
return ref.current;
|
|
10938
11112
|
}
|
|
10939
11113
|
|
|
10940
11114
|
// src/hooks/useRequest.ts
|
|
10941
|
-
import { useCallback as
|
|
11115
|
+
import { useCallback as useCallback5, useMemo as useMemo5, useState as useState4 } from "react";
|
|
10942
11116
|
function useRequest(fn) {
|
|
10943
|
-
const [isLoading, setIsLoading] =
|
|
10944
|
-
const [error, setError] =
|
|
10945
|
-
const [data, setData] =
|
|
10946
|
-
const request =
|
|
11117
|
+
const [isLoading, setIsLoading] = useState4(false);
|
|
11118
|
+
const [error, setError] = useState4(null);
|
|
11119
|
+
const [data, setData] = useState4(void 0);
|
|
11120
|
+
const request = useCallback5(async () => {
|
|
10947
11121
|
try {
|
|
10948
11122
|
setError(null);
|
|
10949
11123
|
setIsLoading(true);
|
|
@@ -11003,9 +11177,9 @@ function useTrialEnd() {
|
|
|
11003
11177
|
}
|
|
11004
11178
|
|
|
11005
11179
|
// src/hooks/useWrapChildren.ts
|
|
11006
|
-
import { useLayoutEffect, useState as
|
|
11180
|
+
import { useLayoutEffect, useState as useState5 } from "react";
|
|
11007
11181
|
function useWrapChildren(elements) {
|
|
11008
|
-
const [shouldWrap, setShouldWrap] =
|
|
11182
|
+
const [shouldWrap, setShouldWrap] = useState5(
|
|
11009
11183
|
() => new Array(elements.length).fill(false)
|
|
11010
11184
|
);
|
|
11011
11185
|
useLayoutEffect(() => {
|
|
@@ -11529,7 +11703,7 @@ var Input = dt.input(({ theme, $size = "md", $variant = "filled" }) => {
|
|
|
11529
11703
|
});
|
|
11530
11704
|
|
|
11531
11705
|
// src/components/ui/modal/Modal.tsx
|
|
11532
|
-
import { useCallback as
|
|
11706
|
+
import { useCallback as useCallback6, useLayoutEffect as useLayoutEffect2, useRef as useRef5 } from "react";
|
|
11533
11707
|
|
|
11534
11708
|
// src/components/ui/modal/styles.ts
|
|
11535
11709
|
var Overlay = dt(Box)`
|
|
@@ -11594,8 +11768,8 @@ var Modal2 = ({
|
|
|
11594
11768
|
}) => {
|
|
11595
11769
|
const { setLayout } = useEmbed();
|
|
11596
11770
|
const isLightBackground = useIsLightBackground();
|
|
11597
|
-
const ref =
|
|
11598
|
-
const handleClose =
|
|
11771
|
+
const ref = useRef5(null);
|
|
11772
|
+
const handleClose = useCallback6(() => {
|
|
11599
11773
|
setLayout("portal");
|
|
11600
11774
|
onClose?.();
|
|
11601
11775
|
}, [setLayout, onClose]);
|
|
@@ -11629,7 +11803,7 @@ var Modal2 = ({
|
|
|
11629
11803
|
Modal2.displayName = "Modal";
|
|
11630
11804
|
|
|
11631
11805
|
// src/components/ui/modal/ModalHeader.tsx
|
|
11632
|
-
import { useCallback as
|
|
11806
|
+
import { useCallback as useCallback7 } from "react";
|
|
11633
11807
|
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
11634
11808
|
var ModalHeader = ({
|
|
11635
11809
|
children,
|
|
@@ -11638,7 +11812,7 @@ var ModalHeader = ({
|
|
|
11638
11812
|
}) => {
|
|
11639
11813
|
const { settings, setLayout } = useEmbed();
|
|
11640
11814
|
const isLightBackground = useIsLightBackground();
|
|
11641
|
-
const handleClose =
|
|
11815
|
+
const handleClose = useCallback7(() => {
|
|
11642
11816
|
setLayout("portal");
|
|
11643
11817
|
onClose?.();
|
|
11644
11818
|
}, [setLayout, onClose]);
|
|
@@ -11827,7 +12001,7 @@ var Text = dt.span.withConfig({
|
|
|
11827
12001
|
|
|
11828
12002
|
// src/components/ui/tooltip/Tooltip.tsx
|
|
11829
12003
|
var import_debounce2 = __toESM(require_debounce());
|
|
11830
|
-
import { useCallback as
|
|
12004
|
+
import { useCallback as useCallback8, useLayoutEffect as useLayoutEffect3, useRef as useRef6, useState as useState6 } from "react";
|
|
11831
12005
|
import { createPortal } from "react-dom";
|
|
11832
12006
|
|
|
11833
12007
|
// src/components/ui/tooltip/styles.ts
|
|
@@ -11984,10 +12158,10 @@ var Tooltip = ({
|
|
|
11984
12158
|
fullWidth = false,
|
|
11985
12159
|
...rest
|
|
11986
12160
|
}) => {
|
|
11987
|
-
const ref =
|
|
11988
|
-
const [show, setShow] =
|
|
11989
|
-
const [coords2, setCoords] =
|
|
11990
|
-
const updateCoords =
|
|
12161
|
+
const ref = useRef6(null);
|
|
12162
|
+
const [show, setShow] = useState6(false);
|
|
12163
|
+
const [coords2, setCoords] = useState6({ x: 0, y: 0 });
|
|
12164
|
+
const updateCoords = useCallback8(() => {
|
|
11991
12165
|
if (ref.current) {
|
|
11992
12166
|
const { top: offsetTop, left: offsetLeft } = document.body.getBoundingClientRect();
|
|
11993
12167
|
const rect = ref.current.getBoundingClientRect();
|
|
@@ -12166,7 +12340,7 @@ Root.displayName = "Root";
|
|
|
12166
12340
|
|
|
12167
12341
|
// src/components/layout/viewport/Viewport.tsx
|
|
12168
12342
|
var import_debounce3 = __toESM(require_debounce());
|
|
12169
|
-
import { forwardRef as forwardRef5, useLayoutEffect as useLayoutEffect5, useMemo as useMemo15, useState as
|
|
12343
|
+
import { forwardRef as forwardRef5, useLayoutEffect as useLayoutEffect5, useMemo as useMemo15, useState as useState13 } from "react";
|
|
12170
12344
|
import { createPortal as createPortal2 } from "react-dom";
|
|
12171
12345
|
|
|
12172
12346
|
// src/components/shared/billing-threshold-tooltip/BillingThresholdTooltip.tsx
|
|
@@ -12200,17 +12374,17 @@ var BillingThresholdTooltip = ({
|
|
|
12200
12374
|
|
|
12201
12375
|
// src/components/shared/checkout-dialog/CheckoutDialog.tsx
|
|
12202
12376
|
import {
|
|
12203
|
-
useCallback as
|
|
12204
|
-
useEffect as
|
|
12377
|
+
useCallback as useCallback10,
|
|
12378
|
+
useEffect as useEffect6,
|
|
12205
12379
|
useLayoutEffect as useLayoutEffect4,
|
|
12206
12380
|
useMemo as useMemo9,
|
|
12207
|
-
useRef as
|
|
12208
|
-
useState as
|
|
12381
|
+
useRef as useRef7,
|
|
12382
|
+
useState as useState10
|
|
12209
12383
|
} from "react";
|
|
12210
12384
|
|
|
12211
12385
|
// src/components/shared/sidebar/Sidebar.tsx
|
|
12212
12386
|
import {
|
|
12213
|
-
useCallback as
|
|
12387
|
+
useCallback as useCallback9,
|
|
12214
12388
|
useMemo as useMemo7
|
|
12215
12389
|
} from "react";
|
|
12216
12390
|
|
|
@@ -12286,11 +12460,11 @@ var EntitlementRow = (entitlement) => {
|
|
|
12286
12460
|
};
|
|
12287
12461
|
|
|
12288
12462
|
// src/components/shared/sidebar/Proration.tsx
|
|
12289
|
-
import { useState as
|
|
12463
|
+
import { useState as useState7 } from "react";
|
|
12290
12464
|
import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
12291
12465
|
var Proration = ({ currency, charges }) => {
|
|
12292
12466
|
const { t: t2 } = useTranslation();
|
|
12293
|
-
const [open, setOpen] =
|
|
12467
|
+
const [open, setOpen] = useState7(false);
|
|
12294
12468
|
const toggle = (e2) => {
|
|
12295
12469
|
e2.preventDefault();
|
|
12296
12470
|
e2.stopPropagation();
|
|
@@ -12606,10 +12780,19 @@ var Sidebar = ({
|
|
|
12606
12780
|
updatePromoCode,
|
|
12607
12781
|
showHeader = true,
|
|
12608
12782
|
shouldTrial = false,
|
|
12609
|
-
willTrialWithoutPaymentMethod = false
|
|
12783
|
+
willTrialWithoutPaymentMethod = false,
|
|
12784
|
+
setConfirmPaymentIntent
|
|
12610
12785
|
}) => {
|
|
12611
12786
|
const { t: t2 } = useTranslation();
|
|
12612
|
-
const {
|
|
12787
|
+
const {
|
|
12788
|
+
data,
|
|
12789
|
+
settings,
|
|
12790
|
+
layout,
|
|
12791
|
+
setLayout,
|
|
12792
|
+
checkout,
|
|
12793
|
+
finishCheckout,
|
|
12794
|
+
unsubscribe
|
|
12795
|
+
} = useEmbed();
|
|
12613
12796
|
const isLightBackground = useIsLightBackground();
|
|
12614
12797
|
const {
|
|
12615
12798
|
currentPlan,
|
|
@@ -12697,14 +12880,25 @@ var Sidebar = ({
|
|
|
12697
12880
|
total += payInAdvanceCost;
|
|
12698
12881
|
return formatCurrency(total, currency);
|
|
12699
12882
|
}, [selectedPlan, currentPlan, planPeriod, addOns, payInAdvanceEntitlements]);
|
|
12700
|
-
const {
|
|
12883
|
+
const {
|
|
12884
|
+
amountOff,
|
|
12885
|
+
dueNow,
|
|
12886
|
+
newCharges,
|
|
12887
|
+
percentOff,
|
|
12888
|
+
periodStart,
|
|
12889
|
+
proration,
|
|
12890
|
+
taxAmount,
|
|
12891
|
+
taxDescription
|
|
12892
|
+
} = useMemo7(() => {
|
|
12701
12893
|
return {
|
|
12702
12894
|
amountOff: charges?.amountOff ?? 0,
|
|
12703
12895
|
dueNow: charges?.dueNow ?? 0,
|
|
12704
12896
|
newCharges: charges?.newCharges ?? 0,
|
|
12705
12897
|
percentOff: charges?.percentOff ?? 0,
|
|
12706
12898
|
periodStart: charges?.periodStart,
|
|
12707
|
-
proration: charges?.proration ?? 0
|
|
12899
|
+
proration: charges?.proration ?? 0,
|
|
12900
|
+
taxAmount: charges?.taxAmount ?? 0,
|
|
12901
|
+
taxDescription: charges?.taxDisplayName
|
|
12708
12902
|
};
|
|
12709
12903
|
}, [charges]);
|
|
12710
12904
|
const updatedUsageBasedEntitlements = useMemo7(() => {
|
|
@@ -12770,7 +12964,7 @@ var Sidebar = ({
|
|
|
12770
12964
|
() => promoCode && (amountOff > 0 || percentOff > 0),
|
|
12771
12965
|
[promoCode, amountOff, percentOff]
|
|
12772
12966
|
);
|
|
12773
|
-
const handleCheckout =
|
|
12967
|
+
const handleCheckout = useCallback9(async () => {
|
|
12774
12968
|
const planId = selectedPlan?.id;
|
|
12775
12969
|
const priceId = (planPeriod === "year" ? selectedPlan?.yearlyPrice : selectedPlan?.monthlyPrice)?.id;
|
|
12776
12970
|
try {
|
|
@@ -12808,7 +13002,7 @@ var Sidebar = ({
|
|
|
12808
13002
|
[]
|
|
12809
13003
|
);
|
|
12810
13004
|
const allPayInAdvance = [...planPayInAdvance, ...addOnPayInAdvance];
|
|
12811
|
-
await checkout({
|
|
13005
|
+
const checkoutResponseFromBackend = await checkout({
|
|
12812
13006
|
newPlanId: planId,
|
|
12813
13007
|
newPriceId: priceId,
|
|
12814
13008
|
addOnIds: addOns.reduce((acc, addOn) => {
|
|
@@ -12840,8 +13034,32 @@ var Sidebar = ({
|
|
|
12840
13034
|
...paymentMethodId && { paymentMethodId },
|
|
12841
13035
|
...promoCode && { promoCode }
|
|
12842
13036
|
});
|
|
12843
|
-
|
|
12844
|
-
|
|
13037
|
+
if (checkoutResponseFromBackend?.data.confirmPaymentIntentClientSecret) {
|
|
13038
|
+
setConfirmPaymentIntent({
|
|
13039
|
+
clientSecret: checkoutResponseFromBackend?.data.confirmPaymentIntentClientSecret,
|
|
13040
|
+
callback: (confirmed) => {
|
|
13041
|
+
if (typeof confirmed === "undefined") {
|
|
13042
|
+
return;
|
|
13043
|
+
}
|
|
13044
|
+
console.log("Payment intent has confirmed. Result: ", confirmed);
|
|
13045
|
+
setIsLoading(false);
|
|
13046
|
+
if (!confirmed) {
|
|
13047
|
+
setError(
|
|
13048
|
+
t2(
|
|
13049
|
+
"Error processing payment. Please try a different payment method."
|
|
13050
|
+
)
|
|
13051
|
+
);
|
|
13052
|
+
setLayout("checkout");
|
|
13053
|
+
} else {
|
|
13054
|
+
finishCheckout(checkoutResponseFromBackend?.data);
|
|
13055
|
+
setLayout("portal");
|
|
13056
|
+
}
|
|
13057
|
+
}
|
|
13058
|
+
});
|
|
13059
|
+
} else {
|
|
13060
|
+
setIsLoading(false);
|
|
13061
|
+
setLayout("portal");
|
|
13062
|
+
}
|
|
12845
13063
|
} catch {
|
|
12846
13064
|
setIsLoading(false);
|
|
12847
13065
|
setLayout("checkout");
|
|
@@ -12852,6 +13070,7 @@ var Sidebar = ({
|
|
|
12852
13070
|
}, [
|
|
12853
13071
|
t2,
|
|
12854
13072
|
checkout,
|
|
13073
|
+
setConfirmPaymentIntent,
|
|
12855
13074
|
paymentMethodId,
|
|
12856
13075
|
planPeriod,
|
|
12857
13076
|
selectedPlan,
|
|
@@ -12863,9 +13082,10 @@ var Sidebar = ({
|
|
|
12863
13082
|
payInAdvanceEntitlements,
|
|
12864
13083
|
addOnUsageBasedEntitlements,
|
|
12865
13084
|
shouldTrial,
|
|
12866
|
-
promoCode
|
|
13085
|
+
promoCode,
|
|
13086
|
+
finishCheckout
|
|
12867
13087
|
]);
|
|
12868
|
-
const handleUnsubscribe =
|
|
13088
|
+
const handleUnsubscribe = useCallback9(async () => {
|
|
12869
13089
|
try {
|
|
12870
13090
|
setError(void 0);
|
|
12871
13091
|
setIsLoading(true);
|
|
@@ -13337,6 +13557,20 @@ var Sidebar = ({
|
|
|
13337
13557
|
]
|
|
13338
13558
|
}
|
|
13339
13559
|
),
|
|
13560
|
+
taxAmount > 0 && /* @__PURE__ */ jsxs9(
|
|
13561
|
+
Flex,
|
|
13562
|
+
{
|
|
13563
|
+
$justifyContent: "space-between",
|
|
13564
|
+
$alignItems: "center",
|
|
13565
|
+
$gap: "1rem",
|
|
13566
|
+
children: [
|
|
13567
|
+
/* @__PURE__ */ jsx14(Box, { $opacity: "0.625", children: /* @__PURE__ */ jsx14(Text, { children: t2("Tax (description):", {
|
|
13568
|
+
description: taxDescription
|
|
13569
|
+
}) }) }),
|
|
13570
|
+
/* @__PURE__ */ jsx14(Box, { children: /* @__PURE__ */ jsx14(Text, { children: formatCurrency(taxAmount, selectedPlanCurrency) }) })
|
|
13571
|
+
]
|
|
13572
|
+
}
|
|
13573
|
+
),
|
|
13340
13574
|
charges && /* @__PURE__ */ jsxs9(
|
|
13341
13575
|
Flex,
|
|
13342
13576
|
{
|
|
@@ -13541,21 +13775,32 @@ var AddOns = ({ addOns, toggle, isLoading, period }) => {
|
|
|
13541
13775
|
};
|
|
13542
13776
|
|
|
13543
13777
|
// src/components/shared/checkout-dialog/Checkout.tsx
|
|
13544
|
-
import { useState as
|
|
13778
|
+
import { useState as useState8 } from "react";
|
|
13545
13779
|
import { Fragment as Fragment6, jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
13546
13780
|
var Checkout = ({
|
|
13547
13781
|
isPaymentMethodRequired,
|
|
13548
13782
|
setPaymentMethodId,
|
|
13549
|
-
updatePromoCode
|
|
13783
|
+
updatePromoCode,
|
|
13784
|
+
confirmPaymentIntentProps,
|
|
13785
|
+
financeData,
|
|
13786
|
+
onPaymentMethodSaved
|
|
13550
13787
|
}) => {
|
|
13551
13788
|
const { t: t2 } = useTranslation();
|
|
13552
13789
|
const isLightBackground = useIsLightBackground();
|
|
13553
|
-
const [discount, setDiscount] =
|
|
13790
|
+
const [discount, setDiscount] = useState8("");
|
|
13554
13791
|
if (!isPaymentMethodRequired) {
|
|
13555
13792
|
return null;
|
|
13556
13793
|
}
|
|
13557
13794
|
return /* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
13558
|
-
/* @__PURE__ */ jsx16(
|
|
13795
|
+
/* @__PURE__ */ jsx16(
|
|
13796
|
+
PaymentMethodDetails,
|
|
13797
|
+
{
|
|
13798
|
+
confirmPaymentIntentProps,
|
|
13799
|
+
setPaymentMethodId,
|
|
13800
|
+
financeData,
|
|
13801
|
+
onPaymentMethodSaved
|
|
13802
|
+
}
|
|
13803
|
+
),
|
|
13559
13804
|
/* @__PURE__ */ jsxs11(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
13560
13805
|
/* @__PURE__ */ jsx16(Box, { children: /* @__PURE__ */ jsx16(Text, { display: "heading4", children: t2("Discount") }) }),
|
|
13561
13806
|
/* @__PURE__ */ jsxs11(
|
|
@@ -13756,7 +14001,7 @@ var Navigation = ({
|
|
|
13756
14001
|
};
|
|
13757
14002
|
|
|
13758
14003
|
// src/components/shared/checkout-dialog/Plan.tsx
|
|
13759
|
-
import { useEffect as
|
|
14004
|
+
import { useEffect as useEffect5, useMemo as useMemo8, useState as useState9 } from "react";
|
|
13760
14005
|
import { Fragment as Fragment8, jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
13761
14006
|
var Selected = ({ isCurrent = false, isTrial = false }) => {
|
|
13762
14007
|
const { t: t2 } = useTranslation();
|
|
@@ -13908,7 +14153,7 @@ var Plan = ({
|
|
|
13908
14153
|
const { t: t2 } = useTranslation();
|
|
13909
14154
|
const { data, settings } = useEmbed();
|
|
13910
14155
|
const isLightBackground = useIsLightBackground();
|
|
13911
|
-
const [entitlementCounts, setEntitlementCounts] =
|
|
14156
|
+
const [entitlementCounts, setEntitlementCounts] = useState9(
|
|
13912
14157
|
() => plans.reduce(entitlementCountsReducer, {})
|
|
13913
14158
|
);
|
|
13914
14159
|
const { isTrialing, showZeroPriceAsFree } = useMemo8(() => {
|
|
@@ -13938,7 +14183,7 @@ var Plan = ({
|
|
|
13938
14183
|
return prev2;
|
|
13939
14184
|
});
|
|
13940
14185
|
};
|
|
13941
|
-
|
|
14186
|
+
useEffect5(() => {
|
|
13942
14187
|
setEntitlementCounts(plans.reduce(entitlementCountsReducer, {}));
|
|
13943
14188
|
}, [plans]);
|
|
13944
14189
|
const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
|
|
@@ -14469,18 +14714,19 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14469
14714
|
const { t: t2 } = useTranslation();
|
|
14470
14715
|
const { data, settings, isPending, checkoutState, previewCheckout } = useEmbed();
|
|
14471
14716
|
const isLightBackground = useIsLightBackground();
|
|
14472
|
-
const contentRef =
|
|
14473
|
-
const checkoutRef =
|
|
14474
|
-
const [
|
|
14475
|
-
const [
|
|
14717
|
+
const contentRef = useRef7(null);
|
|
14718
|
+
const checkoutRef = useRef7(null);
|
|
14719
|
+
const [confirmPaymentIntentProps, setConfirmPaymentIntentProps] = useState10(void 0);
|
|
14720
|
+
const [charges, setCharges] = useState10();
|
|
14721
|
+
const [paymentMethodId, setPaymentMethodId] = useState10(
|
|
14476
14722
|
() => {
|
|
14477
14723
|
if (isCheckoutData(data)) {
|
|
14478
14724
|
return (data.subscription?.paymentMethod || data.company?.defaultPaymentMethod)?.externalId;
|
|
14479
14725
|
}
|
|
14480
14726
|
}
|
|
14481
14727
|
);
|
|
14482
|
-
const [isLoading, setIsLoading] =
|
|
14483
|
-
const [error, setError] =
|
|
14728
|
+
const [isLoading, setIsLoading] = useState10(false);
|
|
14729
|
+
const [error, setError] = useState10();
|
|
14484
14730
|
const {
|
|
14485
14731
|
currentPlanId,
|
|
14486
14732
|
currentEntitlements,
|
|
@@ -14506,7 +14752,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14506
14752
|
() => checkoutState?.period || isCheckoutData(data) && data.company?.plan?.planPeriod || "month",
|
|
14507
14753
|
[data, checkoutState?.period]
|
|
14508
14754
|
);
|
|
14509
|
-
const [planPeriod, setPlanPeriod] =
|
|
14755
|
+
const [planPeriod, setPlanPeriod] = useState10(currentPeriod);
|
|
14510
14756
|
const {
|
|
14511
14757
|
plans: availablePlans,
|
|
14512
14758
|
addOns: availableAddOns,
|
|
@@ -14514,15 +14760,15 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14514
14760
|
} = useAvailablePlans(planPeriod, {
|
|
14515
14761
|
useSelectedPeriod: showPeriodToggle
|
|
14516
14762
|
});
|
|
14517
|
-
const [selectedPlan, setSelectedPlan] =
|
|
14763
|
+
const [selectedPlan, setSelectedPlan] = useState10(
|
|
14518
14764
|
() => {
|
|
14519
14765
|
return availablePlans.find(
|
|
14520
14766
|
(plan) => checkoutState?.planId ? plan.id === checkoutState.planId : isHydratedPlan(plan) && plan.current
|
|
14521
14767
|
);
|
|
14522
14768
|
}
|
|
14523
14769
|
);
|
|
14524
|
-
const [shouldTrial, setShouldTrial] =
|
|
14525
|
-
const [addOns, setAddOns] =
|
|
14770
|
+
const [shouldTrial, setShouldTrial] = useState10(false);
|
|
14771
|
+
const [addOns, setAddOns] = useState10(() => {
|
|
14526
14772
|
if (isCheckoutData(data)) {
|
|
14527
14773
|
return availableAddOns.map((addOn) => ({
|
|
14528
14774
|
...addOn,
|
|
@@ -14533,7 +14779,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14533
14779
|
}
|
|
14534
14780
|
return [];
|
|
14535
14781
|
});
|
|
14536
|
-
const [creditBundles, setCreditBundles] =
|
|
14782
|
+
const [creditBundles, setCreditBundles] = useState10(() => {
|
|
14537
14783
|
if (isCheckoutData(data)) {
|
|
14538
14784
|
return data.creditBundles.map((bundle) => ({
|
|
14539
14785
|
...bundle,
|
|
@@ -14542,7 +14788,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14542
14788
|
}
|
|
14543
14789
|
return [];
|
|
14544
14790
|
});
|
|
14545
|
-
const [usageBasedEntitlements, setUsageBasedEntitlements] =
|
|
14791
|
+
const [usageBasedEntitlements, setUsageBasedEntitlements] = useState10(
|
|
14546
14792
|
() => (selectedPlan?.entitlements || []).reduce(
|
|
14547
14793
|
createActiveUsageBasedEntitlementsReducer(
|
|
14548
14794
|
currentEntitlements,
|
|
@@ -14551,7 +14797,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14551
14797
|
[]
|
|
14552
14798
|
)
|
|
14553
14799
|
);
|
|
14554
|
-
const [addOnUsageBasedEntitlements, setAddOnUsageBasedEntitlements] =
|
|
14800
|
+
const [addOnUsageBasedEntitlements, setAddOnUsageBasedEntitlements] = useState10(() => {
|
|
14555
14801
|
if (!isCheckoutData(data)) return [];
|
|
14556
14802
|
const currentAddOns = data.company?.addOns || [];
|
|
14557
14803
|
return currentAddOns.flatMap((currentAddOn) => {
|
|
@@ -14580,8 +14826,8 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14580
14826
|
),
|
|
14581
14827
|
[addOnUsageBasedEntitlements]
|
|
14582
14828
|
);
|
|
14583
|
-
const [promoCode, setPromoCode] =
|
|
14584
|
-
const [isPaymentMethodRequired, setIsPaymentMethodRequired] =
|
|
14829
|
+
const [promoCode, setPromoCode] = useState10(null);
|
|
14830
|
+
const [isPaymentMethodRequired, setIsPaymentMethodRequired] = useState10(false);
|
|
14585
14831
|
const willTrialWithoutPaymentMethod = useMemo9(
|
|
14586
14832
|
() => shouldTrial && !trialPaymentMethodRequired,
|
|
14587
14833
|
[shouldTrial, trialPaymentMethodRequired]
|
|
@@ -14654,7 +14900,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14654
14900
|
creditBundles,
|
|
14655
14901
|
isPaymentMethodRequired
|
|
14656
14902
|
]);
|
|
14657
|
-
const [checkoutStage, setCheckoutStage] =
|
|
14903
|
+
const [checkoutStage, setCheckoutStage] = useState10(() => {
|
|
14658
14904
|
if (checkoutState?.addOnId) {
|
|
14659
14905
|
return "addons";
|
|
14660
14906
|
}
|
|
@@ -14672,7 +14918,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14672
14918
|
}
|
|
14673
14919
|
return "plan";
|
|
14674
14920
|
});
|
|
14675
|
-
const handlePreviewCheckout =
|
|
14921
|
+
const handlePreviewCheckout = useCallback10(
|
|
14676
14922
|
async (updates) => {
|
|
14677
14923
|
const period = updates.period || planPeriod;
|
|
14678
14924
|
const plan = updates.plan || selectedPlan;
|
|
@@ -14796,7 +15042,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14796
15042
|
promoCode
|
|
14797
15043
|
]
|
|
14798
15044
|
);
|
|
14799
|
-
const selectPlan =
|
|
15045
|
+
const selectPlan = useCallback10(
|
|
14800
15046
|
(updates) => {
|
|
14801
15047
|
const plan = updates.plan;
|
|
14802
15048
|
const period = updates.period || planPeriod;
|
|
@@ -14851,7 +15097,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14851
15097
|
handlePreviewCheckout
|
|
14852
15098
|
]
|
|
14853
15099
|
);
|
|
14854
|
-
const changePlanPeriod =
|
|
15100
|
+
const changePlanPeriod = useCallback10(
|
|
14855
15101
|
(period) => {
|
|
14856
15102
|
if (period !== planPeriod) {
|
|
14857
15103
|
setPlanPeriod(period);
|
|
@@ -14860,7 +15106,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14860
15106
|
},
|
|
14861
15107
|
[planPeriod, setPlanPeriod, handlePreviewCheckout]
|
|
14862
15108
|
);
|
|
14863
|
-
const toggleAddOn =
|
|
15109
|
+
const toggleAddOn = useCallback10(
|
|
14864
15110
|
(id) => {
|
|
14865
15111
|
setAddOns((prev2) => {
|
|
14866
15112
|
const updated = prev2.map((addOn) => ({
|
|
@@ -14887,7 +15133,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14887
15133
|
},
|
|
14888
15134
|
[handlePreviewCheckout]
|
|
14889
15135
|
);
|
|
14890
|
-
const updateUsageBasedEntitlementQuantity =
|
|
15136
|
+
const updateUsageBasedEntitlementQuantity = useCallback10(
|
|
14891
15137
|
(id, updatedQuantity) => {
|
|
14892
15138
|
setUsageBasedEntitlements((prev2) => {
|
|
14893
15139
|
const updated = prev2.map(
|
|
@@ -14906,7 +15152,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14906
15152
|
},
|
|
14907
15153
|
[handlePreviewCheckout]
|
|
14908
15154
|
);
|
|
14909
|
-
const updateCreditBundleCount =
|
|
15155
|
+
const updateCreditBundleCount = useCallback10(
|
|
14910
15156
|
(id, updatedCount) => {
|
|
14911
15157
|
setCreditBundles((prev2) => {
|
|
14912
15158
|
const updated = prev2.map(
|
|
@@ -14921,7 +15167,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14921
15167
|
},
|
|
14922
15168
|
[handlePreviewCheckout]
|
|
14923
15169
|
);
|
|
14924
|
-
const updateAddOnEntitlementQuantity =
|
|
15170
|
+
const updateAddOnEntitlementQuantity = useCallback10(
|
|
14925
15171
|
(id, updatedQuantity) => {
|
|
14926
15172
|
setAddOnUsageBasedEntitlements((prev2) => {
|
|
14927
15173
|
const updated = prev2.map(
|
|
@@ -14938,18 +15184,18 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14938
15184
|
},
|
|
14939
15185
|
[handlePreviewCheckout]
|
|
14940
15186
|
);
|
|
14941
|
-
const updatePromoCode =
|
|
15187
|
+
const updatePromoCode = useCallback10(
|
|
14942
15188
|
async (code) => {
|
|
14943
15189
|
handlePreviewCheckout({ promoCode: code });
|
|
14944
15190
|
},
|
|
14945
15191
|
[handlePreviewCheckout]
|
|
14946
15192
|
);
|
|
14947
|
-
|
|
15193
|
+
useEffect6(() => {
|
|
14948
15194
|
if (selectedPlan) {
|
|
14949
15195
|
selectPlan({ plan: selectedPlan, period: currentPeriod });
|
|
14950
15196
|
}
|
|
14951
15197
|
}, []);
|
|
14952
|
-
|
|
15198
|
+
useEffect6(() => {
|
|
14953
15199
|
setAddOns((prevAddOns) => {
|
|
14954
15200
|
return availableAddOns.filter((availAddOn) => {
|
|
14955
15201
|
if (!selectedPlan) {
|
|
@@ -14971,7 +15217,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14971
15217
|
});
|
|
14972
15218
|
});
|
|
14973
15219
|
}, [availableAddOns, data?.addOnCompatibilities, selectedPlan]);
|
|
14974
|
-
|
|
15220
|
+
useEffect6(() => {
|
|
14975
15221
|
if (charges) {
|
|
14976
15222
|
checkoutRef.current?.scrollTo({
|
|
14977
15223
|
top: 0,
|
|
@@ -15142,7 +15388,10 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
15142
15388
|
{
|
|
15143
15389
|
isPaymentMethodRequired,
|
|
15144
15390
|
setPaymentMethodId: (id) => setPaymentMethodId(id),
|
|
15145
|
-
updatePromoCode
|
|
15391
|
+
updatePromoCode,
|
|
15392
|
+
confirmPaymentIntentProps,
|
|
15393
|
+
financeData: charges,
|
|
15394
|
+
onPaymentMethodSaved: handlePreviewCheckout
|
|
15146
15395
|
}
|
|
15147
15396
|
)
|
|
15148
15397
|
]
|
|
@@ -15171,6 +15420,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
15171
15420
|
setIsLoading,
|
|
15172
15421
|
updatePromoCode,
|
|
15173
15422
|
shouldTrial,
|
|
15423
|
+
setConfirmPaymentIntent: setConfirmPaymentIntentProps,
|
|
15174
15424
|
willTrialWithoutPaymentMethod
|
|
15175
15425
|
}
|
|
15176
15426
|
)
|
|
@@ -15181,11 +15431,11 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
15181
15431
|
};
|
|
15182
15432
|
|
|
15183
15433
|
// src/components/shared/payment-dialog/PaymentDialog.tsx
|
|
15184
|
-
import { useRef as
|
|
15434
|
+
import { useRef as useRef8 } from "react";
|
|
15185
15435
|
import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
15186
15436
|
var PaymentDialog = ({ top = 0 }) => {
|
|
15187
15437
|
const { t: t2 } = useTranslation();
|
|
15188
|
-
const contentRef =
|
|
15438
|
+
const contentRef = useRef8(null);
|
|
15189
15439
|
return /* @__PURE__ */ jsxs17(Modal2, { size: "md", top, contentRef, children: [
|
|
15190
15440
|
/* @__PURE__ */ jsx22(ModalHeader, { bordered: true, children: /* @__PURE__ */ jsx22(Text, { $size: 18, children: t2("Edit payment method") }) }),
|
|
15191
15441
|
/* @__PURE__ */ jsx22(PaymentMethodDetails, {})
|
|
@@ -15199,7 +15449,7 @@ import {
|
|
|
15199
15449
|
useElements,
|
|
15200
15450
|
useStripe
|
|
15201
15451
|
} from "@stripe/react-stripe-js";
|
|
15202
|
-
import { useState as
|
|
15452
|
+
import { useState as useState11 } from "react";
|
|
15203
15453
|
|
|
15204
15454
|
// src/components/shared/payment-form/styles.ts
|
|
15205
15455
|
var Label = dt.label`
|
|
@@ -15256,19 +15506,26 @@ var Input2 = dt.input`
|
|
|
15256
15506
|
|
|
15257
15507
|
// src/components/shared/payment-form/PaymentForm.tsx
|
|
15258
15508
|
import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
15259
|
-
var PaymentForm = ({ onConfirm }) => {
|
|
15509
|
+
var PaymentForm = ({ onConfirm, financeData }) => {
|
|
15260
15510
|
const { t: t2 } = useTranslation();
|
|
15261
15511
|
const stripe = useStripe();
|
|
15262
15512
|
const elements = useElements();
|
|
15263
15513
|
const { data } = useEmbed();
|
|
15264
|
-
const [email, setEmail] =
|
|
15265
|
-
const [message, setMessage] =
|
|
15266
|
-
const [isLoading, setIsLoading] =
|
|
15267
|
-
const [isConfirmed, setIsConfirmed] =
|
|
15268
|
-
const [isPaymentComplete, setIsPaymentComplete] =
|
|
15269
|
-
const [isAddressComplete, setIsAddressComplete] =
|
|
15270
|
-
(
|
|
15271
|
-
|
|
15514
|
+
const [email, setEmail] = useState11("");
|
|
15515
|
+
const [message, setMessage] = useState11();
|
|
15516
|
+
const [isLoading, setIsLoading] = useState11(false);
|
|
15517
|
+
const [isConfirmed, setIsConfirmed] = useState11(false);
|
|
15518
|
+
const [isPaymentComplete, setIsPaymentComplete] = useState11(false);
|
|
15519
|
+
const [isAddressComplete, setIsAddressComplete] = useState11(() => {
|
|
15520
|
+
if (!isCheckoutData(data)) {
|
|
15521
|
+
return true;
|
|
15522
|
+
}
|
|
15523
|
+
const shouldCollectAddress = shouldCollectBillingAddress(
|
|
15524
|
+
data.checkoutSettings.collectAddress,
|
|
15525
|
+
financeData
|
|
15526
|
+
);
|
|
15527
|
+
return !shouldCollectAddress;
|
|
15528
|
+
});
|
|
15272
15529
|
const handleSubmit = async (event) => {
|
|
15273
15530
|
event.preventDefault();
|
|
15274
15531
|
if (!stripe || !elements) {
|
|
@@ -15337,7 +15594,10 @@ var PaymentForm = ({ onConfirm }) => {
|
|
|
15337
15594
|
}
|
|
15338
15595
|
)
|
|
15339
15596
|
] }),
|
|
15340
|
-
isCheckoutData(data) && (
|
|
15597
|
+
isCheckoutData(data) && (shouldCollectBillingAddress(
|
|
15598
|
+
data.checkoutSettings.collectAddress,
|
|
15599
|
+
financeData
|
|
15600
|
+
) || data.checkoutSettings.collectPhone) && /* @__PURE__ */ jsx23(Box, { $marginBottom: "3.5rem", children: /* @__PURE__ */ jsx23(
|
|
15341
15601
|
AddressElement,
|
|
15342
15602
|
{
|
|
15343
15603
|
options: {
|
|
@@ -15665,14 +15925,14 @@ var TieredPricingDetails = ({
|
|
|
15665
15925
|
};
|
|
15666
15926
|
|
|
15667
15927
|
// src/components/shared/unsubscribe-dialog/UnsubscribeDialog.tsx
|
|
15668
|
-
import { useMemo as useMemo14, useRef as
|
|
15928
|
+
import { useMemo as useMemo14, useRef as useRef9, useState as useState12 } from "react";
|
|
15669
15929
|
import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
15670
15930
|
var UnsubscribeDialog = ({ top = 0 }) => {
|
|
15671
15931
|
const { t: t2 } = useTranslation();
|
|
15672
15932
|
const { data, setCheckoutState } = useEmbed();
|
|
15673
|
-
const contentRef =
|
|
15674
|
-
const [error, setError] =
|
|
15675
|
-
const [isLoading, setIsLoading] =
|
|
15933
|
+
const contentRef = useRef9(null);
|
|
15934
|
+
const [error, setError] = useState12();
|
|
15935
|
+
const [isLoading, setIsLoading] = useState12(false);
|
|
15676
15936
|
const { planPeriod, currentPlan, currentAddOns, featureUsage, cancelDate } = useMemo14(() => {
|
|
15677
15937
|
if (isCheckoutData(data)) {
|
|
15678
15938
|
return {
|
|
@@ -15779,7 +16039,9 @@ var UnsubscribeDialog = ({ top = 0 }) => {
|
|
|
15779
16039
|
isPaymentMethodRequired: false,
|
|
15780
16040
|
showHeader: false,
|
|
15781
16041
|
setError: (msg) => setError(msg),
|
|
15782
|
-
setIsLoading
|
|
16042
|
+
setIsLoading,
|
|
16043
|
+
setConfirmPaymentIntent: () => {
|
|
16044
|
+
}
|
|
15783
16045
|
}
|
|
15784
16046
|
)
|
|
15785
16047
|
]
|
|
@@ -15945,7 +16207,7 @@ import { Fragment as Fragment12, jsx as jsx30, jsxs as jsxs24 } from "react/jsx-
|
|
|
15945
16207
|
var Viewport = forwardRef5(
|
|
15946
16208
|
({ children, portal, ...props }, ref) => {
|
|
15947
16209
|
const { data, layout, settings } = useEmbed();
|
|
15948
|
-
const [top, setTop] =
|
|
16210
|
+
const [top, setTop] = useState13(0);
|
|
15949
16211
|
const { canCheckout, isBadgeVisible } = useMemo15(() => {
|
|
15950
16212
|
return {
|
|
15951
16213
|
canCheckout: data?.capabilities?.checkout ?? true,
|
|
@@ -16044,7 +16306,7 @@ var ButtonElement = forwardRef6(({ children, className, ...rest }, ref) => {
|
|
|
16044
16306
|
ButtonElement.displayName = "Button";
|
|
16045
16307
|
|
|
16046
16308
|
// src/components/elements/included-features/IncludedFeatures.tsx
|
|
16047
|
-
import { forwardRef as forwardRef7, useMemo as useMemo17, useRef as
|
|
16309
|
+
import { forwardRef as forwardRef7, useMemo as useMemo17, useRef as useRef10, useState as useState14 } from "react";
|
|
16048
16310
|
|
|
16049
16311
|
// src/components/elements/included-features/UsageDetails.tsx
|
|
16050
16312
|
import { Fragment as Fragment13, useMemo as useMemo16 } from "react";
|
|
@@ -16297,10 +16559,10 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
|
|
|
16297
16559
|
const props = resolveDesignProps2(rest);
|
|
16298
16560
|
const { t: t2 } = useTranslation();
|
|
16299
16561
|
const { data, settings } = useEmbed();
|
|
16300
|
-
const elements =
|
|
16562
|
+
const elements = useRef10([]);
|
|
16301
16563
|
const shouldWrapChildren = useWrapChildren(elements.current);
|
|
16302
16564
|
const isLightBackground = useIsLightBackground();
|
|
16303
|
-
const [showCount, setShowCount] =
|
|
16565
|
+
const [showCount, setShowCount] = useState14(VISIBLE_ENTITLEMENT_COUNT);
|
|
16304
16566
|
const { plan, addOns, featureUsage } = useMemo17(() => {
|
|
16305
16567
|
if (isCheckoutData(data)) {
|
|
16306
16568
|
const orderedFeatureUsage = props.visibleFeatures?.reduce(
|
|
@@ -16437,7 +16699,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
|
|
|
16437
16699
|
IncludedFeatures.displayName = "IncludedFeatures";
|
|
16438
16700
|
|
|
16439
16701
|
// src/components/elements/invoices/Invoices.tsx
|
|
16440
|
-
import { forwardRef as forwardRef8, useCallback as
|
|
16702
|
+
import { forwardRef as forwardRef8, useCallback as useCallback11, useEffect as useEffect7, useState as useState15 } from "react";
|
|
16441
16703
|
import { Fragment as Fragment15, jsx as jsx34, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
16442
16704
|
function resolveDesignProps3(props) {
|
|
16443
16705
|
return {
|
|
@@ -16476,11 +16738,11 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
|
|
|
16476
16738
|
const props = resolveDesignProps3(rest);
|
|
16477
16739
|
const { t: t2 } = useTranslation();
|
|
16478
16740
|
const { listInvoices, settings } = useEmbed();
|
|
16479
|
-
const [isLoading, setIsLoading] =
|
|
16480
|
-
const [error, setError] =
|
|
16481
|
-
const [invoices, setInvoices] =
|
|
16482
|
-
const [listSize, setListSize] =
|
|
16483
|
-
const getInvoices =
|
|
16741
|
+
const [isLoading, setIsLoading] = useState15(false);
|
|
16742
|
+
const [error, setError] = useState15();
|
|
16743
|
+
const [invoices, setInvoices] = useState15(() => formatInvoices(data));
|
|
16744
|
+
const [listSize, setListSize] = useState15(props.limit.number);
|
|
16745
|
+
const getInvoices = useCallback11(async () => {
|
|
16484
16746
|
try {
|
|
16485
16747
|
setError(void 0);
|
|
16486
16748
|
setIsLoading(true);
|
|
@@ -16499,10 +16761,10 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
|
|
|
16499
16761
|
(prev2) => prev2 !== props.limit.number ? props.limit.number : MAX_VISIBLE_INVOICE_COUNT
|
|
16500
16762
|
);
|
|
16501
16763
|
};
|
|
16502
|
-
|
|
16764
|
+
useEffect7(() => {
|
|
16503
16765
|
getInvoices();
|
|
16504
16766
|
}, [getInvoices]);
|
|
16505
|
-
|
|
16767
|
+
useEffect7(() => {
|
|
16506
16768
|
setInvoices(formatInvoices(data));
|
|
16507
16769
|
}, [data]);
|
|
16508
16770
|
if (invoices.length === 0) {
|
|
@@ -16582,7 +16844,7 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
|
|
|
16582
16844
|
Invoices.displayName = "Invoices";
|
|
16583
16845
|
|
|
16584
16846
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
16585
|
-
import { forwardRef as forwardRef9, useCallback as
|
|
16847
|
+
import { forwardRef as forwardRef9, useCallback as useCallback12, useMemo as useMemo18, useRef as useRef11, useState as useState16 } from "react";
|
|
16586
16848
|
|
|
16587
16849
|
// src/components/elements/metered-features/Meter.tsx
|
|
16588
16850
|
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
@@ -16782,7 +17044,7 @@ function resolveDesignProps4(props) {
|
|
|
16782
17044
|
}
|
|
16783
17045
|
var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
16784
17046
|
const props = resolveDesignProps4(rest);
|
|
16785
|
-
const elements =
|
|
17047
|
+
const elements = useRef11([]);
|
|
16786
17048
|
const shouldWrapChildren = useWrapChildren(elements.current);
|
|
16787
17049
|
const { t: t2 } = useTranslation();
|
|
16788
17050
|
const { data, settings, setCheckoutState } = useEmbed();
|
|
@@ -16821,10 +17083,10 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
16821
17083
|
creditGroups: []
|
|
16822
17084
|
};
|
|
16823
17085
|
}, [props.visibleFeatures, data]);
|
|
16824
|
-
const [creditVisibility, setCreditVisibility] =
|
|
17086
|
+
const [creditVisibility, setCreditVisibility] = useState16(
|
|
16825
17087
|
creditGroups.map(({ id }) => ({ id, isExpanded: false }))
|
|
16826
17088
|
);
|
|
16827
|
-
const toggleBalanceDetails =
|
|
17089
|
+
const toggleBalanceDetails = useCallback12((id) => {
|
|
16828
17090
|
setCreditVisibility(
|
|
16829
17091
|
(prev2) => prev2.map(
|
|
16830
17092
|
(item) => item.id === id ? { ...item, isExpanded: !item.isExpanded } : item
|
|
@@ -17497,7 +17759,7 @@ var loadStripe = function loadStripe2() {
|
|
|
17497
17759
|
};
|
|
17498
17760
|
|
|
17499
17761
|
// src/components/elements/payment-method/PaymentMethodDetails.tsx
|
|
17500
|
-
import { useCallback as
|
|
17762
|
+
import { useCallback as useCallback13, useEffect as useEffect8, useMemo as useMemo21, useState as useState17 } from "react";
|
|
17501
17763
|
import { jsx as jsx40, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
17502
17764
|
var resolveDesignProps6 = () => {
|
|
17503
17765
|
return {
|
|
@@ -17512,7 +17774,10 @@ var resolveDesignProps6 = () => {
|
|
|
17512
17774
|
};
|
|
17513
17775
|
};
|
|
17514
17776
|
var PaymentMethodDetails = ({
|
|
17515
|
-
setPaymentMethodId
|
|
17777
|
+
setPaymentMethodId,
|
|
17778
|
+
confirmPaymentIntentProps,
|
|
17779
|
+
financeData,
|
|
17780
|
+
onPaymentMethodSaved
|
|
17516
17781
|
}) => {
|
|
17517
17782
|
const props = resolveDesignProps6();
|
|
17518
17783
|
const { t: t2 } = useTranslation();
|
|
@@ -17538,13 +17803,25 @@ var PaymentMethodDetails = ({
|
|
|
17538
17803
|
};
|
|
17539
17804
|
}, [data]);
|
|
17540
17805
|
const isLightBackground = useIsLightBackground();
|
|
17541
|
-
const [isLoading, setIsLoading] =
|
|
17542
|
-
const [error, setError] =
|
|
17543
|
-
const [showPaymentForm, setShowPaymentForm] =
|
|
17544
|
-
const [stripe, setStripe] =
|
|
17545
|
-
const [setupIntent, setSetupIntent] =
|
|
17546
|
-
const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] =
|
|
17547
|
-
const [currentPaymentMethod, setCurrentPaymentMethod] =
|
|
17806
|
+
const [isLoading, setIsLoading] = useState17(false);
|
|
17807
|
+
const [error, setError] = useState17();
|
|
17808
|
+
const [showPaymentForm, setShowPaymentForm] = useState17(false);
|
|
17809
|
+
const [stripe, setStripe] = useState17(null);
|
|
17810
|
+
const [setupIntent, setSetupIntent] = useState17();
|
|
17811
|
+
const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = useState17(false);
|
|
17812
|
+
const [currentPaymentMethod, setCurrentPaymentMethod] = useState17(subscription?.paymentMethod || defaultPaymentMethod);
|
|
17813
|
+
const { isConfirming: isConfirmingPayment } = usePaymentConfirmation({
|
|
17814
|
+
stripe,
|
|
17815
|
+
clientSecret: confirmPaymentIntentProps?.clientSecret,
|
|
17816
|
+
onSuccess: () => {
|
|
17817
|
+
confirmPaymentIntentProps?.callback(true);
|
|
17818
|
+
},
|
|
17819
|
+
onError: (error2) => {
|
|
17820
|
+
console.error("Payment confirmation error:", error2);
|
|
17821
|
+
confirmPaymentIntentProps?.callback(false);
|
|
17822
|
+
},
|
|
17823
|
+
autoConfirm: true
|
|
17824
|
+
});
|
|
17548
17825
|
const monthsToExpiration = useMemo21(() => {
|
|
17549
17826
|
let expiration;
|
|
17550
17827
|
if (typeof currentPaymentMethod?.cardExpYear === "number" && typeof currentPaymentMethod?.cardExpMonth === "number") {
|
|
@@ -17568,7 +17845,7 @@ var PaymentMethodDetails = ({
|
|
|
17568
17845
|
const toggleShowPaymentMethods = () => {
|
|
17569
17846
|
setShowDifferentPaymentMethods((prev2) => !prev2);
|
|
17570
17847
|
};
|
|
17571
|
-
const initializePaymentMethod =
|
|
17848
|
+
const initializePaymentMethod = useCallback13(async () => {
|
|
17572
17849
|
try {
|
|
17573
17850
|
setIsLoading(true);
|
|
17574
17851
|
const response = await createSetupIntent();
|
|
@@ -17584,7 +17861,7 @@ var PaymentMethodDetails = ({
|
|
|
17584
17861
|
setIsLoading(false);
|
|
17585
17862
|
}
|
|
17586
17863
|
}, [t2, createSetupIntent]);
|
|
17587
|
-
const handleUpdatePaymentMethod =
|
|
17864
|
+
const handleUpdatePaymentMethod = useCallback13(
|
|
17588
17865
|
async (paymentMethodId) => {
|
|
17589
17866
|
try {
|
|
17590
17867
|
setIsLoading(true);
|
|
@@ -17594,6 +17871,9 @@ var PaymentMethodDetails = ({
|
|
|
17594
17871
|
if (setPaymentMethodId) {
|
|
17595
17872
|
setPaymentMethodId(response.data.externalId);
|
|
17596
17873
|
}
|
|
17874
|
+
if (onPaymentMethodSaved) {
|
|
17875
|
+
onPaymentMethodSaved({});
|
|
17876
|
+
}
|
|
17597
17877
|
}
|
|
17598
17878
|
} catch {
|
|
17599
17879
|
setError(t2("Error updating payment method. Please try again."));
|
|
@@ -17601,9 +17881,9 @@ var PaymentMethodDetails = ({
|
|
|
17601
17881
|
setIsLoading(false);
|
|
17602
17882
|
}
|
|
17603
17883
|
},
|
|
17604
|
-
[t2, setPaymentMethodId, updatePaymentMethod]
|
|
17884
|
+
[t2, setPaymentMethodId, updatePaymentMethod, onPaymentMethodSaved]
|
|
17605
17885
|
);
|
|
17606
|
-
const handleDeletePaymentMethod =
|
|
17886
|
+
const handleDeletePaymentMethod = useCallback13(
|
|
17607
17887
|
async (paymentMethodId) => {
|
|
17608
17888
|
try {
|
|
17609
17889
|
setIsLoading(true);
|
|
@@ -17616,7 +17896,7 @@ var PaymentMethodDetails = ({
|
|
|
17616
17896
|
},
|
|
17617
17897
|
[t2, deletePaymentMethod]
|
|
17618
17898
|
);
|
|
17619
|
-
|
|
17899
|
+
useEffect8(() => {
|
|
17620
17900
|
if (!stripe && setupIntent) {
|
|
17621
17901
|
let publishableKey = setupIntent.publishableKey || setupIntent.schematicPublishableKey;
|
|
17622
17902
|
const stripeOptions = {};
|
|
@@ -17624,10 +17904,11 @@ var PaymentMethodDetails = ({
|
|
|
17624
17904
|
publishableKey = setupIntent.schematicPublishableKey;
|
|
17625
17905
|
stripeOptions.stripeAccount = setupIntent.accountId;
|
|
17626
17906
|
}
|
|
17627
|
-
|
|
17907
|
+
const stripePromise2 = loadStripe(publishableKey, stripeOptions);
|
|
17908
|
+
setStripe(stripePromise2);
|
|
17628
17909
|
}
|
|
17629
17910
|
}, [stripe, setupIntent]);
|
|
17630
|
-
|
|
17911
|
+
useEffect8(() => {
|
|
17631
17912
|
if (!setupIntent && (!currentPaymentMethod || showPaymentForm)) {
|
|
17632
17913
|
initializePaymentMethod();
|
|
17633
17914
|
}
|
|
@@ -17642,7 +17923,7 @@ var PaymentMethodDetails = ({
|
|
|
17642
17923
|
Flex,
|
|
17643
17924
|
{
|
|
17644
17925
|
$position: "absolute",
|
|
17645
|
-
$zIndex: isLoading ? 1 : 0,
|
|
17926
|
+
$zIndex: isLoading || isConfirmingPayment ? 1 : 0,
|
|
17646
17927
|
$justifyContent: "center",
|
|
17647
17928
|
$alignItems: "center",
|
|
17648
17929
|
$width: "100%",
|
|
@@ -17652,7 +17933,7 @@ var PaymentMethodDetails = ({
|
|
|
17652
17933
|
{
|
|
17653
17934
|
$color: settings.theme.primary,
|
|
17654
17935
|
$size: "2xl",
|
|
17655
|
-
$isLoading: isLoading
|
|
17936
|
+
$isLoading: isLoading || isConfirmingPayment
|
|
17656
17937
|
}
|
|
17657
17938
|
)
|
|
17658
17939
|
}
|
|
@@ -17661,16 +17942,16 @@ var PaymentMethodDetails = ({
|
|
|
17661
17942
|
Flex,
|
|
17662
17943
|
{
|
|
17663
17944
|
$position: "relative",
|
|
17664
|
-
$zIndex: isLoading ? 0 : 1,
|
|
17945
|
+
$zIndex: isLoading || isConfirmingPayment ? 0 : 1,
|
|
17665
17946
|
$flexDirection: "column",
|
|
17666
17947
|
$flexGrow: 1,
|
|
17667
17948
|
$gap: "1rem",
|
|
17668
17949
|
$overflow: "auto",
|
|
17669
17950
|
$padding: "2rem 2.5rem 2rem 2.5rem",
|
|
17670
|
-
$visibility: isLoading ? "hidden" : "visible",
|
|
17951
|
+
$visibility: isLoading || isConfirmingPayment ? "hidden" : "visible",
|
|
17671
17952
|
$backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.025)" : "hsla(0, 0%, 100%, 0.025)",
|
|
17672
17953
|
children: [
|
|
17673
|
-
setupIntent && showPaymentForm ? /* @__PURE__ */ jsxs31(
|
|
17954
|
+
setupIntent && showPaymentForm && stripe ? /* @__PURE__ */ jsxs31(
|
|
17674
17955
|
Elements,
|
|
17675
17956
|
{
|
|
17676
17957
|
stripe,
|
|
@@ -17703,6 +17984,7 @@ var PaymentMethodDetails = ({
|
|
|
17703
17984
|
/* @__PURE__ */ jsx40(
|
|
17704
17985
|
PaymentForm,
|
|
17705
17986
|
{
|
|
17987
|
+
financeData,
|
|
17706
17988
|
onConfirm: async (paymentMethodId) => {
|
|
17707
17989
|
await handleUpdatePaymentMethod(paymentMethodId);
|
|
17708
17990
|
setShowPaymentForm(false);
|
|
@@ -17984,7 +18266,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
17984
18266
|
creditGroups,
|
|
17985
18267
|
billingSubscription,
|
|
17986
18268
|
canCheckout,
|
|
17987
|
-
|
|
18269
|
+
postTrialPlan,
|
|
17988
18270
|
featureUsage,
|
|
17989
18271
|
showZeroPriceAsFree,
|
|
17990
18272
|
trialPaymentMethodRequired
|
|
@@ -17995,7 +18277,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
17995
18277
|
creditBundles: creditBundles2,
|
|
17996
18278
|
creditGrants,
|
|
17997
18279
|
capabilities,
|
|
17998
|
-
|
|
18280
|
+
postTrialPlan: postTrialPlan2,
|
|
17999
18281
|
featureUsage: featureUsage2,
|
|
18000
18282
|
showZeroPriceAsFree: showZeroPriceAsFree2,
|
|
18001
18283
|
trialPaymentMethodRequired: trialPaymentMethodRequired2
|
|
@@ -18025,7 +18307,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18025
18307
|
creditGroups: creditGroups2,
|
|
18026
18308
|
billingSubscription: company?.billingSubscription,
|
|
18027
18309
|
canCheckout: capabilities?.checkout ?? true,
|
|
18028
|
-
|
|
18310
|
+
postTrialPlan: postTrialPlan2,
|
|
18029
18311
|
featureUsage: featureUsage2?.features || [],
|
|
18030
18312
|
showZeroPriceAsFree: showZeroPriceAsFree2,
|
|
18031
18313
|
trialPaymentMethodRequired: trialPaymentMethodRequired2
|
|
@@ -18038,7 +18320,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18038
18320
|
creditGroups: { plan: [], bundles: [], promotional: [] },
|
|
18039
18321
|
billingSubscription: void 0,
|
|
18040
18322
|
canCheckout: false,
|
|
18041
|
-
|
|
18323
|
+
postTrialPlan: void 0,
|
|
18042
18324
|
featureUsage: [],
|
|
18043
18325
|
showZeroPriceAsFree: false,
|
|
18044
18326
|
trialPaymentMethodRequired: false
|
|
@@ -18079,8 +18361,8 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18079
18361
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
18080
18362
|
children: [
|
|
18081
18363
|
typeof trialEnd.formatted !== "undefined" && /* @__PURE__ */ jsx43(Text, { as: "h3", display: "heading3", children: trialEnd.formatted }),
|
|
18082
|
-
/* @__PURE__ */ jsx43(Text, { as: "p", $size: 0.8125 * settings.theme.typography.text.fontSize, children: trialPaymentMethodRequired ? t2("After the trial, subscribe") :
|
|
18083
|
-
|
|
18364
|
+
/* @__PURE__ */ jsx43(Text, { as: "p", $size: 0.8125 * settings.theme.typography.text.fontSize, children: trialPaymentMethodRequired ? t2("After the trial, subscribe") : postTrialPlan ? t2("After the trial, cancel", {
|
|
18365
|
+
postTrialPlanName: postTrialPlan?.name
|
|
18084
18366
|
}) : t2("After the trial, cancel no default", {
|
|
18085
18367
|
planName: currentPlan?.name
|
|
18086
18368
|
}) })
|
|
@@ -18368,9 +18650,9 @@ PlanManager.displayName = "PlanManager";
|
|
|
18368
18650
|
import {
|
|
18369
18651
|
Fragment as Fragment24,
|
|
18370
18652
|
forwardRef as forwardRef12,
|
|
18371
|
-
useEffect as
|
|
18653
|
+
useEffect as useEffect9,
|
|
18372
18654
|
useMemo as useMemo26,
|
|
18373
|
-
useState as
|
|
18655
|
+
useState as useState18
|
|
18374
18656
|
} from "react";
|
|
18375
18657
|
|
|
18376
18658
|
// src/components/elements/pricing-table/AddOn.tsx
|
|
@@ -19081,11 +19363,11 @@ var PricingTable = forwardRef12(
|
|
|
19081
19363
|
isStandalone: true
|
|
19082
19364
|
};
|
|
19083
19365
|
}, [props.showPeriodToggle, data]);
|
|
19084
|
-
const [selectedPeriod, setSelectedPeriod] =
|
|
19366
|
+
const [selectedPeriod, setSelectedPeriod] = useState18(currentPeriod);
|
|
19085
19367
|
const { plans, addOns, periods } = useAvailablePlans(selectedPeriod, {
|
|
19086
19368
|
useSelectedPeriod: showPeriodToggle
|
|
19087
19369
|
});
|
|
19088
|
-
const [entitlementCounts, setEntitlementCounts] =
|
|
19370
|
+
const [entitlementCounts, setEntitlementCounts] = useState18(
|
|
19089
19371
|
() => plans.reduce(entitlementCountsReducer, {})
|
|
19090
19372
|
);
|
|
19091
19373
|
const handleToggleShowAll = (id) => {
|
|
@@ -19103,12 +19385,12 @@ var PricingTable = forwardRef12(
|
|
|
19103
19385
|
return prev2;
|
|
19104
19386
|
});
|
|
19105
19387
|
};
|
|
19106
|
-
|
|
19388
|
+
useEffect9(() => {
|
|
19107
19389
|
if (isStandalone) {
|
|
19108
19390
|
hydratePublic();
|
|
19109
19391
|
}
|
|
19110
19392
|
}, [isStandalone, hydratePublic]);
|
|
19111
|
-
|
|
19393
|
+
useEffect9(() => {
|
|
19112
19394
|
setEntitlementCounts(plans.reduce(entitlementCountsReducer, {}));
|
|
19113
19395
|
}, [plans]);
|
|
19114
19396
|
if (isPending) {
|
|
@@ -19332,7 +19614,7 @@ var UnsubscribeButton = forwardRef14(({ children, className, ...rest }, ref) =>
|
|
|
19332
19614
|
UnsubscribeButton.displayName = "UnsubscribeButton";
|
|
19333
19615
|
|
|
19334
19616
|
// src/components/elements/upcoming-bill/UpcomingBill.tsx
|
|
19335
|
-
import { forwardRef as forwardRef15, useCallback as
|
|
19617
|
+
import { forwardRef as forwardRef15, useCallback as useCallback14, useEffect as useEffect10, useMemo as useMemo28, useState as useState19 } from "react";
|
|
19336
19618
|
import { jsx as jsx50, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
19337
19619
|
function resolveDesignProps11(props) {
|
|
19338
19620
|
return {
|
|
@@ -19357,10 +19639,10 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
19357
19639
|
const { t: t2 } = useTranslation();
|
|
19358
19640
|
const { data, settings, debug, getUpcomingInvoice, getCustomerBalance } = useEmbed();
|
|
19359
19641
|
const isLightBackground = useIsLightBackground();
|
|
19360
|
-
const [isLoading, setIsLoading] =
|
|
19361
|
-
const [error, setError] =
|
|
19362
|
-
const [upcomingInvoice, setUpcomingInvoice] =
|
|
19363
|
-
const [balances, setBalances] =
|
|
19642
|
+
const [isLoading, setIsLoading] = useState19(false);
|
|
19643
|
+
const [error, setError] = useState19();
|
|
19644
|
+
const [upcomingInvoice, setUpcomingInvoice] = useState19();
|
|
19645
|
+
const [balances, setBalances] = useState19([]);
|
|
19364
19646
|
const discounts = useMemo28(() => {
|
|
19365
19647
|
return (isCheckoutData(data) && data.subscription?.discounts || []).map(
|
|
19366
19648
|
(discount) => ({
|
|
@@ -19373,7 +19655,7 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
19373
19655
|
})
|
|
19374
19656
|
);
|
|
19375
19657
|
}, [data]);
|
|
19376
|
-
const getInvoice =
|
|
19658
|
+
const getInvoice = useCallback14(async () => {
|
|
19377
19659
|
if (isCheckoutData(data) && data.component?.id && data.subscription && !data.subscription.cancelAt) {
|
|
19378
19660
|
try {
|
|
19379
19661
|
setError(void 0);
|
|
@@ -19389,7 +19671,7 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
19389
19671
|
}
|
|
19390
19672
|
}
|
|
19391
19673
|
}, [data, getUpcomingInvoice]);
|
|
19392
|
-
const getBalances =
|
|
19674
|
+
const getBalances = useCallback14(async () => {
|
|
19393
19675
|
try {
|
|
19394
19676
|
const response = await getCustomerBalance();
|
|
19395
19677
|
if (response) {
|
|
@@ -19399,10 +19681,10 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
19399
19681
|
debug("Failed to fetch customer balance.", err2);
|
|
19400
19682
|
}
|
|
19401
19683
|
}, [debug, getCustomerBalance]);
|
|
19402
|
-
|
|
19684
|
+
useEffect10(() => {
|
|
19403
19685
|
getInvoice();
|
|
19404
19686
|
}, [getInvoice]);
|
|
19405
|
-
|
|
19687
|
+
useEffect10(() => {
|
|
19406
19688
|
getBalances();
|
|
19407
19689
|
}, [getBalances]);
|
|
19408
19690
|
if (!isCheckoutData(data) || !data.subscription || data.subscription.cancelAt) {
|
|
@@ -23714,7 +23996,7 @@ var { Inflate, inflate, inflateRaw, ungzip } = inflate_1$1;
|
|
|
23714
23996
|
var inflate_1 = inflate;
|
|
23715
23997
|
|
|
23716
23998
|
// src/components/embed/Embed.tsx
|
|
23717
|
-
import { useContext as useContext5, useEffect as
|
|
23999
|
+
import { useContext as useContext5, useEffect as useEffect11, useState as useState20 } from "react";
|
|
23718
24000
|
|
|
23719
24001
|
// src/components/embed/renderer.ts
|
|
23720
24002
|
import { createElement as createElement5 } from "react";
|
|
@@ -23829,7 +24111,7 @@ var Error2 = ({ message }) => {
|
|
|
23829
24111
|
);
|
|
23830
24112
|
};
|
|
23831
24113
|
var SchematicEmbed = ({ id, accessToken }) => {
|
|
23832
|
-
const [children, setChildren] =
|
|
24114
|
+
const [children, setChildren] = useState20(/* @__PURE__ */ jsx51(Loading, {}));
|
|
23833
24115
|
const theme = useContext5(et);
|
|
23834
24116
|
const {
|
|
23835
24117
|
data,
|
|
@@ -23841,17 +24123,17 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
23841
24123
|
setAccessToken,
|
|
23842
24124
|
updateSettings
|
|
23843
24125
|
} = useEmbed();
|
|
23844
|
-
|
|
24126
|
+
useEffect11(() => {
|
|
23845
24127
|
if (accessToken) {
|
|
23846
24128
|
setAccessToken(accessToken);
|
|
23847
24129
|
}
|
|
23848
24130
|
}, [accessToken, setAccessToken]);
|
|
23849
|
-
|
|
24131
|
+
useEffect11(() => {
|
|
23850
24132
|
if (id && stale) {
|
|
23851
24133
|
hydrateComponent(id);
|
|
23852
24134
|
}
|
|
23853
24135
|
}, [id, hydrateComponent, stale]);
|
|
23854
|
-
|
|
24136
|
+
useEffect11(() => {
|
|
23855
24137
|
const renderer = createRenderer();
|
|
23856
24138
|
try {
|
|
23857
24139
|
if (isCheckoutData(data) && data.component?.ast) {
|
|
@@ -23948,6 +24230,7 @@ export {
|
|
|
23948
24230
|
useAvailablePlans,
|
|
23949
24231
|
useEmbed,
|
|
23950
24232
|
useIsLightBackground,
|
|
24233
|
+
usePaymentConfirmation,
|
|
23951
24234
|
usePrevious2 as usePrevious,
|
|
23952
24235
|
useRequest,
|
|
23953
24236
|
useTrialEnd,
|