@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.
@@ -4834,6 +4834,18 @@ function BillingSubscriptionViewFromJSONTyped(json, ignoreDiscriminator) {
4834
4834
  }
4835
4835
 
4836
4836
  // src/api/checkoutexternal/models/UpdatePayInAdvanceRequestBody.ts
4837
+ function UpdatePayInAdvanceRequestBodyFromJSON(json) {
4838
+ return UpdatePayInAdvanceRequestBodyFromJSONTyped(json, false);
4839
+ }
4840
+ function UpdatePayInAdvanceRequestBodyFromJSONTyped(json, ignoreDiscriminator) {
4841
+ if (json == null) {
4842
+ return json;
4843
+ }
4844
+ return {
4845
+ priceId: json["price_id"],
4846
+ quantity: json["quantity"]
4847
+ };
4848
+ }
4837
4849
  function UpdatePayInAdvanceRequestBodyToJSON(json) {
4838
4850
  return UpdatePayInAdvanceRequestBodyToJSONTyped(json, false);
4839
4851
  }
@@ -4848,6 +4860,18 @@ function UpdatePayInAdvanceRequestBodyToJSONTyped(value, ignoreDiscriminator = f
4848
4860
  }
4849
4861
 
4850
4862
  // src/api/checkoutexternal/models/UpdateCreditBundleRequestBody.ts
4863
+ function UpdateCreditBundleRequestBodyFromJSON(json) {
4864
+ return UpdateCreditBundleRequestBodyFromJSONTyped(json, false);
4865
+ }
4866
+ function UpdateCreditBundleRequestBodyFromJSONTyped(json, ignoreDiscriminator) {
4867
+ if (json == null) {
4868
+ return json;
4869
+ }
4870
+ return {
4871
+ bundleId: json["bundle_id"],
4872
+ quantity: json["quantity"]
4873
+ };
4874
+ }
4851
4875
  function UpdateCreditBundleRequestBodyToJSON(json) {
4852
4876
  return UpdateCreditBundleRequestBodyToJSONTyped(json, false);
4853
4877
  }
@@ -4862,6 +4886,18 @@ function UpdateCreditBundleRequestBodyToJSONTyped(value, ignoreDiscriminator = f
4862
4886
  }
4863
4887
 
4864
4888
  // src/api/checkoutexternal/models/CheckoutFieldValue.ts
4889
+ function CheckoutFieldValueFromJSON(json) {
4890
+ return CheckoutFieldValueFromJSONTyped(json, false);
4891
+ }
4892
+ function CheckoutFieldValueFromJSONTyped(json, ignoreDiscriminator) {
4893
+ if (json == null) {
4894
+ return json;
4895
+ }
4896
+ return {
4897
+ id: json["id"],
4898
+ value: json["value"]
4899
+ };
4900
+ }
4865
4901
  function CheckoutFieldValueToJSON(json) {
4866
4902
  return CheckoutFieldValueToJSONTyped(json, false);
4867
4903
  }
@@ -4876,6 +4912,18 @@ function CheckoutFieldValueToJSONTyped(value, ignoreDiscriminator = false) {
4876
4912
  }
4877
4913
 
4878
4914
  // src/api/checkoutexternal/models/UpdateAddOnRequestBody.ts
4915
+ function UpdateAddOnRequestBodyFromJSON(json) {
4916
+ return UpdateAddOnRequestBodyFromJSONTyped(json, false);
4917
+ }
4918
+ function UpdateAddOnRequestBodyFromJSONTyped(json, ignoreDiscriminator) {
4919
+ if (json == null) {
4920
+ return json;
4921
+ }
4922
+ return {
4923
+ addOnId: json["add_on_id"],
4924
+ priceId: json["price_id"]
4925
+ };
4926
+ }
4879
4927
  function UpdateAddOnRequestBodyToJSON(json) {
4880
4928
  return UpdateAddOnRequestBodyToJSONTyped(json, false);
4881
4929
  }
@@ -4890,6 +4938,20 @@ function UpdateAddOnRequestBodyToJSONTyped(value, ignoreDiscriminator = false) {
4890
4938
  }
4891
4939
 
4892
4940
  // src/api/checkoutexternal/models/UpdateAutoTopupOverrideRequestBody.ts
