@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.
@@ -4863,6 +4863,18 @@ function BillingSubscriptionViewFromJSONTyped(json, ignoreDiscriminator) {
4863
4863
  }
4864
4864
 
4865
4865
  // src/api/checkoutexternal/models/UpdatePayInAdvanceRequestBody.ts
4866
+ function UpdatePayInAdvanceRequestBodyFromJSON(json) {
4867
+ return UpdatePayInAdvanceRequestBodyFromJSONTyped(json, false);
4868
+ }
4869
+ function UpdatePayInAdvanceRequestBodyFromJSONTyped(json, ignoreDiscriminator) {
4870
+ if (json == null) {
4871
+ return json;
4872
+ }
4873
+ return {
4874
+ priceId: json["price_id"],
4875
+ quantity: json["quantity"]
4876
+ };
4877
+ }
4866
4878
  function UpdatePayInAdvanceRequestBodyToJSON(json) {
4867
4879
  return UpdatePayInAdvanceRequestBodyToJSONTyped(json, false);
4868
4880
  }
@@ -4877,6 +4889,18 @@ function UpdatePayInAdvanceRequestBodyToJSONTyped(value, ignoreDiscriminator = f
4877
4889
  }
4878
4890
 
4879
4891
  // src/api/checkoutexternal/models/UpdateCreditBundleRequestBody.ts
4892
+ function UpdateCreditBundleRequestBodyFromJSON(json) {
4893
+ return UpdateCreditBundleRequestBodyFromJSONTyped(json, false);
4894
+ }
4895
+ function UpdateCreditBundleRequestBodyFromJSONTyped(json, ignoreDiscriminator) {
4896
+ if (json == null) {
4897
+ return json;
4898
+ }
4899
+ return {
4900
+ bundleId: json["bundle_id"],
4901
+ quantity: json["quantity"]
4902
+ };
4903
+ }
4880
4904
  function UpdateCreditBundleRequestBodyToJSON(json) {
4881
4905
  return UpdateCreditBundleRequestBodyToJSONTyped(json, false);
4882
4906
  }
@@ -4891,6 +4915,18 @@ function UpdateCreditBundleRequestBodyToJSONTyped(value, ignoreDiscriminator = f
4891
4915
  }
4892
4916
 
4893
4917
  // src/api/checkoutexternal/models/CheckoutFieldValue.ts
4918
+ function CheckoutFieldValueFromJSON(json) {
4919
+ return CheckoutFieldValueFromJSONTyped(json, false);
4920
+ }
4921
+ function CheckoutFieldValueFromJSONTyped(json, ignoreDiscriminator) {
4922
+ if (json == null) {
4923
+ return json;
4924
+ }
4925
+ return {
4926
+ id: json["id"],
4927
+ value: json["value"]
4928
+ };
4929
+ }
4894
4930
  function CheckoutFieldValueToJSON(json) {
4895
4931
  return CheckoutFieldValueToJSONTyped(json, false);
4896
4932
  }
@@ -4905,6 +4941,18 @@ function CheckoutFieldValueToJSONTyped(value, ignoreDiscriminator = false) {
4905
4941
  }
4906
4942
 
4907
4943
  // src/api/checkoutexternal/models/UpdateAddOnRequestBody.ts
4944
+ function UpdateAddOnRequestBodyFromJSON(json) {
4945
+ return UpdateAddOnRequestBodyFromJSONTyped(json, false);
4946
+ }
4947
+ function UpdateAddOnRequestBodyFromJSONTyped(json, ignoreDiscriminator) {
4948
+ if (json == null) {
4949
+ return json;
4950
+ }
4951
+ return {
4952
+ addOnId: json["add_on_id"],
4953
+ priceId: json["price_id"]
4954
+ };
4955
+ }
4908
4956
  function UpdateAddOnRequestBodyToJSON(json) {
4909
4957
  return UpdateAddOnRequestBodyToJSONTyped(json, false);
4910
4958
  }
@@ -4919,6 +4967,20 @@ function UpdateAddOnRequestBodyToJSONTyped(value, ignoreDiscriminator = false) {
4919
4967
  }
4920
4968
 
4921
4969
  // src/api/checkoutexternal/models/UpdateAutoTopupOverrideRequestBody.ts
