@schematichq/schematic-components 2.26.0 → 2.27.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.
@@ -4738,6 +4738,18 @@ function BillingSubscriptionViewFromJSONTyped(json, ignoreDiscriminator) {
4738
4738
  }
4739
4739
 
4740
4740
  // src/api/checkoutexternal/models/UpdatePayInAdvanceRequestBody.ts
4741
+ function UpdatePayInAdvanceRequestBodyFromJSON(json) {
4742
+ return UpdatePayInAdvanceRequestBodyFromJSONTyped(json, false);
4743
+ }
4744
+ function UpdatePayInAdvanceRequestBodyFromJSONTyped(json, ignoreDiscriminator) {
4745
+ if (json == null) {
4746
+ return json;
4747
+ }
4748
+ return {
4749
+ priceId: json["price_id"],
4750
+ quantity: json["quantity"]
4751
+ };
4752
+ }
4741
4753
  function UpdatePayInAdvanceRequestBodyToJSON(json) {
4742
4754
  return UpdatePayInAdvanceRequestBodyToJSONTyped(json, false);
4743
4755
  }
@@ -4752,6 +4764,18 @@ function UpdatePayInAdvanceRequestBodyToJSONTyped(value, ignoreDiscriminator = f
4752
4764
  }
4753
4765
 
4754
4766
  // src/api/checkoutexternal/models/UpdateCreditBundleRequestBody.ts
4767
+ function UpdateCreditBundleRequestBodyFromJSON(json) {
4768
+ return UpdateCreditBundleRequestBodyFromJSONTyped(json, false);
4769
+ }
4770
+ function UpdateCreditBundleRequestBodyFromJSONTyped(json, ignoreDiscriminator) {
4771
+ if (json == null) {
4772
+ return json;
4773
+ }
4774
+ return {
4775
+ bundleId: json["bundle_id"],
4776
+ quantity: json["quantity"]
4777
+ };
4778
+ }
4755
4779
  function UpdateCreditBundleRequestBodyToJSON(json) {
4756
4780
  return UpdateCreditBundleRequestBodyToJSONTyped(json, false);
4757
4781
  }
@@ -4766,6 +4790,18 @@ function UpdateCreditBundleRequestBodyToJSONTyped(value, ignoreDiscriminator = f
4766
4790
  }
4767
4791
 
4768
4792
  // src/api/checkoutexternal/models/CheckoutFieldValue.ts
4793
+ function CheckoutFieldValueFromJSON(json) {
4794
+ return CheckoutFieldValueFromJSONTyped(json, false);
4795
+ }
4796
+ function CheckoutFieldValueFromJSONTyped(json, ignoreDiscriminator) {
4797
+ if (json == null) {
4798
+ return json;
4799
+ }
4800
+ return {
4801
+ id: json["id"],
4802
+ value: json["value"]
4803
+ };
4804
+ }
4769
4805
  function CheckoutFieldValueToJSON(json) {
4770
4806
  return CheckoutFieldValueToJSONTyped(json, false);
4771
4807
  }
@@ -4780,6 +4816,18 @@ function CheckoutFieldValueToJSONTyped(value, ignoreDiscriminator = false) {
4780
4816
  }
4781
4817
 
4782
4818
  // src/api/checkoutexternal/models/UpdateAddOnRequestBody.ts
4819
+ function UpdateAddOnRequestBodyFromJSON(json) {
4820
+ return UpdateAddOnRequestBodyFromJSONTyped(json, false);
4821
+ }
4822
+ function UpdateAddOnRequestBodyFromJSONTyped(json, ignoreDiscriminator) {
4823
+ if (json == null) {
4824
+ return json;
4825
+ }
4826
+ return {
4827
+ addOnId: json["add_on_id"],
4828
+ priceId: json["price_id"]
4829
+ };
4830
+ }
4783
4831
  function UpdateAddOnRequestBodyToJSON(json) {
4784
4832
  return UpdateAddOnRequestBodyToJSONTyped(json, false);
4785
4833
  }
@@ -4794,6 +4842,20 @@ function UpdateAddOnRequestBodyToJSONTyped(value, ignoreDiscriminator = false) {
4794
4842
  }
4795
4843
 
4796
4844
  // src/api/checkoutexternal/models/UpdateAutoTopupOverrideRequestBody.ts