4941
+ function UpdateAutoTopupOverrideRequestBodyFromJSON(json) {
4942
+ return UpdateAutoTopupOverrideRequestBodyFromJSONTyped(json, false);
4943
+ }
4944
+ function UpdateAutoTopupOverrideRequestBodyFromJSONTyped(json, ignoreDiscriminator) {
4945
+ if (json == null) {
4946
+ return json;
4947
+ }
4948
+ return {
4949
+ autoTopupAmount: json["auto_topup_amount"] == null ? void 0 : json["auto_topup_amount"],
4950
+ autoTopupEnabled: json["auto_topup_enabled"] == null ? void 0 : json["auto_topup_enabled"],
4951
+ autoTopupThresholdCredits: json["auto_topup_threshold_credits"] == null ? void 0 : json["auto_topup_threshold_credits"],
4952
+ planCreditGrantId: json["plan_credit_grant_id"]
4953
+ };
4954
+ }
4893
4955
  function UpdateAutoTopupOverrideRequestBodyToJSON(json) {
4894
4956
  return UpdateAutoTopupOverrideRequestBodyToJSONTyped(json, false);
4895
4957
  }
@@ -4925,6 +4987,7 @@ function ChangeSubscriptionRequestBodyToJSONTyped(value, ignoreDiscriminator = f
4925
4987
  credit_bundles: value["creditBundles"].map(
4926
4988
  UpdateCreditBundleRequestBodyToJSON
4927
4989
  ),
4990
+ currency: value["currency"],
4928
4991
  custom_field_values: value["customFieldValues"].map(
4929
4992
  CheckoutFieldValueToJSON
4930
4993
  ),
@@ -4960,6 +5023,143 @@ function CheckoutBundlePurchaseBehaviorFromJSONTyped(json, ignoreDiscriminator)
4960
5023
  return json;
4961
5024
  }
4962
5025
 
