@cimplify/sdk 0.100.6 → 0.102.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-QPRI2NII.js → chunk-2P4KXFB6.js} +6 -0
- package/dist/{chunk-4G5UWFC3.mjs → chunk-3V4DVXV3.mjs} +6 -1
- package/dist/{chunk-KLJLKT6C.mjs → chunk-4KNFBPV2.mjs} +10 -3
- package/dist/{chunk-RQPXLXB2.mjs → chunk-DCMXUKDQ.mjs} +30 -0
- package/dist/{chunk-BMFWQNYZ.mjs → chunk-DKLHCZ5M.mjs} +4 -1
- package/dist/{chunk-PNTINRAU.js → chunk-EAZGA7LD.js} +30 -0
- package/dist/{chunk-BSZJSR62.js → chunk-LOWSMGRT.js} +12 -4
- package/dist/{chunk-D3FWJB7Y.js → chunk-YDA46OZ6.js} +50 -47
- package/dist/{chunk-3HU5I5VG.js → chunk-YER7DIOM.js} +15 -0
- package/dist/{chunk-Z7M6GAHS.mjs → chunk-Z3K2D3TE.mjs} +15 -0
- package/dist/{client-BwRAAk4y.d.mts → client-B40KFazg.d.ts} +15 -2
- package/dist/{client-DGrvLiJv.d.mts → client-BdErclfU.d.mts} +2 -2
- package/dist/{client-CrPglBBz.d.ts → client-BizGfqB7.d.mts} +15 -2
- package/dist/{client-CPcZIrjC.d.ts → client-nsiMwuC1.d.ts} +2 -2
- package/dist/{index-D-LUYk1Y.d.mts → index-DpmnI__D.d.mts} +3 -3
- package/dist/{index-B_RYmvlF.d.ts → index-nEyXWIyR.d.ts} +3 -3
- package/dist/index.d.mts +19 -8
- package/dist/index.d.ts +19 -8
- package/dist/index.js +92 -88
- package/dist/index.mjs +4 -4
- package/dist/mock/cli.mjs +30 -0
- package/dist/mock/library.js +30 -0
- package/dist/mock/library.mjs +30 -0
- package/dist/mock/msw.js +30 -0
- package/dist/mock/msw.mjs +30 -0
- package/dist/{payment-BSzy7sly.d.mts → payment-l0rkieEQ.d.mts} +1 -1
- package/dist/{payment-jK8ztICx.d.ts → payment-vzNnIi1n.d.ts} +1 -1
- package/dist/{price-CJLfcYKd.d.ts → price-BstChV9a.d.ts} +1 -1
- package/dist/{price-D96h6c6L.d.mts → price-CS4E5zLS.d.mts} +1 -1
- package/dist/{product-CeV8euw4.d.mts → product-Byf0unSy.d.mts} +745 -625
- package/dist/{product-CeV8euw4.d.ts → product-Byf0unSy.d.ts} +745 -625
- package/dist/react.d.mts +9 -4
- package/dist/react.d.ts +9 -4
- package/dist/react.js +137 -92
- package/dist/react.mjs +58 -13
- package/dist/server/evict.d.mts +12 -8
- package/dist/server/evict.d.ts +12 -8
- package/dist/server/evict.js +53 -7
- package/dist/server/evict.mjs +53 -7
- package/dist/server/tanstack.d.mts +4 -2
- package/dist/server/tanstack.d.ts +4 -2
- package/dist/server/tanstack.js +53 -14
- package/dist/server/tanstack.mjs +53 -14
- package/dist/{server-zyrpzJVn.d.ts → server-Cj40R2ZD.d.ts} +13 -1
- package/dist/{server-DRAW2OOX.d.mts → server-DqbZh8Bk.d.mts} +13 -1
- 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/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 +52 -21
- package/dist/testing.d.ts +52 -21
- package/dist/testing.js +83 -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/cart-summary.json +1 -1
- package/registry/chat-widget.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkYER7DIOM_js = require('./chunk-YER7DIOM.js');
|
|
4
4
|
var chunkNIOUSKQQ_js = require('./chunk-NIOUSKQQ.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 chunkYER7DIOM_js.safe(this.client.get("/api/v1/store-credit/balance"));
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -262,7 +262,7 @@ var ActivityService = class {
|
|
|
262
262
|
this.sendEvents([event]);
|
|
263
263
|
}
|
|
264
264
|
async getState() {
|
|
265
|
-
return
|
|
265
|
+
return chunkYER7DIOM_js.safe(this.client.get("/api/v1/activity/state"));
|
|
266
266
|
}
|
|
267
267
|
async getRecommendations(options) {
|
|
268
268
|
const params = new URLSearchParams();
|
|
@@ -270,10 +270,10 @@ var ActivityService = class {
|
|
|
270
270
|
if (options?.limit) params.set("limit", String(options.limit));
|
|
271
271
|
const query = params.toString();
|
|
272
272
|
const path = query ? `/api/v1/activity/recommendations?${query}` : "/api/v1/activity/recommendations";
|
|
273
|
-
return
|
|
273
|
+
return chunkYER7DIOM_js.safe(this.client.get(path));
|
|
274
274
|
}
|
|
275
275
|
async dismissMessage(code) {
|
|
276
|
-
return
|
|
276
|
+
return chunkYER7DIOM_js.safe(
|
|
277
277
|
this.client.post("/api/v1/activity/messages/dismiss", { code })
|
|
278
278
|
);
|
|
279
279
|
}
|
|
@@ -369,16 +369,16 @@ var SubscriptionService = class {
|
|
|
369
369
|
this.client = client;
|
|
370
370
|
}
|
|
371
371
|
async list() {
|
|
372
|
-
return
|
|
372
|
+
return chunkYER7DIOM_js.safe(this.client.get("/api/v1/subscriptions"));
|
|
373
373
|
}
|
|
374
374
|
async get(id) {
|
|
375
375
|
const encodedId = encodeURIComponent(id);
|
|
376
|
-
return
|
|
376
|
+
return chunkYER7DIOM_js.safe(this.client.get(`/api/v1/subscriptions/${encodedId}`));
|
|
377
377
|
}
|
|
378
378
|
async cancel(id, reason, opts) {
|
|
379
379
|
const encodedId = encodeURIComponent(id);
|
|
380
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
381
|
-
return
|
|
380
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkYER7DIOM_js.generateIdempotencyKey();
|
|
381
|
+
return chunkYER7DIOM_js.safe(
|
|
382
382
|
this.client.post(
|
|
383
383
|
`/api/v1/subscriptions/${encodedId}/cancel`,
|
|
384
384
|
{ reason },
|
|
@@ -388,20 +388,20 @@ var SubscriptionService = class {
|
|
|
388
388
|
}
|
|
389
389
|
async pause(id) {
|
|
390
390
|
const encodedId = encodeURIComponent(id);
|
|
391
|
-
return
|
|
391
|
+
return chunkYER7DIOM_js.safe(
|
|
392
392
|
this.client.post(`/api/v1/subscriptions/${encodedId}/pause`)
|
|
393
393
|
);
|
|
394
394
|
}
|
|
395
395
|
async resume(id) {
|
|
396
396
|
const encodedId = encodeURIComponent(id);
|
|
397
|
-
return
|
|
397
|
+
return chunkYER7DIOM_js.safe(
|
|
398
398
|
this.client.post(`/api/v1/subscriptions/${encodedId}/resume`)
|
|
399
399
|
);
|
|
400
400
|
}
|
|
401
401
|
async skipNextRenewal(id, opts) {
|
|
402
402
|
const encodedId = encodeURIComponent(id);
|
|
403
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
404
|
-
return
|
|
403
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkYER7DIOM_js.generateIdempotencyKey();
|
|
404
|
+
return chunkYER7DIOM_js.safe(
|
|
405
405
|
this.client.post(
|
|
406
406
|
`/api/v1/subscriptions/${encodedId}/skip`,
|
|
407
407
|
void 0,
|
|
@@ -417,8 +417,8 @@ var UploadService = class {
|
|
|
417
417
|
this.client = client;
|
|
418
418
|
}
|
|
419
419
|
async init(filename, contentType, sizeBytes, opts) {
|
|
420
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
421
|
-
return
|
|
420
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkYER7DIOM_js.generateIdempotencyKey();
|
|
421
|
+
return chunkYER7DIOM_js.safe(
|
|
422
422
|
this.client.post(
|
|
423
423
|
"/api/v1/uploads/init",
|
|
424
424
|
{
|
|
@@ -431,7 +431,7 @@ var UploadService = class {
|
|
|
431
431
|
);
|
|
432
432
|
}
|
|
433
433
|
async confirm(uploadId) {
|
|
434
|
-
return
|
|
434
|
+
return chunkYER7DIOM_js.safe(
|
|
435
435
|
this.client.post("/api/v1/uploads/confirm", {
|
|
436
436
|
upload_id: uploadId
|
|
437
437
|
})
|
|
@@ -477,7 +477,7 @@ var PlacesService = class {
|
|
|
477
477
|
this.client = client;
|
|
478
478
|
}
|
|
479
479
|
async autocomplete(input, sessionToken) {
|
|
480
|
-
return
|
|
480
|
+
return chunkYER7DIOM_js.safe(
|
|
481
481
|
this.client.post("/api/v1/places/autocomplete", {
|
|
482
482
|
input,
|
|
483
483
|
sessionToken
|
|
@@ -485,7 +485,7 @@ var PlacesService = class {
|
|
|
485
485
|
);
|
|
486
486
|
}
|
|
487
487
|
async details(placeId, sessionToken) {
|
|
488
|
-
return
|
|
488
|
+
return chunkYER7DIOM_js.safe(
|
|
489
489
|
this.client.post("/api/v1/places/details", {
|
|
490
490
|
place_id: placeId,
|
|
491
491
|
sessionToken
|
|
@@ -504,7 +504,7 @@ var DeliveryService = class {
|
|
|
504
504
|
params.set("dropoff_lat", String(dropoffLat));
|
|
505
505
|
params.set("dropoff_lng", String(dropoffLng));
|
|
506
506
|
if (country) params.set("country", country);
|
|
507
|
-
return
|
|
507
|
+
return chunkYER7DIOM_js.safe(this.client.get(`/api/v1/delivery/fee?${params.toString()}`));
|
|
508
508
|
}
|
|
509
509
|
async getOptions(queryOrLatitude, longitude, legacyOptions) {
|
|
510
510
|
const query = typeof queryOrLatitude === "number" ? {
|
|
@@ -518,7 +518,7 @@ var DeliveryService = class {
|
|
|
518
518
|
if (query.country) params.set("country", query.country);
|
|
519
519
|
if (query.currency) params.set("currency", query.currency);
|
|
520
520
|
if (query.orderValue != null) params.set("order_value", String(query.orderValue));
|
|
521
|
-
return
|
|
521
|
+
return chunkYER7DIOM_js.safe(
|
|
522
522
|
this.client.get(`/api/v1/delivery/options?${params.toString()}`)
|
|
523
523
|
);
|
|
524
524
|
}
|
|
@@ -595,7 +595,7 @@ var SupportService = class {
|
|
|
595
595
|
async claimConversation() {
|
|
596
596
|
const accessToken = this.client.getAccessToken();
|
|
597
597
|
if (!accessToken) {
|
|
598
|
-
return
|
|
598
|
+
return chunkYER7DIOM_js.err(new chunkNIOUSKQQ_js.CimplifyError("not_authenticated", "No access token to claim with"));
|
|
599
599
|
}
|
|
600
600
|
if (this.claimInFlight) {
|
|
601
601
|
if (this.claimInFlightToken === accessToken) return this.claimInFlight;
|
|
@@ -603,12 +603,12 @@ var SupportService = class {
|
|
|
603
603
|
return this.claimConversation();
|
|
604
604
|
}
|
|
605
605
|
if (this.lastClaimedAccessToken === accessToken) {
|
|
606
|
-
return
|
|
606
|
+
return chunkYER7DIOM_js.err(new chunkNIOUSKQQ_js.CimplifyError("already_claimed", "Session already claimed for this token"));
|
|
607
607
|
}
|
|
608
608
|
const epoch = this.client.getSessionEpoch();
|
|
609
609
|
this.claimInFlightToken = accessToken;
|
|
610
610
|
this.claimInFlight = (async () => {
|
|
611
|
-
const result = await
|
|
611
|
+
const result = await chunkYER7DIOM_js.safe(
|
|
612
612
|
this.client.post(
|
|
613
613
|
"/api/v1/support/conversation/claim",
|
|
614
614
|
{ access_token: accessToken },
|
|
@@ -617,7 +617,7 @@ var SupportService = class {
|
|
|
617
617
|
);
|
|
618
618
|
if (result.ok) {
|
|
619
619
|
if (this.client.getSessionEpoch() !== epoch) {
|
|
620
|
-
return
|
|
620
|
+
return chunkYER7DIOM_js.err(
|
|
621
621
|
new chunkNIOUSKQQ_js.CimplifyError("session_cleared", "Session was cleared during the claim")
|
|
622
622
|
);
|
|
623
623
|
}
|
|
@@ -646,20 +646,20 @@ var SupportService = class {
|
|
|
646
646
|
* the inbox with empty threads.
|
|
647
647
|
*/
|
|
648
648
|
async peekConversation() {
|
|
649
|
-
const result = await
|
|
649
|
+
const result = await chunkYER7DIOM_js.safe(
|
|
650
650
|
this.client.get("/api/v1/support/conversation")
|
|
651
651
|
);
|
|
652
652
|
if (!result.ok) return result;
|
|
653
|
-
if (!result.value.conversation) return
|
|
654
|
-
return
|
|
653
|
+
if (!result.value.conversation) return chunkYER7DIOM_js.ok(null);
|
|
654
|
+
return chunkYER7DIOM_js.ok({
|
|
655
655
|
conversation: result.value.conversation,
|
|
656
656
|
messages: result.value.messages
|
|
657
657
|
});
|
|
658
658
|
}
|
|
659
659
|
/** Open (or resume) the customer's widget conversation. */
|
|
660
660
|
async openConversation(opts) {
|
|
661
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
662
|
-
return
|
|
661
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkYER7DIOM_js.generateIdempotencyKey();
|
|
662
|
+
return chunkYER7DIOM_js.safe(
|
|
663
663
|
this.client.post("/api/v1/support/conversation", void 0, {
|
|
664
664
|
idempotencyKey
|
|
665
665
|
})
|
|
@@ -674,8 +674,8 @@ var SupportService = class {
|
|
|
674
674
|
* server resolves it thread-scoped and echoes the quote as `reply_to`.
|
|
675
675
|
*/
|
|
676
676
|
async sendMessage(content, opts) {
|
|
677
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
678
|
-
return
|
|
677
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkYER7DIOM_js.generateIdempotencyKey();
|
|
678
|
+
return chunkYER7DIOM_js.safe(
|
|
679
679
|
this.client.post(
|
|
680
680
|
"/api/v1/support/conversation/messages",
|
|
681
681
|
{
|
|
@@ -699,11 +699,11 @@ var SupportService = class {
|
|
|
699
699
|
if (options.limit) params.set("limit", String(options.limit));
|
|
700
700
|
const query = params.toString();
|
|
701
701
|
const path = query ? `/api/v1/support/conversation/messages?${query}` : "/api/v1/support/conversation/messages";
|
|
702
|
-
return
|
|
702
|
+
return chunkYER7DIOM_js.safe(this.client.get(path));
|
|
703
703
|
}
|
|
704
704
|
/** React to a message in the active conversation by its `ChatMessage.id`. */
|
|
705
705
|
async reactToMessage(messageId, emoji) {
|
|
706
|
-
return
|
|
706
|
+
return chunkYER7DIOM_js.safe(
|
|
707
707
|
this.client.post(
|
|
708
708
|
`/api/v1/support/conversation/messages/${messageId}/reactions`,
|
|
709
709
|
{ emoji }
|
|
@@ -712,8 +712,8 @@ var SupportService = class {
|
|
|
712
712
|
}
|
|
713
713
|
/** Ask for a person: flags the thread for the merchant's inbox. */
|
|
714
714
|
async requestHuman(opts) {
|
|
715
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
716
|
-
return
|
|
715
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkYER7DIOM_js.generateIdempotencyKey();
|
|
716
|
+
return chunkYER7DIOM_js.safe(
|
|
717
717
|
this.client.post(
|
|
718
718
|
"/api/v1/support/conversation/handoff",
|
|
719
719
|
void 0,
|
|
@@ -972,6 +972,9 @@ var CimplifyClient = class {
|
|
|
972
972
|
getSessionEpoch() {
|
|
973
973
|
return this.sessionEpoch;
|
|
974
974
|
}
|
|
975
|
+
getSessionToken() {
|
|
976
|
+
return this.sessionToken;
|
|
977
|
+
}
|
|
975
978
|
publishSessionClaimed(customerName) {
|
|
976
979
|
if (!this.sessionToken) return;
|
|
977
980
|
this.broadcastSessionSync({
|
|
@@ -1445,25 +1448,25 @@ var CimplifyClient = class {
|
|
|
1445
1448
|
}
|
|
1446
1449
|
get catalogue() {
|
|
1447
1450
|
if (!this._catalogue) {
|
|
1448
|
-
this._catalogue = new
|
|
1451
|
+
this._catalogue = new chunkYER7DIOM_js.CatalogueQueries(this);
|
|
1449
1452
|
}
|
|
1450
1453
|
return this._catalogue;
|
|
1451
1454
|
}
|
|
1452
1455
|
get cart() {
|
|
1453
1456
|
if (!this._cart) {
|
|
1454
|
-
this._cart = new
|
|
1457
|
+
this._cart = new chunkYER7DIOM_js.CartOperations(this);
|
|
1455
1458
|
}
|
|
1456
1459
|
return this._cart;
|
|
1457
1460
|
}
|
|
1458
1461
|
get checkout() {
|
|
1459
1462
|
if (!this._checkout) {
|
|
1460
|
-
this._checkout = new
|
|
1463
|
+
this._checkout = new chunkYER7DIOM_js.CheckoutService(this);
|
|
1461
1464
|
}
|
|
1462
1465
|
return this._checkout;
|
|
1463
1466
|
}
|
|
1464
1467
|
get orders() {
|
|
1465
1468
|
if (!this._orders) {
|
|
1466
|
-
this._orders = new
|
|
1469
|
+
this._orders = new chunkYER7DIOM_js.OrderQueries(this);
|
|
1467
1470
|
}
|
|
1468
1471
|
return this._orders;
|
|
1469
1472
|
}
|
|
@@ -1493,43 +1496,43 @@ var CimplifyClient = class {
|
|
|
1493
1496
|
}
|
|
1494
1497
|
get link() {
|
|
1495
1498
|
if (!this._link) {
|
|
1496
|
-
this._link = new
|
|
1499
|
+
this._link = new chunkYER7DIOM_js.LinkService(this);
|
|
1497
1500
|
}
|
|
1498
1501
|
return this._link;
|
|
1499
1502
|
}
|
|
1500
1503
|
get auth() {
|
|
1501
1504
|
if (!this._auth) {
|
|
1502
|
-
this._auth = new
|
|
1505
|
+
this._auth = new chunkYER7DIOM_js.AuthService(this);
|
|
1503
1506
|
}
|
|
1504
1507
|
return this._auth;
|
|
1505
1508
|
}
|
|
1506
1509
|
get business() {
|
|
1507
1510
|
if (!this._business) {
|
|
1508
|
-
this._business = new
|
|
1511
|
+
this._business = new chunkYER7DIOM_js.BusinessService(this);
|
|
1509
1512
|
}
|
|
1510
1513
|
return this._business;
|
|
1511
1514
|
}
|
|
1512
1515
|
get inventory() {
|
|
1513
1516
|
if (!this._inventory) {
|
|
1514
|
-
this._inventory = new
|
|
1517
|
+
this._inventory = new chunkYER7DIOM_js.InventoryService(this);
|
|
1515
1518
|
}
|
|
1516
1519
|
return this._inventory;
|
|
1517
1520
|
}
|
|
1518
1521
|
get scheduling() {
|
|
1519
1522
|
if (!this._scheduling) {
|
|
1520
|
-
this._scheduling = new
|
|
1523
|
+
this._scheduling = new chunkYER7DIOM_js.SchedulingService(this);
|
|
1521
1524
|
}
|
|
1522
1525
|
return this._scheduling;
|
|
1523
1526
|
}
|
|
1524
1527
|
get lite() {
|
|
1525
1528
|
if (!this._lite) {
|
|
1526
|
-
this._lite = new
|
|
1529
|
+
this._lite = new chunkYER7DIOM_js.LiteService(this);
|
|
1527
1530
|
}
|
|
1528
1531
|
return this._lite;
|
|
1529
1532
|
}
|
|
1530
1533
|
get fx() {
|
|
1531
1534
|
if (!this._fx) {
|
|
1532
|
-
this._fx = new
|
|
1535
|
+
this._fx = new chunkYER7DIOM_js.FxService(this);
|
|
1533
1536
|
}
|
|
1534
1537
|
return this._fx;
|
|
1535
1538
|
}
|
|
@@ -1564,7 +1567,7 @@ var CimplifyClient = class {
|
|
|
1564
1567
|
if (businessId) {
|
|
1565
1568
|
this.setBusinessId(businessId);
|
|
1566
1569
|
}
|
|
1567
|
-
return
|
|
1570
|
+
return chunkYER7DIOM_js.createElements(this, businessId ?? this.businessId ?? void 0, options);
|
|
1568
1571
|
}
|
|
1569
1572
|
};
|
|
1570
1573
|
function createCimplifyClient(config = {}) {
|
|
@@ -668,6 +668,9 @@ var CartOperations = class {
|
|
|
668
668
|
async getTotal() {
|
|
669
669
|
return safe(this.client.get("/api/v1/cart/total"));
|
|
670
670
|
}
|
|
671
|
+
async quoteDestination(input) {
|
|
672
|
+
return safe(this.client.post("/api/v1/cart/destination-quote", input));
|
|
673
|
+
}
|
|
671
674
|
async getSummary() {
|
|
672
675
|
const cartResult = await this.get();
|
|
673
676
|
if (!cartResult.ok) return cartResult;
|
|
@@ -2370,6 +2373,7 @@ var ELEMENT_TYPES = {
|
|
|
2370
2373
|
var MESSAGE_TYPES = {
|
|
2371
2374
|
INIT: "init",
|
|
2372
2375
|
SET_TOKEN: "set_token",
|
|
2376
|
+
SET_SESSION: "set_session",
|
|
2373
2377
|
SET_CART: "set_cart",
|
|
2374
2378
|
GET_DATA: "get_data",
|
|
2375
2379
|
NAVIGATE: "navigate",
|
|
@@ -3132,6 +3136,9 @@ var CimplifyElements = class {
|
|
|
3132
3136
|
getPublicKey() {
|
|
3133
3137
|
return this.client.getPublicKey();
|
|
3134
3138
|
}
|
|
3139
|
+
getSessionToken() {
|
|
3140
|
+
return this.client.getSessionToken();
|
|
3141
|
+
}
|
|
3135
3142
|
getBusinessId() {
|
|
3136
3143
|
return this.businessId;
|
|
3137
3144
|
}
|
|
@@ -3239,8 +3246,12 @@ var CimplifyElements = class {
|
|
|
3239
3246
|
};
|
|
3240
3247
|
}
|
|
3241
3248
|
broadcastAccessToken(token) {
|
|
3249
|
+
const sessionToken = this.client.getSessionToken();
|
|
3242
3250
|
this.elements.forEach((element) => {
|
|
3243
3251
|
element.sendMessage({ type: MESSAGE_TYPES.SET_TOKEN, token });
|
|
3252
|
+
if (sessionToken) {
|
|
3253
|
+
element.sendMessage({ type: MESSAGE_TYPES.SET_SESSION, sessionToken });
|
|
3254
|
+
}
|
|
3244
3255
|
});
|
|
3245
3256
|
}
|
|
3246
3257
|
startEmbeddedAuth(sourceElement, request) {
|
|
@@ -3582,6 +3593,10 @@ var CimplifyElement = class {
|
|
|
3582
3593
|
if (token) {
|
|
3583
3594
|
this.sendMessage({ type: MESSAGE_TYPES.SET_TOKEN, token });
|
|
3584
3595
|
}
|
|
3596
|
+
const sessionToken = this.parent.getSessionToken();
|
|
3597
|
+
if (sessionToken) {
|
|
3598
|
+
this.sendMessage({ type: MESSAGE_TYPES.SET_SESSION, sessionToken });
|
|
3599
|
+
}
|
|
3585
3600
|
this.pendingInit = null;
|
|
3586
3601
|
}
|
|
3587
3602
|
this.flushPending();
|
|
@@ -666,6 +666,9 @@ var CartOperations = class {
|
|
|
666
666
|
async getTotal() {
|
|
667
667
|
return safe(this.client.get("/api/v1/cart/total"));
|
|
668
668
|
}
|
|
669
|
+
async quoteDestination(input) {
|
|
670
|
+
return safe(this.client.post("/api/v1/cart/destination-quote", input));
|
|
671
|
+
}
|
|
669
672
|
async getSummary() {
|
|
670
673
|
const cartResult = await this.get();
|
|
671
674
|
if (!cartResult.ok) return cartResult;
|
|
@@ -2368,6 +2371,7 @@ var ELEMENT_TYPES = {
|
|
|
2368
2371
|
var MESSAGE_TYPES = {
|
|
2369
2372
|
INIT: "init",
|
|
2370
2373
|
SET_TOKEN: "set_token",
|
|
2374
|
+
SET_SESSION: "set_session",
|
|
2371
2375
|
SET_CART: "set_cart",
|
|
2372
2376
|
GET_DATA: "get_data",
|
|
2373
2377
|
NAVIGATE: "navigate",
|
|
@@ -3130,6 +3134,9 @@ var CimplifyElements = class {
|
|
|
3130
3134
|
getPublicKey() {
|
|
3131
3135
|
return this.client.getPublicKey();
|
|
3132
3136
|
}
|
|
3137
|
+
getSessionToken() {
|
|
3138
|
+
return this.client.getSessionToken();
|
|
3139
|
+
}
|
|
3133
3140
|
getBusinessId() {
|
|
3134
3141
|
return this.businessId;
|
|
3135
3142
|
}
|
|
@@ -3237,8 +3244,12 @@ var CimplifyElements = class {
|
|
|
3237
3244
|
};
|
|
3238
3245
|
}
|
|
3239
3246
|
broadcastAccessToken(token) {
|
|
3247
|
+
const sessionToken = this.client.getSessionToken();
|
|
3240
3248
|
this.elements.forEach((element) => {
|
|
3241
3249
|
element.sendMessage({ type: MESSAGE_TYPES.SET_TOKEN, token });
|
|
3250
|
+
if (sessionToken) {
|
|
3251
|
+
element.sendMessage({ type: MESSAGE_TYPES.SET_SESSION, sessionToken });
|
|
3252
|
+
}
|
|
3242
3253
|
});
|
|
3243
3254
|
}
|
|
3244
3255
|
startEmbeddedAuth(sourceElement, request) {
|
|
@@ -3580,6 +3591,10 @@ var CimplifyElement = class {
|
|
|
3580
3591
|
if (token) {
|
|
3581
3592
|
this.sendMessage({ type: MESSAGE_TYPES.SET_TOKEN, token });
|
|
3582
3593
|
}
|
|
3594
|
+
const sessionToken = this.parent.getSessionToken();
|
|
3595
|
+
if (sessionToken) {
|
|
3596
|
+
this.sendMessage({ type: MESSAGE_TYPES.SET_SESSION, sessionToken });
|
|
3597
|
+
}
|
|
3583
3598
|
this.pendingInit = null;
|
|
3584
3599
|
}
|
|
3585
3600
|
this.flushPending();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as CimplifyError, S as Category,
|
|
2
|
-
import { a as AuthorizationType, c as PaymentMethod, I as InitializePaymentResult, S as SubmitAuthorizationInput, i as PaymentStatusResponse } from './payment-
|
|
1
|
+
import { V as CimplifyError, S as Category, b0 as Product, f as AddOnWithOptions, aT as Pagination, be as ProductWithDetails, bc as ProductVariant, bJ as VariantAxis, bK as VariantAxisSelection, A as AddOn, W as Collection, G as BundleSummary, u as Bundle, a3 as Composite, a1 as ComponentSelectionInput, a8 as CompositePriceResult, ad as CurrencyCode, U as ChosenPrice, bl as SaleInfo, b9 as ProductTaxonomy, bB as TaxonomyWithChildren, aA as EligiblePlansQuery, b4 as ProductBillingPlan, ba as ProductTimeProfile, b3 as ProductAvailabilityNow, aj as Deal, b5 as ProductDealInfo, as as DiscountValidation, bx as TagsResponse, ae as CustomAttributeDefinition, af as CustomAttributeValue, bf as PropertyFacet, bA as TaxonomyAttributeTemplate, aM as KnowledgeArticle, bC as UICart, L as CartItem, ao as DestinationQuoteInput, am as DestinationQuote, Q as CartSummary, g as AddToCartInput, N as CartMutationResult, bI as UpdateCartItemInput, ar as DiscountDetails, aR as Money, aN as LineConfiguration, bz as TaxPriceDisplayMode, bP as VariantDetails, bQ as VariantDetailsDTO, a as AddOnDetails, d as AddOnOptionDetails, b as AddOnGroupDetails, D as BundleSelectionData, aa as CompositeSelectionData, ag as CustomerInputValue, bW as components, bn as SchedulingMode, ay as DurationUnit, br as Subscription, bv as SubscriptionWithDetails } from './product-Byf0unSy.js';
|
|
2
|
+
import { a as AuthorizationType, c as PaymentMethod, I as InitializePaymentResult, S as SubmitAuthorizationInput, i as PaymentStatusResponse } from './payment-vzNnIi1n.js';
|
|
3
3
|
|
|
4
4
|
interface RequestContext {
|
|
5
5
|
method: "GET" | "POST" | "PATCH" | "DELETE";
|
|
@@ -353,6 +353,7 @@ declare class CartOperations {
|
|
|
353
353
|
getItems(): Promise<Result<CartItem[], CimplifyError>>;
|
|
354
354
|
getCount(): Promise<Result<number, CimplifyError>>;
|
|
355
355
|
getTotal(): Promise<Result<string, CimplifyError>>;
|
|
356
|
+
quoteDestination(input: DestinationQuoteInput): Promise<Result<DestinationQuote, CimplifyError>>;
|
|
356
357
|
getSummary(): Promise<Result<CartSummary, CimplifyError>>;
|
|
357
358
|
addItem(input: AddToCartInput, opts?: IdempotencyOption$8): Promise<Result<CartMutationResult, CimplifyError>>;
|
|
358
359
|
updateItem(cartItemId: string, updates: UpdateCartItemInput): Promise<Result<CartMutationResult, CimplifyError>>;
|
|
@@ -1082,6 +1083,7 @@ type ElementType = (typeof ELEMENT_TYPES)[keyof typeof ELEMENT_TYPES];
|
|
|
1082
1083
|
declare const MESSAGE_TYPES: {
|
|
1083
1084
|
readonly INIT: "init";
|
|
1084
1085
|
readonly SET_TOKEN: "set_token";
|
|
1086
|
+
readonly SET_SESSION: "set_session";
|
|
1085
1087
|
readonly SET_CART: "set_cart";
|
|
1086
1088
|
readonly GET_DATA: "get_data";
|
|
1087
1089
|
readonly NAVIGATE: "navigate";
|
|
@@ -1241,6 +1243,11 @@ interface CheckoutCartData {
|
|
|
1241
1243
|
* inside `subtotal`/`total`. Checkout labels it "included" rather than
|
|
1242
1244
|
* summing it onto the total. */
|
|
1243
1245
|
tax_inclusive: boolean;
|
|
1246
|
+
/** Tax rate in percentage points (8.25 means 8.25%). */
|
|
1247
|
+
tax_rate?: string | number;
|
|
1248
|
+
/** Reviewed presentation policy; `gross_required` markets show inclusive
|
|
1249
|
+
* prices even when the tax arithmetic is exclusive. */
|
|
1250
|
+
price_display_mode?: TaxPriceDisplayMode;
|
|
1244
1251
|
/** Deposit due now when the cart has deposit-eligible service items, so the
|
|
1245
1252
|
* checkout can offer "pay deposit now, balance later". Absent/0 otherwise. */
|
|
1246
1253
|
deposit_required?: boolean;
|
|
@@ -1262,6 +1269,10 @@ type ParentToIframeMessage = {
|
|
|
1262
1269
|
} | {
|
|
1263
1270
|
type: typeof MESSAGE_TYPES.SET_TOKEN;
|
|
1264
1271
|
token: string;
|
|
1272
|
+
} | {
|
|
1273
|
+
/** Host cart session; the iframe adopts it so destination quotes read the host's cart. */
|
|
1274
|
+
type: typeof MESSAGE_TYPES.SET_SESSION;
|
|
1275
|
+
sessionToken: string;
|
|
1265
1276
|
} | {
|
|
1266
1277
|
type: typeof MESSAGE_TYPES.NAVIGATE;
|
|
1267
1278
|
path: string;
|
|
@@ -2755,6 +2766,7 @@ declare class CimplifyElements {
|
|
|
2755
2766
|
isAuthenticated(): boolean;
|
|
2756
2767
|
getAccessToken(): string | null;
|
|
2757
2768
|
getPublicKey(): string;
|
|
2769
|
+
getSessionToken(): string | null;
|
|
2758
2770
|
getBusinessId(): string | null;
|
|
2759
2771
|
resolveBusinessId(): Promise<string | null>;
|
|
2760
2772
|
getAppearance(): ElementsOptions["appearance"];
|
|
@@ -2934,6 +2946,7 @@ declare class CimplifyClient {
|
|
|
2934
2946
|
adoptSessionToken(token: string): void;
|
|
2935
2947
|
clearSession(): void;
|
|
2936
2948
|
getSessionEpoch(): number;
|
|
2949
|
+
getSessionToken(): string | null;
|
|
2937
2950
|
publishSessionClaimed(customerName: string | null): void;
|
|
2938
2951
|
private broadcastSessionSync;
|
|
2939
2952
|
private watchCrossTabSession;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { af as CimplifyClient } from './client-
|
|
2
|
-
import { A as AppHandle, C as CreateAppOptions } from './server-
|
|
1
|
+
import { af as CimplifyClient } from './client-BizGfqB7.mjs';
|
|
2
|
+
import { A as AppHandle, C as CreateAppOptions } from './server-DqbZh8Bk.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Test client + fixtures.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as CimplifyError, S as Category,
|
|
2
|
-
import { a as AuthorizationType, c as PaymentMethod, I as InitializePaymentResult, S as SubmitAuthorizationInput, i as PaymentStatusResponse } from './payment-
|
|
1
|
+
import { V as CimplifyError, S as Category, b0 as Product, f as AddOnWithOptions, aT as Pagination, be as ProductWithDetails, bc as ProductVariant, bJ as VariantAxis, bK as VariantAxisSelection, A as AddOn, W as Collection, G as BundleSummary, u as Bundle, a3 as Composite, a1 as ComponentSelectionInput, a8 as CompositePriceResult, ad as CurrencyCode, U as ChosenPrice, bl as SaleInfo, b9 as ProductTaxonomy, bB as TaxonomyWithChildren, aA as EligiblePlansQuery, b4 as ProductBillingPlan, ba as ProductTimeProfile, b3 as ProductAvailabilityNow, aj as Deal, b5 as ProductDealInfo, as as DiscountValidation, bx as TagsResponse, ae as CustomAttributeDefinition, af as CustomAttributeValue, bf as PropertyFacet, bA as TaxonomyAttributeTemplate, aM as KnowledgeArticle, bC as UICart, L as CartItem, ao as DestinationQuoteInput, am as DestinationQuote, Q as CartSummary, g as AddToCartInput, N as CartMutationResult, bI as UpdateCartItemInput, ar as DiscountDetails, aR as Money, aN as LineConfiguration, bz as TaxPriceDisplayMode, bP as VariantDetails, bQ as VariantDetailsDTO, a as AddOnDetails, d as AddOnOptionDetails, b as AddOnGroupDetails, D as BundleSelectionData, aa as CompositeSelectionData, ag as CustomerInputValue, bW as components, bn as SchedulingMode, ay as DurationUnit, br as Subscription, bv as SubscriptionWithDetails } from './product-Byf0unSy.mjs';
|
|
2
|
+
import { a as AuthorizationType, c as PaymentMethod, I as InitializePaymentResult, S as SubmitAuthorizationInput, i as PaymentStatusResponse } from './payment-l0rkieEQ.mjs';
|
|
3
3
|
|
|
4
4
|
interface RequestContext {
|
|
5
5
|
method: "GET" | "POST" | "PATCH" | "DELETE";
|
|
@@ -353,6 +353,7 @@ declare class CartOperations {
|
|
|
353
353
|
getItems(): Promise<Result<CartItem[], CimplifyError>>;
|
|
354
354
|
getCount(): Promise<Result<number, CimplifyError>>;
|
|
355
355
|
getTotal(): Promise<Result<string, CimplifyError>>;
|
|
356
|
+
quoteDestination(input: DestinationQuoteInput): Promise<Result<DestinationQuote, CimplifyError>>;
|
|
356
357
|
getSummary(): Promise<Result<CartSummary, CimplifyError>>;
|
|
357
358
|
addItem(input: AddToCartInput, opts?: IdempotencyOption$8): Promise<Result<CartMutationResult, CimplifyError>>;
|
|
358
359
|
updateItem(cartItemId: string, updates: UpdateCartItemInput): Promise<Result<CartMutationResult, CimplifyError>>;
|
|
@@ -1082,6 +1083,7 @@ type ElementType = (typeof ELEMENT_TYPES)[keyof typeof ELEMENT_TYPES];
|
|
|
1082
1083
|
declare const MESSAGE_TYPES: {
|
|
1083
1084
|
readonly INIT: "init";
|
|
1084
1085
|
readonly SET_TOKEN: "set_token";
|
|
1086
|
+
readonly SET_SESSION: "set_session";
|
|
1085
1087
|
readonly SET_CART: "set_cart";
|
|
1086
1088
|
readonly GET_DATA: "get_data";
|
|
1087
1089
|
readonly NAVIGATE: "navigate";
|
|
@@ -1241,6 +1243,11 @@ interface CheckoutCartData {
|
|
|
1241
1243
|
* inside `subtotal`/`total`. Checkout labels it "included" rather than
|
|
1242
1244
|
* summing it onto the total. */
|
|
1243
1245
|
tax_inclusive: boolean;
|
|
1246
|
+
/** Tax rate in percentage points (8.25 means 8.25%). */
|
|
1247
|
+
tax_rate?: string | number;
|
|
1248
|
+
/** Reviewed presentation policy; `gross_required` markets show inclusive
|
|
1249
|
+
* prices even when the tax arithmetic is exclusive. */
|
|
1250
|
+
price_display_mode?: TaxPriceDisplayMode;
|
|
1244
1251
|
/** Deposit due now when the cart has deposit-eligible service items, so the
|
|
1245
1252
|
* checkout can offer "pay deposit now, balance later". Absent/0 otherwise. */
|
|
1246
1253
|
deposit_required?: boolean;
|
|
@@ -1262,6 +1269,10 @@ type ParentToIframeMessage = {
|
|
|
1262
1269
|
} | {
|
|
1263
1270
|
type: typeof MESSAGE_TYPES.SET_TOKEN;
|
|
1264
1271
|
token: string;
|
|
1272
|
+
} | {
|
|
1273
|
+
/** Host cart session; the iframe adopts it so destination quotes read the host's cart. */
|
|
1274
|
+
type: typeof MESSAGE_TYPES.SET_SESSION;
|
|
1275
|
+
sessionToken: string;
|
|
1265
1276
|
} | {
|
|
1266
1277
|
type: typeof MESSAGE_TYPES.NAVIGATE;
|
|
1267
1278
|
path: string;
|
|
@@ -2755,6 +2766,7 @@ declare class CimplifyElements {
|
|
|
2755
2766
|
isAuthenticated(): boolean;
|
|
2756
2767
|
getAccessToken(): string | null;
|
|
2757
2768
|
getPublicKey(): string;
|
|
2769
|
+
getSessionToken(): string | null;
|
|
2758
2770
|
getBusinessId(): string | null;
|
|
2759
2771
|
resolveBusinessId(): Promise<string | null>;
|
|
2760
2772
|
getAppearance(): ElementsOptions["appearance"];
|
|
@@ -2934,6 +2946,7 @@ declare class CimplifyClient {
|
|
|
2934
2946
|
adoptSessionToken(token: string): void;
|
|
2935
2947
|
clearSession(): void;
|
|
2936
2948
|
getSessionEpoch(): number;
|
|
2949
|
+
getSessionToken(): string | null;
|
|
2937
2950
|
publishSessionClaimed(customerName: string | null): void;
|
|
2938
2951
|
private broadcastSessionSync;
|
|
2939
2952
|
private watchCrossTabSession;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { af as CimplifyClient } from './client-
|
|
2
|
-
import { A as AppHandle, C as CreateAppOptions } from './server-
|
|
1
|
+
import { af as CimplifyClient } from './client-B40KFazg.js';
|
|
2
|
+
import { A as AppHandle, C as CreateAppOptions } from './server-Cj40R2ZD.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Test client + fixtures.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { P as ProductWithPrice } from './price-
|
|
3
|
-
import { b as PaymentErrorDetails, g as PaymentResponse, i as PaymentStatusResponse } from './payment-
|
|
1
|
+
import { aR as Money, ad as CurrencyCode, a_ as PricePathTaxInfo, b0 as Product, be as ProductWithDetails, bh as QuantityPricingTier } from './product-Byf0unSy.mjs';
|
|
2
|
+
import { P as ProductWithPrice } from './price-CS4E5zLS.mjs';
|
|
3
|
+
import { b as PaymentErrorDetails, g as PaymentResponse, i as PaymentStatusResponse } from './payment-l0rkieEQ.mjs';
|
|
4
4
|
import { CountryCode } from 'libphonenumber-js';
|
|
5
5
|
|
|
6
6
|
declare const CURRENCY_SYMBOLS: Record<string, string>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { P as ProductWithPrice } from './price-
|
|
3
|
-
import { b as PaymentErrorDetails, g as PaymentResponse, i as PaymentStatusResponse } from './payment-
|
|
1
|
+
import { aR as Money, ad as CurrencyCode, a_ as PricePathTaxInfo, b0 as Product, be as ProductWithDetails, bh as QuantityPricingTier } from './product-Byf0unSy.js';
|
|
2
|
+
import { P as ProductWithPrice } from './price-BstChV9a.js';
|
|
3
|
+
import { b as PaymentErrorDetails, g as PaymentResponse, i as PaymentStatusResponse } from './payment-vzNnIi1n.js';
|
|
4
4
|
import { CountryCode } from 'libphonenumber-js';
|
|
5
5
|
|
|
6
6
|
declare const CURRENCY_SYMBOLS: Record<string, string>;
|