4845
+ function UpdateAutoTopupOverrideRequestBodyFromJSON(json) {
4846
+ return UpdateAutoTopupOverrideRequestBodyFromJSONTyped(json, false);
4847
+ }
4848
+ function UpdateAutoTopupOverrideRequestBodyFromJSONTyped(json, ignoreDiscriminator) {
4849
+ if (json == null) {
4850
+ return json;
4851
+ }
4852
+ return {
4853
+ autoTopupAmount: json["auto_topup_amount"] == null ? void 0 : json["auto_topup_amount"],
4854
+ autoTopupEnabled: json["auto_topup_enabled"] == null ? void 0 : json["auto_topup_enabled"],
4855
+ autoTopupThresholdCredits: json["auto_topup_threshold_credits"] == null ? void 0 : json["auto_topup_threshold_credits"],
4856
+ planCreditGrantId: json["plan_credit_grant_id"]
4857
+ };
4858
+ }
4797
4859
  function UpdateAutoTopupOverrideRequestBodyToJSON(json) {
4798
4860
  return UpdateAutoTopupOverrideRequestBodyToJSONTyped(json, false);
4799
4861
  }
@@ -4829,6 +4891,7 @@ function ChangeSubscriptionRequestBodyToJSONTyped(value, ignoreDiscriminator = f
4829
4891
  credit_bundles: value["creditBundles"].map(
4830
4892
  UpdateCreditBundleRequestBodyToJSON
4831
4893
  ),
4894
+ currency: value["currency"],
4832
4895
  custom_field_values: value["customFieldValues"].map(
4833
4896
  CheckoutFieldValueToJSON
4834
4897
  ),
@@ -4864,6 +4927,143 @@ function CheckoutBundlePurchaseBehaviorFromJSONTyped(json, ignoreDiscriminator)
4864
4927
  return json;
4865
4928
  }
4866
4929
 
