@paypay/mini-app-js-sdk 2.54.0 → 2.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/clientUtils.d.ts +2 -5
- package/dist/client/communicationWithCore.d.ts +2 -1
- package/dist/client/functions/coreWindowBridgeFunctions.d.ts +5 -0
- package/dist/client/supportedFunctionsList.d.ts +1 -1
- package/dist/client/windowBridgeFunctions/domFunctions.d.ts +7 -0
- package/dist/client/windowBridgeFunctions/index.d.ts +2 -0
- package/dist/client/windowBridgeFunctions/insertIframe.d.ts +11 -0
- package/dist/composition-api/usePaymentLabel.d.ts +27 -0
- package/dist/composition-api/usePaymentTypeTranslation.d.ts +19 -0
- package/dist/core/button/buttonFunctions/index.d.ts +1 -0
- package/dist/core/button/buttonFunctions/renderButtonUi.d.ts +17 -0
- package/dist/core/button/index.d.ts +3 -0
- package/dist/core/clientState.d.ts +3 -1
- package/dist/core/coreFunctions/index.d.ts +2 -0
- package/dist/core/coreFunctions/renderButton/index.d.ts +8 -0
- package/dist/core/coreFunctions/renderButton/renderButton.d.ts +6 -0
- package/dist/core/coreFunctions/renderButton/types.d.ts +31 -0
- package/dist/core/iframeVisibilityManager.d.ts +15 -0
- package/dist/environment-variables.d.ts +1 -0
- package/dist/mini-app-api.d.ts +0 -1
- package/dist/mini-app-js-sdk.browser.js +1 -1
- package/dist/mini-app-js-sdk.es.js +281 -211
- package/dist/model/bridge/render.d.ts +1 -1
- package/dist/model/bridge/renderLoginButton.d.ts +1 -1
- package/dist/model/bridge/renderPayButton.d.ts +4 -2
- package/dist/model/makePayment.d.ts +18 -0
- package/dist/package/lottie/lottie.d.ts +1 -1
- package/dist/resources/locales/payment/index.d.ts +499 -0
- package/dist/resources/locales/payment/ja.d.ts +249 -0
- package/dist/resources/locales/shared/index.d.ts +79 -0
- package/dist/resources/locales/shared/ja.d.ts +39 -0
- package/dist/types/init.d.ts +2 -0
- package/dist/types.d.ts +2 -0
- package/dist/utils/analytics.d.ts +2 -1
- package/dist/utils/clientCustomization.d.ts +3 -0
- package/dist/utils/getLanguage.d.ts +1 -2
- package/dist/utils/helper.d.ts +1 -1
- package/dist/utils/minimumJSSDKVersion.d.ts +1 -0
- package/dist/utils/userAgent.d.ts +1 -0
- package/dist/views/coupon/components/CouponAction/index.d.ts +2 -0
- package/dist/views/coupon/index.d.ts +2 -0
- package/dist/views/make-payment/store/util-for-handle-error.d.ts +11 -0
- package/dist/views/make-payment/store.d.ts +22056 -0
- package/dist/views/make-payment/utils/paymentMethod.d.ts +4 -0
- package/dist/views/registerPaymentFeatures/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -18,6 +18,18 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
return a;
|
|
19
19
|
};
|
|
20
20
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
+
var __objRest = (source, exclude) => {
|
|
22
|
+
var target = {};
|
|
23
|
+
for (var prop in source)
|
|
24
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
if (source != null && __getOwnPropSymbols)
|
|
27
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
}
|
|
31
|
+
return target;
|
|
32
|
+
};
|
|
21
33
|
var __async = (__this, __arguments, generator) => {
|
|
22
34
|
return new Promise((resolve, reject) => {
|
|
23
35
|
var fulfilled = (value) => {
|
|
@@ -213,6 +225,8 @@ const PPUtilFunctionName = {
|
|
|
213
225
|
saveRefreshToken: "saveRefreshToken",
|
|
214
226
|
saveCodeVerifier: "saveCodeVerifier",
|
|
215
227
|
makeVisible: "makeVisible",
|
|
228
|
+
hideIframe: "hideIframe",
|
|
229
|
+
showIframe: "showIframe",
|
|
216
230
|
consoleDebugInfo: "consoleDebugInfo",
|
|
217
231
|
clientPopState: "clientPopState"
|
|
218
232
|
};
|
|
@@ -292,10 +306,11 @@ const smartPaymentSupportedFunctions = [
|
|
|
292
306
|
"getUAID",
|
|
293
307
|
"getCashbackInformation",
|
|
294
308
|
"renderCoupons",
|
|
295
|
-
"getLoginUrl"
|
|
309
|
+
"getLoginUrl",
|
|
310
|
+
"renderButton"
|
|
296
311
|
];
|
|
297
|
-
const JS_SDK_VERSION = "2.
|
|
298
|
-
const REVISION = "
|
|
312
|
+
const JS_SDK_VERSION = "2.56.0";
|
|
313
|
+
const REVISION = "8161aa8";
|
|
299
314
|
const coreBaseUrl = new URL("https://mini-app-sdk-core.paypay.ne.jp/");
|
|
300
315
|
const CORE_IFRAME_ORIGIN = coreBaseUrl.origin;
|
|
301
316
|
const CORE_IFRAME_URL = new URL(
|
|
@@ -306,6 +321,10 @@ const COUPON_IFRAME_URL = new URL(
|
|
|
306
321
|
`./coupon/iframe.html?v=${JS_SDK_VERSION}`,
|
|
307
322
|
coreBaseUrl
|
|
308
323
|
).href;
|
|
324
|
+
new URL(
|
|
325
|
+
`./button/iframe.html?v=${JS_SDK_VERSION}`,
|
|
326
|
+
coreBaseUrl
|
|
327
|
+
).href;
|
|
309
328
|
const SENTRY_DSN = "https://377b45f154b1fb17d8e98a6ffb67030a@o4505819519320064.ingest.sentry.io/4506579323453440";
|
|
310
329
|
var MiniAppErrorType = /* @__PURE__ */ ((MiniAppErrorType2) => {
|
|
311
330
|
MiniAppErrorType2["success"] = "SUCCESS";
|
|
@@ -381,12 +400,123 @@ var MiniAppErrorType = /* @__PURE__ */ ((MiniAppErrorType2) => {
|
|
|
381
400
|
MiniAppErrorType2["invalidVirtualAccount"] = "INVALID_VIRTUAL_ACCOUNT";
|
|
382
401
|
return MiniAppErrorType2;
|
|
383
402
|
})(MiniAppErrorType || {});
|
|
403
|
+
function setCookie({ name, value, options }) {
|
|
404
|
+
return api.set(name, value, options);
|
|
405
|
+
}
|
|
406
|
+
function getCookie({ name }) {
|
|
407
|
+
return api.get(name);
|
|
408
|
+
}
|
|
409
|
+
function removeCookie$1({ name, options }) {
|
|
410
|
+
return api.remove(name, options);
|
|
411
|
+
}
|
|
412
|
+
function setLocalStorage({
|
|
413
|
+
name,
|
|
414
|
+
value
|
|
415
|
+
}) {
|
|
416
|
+
return localStorage.setItem(name, value);
|
|
417
|
+
}
|
|
418
|
+
function getLocalStorage({ name }) {
|
|
419
|
+
return localStorage.getItem(name);
|
|
420
|
+
}
|
|
421
|
+
function removeLocalStorage({ name }) {
|
|
422
|
+
return localStorage.removeItem(name);
|
|
423
|
+
}
|
|
424
|
+
function setSessionStorage({
|
|
425
|
+
name,
|
|
426
|
+
value
|
|
427
|
+
}) {
|
|
428
|
+
return sessionStorage.setItem(name, value);
|
|
429
|
+
}
|
|
430
|
+
function getSessionStorage({ name }) {
|
|
431
|
+
return sessionStorage.getItem(name);
|
|
432
|
+
}
|
|
433
|
+
function removeSessionStorage({ name }) {
|
|
434
|
+
return sessionStorage.removeItem(name);
|
|
435
|
+
}
|
|
436
|
+
function removeQueryParametersFromUrl(removeParams) {
|
|
437
|
+
const url = new URL(window.location.href);
|
|
438
|
+
removeParams.forEach((param) => url.searchParams.delete(param));
|
|
439
|
+
const newURL = `${url.pathname}${url.search}`;
|
|
440
|
+
history.replaceState(history.state, "", newURL);
|
|
441
|
+
}
|
|
442
|
+
function getUrl() {
|
|
443
|
+
return window.location.href;
|
|
444
|
+
}
|
|
384
445
|
class PPError extends Error {
|
|
385
446
|
constructor(message, errorCode) {
|
|
386
447
|
super(message);
|
|
387
448
|
this.errorCode = errorCode;
|
|
388
449
|
}
|
|
389
450
|
}
|
|
451
|
+
function insertIframe(_a) {
|
|
452
|
+
var {
|
|
453
|
+
containerSelector: containerQuerySelector,
|
|
454
|
+
attributes: _b
|
|
455
|
+
} = _a, _c = _b, { styles } = _c, attributes = __objRest(_c, ["styles"]);
|
|
456
|
+
return new Promise((resolve, reject) => {
|
|
457
|
+
const container = document.querySelector(containerQuerySelector);
|
|
458
|
+
if (!container) {
|
|
459
|
+
reject(
|
|
460
|
+
new PPError(
|
|
461
|
+
`Container with selector "${containerQuerySelector}" not found.`,
|
|
462
|
+
MiniAppErrorType.badRequestInsufficientParameter
|
|
463
|
+
)
|
|
464
|
+
);
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
const iframe = document.createElement("iframe");
|
|
468
|
+
iframe.onload = () => {
|
|
469
|
+
resolve(true);
|
|
470
|
+
};
|
|
471
|
+
iframe.onerror = () => {
|
|
472
|
+
reject(
|
|
473
|
+
new PPError("Failed to load iframe.", MiniAppErrorType.notReachable)
|
|
474
|
+
);
|
|
475
|
+
};
|
|
476
|
+
Object.assign(iframe.style, styles);
|
|
477
|
+
Object.entries(attributes).forEach(([key, value]) => {
|
|
478
|
+
iframe.setAttribute(key, value);
|
|
479
|
+
});
|
|
480
|
+
container.innerHTML = "";
|
|
481
|
+
container.appendChild(iframe);
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
function removeElement({ selector }) {
|
|
485
|
+
const element = document.querySelector(selector);
|
|
486
|
+
if (element) {
|
|
487
|
+
element.remove();
|
|
488
|
+
return true;
|
|
489
|
+
}
|
|
490
|
+
return false;
|
|
491
|
+
}
|
|
492
|
+
function updateElementStyle({
|
|
493
|
+
selector,
|
|
494
|
+
styles
|
|
495
|
+
}) {
|
|
496
|
+
const element = document.querySelector(selector);
|
|
497
|
+
if (element) {
|
|
498
|
+
Object.assign(element.style, styles);
|
|
499
|
+
return true;
|
|
500
|
+
}
|
|
501
|
+
return false;
|
|
502
|
+
}
|
|
503
|
+
const clientWindowBridgeFunctions = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
504
|
+
__proto__: null,
|
|
505
|
+
getCookie,
|
|
506
|
+
getLocalStorage,
|
|
507
|
+
getSessionStorage,
|
|
508
|
+
getUrl,
|
|
509
|
+
insertIframe,
|
|
510
|
+
removeCookie: removeCookie$1,
|
|
511
|
+
removeElement,
|
|
512
|
+
removeLocalStorage,
|
|
513
|
+
removeQueryParametersFromUrl,
|
|
514
|
+
removeSessionStorage,
|
|
515
|
+
setCookie,
|
|
516
|
+
setLocalStorage,
|
|
517
|
+
setSessionStorage,
|
|
518
|
+
updateElementStyle
|
|
519
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
390
520
|
const SDK_VERSION = "8.45.1";
|
|
391
521
|
const GLOBAL_OBJ = globalThis;
|
|
392
522
|
function getGlobalSingleton(name, creator, obj) {
|
|
@@ -1270,6 +1400,109 @@ function addBreadcrumbToSentry(breadcrumb) {
|
|
|
1270
1400
|
addBreadcrumb(breadcrumb);
|
|
1271
1401
|
}
|
|
1272
1402
|
}
|
|
1403
|
+
class LocalStorageProxy {
|
|
1404
|
+
constructor() {
|
|
1405
|
+
var _a;
|
|
1406
|
+
this.useLocalStorage = true;
|
|
1407
|
+
this.memoryStorage = {};
|
|
1408
|
+
try {
|
|
1409
|
+
localStorage.setItem(
|
|
1410
|
+
PpLocalStorageKey.initializedAt,
|
|
1411
|
+
Date.now().toString()
|
|
1412
|
+
);
|
|
1413
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
1414
|
+
const key = localStorage.key(i);
|
|
1415
|
+
if (key != null) {
|
|
1416
|
+
this.memoryStorage[key] = (_a = localStorage.getItem(key)) != null ? _a : "";
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
} catch (e) {
|
|
1420
|
+
this.useLocalStorage = false;
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
getItem(key) {
|
|
1424
|
+
var _a, _b;
|
|
1425
|
+
if (this.useLocalStorage) {
|
|
1426
|
+
try {
|
|
1427
|
+
if (localStorage.getItem(PpLocalStorageKey.initializedAt) != null) {
|
|
1428
|
+
const val = localStorage.getItem(key);
|
|
1429
|
+
if (val != null) {
|
|
1430
|
+
return val;
|
|
1431
|
+
}
|
|
1432
|
+
return (_a = api.get(key)) != null ? _a : null;
|
|
1433
|
+
} else {
|
|
1434
|
+
console.debug("local storage value has lost unexpectedly.");
|
|
1435
|
+
addBreadcrumbToSentry({
|
|
1436
|
+
message: "local storage value has lost unexpectedly.",
|
|
1437
|
+
category: "storage"
|
|
1438
|
+
});
|
|
1439
|
+
}
|
|
1440
|
+
} catch (e) {
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
this.useLocalStorage = false;
|
|
1444
|
+
return (_b = this.memoryStorage[key]) != null ? _b : null;
|
|
1445
|
+
}
|
|
1446
|
+
setItem(key, value) {
|
|
1447
|
+
this.memoryStorage[key] = value;
|
|
1448
|
+
if (this.useLocalStorage) {
|
|
1449
|
+
try {
|
|
1450
|
+
localStorage.setItem(key, value);
|
|
1451
|
+
removeCookie(key);
|
|
1452
|
+
} catch (e) {
|
|
1453
|
+
this.useLocalStorage = false;
|
|
1454
|
+
console.warn("localStorage has become unavailable.");
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
removeItem(key) {
|
|
1459
|
+
delete this.memoryStorage[key];
|
|
1460
|
+
try {
|
|
1461
|
+
localStorage.removeItem(key);
|
|
1462
|
+
removeCookie(key);
|
|
1463
|
+
} catch (e) {
|
|
1464
|
+
this.useLocalStorage = false;
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
clear() {
|
|
1468
|
+
try {
|
|
1469
|
+
localStorage.clear();
|
|
1470
|
+
localStorage.setItem(
|
|
1471
|
+
PpLocalStorageKey.initializedAt,
|
|
1472
|
+
Date.now().toString()
|
|
1473
|
+
);
|
|
1474
|
+
clearAllCookies();
|
|
1475
|
+
} catch (e) {
|
|
1476
|
+
}
|
|
1477
|
+
this.memoryStorage = {};
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
const cookieAttributes = Object.freeze(__spreadValues({
|
|
1481
|
+
expires: 365,
|
|
1482
|
+
sameSite: "None"
|
|
1483
|
+
}, { secure: true, Partitioned: true }));
|
|
1484
|
+
function writeCookie(key, value) {
|
|
1485
|
+
api.set(key, value, cookieAttributes);
|
|
1486
|
+
}
|
|
1487
|
+
function removeCookie(key) {
|
|
1488
|
+
api.remove(key, cookieAttributes);
|
|
1489
|
+
}
|
|
1490
|
+
(() => {
|
|
1491
|
+
return new LocalStorageProxy();
|
|
1492
|
+
})();
|
|
1493
|
+
function clearAllCookies() {
|
|
1494
|
+
const cookies = api.get();
|
|
1495
|
+
for (const key in cookies) {
|
|
1496
|
+
removeCookie(key);
|
|
1497
|
+
}
|
|
1498
|
+
writeCookie(PpLocalStorageKey.initializedAt, Date.now().toString());
|
|
1499
|
+
}
|
|
1500
|
+
function isFunction(val) {
|
|
1501
|
+
return typeof val === "function";
|
|
1502
|
+
}
|
|
1503
|
+
function getRandomString() {
|
|
1504
|
+
return Math.random().toString(36).substring(7);
|
|
1505
|
+
}
|
|
1273
1506
|
function middlewareHandler(middlewares, message, messageHandler, params) {
|
|
1274
1507
|
let index = -1;
|
|
1275
1508
|
const next = (_params) => __async(this, null, function* () {
|
|
@@ -1596,165 +1829,6 @@ class WindowBridge {
|
|
|
1596
1829
|
});
|
|
1597
1830
|
}
|
|
1598
1831
|
}
|
|
1599
|
-
class LocalStorageProxy {
|
|
1600
|
-
constructor() {
|
|
1601
|
-
var _a;
|
|
1602
|
-
this.useLocalStorage = true;
|
|
1603
|
-
this.memoryStorage = {};
|
|
1604
|
-
try {
|
|
1605
|
-
localStorage.setItem(
|
|
1606
|
-
PpLocalStorageKey.initializedAt,
|
|
1607
|
-
Date.now().toString()
|
|
1608
|
-
);
|
|
1609
|
-
for (let i = 0; i < localStorage.length; i++) {
|
|
1610
|
-
const key = localStorage.key(i);
|
|
1611
|
-
if (key != null) {
|
|
1612
|
-
this.memoryStorage[key] = (_a = localStorage.getItem(key)) != null ? _a : "";
|
|
1613
|
-
}
|
|
1614
|
-
}
|
|
1615
|
-
} catch (e) {
|
|
1616
|
-
this.useLocalStorage = false;
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1619
|
-
getItem(key) {
|
|
1620
|
-
var _a, _b;
|
|
1621
|
-
if (this.useLocalStorage) {
|
|
1622
|
-
try {
|
|
1623
|
-
if (localStorage.getItem(PpLocalStorageKey.initializedAt) != null) {
|
|
1624
|
-
const val = localStorage.getItem(key);
|
|
1625
|
-
if (val != null) {
|
|
1626
|
-
return val;
|
|
1627
|
-
}
|
|
1628
|
-
return (_a = api.get(key)) != null ? _a : null;
|
|
1629
|
-
} else {
|
|
1630
|
-
console.debug("local storage value has lost unexpectedly.");
|
|
1631
|
-
addBreadcrumbToSentry({
|
|
1632
|
-
message: "local storage value has lost unexpectedly.",
|
|
1633
|
-
category: "storage"
|
|
1634
|
-
});
|
|
1635
|
-
}
|
|
1636
|
-
} catch (e) {
|
|
1637
|
-
}
|
|
1638
|
-
}
|
|
1639
|
-
this.useLocalStorage = false;
|
|
1640
|
-
return (_b = this.memoryStorage[key]) != null ? _b : null;
|
|
1641
|
-
}
|
|
1642
|
-
setItem(key, value) {
|
|
1643
|
-
this.memoryStorage[key] = value;
|
|
1644
|
-
if (this.useLocalStorage) {
|
|
1645
|
-
try {
|
|
1646
|
-
localStorage.setItem(key, value);
|
|
1647
|
-
removeCookie$1(key);
|
|
1648
|
-
} catch (e) {
|
|
1649
|
-
this.useLocalStorage = false;
|
|
1650
|
-
console.warn("localStorage has become unavailable.");
|
|
1651
|
-
}
|
|
1652
|
-
}
|
|
1653
|
-
}
|
|
1654
|
-
removeItem(key) {
|
|
1655
|
-
delete this.memoryStorage[key];
|
|
1656
|
-
try {
|
|
1657
|
-
localStorage.removeItem(key);
|
|
1658
|
-
removeCookie$1(key);
|
|
1659
|
-
} catch (e) {
|
|
1660
|
-
this.useLocalStorage = false;
|
|
1661
|
-
}
|
|
1662
|
-
}
|
|
1663
|
-
clear() {
|
|
1664
|
-
try {
|
|
1665
|
-
localStorage.clear();
|
|
1666
|
-
localStorage.setItem(
|
|
1667
|
-
PpLocalStorageKey.initializedAt,
|
|
1668
|
-
Date.now().toString()
|
|
1669
|
-
);
|
|
1670
|
-
clearAllCookies();
|
|
1671
|
-
} catch (e) {
|
|
1672
|
-
}
|
|
1673
|
-
this.memoryStorage = {};
|
|
1674
|
-
}
|
|
1675
|
-
}
|
|
1676
|
-
const cookieAttributes = Object.freeze(__spreadValues({
|
|
1677
|
-
expires: 365,
|
|
1678
|
-
sameSite: "None"
|
|
1679
|
-
}, { secure: true, Partitioned: true }));
|
|
1680
|
-
function writeCookie(key, value) {
|
|
1681
|
-
api.set(key, value, cookieAttributes);
|
|
1682
|
-
}
|
|
1683
|
-
function removeCookie$1(key) {
|
|
1684
|
-
api.remove(key, cookieAttributes);
|
|
1685
|
-
}
|
|
1686
|
-
(() => {
|
|
1687
|
-
return new LocalStorageProxy();
|
|
1688
|
-
})();
|
|
1689
|
-
function clearAllCookies() {
|
|
1690
|
-
const cookies = api.get();
|
|
1691
|
-
for (const key in cookies) {
|
|
1692
|
-
removeCookie$1(key);
|
|
1693
|
-
}
|
|
1694
|
-
writeCookie(PpLocalStorageKey.initializedAt, Date.now().toString());
|
|
1695
|
-
}
|
|
1696
|
-
function isFunction(val) {
|
|
1697
|
-
return typeof val === "function";
|
|
1698
|
-
}
|
|
1699
|
-
function getRandomString() {
|
|
1700
|
-
return Math.random().toString(36).substring(7);
|
|
1701
|
-
}
|
|
1702
|
-
function setCookie({ name, value, options }) {
|
|
1703
|
-
return api.set(name, value, options);
|
|
1704
|
-
}
|
|
1705
|
-
function getCookie({ name }) {
|
|
1706
|
-
return api.get(name);
|
|
1707
|
-
}
|
|
1708
|
-
function removeCookie({ name, options }) {
|
|
1709
|
-
return api.remove(name, options);
|
|
1710
|
-
}
|
|
1711
|
-
function setLocalStorage({
|
|
1712
|
-
name,
|
|
1713
|
-
value
|
|
1714
|
-
}) {
|
|
1715
|
-
return localStorage.setItem(name, value);
|
|
1716
|
-
}
|
|
1717
|
-
function getLocalStorage({ name }) {
|
|
1718
|
-
return localStorage.getItem(name);
|
|
1719
|
-
}
|
|
1720
|
-
function removeLocalStorage({ name }) {
|
|
1721
|
-
return localStorage.removeItem(name);
|
|
1722
|
-
}
|
|
1723
|
-
function setSessionStorage({
|
|
1724
|
-
name,
|
|
1725
|
-
value
|
|
1726
|
-
}) {
|
|
1727
|
-
return sessionStorage.setItem(name, value);
|
|
1728
|
-
}
|
|
1729
|
-
function getSessionStorage({ name }) {
|
|
1730
|
-
return sessionStorage.getItem(name);
|
|
1731
|
-
}
|
|
1732
|
-
function removeSessionStorage({ name }) {
|
|
1733
|
-
return sessionStorage.removeItem(name);
|
|
1734
|
-
}
|
|
1735
|
-
function removeQueryParametersFromUrl(removeParams) {
|
|
1736
|
-
const url = new URL(window.location.href);
|
|
1737
|
-
removeParams.forEach((param) => url.searchParams.delete(param));
|
|
1738
|
-
const newURL = `${url.pathname}${url.search}`;
|
|
1739
|
-
history.replaceState(history.state, "", newURL);
|
|
1740
|
-
}
|
|
1741
|
-
function getUrl() {
|
|
1742
|
-
return window.location.href;
|
|
1743
|
-
}
|
|
1744
|
-
const clientWindowBridgeFunctions = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1745
|
-
__proto__: null,
|
|
1746
|
-
getCookie,
|
|
1747
|
-
getLocalStorage,
|
|
1748
|
-
getSessionStorage,
|
|
1749
|
-
getUrl,
|
|
1750
|
-
removeCookie,
|
|
1751
|
-
removeLocalStorage,
|
|
1752
|
-
removeQueryParametersFromUrl,
|
|
1753
|
-
removeSessionStorage,
|
|
1754
|
-
setCookie,
|
|
1755
|
-
setLocalStorage,
|
|
1756
|
-
setSessionStorage
|
|
1757
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
1758
1832
|
const IFRAME_NAME = "ppmna-iframe";
|
|
1759
1833
|
const IFRAME_CONTAINER_NAME = "ppsdk-container";
|
|
1760
1834
|
let iframeContainer;
|
|
@@ -1849,10 +1923,6 @@ function receiveMessageFromIframe(messageData, params, eventHandler) {
|
|
|
1849
1923
|
if (messageData.result === PPFunctionResult.complete) {
|
|
1850
1924
|
(_c = params == null ? void 0 : params.complete) == null ? void 0 : _c.call(params);
|
|
1851
1925
|
removeEventListener("message", eventHandler);
|
|
1852
|
-
functionEnd(messageData.messageId);
|
|
1853
|
-
if (!isFunctionRunning()) {
|
|
1854
|
-
showCoreIframe(false);
|
|
1855
|
-
}
|
|
1856
1926
|
}
|
|
1857
1927
|
}
|
|
1858
1928
|
function postMessageToCore(messageData) {
|
|
@@ -1865,8 +1935,8 @@ function postMessageToCore(messageData) {
|
|
|
1865
1935
|
);
|
|
1866
1936
|
});
|
|
1867
1937
|
}
|
|
1868
|
-
function triggerPostMessageToCore(type,
|
|
1869
|
-
const messageId =
|
|
1938
|
+
function triggerPostMessageToCore(type, params, postMessageParams) {
|
|
1939
|
+
const messageId = getRandomString();
|
|
1870
1940
|
const fnMessageHandler = (e) => {
|
|
1871
1941
|
if (!checkIFrameOrigin(e.origin)) {
|
|
1872
1942
|
return;
|
|
@@ -1887,13 +1957,29 @@ function triggerPostMessageToCore(type, showIframeFlag, params, postMessageParam
|
|
|
1887
1957
|
function checkIFrameOrigin(origin) {
|
|
1888
1958
|
return origin === CORE_IFRAME_ORIGIN;
|
|
1889
1959
|
}
|
|
1890
|
-
function getRefreshToken(clientId) {
|
|
1960
|
+
function getRefreshToken(clientId, useLocalStorage) {
|
|
1961
|
+
if (useLocalStorage) {
|
|
1962
|
+
const refreshToken = localStorage.getItem(
|
|
1963
|
+
`${PpLocalStorageKey.refreshToken}.${clientId}`
|
|
1964
|
+
);
|
|
1965
|
+
if (refreshToken) {
|
|
1966
|
+
return refreshToken;
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1891
1969
|
const refreshTokenWithClientId = api.get(
|
|
1892
1970
|
`${PpLocalStorageKey.refreshToken}.${clientId}`
|
|
1893
1971
|
);
|
|
1894
1972
|
return refreshTokenWithClientId || api.get(PpLocalStorageKey.refreshToken) || "";
|
|
1895
1973
|
}
|
|
1896
|
-
function getCodeVerifier(clientId) {
|
|
1974
|
+
function getCodeVerifier(clientId, useLocalStorage) {
|
|
1975
|
+
if (useLocalStorage) {
|
|
1976
|
+
const codeVerifier = localStorage.getItem(
|
|
1977
|
+
`${PpLocalStorageKey.codeVerifier}.${clientId}`
|
|
1978
|
+
);
|
|
1979
|
+
if (codeVerifier) {
|
|
1980
|
+
return codeVerifier;
|
|
1981
|
+
}
|
|
1982
|
+
}
|
|
1897
1983
|
return api.get(`${PpLocalStorageKey.codeVerifier}.${clientId}`) || api.get(PpLocalStorageKey.codeVerifier) || "";
|
|
1898
1984
|
}
|
|
1899
1985
|
function exposeClientJsBridge(jsBridge) {
|
|
@@ -1914,20 +2000,6 @@ function isSupportedSmartpayment(functionName) {
|
|
|
1914
2000
|
functionName
|
|
1915
2001
|
);
|
|
1916
2002
|
}
|
|
1917
|
-
let runningFunctions = [];
|
|
1918
|
-
function isFunctionRunning() {
|
|
1919
|
-
return runningFunctions.length > 0;
|
|
1920
|
-
}
|
|
1921
|
-
function functionEnd(messageId) {
|
|
1922
|
-
runningFunctions = runningFunctions.filter((val) => {
|
|
1923
|
-
return val !== messageId;
|
|
1924
|
-
});
|
|
1925
|
-
}
|
|
1926
|
-
function functionStart() {
|
|
1927
|
-
const messageId = getRandomString();
|
|
1928
|
-
runningFunctions.push(messageId);
|
|
1929
|
-
return messageId;
|
|
1930
|
-
}
|
|
1931
2003
|
function promiseToCallback(functionName, target, getLoggingParams) {
|
|
1932
2004
|
return function(params = {}) {
|
|
1933
2005
|
const loggingParams = getLoggingParams == null ? void 0 : getLoggingParams(params);
|
|
@@ -2021,6 +2093,14 @@ const commonMessageHandler = (e) => {
|
|
|
2021
2093
|
showCoreIframe(true);
|
|
2022
2094
|
return;
|
|
2023
2095
|
}
|
|
2096
|
+
if (e.data.name === PPUtilFunctionName.showIframe) {
|
|
2097
|
+
showCoreIframe(true);
|
|
2098
|
+
return;
|
|
2099
|
+
}
|
|
2100
|
+
if (e.data.name === PPUtilFunctionName.hideIframe) {
|
|
2101
|
+
showCoreIframe(false);
|
|
2102
|
+
return;
|
|
2103
|
+
}
|
|
2024
2104
|
if (e.data.name === PPUtilFunctionName.link) {
|
|
2025
2105
|
const linkOption = e.data.data;
|
|
2026
2106
|
if (linkOption.target === "_blank") {
|
|
@@ -2045,20 +2125,16 @@ addEventListener("popstate", () => {
|
|
|
2045
2125
|
}).catch((error) => console.warn(error));
|
|
2046
2126
|
});
|
|
2047
2127
|
function init(params) {
|
|
2048
|
-
const refreshToken = getRefreshToken(params.clientId);
|
|
2049
|
-
const codeVerifier = getCodeVerifier(params.clientId);
|
|
2050
|
-
const clientVersion = "2.
|
|
2051
|
-
const initParams = {
|
|
2052
|
-
env: params.env,
|
|
2053
|
-
mode: params.mode,
|
|
2054
|
-
debugMode: params.debugMode,
|
|
2055
|
-
clientId: params.clientId,
|
|
2128
|
+
const refreshToken = getRefreshToken(params.clientId, params.useLocalStorage);
|
|
2129
|
+
const codeVerifier = getCodeVerifier(params.clientId, params.useLocalStorage);
|
|
2130
|
+
const clientVersion = "2.56.0";
|
|
2131
|
+
const initParams = __spreadProps(__spreadValues({}, params), {
|
|
2056
2132
|
refreshToken,
|
|
2057
2133
|
clientVersion,
|
|
2058
2134
|
codeVerifier,
|
|
2059
2135
|
clientSdkType,
|
|
2060
2136
|
clientUrl: window.location.href
|
|
2061
|
-
};
|
|
2137
|
+
});
|
|
2062
2138
|
let initDonePromiseResolve;
|
|
2063
2139
|
const nextInitDonePromise = new Promise(
|
|
2064
2140
|
(resolve) => initDonePromiseResolve = resolve
|
|
@@ -2071,7 +2147,6 @@ function init(params) {
|
|
|
2071
2147
|
initDonePromise.then(() => getCoreIframe()).then(() => {
|
|
2072
2148
|
triggerPostMessageToCore(
|
|
2073
2149
|
PPFunctionName.init,
|
|
2074
|
-
false,
|
|
2075
2150
|
__spreadProps(__spreadValues({}, params), { complete }),
|
|
2076
2151
|
initParams
|
|
2077
2152
|
);
|
|
@@ -2127,8 +2202,8 @@ function executePendingFunctionCalls(client2) {
|
|
|
2127
2202
|
}
|
|
2128
2203
|
}
|
|
2129
2204
|
const clientProperties = {
|
|
2130
|
-
version: "2.
|
|
2131
|
-
revision: "
|
|
2205
|
+
version: "2.56.0",
|
|
2206
|
+
revision: "8161aa8"
|
|
2132
2207
|
};
|
|
2133
2208
|
function isInitClientParams(params) {
|
|
2134
2209
|
return params.clientId !== void 0;
|
|
@@ -2176,7 +2251,6 @@ function getClient({
|
|
|
2176
2251
|
}
|
|
2177
2252
|
triggerPostMessageToCore(
|
|
2178
2253
|
prop,
|
|
2179
|
-
false,
|
|
2180
2254
|
params,
|
|
2181
2255
|
params
|
|
2182
2256
|
);
|
|
@@ -2220,9 +2294,13 @@ const markAsReady = promiseToCallback(
|
|
|
2220
2294
|
"markAsReady",
|
|
2221
2295
|
coreFunctions.markAsReady
|
|
2222
2296
|
);
|
|
2297
|
+
promiseToCallback(
|
|
2298
|
+
"renderButton",
|
|
2299
|
+
coreFunctions.renderButton
|
|
2300
|
+
);
|
|
2223
2301
|
function getKycPassportInfo(params) {
|
|
2224
2302
|
const url = window.location.href;
|
|
2225
|
-
triggerPostMessageToCore(PPFunctionName.getKycPassportInfo,
|
|
2303
|
+
triggerPostMessageToCore(PPFunctionName.getKycPassportInfo, params, __spreadProps(__spreadValues({}, params), {
|
|
2226
2304
|
url
|
|
2227
2305
|
}));
|
|
2228
2306
|
}
|
|
@@ -2319,12 +2397,7 @@ function scanCode(params) {
|
|
|
2319
2397
|
const scanCodeParams = __spreadProps(__spreadValues({}, params), {
|
|
2320
2398
|
redirectUrlOnCancel: (_a = params == null ? void 0 : params.redirectUrlOnCancel) != null ? _a : window.location.href
|
|
2321
2399
|
});
|
|
2322
|
-
triggerPostMessageToCore(
|
|
2323
|
-
PPFunctionName.scanCode,
|
|
2324
|
-
false,
|
|
2325
|
-
params,
|
|
2326
|
-
scanCodeParams
|
|
2327
|
-
);
|
|
2400
|
+
triggerPostMessageToCore(PPFunctionName.scanCode, params, scanCodeParams);
|
|
2328
2401
|
}
|
|
2329
2402
|
function setTitle(params) {
|
|
2330
2403
|
var _a, _b, _c;
|
|
@@ -2334,7 +2407,7 @@ function setTitle(params) {
|
|
|
2334
2407
|
}
|
|
2335
2408
|
function share(params) {
|
|
2336
2409
|
if (!(navigator == null ? void 0 : navigator.share)) {
|
|
2337
|
-
triggerPostMessageToCore(PPFunctionName.share,
|
|
2410
|
+
triggerPostMessageToCore(PPFunctionName.share, params, params);
|
|
2338
2411
|
return;
|
|
2339
2412
|
}
|
|
2340
2413
|
const data = {
|
|
@@ -2384,12 +2457,9 @@ function removeStorageData(params) {
|
|
|
2384
2457
|
}
|
|
2385
2458
|
function verifyMultiFactorAuthResult(params) {
|
|
2386
2459
|
const url = new URL(window.location.href);
|
|
2387
|
-
triggerPostMessageToCore(
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
params,
|
|
2391
|
-
__spreadProps(__spreadValues({}, params), { sessionId: url.searchParams.get("ppSessionId") })
|
|
2392
|
-
);
|
|
2460
|
+
triggerPostMessageToCore(PPFunctionName.verifyMultiFactorAuthResult, params, __spreadProps(__spreadValues({}, params), {
|
|
2461
|
+
sessionId: url.searchParams.get("ppSessionId")
|
|
2462
|
+
}));
|
|
2393
2463
|
}
|
|
2394
2464
|
const clientFunctions = {
|
|
2395
2465
|
verifyMultiFactorAuthResult,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RenderSmartButtonParams } from '../../types';
|
|
2
2
|
export declare function getRenderButtonInfo(params: RenderSmartButtonParams): Promise<{
|
|
3
3
|
data: import('../../types').SmartButtonParam;
|
|
4
|
-
preferredLanguage:
|
|
4
|
+
preferredLanguage: import('../../types').Locale;
|
|
5
5
|
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RenderSmartButtonParams, SmartButtonParam } from '../../types';
|
|
2
2
|
export declare function getRenderLoginInfo(params: RenderSmartButtonParams): Promise<{
|
|
3
3
|
data: SmartButtonParam;
|
|
4
|
-
preferredLanguage:
|
|
4
|
+
preferredLanguage: import('../../types').Locale;
|
|
5
5
|
}>;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { RenderSmartButtonParams, SmartButtonParam } from '../../types';
|
|
1
|
+
import { RenderSmartButtonParams, SmartButtonParam, SmartPayParams } from '../../types';
|
|
2
2
|
export declare function getRenderPayInfo(params: RenderSmartButtonParams): Promise<{
|
|
3
3
|
renderParams: RenderSmartButtonParams;
|
|
4
4
|
data: SmartButtonParam;
|
|
5
5
|
isLoggedIn: boolean;
|
|
6
|
-
preferredLanguage:
|
|
6
|
+
preferredLanguage: import('../../types').Locale;
|
|
7
7
|
isJustLoggedIn: boolean;
|
|
8
8
|
}>;
|
|
9
|
+
export declare function getExpectedCashback(orderInfo: SmartPayParams): Promise<string>;
|
|
10
|
+
export declare function getIsLoggedIn(): Promise<boolean>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PPFetchResult } from '../utils/fetch';
|
|
2
|
+
import { OrderType, CashBackDetailResponse, ConsultResponse, GetPaymentMethodsResponse, MakePaymentResponse, PaymentBody, PaymentObject, PaymentQuery, SendAgePayload, SendAgeResponse } from '../types/makePayment';
|
|
3
|
+
export declare const getPaymentMethods2: (params: {
|
|
4
|
+
merchant?: string;
|
|
5
|
+
type: string;
|
|
6
|
+
productType?: string;
|
|
7
|
+
}) => Promise<PPFetchResult<GetPaymentMethodsResponse, Record<string, unknown>>>;
|
|
8
|
+
export declare const getConsult: ({ merchant, amount, productType, metaData, orderType, payments, }: {
|
|
9
|
+
merchant: string;
|
|
10
|
+
amount: number;
|
|
11
|
+
productType: string;
|
|
12
|
+
metaData: unknown;
|
|
13
|
+
orderType: string;
|
|
14
|
+
payments: PaymentObject[];
|
|
15
|
+
}) => Promise<PPFetchResult<ConsultResponse, ConsultResponse>>;
|
|
16
|
+
export declare const makePayment: (queryParams: PaymentQuery, body: PaymentBody, isAuthorization: boolean) => Promise<PPFetchResult<MakePaymentResponse>>;
|
|
17
|
+
export declare const getCashBackDetails: (paymentId: string, orderType?: OrderType) => Promise<PPFetchResult<CashBackDetailResponse, Record<string, unknown>>>;
|
|
18
|
+
export declare const sendAge: (payload: SendAgePayload) => Promise<PPFetchResult<SendAgeResponse, Record<string, unknown>>>;
|
|
@@ -79,9 +79,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
79
79
|
path: string;
|
|
80
80
|
type: TRenderType;
|
|
81
81
|
play: boolean;
|
|
82
|
+
styles: Record<string, any>;
|
|
82
83
|
loop: boolean;
|
|
83
84
|
autoplay: boolean;
|
|
84
|
-
styles: Record<string, any>;
|
|
85
85
|
className: string;
|
|
86
86
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
87
87
|
export default _default;
|