4970
+ function UpdateAutoTopupOverrideRequestBodyFromJSON(json) {
4971
+ return UpdateAutoTopupOverrideRequestBodyFromJSONTyped(json, false);
4972
+ }
4973
+ function UpdateAutoTopupOverrideRequestBodyFromJSONTyped(json, ignoreDiscriminator) {
4974
+ if (json == null) {
4975
+ return json;
4976
+ }
4977
+ return {
4978
+ autoTopupAmount: json["auto_topup_amount"] == null ? void 0 : json["auto_topup_amount"],
4979
+ autoTopupEnabled: json["auto_topup_enabled"] == null ? void 0 : json["auto_topup_enabled"],
4980
+ autoTopupThresholdCredits: json["auto_topup_threshold_credits"] == null ? void 0 : json["auto_topup_threshold_credits"],
4981
+ planCreditGrantId: json["plan_credit_grant_id"]
4982
+ };
4983
+ }
4922
4984
  function UpdateAutoTopupOverrideRequestBodyToJSON(json) {
4923
4985
  return UpdateAutoTopupOverrideRequestBodyToJSONTyped(json, false);
4924
4986
  }
@@ -4954,6 +5016,7 @@ function ChangeSubscriptionRequestBodyToJSONTyped(value, ignoreDiscriminator = f
4954
5016
  credit_bundles: value["creditBundles"].map(
4955
5017
  UpdateCreditBundleRequestBodyToJSON
4956
5018
  ),
5019
+ currency: value["currency"],
4957
5020
  custom_field_values: value["customFieldValues"].map(
4958
5021
  CheckoutFieldValueToJSON
4959
5022
  ),
@@ -4989,6 +5052,143 @@ function CheckoutBundlePurchaseBehaviorFromJSONTyped(json, ignoreDiscriminator)
4989
5052
  return json;
4990
5053
  }
4991
5054
 
