@cimplify/sdk 0.85.0 → 0.86.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/advanced.d.mts +3 -3
- package/dist/advanced.d.ts +3 -3
- package/dist/advanced.js +22 -22
- package/dist/advanced.mjs +3 -3
- package/dist/{chunk-DU4IX2I2.mjs → chunk-A2GXDCSI.mjs} +2 -2
- package/dist/{chunk-XA3ZNR75.js → chunk-AETVRBKI.js} +1 -1
- package/dist/{chunk-GIFVSWYJ.mjs → chunk-D6JWYYTG.mjs} +2 -2
- package/dist/{chunk-A6J7W6DH.js → chunk-ESGKWRQS.js} +4 -4
- package/dist/{chunk-GFM5JW45.js → chunk-HJEKXCG2.js} +62 -62
- package/dist/{chunk-AMZXALF6.mjs → chunk-K5EN2W2Q.mjs} +1 -1
- package/dist/{chunk-TD3AY34U.mjs → chunk-KFLGQGMC.mjs} +3 -3
- package/dist/{chunk-NWUEWUX2.mjs → chunk-MRL53WP6.mjs} +2 -2
- package/dist/{chunk-7BM56JET.mjs → chunk-NN3WC7XZ.mjs} +3 -3
- package/dist/{chunk-7Y2O3E4D.js → chunk-PTPOQVXS.js} +5 -5
- package/dist/{chunk-HPN5R3K2.js → chunk-VUG4HTUM.js} +23 -23
- package/dist/{chunk-NWTCBGJ2.js → chunk-X4UNISYG.js} +4 -4
- package/dist/{client-WKKxIiF1.d.ts → client-BQSRj4iK.d.mts} +528 -539
- package/dist/{client-DLtwQ-jI.d.mts → client-BdI24jUT.d.ts} +528 -539
- package/dist/{client-BT5gaiGR.d.ts → client-CMJO_8zo.d.ts} +2 -2
- package/dist/{client-BEhIE0Dm.d.mts → client-DowGNrTh.d.mts} +2 -2
- package/dist/{index-BrC1x2kK.d.ts → index-BRwHpMY-.d.ts} +3 -3
- package/dist/{index-DZz6hdrT.d.mts → index-DLb_Ldl6.d.mts} +3 -3
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +117 -117
- package/dist/index.mjs +5 -5
- package/dist/mock/cli.mjs +2 -2
- package/dist/mock/library.js +2 -2
- package/dist/mock/library.mjs +2 -2
- package/dist/mock/msw.js +2 -2
- package/dist/mock/msw.mjs +2 -2
- package/dist/{payment-D1f3ZQPC.d.ts → payment-BA7KNBxg.d.ts} +3 -3
- package/dist/{payment-Dh-6cRcV.d.mts → payment-CFev-fOE.d.mts} +3 -3
- package/dist/{price-CQdOJoX-.d.ts → price-BNhGVB5q.d.ts} +1 -1
- package/dist/{price-4T7dlhxM.d.mts → price-nRxqVNGq.d.mts} +1 -1
- package/dist/product-BGxIfTqJ.d.mts +5400 -0
- package/dist/product-BGxIfTqJ.d.ts +5400 -0
- package/dist/react.d.mts +6 -6
- package/dist/react.d.ts +6 -6
- package/dist/react.js +139 -139
- package/dist/react.mjs +19 -19
- package/dist/{server-DjK98UW-.d.mts → server-9u0LiG5U.d.mts} +1 -1
- package/dist/{server-DvThXldo.d.ts → server-BH7DTaaz.d.ts} +1 -1
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +10 -10
- package/dist/server.mjs +4 -4
- package/dist/testing/msw.d.mts +2 -2
- package/dist/testing/msw.d.ts +2 -2
- package/dist/testing/msw.js +3 -3
- package/dist/testing/msw.mjs +2 -2
- package/dist/testing/suite.d.mts +6 -6
- package/dist/testing/suite.d.ts +6 -6
- package/dist/testing/suite.js +25 -25
- package/dist/testing/suite.mjs +6 -6
- package/dist/testing.d.mts +5 -5
- package/dist/testing.d.ts +5 -5
- package/dist/testing.js +81 -81
- package/dist/testing.mjs +7 -7
- package/dist/utils.d.mts +4 -4
- package/dist/utils.d.ts +4 -4
- package/dist/utils.js +29 -29
- package/dist/utils.mjs +2 -2
- package/package.json +5 -2
- package/registry/currency-selector.json +1 -1
- package/registry/digital-product-card.json +1 -1
- package/registry/digital-product-layout.json +1 -1
- package/dist/product-RJMIdCAf.d.mts +0 -1582
- package/dist/product-RJMIdCAf.d.ts +0 -1582
package/dist/advanced.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { k as AuthService, C as BusinessService,
|
|
2
|
-
import './product-
|
|
3
|
-
import './payment-
|
|
1
|
+
export { k as AuthService, C as BusinessService, O as CartOperations, P as CatalogueQueries, a8 as CheckoutOperations, a8 as CheckoutService, ae as CimplifyElement, af as CimplifyElements, aG as ELEMENT_TYPES, aH as EVENT_TYPES, aK as ElementEventType, aL as ElementOptions, aM as ElementType, aU as ElementsOptions, b0 as FetchQuoteInput, b9 as FxService, bd as GetProductsOptions, bg as InventoryService, bo as LinkService, bs as LiteService, bz as MESSAGE_TYPES, b$ as OrderQueries, cl as PriceQuote, cr as QuoteBundleSelectionInput, cs as QuoteCompositeSelectionInput, ct as QuoteDynamicBuckets, cu as QuoteStatus, cv as QuoteUiMessage, cx as RefreshQuoteInput, cy as RefreshQuoteResult, cZ as SchedulingService, dE as createElements } from './client-BQSRj4iK.mjs';
|
|
2
|
+
import './product-BGxIfTqJ.mjs';
|
|
3
|
+
import './payment-CFev-fOE.mjs';
|
|
4
4
|
|
|
5
5
|
declare function generateIdempotencyKey(prefix?: string): string;
|
|
6
6
|
|
package/dist/advanced.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { k as AuthService, C as BusinessService,
|
|
2
|
-
import './product-
|
|
3
|
-
import './payment-
|
|
1
|
+
export { k as AuthService, C as BusinessService, O as CartOperations, P as CatalogueQueries, a8 as CheckoutOperations, a8 as CheckoutService, ae as CimplifyElement, af as CimplifyElements, aG as ELEMENT_TYPES, aH as EVENT_TYPES, aK as ElementEventType, aL as ElementOptions, aM as ElementType, aU as ElementsOptions, b0 as FetchQuoteInput, b9 as FxService, bd as GetProductsOptions, bg as InventoryService, bo as LinkService, bs as LiteService, bz as MESSAGE_TYPES, b$ as OrderQueries, cl as PriceQuote, cr as QuoteBundleSelectionInput, cs as QuoteCompositeSelectionInput, ct as QuoteDynamicBuckets, cu as QuoteStatus, cv as QuoteUiMessage, cx as RefreshQuoteInput, cy as RefreshQuoteResult, cZ as SchedulingService, dE as createElements } from './client-BdI24jUT.js';
|
|
2
|
+
import './product-BGxIfTqJ.js';
|
|
3
|
+
import './payment-BA7KNBxg.js';
|
|
4
4
|
|
|
5
5
|
declare function generateIdempotencyKey(prefix?: string): string;
|
|
6
6
|
|
package/dist/advanced.js
CHANGED
|
@@ -1,85 +1,85 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var chunkVUG4HTUM_js = require('./chunk-VUG4HTUM.js');
|
|
4
|
+
require('./chunk-PTPOQVXS.js');
|
|
5
|
+
require('./chunk-AETVRBKI.js');
|
|
6
6
|
require('./chunk-OWW5GUSB.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "AuthService", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkVUG4HTUM_js.AuthService; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "BusinessService", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkVUG4HTUM_js.BusinessService; }
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "CartOperations", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunkVUG4HTUM_js.CartOperations; }
|
|
21
21
|
});
|
|
22
22
|
Object.defineProperty(exports, "CatalogueQueries", {
|
|
23
23
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunkVUG4HTUM_js.CatalogueQueries; }
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "CheckoutOperations", {
|
|
27
27
|
enumerable: true,
|
|
28
|
-
get: function () { return
|
|
28
|
+
get: function () { return chunkVUG4HTUM_js.CheckoutService; }
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "CheckoutService", {
|
|
31
31
|
enumerable: true,
|
|
32
|
-
get: function () { return
|
|
32
|
+
get: function () { return chunkVUG4HTUM_js.CheckoutService; }
|
|
33
33
|
});
|
|
34
34
|
Object.defineProperty(exports, "CimplifyElement", {
|
|
35
35
|
enumerable: true,
|
|
36
|
-
get: function () { return
|
|
36
|
+
get: function () { return chunkVUG4HTUM_js.CimplifyElement; }
|
|
37
37
|
});
|
|
38
38
|
Object.defineProperty(exports, "CimplifyElements", {
|
|
39
39
|
enumerable: true,
|
|
40
|
-
get: function () { return
|
|
40
|
+
get: function () { return chunkVUG4HTUM_js.CimplifyElements; }
|
|
41
41
|
});
|
|
42
42
|
Object.defineProperty(exports, "ELEMENT_TYPES", {
|
|
43
43
|
enumerable: true,
|
|
44
|
-
get: function () { return
|
|
44
|
+
get: function () { return chunkVUG4HTUM_js.ELEMENT_TYPES; }
|
|
45
45
|
});
|
|
46
46
|
Object.defineProperty(exports, "EVENT_TYPES", {
|
|
47
47
|
enumerable: true,
|
|
48
|
-
get: function () { return
|
|
48
|
+
get: function () { return chunkVUG4HTUM_js.EVENT_TYPES; }
|
|
49
49
|
});
|
|
50
50
|
Object.defineProperty(exports, "FxService", {
|
|
51
51
|
enumerable: true,
|
|
52
|
-
get: function () { return
|
|
52
|
+
get: function () { return chunkVUG4HTUM_js.FxService; }
|
|
53
53
|
});
|
|
54
54
|
Object.defineProperty(exports, "InventoryService", {
|
|
55
55
|
enumerable: true,
|
|
56
|
-
get: function () { return
|
|
56
|
+
get: function () { return chunkVUG4HTUM_js.InventoryService; }
|
|
57
57
|
});
|
|
58
58
|
Object.defineProperty(exports, "LinkService", {
|
|
59
59
|
enumerable: true,
|
|
60
|
-
get: function () { return
|
|
60
|
+
get: function () { return chunkVUG4HTUM_js.LinkService; }
|
|
61
61
|
});
|
|
62
62
|
Object.defineProperty(exports, "LiteService", {
|
|
63
63
|
enumerable: true,
|
|
64
|
-
get: function () { return
|
|
64
|
+
get: function () { return chunkVUG4HTUM_js.LiteService; }
|
|
65
65
|
});
|
|
66
66
|
Object.defineProperty(exports, "MESSAGE_TYPES", {
|
|
67
67
|
enumerable: true,
|
|
68
|
-
get: function () { return
|
|
68
|
+
get: function () { return chunkVUG4HTUM_js.MESSAGE_TYPES; }
|
|
69
69
|
});
|
|
70
70
|
Object.defineProperty(exports, "OrderQueries", {
|
|
71
71
|
enumerable: true,
|
|
72
|
-
get: function () { return
|
|
72
|
+
get: function () { return chunkVUG4HTUM_js.OrderQueries; }
|
|
73
73
|
});
|
|
74
74
|
Object.defineProperty(exports, "SchedulingService", {
|
|
75
75
|
enumerable: true,
|
|
76
|
-
get: function () { return
|
|
76
|
+
get: function () { return chunkVUG4HTUM_js.SchedulingService; }
|
|
77
77
|
});
|
|
78
78
|
Object.defineProperty(exports, "createElements", {
|
|
79
79
|
enumerable: true,
|
|
80
|
-
get: function () { return
|
|
80
|
+
get: function () { return chunkVUG4HTUM_js.createElements; }
|
|
81
81
|
});
|
|
82
82
|
Object.defineProperty(exports, "generateIdempotencyKey", {
|
|
83
83
|
enumerable: true,
|
|
84
|
-
get: function () { return
|
|
84
|
+
get: function () { return chunkVUG4HTUM_js.generateIdempotencyKey; }
|
|
85
85
|
});
|
package/dist/advanced.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AuthService, BusinessService, CartOperations, CatalogueQueries, CheckoutService as CheckoutOperations, CheckoutService, CimplifyElement, CimplifyElements, ELEMENT_TYPES, EVENT_TYPES, FxService, InventoryService, LinkService, LiteService, MESSAGE_TYPES, OrderQueries, SchedulingService, createElements, generateIdempotencyKey } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { AuthService, BusinessService, CartOperations, CatalogueQueries, CheckoutService as CheckoutOperations, CheckoutService, CimplifyElement, CimplifyElements, ELEMENT_TYPES, EVENT_TYPES, FxService, InventoryService, LinkService, LiteService, MESSAGE_TYPES, OrderQueries, SchedulingService, createElements, generateIdempotencyKey } from './chunk-NN3WC7XZ.mjs';
|
|
2
|
+
import './chunk-KFLGQGMC.mjs';
|
|
3
|
+
import './chunk-K5EN2W2Q.mjs';
|
|
4
4
|
import './chunk-3G6RQLXK.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createMockApp } from './chunk-
|
|
2
|
-
import { createCimplifyClient } from './chunk-
|
|
1
|
+
import { createMockApp } from './chunk-D6JWYYTG.mjs';
|
|
2
|
+
import { createCimplifyClient } from './chunk-MRL53WP6.mjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
var cimplifyRegistry = z.registry();
|
|
@@ -155,7 +155,7 @@ var ERROR_SUGGESTIONS = {
|
|
|
155
155
|
INSUFFICIENT_QUANTITY: "Requested quantity exceeds available inventory. Reduce quantity and retry.",
|
|
156
156
|
BUSINESS_ID_REQUIRED: "Business context could not be resolved. Verify the public key and business bootstrap call.",
|
|
157
157
|
INVALID_CART: "Cart is invalid for checkout. Sync cart state, ensure items exist, then retry.",
|
|
158
|
-
ORDER_TYPE_REQUIRED: "Order type is required. Provide one of delivery, pickup, or
|
|
158
|
+
ORDER_TYPE_REQUIRED: "Order type is required. Provide one of delivery, pickup, or dine-in before checkout.",
|
|
159
159
|
NO_PAYMENT_ELEMENT: "PaymentElement is required for processCheckout(). Mount it before triggering checkout.",
|
|
160
160
|
PAYMENT_NOT_MOUNTED: "PaymentElement iframe is not mounted. Mount it in the DOM before processCheckout().",
|
|
161
161
|
AUTH_INCOMPLETE: "AuthElement has not completed authentication. Wait for AUTHENTICATED before checkout.",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ErrorCode } from './chunk-
|
|
1
|
+
import { ErrorCode } from './chunk-K5EN2W2Q.mjs';
|
|
2
2
|
import { __publicField, __privateAdd, __privateSet, __privateGet, __privateMethod, __privateWrapper } from './chunk-3G6RQLXK.mjs';
|
|
3
3
|
|
|
4
4
|
// ../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/compose.js
|
|
@@ -2822,7 +2822,7 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2822
2822
|
'<select id="order-type">' +
|
|
2823
2823
|
' <option value="delivery">Delivery</option>' +
|
|
2824
2824
|
' <option value="pickup">Pickup</option>' +
|
|
2825
|
-
' <option value="
|
|
2825
|
+
' <option value="dine-in">Dine-in</option>' +
|
|
2826
2826
|
'</select>' +
|
|
2827
2827
|
'<label>Customer name</label>' +
|
|
2828
2828
|
'<input id="cust-name" value="' + (qs.get("name") || "Test Customer") + '">' +
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkX4UNISYG_js = require('./chunk-X4UNISYG.js');
|
|
4
|
+
var chunkHJEKXCG2_js = require('./chunk-HJEKXCG2.js');
|
|
5
5
|
var zod = require('zod');
|
|
6
6
|
|
|
7
7
|
var cimplifyRegistry = zod.z.registry();
|
|
@@ -600,7 +600,7 @@ async function toForwardedRequest(input, init) {
|
|
|
600
600
|
};
|
|
601
601
|
}
|
|
602
602
|
function createTestClient(options = {}) {
|
|
603
|
-
const mock =
|
|
603
|
+
const mock = chunkX4UNISYG_js.createMockApp(options);
|
|
604
604
|
let sessionToken;
|
|
605
605
|
const fetchImpl = async (input, init) => {
|
|
606
606
|
const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
|
|
@@ -619,7 +619,7 @@ function createTestClient(options = {}) {
|
|
|
619
619
|
if (echoed) sessionToken = echoed;
|
|
620
620
|
return res;
|
|
621
621
|
};
|
|
622
|
-
const client =
|
|
622
|
+
const client = chunkHJEKXCG2_js.createCimplifyClient({
|
|
623
623
|
baseUrl: TEST_BASE_URL,
|
|
624
624
|
// Link mock lives at /v1/link on the same Hono app, so point the SDK's
|
|
625
625
|
// separate Link transport at the same TEST_BASE_URL.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkVUG4HTUM_js = require('./chunk-VUG4HTUM.js');
|
|
4
|
+
var chunkAETVRBKI_js = require('./chunk-AETVRBKI.js');
|
|
5
5
|
|
|
6
6
|
// src/store-credit.ts
|
|
7
7
|
var StoreCreditQueries = class {
|
|
@@ -13,7 +13,7 @@ var StoreCreditQueries = class {
|
|
|
13
13
|
* currency. Requires a signed-in customer; returns an error otherwise.
|
|
14
14
|
*/
|
|
15
15
|
async balance() {
|
|
16
|
-
return
|
|
16
|
+
return chunkVUG4HTUM_js.safe(this.client.get("/api/v1/store-credit/balance"));
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -95,7 +95,7 @@ var ActivityService = class {
|
|
|
95
95
|
this.sendEvents([event]);
|
|
96
96
|
}
|
|
97
97
|
async getState() {
|
|
98
|
-
return
|
|
98
|
+
return chunkVUG4HTUM_js.safe(this.client.get("/api/v1/activity/state"));
|
|
99
99
|
}
|
|
100
100
|
async getRecommendations(options) {
|
|
101
101
|
const params = new URLSearchParams();
|
|
@@ -103,10 +103,10 @@ var ActivityService = class {
|
|
|
103
103
|
if (options?.limit) params.set("limit", String(options.limit));
|
|
104
104
|
const query = params.toString();
|
|
105
105
|
const path = query ? `/api/v1/activity/recommendations?${query}` : "/api/v1/activity/recommendations";
|
|
106
|
-
return
|
|
106
|
+
return chunkVUG4HTUM_js.safe(this.client.get(path));
|
|
107
107
|
}
|
|
108
108
|
async dismissMessage(code) {
|
|
109
|
-
return
|
|
109
|
+
return chunkVUG4HTUM_js.safe(
|
|
110
110
|
this.client.post("/api/v1/activity/messages/dismiss", { code })
|
|
111
111
|
);
|
|
112
112
|
}
|
|
@@ -142,16 +142,16 @@ var SubscriptionService = class {
|
|
|
142
142
|
this.client = client;
|
|
143
143
|
}
|
|
144
144
|
async list() {
|
|
145
|
-
return
|
|
145
|
+
return chunkVUG4HTUM_js.safe(this.client.get("/api/v1/subscriptions"));
|
|
146
146
|
}
|
|
147
147
|
async get(id) {
|
|
148
148
|
const encodedId = encodeURIComponent(id);
|
|
149
|
-
return
|
|
149
|
+
return chunkVUG4HTUM_js.safe(this.client.get(`/api/v1/subscriptions/${encodedId}`));
|
|
150
150
|
}
|
|
151
151
|
async cancel(id, reason, opts) {
|
|
152
152
|
const encodedId = encodeURIComponent(id);
|
|
153
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
154
|
-
return
|
|
153
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkVUG4HTUM_js.generateIdempotencyKey();
|
|
154
|
+
return chunkVUG4HTUM_js.safe(
|
|
155
155
|
this.client.post(
|
|
156
156
|
`/api/v1/subscriptions/${encodedId}/cancel`,
|
|
157
157
|
{ reason },
|
|
@@ -161,20 +161,20 @@ var SubscriptionService = class {
|
|
|
161
161
|
}
|
|
162
162
|
async pause(id) {
|
|
163
163
|
const encodedId = encodeURIComponent(id);
|
|
164
|
-
return
|
|
164
|
+
return chunkVUG4HTUM_js.safe(
|
|
165
165
|
this.client.post(`/api/v1/subscriptions/${encodedId}/pause`)
|
|
166
166
|
);
|
|
167
167
|
}
|
|
168
168
|
async resume(id) {
|
|
169
169
|
const encodedId = encodeURIComponent(id);
|
|
170
|
-
return
|
|
170
|
+
return chunkVUG4HTUM_js.safe(
|
|
171
171
|
this.client.post(`/api/v1/subscriptions/${encodedId}/resume`)
|
|
172
172
|
);
|
|
173
173
|
}
|
|
174
174
|
async skipNextRenewal(id, opts) {
|
|
175
175
|
const encodedId = encodeURIComponent(id);
|
|
176
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
177
|
-
return
|
|
176
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkVUG4HTUM_js.generateIdempotencyKey();
|
|
177
|
+
return chunkVUG4HTUM_js.safe(
|
|
178
178
|
this.client.post(
|
|
179
179
|
`/api/v1/subscriptions/${encodedId}/skip`,
|
|
180
180
|
void 0,
|
|
@@ -190,8 +190,8 @@ var UploadService = class {
|
|
|
190
190
|
this.client = client;
|
|
191
191
|
}
|
|
192
192
|
async init(filename, contentType, sizeBytes, opts) {
|
|
193
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
194
|
-
return
|
|
193
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkVUG4HTUM_js.generateIdempotencyKey();
|
|
194
|
+
return chunkVUG4HTUM_js.safe(
|
|
195
195
|
this.client.post(
|
|
196
196
|
"/api/v1/uploads/init",
|
|
197
197
|
{
|
|
@@ -204,7 +204,7 @@ var UploadService = class {
|
|
|
204
204
|
);
|
|
205
205
|
}
|
|
206
206
|
async confirm(uploadId) {
|
|
207
|
-
return
|
|
207
|
+
return chunkVUG4HTUM_js.safe(
|
|
208
208
|
this.client.post("/api/v1/uploads/confirm", {
|
|
209
209
|
upload_id: uploadId
|
|
210
210
|
})
|
|
@@ -223,7 +223,7 @@ var UploadService = class {
|
|
|
223
223
|
if (!uploadResponse.ok) {
|
|
224
224
|
return {
|
|
225
225
|
ok: false,
|
|
226
|
-
error: new
|
|
226
|
+
error: new chunkAETVRBKI_js.CimplifyError(
|
|
227
227
|
"UPLOAD_FAILED",
|
|
228
228
|
`Upload failed with status ${uploadResponse.status}`,
|
|
229
229
|
true
|
|
@@ -233,7 +233,7 @@ var UploadService = class {
|
|
|
233
233
|
} catch (error) {
|
|
234
234
|
return {
|
|
235
235
|
ok: false,
|
|
236
|
-
error: new
|
|
236
|
+
error: new chunkAETVRBKI_js.CimplifyError(
|
|
237
237
|
"UPLOAD_FAILED",
|
|
238
238
|
error instanceof Error ? error.message : "Upload failed",
|
|
239
239
|
true
|
|
@@ -250,7 +250,7 @@ var PlacesService = class {
|
|
|
250
250
|
this.client = client;
|
|
251
251
|
}
|
|
252
252
|
async autocomplete(input, sessionToken) {
|
|
253
|
-
return
|
|
253
|
+
return chunkVUG4HTUM_js.safe(
|
|
254
254
|
this.client.post("/api/v1/places/autocomplete", {
|
|
255
255
|
input,
|
|
256
256
|
sessionToken
|
|
@@ -258,7 +258,7 @@ var PlacesService = class {
|
|
|
258
258
|
);
|
|
259
259
|
}
|
|
260
260
|
async details(placeId, sessionToken) {
|
|
261
|
-
return
|
|
261
|
+
return chunkVUG4HTUM_js.safe(
|
|
262
262
|
this.client.post("/api/v1/places/details", {
|
|
263
263
|
place_id: placeId,
|
|
264
264
|
sessionToken
|
|
@@ -277,7 +277,7 @@ var DeliveryService = class {
|
|
|
277
277
|
params.set("dropoff_lat", String(dropoffLat));
|
|
278
278
|
params.set("dropoff_lng", String(dropoffLng));
|
|
279
279
|
if (country) params.set("country", country);
|
|
280
|
-
return
|
|
280
|
+
return chunkVUG4HTUM_js.safe(
|
|
281
281
|
this.client.get(`/api/v1/delivery/fee?${params.toString()}`)
|
|
282
282
|
);
|
|
283
283
|
}
|
|
@@ -289,7 +289,7 @@ var DeliveryService = class {
|
|
|
289
289
|
params.set("dropoff_lng", String(dropoffLng));
|
|
290
290
|
if (opts?.country) params.set("country", opts.country);
|
|
291
291
|
if (opts?.orderValue != null) params.set("order_value", String(opts.orderValue));
|
|
292
|
-
return
|
|
292
|
+
return chunkVUG4HTUM_js.safe(
|
|
293
293
|
this.client.get(`/api/v1/delivery/options?${params.toString()}`)
|
|
294
294
|
);
|
|
295
295
|
}
|
|
@@ -302,8 +302,8 @@ var SupportService = class {
|
|
|
302
302
|
}
|
|
303
303
|
/** Open (or resume) the customer's widget conversation. */
|
|
304
304
|
async openConversation(opts) {
|
|
305
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
306
|
-
return
|
|
305
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkVUG4HTUM_js.generateIdempotencyKey();
|
|
306
|
+
return chunkVUG4HTUM_js.safe(
|
|
307
307
|
this.client.post("/api/v1/support/conversation", void 0, {
|
|
308
308
|
idempotencyKey
|
|
309
309
|
})
|
|
@@ -311,8 +311,8 @@ var SupportService = class {
|
|
|
311
311
|
}
|
|
312
312
|
/** Send a message in the active conversation. */
|
|
313
313
|
async sendMessage(content, opts) {
|
|
314
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
315
|
-
return
|
|
314
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkVUG4HTUM_js.generateIdempotencyKey();
|
|
315
|
+
return chunkVUG4HTUM_js.safe(
|
|
316
316
|
this.client.post(
|
|
317
317
|
"/api/v1/support/conversation/messages",
|
|
318
318
|
{ content },
|
|
@@ -327,7 +327,7 @@ var SupportService = class {
|
|
|
327
327
|
if (options.limit) params.set("limit", String(options.limit));
|
|
328
328
|
const query = params.toString();
|
|
329
329
|
const path = query ? `/api/v1/support/conversation/messages?${query}` : "/api/v1/support/conversation/messages";
|
|
330
|
-
return
|
|
330
|
+
return chunkVUG4HTUM_js.safe(this.client.get(path));
|
|
331
331
|
}
|
|
332
332
|
};
|
|
333
333
|
|
|
@@ -403,16 +403,16 @@ function isRetryable(error) {
|
|
|
403
403
|
if (error instanceof DOMException && error.name === "AbortError") {
|
|
404
404
|
return true;
|
|
405
405
|
}
|
|
406
|
-
if (error instanceof
|
|
406
|
+
if (error instanceof chunkAETVRBKI_js.CimplifyError) {
|
|
407
407
|
return error.retryable;
|
|
408
408
|
}
|
|
409
409
|
return false;
|
|
410
410
|
}
|
|
411
411
|
function toNetworkError(error, isTestMode) {
|
|
412
412
|
if (error instanceof DOMException && error.name === "AbortError") {
|
|
413
|
-
return
|
|
414
|
-
new
|
|
415
|
-
|
|
413
|
+
return chunkAETVRBKI_js.enrichError(
|
|
414
|
+
new chunkAETVRBKI_js.CimplifyError(
|
|
415
|
+
chunkAETVRBKI_js.ErrorCode.TIMEOUT,
|
|
416
416
|
"Request timed out. Please check your connection and try again.",
|
|
417
417
|
true
|
|
418
418
|
),
|
|
@@ -420,21 +420,21 @@ function toNetworkError(error, isTestMode) {
|
|
|
420
420
|
);
|
|
421
421
|
}
|
|
422
422
|
if (error instanceof TypeError && error.message.includes("fetch")) {
|
|
423
|
-
return
|
|
424
|
-
new
|
|
425
|
-
|
|
423
|
+
return chunkAETVRBKI_js.enrichError(
|
|
424
|
+
new chunkAETVRBKI_js.CimplifyError(
|
|
425
|
+
chunkAETVRBKI_js.ErrorCode.NETWORK_ERROR,
|
|
426
426
|
"Network error. Please check your internet connection.",
|
|
427
427
|
true
|
|
428
428
|
),
|
|
429
429
|
{ isTestMode }
|
|
430
430
|
);
|
|
431
431
|
}
|
|
432
|
-
if (error instanceof
|
|
433
|
-
return
|
|
432
|
+
if (error instanceof chunkAETVRBKI_js.CimplifyError) {
|
|
433
|
+
return chunkAETVRBKI_js.enrichError(error, { isTestMode });
|
|
434
434
|
}
|
|
435
|
-
return
|
|
436
|
-
new
|
|
437
|
-
|
|
435
|
+
return chunkAETVRBKI_js.enrichError(
|
|
436
|
+
new chunkAETVRBKI_js.CimplifyError(
|
|
437
|
+
chunkAETVRBKI_js.ErrorCode.UNKNOWN_ERROR,
|
|
438
438
|
error instanceof Error ? error.message : "An unknown error occurred",
|
|
439
439
|
false
|
|
440
440
|
),
|
|
@@ -615,8 +615,8 @@ var CimplifyClient = class {
|
|
|
615
615
|
this.businessIdResolvePromise = (async () => {
|
|
616
616
|
const result = await this.business.getInfo();
|
|
617
617
|
if (!result.ok || !result.value?.id) {
|
|
618
|
-
throw new
|
|
619
|
-
|
|
618
|
+
throw new chunkAETVRBKI_js.CimplifyError(
|
|
619
|
+
chunkAETVRBKI_js.ErrorCode.NOT_FOUND,
|
|
620
620
|
"Unable to resolve business ID from the current public key.",
|
|
621
621
|
true
|
|
622
622
|
);
|
|
@@ -725,7 +725,7 @@ var CimplifyClient = class {
|
|
|
725
725
|
if (response.status >= 400 && response.status < 500) {
|
|
726
726
|
this.hooks.onRequestError?.({
|
|
727
727
|
...context,
|
|
728
|
-
error: new
|
|
728
|
+
error: new chunkAETVRBKI_js.CimplifyError(
|
|
729
729
|
`HTTP_${response.status}`,
|
|
730
730
|
`Request failed with status ${response.status}`,
|
|
731
731
|
false
|
|
@@ -751,7 +751,7 @@ var CimplifyClient = class {
|
|
|
751
751
|
}
|
|
752
752
|
this.hooks.onRequestError?.({
|
|
753
753
|
...context,
|
|
754
|
-
error: new
|
|
754
|
+
error: new chunkAETVRBKI_js.CimplifyError(
|
|
755
755
|
"SERVER_ERROR",
|
|
756
756
|
`Server error ${response.status} after ${retryCount} retries`,
|
|
757
757
|
false
|
|
@@ -887,17 +887,17 @@ var CimplifyClient = class {
|
|
|
887
887
|
const retryable = typeof json.error === "object" && typeof json.error?.retryable === "boolean" ? json.error.retryable : false;
|
|
888
888
|
if (errorCode === "IDEMPOTENCY_MISMATCH") {
|
|
889
889
|
const originalCreatedAt = typeof json.error === "object" && json.error?.original_created_at || "";
|
|
890
|
-
throw new
|
|
890
|
+
throw new chunkAETVRBKI_js.IdempotencyMismatchError(errorMessage, originalCreatedAt);
|
|
891
891
|
}
|
|
892
|
-
const error =
|
|
893
|
-
new
|
|
892
|
+
const error = chunkAETVRBKI_js.enrichError(
|
|
893
|
+
new chunkAETVRBKI_js.CimplifyError(
|
|
894
894
|
errorCode,
|
|
895
895
|
errorMessage,
|
|
896
896
|
retryable
|
|
897
897
|
),
|
|
898
898
|
{ isTestMode: this.isTestMode() }
|
|
899
899
|
);
|
|
900
|
-
if ((response.status === 401 || error.code ===
|
|
900
|
+
if ((response.status === 401 || error.code === chunkAETVRBKI_js.ErrorCode.UNAUTHORIZED) && this.accessToken) {
|
|
901
901
|
console.warn(
|
|
902
902
|
"[Cimplify] Received 401 Unauthorized. Access token may be missing/expired. Refresh authentication and retry the request."
|
|
903
903
|
);
|
|
@@ -905,8 +905,8 @@ var CimplifyClient = class {
|
|
|
905
905
|
throw error;
|
|
906
906
|
}
|
|
907
907
|
if (json?.success === false || json?.error?.code || json?.error?.message) {
|
|
908
|
-
const error =
|
|
909
|
-
new
|
|
908
|
+
const error = chunkAETVRBKI_js.enrichError(
|
|
909
|
+
new chunkAETVRBKI_js.CimplifyError(
|
|
910
910
|
json.error?.code || "API_ERROR",
|
|
911
911
|
json.error?.message || "An error occurred",
|
|
912
912
|
json.error?.retryable || false
|
|
@@ -922,25 +922,25 @@ var CimplifyClient = class {
|
|
|
922
922
|
}
|
|
923
923
|
get catalogue() {
|
|
924
924
|
if (!this._catalogue) {
|
|
925
|
-
this._catalogue = new
|
|
925
|
+
this._catalogue = new chunkVUG4HTUM_js.CatalogueQueries(this);
|
|
926
926
|
}
|
|
927
927
|
return this._catalogue;
|
|
928
928
|
}
|
|
929
929
|
get cart() {
|
|
930
930
|
if (!this._cart) {
|
|
931
|
-
this._cart = new
|
|
931
|
+
this._cart = new chunkVUG4HTUM_js.CartOperations(this);
|
|
932
932
|
}
|
|
933
933
|
return this._cart;
|
|
934
934
|
}
|
|
935
935
|
get checkout() {
|
|
936
936
|
if (!this._checkout) {
|
|
937
|
-
this._checkout = new
|
|
937
|
+
this._checkout = new chunkVUG4HTUM_js.CheckoutService(this);
|
|
938
938
|
}
|
|
939
939
|
return this._checkout;
|
|
940
940
|
}
|
|
941
941
|
get orders() {
|
|
942
942
|
if (!this._orders) {
|
|
943
|
-
this._orders = new
|
|
943
|
+
this._orders = new chunkVUG4HTUM_js.OrderQueries(this);
|
|
944
944
|
}
|
|
945
945
|
return this._orders;
|
|
946
946
|
}
|
|
@@ -970,43 +970,43 @@ var CimplifyClient = class {
|
|
|
970
970
|
}
|
|
971
971
|
get link() {
|
|
972
972
|
if (!this._link) {
|
|
973
|
-
this._link = new
|
|
973
|
+
this._link = new chunkVUG4HTUM_js.LinkService(this);
|
|
974
974
|
}
|
|
975
975
|
return this._link;
|
|
976
976
|
}
|
|
977
977
|
get auth() {
|
|
978
978
|
if (!this._auth) {
|
|
979
|
-
this._auth = new
|
|
979
|
+
this._auth = new chunkVUG4HTUM_js.AuthService(this);
|
|
980
980
|
}
|
|
981
981
|
return this._auth;
|
|
982
982
|
}
|
|
983
983
|
get business() {
|
|
984
984
|
if (!this._business) {
|
|
985
|
-
this._business = new
|
|
985
|
+
this._business = new chunkVUG4HTUM_js.BusinessService(this);
|
|
986
986
|
}
|
|
987
987
|
return this._business;
|
|
988
988
|
}
|
|
989
989
|
get inventory() {
|
|
990
990
|
if (!this._inventory) {
|
|
991
|
-
this._inventory = new
|
|
991
|
+
this._inventory = new chunkVUG4HTUM_js.InventoryService(this);
|
|
992
992
|
}
|
|
993
993
|
return this._inventory;
|
|
994
994
|
}
|
|
995
995
|
get scheduling() {
|
|
996
996
|
if (!this._scheduling) {
|
|
997
|
-
this._scheduling = new
|
|
997
|
+
this._scheduling = new chunkVUG4HTUM_js.SchedulingService(this);
|
|
998
998
|
}
|
|
999
999
|
return this._scheduling;
|
|
1000
1000
|
}
|
|
1001
1001
|
get lite() {
|
|
1002
1002
|
if (!this._lite) {
|
|
1003
|
-
this._lite = new
|
|
1003
|
+
this._lite = new chunkVUG4HTUM_js.LiteService(this);
|
|
1004
1004
|
}
|
|
1005
1005
|
return this._lite;
|
|
1006
1006
|
}
|
|
1007
1007
|
get fx() {
|
|
1008
1008
|
if (!this._fx) {
|
|
1009
|
-
this._fx = new
|
|
1009
|
+
this._fx = new chunkVUG4HTUM_js.FxService(this);
|
|
1010
1010
|
}
|
|
1011
1011
|
return this._fx;
|
|
1012
1012
|
}
|
|
@@ -1041,7 +1041,7 @@ var CimplifyClient = class {
|
|
|
1041
1041
|
if (businessId) {
|
|
1042
1042
|
this.setBusinessId(businessId);
|
|
1043
1043
|
}
|
|
1044
|
-
return
|
|
1044
|
+
return chunkVUG4HTUM_js.createElements(this, businessId ?? this.businessId ?? void 0, options);
|
|
1045
1045
|
}
|
|
1046
1046
|
};
|
|
1047
1047
|
function createCimplifyClient(config = {}) {
|
|
@@ -153,7 +153,7 @@ var ERROR_SUGGESTIONS = {
|
|
|
153
153
|
INSUFFICIENT_QUANTITY: "Requested quantity exceeds available inventory. Reduce quantity and retry.",
|
|
154
154
|
BUSINESS_ID_REQUIRED: "Business context could not be resolved. Verify the public key and business bootstrap call.",
|
|
155
155
|
INVALID_CART: "Cart is invalid for checkout. Sync cart state, ensure items exist, then retry.",
|
|
156
|
-
ORDER_TYPE_REQUIRED: "Order type is required. Provide one of delivery, pickup, or
|
|
156
|
+
ORDER_TYPE_REQUIRED: "Order type is required. Provide one of delivery, pickup, or dine-in before checkout.",
|
|
157
157
|
NO_PAYMENT_ELEMENT: "PaymentElement is required for processCheckout(). Mount it before triggering checkout.",
|
|
158
158
|
PAYMENT_NOT_MOUNTED: "PaymentElement iframe is not mounted. Mount it in the DOM before processCheckout().",
|
|
159
159
|
AUTH_INCOMPLETE: "AuthElement has not completed authentication. Wait for AUTHENTICATED before checkout.",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { moneyFromNumber, money } from './chunk-
|
|
1
|
+
import { moneyFromNumber, money } from './chunk-K5EN2W2Q.mjs';
|
|
2
2
|
|
|
3
3
|
// src/utils/price.ts
|
|
4
4
|
var CURRENCY_SYMBOLS = {
|
|
@@ -319,9 +319,9 @@ function normalizePaymentResponse(response) {
|
|
|
319
319
|
};
|
|
320
320
|
}
|
|
321
321
|
if (isWebPaymentResponse(response)) {
|
|
322
|
-
const objectAuthType = response.authorization_type && typeof response.authorization_type === "object" && "address" in response.authorization_type ?
|
|
322
|
+
const objectAuthType = response.authorization_type && typeof response.authorization_type === "object" && "address" in response.authorization_type ? { address: response.authorization_type.address } : void 0;
|
|
323
323
|
const authType = typeof response.authorization_type === "string" ? response.authorization_type.trim().toLowerCase().replace(/[\s-]+/g, "_") : void 0;
|
|
324
|
-
const validStringAuthTypes = ["otp", "pin", "phone", "birthday"
|
|
324
|
+
const validStringAuthTypes = ["otp", "pin", "phone", "birthday"];
|
|
325
325
|
const safeAuthType = objectAuthType || (authType && validStringAuthTypes.includes(authType) ? authType : void 0);
|
|
326
326
|
return {
|
|
327
327
|
provider: response.transaction.provider_type?.toLowerCase() || "unknown",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { safe, generateIdempotencyKey, CatalogueQueries, CartOperations, CheckoutService, OrderQueries, LinkService, AuthService, BusinessService, InventoryService, SchedulingService, LiteService, FxService, createElements } from './chunk-
|
|
2
|
-
import { CimplifyError, ErrorCode, IdempotencyMismatchError, enrichError } from './chunk-
|
|
1
|
+
import { safe, generateIdempotencyKey, CatalogueQueries, CartOperations, CheckoutService, OrderQueries, LinkService, AuthService, BusinessService, InventoryService, SchedulingService, LiteService, FxService, createElements } from './chunk-NN3WC7XZ.mjs';
|
|
2
|
+
import { CimplifyError, ErrorCode, IdempotencyMismatchError, enrichError } from './chunk-K5EN2W2Q.mjs';
|
|
3
3
|
|
|
4
4
|
// src/store-credit.ts
|
|
5
5
|
var StoreCreditQueries = class {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isPaymentStatusRequiresAction, normalizeStatusResponse, isPaymentStatusSuccess, isPaymentStatusFailure } from './chunk-
|
|
2
|
-
import { CimplifyError, currencyCode, ErrorCode, enrichError, getErrorHint } from './chunk-
|
|
1
|
+
import { isPaymentStatusRequiresAction, normalizeStatusResponse, isPaymentStatusSuccess, isPaymentStatusFailure } from './chunk-KFLGQGMC.mjs';
|
|
2
|
+
import { CimplifyError, currencyCode, ErrorCode, enrichError, getErrorHint } from './chunk-K5EN2W2Q.mjs';
|
|
3
3
|
|
|
4
4
|
// src/types/result.ts
|
|
5
5
|
function ok(value) {
|
|
@@ -2090,7 +2090,7 @@ var InventoryService = class {
|
|
|
2090
2090
|
async getAvailableQuantity(productId, locationId) {
|
|
2091
2091
|
const result = await this.getProductStock(productId, locationId);
|
|
2092
2092
|
if (!result.ok) return result;
|
|
2093
|
-
return ok(result.value.available_quantity);
|
|
2093
|
+
return ok(result.value.available_quantity ?? void 0);
|
|
2094
2094
|
}
|
|
2095
2095
|
};
|
|
2096
2096
|
|