5026
+ // src/api/checkoutexternal/models/CheckoutPriceSnapshot.ts
5027
+ function CheckoutPriceSnapshotFromJSON(json) {
5028
+ return CheckoutPriceSnapshotFromJSONTyped(json, false);
5029
+ }
5030
+ function CheckoutPriceSnapshotFromJSONTyped(json, ignoreDiscriminator) {
5031
+ if (json == null) {
5032
+ return json;
5033
+ }
5034
+ return {
5035
+ amountOff: json["amount_off"],
5036
+ currency: json["currency"],
5037
+ dueNow: json["due_now"],
5038
+ isScheduledDowngrade: json["is_scheduled_downgrade"],
5039
+ newCharges: json["new_charges"],
5040
+ optInRequired: json["opt_in_required"],
5041
+ paymentMethodRequired: json["payment_method_required"],
5042
+ percentOff: json["percent_off"],
5043
+ periodStart: new Date(json["period_start"]),
5044
+ pricedAt: new Date(json["priced_at"]),
5045
+ promoCodeApplied: json["promo_code_applied"],
5046
+ proration: json["proration"],
5047
+ scheduledChangeTime: json["scheduled_change_time"] == null ? void 0 : new Date(json["scheduled_change_time"]),
5048
+ taxAmount: json["tax_amount"] == null ? void 0 : json["tax_amount"],
5049
+ totalPerBillingPeriod: json["total_per_billing_period"],
5050
+ trialEnd: json["trial_end"] == null ? void 0 : new Date(json["trial_end"])
5051
+ };
5052
+ }
5053
+
5054
+ // src/api/checkoutexternal/models/CheckoutStatus.ts
5055
+ function CheckoutStatusFromJSON(json) {
5056
+ return CheckoutStatusFromJSONTyped(json, false);
5057
+ }
5058
+ function CheckoutStatusFromJSONTyped(json, ignoreDiscriminator) {
5059
+ return json;
5060
+ }
5061
+
5062
+ // src/api/checkoutexternal/models/CheckoutSelectionsResponseData.ts
5063
+ function CheckoutSelectionsResponseDataFromJSON(json) {
5064
+ return CheckoutSelectionsResponseDataFromJSONTyped(json, false);
5065
+ }
5066
+ function CheckoutSelectionsResponseDataFromJSONTyped(json, ignoreDiscriminator) {
5067
+ if (json == null) {
5068
+ return json;
5069
+ }
5070
+ return {
5071
+ addOnIds: json["add_on_ids"].map(
5072
+ UpdateAddOnRequestBodyFromJSON
5073
+ ),
5074
+ autoTopupOverrides: json["auto_topup_overrides"].map(
5075
+ UpdateAutoTopupOverrideRequestBodyFromJSON
5076
+ ),
5077
+ billingEntityId: json["billing_entity_id"] == null ? void 0 : json["billing_entity_id"],
5078
+ couponExternalId: json["coupon_external_id"] == null ? void 0 : json["coupon_external_id"],
5079
+ creditBundles: json["credit_bundles"].map(
5080
+ UpdateCreditBundleRequestBodyFromJSON
5081
+ ),
5082
+ customFieldValues: json["custom_field_values"].map(
5083
+ CheckoutFieldValueFromJSON
5084
+ ),
5085
+ newPlanId: json["new_plan_id"] == null ? void 0 : json["new_plan_id"],
5086
+ newPriceId: json["new_price_id"] == null ? void 0 : json["new_price_id"],
5087
+ optInAccepted: json["opt_in_accepted"] == null ? void 0 : json["opt_in_accepted"],
5088
+ payInAdvance: json["pay_in_advance"].map(
5089
+ UpdatePayInAdvanceRequestBodyFromJSON
5090
+ ),
5091
+ paymentMethodId: json["payment_method_id"] == null ? void 0 : json["payment_method_id"],
5092
+ promoCode: json["promo_code"] == null ? void 0 : json["promo_code"],
5093
+ skipTrial: json["skip_trial"]
5094
+ };
5095
+ }
5096
+
5097
+ // src/api/checkoutexternal/models/CheckoutProblemSource.ts
5098
+ function CheckoutProblemSourceFromJSON(json) {
5099
+ return CheckoutProblemSourceFromJSONTyped(json, false);
5100
+ }
5101
+ function CheckoutProblemSourceFromJSONTyped(json, ignoreDiscriminator) {
5102
+ return json;
5103
+ }
5104
+
5105
+ // src/api/checkoutexternal/models/CheckoutProblemCode.ts
5106
+ function CheckoutProblemCodeFromJSON(json) {
5107
+ return CheckoutProblemCodeFromJSONTyped(json, false);
5108
+ }
5109
+ function CheckoutProblemCodeFromJSONTyped(json, ignoreDiscriminator) {
5110
+ return json;
5111
+ }
5112
+
5113
+ // src/api/checkoutexternal/models/Problem.ts
5114
+ function ProblemFromJSON(json) {
5115
+ return ProblemFromJSONTyped(json, false);
5116
+ }
5117
+ function ProblemFromJSONTyped(json, ignoreDiscriminator) {
5118
+ if (json == null) {
5119
+ return json;
5120
+ }
5121
+ return {
5122
+ blocking: json["blocking"],
5123
+ bundleId: json["bundle_id"] == null ? void 0 : json["bundle_id"],
5124
+ code: CheckoutProblemCodeFromJSON(json["code"]),
5125
+ currency: json["currency"] == null ? void 0 : json["currency"],
5126
+ detail: json["detail"] == null ? void 0 : json["detail"],
5127
+ featureId: json["feature_id"] == null ? void 0 : json["feature_id"],
5128
+ fieldId: json["field_id"] == null ? void 0 : json["field_id"],
5129
+ message: json["message"],
5130
+ paymentMethodId: json["payment_method_id"] == null ? void 0 : json["payment_method_id"],
5131
+ planId: json["plan_id"] == null ? void 0 : json["plan_id"],
5132
+ priceId: json["price_id"] == null ? void 0 : json["price_id"],
5133
+ source: CheckoutProblemSourceFromJSON(json["source"])
5134
+ };
5135
+ }
5136
+
5137
+ // src/api/checkoutexternal/models/CheckoutDraftResponseData.ts
5138
+ function CheckoutDraftResponseDataFromJSON(json) {
5139
+ return CheckoutDraftResponseDataFromJSONTyped(json, false);
5140
+ }
5141
+ function CheckoutDraftResponseDataFromJSONTyped(json, ignoreDiscriminator) {
5142
+ if (json == null) {
5143
+ return json;
5144
+ }
5145
+ return {
5146
+ companyId: json["company_id"],
5147
+ completedAt: json["completed_at"] == null ? void 0 : new Date(json["completed_at"]),
5148
+ createdAt: new Date(json["created_at"]),
5149
+ expiresAt: json["expires_at"] == null ? void 0 : new Date(json["expires_at"]),
5150
+ id: json["id"],
5151
+ lastActivityAt: new Date(json["last_activity_at"]),
5152
+ priceSnapshot: json["price_snapshot"] == null ? void 0 : CheckoutPriceSnapshotFromJSON(json["price_snapshot"]),
5153
+ pricedAt: json["priced_at"] == null ? void 0 : new Date(json["priced_at"]),
5154
+ problems: json["problems"].map(ProblemFromJSON),
5155
+ selections: CheckoutSelectionsResponseDataFromJSON(json["selections"]),
5156
+ shareToken: json["share_token"] == null ? void 0 : json["share_token"],
5157
+ status: CheckoutStatusFromJSON(json["status"]),
5158
+ updatedAt: new Date(json["updated_at"]),
5159
+ version: json["version"]
5160
+ };
5161
+ }
5162
+
4963
5163
  // src/api/checkoutexternal/models/CheckoutFieldWithValue.ts
