@schematichq/schematic-components 2.8.2 → 2.8.4

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.
@@ -2273,6 +2273,72 @@ function BillingProductPriceResponseDataFromJSONTyped(json, ignoreDiscriminator)
2273
2273
  };
2274
2274
  }
2275
2275
 
2276
+ // src/api/checkoutexternal/models/BillingProductPriceTierResponseData.ts
2277
+ function BillingProductPriceTierResponseDataFromJSON(json) {
2278
+ return BillingProductPriceTierResponseDataFromJSONTyped(json, false);
2279
+ }
2280
+ function BillingProductPriceTierResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2281
+ if (json == null) {
2282
+ return json;
2283
+ }
2284
+ return {
2285
+ flatAmount: json["flat_amount"] == null ? void 0 : json["flat_amount"],
2286
+ perUnitPrice: json["per_unit_price"] == null ? void 0 : json["per_unit_price"],
2287
+ perUnitPriceDecimal: json["per_unit_price_decimal"] == null ? void 0 : json["per_unit_price_decimal"],
2288
+ upTo: json["up_to"] == null ? void 0 : json["up_to"]
2289
+ };
2290
+ }
2291
+
2292
+ // src/api/checkoutexternal/models/BillingPriceView.ts
2293
+ function BillingPriceViewFromJSON(json) {
2294
+ return BillingPriceViewFromJSONTyped(json, false);
2295
+ }
2296
+ function BillingPriceViewFromJSONTyped(json, ignoreDiscriminator) {
2297
+ if (json == null) {
2298
+ return json;
2299
+ }
2300
+ return {
2301
+ billingScheme: BillingPriceSchemeFromJSON(json["billing_scheme"]),
2302
+ createdAt: new Date(json["created_at"]),
2303
+ currency: json["currency"],
2304
+ id: json["id"],
2305
+ interval: BillingProductPriceIntervalFromJSON(json["interval"]),
2306
+ isActive: json["is_active"],
2307
+ meterEventName: json["meter_event_name"] == null ? void 0 : json["meter_event_name"],
2308
+ meterEventPayloadKey: json["meter_event_payload_key"] == null ? void 0 : json["meter_event_payload_key"],
2309
+ meterId: json["meter_id"] == null ? void 0 : json["meter_id"],
2310
+ packageSize: json["package_size"],
2311
+ price: json["price"],
2312
+ priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"],
2313
+ priceExternalId: json["price_external_id"],
2314
+ priceId: json["price_id"],
2315
+ priceTier: json["price_tier"].map(
2316
+ BillingProductPriceTierResponseDataFromJSON
2317
+ ),
2318
+ productExternalId: json["product_external_id"],
2319
+ productId: json["product_id"],
2320
+ productName: json["product_name"],
2321
+ providerType: BillingProviderTypeFromJSON(json["provider_type"]),
2322
+ tiersMode: json["tiers_mode"] == null ? void 0 : BillingTiersModeFromJSON(json["tiers_mode"]),
2323
+ updatedAt: new Date(json["updated_at"]),
2324
+ usageType: BillingPriceUsageTypeFromJSON(json["usage_type"])
2325
+ };
2326
+ }
2327
+
2328
+ // src/api/checkoutexternal/models/CreditBundleCurrencyPrice.ts
2329
+ function CreditBundleCurrencyPriceFromJSON(json) {
2330
+ return CreditBundleCurrencyPriceFromJSONTyped(json, false);
2331
+ }
2332
+ function CreditBundleCurrencyPriceFromJSONTyped(json, ignoreDiscriminator) {
2333
+ if (json == null) {
2334
+ return json;
2335
+ }
2336
+ return {
2337
+ currency: json["currency"],
2338
+ price: json["price"] == null ? void 0 : BillingPriceViewFromJSON(json["price"])
2339
+ };
2340
+ }
2341
+
2276
2342
  // src/api/checkoutexternal/models/BillingCreditExpiryUnit.ts
2277
2343
  function BillingCreditExpiryUnitFromJSON(json) {
2278
2344
  return BillingCreditExpiryUnitFromJSONTyped(json, false);
@@ -2296,6 +2362,9 @@ function BillingCreditBundleViewFromJSONTyped(json, ignoreDiscriminator) {
2296
2362
  creditIcon: json["credit_icon"] == null ? void 0 : json["credit_icon"],
2297
2363
  creditId: json["credit_id"],
2298
2364
  creditName: json["credit_name"],
2365
+ currencyPrices: json["currency_prices"] == null ? void 0 : json["currency_prices"].map(
2366
+ CreditBundleCurrencyPriceFromJSON
2367
+ ),
2299
2368
  expiryType: BillingCreditExpiryTypeFromJSON(json["expiry_type"]),
2300
2369
  expiryUnit: BillingCreditExpiryUnitFromJSON(json["expiry_unit"]),
2301
2370
  expiryUnitCount: json["expiry_unit_count"] == null ? void 0 : json["expiry_unit_count"],
@@ -2342,6 +2411,40 @@ function BillingCreditGrantZeroedOutReasonFromJSONTyped(json, ignoreDiscriminato
2342
2411
  return json;
2343
2412
  }
2344
2413
 
2414
+ // src/api/checkoutexternal/models/BillingPriceResponseData.ts
2415
+ function BillingPriceResponseDataFromJSON(json) {
2416
+ return BillingPriceResponseDataFromJSONTyped(json, false);
2417
+ }
2418
+ function BillingPriceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2419
+ if (json == null) {
2420
+ return json;
2421
+ }
2422
+ return {
2423
+ currency: json["currency"],
2424
+ externalPriceId: json["external_price_id"],
2425
+ id: json["id"],
2426
+ interval: BillingProductPriceIntervalFromJSON(json["interval"]),
2427
+ price: json["price"],
2428
+ priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"],
2429
+ providerType: BillingProviderTypeFromJSON(json["provider_type"]),
2430
+ scheme: BillingPriceSchemeFromJSON(json["scheme"])
2431
+ };
2432
+ }
2433
+
2434
+ // src/api/checkoutexternal/models/CreditCurrencyPriceResponseData.ts
2435
+ function CreditCurrencyPriceResponseDataFromJSON(json) {
2436
+ return CreditCurrencyPriceResponseDataFromJSONTyped(json, false);
2437
+ }
2438
+ function CreditCurrencyPriceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2439
+ if (json == null) {
2440
+ return json;
2441
+ }
2442
+ return {
2443
+ currency: json["currency"],
2444
+ price: json["price"] == null ? void 0 : BillingPriceResponseDataFromJSON(json["price"])
2445
+ };
2446
+ }
2447
+
2345
2448
  // src/api/checkoutexternal/models/BillingProductResponseData.ts
2346
2449
  function BillingProductResponseDataFromJSON(json) {
2347
2450
  return BillingProductResponseDataFromJSONTyped(json, false);
@@ -2367,26 +2470,6 @@ function BillingProductResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2367
2470
  };
2368
2471
  }
2369
2472
 
2370
- // src/api/checkoutexternal/models/BillingPriceResponseData.ts
2371
- function BillingPriceResponseDataFromJSON(json) {
2372
- return BillingPriceResponseDataFromJSONTyped(json, false);
2373
- }
2374
- function BillingPriceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2375
- if (json == null) {
2376
- return json;
2377
- }
2378
- return {
2379
- currency: json["currency"],
2380
- externalPriceId: json["external_price_id"],
2381
- id: json["id"],
2382
- interval: BillingProductPriceIntervalFromJSON(json["interval"]),
2383
- price: json["price"],
2384
- priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"],
2385
- providerType: BillingProviderTypeFromJSON(json["provider_type"]),
2386
- scheme: BillingPriceSchemeFromJSON(json["scheme"])
2387
- };
2388
- }
2389
-
2390
2473
  // src/api/checkoutexternal/models/BillingCreditRolloverPolicy.ts
2391
2474
  function BillingCreditRolloverPolicyFromJSON(json) {
2392
2475
  return BillingCreditRolloverPolicyFromJSONTyped(json, false);
@@ -2407,6 +2490,9 @@ function BillingCreditResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2407
2490
  burnStrategy: BillingCreditBurnStrategyFromJSON(json["burn_strategy"]),
2408
2491
  costEditable: json["cost_editable"],
2409
2492
  createdAt: new Date(json["created_at"]),
2493
+ currencyPrices: json["currency_prices"].map(
2494
+ CreditCurrencyPriceResponseDataFromJSON
2495
+ ),
2410
2496
  defaultExpiryUnit: BillingCreditExpiryUnitFromJSON(
2411
2497
  json["default_expiry_unit"]
2412
2498
  ),
@@ -2426,58 +2512,6 @@ function BillingCreditResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2426
2512
  };