4930
+ // src/api/checkoutexternal/models/CheckoutPriceSnapshot.ts
4931
+ function CheckoutPriceSnapshotFromJSON(json) {
4932
+ return CheckoutPriceSnapshotFromJSONTyped(json, false);
4933
+ }
4934
+ function CheckoutPriceSnapshotFromJSONTyped(json, ignoreDiscriminator) {
4935
+ if (json == null) {
4936
+ return json;
4937
+ }
4938
+ return {
4939
+ amountOff: json["amount_off"],
4940
+ currency: json["currency"],
4941
+ dueNow: json["due_now"],
4942
+ isScheduledDowngrade: json["is_scheduled_downgrade"],
4943
+ newCharges: json["new_charges"],
4944
+ optInRequired: json["opt_in_required"],
4945
+ paymentMethodRequired: json["payment_method_required"],
4946
+ percentOff: json["percent_off"],
4947
+ periodStart: new Date(json["period_start"]),
4948
+ pricedAt: new Date(json["priced_at"]),
4949
+ promoCodeApplied: json["promo_code_applied"],
4950
+ proration: json["proration"],
4951
+ scheduledChangeTime: json["scheduled_change_time"] == null ? void 0 : new Date(json["scheduled_change_time"]),
4952
+ taxAmount: json["tax_amount"] == null ? void 0 : json["tax_amount"],
4953
+ totalPerBillingPeriod: json["total_per_billing_period"],
4954
+ trialEnd: json["trial_end"] == null ? void 0 : new Date(json["trial_end"])
4955
+ };
4956
+ }
4957
+
4958
+ // src/api/checkoutexternal/models/CheckoutStatus.ts
4959
+ function CheckoutStatusFromJSON(json) {
4960
+ return CheckoutStatusFromJSONTyped(json, false);
4961
+ }
4962
+ function CheckoutStatusFromJSONTyped(json, ignoreDiscriminator) {
4963
+ return json;
4964
+ }
4965
+
4966
+ // src/api/checkoutexternal/models/CheckoutSelectionsResponseData.ts
4967
+ function CheckoutSelectionsResponseDataFromJSON(json) {
4968
+ return CheckoutSelectionsResponseDataFromJSONTyped(json, false);
4969
+ }
4970
+ function CheckoutSelectionsResponseDataFromJSONTyped(json, ignoreDiscriminator) {
4971
+ if (json == null) {
4972
+ return json;
4973
+ }
4974
+ return {
4975
+ addOnIds: json["add_on_ids"].map(
4976
+ UpdateAddOnRequestBodyFromJSON
4977
+ ),
4978
+ autoTopupOverrides: json["auto_topup_overrides"].map(
4979
+ UpdateAutoTopupOverrideRequestBodyFromJSON
4980
+ ),
4981
+ billingEntityId: json["billing_entity_id"] == null ? void 0 : json["billing_entity_id"],
4982
+ couponExternalId: json["coupon_external_id"] == null ? void 0 : json["coupon_external_id"],
4983
+ creditBundles: json["credit_bundles"].map(
4984
+ UpdateCreditBundleRequestBodyFromJSON
4985
+ ),
4986
+ customFieldValues: json["custom_field_values"].map(
4987
+ CheckoutFieldValueFromJSON
4988
+ ),
4989
+ newPlanId: json["new_plan_id"] == null ? void 0 : json["new_plan_id"],
4990
+ newPriceId: json["new_price_id"] == null ? void 0 : json["new_price_id"],
4991
+ optInAccepted: json["opt_in_accepted"] == null ? void 0 : json["opt_in_accepted"],
4992
+ payInAdvance: json["pay_in_advance"].map(
4993
+ UpdatePayInAdvanceRequestBodyFromJSON
4994
+ ),
4995
+ paymentMethodId: json["payment_method_id"] == null ? void 0 : json["payment_method_id"],
4996
+ promoCode: json["promo_code"] == null ? void 0 : json["promo_code"],
4997
+ skipTrial: json["skip_trial"]
4998
+ };
4999
+ }
5000
+
5001
+ // src/api/checkoutexternal/models/CheckoutProblemSource.ts
5002
+ function CheckoutProblemSourceFromJSON(json) {
5003
+ return CheckoutProblemSourceFromJSONTyped(json, false);
5004
+ }
5005
+ function CheckoutProblemSourceFromJSONTyped(json, ignoreDiscriminator) {
5006
+ return json;
5007
+ }
5008
+
5009
+ // src/api/checkoutexternal/models/CheckoutProblemCode.ts
5010
+ function CheckoutProblemCodeFromJSON(json) {
5011
+ return CheckoutProblemCodeFromJSONTyped(json, false);
5012
+ }
5013
+ function CheckoutProblemCodeFromJSONTyped(json, ignoreDiscriminator) {
5014
+ return json;
5015
+ }
5016
+
5017
+ // src/api/checkoutexternal/models/Problem.ts
5018
+ function ProblemFromJSON(json) {
5019
+ return ProblemFromJSONTyped(json, false);
5020
+ }
5021
+ function ProblemFromJSONTyped(json, ignoreDiscriminator) {
5022
+ if (json == null) {
5023
+ return json;
5024
+ }
5025
+ return {
5026
+ blocking: json["blocking"],
5027
+ bundleId: json["bundle_id"] == null ? void 0 : json["bundle_id"],
5028
+ code: CheckoutProblemCodeFromJSON(json["code"]),
5029
+ currency: json["currency"] == null ? void 0 : json["currency"],
5030
+ detail: json["detail"] == null ? void 0 : json["detail"],
5031
+ featureId: json["feature_id"] == null ? void 0 : json["feature_id"],
5032
+ fieldId: json["field_id"] == null ? void 0 : json["field_id"],
5033
+ message: json["message"],
5034
+ paymentMethodId: json["payment_method_id"] == null ? void 0 : json["payment_method_id"],
5035
+ planId: json["plan_id"] == null ? void 0 : json["plan_id"],
5036
+ priceId: json["price_id"] == null ? void 0 : json["price_id"],
5037
+ source: CheckoutProblemSourceFromJSON(json["source"])
5038
+ };
5039
+ }
5040
+
5041
+ // src/api/checkoutexternal/models/CheckoutDraftResponseData.ts
5042
+ function CheckoutDraftResponseDataFromJSON(json) {
5043
+ return CheckoutDraftResponseDataFromJSONTyped(json, false);
5044
+ }
5045
+ function CheckoutDraftResponseDataFromJSONTyped(json, ignoreDiscriminator) {
5046
+ if (json == null) {
5047
+ return json;
5048
+ }
5049
+ return {
5050
+ companyId: json["company_id"],
5051
+ completedAt: json["completed_at"] == null ? void 0 : new Date(json["completed_at"]),
5052
+ createdAt: new Date(json["created_at"]),
5053
+ expiresAt: json["expires_at"] == null ? void 0 : new Date(json["expires_at"]),
5054
+ id: json["id"],
5055
+ lastActivityAt: new Date(json["last_activity_at"]),
5056
+ priceSnapshot: json["price_snapshot"] == null ? void 0 : CheckoutPriceSnapshotFromJSON(json["price_snapshot"]),
5057
+ pricedAt: json["priced_at"] == null ? void 0 : new Date(json["priced_at"]),
5058
+ problems: json["problems"].map(ProblemFromJSON),
5059
+ selections: CheckoutSelectionsResponseDataFromJSON(json["selections"]),
5060
+ shareToken: json["share_token"] == null ? void 0 : json["share_token"],
5061
+ status: CheckoutStatusFromJSON(json["status"]),
5062
+ updatedAt: new Date(json["updated_at"]),
5063
+ version: json["version"]
5064
+ };
5065
+ }
5066
+
4867
5067
  // src/api/checkoutexternal/models/CheckoutFieldWithValue.ts
