@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.
@@ -5190,6 +5190,18 @@ function BillingSubscriptionViewFromJSONTyped(json, ignoreDiscriminator) {
5190
5190
  }
5191
5191
 
5192
5192
  // src/api/checkoutexternal/models/UpdatePayInAdvanceRequestBody.ts
5193
+ function UpdatePayInAdvanceRequestBodyFromJSON(json) {
5194
+ return UpdatePayInAdvanceRequestBodyFromJSONTyped(json, false);
5195
+ }
5196
+ function UpdatePayInAdvanceRequestBodyFromJSONTyped(json, ignoreDiscriminator) {
5197
+ if (json == null) {
5198
+ return json;
5199
+ }
5200
+ return {
5201
+ priceId: json["price_id"],
5202
+ quantity: json["quantity"]
5203
+ };
5204
+ }
5193
5205
  function UpdatePayInAdvanceRequestBodyToJSON(json) {
5194
5206
  return UpdatePayInAdvanceRequestBodyToJSONTyped(json, false);
5195
5207
  }
@@ -5204,6 +5216,18 @@ function UpdatePayInAdvanceRequestBodyToJSONTyped(value, ignoreDiscriminator = f
5204
5216
  }
5205
5217
 
5206
5218
  // src/api/checkoutexternal/models/UpdateCreditBundleRequestBody.ts
5219
+ function UpdateCreditBundleRequestBodyFromJSON(json) {
5220
+ return UpdateCreditBundleRequestBodyFromJSONTyped(json, false);
5221
+ }
5222
+ function UpdateCreditBundleRequestBodyFromJSONTyped(json, ignoreDiscriminator) {
5223
+ if (json == null) {
5224
+ return json;
5225
+ }
5226
+ return {
5227
+ bundleId: json["bundle_id"],
5228
+ quantity: json["quantity"]
5229
+ };
5230
+ }
5207
5231
  function UpdateCreditBundleRequestBodyToJSON(json) {
5208
5232
  return UpdateCreditBundleRequestBodyToJSONTyped(json, false);
5209
5233
  }
@@ -5218,6 +5242,18 @@ function UpdateCreditBundleRequestBodyToJSONTyped(value, ignoreDiscriminator = f
5218
5242
  }
5219
5243
 
5220
5244
  // src/api/checkoutexternal/models/CheckoutFieldValue.ts
5245
+ function CheckoutFieldValueFromJSON(json) {
5246
+ return CheckoutFieldValueFromJSONTyped(json, false);
5247
+ }
5248
+ function CheckoutFieldValueFromJSONTyped(json, ignoreDiscriminator) {
5249
+ if (json == null) {
5250
+ return json;
5251
+ }
5252
+ return {
5253
+ id: json["id"],
5254
+ value: json["value"]
5255
+ };
5256
+ }
5221
5257
  function CheckoutFieldValueToJSON(json) {
5222
5258
  return CheckoutFieldValueToJSONTyped(json, false);
5223
5259
  }
@@ -5232,6 +5268,18 @@ function CheckoutFieldValueToJSONTyped(value, ignoreDiscriminator = false) {
5232
5268
  }
5233
5269
 
5234
5270
  // src/api/checkoutexternal/models/UpdateAddOnRequestBody.ts
5271
+ function UpdateAddOnRequestBodyFromJSON(json) {
5272
+ return UpdateAddOnRequestBodyFromJSONTyped(json, false);
5273
+ }
5274
+ function UpdateAddOnRequestBodyFromJSONTyped(json, ignoreDiscriminator) {
5275
+ if (json == null) {
5276
+ return json;
5277
+ }
5278
+ return {
5279
+ addOnId: json["add_on_id"],
5280
+ priceId: json["price_id"]
5281
+ };
5282
+ }
5235
5283
  function UpdateAddOnRequestBodyToJSON(json) {
5236
5284
  return UpdateAddOnRequestBodyToJSONTyped(json, false);
5237
5285
  }
@@ -5246,6 +5294,20 @@ function UpdateAddOnRequestBodyToJSONTyped(value, ignoreDiscriminator = false) {
5246
5294
  }
5247
5295
 
5248
5296
  // src/api/checkoutexternal/models/UpdateAutoTopupOverrideRequestBody.ts