5055
+ // src/api/checkoutexternal/models/CheckoutPriceSnapshot.ts
5056
+ function CheckoutPriceSnapshotFromJSON(json) {
5057
+ return CheckoutPriceSnapshotFromJSONTyped(json, false);
5058
+ }
5059
+ function CheckoutPriceSnapshotFromJSONTyped(json, ignoreDiscriminator) {
5060
+ if (json == null) {
5061
+ return json;
5062
+ }
5063
+ return {
5064
+ amountOff: json["amount_off"],
5065
+ currency: json["currency"],
5066
+ dueNow: json["due_now"],
5067
+ isScheduledDowngrade: json["is_scheduled_downgrade"],
5068
+ newCharges: json["new_charges"],
5069
+ optInRequired: json["opt_in_required"],
5070
+ paymentMethodRequired: json["payment_method_required"],
5071
+ percentOff: json["percent_off"],
5072
+ periodStart: new Date(json["period_start"]),
5073
+ pricedAt: new Date(json["priced_at"]),
5074
+ promoCodeApplied: json["promo_code_applied"],
5075
+ proration: json["proration"],
5076
+ scheduledChangeTime: json["scheduled_change_time"] == null ? void 0 : new Date(json["scheduled_change_time"]),
5077
+ taxAmount: json["tax_amount"] == null ? void 0 : json["tax_amount"],
5078
+ totalPerBillingPeriod: json["total_per_billing_period"],
5079
+ trialEnd: json["trial_end"] == null ? void 0 : new Date(json["trial_end"])
5080
+ };
5081
+ }
5082
+
5083
+ // src/api/checkoutexternal/models/CheckoutStatus.ts
5084
+ function CheckoutStatusFromJSON(json) {
5085
+ return CheckoutStatusFromJSONTyped(json, false);
5086
+ }
5087
+ function CheckoutStatusFromJSONTyped(json, ignoreDiscriminator) {
5088
+ return json;
5089
+ }
5090
+
5091
+ // src/api/checkoutexternal/models/CheckoutSelectionsResponseData.ts
5092
+ function CheckoutSelectionsResponseDataFromJSON(json) {
5093
+ return CheckoutSelectionsResponseDataFromJSONTyped(json, false);
5094
+ }
5095
+ function CheckoutSelectionsResponseDataFromJSONTyped(json, ignoreDiscriminator) {
5096
+ if (json == null) {
5097
+ return json;
5098
+ }
5099
+ return {
5100
+ addOnIds: json["add_on_ids"].map(
5101
+ UpdateAddOnRequestBodyFromJSON
5102
+ ),
5103
+ autoTopupOverrides: json["auto_topup_overrides"].map(
5104
+ UpdateAutoTopupOverrideRequestBodyFromJSON
5105
+ ),
5106
+ billingEntityId: json["billing_entity_id"] == null ? void 0 : json["billing_entity_id"],
5107
+ couponExternalId: json["coupon_external_id"] == null ? void 0 : json["coupon_external_id"],
5108
+ creditBundles: json["credit_bundles"].map(
5109
+ UpdateCreditBundleRequestBodyFromJSON
5110
+ ),
5111
+ customFieldValues: json["custom_field_values"].map(
5112
+ CheckoutFieldValueFromJSON
5113
+ ),
5114
+ newPlanId: json["new_plan_id"] == null ? void 0 : json["new_plan_id"],
5115
+ newPriceId: json["new_price_id"] == null ? void 0 : json["new_price_id"],
5116
+ optInAccepted: json["opt_in_accepted"] == null ? void 0 : json["opt_in_accepted"],
5117
+ payInAdvance: json["pay_in_advance"].map(
5118
+ UpdatePayInAdvanceRequestBodyFromJSON
5119
+ ),
5120
+ paymentMethodId: json["payment_method_id"] == null ? void 0 : json["payment_method_id"],
5121
+ promoCode: json["promo_code"] == null ? void 0 : json["promo_code"],
5122
+ skipTrial: json["skip_trial"]
5123
+ };
5124
+ }
5125
+
5126
+ // src/api/checkoutexternal/models/CheckoutProblemSource.ts
5127
+ function CheckoutProblemSourceFromJSON(json) {
5128
+ return CheckoutProblemSourceFromJSONTyped(json, false);
5129
+ }
5130
+ function CheckoutProblemSourceFromJSONTyped(json, ignoreDiscriminator) {
5131
+ return json;
5132
+ }
5133
+
5134
+ // src/api/checkoutexternal/models/CheckoutProblemCode.ts
5135
+ function CheckoutProblemCodeFromJSON(json) {
5136
+ return CheckoutProblemCodeFromJSONTyped(json, false);
5137
+ }
5138
+ function CheckoutProblemCodeFromJSONTyped(json, ignoreDiscriminator) {
5139
+ return json;
5140
+ }
5141
+
5142
+ // src/api/checkoutexternal/models/Problem.ts
5143
+ function ProblemFromJSON(json) {
5144
+ return ProblemFromJSONTyped(json, false);
5145
+ }
5146
+ function ProblemFromJSONTyped(json, ignoreDiscriminator) {
5147
+ if (json == null) {
5148
+ return json;
5149
+ }
5150
+ return {
5151
+ blocking: json["blocking"],
5152
+ bundleId: json["bundle_id"] == null ? void 0 : json["bundle_id"],
5153
+ code: CheckoutProblemCodeFromJSON(json["code"]),
5154
+ currency: json["currency"] == null ? void 0 : json["currency"],
5155
+ detail: json["detail"] == null ? void 0 : json["detail"],
5156
+ featureId: json["feature_id"] == null ? void 0 : json["feature_id"],
5157
+ fieldId: json["field_id"] == null ? void 0 : json["field_id"],
5158
+ message: json["message"],
5159
+ paymentMethodId: json["payment_method_id"] == null ? void 0 : json["payment_method_id"],
5160
+ planId: json["plan_id"] == null ? void 0 : json["plan_id"],
5161
+ priceId: json["price_id"] == null ? void 0 : json["price_id"],
5162
+ source: CheckoutProblemSourceFromJSON(json["source"])
5163
+ };
5164
+ }
5165
+
5166
+ // src/api/checkoutexternal/models/CheckoutDraftResponseData.ts
5167
+ function CheckoutDraftResponseDataFromJSON(json) {
5168
+ return CheckoutDraftResponseDataFromJSONTyped(json, false);
5169
+ }
5170
+ function CheckoutDraftResponseDataFromJSONTyped(json, ignoreDiscriminator) {
5171
+ if (json == null) {
5172
+ return json;
5173
+ }
5174
+ return {
5175
+ companyId: json["company_id"],
5176
+ completedAt: json["completed_at"] == null ? void 0 : new Date(json["completed_at"]),
5177
+ createdAt: new Date(json["created_at"]),
5178
+ expiresAt: json["expires_at"] == null ? void 0 : new Date(json["expires_at"]),
5179
+ id: json["id"],
5180
+ lastActivityAt: new Date(json["last_activity_at"]),
5181
+ priceSnapshot: json["price_snapshot"] == null ? void 0 : CheckoutPriceSnapshotFromJSON(json["price_snapshot"]),
5182
+ pricedAt: json["priced_at"] == null ? void 0 : new Date(json["priced_at"]),
5183
+ problems: json["problems"].map(ProblemFromJSON),
5184
+ selections: CheckoutSelectionsResponseDataFromJSON(json["selections"]),
5185
+ shareToken: json["share_token"] == null ? void 0 : json["share_token"],
5186
+ status: CheckoutStatusFromJSON(json["status"]),
5187
+ updatedAt: new Date(json["updated_at"]),
5188
+ version: json["version"]
5189
+ };
5190
+ }
5191
+
4992
5192
  // src/api/checkoutexternal/models/CheckoutFieldWithValue.ts