4964
5164
  function CheckoutFieldWithValueFromJSON(json) {
4965
5165
  return CheckoutFieldWithValueFromJSONTyped(json, false);
@@ -6971,6 +7171,57 @@ function ComponentHydrateResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6971
7171
  };
6972
7172
  }
6973
7173
 
7174
+ // src/api/checkoutexternal/models/CreateCheckoutRequest.ts
7175
+ function CreateCheckoutRequestToJSON(json) {
7176
+ return CreateCheckoutRequestToJSONTyped(json, false);
7177
+ }
7178
+ function CreateCheckoutRequestToJSONTyped(value, ignoreDiscriminator = false) {
7179
+ if (value == null) {
7180
+ return value;
7181
+ }
7182
+ return {
7183
+ add_on_ids: value["addOnIds"].map(
7184
+ UpdateAddOnRequestBodyToJSON
7185
+ ),
7186
+ auto_topup_overrides: value["autoTopupOverrides"].map(
7187
+ UpdateAutoTopupOverrideRequestBodyToJSON
7188
+ ),
7189
+ billing_entity_id: value["billingEntityId"],
7190
+ company_id: value["companyId"],
7191
+ coupon_external_id: value["couponExternalId"],
7192
+ credit_bundles: value["creditBundles"].map(
7193
+ UpdateCreditBundleRequestBodyToJSON
7194
+ ),
7195
+ currency: value["currency"],
7196
+ custom_field_values: value["customFieldValues"].map(
7197
+ CheckoutFieldValueToJSON
7198
+ ),
7199
+ new_plan_id: value["newPlanId"],
7200
+ new_price_id: value["newPriceId"],
7201
+ opt_in_accepted: value["optInAccepted"],
7202
+ pay_in_advance: value["payInAdvance"].map(
7203
+ UpdatePayInAdvanceRequestBodyToJSON
7204
+ ),
7205
+ payment_method_id: value["paymentMethodId"],
7206
+ promo_code: value["promoCode"],
7207
+ skip_trial: value["skipTrial"]
7208
+ };
7209
+ }
7210
+
7211
+ // src/api/checkoutexternal/models/CreateCheckoutResponse.ts
7212
+ function CreateCheckoutResponseFromJSON(json) {
7213
+ return CreateCheckoutResponseFromJSONTyped(json, false);
7214
+ }
7215
+ function CreateCheckoutResponseFromJSONTyped(json, ignoreDiscriminator) {
7216
+ if (json == null) {
7217
+ return json;
7218
+ }
7219
+ return {
7220
+ data: CheckoutDraftResponseDataFromJSON(json["data"]),
7221
+ params: json["params"]
7222
+ };
7223
+ }
7224
+
6974
7225
  // src/api/checkoutexternal/models/SetupIntentResponseData.ts
6975
7226
  function SetupIntentResponseDataFromJSON(json) {
6976
7227
  return SetupIntentResponseDataFromJSONTyped(json, false);
@@ -7126,6 +7377,47 @@ function FetchCustomerBalanceResponseFromJSONTyped(json, ignoreDiscriminator) {
7126
7377
  };
7127
7378
  }
7128
7379
 
7380
+ // src/api/checkoutexternal/models/FinalizeCheckoutRequest.ts
7381
+ function FinalizeCheckoutRequestToJSON(json) {
7382
+ return FinalizeCheckoutRequestToJSONTyped(json, false);
7383
+ }
7384
+ function FinalizeCheckoutRequestToJSONTyped(value, ignoreDiscriminator = false) {
7385
+ if (value == null) {
7386
+ return value;
7387
+ }
7388
+ return {
7389
+ version: value["version"]
7390
+ };
7391
+ }
7392
+
7393
+ // src/api/checkoutexternal/models/FinalizeCheckoutResponse.ts
7394
+ function FinalizeCheckoutResponseFromJSON(json) {
7395
+ return FinalizeCheckoutResponseFromJSONTyped(json, false);
7396
+ }
7397
+ function FinalizeCheckoutResponseFromJSONTyped(json, ignoreDiscriminator) {
7398
+ if (json == null) {
7399
+ return json;
7400
+ }
7401
+ return {
7402
+ data: CheckoutResponseDataFromJSON(json["data"]),
7403
+ params: json["params"]
7404
+ };
7405
+ }
7406
+
7407
+ // src/api/checkoutexternal/models/GetCheckoutResponse.ts
7408
+ function GetCheckoutResponseFromJSON(json) {
7409
+ return GetCheckoutResponseFromJSONTyped(json, false);
7410
+ }
7411
+ function GetCheckoutResponseFromJSONTyped(json, ignoreDiscriminator) {
7412
+ if (json == null) {
7413
+ return json;
7414
+ }
7415
+ return {
7416
+ data: CheckoutDraftResponseDataFromJSON(json["data"]),
7417
+ params: json["params"]
7418
+ };
7419
+ }
7420
+
7129
7421
  // src/api/checkoutexternal/models/UpdateCheckoutTaxIDResponseData.ts