2427
2513
  }
2428
2514
 
2429
- // src/api/checkoutexternal/models/BillingProductPriceTierResponseData.ts
2430
- function BillingProductPriceTierResponseDataFromJSON(json) {
2431
- return BillingProductPriceTierResponseDataFromJSONTyped(json, false);
2432
- }
2433
- function BillingProductPriceTierResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2434
- if (json == null) {
2435
- return json;
2436
- }
2437
- return {
2438
- flatAmount: json["flat_amount"] == null ? void 0 : json["flat_amount"],
2439
- perUnitPrice: json["per_unit_price"] == null ? void 0 : json["per_unit_price"],
2440
- perUnitPriceDecimal: json["per_unit_price_decimal"] == null ? void 0 : json["per_unit_price_decimal"],
2441
- upTo: json["up_to"] == null ? void 0 : json["up_to"]
2442
- };
2443
- }
2444
-
2445
- // src/api/checkoutexternal/models/BillingPriceView.ts
2446
- function BillingPriceViewFromJSON(json) {
2447
- return BillingPriceViewFromJSONTyped(json, false);
2448
- }
2449
- function BillingPriceViewFromJSONTyped(json, ignoreDiscriminator) {
2450
- if (json == null) {
2451
- return json;
2452
- }
2453
- return {
2454
- billingScheme: BillingPriceSchemeFromJSON(json["billing_scheme"]),
2455
- createdAt: new Date(json["created_at"]),
2456
- currency: json["currency"],
2457
- id: json["id"],
2458
- interval: BillingProductPriceIntervalFromJSON(json["interval"]),
2459
- isActive: json["is_active"],
2460
- meterEventName: json["meter_event_name"] == null ? void 0 : json["meter_event_name"],
2461
- meterEventPayloadKey: json["meter_event_payload_key"] == null ? void 0 : json["meter_event_payload_key"],
2462
- meterId: json["meter_id"] == null ? void 0 : json["meter_id"],
2463
- packageSize: json["package_size"],
2464
- price: json["price"],
2465
- priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"],
2466
- priceExternalId: json["price_external_id"],
2467
- priceId: json["price_id"],
2468
- priceTier: json["price_tier"].map(
2469
- BillingProductPriceTierResponseDataFromJSON
2470
- ),
2471
- productExternalId: json["product_external_id"],
2472
- productId: json["product_id"],
2473
- productName: json["product_name"],
2474
- providerType: BillingProviderTypeFromJSON(json["provider_type"]),
2475
- tiersMode: json["tiers_mode"] == null ? void 0 : BillingTiersModeFromJSON(json["tiers_mode"]),
2476
- updatedAt: new Date(json["updated_at"]),
2477
- usageType: BillingPriceUsageTypeFromJSON(json["usage_type"])
2478
- };
2479
- }
2480
-
2481
2515
  // src/api/checkoutexternal/models/BillingCreditView.ts