4993
5193
  function CheckoutFieldWithValueFromJSON(json) {
4994
5194
  return CheckoutFieldWithValueFromJSONTyped(json, false);
@@ -7000,6 +7200,57 @@ function ComponentHydrateResponseDataFromJSONTyped(json, ignoreDiscriminator) {
7000
7200
  };
7001
7201
  }
7002
7202
 
7203
+ // src/api/checkoutexternal/models/CreateCheckoutRequest.ts
7204
+ function CreateCheckoutRequestToJSON(json) {
7205
+ return CreateCheckoutRequestToJSONTyped(json, false);
7206
+ }
7207
+ function CreateCheckoutRequestToJSONTyped(value, ignoreDiscriminator = false) {
7208
+ if (value == null) {
7209
+ return value;
7210
+ }
7211
+ return {
7212
+ add_on_ids: value["addOnIds"].map(
7213
+ UpdateAddOnRequestBodyToJSON
7214
+ ),
7215
+ auto_topup_overrides: value["autoTopupOverrides"].map(
7216
+ UpdateAutoTopupOverrideRequestBodyToJSON
7217
+ ),
7218
+ billing_entity_id: value["billingEntityId"],
7219
+ company_id: value["companyId"],
7220
+ coupon_external_id: value["couponExternalId"],
7221
+ credit_bundles: value["creditBundles"].map(
7222
+ UpdateCreditBundleRequestBodyToJSON
7223
+ ),
7224
+ currency: value["currency"],
7225
+ custom_field_values: value["customFieldValues"].map(
7226
+ CheckoutFieldValueToJSON
7227
+ ),
7228
+ new_plan_id: value["newPlanId"],
7229
+ new_price_id: value["newPriceId"],
7230
+ opt_in_accepted: value["optInAccepted"],
7231
+ pay_in_advance: value["payInAdvance"].map(
7232
+ UpdatePayInAdvanceRequestBodyToJSON
7233
+ ),
7234
+ payment_method_id: value["paymentMethodId"],
7235
+ promo_code: value["promoCode"],
7236
+ skip_trial: value["skipTrial"]
7237
+ };
7238
+ }
7239
+
7240
+ // src/api/checkoutexternal/models/CreateCheckoutResponse.ts
7241
+ function CreateCheckoutResponseFromJSON(json) {
7242
+ return CreateCheckoutResponseFromJSONTyped(json, false);
7243
+ }
7244
+ function CreateCheckoutResponseFromJSONTyped(json, ignoreDiscriminator) {
7245
+ if (json == null) {
7246
+ return json;
7247
+ }
7248
+ return {
7249
+ data: CheckoutDraftResponseDataFromJSON(json["data"]),
7250
+ params: json["params"]
7251
+ };
7252
+ }
7253
+
7003
7254
  // src/api/checkoutexternal/models/SetupIntentResponseData.ts
7004
7255
  function SetupIntentResponseDataFromJSON(json) {
7005
7256
  return SetupIntentResponseDataFromJSONTyped(json, false);
@@ -7155,6 +7406,47 @@ function FetchCustomerBalanceResponseFromJSONTyped(json, ignoreDiscriminator) {
7155
7406
  };
7156
7407
  }
7157
7408
 
7409
+ // src/api/checkoutexternal/models/FinalizeCheckoutRequest.ts
7410
+ function FinalizeCheckoutRequestToJSON(json) {
7411
+ return FinalizeCheckoutRequestToJSONTyped(json, false);
7412
+ }
7413
+ function FinalizeCheckoutRequestToJSONTyped(value, ignoreDiscriminator = false) {
7414
+ if (value == null) {
7415
+ return value;
7416
+ }
7417
+ return {
7418
+ version: value["version"]
7419
+ };
7420
+ }
7421
+
7422
+ // src/api/checkoutexternal/models/FinalizeCheckoutResponse.ts
7423
+ function FinalizeCheckoutResponseFromJSON(json) {
7424
+ return FinalizeCheckoutResponseFromJSONTyped(json, false);
7425
+ }
7426
+ function FinalizeCheckoutResponseFromJSONTyped(json, ignoreDiscriminator) {
7427
+ if (json == null) {
7428
+ return json;
7429
+ }
7430
+ return {
7431
+ data: CheckoutResponseDataFromJSON(json["data"]),
7432
+ params: json["params"]
7433
+ };
7434
+ }
7435
+
7436
+ // src/api/checkoutexternal/models/GetCheckoutResponse.ts
7437
+ function GetCheckoutResponseFromJSON(json) {
7438
+ return GetCheckoutResponseFromJSONTyped(json, false);
7439
+ }
7440
+ function GetCheckoutResponseFromJSONTyped(json, ignoreDiscriminator) {
7441
+ if (json == null) {
7442
+ return json;
7443
+ }
7444
+ return {
7445
+ data: CheckoutDraftResponseDataFromJSON(json["data"]),
7446
+ params: json["params"]
7447
+ };
7448
+ }
7449
+
7158
7450
  // src/api/checkoutexternal/models/UpdateCheckoutTaxIDResponseData.ts