4868
5068
  function CheckoutFieldWithValueFromJSON(json) {
4869
5069
  return CheckoutFieldWithValueFromJSONTyped(json, false);
@@ -6875,6 +7075,57 @@ function ComponentHydrateResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6875
7075
  };
6876
7076
  }
6877
7077
 
7078
+ // src/api/checkoutexternal/models/CreateCheckoutRequest.ts
7079
+ function CreateCheckoutRequestToJSON(json) {
7080
+ return CreateCheckoutRequestToJSONTyped(json, false);
7081
+ }
7082
+ function CreateCheckoutRequestToJSONTyped(value, ignoreDiscriminator = false) {
7083
+ if (value == null) {
7084
+ return value;
7085
+ }
7086
+ return {
7087
+ add_on_ids: value["addOnIds"].map(
7088
+ UpdateAddOnRequestBodyToJSON
7089
+ ),
7090
+ auto_topup_overrides: value["autoTopupOverrides"].map(
7091
+ UpdateAutoTopupOverrideRequestBodyToJSON
7092
+ ),
7093
+ billing_entity_id: value["billingEntityId"],
7094
+ company_id: value["companyId"],
7095
+ coupon_external_id: value["couponExternalId"],
7096
+ credit_bundles: value["creditBundles"].map(
7097
+ UpdateCreditBundleRequestBodyToJSON
7098
+ ),
7099
+ currency: value["currency"],
7100
+ custom_field_values: value["customFieldValues"].map(
7101
+ CheckoutFieldValueToJSON
7102
+ ),
7103
+ new_plan_id: value["newPlanId"],
7104
+ new_price_id: value["newPriceId"],
7105
+ opt_in_accepted: value["optInAccepted"],
7106
+ pay_in_advance: value["payInAdvance"].map(
7107
+ UpdatePayInAdvanceRequestBodyToJSON
7108
+ ),
7109
+ payment_method_id: value["paymentMethodId"],
7110
+ promo_code: value["promoCode"],
7111
+ skip_trial: value["skipTrial"]
7112
+ };
7113
+ }
7114
+
7115
+ // src/api/checkoutexternal/models/CreateCheckoutResponse.ts
7116
+ function CreateCheckoutResponseFromJSON(json) {
7117
+ return CreateCheckoutResponseFromJSONTyped(json, false);
7118
+ }
7119
+ function CreateCheckoutResponseFromJSONTyped(json, ignoreDiscriminator) {
7120
+ if (json == null) {
7121
+ return json;
7122
+ }
7123
+ return {
7124
+ data: CheckoutDraftResponseDataFromJSON(json["data"]),
7125
+ params: json["params"]
7126
+ };
7127
+ }
7128
+
6878
7129
  // src/api/checkoutexternal/models/SetupIntentResponseData.ts
6879
7130
  function SetupIntentResponseDataFromJSON(json) {
6880
7131
  return SetupIntentResponseDataFromJSONTyped(json, false);
@@ -7030,6 +7281,47 @@ function FetchCustomerBalanceResponseFromJSONTyped(json, ignoreDiscriminator) {
7030
7281
  };
7031
7282
  }
7032
7283
 
7284
+ // src/api/checkoutexternal/models/FinalizeCheckoutRequest.ts
7285
+ function FinalizeCheckoutRequestToJSON(json) {
7286
+ return FinalizeCheckoutRequestToJSONTyped(json, false);
7287
+ }
7288
+ function FinalizeCheckoutRequestToJSONTyped(value, ignoreDiscriminator = false) {
7289
+ if (value == null) {
7290
+ return value;
7291
+ }
7292
+ return {
7293
+ version: value["version"]
7294
+ };
7295
+ }
7296
+
7297
+ // src/api/checkoutexternal/models/FinalizeCheckoutResponse.ts
7298
+ function FinalizeCheckoutResponseFromJSON(json) {
7299
+ return FinalizeCheckoutResponseFromJSONTyped(json, false);
7300
+ }
7301
+ function FinalizeCheckoutResponseFromJSONTyped(json, ignoreDiscriminator) {
7302
+ if (json == null) {
7303
+ return json;
7304
+ }
7305
+ return {
7306
+ data: CheckoutResponseDataFromJSON(json["data"]),
7307
+ params: json["params"]
7308
+ };
7309
+ }
7310
+
7311
+ // src/api/checkoutexternal/models/GetCheckoutResponse.ts
7312
+ function GetCheckoutResponseFromJSON(json) {
7313
+ return GetCheckoutResponseFromJSONTyped(json, false);
7314
+ }
7315
+ function GetCheckoutResponseFromJSONTyped(json, ignoreDiscriminator) {
7316
+ if (json == null) {
7317
+ return json;
7318
+ }
7319
+ return {
7320
+ data: CheckoutDraftResponseDataFromJSON(json["data"]),
7321
+ params: json["params"]
7322
+ };
7323
+ }
7324
+
7033
7325
  // src/api/checkoutexternal/models/UpdateCheckoutTaxIDResponseData.ts