5297
+ function UpdateAutoTopupOverrideRequestBodyFromJSON(json) {
5298
+ return UpdateAutoTopupOverrideRequestBodyFromJSONTyped(json, false);
5299
+ }
5300
+ function UpdateAutoTopupOverrideRequestBodyFromJSONTyped(json, ignoreDiscriminator) {
5301
+ if (json == null) {
5302
+ return json;
5303
+ }
5304
+ return {
5305
+ autoTopupAmount: json["auto_topup_amount"] == null ? void 0 : json["auto_topup_amount"],
5306
+ autoTopupEnabled: json["auto_topup_enabled"] == null ? void 0 : json["auto_topup_enabled"],
5307
+ autoTopupThresholdCredits: json["auto_topup_threshold_credits"] == null ? void 0 : json["auto_topup_threshold_credits"],
5308
+ planCreditGrantId: json["plan_credit_grant_id"]
5309
+ };
5310
+ }
5249
5311
  function UpdateAutoTopupOverrideRequestBodyToJSON(json) {
5250
5312
  return UpdateAutoTopupOverrideRequestBodyToJSONTyped(json, false);
5251
5313
  }
@@ -5281,6 +5343,7 @@ function ChangeSubscriptionRequestBodyToJSONTyped(value, ignoreDiscriminator = f
5281
5343
  credit_bundles: value["creditBundles"].map(
5282
5344
  UpdateCreditBundleRequestBodyToJSON
5283
5345
  ),
5346
+ currency: value["currency"],
5284
5347
  custom_field_values: value["customFieldValues"].map(
5285
5348
  CheckoutFieldValueToJSON
5286
5349
  ),
@@ -5316,6 +5379,143 @@ function CheckoutBundlePurchaseBehaviorFromJSONTyped(json, ignoreDiscriminator)
5316
5379
  return json;
5317
5380
  }
5318
5381
 
