@schematichq/schematic-react 1.15.0 → 1.16.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.
- package/dist/schematic-react.cjs.js +385 -15
- package/dist/schematic-react.d.ts +308 -9
- package/dist/schematic-react.esm.js +385 -15
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// node_modules/.pnpm/@schematichq+schematic-js@1.
|
|
1
|
+
// node_modules/.pnpm/@schematichq+schematic-js@1.16.1/node_modules/@schematichq/schematic-js/dist/schematic.esm.js
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1329,7 +1329,7 @@ var ContextSignatureManager = class {
|
|
|
1329
1329
|
}
|
|
1330
1330
|
}
|
|
1331
1331
|
};
|
|
1332
|
-
var version = "1.
|
|
1332
|
+
var version = "1.16.1";
|
|
1333
1333
|
var DEFAULT_CATALOG_QUERY = {};
|
|
1334
1334
|
function normalizeCatalogQuery(query) {
|
|
1335
1335
|
return query.catalogId === void 0 ? {} : { catalogId: query.catalogId };
|
|
@@ -1448,6 +1448,10 @@ __export(models_exports, {
|
|
|
1448
1448
|
CatalogPlanRefResponseDataFromJSONTyped: () => CatalogPlanRefResponseDataFromJSONTyped,
|
|
1449
1449
|
CatalogPlanRefResponseDataToJSON: () => CatalogPlanRefResponseDataToJSON,
|
|
1450
1450
|
CatalogPlanRefResponseDataToJSONTyped: () => CatalogPlanRefResponseDataToJSONTyped,
|
|
1451
|
+
CatalogPlanResponseDataFromJSON: () => CatalogPlanResponseDataFromJSON2,
|
|
1452
|
+
CatalogPlanResponseDataFromJSONTyped: () => CatalogPlanResponseDataFromJSONTyped2,
|
|
1453
|
+
CatalogPlanResponseDataToJSON: () => CatalogPlanResponseDataToJSON2,
|
|
1454
|
+
CatalogPlanResponseDataToJSONTyped: () => CatalogPlanResponseDataToJSONTyped2,
|
|
1451
1455
|
CatalogPriceResponseDataFromJSON: () => CatalogPriceResponseDataFromJSON2,
|
|
1452
1456
|
CatalogPriceResponseDataFromJSONTyped: () => CatalogPriceResponseDataFromJSONTyped7,
|
|
1453
1457
|
CatalogPriceResponseDataToJSON: () => CatalogPriceResponseDataToJSON2,
|
|
@@ -1754,6 +1758,14 @@ __export(models_exports, {
|
|
|
1754
1758
|
GetCompanyUpcomingInvoiceResponseFromJSONTyped: () => GetCompanyUpcomingInvoiceResponseFromJSONTyped,
|
|
1755
1759
|
GetCompanyUpcomingInvoiceResponseToJSON: () => GetCompanyUpcomingInvoiceResponseToJSON,
|
|
1756
1760
|
GetCompanyUpcomingInvoiceResponseToJSONTyped: () => GetCompanyUpcomingInvoiceResponseToJSONTyped,
|
|
1761
|
+
GetPublicCatalogByIDResponseFromJSON: () => GetPublicCatalogByIDResponseFromJSON,
|
|
1762
|
+
GetPublicCatalogByIDResponseFromJSONTyped: () => GetPublicCatalogByIDResponseFromJSONTyped,
|
|
1763
|
+
GetPublicCatalogByIDResponseToJSON: () => GetPublicCatalogByIDResponseToJSON,
|
|
1764
|
+
GetPublicCatalogByIDResponseToJSONTyped: () => GetPublicCatalogByIDResponseToJSONTyped,
|
|
1765
|
+
GetPublicCatalogResponseFromJSON: () => GetPublicCatalogResponseFromJSON,
|
|
1766
|
+
GetPublicCatalogResponseFromJSONTyped: () => GetPublicCatalogResponseFromJSONTyped,
|
|
1767
|
+
GetPublicCatalogResponseToJSON: () => GetPublicCatalogResponseToJSON,
|
|
1768
|
+
GetPublicCatalogResponseToJSONTyped: () => GetPublicCatalogResponseToJSONTyped,
|
|
1757
1769
|
InvoiceStatus: () => InvoiceStatus,
|
|
1758
1770
|
InvoiceStatusFromJSON: () => InvoiceStatusFromJSON,
|
|
1759
1771
|
InvoiceStatusFromJSONTyped: () => InvoiceStatusFromJSONTyped,
|
|
@@ -1801,6 +1813,10 @@ __export(models_exports, {
|
|
|
1801
1813
|
ProrationLineKindFromJSONTyped: () => ProrationLineKindFromJSONTyped,
|
|
1802
1814
|
ProrationLineKindToJSON: () => ProrationLineKindToJSON,
|
|
1803
1815
|
ProrationLineKindToJSONTyped: () => ProrationLineKindToJSONTyped,
|
|
1816
|
+
PublicCatalogResponseDataFromJSON: () => PublicCatalogResponseDataFromJSON2,
|
|
1817
|
+
PublicCatalogResponseDataFromJSONTyped: () => PublicCatalogResponseDataFromJSONTyped3,
|
|
1818
|
+
PublicCatalogResponseDataToJSON: () => PublicCatalogResponseDataToJSON2,
|
|
1819
|
+
PublicCatalogResponseDataToJSONTyped: () => PublicCatalogResponseDataToJSONTyped3,
|
|
1804
1820
|
ScheduledDowngradeConfigBehavior: () => ScheduledDowngradeConfigBehavior,
|
|
1805
1821
|
ScheduledDowngradeConfigBehaviorFromJSON: () => ScheduledDowngradeConfigBehaviorFromJSON,
|
|
1806
1822
|
ScheduledDowngradeConfigBehaviorFromJSONTyped: () => ScheduledDowngradeConfigBehaviorFromJSONTyped,
|
|
@@ -1888,6 +1904,7 @@ __export(models_exports, {
|
|
|
1888
1904
|
instanceOfCatalogCustomPlanCTAResponseData: () => instanceOfCatalogCustomPlanCTAResponseData,
|
|
1889
1905
|
instanceOfCatalogPlanEntitlementResponseData: () => instanceOfCatalogPlanEntitlementResponseData,
|
|
1890
1906
|
instanceOfCatalogPlanRefResponseData: () => instanceOfCatalogPlanRefResponseData,
|
|
1907
|
+
instanceOfCatalogPlanResponseData: () => instanceOfCatalogPlanResponseData,
|
|
1891
1908
|
instanceOfCatalogPriceResponseData: () => instanceOfCatalogPriceResponseData,
|
|
1892
1909
|
instanceOfCatalogPriceTierResponseData: () => instanceOfCatalogPriceTierResponseData,
|
|
1893
1910
|
instanceOfCatalogUsageViolationResponseData: () => instanceOfCatalogUsageViolationResponseData,
|
|
@@ -1961,6 +1978,8 @@ __export(models_exports, {
|
|
|
1961
1978
|
instanceOfGetCompanyPaymentMethodsResponse: () => instanceOfGetCompanyPaymentMethodsResponse,
|
|
1962
1979
|
instanceOfGetCompanyResponse: () => instanceOfGetCompanyResponse,
|
|
1963
1980
|
instanceOfGetCompanyUpcomingInvoiceResponse: () => instanceOfGetCompanyUpcomingInvoiceResponse,
|
|
1981
|
+
instanceOfGetPublicCatalogByIDResponse: () => instanceOfGetPublicCatalogByIDResponse,
|
|
1982
|
+
instanceOfGetPublicCatalogResponse: () => instanceOfGetPublicCatalogResponse,
|
|
1964
1983
|
instanceOfInvoiceStatus: () => instanceOfInvoiceStatus,
|
|
1965
1984
|
instanceOfListCheckoutsParams: () => instanceOfListCheckoutsParams,
|
|
1966
1985
|
instanceOfListCheckoutsResponse: () => instanceOfListCheckoutsResponse,
|
|
@@ -1971,6 +1990,7 @@ __export(models_exports, {
|
|
|
1971
1990
|
instanceOfPlanPriceCadence: () => instanceOfPlanPriceCadence,
|
|
1972
1991
|
instanceOfProrationBehavior: () => instanceOfProrationBehavior,
|
|
1973
1992
|
instanceOfProrationLineKind: () => instanceOfProrationLineKind,
|
|
1993
|
+
instanceOfPublicCatalogResponseData: () => instanceOfPublicCatalogResponseData,
|
|
1974
1994
|
instanceOfScheduledDowngradeConfigBehavior: () => instanceOfScheduledDowngradeConfigBehavior,
|
|
1975
1995
|
instanceOfSetupIntentResponseData: () => instanceOfSetupIntentResponseData,
|
|
1976
1996
|
instanceOfTaxIDInput: () => instanceOfTaxIDInput,
|
|
@@ -3281,6 +3301,7 @@ function instanceOfCatalogCreditGrantResponseData(value) {
|
|
|
3281
3301
|
return false;
|
|
3282
3302
|
if (!("id" in value) || value["id"] === void 0) return false;
|
|
3283
3303
|
if (!("scaling" in value) || value["scaling"] === void 0) return false;
|
|
3304
|
+
if (!("visible" in value) || value["visible"] === void 0) return false;
|
|
3284
3305
|
return true;
|
|
3285
3306
|
}
|
|
3286
3307
|
function CatalogCreditGrantResponseDataFromJSON2(json) {
|
|
@@ -3301,7 +3322,8 @@ function CatalogCreditGrantResponseDataFromJSONTyped2(json, ignoreDiscriminator)
|
|
|
3301
3322
|
id: json["id"],
|
|
3302
3323
|
licenseId: json["license_id"] == null ? void 0 : json["license_id"],
|
|
3303
3324
|
resetCadence: json["reset_cadence"] == null ? void 0 : BillingPlanCreditGrantResetCadenceFromJSON2(json["reset_cadence"]),
|
|
3304
|
-
scaling: PlanCreditGrantScalingFromJSON2(json["scaling"])
|
|
3325
|
+
scaling: PlanCreditGrantScalingFromJSON2(json["scaling"]),
|
|
3326
|
+
visible: json["visible"]
|
|
3305
3327
|
};
|
|
3306
3328
|
}
|
|
3307
3329
|
function CatalogCreditGrantResponseDataToJSON2(json) {
|
|
@@ -3324,7 +3346,8 @@ function CatalogCreditGrantResponseDataToJSONTyped2(value, ignoreDiscriminator =
|
|
|
3324
3346
|
reset_cadence: BillingPlanCreditGrantResetCadenceToJSON2(
|
|
3325
3347
|
value["resetCadence"]
|
|
3326
3348
|
),
|
|
3327
|
-
scaling: PlanCreditGrantScalingToJSON2(value["scaling"])
|
|
3349
|
+
scaling: PlanCreditGrantScalingToJSON2(value["scaling"]),
|
|
3350
|
+
visible: value["visible"]
|
|
3328
3351
|
};
|
|
3329
3352
|
}
|
|
3330
3353
|
var PlanPriceCadence = {
|
|
@@ -3604,6 +3627,98 @@ function CatalogPlanRefResponseDataToJSONTyped(value, ignoreDiscriminator = fals
|
|
|
3604
3627
|
name: value["name"]
|
|
3605
3628
|
};
|
|
3606
3629
|
}
|
|
3630
|
+
function instanceOfCatalogPlanResponseData(value) {
|
|
3631
|
+
if (!("availablePeriods" in value) || value["availablePeriods"] === void 0)
|
|
3632
|
+
return false;
|
|
3633
|
+
if (!("billingStrategy" in value) || value["billingStrategy"] === void 0)
|
|
3634
|
+
return false;
|
|
3635
|
+
if (!("chargeType" in value) || value["chargeType"] === void 0)
|
|
3636
|
+
return false;
|
|
3637
|
+
if (!("currencyPrices" in value) || value["currencyPrices"] === void 0)
|
|
3638
|
+
return false;
|
|
3639
|
+
if (!("description" in value) || value["description"] === void 0)
|
|
3640
|
+
return false;
|
|
3641
|
+
if (!("entitlements" in value) || value["entitlements"] === void 0)
|
|
3642
|
+
return false;
|
|
3643
|
+
if (!("icon" in value) || value["icon"] === void 0) return false;
|
|
3644
|
+
if (!("id" in value) || value["id"] === void 0) return false;
|
|
3645
|
+
if (!("includedCreditGrants" in value) || value["includedCreditGrants"] === void 0)
|
|
3646
|
+
return false;
|
|
3647
|
+
if (!("isTrialable" in value) || value["isTrialable"] === void 0)
|
|
3648
|
+
return false;
|
|
3649
|
+
if (!("name" in value) || value["name"] === void 0) return false;
|
|
3650
|
+
return true;
|
|
3651
|
+
}
|
|
3652
|
+
function CatalogPlanResponseDataFromJSON2(json) {
|
|
3653
|
+
return CatalogPlanResponseDataFromJSONTyped2(json, false);
|
|
3654
|
+
}
|
|
3655
|
+
function CatalogPlanResponseDataFromJSONTyped2(json, ignoreDiscriminator) {
|
|
3656
|
+
if (json == null) {
|
|
3657
|
+
return json;
|
|
3658
|
+
}
|
|
3659
|
+
return {
|
|
3660
|
+
availablePeriods: json["available_periods"].map(
|
|
3661
|
+
PlanPriceCadenceFromJSON2
|
|
3662
|
+
),
|
|
3663
|
+
billingStrategy: BillingStrategyFromJSON2(json["billing_strategy"]),
|
|
3664
|
+
chargeType: ChargeTypeFromJSON2(json["charge_type"]),
|
|
3665
|
+
compatiblePlanIds: json["compatible_plan_ids"] == null ? void 0 : json["compatible_plan_ids"],
|
|
3666
|
+
currencyPrices: json["currency_prices"].map(
|
|
3667
|
+
CatalogCurrencyPricesResponseDataFromJSON2
|
|
3668
|
+
),
|
|
3669
|
+
description: json["description"],
|
|
3670
|
+
entitlements: json["entitlements"].map(
|
|
3671
|
+
CatalogPlanEntitlementResponseDataFromJSON2
|
|
3672
|
+
),
|
|
3673
|
+
icon: json["icon"],
|
|
3674
|
+
id: json["id"],
|
|
3675
|
+
includedCreditGrants: json["included_credit_grants"].map(
|
|
3676
|
+
CatalogCreditGrantResponseDataFromJSON2
|
|
3677
|
+
),
|
|
3678
|
+
isTrialable: json["is_trialable"],
|
|
3679
|
+
monthlyPrice: json["monthly_price"] == null ? void 0 : CatalogPriceResponseDataFromJSON2(json["monthly_price"]),
|
|
3680
|
+
name: json["name"],
|
|
3681
|
+
oneTimePrice: json["one_time_price"] == null ? void 0 : CatalogPriceResponseDataFromJSON2(json["one_time_price"]),
|
|
3682
|
+
quarterlyPrice: json["quarterly_price"] == null ? void 0 : CatalogPriceResponseDataFromJSON2(json["quarterly_price"]),
|
|
3683
|
+
trialDays: json["trial_days"] == null ? void 0 : json["trial_days"],
|
|
3684
|
+
yearlyPrice: json["yearly_price"] == null ? void 0 : CatalogPriceResponseDataFromJSON2(json["yearly_price"])
|
|
3685
|
+
};
|
|
3686
|
+
}
|
|
3687
|
+
function CatalogPlanResponseDataToJSON2(json) {
|
|
3688
|
+
return CatalogPlanResponseDataToJSONTyped2(json, false);
|
|
3689
|
+
}
|
|
3690
|
+
function CatalogPlanResponseDataToJSONTyped2(value, ignoreDiscriminator = false) {
|
|
3691
|
+
if (value == null) {
|
|
3692
|
+
return value;
|
|
3693
|
+
}
|
|
3694
|
+
return {
|
|
3695
|
+
available_periods: value["availablePeriods"].map(
|
|
3696
|
+
PlanPriceCadenceToJSON2
|
|
3697
|
+
),
|
|
3698
|
+
billing_strategy: BillingStrategyToJSON2(value["billingStrategy"]),
|
|
3699
|
+
charge_type: ChargeTypeToJSON2(value["chargeType"]),
|
|
3700
|
+
compatible_plan_ids: value["compatiblePlanIds"],
|
|
3701
|
+
currency_prices: value["currencyPrices"].map(
|
|
3702
|
+
CatalogCurrencyPricesResponseDataToJSON2
|
|
3703
|
+
),
|
|
3704
|
+
description: value["description"],
|
|
3705
|
+
entitlements: value["entitlements"].map(
|
|
3706
|
+
CatalogPlanEntitlementResponseDataToJSON2
|
|
3707
|
+
),
|
|
3708
|
+
icon: value["icon"],
|
|
3709
|
+
id: value["id"],
|
|
3710
|
+
included_credit_grants: value["includedCreditGrants"].map(
|
|
3711
|
+
CatalogCreditGrantResponseDataToJSON2
|
|
3712
|
+
),
|
|
3713
|
+
is_trialable: value["isTrialable"],
|
|
3714
|
+
monthly_price: CatalogPriceResponseDataToJSON2(value["monthlyPrice"]),
|
|
3715
|
+
name: value["name"],
|
|
3716
|
+
one_time_price: CatalogPriceResponseDataToJSON2(value["oneTimePrice"]),
|
|
3717
|
+
quarterly_price: CatalogPriceResponseDataToJSON2(value["quarterlyPrice"]),
|
|
3718
|
+
trial_days: value["trialDays"],
|
|
3719
|
+
yearly_price: CatalogPriceResponseDataToJSON2(value["yearlyPrice"])
|
|
3720
|
+
};
|
|
3721
|
+
}
|
|
3607
3722
|
var CheckoutChargeTiming = {
|
|
3608
3723
|
AtRenewal: "at_renewal",
|
|
3609
3724
|
None: "none",
|
|
@@ -6518,6 +6633,127 @@ function GetCompanyUpcomingInvoiceResponseToJSONTyped(value, ignoreDiscriminator
|
|
|
6518
6633
|
params: value["params"]
|
|
6519
6634
|
};
|
|
6520
6635
|
}
|
|
6636
|
+
function instanceOfPublicCatalogResponseData(value) {
|
|
6637
|
+
if (!("addOns" in value) || value["addOns"] === void 0) return false;
|
|
6638
|
+
if (!("capabilities" in value) || value["capabilities"] === void 0)
|
|
6639
|
+
return false;
|
|
6640
|
+
if (!("creditBundles" in value) || value["creditBundles"] === void 0)
|
|
6641
|
+
return false;
|
|
6642
|
+
if (!("defaultCurrency" in value) || value["defaultCurrency"] === void 0)
|
|
6643
|
+
return false;
|
|
6644
|
+
if (!("id" in value) || value["id"] === void 0) return false;
|
|
6645
|
+
if (!("name" in value) || value["name"] === void 0) return false;
|
|
6646
|
+
if (!("plans" in value) || value["plans"] === void 0) return false;
|
|
6647
|
+
return true;
|
|
6648
|
+
}
|
|
6649
|
+
function PublicCatalogResponseDataFromJSON2(json) {
|
|
6650
|
+
return PublicCatalogResponseDataFromJSONTyped3(json, false);
|
|
6651
|
+
}
|
|
6652
|
+
function PublicCatalogResponseDataFromJSONTyped3(json, ignoreDiscriminator) {
|
|
6653
|
+
if (json == null) {
|
|
6654
|
+
return json;
|
|
6655
|
+
}
|
|
6656
|
+
return {
|
|
6657
|
+
addOns: json["add_ons"].map(
|
|
6658
|
+
CatalogPlanResponseDataFromJSON2
|
|
6659
|
+
),
|
|
6660
|
+
capabilities: CatalogCapabilitiesResponseDataFromJSON2(json["capabilities"]),
|
|
6661
|
+
creditBundles: json["credit_bundles"].map(
|
|
6662
|
+
CatalogCreditBundleResponseDataFromJSON2
|
|
6663
|
+
),
|
|
6664
|
+
customPlanCta: json["custom_plan_cta"] == null ? void 0 : CatalogCustomPlanCTAResponseDataFromJSON2(json["custom_plan_cta"]),
|
|
6665
|
+
defaultCurrency: CurrencyFromJSON2(json["default_currency"]),
|
|
6666
|
+
description: json["description"] == null ? void 0 : json["description"],
|
|
6667
|
+
id: json["id"],
|
|
6668
|
+
name: json["name"],
|
|
6669
|
+
plans: json["plans"].map(CatalogPlanResponseDataFromJSON2),
|
|
6670
|
+
pricingModel: json["pricing_model"] == null ? void 0 : json["pricing_model"],
|
|
6671
|
+
pricingUrl: json["pricing_url"] == null ? void 0 : json["pricing_url"]
|
|
6672
|
+
};
|
|
6673
|
+
}
|
|
6674
|
+
function PublicCatalogResponseDataToJSON2(json) {
|
|
6675
|
+
return PublicCatalogResponseDataToJSONTyped3(json, false);
|
|
6676
|
+
}
|
|
6677
|
+
function PublicCatalogResponseDataToJSONTyped3(value, ignoreDiscriminator = false) {
|
|
6678
|
+
if (value == null) {
|
|
6679
|
+
return value;
|
|
6680
|
+
}
|
|
6681
|
+
return {
|
|
6682
|
+
add_ons: value["addOns"].map(CatalogPlanResponseDataToJSON2),
|
|
6683
|
+
capabilities: CatalogCapabilitiesResponseDataToJSON2(value["capabilities"]),
|
|
6684
|
+
credit_bundles: value["creditBundles"].map(
|
|
6685
|
+
CatalogCreditBundleResponseDataToJSON2
|
|
6686
|
+
),
|
|
6687
|
+
custom_plan_cta: CatalogCustomPlanCTAResponseDataToJSON2(
|
|
6688
|
+
value["customPlanCta"]
|
|
6689
|
+
),
|
|
6690
|
+
default_currency: CurrencyToJSON2(value["defaultCurrency"]),
|
|
6691
|
+
description: value["description"],
|
|
6692
|
+
id: value["id"],
|
|
6693
|
+
name: value["name"],
|
|
6694
|
+
plans: value["plans"].map(CatalogPlanResponseDataToJSON2),
|
|
6695
|
+
pricing_model: value["pricingModel"],
|
|
6696
|
+
pricing_url: value["pricingUrl"]
|
|
6697
|
+
};
|
|
6698
|
+
}
|
|
6699
|
+
function instanceOfGetPublicCatalogByIDResponse(value) {
|
|
6700
|
+
if (!("data" in value) || value["data"] === void 0) return false;
|
|
6701
|
+
if (!("params" in value) || value["params"] === void 0) return false;
|
|
6702
|
+
return true;
|
|
6703
|
+
}
|
|
6704
|
+
function GetPublicCatalogByIDResponseFromJSON(json) {
|
|
6705
|
+
return GetPublicCatalogByIDResponseFromJSONTyped(json, false);
|
|
6706
|
+
}
|
|
6707
|
+
function GetPublicCatalogByIDResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
6708
|
+
if (json == null) {
|
|
6709
|
+
return json;
|
|
6710
|
+
}
|
|
6711
|
+
return {
|
|
6712
|
+
data: PublicCatalogResponseDataFromJSON2(json["data"]),
|
|
6713
|
+
params: json["params"]
|
|
6714
|
+
};
|
|
6715
|
+
}
|
|
6716
|
+
function GetPublicCatalogByIDResponseToJSON(json) {
|
|
6717
|
+
return GetPublicCatalogByIDResponseToJSONTyped(json, false);
|
|
6718
|
+
}
|
|
6719
|
+
function GetPublicCatalogByIDResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
6720
|
+
if (value == null) {
|
|
6721
|
+
return value;
|
|
6722
|
+
}
|
|
6723
|
+
return {
|
|
6724
|
+
data: PublicCatalogResponseDataToJSON2(value["data"]),
|
|
6725
|
+
params: value["params"]
|
|
6726
|
+
};
|
|
6727
|
+
}
|
|
6728
|
+
function instanceOfGetPublicCatalogResponse(value) {
|
|
6729
|
+
if (!("data" in value) || value["data"] === void 0) return false;
|
|
6730
|
+
if (!("params" in value) || value["params"] === void 0) return false;
|
|
6731
|
+
return true;
|
|
6732
|
+
}
|
|
6733
|
+
function GetPublicCatalogResponseFromJSON(json) {
|
|
6734
|
+
return GetPublicCatalogResponseFromJSONTyped(json, false);
|
|
6735
|
+
}
|
|
6736
|
+
function GetPublicCatalogResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
6737
|
+
if (json == null) {
|
|
6738
|
+
return json;
|
|
6739
|
+
}
|
|
6740
|
+
return {
|
|
6741
|
+
data: PublicCatalogResponseDataFromJSON2(json["data"]),
|
|
6742
|
+
params: json["params"]
|
|
6743
|
+
};
|
|
6744
|
+
}
|
|
6745
|
+
function GetPublicCatalogResponseToJSON(json) {
|
|
6746
|
+
return GetPublicCatalogResponseToJSONTyped(json, false);
|
|
6747
|
+
}
|
|
6748
|
+
function GetPublicCatalogResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
6749
|
+
if (value == null) {
|
|
6750
|
+
return value;
|
|
6751
|
+
}
|
|
6752
|
+
return {
|
|
6753
|
+
data: PublicCatalogResponseDataToJSON2(value["data"]),
|
|
6754
|
+
params: value["params"]
|
|
6755
|
+
};
|
|
6756
|
+
}
|
|
6521
6757
|
function instanceOfListCheckoutsParams(value) {
|
|
6522
6758
|
return true;
|
|
6523
6759
|
}
|
|
@@ -6993,6 +7229,7 @@ var SchematicSession = class {
|
|
|
6993
7229
|
_apiUrl;
|
|
6994
7230
|
_headers;
|
|
6995
7231
|
_fetch;
|
|
7232
|
+
_publishableKey;
|
|
6996
7233
|
_session;
|
|
6997
7234
|
_tokens = /* @__PURE__ */ new Map();
|
|
6998
7235
|
_resolving = /* @__PURE__ */ new Map();
|
|
@@ -7005,6 +7242,7 @@ var SchematicSession = class {
|
|
|
7005
7242
|
_listeners = /* @__PURE__ */ new Set();
|
|
7006
7243
|
constructor(options = {}) {
|
|
7007
7244
|
this._session = options.session;
|
|
7245
|
+
this._publishableKey = options.publishableKey;
|
|
7008
7246
|
this._apiUrl = (options.apiUrl ?? DEFAULT_API_URL).replace(/\/$/, "");
|
|
7009
7247
|
this._headers = options.additionalHeaders ?? {};
|
|
7010
7248
|
this._fetch = options.fetch ?? ((input, init) => globalThis.fetch(input, init));
|
|
@@ -7012,6 +7250,9 @@ var SchematicSession = class {
|
|
|
7012
7250
|
get key() {
|
|
7013
7251
|
return this._session === null || this._session === void 0 ? void 0 : sessionKey(this._session);
|
|
7014
7252
|
}
|
|
7253
|
+
get hasPublishableKey() {
|
|
7254
|
+
return this._publishableKey !== void 0;
|
|
7255
|
+
}
|
|
7015
7256
|
get status() {
|
|
7016
7257
|
if (this._session === void 0) {
|
|
7017
7258
|
return "pending";
|
|
@@ -7130,6 +7371,30 @@ var SchematicSession = class {
|
|
|
7130
7371
|
async request(path, options = {}) {
|
|
7131
7372
|
return (await this.requestWithResponse(path, options)).body;
|
|
7132
7373
|
}
|
|
7374
|
+
/**
|
|
7375
|
+
* A read under the publishable key, whatever the session. Nothing is
|
|
7376
|
+
* refreshed or retried, since the key does not expire, and a session
|
|
7377
|
+
* changing mid-flight does not void the answer: it is the same for
|
|
7378
|
+
* everyone.
|
|
7379
|
+
*/
|
|
7380
|
+
async requestPublic(path) {
|
|
7381
|
+
if (this._publishableKey === void 0) {
|
|
7382
|
+
throw new Error("A publishable key is required to read public data.");
|
|
7383
|
+
}
|
|
7384
|
+
const response = await this._fetch(`${this._apiUrl}${path}`, {
|
|
7385
|
+
method: "GET",
|
|
7386
|
+
headers: {
|
|
7387
|
+
"Accept": "application/json",
|
|
7388
|
+
...this._headers,
|
|
7389
|
+
"X-Schematic-Api-Key": this._publishableKey
|
|
7390
|
+
}
|
|
7391
|
+
});
|
|
7392
|
+
const parsed = await readBody(response);
|
|
7393
|
+
if (!response.ok) {
|
|
7394
|
+
throw new SchematicApiError(response.status, path, parsed);
|
|
7395
|
+
}
|
|
7396
|
+
return parsed;
|
|
7397
|
+
}
|
|
7133
7398
|
/**
|
|
7134
7399
|
* `request`, with the headers the answer came back with — for a resource
|
|
7135
7400
|
* whose protocol rides beside the body, as a checkout's session does.
|
|
@@ -7310,6 +7575,8 @@ var CheckoutDraft = class {
|
|
|
7310
7575
|
/** Bumped by reset, so an answer for a discarded draft lands nowhere. */
|
|
7311
7576
|
generation = 0;
|
|
7312
7577
|
inFlight;
|
|
7578
|
+
/** The read of a resumed checkout, while one is out. */
|
|
7579
|
+
loading;
|
|
7313
7580
|
queued;
|
|
7314
7581
|
constructor(transport, options = {}) {
|
|
7315
7582
|
this.transport = transport;
|
|
@@ -7335,10 +7602,19 @@ var CheckoutDraft = class {
|
|
|
7335
7602
|
}
|
|
7336
7603
|
/**
|
|
7337
7604
|
* Reads the checkout this draft was opened on, for a resume. A draft with
|
|
7338
|
-
* no checkout yet has nothing to read.
|
|
7605
|
+
* no checkout yet has nothing to read. A call while a read is out shares
|
|
7606
|
+
* its answer.
|
|
7339
7607
|
*/
|
|
7340
7608
|
load() {
|
|
7341
|
-
|
|
7609
|
+
if (this.loading === void 0) {
|
|
7610
|
+
const generation = this.generation;
|
|
7611
|
+
this.loading = this.refresh(generation).finally(() => {
|
|
7612
|
+
if (generation === this.generation) {
|
|
7613
|
+
this.loading = void 0;
|
|
7614
|
+
}
|
|
7615
|
+
});
|
|
7616
|
+
}
|
|
7617
|
+
return this.loading;
|
|
7342
7618
|
}
|
|
7343
7619
|
/**
|
|
7344
7620
|
* Replaces the cart and re-prices it. Resolves with the checkout the write
|
|
@@ -7371,11 +7647,12 @@ var CheckoutDraft = class {
|
|
|
7371
7647
|
if (generation !== this.generation) {
|
|
7372
7648
|
throw new Error("The checkout was reset before it was finalized.");
|
|
7373
7649
|
}
|
|
7374
|
-
if (this.checkoutId === void 0
|
|
7650
|
+
if (this.checkoutId === void 0) {
|
|
7375
7651
|
throw new Error("There is no checkout to finalize yet.");
|
|
7376
7652
|
}
|
|
7377
7653
|
this.update({ isFinalizing: true, error: void 0 });
|
|
7378
7654
|
try {
|
|
7655
|
+
await this.readResumed(generation);
|
|
7379
7656
|
const result = await this.finalizeOnce(generation, true);
|
|
7380
7657
|
if (generation === this.generation) {
|
|
7381
7658
|
this.update({ isFinalizing: false, result });
|
|
@@ -7403,6 +7680,7 @@ var CheckoutDraft = class {
|
|
|
7403
7680
|
const queued = this.queued;
|
|
7404
7681
|
this.queued = void 0;
|
|
7405
7682
|
this.inFlight = void 0;
|
|
7683
|
+
this.loading = void 0;
|
|
7406
7684
|
queued?.waiters.forEach((w) => w.resolve(void 0));
|
|
7407
7685
|
this.update({ ...INITIAL_STATE });
|
|
7408
7686
|
}
|
|
@@ -7452,6 +7730,7 @@ var CheckoutDraft = class {
|
|
|
7452
7730
|
});
|
|
7453
7731
|
}
|
|
7454
7732
|
async write(generation, selections) {
|
|
7733
|
+
await this.readResumed(generation);
|
|
7455
7734
|
let written;
|
|
7456
7735
|
if (this.checkoutId === void 0 || this.version === void 0) {
|
|
7457
7736
|
written = await this.transport.createCheckout(selections);
|
|
@@ -7513,6 +7792,20 @@ var CheckoutDraft = class {
|
|
|
7513
7792
|
return this.finalizeOnce(generation, false);
|
|
7514
7793
|
}
|
|
7515
7794
|
}
|
|
7795
|
+
/**
|
|
7796
|
+
* A resumed checkout is read before it is written or finalized: a write
|
|
7797
|
+
* ahead of the read would open a second checkout beside it, and the read's
|
|
7798
|
+
* answer would then point the draft back at the first.
|
|
7799
|
+
*/
|
|
7800
|
+
async readResumed(generation) {
|
|
7801
|
+
if (this.checkoutId === void 0 || this.version !== void 0) {
|
|
7802
|
+
return;
|
|
7803
|
+
}
|
|
7804
|
+
await this.load();
|
|
7805
|
+
if (generation !== this.generation) {
|
|
7806
|
+
throw new Error("The checkout was reset before it was read.");
|
|
7807
|
+
}
|
|
7808
|
+
}
|
|
7516
7809
|
async refresh(generation) {
|
|
7517
7810
|
if (this.checkoutId === void 0) {
|
|
7518
7811
|
return void 0;
|
|
@@ -7563,6 +7856,9 @@ var SchematicBillingClient = class {
|
|
|
7563
7856
|
get sessionStatus() {
|
|
7564
7857
|
return this.session.status;
|
|
7565
7858
|
}
|
|
7859
|
+
get hasPublishableKey() {
|
|
7860
|
+
return this.session.hasPublishableKey;
|
|
7861
|
+
}
|
|
7566
7862
|
setSession(session) {
|
|
7567
7863
|
this.session.set(session);
|
|
7568
7864
|
}
|
|
@@ -7573,6 +7869,10 @@ var SchematicBillingClient = class {
|
|
|
7573
7869
|
const path = query.catalogId === void 0 ? "/catalog/view" : `/catalogs/${encodeURIComponent(query.catalogId)}/view`;
|
|
7574
7870
|
return this.session.request(path).then((body) => CompanyCatalogResponseDataFromJSON(dataOf(body, path)));
|
|
7575
7871
|
}
|
|
7872
|
+
fetchPublicCatalog(query = {}) {
|
|
7873
|
+
const path = query.catalogId === void 0 ? "/public/catalog" : `/public/catalogs/${encodeURIComponent(query.catalogId)}`;
|
|
7874
|
+
return this.session.requestPublic(path).then((body) => PublicCatalogResponseDataFromJSON2(dataOf(body, path)));
|
|
7875
|
+
}
|
|
7576
7876
|
createCheckout(selections) {
|
|
7577
7877
|
return this.checkoutWrite("/checkouts", {
|
|
7578
7878
|
method: "POST",
|
|
@@ -7974,6 +8274,10 @@ var Schematic = class {
|
|
|
7974
8274
|
get additionalHeaders() {
|
|
7975
8275
|
return { ...this._additionalHeaders };
|
|
7976
8276
|
}
|
|
8277
|
+
/** The key flags are read with, for a billing client reading beside it. */
|
|
8278
|
+
get publishableKey() {
|
|
8279
|
+
return this.apiKey;
|
|
8280
|
+
}
|
|
7977
8281
|
/**
|
|
7978
8282
|
* Resolve fallback value according to priority order:
|
|
7979
8283
|
* 1. Callsite fallback value (if provided)
|
|
@@ -10012,6 +10316,27 @@ var BillingStore = class {
|
|
|
10012
10316
|
(query) => this._client.fetchCatalog(query),
|
|
10013
10317
|
{ readiness }
|
|
10014
10318
|
);
|
|
10319
|
+
this.publicCatalog = new KeyedResource(
|
|
10320
|
+
(query) => this._client.fetchPublicCatalog?.(query) ?? Promise.reject(
|
|
10321
|
+
new Error("The billing client cannot read public data.")
|
|
10322
|
+
),
|
|
10323
|
+
{
|
|
10324
|
+
readiness: () => {
|
|
10325
|
+
if (!this._connected) {
|
|
10326
|
+
return "waiting";
|
|
10327
|
+
}
|
|
10328
|
+
return this._client.hasPublishableKey === true && this._client.fetchPublicCatalog !== void 0 ? "ready" : "never";
|
|
10329
|
+
}
|
|
10330
|
+
}
|
|
10331
|
+
);
|
|
10332
|
+
if (initialData.publicCatalog !== void 0) {
|
|
10333
|
+
this.publicCatalog.seed(
|
|
10334
|
+
normalizeCatalogQuery2(
|
|
10335
|
+
initialData.params?.publicCatalog ?? DEFAULT_CATALOG_QUERY
|
|
10336
|
+
),
|
|
10337
|
+
initialData.publicCatalog
|
|
10338
|
+
);
|
|
10339
|
+
}
|
|
10015
10340
|
this.invoices = new KeyedResource(
|
|
10016
10341
|
(query, current) => this._reloadWindow(
|
|
10017
10342
|
query,
|
|
@@ -10099,6 +10424,7 @@ var BillingStore = class {
|
|
|
10099
10424
|
}
|
|
10100
10425
|
_client;
|
|
10101
10426
|
catalog;
|
|
10427
|
+
publicCatalog;
|
|
10102
10428
|
invoices;
|
|
10103
10429
|
upcomingInvoice;
|
|
10104
10430
|
paymentMethods;
|
|
@@ -10146,6 +10472,7 @@ var BillingStore = class {
|
|
|
10146
10472
|
this._connected = true;
|
|
10147
10473
|
this._settleSeed(claimOf(this._client));
|
|
10148
10474
|
this.resumeAll();
|
|
10475
|
+
this.publicCatalog.resumeAll();
|
|
10149
10476
|
}
|
|
10150
10477
|
return () => {
|
|
10151
10478
|
unsubscribe?.();
|
|
@@ -10205,6 +10532,15 @@ var BillingStore = class {
|
|
|
10205
10532
|
this._seeded = true;
|
|
10206
10533
|
}
|
|
10207
10534
|
}
|
|
10535
|
+
/**
|
|
10536
|
+
* The company's view once someone is signed in; the public catalog until
|
|
10537
|
+
* then, where the client has a key to read it with. A session still
|
|
10538
|
+
* pending reads the public one too: a page that never states a session
|
|
10539
|
+
* would otherwise wait on one for good.
|
|
10540
|
+
*/
|
|
10541
|
+
catalogSource() {
|
|
10542
|
+
return this._client.sessionStatus !== "active" && this._client.hasPublishableKey === true ? "public" : "company";
|
|
10543
|
+
}
|
|
10208
10544
|
resource(name) {
|
|
10209
10545
|
return this[name];
|
|
10210
10546
|
}
|
|
@@ -10445,6 +10781,9 @@ function useSchematicStrings() {
|
|
|
10445
10781
|
|
|
10446
10782
|
// src/billing/context.tsx
|
|
10447
10783
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
10784
|
+
function catalogSourceOf(data) {
|
|
10785
|
+
return data.catalog === void 0 && data.publicCatalog !== void 0 ? "public" : "company";
|
|
10786
|
+
}
|
|
10448
10787
|
var BillingDataContext = createContext2(
|
|
10449
10788
|
void 0
|
|
10450
10789
|
);
|
|
@@ -10584,7 +10923,8 @@ function BillingDataProvider({
|
|
|
10584
10923
|
return Promise.resolve();
|
|
10585
10924
|
},
|
|
10586
10925
|
invalidateAll: () => {
|
|
10587
|
-
}
|
|
10926
|
+
},
|
|
10927
|
+
catalogSource: () => catalogSourceOf(data)
|
|
10588
10928
|
};
|
|
10589
10929
|
}, [
|
|
10590
10930
|
actions,
|
|
@@ -10637,10 +10977,30 @@ function useBillingResource(name, params) {
|
|
|
10637
10977
|
return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
10638
10978
|
}
|
|
10639
10979
|
function useCatalog(query = DEFAULT_CATALOG_QUERY) {
|
|
10640
|
-
|
|
10641
|
-
|
|
10642
|
-
|
|
10980
|
+
const source = useBillingDataSource();
|
|
10981
|
+
const params = useStableParams(normalizeCatalogQuery2(query));
|
|
10982
|
+
const subscribeSource = useCallback(
|
|
10983
|
+
(listener) => source.onSessionChange?.(() => listener()) ?? (() => {
|
|
10984
|
+
}),
|
|
10985
|
+
[source]
|
|
10986
|
+
);
|
|
10987
|
+
const readSource = useCallback(
|
|
10988
|
+
() => source.catalogSource?.() ?? "company",
|
|
10989
|
+
[source]
|
|
10643
10990
|
);
|
|
10991
|
+
const which = useSyncExternalStore(subscribeSource, readSource, readSource);
|
|
10992
|
+
const handle = useBillingResource(
|
|
10993
|
+
which === "public" ? "publicCatalog" : "catalog",
|
|
10994
|
+
params
|
|
10995
|
+
);
|
|
10996
|
+
return useMemo3(() => {
|
|
10997
|
+
const { data } = handle;
|
|
10998
|
+
let view;
|
|
10999
|
+
if (data !== void 0) {
|
|
11000
|
+
view = which === "public" ? { source: "public", catalog: data } : { source: "company", catalog: data };
|
|
11001
|
+
}
|
|
11002
|
+
return { ...handle, data: view };
|
|
11003
|
+
}, [handle, which]);
|
|
10644
11004
|
}
|
|
10645
11005
|
function useInvoices(query = DEFAULT_INVOICE_QUERY) {
|
|
10646
11006
|
const source = useBillingDataSource();
|
|
@@ -10924,7 +11284,8 @@ function BillingProvider({
|
|
|
10924
11284
|
updateCheckout: (id, version3, selections) => store.updateCheckout(id, version3, selections),
|
|
10925
11285
|
finalizeCheckout: (id, version3, options) => store.finalizeCheckout(id, version3, options)
|
|
10926
11286
|
},
|
|
10927
|
-
onSessionChange: (listener) => store.onSessionChange(listener)
|
|
11287
|
+
onSessionChange: (listener) => store.onSessionChange(listener),
|
|
11288
|
+
catalogSource: () => store.catalogSource()
|
|
10928
11289
|
};
|
|
10929
11290
|
}, [store]);
|
|
10930
11291
|
const localized = /* @__PURE__ */ jsx3(
|
|
@@ -10985,12 +11346,13 @@ function staticSource(data) {
|
|
|
10985
11346
|
},
|
|
10986
11347
|
loadMoreInvoices: () => Promise.resolve(),
|
|
10987
11348
|
invalidateAll: () => {
|
|
10988
|
-
}
|
|
11349
|
+
},
|
|
11350
|
+
catalogSource: () => catalogSourceOf(data)
|
|
10989
11351
|
};
|
|
10990
11352
|
}
|
|
10991
11353
|
|
|
10992
11354
|
// src/version.ts
|
|
10993
|
-
var version2 = "1.
|
|
11355
|
+
var version2 = "1.16.1";
|
|
10994
11356
|
|
|
10995
11357
|
// src/context/schematic.tsx
|
|
10996
11358
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
@@ -11043,9 +11405,11 @@ var SchematicProvider = ({
|
|
|
11043
11405
|
);
|
|
11044
11406
|
const { apiUrl, additionalHeaders } = initialOptsRef.current;
|
|
11045
11407
|
const providedApiUrl = providedClient?.apiUrl;
|
|
11408
|
+
const resolvedPublishableKey = initialOptsRef.current.publishableKey ?? providedClient?.publishableKey;
|
|
11046
11409
|
const resolvedBillingClient = useMemo5(
|
|
11047
11410
|
() => billingClient ?? new SchematicBillingClient({
|
|
11048
11411
|
session,
|
|
11412
|
+
publishableKey: resolvedPublishableKey,
|
|
11049
11413
|
apiUrl: apiUrl ?? providedApiUrl,
|
|
11050
11414
|
// Read as they stand when a client is built: headers do not change
|
|
11051
11415
|
// where the token goes, so they are no reason to build one.
|
|
@@ -11057,7 +11421,13 @@ var SchematicProvider = ({
|
|
|
11057
11421
|
// `session` is deliberately absent: `BillingProvider` forwards it through
|
|
11058
11422
|
// `setSession`, so a token change resets the billing resources without
|
|
11059
11423
|
// rebuilding the client.
|
|
11060
|
-
[
|
|
11424
|
+
[
|
|
11425
|
+
additionalHeaders,
|
|
11426
|
+
apiUrl,
|
|
11427
|
+
billingClient,
|
|
11428
|
+
providedApiUrl,
|
|
11429
|
+
resolvedPublishableKey
|
|
11430
|
+
]
|
|
11061
11431
|
);
|
|
11062
11432
|
return /* @__PURE__ */ jsx4(SchematicContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx4(
|
|
11063
11433
|
BillingProvider,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schematichq/schematic-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.1",
|
|
4
4
|
"main": "dist/schematic-react.cjs.js",
|
|
5
5
|
"module": "dist/schematic-react.esm.js",
|
|
6
6
|
"types": "dist/schematic-react.d.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@eslint/js": "^10.0.1",
|
|
36
36
|
"@microsoft/api-extractor": "^7.59.4",
|
|
37
|
-
"@schematichq/schematic-js": "^1.
|
|
37
|
+
"@schematichq/schematic-js": "^1.16.1",
|
|
38
38
|
"@testing-library/dom": "^10.4.2",
|
|
39
39
|
"@testing-library/jest-dom": "^7.0.1",
|
|
40
40
|
"@testing-library/react": "^16.3.3",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"eslint-plugin-react": "^7.37.5",
|
|
47
47
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
48
48
|
"globals": "^17.13.0",
|
|
49
|
-
"happy-dom": "^
|
|
49
|
+
"happy-dom": "^21.0.4",
|
|
50
50
|
"husky": "^9.1.7",
|
|
51
51
|
"jsdom": "^30.1.2",
|
|
52
52
|
"prettier": "^3.9.9",
|