7034
7326
  function UpdateCheckoutTaxIDResponseDataFromJSON(json) {
7035
7327
  return UpdateCheckoutTaxIDResponseDataFromJSONTyped(json, false);
@@ -7238,6 +7530,36 @@ function HydrateUpcomingInvoiceResponseFromJSONTyped(json, ignoreDiscriminator)
7238
7530
  };
7239
7531
  }
7240
7532
 
7533
+ // src/api/checkoutexternal/models/ListCheckoutsParams.ts
7534
+ function ListCheckoutsParamsFromJSON(json) {
7535
+ return ListCheckoutsParamsFromJSONTyped(json, false);
7536
+ }
7537
+ function ListCheckoutsParamsFromJSONTyped(json, ignoreDiscriminator) {
7538
+ if (json == null) {
7539
+ return json;
7540
+ }
7541
+ return {
7542
+ companyId: json["company_id"] == null ? void 0 : json["company_id"],
7543
+ limit: json["limit"] == null ? void 0 : json["limit"],
7544
+ offset: json["offset"] == null ? void 0 : json["offset"],
7545
+ statuses: json["statuses"] == null ? void 0 : json["statuses"].map(CheckoutStatusFromJSON)
7546
+ };
7547
+ }
7548
+
7549
+ // src/api/checkoutexternal/models/ListCheckoutsResponse.ts
7550
+ function ListCheckoutsResponseFromJSON(json) {
7551
+ return ListCheckoutsResponseFromJSONTyped(json, false);
7552
+ }
7553
+ function ListCheckoutsResponseFromJSONTyped(json, ignoreDiscriminator) {
7554
+ if (json == null) {
7555
+ return json;
7556
+ }
7557
+ return {
7558
+ data: json["data"].map(CheckoutDraftResponseDataFromJSON),
7559
+ params: ListCheckoutsParamsFromJSON(json["params"])
7560
+ };
7561
+ }
7562
+
7241
7563
  // src/api/checkoutexternal/models/ListInvoicesParams.ts