7159
7451
  function UpdateCheckoutTaxIDResponseDataFromJSON(json) {
7160
7452
  return UpdateCheckoutTaxIDResponseDataFromJSONTyped(json, false);
@@ -7363,6 +7655,36 @@ function HydrateUpcomingInvoiceResponseFromJSONTyped(json, ignoreDiscriminator)
7363
7655
  };
7364
7656
  }
7365
7657
 
7658
+ // src/api/checkoutexternal/models/ListCheckoutsParams.ts
7659
+ function ListCheckoutsParamsFromJSON(json) {
7660
+ return ListCheckoutsParamsFromJSONTyped(json, false);
7661
+ }
7662
+ function ListCheckoutsParamsFromJSONTyped(json, ignoreDiscriminator) {
7663
+ if (json == null) {
7664
+ return json;
7665
+ }
7666
+ return {
7667
+ companyId: json["company_id"] == null ? void 0 : json["company_id"],
7668
+ limit: json["limit"] == null ? void 0 : json["limit"],
7669
+ offset: json["offset"] == null ? void 0 : json["offset"],
7670
+ statuses: json["statuses"] == null ? void 0 : json["statuses"].map(CheckoutStatusFromJSON)
7671
+ };
7672
+ }
7673
+
7674
+ // src/api/checkoutexternal/models/ListCheckoutsResponse.ts
7675
+ function ListCheckoutsResponseFromJSON(json) {
7676
+ return ListCheckoutsResponseFromJSONTyped(json, false);
7677
+ }
7678
+ function ListCheckoutsResponseFromJSONTyped(json, ignoreDiscriminator) {
7679
+ if (json == null) {
7680
+ return json;
7681
+ }
7682
+ return {
7683
+ data: json["data"].map(CheckoutDraftResponseDataFromJSON),
7684
+ params: ListCheckoutsParamsFromJSON(json["params"])
7685
+ };
7686
+ }
7687
+
7366
7688
  // src/api/checkoutexternal/models/ListInvoicesParams.ts
