@sunbay/checkout-sdk-js 0.0.8 → 0.0.9
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/README.md +4 -2
- package/dist/index.cjs +20 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -2
- package/dist/index.d.ts +18 -2
- package/dist/index.global.js +29 -2
- package/dist/index.global.js.map +1 -1
- package/dist/index.mjs +21 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -984,6 +984,7 @@ var CheckoutInstance = class {
|
|
|
984
984
|
/** The current pending confirm (at most one at a time). */
|
|
985
985
|
this.pendingConfirm = null;
|
|
986
986
|
this.destroyed = false;
|
|
987
|
+
this.pendingWarnings = opts.initialWarnings ? [...opts.initialWarnings] : [];
|
|
987
988
|
this.checkoutId = opts.checkoutId;
|
|
988
989
|
this.runtimeId = opts.runtimeId;
|
|
989
990
|
this.capabilities = opts.capabilities;
|
|
@@ -1181,6 +1182,18 @@ var CheckoutInstance = class {
|
|
|
1181
1182
|
on(event, handler) {
|
|
1182
1183
|
this.assertAlive();
|
|
1183
1184
|
this.transport.on(event, handler);
|
|
1185
|
+
if (event === "warning" && this.pendingWarnings.length > 0) {
|
|
1186
|
+
const pending = this.pendingWarnings;
|
|
1187
|
+
this.pendingWarnings = [];
|
|
1188
|
+
queueMicrotask(() => {
|
|
1189
|
+
if (this.destroyed) {
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1192
|
+
for (const w of pending) {
|
|
1193
|
+
handler(w);
|
|
1194
|
+
}
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1184
1197
|
}
|
|
1185
1198
|
/**
|
|
1186
1199
|
* Unregister an event handler (safe to call after destruction).
|
|
@@ -1379,7 +1392,9 @@ async function createCheckout(opts) {
|
|
|
1379
1392
|
checkoutClientSecret: opts.checkoutClientSecret,
|
|
1380
1393
|
locale: opts.locale,
|
|
1381
1394
|
appearance: opts.appearance,
|
|
1382
|
-
paymentMethods: opts.paymentMethods
|
|
1395
|
+
paymentMethods: opts.paymentMethods,
|
|
1396
|
+
billingAddress: opts.billingAddress,
|
|
1397
|
+
shippingAddress: opts.shippingAddress
|
|
1383
1398
|
};
|
|
1384
1399
|
let initResp;
|
|
1385
1400
|
try {
|
|
@@ -1395,6 +1410,7 @@ async function createCheckout(opts) {
|
|
|
1395
1410
|
transport,
|
|
1396
1411
|
capabilities: initResp.capabilities,
|
|
1397
1412
|
session: initResp.session,
|
|
1413
|
+
initialWarnings: initResp.warnings,
|
|
1398
1414
|
appearance: opts.appearance
|
|
1399
1415
|
});
|
|
1400
1416
|
}
|
|
@@ -1421,17 +1437,19 @@ function waitForHello(transport) {
|
|
|
1421
1437
|
|
|
1422
1438
|
// src/index.ts
|
|
1423
1439
|
import {
|
|
1424
|
-
ErrorCode as ErrorCode5
|
|
1440
|
+
ErrorCode as ErrorCode5,
|
|
1441
|
+
WARNING_CODES
|
|
1425
1442
|
} from "@sunbay/checkout-sdk-protocol";
|
|
1426
1443
|
if (typeof window !== "undefined") {
|
|
1427
1444
|
const w = window;
|
|
1428
1445
|
w.SunbayCheckout = { ...w.SunbayCheckout ?? {}, createCheckout };
|
|
1429
1446
|
}
|
|
1430
|
-
var version = true ? "0.0.
|
|
1447
|
+
var version = true ? "0.0.9" : "0.0.0";
|
|
1431
1448
|
export {
|
|
1432
1449
|
CheckoutElement,
|
|
1433
1450
|
CheckoutInstance,
|
|
1434
1451
|
ErrorCode5 as ErrorCode,
|
|
1452
|
+
WARNING_CODES,
|
|
1435
1453
|
createCheckout,
|
|
1436
1454
|
version
|
|
1437
1455
|
};
|