5382
+ // src/api/checkoutexternal/models/CheckoutPriceSnapshot.ts
5383
+ function CheckoutPriceSnapshotFromJSON(json) {
5384
+ return CheckoutPriceSnapshotFromJSONTyped(json, false);
5385
+ }
5386
+ function CheckoutPriceSnapshotFromJSONTyped(json, ignoreDiscriminator) {
5387
+ if (json == null) {
5388
+ return json;
5389
+ }
5390
+ return {
5391
+ amountOff: json["amount_off"],
5392
+ currency: json["currency"],
5393
+ dueNow: json["due_now"],
5394
+ isScheduledDowngrade: json["is_scheduled_downgrade"],
5395
+ newCharges: json["new_charges"],
5396
+ optInRequired: json["opt_in_required"],
5397
+ paymentMethodRequired: json["payment_method_required"],
5398
+ percentOff: json["percent_off"],
5399
+ periodStart: new Date(json["period_start"]),
5400
+ pricedAt: new Date(json["priced_at"]),
5401
+ promoCodeApplied: json["promo_code_applied"],
5402
+ proration: json["proration"],
5403
+ scheduledChangeTime: json["scheduled_change_time"] == null ? void 0 : new Date(json["scheduled_change_time"]),
5404
+ taxAmount: json["tax_amount"] == null ? void 0 : json["tax_amount"],
5405
+ totalPerBillingPeriod: json["total_per_billing_period"],
5406
+ trialEnd: json["trial_end"] == null ? void 0 : new Date(json["trial_end"])
5407
+ };
5408
+ }
5409
+
5410
+ // src/api/checkoutexternal/models/CheckoutStatus.ts
5411
+ function CheckoutStatusFromJSON(json) {
5412
+ return CheckoutStatusFromJSONTyped(json, false);
5413
+ }
5414
+ function CheckoutStatusFromJSONTyped(json, ignoreDiscriminator) {
5415
+ return json;
5416
+ }
5417
+
5418
+ // src/api/checkoutexternal/models/CheckoutSelectionsResponseData.ts
5419
+ function CheckoutSelectionsResponseDataFromJSON(json) {
5420
+ return CheckoutSelectionsResponseDataFromJSONTyped(json, false);
5421
+ }
5422
+ function CheckoutSelectionsResponseDataFromJSONTyped(json, ignoreDiscriminator) {
5423
+ if (json == null) {
5424
+ return json;
5425
+ }
5426
+ return {
5427
+ addOnIds: json["add_on_ids"].map(
5428
+ UpdateAddOnRequestBodyFromJSON
5429
+ ),
5430
+ autoTopupOverrides: json["auto_topup_overrides"].map(
5431
+ UpdateAutoTopupOverrideRequestBodyFromJSON
5432
+ ),
5433
+ billingEntityId: json["billing_entity_id"] == null ? void 0 : json["billing_entity_id"],
5434
+ couponExternalId: json["coupon_external_id"] == null ? void 0 : json["coupon_external_id"],
5435
+ creditBundles: json["credit_bundles"].map(
5436
+ UpdateCreditBundleRequestBodyFromJSON
5437
+ ),
5438
+ customFieldValues: json["custom_field_values"].map(
5439
+ CheckoutFieldValueFromJSON
5440
+ ),
5441
+ newPlanId: json["new_plan_id"] == null ? void 0 : json["new_plan_id"],
5442
+ newPriceId: json["new_price_id"] == null ? void 0 : json["new_price_id"],
5443
+ optInAccepted: json["opt_in_accepted"] == null ? void 0 : json["opt_in_accepted"],
5444
+ payInAdvance: json["pay_in_advance"].map(
5445
+ UpdatePayInAdvanceRequestBodyFromJSON
5446
+ ),
5447
+ paymentMethodId: json["payment_method_id"] == null ? void 0 : json["payment_method_id"],
5448
+ promoCode: json["promo_code"] == null ? void 0 : json["promo_code"],
5449
+ skipTrial: json["skip_trial"]
5450
+ };
5451
+ }
5452
+
5453
+ // src/api/checkoutexternal/models/CheckoutProblemSource.ts
5454
+ function CheckoutProblemSourceFromJSON(json) {
5455
+ return CheckoutProblemSourceFromJSONTyped(json, false);
5456
+ }
5457
+ function CheckoutProblemSourceFromJSONTyped(json, ignoreDiscriminator) {
5458
+ return json;
5459
+ }
5460
+
5461
+ // src/api/checkoutexternal/models/CheckoutProblemCode.ts
5462
+ function CheckoutProblemCodeFromJSON(json) {
5463
+ return CheckoutProblemCodeFromJSONTyped(json, false);
5464
+ }
5465
+ function CheckoutProblemCodeFromJSONTyped(json, ignoreDiscriminator) {
5466
+ return json;
5467
+ }
5468
+
5469
+ // src/api/checkoutexternal/models/Problem.ts
5470
+ function ProblemFromJSON(json) {
5471
+ return ProblemFromJSONTyped(json, false);
5472
+ }
5473
+ function ProblemFromJSONTyped(json, ignoreDiscriminator) {
5474
+ if (json == null) {
5475
+ return json;
5476
+ }
5477
+ return {
5478
+ blocking: json["blocking"],
5479
+ bundleId: json["bundle_id"] == null ? void 0 : json["bundle_id"],
5480
+ code: CheckoutProblemCodeFromJSON(json["code"]),
5481
+ currency: json["currency"] == null ? void 0 : json["currency"],
5482
+ detail: json["detail"] == null ? void 0 : json["detail"],
5483
+ featureId: json["feature_id"] == null ? void 0 : json["feature_id"],
5484
+ fieldId: json["field_id"] == null ? void 0 : json["field_id"],
5485
+ message: json["message"],
5486
+ paymentMethodId: json["payment_method_id"] == null ? void 0 : json["payment_method_id"],
5487
+ planId: json["plan_id"] == null ? void 0 : json["plan_id"],
5488
+ priceId: json["price_id"] == null ? void 0 : json["price_id"],
5489
+ source: CheckoutProblemSourceFromJSON(json["source"])
5490
+ };
5491
+ }
5492
+
5493
+ // src/api/checkoutexternal/models/CheckoutDraftResponseData.ts
5494
+ function CheckoutDraftResponseDataFromJSON(json) {
5495
+ return CheckoutDraftResponseDataFromJSONTyped(json, false);
5496
+ }
5497
+ function CheckoutDraftResponseDataFromJSONTyped(json, ignoreDiscriminator) {
5498
+ if (json == null) {
5499
+ return json;
5500
+ }
5501
+ return {
5502
+ companyId: json["company_id"],
5503
+ completedAt: json["completed_at"] == null ? void 0 : new Date(json["completed_at"]),
5504
+ createdAt: new Date(json["created_at"]),
5505
+ expiresAt: json["expires_at"] == null ? void 0 : new Date(json["expires_at"]),
5506
+ id: json["id"],
5507
+ lastActivityAt: new Date(json["last_activity_at"]),
5508
+ priceSnapshot: json["price_snapshot"] == null ? void 0 : CheckoutPriceSnapshotFromJSON(json["price_snapshot"]),
5509
+ pricedAt: json["priced_at"] == null ? void 0 : new Date(json["priced_at"]),
5510
+ problems: json["problems"].map(ProblemFromJSON),
5511
+ selections: CheckoutSelectionsResponseDataFromJSON(json["selections"]),
5512
+ shareToken: json["share_token"] == null ? void 0 : json["share_token"],
5513
+ status: CheckoutStatusFromJSON(json["status"]),
5514
+ updatedAt: new Date(json["updated_at"]),
5515
+ version: json["version"]
5516
+ };
5517
+ }
5518
+
5319
5519
  // src/api/checkoutexternal/models/CheckoutFieldWithValue.ts