7367
7689
  function ListInvoicesParamsFromJSON(json) {
7368
7690
  return ListInvoicesParamsFromJSONTyped(json, false);
@@ -7441,6 +7763,7 @@ function PreviewSubscriptionFinanceResponseDataFromJSONTyped(json, ignoreDiscrim
7441
7763
  }
7442
7764
  return {
7443
7765
  amountOff: json["amount_off"],
7766
+ currency: json["currency"],
7444
7767
  discountAmount: json["discount_amount"],
7445
7768
  discounts: json["discounts"].map(
7446
7769
  PreviewSubscriptionDiscountResponseDataFromJSON
@@ -7565,6 +7888,57 @@ function UpdateCheckoutFieldValuesResponseFromJSONTyped(json, ignoreDiscriminato
7565
7888
  };
7566
7889
  }
7567
7890
 
7891
+ // src/api/checkoutexternal/models/UpdateCheckoutRequest.ts
7892
+ function UpdateCheckoutRequestToJSON(json) {
7893
+ return UpdateCheckoutRequestToJSONTyped(json, false);
7894
+ }
7895
+ function UpdateCheckoutRequestToJSONTyped(value, ignoreDiscriminator = false) {
7896
+ if (value == null) {
7897
+ return value;
7898
+ }
7899
+ return {
7900
+ add_on_ids: value["addOnIds"].map(
7901
+ UpdateAddOnRequestBodyToJSON
7902
+ ),
7903
+ auto_topup_overrides: value["autoTopupOverrides"].map(
7904
+ UpdateAutoTopupOverrideRequestBodyToJSON
7905
+ ),
7906
+ billing_entity_id: value["billingEntityId"],
7907
+ coupon_external_id: value["couponExternalId"],
7908
+ credit_bundles: value["creditBundles"].map(
7909
+ UpdateCreditBundleRequestBodyToJSON
7910
+ ),
7911
+ currency: value["currency"],
7912
+ custom_field_values: value["customFieldValues"].map(
7913
+ CheckoutFieldValueToJSON
7914
+ ),
7915
+ new_plan_id: value["newPlanId"],
7916
+ new_price_id: value["newPriceId"],
7917
+ opt_in_accepted: value["optInAccepted"],
7918
+ pay_in_advance: value["payInAdvance"].map(
7919
+ UpdatePayInAdvanceRequestBodyToJSON
7920
+ ),
7921
+ payment_method_id: value["paymentMethodId"],
7922
+ promo_code: value["promoCode"],
7923
+ skip_trial: value["skipTrial"],
7924
+ version: value["version"]
7925
+ };
7926
+ }
7927
+
7928
+ // src/api/checkoutexternal/models/UpdateCheckoutResponse.ts
7929
+ function UpdateCheckoutResponseFromJSON(json) {
7930
+ return UpdateCheckoutResponseFromJSONTyped(json, false);
7931
+ }
7932
+ function UpdateCheckoutResponseFromJSONTyped(json, ignoreDiscriminator) {
7933
+ if (json == null) {
7934
+ return json;
7935
+ }
7936
+ return {
7937
+ data: CheckoutDraftResponseDataFromJSON(json["data"]),
7938
+ params: json["params"]
7939
+ };
7940
+ }
7941
+
7568
7942
  // src/api/checkoutexternal/models/UpdateCheckoutTaxIDRequestBody.ts
7569
7943
  function UpdateCheckoutTaxIDRequestBodyToJSON(json) {
7570
7944
  return UpdateCheckoutTaxIDRequestBodyToJSONTyped(json, false);
@@ -7695,6 +8069,51 @@ var CheckoutexternalApi = class extends BaseAPI {
7695
8069
  const response = await this.checkoutUnsubscribeRaw(initOverrides);
7696
8070
  return await response.value();
7697
8071
  }
8072
+ /**
8073
+ * Create checkout
8074
+ */
8075
+ async createCheckoutRaw(requestParameters, initOverrides) {
8076
+ if (requestParameters["createCheckoutRequest"] == null) {
8077
+ throw new RequiredError(
8078
+ "createCheckoutRequest",
8079
+ 'Required parameter "createCheckoutRequest" was null or undefined when calling createCheckout().'
8080
+ );
8081
+ }
8082
+ const queryParameters = {};
8083
+ const headerParameters = {};
8084
+ headerParameters["Content-Type"] = "application/json";
8085
+ if (this.configuration && this.configuration.apiKey) {
8086
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
8087
+ "X-Schematic-Api-Key"
8088
+ );
8089
+ }
8090
+ const response = await this.request(
8091
+ {
8092
+ path: `/checkouts`,
8093
+ method: "POST",
8094
+ headers: headerParameters,
8095
+ query: queryParameters,
8096
+ body: CreateCheckoutRequestToJSON(
8097
+ requestParameters["createCheckoutRequest"]
8098
+ )
8099
+ },
8100
+ initOverrides
8101
+ );
8102
+ return new JSONApiResponse(
8103
+ response,
8104
+ (jsonValue) => CreateCheckoutResponseFromJSON(jsonValue)
8105
+ );
8106
+ }
8107
+ /**
8108
+ * Create checkout
8109
+ */
8110
+ async createCheckout(requestParameters, initOverrides) {
8111
+ const response = await this.createCheckoutRaw(
8112
+ requestParameters,
8113
+ initOverrides
8114
+ );
8115
+ return await response.value();
8116
+ }
7698
8117
  /**
7699
8118
  * Create setup intent
7700
8119
  */
@@ -7803,6 +8222,104 @@ var CheckoutexternalApi = class extends BaseAPI {
7803
8222
  const response = await this.fetchCustomerBalanceRaw(initOverrides);
7804
8223
  return await response.value();
7805
8224
  }
8225
+ /**
8226
+ * Finalize checkout
8227
+ */
8228
+ async finalizeCheckoutRaw(requestParameters, initOverrides) {
8229
+ if (requestParameters["checkoutId"] == null) {
8230
+ throw new RequiredError(
8231
+ "checkoutId",
8232
+ 'Required parameter "checkoutId" was null or undefined when calling finalizeCheckout().'
8233
+ );
8234
+ }
8235
+ if (requestParameters["finalizeCheckoutRequest"] == null) {
8236
+ throw new RequiredError(
8237
+ "finalizeCheckoutRequest",
8238
+ 'Required parameter "finalizeCheckoutRequest" was null or undefined when calling finalizeCheckout().'
8239
+ );
8240
+ }
8241
+ const queryParameters = {};
8242
+ const headerParameters = {};
8243
+ headerParameters["Content-Type"] = "application/json";
8244
+ if (this.configuration && this.configuration.apiKey) {
8245
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
8246
+ "X-Schematic-Api-Key"
8247
+ );
8248
+ }
8249
+ const response = await this.request(
8250
+ {
8251
+ path: `/checkouts/{checkout_id}/finalize`.replace(
8252
+ `{${"checkout_id"}}`,
8253
+ encodeURIComponent(String(requestParameters["checkoutId"]))
8254
+ ),
8255
+ method: "POST",
8256
+ headers: headerParameters,
8257
+ query: queryParameters,
8258
+ body: FinalizeCheckoutRequestToJSON(
8259
+ requestParameters["finalizeCheckoutRequest"]
8260
+ )
8261
+ },
8262
+ initOverrides
8263
+ );
8264
+ return new JSONApiResponse(
8265
+ response,
8266
+ (jsonValue) => FinalizeCheckoutResponseFromJSON(jsonValue)
8267
+ );
8268
+ }
8269
+ /**
8270
+ * Finalize checkout
8271
+ */
8272
+ async finalizeCheckout(requestParameters, initOverrides) {
8273
+ const response = await this.finalizeCheckoutRaw(
8274
+ requestParameters,
8275
+ initOverrides
8276
+ );
8277
+ return await response.value();
8278
+ }
8279
+ /**
8280
+ * Get checkout
8281
+ */
8282
+ async getCheckoutRaw(requestParameters, initOverrides) {
8283
+ if (requestParameters["checkoutId"] == null) {
8284
+ throw new RequiredError(
8285
+ "checkoutId",
8286
+ 'Required parameter "checkoutId" was null or undefined when calling getCheckout().'
8287
+ );
8288
+ }
8289
+ const queryParameters = {};
8290
+ const headerParameters = {};
8291
+ if (this.configuration && this.configuration.apiKey) {
8292
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
8293
+ "X-Schematic-Api-Key"
8294
+ );
8295
+ }
8296
+ const response = await this.request(
8297
+ {
8298
+ path: `/checkouts/{checkout_id}`.replace(
8299
+ `{${"checkout_id"}}`,
8300
+ encodeURIComponent(String(requestParameters["checkoutId"]))
8301
+ ),
8302
+ method: "GET",
8303
+ headers: headerParameters,
8304
+ query: queryParameters
8305
+ },
8306
+ initOverrides
8307
+ );
8308
+ return new JSONApiResponse(
8309
+ response,
8310
+ (jsonValue) => GetCheckoutResponseFromJSON(jsonValue)
8311
+ );
8312
+ }
8313
+ /**
8314
+ * Get checkout
8315
+ */
8316
+ async getCheckout(requestParameters, initOverrides) {
8317
+ const response = await this.getCheckoutRaw(
8318
+ requestParameters,
8319
+ initOverrides
8320
+ );
8321
+ return await response.value();
8322
+ }
7806
8323
  /**
7807
8324
  * Get checkout tax ID
7808
8325
  */
