@cimplify/sdk 0.100.0 → 0.100.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/advanced.d.mts +3 -3
- package/dist/advanced.d.ts +3 -3
- package/dist/advanced.js +22 -22
- package/dist/advanced.mjs +3 -3
- package/dist/{chunk-X6G6QERR.js → chunk-6JEKKL3M.js} +53 -38
- package/dist/{chunk-7TEMLVDT.mjs → chunk-B2YOCOLH.mjs} +2 -2
- package/dist/{chunk-V5TU5JKA.mjs → chunk-DLW3RWRK.mjs} +30 -6
- package/dist/{chunk-FECGCIVV.js → chunk-IFAQLFAJ.js} +4 -4
- package/dist/{chunk-J3UYIBKH.js → chunk-IJI7KMTG.js} +89 -82
- package/dist/{chunk-AETVRBKI.js → chunk-NIOUSKQQ.js} +1 -0
- package/dist/{chunk-K5EN2W2Q.mjs → chunk-O3YUHLZL.mjs} +1 -0
- package/dist/{chunk-GWKIDFN6.mjs → chunk-PJUXAUM2.mjs} +20 -14
- package/dist/{chunk-ZA5VKVUB.js → chunk-QRBBSIAY.js} +4 -4
- package/dist/{chunk-OX5L6XE7.mjs → chunk-TIQLOH2B.mjs} +30 -15
- package/dist/{chunk-64EDCDBR.js → chunk-WMEC5JWN.js} +32 -7
- package/dist/{chunk-I7L4VRHI.mjs → chunk-YWNJJO2U.mjs} +2 -2
- package/dist/{client-DQpvwf-p.d.mts → client-C6wb92AD.d.mts} +2 -2
- package/dist/{client-DmR3Z6pQ.d.ts → client-CgXkRu2o.d.ts} +2 -2
- package/dist/{client-C1vS5pf0.d.ts → client-D8XcrONA.d.mts} +38 -26
- package/dist/{client-B5MeD8da.d.mts → client-LPg_AUUr.d.ts} +38 -26
- package/dist/{index-Br-vFygC.d.ts → index-B_RYmvlF.d.ts} +3 -3
- package/dist/{index-DUOCn1Cs.d.mts → index-D-LUYk1Y.d.mts} +3 -3
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +117 -117
- package/dist/index.mjs +5 -5
- package/dist/mock/cli.mjs +1 -1
- package/dist/mock/library.js +1 -1
- package/dist/mock/library.mjs +1 -1
- package/dist/mock/msw.js +1 -1
- package/dist/mock/msw.mjs +1 -1
- package/dist/{payment-BIpS9oPG.d.mts → payment-BSzy7sly.d.mts} +1 -1
- package/dist/{payment-CsuBKHqg.d.ts → payment-jK8ztICx.d.ts} +1 -1
- package/dist/{price-Ml_uPoiY.d.ts → price-CJLfcYKd.d.ts} +1 -1
- package/dist/{price-IOOoVYS-.d.mts → price-D96h6c6L.d.mts} +1 -1
- package/dist/{product-BKV6TBj_.d.ts → product-CeV8euw4.d.mts} +23 -11
- package/dist/{product-BKV6TBj_.d.mts → product-CeV8euw4.d.ts} +23 -11
- package/dist/react.d.mts +10 -5
- package/dist/react.d.ts +10 -5
- package/dist/react.js +856 -450
- package/dist/react.mjs +737 -331
- package/dist/{server-C0iEk55_.d.mts → server--RyVAfPN.d.mts} +1 -1
- package/dist/{server-CfpYhSV_.d.ts → server-CNyy47HL.d.ts} +1 -1
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +10 -10
- package/dist/server.mjs +4 -4
- package/dist/testing/msw.d.mts +2 -2
- package/dist/testing/msw.d.ts +2 -2
- package/dist/testing/msw.js +3 -3
- package/dist/testing/msw.mjs +2 -2
- package/dist/testing/suite.d.mts +6 -6
- package/dist/testing/suite.d.ts +6 -6
- package/dist/testing/suite.js +25 -25
- package/dist/testing/suite.mjs +6 -6
- package/dist/testing.d.mts +5 -5
- package/dist/testing.d.ts +5 -5
- package/dist/testing.js +81 -81
- package/dist/testing.mjs +7 -7
- package/dist/utils.d.mts +4 -4
- package/dist/utils.d.ts +4 -4
- package/dist/utils.js +29 -29
- package/dist/utils.mjs +2 -2
- package/package.json +1 -1
- package/registry/cart-summary.json +1 -1
- package/registry/product-customizer.json +1 -1
- package/registry/sale-badge.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, ab as CheckoutOperations, ab as CheckoutService, ah as CimplifyElement, ai as CimplifyElements,
|
|
2
|
-
import './product-
|
|
3
|
-
import './payment-
|
|
1
|
+
export { k as AuthService, C as BusinessService, O as CartOperations, P as CatalogueQueries, ab as CheckoutOperations, ab as CheckoutService, ah as CimplifyElement, ai as CimplifyElements, aL as ELEMENT_TYPES, aM as EVENT_TYPES, aP as ElementEventType, aQ as ElementOptions, aR as ElementType, aZ as ElementsOptions, b5 as FetchQuoteInput, be as FxService, bi as GetProductsOptions, bl as InventoryService, bt as LinkService, bz as LiteService, bG as MESSAGE_TYPES, c6 as OrderQueries, cs as PriceQuote, cy as QuoteBundleSelectionInput, cz as QuoteCompositeSelectionInput, cA as QuoteDynamicBuckets, cB as QuoteStatus, cC as QuoteUiMessage, cE as RefreshQuoteInput, cF as RefreshQuoteResult, d5 as SchedulingService, dL as createElements } from './client-D8XcrONA.mjs';
|
|
2
|
+
import './product-CeV8euw4.mjs';
|
|
3
|
+
import './payment-BSzy7sly.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, ab as CheckoutOperations, ab as CheckoutService, ah as CimplifyElement, ai as CimplifyElements,
|
|
2
|
-
import './product-
|
|
3
|
-
import './payment-
|
|
1
|
+
export { k as AuthService, C as BusinessService, O as CartOperations, P as CatalogueQueries, ab as CheckoutOperations, ab as CheckoutService, ah as CimplifyElement, ai as CimplifyElements, aL as ELEMENT_TYPES, aM as EVENT_TYPES, aP as ElementEventType, aQ as ElementOptions, aR as ElementType, aZ as ElementsOptions, b5 as FetchQuoteInput, be as FxService, bi as GetProductsOptions, bl as InventoryService, bt as LinkService, bz as LiteService, bG as MESSAGE_TYPES, c6 as OrderQueries, cs as PriceQuote, cy as QuoteBundleSelectionInput, cz as QuoteCompositeSelectionInput, cA as QuoteDynamicBuckets, cB as QuoteStatus, cC as QuoteUiMessage, cE as RefreshQuoteInput, cF as RefreshQuoteResult, d5 as SchedulingService, dL as createElements } from './client-LPg_AUUr.js';
|
|
2
|
+
import './product-CeV8euw4.js';
|
|
3
|
+
import './payment-jK8ztICx.js';
|
|
4
4
|
|
|
5
5
|
declare function generateIdempotencyKey(prefix?: string): string;
|
|
6
6
|
|
package/dist/advanced.js
CHANGED
|
@@ -1,85 +1,85 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var chunk6JEKKL3M_js = require('./chunk-6JEKKL3M.js');
|
|
4
|
+
require('./chunk-WMEC5JWN.js');
|
|
5
|
+
require('./chunk-NIOUSKQQ.js');
|
|
6
6
|
require('./chunk-OWW5GUSB.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "AuthService", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunk6JEKKL3M_js.AuthService; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "BusinessService", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunk6JEKKL3M_js.BusinessService; }
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "CartOperations", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunk6JEKKL3M_js.CartOperations; }
|
|
21
21
|
});
|
|
22
22
|
Object.defineProperty(exports, "CatalogueQueries", {
|
|
23
23
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunk6JEKKL3M_js.CatalogueQueries; }
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "CheckoutOperations", {
|
|
27
27
|
enumerable: true,
|
|
28
|
-
get: function () { return
|
|
28
|
+
get: function () { return chunk6JEKKL3M_js.CheckoutService; }
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "CheckoutService", {
|
|
31
31
|
enumerable: true,
|
|
32
|
-
get: function () { return
|
|
32
|
+
get: function () { return chunk6JEKKL3M_js.CheckoutService; }
|
|
33
33
|
});
|
|
34
34
|
Object.defineProperty(exports, "CimplifyElement", {
|
|
35
35
|
enumerable: true,
|
|
36
|
-
get: function () { return
|
|
36
|
+
get: function () { return chunk6JEKKL3M_js.CimplifyElement; }
|
|
37
37
|
});
|
|
38
38
|
Object.defineProperty(exports, "CimplifyElements", {
|
|
39
39
|
enumerable: true,
|
|
40
|
-
get: function () { return
|
|
40
|
+
get: function () { return chunk6JEKKL3M_js.CimplifyElements; }
|
|
41
41
|
});
|
|
42
42
|
Object.defineProperty(exports, "ELEMENT_TYPES", {
|
|
43
43
|
enumerable: true,
|
|
44
|
-
get: function () { return
|
|
44
|
+
get: function () { return chunk6JEKKL3M_js.ELEMENT_TYPES; }
|
|
45
45
|
});
|
|
46
46
|
Object.defineProperty(exports, "EVENT_TYPES", {
|
|
47
47
|
enumerable: true,
|
|
48
|
-
get: function () { return
|
|
48
|
+
get: function () { return chunk6JEKKL3M_js.EVENT_TYPES; }
|
|
49
49
|
});
|
|
50
50
|
Object.defineProperty(exports, "FxService", {
|
|
51
51
|
enumerable: true,
|
|
52
|
-
get: function () { return
|
|
52
|
+
get: function () { return chunk6JEKKL3M_js.FxService; }
|
|
53
53
|
});
|
|
54
54
|
Object.defineProperty(exports, "InventoryService", {
|
|
55
55
|
enumerable: true,
|
|
56
|
-
get: function () { return
|
|
56
|
+
get: function () { return chunk6JEKKL3M_js.InventoryService; }
|
|
57
57
|
});
|
|
58
58
|
Object.defineProperty(exports, "LinkService", {
|
|
59
59
|
enumerable: true,
|
|
60
|
-
get: function () { return
|
|
60
|
+
get: function () { return chunk6JEKKL3M_js.LinkService; }
|
|
61
61
|
});
|
|
62
62
|
Object.defineProperty(exports, "LiteService", {
|
|
63
63
|
enumerable: true,
|
|
64
|
-
get: function () { return
|
|
64
|
+
get: function () { return chunk6JEKKL3M_js.LiteService; }
|
|
65
65
|
});
|
|
66
66
|
Object.defineProperty(exports, "MESSAGE_TYPES", {
|
|
67
67
|
enumerable: true,
|
|
68
|
-
get: function () { return
|
|
68
|
+
get: function () { return chunk6JEKKL3M_js.MESSAGE_TYPES; }
|
|
69
69
|
});
|
|
70
70
|
Object.defineProperty(exports, "OrderQueries", {
|
|
71
71
|
enumerable: true,
|
|
72
|
-
get: function () { return
|
|
72
|
+
get: function () { return chunk6JEKKL3M_js.OrderQueries; }
|
|
73
73
|
});
|
|
74
74
|
Object.defineProperty(exports, "SchedulingService", {
|
|
75
75
|
enumerable: true,
|
|
76
|
-
get: function () { return
|
|
76
|
+
get: function () { return chunk6JEKKL3M_js.SchedulingService; }
|
|
77
77
|
});
|
|
78
78
|
Object.defineProperty(exports, "createElements", {
|
|
79
79
|
enumerable: true,
|
|
80
|
-
get: function () { return
|
|
80
|
+
get: function () { return chunk6JEKKL3M_js.createElements; }
|
|
81
81
|
});
|
|
82
82
|
Object.defineProperty(exports, "generateIdempotencyKey", {
|
|
83
83
|
enumerable: true,
|
|
84
|
-
get: function () { return
|
|
84
|
+
get: function () { return chunk6JEKKL3M_js.generateIdempotencyKey; }
|
|
85
85
|
});
|
package/dist/advanced.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AuthService, BusinessService, CartOperations, CatalogueQueries, CheckoutService as CheckoutOperations, CheckoutService, CimplifyElement, CimplifyElements, ELEMENT_TYPES, EVENT_TYPES, FxService, InventoryService, LinkService, LiteService, MESSAGE_TYPES, OrderQueries, SchedulingService, createElements, generateIdempotencyKey } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { AuthService, BusinessService, CartOperations, CatalogueQueries, CheckoutService as CheckoutOperations, CheckoutService, CimplifyElement, CimplifyElements, ELEMENT_TYPES, EVENT_TYPES, FxService, InventoryService, LinkService, LiteService, MESSAGE_TYPES, OrderQueries, SchedulingService, createElements, generateIdempotencyKey } from './chunk-TIQLOH2B.mjs';
|
|
2
|
+
import './chunk-DLW3RWRK.mjs';
|
|
3
|
+
import './chunk-O3YUHLZL.mjs';
|
|
4
4
|
import './chunk-3G6RQLXK.mjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkWMEC5JWN_js = require('./chunk-WMEC5JWN.js');
|
|
4
|
+
var chunkNIOUSKQQ_js = require('./chunk-NIOUSKQQ.js');
|
|
5
5
|
|
|
6
6
|
// src/types/result.ts
|
|
7
7
|
function ok(value) {
|
|
@@ -116,11 +116,11 @@ function clearIntentIdempotencyKey(scope, storage = sessionStorageOrNull()) {
|
|
|
116
116
|
|
|
117
117
|
// src/internal/safe.ts
|
|
118
118
|
function toCimplifyError(error) {
|
|
119
|
-
if (error instanceof
|
|
119
|
+
if (error instanceof chunkNIOUSKQQ_js.CimplifyError) return chunkNIOUSKQQ_js.enrichError(error);
|
|
120
120
|
if (error instanceof Error) {
|
|
121
|
-
return
|
|
121
|
+
return chunkNIOUSKQQ_js.enrichError(new chunkNIOUSKQQ_js.CimplifyError(chunkNIOUSKQQ_js.ErrorCode.UNKNOWN_ERROR, error.message, false));
|
|
122
122
|
}
|
|
123
|
-
return
|
|
123
|
+
return chunkNIOUSKQQ_js.enrichError(new chunkNIOUSKQQ_js.CimplifyError(chunkNIOUSKQQ_js.ErrorCode.UNKNOWN_ERROR, String(error), false));
|
|
124
124
|
}
|
|
125
125
|
async function safe(promise) {
|
|
126
126
|
try {
|
|
@@ -286,7 +286,9 @@ var CatalogueQueries = class {
|
|
|
286
286
|
this.client = client;
|
|
287
287
|
}
|
|
288
288
|
async getCatalogue(opts) {
|
|
289
|
-
const result = await safe(
|
|
289
|
+
const result = await safe(
|
|
290
|
+
this.client.get("/api/v1/catalogue", opts)
|
|
291
|
+
);
|
|
290
292
|
if (!result.ok) return result;
|
|
291
293
|
return ok(normalizeCatalogueSnapshot(result.value));
|
|
292
294
|
}
|
|
@@ -314,7 +316,9 @@ var CatalogueQueries = class {
|
|
|
314
316
|
}
|
|
315
317
|
async getProduct(id, opts) {
|
|
316
318
|
const encodedId = encodeURIComponent(id);
|
|
317
|
-
const result = await safe(
|
|
319
|
+
const result = await safe(
|
|
320
|
+
this.client.get(`/api/v1/catalogue/products/${encodedId}`, opts)
|
|
321
|
+
);
|
|
318
322
|
if (!result.ok) return result;
|
|
319
323
|
const payload = result.value;
|
|
320
324
|
const rawProduct = isRecord(payload.item) ? payload.item : payload;
|
|
@@ -336,11 +340,15 @@ var CatalogueQueries = class {
|
|
|
336
340
|
}
|
|
337
341
|
async getVariants(productId) {
|
|
338
342
|
const encodedId = encodeURIComponent(productId);
|
|
339
|
-
return safe(
|
|
343
|
+
return safe(
|
|
344
|
+
this.client.get(`/api/v1/catalogue/products/${encodedId}/variants`)
|
|
345
|
+
);
|
|
340
346
|
}
|
|
341
347
|
async getVariantAxes(productId) {
|
|
342
348
|
const encodedId = encodeURIComponent(productId);
|
|
343
|
-
return safe(
|
|
349
|
+
return safe(
|
|
350
|
+
this.client.get(`/api/v1/catalogue/products/${encodedId}/variant-axes`)
|
|
351
|
+
);
|
|
344
352
|
}
|
|
345
353
|
async getVariantByAxisSelections(productId, selections) {
|
|
346
354
|
const encodedId = encodeURIComponent(productId);
|
|
@@ -471,7 +479,9 @@ var CatalogueQueries = class {
|
|
|
471
479
|
}
|
|
472
480
|
async getTaxonomyPath(id) {
|
|
473
481
|
const encodedId = encodeURIComponent(id);
|
|
474
|
-
return safe(
|
|
482
|
+
return safe(
|
|
483
|
+
this.client.get(`/api/v1/catalogue/taxonomies/${encodedId}/path`)
|
|
484
|
+
);
|
|
475
485
|
}
|
|
476
486
|
async searchTaxonomies(query, limit) {
|
|
477
487
|
const path = withQuery("/api/v1/catalogue/taxonomies/search", { q: query, limit });
|
|
@@ -488,11 +498,15 @@ var CatalogueQueries = class {
|
|
|
488
498
|
}
|
|
489
499
|
async getProductSchedules(productId) {
|
|
490
500
|
const encodedId = encodeURIComponent(productId);
|
|
491
|
-
return safe(
|
|
501
|
+
return safe(
|
|
502
|
+
this.client.get(`/api/v1/catalogue/products/${encodedId}/schedules`)
|
|
503
|
+
);
|
|
492
504
|
}
|
|
493
505
|
async checkProductAvailableNow(productId, locationId) {
|
|
494
506
|
const encodedId = encodeURIComponent(productId);
|
|
495
|
-
const path = withQuery(`/api/v1/catalogue/products/${encodedId}/available-now`, {
|
|
507
|
+
const path = withQuery(`/api/v1/catalogue/products/${encodedId}/available-now`, {
|
|
508
|
+
location_id: locationId
|
|
509
|
+
});
|
|
496
510
|
return safe(this.client.get(path));
|
|
497
511
|
}
|
|
498
512
|
async getDeals(locationId) {
|
|
@@ -572,9 +586,7 @@ var CatalogueQueries = class {
|
|
|
572
586
|
async getProductAttributes(productId) {
|
|
573
587
|
const encodedId = encodeURIComponent(productId);
|
|
574
588
|
return safe(
|
|
575
|
-
this.client.get(
|
|
576
|
-
`/api/v1/catalogue/products/${encodedId}/attributes`
|
|
577
|
-
)
|
|
589
|
+
this.client.get(`/api/v1/catalogue/products/${encodedId}/attributes`)
|
|
578
590
|
);
|
|
579
591
|
}
|
|
580
592
|
async getCategoryAttributes(categoryId) {
|
|
@@ -616,9 +628,7 @@ var CatalogueQueries = class {
|
|
|
616
628
|
return safe(this.client.get(path));
|
|
617
629
|
}
|
|
618
630
|
async getKnowledgeArticles() {
|
|
619
|
-
return safe(
|
|
620
|
-
this.client.get("/api/v1/catalogue/knowledge-base/articles")
|
|
621
|
-
);
|
|
631
|
+
return safe(this.client.get("/api/v1/catalogue/knowledge-base/articles"));
|
|
622
632
|
}
|
|
623
633
|
};
|
|
624
634
|
|
|
@@ -682,7 +692,7 @@ var CartOperations = class {
|
|
|
682
692
|
if (typeof updates.quantity !== "number") {
|
|
683
693
|
return {
|
|
684
694
|
ok: false,
|
|
685
|
-
error: new
|
|
695
|
+
error: new chunkNIOUSKQQ_js.CimplifyError(
|
|
686
696
|
"VALIDATION_ERROR",
|
|
687
697
|
"updateItem requires a quantity; richer mid-cart edits are not supported"
|
|
688
698
|
)
|
|
@@ -1128,7 +1138,7 @@ var CheckoutResolver = class {
|
|
|
1128
1138
|
}
|
|
1129
1139
|
}
|
|
1130
1140
|
}
|
|
1131
|
-
if (checkoutResult.requires_authorization ||
|
|
1141
|
+
if (checkoutResult.requires_authorization || chunkWMEC5JWN_js.isPaymentStatusRequiresAction(checkoutResult.payment_status)) {
|
|
1132
1142
|
const authorization = await this.handleAuthorization({
|
|
1133
1143
|
authorizationType,
|
|
1134
1144
|
paymentReference,
|
|
@@ -1302,18 +1312,18 @@ var CheckoutResolver = class {
|
|
|
1302
1312
|
if (statusResult.value.reference) {
|
|
1303
1313
|
paymentReference = statusResult.value.reference;
|
|
1304
1314
|
}
|
|
1305
|
-
const normalized =
|
|
1306
|
-
if (normalized.paid ||
|
|
1315
|
+
const normalized = chunkWMEC5JWN_js.normalizeStatusResponse(statusResult.value);
|
|
1316
|
+
if (normalized.paid || chunkWMEC5JWN_js.isPaymentStatusSuccess(normalized.status)) {
|
|
1307
1317
|
return this.finalizeSuccess(latestCheckoutResult);
|
|
1308
1318
|
}
|
|
1309
|
-
if (
|
|
1319
|
+
if (chunkWMEC5JWN_js.isPaymentStatusFailure(normalized.status)) {
|
|
1310
1320
|
return this.fail(
|
|
1311
1321
|
normalized.status ? normalized.status.toUpperCase() : "PAYMENT_FAILED",
|
|
1312
1322
|
normalized.message || "Payment failed during confirmation.",
|
|
1313
1323
|
false
|
|
1314
1324
|
);
|
|
1315
1325
|
}
|
|
1316
|
-
if (
|
|
1326
|
+
if (chunkWMEC5JWN_js.isPaymentStatusRequiresAction(normalized.status)) {
|
|
1317
1327
|
const authorization = await this.handleAuthorization({
|
|
1318
1328
|
authorizationType,
|
|
1319
1329
|
paymentReference,
|
|
@@ -1344,8 +1354,8 @@ var CheckoutResolver = class {
|
|
|
1344
1354
|
try {
|
|
1345
1355
|
const finalResult = await this.client.checkout.pollPaymentStatus(input.orderId);
|
|
1346
1356
|
if (finalResult.ok) {
|
|
1347
|
-
const normalized =
|
|
1348
|
-
if (normalized.paid ||
|
|
1357
|
+
const normalized = chunkWMEC5JWN_js.normalizeStatusResponse(finalResult.value);
|
|
1358
|
+
if (normalized.paid || chunkWMEC5JWN_js.isPaymentStatusSuccess(normalized.status)) {
|
|
1349
1359
|
return this.finalizeSuccess(latestCheckoutResult);
|
|
1350
1360
|
}
|
|
1351
1361
|
}
|
|
@@ -1541,12 +1551,12 @@ var CheckoutResolver = class {
|
|
|
1541
1551
|
};
|
|
1542
1552
|
}
|
|
1543
1553
|
isSuccessfulStatus(status) {
|
|
1544
|
-
const normalized =
|
|
1545
|
-
return normalized.paid ||
|
|
1554
|
+
const normalized = chunkWMEC5JWN_js.normalizeStatusResponse({ status, paid: false });
|
|
1555
|
+
return normalized.paid || chunkWMEC5JWN_js.isPaymentStatusSuccess(normalized.status);
|
|
1546
1556
|
}
|
|
1547
1557
|
isFailureStatus(status) {
|
|
1548
|
-
const normalized =
|
|
1549
|
-
return
|
|
1558
|
+
const normalized = chunkWMEC5JWN_js.normalizeStatusResponse({ status, paid: false });
|
|
1559
|
+
return chunkWMEC5JWN_js.isPaymentStatusFailure(normalized.status);
|
|
1550
1560
|
}
|
|
1551
1561
|
ensureNotAborted() {
|
|
1552
1562
|
if (this.signal?.aborted) {
|
|
@@ -1597,14 +1607,14 @@ var CheckoutService = class {
|
|
|
1597
1607
|
}
|
|
1598
1608
|
validateCheckoutData(data) {
|
|
1599
1609
|
if (isOfflinePaymentMethod(data.payment_method)) {
|
|
1600
|
-
return new
|
|
1610
|
+
return new chunkNIOUSKQQ_js.CimplifyError(
|
|
1601
1611
|
"INVALID_PAYMENT_METHOD",
|
|
1602
1612
|
"Offline payment isn't available for online checkout. Please pay by card or mobile money.",
|
|
1603
1613
|
false
|
|
1604
1614
|
);
|
|
1605
1615
|
}
|
|
1606
1616
|
if (!isValidCustomerName(data.customer?.name)) {
|
|
1607
|
-
return new
|
|
1617
|
+
return new chunkNIOUSKQQ_js.CimplifyError(
|
|
1608
1618
|
"INVALID_CUSTOMER_NAME",
|
|
1609
1619
|
"Enter your name, not a phone number.",
|
|
1610
1620
|
false
|
|
@@ -1639,14 +1649,14 @@ var CheckoutService = class {
|
|
|
1639
1649
|
if (result.value.bill_token) {
|
|
1640
1650
|
this.client.setOrderToken(result.value.order_id, result.value.bill_token);
|
|
1641
1651
|
}
|
|
1642
|
-
} else if (result.error.code !==
|
|
1652
|
+
} else if (result.error.code !== chunkNIOUSKQQ_js.ErrorCode.NETWORK_ERROR && result.error.code !== chunkNIOUSKQQ_js.ErrorCode.TIMEOUT) {
|
|
1643
1653
|
clearIntentIdempotencyKey(intentScope);
|
|
1644
1654
|
}
|
|
1645
1655
|
return result;
|
|
1646
1656
|
}
|
|
1647
1657
|
async initializePayment(_orderId, _method) {
|
|
1648
1658
|
return err(
|
|
1649
|
-
new
|
|
1659
|
+
new chunkNIOUSKQQ_js.CimplifyError(
|
|
1650
1660
|
"NOT_IMPLEMENTED",
|
|
1651
1661
|
"initializePayment is not available in REST mode.",
|
|
1652
1662
|
false
|
|
@@ -1722,11 +1732,11 @@ var CheckoutService = class {
|
|
|
1722
1732
|
voucher_code: data.voucher_code,
|
|
1723
1733
|
pay_deposit: data.pay_deposit
|
|
1724
1734
|
};
|
|
1725
|
-
const baseCurrency =
|
|
1735
|
+
const baseCurrency = chunkNIOUSKQQ_js.currencyCode(
|
|
1726
1736
|
(cart.pricing.currency || checkoutData.pay_currency || "GHS").toUpperCase()
|
|
1727
1737
|
);
|
|
1728
1738
|
const payCurrency = data.pay_currency?.trim().toUpperCase();
|
|
1729
|
-
const payCurrencyCode = payCurrency ?
|
|
1739
|
+
const payCurrencyCode = payCurrency ? chunkNIOUSKQQ_js.currencyCode(payCurrency) : void 0;
|
|
1730
1740
|
const cartTotalAmount = typeof cart.pricing.total_price === "number" ? cart.pricing.total_price : Number.parseFloat(cart.pricing.total_price || "0");
|
|
1731
1741
|
if (payCurrencyCode && payCurrencyCode !== baseCurrency && !checkoutData.fx_quote_id && Number.isFinite(cartTotalAmount) && cartTotalAmount > 0) {
|
|
1732
1742
|
const fxQuoteResult = await this.client.fx.lockQuote({
|
|
@@ -2088,7 +2098,7 @@ var BusinessService = class {
|
|
|
2088
2098
|
if (!result.ok) return err(result.error);
|
|
2089
2099
|
const location = result.value.find((item) => item.id === locationId);
|
|
2090
2100
|
if (!location) {
|
|
2091
|
-
return err(new
|
|
2101
|
+
return err(new chunkNIOUSKQQ_js.CimplifyError(chunkNIOUSKQQ_js.ErrorCode.NOT_FOUND, `Location not found: ${locationId}`, false));
|
|
2092
2102
|
}
|
|
2093
2103
|
return ok(location);
|
|
2094
2104
|
}
|
|
@@ -2707,7 +2717,7 @@ function startRedirectSignIn(opts, authorizeEndpoint, pkce, state) {
|
|
|
2707
2717
|
|
|
2708
2718
|
// src/elements.ts
|
|
2709
2719
|
function toCheckoutError(code, message, recoverable) {
|
|
2710
|
-
const hint =
|
|
2720
|
+
const hint = chunkNIOUSKQQ_js.getErrorHint(code);
|
|
2711
2721
|
return {
|
|
2712
2722
|
success: false,
|
|
2713
2723
|
error: {
|
|
@@ -2769,6 +2779,7 @@ var KNOWN_IFRAME_TYPES = /* @__PURE__ */ new Set([
|
|
|
2769
2779
|
MESSAGE_TYPES.READY,
|
|
2770
2780
|
MESSAGE_TYPES.HEIGHT_CHANGE,
|
|
2771
2781
|
MESSAGE_TYPES.AUTH_REQUESTED,
|
|
2782
|
+
MESSAGE_TYPES.SESSION_ESTABLISHED,
|
|
2772
2783
|
MESSAGE_TYPES.ERROR,
|
|
2773
2784
|
MESSAGE_TYPES.ADDRESS_CHANGED,
|
|
2774
2785
|
MESSAGE_TYPES.ADDRESS_SELECTED,
|
|
@@ -2801,6 +2812,10 @@ function parseIframeMessage(data) {
|
|
|
2801
2812
|
return null;
|
|
2802
2813
|
}
|
|
2803
2814
|
break;
|
|
2815
|
+
case MESSAGE_TYPES.SESSION_ESTABLISHED:
|
|
2816
|
+
if (typeof record.accessToken !== "string" || !record.accessToken.trim()) return null;
|
|
2817
|
+
if (record.refreshToken !== void 0 && typeof record.refreshToken !== "string") return null;
|
|
2818
|
+
break;
|
|
2804
2819
|
case MESSAGE_TYPES.ADDRESS_CHANGED:
|
|
2805
2820
|
case MESSAGE_TYPES.ADDRESS_SELECTED:
|
|
2806
2821
|
if (!record.address || typeof record.address !== "object") return null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { messagePreview } from './chunk-U4MW6PYU.mjs';
|
|
2
|
-
import { ErrorCode } from './chunk-
|
|
2
|
+
import { ErrorCode } from './chunk-O3YUHLZL.mjs';
|
|
3
3
|
import { __publicField, __privateAdd, __privateSet, __privateGet, __privateMethod, __privateWrapper } from './chunk-3G6RQLXK.mjs';
|
|
4
4
|
|
|
5
5
|
// ../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/compose.js
|
|
@@ -4609,7 +4609,7 @@ function toUICart(registry, cart) {
|
|
|
4609
4609
|
is_available: product?.is_available ?? true,
|
|
4610
4610
|
base_price: i.price,
|
|
4611
4611
|
add_ons_price: i.add_ons_price,
|
|
4612
|
-
total_price:
|
|
4612
|
+
total_price: add(i.price, i.add_ons_price),
|
|
4613
4613
|
item_discount_amount: i.item_discount_amount,
|
|
4614
4614
|
price_info: defaultChosenPrice(i.price),
|
|
4615
4615
|
add_on_option_ids: cfg.add_ons?.selected_options.map((o) => o.option_id) ?? [],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { moneyFromNumber, money } from './chunk-
|
|
1
|
+
import { moneyFromNumber, money } from './chunk-O3YUHLZL.mjs';
|
|
2
2
|
|
|
3
3
|
// src/utils/price.ts
|
|
4
4
|
var CURRENCY_SYMBOLS = {
|
|
@@ -15,6 +15,7 @@ var CURRENCY_SYMBOLS = {
|
|
|
15
15
|
SGD: "S$",
|
|
16
16
|
INR: "\u20B9",
|
|
17
17
|
BRL: "R$",
|
|
18
|
+
COP: "COL$",
|
|
18
19
|
MXN: "MX$",
|
|
19
20
|
KRW: "\u20A9",
|
|
20
21
|
RUB: "\u20BD",
|
|
@@ -143,6 +144,20 @@ function parsePrice(value) {
|
|
|
143
144
|
const parsed = parseFloat(cleaned);
|
|
144
145
|
return isNaN(parsed) ? 0 : parsed;
|
|
145
146
|
}
|
|
147
|
+
function getVariantUnitPrice(product, variant) {
|
|
148
|
+
if (variant?.price_info) {
|
|
149
|
+
return parsePrice(variant.price_info.final_price);
|
|
150
|
+
}
|
|
151
|
+
const defaultPrice = parsePrice(product.default_price);
|
|
152
|
+
if (!variant) {
|
|
153
|
+
return defaultPrice;
|
|
154
|
+
}
|
|
155
|
+
const defaultVariant = product.variants?.find((candidate) => candidate.is_default);
|
|
156
|
+
if (!defaultVariant) {
|
|
157
|
+
return variant.is_default ? defaultPrice : defaultPrice + parsePrice(variant.price_adjustment);
|
|
158
|
+
}
|
|
159
|
+
return defaultPrice - parsePrice(defaultVariant.price_adjustment) + parsePrice(variant.price_adjustment);
|
|
160
|
+
}
|
|
146
161
|
function hasTaxInfo(priceInfo) {
|
|
147
162
|
return priceInfo.tax_info !== void 0 && priceInfo.tax_info !== null;
|
|
148
163
|
}
|
|
@@ -163,6 +178,9 @@ function formatPriceWithTax(priceInfo, currency = "GHS") {
|
|
|
163
178
|
return `${finalPrice} + ${formatPrice(getTaxAmount(priceInfo), currency)} tax`;
|
|
164
179
|
}
|
|
165
180
|
function getDisplayPrice(product) {
|
|
181
|
+
if (product.sale) {
|
|
182
|
+
return parsePrice(product.sale.price);
|
|
183
|
+
}
|
|
166
184
|
if (product.price_info) {
|
|
167
185
|
return parsePrice(product.price_info.final_price);
|
|
168
186
|
}
|
|
@@ -175,6 +193,9 @@ function getDisplayPrice(product) {
|
|
|
175
193
|
return 0;
|
|
176
194
|
}
|
|
177
195
|
function getBasePrice(product) {
|
|
196
|
+
if (product.sale) {
|
|
197
|
+
return parsePrice(product.sale.original);
|
|
198
|
+
}
|
|
178
199
|
if (product.price_info) {
|
|
179
200
|
return parsePrice(product.price_info.base_price);
|
|
180
201
|
}
|
|
@@ -187,11 +208,17 @@ function getBasePrice(product) {
|
|
|
187
208
|
return 0;
|
|
188
209
|
}
|
|
189
210
|
function isOnSale(product) {
|
|
211
|
+
if (product.sale) {
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
190
214
|
const basePrice = getBasePrice(product);
|
|
191
215
|
const finalPrice = getDisplayPrice(product);
|
|
192
216
|
return basePrice > finalPrice && basePrice > 0;
|
|
193
217
|
}
|
|
194
218
|
function getDiscountPercentage(product) {
|
|
219
|
+
if (product.sale) {
|
|
220
|
+
return parsePrice(product.sale.percent_off);
|
|
221
|
+
}
|
|
195
222
|
const basePrice = getBasePrice(product);
|
|
196
223
|
const finalPrice = getDisplayPrice(product);
|
|
197
224
|
if (basePrice > finalPrice && basePrice > 0) {
|
|
@@ -241,10 +268,7 @@ function getPriceRange(product) {
|
|
|
241
268
|
}
|
|
242
269
|
const variants = product.variants;
|
|
243
270
|
if (variants && variants.length > 1) {
|
|
244
|
-
const
|
|
245
|
-
const prices = variants.map(
|
|
246
|
-
(v) => base + parsePrice(v.price_adjustment ?? 0)
|
|
247
|
-
);
|
|
271
|
+
const prices = variants.map((variant) => getVariantUnitPrice(product, variant));
|
|
248
272
|
return { min: Math.min(...prices), max: Math.max(...prices) };
|
|
249
273
|
}
|
|
250
274
|
return null;
|
|
@@ -477,4 +501,4 @@ function detectMobileMoneyProvider(phoneNumber) {
|
|
|
477
501
|
return null;
|
|
478
502
|
}
|
|
479
503
|
|
|
480
|
-
export { CURRENCY_SYMBOLS, MOBILE_MONEY_PROVIDERS, categorizePaymentError, detectMobileMoneyProvider, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatPriceRange, formatPriceWithTax, formatProductPrice, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getMarkupPercentage, getPriceRange, getProductCurrency, getTaxAmount, getUnitPriceAtQuantity, hasTaxInfo, isOnSale, isPaymentStatusFailure, isPaymentStatusRequiresAction, isPaymentStatusSuccess, isTaxInclusive, normalizePaymentResponse, normalizeStatusResponse, parsePrice };
|
|
504
|
+
export { CURRENCY_SYMBOLS, MOBILE_MONEY_PROVIDERS, categorizePaymentError, detectMobileMoneyProvider, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatPriceRange, formatPriceWithTax, formatProductPrice, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getMarkupPercentage, getPriceRange, getProductCurrency, getTaxAmount, getUnitPriceAtQuantity, getVariantUnitPrice, hasTaxInfo, isOnSale, isPaymentStatusFailure, isPaymentStatusRequiresAction, isPaymentStatusSuccess, isTaxInclusive, normalizePaymentResponse, normalizeStatusResponse, parsePrice };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkXREIZ56K_js = require('./chunk-XREIZ56K.js');
|
|
4
|
-
var
|
|
4
|
+
var chunkNIOUSKQQ_js = require('./chunk-NIOUSKQQ.js');
|
|
5
5
|
var chunkOWW5GUSB_js = require('./chunk-OWW5GUSB.js');
|
|
6
6
|
|
|
7
7
|
// ../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/compose.js
|
|
@@ -2077,8 +2077,8 @@ var MockError = class extends Error {
|
|
|
2077
2077
|
};
|
|
2078
2078
|
}
|
|
2079
2079
|
};
|
|
2080
|
-
var notFound = (msg) => new MockError(
|
|
2081
|
-
var validation = (msg, ctx) => new MockError(
|
|
2080
|
+
var notFound = (msg) => new MockError(chunkNIOUSKQQ_js.ErrorCode.NOT_FOUND, msg, 404);
|
|
2081
|
+
var validation = (msg, ctx) => new MockError(chunkNIOUSKQQ_js.ErrorCode.VALIDATION_ERROR, msg, 400, ctx);
|
|
2082
2082
|
|
|
2083
2083
|
// src/mock/routes/_helpers.ts
|
|
2084
2084
|
function authMiddleware(deps) {
|
|
@@ -4611,7 +4611,7 @@ function toUICart(registry, cart) {
|
|
|
4611
4611
|
is_available: product?.is_available ?? true,
|
|
4612
4612
|
base_price: i.price,
|
|
4613
4613
|
add_ons_price: i.add_ons_price,
|
|
4614
|
-
total_price:
|
|
4614
|
+
total_price: add(i.price, i.add_ons_price),
|
|
4615
4615
|
item_discount_amount: i.item_discount_amount,
|
|
4616
4616
|
price_info: defaultChosenPrice(i.price),
|
|
4617
4617
|
add_on_option_ids: cfg.add_ons?.selected_options.map((o) => o.option_id) ?? [],
|