5320
5520
  function CheckoutFieldWithValueFromJSON(json) {
5321
5521
  return CheckoutFieldWithValueFromJSONTyped(json, false);
@@ -7327,6 +7527,57 @@ function ComponentHydrateResponseDataFromJSONTyped(json, ignoreDiscriminator) {
7327
7527
  };
7328
7528
  }
7329
7529
 
7530
+ // src/api/checkoutexternal/models/CreateCheckoutRequest.ts
7531
+ function CreateCheckoutRequestToJSON(json) {
7532
+ return CreateCheckoutRequestToJSONTyped(json, false);
7533
+ }
7534
+ function CreateCheckoutRequestToJSONTyped(value, ignoreDiscriminator = false) {
7535
+ if (value == null) {
7536
+ return value;
7537
+ }
7538
+ return {
7539
+ add_on_ids: value["addOnIds"].map(
7540
+ UpdateAddOnRequestBodyToJSON
7541
+ ),
7542
+ auto_topup_overrides: value["autoTopupOverrides"].map(
7543
+ UpdateAutoTopupOverrideRequestBodyToJSON
7544
+ ),
7545
+ billing_entity_id: value["billingEntityId"],
7546
+ company_id: value["companyId"],
7547
+ coupon_external_id: value["couponExternalId"],
7548
+ credit_bundles: value["creditBundles"].map(
7549
+ UpdateCreditBundleRequestBodyToJSON
7550
+ ),
7551
+ currency: value["currency"],
7552
+ custom_field_values: value["customFieldValues"].map(
7553
+ CheckoutFieldValueToJSON
7554
+ ),
7555
+ new_plan_id: value["newPlanId"],
7556
+ new_price_id: value["newPriceId"],
7557
+ opt_in_accepted: value["optInAccepted"],
7558
+ pay_in_advance: value["payInAdvance"].map(
7559
+ UpdatePayInAdvanceRequestBodyToJSON
7560
+ ),
7561
+ payment_method_id: value["paymentMethodId"],
7562
+ promo_code: value["promoCode"],
7563
+ skip_trial: value["skipTrial"]
7564
+ };
7565
+ }
7566
+
7567
+ // src/api/checkoutexternal/models/CreateCheckoutResponse.ts
7568
+ function CreateCheckoutResponseFromJSON(json) {
7569
+ return CreateCheckoutResponseFromJSONTyped(json, false);
7570
+ }
7571
+ function CreateCheckoutResponseFromJSONTyped(json, ignoreDiscriminator) {
7572
+ if (json == null) {
7573
+ return json;
7574
+ }
7575
+ return {
7576
+ data: CheckoutDraftResponseDataFromJSON(json["data"]),
7577
+ params: json["params"]
7578
+ };
7579
+ }
7580
+
7330
7581
  // src/api/checkoutexternal/models/SetupIntentResponseData.ts
7331
7582
  function SetupIntentResponseDataFromJSON(json) {
7332
7583
  return SetupIntentResponseDataFromJSONTyped(json, false);
@@ -7482,6 +7733,47 @@ function FetchCustomerBalanceResponseFromJSONTyped(json, ignoreDiscriminator) {
7482
7733
  };
7483
7734
  }
7484
7735
 
7736
+ // src/api/checkoutexternal/models/FinalizeCheckoutRequest.ts
7737
+ function FinalizeCheckoutRequestToJSON(json) {
7738
+ return FinalizeCheckoutRequestToJSONTyped(json, false);
7739
+ }
7740
+ function FinalizeCheckoutRequestToJSONTyped(value, ignoreDiscriminator = false) {
7741
+ if (value == null) {
7742
+ return value;
7743
+ }
7744
+ return {
7745
+ version: value["version"]
7746
+ };
7747
+ }
7748
+
7749
+ // src/api/checkoutexternal/models/FinalizeCheckoutResponse.ts
7750
+ function FinalizeCheckoutResponseFromJSON(json) {
7751
+ return FinalizeCheckoutResponseFromJSONTyped(json, false);
7752
+ }
7753
+ function FinalizeCheckoutResponseFromJSONTyped(json, ignoreDiscriminator) {
7754
+ if (json == null) {
7755
+ return json;
7756
+ }
7757
+ return {
7758
+ data: CheckoutResponseDataFromJSON(json["data"]),
7759
+ params: json["params"]
7760
+ };
7761
+ }
7762
+
7763
+ // src/api/checkoutexternal/models/GetCheckoutResponse.ts
7764
+ function GetCheckoutResponseFromJSON(json) {
7765
+ return GetCheckoutResponseFromJSONTyped(json, false);
7766
+ }
7767
+ function GetCheckoutResponseFromJSONTyped(json, ignoreDiscriminator) {
7768
+ if (json == null) {
7769
+ return json;
7770
+ }
7771
+ return {
7772
+ data: CheckoutDraftResponseDataFromJSON(json["data"]),
7773
+ params: json["params"]
7774
+ };
7775
+ }
7776
+
7485
7777
  // src/api/checkoutexternal/models/UpdateCheckoutTaxIDResponseData.ts
