@cimplify/sdk 0.46.0 → 0.46.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-RQ3ILHUQ.mjs → chunk-632JEJUS.mjs} +1 -1
- package/dist/{chunk-IF22UYTT.mjs → chunk-6HYKWYUF.mjs} +2 -2
- package/dist/{chunk-BN2CXGMO.js → chunk-6RP6OPYO.js} +3 -3
- package/dist/{chunk-GVLWRI5I.js → chunk-7ZACMER7.js} +49 -25
- package/dist/{chunk-AIXUFSA6.mjs → chunk-CKRMA5F7.mjs} +29 -5
- package/dist/{chunk-K6FCVLZA.js → chunk-GEWFWQYK.js} +234 -234
- package/dist/{chunk-QBQCMQ4F.js → chunk-TKOTACKZ.js} +24 -2
- package/dist/{chunk-ZH6ZST5T.js → chunk-TW4OFRWV.js} +4 -4
- package/dist/{chunk-RR3ZJQW5.mjs → chunk-WUIERJ6J.mjs} +4 -4
- package/dist/{chunk-NRT6PVW5.mjs → chunk-XY2DFX5K.mjs} +1 -1
- package/dist/{chunk-XPXAZXF2.mjs → chunk-Z2AYLZDF.mjs} +23 -3
- package/dist/{chunk-LLZZMHSU.js → chunk-Z2MLAIID.js} +62 -62
- package/dist/{client-BDYBB-ME.d.ts → client-B76ZNW5r.d.ts} +2 -2
- package/dist/{client-MUD63aYS.d.mts → client-CT9NwIDX.d.mts} +2 -2
- package/dist/{client-aZInadOY.d.ts → client-G2WCoxv2.d.mts} +5 -2
- package/dist/{client-CDUY-6nC.d.mts → client-QVINYu1X.d.ts} +5 -2
- package/dist/{index-DC_ZcSgO.d.ts → index-BAohYhdg.d.ts} +3 -3
- package/dist/{index-3C9J8Wb-.d.mts → index-Bo0NjgR6.d.mts} +3 -3
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +115 -107
- package/dist/index.mjs +4 -4
- package/dist/mock/cli.mjs +2 -0
- package/dist/mock/library.js +2 -0
- package/dist/mock/library.mjs +2 -0
- package/dist/mock/msw.js +2 -0
- package/dist/mock/msw.mjs +2 -0
- package/dist/{payment-Bse2XJ-c.d.mts → payment-9L_-GWqQ.d.mts} +1 -1
- package/dist/{payment-JcNqOf_T.d.ts → payment-_e99nSRj.d.ts} +1 -1
- package/dist/{price-YBGk5seG.d.mts → price-BjehlIhG.d.mts} +1 -1
- package/dist/{price-mHkRncgW.d.ts → price-CWQ5TQmk.d.ts} +1 -1
- package/dist/{product-DiX-HGkT.d.ts → product-C-xLzh7Q.d.mts} +16 -1
- package/dist/{product-DiX-HGkT.d.mts → product-C-xLzh7Q.d.ts} +16 -1
- package/dist/react.d.mts +4 -4
- package/dist/react.d.ts +4 -4
- package/dist/react.js +85 -85
- package/dist/react.mjs +4 -4
- package/dist/{server-Bg3VtA1D.d.ts → server-72rzvJ4Y.d.ts} +1 -1
- package/dist/{server-kakjHRgj.d.mts → server-BgccqOLT.d.mts} +1 -1
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +6 -6
- package/dist/server.mjs +4 -4
- package/dist/styles.css +1 -1
- package/dist/testing/msw.d.mts +2 -2
- package/dist/testing/msw.d.ts +2 -2
- package/dist/testing/msw.js +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/dist/advanced.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { A as AuthService, B as BusinessService, j as CartOperations, b as CatalogueQueries, l as CheckoutOperations, l as CheckoutService, a6 as CimplifyElement, a5 as CimplifyElements, aa as ELEMENT_TYPES, a9 as EVENT_TYPES, ae as ElementEventType, ac as ElementOptions, ad as ElementType, ab as ElementsOptions, F as FetchQuoteInput, r as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, q as LiteService, a8 as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, i as RefreshQuoteResult, p as SchedulingService, a7 as createElements } from './client-
|
|
2
|
-
import './product-
|
|
3
|
-
import './payment-
|
|
1
|
+
export { A as AuthService, B as BusinessService, j as CartOperations, b as CatalogueQueries, l as CheckoutOperations, l as CheckoutService, a6 as CimplifyElement, a5 as CimplifyElements, aa as ELEMENT_TYPES, a9 as EVENT_TYPES, ae as ElementEventType, ac as ElementOptions, ad as ElementType, ab as ElementsOptions, F as FetchQuoteInput, r as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, q as LiteService, a8 as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, i as RefreshQuoteResult, p as SchedulingService, a7 as createElements } from './client-G2WCoxv2.mjs';
|
|
2
|
+
import './product-C-xLzh7Q.mjs';
|
|
3
|
+
import './payment-9L_-GWqQ.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 { A as AuthService, B as BusinessService, j as CartOperations, b as CatalogueQueries, l as CheckoutOperations, l as CheckoutService, a6 as CimplifyElement, a5 as CimplifyElements, aa as ELEMENT_TYPES, a9 as EVENT_TYPES, ae as ElementEventType, ac as ElementOptions, ad as ElementType, ab as ElementsOptions, F as FetchQuoteInput, r as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, q as LiteService, a8 as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, i as RefreshQuoteResult, p as SchedulingService, a7 as createElements } from './client-
|
|
2
|
-
import './product-
|
|
3
|
-
import './payment-
|
|
1
|
+
export { A as AuthService, B as BusinessService, j as CartOperations, b as CatalogueQueries, l as CheckoutOperations, l as CheckoutService, a6 as CimplifyElement, a5 as CimplifyElements, aa as ELEMENT_TYPES, a9 as EVENT_TYPES, ae as ElementEventType, ac as ElementOptions, ad as ElementType, ab as ElementsOptions, F as FetchQuoteInput, r as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, q as LiteService, a8 as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, i as RefreshQuoteResult, p as SchedulingService, a7 as createElements } from './client-QVINYu1X.js';
|
|
2
|
+
import './product-C-xLzh7Q.js';
|
|
3
|
+
import './payment-_e99nSRj.js';
|
|
4
4
|
|
|
5
5
|
declare function generateIdempotencyKey(prefix?: string): string;
|
|
6
6
|
|
package/dist/advanced.js
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var chunk7ZACMER7_js = require('./chunk-7ZACMER7.js');
|
|
4
|
+
require('./chunk-6RP6OPYO.js');
|
|
5
|
+
require('./chunk-TKOTACKZ.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "AuthService", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunk7ZACMER7_js.AuthService; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "BusinessService", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunk7ZACMER7_js.BusinessService; }
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "CartOperations", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunk7ZACMER7_js.CartOperations; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "CatalogueQueries", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunk7ZACMER7_js.CatalogueQueries; }
|
|
24
24
|
});
|
|
25
25
|
Object.defineProperty(exports, "CheckoutOperations", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunk7ZACMER7_js.CheckoutService; }
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(exports, "CheckoutService", {
|
|
30
30
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunk7ZACMER7_js.CheckoutService; }
|
|
32
32
|
});
|
|
33
33
|
Object.defineProperty(exports, "CimplifyElement", {
|
|
34
34
|
enumerable: true,
|
|
35
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunk7ZACMER7_js.CimplifyElement; }
|
|
36
36
|
});
|
|
37
37
|
Object.defineProperty(exports, "CimplifyElements", {
|
|
38
38
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunk7ZACMER7_js.CimplifyElements; }
|
|
40
40
|
});
|
|
41
41
|
Object.defineProperty(exports, "ELEMENT_TYPES", {
|
|
42
42
|
enumerable: true,
|
|
43
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunk7ZACMER7_js.ELEMENT_TYPES; }
|
|
44
44
|
});
|
|
45
45
|
Object.defineProperty(exports, "EVENT_TYPES", {
|
|
46
46
|
enumerable: true,
|
|
47
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunk7ZACMER7_js.EVENT_TYPES; }
|
|
48
48
|
});
|
|
49
49
|
Object.defineProperty(exports, "FxService", {
|
|
50
50
|
enumerable: true,
|
|
51
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunk7ZACMER7_js.FxService; }
|
|
52
52
|
});
|
|
53
53
|
Object.defineProperty(exports, "InventoryService", {
|
|
54
54
|
enumerable: true,
|
|
55
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunk7ZACMER7_js.InventoryService; }
|
|
56
56
|
});
|
|
57
57
|
Object.defineProperty(exports, "LinkService", {
|
|
58
58
|
enumerable: true,
|
|
59
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunk7ZACMER7_js.LinkService; }
|
|
60
60
|
});
|
|
61
61
|
Object.defineProperty(exports, "LiteService", {
|
|
62
62
|
enumerable: true,
|
|
63
|
-
get: function () { return
|
|
63
|
+
get: function () { return chunk7ZACMER7_js.LiteService; }
|
|
64
64
|
});
|
|
65
65
|
Object.defineProperty(exports, "MESSAGE_TYPES", {
|
|
66
66
|
enumerable: true,
|
|
67
|
-
get: function () { return
|
|
67
|
+
get: function () { return chunk7ZACMER7_js.MESSAGE_TYPES; }
|
|
68
68
|
});
|
|
69
69
|
Object.defineProperty(exports, "OrderQueries", {
|
|
70
70
|
enumerable: true,
|
|
71
|
-
get: function () { return
|
|
71
|
+
get: function () { return chunk7ZACMER7_js.OrderQueries; }
|
|
72
72
|
});
|
|
73
73
|
Object.defineProperty(exports, "SchedulingService", {
|
|
74
74
|
enumerable: true,
|
|
75
|
-
get: function () { return
|
|
75
|
+
get: function () { return chunk7ZACMER7_js.SchedulingService; }
|
|
76
76
|
});
|
|
77
77
|
Object.defineProperty(exports, "createElements", {
|
|
78
78
|
enumerable: true,
|
|
79
|
-
get: function () { return
|
|
79
|
+
get: function () { return chunk7ZACMER7_js.createElements; }
|
|
80
80
|
});
|
|
81
81
|
Object.defineProperty(exports, "generateIdempotencyKey", {
|
|
82
82
|
enumerable: true,
|
|
83
|
-
get: function () { return
|
|
83
|
+
get: function () { return chunk7ZACMER7_js.generateIdempotencyKey; }
|
|
84
84
|
});
|
package/dist/advanced.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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-CKRMA5F7.mjs';
|
|
2
|
+
import './chunk-XY2DFX5K.mjs';
|
|
3
|
+
import './chunk-Z2AYLZDF.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __publicField, __privateAdd, __privateSet, __privateGet, __privateMethod, ErrorCode, __privateWrapper } from './chunk-
|
|
1
|
+
import { __publicField, __privateAdd, __privateSet, __privateGet, __privateMethod, ErrorCode, __privateWrapper } from './chunk-Z2AYLZDF.mjs';
|
|
2
2
|
|
|
3
3
|
// ../node_modules/.bun/hono@4.12.16/node_modules/hono/dist/compose.js
|
|
4
4
|
var compose = (middleware, onError, onNotFound) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createCimplifyClient } from './chunk-
|
|
2
|
-
import { createMockApp } from './chunk-
|
|
1
|
+
import { createCimplifyClient } from './chunk-WUIERJ6J.mjs';
|
|
2
|
+
import { createMockApp } from './chunk-632JEJUS.mjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
var cimplifyRegistry = z.registry();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkTKOTACKZ_js = require('./chunk-TKOTACKZ.js');
|
|
4
4
|
|
|
5
5
|
// src/utils/price.ts
|
|
6
6
|
var CURRENCY_SYMBOLS = {
|
|
@@ -440,14 +440,14 @@ function normalizeStatusResponse(response) {
|
|
|
440
440
|
return {
|
|
441
441
|
status: "pending",
|
|
442
442
|
paid: false,
|
|
443
|
-
amount:
|
|
443
|
+
amount: chunkTKOTACKZ_js.moneyFromNumber(0),
|
|
444
444
|
currency: "",
|
|
445
445
|
message: "No status available"
|
|
446
446
|
};
|
|
447
447
|
}
|
|
448
448
|
const res = response;
|
|
449
449
|
const normalizedStatus = normalizePaymentStatusValue(res.status ?? void 0);
|
|
450
|
-
const normalizedAmount = typeof res.amount === "string" ?
|
|
450
|
+
const normalizedAmount = typeof res.amount === "string" ? chunkTKOTACKZ_js.money(res.amount) : typeof res.amount === "number" && Number.isFinite(res.amount) ? chunkTKOTACKZ_js.moneyFromNumber(res.amount) : chunkTKOTACKZ_js.moneyFromNumber(0);
|
|
451
451
|
const normalizedCurrency = typeof res.currency === "string" && res.currency.trim().length > 0 ? res.currency : "";
|
|
452
452
|
const paidValue = res.paid === true;
|
|
453
453
|
const derivedPaid = paidValue || [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk6RP6OPYO_js = require('./chunk-6RP6OPYO.js');
|
|
4
|
+
var chunkTKOTACKZ_js = require('./chunk-TKOTACKZ.js');
|
|
5
5
|
|
|
6
6
|
// src/types/result.ts
|
|
7
7
|
function ok(value) {
|
|
@@ -85,11 +85,11 @@ function generateIdempotencyKey(prefix = "idem") {
|
|
|
85
85
|
|
|
86
86
|
// src/internal/safe.ts
|
|
87
87
|
function toCimplifyError(error) {
|
|
88
|
-
if (error instanceof
|
|
88
|
+
if (error instanceof chunkTKOTACKZ_js.CimplifyError) return chunkTKOTACKZ_js.enrichError(error);
|
|
89
89
|
if (error instanceof Error) {
|
|
90
|
-
return
|
|
90
|
+
return chunkTKOTACKZ_js.enrichError(new chunkTKOTACKZ_js.CimplifyError(chunkTKOTACKZ_js.ErrorCode.UNKNOWN_ERROR, error.message, false));
|
|
91
91
|
}
|
|
92
|
-
return
|
|
92
|
+
return chunkTKOTACKZ_js.enrichError(new chunkTKOTACKZ_js.CimplifyError(chunkTKOTACKZ_js.ErrorCode.UNKNOWN_ERROR, String(error), false));
|
|
93
93
|
}
|
|
94
94
|
async function safe(promise) {
|
|
95
95
|
try {
|
|
@@ -648,7 +648,7 @@ var CartOperations = class {
|
|
|
648
648
|
if (typeof updates.quantity !== "number") {
|
|
649
649
|
return {
|
|
650
650
|
ok: false,
|
|
651
|
-
error: new
|
|
651
|
+
error: new chunkTKOTACKZ_js.CimplifyError(
|
|
652
652
|
"VALIDATION_ERROR",
|
|
653
653
|
"updateItem requires a quantity; richer mid-cart edits are not supported"
|
|
654
654
|
)
|
|
@@ -1093,7 +1093,7 @@ var CheckoutResolver = class {
|
|
|
1093
1093
|
}
|
|
1094
1094
|
}
|
|
1095
1095
|
}
|
|
1096
|
-
if (checkoutResult.requires_authorization ||
|
|
1096
|
+
if (checkoutResult.requires_authorization || chunk6RP6OPYO_js.isPaymentStatusRequiresAction(checkoutResult.payment_status)) {
|
|
1097
1097
|
const authorization = await this.handleAuthorization({
|
|
1098
1098
|
authorizationType,
|
|
1099
1099
|
paymentReference,
|
|
@@ -1267,18 +1267,18 @@ var CheckoutResolver = class {
|
|
|
1267
1267
|
if (statusResult.value.reference) {
|
|
1268
1268
|
paymentReference = statusResult.value.reference;
|
|
1269
1269
|
}
|
|
1270
|
-
const normalized =
|
|
1271
|
-
if (normalized.paid ||
|
|
1270
|
+
const normalized = chunk6RP6OPYO_js.normalizeStatusResponse(statusResult.value);
|
|
1271
|
+
if (normalized.paid || chunk6RP6OPYO_js.isPaymentStatusSuccess(normalized.status)) {
|
|
1272
1272
|
return this.finalizeSuccess(latestCheckoutResult);
|
|
1273
1273
|
}
|
|
1274
|
-
if (
|
|
1274
|
+
if (chunk6RP6OPYO_js.isPaymentStatusFailure(normalized.status)) {
|
|
1275
1275
|
return this.fail(
|
|
1276
1276
|
normalized.status ? normalized.status.toUpperCase() : "PAYMENT_FAILED",
|
|
1277
1277
|
normalized.message || "Payment failed during confirmation.",
|
|
1278
1278
|
false
|
|
1279
1279
|
);
|
|
1280
1280
|
}
|
|
1281
|
-
if (
|
|
1281
|
+
if (chunk6RP6OPYO_js.isPaymentStatusRequiresAction(normalized.status)) {
|
|
1282
1282
|
const authorization = await this.handleAuthorization({
|
|
1283
1283
|
authorizationType,
|
|
1284
1284
|
paymentReference,
|
|
@@ -1309,8 +1309,8 @@ var CheckoutResolver = class {
|
|
|
1309
1309
|
try {
|
|
1310
1310
|
const finalResult = await this.client.checkout.pollPaymentStatus(input.orderId);
|
|
1311
1311
|
if (finalResult.ok) {
|
|
1312
|
-
const normalized =
|
|
1313
|
-
if (normalized.paid ||
|
|
1312
|
+
const normalized = chunk6RP6OPYO_js.normalizeStatusResponse(finalResult.value);
|
|
1313
|
+
if (normalized.paid || chunk6RP6OPYO_js.isPaymentStatusSuccess(normalized.status)) {
|
|
1314
1314
|
return this.finalizeSuccess(latestCheckoutResult);
|
|
1315
1315
|
}
|
|
1316
1316
|
}
|
|
@@ -1506,12 +1506,12 @@ var CheckoutResolver = class {
|
|
|
1506
1506
|
};
|
|
1507
1507
|
}
|
|
1508
1508
|
isSuccessfulStatus(status) {
|
|
1509
|
-
const normalized =
|
|
1510
|
-
return normalized.paid ||
|
|
1509
|
+
const normalized = chunk6RP6OPYO_js.normalizeStatusResponse({ status, paid: false });
|
|
1510
|
+
return normalized.paid || chunk6RP6OPYO_js.isPaymentStatusSuccess(normalized.status);
|
|
1511
1511
|
}
|
|
1512
1512
|
isFailureStatus(status) {
|
|
1513
|
-
const normalized =
|
|
1514
|
-
return
|
|
1513
|
+
const normalized = chunk6RP6OPYO_js.normalizeStatusResponse({ status, paid: false });
|
|
1514
|
+
return chunk6RP6OPYO_js.isPaymentStatusFailure(normalized.status);
|
|
1515
1515
|
}
|
|
1516
1516
|
ensureNotAborted() {
|
|
1517
1517
|
if (this.signal?.aborted) {
|
|
@@ -1570,7 +1570,7 @@ var CheckoutService = class {
|
|
|
1570
1570
|
}
|
|
1571
1571
|
async initializePayment(_orderId, _method) {
|
|
1572
1572
|
return err(
|
|
1573
|
-
new
|
|
1573
|
+
new chunkTKOTACKZ_js.CimplifyError(
|
|
1574
1574
|
"NOT_IMPLEMENTED",
|
|
1575
1575
|
"initializePayment is not available in REST mode.",
|
|
1576
1576
|
false
|
|
@@ -1642,11 +1642,11 @@ var CheckoutService = class {
|
|
|
1642
1642
|
pay_currency: data.pay_currency,
|
|
1643
1643
|
fx_quote_id: data.fx_quote_id
|
|
1644
1644
|
};
|
|
1645
|
-
const baseCurrency =
|
|
1645
|
+
const baseCurrency = chunkTKOTACKZ_js.currencyCode(
|
|
1646
1646
|
(cart.pricing.currency || checkoutData.pay_currency || "GHS").toUpperCase()
|
|
1647
1647
|
);
|
|
1648
1648
|
const payCurrency = data.pay_currency?.trim().toUpperCase();
|
|
1649
|
-
const payCurrencyCode = payCurrency ?
|
|
1649
|
+
const payCurrencyCode = payCurrency ? chunkTKOTACKZ_js.currencyCode(payCurrency) : void 0;
|
|
1650
1650
|
const cartTotalAmount = typeof cart.pricing.total_price === "number" ? cart.pricing.total_price : Number.parseFloat(cart.pricing.total_price || "0");
|
|
1651
1651
|
if (payCurrencyCode && payCurrencyCode !== baseCurrency && !checkoutData.fx_quote_id && Number.isFinite(cartTotalAmount) && cartTotalAmount > 0) {
|
|
1652
1652
|
const fxQuoteResult = await this.client.fx.lockQuote({
|
|
@@ -1979,7 +1979,7 @@ var BusinessService = class {
|
|
|
1979
1979
|
if (!result.ok) return err(result.error);
|
|
1980
1980
|
const location = result.value.find((item) => item.id === locationId);
|
|
1981
1981
|
if (!location) {
|
|
1982
|
-
return err(new
|
|
1982
|
+
return err(new chunkTKOTACKZ_js.CimplifyError(chunkTKOTACKZ_js.ErrorCode.NOT_FOUND, `Location not found: ${locationId}`, false));
|
|
1983
1983
|
}
|
|
1984
1984
|
return ok(location);
|
|
1985
1985
|
}
|
|
@@ -2266,7 +2266,7 @@ var EVENT_TYPES = {
|
|
|
2266
2266
|
|
|
2267
2267
|
// src/elements.ts
|
|
2268
2268
|
function toCheckoutError(code, message, recoverable) {
|
|
2269
|
-
const hint =
|
|
2269
|
+
const hint = chunkTKOTACKZ_js.getErrorHint(code);
|
|
2270
2270
|
return {
|
|
2271
2271
|
success: false,
|
|
2272
2272
|
error: {
|
|
@@ -2732,6 +2732,8 @@ var CimplifyElement = class {
|
|
|
2732
2732
|
this.iframe = null;
|
|
2733
2733
|
this.container = null;
|
|
2734
2734
|
this.mounted = false;
|
|
2735
|
+
this.ready = false;
|
|
2736
|
+
this.pendingMessages = [];
|
|
2735
2737
|
this.pendingInit = null;
|
|
2736
2738
|
this.eventHandlers = /* @__PURE__ */ new Map();
|
|
2737
2739
|
this.resolvers = /* @__PURE__ */ new Map();
|
|
@@ -2773,6 +2775,8 @@ var CimplifyElement = class {
|
|
|
2773
2775
|
}
|
|
2774
2776
|
this.container = null;
|
|
2775
2777
|
this.mounted = false;
|
|
2778
|
+
this.ready = false;
|
|
2779
|
+
this.pendingMessages = [];
|
|
2776
2780
|
this.eventHandlers.clear();
|
|
2777
2781
|
this.resolvers.forEach((entry) => clearTimeout(entry.timeoutId));
|
|
2778
2782
|
this.resolvers.clear();
|
|
@@ -2813,10 +2817,28 @@ var CimplifyElement = class {
|
|
|
2813
2817
|
this.sendMessage({ type: MESSAGE_TYPES.SET_CART, cart });
|
|
2814
2818
|
}
|
|
2815
2819
|
sendMessage(message) {
|
|
2816
|
-
|
|
2820
|
+
const iframe = this.iframe;
|
|
2821
|
+
if (!iframe || !iframe.isConnected) {
|
|
2822
|
+
if (iframe && !iframe.isConnected) {
|
|
2823
|
+
console.warn(
|
|
2824
|
+
"[cimplify:checkout] sendMessage DROPPED \u2014 iframe detached",
|
|
2825
|
+
{ type: message.type }
|
|
2826
|
+
);
|
|
2827
|
+
}
|
|
2828
|
+
return;
|
|
2829
|
+
}
|
|
2830
|
+
if (!this.ready || !iframe.contentWindow) {
|
|
2831
|
+
this.pendingMessages.push(message);
|
|
2832
|
+
return;
|
|
2833
|
+
}
|
|
2834
|
+
iframe.contentWindow.postMessage(message, this.linkUrl);
|
|
2835
|
+
}
|
|
2836
|
+
flushPending() {
|
|
2837
|
+
if (!this.ready || !this.iframe?.contentWindow) return;
|
|
2838
|
+
const queue = this.pendingMessages;
|
|
2839
|
+
this.pendingMessages = [];
|
|
2840
|
+
for (const message of queue) {
|
|
2817
2841
|
this.iframe.contentWindow.postMessage(message, this.linkUrl);
|
|
2818
|
-
} else {
|
|
2819
|
-
console.warn("[cimplify:checkout] sendMessage DROPPED \u2014 no contentWindow", { type: message.type, hasIframe: !!this.iframe, isConnected: this.iframe?.isConnected });
|
|
2820
2842
|
}
|
|
2821
2843
|
}
|
|
2822
2844
|
getContentWindow() {
|
|
@@ -2881,6 +2903,7 @@ var CimplifyElement = class {
|
|
|
2881
2903
|
if (!message) return;
|
|
2882
2904
|
switch (message.type) {
|
|
2883
2905
|
case MESSAGE_TYPES.READY:
|
|
2906
|
+
this.ready = true;
|
|
2884
2907
|
if (this.iframe && message.height) this.iframe.style.height = `${message.height}px`;
|
|
2885
2908
|
if (this.pendingInit) {
|
|
2886
2909
|
const { publicKey } = this.pendingInit;
|
|
@@ -2902,6 +2925,7 @@ var CimplifyElement = class {
|
|
|
2902
2925
|
}
|
|
2903
2926
|
this.pendingInit = null;
|
|
2904
2927
|
}
|
|
2928
|
+
this.flushPending();
|
|
2905
2929
|
this.emit(EVENT_TYPES.READY, { height: message.height });
|
|
2906
2930
|
break;
|
|
2907
2931
|
case MESSAGE_TYPES.HEIGHT_CHANGE:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isPaymentStatusRequiresAction, normalizeStatusResponse, isPaymentStatusSuccess, isPaymentStatusFailure } from './chunk-
|
|
2
|
-
import { CimplifyError, currencyCode, ErrorCode, enrichError, getErrorHint } from './chunk-
|
|
1
|
+
import { isPaymentStatusRequiresAction, normalizeStatusResponse, isPaymentStatusSuccess, isPaymentStatusFailure } from './chunk-XY2DFX5K.mjs';
|
|
2
|
+
import { CimplifyError, currencyCode, ErrorCode, enrichError, getErrorHint } from './chunk-Z2AYLZDF.mjs';
|
|
3
3
|
|
|
4
4
|
// src/types/result.ts
|
|
5
5
|
function ok(value) {
|
|
@@ -2730,6 +2730,8 @@ var CimplifyElement = class {
|
|
|
2730
2730
|
this.iframe = null;
|
|
2731
2731
|
this.container = null;
|
|
2732
2732
|
this.mounted = false;
|
|
2733
|
+
this.ready = false;
|
|
2734
|
+
this.pendingMessages = [];
|
|
2733
2735
|
this.pendingInit = null;
|
|
2734
2736
|
this.eventHandlers = /* @__PURE__ */ new Map();
|
|
2735
2737
|
this.resolvers = /* @__PURE__ */ new Map();
|
|
@@ -2771,6 +2773,8 @@ var CimplifyElement = class {
|
|
|
2771
2773
|
}
|
|
2772
2774
|
this.container = null;
|
|
2773
2775
|
this.mounted = false;
|
|
2776
|
+
this.ready = false;
|
|
2777
|
+
this.pendingMessages = [];
|
|
2774
2778
|
this.eventHandlers.clear();
|
|
2775
2779
|
this.resolvers.forEach((entry) => clearTimeout(entry.timeoutId));
|
|
2776
2780
|
this.resolvers.clear();
|
|
@@ -2811,10 +2815,28 @@ var CimplifyElement = class {
|
|
|
2811
2815
|
this.sendMessage({ type: MESSAGE_TYPES.SET_CART, cart });
|
|
2812
2816
|
}
|
|
2813
2817
|
sendMessage(message) {
|
|
2814
|
-
|
|
2818
|
+
const iframe = this.iframe;
|
|
2819
|
+
if (!iframe || !iframe.isConnected) {
|
|
2820
|
+
if (iframe && !iframe.isConnected) {
|
|
2821
|
+
console.warn(
|
|
2822
|
+
"[cimplify:checkout] sendMessage DROPPED \u2014 iframe detached",
|
|
2823
|
+
{ type: message.type }
|
|
2824
|
+
);
|
|
2825
|
+
}
|
|
2826
|
+
return;
|
|
2827
|
+
}
|
|
2828
|
+
if (!this.ready || !iframe.contentWindow) {
|
|
2829
|
+
this.pendingMessages.push(message);
|
|
2830
|
+
return;
|
|
2831
|
+
}
|
|
2832
|
+
iframe.contentWindow.postMessage(message, this.linkUrl);
|
|
2833
|
+
}
|
|
2834
|
+
flushPending() {
|
|
2835
|
+
if (!this.ready || !this.iframe?.contentWindow) return;
|
|
2836
|
+
const queue = this.pendingMessages;
|
|
2837
|
+
this.pendingMessages = [];
|
|
2838
|
+
for (const message of queue) {
|
|
2815
2839
|
this.iframe.contentWindow.postMessage(message, this.linkUrl);
|
|
2816
|
-
} else {
|
|
2817
|
-
console.warn("[cimplify:checkout] sendMessage DROPPED \u2014 no contentWindow", { type: message.type, hasIframe: !!this.iframe, isConnected: this.iframe?.isConnected });
|
|
2818
2840
|
}
|
|
2819
2841
|
}
|
|
2820
2842
|
getContentWindow() {
|
|
@@ -2879,6 +2901,7 @@ var CimplifyElement = class {
|
|
|
2879
2901
|
if (!message) return;
|
|
2880
2902
|
switch (message.type) {
|
|
2881
2903
|
case MESSAGE_TYPES.READY:
|
|
2904
|
+
this.ready = true;
|
|
2882
2905
|
if (this.iframe && message.height) this.iframe.style.height = `${message.height}px`;
|
|
2883
2906
|
if (this.pendingInit) {
|
|
2884
2907
|
const { publicKey } = this.pendingInit;
|
|
@@ -2900,6 +2923,7 @@ var CimplifyElement = class {
|
|
|
2900
2923
|
}
|
|
2901
2924
|
this.pendingInit = null;
|
|
2902
2925
|
}
|
|
2926
|
+
this.flushPending();
|
|
2903
2927
|
this.emit(EVENT_TYPES.READY, { height: message.height });
|
|
2904
2928
|
break;
|
|
2905
2929
|
case MESSAGE_TYPES.HEIGHT_CHANGE:
|