@schematichq/schematic-react 1.15.0 → 1.16.0
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 +354 -12
- package/dist/schematic-react.d.ts +294 -7
- package/dist/schematic-react.esm.js +354 -12
- package/package.json +2 -2
|
@@ -82,7 +82,7 @@ __export(index_exports, {
|
|
|
82
82
|
});
|
|
83
83
|
module.exports = __toCommonJS(index_exports);
|
|
84
84
|
|
|
85
|
-
// node_modules/.pnpm/@schematichq+schematic-js@1.
|
|
85
|
+
// node_modules/.pnpm/@schematichq+schematic-js@1.16.0/node_modules/@schematichq/schematic-js/dist/schematic.esm.js
|
|
86
86
|
var __create2 = Object.create;
|
|
87
87
|
var __defProp2 = Object.defineProperty;
|
|
88
88
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -1413,7 +1413,7 @@ var ContextSignatureManager = class {
|
|
|
1413
1413
|
}
|
|
1414
1414
|
}
|
|
1415
1415
|
};
|
|
1416
|
-
var version = "1.
|
|
1416
|
+
var version = "1.16.0";
|
|
1417
1417
|
var DEFAULT_CATALOG_QUERY = {};
|
|
1418
1418
|
function normalizeCatalogQuery(query) {
|
|
1419
1419
|
return query.catalogId === void 0 ? {} : { catalogId: query.catalogId };
|
|
@@ -1532,6 +1532,10 @@ __export2(models_exports, {
|
|
|
1532
1532
|
CatalogPlanRefResponseDataFromJSONTyped: () => CatalogPlanRefResponseDataFromJSONTyped,
|
|
1533
1533
|
CatalogPlanRefResponseDataToJSON: () => CatalogPlanRefResponseDataToJSON,
|
|
1534
1534
|
CatalogPlanRefResponseDataToJSONTyped: () => CatalogPlanRefResponseDataToJSONTyped,
|
|
1535
|
+
CatalogPlanResponseDataFromJSON: () => CatalogPlanResponseDataFromJSON2,
|
|
1536
|
+
CatalogPlanResponseDataFromJSONTyped: () => CatalogPlanResponseDataFromJSONTyped2,
|
|
1537
|
+
CatalogPlanResponseDataToJSON: () => CatalogPlanResponseDataToJSON2,
|
|
1538
|
+
CatalogPlanResponseDataToJSONTyped: () => CatalogPlanResponseDataToJSONTyped2,
|
|
1535
1539
|
CatalogPriceResponseDataFromJSON: () => CatalogPriceResponseDataFromJSON2,
|
|
1536
1540
|
CatalogPriceResponseDataFromJSONTyped: () => CatalogPriceResponseDataFromJSONTyped7,
|
|
1537
1541
|
CatalogPriceResponseDataToJSON: () => CatalogPriceResponseDataToJSON2,
|
|
@@ -1838,6 +1842,14 @@ __export2(models_exports, {
|
|
|
1838
1842
|
GetCompanyUpcomingInvoiceResponseFromJSONTyped: () => GetCompanyUpcomingInvoiceResponseFromJSONTyped,
|
|
1839
1843
|
GetCompanyUpcomingInvoiceResponseToJSON: () => GetCompanyUpcomingInvoiceResponseToJSON,
|
|
1840
1844
|
GetCompanyUpcomingInvoiceResponseToJSONTyped: () => GetCompanyUpcomingInvoiceResponseToJSONTyped,
|
|
1845
|
+
GetPublicCatalogByIDResponseFromJSON: () => GetPublicCatalogByIDResponseFromJSON,
|
|
1846
|
+
GetPublicCatalogByIDResponseFromJSONTyped: () => GetPublicCatalogByIDResponseFromJSONTyped,
|
|
1847
|
+
GetPublicCatalogByIDResponseToJSON: () => GetPublicCatalogByIDResponseToJSON,
|
|
1848
|
+
GetPublicCatalogByIDResponseToJSONTyped: () => GetPublicCatalogByIDResponseToJSONTyped,
|
|
1849
|
+
GetPublicCatalogResponseFromJSON: () => GetPublicCatalogResponseFromJSON,
|
|
1850
|
+
GetPublicCatalogResponseFromJSONTyped: () => GetPublicCatalogResponseFromJSONTyped,
|
|
1851
|
+
GetPublicCatalogResponseToJSON: () => GetPublicCatalogResponseToJSON,
|
|
1852
|
+
GetPublicCatalogResponseToJSONTyped: () => GetPublicCatalogResponseToJSONTyped,
|
|
1841
1853
|
InvoiceStatus: () => InvoiceStatus,
|
|
1842
1854
|
InvoiceStatusFromJSON: () => InvoiceStatusFromJSON,
|
|
1843
1855
|
InvoiceStatusFromJSONTyped: () => InvoiceStatusFromJSONTyped,
|
|
@@ -1885,6 +1897,10 @@ __export2(models_exports, {
|
|
|
1885
1897
|
ProrationLineKindFromJSONTyped: () => ProrationLineKindFromJSONTyped,
|
|
1886
1898
|
ProrationLineKindToJSON: () => ProrationLineKindToJSON,
|
|
1887
1899
|
ProrationLineKindToJSONTyped: () => ProrationLineKindToJSONTyped,
|
|
1900
|
+
PublicCatalogResponseDataFromJSON: () => PublicCatalogResponseDataFromJSON2,
|
|
1901
|
+
PublicCatalogResponseDataFromJSONTyped: () => PublicCatalogResponseDataFromJSONTyped3,
|
|
1902
|
+
PublicCatalogResponseDataToJSON: () => PublicCatalogResponseDataToJSON2,
|
|
1903
|
+
PublicCatalogResponseDataToJSONTyped: () => PublicCatalogResponseDataToJSONTyped3,
|
|
1888
1904
|
ScheduledDowngradeConfigBehavior: () => ScheduledDowngradeConfigBehavior,
|
|
1889
1905
|
ScheduledDowngradeConfigBehaviorFromJSON: () => ScheduledDowngradeConfigBehaviorFromJSON,
|
|
1890
1906
|
ScheduledDowngradeConfigBehaviorFromJSONTyped: () => ScheduledDowngradeConfigBehaviorFromJSONTyped,
|
|
@@ -1972,6 +1988,7 @@ __export2(models_exports, {
|
|
|
1972
1988
|
instanceOfCatalogCustomPlanCTAResponseData: () => instanceOfCatalogCustomPlanCTAResponseData,
|
|
1973
1989
|
instanceOfCatalogPlanEntitlementResponseData: () => instanceOfCatalogPlanEntitlementResponseData,
|
|
1974
1990
|
instanceOfCatalogPlanRefResponseData: () => instanceOfCatalogPlanRefResponseData,
|
|
1991
|
+
instanceOfCatalogPlanResponseData: () => instanceOfCatalogPlanResponseData,
|
|
1975
1992
|
instanceOfCatalogPriceResponseData: () => instanceOfCatalogPriceResponseData,
|
|
1976
1993
|
instanceOfCatalogPriceTierResponseData: () => instanceOfCatalogPriceTierResponseData,
|
|
1977
1994
|
instanceOfCatalogUsageViolationResponseData: () => instanceOfCatalogUsageViolationResponseData,
|
|
@@ -2045,6 +2062,8 @@ __export2(models_exports, {
|
|
|
2045
2062
|
instanceOfGetCompanyPaymentMethodsResponse: () => instanceOfGetCompanyPaymentMethodsResponse,
|
|
2046
2063
|
instanceOfGetCompanyResponse: () => instanceOfGetCompanyResponse,
|
|
2047
2064
|
instanceOfGetCompanyUpcomingInvoiceResponse: () => instanceOfGetCompanyUpcomingInvoiceResponse,
|
|
2065
|
+
instanceOfGetPublicCatalogByIDResponse: () => instanceOfGetPublicCatalogByIDResponse,
|
|
2066
|
+
instanceOfGetPublicCatalogResponse: () => instanceOfGetPublicCatalogResponse,
|
|
2048
2067
|
instanceOfInvoiceStatus: () => instanceOfInvoiceStatus,
|
|
2049
2068
|
instanceOfListCheckoutsParams: () => instanceOfListCheckoutsParams,
|
|
2050
2069
|
instanceOfListCheckoutsResponse: () => instanceOfListCheckoutsResponse,
|
|
@@ -2055,6 +2074,7 @@ __export2(models_exports, {
|
|
|
2055
2074
|
instanceOfPlanPriceCadence: () => instanceOfPlanPriceCadence,
|
|
2056
2075
|
instanceOfProrationBehavior: () => instanceOfProrationBehavior,
|
|
2057
2076
|
instanceOfProrationLineKind: () => instanceOfProrationLineKind,
|
|
2077
|
+
instanceOfPublicCatalogResponseData: () => instanceOfPublicCatalogResponseData,
|
|
2058
2078
|
instanceOfScheduledDowngradeConfigBehavior: () => instanceOfScheduledDowngradeConfigBehavior,
|
|
2059
2079
|
instanceOfSetupIntentResponseData: () => instanceOfSetupIntentResponseData,
|
|
2060
2080
|
instanceOfTaxIDInput: () => instanceOfTaxIDInput,
|
|
@@ -3365,6 +3385,7 @@ function instanceOfCatalogCreditGrantResponseData(value) {
|
|
|
3365
3385
|
return false;
|
|
3366
3386
|
if (!("id" in value) || value["id"] === void 0) return false;
|
|
3367
3387
|
if (!("scaling" in value) || value["scaling"] === void 0) return false;
|
|
3388
|
+
if (!("visible" in value) || value["visible"] === void 0) return false;
|
|
3368
3389
|
return true;
|
|
3369
3390
|
}
|
|
3370
3391
|
function CatalogCreditGrantResponseDataFromJSON2(json) {
|
|
@@ -3385,7 +3406,8 @@ function CatalogCreditGrantResponseDataFromJSONTyped2(json, ignoreDiscriminator)
|
|
|
3385
3406
|
id: json["id"],
|
|
3386
3407
|
licenseId: json["license_id"] == null ? void 0 : json["license_id"],
|
|
3387
3408
|
resetCadence: json["reset_cadence"] == null ? void 0 : BillingPlanCreditGrantResetCadenceFromJSON2(json["reset_cadence"]),
|
|
3388
|
-
scaling: PlanCreditGrantScalingFromJSON2(json["scaling"])
|
|
3409
|
+
scaling: PlanCreditGrantScalingFromJSON2(json["scaling"]),
|
|
3410
|
+
visible: json["visible"]
|
|
3389
3411
|
};
|
|
3390
3412
|
}
|
|
3391
3413
|
function CatalogCreditGrantResponseDataToJSON2(json) {
|
|
@@ -3408,7 +3430,8 @@ function CatalogCreditGrantResponseDataToJSONTyped2(value, ignoreDiscriminator =
|
|
|
3408
3430
|
reset_cadence: BillingPlanCreditGrantResetCadenceToJSON2(
|
|
3409
3431
|
value["resetCadence"]
|
|
3410
3432
|
),
|
|
3411
|
-
scaling: PlanCreditGrantScalingToJSON2(value["scaling"])
|
|
3433
|
+
scaling: PlanCreditGrantScalingToJSON2(value["scaling"]),
|
|
3434
|
+
visible: value["visible"]
|
|
3412
3435
|
};
|
|
3413
3436
|
}
|
|
3414
3437
|
var PlanPriceCadence = {
|
|
@@ -3688,6 +3711,98 @@ function CatalogPlanRefResponseDataToJSONTyped(value, ignoreDiscriminator = fals
|
|
|
3688
3711
|
name: value["name"]
|
|
3689
3712
|
};
|
|
3690
3713
|
}
|
|
3714
|
+
function instanceOfCatalogPlanResponseData(value) {
|
|
3715
|
+
if (!("availablePeriods" in value) || value["availablePeriods"] === void 0)
|
|
3716
|
+
return false;
|
|
3717
|
+
if (!("billingStrategy" in value) || value["billingStrategy"] === void 0)
|
|
3718
|
+
return false;
|
|
3719
|
+
if (!("chargeType" in value) || value["chargeType"] === void 0)
|
|
3720
|
+
return false;
|
|
3721
|
+
if (!("currencyPrices" in value) || value["currencyPrices"] === void 0)
|
|
3722
|
+
return false;
|
|
3723
|
+
if (!("description" in value) || value["description"] === void 0)
|
|
3724
|
+
return false;
|
|
3725
|
+
if (!("entitlements" in value) || value["entitlements"] === void 0)
|
|
3726
|
+
return false;
|
|
3727
|
+
if (!("icon" in value) || value["icon"] === void 0) return false;
|
|
3728
|
+
if (!("id" in value) || value["id"] === void 0) return false;
|
|
3729
|
+
if (!("includedCreditGrants" in value) || value["includedCreditGrants"] === void 0)
|
|
3730
|
+
return false;
|
|
3731
|
+
if (!("isTrialable" in value) || value["isTrialable"] === void 0)
|
|
3732
|
+
return false;
|
|
3733
|
+
if (!("name" in value) || value["name"] === void 0) return false;
|
|
3734
|
+
return true;
|
|
3735
|
+
}
|
|
3736
|
+
function CatalogPlanResponseDataFromJSON2(json) {
|
|
3737
|
+
return CatalogPlanResponseDataFromJSONTyped2(json, false);
|
|
3738
|
+
}
|
|
3739
|
+
function CatalogPlanResponseDataFromJSONTyped2(json, ignoreDiscriminator) {
|
|
3740
|
+
if (json == null) {
|
|
3741
|
+
return json;
|
|
3742
|
+
}
|
|
3743
|
+
return {
|
|
3744
|
+
availablePeriods: json["available_periods"].map(
|
|
3745
|
+
PlanPriceCadenceFromJSON2
|
|
3746
|
+
),
|
|
3747
|
+
billingStrategy: BillingStrategyFromJSON2(json["billing_strategy"]),
|
|
3748
|
+
chargeType: ChargeTypeFromJSON2(json["charge_type"]),
|
|
3749
|
+
compatiblePlanIds: json["compatible_plan_ids"] == null ? void 0 : json["compatible_plan_ids"],
|
|
3750
|
+
currencyPrices: json["currency_prices"].map(
|
|
3751
|
+
CatalogCurrencyPricesResponseDataFromJSON2
|
|
3752
|
+
),
|
|
3753
|
+
description: json["description"],
|
|
3754
|
+
entitlements: json["entitlements"].map(
|
|
3755
|
+
CatalogPlanEntitlementResponseDataFromJSON2
|
|
3756
|
+
),
|
|
3757
|
+
icon: json["icon"],
|
|
3758
|
+
id: json["id"],
|
|
3759
|
+
includedCreditGrants: json["included_credit_grants"].map(
|
|
3760
|
+
CatalogCreditGrantResponseDataFromJSON2
|
|
3761
|
+
),
|
|
3762
|
+
isTrialable: json["is_trialable"],
|
|
3763
|
+
monthlyPrice: json["monthly_price"] == null ? void 0 : CatalogPriceResponseDataFromJSON2(json["monthly_price"]),
|
|
3764
|
+
name: json["name"],
|
|
3765
|
+
oneTimePrice: json["one_time_price"] == null ? void 0 : CatalogPriceResponseDataFromJSON2(json["one_time_price"]),
|
|
3766
|
+
quarterlyPrice: json["quarterly_price"] == null ? void 0 : CatalogPriceResponseDataFromJSON2(json["quarterly_price"]),
|
|
3767
|
+
trialDays: json["trial_days"] == null ? void 0 : json["trial_days"],
|
|
3768
|
+
yearlyPrice: json["yearly_price"] == null ? void 0 : CatalogPriceResponseDataFromJSON2(json["yearly_price"])
|
|
3769
|
+
};
|
|
3770
|
+
}
|
|
3771
|
+
function CatalogPlanResponseDataToJSON2(json) {
|
|
3772
|
+
return CatalogPlanResponseDataToJSONTyped2(json, false);
|
|
3773
|
+
}
|
|
3774
|
+
function CatalogPlanResponseDataToJSONTyped2(value, ignoreDiscriminator = false) {
|
|
3775
|
+
if (value == null) {
|
|
3776
|
+
return value;
|
|
3777
|
+
}
|
|
3778
|
+
return {
|
|
3779
|
+
available_periods: value["availablePeriods"].map(
|
|
3780
|
+
PlanPriceCadenceToJSON2
|
|
3781
|
+
),
|
|
3782
|
+
billing_strategy: BillingStrategyToJSON2(value["billingStrategy"]),
|
|
3783
|
+
charge_type: ChargeTypeToJSON2(value["chargeType"]),
|
|
3784
|
+
compatible_plan_ids: value["compatiblePlanIds"],
|
|
3785
|
+
currency_prices: value["currencyPrices"].map(
|
|
3786
|
+
CatalogCurrencyPricesResponseDataToJSON2
|
|
3787
|
+
),
|
|
3788
|
+
description: value["description"],
|
|
3789
|
+
entitlements: value["entitlements"].map(
|
|
3790
|
+
CatalogPlanEntitlementResponseDataToJSON2
|
|
3791
|
+
),
|
|
3792
|
+
icon: value["icon"],
|
|
3793
|
+
id: value["id"],
|
|
3794
|
+
included_credit_grants: value["includedCreditGrants"].map(
|
|
3795
|
+
CatalogCreditGrantResponseDataToJSON2
|
|
3796
|
+
),
|
|
3797
|
+
is_trialable: value["isTrialable"],
|
|
3798
|
+
monthly_price: CatalogPriceResponseDataToJSON2(value["monthlyPrice"]),
|
|
3799
|
+
name: value["name"],
|
|
3800
|
+
one_time_price: CatalogPriceResponseDataToJSON2(value["oneTimePrice"]),
|
|
3801
|
+
quarterly_price: CatalogPriceResponseDataToJSON2(value["quarterlyPrice"]),
|
|
3802
|
+
trial_days: value["trialDays"],
|
|
3803
|
+
yearly_price: CatalogPriceResponseDataToJSON2(value["yearlyPrice"])
|
|
3804
|
+
};
|
|
3805
|
+
}
|
|
3691
3806
|
var CheckoutChargeTiming = {
|
|
3692
3807
|
AtRenewal: "at_renewal",
|
|
3693
3808
|
None: "none",
|
|
@@ -6602,6 +6717,127 @@ function GetCompanyUpcomingInvoiceResponseToJSONTyped(value, ignoreDiscriminator
|
|
|
6602
6717
|
params: value["params"]
|
|
6603
6718
|
};
|
|
6604
6719
|
}
|
|
6720
|
+
function instanceOfPublicCatalogResponseData(value) {
|
|
6721
|
+
if (!("addOns" in value) || value["addOns"] === void 0) return false;
|
|
6722
|
+
if (!("capabilities" in value) || value["capabilities"] === void 0)
|
|
6723
|
+
return false;
|
|
6724
|
+
if (!("creditBundles" in value) || value["creditBundles"] === void 0)
|
|
6725
|
+
return false;
|
|
6726
|
+
if (!("defaultCurrency" in value) || value["defaultCurrency"] === void 0)
|
|
6727
|
+
return false;
|
|
6728
|
+
if (!("id" in value) || value["id"] === void 0) return false;
|
|
6729
|
+
if (!("name" in value) || value["name"] === void 0) return false;
|
|
6730
|
+
if (!("plans" in value) || value["plans"] === void 0) return false;
|
|
6731
|
+
return true;
|
|
6732
|
+
}
|
|
6733
|
+
function PublicCatalogResponseDataFromJSON2(json) {
|
|
6734
|
+
return PublicCatalogResponseDataFromJSONTyped3(json, false);
|
|
6735
|
+
}
|
|
6736
|
+
function PublicCatalogResponseDataFromJSONTyped3(json, ignoreDiscriminator) {
|
|
6737
|
+
if (json == null) {
|
|
6738
|
+
return json;
|
|
6739
|
+
}
|
|
6740
|
+
return {
|
|
6741
|
+
addOns: json["add_ons"].map(
|
|
6742
|
+
CatalogPlanResponseDataFromJSON2
|
|
6743
|
+
),
|
|
6744
|
+
capabilities: CatalogCapabilitiesResponseDataFromJSON2(json["capabilities"]),
|
|
6745
|
+
creditBundles: json["credit_bundles"].map(
|
|
6746
|
+
CatalogCreditBundleResponseDataFromJSON2
|
|
6747
|
+
),
|
|
6748
|
+
customPlanCta: json["custom_plan_cta"] == null ? void 0 : CatalogCustomPlanCTAResponseDataFromJSON2(json["custom_plan_cta"]),
|
|
6749
|
+
defaultCurrency: CurrencyFromJSON2(json["default_currency"]),
|
|
6750
|
+
description: json["description"] == null ? void 0 : json["description"],
|
|
6751
|
+
id: json["id"],
|
|
6752
|
+
name: json["name"],
|
|
6753
|
+
plans: json["plans"].map(CatalogPlanResponseDataFromJSON2),
|
|
6754
|
+
pricingModel: json["pricing_model"] == null ? void 0 : json["pricing_model"],
|
|
6755
|
+
pricingUrl: json["pricing_url"] == null ? void 0 : json["pricing_url"]
|
|
6756
|
+
};
|
|
6757
|
+
}
|
|
6758
|
+
function PublicCatalogResponseDataToJSON2(json) {
|
|
6759
|
+
return PublicCatalogResponseDataToJSONTyped3(json, false);
|
|
6760
|
+
}
|
|
6761
|
+
function PublicCatalogResponseDataToJSONTyped3(value, ignoreDiscriminator = false) {
|
|
6762
|
+
if (value == null) {
|
|
6763
|
+
return value;
|
|
6764
|
+
}
|
|
6765
|
+
return {
|
|
6766
|
+
add_ons: value["addOns"].map(CatalogPlanResponseDataToJSON2),
|
|
6767
|
+
capabilities: CatalogCapabilitiesResponseDataToJSON2(value["capabilities"]),
|
|
6768
|
+
credit_bundles: value["creditBundles"].map(
|
|
6769
|
+
CatalogCreditBundleResponseDataToJSON2
|
|
6770
|
+
),
|
|
6771
|
+
custom_plan_cta: CatalogCustomPlanCTAResponseDataToJSON2(
|
|
6772
|
+
value["customPlanCta"]
|
|
6773
|
+
),
|
|
6774
|
+
default_currency: CurrencyToJSON2(value["defaultCurrency"]),
|
|
6775
|
+
description: value["description"],
|
|
6776
|
+
id: value["id"],
|
|
6777
|
+
name: value["name"],
|
|
6778
|
+
plans: value["plans"].map(CatalogPlanResponseDataToJSON2),
|
|
6779
|
+
pricing_model: value["pricingModel"],
|
|
6780
|
+
pricing_url: value["pricingUrl"]
|
|
6781
|
+
};
|
|
6782
|
+
}
|
|
6783
|
+
function instanceOfGetPublicCatalogByIDResponse(value) {
|
|
6784
|
+
if (!("data" in value) || value["data"] === void 0) return false;
|
|
6785
|
+
if (!("params" in value) || value["params"] === void 0) return false;
|
|
6786
|
+
return true;
|
|
6787
|
+
}
|
|
6788
|
+
function GetPublicCatalogByIDResponseFromJSON(json) {
|
|
6789
|
+
return GetPublicCatalogByIDResponseFromJSONTyped(json, false);
|
|
6790
|
+
}
|
|
6791
|
+
function GetPublicCatalogByIDResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
6792
|
+
if (json == null) {
|
|
6793
|
+
return json;
|
|
6794
|
+
}
|
|
6795
|
+
return {
|
|
6796
|
+
data: PublicCatalogResponseDataFromJSON2(json["data"]),
|
|
6797
|
+
params: json["params"]
|
|
6798
|
+
};
|
|
6799
|
+
}
|
|
6800
|
+
function GetPublicCatalogByIDResponseToJSON(json) {
|
|
6801
|
+
return GetPublicCatalogByIDResponseToJSONTyped(json, false);
|
|
6802
|
+
}
|
|
6803
|
+
function GetPublicCatalogByIDResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
6804
|
+
if (value == null) {
|
|
6805
|
+
return value;
|
|
6806
|
+
}
|
|
6807
|
+
return {
|
|
6808
|
+
data: PublicCatalogResponseDataToJSON2(value["data"]),
|
|
6809
|
+
params: value["params"]
|
|
6810
|
+
};
|
|
6811
|
+
}
|
|
6812
|
+
function instanceOfGetPublicCatalogResponse(value) {
|
|
6813
|
+
if (!("data" in value) || value["data"] === void 0) return false;
|
|
6814
|
+
if (!("params" in value) || value["params"] === void 0) return false;
|
|
6815
|
+
return true;
|
|
6816
|
+
}
|
|
6817
|
+
function GetPublicCatalogResponseFromJSON(json) {
|
|
6818
|
+
return GetPublicCatalogResponseFromJSONTyped(json, false);
|
|
6819
|
+
}
|
|
6820
|
+
function GetPublicCatalogResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
6821
|
+
if (json == null) {
|
|
6822
|
+
return json;
|
|
6823
|
+
}
|
|
6824
|
+
return {
|
|
6825
|
+
data: PublicCatalogResponseDataFromJSON2(json["data"]),
|
|
6826
|
+
params: json["params"]
|
|
6827
|
+
};
|
|
6828
|
+
}
|
|
6829
|
+
function GetPublicCatalogResponseToJSON(json) {
|
|
6830
|
+
return GetPublicCatalogResponseToJSONTyped(json, false);
|
|
6831
|
+
}
|
|
6832
|
+
function GetPublicCatalogResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
6833
|
+
if (value == null) {
|
|
6834
|
+
return value;
|
|
6835
|
+
}
|
|
6836
|
+
return {
|
|
6837
|
+
data: PublicCatalogResponseDataToJSON2(value["data"]),
|
|
6838
|
+
params: value["params"]
|
|
6839
|
+
};
|
|
6840
|
+
}
|
|
6605
6841
|
function instanceOfListCheckoutsParams(value) {
|
|
6606
6842
|
return true;
|
|
6607
6843
|
}
|
|
@@ -7077,6 +7313,7 @@ var SchematicSession = class {
|
|
|
7077
7313
|
_apiUrl;
|
|
7078
7314
|
_headers;
|
|
7079
7315
|
_fetch;
|
|
7316
|
+
_publishableKey;
|
|
7080
7317
|
_session;
|
|
7081
7318
|
_tokens = /* @__PURE__ */ new Map();
|
|
7082
7319
|
_resolving = /* @__PURE__ */ new Map();
|
|
@@ -7089,6 +7326,7 @@ var SchematicSession = class {
|
|
|
7089
7326
|
_listeners = /* @__PURE__ */ new Set();
|
|
7090
7327
|
constructor(options = {}) {
|
|
7091
7328
|
this._session = options.session;
|
|
7329
|
+
this._publishableKey = options.publishableKey;
|
|
7092
7330
|
this._apiUrl = (options.apiUrl ?? DEFAULT_API_URL).replace(/\/$/, "");
|
|
7093
7331
|
this._headers = options.additionalHeaders ?? {};
|
|
7094
7332
|
this._fetch = options.fetch ?? ((input, init) => globalThis.fetch(input, init));
|
|
@@ -7096,6 +7334,9 @@ var SchematicSession = class {
|
|
|
7096
7334
|
get key() {
|
|
7097
7335
|
return this._session === null || this._session === void 0 ? void 0 : sessionKey(this._session);
|
|
7098
7336
|
}
|
|
7337
|
+
get hasPublishableKey() {
|
|
7338
|
+
return this._publishableKey !== void 0;
|
|
7339
|
+
}
|
|
7099
7340
|
get status() {
|
|
7100
7341
|
if (this._session === void 0) {
|
|
7101
7342
|
return "pending";
|
|
@@ -7214,6 +7455,30 @@ var SchematicSession = class {
|
|
|
7214
7455
|
async request(path, options = {}) {
|
|
7215
7456
|
return (await this.requestWithResponse(path, options)).body;
|
|
7216
7457
|
}
|
|
7458
|
+
/**
|
|
7459
|
+
* A read under the publishable key, whatever the session. Nothing is
|
|
7460
|
+
* refreshed or retried, since the key does not expire, and a session
|
|
7461
|
+
* changing mid-flight does not void the answer: it is the same for
|
|
7462
|
+
* everyone.
|
|
7463
|
+
*/
|
|
7464
|
+
async requestPublic(path) {
|
|
7465
|
+
if (this._publishableKey === void 0) {
|
|
7466
|
+
throw new Error("A publishable key is required to read public data.");
|
|
7467
|
+
}
|
|
7468
|
+
const response = await this._fetch(`${this._apiUrl}${path}`, {
|
|
7469
|
+
method: "GET",
|
|
7470
|
+
headers: {
|
|
7471
|
+
"Accept": "application/json",
|
|
7472
|
+
...this._headers,
|
|
7473
|
+
"X-Schematic-Api-Key": this._publishableKey
|
|
7474
|
+
}
|
|
7475
|
+
});
|
|
7476
|
+
const parsed = await readBody(response);
|
|
7477
|
+
if (!response.ok) {
|
|
7478
|
+
throw new SchematicApiError(response.status, path, parsed);
|
|
7479
|
+
}
|
|
7480
|
+
return parsed;
|
|
7481
|
+
}
|
|
7217
7482
|
/**
|
|
7218
7483
|
* `request`, with the headers the answer came back with — for a resource
|
|
7219
7484
|
* whose protocol rides beside the body, as a checkout's session does.
|
|
@@ -7647,6 +7912,9 @@ var SchematicBillingClient = class {
|
|
|
7647
7912
|
get sessionStatus() {
|
|
7648
7913
|
return this.session.status;
|
|
7649
7914
|
}
|
|
7915
|
+
get hasPublishableKey() {
|
|
7916
|
+
return this.session.hasPublishableKey;
|
|
7917
|
+
}
|
|
7650
7918
|
setSession(session) {
|
|
7651
7919
|
this.session.set(session);
|
|
7652
7920
|
}
|
|
@@ -7657,6 +7925,10 @@ var SchematicBillingClient = class {
|
|
|
7657
7925
|
const path = query.catalogId === void 0 ? "/catalog/view" : `/catalogs/${encodeURIComponent(query.catalogId)}/view`;
|
|
7658
7926
|
return this.session.request(path).then((body) => CompanyCatalogResponseDataFromJSON(dataOf(body, path)));
|
|
7659
7927
|
}
|
|
7928
|
+
fetchPublicCatalog(query = {}) {
|
|
7929
|
+
const path = query.catalogId === void 0 ? "/public/catalog" : `/public/catalogs/${encodeURIComponent(query.catalogId)}`;
|
|
7930
|
+
return this.session.requestPublic(path).then((body) => PublicCatalogResponseDataFromJSON2(dataOf(body, path)));
|
|
7931
|
+
}
|
|
7660
7932
|
createCheckout(selections) {
|
|
7661
7933
|
return this.checkoutWrite("/checkouts", {
|
|
7662
7934
|
method: "POST",
|
|
@@ -8058,6 +8330,10 @@ var Schematic = class {
|
|
|
8058
8330
|
get additionalHeaders() {
|
|
8059
8331
|
return { ...this._additionalHeaders };
|
|
8060
8332
|
}
|
|
8333
|
+
/** The key flags are read with, for a billing client reading beside it. */
|
|
8334
|
+
get publishableKey() {
|
|
8335
|
+
return this.apiKey;
|
|
8336
|
+
}
|
|
8061
8337
|
/**
|
|
8062
8338
|
* Resolve fallback value according to priority order:
|
|
8063
8339
|
* 1. Callsite fallback value (if provided)
|
|
@@ -10096,6 +10372,27 @@ var BillingStore = class {
|
|
|
10096
10372
|
(query) => this._client.fetchCatalog(query),
|
|
10097
10373
|
{ readiness }
|
|
10098
10374
|
);
|
|
10375
|
+
this.publicCatalog = new KeyedResource(
|
|
10376
|
+
(query) => this._client.fetchPublicCatalog?.(query) ?? Promise.reject(
|
|
10377
|
+
new Error("The billing client cannot read public data.")
|
|
10378
|
+
),
|
|
10379
|
+
{
|
|
10380
|
+
readiness: () => {
|
|
10381
|
+
if (!this._connected) {
|
|
10382
|
+
return "waiting";
|
|
10383
|
+
}
|
|
10384
|
+
return this._client.hasPublishableKey === true && this._client.fetchPublicCatalog !== void 0 ? "ready" : "never";
|
|
10385
|
+
}
|
|
10386
|
+
}
|
|
10387
|
+
);
|
|
10388
|
+
if (initialData.publicCatalog !== void 0) {
|
|
10389
|
+
this.publicCatalog.seed(
|
|
10390
|
+
normalizeCatalogQuery2(
|
|
10391
|
+
initialData.params?.publicCatalog ?? DEFAULT_CATALOG_QUERY
|
|
10392
|
+
),
|
|
10393
|
+
initialData.publicCatalog
|
|
10394
|
+
);
|
|
10395
|
+
}
|
|
10099
10396
|
this.invoices = new KeyedResource(
|
|
10100
10397
|
(query, current) => this._reloadWindow(
|
|
10101
10398
|
query,
|
|
@@ -10183,6 +10480,7 @@ var BillingStore = class {
|
|
|
10183
10480
|
}
|
|
10184
10481
|
_client;
|
|
10185
10482
|
catalog;
|
|
10483
|
+
publicCatalog;
|
|
10186
10484
|
invoices;
|
|
10187
10485
|
upcomingInvoice;
|
|
10188
10486
|
paymentMethods;
|
|
@@ -10230,6 +10528,7 @@ var BillingStore = class {
|
|
|
10230
10528
|
this._connected = true;
|
|
10231
10529
|
this._settleSeed(claimOf(this._client));
|
|
10232
10530
|
this.resumeAll();
|
|
10531
|
+
this.publicCatalog.resumeAll();
|
|
10233
10532
|
}
|
|
10234
10533
|
return () => {
|
|
10235
10534
|
unsubscribe?.();
|
|
@@ -10289,6 +10588,15 @@ var BillingStore = class {
|
|
|
10289
10588
|
this._seeded = true;
|
|
10290
10589
|
}
|
|
10291
10590
|
}
|
|
10591
|
+
/**
|
|
10592
|
+
* The company's view once someone is signed in; the public catalog until
|
|
10593
|
+
* then, where the client has a key to read it with. A session still
|
|
10594
|
+
* pending reads the public one too: a page that never states a session
|
|
10595
|
+
* would otherwise wait on one for good.
|
|
10596
|
+
*/
|
|
10597
|
+
catalogSource() {
|
|
10598
|
+
return this._client.sessionStatus !== "active" && this._client.hasPublishableKey === true ? "public" : "company";
|
|
10599
|
+
}
|
|
10292
10600
|
resource(name) {
|
|
10293
10601
|
return this[name];
|
|
10294
10602
|
}
|
|
@@ -10529,6 +10837,9 @@ function useSchematicStrings() {
|
|
|
10529
10837
|
|
|
10530
10838
|
// src/billing/context.tsx
|
|
10531
10839
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
10840
|
+
function catalogSourceOf(data) {
|
|
10841
|
+
return data.catalog === void 0 && data.publicCatalog !== void 0 ? "public" : "company";
|
|
10842
|
+
}
|
|
10532
10843
|
var BillingDataContext = (0, import_react2.createContext)(
|
|
10533
10844
|
void 0
|
|
10534
10845
|
);
|
|
@@ -10668,7 +10979,8 @@ function BillingDataProvider({
|
|
|
10668
10979
|
return Promise.resolve();
|
|
10669
10980
|
},
|
|
10670
10981
|
invalidateAll: () => {
|
|
10671
|
-
}
|
|
10982
|
+
},
|
|
10983
|
+
catalogSource: () => catalogSourceOf(data)
|
|
10672
10984
|
};
|
|
10673
10985
|
}, [
|
|
10674
10986
|
actions,
|
|
@@ -10714,10 +11026,30 @@ function useBillingResource(name, params) {
|
|
|
10714
11026
|
return (0, import_react3.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
|
|
10715
11027
|
}
|
|
10716
11028
|
function useCatalog(query = DEFAULT_CATALOG_QUERY) {
|
|
10717
|
-
|
|
10718
|
-
|
|
10719
|
-
|
|
11029
|
+
const source = useBillingDataSource();
|
|
11030
|
+
const params = useStableParams(normalizeCatalogQuery2(query));
|
|
11031
|
+
const subscribeSource = (0, import_react3.useCallback)(
|
|
11032
|
+
(listener) => source.onSessionChange?.(() => listener()) ?? (() => {
|
|
11033
|
+
}),
|
|
11034
|
+
[source]
|
|
11035
|
+
);
|
|
11036
|
+
const readSource = (0, import_react3.useCallback)(
|
|
11037
|
+
() => source.catalogSource?.() ?? "company",
|
|
11038
|
+
[source]
|
|
11039
|
+
);
|
|
11040
|
+
const which = (0, import_react3.useSyncExternalStore)(subscribeSource, readSource, readSource);
|
|
11041
|
+
const handle = useBillingResource(
|
|
11042
|
+
which === "public" ? "publicCatalog" : "catalog",
|
|
11043
|
+
params
|
|
10720
11044
|
);
|
|
11045
|
+
return (0, import_react3.useMemo)(() => {
|
|
11046
|
+
const { data } = handle;
|
|
11047
|
+
let view;
|
|
11048
|
+
if (data !== void 0) {
|
|
11049
|
+
view = which === "public" ? { source: "public", catalog: data } : { source: "company", catalog: data };
|
|
11050
|
+
}
|
|
11051
|
+
return { ...handle, data: view };
|
|
11052
|
+
}, [handle, which]);
|
|
10721
11053
|
}
|
|
10722
11054
|
function useInvoices(query = DEFAULT_INVOICE_QUERY) {
|
|
10723
11055
|
const source = useBillingDataSource();
|
|
@@ -11001,7 +11333,8 @@ function BillingProvider({
|
|
|
11001
11333
|
updateCheckout: (id, version3, selections) => store.updateCheckout(id, version3, selections),
|
|
11002
11334
|
finalizeCheckout: (id, version3, options) => store.finalizeCheckout(id, version3, options)
|
|
11003
11335
|
},
|
|
11004
|
-
onSessionChange: (listener) => store.onSessionChange(listener)
|
|
11336
|
+
onSessionChange: (listener) => store.onSessionChange(listener),
|
|
11337
|
+
catalogSource: () => store.catalogSource()
|
|
11005
11338
|
};
|
|
11006
11339
|
}, [store]);
|
|
11007
11340
|
const localized = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -11062,12 +11395,13 @@ function staticSource(data) {
|
|
|
11062
11395
|
},
|
|
11063
11396
|
loadMoreInvoices: () => Promise.resolve(),
|
|
11064
11397
|
invalidateAll: () => {
|
|
11065
|
-
}
|
|
11398
|
+
},
|
|
11399
|
+
catalogSource: () => catalogSourceOf(data)
|
|
11066
11400
|
};
|
|
11067
11401
|
}
|
|
11068
11402
|
|
|
11069
11403
|
// src/version.ts
|
|
11070
|
-
var version2 = "1.
|
|
11404
|
+
var version2 = "1.16.0";
|
|
11071
11405
|
|
|
11072
11406
|
// src/context/schematic.tsx
|
|
11073
11407
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
@@ -11120,9 +11454,11 @@ var SchematicProvider = ({
|
|
|
11120
11454
|
);
|
|
11121
11455
|
const { apiUrl, additionalHeaders } = initialOptsRef.current;
|
|
11122
11456
|
const providedApiUrl = providedClient?.apiUrl;
|
|
11457
|
+
const resolvedPublishableKey = initialOptsRef.current.publishableKey ?? providedClient?.publishableKey;
|
|
11123
11458
|
const resolvedBillingClient = (0, import_react5.useMemo)(
|
|
11124
11459
|
() => billingClient ?? new SchematicBillingClient({
|
|
11125
11460
|
session,
|
|
11461
|
+
publishableKey: resolvedPublishableKey,
|
|
11126
11462
|
apiUrl: apiUrl ?? providedApiUrl,
|
|
11127
11463
|
// Read as they stand when a client is built: headers do not change
|
|
11128
11464
|
// where the token goes, so they are no reason to build one.
|
|
@@ -11134,7 +11470,13 @@ var SchematicProvider = ({
|
|
|
11134
11470
|
// `session` is deliberately absent: `BillingProvider` forwards it through
|
|
11135
11471
|
// `setSession`, so a token change resets the billing resources without
|
|
11136
11472
|
// rebuilding the client.
|
|
11137
|
-
[
|
|
11473
|
+
[
|
|
11474
|
+
additionalHeaders,
|
|
11475
|
+
apiUrl,
|
|
11476
|
+
billingClient,
|
|
11477
|
+
providedApiUrl,
|
|
11478
|
+
resolvedPublishableKey
|
|
11479
|
+
]
|
|
11138
11480
|
);
|
|
11139
11481
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SchematicContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
11140
11482
|
BillingProvider,
|