7486
7778
  function UpdateCheckoutTaxIDResponseDataFromJSON(json) {
7487
7779
  return UpdateCheckoutTaxIDResponseDataFromJSONTyped(json, false);
@@ -7690,6 +7982,36 @@ function HydrateUpcomingInvoiceResponseFromJSONTyped(json, ignoreDiscriminator)
7690
7982
  };
7691
7983
  }
7692
7984
 
7985
+ // src/api/checkoutexternal/models/ListCheckoutsParams.ts
7986
+ function ListCheckoutsParamsFromJSON(json) {
7987
+ return ListCheckoutsParamsFromJSONTyped(json, false);
7988
+ }
7989
+ function ListCheckoutsParamsFromJSONTyped(json, ignoreDiscriminator) {
7990
+ if (json == null) {
7991
+ return json;
7992
+ }
7993
+ return {
7994
+ companyId: json["company_id"] == null ? void 0 : json["company_id"],
7995
+ limit: json["limit"] == null ? void 0 : json["limit"],
7996
+ offset: json["offset"] == null ? void 0 : json["offset"],
7997
+ statuses: json["statuses"] == null ? void 0 : json["statuses"].map(CheckoutStatusFromJSON)
7998
+ };
7999
+ }
8000
+
8001
+ // src/api/checkoutexternal/models/ListCheckoutsResponse.ts
8002
+ function ListCheckoutsResponseFromJSON(json) {
8003
+ return ListCheckoutsResponseFromJSONTyped(json, false);
8004
+ }
8005
+ function ListCheckoutsResponseFromJSONTyped(json, ignoreDiscriminator) {
8006
+ if (json == null) {
8007
+ return json;
8008
+ }
8009
+ return {
8010
+ data: json["data"].map(CheckoutDraftResponseDataFromJSON),
8011
+ params: ListCheckoutsParamsFromJSON(json["params"])
8012
+ };
8013
+ }
8014
+
7693
8015
  // src/api/checkoutexternal/models/ListInvoicesParams.ts