@@ -8188,6 +8705,53 @@ var CheckoutexternalApi = class extends BaseAPI {
8188
8705
  );
8189
8706
  return await response.value();
8190
8707
  }
8708
+ /**
8709
+ * List checkouts
8710
+ */
8711
+ async listCheckoutsRaw(requestParameters, initOverrides) {
8712
+ const queryParameters = {};
8713
+ if (requestParameters["companyId"] != null) {
8714
+ queryParameters["company_id"] = requestParameters["companyId"];
8715
+ }
8716
+ if (requestParameters["statuses"] != null) {
8717
+ queryParameters["statuses"] = requestParameters["statuses"];
8718
+ }
8719
+ if (requestParameters["limit"] != null) {
8720
+ queryParameters["limit"] = requestParameters["limit"];
8721
+ }
8722
+ if (requestParameters["offset"] != null) {
8723
+ queryParameters["offset"] = requestParameters["offset"];
8724
+ }
8725
+ const headerParameters = {};
8726
+ if (this.configuration && this.configuration.apiKey) {
8727
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
8728
+ "X-Schematic-Api-Key"
8729
+ );
8730
+ }
8731
+ const response = await this.request(
8732
+ {
8733
+ path: `/checkouts`,
8734
+ method: "GET",
8735
+ headers: headerParameters,
8736
+ query: queryParameters
8737
+ },
8738
+ initOverrides
8739
+ );
8740
+ return new JSONApiResponse(
8741
+ response,
8742
+ (jsonValue) => ListCheckoutsResponseFromJSON(jsonValue)
8743
+ );
8744
+ }
8745
+ /**
8746
+ * List checkouts
8747
+ */
8748
+ async listCheckouts(requestParameters = {}, initOverrides) {
8749
+ const response = await this.listCheckoutsRaw(
8750
+ requestParameters,
8751
+ initOverrides
8752
+ );
8753
+ return await response.value();
8754
+ }
8191
8755
  /**
8192
8756
  * List invoices
8193
8757
  */
