@cimplify/sdk 0.86.0 → 0.87.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 +20 -20
- package/dist/advanced.mjs +1 -1
- package/dist/{chunk-D6JWYYTG.mjs → chunk-APBLFZ2I.mjs} +3 -3
- package/dist/{chunk-VUG4HTUM.js → chunk-FWEF2DHR.js} +57 -5
- package/dist/{chunk-A2GXDCSI.mjs → chunk-J7JDCPNW.mjs} +2 -2
- package/dist/{chunk-E6T5VJMG.mjs → chunk-OZDDHSIB.mjs} +9 -1
- package/dist/{chunk-HJEKXCG2.js → chunk-P3352VXA.js} +37 -37
- package/dist/{chunk-ESGKWRQS.js → chunk-PWDX5N2M.js} +4 -4
- package/dist/{chunk-MRL53WP6.mjs → chunk-RCGSHS2Q.mjs} +1 -1
- package/dist/{chunk-X4UNISYG.js → chunk-ROBTTS3Q.js} +3 -3
- package/dist/{chunk-IQLJJW2H.js → chunk-T7Z25EY4.js} +9 -0
- package/dist/{chunk-NN3WC7XZ.mjs → chunk-U57TYZLD.mjs} +57 -5
- package/dist/{client-BdI24jUT.d.ts → client-BIt37FjS.d.mts} +18 -8
- package/dist/{client-DowGNrTh.d.mts → client-BMOdyC1F.d.mts} +2 -2
- package/dist/{client-CMJO_8zo.d.ts → client-BvWtk822.d.ts} +2 -2
- package/dist/{client-BQSRj4iK.d.mts → client-Dfl6WY2F.d.ts} +18 -8
- package/dist/{index-DLb_Ldl6.d.mts → index-BxOJ3BLn.d.mts} +3 -3
- package/dist/{index-BRwHpMY-.d.ts → index-DW6JifS1.d.ts} +3 -3
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +85 -81
- package/dist/index.mjs +4 -4
- package/dist/mock/cli.mjs +3 -3
- package/dist/mock/library.js +3 -3
- package/dist/mock/library.mjs +3 -3
- package/dist/mock/msw.js +3 -3
- package/dist/mock/msw.mjs +3 -3
- package/dist/{payment-CFev-fOE.d.mts → payment-CLp__KpE.d.mts} +1 -1
- package/dist/{payment-BA7KNBxg.d.ts → payment-DJrvivO_.d.ts} +1 -1
- package/dist/{price-BNhGVB5q.d.ts → price-B7_UzClY.d.ts} +1 -1
- package/dist/{price-nRxqVNGq.d.mts → price-Ddk8Vr8z.d.mts} +1 -1
- package/dist/{product-BGxIfTqJ.d.mts → product-C0Lr81ze.d.mts} +43 -4
- package/dist/{product-BGxIfTqJ.d.ts → product-C0Lr81ze.d.ts} +43 -4
- package/dist/react.d.mts +22 -5
- package/dist/react.d.ts +22 -5
- package/dist/react.js +101 -63
- package/dist/react.mjs +40 -5
- package/dist/{server-9u0LiG5U.d.mts → server-0TnEJt8U.d.mts} +2 -2
- package/dist/{server-BH7DTaaz.d.ts → server-P2G43ENi.d.ts} +2 -2
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +7 -7
- package/dist/server.mjs +2 -2
- package/dist/styles.css +1 -1
- package/dist/testing/msw.d.mts +2 -2
- package/dist/testing/msw.d.ts +2 -2
- package/dist/testing/msw.js +2 -2
- package/dist/testing/msw.mjs +1 -1
- package/dist/testing/suite.d.mts +6 -6
- package/dist/testing/suite.d.ts +6 -6
- package/dist/testing/suite.js +23 -23
- package/dist/testing/suite.mjs +4 -4
- package/dist/testing.d.mts +5 -5
- package/dist/testing.d.ts +5 -5
- package/dist/testing.js +79 -79
- package/dist/testing.mjs +5 -5
- package/dist/utils.d.mts +4 -4
- package/dist/utils.d.ts +4 -4
- package/package.json +1 -1
- package/registry/product-card.json +1 -1
package/dist/advanced.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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,
|
|
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, c_ as SchedulingService, dE as createElements } from './client-BIt37FjS.mjs';
|
|
2
|
+
import './product-C0Lr81ze.mjs';
|
|
3
|
+
import './payment-CLp__KpE.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, 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,
|
|
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, c_ as SchedulingService, dE as createElements } from './client-Dfl6WY2F.js';
|
|
2
|
+
import './product-C0Lr81ze.js';
|
|
3
|
+
import './payment-DJrvivO_.js';
|
|
4
4
|
|
|
5
5
|
declare function generateIdempotencyKey(prefix?: string): string;
|
|
6
6
|
|
package/dist/advanced.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkFWEF2DHR_js = require('./chunk-FWEF2DHR.js');
|
|
4
4
|
require('./chunk-PTPOQVXS.js');
|
|
5
5
|
require('./chunk-AETVRBKI.js');
|
|
6
6
|
require('./chunk-OWW5GUSB.js');
|
|
@@ -9,77 +9,77 @@ require('./chunk-OWW5GUSB.js');
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "AuthService", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkFWEF2DHR_js.AuthService; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "BusinessService", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkFWEF2DHR_js.BusinessService; }
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "CartOperations", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunkFWEF2DHR_js.CartOperations; }
|
|
21
21
|
});
|
|
22
22
|
Object.defineProperty(exports, "CatalogueQueries", {
|
|
23
23
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunkFWEF2DHR_js.CatalogueQueries; }
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "CheckoutOperations", {
|
|
27
27
|
enumerable: true,
|
|
28
|
-
get: function () { return
|
|
28
|
+
get: function () { return chunkFWEF2DHR_js.CheckoutService; }
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "CheckoutService", {
|
|
31
31
|
enumerable: true,
|
|
32
|
-
get: function () { return
|
|
32
|
+
get: function () { return chunkFWEF2DHR_js.CheckoutService; }
|
|
33
33
|
});
|
|
34
34
|
Object.defineProperty(exports, "CimplifyElement", {
|
|
35
35
|
enumerable: true,
|
|
36
|
-
get: function () { return
|
|
36
|
+
get: function () { return chunkFWEF2DHR_js.CimplifyElement; }
|
|
37
37
|
});
|
|
38
38
|
Object.defineProperty(exports, "CimplifyElements", {
|
|
39
39
|
enumerable: true,
|
|
40
|
-
get: function () { return
|
|
40
|
+
get: function () { return chunkFWEF2DHR_js.CimplifyElements; }
|
|
41
41
|
});
|
|
42
42
|
Object.defineProperty(exports, "ELEMENT_TYPES", {
|
|
43
43
|
enumerable: true,
|
|
44
|
-
get: function () { return
|
|
44
|
+
get: function () { return chunkFWEF2DHR_js.ELEMENT_TYPES; }
|
|
45
45
|
});
|
|
46
46
|
Object.defineProperty(exports, "EVENT_TYPES", {
|
|
47
47
|
enumerable: true,
|
|
48
|
-
get: function () { return
|
|
48
|
+
get: function () { return chunkFWEF2DHR_js.EVENT_TYPES; }
|
|
49
49
|
});
|
|
50
50
|
Object.defineProperty(exports, "FxService", {
|
|
51
51
|
enumerable: true,
|
|
52
|
-
get: function () { return
|
|
52
|
+
get: function () { return chunkFWEF2DHR_js.FxService; }
|
|
53
53
|
});
|
|
54
54
|
Object.defineProperty(exports, "InventoryService", {
|
|
55
55
|
enumerable: true,
|
|
56
|
-
get: function () { return
|
|
56
|
+
get: function () { return chunkFWEF2DHR_js.InventoryService; }
|
|
57
57
|
});
|
|
58
58
|
Object.defineProperty(exports, "LinkService", {
|
|
59
59
|
enumerable: true,
|
|
60
|
-
get: function () { return
|
|
60
|
+
get: function () { return chunkFWEF2DHR_js.LinkService; }
|
|
61
61
|
});
|
|
62
62
|
Object.defineProperty(exports, "LiteService", {
|
|
63
63
|
enumerable: true,
|
|
64
|
-
get: function () { return
|
|
64
|
+
get: function () { return chunkFWEF2DHR_js.LiteService; }
|
|
65
65
|
});
|
|
66
66
|
Object.defineProperty(exports, "MESSAGE_TYPES", {
|
|
67
67
|
enumerable: true,
|
|
68
|
-
get: function () { return
|
|
68
|
+
get: function () { return chunkFWEF2DHR_js.MESSAGE_TYPES; }
|
|
69
69
|
});
|
|
70
70
|
Object.defineProperty(exports, "OrderQueries", {
|
|
71
71
|
enumerable: true,
|
|
72
|
-
get: function () { return
|
|
72
|
+
get: function () { return chunkFWEF2DHR_js.OrderQueries; }
|
|
73
73
|
});
|
|
74
74
|
Object.defineProperty(exports, "SchedulingService", {
|
|
75
75
|
enumerable: true,
|
|
76
|
-
get: function () { return
|
|
76
|
+
get: function () { return chunkFWEF2DHR_js.SchedulingService; }
|
|
77
77
|
});
|
|
78
78
|
Object.defineProperty(exports, "createElements", {
|
|
79
79
|
enumerable: true,
|
|
80
|
-
get: function () { return
|
|
80
|
+
get: function () { return chunkFWEF2DHR_js.createElements; }
|
|
81
81
|
});
|
|
82
82
|
Object.defineProperty(exports, "generateIdempotencyKey", {
|
|
83
83
|
enumerable: true,
|
|
84
|
-
get: function () { return
|
|
84
|
+
get: function () { return chunkFWEF2DHR_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-
|
|
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-U57TYZLD.mjs';
|
|
2
2
|
import './chunk-KFLGQGMC.mjs';
|
|
3
3
|
import './chunk-K5EN2W2Q.mjs';
|
|
4
4
|
import './chunk-3G6RQLXK.mjs';
|
|
@@ -2441,7 +2441,7 @@ function buildV1(deps) {
|
|
|
2441
2441
|
return tryRoute(c, () => deps.scheduling.cancelBooking(c.req.param("booking_id"), body.reason));
|
|
2442
2442
|
});
|
|
2443
2443
|
app.get("/lite/bootstrap", (c) => tryRoute(c, () => deps.lite.bootstrap(deps.defaultBusinessId)));
|
|
2444
|
-
app.get("/lite/
|
|
2444
|
+
app.get("/lite/resources/:resource_id", (c) => tryRoute(c, () => deps.lite.getResource(c.req.param("resource_id"))));
|
|
2445
2445
|
app.get("/lite/menu", (c) => tryRoute(c, () => deps.lite.getMenu(deps.defaultBusinessId)));
|
|
2446
2446
|
app.get("/lite/menu/categories/:category_id", (c) => tryRoute(c, () => deps.lite.getMenuCategory(c.req.param("category_id"))));
|
|
2447
2447
|
app.get("/fx/rate", (c) => tryRoute(c, () => deps.fx.getRate(c.req.query("from") ?? "USD", c.req.query("to") ?? "GHS")));
|
|
@@ -5544,8 +5544,8 @@ function createLiteService(opts) {
|
|
|
5544
5544
|
tables: []
|
|
5545
5545
|
};
|
|
5546
5546
|
},
|
|
5547
|
-
|
|
5548
|
-
return { id:
|
|
5547
|
+
getResource(resourceId) {
|
|
5548
|
+
return { id: resourceId, table_number: resourceId.slice(-2), capacity: 4, occupied: false };
|
|
5549
5549
|
},
|
|
5550
5550
|
getMenu(businessId) {
|
|
5551
5551
|
const products = registry.products.list((p) => p.business_id === businessId);
|
|
@@ -1553,15 +1553,43 @@ function toTerminalFailure(code, message, recoverable) {
|
|
|
1553
1553
|
}
|
|
1554
1554
|
};
|
|
1555
1555
|
}
|
|
1556
|
+
function isValidCustomerName(name) {
|
|
1557
|
+
const trimmed = (name ?? "").trim();
|
|
1558
|
+
return trimmed.length >= 2 && /\p{L}/u.test(trimmed);
|
|
1559
|
+
}
|
|
1560
|
+
function isOfflinePaymentMethod(method) {
|
|
1561
|
+
return method === "cash" || method === "offline";
|
|
1562
|
+
}
|
|
1556
1563
|
var CheckoutService = class {
|
|
1557
1564
|
constructor(client) {
|
|
1558
1565
|
this.client = client;
|
|
1559
1566
|
}
|
|
1567
|
+
validateCheckoutData(data) {
|
|
1568
|
+
if (isOfflinePaymentMethod(data.payment_method)) {
|
|
1569
|
+
return new chunkAETVRBKI_js.CimplifyError(
|
|
1570
|
+
"INVALID_PAYMENT_METHOD",
|
|
1571
|
+
"Offline payment isn't available for online checkout. Please pay by card or mobile money.",
|
|
1572
|
+
false
|
|
1573
|
+
);
|
|
1574
|
+
}
|
|
1575
|
+
if (!isValidCustomerName(data.customer?.name)) {
|
|
1576
|
+
return new chunkAETVRBKI_js.CimplifyError(
|
|
1577
|
+
"INVALID_CUSTOMER_NAME",
|
|
1578
|
+
"Enter your name, not a phone number.",
|
|
1579
|
+
false
|
|
1580
|
+
);
|
|
1581
|
+
}
|
|
1582
|
+
return null;
|
|
1583
|
+
}
|
|
1560
1584
|
orderTokenParam(orderId) {
|
|
1561
1585
|
const token = this.client.getOrderToken(orderId);
|
|
1562
1586
|
return token ? `?token=${encodeURIComponent(token)}` : "";
|
|
1563
1587
|
}
|
|
1564
1588
|
async process(data) {
|
|
1589
|
+
const invalid = this.validateCheckoutData(data);
|
|
1590
|
+
if (invalid) {
|
|
1591
|
+
return err(invalid);
|
|
1592
|
+
}
|
|
1565
1593
|
const checkoutData = {
|
|
1566
1594
|
...data,
|
|
1567
1595
|
idempotency_key: data.idempotency_key || generateIdempotencyKey()
|
|
@@ -2222,9 +2250,9 @@ var LiteService = class {
|
|
|
2222
2250
|
async getBootstrap() {
|
|
2223
2251
|
return safe(this.client.get("/api/v1/lite/bootstrap"));
|
|
2224
2252
|
}
|
|
2225
|
-
async
|
|
2226
|
-
const encodedId = encodeURIComponent(
|
|
2227
|
-
return safe(this.client.get(`/api/v1/lite/
|
|
2253
|
+
async getResource(resourceId) {
|
|
2254
|
+
const encodedId = encodeURIComponent(resourceId);
|
|
2255
|
+
return safe(this.client.get(`/api/v1/lite/resources/${encodedId}`));
|
|
2228
2256
|
}
|
|
2229
2257
|
async getMenu() {
|
|
2230
2258
|
return safe(this.client.get("/api/v1/lite/menu"));
|
|
@@ -3201,6 +3229,7 @@ var CimplifyElement = class {
|
|
|
3201
3229
|
this.pendingInit = null;
|
|
3202
3230
|
this.eventHandlers = /* @__PURE__ */ new Map();
|
|
3203
3231
|
this.resolvers = /* @__PURE__ */ new Map();
|
|
3232
|
+
this.lastReportedHeight = 0;
|
|
3204
3233
|
this.listening = false;
|
|
3205
3234
|
this.type = type;
|
|
3206
3235
|
this.businessId = businessId;
|
|
@@ -3209,11 +3238,33 @@ var CimplifyElement = class {
|
|
|
3209
3238
|
this.parent = parent;
|
|
3210
3239
|
this.nonce = generateNonce();
|
|
3211
3240
|
this.boundHandleMessage = this.handleMessage.bind(this);
|
|
3241
|
+
this.boundHandleResize = () => this.applyHeight();
|
|
3212
3242
|
if (typeof window !== "undefined") {
|
|
3213
3243
|
window.addEventListener("message", this.boundHandleMessage);
|
|
3244
|
+
window.addEventListener("resize", this.boundHandleResize);
|
|
3214
3245
|
this.listening = true;
|
|
3215
3246
|
}
|
|
3216
3247
|
}
|
|
3248
|
+
/**
|
|
3249
|
+
* Size the iframe to the element's reported content height. The checkout can
|
|
3250
|
+
* exceed the viewport, so cap it at the viewport height — the checkout then
|
|
3251
|
+
* scrolls internally instead of growing (and scrolling) the host page. Other
|
|
3252
|
+
* element types size to content as before.
|
|
3253
|
+
*/
|
|
3254
|
+
applyHeight(reportedHeight) {
|
|
3255
|
+
if (!this.iframe) return;
|
|
3256
|
+
if (typeof reportedHeight === "number" && reportedHeight > 0) {
|
|
3257
|
+
this.lastReportedHeight = reportedHeight;
|
|
3258
|
+
}
|
|
3259
|
+
const content = this.lastReportedHeight;
|
|
3260
|
+
if (!content) return;
|
|
3261
|
+
if (this.type !== "checkout" || typeof window === "undefined") {
|
|
3262
|
+
this.iframe.style.height = `${content}px`;
|
|
3263
|
+
return;
|
|
3264
|
+
}
|
|
3265
|
+
const capped = Math.max(320, Math.min(content, window.innerHeight));
|
|
3266
|
+
this.iframe.style.height = `${capped}px`;
|
|
3267
|
+
}
|
|
3217
3268
|
mount(container) {
|
|
3218
3269
|
if (this.mounted) {
|
|
3219
3270
|
console.warn(`Element ${this.type} is already mounted`);
|
|
@@ -3246,6 +3297,7 @@ var CimplifyElement = class {
|
|
|
3246
3297
|
this.resolvers.clear();
|
|
3247
3298
|
if (this.listening && typeof window !== "undefined") {
|
|
3248
3299
|
window.removeEventListener("message", this.boundHandleMessage);
|
|
3300
|
+
window.removeEventListener("resize", this.boundHandleResize);
|
|
3249
3301
|
this.listening = false;
|
|
3250
3302
|
}
|
|
3251
3303
|
this.parent._removeElement(this.type, this);
|
|
@@ -3371,7 +3423,7 @@ var CimplifyElement = class {
|
|
|
3371
3423
|
switch (message.type) {
|
|
3372
3424
|
case MESSAGE_TYPES.READY:
|
|
3373
3425
|
this.ready = true;
|
|
3374
|
-
if (
|
|
3426
|
+
if (message.height) this.applyHeight(message.height);
|
|
3375
3427
|
if (this.pendingInit) {
|
|
3376
3428
|
const { publicKey } = this.pendingInit;
|
|
3377
3429
|
this.sendMessage({
|
|
@@ -3395,7 +3447,7 @@ var CimplifyElement = class {
|
|
|
3395
3447
|
this.emit(EVENT_TYPES.READY, { height: message.height });
|
|
3396
3448
|
break;
|
|
3397
3449
|
case MESSAGE_TYPES.HEIGHT_CHANGE:
|
|
3398
|
-
|
|
3450
|
+
this.applyHeight(message.height);
|
|
3399
3451
|
break;
|
|
3400
3452
|
case MESSAGE_TYPES.ERROR:
|
|
3401
3453
|
this.emit(EVENT_TYPES.ERROR, { code: message.code, message: message.message });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createMockApp } from './chunk-
|
|
2
|
-
import { createCimplifyClient } from './chunk-
|
|
1
|
+
import { createMockApp } from './chunk-APBLFZ2I.mjs';
|
|
2
|
+
import { createCimplifyClient } from './chunk-RCGSHS2Q.mjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
var cimplifyRegistry = z.registry();
|
|
@@ -94,6 +94,14 @@ var DURATION_UNIT = {
|
|
|
94
94
|
Months: "months",
|
|
95
95
|
Years: "years"
|
|
96
96
|
};
|
|
97
|
+
var BOUNDARY_KIND = {
|
|
98
|
+
CheckInOut: "check_in_out",
|
|
99
|
+
PickupReturn: "pickup_return",
|
|
100
|
+
DeliveryCollection: "delivery_collection",
|
|
101
|
+
AccessVacate: "access_vacate",
|
|
102
|
+
MoveInOut: "move_in_out",
|
|
103
|
+
Custom: "custom"
|
|
104
|
+
};
|
|
97
105
|
var INPUT_FIELD_TYPE = {
|
|
98
106
|
Text: "text",
|
|
99
107
|
Textarea: "textarea",
|
|
@@ -153,4 +161,4 @@ function appendTransform(url, t) {
|
|
|
153
161
|
return `${url}${url.includes("?") ? "&" : "?"}${query}`;
|
|
154
162
|
}
|
|
155
163
|
|
|
156
|
-
export { CIMPLIFY_CDN_HOSTS, DEFAULT_CDN_BASE_URL, DURATION_UNIT, INPUT_FIELD_TYPE, PRODUCT_TYPE, RENDER_HINT, allGalleryImages, assetUrl, getVariantDisplayName, isCimplifyAsset, resolveGallery };
|
|
164
|
+
export { BOUNDARY_KIND, CIMPLIFY_CDN_HOSTS, DEFAULT_CDN_BASE_URL, DURATION_UNIT, INPUT_FIELD_TYPE, PRODUCT_TYPE, RENDER_HINT, allGalleryImages, assetUrl, getVariantDisplayName, isCimplifyAsset, resolveGallery };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkFWEF2DHR_js = require('./chunk-FWEF2DHR.js');
|
|
4
4
|
var chunkAETVRBKI_js = require('./chunk-AETVRBKI.js');
|
|
5
5
|
|
|
6
6
|
// src/store-credit.ts
|
|
@@ -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 chunkFWEF2DHR_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 chunkFWEF2DHR_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 chunkFWEF2DHR_js.safe(this.client.get(path));
|
|
107
107
|
}
|
|
108
108
|
async dismissMessage(code) {
|
|
109
|
-
return
|
|
109
|
+
return chunkFWEF2DHR_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 chunkFWEF2DHR_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 chunkFWEF2DHR_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 ?? chunkFWEF2DHR_js.generateIdempotencyKey();
|
|
154
|
+
return chunkFWEF2DHR_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 chunkFWEF2DHR_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 chunkFWEF2DHR_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 ?? chunkFWEF2DHR_js.generateIdempotencyKey();
|
|
177
|
+
return chunkFWEF2DHR_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 ?? chunkFWEF2DHR_js.generateIdempotencyKey();
|
|
194
|
+
return chunkFWEF2DHR_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 chunkFWEF2DHR_js.safe(
|
|
208
208
|
this.client.post("/api/v1/uploads/confirm", {
|
|
209
209
|
upload_id: uploadId
|
|
210
210
|
})
|
|
@@ -250,7 +250,7 @@ var PlacesService = class {
|
|
|
250
250
|
this.client = client;
|
|
251
251
|
}
|
|
252
252
|
async autocomplete(input, sessionToken) {
|
|
253
|
-
return
|
|
253
|
+
return chunkFWEF2DHR_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 chunkFWEF2DHR_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 chunkFWEF2DHR_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 chunkFWEF2DHR_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 ?? chunkFWEF2DHR_js.generateIdempotencyKey();
|
|
306
|
+
return chunkFWEF2DHR_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 ?? chunkFWEF2DHR_js.generateIdempotencyKey();
|
|
315
|
+
return chunkFWEF2DHR_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 chunkFWEF2DHR_js.safe(this.client.get(path));
|
|
331
331
|
}
|
|
332
332
|
};
|
|
333
333
|
|
|
@@ -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 chunkFWEF2DHR_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 chunkFWEF2DHR_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 chunkFWEF2DHR_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 chunkFWEF2DHR_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 chunkFWEF2DHR_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 chunkFWEF2DHR_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 chunkFWEF2DHR_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 chunkFWEF2DHR_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 chunkFWEF2DHR_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 chunkFWEF2DHR_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 chunkFWEF2DHR_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 chunkFWEF2DHR_js.createElements(this, businessId ?? this.businessId ?? void 0, options);
|
|
1045
1045
|
}
|
|
1046
1046
|
};
|
|
1047
1047
|
function createCimplifyClient(config = {}) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkROBTTS3Q_js = require('./chunk-ROBTTS3Q.js');
|
|
4
|
+
var chunkP3352VXA_js = require('./chunk-P3352VXA.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 = chunkROBTTS3Q_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 = chunkP3352VXA_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,4 +1,4 @@
|
|
|
1
|
-
import { safe, generateIdempotencyKey, CatalogueQueries, CartOperations, CheckoutService, OrderQueries, LinkService, AuthService, BusinessService, InventoryService, SchedulingService, LiteService, FxService, createElements } from './chunk-
|
|
1
|
+
import { safe, generateIdempotencyKey, CatalogueQueries, CartOperations, CheckoutService, OrderQueries, LinkService, AuthService, BusinessService, InventoryService, SchedulingService, LiteService, FxService, createElements } from './chunk-U57TYZLD.mjs';
|
|
2
2
|
import { CimplifyError, ErrorCode, IdempotencyMismatchError, enrichError } from './chunk-K5EN2W2Q.mjs';
|
|
3
3
|
|
|
4
4
|
// src/store-credit.ts
|
|
@@ -2443,7 +2443,7 @@ function buildV1(deps) {
|
|
|
2443
2443
|
return tryRoute(c, () => deps.scheduling.cancelBooking(c.req.param("booking_id"), body.reason));
|
|
2444
2444
|
});
|
|
2445
2445
|
app.get("/lite/bootstrap", (c) => tryRoute(c, () => deps.lite.bootstrap(deps.defaultBusinessId)));
|
|
2446
|
-
app.get("/lite/
|
|
2446
|
+
app.get("/lite/resources/:resource_id", (c) => tryRoute(c, () => deps.lite.getResource(c.req.param("resource_id"))));
|
|
2447
2447
|
app.get("/lite/menu", (c) => tryRoute(c, () => deps.lite.getMenu(deps.defaultBusinessId)));
|
|
2448
2448
|
app.get("/lite/menu/categories/:category_id", (c) => tryRoute(c, () => deps.lite.getMenuCategory(c.req.param("category_id"))));
|
|
2449
2449
|
app.get("/fx/rate", (c) => tryRoute(c, () => deps.fx.getRate(c.req.query("from") ?? "USD", c.req.query("to") ?? "GHS")));
|
|
@@ -5546,8 +5546,8 @@ function createLiteService(opts) {
|
|
|
5546
5546
|
tables: []
|
|
5547
5547
|
};
|
|
5548
5548
|
},
|
|
5549
|
-
|
|
5550
|
-
return { id:
|
|
5549
|
+
getResource(resourceId) {
|
|
5550
|
+
return { id: resourceId, table_number: resourceId.slice(-2), capacity: 4, occupied: false };
|
|
5551
5551
|
},
|
|
5552
5552
|
getMenu(businessId) {
|
|
5553
5553
|
const products = registry.products.list((p) => p.business_id === businessId);
|
|
@@ -96,6 +96,14 @@ var DURATION_UNIT = {
|
|
|
96
96
|
Months: "months",
|
|
97
97
|
Years: "years"
|
|
98
98
|
};
|
|
99
|
+
var BOUNDARY_KIND = {
|
|
100
|
+
CheckInOut: "check_in_out",
|
|
101
|
+
PickupReturn: "pickup_return",
|
|
102
|
+
DeliveryCollection: "delivery_collection",
|
|
103
|
+
AccessVacate: "access_vacate",
|
|
104
|
+
MoveInOut: "move_in_out",
|
|
105
|
+
Custom: "custom"
|
|
106
|
+
};
|
|
99
107
|
var INPUT_FIELD_TYPE = {
|
|
100
108
|
Text: "text",
|
|
101
109
|
Textarea: "textarea",
|
|
@@ -155,6 +163,7 @@ function appendTransform(url, t) {
|
|
|
155
163
|
return `${url}${url.includes("?") ? "&" : "?"}${query}`;
|
|
156
164
|
}
|
|
157
165
|
|
|
166
|
+
exports.BOUNDARY_KIND = BOUNDARY_KIND;
|
|
158
167
|
exports.CIMPLIFY_CDN_HOSTS = CIMPLIFY_CDN_HOSTS;
|
|
159
168
|
exports.DEFAULT_CDN_BASE_URL = DEFAULT_CDN_BASE_URL;
|
|
160
169
|
exports.DURATION_UNIT = DURATION_UNIT;
|