7694
8016
  function ListInvoicesParamsFromJSON(json) {
7695
8017
  return ListInvoicesParamsFromJSONTyped(json, false);
@@ -7768,6 +8090,7 @@ function PreviewSubscriptionFinanceResponseDataFromJSONTyped(json, ignoreDiscrim
7768
8090
  }
7769
8091
  return {
7770
8092
  amountOff: json["amount_off"],
8093
+ currency: json["currency"],
7771
8094
  discountAmount: json["discount_amount"],
7772
8095
  discounts: json["discounts"].map(
7773
8096
  PreviewSubscriptionDiscountResponseDataFromJSON
@@ -7892,6 +8215,57 @@ function UpdateCheckoutFieldValuesResponseFromJSONTyped(json, ignoreDiscriminato
7892
8215
  };
7893
8216
  }
7894
8217
 
8218
+ // src/api/checkoutexternal/models/UpdateCheckoutRequest.ts
8219
+ function UpdateCheckoutRequestToJSON(json) {
8220
+ return UpdateCheckoutRequestToJSONTyped(json, false);
8221
+ }
8222
+ function UpdateCheckoutRequestToJSONTyped(value, ignoreDiscriminator = false) {
8223
+ if (value == null) {
8224
+ return value;
8225
+ }
8226
+ return {
8227
+ add_on_ids: value["addOnIds"].map(
8228
+ UpdateAddOnRequestBodyToJSON
8229
+ ),
8230
+ auto_topup_overrides: value["autoTopupOverrides"].map(
8231
+ UpdateAutoTopupOverrideRequestBodyToJSON
8232
+ ),
8233
+ billing_entity_id: value["billingEntityId"],
8234
+ coupon_external_id: value["couponExternalId"],
8235
+ credit_bundles: value["creditBundles"].map(
8236
+ UpdateCreditBundleRequestBodyToJSON
8237
+ ),
8238
+ currency: value["currency"],
8239
+ custom_field_values: value["customFieldValues"].map(
8240
+ CheckoutFieldValueToJSON
8241
+ ),
8242
+ new_plan_id: value["newPlanId"],
8243
+ new_price_id: value["newPriceId"],
8244
+ opt_in_accepted: value["optInAccepted"],
8245
+ pay_in_advance: value["payInAdvance"].map(
8246
+ UpdatePayInAdvanceRequestBodyToJSON
8247
+ ),
8248
+ payment_method_id: value["paymentMethodId"],
8249
+ promo_code: value["promoCode"],
8250
+ skip_trial: value["skipTrial"],
8251
+ version: value["version"]
8252
+ };
8253
+ }
8254
+
8255
+ // src/api/checkoutexternal/models/UpdateCheckoutResponse.ts
8256
+ function UpdateCheckoutResponseFromJSON(json) {
8257
+ return UpdateCheckoutResponseFromJSONTyped(json, false);
8258
+ }
8259
+ function UpdateCheckoutResponseFromJSONTyped(json, ignoreDiscriminator) {
8260
+ if (json == null) {
8261
+ return json;
8262
+ }
8263
+ return {
8264
+ data: CheckoutDraftResponseDataFromJSON(json["data"]),
8265
+ params: json["params"]
8266
+ };
8267
+ }
8268
+
7895
8269
  // src/api/checkoutexternal/models/UpdateCheckoutTaxIDRequestBody.ts
7896
8270
  function UpdateCheckoutTaxIDRequestBodyToJSON(json) {
7897
8271
  return UpdateCheckoutTaxIDRequestBodyToJSONTyped(json, false);
@@ -8022,6 +8396,51 @@ var CheckoutexternalApi = class extends BaseAPI {
8022
8396
  const response = await this.checkoutUnsubscribeRaw(initOverrides);
8023
8397
  return await response.value();
8024
8398
  }
8399
+ /**
8400
+ * Create checkout
8401
+ */
8402
+ async createCheckoutRaw(requestParameters, initOverrides) {
8403
+ if (requestParameters["createCheckoutRequest"] == null) {
8404
+ throw new RequiredError(
8405
+ "createCheckoutRequest",
8406
+ 'Required parameter "createCheckoutRequest" was null or undefined when calling createCheckout().'
8407
+ );
8408
+ }
8409
+ const queryParameters = {};
8410
+ const headerParameters = {};
8411
+ headerParameters["Content-Type"] = "application/json";
8412
+ if (this.configuration && this.configuration.apiKey) {
8413
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
8414
+ "X-Schematic-Api-Key"
8415
+ );
8416
+ }
8417
+ const response = await this.request(
8418
+ {
8419
+ path: `/checkouts`,
8420
+ method: "POST",
8421
+ headers: headerParameters,
8422
+ query: queryParameters,
8423
+ body: CreateCheckoutRequestToJSON(
8424
+ requestParameters["createCheckoutRequest"]
8425
+ )
8426
+ },
8427
+ initOverrides
8428
+ );
8429
+ return new JSONApiResponse(
8430
+ response,
8431
+ (jsonValue) => CreateCheckoutResponseFromJSON(jsonValue)
8432
+ );
8433
+ }
8434
+ /**
8435
+ * Create checkout
8436
+ */
8437
+ async createCheckout(requestParameters, initOverrides) {
8438
+ const response = await this.createCheckoutRaw(
8439
+ requestParameters,
8440
+ initOverrides
8441
+ );
8442
+ return await response.value();
8443
+ }
8025
8444
  /**
8026
8445
  * Create setup intent
8027
8446
  */
@@ -8130,6 +8549,104 @@ var CheckoutexternalApi = class extends BaseAPI {
8130
8549
  const response = await this.fetchCustomerBalanceRaw(initOverrides);
8131
8550
  return await response.value();
8132
8551
  }
8552
+ /**
8553
+ * Finalize checkout
8554
+ */
8555
+ async finalizeCheckoutRaw(requestParameters, initOverrides) {
8556
+ if (requestParameters["checkoutId"] == null) {
8557
+ throw new RequiredError(
8558
+ "checkoutId",
8559
+ 'Required parameter "checkoutId" was null or undefined when calling finalizeCheckout().'
8560
+ );
8561
+ }
8562
+ if (requestParameters["finalizeCheckoutRequest"] == null) {
8563
+ throw new RequiredError(
8564
+ "finalizeCheckoutRequest",
8565
+ 'Required parameter "finalizeCheckoutRequest" was null or undefined when calling finalizeCheckout().'
8566
+ );
8567
+ }
8568
+ const queryParameters = {};
8569
+ const headerParameters = {};
8570
+ headerParameters["Content-Type"] = "application/json";
8571
+ if (this.configuration && this.configuration.apiKey) {
8572
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
8573
+ "X-Schematic-Api-Key"
8574
+ );
8575
+ }
8576
+ const response = await this.request(
8577
+ {
8578
+ path: `/checkouts/{checkout_id}/finalize`.replace(
8579
+ `{${"checkout_id"}}`,
8580
+ encodeURIComponent(String(requestParameters["checkoutId"]))
8581
+ ),
8582
+ method: "POST",
8583
+ headers: headerParameters,
8584
+ query: queryParameters,
8585
+ body: FinalizeCheckoutRequestToJSON(
8586
+ requestParameters["finalizeCheckoutRequest"]
8587
+ )
8588
+ },
8589
+ initOverrides
8590
+ );
8591
+ return new JSONApiResponse(
8592
+ response,
8593
+ (jsonValue) => FinalizeCheckoutResponseFromJSON(jsonValue)
8594
+ );
8595
+ }
8596
+ /**
8597
+ * Finalize checkout
8598
+ */
8599
+ async finalizeCheckout(requestParameters, initOverrides) {
8600
+ const response = await this.finalizeCheckoutRaw(
8601
+ requestParameters,
8602
+ initOverrides
8603
+ );
8604
+ return await response.value();
8605
+ }
8606
+ /**
8607
+ * Get checkout
8608
+ */
8609
+ async getCheckoutRaw(requestParameters, initOverrides) {
8610
+ if (requestParameters["checkoutId"] == null) {
8611
+ throw new RequiredError(
8612
+ "checkoutId",
8613
+ 'Required parameter "checkoutId" was null or undefined when calling getCheckout().'
8614
+ );
8615
+ }
8616
+ const queryParameters = {};
8617
+ const headerParameters = {};
8618
+ if (this.configuration && this.configuration.apiKey) {
8619
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
8620
+ "X-Schematic-Api-Key"
8621
+ );
8622
+ }
8623
+ const response = await this.request(
8624
+ {
8625
+ path: `/checkouts/{checkout_id}`.replace(
8626
+ `{${"checkout_id"}}`,
8627
+ encodeURIComponent(String(requestParameters["checkoutId"]))
8628
+ ),
8629
+ method: "GET",
8630
+ headers: headerParameters,
8631
+ query: queryParameters
8632
+ },
8633
+ initOverrides
8634
+ );
8635
+ return new JSONApiResponse(
8636
+ response,
8637
+ (jsonValue) => GetCheckoutResponseFromJSON(jsonValue)
8638
+ );
8639
+ }
8640
+ /**
8641
+ * Get checkout
8642
+ */
8643
+ async getCheckout(requestParameters, initOverrides) {
8644
+ const response = await this.getCheckoutRaw(
8645
+ requestParameters,
8646
+ initOverrides
8647
+ );
8648
+ return await response.value();
8649
+ }
8133
8650
  /**
8134
8651
  * Get checkout tax ID
8135
8652
  */