7242
7564
  function ListInvoicesParamsFromJSON(json) {
7243
7565
  return ListInvoicesParamsFromJSONTyped(json, false);
@@ -7316,6 +7638,7 @@ function PreviewSubscriptionFinanceResponseDataFromJSONTyped(json, ignoreDiscrim
7316
7638
  }
7317
7639
  return {
7318
7640
  amountOff: json["amount_off"],
7641
+ currency: json["currency"],
7319
7642
  discountAmount: json["discount_amount"],
7320
7643
  discounts: json["discounts"].map(
7321
7644
  PreviewSubscriptionDiscountResponseDataFromJSON
@@ -7440,6 +7763,57 @@ function UpdateCheckoutFieldValuesResponseFromJSONTyped(json, ignoreDiscriminato
7440
7763
  };
7441
7764
  }
7442
7765
 
7766
+ // src/api/checkoutexternal/models/UpdateCheckoutRequest.ts
7767
+ function UpdateCheckoutRequestToJSON(json) {
7768
+ return UpdateCheckoutRequestToJSONTyped(json, false);
7769
+ }
7770
+ function UpdateCheckoutRequestToJSONTyped(value, ignoreDiscriminator = false) {
7771
+ if (value == null) {
7772
+ return value;
7773
+ }
7774
+ return {
7775
+ add_on_ids: value["addOnIds"].map(
7776
+ UpdateAddOnRequestBodyToJSON
7777
+ ),
7778
+ auto_topup_overrides: value["autoTopupOverrides"].map(
7779
+ UpdateAutoTopupOverrideRequestBodyToJSON
7780
+ ),
7781
+ billing_entity_id: value["billingEntityId"],
7782
+ coupon_external_id: value["couponExternalId"],
7783
+ credit_bundles: value["creditBundles"].map(
7784
+ UpdateCreditBundleRequestBodyToJSON
7785
+ ),
7786
+ currency: value["currency"],
7787
+ custom_field_values: value["customFieldValues"].map(
7788
+ CheckoutFieldValueToJSON
7789
+ ),
7790
+ new_plan_id: value["newPlanId"],
7791
+ new_price_id: value["newPriceId"],
7792
+ opt_in_accepted: value["optInAccepted"],
7793
+ pay_in_advance: value["payInAdvance"].map(
7794
+ UpdatePayInAdvanceRequestBodyToJSON
7795
+ ),
7796
+ payment_method_id: value["paymentMethodId"],
7797
+ promo_code: value["promoCode"],
7798
+ skip_trial: value["skipTrial"],
7799
+ version: value["version"]
7800
+ };
7801
+ }
7802
+
7803
+ // src/api/checkoutexternal/models/UpdateCheckoutResponse.ts
7804
+ function UpdateCheckoutResponseFromJSON(json) {
7805
+ return UpdateCheckoutResponseFromJSONTyped(json, false);
7806
+ }
7807
+ function UpdateCheckoutResponseFromJSONTyped(json, ignoreDiscriminator) {
7808
+ if (json == null) {
7809
+ return json;
7810
+ }
7811
+ return {
7812
+ data: CheckoutDraftResponseDataFromJSON(json["data"]),
7813
+ params: json["params"]
7814
+ };
7815
+ }
7816
+
7443
7817
  // src/api/checkoutexternal/models/UpdateCheckoutTaxIDRequestBody.ts
7444
7818
  function UpdateCheckoutTaxIDRequestBodyToJSON(json) {
7445
7819
  return UpdateCheckoutTaxIDRequestBodyToJSONTyped(json, false);
@@ -7570,6 +7944,51 @@ var CheckoutexternalApi = class extends BaseAPI {
7570
7944
  const response = await this.checkoutUnsubscribeRaw(initOverrides);
7571
7945
  return await response.value();
7572
7946
  }
7947
+ /**
7948
+ * Create checkout
7949
+ */
7950
+ async createCheckoutRaw(requestParameters, initOverrides) {
7951
+ if (requestParameters["createCheckoutRequest"] == null) {
7952
+ throw new RequiredError(
7953
+ "createCheckoutRequest",
7954
+ 'Required parameter "createCheckoutRequest" was null or undefined when calling createCheckout().'
7955
+ );
7956
+ }
7957
+ const queryParameters = {};
7958
+ const headerParameters = {};
7959
+ headerParameters["Content-Type"] = "application/json";
7960
+ if (this.configuration && this.configuration.apiKey) {
7961
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
7962
+ "X-Schematic-Api-Key"
7963
+ );
7964
+ }
7965
+ const response = await this.request(
7966
+ {
7967
+ path: `/checkouts`,
7968
+ method: "POST",
7969
+ headers: headerParameters,
7970
+ query: queryParameters,
7971
+ body: CreateCheckoutRequestToJSON(
7972
+ requestParameters["createCheckoutRequest"]
7973
+ )
7974
+ },
7975
+ initOverrides
7976
+ );
7977
+ return new JSONApiResponse(
7978
+ response,
7979
+ (jsonValue) => CreateCheckoutResponseFromJSON(jsonValue)
7980
+ );
7981
+ }
7982
+ /**
7983
+ * Create checkout
7984
+ */
7985
+ async createCheckout(requestParameters, initOverrides) {
7986
+ const response = await this.createCheckoutRaw(
7987
+ requestParameters,
7988
+ initOverrides
7989
+ );
7990
+ return await response.value();
7991
+ }
7573
7992
  /**
7574
7993
  * Create setup intent
7575
7994
  */
@@ -7678,6 +8097,104 @@ var CheckoutexternalApi = class extends BaseAPI {
7678
8097
  const response = await this.fetchCustomerBalanceRaw(initOverrides);
7679
8098
  return await response.value();
7680
8099
  }
8100
+ /**
8101
+ * Finalize checkout
8102
+ */
8103
+ async finalizeCheckoutRaw(requestParameters, initOverrides) {
8104
+ if (requestParameters["checkoutId"] == null) {
8105
+ throw new RequiredError(
8106
+ "checkoutId",
8107
+ 'Required parameter "checkoutId" was null or undefined when calling finalizeCheckout().'
8108
+ );
8109
+ }
8110
+ if (requestParameters["finalizeCheckoutRequest"] == null) {
8111
+ throw new RequiredError(
8112
+ "finalizeCheckoutRequest",
8113
+ 'Required parameter "finalizeCheckoutRequest" was null or undefined when calling finalizeCheckout().'
8114
+ );
8115
+ }
8116
+ const queryParameters = {};
8117
+ const headerParameters = {};
8118
+ headerParameters["Content-Type"] = "application/json";
8119
+ if (this.configuration && this.configuration.apiKey) {
8120
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
8121
+ "X-Schematic-Api-Key"
8122
+ );
8123
+ }
8124
+ const response = await this.request(
8125
+ {
8126
+ path: `/checkouts/{checkout_id}/finalize`.replace(
8127
+ `{${"checkout_id"}}`,
8128
+ encodeURIComponent(String(requestParameters["checkoutId"]))
8129
+ ),
8130
+ method: "POST",
8131
+ headers: headerParameters,
8132
+ query: queryParameters,
8133
+ body: FinalizeCheckoutRequestToJSON(
8134
+ requestParameters["finalizeCheckoutRequest"]
8135
+ )
8136
+ },
8137
+ initOverrides
8138
+ );
8139
+ return new JSONApiResponse(
8140
+ response,
8141
+ (jsonValue) => FinalizeCheckoutResponseFromJSON(jsonValue)
8142
+ );
8143
+ }
8144
+ /**
8145
+ * Finalize checkout
8146
+ */
8147
+ async finalizeCheckout(requestParameters, initOverrides) {
8148
+ const response = await this.finalizeCheckoutRaw(
8149
+ requestParameters,
8150
+ initOverrides
8151
+ );
8152
+ return await response.value();
8153
+ }
8154
+ /**
8155
+ * Get checkout
8156
+ */
8157
+ async getCheckoutRaw(requestParameters, initOverrides) {
8158
+ if (requestParameters["checkoutId"] == null) {
8159
+ throw new RequiredError(
8160
+ "checkoutId",
8161
+ 'Required parameter "checkoutId" was null or undefined when calling getCheckout().'
8162
+ );
8163
+ }
8164
+ const queryParameters = {};
8165
+ const headerParameters = {};
8166
+ if (this.configuration && this.configuration.apiKey) {
8167
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
8168
+ "X-Schematic-Api-Key"
8169
+ );
8170
+ }
8171
+ const response = await this.request(
8172
+ {
8173
+ path: `/checkouts/{checkout_id}`.replace(
8174
+ `{${"checkout_id"}}`,
8175
+ encodeURIComponent(String(requestParameters["checkoutId"]))
8176
+ ),
8177
+ method: "GET",
8178
+ headers: headerParameters,
8179
+ query: queryParameters
8180
+ },
8181
+ initOverrides
8182
+ );
8183
+ return new JSONApiResponse(
8184
+ response,
8185
+ (jsonValue) => GetCheckoutResponseFromJSON(jsonValue)
8186
+ );
8187
+ }
8188
+ /**
8189
+ * Get checkout
8190
+ */
8191
+ async getCheckout(requestParameters, initOverrides) {
8192
+ const response = await this.getCheckoutRaw(
8193
+ requestParameters,
8194
+ initOverrides
8195
+ );
8196
+ return await response.value();
8197
+ }
7681
8198
  /**
7682
8199
  * Get checkout tax ID
7683
8200
  */
