@cimplify/sdk 0.22.3 → 0.22.4
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.js +20 -20
- package/dist/advanced.mjs +1 -1
- package/dist/{chunk-RETQI2CJ.js → chunk-4M2D57C3.js} +14 -1
- package/dist/{chunk-KBKAYGMI.mjs → chunk-JD3ZHI4S.mjs} +1 -1
- package/dist/{chunk-7QQOYYEB.js → chunk-RRO6ZDZI.js} +17 -17
- package/dist/{chunk-X7FRCS2Q.mjs → chunk-WX54U6Y2.mjs} +14 -1
- package/dist/index.js +58 -58
- package/dist/index.mjs +2 -2
- package/dist/react.js +19 -19
- package/dist/react.mjs +3 -3
- package/package.json +1 -1
package/dist/advanced.js
CHANGED
|
@@ -1,83 +1,83 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk4M2D57C3_js = require('./chunk-4M2D57C3.js');
|
|
4
4
|
require('./chunk-64OCG2TJ.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "AuthService", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunk4M2D57C3_js.AuthService; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "BusinessService", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunk4M2D57C3_js.BusinessService; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "CartOperations", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunk4M2D57C3_js.CartOperations; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "CatalogueQueries", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunk4M2D57C3_js.CatalogueQueries; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "CheckoutOperations", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunk4M2D57C3_js.CheckoutService; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "CheckoutService", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunk4M2D57C3_js.CheckoutService; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "CimplifyElement", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunk4M2D57C3_js.CimplifyElement; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "CimplifyElements", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunk4M2D57C3_js.CimplifyElements; }
|
|
39
39
|
});
|
|
40
40
|
Object.defineProperty(exports, "ELEMENT_TYPES", {
|
|
41
41
|
enumerable: true,
|
|
42
|
-
get: function () { return
|
|
42
|
+
get: function () { return chunk4M2D57C3_js.ELEMENT_TYPES; }
|
|
43
43
|
});
|
|
44
44
|
Object.defineProperty(exports, "EVENT_TYPES", {
|
|
45
45
|
enumerable: true,
|
|
46
|
-
get: function () { return
|
|
46
|
+
get: function () { return chunk4M2D57C3_js.EVENT_TYPES; }
|
|
47
47
|
});
|
|
48
48
|
Object.defineProperty(exports, "FxService", {
|
|
49
49
|
enumerable: true,
|
|
50
|
-
get: function () { return
|
|
50
|
+
get: function () { return chunk4M2D57C3_js.FxService; }
|
|
51
51
|
});
|
|
52
52
|
Object.defineProperty(exports, "InventoryService", {
|
|
53
53
|
enumerable: true,
|
|
54
|
-
get: function () { return
|
|
54
|
+
get: function () { return chunk4M2D57C3_js.InventoryService; }
|
|
55
55
|
});
|
|
56
56
|
Object.defineProperty(exports, "LinkService", {
|
|
57
57
|
enumerable: true,
|
|
58
|
-
get: function () { return
|
|
58
|
+
get: function () { return chunk4M2D57C3_js.LinkService; }
|
|
59
59
|
});
|
|
60
60
|
Object.defineProperty(exports, "LiteService", {
|
|
61
61
|
enumerable: true,
|
|
62
|
-
get: function () { return
|
|
62
|
+
get: function () { return chunk4M2D57C3_js.LiteService; }
|
|
63
63
|
});
|
|
64
64
|
Object.defineProperty(exports, "MESSAGE_TYPES", {
|
|
65
65
|
enumerable: true,
|
|
66
|
-
get: function () { return
|
|
66
|
+
get: function () { return chunk4M2D57C3_js.MESSAGE_TYPES; }
|
|
67
67
|
});
|
|
68
68
|
Object.defineProperty(exports, "OrderQueries", {
|
|
69
69
|
enumerable: true,
|
|
70
|
-
get: function () { return
|
|
70
|
+
get: function () { return chunk4M2D57C3_js.OrderQueries; }
|
|
71
71
|
});
|
|
72
72
|
Object.defineProperty(exports, "SchedulingService", {
|
|
73
73
|
enumerable: true,
|
|
74
|
-
get: function () { return
|
|
74
|
+
get: function () { return chunk4M2D57C3_js.SchedulingService; }
|
|
75
75
|
});
|
|
76
76
|
Object.defineProperty(exports, "createElements", {
|
|
77
77
|
enumerable: true,
|
|
78
|
-
get: function () { return
|
|
78
|
+
get: function () { return chunk4M2D57C3_js.createElements; }
|
|
79
79
|
});
|
|
80
80
|
Object.defineProperty(exports, "generateIdempotencyKey", {
|
|
81
81
|
enumerable: true,
|
|
82
|
-
get: function () { return
|
|
82
|
+
get: function () { return chunk4M2D57C3_js.generateIdempotencyKey; }
|
|
83
83
|
});
|
package/dist/advanced.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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-WX54U6Y2.mjs';
|
|
2
2
|
import './chunk-JFT63H34.mjs';
|
|
@@ -274,7 +274,20 @@ var CatalogueQueries = class {
|
|
|
274
274
|
const encodedId = encodeURIComponent(id);
|
|
275
275
|
const result = await safe(this.client.get(`/api/v1/catalogue/products/${encodedId}`));
|
|
276
276
|
if (!result.ok) return result;
|
|
277
|
-
|
|
277
|
+
const payload = result.value;
|
|
278
|
+
const rawProduct = isRecord(payload.item) ? payload.item : payload;
|
|
279
|
+
const product = normalizeCatalogueProductPayload(rawProduct);
|
|
280
|
+
if (isRecord(payload.category)) {
|
|
281
|
+
product.category = payload.category;
|
|
282
|
+
}
|
|
283
|
+
const addOnIds = rawProduct.add_on_ids;
|
|
284
|
+
if (Array.isArray(addOnIds) && addOnIds.length > 0) {
|
|
285
|
+
const addOnsResult = await this.getAddOns(product.id);
|
|
286
|
+
if (addOnsResult.ok) {
|
|
287
|
+
product.add_ons = addOnsResult.value;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return ok(product);
|
|
278
291
|
}
|
|
279
292
|
async getProductBySlug(slug) {
|
|
280
293
|
return this.getProduct(slug);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { safe, CatalogueQueries, CartOperations, CheckoutService, OrderQueries, LinkService, AuthService, BusinessService, InventoryService, SchedulingService, LiteService, FxService, createElements } from './chunk-
|
|
1
|
+
import { safe, CatalogueQueries, CartOperations, CheckoutService, OrderQueries, LinkService, AuthService, BusinessService, InventoryService, SchedulingService, LiteService, FxService, createElements } from './chunk-WX54U6Y2.mjs';
|
|
2
2
|
import { CimplifyError, ErrorCode, enrichError } from './chunk-JFT63H34.mjs';
|
|
3
3
|
|
|
4
4
|
// src/activity.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk4M2D57C3_js = require('./chunk-4M2D57C3.js');
|
|
4
4
|
var chunk64OCG2TJ_js = require('./chunk-64OCG2TJ.js');
|
|
5
5
|
|
|
6
6
|
// src/activity.ts
|
|
@@ -29,7 +29,7 @@ var ActivityService = class {
|
|
|
29
29
|
this.sendEvents([event]);
|
|
30
30
|
}
|
|
31
31
|
async getState() {
|
|
32
|
-
return
|
|
32
|
+
return chunk4M2D57C3_js.safe(this.client.get("/api/v1/activity/state"));
|
|
33
33
|
}
|
|
34
34
|
async getRecommendations(options) {
|
|
35
35
|
const params = new URLSearchParams();
|
|
@@ -37,10 +37,10 @@ var ActivityService = class {
|
|
|
37
37
|
if (options?.limit) params.set("limit", String(options.limit));
|
|
38
38
|
const query = params.toString();
|
|
39
39
|
const path = query ? `/api/v1/activity/recommendations?${query}` : "/api/v1/activity/recommendations";
|
|
40
|
-
return
|
|
40
|
+
return chunk4M2D57C3_js.safe(this.client.get(path));
|
|
41
41
|
}
|
|
42
42
|
async dismissMessage(code) {
|
|
43
|
-
return
|
|
43
|
+
return chunk4M2D57C3_js.safe(
|
|
44
44
|
this.client.post("/api/v1/activity/messages/dismiss", { code })
|
|
45
45
|
);
|
|
46
46
|
}
|
|
@@ -66,7 +66,7 @@ var DeliveryService = class {
|
|
|
66
66
|
params.set("dropoff_lat", String(dropoffLat));
|
|
67
67
|
params.set("dropoff_lng", String(dropoffLng));
|
|
68
68
|
if (country) params.set("country", country);
|
|
69
|
-
return
|
|
69
|
+
return chunk4M2D57C3_js.safe(
|
|
70
70
|
this.client.get(`/api/v1/delivery/fee?${params.toString()}`)
|
|
71
71
|
);
|
|
72
72
|
}
|
|
@@ -597,67 +597,67 @@ var CimplifyClient = class {
|
|
|
597
597
|
}
|
|
598
598
|
get catalogue() {
|
|
599
599
|
if (!this._catalogue) {
|
|
600
|
-
this._catalogue = new
|
|
600
|
+
this._catalogue = new chunk4M2D57C3_js.CatalogueQueries(this);
|
|
601
601
|
}
|
|
602
602
|
return this._catalogue;
|
|
603
603
|
}
|
|
604
604
|
get cart() {
|
|
605
605
|
if (!this._cart) {
|
|
606
|
-
this._cart = new
|
|
606
|
+
this._cart = new chunk4M2D57C3_js.CartOperations(this);
|
|
607
607
|
}
|
|
608
608
|
return this._cart;
|
|
609
609
|
}
|
|
610
610
|
get checkout() {
|
|
611
611
|
if (!this._checkout) {
|
|
612
|
-
this._checkout = new
|
|
612
|
+
this._checkout = new chunk4M2D57C3_js.CheckoutService(this);
|
|
613
613
|
}
|
|
614
614
|
return this._checkout;
|
|
615
615
|
}
|
|
616
616
|
get orders() {
|
|
617
617
|
if (!this._orders) {
|
|
618
|
-
this._orders = new
|
|
618
|
+
this._orders = new chunk4M2D57C3_js.OrderQueries(this);
|
|
619
619
|
}
|
|
620
620
|
return this._orders;
|
|
621
621
|
}
|
|
622
622
|
get link() {
|
|
623
623
|
if (!this._link) {
|
|
624
|
-
this._link = new
|
|
624
|
+
this._link = new chunk4M2D57C3_js.LinkService(this);
|
|
625
625
|
}
|
|
626
626
|
return this._link;
|
|
627
627
|
}
|
|
628
628
|
get auth() {
|
|
629
629
|
if (!this._auth) {
|
|
630
|
-
this._auth = new
|
|
630
|
+
this._auth = new chunk4M2D57C3_js.AuthService(this);
|
|
631
631
|
}
|
|
632
632
|
return this._auth;
|
|
633
633
|
}
|
|
634
634
|
get business() {
|
|
635
635
|
if (!this._business) {
|
|
636
|
-
this._business = new
|
|
636
|
+
this._business = new chunk4M2D57C3_js.BusinessService(this);
|
|
637
637
|
}
|
|
638
638
|
return this._business;
|
|
639
639
|
}
|
|
640
640
|
get inventory() {
|
|
641
641
|
if (!this._inventory) {
|
|
642
|
-
this._inventory = new
|
|
642
|
+
this._inventory = new chunk4M2D57C3_js.InventoryService(this);
|
|
643
643
|
}
|
|
644
644
|
return this._inventory;
|
|
645
645
|
}
|
|
646
646
|
get scheduling() {
|
|
647
647
|
if (!this._scheduling) {
|
|
648
|
-
this._scheduling = new
|
|
648
|
+
this._scheduling = new chunk4M2D57C3_js.SchedulingService(this);
|
|
649
649
|
}
|
|
650
650
|
return this._scheduling;
|
|
651
651
|
}
|
|
652
652
|
get lite() {
|
|
653
653
|
if (!this._lite) {
|
|
654
|
-
this._lite = new
|
|
654
|
+
this._lite = new chunk4M2D57C3_js.LiteService(this);
|
|
655
655
|
}
|
|
656
656
|
return this._lite;
|
|
657
657
|
}
|
|
658
658
|
get fx() {
|
|
659
659
|
if (!this._fx) {
|
|
660
|
-
this._fx = new
|
|
660
|
+
this._fx = new chunk4M2D57C3_js.FxService(this);
|
|
661
661
|
}
|
|
662
662
|
return this._fx;
|
|
663
663
|
}
|
|
@@ -677,7 +677,7 @@ var CimplifyClient = class {
|
|
|
677
677
|
if (businessId) {
|
|
678
678
|
this.setBusinessId(businessId);
|
|
679
679
|
}
|
|
680
|
-
return
|
|
680
|
+
return chunk4M2D57C3_js.createElements(this, businessId ?? this.businessId ?? void 0, options);
|
|
681
681
|
}
|
|
682
682
|
};
|
|
683
683
|
function createCimplifyClient(config = {}) {
|
|
@@ -272,7 +272,20 @@ var CatalogueQueries = class {
|
|
|
272
272
|
const encodedId = encodeURIComponent(id);
|
|
273
273
|
const result = await safe(this.client.get(`/api/v1/catalogue/products/${encodedId}`));
|
|
274
274
|
if (!result.ok) return result;
|
|
275
|
-
|
|
275
|
+
const payload = result.value;
|
|
276
|
+
const rawProduct = isRecord(payload.item) ? payload.item : payload;
|
|
277
|
+
const product = normalizeCatalogueProductPayload(rawProduct);
|
|
278
|
+
if (isRecord(payload.category)) {
|
|
279
|
+
product.category = payload.category;
|
|
280
|
+
}
|
|
281
|
+
const addOnIds = rawProduct.add_on_ids;
|
|
282
|
+
if (Array.isArray(addOnIds) && addOnIds.length > 0) {
|
|
283
|
+
const addOnsResult = await this.getAddOns(product.id);
|
|
284
|
+
if (addOnsResult.ok) {
|
|
285
|
+
product.add_ons = addOnsResult.value;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return ok(product);
|
|
276
289
|
}
|
|
277
290
|
async getProductBySlug(slug) {
|
|
278
291
|
return this.getProduct(slug);
|
package/dist/index.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkRRO6ZDZI_js = require('./chunk-RRO6ZDZI.js');
|
|
4
4
|
var chunkL5GKVQVJ_js = require('./chunk-L5GKVQVJ.js');
|
|
5
|
-
var
|
|
5
|
+
var chunk4M2D57C3_js = require('./chunk-4M2D57C3.js');
|
|
6
6
|
var chunk64OCG2TJ_js = require('./chunk-64OCG2TJ.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "ActivityService", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkRRO6ZDZI_js.ActivityService; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "CimplifyClient", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkRRO6ZDZI_js.CimplifyClient; }
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "DeliveryService", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunkRRO6ZDZI_js.DeliveryService; }
|
|
21
21
|
});
|
|
22
22
|
Object.defineProperty(exports, "createCimplifyClient", {
|
|
23
23
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunkRRO6ZDZI_js.createCimplifyClient; }
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "getVariantDisplayName", {
|
|
27
27
|
enumerable: true,
|
|
28
|
-
get: function () { return
|
|
28
|
+
get: function () { return chunkRRO6ZDZI_js.getVariantDisplayName; }
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "isValidPhoneForContext", {
|
|
31
31
|
enumerable: true,
|
|
@@ -41,207 +41,207 @@ Object.defineProperty(exports, "resolvePhoneCountryCode", {
|
|
|
41
41
|
});
|
|
42
42
|
Object.defineProperty(exports, "AUTHORIZATION_TYPE", {
|
|
43
43
|
enumerable: true,
|
|
44
|
-
get: function () { return
|
|
44
|
+
get: function () { return chunk4M2D57C3_js.AUTHORIZATION_TYPE; }
|
|
45
45
|
});
|
|
46
46
|
Object.defineProperty(exports, "AUTH_MUTATION", {
|
|
47
47
|
enumerable: true,
|
|
48
|
-
get: function () { return
|
|
48
|
+
get: function () { return chunk4M2D57C3_js.AUTH_MUTATION; }
|
|
49
49
|
});
|
|
50
50
|
Object.defineProperty(exports, "AuthService", {
|
|
51
51
|
enumerable: true,
|
|
52
|
-
get: function () { return
|
|
52
|
+
get: function () { return chunk4M2D57C3_js.AuthService; }
|
|
53
53
|
});
|
|
54
54
|
Object.defineProperty(exports, "BusinessService", {
|
|
55
55
|
enumerable: true,
|
|
56
|
-
get: function () { return
|
|
56
|
+
get: function () { return chunk4M2D57C3_js.BusinessService; }
|
|
57
57
|
});
|
|
58
58
|
Object.defineProperty(exports, "CHECKOUT_MODE", {
|
|
59
59
|
enumerable: true,
|
|
60
|
-
get: function () { return
|
|
60
|
+
get: function () { return chunk4M2D57C3_js.CHECKOUT_MODE; }
|
|
61
61
|
});
|
|
62
62
|
Object.defineProperty(exports, "CHECKOUT_MUTATION", {
|
|
63
63
|
enumerable: true,
|
|
64
|
-
get: function () { return
|
|
64
|
+
get: function () { return chunk4M2D57C3_js.CHECKOUT_MUTATION; }
|
|
65
65
|
});
|
|
66
66
|
Object.defineProperty(exports, "CHECKOUT_STEP", {
|
|
67
67
|
enumerable: true,
|
|
68
|
-
get: function () { return
|
|
68
|
+
get: function () { return chunk4M2D57C3_js.CHECKOUT_STEP; }
|
|
69
69
|
});
|
|
70
70
|
Object.defineProperty(exports, "CONTACT_TYPE", {
|
|
71
71
|
enumerable: true,
|
|
72
|
-
get: function () { return
|
|
72
|
+
get: function () { return chunk4M2D57C3_js.CONTACT_TYPE; }
|
|
73
73
|
});
|
|
74
74
|
Object.defineProperty(exports, "CartOperations", {
|
|
75
75
|
enumerable: true,
|
|
76
|
-
get: function () { return
|
|
76
|
+
get: function () { return chunk4M2D57C3_js.CartOperations; }
|
|
77
77
|
});
|
|
78
78
|
Object.defineProperty(exports, "CatalogueQueries", {
|
|
79
79
|
enumerable: true,
|
|
80
|
-
get: function () { return
|
|
80
|
+
get: function () { return chunk4M2D57C3_js.CatalogueQueries; }
|
|
81
81
|
});
|
|
82
82
|
Object.defineProperty(exports, "CheckoutOperations", {
|
|
83
83
|
enumerable: true,
|
|
84
|
-
get: function () { return
|
|
84
|
+
get: function () { return chunk4M2D57C3_js.CheckoutService; }
|
|
85
85
|
});
|
|
86
86
|
Object.defineProperty(exports, "CheckoutService", {
|
|
87
87
|
enumerable: true,
|
|
88
|
-
get: function () { return
|
|
88
|
+
get: function () { return chunk4M2D57C3_js.CheckoutService; }
|
|
89
89
|
});
|
|
90
90
|
Object.defineProperty(exports, "CimplifyElement", {
|
|
91
91
|
enumerable: true,
|
|
92
|
-
get: function () { return
|
|
92
|
+
get: function () { return chunk4M2D57C3_js.CimplifyElement; }
|
|
93
93
|
});
|
|
94
94
|
Object.defineProperty(exports, "CimplifyElements", {
|
|
95
95
|
enumerable: true,
|
|
96
|
-
get: function () { return
|
|
96
|
+
get: function () { return chunk4M2D57C3_js.CimplifyElements; }
|
|
97
97
|
});
|
|
98
98
|
Object.defineProperty(exports, "DEFAULT_COUNTRY", {
|
|
99
99
|
enumerable: true,
|
|
100
|
-
get: function () { return
|
|
100
|
+
get: function () { return chunk4M2D57C3_js.DEFAULT_COUNTRY; }
|
|
101
101
|
});
|
|
102
102
|
Object.defineProperty(exports, "DEFAULT_CURRENCY", {
|
|
103
103
|
enumerable: true,
|
|
104
|
-
get: function () { return
|
|
104
|
+
get: function () { return chunk4M2D57C3_js.DEFAULT_CURRENCY; }
|
|
105
105
|
});
|
|
106
106
|
Object.defineProperty(exports, "DEVICE_TYPE", {
|
|
107
107
|
enumerable: true,
|
|
108
|
-
get: function () { return
|
|
108
|
+
get: function () { return chunk4M2D57C3_js.DEVICE_TYPE; }
|
|
109
109
|
});
|
|
110
110
|
Object.defineProperty(exports, "ELEMENT_TYPES", {
|
|
111
111
|
enumerable: true,
|
|
112
|
-
get: function () { return
|
|
112
|
+
get: function () { return chunk4M2D57C3_js.ELEMENT_TYPES; }
|
|
113
113
|
});
|
|
114
114
|
Object.defineProperty(exports, "EVENT_TYPES", {
|
|
115
115
|
enumerable: true,
|
|
116
|
-
get: function () { return
|
|
116
|
+
get: function () { return chunk4M2D57C3_js.EVENT_TYPES; }
|
|
117
117
|
});
|
|
118
118
|
Object.defineProperty(exports, "FxService", {
|
|
119
119
|
enumerable: true,
|
|
120
|
-
get: function () { return
|
|
120
|
+
get: function () { return chunk4M2D57C3_js.FxService; }
|
|
121
121
|
});
|
|
122
122
|
Object.defineProperty(exports, "InventoryService", {
|
|
123
123
|
enumerable: true,
|
|
124
|
-
get: function () { return
|
|
124
|
+
get: function () { return chunk4M2D57C3_js.InventoryService; }
|
|
125
125
|
});
|
|
126
126
|
Object.defineProperty(exports, "LINK_MUTATION", {
|
|
127
127
|
enumerable: true,
|
|
128
|
-
get: function () { return
|
|
128
|
+
get: function () { return chunk4M2D57C3_js.LINK_MUTATION; }
|
|
129
129
|
});
|
|
130
130
|
Object.defineProperty(exports, "LINK_QUERY", {
|
|
131
131
|
enumerable: true,
|
|
132
|
-
get: function () { return
|
|
132
|
+
get: function () { return chunk4M2D57C3_js.LINK_QUERY; }
|
|
133
133
|
});
|
|
134
134
|
Object.defineProperty(exports, "LinkService", {
|
|
135
135
|
enumerable: true,
|
|
136
|
-
get: function () { return
|
|
136
|
+
get: function () { return chunk4M2D57C3_js.LinkService; }
|
|
137
137
|
});
|
|
138
138
|
Object.defineProperty(exports, "LiteService", {
|
|
139
139
|
enumerable: true,
|
|
140
|
-
get: function () { return
|
|
140
|
+
get: function () { return chunk4M2D57C3_js.LiteService; }
|
|
141
141
|
});
|
|
142
142
|
Object.defineProperty(exports, "MESSAGE_TYPES", {
|
|
143
143
|
enumerable: true,
|
|
144
|
-
get: function () { return
|
|
144
|
+
get: function () { return chunk4M2D57C3_js.MESSAGE_TYPES; }
|
|
145
145
|
});
|
|
146
146
|
Object.defineProperty(exports, "MOBILE_MONEY_PROVIDER", {
|
|
147
147
|
enumerable: true,
|
|
148
|
-
get: function () { return
|
|
148
|
+
get: function () { return chunk4M2D57C3_js.MOBILE_MONEY_PROVIDER; }
|
|
149
149
|
});
|
|
150
150
|
Object.defineProperty(exports, "ORDER_MUTATION", {
|
|
151
151
|
enumerable: true,
|
|
152
|
-
get: function () { return
|
|
152
|
+
get: function () { return chunk4M2D57C3_js.ORDER_MUTATION; }
|
|
153
153
|
});
|
|
154
154
|
Object.defineProperty(exports, "ORDER_TYPE", {
|
|
155
155
|
enumerable: true,
|
|
156
|
-
get: function () { return
|
|
156
|
+
get: function () { return chunk4M2D57C3_js.ORDER_TYPE; }
|
|
157
157
|
});
|
|
158
158
|
Object.defineProperty(exports, "OrderQueries", {
|
|
159
159
|
enumerable: true,
|
|
160
|
-
get: function () { return
|
|
160
|
+
get: function () { return chunk4M2D57C3_js.OrderQueries; }
|
|
161
161
|
});
|
|
162
162
|
Object.defineProperty(exports, "PAYMENT_METHOD", {
|
|
163
163
|
enumerable: true,
|
|
164
|
-
get: function () { return
|
|
164
|
+
get: function () { return chunk4M2D57C3_js.PAYMENT_METHOD; }
|
|
165
165
|
});
|
|
166
166
|
Object.defineProperty(exports, "PAYMENT_MUTATION", {
|
|
167
167
|
enumerable: true,
|
|
168
|
-
get: function () { return
|
|
168
|
+
get: function () { return chunk4M2D57C3_js.PAYMENT_MUTATION; }
|
|
169
169
|
});
|
|
170
170
|
Object.defineProperty(exports, "PAYMENT_STATE", {
|
|
171
171
|
enumerable: true,
|
|
172
|
-
get: function () { return
|
|
172
|
+
get: function () { return chunk4M2D57C3_js.PAYMENT_STATE; }
|
|
173
173
|
});
|
|
174
174
|
Object.defineProperty(exports, "PICKUP_TIME_TYPE", {
|
|
175
175
|
enumerable: true,
|
|
176
|
-
get: function () { return
|
|
176
|
+
get: function () { return chunk4M2D57C3_js.PICKUP_TIME_TYPE; }
|
|
177
177
|
});
|
|
178
178
|
Object.defineProperty(exports, "SchedulingService", {
|
|
179
179
|
enumerable: true,
|
|
180
|
-
get: function () { return
|
|
180
|
+
get: function () { return chunk4M2D57C3_js.SchedulingService; }
|
|
181
181
|
});
|
|
182
182
|
Object.defineProperty(exports, "combine", {
|
|
183
183
|
enumerable: true,
|
|
184
|
-
get: function () { return
|
|
184
|
+
get: function () { return chunk4M2D57C3_js.combine; }
|
|
185
185
|
});
|
|
186
186
|
Object.defineProperty(exports, "combineObject", {
|
|
187
187
|
enumerable: true,
|
|
188
|
-
get: function () { return
|
|
188
|
+
get: function () { return chunk4M2D57C3_js.combineObject; }
|
|
189
189
|
});
|
|
190
190
|
Object.defineProperty(exports, "createElements", {
|
|
191
191
|
enumerable: true,
|
|
192
|
-
get: function () { return
|
|
192
|
+
get: function () { return chunk4M2D57C3_js.createElements; }
|
|
193
193
|
});
|
|
194
194
|
Object.defineProperty(exports, "err", {
|
|
195
195
|
enumerable: true,
|
|
196
|
-
get: function () { return
|
|
196
|
+
get: function () { return chunk4M2D57C3_js.err; }
|
|
197
197
|
});
|
|
198
198
|
Object.defineProperty(exports, "flatMap", {
|
|
199
199
|
enumerable: true,
|
|
200
|
-
get: function () { return
|
|
200
|
+
get: function () { return chunk4M2D57C3_js.flatMap; }
|
|
201
201
|
});
|
|
202
202
|
Object.defineProperty(exports, "fromPromise", {
|
|
203
203
|
enumerable: true,
|
|
204
|
-
get: function () { return
|
|
204
|
+
get: function () { return chunk4M2D57C3_js.fromPromise; }
|
|
205
205
|
});
|
|
206
206
|
Object.defineProperty(exports, "generateIdempotencyKey", {
|
|
207
207
|
enumerable: true,
|
|
208
|
-
get: function () { return
|
|
208
|
+
get: function () { return chunk4M2D57C3_js.generateIdempotencyKey; }
|
|
209
209
|
});
|
|
210
210
|
Object.defineProperty(exports, "getOrElse", {
|
|
211
211
|
enumerable: true,
|
|
212
|
-
get: function () { return
|
|
212
|
+
get: function () { return chunk4M2D57C3_js.getOrElse; }
|
|
213
213
|
});
|
|
214
214
|
Object.defineProperty(exports, "isErr", {
|
|
215
215
|
enumerable: true,
|
|
216
|
-
get: function () { return
|
|
216
|
+
get: function () { return chunk4M2D57C3_js.isErr; }
|
|
217
217
|
});
|
|
218
218
|
Object.defineProperty(exports, "isOk", {
|
|
219
219
|
enumerable: true,
|
|
220
|
-
get: function () { return
|
|
220
|
+
get: function () { return chunk4M2D57C3_js.isOk; }
|
|
221
221
|
});
|
|
222
222
|
Object.defineProperty(exports, "mapError", {
|
|
223
223
|
enumerable: true,
|
|
224
|
-
get: function () { return
|
|
224
|
+
get: function () { return chunk4M2D57C3_js.mapError; }
|
|
225
225
|
});
|
|
226
226
|
Object.defineProperty(exports, "mapResult", {
|
|
227
227
|
enumerable: true,
|
|
228
|
-
get: function () { return
|
|
228
|
+
get: function () { return chunk4M2D57C3_js.mapResult; }
|
|
229
229
|
});
|
|
230
230
|
Object.defineProperty(exports, "ok", {
|
|
231
231
|
enumerable: true,
|
|
232
|
-
get: function () { return
|
|
232
|
+
get: function () { return chunk4M2D57C3_js.ok; }
|
|
233
233
|
});
|
|
234
234
|
Object.defineProperty(exports, "toNullable", {
|
|
235
235
|
enumerable: true,
|
|
236
|
-
get: function () { return
|
|
236
|
+
get: function () { return chunk4M2D57C3_js.toNullable; }
|
|
237
237
|
});
|
|
238
238
|
Object.defineProperty(exports, "tryCatch", {
|
|
239
239
|
enumerable: true,
|
|
240
|
-
get: function () { return
|
|
240
|
+
get: function () { return chunk4M2D57C3_js.tryCatch; }
|
|
241
241
|
});
|
|
242
242
|
Object.defineProperty(exports, "unwrap", {
|
|
243
243
|
enumerable: true,
|
|
244
|
-
get: function () { return
|
|
244
|
+
get: function () { return chunk4M2D57C3_js.unwrap; }
|
|
245
245
|
});
|
|
246
246
|
Object.defineProperty(exports, "CURRENCY_SYMBOLS", {
|
|
247
247
|
enumerable: true,
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ActivityService, CimplifyClient, DeliveryService, createCimplifyClient, getVariantDisplayName } from './chunk-
|
|
1
|
+
export { ActivityService, CimplifyClient, DeliveryService, createCimplifyClient, getVariantDisplayName } from './chunk-JD3ZHI4S.mjs';
|
|
2
2
|
export { isValidPhoneForContext, normalizePhoneToE164, resolvePhoneCountryCode } from './chunk-YOIVZ6OA.mjs';
|
|
3
|
-
export { AUTHORIZATION_TYPE, AUTH_MUTATION, AuthService, BusinessService, CHECKOUT_MODE, CHECKOUT_MUTATION, CHECKOUT_STEP, CONTACT_TYPE, CartOperations, CatalogueQueries, CheckoutService as CheckoutOperations, CheckoutService, CimplifyElement, CimplifyElements, DEFAULT_COUNTRY, DEFAULT_CURRENCY, DEVICE_TYPE, ELEMENT_TYPES, EVENT_TYPES, FxService, InventoryService, LINK_MUTATION, LINK_QUERY, LinkService, LiteService, MESSAGE_TYPES, MOBILE_MONEY_PROVIDER, ORDER_MUTATION, ORDER_TYPE, OrderQueries, PAYMENT_METHOD, PAYMENT_MUTATION, PAYMENT_STATE, PICKUP_TIME_TYPE, SchedulingService, combine, combineObject, createElements, err, flatMap, fromPromise, generateIdempotencyKey, getOrElse, isErr, isOk, mapError, mapResult, ok, toNullable, tryCatch, unwrap } from './chunk-
|
|
3
|
+
export { AUTHORIZATION_TYPE, AUTH_MUTATION, AuthService, BusinessService, CHECKOUT_MODE, CHECKOUT_MUTATION, CHECKOUT_STEP, CONTACT_TYPE, CartOperations, CatalogueQueries, CheckoutService as CheckoutOperations, CheckoutService, CimplifyElement, CimplifyElements, DEFAULT_COUNTRY, DEFAULT_CURRENCY, DEVICE_TYPE, ELEMENT_TYPES, EVENT_TYPES, FxService, InventoryService, LINK_MUTATION, LINK_QUERY, LinkService, LiteService, MESSAGE_TYPES, MOBILE_MONEY_PROVIDER, ORDER_MUTATION, ORDER_TYPE, OrderQueries, PAYMENT_METHOD, PAYMENT_MUTATION, PAYMENT_STATE, PICKUP_TIME_TYPE, SchedulingService, combine, combineObject, createElements, err, flatMap, fromPromise, generateIdempotencyKey, getOrElse, isErr, isOk, mapError, mapResult, ok, toNullable, tryCatch, unwrap } from './chunk-WX54U6Y2.mjs';
|
|
4
4
|
export { CURRENCY_SYMBOLS, CimplifyError, ERROR_HINTS, ErrorCode, MOBILE_MONEY_PROVIDERS, ZERO, categorizePaymentError, currencyCode, detectMobileMoneyProvider, enrichError, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatPriceWithTax, formatProductPrice, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getErrorHint, getMarkupPercentage, getProductCurrency, getTaxAmount, hasTaxInfo, isCimplifyError, isOnSale, isPaymentStatusFailure, isPaymentStatusRequiresAction, isPaymentStatusSuccess, isRetryableError, isSupportedCurrency, isTaxInclusive, money, moneyFromNumber, normalizePaymentResponse, normalizeStatusResponse, parsePrice } from './chunk-JFT63H34.mjs';
|
package/dist/react.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunkRRO6ZDZI_js = require('./chunk-RRO6ZDZI.js');
|
|
5
|
+
var chunk4M2D57C3_js = require('./chunk-4M2D57C3.js');
|
|
6
6
|
var chunk64OCG2TJ_js = require('./chunk-64OCG2TJ.js');
|
|
7
7
|
var React3 = require('react');
|
|
8
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -1061,7 +1061,7 @@ var DEFAULT_COUNTRY = "US";
|
|
|
1061
1061
|
function createDefaultClient() {
|
|
1062
1062
|
const processRef = globalThis.process;
|
|
1063
1063
|
const envPublicKey = processRef?.env?.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY || "";
|
|
1064
|
-
return
|
|
1064
|
+
return chunkRRO6ZDZI_js.createCimplifyClient({ publicKey: envPublicKey });
|
|
1065
1065
|
}
|
|
1066
1066
|
function getStoredLocationId() {
|
|
1067
1067
|
if (typeof window === "undefined" || !window.localStorage) {
|
|
@@ -3212,19 +3212,19 @@ function AuthElement({
|
|
|
3212
3212
|
}, [onReady, onAuthenticated, onRequiresOtp, onError]);
|
|
3213
3213
|
React3.useEffect(() => {
|
|
3214
3214
|
if (!elements || !containerRef.current) return;
|
|
3215
|
-
const element = elements.create(
|
|
3215
|
+
const element = elements.create(chunk4M2D57C3_js.ELEMENT_TYPES.AUTH, { prefillEmail });
|
|
3216
3216
|
elementRef.current = element;
|
|
3217
|
-
element.on(
|
|
3217
|
+
element.on(chunk4M2D57C3_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
3218
3218
|
element.on(
|
|
3219
|
-
|
|
3219
|
+
chunk4M2D57C3_js.EVENT_TYPES.AUTHENTICATED,
|
|
3220
3220
|
(data) => onAuthenticatedRef.current?.(data)
|
|
3221
3221
|
);
|
|
3222
3222
|
element.on(
|
|
3223
|
-
|
|
3223
|
+
chunk4M2D57C3_js.EVENT_TYPES.REQUIRES_OTP,
|
|
3224
3224
|
(data) => onRequiresOtpRef.current?.(data)
|
|
3225
3225
|
);
|
|
3226
3226
|
element.on(
|
|
3227
|
-
|
|
3227
|
+
chunk4M2D57C3_js.EVENT_TYPES.ERROR,
|
|
3228
3228
|
(data) => onErrorRef.current?.(data)
|
|
3229
3229
|
);
|
|
3230
3230
|
element.mount(containerRef.current);
|
|
@@ -3253,15 +3253,15 @@ function AddressElement({
|
|
|
3253
3253
|
}, [onReady, onChange, onError]);
|
|
3254
3254
|
React3.useEffect(() => {
|
|
3255
3255
|
if (!elements || !containerRef.current) return;
|
|
3256
|
-
const element = elements.create(
|
|
3256
|
+
const element = elements.create(chunk4M2D57C3_js.ELEMENT_TYPES.ADDRESS, { mode });
|
|
3257
3257
|
elementRef.current = element;
|
|
3258
|
-
element.on(
|
|
3258
|
+
element.on(chunk4M2D57C3_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
3259
3259
|
element.on(
|
|
3260
|
-
|
|
3260
|
+
chunk4M2D57C3_js.EVENT_TYPES.CHANGE,
|
|
3261
3261
|
(data) => onChangeRef.current?.(data)
|
|
3262
3262
|
);
|
|
3263
3263
|
element.on(
|
|
3264
|
-
|
|
3264
|
+
chunk4M2D57C3_js.EVENT_TYPES.ERROR,
|
|
3265
3265
|
(data) => onErrorRef.current?.(data)
|
|
3266
3266
|
);
|
|
3267
3267
|
element.mount(containerRef.current);
|
|
@@ -3291,15 +3291,15 @@ function PaymentElement({
|
|
|
3291
3291
|
}, [onReady, onChange, onError]);
|
|
3292
3292
|
React3.useEffect(() => {
|
|
3293
3293
|
if (!elements || !containerRef.current) return;
|
|
3294
|
-
const element = elements.create(
|
|
3294
|
+
const element = elements.create(chunk4M2D57C3_js.ELEMENT_TYPES.PAYMENT, { amount, currency });
|
|
3295
3295
|
elementRef.current = element;
|
|
3296
|
-
element.on(
|
|
3296
|
+
element.on(chunk4M2D57C3_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
3297
3297
|
element.on(
|
|
3298
|
-
|
|
3298
|
+
chunk4M2D57C3_js.EVENT_TYPES.CHANGE,
|
|
3299
3299
|
(data) => onChangeRef.current?.(data)
|
|
3300
3300
|
);
|
|
3301
3301
|
element.on(
|
|
3302
|
-
|
|
3302
|
+
chunk4M2D57C3_js.EVENT_TYPES.ERROR,
|
|
3303
3303
|
(data) => onErrorRef.current?.(data)
|
|
3304
3304
|
);
|
|
3305
3305
|
element.mount(containerRef.current);
|
|
@@ -3562,7 +3562,7 @@ function VariantSelector({
|
|
|
3562
3562
|
{
|
|
3563
3563
|
"data-cimplify-variant-name": true,
|
|
3564
3564
|
className: cn("flex-1 min-w-0 text-sm", classNames?.name),
|
|
3565
|
-
children:
|
|
3565
|
+
children: chunkRRO6ZDZI_js.getVariantDisplayName(variant, productName)
|
|
3566
3566
|
}
|
|
3567
3567
|
),
|
|
3568
3568
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-variant-pricing": true, className: cn("text-sm text-muted-foreground", classNames?.pricing), children: [
|
|
@@ -4876,7 +4876,7 @@ function CartLineItemRow({
|
|
|
4876
4876
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-item": true, className: classNames?.item, children: [
|
|
4877
4877
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-item-info": true, children: [
|
|
4878
4878
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-name": true, className: classNames?.itemName, children: item.product.name }),
|
|
4879
|
-
item.variant && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-variant": true, children:
|
|
4879
|
+
item.variant && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-variant": true, children: chunkRRO6ZDZI_js.getVariantDisplayName(item.variant, item.product.name) }),
|
|
4880
4880
|
item.addOnOptions && item.addOnOptions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-cart-item-addons": true, children: [
|
|
4881
4881
|
"+ ",
|
|
4882
4882
|
item.addOnOptions.map((opt) => opt.name).join(", ")
|
|
@@ -8601,7 +8601,7 @@ function CurrencySelector({
|
|
|
8601
8601
|
|
|
8602
8602
|
Object.defineProperty(exports, "getVariantDisplayName", {
|
|
8603
8603
|
enumerable: true,
|
|
8604
|
-
get: function () { return
|
|
8604
|
+
get: function () { return chunkRRO6ZDZI_js.getVariantDisplayName; }
|
|
8605
8605
|
});
|
|
8606
8606
|
exports.Ad = Ad;
|
|
8607
8607
|
exports.AdProvider = AdProvider;
|
package/dist/react.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { getVariantDisplayName, createCimplifyClient } from './chunk-
|
|
3
|
-
export { getVariantDisplayName } from './chunk-
|
|
4
|
-
import { ELEMENT_TYPES, EVENT_TYPES } from './chunk-
|
|
2
|
+
import { getVariantDisplayName, createCimplifyClient } from './chunk-JD3ZHI4S.mjs';
|
|
3
|
+
export { getVariantDisplayName } from './chunk-JD3ZHI4S.mjs';
|
|
4
|
+
import { ELEMENT_TYPES, EVENT_TYPES } from './chunk-WX54U6Y2.mjs';
|
|
5
5
|
import { isSupportedCurrency, formatPrice, parsePrice, isOnSale, getDiscountPercentage, getBasePrice } from './chunk-JFT63H34.mjs';
|
|
6
6
|
import React3, { createContext, useRef, useState, useCallback, useEffect, useContext, useMemo, useSyncExternalStore, useId } from 'react';
|
|
7
7
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|