7130
7422
  function UpdateCheckoutTaxIDResponseDataFromJSON(json) {
7131
7423
  return UpdateCheckoutTaxIDResponseDataFromJSONTyped(json, false);
@@ -7334,6 +7626,36 @@ function HydrateUpcomingInvoiceResponseFromJSONTyped(json, ignoreDiscriminator)
7334
7626
  };
7335
7627
  }
7336
7628
 
7629
+ // src/api/checkoutexternal/models/ListCheckoutsParams.ts
7630
+ function ListCheckoutsParamsFromJSON(json) {
7631
+ return ListCheckoutsParamsFromJSONTyped(json, false);
7632
+ }
7633
+ function ListCheckoutsParamsFromJSONTyped(json, ignoreDiscriminator) {
7634
+ if (json == null) {
7635
+ return json;
7636
+ }
7637
+ return {
7638
+ companyId: json["company_id"] == null ? void 0 : json["company_id"],
7639
+ limit: json["limit"] == null ? void 0 : json["limit"],
7640
+ offset: json["offset"] == null ? void 0 : json["offset"],
7641
+ statuses: json["statuses"] == null ? void 0 : json["statuses"].map(CheckoutStatusFromJSON)
7642
+ };
7643
+ }
7644
+
7645
+ // src/api/checkoutexternal/models/ListCheckoutsResponse.ts
7646
+ function ListCheckoutsResponseFromJSON(json) {
7647
+ return ListCheckoutsResponseFromJSONTyped(json, false);
7648
+ }
7649
+ function ListCheckoutsResponseFromJSONTyped(json, ignoreDiscriminator) {
7650
+ if (json == null) {
7651
+ return json;
7652
+ }
7653
+ return {
7654
+ data: json["data"].map(CheckoutDraftResponseDataFromJSON),
7655
+ params: ListCheckoutsParamsFromJSON(json["params"])
7656
+ };
7657
+ }
7658
+
7337
7659
  // src/api/checkoutexternal/models/ListInvoicesParams.ts
