@schematichq/schematic-react 1.16.0 → 1.17.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 +79 -37
- package/dist/schematic-react.d.ts +48 -11
- package/dist/schematic-react.esm.js +79 -37
- package/package.json +10 -10
|
@@ -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.17.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.17.0";
|
|
1417
1417
|
var DEFAULT_CATALOG_QUERY = {};
|
|
1418
1418
|
function normalizeCatalogQuery(query) {
|
|
1419
1419
|
return query.catalogId === void 0 ? {} : { catalogId: query.catalogId };
|
|
@@ -1521,9 +1521,9 @@ __export2(models_exports, {
|
|
|
1521
1521
|
CatalogCurrencyPricesResponseDataToJSON: () => CatalogCurrencyPricesResponseDataToJSON2,
|
|
1522
1522
|
CatalogCurrencyPricesResponseDataToJSONTyped: () => CatalogCurrencyPricesResponseDataToJSONTyped4,
|
|
1523
1523
|
CatalogCustomPlanCTAResponseDataFromJSON: () => CatalogCustomPlanCTAResponseDataFromJSON2,
|
|
1524
|
-
CatalogCustomPlanCTAResponseDataFromJSONTyped: () =>
|
|
1524
|
+
CatalogCustomPlanCTAResponseDataFromJSONTyped: () => CatalogCustomPlanCTAResponseDataFromJSONTyped4,
|
|
1525
1525
|
CatalogCustomPlanCTAResponseDataToJSON: () => CatalogCustomPlanCTAResponseDataToJSON2,
|
|
1526
|
-
CatalogCustomPlanCTAResponseDataToJSONTyped: () =>
|
|
1526
|
+
CatalogCustomPlanCTAResponseDataToJSONTyped: () => CatalogCustomPlanCTAResponseDataToJSONTyped4,
|
|
1527
1527
|
CatalogPlanEntitlementResponseDataFromJSON: () => CatalogPlanEntitlementResponseDataFromJSON2,
|
|
1528
1528
|
CatalogPlanEntitlementResponseDataFromJSONTyped: () => CatalogPlanEntitlementResponseDataFromJSONTyped2,
|
|
1529
1529
|
CatalogPlanEntitlementResponseDataToJSON: () => CatalogPlanEntitlementResponseDataToJSON2,
|
|
@@ -3042,6 +3042,35 @@ function CatalogUsageViolationResponseDataToJSONTyped(value, ignoreDiscriminator
|
|
|
3042
3042
|
usage: value["usage"]
|
|
3043
3043
|
};
|
|
3044
3044
|
}
|
|
3045
|
+
function instanceOfCatalogCustomPlanCTAResponseData(value) {
|
|
3046
|
+
return true;
|
|
3047
|
+
}
|
|
3048
|
+
function CatalogCustomPlanCTAResponseDataFromJSON2(json) {
|
|
3049
|
+
return CatalogCustomPlanCTAResponseDataFromJSONTyped4(json, false);
|
|
3050
|
+
}
|
|
3051
|
+
function CatalogCustomPlanCTAResponseDataFromJSONTyped4(json, ignoreDiscriminator) {
|
|
3052
|
+
if (json == null) {
|
|
3053
|
+
return json;
|
|
3054
|
+
}
|
|
3055
|
+
return {
|
|
3056
|
+
ctaText: json["cta_text"] == null ? void 0 : json["cta_text"],
|
|
3057
|
+
ctaUrl: json["cta_url"] == null ? void 0 : json["cta_url"],
|
|
3058
|
+
priceText: json["price_text"] == null ? void 0 : json["price_text"]
|
|
3059
|
+
};
|
|
3060
|
+
}
|
|
3061
|
+
function CatalogCustomPlanCTAResponseDataToJSON2(json) {
|
|
3062
|
+
return CatalogCustomPlanCTAResponseDataToJSONTyped4(json, false);
|
|
3063
|
+
}
|
|
3064
|
+
function CatalogCustomPlanCTAResponseDataToJSONTyped4(value, ignoreDiscriminator = false) {
|
|
3065
|
+
if (value == null) {
|
|
3066
|
+
return value;
|
|
3067
|
+
}
|
|
3068
|
+
return {
|
|
3069
|
+
cta_text: value["ctaText"],
|
|
3070
|
+
cta_url: value["ctaUrl"],
|
|
3071
|
+
price_text: value["priceText"]
|
|
3072
|
+
};
|
|
3073
|
+
}
|
|
3045
3074
|
var EntitlementValueType = {
|
|
3046
3075
|
Boolean: "boolean",
|
|
3047
3076
|
Credit: "credit",
|
|
@@ -3475,6 +3504,7 @@ function instanceOfCatalogCompanyPlanResponseData(value) {
|
|
|
3475
3504
|
if (!("currencyPrices" in value) || value["currencyPrices"] === void 0)
|
|
3476
3505
|
return false;
|
|
3477
3506
|
if (!("current" in value) || value["current"] === void 0) return false;
|
|
3507
|
+
if (!("custom" in value) || value["custom"] === void 0) return false;
|
|
3478
3508
|
if (!("description" in value) || value["description"] === void 0)
|
|
3479
3509
|
return false;
|
|
3480
3510
|
if (!("entitlements" in value) || value["entitlements"] === void 0)
|
|
@@ -3513,6 +3543,8 @@ function CatalogCompanyPlanResponseDataFromJSONTyped(json, ignoreDiscriminator)
|
|
|
3513
3543
|
CatalogCurrencyPricesResponseDataFromJSON2
|
|
3514
3544
|
),
|
|
3515
3545
|
current: json["current"],
|
|
3546
|
+
custom: json["custom"],
|
|
3547
|
+
customPlanCta: json["custom_plan_cta"] == null ? void 0 : CatalogCustomPlanCTAResponseDataFromJSON2(json["custom_plan_cta"]),
|
|
3516
3548
|
description: json["description"],
|
|
3517
3549
|
entitlements: json["entitlements"].map(
|
|
3518
3550
|
CatalogPlanEntitlementResponseDataFromJSON2
|
|
@@ -3558,6 +3590,10 @@ function CatalogCompanyPlanResponseDataToJSONTyped(value, ignoreDiscriminator =
|
|
|
3558
3590
|
CatalogCurrencyPricesResponseDataToJSON2
|
|
3559
3591
|
),
|
|
3560
3592
|
current: value["current"],
|
|
3593
|
+
custom: value["custom"],
|
|
3594
|
+
custom_plan_cta: CatalogCustomPlanCTAResponseDataToJSON2(
|
|
3595
|
+
value["customPlanCta"]
|
|
3596
|
+
),
|
|
3561
3597
|
description: value["description"],
|
|
3562
3598
|
entitlements: value["entitlements"].map(
|
|
3563
3599
|
CatalogPlanEntitlementResponseDataToJSON2
|
|
@@ -3653,35 +3689,6 @@ function CatalogCreditBundleResponseDataToJSONTyped2(value, ignoreDiscriminator
|
|
|
3653
3689
|
unit_price: CatalogPriceResponseDataToJSON2(value["unitPrice"])
|
|
3654
3690
|
};
|
|
3655
3691
|
}
|
|
3656
|
-
function instanceOfCatalogCustomPlanCTAResponseData(value) {
|
|
3657
|
-
return true;
|
|
3658
|
-
}
|
|
3659
|
-
function CatalogCustomPlanCTAResponseDataFromJSON2(json) {
|
|
3660
|
-
return CatalogCustomPlanCTAResponseDataFromJSONTyped3(json, false);
|
|
3661
|
-
}
|
|
3662
|
-
function CatalogCustomPlanCTAResponseDataFromJSONTyped3(json, ignoreDiscriminator) {
|
|
3663
|
-
if (json == null) {
|
|
3664
|
-
return json;
|
|
3665
|
-
}
|
|
3666
|
-
return {
|
|
3667
|
-
ctaText: json["cta_text"] == null ? void 0 : json["cta_text"],
|
|
3668
|
-
ctaUrl: json["cta_url"] == null ? void 0 : json["cta_url"],
|
|
3669
|
-
priceText: json["price_text"] == null ? void 0 : json["price_text"]
|
|
3670
|
-
};
|
|
3671
|
-
}
|
|
3672
|
-
function CatalogCustomPlanCTAResponseDataToJSON2(json) {
|
|
3673
|
-
return CatalogCustomPlanCTAResponseDataToJSONTyped3(json, false);
|
|
3674
|
-
}
|
|
3675
|
-
function CatalogCustomPlanCTAResponseDataToJSONTyped3(value, ignoreDiscriminator = false) {
|
|
3676
|
-
if (value == null) {
|
|
3677
|
-
return value;
|
|
3678
|
-
}
|
|
3679
|
-
return {
|
|
3680
|
-
cta_text: value["ctaText"],
|
|
3681
|
-
cta_url: value["ctaUrl"],
|
|
3682
|
-
price_text: value["priceText"]
|
|
3683
|
-
};
|
|
3684
|
-
}
|
|
3685
3692
|
function instanceOfCatalogPlanRefResponseData(value) {
|
|
3686
3693
|
if (!("id" in value) || value["id"] === void 0) return false;
|
|
3687
3694
|
if (!("name" in value) || value["name"] === void 0) return false;
|
|
@@ -3720,6 +3727,7 @@ function instanceOfCatalogPlanResponseData(value) {
|
|
|
3720
3727
|
return false;
|
|
3721
3728
|
if (!("currencyPrices" in value) || value["currencyPrices"] === void 0)
|
|
3722
3729
|
return false;
|
|
3730
|
+
if (!("custom" in value) || value["custom"] === void 0) return false;
|
|
3723
3731
|
if (!("description" in value) || value["description"] === void 0)
|
|
3724
3732
|
return false;
|
|
3725
3733
|
if (!("entitlements" in value) || value["entitlements"] === void 0)
|
|
@@ -3750,6 +3758,8 @@ function CatalogPlanResponseDataFromJSONTyped2(json, ignoreDiscriminator) {
|
|
|
3750
3758
|
currencyPrices: json["currency_prices"].map(
|
|
3751
3759
|
CatalogCurrencyPricesResponseDataFromJSON2
|
|
3752
3760
|
),
|
|
3761
|
+
custom: json["custom"],
|
|
3762
|
+
customPlanCta: json["custom_plan_cta"] == null ? void 0 : CatalogCustomPlanCTAResponseDataFromJSON2(json["custom_plan_cta"]),
|
|
3753
3763
|
description: json["description"],
|
|
3754
3764
|
entitlements: json["entitlements"].map(
|
|
3755
3765
|
CatalogPlanEntitlementResponseDataFromJSON2
|
|
@@ -3785,6 +3795,10 @@ function CatalogPlanResponseDataToJSONTyped2(value, ignoreDiscriminator = false)
|
|
|
3785
3795
|
currency_prices: value["currencyPrices"].map(
|
|
3786
3796
|
CatalogCurrencyPricesResponseDataToJSON2
|
|
3787
3797
|
),
|
|
3798
|
+
custom: value["custom"],
|
|
3799
|
+
custom_plan_cta: CatalogCustomPlanCTAResponseDataToJSON2(
|
|
3800
|
+
value["customPlanCta"]
|
|
3801
|
+
),
|
|
3788
3802
|
description: value["description"],
|
|
3789
3803
|
entitlements: value["entitlements"].map(
|
|
3790
3804
|
CatalogPlanEntitlementResponseDataToJSON2
|
|
@@ -7659,6 +7673,8 @@ var CheckoutDraft = class {
|
|
|
7659
7673
|
/** Bumped by reset, so an answer for a discarded draft lands nowhere. */
|
|
7660
7674
|
generation = 0;
|
|
7661
7675
|
inFlight;
|
|
7676
|
+
/** The read of a resumed checkout, while one is out. */
|
|
7677
|
+
loading;
|
|
7662
7678
|
queued;
|
|
7663
7679
|
constructor(transport, options = {}) {
|
|
7664
7680
|
this.transport = transport;
|
|
@@ -7684,10 +7700,19 @@ var CheckoutDraft = class {
|
|
|
7684
7700
|
}
|
|
7685
7701
|
/**
|
|
7686
7702
|
* Reads the checkout this draft was opened on, for a resume. A draft with
|
|
7687
|
-
* no checkout yet has nothing to read.
|
|
7703
|
+
* no checkout yet has nothing to read. A call while a read is out shares
|
|
7704
|
+
* its answer.
|
|
7688
7705
|
*/
|
|
7689
7706
|
load() {
|
|
7690
|
-
|
|
7707
|
+
if (this.loading === void 0) {
|
|
7708
|
+
const generation = this.generation;
|
|
7709
|
+
this.loading = this.refresh(generation).finally(() => {
|
|
7710
|
+
if (generation === this.generation) {
|
|
7711
|
+
this.loading = void 0;
|
|
7712
|
+
}
|
|
7713
|
+
});
|
|
7714
|
+
}
|
|
7715
|
+
return this.loading;
|
|
7691
7716
|
}
|
|
7692
7717
|
/**
|
|
7693
7718
|
* Replaces the cart and re-prices it. Resolves with the checkout the write
|
|
@@ -7720,11 +7745,12 @@ var CheckoutDraft = class {
|
|
|
7720
7745
|
if (generation !== this.generation) {
|
|
7721
7746
|
throw new Error("The checkout was reset before it was finalized.");
|
|
7722
7747
|
}
|
|
7723
|
-
if (this.checkoutId === void 0
|
|
7748
|
+
if (this.checkoutId === void 0) {
|
|
7724
7749
|
throw new Error("There is no checkout to finalize yet.");
|
|
7725
7750
|
}
|
|
7726
7751
|
this.update({ isFinalizing: true, error: void 0 });
|
|
7727
7752
|
try {
|
|
7753
|
+
await this.readResumed(generation);
|
|
7728
7754
|
const result = await this.finalizeOnce(generation, true);
|
|
7729
7755
|
if (generation === this.generation) {
|
|
7730
7756
|
this.update({ isFinalizing: false, result });
|
|
@@ -7752,6 +7778,7 @@ var CheckoutDraft = class {
|
|
|
7752
7778
|
const queued = this.queued;
|
|
7753
7779
|
this.queued = void 0;
|
|
7754
7780
|
this.inFlight = void 0;
|
|
7781
|
+
this.loading = void 0;
|
|
7755
7782
|
queued?.waiters.forEach((w) => w.resolve(void 0));
|
|
7756
7783
|
this.update({ ...INITIAL_STATE });
|
|
7757
7784
|
}
|
|
@@ -7801,6 +7828,7 @@ var CheckoutDraft = class {
|
|
|
7801
7828
|
});
|
|
7802
7829
|
}
|
|
7803
7830
|
async write(generation, selections) {
|
|
7831
|
+
await this.readResumed(generation);
|
|
7804
7832
|
let written;
|
|
7805
7833
|
if (this.checkoutId === void 0 || this.version === void 0) {
|
|
7806
7834
|
written = await this.transport.createCheckout(selections);
|
|
@@ -7862,6 +7890,20 @@ var CheckoutDraft = class {
|
|
|
7862
7890
|
return this.finalizeOnce(generation, false);
|
|
7863
7891
|
}
|
|
7864
7892
|
}
|
|
7893
|
+
/**
|
|
7894
|
+
* A resumed checkout is read before it is written or finalized: a write
|
|
7895
|
+
* ahead of the read would open a second checkout beside it, and the read's
|
|
7896
|
+
* answer would then point the draft back at the first.
|
|
7897
|
+
*/
|
|
7898
|
+
async readResumed(generation) {
|
|
7899
|
+
if (this.checkoutId === void 0 || this.version !== void 0) {
|
|
7900
|
+
return;
|
|
7901
|
+
}
|
|
7902
|
+
await this.load();
|
|
7903
|
+
if (generation !== this.generation) {
|
|
7904
|
+
throw new Error("The checkout was reset before it was read.");
|
|
7905
|
+
}
|
|
7906
|
+
}
|
|
7865
7907
|
async refresh(generation) {
|
|
7866
7908
|
if (this.checkoutId === void 0) {
|
|
7867
7909
|
return void 0;
|
|
@@ -11401,7 +11443,7 @@ function staticSource(data) {
|
|
|
11401
11443
|
}
|
|
11402
11444
|
|
|
11403
11445
|
// src/version.ts
|
|
11404
|
-
var version2 = "1.
|
|
11446
|
+
var version2 = "1.17.0";
|
|
11405
11447
|
|
|
11406
11448
|
// src/context/schematic.tsx
|
|
11407
11449
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
@@ -1605,6 +1605,18 @@ declare interface CatalogCompanyPlanResponseData {
|
|
|
1605
1605
|
* @memberof CatalogCompanyPlanResponseData
|
|
1606
1606
|
*/
|
|
1607
1607
|
current: boolean;
|
|
1608
|
+
/**
|
|
1609
|
+
* True for the catalog's custom plan, the one sold by quote: show custom_plan_cta in place of its price and action.
|
|
1610
|
+
* @type {boolean}
|
|
1611
|
+
* @memberof CatalogCompanyPlanResponseData
|
|
1612
|
+
*/
|
|
1613
|
+
custom: boolean;
|
|
1614
|
+
/**
|
|
1615
|
+
* The custom plan's price text and call to action; set only where custom is true.
|
|
1616
|
+
* @type {CatalogCustomPlanCTAResponseData}
|
|
1617
|
+
* @memberof CatalogCompanyPlanResponseData
|
|
1618
|
+
*/
|
|
1619
|
+
customPlanCta?: CatalogCustomPlanCTAResponseData | null;
|
|
1608
1620
|
/**
|
|
1609
1621
|
*
|
|
1610
1622
|
* @type {string}
|
|
@@ -2205,6 +2217,18 @@ declare interface CatalogPlanResponseData {
|
|
|
2205
2217
|
* @memberof CatalogPlanResponseData
|
|
2206
2218
|
*/
|
|
2207
2219
|
currencyPrices: Array<CatalogCurrencyPricesResponseData>;
|
|
2220
|
+
/**
|
|
2221
|
+
* True for the catalog's custom plan, the one sold by quote: show custom_plan_cta in place of its price and action.
|
|
2222
|
+
* @type {boolean}
|
|
2223
|
+
* @memberof CatalogPlanResponseData
|
|
2224
|
+
*/
|
|
2225
|
+
custom: boolean;
|
|
2226
|
+
/**
|
|
2227
|
+
* The custom plan's price text and call to action; set only where custom is true.
|
|
2228
|
+
* @type {CatalogCustomPlanCTAResponseData}
|
|
2229
|
+
* @memberof CatalogPlanResponseData
|
|
2230
|
+
*/
|
|
2231
|
+
customPlanCta?: CatalogCustomPlanCTAResponseData | null;
|
|
2208
2232
|
/**
|
|
2209
2233
|
*
|
|
2210
2234
|
* @type {string}
|
|
@@ -2516,7 +2540,7 @@ declare interface CheckFlagResponseData {
|
|
|
2516
2540
|
* @type {FeatureEntitlement}
|
|
2517
2541
|
* @memberof CheckFlagResponseData
|
|
2518
2542
|
*/
|
|
2519
|
-
entitlement?: FeatureEntitlement;
|
|
2543
|
+
entitlement?: FeatureEntitlement | null;
|
|
2520
2544
|
/**
|
|
2521
2545
|
* If an error occurred while checking the flag, the error message
|
|
2522
2546
|
* @type {string}
|
|
@@ -2763,6 +2787,8 @@ export declare class CheckoutDraft {
|
|
|
2763
2787
|
/** Bumped by reset, so an answer for a discarded draft lands nowhere. */
|
|
2764
2788
|
private generation;
|
|
2765
2789
|
private inFlight;
|
|
2790
|
+
/** The read of a resumed checkout, while one is out. */
|
|
2791
|
+
private loading;
|
|
2766
2792
|
private queued;
|
|
2767
2793
|
constructor(transport: CheckoutTransport, options?: CheckoutDraftOptions);
|
|
2768
2794
|
/**
|
|
@@ -2774,7 +2800,8 @@ export declare class CheckoutDraft {
|
|
|
2774
2800
|
subscribe(listener: () => void): () => void;
|
|
2775
2801
|
/**
|
|
2776
2802
|
* Reads the checkout this draft was opened on, for a resume. A draft with
|
|
2777
|
-
* no checkout yet has nothing to read.
|
|
2803
|
+
* no checkout yet has nothing to read. A call while a read is out shares
|
|
2804
|
+
* its answer.
|
|
2778
2805
|
*/
|
|
2779
2806
|
load(): Promise<Checkout | undefined>;
|
|
2780
2807
|
/**
|
|
@@ -2802,13 +2829,22 @@ export declare class CheckoutDraft {
|
|
|
2802
2829
|
*/
|
|
2803
2830
|
private updateWithReplay;
|
|
2804
2831
|
private finalizeOnce;
|
|
2832
|
+
/**
|
|
2833
|
+
* A resumed checkout is read before it is written or finalized: a write
|
|
2834
|
+
* ahead of the read would open a second checkout beside it, and the read's
|
|
2835
|
+
* answer would then point the draft back at the first.
|
|
2836
|
+
*/
|
|
2837
|
+
private readResumed;
|
|
2805
2838
|
private refresh;
|
|
2806
2839
|
private adopt;
|
|
2807
2840
|
private update;
|
|
2808
2841
|
}
|
|
2809
2842
|
|
|
2810
2843
|
declare interface CheckoutDraftOptions {
|
|
2811
|
-
/**
|
|
2844
|
+
/**
|
|
2845
|
+
* Resume this checkout rather than opening one on the first write. The
|
|
2846
|
+
* draft reads it before the first write or finalize.
|
|
2847
|
+
*/
|
|
2812
2848
|
checkoutId?: string;
|
|
2813
2849
|
}
|
|
2814
2850
|
|
|
@@ -5197,18 +5233,18 @@ declare interface CompanyUserUsageResponseData {
|
|
|
5197
5233
|
* signature (`iat.exp.sig`) for the given context.
|
|
5198
5234
|
*
|
|
5199
5235
|
* Because a publishable key is public, the signature must be produced by the
|
|
5200
|
-
* customer's backend, which holds the matching secret API key.
|
|
5201
|
-
*
|
|
5236
|
+
* customer's backend, which holds the matching secret API key. The backend
|
|
5237
|
+
* signs only the company and user of the logged-in user, read from its own
|
|
5238
|
+
* session. A typical implementation calls an authenticated endpoint with no
|
|
5239
|
+
* body and returns the
|
|
5202
5240
|
* `X-Schematic-Context-Sig` value it computes:
|
|
5203
5241
|
*
|
|
5204
5242
|
* ```ts
|
|
5205
5243
|
* const schematic = new Schematic(pubKey, {
|
|
5206
|
-
* getContextSignature: async (
|
|
5244
|
+
* getContextSignature: async () => {
|
|
5207
5245
|
* const res = await fetch("/api/schematic/sign", {
|
|
5208
5246
|
* method: "POST",
|
|
5209
5247
|
* credentials: "include",
|
|
5210
|
-
* headers: { "Content-Type": "application/json" },
|
|
5211
|
-
* body: JSON.stringify(context),
|
|
5212
5248
|
* });
|
|
5213
5249
|
* const { signature } = await res.json();
|
|
5214
5250
|
* return signature; // "iat.exp.sig"
|
|
@@ -5355,7 +5391,7 @@ declare interface CreditSpendPolicy_2 {
|
|
|
5355
5391
|
* @type {CreditSpendWindow}
|
|
5356
5392
|
* @memberof CreditSpendPolicy
|
|
5357
5393
|
*/
|
|
5358
|
-
window?: CreditSpendWindow_2;
|
|
5394
|
+
window?: CreditSpendWindow_2 | null;
|
|
5359
5395
|
}
|
|
5360
5396
|
|
|
5361
5397
|
/** How a spend policy applies its limit. Unknown kinds are carried, not dropped:
|
|
@@ -6956,8 +6992,9 @@ export declare type SchematicOptions = {
|
|
|
6956
6992
|
* (`iat.exp.sig`) for a given context. Required only when the Schematic
|
|
6957
6993
|
* environment has context-signature verification enabled. Because a
|
|
6958
6994
|
* publishable key is public, the signature must be produced by your backend
|
|
6959
|
-
* (which holds the matching secret API key)
|
|
6960
|
-
*
|
|
6995
|
+
* (which holds the matching secret API key), and it signs only the company
|
|
6996
|
+
* and user of the logged-in user; this function typically calls that
|
|
6997
|
+
* backend and returns the value it computes. The SDK
|
|
6961
6998
|
* caches the signature per context, derives its expiry from the returned
|
|
6962
6999
|
* string, and attaches it as the `X-Schematic-Context-Sig` header on flag
|
|
6963
7000
|
* checks, the WebSocket bootstrap, and events. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// node_modules/.pnpm/@schematichq+schematic-js@1.
|
|
1
|
+
// node_modules/.pnpm/@schematichq+schematic-js@1.17.0/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.17.0";
|
|
1333
1333
|
var DEFAULT_CATALOG_QUERY = {};
|
|
1334
1334
|
function normalizeCatalogQuery(query) {
|
|
1335
1335
|
return query.catalogId === void 0 ? {} : { catalogId: query.catalogId };
|
|
@@ -1437,9 +1437,9 @@ __export(models_exports, {
|
|
|
1437
1437
|
CatalogCurrencyPricesResponseDataToJSON: () => CatalogCurrencyPricesResponseDataToJSON2,
|
|
1438
1438
|
CatalogCurrencyPricesResponseDataToJSONTyped: () => CatalogCurrencyPricesResponseDataToJSONTyped4,
|
|
1439
1439
|
CatalogCustomPlanCTAResponseDataFromJSON: () => CatalogCustomPlanCTAResponseDataFromJSON2,
|
|
1440
|
-
CatalogCustomPlanCTAResponseDataFromJSONTyped: () =>
|
|
1440
|
+
CatalogCustomPlanCTAResponseDataFromJSONTyped: () => CatalogCustomPlanCTAResponseDataFromJSONTyped4,
|
|
1441
1441
|
CatalogCustomPlanCTAResponseDataToJSON: () => CatalogCustomPlanCTAResponseDataToJSON2,
|
|
1442
|
-
CatalogCustomPlanCTAResponseDataToJSONTyped: () =>
|
|
1442
|
+
CatalogCustomPlanCTAResponseDataToJSONTyped: () => CatalogCustomPlanCTAResponseDataToJSONTyped4,
|
|
1443
1443
|
CatalogPlanEntitlementResponseDataFromJSON: () => CatalogPlanEntitlementResponseDataFromJSON2,
|
|
1444
1444
|
CatalogPlanEntitlementResponseDataFromJSONTyped: () => CatalogPlanEntitlementResponseDataFromJSONTyped2,
|
|
1445
1445
|
CatalogPlanEntitlementResponseDataToJSON: () => CatalogPlanEntitlementResponseDataToJSON2,
|
|
@@ -2958,6 +2958,35 @@ function CatalogUsageViolationResponseDataToJSONTyped(value, ignoreDiscriminator
|
|
|
2958
2958
|
usage: value["usage"]
|
|
2959
2959
|
};
|
|
2960
2960
|
}
|
|
2961
|
+
function instanceOfCatalogCustomPlanCTAResponseData(value) {
|
|
2962
|
+
return true;
|
|
2963
|
+
}
|
|
2964
|
+
function CatalogCustomPlanCTAResponseDataFromJSON2(json) {
|
|
2965
|
+
return CatalogCustomPlanCTAResponseDataFromJSONTyped4(json, false);
|
|
2966
|
+
}
|
|
2967
|
+
function CatalogCustomPlanCTAResponseDataFromJSONTyped4(json, ignoreDiscriminator) {
|
|
2968
|
+
if (json == null) {
|
|
2969
|
+
return json;
|
|
2970
|
+
}
|
|
2971
|
+
return {
|
|
2972
|
+
ctaText: json["cta_text"] == null ? void 0 : json["cta_text"],
|
|
2973
|
+
ctaUrl: json["cta_url"] == null ? void 0 : json["cta_url"],
|
|
2974
|
+
priceText: json["price_text"] == null ? void 0 : json["price_text"]
|
|
2975
|
+
};
|
|
2976
|
+
}
|
|
2977
|
+
function CatalogCustomPlanCTAResponseDataToJSON2(json) {
|
|
2978
|
+
return CatalogCustomPlanCTAResponseDataToJSONTyped4(json, false);
|
|
2979
|
+
}
|
|
2980
|
+
function CatalogCustomPlanCTAResponseDataToJSONTyped4(value, ignoreDiscriminator = false) {
|
|
2981
|
+
if (value == null) {
|
|
2982
|
+
return value;
|
|
2983
|
+
}
|
|
2984
|
+
return {
|
|
2985
|
+
cta_text: value["ctaText"],
|
|
2986
|
+
cta_url: value["ctaUrl"],
|
|
2987
|
+
price_text: value["priceText"]
|
|
2988
|
+
};
|
|
2989
|
+
}
|
|
2961
2990
|
var EntitlementValueType = {
|
|
2962
2991
|
Boolean: "boolean",
|
|
2963
2992
|
Credit: "credit",
|
|
@@ -3391,6 +3420,7 @@ function instanceOfCatalogCompanyPlanResponseData(value) {
|
|
|
3391
3420
|
if (!("currencyPrices" in value) || value["currencyPrices"] === void 0)
|
|
3392
3421
|
return false;
|
|
3393
3422
|
if (!("current" in value) || value["current"] === void 0) return false;
|
|
3423
|
+
if (!("custom" in value) || value["custom"] === void 0) return false;
|
|
3394
3424
|
if (!("description" in value) || value["description"] === void 0)
|
|
3395
3425
|
return false;
|
|
3396
3426
|
if (!("entitlements" in value) || value["entitlements"] === void 0)
|
|
@@ -3429,6 +3459,8 @@ function CatalogCompanyPlanResponseDataFromJSONTyped(json, ignoreDiscriminator)
|
|
|
3429
3459
|
CatalogCurrencyPricesResponseDataFromJSON2
|
|
3430
3460
|
),
|
|
3431
3461
|
current: json["current"],
|
|
3462
|
+
custom: json["custom"],
|
|
3463
|
+
customPlanCta: json["custom_plan_cta"] == null ? void 0 : CatalogCustomPlanCTAResponseDataFromJSON2(json["custom_plan_cta"]),
|
|
3432
3464
|
description: json["description"],
|
|
3433
3465
|
entitlements: json["entitlements"].map(
|
|
3434
3466
|
CatalogPlanEntitlementResponseDataFromJSON2
|
|
@@ -3474,6 +3506,10 @@ function CatalogCompanyPlanResponseDataToJSONTyped(value, ignoreDiscriminator =
|
|
|
3474
3506
|
CatalogCurrencyPricesResponseDataToJSON2
|
|
3475
3507
|
),
|
|
3476
3508
|
current: value["current"],
|
|
3509
|
+
custom: value["custom"],
|
|
3510
|
+
custom_plan_cta: CatalogCustomPlanCTAResponseDataToJSON2(
|
|
3511
|
+
value["customPlanCta"]
|
|
3512
|
+
),
|
|
3477
3513
|
description: value["description"],
|
|
3478
3514
|
entitlements: value["entitlements"].map(
|
|
3479
3515
|
CatalogPlanEntitlementResponseDataToJSON2
|
|
@@ -3569,35 +3605,6 @@ function CatalogCreditBundleResponseDataToJSONTyped2(value, ignoreDiscriminator
|
|
|
3569
3605
|
unit_price: CatalogPriceResponseDataToJSON2(value["unitPrice"])
|
|
3570
3606
|
};
|
|
3571
3607
|
}
|
|
3572
|
-
function instanceOfCatalogCustomPlanCTAResponseData(value) {
|
|
3573
|
-
return true;
|
|
3574
|
-
}
|
|
3575
|
-
function CatalogCustomPlanCTAResponseDataFromJSON2(json) {
|
|
3576
|
-
return CatalogCustomPlanCTAResponseDataFromJSONTyped3(json, false);
|
|
3577
|
-
}
|
|
3578
|
-
function CatalogCustomPlanCTAResponseDataFromJSONTyped3(json, ignoreDiscriminator) {
|
|
3579
|
-
if (json == null) {
|
|
3580
|
-
return json;
|
|
3581
|
-
}
|
|
3582
|
-
return {
|
|
3583
|
-
ctaText: json["cta_text"] == null ? void 0 : json["cta_text"],
|
|
3584
|
-
ctaUrl: json["cta_url"] == null ? void 0 : json["cta_url"],
|
|
3585
|
-
priceText: json["price_text"] == null ? void 0 : json["price_text"]
|
|
3586
|
-
};
|
|
3587
|
-
}
|
|
3588
|
-
function CatalogCustomPlanCTAResponseDataToJSON2(json) {
|
|
3589
|
-
return CatalogCustomPlanCTAResponseDataToJSONTyped3(json, false);
|
|
3590
|
-
}
|
|
3591
|
-
function CatalogCustomPlanCTAResponseDataToJSONTyped3(value, ignoreDiscriminator = false) {
|
|
3592
|
-
if (value == null) {
|
|
3593
|
-
return value;
|
|
3594
|
-
}
|
|
3595
|
-
return {
|
|
3596
|
-
cta_text: value["ctaText"],
|
|
3597
|
-
cta_url: value["ctaUrl"],
|
|
3598
|
-
price_text: value["priceText"]
|
|
3599
|
-
};
|
|
3600
|
-
}
|
|
3601
3608
|
function instanceOfCatalogPlanRefResponseData(value) {
|
|
3602
3609
|
if (!("id" in value) || value["id"] === void 0) return false;
|
|
3603
3610
|
if (!("name" in value) || value["name"] === void 0) return false;
|
|
@@ -3636,6 +3643,7 @@ function instanceOfCatalogPlanResponseData(value) {
|
|
|
3636
3643
|
return false;
|
|
3637
3644
|
if (!("currencyPrices" in value) || value["currencyPrices"] === void 0)
|
|
3638
3645
|
return false;
|
|
3646
|
+
if (!("custom" in value) || value["custom"] === void 0) return false;
|
|
3639
3647
|
if (!("description" in value) || value["description"] === void 0)
|
|
3640
3648
|
return false;
|
|
3641
3649
|
if (!("entitlements" in value) || value["entitlements"] === void 0)
|
|
@@ -3666,6 +3674,8 @@ function CatalogPlanResponseDataFromJSONTyped2(json, ignoreDiscriminator) {
|
|
|
3666
3674
|
currencyPrices: json["currency_prices"].map(
|
|
3667
3675
|
CatalogCurrencyPricesResponseDataFromJSON2
|
|
3668
3676
|
),
|
|
3677
|
+
custom: json["custom"],
|
|
3678
|
+
customPlanCta: json["custom_plan_cta"] == null ? void 0 : CatalogCustomPlanCTAResponseDataFromJSON2(json["custom_plan_cta"]),
|
|
3669
3679
|
description: json["description"],
|
|
3670
3680
|
entitlements: json["entitlements"].map(
|
|
3671
3681
|
CatalogPlanEntitlementResponseDataFromJSON2
|
|
@@ -3701,6 +3711,10 @@ function CatalogPlanResponseDataToJSONTyped2(value, ignoreDiscriminator = false)
|
|
|
3701
3711
|
currency_prices: value["currencyPrices"].map(
|
|
3702
3712
|
CatalogCurrencyPricesResponseDataToJSON2
|
|
3703
3713
|
),
|
|
3714
|
+
custom: value["custom"],
|
|
3715
|
+
custom_plan_cta: CatalogCustomPlanCTAResponseDataToJSON2(
|
|
3716
|
+
value["customPlanCta"]
|
|
3717
|
+
),
|
|
3704
3718
|
description: value["description"],
|
|
3705
3719
|
entitlements: value["entitlements"].map(
|
|
3706
3720
|
CatalogPlanEntitlementResponseDataToJSON2
|
|
@@ -7575,6 +7589,8 @@ var CheckoutDraft = class {
|
|
|
7575
7589
|
/** Bumped by reset, so an answer for a discarded draft lands nowhere. */
|
|
7576
7590
|
generation = 0;
|
|
7577
7591
|
inFlight;
|
|
7592
|
+
/** The read of a resumed checkout, while one is out. */
|
|
7593
|
+
loading;
|
|
7578
7594
|
queued;
|
|
7579
7595
|
constructor(transport, options = {}) {
|
|
7580
7596
|
this.transport = transport;
|
|
@@ -7600,10 +7616,19 @@ var CheckoutDraft = class {
|
|
|
7600
7616
|
}
|
|
7601
7617
|
/**
|
|
7602
7618
|
* Reads the checkout this draft was opened on, for a resume. A draft with
|
|
7603
|
-
* no checkout yet has nothing to read.
|
|
7619
|
+
* no checkout yet has nothing to read. A call while a read is out shares
|
|
7620
|
+
* its answer.
|
|
7604
7621
|
*/
|
|
7605
7622
|
load() {
|
|
7606
|
-
|
|
7623
|
+
if (this.loading === void 0) {
|
|
7624
|
+
const generation = this.generation;
|
|
7625
|
+
this.loading = this.refresh(generation).finally(() => {
|
|
7626
|
+
if (generation === this.generation) {
|
|
7627
|
+
this.loading = void 0;
|
|
7628
|
+
}
|
|
7629
|
+
});
|
|
7630
|
+
}
|
|
7631
|
+
return this.loading;
|
|
7607
7632
|
}
|
|
7608
7633
|
/**
|
|
7609
7634
|
* Replaces the cart and re-prices it. Resolves with the checkout the write
|
|
@@ -7636,11 +7661,12 @@ var CheckoutDraft = class {
|
|
|
7636
7661
|
if (generation !== this.generation) {
|
|
7637
7662
|
throw new Error("The checkout was reset before it was finalized.");
|
|
7638
7663
|
}
|
|
7639
|
-
if (this.checkoutId === void 0
|
|
7664
|
+
if (this.checkoutId === void 0) {
|
|
7640
7665
|
throw new Error("There is no checkout to finalize yet.");
|
|
7641
7666
|
}
|
|
7642
7667
|
this.update({ isFinalizing: true, error: void 0 });
|
|
7643
7668
|
try {
|
|
7669
|
+
await this.readResumed(generation);
|
|
7644
7670
|
const result = await this.finalizeOnce(generation, true);
|
|
7645
7671
|
if (generation === this.generation) {
|
|
7646
7672
|
this.update({ isFinalizing: false, result });
|
|
@@ -7668,6 +7694,7 @@ var CheckoutDraft = class {
|
|
|
7668
7694
|
const queued = this.queued;
|
|
7669
7695
|
this.queued = void 0;
|
|
7670
7696
|
this.inFlight = void 0;
|
|
7697
|
+
this.loading = void 0;
|
|
7671
7698
|
queued?.waiters.forEach((w) => w.resolve(void 0));
|
|
7672
7699
|
this.update({ ...INITIAL_STATE });
|
|
7673
7700
|
}
|
|
@@ -7717,6 +7744,7 @@ var CheckoutDraft = class {
|
|
|
7717
7744
|
});
|
|
7718
7745
|
}
|
|
7719
7746
|
async write(generation, selections) {
|
|
7747
|
+
await this.readResumed(generation);
|
|
7720
7748
|
let written;
|
|
7721
7749
|
if (this.checkoutId === void 0 || this.version === void 0) {
|
|
7722
7750
|
written = await this.transport.createCheckout(selections);
|
|
@@ -7778,6 +7806,20 @@ var CheckoutDraft = class {
|
|
|
7778
7806
|
return this.finalizeOnce(generation, false);
|
|
7779
7807
|
}
|
|
7780
7808
|
}
|
|
7809
|
+
/**
|
|
7810
|
+
* A resumed checkout is read before it is written or finalized: a write
|
|
7811
|
+
* ahead of the read would open a second checkout beside it, and the read's
|
|
7812
|
+
* answer would then point the draft back at the first.
|
|
7813
|
+
*/
|
|
7814
|
+
async readResumed(generation) {
|
|
7815
|
+
if (this.checkoutId === void 0 || this.version !== void 0) {
|
|
7816
|
+
return;
|
|
7817
|
+
}
|
|
7818
|
+
await this.load();
|
|
7819
|
+
if (generation !== this.generation) {
|
|
7820
|
+
throw new Error("The checkout was reset before it was read.");
|
|
7821
|
+
}
|
|
7822
|
+
}
|
|
7781
7823
|
async refresh(generation) {
|
|
7782
7824
|
if (this.checkoutId === void 0) {
|
|
7783
7825
|
return void 0;
|
|
@@ -11324,7 +11366,7 @@ function staticSource(data) {
|
|
|
11324
11366
|
}
|
|
11325
11367
|
|
|
11326
11368
|
// src/version.ts
|
|
11327
|
-
var version2 = "1.
|
|
11369
|
+
var version2 = "1.17.0";
|
|
11328
11370
|
|
|
11329
11371
|
// src/context/schematic.tsx
|
|
11330
11372
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schematichq/schematic-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"main": "dist/schematic-react.cjs.js",
|
|
5
5
|
"module": "dist/schematic-react.esm.js",
|
|
6
6
|
"types": "dist/schematic-react.d.ts",
|
|
@@ -33,27 +33,27 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@eslint/js": "^10.0.1",
|
|
36
|
-
"@microsoft/api-extractor": "^7.
|
|
37
|
-
"@schematichq/schematic-js": "^1.
|
|
36
|
+
"@microsoft/api-extractor": "^7.60.1",
|
|
37
|
+
"@schematichq/schematic-js": "^1.17.0",
|
|
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",
|
|
41
41
|
"@types/react": "^19.3.0",
|
|
42
42
|
"@vitest/browser": "^5.0.5",
|
|
43
43
|
"esbuild": "^0.28.2",
|
|
44
|
-
"eslint": "^10.
|
|
44
|
+
"eslint": "^10.14.0",
|
|
45
45
|
"eslint-plugin-import": "^2.32.0",
|
|
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
|
-
"jsdom": "^30.1.
|
|
52
|
-
"prettier": "^3.9.
|
|
53
|
-
"react": "^19.3.
|
|
54
|
-
"react-dom": "^19.3.
|
|
51
|
+
"jsdom": "^30.1.3",
|
|
52
|
+
"prettier": "^3.9.10",
|
|
53
|
+
"react": "^19.3.1",
|
|
54
|
+
"react-dom": "^19.3.1",
|
|
55
55
|
"typescript": "^6.0.3",
|
|
56
|
-
"typescript-eslint": "^8.
|
|
56
|
+
"typescript-eslint": "^8.72.1",
|
|
57
57
|
"vitest": "^5.0.5"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|