2482
2516
  function BillingCreditViewFromJSON(json) {
2483
2517
  return BillingCreditViewFromJSONTyped(json, false);
@@ -3691,6 +3725,21 @@ function PlanControlledByTypeFromJSONTyped(json, ignoreDiscriminator) {
3691
3725
  return json;
3692
3726
  }
3693
3727
 
3728
+ // src/api/checkoutexternal/models/EntitlementCurrencyPricesResponseData.ts
3729
+ function EntitlementCurrencyPricesResponseDataFromJSON(json) {
3730
+ return EntitlementCurrencyPricesResponseDataFromJSONTyped(json, false);
3731
+ }
3732
+ function EntitlementCurrencyPricesResponseDataFromJSONTyped(json, ignoreDiscriminator) {
3733
+ if (json == null) {
3734
+ return json;
3735
+ }
3736
+ return {
3737
+ currency: json["currency"],
3738
+ monthlyPrice: json["monthly_price"] == null ? void 0 : BillingPriceViewFromJSON(json["monthly_price"]),
3739
+ yearlyPrice: json["yearly_price"] == null ? void 0 : BillingPriceViewFromJSON(json["yearly_price"])
3740
+ };
3741
+ }
3742
+
3694
3743
  // src/api/checkoutexternal/models/EntitlementPriceBehavior.ts
3695
3744
  var EntitlementPriceBehavior = {
3696
3745
  CreditBurndown: "credit_burndown",
@@ -3746,6 +3795,9 @@ function PlanEntitlementResponseDataFromJSONTyped(json, ignoreDiscriminator) {
3746
3795
  billingThreshold: json["billing_threshold"] == null ? void 0 : json["billing_threshold"],
3747
3796
  consumptionRate: json["consumption_rate"] == null ? void 0 : json["consumption_rate"],
3748
3797
  createdAt: new Date(json["created_at"]),
3798
+ currencyPrices: json["currency_prices"].map(
3799
+ EntitlementCurrencyPricesResponseDataFromJSON
3800
+ ),
3749
3801
  environmentId: json["environment_id"],
3750
3802
  feature: json["feature"] == null ? void 0 : FeatureResponseDataFromJSON(json["feature"]),
3751
3803
  featureId: json["feature_id"],
@@ -3771,6 +3823,37 @@ function PlanEntitlementResponseDataFromJSONTyped(json, ignoreDiscriminator) {
3771
3823
  };
3772
3824
  }
3773
3825
 
3826
+ // src/api/checkoutexternal/models/CustomPlanConfig.ts
3827
+ function CustomPlanConfigFromJSON(json) {
3828
+ return CustomPlanConfigFromJSONTyped(json, false);
3829
+ }
3830
+ function CustomPlanConfigFromJSONTyped(json, ignoreDiscriminator) {
3831
+ if (json == null) {
3832
+ return json;
3833
+ }
3834
+ return {
3835
+ ctaText: json["cta_text"],
3836
+ ctaWebSite: json["cta_web_site"],
3837
+ priceText: json["price_text"]
3838
+ };
3839
+ }
3840
+
3841
+ // src/api/checkoutexternal/models/PlanCurrencyPricesResponseData.ts
3842
+ function PlanCurrencyPricesResponseDataFromJSON(json) {
3843
+ return PlanCurrencyPricesResponseDataFromJSONTyped(json, false);
3844
+ }
3845
+ function PlanCurrencyPricesResponseDataFromJSONTyped(json, ignoreDiscriminator) {
3846
+ if (json == null) {
3847
+ return json;
3848
+ }
3849
+ return {
3850
+ currency: json["currency"],
3851
+ monthlyPrice: json["monthly_price"] == null ? void 0 : BillingPriceResponseDataFromJSON(json["monthly_price"]),
3852
+ oneTimePrice: json["one_time_price"] == null ? void 0 : BillingPriceResponseDataFromJSON(json["one_time_price"]),
3853
+ yearlyPrice: json["yearly_price"] == null ? void 0 : BillingPriceResponseDataFromJSON(json["yearly_price"])
3854
+ };
3855
+ }
3856
+
3774
3857
  // src/api/checkoutexternal/models/PlanVersionStatus.ts
3775
3858
  function PlanVersionStatusFromJSON(json) {
3776
3859
  return PlanVersionStatusFromJSONTyped(json, false);
@@ -3802,21 +3885,6 @@ function PlanVersionResponseDataFromJSONTyped(json, ignoreDiscriminator) {
3802
3885
  };
3803
3886
  }
3804
3887
 
3805
- // src/api/checkoutexternal/models/CustomPlanConfig.ts
3806
- function CustomPlanConfigFromJSON(json) {
3807
- return CustomPlanConfigFromJSONTyped(json, false);
3808
- }
3809
- function CustomPlanConfigFromJSONTyped(json, ignoreDiscriminator) {
3810
- if (json == null) {
3811
- return json;
3812
- }
3813
- return {
3814
- ctaText: json["cta_text"],
3815
- ctaWebSite: json["cta_web_site"],
3816
- priceText: json["price_text"]
3817
- };
3818
- }
3819
-
3820
3888
  // src/api/checkoutexternal/models/CreditUsageAggregation.ts
3821
3889
  function CreditUsageAggregationFromJSON(json) {
3822
3890
  return CreditUsageAggregationFromJSONTyped(json, false);
@@ -3923,6 +3991,9 @@ function CompanyPlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
3923
3991
  compatiblePlanIds: json["compatible_plan_ids"],
3924
3992
  controlledBy: PlanControlledByTypeFromJSON(json["controlled_by"]),
3925
3993
  createdAt: new Date(json["created_at"]),
3994
+ currencyPrices: json["currency_prices"].map(
3995
+ PlanCurrencyPricesResponseDataFromJSON
3996
+ ),
3926
3997
  current: json["current"],
3927
3998
  custom: json["custom"],
3928
3999
  customPlanConfig: json["custom_plan_config"] == null ? void 0 : CustomPlanConfigFromJSON(json["custom_plan_config"]),
@@ -4077,6 +4148,9 @@ function PlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
4077
4148
  companyCount: json["company_count"],
4078
4149
  controlledBy: PlanControlledByTypeFromJSON(json["controlled_by"]),
4079
4150
  createdAt: new Date(json["created_at"]),
4151
+ currencyPrices: json["currency_prices"].map(
4152
+ PlanCurrencyPricesResponseDataFromJSON
4153
+ ),
4080
4154
  description: json["description"],
4081
4155
  draftVersion: json["draft_version"] == null ? void 0 : PlanVersionResponseDataFromJSON(json["draft_version"]),
4082
4156
  features: json["features"].map(
@@ -4154,6 +4228,7 @@ function CreditCompanyGrantViewFromJSONTyped(json, ignoreDiscriminator) {
4154
4228
  creditDescription: json["credit_description"],
4155
4229
  creditIcon: json["credit_icon"] == null ? void 0 : json["credit_icon"],
4156
4230
  creditName: json["credit_name"],
4231
+ currency: json["currency"] == null ? void 0 : json["currency"],
4157
4232
  exhaustedAt: json["exhausted_at"] == null ? void 0 : new Date(json["exhausted_at"]),
4158
4233
  expiresAt: json["expires_at"] == null ? void 0 : new Date(json["expires_at"]),
4159
4234
  expiryType: json["expiry_type"] == null ? void 0 : BillingCreditExpiryTypeFromJSON(json["expiry_type"]),
@@ -5181,14 +5256,12 @@ function buildPayInAdvanceRequestBody(entitlements, period) {
5181
5256
  []
5182
5257
  );
5183
5258
  }
5184
- function buildAddOnRequestBody(addOns, period, shouldTrial, addOnPayInAdvanceEntitlements) {
5259
+ function buildAddOnRequestBody(addOns, period, shouldTrial) {
5185
5260
  return addOns.reduce((acc, addOn) => {
5186
5261
  if (addOn.isSelected && !shouldTrial) {
5187
5262
  const addOnPrice = getAddOnPrice(addOn, period);
5188
5263
  const addOnPriceId = addOnPrice?.id;
5189
- if (addOnPriceId && (addOnPrice?.price || addOnPayInAdvanceEntitlements.some(
5190
- (e2) => e2.priceBehavior === EntitlementPriceBehavior.PayInAdvance
5191
- ))) {
5264
+ if (addOnPriceId) {
5192
5265
  acc.push({
5193
5266
  addOnId: addOn.id,
5194
5267
  priceId: addOnPriceId
@@ -7634,7 +7707,7 @@ var defer = () => {
7634
7707
  };
7635
7708
  var makeString = (object) => {
7636
7709
  if (object == null) return "";
7637
- return "" + object;
7710
+ return String(object);
7638
7711
  };
7639
7712
  var copy2 = (a2, s, t2) => {
7640
7713
  a2.forEach((m2) => {
@@ -7642,7 +7715,7 @@ var copy2 = (a2, s, t2) => {
7642
7715
  });
7643
7716
  };
7644
7717
  var lastOfPathSeparatorRegExp = /###/g;
7645
- var cleanKey = (key) => key && key.indexOf("###") > -1 ? key.replace(lastOfPathSeparatorRegExp, ".") : key;
7718
+ var cleanKey = (key) => key && key.includes("###") ? key.replace(lastOfPathSeparatorRegExp, ".") : key;
7646
7719
  var canNotTraverseDeeper = (object) => !object || isString(object);
7647
7720
  var getLastOfPath = (object, path, Empty) => {
7648
7721
  const stack = !isString(path) ? path : path.split(".");
@@ -7766,7 +7839,7 @@ var looksLikeObjectPathRegExpCache = new RegExpCache(20);
7766
7839
  var looksLikeObjectPath = (key, nsSeparator, keySeparator) => {
7767
7840
  nsSeparator = nsSeparator || "";
7768
7841
  keySeparator = keySeparator || "";
7769
- const possibleChars = chars.filter((c2) => nsSeparator.indexOf(c2) < 0 && keySeparator.indexOf(c2) < 0);
7842
+ const possibleChars = chars.filter((c2) => !nsSeparator.includes(c2) && !keySeparator.includes(c2));
7770
7843
  if (possibleChars.length === 0) return true;
7771
7844
  const r2 = looksLikeObjectPathRegExpCache.getRegExp(`(${possibleChars.map((c2) => c2 === "?" ? "\\?" : c2).join("|")})`);
7772
7845
  let matched = !r2.test(key);
@@ -7799,7 +7872,7 @@ var deepFind = (obj, path, keySeparator = ".") => {
7799
7872
  nextPath += tokens[j2];
7800
7873
  next2 = current[nextPath];
7801
7874
  if (next2 !== void 0) {
7802
- if (["string", "number", "boolean"].indexOf(typeof next2) > -1 && j2 < tokens.length - 1) {
7875
+ if (["string", "number", "boolean"].includes(typeof next2) && j2 < tokens.length - 1) {
7803
7876
  continue;
7804
7877
  }
7805
7878
  i += j2 - i + 1;
@@ -7888,6 +7961,14 @@ var EventEmitter = class {
7888
7961
  }
7889
7962
  this.observers[event].delete(listener);
7890
7963
  }
7964
+ once(event, listener) {
7965
+ const wrapper = (...args) => {
7966
+ listener(...args);
7967
+ this.off(event, wrapper);
7968
+ };
7969
+ this.on(event, wrapper);
7970
+ return this;
7971
+ }
7891
7972
  emit(event, ...args) {
7892
7973
  if (this.observers[event]) {
7893
7974
  const cloned = Array.from(this.observers[event].entries());
@@ -7901,7 +7982,7 @@ var EventEmitter = class {
7901
7982
  const cloned = Array.from(this.observers["*"].entries());
7902
7983
  cloned.forEach(([observer, numTimesAdded]) => {
7903
7984
  for (let i = 0; i < numTimesAdded; i++) {
7904
- observer.apply(observer, [event, ...args]);
7985
+ observer(event, ...args);
7905
7986
  }
7906
7987
  });
7907
7988
  }
@@ -7923,7 +8004,7 @@ var ResourceStore = class extends EventEmitter {
7923
8004
  }
7924
8005
  }
7925
8006
  addNamespaces(ns) {
7926
- if (this.options.ns.indexOf(ns) < 0) {
8007
+ if (!this.options.ns.includes(ns)) {
7927
8008
  this.options.ns.push(ns);
7928
8009
  }
7929
8010
  }
@@ -7937,7 +8018,7 @@ var ResourceStore = class extends EventEmitter {
7937
8018
  const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
7938
8019
  const ignoreJSONStructure = options.ignoreJSONStructure !== void 0 ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
7939
8020
  let path;
7940
- if (lng.indexOf(".") > -1) {
8021
+ if (lng.includes(".")) {
7941
8022
  path = lng.split(".");
7942
8023
  } else {
7943
8024
  path = [lng, ns];
@@ -7952,7 +8033,7 @@ var ResourceStore = class extends EventEmitter {
7952
8033
  }
7953
8034
  }
7954
8035
  const result = getPath(this.data, path);
7955
- if (!result && !ns && !key && lng.indexOf(".") > -1) {
8036
+ if (!result && !ns && !key && lng.includes(".")) {
7956
8037
  lng = path[0];
7957
8038
  ns = path[1];
7958
8039
  key = path.slice(2).join(".");
@@ -7966,7 +8047,7 @@ var ResourceStore = class extends EventEmitter {
7966
8047
  const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
7967
8048
  let path = [lng, ns];
7968
8049
  if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
7969
- if (lng.indexOf(".") > -1) {
8050
+ if (lng.includes(".")) {
7970
8051
  path = lng.split(".");
7971
8052
  value = ns;
7972
8053
  ns = path[1];
@@ -7990,7 +8071,7 @@ var ResourceStore = class extends EventEmitter {
7990
8071
  skipCopy: false
7991
8072
  }) {
7992
8073
  let path = [lng, ns];
7993
- if (lng.indexOf(".") > -1) {
8074
+ if (lng.includes(".")) {
7994
8075
  path = lng.split(".");
7995
8076
  deep = resources;
7996
8077
  resources = ns;
@@ -8077,7 +8158,6 @@ function keysFromSelector(selector, opts) {
8077
8158
  }
8078
8159
  return path.join(keySeparator);
8079
8160
  }
8080
- var checkedLoadedFor = {};
8081
8161
  var shouldHandleAsObject = (res) => !isString(res) && typeof res !== "boolean" && typeof res !== "number";
8082
8162
  var Translator = class _Translator extends EventEmitter {
8083
8163
  constructor(services, options = {}) {
@@ -8088,6 +8168,7 @@ var Translator = class _Translator extends EventEmitter {
8088
8168
  this.options.keySeparator = ".";
8089
8169
  }
8090
8170
  this.logger = baseLogger.create("translator");
8171
+ this.checkedLoadedFor = {};
8091
8172
  }
8092
8173
  changeLanguage(lng) {
8093
8174
  if (lng) this.language = lng;
@@ -8112,7 +8193,7 @@ var Translator = class _Translator extends EventEmitter {
8112
8193
  if (nsSeparator === void 0) nsSeparator = ":";
8113
8194
  const keySeparator = opt.keySeparator !== void 0 ? opt.keySeparator : this.options.keySeparator;
8114
8195
  let namespaces = opt.ns || this.options.defaultNS || [];
8115
- const wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
8196
+ const wouldCheckForNsInKey = nsSeparator && key.includes(nsSeparator);
8116
8197
  const seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !opt.keySeparator && !this.options.userDefinedNsSeparator && !opt.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
8117
8198
  if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
8118
8199
  const m2 = key.match(this.interpolator.nestingRegexp);
@@ -8123,7 +8204,7 @@ var Translator = class _Translator extends EventEmitter {
8123
8204
  };
8124
8205
  }
8125
8206
  const parts = key.split(nsSeparator);
8126
- if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
8207
+ if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.includes(parts[0])) namespaces = parts.shift();
8127
8208
  key = parts.join(keySeparator);
8128
8209
  }
8129
8210
  return {
@@ -8210,7 +8291,7 @@ var Translator = class _Translator extends EventEmitter {
8210
8291
  }
8211
8292
  const handleAsObject = shouldHandleAsObject(resForObjHndl);
8212
8293
  const resType = Object.prototype.toString.apply(resForObjHndl);
8213
- if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && noObject.indexOf(resType) < 0 && !(isString(joinArrays) && Array.isArray(resForObjHndl))) {
8294
+ if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && !noObject.includes(resType) && !(isString(joinArrays) && Array.isArray(resForObjHndl))) {
8214
8295
  if (!opt.returnObjects && !this.options.returnObjects) {
8215
8296
  if (!this.options.returnedObjectHandler) {
8216
8297
  this.logger.warn("accessing an object - but returnObjects options is not enabled!");
@@ -8306,7 +8387,7 @@ var Translator = class _Translator extends EventEmitter {
8306
8387
  if (this.options.saveMissingPlurals && needsPluralHandling) {
8307
8388
  lngs.forEach((language) => {
8308
8389
  const suffixes = this.pluralResolver.getSuffixes(language, opt);
8309
- if (needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] && suffixes.indexOf(`${this.options.pluralSeparator}zero`) < 0) {
8390
+ if (needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] && !suffixes.includes(`${this.options.pluralSeparator}zero`)) {
8310
8391
  suffixes.push(`${this.options.pluralSeparator}zero`);
8311
8392
  }
8312
8393
  suffixes.forEach((suffix) => {
@@ -8416,8 +8497,8 @@ var Translator = class _Translator extends EventEmitter {
8416
8497
  namespaces.forEach((ns) => {
8417
8498
  if (this.isValidLookup(found)) return;
8418
8499
  usedNS = ns;
8419
- if (!checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(usedNS)) {
8420
- checkedLoadedFor[`${codes[0]}-${ns}`] = true;
8500
+ if (!this.checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(usedNS)) {
8501
+ this.checkedLoadedFor[`${codes[0]}-${ns}`] = true;
8421
8502
  this.logger.warn(`key "${usedKey}" for languages "${codes.join(", ")}" won't get resolved as namespace "${usedNS}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
8422
8503
  }
8423
8504
  codes.forEach((code) => {
@@ -8432,7 +8513,7 @@ var Translator = class _Translator extends EventEmitter {
8432
8513
  const zeroSuffix = `${this.options.pluralSeparator}zero`;
8433
8514
  const ordinalPrefix = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
8434
8515
  if (needsPluralHandling) {
8435
- if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
8516
+ if (opt.ordinal && pluralSuffix.startsWith(ordinalPrefix)) {
8436
8517
  finalKeys.push(key + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
8437
8518
  }
8438
8519
  finalKeys.push(key + pluralSuffix);
@@ -8444,7 +8525,7 @@ var Translator = class _Translator extends EventEmitter {
8444
8525
  const contextKey = `${key}${this.options.contextSeparator || "_"}${opt.context}`;
8445
8526
  finalKeys.push(contextKey);
8446
8527
  if (needsPluralHandling) {
8447
- if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
8528
+ if (opt.ordinal && pluralSuffix.startsWith(ordinalPrefix)) {
8448
8529
  finalKeys.push(contextKey + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
8449
8530
  }
8450
8531
  finalKeys.push(contextKey + pluralSuffix);
@@ -8505,7 +8586,7 @@ var Translator = class _Translator extends EventEmitter {
8505
8586
  static hasDefaultValue(options) {
8506
8587
  const prefix2 = "defaultValue";
8507
8588
  for (const option in options) {
8508
- if (Object.prototype.hasOwnProperty.call(options, option) && prefix2 === option.substring(0, prefix2.length) && void 0 !== options[option]) {
8589
+ if (Object.prototype.hasOwnProperty.call(options, option) && option.startsWith(prefix2) && void 0 !== options[option]) {
8509
8590
  return true;
8510
8591
  }
8511
8592
  }
@@ -8520,7 +8601,7 @@ var LanguageUtil = class {
8520
8601
  }
8521
8602
  getScriptPartFromCode(code) {
8522
8603
  code = getCleanedCode(code);
8523
- if (!code || code.indexOf("-") < 0) return null;
8604
+ if (!code || !code.includes("-")) return null;
8524
8605
  const p2 = code.split("-");
8525
8606
  if (p2.length === 2) return null;
8526
8607
  p2.pop();
@@ -8529,12 +8610,12 @@ var LanguageUtil = class {
8529
8610
  }
8530
8611
  getLanguagePartFromCode(code) {
8531
8612
  code = getCleanedCode(code);
8532
- if (!code || code.indexOf("-") < 0) return code;
8613
+ if (!code || !code.includes("-")) return code;
8533
8614
  const p2 = code.split("-");
8534
8615
  return this.formatLanguageCode(p2[0]);
8535
8616
  }
8536
8617
  formatLanguageCode(code) {
8537
- if (isString(code) && code.indexOf("-") > -1) {
8618
+ if (isString(code) && code.includes("-")) {
8538
8619
  let formattedCode;
8539
8620
  try {
8540
8621
  formattedCode = Intl.getCanonicalLocales(code)[0];
@@ -8555,7 +8636,7 @@ var LanguageUtil = class {
8555
8636
  if (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) {
8556
8637
  code = this.getLanguagePartFromCode(code);
8557
8638
  }
8558
- return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
8639
+ return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.includes(code);
8559
8640
  }
8560
8641
  getBestMatchFromCodes(codes) {
8561
8642
  if (!codes) return null;
@@ -8573,10 +8654,11 @@ var LanguageUtil = class {
8573
8654
  const lngOnly = this.getLanguagePartFromCode(code);
8574
8655
  if (this.isSupportedCode(lngOnly)) return found = lngOnly;
8575
8656
  found = this.options.supportedLngs.find((supportedLng) => {
8576
- if (supportedLng === lngOnly) return supportedLng;
8577
- if (supportedLng.indexOf("-") < 0 && lngOnly.indexOf("-") < 0) return;
8578
- if (supportedLng.indexOf("-") > 0 && lngOnly.indexOf("-") < 0 && supportedLng.substring(0, supportedLng.indexOf("-")) === lngOnly) return supportedLng;
8579
- if (supportedLng.indexOf(lngOnly) === 0 && lngOnly.length > 1) return supportedLng;
8657
+ if (supportedLng === lngOnly) return true;
8658
+ if (!supportedLng.includes("-") && !lngOnly.includes("-")) return false;
8659
+ if (supportedLng.includes("-") && !lngOnly.includes("-") && supportedLng.slice(0, supportedLng.indexOf("-")) === lngOnly) return true;
8660
+ if (supportedLng.startsWith(lngOnly) && lngOnly.length > 1) return true;
8661
+ return false;
8580
8662
  });
8581
8663
  });
8582
8664
  }
@@ -8607,7 +8689,7 @@ var LanguageUtil = class {
8607
8689
  this.logger.warn(`rejecting language code not found in supportedLngs: ${c2}`);
8608
8690
  }
8609
8691
  };
8610
- if (isString(code) && (code.indexOf("-") > -1 || code.indexOf("_") > -1)) {
8692
+ if (isString(code) && (code.includes("-") || code.includes("_"))) {
8611
8693
  if (this.options.load !== "languageOnly") addCode(this.formatLanguageCode(code));
8612
8694
  if (this.options.load !== "languageOnly" && this.options.load !== "currentOnly") addCode(this.getScriptPartFromCode(code));
8613
8695
  if (this.options.load !== "currentOnly") addCode(this.getLanguagePartFromCode(code));
@@ -8615,7 +8697,7 @@ var LanguageUtil = class {
8615
8697
  addCode(this.formatLanguageCode(code));
8616
8698
  }
8617
8699
  fallbackCodes.forEach((fc) => {
8618
- if (codes.indexOf(fc) < 0) addCode(this.formatLanguageCode(fc));
8700
+ if (!codes.includes(fc)) addCode(this.formatLanguageCode(fc));
8619
8701
  });
8620
8702
  return codes;
8621
8703
  }
@@ -8769,7 +8851,7 @@ var Interpolator = class {
8769
8851
  let replaces;
8770
8852
  const defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
8771
8853
  const handleFormat = (key) => {
8772
- if (key.indexOf(this.formatSeparator) < 0) {
8854
+ if (!key.includes(this.formatSeparator)) {
8773
8855
  const path = deepFindWithDefaults(data, defaultData, key, this.options.keySeparator, this.options.ignoreJSONStructure);
8774
8856
  return this.alwaysFormat ? this.format(path, void 0, lng, {
8775
8857
  ...options,
@@ -8839,7 +8921,7 @@ var Interpolator = class {
8839
8921
  let clonedOptions;
8840
8922
  const handleHasOptions = (key, inheritedOptions) => {
8841
8923
  const sep = this.nestingOptionsSeparator;
8842
- if (key.indexOf(sep) < 0) return key;
8924
+ if (!key.includes(sep)) return key;
8843
8925
  const c2 = key.split(new RegExp(`${regexEscape(sep)}[ ]*{`));
8844
8926
  let optionsString = `{${c2[1]}`;
8845
8927
  key = c2[0];
@@ -8859,7 +8941,7 @@ var Interpolator = class {
8859
8941
  this.logger.warn(`failed parsing options string in nesting for key ${key}`, e2);
8860
8942
  return `${key}${sep}${optionsString}`;
8861
8943
  }
8862
- if (clonedOptions.defaultValue && clonedOptions.defaultValue.indexOf(this.prefix) > -1) delete clonedOptions.defaultValue;
8944
+ if (clonedOptions.defaultValue && clonedOptions.defaultValue.includes(this.prefix)) delete clonedOptions.defaultValue;
8863
8945
  return key;
8864
8946
  };
8865
8947
  while (match2 = this.nestingRegexp.exec(str)) {
@@ -8897,13 +8979,13 @@ var Interpolator = class {
8897
8979
  var parseFormatStr = (formatStr) => {
8898
8980
  let formatName = formatStr.toLowerCase().trim();
8899
8981
  const formatOptions = {};
8900
- if (formatStr.indexOf("(") > -1) {
8982
+ if (formatStr.includes("(")) {
8901
8983
  const p2 = formatStr.split("(");
8902
8984
  formatName = p2[0].toLowerCase().trim();
8903
- const optStr = p2[1].substring(0, p2[1].length - 1);
8904
- if (formatName === "currency" && optStr.indexOf(":") < 0) {
8985
+ const optStr = p2[1].slice(0, -1);
8986
+ if (formatName === "currency" && !optStr.includes(":")) {
8905
8987
  if (!formatOptions.currency) formatOptions.currency = optStr.trim();
8906
- } else if (formatName === "relativetime" && optStr.indexOf(":") < 0) {
8988
+ } else if (formatName === "relativetime" && !optStr.includes(":")) {
8907
8989
  if (!formatOptions.range) formatOptions.range = optStr.trim();
8908
8990
  } else {
8909
8991
  const opts = optStr.split(";");
@@ -8997,9 +9079,11 @@ var Formatter = class {
8997
9079
  this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
8998
9080
  }
8999
9081
  format(value, format, lng, options = {}) {
9082
+ if (!format) return value;
9083
+ if (value == null) return value;
9000
9084
  const formats = format.split(this.formatSeparator);
9001
- if (formats.length > 1 && formats[0].indexOf("(") > 1 && formats[0].indexOf(")") < 0 && formats.find((f2) => f2.indexOf(")") > -1)) {
9002
- const lastIndex = formats.findIndex((f2) => f2.indexOf(")") > -1);
9085
+ if (formats.length > 1 && formats[0].indexOf("(") > 1 && !formats[0].includes(")") && formats.find((f2) => f2.includes(")"))) {
9086
+ const lastIndex = formats.findIndex((f2) => f2.includes(")"));
9003
9087
  formats[0] = [formats[0], ...formats.splice(1, lastIndex)].join(this.formatSeparator);
9004
9088
  }
9005
9089
  const result = formats.reduce((mem, f2) => {
@@ -9153,7 +9237,7 @@ var Connector = class extends EventEmitter {
9153
9237
  }
9154
9238
  if (err2 && data && tried < this.maxRetries) {
9155
9239
  setTimeout(() => {
9156
- this.read.call(this, lng, ns, fcName, tried + 1, wait * 2, callback);
9240
+ this.read(lng, ns, fcName, tried + 1, wait * 2, callback);
9157
9241
  }, wait);
9158
9242
  return;
9159
9243
  }
@@ -9257,7 +9341,6 @@ var get = () => ({
9257
9341
  nonExplicitSupportedLngs: false,
9258
9342
  load: "all",
9259
9343
  preload: false,
9260
- simplifyPluralSuffix: true,
9261
9344
  keySeparator: ".",
9262
9345
  nsSeparator: ":",
9263
9346
  pluralSeparator: "_",
@@ -9294,7 +9377,6 @@ var get = () => ({
9294
9377
  },
9295
9378
  interpolation: {
9296
9379
  escapeValue: true,
9297
- format: (value) => value,
9298
9380
  prefix: "{{",
9299
9381
  suffix: "}}",
9300
9382
  formatSeparator: ",",
@@ -9311,10 +9393,9 @@ var transformOptions = (options) => {
9311
9393
  if (isString(options.ns)) options.ns = [options.ns];
9312
9394
  if (isString(options.fallbackLng)) options.fallbackLng = [options.fallbackLng];
9313
9395
  if (isString(options.fallbackNS)) options.fallbackNS = [options.fallbackNS];
9314
- if (options.supportedLngs?.indexOf?.("cimode") < 0) {
9396
+ if (options.supportedLngs && !options.supportedLngs.includes("cimode")) {
9315
9397
  options.supportedLngs = options.supportedLngs.concat(["cimode"]);
9316
9398
  }
9317
- if (typeof options.initImmediate === "boolean") options.initAsync = options.initImmediate;
9318
9399
  return options;
9319
9400
  };
9320
9401
  var noop = () => {
@@ -9327,27 +9408,6 @@ var bindMemberFunctions = (inst) => {
9327
9408
  }
9328
9409
  });
9329
9410
  };
9330
- var SUPPORT_NOTICE_KEY = "__i18next_supportNoticeShown";
9331
- var getSupportNoticeShown = () => {
9332
- if (typeof globalThis !== "undefined" && !!globalThis[SUPPORT_NOTICE_KEY]) return true;
9333
- if (typeof process !== "undefined" && process.env && process.env.I18NEXT_NO_SUPPORT_NOTICE) return true;
9334
- return false;
9335
- };
9336
- var setSupportNoticeShown = () => {
9337
- if (typeof globalThis !== "undefined") globalThis[SUPPORT_NOTICE_KEY] = true;
9338
- };
9339
- var usesLocize = (inst) => {
9340
- if (inst?.modules?.backend?.name?.indexOf("Locize") > 0) return true;
9341
- if (inst?.modules?.backend?.constructor?.name?.indexOf("Locize") > 0) return true;
9342
- if (inst?.options?.backend?.backends) {
9343
- if (inst.options.backend.backends.some((b2) => b2?.name?.indexOf("Locize") > 0 || b2?.constructor?.name?.indexOf("Locize") > 0)) return true;
9344
- }
9345
- if (inst?.options?.backend?.projectId) return true;
9346
- if (inst?.options?.backend?.backendOptions) {
9347
- if (inst.options.backend.backendOptions.some((b2) => b2?.projectId)) return true;
9348
- }
9349
- return false;
9350
- };
9351
9411
  var I18n = class _I18n extends EventEmitter {
9352
9412
  constructor(options = {}, callback) {
9353
9413
  super();
@@ -9377,7 +9437,7 @@ var I18n = class _I18n extends EventEmitter {
9377
9437
  if (options.defaultNS == null && options.ns) {
9378
9438
  if (isString(options.ns)) {
9379
9439
  options.defaultNS = options.ns;
9380
- } else if (options.ns.indexOf("translation") < 0) {
9440
+ } else if (!options.ns.includes("translation")) {
9381
9441
  options.defaultNS = options.ns[0];
9382
9442
  }
9383
9443
  }
@@ -9400,10 +9460,6 @@ var I18n = class _I18n extends EventEmitter {
9400
9460
  if (typeof this.options.overloadTranslationOptionHandler !== "function") {
9401
9461
  this.options.overloadTranslationOptionHandler = defOpts.overloadTranslationOptionHandler;
9402
9462
  }
9403
- if (this.options.showSupportNotice !== false && !usesLocize(this) && !getSupportNoticeShown()) {
9404
- if (typeof console !== "undefined" && typeof console.info !== "undefined") console.info("\u{1F310} i18next is made possible by our own product, Locize \u2014 consider powering your project with managed localization (AI, CDN, integrations): https://locize.com \u{1F499}");
9405
- setSupportNoticeShown();
9406
- }
9407
9463
  const createClassOnDemand = (ClassOrObject) => {
9408
9464
  if (!ClassOrObject) return null;
9409
9465
  if (typeof ClassOrObject === "function") return new ClassOrObject();
@@ -9428,14 +9484,9 @@ var I18n = class _I18n extends EventEmitter {
9428
9484
  s.resourceStore = this.store;
9429
9485
  s.languageUtils = lu;
9430
9486
  s.pluralResolver = new PluralResolver(lu, {
9431
- prepend: this.options.pluralSeparator,
9432
- simplifyPluralSuffix: this.options.simplifyPluralSuffix
9487
+ prepend: this.options.pluralSeparator
9433
9488
  });
9434
- const usingLegacyFormatFunction = this.options.interpolation.format && this.options.interpolation.format !== defOpts.interpolation.format;
9435
- if (usingLegacyFormatFunction) {
9436
- this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`);
9437
- }
9438
- if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
9489
+ if (formatter) {
9439
9490
  s.formatter = createClassOnDemand(formatter);
9440
9491
  if (s.formatter.init) s.formatter.init(s, this.options);
9441
9492
  this.options.interpolation.format = s.formatter.format.bind(s.formatter);
@@ -9518,7 +9569,7 @@ var I18n = class _I18n extends EventEmitter {
9518
9569
  const lngs = this.services.languageUtils.toResolveHierarchy(lng);
9519
9570
  lngs.forEach((l2) => {
9520
9571
  if (l2 === "cimode") return;
9521
- if (toLoad.indexOf(l2) < 0) toLoad.push(l2);
9572
+ if (!toLoad.includes(l2)) toLoad.push(l2);
9522
9573
  });
9523
9574
  };
9524
9575
  if (!usedLng) {
@@ -9583,16 +9634,16 @@ var I18n = class _I18n extends EventEmitter {
9583
9634
  }
9584
9635
  setResolvedLanguage(l2) {
9585
9636
  if (!l2 || !this.languages) return;
9586
- if (["cimode", "dev"].indexOf(l2) > -1) return;
9637
+ if (["cimode", "dev"].includes(l2)) return;
9587
9638
  for (let li = 0; li < this.languages.length; li++) {
9588
9639
  const lngInLngs = this.languages[li];
9589
- if (["cimode", "dev"].indexOf(lngInLngs) > -1) continue;
9640
+ if (["cimode", "dev"].includes(lngInLngs)) continue;
9590
9641
  if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
9591
9642
  this.resolvedLanguage = lngInLngs;
9592
9643
  break;
9593
9644
  }
9594
9645
  }
9595
- if (!this.resolvedLanguage && this.languages.indexOf(l2) < 0 && this.store.hasLanguageSomeTranslations(l2)) {
9646
+ if (!this.resolvedLanguage && !this.languages.includes(l2) && this.store.hasLanguageSomeTranslations(l2)) {
9596
9647
  this.resolvedLanguage = l2;
9597
9648
  this.languages.unshift(l2);
9598
9649
  }
@@ -9734,7 +9785,7 @@ var I18n = class _I18n extends EventEmitter {
9734
9785
  }
9735
9786
  if (isString(ns)) ns = [ns];
9736
9787
  ns.forEach((n) => {
9737
- if (this.options.ns.indexOf(n) < 0) this.options.ns.push(n);
9788
+ if (!this.options.ns.includes(n)) this.options.ns.push(n);
9738
9789
  });
9739
9790
  this.loadResources((err2) => {
9740
9791
  deferred.resolve();
@@ -9746,7 +9797,7 @@ var I18n = class _I18n extends EventEmitter {
9746
9797
  const deferred = defer();
9747
9798
  if (isString(lngs)) lngs = [lngs];
9748
9799
  const preloaded = this.options.preload || [];
9749
- const newLngs = lngs.filter((lng) => preloaded.indexOf(lng) < 0 && this.services.languageUtils.isSupportedCode(lng));
9800
+ const newLngs = lngs.filter((lng) => !preloaded.includes(lng) && this.services.languageUtils.isSupportedCode(lng));
9750
9801
  if (!newLngs.length) {
9751
9802
  if (callback) callback();
9752
9803
  return Promise.resolve();
@@ -9772,7 +9823,7 @@ var I18n = class _I18n extends EventEmitter {
9772
9823
  const rtlLngs = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"];
9773
9824
  const languageUtils = this.services?.languageUtils || new LanguageUtil(get());
9774
9825
  if (lng.toLowerCase().indexOf("-latn") > 1) return "ltr";
9775
- return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
9826
+ return rtlLngs.includes(languageUtils.getLanguagePartFromCode(lng)) || lng.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
9776
9827
  }
9777
9828
  static createInstance(options = {}, callback) {
9778
9829
  const instance2 = new _I18n(options, callback);
@@ -11305,39 +11356,6 @@ function BillingCreditExpiryUnitFromJSONTyped8(json, ignoreDiscriminator) {
11305
11356
  return json;
11306
11357
  }
11307
11358
 
11308
- // src/api/componentspublic/models/BillingProviderType.ts
11309
- function BillingProviderTypeFromJSON2(json) {
11310
- return BillingProviderTypeFromJSONTyped13(json, false);
11311
- }
11312
- function BillingProviderTypeFromJSONTyped13(json, ignoreDiscriminator) {
11313
- return json;
11314
- }
11315
-
11316
- // src/api/componentspublic/models/BillingProductResponseData.ts
11317
- function BillingProductResponseDataFromJSON2(json) {
11318
- return BillingProductResponseDataFromJSONTyped5(json, false);
11319
- }
11320
- function BillingProductResponseDataFromJSONTyped5(json, ignoreDiscriminator) {
11321
- if (json == null) {
11322
- return json;
11323
- }
11324
- return {
11325
- accountId: json["account_id"],
11326
- createdAt: new Date(json["created_at"]),
11327
- currency: json["currency"] == null ? void 0 : json["currency"],
11328
- environmentId: json["environment_id"],
11329
- externalId: json["external_id"],
11330
- isActive: json["is_active"],
11331
- name: json["name"],
11332
- price: json["price"],
11333
- priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"],
11334
- productId: json["product_id"],
11335
- providerType: BillingProviderTypeFromJSON2(json["provider_type"]),
11336
- quantity: json["quantity"],
11337
- updatedAt: new Date(json["updated_at"])
11338
- };
11339
- }
11340
-
11341
11359
  // src/api/componentspublic/models/BillingProductPriceInterval.ts
11342
11360
  function BillingProductPriceIntervalFromJSON2(json) {
11343
11361
  return BillingProductPriceIntervalFromJSONTyped5(json, false);
@@ -11346,6 +11364,14 @@ function BillingProductPriceIntervalFromJSONTyped5(json, ignoreDiscriminator) {
11346
11364
  return json;
11347
11365
  }
11348
11366
 
11367
+ // src/api/componentspublic/models/BillingProviderType.ts
11368
+ function BillingProviderTypeFromJSON2(json) {
11369
+ return BillingProviderTypeFromJSONTyped13(json, false);
11370
+ }
11371
+ function BillingProviderTypeFromJSONTyped13(json, ignoreDiscriminator) {
11372
+ return json;
11373
+ }
11374
+
11349
11375
  // src/api/componentspublic/models/BillingPriceScheme.ts
11350
11376
  function BillingPriceSchemeFromJSON2(json) {
11351
11377
  return BillingPriceSchemeFromJSONTyped6(json, false);
@@ -11356,9 +11382,9 @@ function BillingPriceSchemeFromJSONTyped6(json, ignoreDiscriminator) {
11356
11382
 
11357
11383
  // src/api/componentspublic/models/BillingPriceResponseData.ts
11358
11384
  function BillingPriceResponseDataFromJSON2(json) {
11359
- return BillingPriceResponseDataFromJSONTyped7(json, false);
11385
+ return BillingPriceResponseDataFromJSONTyped9(json, false);
11360
11386
  }
11361
- function BillingPriceResponseDataFromJSONTyped7(json, ignoreDiscriminator) {
11387
+ function BillingPriceResponseDataFromJSONTyped9(json, ignoreDiscriminator) {
11362
11388
  if (json == null) {
11363
11389
  return json;
11364
11390
  }
@@ -11374,6 +11400,45 @@ function BillingPriceResponseDataFromJSONTyped7(json, ignoreDiscriminator) {
11374
11400
  };
11375
11401
  }
11376
11402
 
11403
+ // src/api/componentspublic/models/CreditCurrencyPriceResponseData.ts
11404
+ function CreditCurrencyPriceResponseDataFromJSON2(json) {
11405
+ return CreditCurrencyPriceResponseDataFromJSONTyped3(json, false);
11406
+ }
11407
+ function CreditCurrencyPriceResponseDataFromJSONTyped3(json, ignoreDiscriminator) {
11408
+ if (json == null) {
11409
+ return json;
11410
+ }
11411
+ return {
11412
+ currency: json["currency"],
11413
+ price: json["price"] == null ? void 0 : BillingPriceResponseDataFromJSON2(json["price"])
11414
+ };
11415
+ }
11416
+
11417
+ // src/api/componentspublic/models/BillingProductResponseData.ts
11418
+ function BillingProductResponseDataFromJSON2(json) {
11419
+ return BillingProductResponseDataFromJSONTyped5(json, false);
11420
+ }
11421
+ function BillingProductResponseDataFromJSONTyped5(json, ignoreDiscriminator) {
11422
+ if (json == null) {
11423
+ return json;
11424
+ }
11425
+ return {
11426
+ accountId: json["account_id"],
11427
+ createdAt: new Date(json["created_at"]),
11428
+ currency: json["currency"] == null ? void 0 : json["currency"],
11429
+ environmentId: json["environment_id"],
11430
+ externalId: json["external_id"],
11431
+ isActive: json["is_active"],
11432
+ name: json["name"],
11433
+ price: json["price"],
11434
+ priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"],
11435
+ productId: json["product_id"],
11436
+ providerType: BillingProviderTypeFromJSON2(json["provider_type"]),
11437
+ quantity: json["quantity"],
11438
+ updatedAt: new Date(json["updated_at"])
11439
+ };
11440
+ }
11441
+
11377
11442
  // src/api/componentspublic/models/BillingCreditRolloverPolicy.ts
11378
11443
  function BillingCreditRolloverPolicyFromJSON2(json) {
11379
11444
  return BillingCreditRolloverPolicyFromJSONTyped4(json, false);
@@ -11394,6 +11459,9 @@ function BillingCreditResponseDataFromJSONTyped4(json, ignoreDiscriminator) {
11394
11459
  burnStrategy: BillingCreditBurnStrategyFromJSON2(json["burn_strategy"]),
11395
11460
  costEditable: json["cost_editable"],
11396
11461
  createdAt: new Date(json["created_at"]),
11462
+ currencyPrices: json["currency_prices"].map(
11463
+ CreditCurrencyPriceResponseDataFromJSON2
11464
+ ),
11397
11465
  defaultExpiryUnit: BillingCreditExpiryUnitFromJSON2(
11398
11466
  json["default_expiry_unit"]
11399
11467
  ),
@@ -11447,9 +11515,9 @@ function BillingTiersModeFromJSONTyped4(json, ignoreDiscriminator) {
11447
11515
 
11448
11516
  // src/api/componentspublic/models/BillingPriceView.ts
11449
11517
  function BillingPriceViewFromJSON2(json) {
11450
- return BillingPriceViewFromJSONTyped6(json, false);
11518
+ return BillingPriceViewFromJSONTyped8(json, false);
11451
11519
  }
11452
- function BillingPriceViewFromJSONTyped6(json, ignoreDiscriminator) {
11520
+ function BillingPriceViewFromJSONTyped8(json, ignoreDiscriminator) {
11453
11521
  if (json == null) {
11454
11522
  return json;
11455
11523
  }
@@ -11662,6 +11730,21 @@ function CustomPlanConfigFromJSONTyped3(json, ignoreDiscriminator) {
11662
11730
  };
11663
11731
  }
11664
11732
 
11733
+ // src/api/componentspublic/models/EntitlementCurrencyPricesResponseData.ts
11734
+ function EntitlementCurrencyPricesResponseDataFromJSON2(json) {
11735
+ return EntitlementCurrencyPricesResponseDataFromJSONTyped3(json, false);
11736
+ }
11737
+ function EntitlementCurrencyPricesResponseDataFromJSONTyped3(json, ignoreDiscriminator) {
11738
+ if (json == null) {
11739
+ return json;
11740
+ }
11741
+ return {
11742
+ currency: json["currency"],
11743
+ monthlyPrice: json["monthly_price"] == null ? void 0 : BillingPriceViewFromJSON2(json["monthly_price"]),
11744
+ yearlyPrice: json["yearly_price"] == null ? void 0 : BillingPriceViewFromJSON2(json["yearly_price"])
11745
+ };
11746
+ }
11747
+
11665
11748
  // src/api/componentspublic/models/EntitlementPriceBehavior.ts
11666
11749
  function EntitlementPriceBehaviorFromJSON2(json) {
11667
11750
  return EntitlementPriceBehaviorFromJSONTyped5(json, false);
@@ -11992,6 +12075,22 @@ function PlanCreditGrantViewFromJSONTyped4(json, ignoreDiscriminator) {
11992
12075
  };
11993
12076
  }
11994
12077
 
12078
+ // src/api/componentspublic/models/PlanCurrencyPricesResponseData.ts
12079
+ function PlanCurrencyPricesResponseDataFromJSON2(json) {
12080
+ return PlanCurrencyPricesResponseDataFromJSONTyped5(json, false);
12081
+ }
12082
+ function PlanCurrencyPricesResponseDataFromJSONTyped5(json, ignoreDiscriminator) {
12083
+ if (json == null) {
12084
+ return json;
12085
+ }
12086
+ return {
12087
+ currency: json["currency"],
12088
+ monthlyPrice: json["monthly_price"] == null ? void 0 : BillingPriceResponseDataFromJSON2(json["monthly_price"]),
12089
+ oneTimePrice: json["one_time_price"] == null ? void 0 : BillingPriceResponseDataFromJSON2(json["one_time_price"]),
12090
+ yearlyPrice: json["yearly_price"] == null ? void 0 : BillingPriceResponseDataFromJSON2(json["yearly_price"])
12091
+ };
12092
+ }
12093
+
11995
12094
  // src/api/componentspublic/models/PlanType.ts
11996
12095
  function PlanTypeFromJSON2(json) {
11997
12096
  return PlanTypeFromJSONTyped7(json, false);
@@ -12032,6 +12131,9 @@ function PlanEntitlementResponseDataFromJSONTyped5(json, ignoreDiscriminator) {
12032
12131
  billingThreshold: json["billing_threshold"] == null ? void 0 : json["billing_threshold"],
12033
12132
  consumptionRate: json["consumption_rate"] == null ? void 0 : json["consumption_rate"],
12034
12133
  createdAt: new Date(json["created_at"]),
12134
+ currencyPrices: json["currency_prices"].map(
12135
+ EntitlementCurrencyPricesResponseDataFromJSON2
12136
+ ),
12035
12137
  environmentId: json["environment_id"],
12036
12138
  feature: json["feature"] == null ? void 0 : FeatureResponseDataFromJSON2(json["feature"]),
12037
12139
  featureId: json["feature_id"],
@@ -12105,6 +12207,9 @@ function PlanViewPublicResponseDataFromJSONTyped(json, ignoreDiscriminator) {
12105
12207
  compatiblePlanIds: json["compatible_plan_ids"],
12106
12208
  controlledBy: PlanControlledByTypeFromJSON2(json["controlled_by"]),
12107
12209
  createdAt: new Date(json["created_at"]),
12210
+ currencyPrices: json["currency_prices"].map(
12211
+ PlanCurrencyPricesResponseDataFromJSON2
12212
+ ),
12108
12213
  custom: json["custom"],
12109
12214
  customPlanConfig: json["custom_plan_config"] == null ? void 0 : CustomPlanConfigFromJSON2(json["custom_plan_config"]),
12110
12215
  description: json["description"],
@@ -12416,7 +12521,7 @@ var reducer = (state, action) => {
12416
12521
  // src/context/EmbedProvider.tsx
12417
12522
  var import_jsx_runtime2 = require("react/jsx-runtime");
12418
12523
  var getCustomHeaders = (sessionId) => ({
12419
- "X-Schematic-Components-Version": "2.8.2",
12524
+ "X-Schematic-Components-Version": "2.8.4",
12420
12525
  "X-Schematic-Session-ID": sessionId
12421
12526
  });
12422
12527
  var EmbedProvider = ({
@@ -12804,6 +12909,7 @@ var EmbedProvider = ({
12804
12909
  value: {
12805
12910
  isPending: state.isPending,
12806
12911
  stale: state.stale,
12912
+ accessToken: state.accessToken,
12807
12913
  data: state.data,
12808
12914
  error: state.error,
12809
12915
  settings: state.settings,
@@ -15740,9 +15846,7 @@ var CheckoutDialog = ({ top }) => {
15740
15846
  (available) => available.id === addOnId
15741
15847
  );
15742
15848
  if (!availableAddOn) return [];
15743
- return availableAddOn.entitlements.filter(
15744
- (entitlement) => entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance
15745
- ).map((entitlement) => ({
15849
+ return availableAddOn.entitlements.filter((entitlement) => !!entitlement.priceBehavior).map((entitlement) => ({
15746
15850
  ...entitlement,
15747
15851
  allocation: entitlement.valueNumeric || 0,
15748
15852
  usage: 0,
@@ -15937,8 +16041,7 @@ var CheckoutDialog = ({ top }) => {
15937
16041
  const addOnRequestBody = buildAddOnRequestBody(
15938
16042
  resolvedAddOns,
15939
16043
  period,
15940
- shouldTrial,
15941
- resolvedAddOnPayInAdvanceEntitlements
16044
+ shouldTrial
15942
16045
  );
15943
16046
  const creditBundlesRequestBody = buildCreditBundlesRequestBody(
15944
16047
  resolvedCreditBundles
@@ -17699,18 +17802,18 @@ var SubscriptionSidebar = (0, import_react39.forwardRef)(
17699
17802
  usageBasedEntitlements,
17700
17803
  addOnUsageBasedEntitlements
17701
17804
  ]);
17702
- const selectedAddOnsWithCost = (0, import_react39.useMemo)(
17805
+ const selectedAddOnsWithPrice = (0, import_react39.useMemo)(
17703
17806
  () => addOns.filter(
17704
- (addOn) => addOn.isSelected && getPlanPrice(addOn)?.price
17807
+ (addOn) => addOn.isSelected && typeof getPlanPrice(addOn)?.price === "number"
17705
17808
  ),
17706
17809
  [addOns]
17707
17810
  );
17708
17811
  const { removedAddOns, willAddOnsChange } = (0, import_react39.useMemo)(() => {
17709
- const addedAddOns = selectedAddOnsWithCost.filter(
17710
- (selected) => getPlanPrice(selected)?.price && !currentAddOns.some((current) => selected.id === current.id)
17812
+ const addedAddOns = selectedAddOnsWithPrice.filter(
17813
+ (selected) => !currentAddOns.some((current) => selected.id === current.id)
17711
17814
  );
17712
17815
  const removedAddOns2 = currentAddOns.filter(
17713
- (current) => current.planPrice && current.planPeriod !== "one-time" && !selectedAddOnsWithCost.some(
17816
+ (current) => current.planPrice && current.planPeriod !== "one-time" && !selectedAddOnsWithPrice.some(
17714
17817
  (selected) => current.id === selected.id
17715
17818
  )
17716
17819
  );
@@ -17720,7 +17823,7 @@ var SubscriptionSidebar = (0, import_react39.forwardRef)(
17720
17823
  removedAddOns: removedAddOns2,
17721
17824
  willAddOnsChange: willAddOnsChange2
17722
17825
  };
17723
- }, [currentAddOns, selectedAddOnsWithCost]);
17826
+ }, [currentAddOns, selectedAddOnsWithPrice]);
17724
17827
  const addedCreditBundles = (0, import_react39.useMemo)(
17725
17828
  () => creditBundles.filter((bundle) => bundle.count > 0),
17726
17829
  [creditBundles]
@@ -17749,8 +17852,7 @@ var SubscriptionSidebar = (0, import_react39.forwardRef)(
17749
17852
  const addOnRequestBody = buildAddOnRequestBody(
17750
17853
  addOns,
17751
17854
  planPeriod,
17752
- shouldTrial,
17753
- addOnPayInAdvanceEntitlements
17855
+ shouldTrial
17754
17856
  );
17755
17857
  const creditBundlesRequestBody = buildCreditBundlesRequestBody(creditBundles);
17756
17858
  const checkoutResponseFromBackend = await checkout({
@@ -18164,7 +18266,7 @@ var SubscriptionSidebar = (0, import_react39.forwardRef)(
18164
18266
  }
18165
18267
  )
18166
18268
  ] }),
18167
- (willAddOnsChange || selectedAddOnsWithCost.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $marginBottom: "1.5rem", children: [
18269
+ (willAddOnsChange || selectedAddOnsWithPrice.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $marginBottom: "1.5rem", children: [
18168
18270
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Text, { $size: 14, children: t2("Add-ons") }) }),
18169
18271
  removedAddOns.map((addOn, index) => {
18170
18272
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
@@ -18193,7 +18295,7 @@ var SubscriptionSidebar = (0, import_react39.forwardRef)(
18193
18295
  index
18194
18296
  );
18195
18297
  }),
18196
- selectedAddOnsWithCost.map((addOn, index) => {
18298
+ selectedAddOnsWithPrice.map((addOn, index) => {
18197
18299
  const { price: addOnPrice, currency: addOnCurrency } = getAddOnPrice(addOn, planPeriod) || {};
18198
18300
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
18199
18301
  Flex,