@@ -8063,6 +8580,53 @@ var CheckoutexternalApi = class extends BaseAPI {
8063
8580
  );
8064
8581
  return await response.value();
8065
8582
  }
8583
+ /**
8584
+ * List checkouts
8585
+ */
8586
+ async listCheckoutsRaw(requestParameters, initOverrides) {
8587
+ const queryParameters = {};
8588
+ if (requestParameters["companyId"] != null) {
8589
+ queryParameters["company_id"] = requestParameters["companyId"];
8590
+ }
8591
+ if (requestParameters["statuses"] != null) {
8592
+ queryParameters["statuses"] = requestParameters["statuses"];
8593
+ }
8594
+ if (requestParameters["limit"] != null) {
8595
+ queryParameters["limit"] = requestParameters["limit"];
8596
+ }
8597
+ if (requestParameters["offset"] != null) {
8598
+ queryParameters["offset"] = requestParameters["offset"];
8599
+ }
8600
+ const headerParameters = {};
8601
+ if (this.configuration && this.configuration.apiKey) {
8602
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
8603
+ "X-Schematic-Api-Key"
8604
+ );
8605
+ }
8606
+ const response = await this.request(
8607
+ {
8608
+ path: `/checkouts`,
8609
+ method: "GET",
8610
+ headers: headerParameters,
8611
+ query: queryParameters
8612
+ },
8613
+ initOverrides
8614
+ );
8615
+ return new JSONApiResponse(
8616
+ response,
8617
+ (jsonValue) => ListCheckoutsResponseFromJSON(jsonValue)
8618
+ );
8619
+ }
8620
+ /**
8621
+ * List checkouts
8622
+ */
8623
+ async listCheckouts(requestParameters = {}, initOverrides) {
8624
+ const response = await this.listCheckoutsRaw(
8625
+ requestParameters,
8626
+ initOverrides
8627
+ );
8628
+ return await response.value();
8629
+ }
8066
8630
  /**
8067
8631
  * List invoices
8068
8632
  */