7338
7660
  function ListInvoicesParamsFromJSON(json) {
7339
7661
  return ListInvoicesParamsFromJSONTyped(json, false);
@@ -7412,6 +7734,7 @@ function PreviewSubscriptionFinanceResponseDataFromJSONTyped(json, ignoreDiscrim
7412
7734
  }
7413
7735
  return {
7414
7736
  amountOff: json["amount_off"],
7737
+ currency: json["currency"],
7415
7738
  discountAmount: json["discount_amount"],
7416
7739
  discounts: json["discounts"].map(
7417
7740
  PreviewSubscriptionDiscountResponseDataFromJSON
@@ -7536,6 +7859,57 @@ function UpdateCheckoutFieldValuesResponseFromJSONTyped(json, ignoreDiscriminato
7536
7859
  };
7537
7860
  }
7538
7861
 
7862
+ // src/api/checkoutexternal/models/UpdateCheckoutRequest.ts
7863
+ function UpdateCheckoutRequestToJSON(json) {
7864
+ return UpdateCheckoutRequestToJSONTyped(json, false);
7865
+ }
7866
+ function UpdateCheckoutRequestToJSONTyped(value, ignoreDiscriminator = false) {
7867
+ if (value == null) {
7868
+ return value;
7869
+ }
7870
+ return {
7871
+ add_on_ids: value["addOnIds"].map(
7872
+ UpdateAddOnRequestBodyToJSON
7873
+ ),
7874
+ auto_topup_overrides: value["autoTopupOverrides"].map(
7875
+ UpdateAutoTopupOverrideRequestBodyToJSON
7876
+ ),
7877
+ billing_entity_id: value["billingEntityId"],
7878
+ coupon_external_id: value["couponExternalId"],
7879
+ credit_bundles: value["creditBundles"].map(
7880
+ UpdateCreditBundleRequestBodyToJSON
7881
+ ),
7882
+ currency: value["currency"],
7883
+ custom_field_values: value["customFieldValues"].map(
7884
+ CheckoutFieldValueToJSON
7885
+ ),
7886
+ new_plan_id: value["newPlanId"],
7887
+ new_price_id: value["newPriceId"],
7888
+ opt_in_accepted: value["optInAccepted"],
7889
+ pay_in_advance: value["payInAdvance"].map(
7890
+ UpdatePayInAdvanceRequestBodyToJSON
7891
+ ),
7892
+ payment_method_id: value["paymentMethodId"],
7893
+ promo_code: value["promoCode"],
7894
+ skip_trial: value["skipTrial"],
7895
+ version: value["version"]
7896
+ };
7897
+ }
7898
+
7899
+ // src/api/checkoutexternal/models/UpdateCheckoutResponse.ts
7900
+ function UpdateCheckoutResponseFromJSON(json) {
7901
+ return UpdateCheckoutResponseFromJSONTyped(json, false);
7902
+ }
7903
+ function UpdateCheckoutResponseFromJSONTyped(json, ignoreDiscriminator) {
7904
+ if (json == null) {
7905
+ return json;
7906
+ }
7907
+ return {
7908
+ data: CheckoutDraftResponseDataFromJSON(json["data"]),
7909
+ params: json["params"]
7910
+ };
7911
+ }
7912
+
7539
7913
  // src/api/checkoutexternal/models/UpdateCheckoutTaxIDRequestBody.ts
7540
7914
  function UpdateCheckoutTaxIDRequestBodyToJSON(json) {
7541
7915
  return UpdateCheckoutTaxIDRequestBodyToJSONTyped(json, false);
@@ -7666,6 +8040,51 @@ var CheckoutexternalApi = class extends BaseAPI {
7666
8040
  const response = await this.checkoutUnsubscribeRaw(initOverrides);
7667
8041
  return await response.value();
7668
8042
  }
8043
+ /**
8044
+ * Create checkout
8045
+ */
8046
+ async createCheckoutRaw(requestParameters, initOverrides) {
8047
+ if (requestParameters["createCheckoutRequest"] == null) {
8048
+ throw new RequiredError(
8049
+ "createCheckoutRequest",
8050
+ 'Required parameter "createCheckoutRequest" was null or undefined when calling createCheckout().'
8051
+ );
8052
+ }
8053
+ const queryParameters = {};
8054
+ const headerParameters = {};
8055
+ headerParameters["Content-Type"] = "application/json";
8056
+ if (this.configuration && this.configuration.apiKey) {
8057
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
8058
+ "X-Schematic-Api-Key"
8059
+ );
8060
+ }
8061
+ const response = await this.request(
8062
+ {
8063
+ path: `/checkouts`,
8064
+ method: "POST",
8065
+ headers: headerParameters,
8066
+ query: queryParameters,
8067
+ body: CreateCheckoutRequestToJSON(
8068
+ requestParameters["createCheckoutRequest"]
8069
+ )
8070
+ },
8071
+ initOverrides
8072
+ );
8073
+ return new JSONApiResponse(
8074
+ response,
8075
+ (jsonValue) => CreateCheckoutResponseFromJSON(jsonValue)
8076
+ );
8077
+ }
8078
+ /**
8079
+ * Create checkout
8080
+ */
8081
+ async createCheckout(requestParameters, initOverrides) {
8082
+ const response = await this.createCheckoutRaw(
8083
+ requestParameters,
8084
+ initOverrides
8085
+ );
8086
+ return await response.value();
8087
+ }
7669
8088
  /**
7670
8089
  * Create setup intent
7671
8090
  */
@@ -7774,6 +8193,104 @@ var CheckoutexternalApi = class extends BaseAPI {
7774
8193
  const response = await this.fetchCustomerBalanceRaw(initOverrides);
7775
8194
  return await response.value();
7776
8195
  }
8196
+ /**
8197
+ * Finalize checkout
8198
+ */
8199
+ async finalizeCheckoutRaw(requestParameters, initOverrides) {
8200
+ if (requestParameters["checkoutId"] == null) {
8201
+ throw new RequiredError(
8202
+ "checkoutId",
8203
+ 'Required parameter "checkoutId" was null or undefined when calling finalizeCheckout().'
8204
+ );
8205
+ }
8206
+ if (requestParameters["finalizeCheckoutRequest"] == null) {
8207
+ throw new RequiredError(
8208
+ "finalizeCheckoutRequest",
8209
+ 'Required parameter "finalizeCheckoutRequest" was null or undefined when calling finalizeCheckout().'
8210
+ );
8211
+ }
8212
+ const queryParameters = {};
8213
+ const headerParameters = {};
8214
+ headerParameters["Content-Type"] = "application/json";
8215
+ if (this.configuration && this.configuration.apiKey) {
8216
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
8217
+ "X-Schematic-Api-Key"
8218
+ );
8219
+ }
8220
+ const response = await this.request(
8221
+ {
8222
+ path: `/checkouts/{checkout_id}/finalize`.replace(
8223
+ `{${"checkout_id"}}`,
8224
+ encodeURIComponent(String(requestParameters["checkoutId"]))
8225
+ ),
8226
+ method: "POST",
8227
+ headers: headerParameters,
8228
+ query: queryParameters,
8229
+ body: FinalizeCheckoutRequestToJSON(
8230
+ requestParameters["finalizeCheckoutRequest"]
8231
+ )
8232
+ },
8233
+ initOverrides
8234
+ );
8235
+ return new JSONApiResponse(
8236
+ response,
8237
+ (jsonValue) => FinalizeCheckoutResponseFromJSON(jsonValue)
8238
+ );
8239
+ }
8240
+ /**
8241
+ * Finalize checkout
8242
+ */
8243
+ async finalizeCheckout(requestParameters, initOverrides) {
8244
+ const response = await this.finalizeCheckoutRaw(
8245
+ requestParameters,
8246
+ initOverrides
8247
+ );
8248
+ return await response.value();
8249
+ }
8250
+ /**
8251
+ * Get checkout
8252
+ */
8253
+ async getCheckoutRaw(requestParameters, initOverrides) {
8254
+ if (requestParameters["checkoutId"] == null) {
8255
+ throw new RequiredError(
8256
+ "checkoutId",
8257
+ 'Required parameter "checkoutId" was null or undefined when calling getCheckout().'
8258
+ );
8259
+ }
8260
+ const queryParameters = {};
8261
+ const headerParameters = {};
8262
+ if (this.configuration && this.configuration.apiKey) {
8263
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
8264
+ "X-Schematic-Api-Key"
8265
+ );
8266
+ }
8267
+ const response = await this.request(
8268
+ {
8269
+ path: `/checkouts/{checkout_id}`.replace(
8270
+ `{${"checkout_id"}}`,
8271
+ encodeURIComponent(String(requestParameters["checkoutId"]))
8272
+ ),
8273
+ method: "GET",
8274
+ headers: headerParameters,
8275
+ query: queryParameters
8276
+ },
8277
+ initOverrides
8278
+ );
8279
+ return new JSONApiResponse(
8280
+ response,
8281
+ (jsonValue) => GetCheckoutResponseFromJSON(jsonValue)
8282
+ );
8283
+ }
8284
+ /**
8285
+ * Get checkout
8286
+ */
8287
+ async getCheckout(requestParameters, initOverrides) {
8288
+ const response = await this.getCheckoutRaw(
8289
+ requestParameters,
8290
+ initOverrides
8291
+ );
8292
+ return await response.value();
8293
+ }
7777
8294
  /**
7778
8295
  * Get checkout tax ID
7779
8296
  */