@@ -8515,6 +9032,53 @@ var CheckoutexternalApi = class extends BaseAPI {
8515
9032
  );
8516
9033
  return await response.value();
8517
9034
  }
9035
+ /**
9036
+ * List checkouts
9037
+ */
9038
+ async listCheckoutsRaw(requestParameters, initOverrides) {
9039
+ const queryParameters = {};
9040
+ if (requestParameters["companyId"] != null) {
9041
+ queryParameters["company_id"] = requestParameters["companyId"];
9042
+ }
9043
+ if (requestParameters["statuses"] != null) {
9044
+ queryParameters["statuses"] = requestParameters["statuses"];
9045
+ }
9046
+ if (requestParameters["limit"] != null) {
9047
+ queryParameters["limit"] = requestParameters["limit"];
9048
+ }
9049
+ if (requestParameters["offset"] != null) {
9050
+ queryParameters["offset"] = requestParameters["offset"];
9051
+ }
9052
+ const headerParameters = {};
9053
+ if (this.configuration && this.configuration.apiKey) {
9054
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
9055
+ "X-Schematic-Api-Key"
9056
+ );
9057
+ }
9058
+ const response = await this.request(
9059
+ {
9060
+ path: `/checkouts`,
9061
+ method: "GET",
9062
+ headers: headerParameters,
9063
+ query: queryParameters
9064
+ },
9065
+ initOverrides
9066
+ );
9067
+ return new JSONApiResponse(
9068
+ response,
9069
+ (jsonValue) => ListCheckoutsResponseFromJSON(jsonValue)
9070
+ );
9071
+ }
9072
+ /**
9073
+ * List checkouts
9074
+ */
9075
+ async listCheckouts(requestParameters = {}, initOverrides) {
9076
+ const response = await this.listCheckoutsRaw(
9077
+ requestParameters,
9078
+ initOverrides
9079
+ );
9080
+ return await response.value();
9081
+ }
8518
9082
  /**
8519
9083
  * List invoices
8520
9084
  */
@@ -8601,6 +9165,60 @@ var CheckoutexternalApi = class extends BaseAPI {
8601
9165
  );
8602
9166
  return await response.value();