@@ -8149,6 +8713,60 @@ var CheckoutexternalApi = class extends BaseAPI {
8149
8713
  );
8150
8714
  return await response.value();
8151
8715
  }
8716
+ /**
8717
+ * Update checkout
8718
+ */
8719
+ async updateCheckoutRaw(requestParameters, initOverrides) {
8720
+ if (requestParameters["checkoutId"] == null) {
8721
+ throw new RequiredError(
8722
+ "checkoutId",
8723
+ 'Required parameter "checkoutId" was null or undefined when calling updateCheckout().'
8724
+ );
8725
+ }
8726
+ if (requestParameters["updateCheckoutRequest"] == null) {
8727
+ throw new RequiredError(
8728
+ "updateCheckoutRequest",
8729
+ 'Required parameter "updateCheckoutRequest" was null or undefined when calling updateCheckout().'
8730
+ );
8731
+ }
8732
+ const queryParameters = {};
8733
+ const headerParameters = {};
8734
+ headerParameters["Content-Type"] = "application/json";
8735
+ if (this.configuration && this.configuration.apiKey) {
8736
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
8737
+ "X-Schematic-Api-Key"
8738
+ );
8739
+ }
8740
+ const response = await this.request(
8741
+ {
8742
+ path: `/checkouts/{checkout_id}`.replace(
8743
+ `{${"checkout_id"}}`,
8744
+ encodeURIComponent(String(requestParameters["checkoutId"]))
8745
+ ),
8746
+ method: "PUT",
8747
+ headers: headerParameters,
8748
+ query: queryParameters,
8749
+ body: UpdateCheckoutRequestToJSON(
8750
+ requestParameters["updateCheckoutRequest"]
8751
+ )
8752
+ },
8753
+ initOverrides
8754
+ );
8755
+ return new JSONApiResponse(
8756
+ response,
8757
+ (jsonValue) => UpdateCheckoutResponseFromJSON(jsonValue)
8758
+ );
8759
+ }
8760
+ /**
8761
+ * Update checkout
8762
+ */
8763
+ async updateCheckout(requestParameters, initOverrides) {
8764
+ const response = await this.updateCheckoutRaw(
8765
+ requestParameters,
8766
+ initOverrides
8767
+ );
8768
+ return await response.value();
8769
+ }
8152
8770
  /**
8153
8771
  * Update checkout field values
8154
8772
  */
@@ -12929,6 +13547,12 @@ function getSubscriptionPeriod(billingSubscription) {
12929
13547
  );
12930
13548
  return derivePeriod(product?.interval, product?.intervalCount) ?? derivePeriod(billingSubscription.interval);
12931
13549
  }
13550
+ function getDefaultPlanPeriod(plans = []) {
13551
+ if (plans.some((plan) => plan.monthlyPrice)) return "month";
13552
+ if (plans.some((plan) => plan.quarterlyPrice)) return "quarter";
13553
+ if (plans.some((plan) => plan.yearlyPrice)) return "year";
13554
+ return "month";
13555
+ }
12932
13556
  var ChargeType = {
12933
13557
  oneTime: "one_time",
12934
13558
  recurring: "recurring",
@@ -14796,7 +15420,7 @@ var reducer = (state, action) => {
14796
15420
  // src/context/EmbedProvider.tsx
14797
15421
  import { jsx as jsx3, jsxs } from "react/jsx-runtime";
14798
15422
  var getCustomHeaders = (sessionId) => ({
14799
- "X-Schematic-Components-Version": "2.26.0",
15423
+ "X-Schematic-Components-Version": "2.27.1",
14800
15424
  "X-Schematic-Session-ID": sessionId
14801
15425
  });
14802
15426
  var normalizeCurrencyFilter = (filter2) => {
@@ -19124,7 +19748,7 @@ var CheckoutDialog = ({ top }) => {
19124
19748
  [data?.featureUsage?.features]
19125
19749
  );
19126
19750
  const getValidatedPeriod = () => {
19127
- const requestedPeriod = checkoutState?.period || getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month";
19751
+ const requestedPeriod = checkoutState?.period || getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || getDefaultPlanPeriod(data?.activePlans);
19128
19752
  if (checkoutState?.planId) {
19129
19753
  const requestedPlan = data?.activePlans?.find(
19130
19754
  (plan) => plan.id === checkoutState.planId
@@ -27938,7 +28562,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
27938
28562
  []
27939
28563
  );
27940
28564
  const [selectedPeriod, setSelectedPeriod] = useState21(
27941
- () => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month"
28565
+ () => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || getDefaultPlanPeriod(data?.activePlans)
27942
28566
  );
27943
28567
  const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
27944
28568
  const [selectedCurrency, setSelectedCurrency] = useState21(