@@ -8159,6 +8676,53 @@ var CheckoutexternalApi = class extends BaseAPI {
8159
8676
  );
8160
8677
  return await response.value();
8161
8678
  }
8679
+ /**
8680
+ * List checkouts
8681
+ */
8682
+ async listCheckoutsRaw(requestParameters, initOverrides) {
8683
+ const queryParameters = {};
8684
+ if (requestParameters["companyId"] != null) {
8685
+ queryParameters["company_id"] = requestParameters["companyId"];
8686
+ }
8687
+ if (requestParameters["statuses"] != null) {
8688
+ queryParameters["statuses"] = requestParameters["statuses"];
8689
+ }
8690
+ if (requestParameters["limit"] != null) {
8691
+ queryParameters["limit"] = requestParameters["limit"];
8692
+ }
8693
+ if (requestParameters["offset"] != null) {
8694
+ queryParameters["offset"] = requestParameters["offset"];
8695
+ }
8696
+ const headerParameters = {};
8697
+ if (this.configuration && this.configuration.apiKey) {
8698
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
8699
+ "X-Schematic-Api-Key"
8700
+ );
8701
+ }
8702
+ const response = await this.request(
8703
+ {
8704
+ path: `/checkouts`,
8705
+ method: "GET",
8706
+ headers: headerParameters,
8707
+ query: queryParameters
8708
+ },
8709
+ initOverrides
8710
+ );
8711
+ return new JSONApiResponse(
8712
+ response,
8713
+ (jsonValue) => ListCheckoutsResponseFromJSON(jsonValue)
8714
+ );
8715
+ }
8716
+ /**
8717
+ * List checkouts
8718
+ */
8719
+ async listCheckouts(requestParameters = {}, initOverrides) {
8720
+ const response = await this.listCheckoutsRaw(
8721
+ requestParameters,
8722
+ initOverrides
8723
+ );
8724
+ return await response.value();
8725
+ }
8162
8726
  /**
8163
8727
  * List invoices
8164
8728
  */
@@ -8245,6 +8809,60 @@ var CheckoutexternalApi = class extends BaseAPI {
8245
8809
  );
8246
8810
  return await response.value();
8247
8811
  }
