@paypay/mini-app-js-sdk 1.54.0 → 1.55.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.
|
@@ -85,8 +85,8 @@ function normalizeNativeResponseData(data2) {
|
|
|
85
85
|
}
|
|
86
86
|
class JsBridge {
|
|
87
87
|
constructor(global2) {
|
|
88
|
-
this.version = "1.
|
|
89
|
-
this.revision = "
|
|
88
|
+
this.version = "1.55.0";
|
|
89
|
+
this.revision = "be18b1c";
|
|
90
90
|
this.messageHandlers = new Map();
|
|
91
91
|
this.responseCallbacks = new Map();
|
|
92
92
|
this.global = global2;
|
|
@@ -1583,35 +1583,6 @@ function getUserLocationRequest(params) {
|
|
|
1583
1583
|
function isValidUrl(urlChallenge) {
|
|
1584
1584
|
return /^https?:\/\//.test(urlChallenge);
|
|
1585
1585
|
}
|
|
1586
|
-
async function initAppDetail(accessToken) {
|
|
1587
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
1588
|
-
const res = await ppFetch2({
|
|
1589
|
-
method: "GET",
|
|
1590
|
-
url: "web-api/app/v1/apps/detail",
|
|
1591
|
-
headers: { Authorization: `Bearer ${accessToken}` }
|
|
1592
|
-
});
|
|
1593
|
-
if ((res == null ? void 0 : res.ppFetchResult) !== "success" || !((_b = (_a2 = res == null ? void 0 : res.body) == null ? void 0 : _a2.unsigned) == null ? void 0 : _b.data)) {
|
|
1594
|
-
removeAppDetail();
|
|
1595
|
-
return false;
|
|
1596
|
-
}
|
|
1597
|
-
saveAppDetail(JSON.stringify({
|
|
1598
|
-
appLogo: (_e = (_d = (_c = res == null ? void 0 : res.body) == null ? void 0 : _c.unsigned) == null ? void 0 : _d.data) == null ? void 0 : _e.appLogo,
|
|
1599
|
-
appName: (_h = (_g = (_f = res == null ? void 0 : res.body) == null ? void 0 : _f.unsigned) == null ? void 0 : _g.data) == null ? void 0 : _h.appName,
|
|
1600
|
-
openUrl: (_k = (_j = (_i = res == null ? void 0 : res.body) == null ? void 0 : _i.unsigned) == null ? void 0 : _j.data) == null ? void 0 : _k.openUrl,
|
|
1601
|
-
whiteListDomains: (_n = (_m = (_l = res == null ? void 0 : res.body) == null ? void 0 : _l.unsigned) == null ? void 0 : _m.data) == null ? void 0 : _n.whiteListDomains,
|
|
1602
|
-
isInternal: (_q = (_p = (_o = res == null ? void 0 : res.body) == null ? void 0 : _o.unsigned) == null ? void 0 : _p.data) == null ? void 0 : _q.isInternal,
|
|
1603
|
-
window: (_t = (_s = (_r = res == null ? void 0 : res.body) == null ? void 0 : _r.unsigned) == null ? void 0 : _s.data) == null ? void 0 : _t.window,
|
|
1604
|
-
subdomainCookieSharing: (_w = (_v = (_u = res == null ? void 0 : res.body) == null ? void 0 : _u.unsigned) == null ? void 0 : _v.data) == null ? void 0 : _w.subdomainCookieSharing
|
|
1605
|
-
}));
|
|
1606
|
-
return true;
|
|
1607
|
-
}
|
|
1608
|
-
function getAppDetail() {
|
|
1609
|
-
const json = getAppDetail$1();
|
|
1610
|
-
if (json) {
|
|
1611
|
-
return JSON.parse(json);
|
|
1612
|
-
}
|
|
1613
|
-
return null;
|
|
1614
|
-
}
|
|
1615
1586
|
function reconstructParams(params) {
|
|
1616
1587
|
if (!params) {
|
|
1617
1588
|
return params;
|
|
@@ -1651,11 +1622,9 @@ function createWrapComplete(fn) {
|
|
|
1651
1622
|
};
|
|
1652
1623
|
}
|
|
1653
1624
|
function openWebview(openWebviewParams) {
|
|
1654
|
-
var _a2, _b, _c
|
|
1625
|
+
var _a2, _b, _c;
|
|
1655
1626
|
const params = reconstructParams(openWebviewParams);
|
|
1656
1627
|
let url;
|
|
1657
|
-
let openUrl2 = null;
|
|
1658
|
-
const appDetail = getAppDetail();
|
|
1659
1628
|
try {
|
|
1660
1629
|
url = new URL(params == null ? void 0 : params.url);
|
|
1661
1630
|
} catch (error2) {
|
|
@@ -1664,18 +1633,14 @@ function openWebview(openWebviewParams) {
|
|
|
1664
1633
|
});
|
|
1665
1634
|
return;
|
|
1666
1635
|
}
|
|
1667
|
-
|
|
1668
|
-
openUrl2 = appDetail ? new URL(appDetail.openUrl) : null;
|
|
1669
|
-
} catch (_) {
|
|
1670
|
-
}
|
|
1671
|
-
if (["http:", "https:"].includes(url.protocol) && ((params == null ? void 0 : params.style) === "external" || ((_b = appDetail == null ? void 0 : appDetail.whiteListDomains) == null ? void 0 : _b.includes(url.host)) || url.host === (openUrl2 == null ? void 0 : openUrl2.host))) {
|
|
1636
|
+
if (["http:", "https:"].includes(url.protocol)) {
|
|
1672
1637
|
openWebviewInternal(params);
|
|
1673
1638
|
} else {
|
|
1674
|
-
return (
|
|
1675
|
-
errorCode: MiniAppErrorType.
|
|
1639
|
+
return (_b = params == null ? void 0 : params.fail) == null ? void 0 : _b.call(params, {
|
|
1640
|
+
errorCode: MiniAppErrorType.notAvailable
|
|
1676
1641
|
});
|
|
1677
1642
|
}
|
|
1678
|
-
(
|
|
1643
|
+
(_c = params == null ? void 0 : params.success) == null ? void 0 : _c.call(params);
|
|
1679
1644
|
}
|
|
1680
1645
|
function openWebviewInternal(params) {
|
|
1681
1646
|
var _a2, _b;
|
|
@@ -1980,7 +1945,7 @@ const opaUrl = () => {
|
|
|
1980
1945
|
const createHeaderMiniAppApi = (urlEndpoint, customHeaders) => {
|
|
1981
1946
|
let headers = new Headers(__spreadValues({
|
|
1982
1947
|
"Content-Type": "application/json",
|
|
1983
|
-
"Client-Version": "1.
|
|
1948
|
+
"Client-Version": "1.55.0",
|
|
1984
1949
|
"Client-OS-Type": getRuntime()
|
|
1985
1950
|
}, customHeaders));
|
|
1986
1951
|
if (urlEndpoint === "web-api/app/v2/payment/methods" || urlEndpoint === "web-api/app/v2/payment/consult" || urlEndpoint === "web-api/app/v1/payment/cashbackDetail" || urlEndpoint === "web-api/app/v1/confirmAgeForCashback" || urlEndpoint === "web-api/app/v1/internal/request" || urlEndpoint === "web-api/app/v1/addressbyzip" || urlEndpoint === "/web-api/app/platform/v1/balance" || urlEndpoint === "web-api/app/v1/users/autoTopupConfiguration" || urlEndpoint === "web-api/app/v1/users/preTransactionAutoTopupConfiguration" || urlEndpoint === "web-api/app/v1/users/consultPaymentFeature") {
|
|
@@ -2134,6 +2099,35 @@ async function refreshToken() {
|
|
|
2134
2099
|
}
|
|
2135
2100
|
return false;
|
|
2136
2101
|
}
|
|
2102
|
+
async function initAppDetail(accessToken) {
|
|
2103
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
2104
|
+
const res = await ppFetch2({
|
|
2105
|
+
method: "GET",
|
|
2106
|
+
url: "web-api/app/v1/apps/detail",
|
|
2107
|
+
headers: { Authorization: `Bearer ${accessToken}` }
|
|
2108
|
+
});
|
|
2109
|
+
if ((res == null ? void 0 : res.ppFetchResult) !== "success" || !((_b = (_a2 = res == null ? void 0 : res.body) == null ? void 0 : _a2.unsigned) == null ? void 0 : _b.data)) {
|
|
2110
|
+
removeAppDetail();
|
|
2111
|
+
return false;
|
|
2112
|
+
}
|
|
2113
|
+
saveAppDetail(JSON.stringify({
|
|
2114
|
+
appLogo: (_e = (_d = (_c = res == null ? void 0 : res.body) == null ? void 0 : _c.unsigned) == null ? void 0 : _d.data) == null ? void 0 : _e.appLogo,
|
|
2115
|
+
appName: (_h = (_g = (_f = res == null ? void 0 : res.body) == null ? void 0 : _f.unsigned) == null ? void 0 : _g.data) == null ? void 0 : _h.appName,
|
|
2116
|
+
openUrl: (_k = (_j = (_i = res == null ? void 0 : res.body) == null ? void 0 : _i.unsigned) == null ? void 0 : _j.data) == null ? void 0 : _k.openUrl,
|
|
2117
|
+
whiteListDomains: (_n = (_m = (_l = res == null ? void 0 : res.body) == null ? void 0 : _l.unsigned) == null ? void 0 : _m.data) == null ? void 0 : _n.whiteListDomains,
|
|
2118
|
+
isInternal: (_q = (_p = (_o = res == null ? void 0 : res.body) == null ? void 0 : _o.unsigned) == null ? void 0 : _p.data) == null ? void 0 : _q.isInternal,
|
|
2119
|
+
window: (_t = (_s = (_r = res == null ? void 0 : res.body) == null ? void 0 : _r.unsigned) == null ? void 0 : _s.data) == null ? void 0 : _t.window,
|
|
2120
|
+
subdomainCookieSharing: (_w = (_v = (_u = res == null ? void 0 : res.body) == null ? void 0 : _u.unsigned) == null ? void 0 : _v.data) == null ? void 0 : _w.subdomainCookieSharing
|
|
2121
|
+
}));
|
|
2122
|
+
return true;
|
|
2123
|
+
}
|
|
2124
|
+
function getAppDetail() {
|
|
2125
|
+
const json = getAppDetail$1();
|
|
2126
|
+
if (json) {
|
|
2127
|
+
return JSON.parse(json);
|
|
2128
|
+
}
|
|
2129
|
+
return null;
|
|
2130
|
+
}
|
|
2137
2131
|
async function initAppConfiguration() {
|
|
2138
2132
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2139
2133
|
const res = await ppFetch2({
|
|
@@ -34355,11 +34349,19 @@ async function execute$a(params) {
|
|
|
34355
34349
|
return (_c = params == null ? void 0 : params.fail) == null ? void 0 : _c.call(params, { errorCode: MiniAppErrorType.serverError });
|
|
34356
34350
|
}
|
|
34357
34351
|
}
|
|
34358
|
-
function scanCode(
|
|
34352
|
+
function scanCode(params) {
|
|
34353
|
+
var _a2, _b;
|
|
34359
34354
|
if (isPayPayMiniApp()) {
|
|
34355
|
+
const clientId = getClientId();
|
|
34356
|
+
if (!clientId) {
|
|
34357
|
+
(_a2 = params.fail) == null ? void 0 : _a2.call(params, { errorCode: MiniAppErrorType.sdkNotInitialized });
|
|
34358
|
+
return;
|
|
34359
|
+
}
|
|
34360
|
+
const redirectUrlOnCancel = (_b = params == null ? void 0 : params.redirectUrlOnCancel) != null ? _b : window.location.href;
|
|
34361
|
+
const deeplink = `paypay://miniapp?appId=${clientId}&redirectUrl=${encodeURIComponent(redirectUrlOnCancel)}&closeCurrentScreen=true`;
|
|
34360
34362
|
closeApp({
|
|
34361
34363
|
options: {
|
|
34362
|
-
deeplink:
|
|
34364
|
+
deeplink: `paypay://scan?callbackdeeplink=${encodeURIComponent(deeplink)}`
|
|
34363
34365
|
}
|
|
34364
34366
|
});
|
|
34365
34367
|
} else {
|
|
@@ -35439,7 +35441,7 @@ function debug(params) {
|
|
|
35439
35441
|
function execute$6(params) {
|
|
35440
35442
|
var _a2;
|
|
35441
35443
|
(_a2 = params == null ? void 0 : params.success) == null ? void 0 : _a2.call(params, {
|
|
35442
|
-
v: "1.
|
|
35444
|
+
v: "1.55.0"
|
|
35443
35445
|
});
|
|
35444
35446
|
}
|
|
35445
35447
|
function useCallBack(props, ctx) {
|
|
@@ -41671,7 +41673,7 @@ class MiniAppModule extends JsBridgeModule {
|
|
|
41671
41673
|
});
|
|
41672
41674
|
}
|
|
41673
41675
|
scanCode(params) {
|
|
41674
|
-
scanCode();
|
|
41676
|
+
scanCode(params);
|
|
41675
41677
|
}
|
|
41676
41678
|
showAlert(params) {
|
|
41677
41679
|
this.detectMode() === RuntimeEnv.JS ? showAlert(params) : this.jsBridge.callNative("showAlert", params);
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare function scanCode(_params: NativeParams<MiniAppResult>): void;
|
|
1
|
+
import { ScanCodeParams } from '../../types';
|
|
2
|
+
export declare function scanCode(params: ScanCodeParams): void;
|
package/dist/types.d.ts
CHANGED