8603
9167
  }
9168
+ /**
9169
+ * Update checkout
9170
+ */
9171
+ async updateCheckoutRaw(requestParameters, initOverrides) {
9172
+ if (requestParameters["checkoutId"] == null) {
9173
+ throw new RequiredError(
9174
+ "checkoutId",
9175
+ 'Required parameter "checkoutId" was null or undefined when calling updateCheckout().'
9176
+ );
9177
+ }
9178
+ if (requestParameters["updateCheckoutRequest"] == null) {
9179
+ throw new RequiredError(
9180
+ "updateCheckoutRequest",
9181
+ 'Required parameter "updateCheckoutRequest" was null or undefined when calling updateCheckout().'
9182
+ );
9183
+ }
9184
+ const queryParameters = {};
9185
+ const headerParameters = {};
9186
+ headerParameters["Content-Type"] = "application/json";
9187
+ if (this.configuration && this.configuration.apiKey) {
9188
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
9189
+ "X-Schematic-Api-Key"
9190
+ );
9191
+ }
9192
+ const response = await this.request(
9193
+ {
9194
+ path: `/checkouts/{checkout_id}`.replace(
9195
+ `{${"checkout_id"}}`,
9196
+ encodeURIComponent(String(requestParameters["checkoutId"]))
9197
+ ),
9198
+ method: "PUT",
9199
+ headers: headerParameters,
9200
+ query: queryParameters,
9201
+ body: UpdateCheckoutRequestToJSON(
9202
+ requestParameters["updateCheckoutRequest"]
9203
+ )
9204
+ },
9205
+ initOverrides
9206
+ );
9207
+ return new JSONApiResponse(
9208
+ response,
9209
+ (jsonValue) => UpdateCheckoutResponseFromJSON(jsonValue)
9210
+ );
9211
+ }
9212
+ /**
9213
+ * Update checkout
9214
+ */
9215
+ async updateCheckout(requestParameters, initOverrides) {
9216
+ const response = await this.updateCheckoutRaw(
9217
+ requestParameters,
9218
+ initOverrides
9219
+ );
9220
+ return await response.value();
9221
+ }
8604
9222
  /**
8605
9223
  * Update checkout field values
8606
9224
  */
@@ -13374,6 +13992,12 @@ function getSubscriptionPeriod(billingSubscription) {
13374
13992
  );
13375
13993
  return derivePeriod(product?.interval, product?.intervalCount) ?? derivePeriod(billingSubscription.interval);
13376
13994
  }
13995
+ function getDefaultPlanPeriod(plans = []) {
13996
+ if (plans.some((plan) => plan.monthlyPrice)) return "month";
13997
+ if (plans.some((plan) => plan.quarterlyPrice)) return "quarter";
13998
+ if (plans.some((plan) => plan.yearlyPrice)) return "year";
13999
+ return "month";
14000
+ }
13377
14001
  var ChargeType = {
13378
14002
  oneTime: "one_time",
13379
14003
  recurring: "recurring",
@@ -15242,7 +15866,7 @@ var reducer = (state, action) => {
15242
15866
  // src/context/EmbedProvider.tsx
15243
15867
  var import_jsx_runtime4 = require("react/jsx-runtime");
15244
15868
  var getCustomHeaders = (sessionId) => ({
15245
- "X-Schematic-Components-Version": "2.26.0",
15869
+ "X-Schematic-Components-Version": "2.27.1",
15246
15870
  "X-Schematic-Session-ID": sessionId
15247
15871
  });
15248
15872
  var normalizeCurrencyFilter = (filter) => {
@@ -19570,7 +20194,7 @@ var CheckoutDialog = ({ top }) => {
19570
20194
  [data?.featureUsage?.features]
19571
20195
  );
19572
20196
  const getValidatedPeriod = () => {
19573
- const requestedPeriod = checkoutState?.period || getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month";
20197
+ const requestedPeriod = checkoutState?.period || getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || getDefaultPlanPeriod(data?.activePlans);
19574
20198
  if (checkoutState?.planId) {
19575
20199
  const requestedPlan = data?.activePlans?.find(
19576
20200
  (plan) => plan.id === checkoutState.planId
@@ -28367,7 +28991,7 @@ var PricingTable = (0, import_react53.forwardRef)(({ className, ...rest }, ref)
28367
28991
  []
28368
28992
  );
28369
28993
  const [selectedPeriod, setSelectedPeriod] = (0, import_react53.useState)(
28370
- () => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month"
28994
+ () => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || getDefaultPlanPeriod(data?.activePlans)
28371
28995
  );
28372
28996
  const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
28373
28997
  const [selectedCurrency, setSelectedCurrency] = (0, import_react53.useState)(