8812
+ /**
8813
+ * Update checkout
8814
+ */
8815
+ async updateCheckoutRaw(requestParameters, initOverrides) {
8816
+ if (requestParameters["checkoutId"] == null) {
8817
+ throw new RequiredError(
8818
+ "checkoutId",
8819
+ 'Required parameter "checkoutId" was null or undefined when calling updateCheckout().'
8820
+ );
8821
+ }
8822
+ if (requestParameters["updateCheckoutRequest"] == null) {
8823
+ throw new RequiredError(
8824
+ "updateCheckoutRequest",
8825
+ 'Required parameter "updateCheckoutRequest" was null or undefined when calling updateCheckout().'
8826
+ );
8827
+ }
8828
+ const queryParameters = {};
8829
+ const headerParameters = {};
8830
+ headerParameters["Content-Type"] = "application/json";
8831
+ if (this.configuration && this.configuration.apiKey) {
8832
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
8833
+ "X-Schematic-Api-Key"
8834
+ );
8835
+ }
8836
+ const response = await this.request(
8837
+ {
8838
+ path: `/checkouts/{checkout_id}`.replace(
8839
+ `{${"checkout_id"}}`,
8840
+ encodeURIComponent(String(requestParameters["checkoutId"]))
8841
+ ),
8842
+ method: "PUT",
8843
+ headers: headerParameters,
8844
+ query: queryParameters,
8845
+ body: UpdateCheckoutRequestToJSON(
8846
+ requestParameters["updateCheckoutRequest"]
8847
+ )
8848
+ },
8849
+ initOverrides
8850
+ );
8851
+ return new JSONApiResponse(
8852
+ response,
8853
+ (jsonValue) => UpdateCheckoutResponseFromJSON(jsonValue)
8854
+ );
8855
+ }
8856
+ /**
8857
+ * Update checkout
8858
+ */
8859
+ async updateCheckout(requestParameters, initOverrides) {
8860
+ const response = await this.updateCheckoutRaw(
8861
+ requestParameters,
8862
+ initOverrides
8863
+ );
8864
+ return await response.value();
8865
+ }
8248
8866
  /**
8249
8867
  * Update checkout field values
8250
8868
  */
@@ -13018,6 +13636,12 @@ function getSubscriptionPeriod(billingSubscription) {
13018
13636
  );
13019
13637
  return derivePeriod(product?.interval, product?.intervalCount) ?? derivePeriod(billingSubscription.interval);
13020
13638
  }
13639
+ function getDefaultPlanPeriod(plans = []) {
13640
+ if (plans.some((plan) => plan.monthlyPrice)) return "month";
13641
+ if (plans.some((plan) => plan.quarterlyPrice)) return "quarter";
13642
+ if (plans.some((plan) => plan.yearlyPrice)) return "year";
13643
+ return "month";
13644
+ }
13021
13645
  var ChargeType = {
13022
13646
  oneTime: "one_time",
13023
13647
  recurring: "recurring",
@@ -14885,7 +15509,7 @@ var reducer = (state, action) => {
14885
15509
  // src/context/EmbedProvider.tsx
14886
15510
  var import_jsx_runtime4 = require("react/jsx-runtime");
14887
15511
  var getCustomHeaders = (sessionId) => ({
14888
- "X-Schematic-Components-Version": "2.26.0",
15512
+ "X-Schematic-Components-Version": "2.27.1",
14889
15513
  "X-Schematic-Session-ID": sessionId
14890
15514
  });
14891
15515
  var normalizeCurrencyFilter = (filter2) => {
@@ -19194,7 +19818,7 @@ var CheckoutDialog = ({ top }) => {
19194
19818
  [data?.featureUsage?.features]
19195
19819
  );
19196
19820
  const getValidatedPeriod = () => {
19197
- const requestedPeriod = checkoutState?.period || getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month";
19821
+ const requestedPeriod = checkoutState?.period || getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || getDefaultPlanPeriod(data?.activePlans);
19198
19822
  if (checkoutState?.planId) {
19199
19823
  const requestedPlan = data?.activePlans?.find(
19200
19824
  (plan) => plan.id === checkoutState.planId
@@ -27989,7 +28613,7 @@ var PricingTable = (0, import_react54.forwardRef)(({ className, ...rest }, ref)
27989
28613
  []
27990
28614
  );
27991
28615
  const [selectedPeriod, setSelectedPeriod] = (0, import_react54.useState)(
27992
- () => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month"
28616
+ () => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || getDefaultPlanPeriod(data?.activePlans)
27993
28617
  );
27994
28618
  const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
27995
28619
  const [selectedCurrency, setSelectedCurrency] = (0, import_react54.useState)(