@schematichq/schematic-components 2.9.0-rc.3 → 2.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1821,7 +1821,7 @@ __export(index_exports, {
1821
1821
  Credits: () => Credits,
1822
1822
  Dialog: () => Dialog2,
1823
1823
  DialogClose: () => DialogClose,
1824
- DialogContent: () => DialogContent,
1824
+ DialogContent: () => DialogContent2,
1825
1825
  DialogHeader: () => DialogHeader,
1826
1826
  Element: () => Element,
1827
1827
  EmbedContext: () => EmbedContext,
@@ -5134,6 +5134,7 @@ var en_default = {
5134
5134
  "Try again": "Try again",
5135
5135
  Unlimited: "Unlimited {{item}}",
5136
5136
  "Unlimited in this tier": "Unlimited {{feature}} in this tier",
5137
+ "Unable to load payment form.": "Unable to load payment form. Your browser's security or privacy settings may be blocking it. Please try a different browser or adjust your privacy settings.",
5137
5138
  "Unsubscribe failed": "Unsubscribe failed",
5138
5139
  Unsubscribe: "Unsubscribe",
5139
5140
  "Unused time": "Unused time",
@@ -7525,6 +7526,21 @@ function BillingCreditViewFromJSONTyped(json, ignoreDiscriminator) {
7525
7526
  };
7526
7527
  }
7527
7528
 
7529
+ // src/api/checkoutexternal/models/BillingLinkedResourceResponseData.ts
7530
+ function BillingLinkedResourceResponseDataFromJSON(json) {
7531
+ return BillingLinkedResourceResponseDataFromJSONTyped(json, false);
7532
+ }
7533
+ function BillingLinkedResourceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
7534
+ if (json == null) {
7535
+ return json;
7536
+ }
7537
+ return {
7538
+ billingProvider: BillingProviderTypeFromJSON(json["billing_provider"]),
7539
+ externalResourceId: json["external_resource_id"],
7540
+ originator: BillingProviderTypeFromJSON(json["originator"])
7541
+ };
7542
+ }
7543
+
7528
7544
  // src/api/checkoutexternal/models/BillingPlanCreditGrantResetCadence.ts
7529
7545
  var BillingPlanCreditGrantResetCadence = {
7530
7546
  Daily: "daily",
@@ -8677,6 +8693,9 @@ function FeatureDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8677
8693
  return json;
8678
8694
  }
8679
8695
  return {
8696
+ billingLinkedResource: json["billing_linked_resource"] == null ? void 0 : BillingLinkedResourceResponseDataFromJSON(
8697
+ json["billing_linked_resource"]
8698
+ ),
8680
8699
  createdAt: new Date(json["created_at"]),
8681
8700
  description: json["description"],
8682
8701
  eventSubtype: json["event_subtype"] == null ? void 0 : json["event_subtype"],
@@ -8780,6 +8799,9 @@ function PlanEntitlementResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8780
8799
  return json;
8781
8800
  }
8782
8801
  return {
8802
+ billingLinkedResource: json["billing_linked_resource"] == null ? void 0 : BillingLinkedResourceResponseDataFromJSON(
8803
+ json["billing_linked_resource"]
8804
+ ),
8783
8805
  billingThreshold: json["billing_threshold"] == null ? void 0 : json["billing_threshold"],
8784
8806
  consumptionRate: json["consumption_rate"] == null ? void 0 : json["consumption_rate"],
8785
8807
  createdAt: new Date(json["created_at"]),
@@ -8972,6 +8994,9 @@ function CompanyPlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8972
8994
  return {
8973
8995
  activeVersion: json["active_version"] == null ? void 0 : PlanVersionResponseDataFromJSON(json["active_version"]),
8974
8996
  audienceType: json["audience_type"] == null ? void 0 : json["audience_type"],
8997
+ billingLinkedResource: json["billing_linked_resource"] == null ? void 0 : BillingLinkedResourceResponseDataFromJSON(
8998
+ json["billing_linked_resource"]
8999
+ ),
8975
9000
  billingProduct: json["billing_product"] == null ? void 0 : BillingProductDetailResponseDataFromJSON(json["billing_product"]),
8976
9001
  chargeType: ChargeTypeFromJSON(json["charge_type"]),
8977
9002
  companyCanTrial: json["company_can_trial"],
@@ -9131,6 +9156,9 @@ function PlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
9131
9156
  return {
9132
9157
  activeVersion: json["active_version"] == null ? void 0 : PlanVersionResponseDataFromJSON(json["active_version"]),
9133
9158
  audienceType: json["audience_type"] == null ? void 0 : json["audience_type"],
9159
+ billingLinkedResource: json["billing_linked_resource"] == null ? void 0 : BillingLinkedResourceResponseDataFromJSON(
9160
+ json["billing_linked_resource"]
9161
+ ),
9134
9162
  billingProduct: json["billing_product"] == null ? void 0 : BillingProductDetailResponseDataFromJSON(json["billing_product"]),
9135
9163
  chargeType: ChargeTypeFromJSON(json["charge_type"]),
9136
9164
  companyCount: json["company_count"],
@@ -10382,9 +10410,9 @@ function BillingProductPriceIntervalFromJSONTyped5(json, ignoreDiscriminator) {
10382
10410
 
10383
10411
  // src/api/componentspublic/models/BillingProviderType.ts
10384
10412
  function BillingProviderTypeFromJSON2(json) {
10385
- return BillingProviderTypeFromJSONTyped13(json, false);
10413
+ return BillingProviderTypeFromJSONTyped14(json, false);
10386
10414
  }
10387
- function BillingProviderTypeFromJSONTyped13(json, ignoreDiscriminator) {
10415
+ function BillingProviderTypeFromJSONTyped14(json, ignoreDiscriminator) {
10388
10416
  return json;
10389
10417
  }
10390
10418
 
@@ -10600,6 +10628,21 @@ function BillingCreditViewFromJSONTyped3(json, ignoreDiscriminator) {
10600
10628
  };
10601
10629
  }
10602
10630
 
10631
+ // src/api/componentspublic/models/BillingLinkedResourceResponseData.ts
10632
+ function BillingLinkedResourceResponseDataFromJSON2(json) {
10633
+ return BillingLinkedResourceResponseDataFromJSONTyped7(json, false);
10634
+ }
10635
+ function BillingLinkedResourceResponseDataFromJSONTyped7(json, ignoreDiscriminator) {
10636
+ if (json == null) {
10637
+ return json;
10638
+ }
10639
+ return {
10640
+ billingProvider: BillingProviderTypeFromJSON2(json["billing_provider"]),
10641
+ externalResourceId: json["external_resource_id"],
10642
+ originator: BillingProviderTypeFromJSON2(json["originator"])
10643
+ };
10644
+ }
10645
+
10603
10646
  // src/api/componentspublic/models/BillingPlanCreditGrantResetCadence.ts
10604
10647
  function BillingPlanCreditGrantResetCadenceFromJSON2(json) {
10605
10648
  return BillingPlanCreditGrantResetCadenceFromJSONTyped5(json, false);
@@ -11004,6 +11047,9 @@ function FeatureDetailResponseDataFromJSONTyped6(json, ignoreDiscriminator) {
11004
11047
  return json;
11005
11048
  }
11006
11049
  return {
11050
+ billingLinkedResource: json["billing_linked_resource"] == null ? void 0 : BillingLinkedResourceResponseDataFromJSON2(
11051
+ json["billing_linked_resource"]
11052
+ ),
11007
11053
  createdAt: new Date(json["created_at"]),
11008
11054
  description: json["description"],
11009
11055
  eventSubtype: json["event_subtype"] == null ? void 0 : json["event_subtype"],
@@ -11048,66 +11094,6 @@ function PlanControlledByTypeFromJSONTyped5(json, ignoreDiscriminator) {
11048
11094
  return json;
11049
11095
  }
11050
11096
 
11051
- // src/api/componentspublic/models/PlanCreditGrantView.ts
11052
- function PlanCreditGrantViewFromJSON2(json) {
11053
- return PlanCreditGrantViewFromJSONTyped4(json, false);
11054
- }
11055
- function PlanCreditGrantViewFromJSONTyped4(json, ignoreDiscriminator) {
11056
- if (json == null) {
11057
- return json;
11058
- }
11059
- return {
11060
- billingCreditAutoTopupAmount: json["billing_credit_auto_topup_amount"] == null ? void 0 : json["billing_credit_auto_topup_amount"],
11061
- billingCreditAutoTopupAmountType: json["billing_credit_auto_topup_amount_type"] == null ? void 0 : json["billing_credit_auto_topup_amount_type"],
11062
- billingCreditAutoTopupEnabled: json["billing_credit_auto_topup_enabled"],
11063
- billingCreditAutoTopupExpiryType: json["billing_credit_auto_topup_expiry_type"] == null ? void 0 : BillingCreditExpiryTypeFromJSON2(
11064
- json["billing_credit_auto_topup_expiry_type"]
11065
- ),
11066
- billingCreditAutoTopupExpiryUnit: json["billing_credit_auto_topup_expiry_unit"] == null ? void 0 : BillingCreditExpiryUnitFromJSON2(
11067
- json["billing_credit_auto_topup_expiry_unit"]
11068
- ),
11069
- billingCreditAutoTopupExpiryUnitCount: json["billing_credit_auto_topup_expiry_unit_count"] == null ? void 0 : json["billing_credit_auto_topup_expiry_unit_count"],
11070
- billingCreditAutoTopupThresholdCredits: json["billing_credit_auto_topup_threshold_credits"] == null ? void 0 : json["billing_credit_auto_topup_threshold_credits"],
11071
- billingCreditAutoTopupThresholdPercent: json["billing_credit_auto_topup_threshold_percent"] == null ? void 0 : json["billing_credit_auto_topup_threshold_percent"],
11072
- createdAt: new Date(json["created_at"]),
11073
- credit: json["credit"] == null ? void 0 : BillingCreditViewFromJSON2(json["credit"]),
11074
- creditAmount: json["credit_amount"],
11075
- creditDescription: json["credit_description"],
11076
- creditIcon: json["credit_icon"] == null ? void 0 : json["credit_icon"],
11077
- creditId: json["credit_id"],
11078
- creditName: json["credit_name"],
11079
- expiryType: json["expiry_type"] == null ? void 0 : BillingCreditExpiryTypeFromJSON2(json["expiry_type"]),
11080
- expiryUnit: json["expiry_unit"] == null ? void 0 : BillingCreditExpiryUnitFromJSON2(json["expiry_unit"]),
11081
- expiryUnitCount: json["expiry_unit_count"] == null ? void 0 : json["expiry_unit_count"],
11082
- id: json["id"],
11083
- plan: json["plan"] == null ? void 0 : GenericPreviewObjectFromJSON2(json["plan"]),
11084
- planId: json["plan_id"],
11085
- planVersionId: json["plan_version_id"] == null ? void 0 : json["plan_version_id"],
11086
- pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
11087
- resetCadence: json["reset_cadence"] == null ? void 0 : BillingPlanCreditGrantResetCadenceFromJSON2(json["reset_cadence"]),
11088
- resetStart: json["reset_start"] == null ? void 0 : BillingPlanCreditGrantResetStartFromJSON2(json["reset_start"]),
11089
- resetType: BillingPlanCreditGrantResetTypeFromJSON2(json["reset_type"]),
11090
- singularName: json["singular_name"] == null ? void 0 : json["singular_name"],
11091
- updatedAt: new Date(json["updated_at"])
11092
- };
11093
- }
11094
-
11095
- // src/api/componentspublic/models/PlanCurrencyPricesResponseData.ts
11096
- function PlanCurrencyPricesResponseDataFromJSON2(json) {
11097
- return PlanCurrencyPricesResponseDataFromJSONTyped5(json, false);
11098
- }
11099
- function PlanCurrencyPricesResponseDataFromJSONTyped5(json, ignoreDiscriminator) {
11100
- if (json == null) {
11101
- return json;
11102
- }
11103
- return {
11104
- currency: json["currency"],
11105
- monthlyPrice: json["monthly_price"] == null ? void 0 : BillingPriceResponseDataFromJSON2(json["monthly_price"]),
11106
- oneTimePrice: json["one_time_price"] == null ? void 0 : BillingPriceResponseDataFromJSON2(json["one_time_price"]),
11107
- yearlyPrice: json["yearly_price"] == null ? void 0 : BillingPriceResponseDataFromJSON2(json["yearly_price"])
11108
- };
11109
- }
11110
-
11111
11097
  // src/api/componentspublic/models/PlanIcon.ts
11112
11098
  function PlanIconFromJSON2(json) {
11113
11099
  return PlanIconFromJSONTyped7(json, false);
@@ -11153,6 +11139,9 @@ function PlanEntitlementResponseDataFromJSONTyped5(json, ignoreDiscriminator) {
11153
11139
  return json;
11154
11140
  }
11155
11141
  return {
11142
+ billingLinkedResource: json["billing_linked_resource"] == null ? void 0 : BillingLinkedResourceResponseDataFromJSON2(
11143
+ json["billing_linked_resource"]
11144
+ ),
11156
11145
  billingThreshold: json["billing_threshold"] == null ? void 0 : json["billing_threshold"],
11157
11146
  consumptionRate: json["consumption_rate"] == null ? void 0 : json["consumption_rate"],
11158
11147
  createdAt: new Date(json["created_at"]),
@@ -11184,6 +11173,66 @@ function PlanEntitlementResponseDataFromJSONTyped5(json, ignoreDiscriminator) {
11184
11173
  };
11185
11174
  }
11186
11175
 
11176
+ // src/api/componentspublic/models/PlanCreditGrantView.ts
11177
+ function PlanCreditGrantViewFromJSON2(json) {
11178
+ return PlanCreditGrantViewFromJSONTyped4(json, false);
11179
+ }
11180
+ function PlanCreditGrantViewFromJSONTyped4(json, ignoreDiscriminator) {
11181
+ if (json == null) {
11182
+ return json;
11183
+ }
11184
+ return {
11185
+ billingCreditAutoTopupAmount: json["billing_credit_auto_topup_amount"] == null ? void 0 : json["billing_credit_auto_topup_amount"],
11186
+ billingCreditAutoTopupAmountType: json["billing_credit_auto_topup_amount_type"] == null ? void 0 : json["billing_credit_auto_topup_amount_type"],
11187
+ billingCreditAutoTopupEnabled: json["billing_credit_auto_topup_enabled"],
11188
+ billingCreditAutoTopupExpiryType: json["billing_credit_auto_topup_expiry_type"] == null ? void 0 : BillingCreditExpiryTypeFromJSON2(
11189
+ json["billing_credit_auto_topup_expiry_type"]
11190
+ ),
11191
+ billingCreditAutoTopupExpiryUnit: json["billing_credit_auto_topup_expiry_unit"] == null ? void 0 : BillingCreditExpiryUnitFromJSON2(
11192
+ json["billing_credit_auto_topup_expiry_unit"]
11193
+ ),
11194
+ billingCreditAutoTopupExpiryUnitCount: json["billing_credit_auto_topup_expiry_unit_count"] == null ? void 0 : json["billing_credit_auto_topup_expiry_unit_count"],
11195
+ billingCreditAutoTopupThresholdCredits: json["billing_credit_auto_topup_threshold_credits"] == null ? void 0 : json["billing_credit_auto_topup_threshold_credits"],
11196
+ billingCreditAutoTopupThresholdPercent: json["billing_credit_auto_topup_threshold_percent"] == null ? void 0 : json["billing_credit_auto_topup_threshold_percent"],
11197
+ createdAt: new Date(json["created_at"]),
11198
+ credit: json["credit"] == null ? void 0 : BillingCreditViewFromJSON2(json["credit"]),
11199
+ creditAmount: json["credit_amount"],
11200
+ creditDescription: json["credit_description"],
11201
+ creditIcon: json["credit_icon"] == null ? void 0 : json["credit_icon"],
11202
+ creditId: json["credit_id"],
11203
+ creditName: json["credit_name"],
11204
+ expiryType: json["expiry_type"] == null ? void 0 : BillingCreditExpiryTypeFromJSON2(json["expiry_type"]),
11205
+ expiryUnit: json["expiry_unit"] == null ? void 0 : BillingCreditExpiryUnitFromJSON2(json["expiry_unit"]),
11206
+ expiryUnitCount: json["expiry_unit_count"] == null ? void 0 : json["expiry_unit_count"],
11207
+ id: json["id"],
11208
+ plan: json["plan"] == null ? void 0 : GenericPreviewObjectFromJSON2(json["plan"]),
11209
+ planId: json["plan_id"],
11210
+ planVersionId: json["plan_version_id"] == null ? void 0 : json["plan_version_id"],
11211
+ pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
11212
+ resetCadence: json["reset_cadence"] == null ? void 0 : BillingPlanCreditGrantResetCadenceFromJSON2(json["reset_cadence"]),
11213
+ resetStart: json["reset_start"] == null ? void 0 : BillingPlanCreditGrantResetStartFromJSON2(json["reset_start"]),
11214
+ resetType: BillingPlanCreditGrantResetTypeFromJSON2(json["reset_type"]),
11215
+ singularName: json["singular_name"] == null ? void 0 : json["singular_name"],
11216
+ updatedAt: new Date(json["updated_at"])
11217
+ };
11218
+ }
11219
+
11220
+ // src/api/componentspublic/models/PlanCurrencyPricesResponseData.ts
11221
+ function PlanCurrencyPricesResponseDataFromJSON2(json) {
11222
+ return PlanCurrencyPricesResponseDataFromJSONTyped5(json, false);
11223
+ }
11224
+ function PlanCurrencyPricesResponseDataFromJSONTyped5(json, ignoreDiscriminator) {
11225
+ if (json == null) {
11226
+ return json;
11227
+ }
11228
+ return {
11229
+ currency: json["currency"],
11230
+ monthlyPrice: json["monthly_price"] == null ? void 0 : BillingPriceResponseDataFromJSON2(json["monthly_price"]),
11231
+ oneTimePrice: json["one_time_price"] == null ? void 0 : BillingPriceResponseDataFromJSON2(json["one_time_price"]),
11232
+ yearlyPrice: json["yearly_price"] == null ? void 0 : BillingPriceResponseDataFromJSON2(json["yearly_price"])
11233
+ };
11234
+ }
11235
+
11187
11236
  // src/api/componentspublic/models/PlanVersionStatus.ts
11188
11237
  function PlanVersionStatusFromJSON2(json) {
11189
11238
  return PlanVersionStatusFromJSONTyped3(json, false);
@@ -11226,6 +11275,9 @@ function PlanViewPublicResponseDataFromJSONTyped(json, ignoreDiscriminator) {
11226
11275
  return {
11227
11276
  activeVersion: json["active_version"] == null ? void 0 : PlanVersionResponseDataFromJSON2(json["active_version"]),
11228
11277
  audienceType: json["audience_type"] == null ? void 0 : json["audience_type"],
11278
+ billingLinkedResource: json["billing_linked_resource"] == null ? void 0 : BillingLinkedResourceResponseDataFromJSON2(
11279
+ json["billing_linked_resource"]
11280
+ ),
11229
11281
  billingProduct: json["billing_product"] == null ? void 0 : BillingProductDetailResponseDataFromJSON2(json["billing_product"]),
11230
11282
  chargeType: ChargeTypeFromJSON2(json["charge_type"]),
11231
11283
  companyCount: json["company_count"],
@@ -11390,25 +11442,21 @@ function getAddOnPrice(addOn, period = "month", currency) {
11390
11442
  }
11391
11443
  function getEntitlementPrice(entitlement, period = "month", currency) {
11392
11444
  const currencyPrices = "valueType" in entitlement ? entitlement.currencyPrices : "entitlementType" in entitlement ? entitlement.planEntitlement?.currencyPrices : void 0;
11445
+ let source;
11393
11446
  if (currency && currencyPrices?.length) {
11394
11447
  const currencyPrice = currencyPrices.find(
11395
11448
  (cp) => cp.currency.toLowerCase() === currency.toLowerCase()
11396
11449
  );
11397
11450
  if (currencyPrice) {
11398
- const source2 = period === "year" ? currencyPrice.yearlyPrice : currencyPrice.monthlyPrice;
11399
- if (source2) {
11400
- return {
11401
- ...source2,
11402
- price: getPriceValue(source2)
11403
- };
11404
- }
11451
+ source = period === "year" ? currencyPrice.yearlyPrice : currencyPrice.monthlyPrice;
11405
11452
  }
11406
11453
  }
11407
- let source;
11408
- if ("valueType" in entitlement) {
11409
- source = period === "year" ? entitlement.meteredYearlyPrice : entitlement.meteredMonthlyPrice;
11410
- } else if ("entitlementType" in entitlement) {
11411
- source = period === "year" ? entitlement.yearlyUsageBasedPrice : entitlement.monthlyUsageBasedPrice;
11454
+ if (!source) {
11455
+ if ("valueType" in entitlement) {
11456
+ source = period === "year" ? entitlement.meteredYearlyPrice : entitlement.meteredMonthlyPrice;
11457
+ } else if ("entitlementType" in entitlement) {
11458
+ source = period === "year" ? entitlement.yearlyUsageBasedPrice : entitlement.monthlyUsageBasedPrice;
11459
+ }
11412
11460
  }
11413
11461
  if (source) {
11414
11462
  const billingPrice = { ...source };
@@ -11417,9 +11465,7 @@ function getEntitlementPrice(entitlement, period = "month", currency) {
11417
11465
  if (typeof overagePriceTier.perUnitPrice === "number") {
11418
11466
  billingPrice.price = overagePriceTier.perUnitPrice;
11419
11467
  }
11420
- if (typeof overagePriceTier.perUnitPriceDecimal === "string") {
11421
- billingPrice.priceDecimal = overagePriceTier.perUnitPriceDecimal;
11422
- }
11468
+ billingPrice.priceDecimal = typeof overagePriceTier.perUnitPriceDecimal === "string" ? overagePriceTier.perUnitPriceDecimal : null;
11423
11469
  }
11424
11470
  return { ...billingPrice, price: getPriceValue(billingPrice) };
11425
11471
  }
@@ -12640,7 +12686,7 @@ var reducer = (state, action) => {
12640
12686
  // src/context/EmbedProvider.tsx
12641
12687
  var import_jsx_runtime2 = require("react/jsx-runtime");
12642
12688
  var getCustomHeaders = (sessionId) => ({
12643
- "X-Schematic-Components-Version": "2.9.0-rc.3",
12689
+ "X-Schematic-Components-Version": "2.9.1",
12644
12690
  "X-Schematic-Session-ID": sessionId
12645
12691
  });
12646
12692
  var EmbedProvider = ({
@@ -13722,6 +13768,11 @@ var Button = ut.button(
13722
13768
  var import_react23 = require("react");
13723
13769
 
13724
13770
  // src/components/ui/dialog/styles.ts
13771
+ var DialogContent = ut.div`
13772
+ position: relative;
13773
+ display: flex;
13774
+ flex-direction: column;
13775
+ `;
13725
13776
  var Dialog = ut.dialog(
13726
13777
  ({ theme, $isModal, $size, $top }) => {
13727
13778
  return it`
@@ -13760,6 +13811,15 @@ var Dialog = ut.dialog(
13760
13811
  max-width: ${$size === "sm" ? "480px" : $size === "md" ? "768px" : "1356px"};
13761
13812
  height: ${$size === "lg" ? "100%" : "fit-content"};
13762
13813
  border-radius: 0.5rem;
13814
+
13815
+ ${DialogContent} {
13816
+ flex-direction: row;
13817
+ max-height: calc(100dvh - 5rem + 3px);
13818
+
13819
+ ${$size === "lg" && it`
13820
+ height: calc(100% - 5rem + 3px);
13821
+ `}
13822
+ }
13763
13823
  }
13764
13824
 
13765
13825
  @media (min-width: 768px) and (min-height: 896px) {
@@ -13846,25 +13906,10 @@ var DialogClose = ({ onClose, ...rest }) => {
13846
13906
  // src/components/ui/dialog/DialogContent.tsx
13847
13907
  var import_react24 = require("react");
13848
13908
  var import_jsx_runtime5 = require("react/jsx-runtime");
13849
- var DialogContent = (0, import_react24.forwardRef)(({ children }, ref) => {
13850
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
13851
- Flex,
13852
- {
13853
- ref,
13854
- $position: "relative",
13855
- $flexDirection: "column",
13856
- $viewport: {
13857
- md: {
13858
- $flexDirection: "row",
13859
- $height: "calc(100% - 5rem + 3px)",
13860
- $maxHeight: "calc(100dvh - 5rem + 3px)"
13861
- }
13862
- },
13863
- children
13864
- }
13865
- );
13909
+ var DialogContent2 = (0, import_react24.forwardRef)(({ children }, ref) => {
13910
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DialogContent, { ref, children });
13866
13911
  });
13867
- DialogContent.displayName = "DialogContent";
13912
+ DialogContent2.displayName = "DialogContent";
13868
13913
 
13869
13914
  // src/components/ui/dialog/DialogHeader.tsx
13870
13915
  var import_jsx_runtime6 = require("react/jsx-runtime");
@@ -16010,7 +16055,8 @@ var CheckoutDialog = ({ top }) => {
16010
16055
  const [selectedCurrency, setSelectedCurrency] = (0, import_react33.useState)(
16011
16056
  () => lockedCurrency ?? checkoutState?.selectedCurrency ?? currencies[0] ?? DEFAULT_CURRENCY
16012
16057
  );
16013
- const showCurrencySelector = currencies.length > 1 || !!lockedCurrency;
16058
+ const showCurrencySelector = currencies.length > 1 && !lockedCurrency;
16059
+ const hasCurrency = currencies.length > 1 || !!lockedCurrency;
16014
16060
  (0, import_react33.useEffect)(() => {
16015
16061
  if (lockedCurrency) {
16016
16062
  setSelectedCurrency(lockedCurrency);
@@ -16245,7 +16291,7 @@ var CheckoutDialog = ({ top }) => {
16245
16291
  async (updates) => {
16246
16292
  const period = updates.period || planPeriod;
16247
16293
  const plan = updates.plan || selectedPlan;
16248
- const resolvedCurrency = showCurrencySelector ? selectedCurrency : void 0;
16294
+ const resolvedCurrency = hasCurrency ? selectedCurrency : void 0;
16249
16295
  const currencyPrice = plan ? getPlanPrice(
16250
16296
  plan,
16251
16297
  period,
@@ -16356,7 +16402,7 @@ var CheckoutDialog = ({ top }) => {
16356
16402
  planPeriod,
16357
16403
  selectedPlan,
16358
16404
  selectedCurrency,
16359
- showCurrencySelector,
16405
+ hasCurrency,
16360
16406
  payInAdvanceEntitlements,
16361
16407
  addOnPayInAdvanceEntitlements,
16362
16408
  addOns,
@@ -16702,7 +16748,7 @@ var CheckoutDialog = ({ top }) => {
16702
16748
  ))
16703
16749
  }
16704
16750
  ) }),
16705
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(DialogContent, { ref: contentRef, children: [
16751
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(DialogContent2, { ref: contentRef, children: [
16706
16752
  /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
16707
16753
  Flex,
16708
16754
  {
@@ -16752,8 +16798,7 @@ var CheckoutDialog = ({ top }) => {
16752
16798
  {
16753
16799
  currencies,
16754
16800
  selectedCurrency,
16755
- onSelect: setSelectedCurrency,
16756
- disabled: !!lockedCurrency
16801
+ onSelect: setSelectedCurrency
16757
16802
  }
16758
16803
  ),
16759
16804
  showPeriodToggle && availablePeriods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
@@ -16790,7 +16835,7 @@ var CheckoutDialog = ({ top }) => {
16790
16835
  selectPlan,
16791
16836
  shouldTrial,
16792
16837
  tooltipPortal: dialogRef.current,
16793
- currency: showCurrencySelector ? selectedCurrency : void 0
16838
+ currency: hasCurrency ? selectedCurrency : void 0
16794
16839
  }
16795
16840
  ) : checkoutStage === "usage" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
16796
16841
  Quantity,
@@ -16801,7 +16846,7 @@ var CheckoutDialog = ({ top }) => {
16801
16846
  entitlements: payInAdvanceEntitlements,
16802
16847
  updateQuantity: updateUsageBasedEntitlementQuantity,
16803
16848
  tooltipPortal: dialogRef.current,
16804
- currency: showCurrencySelector ? selectedCurrency : void 0
16849
+ currency: hasCurrency ? selectedCurrency : void 0
16805
16850
  }
16806
16851
  ) : checkoutStage === "addons" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
16807
16852
  AddOns,
@@ -16810,7 +16855,7 @@ var CheckoutDialog = ({ top }) => {
16810
16855
  period: planPeriod,
16811
16856
  addOns,
16812
16857
  toggle: (id) => toggleAddOn(id),
16813
- currency: showCurrencySelector ? selectedCurrency : void 0
16858
+ currency: hasCurrency ? selectedCurrency : void 0
16814
16859
  }
16815
16860
  ) : checkoutStage === "addonsUsage" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
16816
16861
  Quantity,
@@ -16821,7 +16866,7 @@ var CheckoutDialog = ({ top }) => {
16821
16866
  entitlements: addOnPayInAdvanceEntitlements,
16822
16867
  updateQuantity: updateAddOnEntitlementQuantity,
16823
16868
  tooltipPortal: dialogRef.current,
16824
- currency: showCurrencySelector ? selectedCurrency : void 0
16869
+ currency: hasCurrency ? selectedCurrency : void 0
16825
16870
  }
16826
16871
  ) : checkoutStage === "credits" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
16827
16872
  Credits,
@@ -16829,7 +16874,7 @@ var CheckoutDialog = ({ top }) => {
16829
16874
  isLoading,
16830
16875
  bundles: creditBundles,
16831
16876
  updateCount: updateCreditBundleCount,
16832
- currency: showCurrencySelector ? selectedCurrency : void 0
16877
+ currency: hasCurrency ? selectedCurrency : void 0
16833
16878
  }
16834
16879
  ) : checkoutStage === "checkout" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
16835
16880
  Checkout,
@@ -16873,7 +16918,7 @@ var CheckoutDialog = ({ top }) => {
16873
16918
  setConfirmPaymentIntent: setConfirmPaymentIntentProps,
16874
16919
  willTrialWithoutPaymentMethod,
16875
16920
  willScheduleDowngrade,
16876
- currency: showCurrencySelector ? selectedCurrency : void 0
16921
+ currency: hasCurrency ? selectedCurrency : void 0
16877
16922
  }
16878
16923
  )
16879
16924
  ] })
@@ -17055,7 +17100,7 @@ var PaymentDialog = ({ top }) => {
17055
17100
  ...!isModal && { open: layout === "payment" },
17056
17101
  children: [
17057
17102
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogHeader, { bordered: true, onClose: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text, { $size: 18, children: t2("Edit payment method") }) }),
17058
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogContent, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Flex, { $position: "relative", $flexGrow: 1, $overflow: "auto", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PaymentMethodDetails, {}) }) })
17103
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogContent2, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Flex, { $position: "relative", $flexGrow: 1, $overflow: "auto", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PaymentMethodDetails, {}) }) })
17059
17104
  ]
17060
17105
  }
17061
17106
  );
@@ -17125,11 +17170,16 @@ var PaymentForm = ({ onConfirm, financeData }) => {
17125
17170
  const stripe = (0, import_react_stripe_js.useStripe)();
17126
17171
  const elements = (0, import_react_stripe_js.useElements)();
17127
17172
  const { data } = useEmbed();
17173
+ const loadTimerRef = (0, import_react35.useRef)(
17174
+ void 0
17175
+ );
17128
17176
  const [email, setEmail] = (0, import_react35.useState)("");
17129
17177
  const [message, setMessage] = (0, import_react35.useState)();
17130
17178
  const [isLoading, setIsLoading] = (0, import_react35.useState)(false);
17131
17179
  const [isConfirmed, setIsConfirmed] = (0, import_react35.useState)(false);
17132
17180
  const [isPaymentComplete, setIsPaymentComplete] = (0, import_react35.useState)(false);
17181
+ const [isPaymentReady, setIsPaymentReady] = (0, import_react35.useState)(false);
17182
+ const [loadError, setLoadError] = (0, import_react35.useState)();
17133
17183
  const [isAddressComplete, setIsAddressComplete] = (0, import_react35.useState)(() => {
17134
17184
  const shouldCollectAddress = shouldCollectBillingAddress(
17135
17185
  data?.checkoutSettings.collectAddress ?? false,
@@ -17172,6 +17222,18 @@ var PaymentForm = ({ onConfirm, financeData }) => {
17172
17222
  setIsLoading(false);
17173
17223
  }
17174
17224
  };
17225
+ (0, import_react35.useEffect)(() => {
17226
+ loadTimerRef.current = setTimeout(() => {
17227
+ if (!isPaymentReady) {
17228
+ setLoadError(t2("Unable to load payment form."));
17229
+ }
17230
+ }, 1e4);
17231
+ return () => {
17232
+ if (loadTimerRef.current) {
17233
+ clearTimeout(loadTimerRef.current);
17234
+ }
17235
+ };
17236
+ }, [t2, isPaymentReady]);
17175
17237
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
17176
17238
  Flex,
17177
17239
  {
@@ -17180,15 +17242,40 @@ var PaymentForm = ({ onConfirm, financeData }) => {
17180
17242
  onSubmit: handleSubmit,
17181
17243
  $flexDirection: "column",
17182
17244
  children: [
17183
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
17184
- import_react_stripe_js.PaymentElement,
17185
- {
17186
- id: "payment-element",
17187
- onChange: (event) => {
17188
- setIsPaymentComplete(event.complete);
17245
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Box, { $marginBottom: "1.5rem", children: [
17246
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
17247
+ import_react_stripe_js.PaymentElement,
17248
+ {
17249
+ id: "payment-element",
17250
+ onReady: () => {
17251
+ setIsPaymentReady(true);
17252
+ if (loadTimerRef.current) {
17253
+ clearTimeout(loadTimerRef.current);
17254
+ }
17255
+ },
17256
+ onLoadError: () => {
17257
+ setLoadError(t2("Unable to load payment form."));
17258
+ if (loadTimerRef.current) {
17259
+ clearTimeout(loadTimerRef.current);
17260
+ }
17261
+ },
17262
+ onChange: (event) => {
17263
+ setIsPaymentComplete(event.complete);
17264
+ }
17189
17265
  }
17190
- }
17191
- ) }),
17266
+ ),
17267
+ loadError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
17268
+ Flex,
17269
+ {
17270
+ as: TransitionBox,
17271
+ $flexDirection: "column",
17272
+ $justifyContent: "center",
17273
+ $alignItems: "center",
17274
+ $gap: "1rem",
17275
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { $weight: 500, $color: "#DB6669", children: loadError })
17276
+ }
17277
+ )
17278
+ ] }),
17192
17279
  stripe && data?.checkoutSettings.collectEmail && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Box, { "data-field": "name", $marginBottom: "1.5rem", $verticalAlign: "top", children: [
17193
17280
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Label, { htmlFor: "email", children: "Email" }),
17194
17281
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
@@ -19087,7 +19174,7 @@ var UnsubscribeDialog = ({ top }) => {
19087
19174
  top,
19088
19175
  onClose: handleClose,
19089
19176
  ...!isModal && { open: layout === "unsubscribe" },
19090
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(DialogContent, { children: [
19177
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(DialogContent2, { children: [
19091
19178
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
19092
19179
  DialogClose,
19093
19180
  {
@@ -20929,7 +21016,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
20929
21016
  }
20930
21017
  stripe._registerWrapper({
20931
21018
  name: "stripe-js",
20932
- version: "9.0.1",
21019
+ version: "9.1.0",
20933
21020
  startTime
20934
21021
  });
20935
21022
  };
@@ -21007,7 +21094,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
21007
21094
  var version = runtimeVersionToUrlVersion(maybeStripe.version);
21008
21095
  var expectedVersion = RELEASE_TRAIN;
21009
21096
  if (isTestKey && version !== expectedVersion) {
21010
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.0.1", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
21097
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.1.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
21011
21098
  }
21012
21099
  var stripe = maybeStripe.apply(void 0, args);
21013
21100
  registerWrapper(stripe, startTime);
@@ -21127,6 +21214,27 @@ var PaymentMethodDetails = ({
21127
21214
  const toggleShowPaymentMethods = () => {
21128
21215
  setShowDifferentPaymentMethods((prev2) => !prev2);
21129
21216
  };
21217
+ const initializeStripe = (0, import_react51.useCallback)(async () => {
21218
+ if (!stripe && setupIntent) {
21219
+ let publishableKey = setupIntent.publishableKey || setupIntent.schematicPublishableKey;
21220
+ const stripeOptions = {};
21221
+ if (setupIntent.accountId) {
21222
+ publishableKey = setupIntent.schematicPublishableKey;
21223
+ stripeOptions.stripeAccount = setupIntent.accountId;
21224
+ }
21225
+ try {
21226
+ const stripePromise2 = loadStripe(publishableKey, stripeOptions);
21227
+ setStripe(stripePromise2);
21228
+ const instance2 = await stripePromise2;
21229
+ if (!instance2) {
21230
+ throw new Error("Failed to load Stripe instance");
21231
+ }
21232
+ } catch {
21233
+ setError(t2("Unable to load payment form."));
21234
+ setShowPaymentForm(false);
21235
+ }
21236
+ }
21237
+ }, [t2, stripe, setupIntent]);
21130
21238
  const initializePaymentMethod = (0, import_react51.useCallback)(async () => {
21131
21239
  try {
21132
21240
  setIsLoading(true);
@@ -21182,17 +21290,8 @@ var PaymentMethodDetails = ({
21182
21290
  [t2, deletePaymentMethod]
21183
21291
  );
21184
21292
  (0, import_react51.useEffect)(() => {
21185
- if (!stripe && setupIntent) {
21186
- let publishableKey = setupIntent.publishableKey || setupIntent.schematicPublishableKey;
21187
- const stripeOptions = {};
21188
- if (setupIntent.accountId) {
21189
- publishableKey = setupIntent.schematicPublishableKey;
21190
- stripeOptions.stripeAccount = setupIntent.accountId;
21191
- }
21192
- const stripePromise2 = loadStripe(publishableKey, stripeOptions);
21193
- setStripe(stripePromise2);
21194
- }
21195
- }, [stripe, setupIntent]);
21293
+ initializeStripe();
21294
+ }, [initializeStripe]);
21196
21295
  (0, import_react51.useEffect)(() => {
21197
21296
  if (!setupIntent && (!currentPaymentMethod || showPaymentForm)) {
21198
21297
  initializePaymentMethod();
@@ -21538,7 +21637,6 @@ var UsageDetails2 = ({
21538
21637
  var import_jsx_runtime52 = require("react/jsx-runtime");
21539
21638
  var resolveDesignProps7 = (props) => {
21540
21639
  return {
21541
- showCurrencySelector: props.showCurrencySelector ?? false,
21542
21640
  header: {
21543
21641
  isVisible: props.header?.isVisible ?? true,
21544
21642
  title: {