@@ -8274,6 +8838,60 @@ var CheckoutexternalApi = class extends BaseAPI {
8274
8838
  );
8275
8839
  return await response.value();
8276
8840
  }
8841
+ /**
8842
+ * Update checkout
8843
+ */
8844
+ async updateCheckoutRaw(requestParameters, initOverrides) {
8845
+ if (requestParameters["checkoutId"] == null) {
8846
+ throw new RequiredError(
8847
+ "checkoutId",
8848
+ 'Required parameter "checkoutId" was null or undefined when calling updateCheckout().'
8849
+ );
8850
+ }
8851
+ if (requestParameters["updateCheckoutRequest"] == null) {
8852
+ throw new RequiredError(
8853
+ "updateCheckoutRequest",
8854
+ 'Required parameter "updateCheckoutRequest" was null or undefined when calling updateCheckout().'
8855
+ );
8856
+ }
8857
+ const queryParameters = {};
8858
+ const headerParameters = {};
8859
+ headerParameters["Content-Type"] = "application/json";
8860
+ if (this.configuration && this.configuration.apiKey) {
8861
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
8862
+ "X-Schematic-Api-Key"
8863
+ );
8864
+ }
8865
+ const response = await this.request(
8866
+ {
8867
+ path: `/checkouts/{checkout_id}`.replace(
8868
+ `{${"checkout_id"}}`,
8869
+ encodeURIComponent(String(requestParameters["checkoutId"]))
8870
+ ),
8871
+ method: "PUT",
8872
+ headers: headerParameters,
8873
+ query: queryParameters,
8874
+ body: UpdateCheckoutRequestToJSON(
8875
+ requestParameters["updateCheckoutRequest"]
8876
+ )
8877
+ },
8878
+ initOverrides
8879
+ );
8880
+ return new JSONApiResponse(
8881
+ response,
8882
+ (jsonValue) => UpdateCheckoutResponseFromJSON(jsonValue)
8883
+ );
8884
+ }
8885
+ /**
8886
+ * Update checkout
8887
+ */
8888
+ async updateCheckout(requestParameters, initOverrides) {
8889
+ const response = await this.updateCheckoutRaw(
8890
+ requestParameters,
8891
+ initOverrides
8892
+ );
8893
+ return await response.value();
8894
+ }
8277
8895
  /**
8278
8896
  * Update checkout field values
8279
8897
  */
@@ -13054,6 +13672,12 @@ function getSubscriptionPeriod(billingSubscription) {
13054
13672
  );
13055
13673
  return derivePeriod(product?.interval, product?.intervalCount) ?? derivePeriod(billingSubscription.interval);
13056
13674
  }
13675
+ function getDefaultPlanPeriod(plans = []) {
13676
+ if (plans.some((plan) => plan.monthlyPrice)) return "month";
13677
+ if (plans.some((plan) => plan.quarterlyPrice)) return "quarter";
13678
+ if (plans.some((plan) => plan.yearlyPrice)) return "year";
13679
+ return "month";
13680
+ }
13057
13681
  var ChargeType = {
13058
13682
  oneTime: "one_time",
13059
13683
  recurring: "recurring",
@@ -14921,7 +15545,7 @@ var reducer = (state, action) => {
14921
15545
  // src/context/EmbedProvider.tsx
14922
15546
  import { jsx as jsx3, jsxs } from "react/jsx-runtime";
14923
15547
  var getCustomHeaders = (sessionId) => ({
14924
- "X-Schematic-Components-Version": "2.26.0",
15548
+ "X-Schematic-Components-Version": "2.27.1",
14925
15549
  "X-Schematic-Session-ID": sessionId
14926
15550
  });
14927
15551
  var normalizeCurrencyFilter = (filter2) => {
@@ -19249,7 +19873,7 @@ var CheckoutDialog = ({ top }) => {
19249
19873
  [data?.featureUsage?.features]
19250
19874
  );
19251
19875
  const getValidatedPeriod = () => {
19252
- const requestedPeriod = checkoutState?.period || getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month";
19876
+ const requestedPeriod = checkoutState?.period || getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || getDefaultPlanPeriod(data?.activePlans);
19253
19877
  if (checkoutState?.planId) {
19254
19878
  const requestedPlan = data?.activePlans?.find(
19255
19879
  (plan) => plan.id === checkoutState.planId
@@ -28063,7 +28687,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
28063
28687
  []
28064
28688
  );
28065
28689
  const [selectedPeriod, setSelectedPeriod] = useState21(
28066
- () => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month"
28690
+ () => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || getDefaultPlanPeriod(data?.activePlans)
28067
28691
  );
28068
28692
  const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
28069
28693
  const [selectedCurrency, setSelectedCurrency] = useState21(