@paypay/mini-app-js-sdk 1.39.0 → 1.40.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.
@@ -65,8 +65,8 @@ function normalizeNativeResponseData(data2) {
65
65
  }
66
66
  class JsBridge {
67
67
  constructor(global2) {
68
- this.version = "1.39.0";
69
- this.revision = "e9ad76f";
68
+ this.version = "1.40.0";
69
+ this.revision = "413a0f6";
70
70
  this.messageHandlers = new Map();
71
71
  this.responseCallbacks = new Map();
72
72
  this.global = global2;
@@ -1308,13 +1308,6 @@ var status;
1308
1308
  status2["BUSY"] = "\u5229\u7528\u4E0D\u53EF";
1309
1309
  status2["SUSPENDED"] = "\u5229\u7528\u4E0D\u53EF";
1310
1310
  })(status || (status = {}));
1311
- const getPaymentMethods = (params) => {
1312
- return ppFetch({
1313
- method: "GET",
1314
- url: "web-api/app/v2/payment/methods",
1315
- params
1316
- });
1317
- };
1318
1311
  const getPaymentMethods2 = (params) => {
1319
1312
  return ppFetch2({
1320
1313
  method: "GET",
@@ -1323,35 +1316,31 @@ const getPaymentMethods2 = (params) => {
1323
1316
  });
1324
1317
  };
1325
1318
  const makePayment$2 = async (queryParams, body2, isAuthorization) => {
1326
- var _a, _b, _c, _d, _e, _f, _g;
1319
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
1327
1320
  const url = isAuthorization ? "web-api/app/v1/payment/preauthorize" : "web-api/app/v1/payment";
1328
- const res = await ppFetch({
1321
+ const res = await ppFetch2({
1329
1322
  method: "POST",
1330
1323
  url,
1331
1324
  params: queryParams,
1332
1325
  data: body2
1333
1326
  });
1334
- if ("error" in res) {
1335
- return __spreadProps(__spreadValues({}, res), {
1336
- isSuccess: false
1337
- });
1327
+ if ((res == null ? void 0 : res.ppFetchResult) !== "success") {
1328
+ return __spreadValues({}, res);
1338
1329
  }
1339
- const isSuccess = ((_b = (_a = res.unsigned) == null ? void 0 : _a.resultInfo) == null ? void 0 : _b.code) === "SUCCESS" && ["COMPLETED", "AUTHORIZED"].includes((_d = (_c = res.unsigned) == null ? void 0 : _c.data) == null ? void 0 : _d.status);
1330
+ const isSuccess = ((_c = (_b = (_a = res == null ? void 0 : res.body) == null ? void 0 : _a.unsigned) == null ? void 0 : _b.resultInfo) == null ? void 0 : _c.code) === "SUCCESS" && ["COMPLETED", "AUTHORIZED"].includes((_f = (_e = (_d = res == null ? void 0 : res.body) == null ? void 0 : _d.unsigned) == null ? void 0 : _e.data) == null ? void 0 : _f.status);
1340
1331
  if (isSuccess) {
1341
1332
  savePayment({
1342
- price: (_g = (_f = (_e = res.unsigned) == null ? void 0 : _e.data) == null ? void 0 : _f.amount) == null ? void 0 : _g.amount
1333
+ price: (_j = (_i = (_h = (_g = res == null ? void 0 : res.body) == null ? void 0 : _g.unsigned) == null ? void 0 : _h.data) == null ? void 0 : _i.amount) == null ? void 0 : _j.amount
1343
1334
  });
1344
1335
  }
1345
- return __spreadProps(__spreadValues({}, res), {
1346
- isSuccess
1347
- });
1336
+ return __spreadValues({}, res);
1348
1337
  };
1349
1338
  const getConsult = ({
1350
1339
  merchant: merchant2,
1351
1340
  amount: amount2,
1352
1341
  productType
1353
1342
  }) => {
1354
- return ppFetch({
1343
+ return ppFetch2({
1355
1344
  method: "POST",
1356
1345
  url: "web-api/app/v2/payment/consult",
1357
1346
  params: { merchant: merchant2, productType },
@@ -1365,7 +1354,7 @@ var CashBackAnimationType;
1365
1354
  CashBackAnimationType2["TIER_CAMPAIGN_FULL"] = "TIER_CAMPAIGN_FULL";
1366
1355
  })(CashBackAnimationType || (CashBackAnimationType = {}));
1367
1356
  const getCashBackDetails = (paymentId2) => {
1368
- return ppFetch({
1357
+ return ppFetch2({
1369
1358
  method: "GET",
1370
1359
  url: "web-api/app/v1/payment/cashbackDetail",
1371
1360
  params: {
@@ -1374,7 +1363,7 @@ const getCashBackDetails = (paymentId2) => {
1374
1363
  });
1375
1364
  };
1376
1365
  const sendAge = (payload) => {
1377
- return ppFetch({
1366
+ return ppFetch2({
1378
1367
  method: "POST",
1379
1368
  url: "web-api/app/v1/confirmAgeForCashback",
1380
1369
  data: payload
@@ -1392,26 +1381,26 @@ var UIComponentsButtonType;
1392
1381
  UIComponentsButtonType2["WHITE"] = "WHITE";
1393
1382
  })(UIComponentsButtonType || (UIComponentsButtonType = {}));
1394
1383
  async function topup$3(queryParams, body2) {
1395
- var _a, _b, _c, _d, _e, _f, _g;
1396
- const res = await ppFetch({
1384
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
1385
+ const res = await ppFetch2({
1397
1386
  method: "POST",
1398
1387
  url: "web-api/app/v1/payment/topup",
1399
1388
  params: queryParams,
1400
1389
  data: body2
1401
1390
  });
1402
- if ("error" in res) {
1391
+ if ((res == null ? void 0 : res.ppFetchResult) !== "success") {
1403
1392
  return res;
1404
1393
  }
1405
- const isSuccess = ((_b = (_a = res.unsigned) == null ? void 0 : _a.resultInfo) == null ? void 0 : _b.code) === "SUCCESS" && ["COMPLETED"].includes((_d = (_c = res.unsigned) == null ? void 0 : _c.data) == null ? void 0 : _d.status);
1394
+ const isSuccess = ((_c = (_b = (_a = res == null ? void 0 : res.body) == null ? void 0 : _a.unsigned) == null ? void 0 : _b.resultInfo) == null ? void 0 : _c.code) === "SUCCESS" && ["COMPLETED"].includes((_f = (_e = (_d = res == null ? void 0 : res.body) == null ? void 0 : _d.unsigned) == null ? void 0 : _e.data) == null ? void 0 : _f.status);
1406
1395
  if (isSuccess) {
1407
1396
  saveTopup({
1408
- amount: (_g = (_f = (_e = res.unsigned) == null ? void 0 : _e.data) == null ? void 0 : _f.amount) == null ? void 0 : _g.amount
1397
+ amount: (_j = (_i = (_h = (_g = res == null ? void 0 : res.body) == null ? void 0 : _g.unsigned) == null ? void 0 : _h.data) == null ? void 0 : _i.amount) == null ? void 0 : _j.amount
1409
1398
  });
1410
1399
  }
1411
1400
  return res;
1412
1401
  }
1413
1402
  async function getCashBackInfo() {
1414
- return await ppFetch({
1403
+ return await ppFetch2({
1415
1404
  method: "GET",
1416
1405
  url: "/web-api/app/platform/v1/balance",
1417
1406
  headers: {
@@ -1462,7 +1451,7 @@ async function setSelectedAddress(addressId) {
1462
1451
  });
1463
1452
  }
1464
1453
  async function getUserProfileData() {
1465
- return ppFetch({
1454
+ return ppFetch2({
1466
1455
  url: "web-api/app/v1/users/profile",
1467
1456
  method: "GET"
1468
1457
  });
@@ -1474,7 +1463,7 @@ async function getUserProfileDataV2() {
1474
1463
  });
1475
1464
  }
1476
1465
  async function registerEmail$1(email2) {
1477
- return ppFetch({
1466
+ return ppFetch2({
1478
1467
  url: "web-api/app/v1/users/email",
1479
1468
  method: "POST",
1480
1469
  data: {
@@ -1489,7 +1478,7 @@ async function resendEmail() {
1489
1478
  });
1490
1479
  }
1491
1480
  function getUserLocationRequest(params) {
1492
- return ppFetch({
1481
+ return ppFetch2({
1493
1482
  url: "web-api/app/v1/location",
1494
1483
  method: "GET",
1495
1484
  params: {
@@ -1710,6 +1699,18 @@ function filterErrorButtonList(buttonList) {
1710
1699
  }
1711
1700
  });
1712
1701
  }
1702
+ function getFailErrorCode(ppFetchResult) {
1703
+ switch (ppFetchResult) {
1704
+ case "notAuthorized":
1705
+ return MiniAppErrorType.notAuthorized;
1706
+ case "timeout":
1707
+ return MiniAppErrorType.timeOut;
1708
+ case "tokenExpired":
1709
+ return MiniAppErrorType.tokenExpired;
1710
+ default:
1711
+ return MiniAppErrorType.serverError;
1712
+ }
1713
+ }
1713
1714
  const opaUrl = () => {
1714
1715
  switch (getEnv()) {
1715
1716
  case "staging":
@@ -1728,7 +1729,7 @@ const opaUrl = () => {
1728
1729
  const createHeaderMiniAppApi = (urlEndpoint, customHeaders) => {
1729
1730
  let headers = new Headers(__spreadValues({
1730
1731
  "Content-Type": "application/json",
1731
- "Client-Version": "1.39.0",
1732
+ "Client-Version": "1.40.0",
1732
1733
  "Client-OS-Type": getRuntime()
1733
1734
  }, customHeaders));
1734
1735
  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") {
@@ -1781,36 +1782,6 @@ function ppFetchPrepare(options) {
1781
1782
  }
1782
1783
  return { requestInfo, requestInit };
1783
1784
  }
1784
- async function ppFetch(options) {
1785
- const fetchParams = ppFetchPrepare(options);
1786
- if (!fetchParams) {
1787
- const msg = "PayPay Mini App JS SDK is not authorized";
1788
- console.warn(msg);
1789
- return Promise.resolve({
1790
- error: {
1791
- message: msg
1792
- }
1793
- });
1794
- }
1795
- const { requestInfo, requestInit } = fetchParams;
1796
- try {
1797
- const response = await fetch(requestInfo, requestInit);
1798
- const res = await response.json();
1799
- if (res.error === "invalid_token" && !options.suppressRefresh) {
1800
- if (await refreshToken()) {
1801
- return ppFetch(__spreadProps(__spreadValues({}, options), { suppressRefresh: true }));
1802
- }
1803
- }
1804
- return __spreadProps(__spreadValues({}, res), { statusCode: response == null ? void 0 : response.status });
1805
- } catch (error2) {
1806
- if (error2 instanceof Error && error2.name === "AbortError") {
1807
- return {
1808
- error: { message: MiniAppErrorType.timeOut }
1809
- };
1810
- }
1811
- return { error: { message: "Request failed." } };
1812
- }
1813
- }
1814
1785
  async function ppFetch2(options) {
1815
1786
  var _a, _b, _c, _d, _e;
1816
1787
  const fetchParams = ppFetchPrepare(options);
@@ -1838,6 +1809,13 @@ async function ppFetch2(options) {
1838
1809
  };
1839
1810
  }
1840
1811
  }
1812
+ if (options.skipResultCodeCheck && response.status >= 200 && response.status < 300) {
1813
+ return {
1814
+ ppFetchResult: "success",
1815
+ statusCode: response.status,
1816
+ body: res
1817
+ };
1818
+ }
1841
1819
  const opaResponse = res;
1842
1820
  if (opaResponse.unsigned) {
1843
1821
  if (((_a = opaResponse.unsigned.resultInfo) == null ? void 0 : _a.code) !== "SUCCESS") {
@@ -1899,24 +1877,24 @@ async function refreshToken() {
1899
1877
  return false;
1900
1878
  }
1901
1879
  async function initAppDetail(accessToken) {
1902
- var _a;
1903
- const res = await ppFetch({
1880
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
1881
+ const res = await ppFetch2({
1904
1882
  method: "GET",
1905
1883
  url: "web-api/app/v1/apps/detail",
1906
1884
  headers: { Authorization: `Bearer ${accessToken}` }
1907
1885
  });
1908
- if ("error" in res || !((_a = res == null ? void 0 : res.unsigned) == null ? void 0 : _a.data)) {
1886
+ if ((res == null ? void 0 : res.ppFetchResult) !== "success" || !((_b = (_a = res == null ? void 0 : res.body) == null ? void 0 : _a.unsigned) == null ? void 0 : _b.data)) {
1909
1887
  removeAppDetail();
1910
1888
  return false;
1911
1889
  }
1912
1890
  saveAppDetail(JSON.stringify({
1913
- appLogo: res.unsigned.data.appLogo,
1914
- appName: res.unsigned.data.appName,
1915
- openUrl: res.unsigned.data.openUrl,
1916
- whiteListDomains: res.unsigned.data.whiteListDomains,
1917
- isInternal: res.unsigned.data.isInternal,
1918
- window: res.unsigned.data.window,
1919
- subdomainCookieSharing: res.unsigned.data.subdomainCookieSharing
1891
+ 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,
1892
+ 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,
1893
+ 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,
1894
+ 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,
1895
+ 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,
1896
+ 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,
1897
+ 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
1920
1898
  }));
1921
1899
  return true;
1922
1900
  }
@@ -1928,18 +1906,20 @@ function getAppDetail() {
1928
1906
  return null;
1929
1907
  }
1930
1908
  async function initAppConfiguration() {
1931
- const res = await ppFetch({
1909
+ var _a, _b, _c, _d, _e, _f, _g;
1910
+ const res = await ppFetch2({
1932
1911
  method: "GET",
1933
1912
  url: "web-api/app/platform/v1/configuration",
1934
- params: { filePath: "globalServiceStatus.json" }
1913
+ params: { filePath: "globalServiceStatus.json" },
1914
+ skipResultCodeCheck: true
1935
1915
  });
1936
- if ("error" in res || !res.variables) {
1916
+ if ((res == null ? void 0 : res.ppFetchResult) !== "success" || !((_a = res == null ? void 0 : res.body) == null ? void 0 : _a.variables)) {
1937
1917
  return false;
1938
1918
  }
1939
1919
  saveAppConfig(JSON.stringify({
1940
- topupButtonsAmount: res.variables.topupButtonsAmount,
1941
- topupHalfSheetAmount: res.variables.topupHalfSheetAmount,
1942
- topupHalfSheetRecommendedAmount: res.variables.topupHalfSheetRecommendedAmount
1920
+ topupButtonsAmount: (_c = (_b = res == null ? void 0 : res.body) == null ? void 0 : _b.variables) == null ? void 0 : _c.topupButtonsAmount,
1921
+ topupHalfSheetAmount: (_e = (_d = res == null ? void 0 : res.body) == null ? void 0 : _d.variables) == null ? void 0 : _e.topupHalfSheetAmount,
1922
+ topupHalfSheetRecommendedAmount: (_g = (_f = res == null ? void 0 : res.body) == null ? void 0 : _f.variables) == null ? void 0 : _g.topupHalfSheetRecommendedAmount
1943
1923
  }));
1944
1924
  return true;
1945
1925
  }
@@ -1989,16 +1969,16 @@ function getUAID(params) {
1989
1969
  });
1990
1970
  }
1991
1971
  async function execute$f(params) {
1992
- var _a, _b, _c, _d;
1993
- const res = await ppFetch({
1972
+ var _a, _b, _c, _d, _e;
1973
+ const res = await ppFetch2({
1994
1974
  method: "GET",
1995
1975
  url: "web-api/app/v1/users/id"
1996
1976
  });
1997
- if (!res || "error" in res) {
1998
- return (_a = params == null ? void 0 : params.fail) == null ? void 0 : _a.call(params, { errorCode: MiniAppErrorType.serverError });
1977
+ if (res.ppFetchResult !== "success") {
1978
+ return (_a = params == null ? void 0 : params.fail) == null ? void 0 : _a.call(params, { errorCode: getFailErrorCode(res.ppFetchResult) });
1999
1979
  }
2000
- const userId = (_b = res == null ? void 0 : res.signed) == null ? void 0 : _b.jws;
2001
- (userId == null ? void 0 : userId.length) ? (_c = params == null ? void 0 : params.success) == null ? void 0 : _c.call(params, { jws: userId }) : (_d = params == null ? void 0 : params.fail) == null ? void 0 : _d.call(params, { errorCode: MiniAppErrorType.serverError });
1980
+ const userId = (_c = (_b = res == null ? void 0 : res.body) == null ? void 0 : _b.signed) == null ? void 0 : _c.jws;
1981
+ (userId == null ? void 0 : userId.length) ? (_d = params == null ? void 0 : params.success) == null ? void 0 : _d.call(params, { jws: userId }) : (_e = params == null ? void 0 : params.fail) == null ? void 0 : _e.call(params, { errorCode: MiniAppErrorType.serverError });
2002
1982
  }
2003
1983
  function checkAccessToken(params) {
2004
1984
  const newParams = reconstructParams(params);
@@ -2038,8 +2018,7 @@ async function execute$d(params) {
2038
2018
  url: "web-api/app/v2/users/profile"
2039
2019
  });
2040
2020
  if (res.ppFetchResult !== "success") {
2041
- (_a = params == null ? void 0 : params.fail) == null ? void 0 : _a.call(params, { errorCode: MiniAppErrorType.serverError });
2042
- return;
2021
+ return (_a = params == null ? void 0 : params.fail) == null ? void 0 : _a.call(params, { errorCode: getFailErrorCode(res.ppFetchResult) });
2043
2022
  }
2044
2023
  const data2 = __spreadProps(__spreadValues({}, res.body.unsigned.data), {
2045
2024
  jws: res.body.signed.jws
@@ -7698,7 +7677,7 @@ async function init(params) {
7698
7677
  await execute$c(newParams);
7699
7678
  }
7700
7679
  async function execute$c(params) {
7701
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
7680
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
7702
7681
  try {
7703
7682
  saveEnv((_a = params == null ? void 0 : params.env) != null ? _a : "");
7704
7683
  saveClientId((_b = params == null ? void 0 : params.clientId) != null ? _b : "");
@@ -7728,28 +7707,29 @@ async function execute$c(params) {
7728
7707
  const newUrlParams = urlParams.toString().length ? "?" + urlParams.toString() : "";
7729
7708
  const newUrl = location.pathname + newUrlParams + location.hash;
7730
7709
  history.replaceState(null, "", newUrl);
7731
- const res = await ppFetch({
7710
+ const res = await ppFetch2({
7732
7711
  method: "POST",
7733
7712
  url: "web-api/app/token/v1/issue",
7734
7713
  data: { ott: token, opaClientId: params == null ? void 0 : params.clientId }
7735
7714
  });
7736
- if (!res || "error" in res) {
7737
- throw Error();
7715
+ if ((res == null ? void 0 : res.ppFetchResult) !== "success") {
7716
+ failedAuth(params, getFailErrorCode(res == null ? void 0 : res.ppFetchResult));
7717
+ return;
7738
7718
  }
7739
- if (((_c = res == null ? void 0 : res.resultInfo) == null ? void 0 : _c.code) === "SUCCESS") {
7740
- const appDetailResult = await initAppDetail((_e = (_d = res == null ? void 0 : res.data) == null ? void 0 : _d.accessToken) != null ? _e : "");
7719
+ if (((_d = (_c = res == null ? void 0 : res.body) == null ? void 0 : _c.resultInfo) == null ? void 0 : _d.code) === "SUCCESS") {
7720
+ const appDetailResult = await initAppDetail((_g = (_f = (_e = res == null ? void 0 : res.body) == null ? void 0 : _e.data) == null ? void 0 : _f.accessToken) != null ? _g : "");
7741
7721
  if (!appDetailResult) {
7742
7722
  throw Error();
7743
7723
  }
7744
- saveEnv((_f = params == null ? void 0 : params.env) != null ? _f : "");
7745
- saveAccessToken((_h = (_g = res == null ? void 0 : res.data) == null ? void 0 : _g.accessToken) != null ? _h : "");
7746
- saveRefreshToken((_j = (_i = res == null ? void 0 : res.data) == null ? void 0 : _i.refreshToken) != null ? _j : "");
7724
+ saveEnv((_h = params == null ? void 0 : params.env) != null ? _h : "");
7725
+ saveAccessToken((_k = (_j = (_i = res == null ? void 0 : res.body) == null ? void 0 : _i.data) == null ? void 0 : _j.accessToken) != null ? _k : "");
7726
+ saveRefreshToken((_n = (_m = (_l = res == null ? void 0 : res.body) == null ? void 0 : _l.data) == null ? void 0 : _m.refreshToken) != null ? _n : "");
7747
7727
  OTTLoginState.setLoginState(true);
7748
7728
  setTimeout(() => {
7749
7729
  OTTLoginState.setLoginState(false);
7750
7730
  }, 5e3);
7751
7731
  saveUserData();
7752
- saveClientId((_k = params == null ? void 0 : params.clientId) != null ? _k : "");
7732
+ saveClientId((_o = params == null ? void 0 : params.clientId) != null ? _o : "");
7753
7733
  const configResult = await initAppConfiguration();
7754
7734
  if (!configResult) {
7755
7735
  throw Error();
@@ -7761,7 +7741,7 @@ async function execute$c(params) {
7761
7741
  failedAuth(params, MiniAppErrorType.serverError);
7762
7742
  return;
7763
7743
  }
7764
- (_l = params == null ? void 0 : params.success) == null ? void 0 : _l.call(params, {
7744
+ (_p = params == null ? void 0 : params.success) == null ? void 0 : _p.call(params, {
7765
7745
  statusCode: MiniAppStatusType.initialized
7766
7746
  });
7767
7747
  }
@@ -7835,19 +7815,19 @@ const checkPermission = async (permissionNames) => {
7835
7815
  return PermissionStatus.granted;
7836
7816
  };
7837
7817
  async function getUserGrantedPermission() {
7838
- var _a, _b, _c;
7839
- const response = await ppFetch({
7818
+ var _a, _b, _c, _d;
7819
+ const response = await ppFetch2({
7840
7820
  method: "GET",
7841
7821
  url: "web-api/app/v1/users/permissions/granted"
7842
7822
  });
7843
- return (_c = (_b = (_a = response == null ? void 0 : response.unsigned) == null ? void 0 : _a.data) == null ? void 0 : _b.scopes) != null ? _c : [];
7823
+ return (response == null ? void 0 : response.ppFetchResult) === "success" ? (_d = (_c = (_b = (_a = response == null ? void 0 : response.body) == null ? void 0 : _a.unsigned) == null ? void 0 : _b.data) == null ? void 0 : _c.scopes) != null ? _d : [] : [];
7844
7824
  }
7845
7825
  async function getBalance(params) {
7846
7826
  const newParams = reconstructParams(params);
7847
7827
  await execute$b(newParams);
7848
7828
  }
7849
7829
  async function execute$b(params) {
7850
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
7830
+ var _a, _b, _c, _d, _e, _f, _g, _h;
7851
7831
  try {
7852
7832
  const grantStatus = await checkPermission(PermissionName.mini_app_payment_balance);
7853
7833
  if (grantStatus !== PermissionStatus.granted) {
@@ -7857,21 +7837,20 @@ async function execute$b(params) {
7857
7837
  payload.merchant = params.merchant;
7858
7838
  payload.productType = params.productType;
7859
7839
  payload.sourceInfoApp = params.sourceInfoApp;
7860
- const res = await ppFetch({
7840
+ const res = await ppFetch2({
7861
7841
  method: "GET",
7862
7842
  url: "web-api/app/v1/payment/balance",
7863
7843
  params: payload
7864
7844
  });
7865
- if (!res || "error" in res) {
7866
- return (_b = params == null ? void 0 : params.fail) == null ? void 0 : _b.call(params, { errorCode: MiniAppErrorType.serverError });
7867
- }
7868
- if (((_d = (_c = res == null ? void 0 : res.unsigned) == null ? void 0 : _c.resultInfo) == null ? void 0 : _d.code) === "SUCCESS") {
7869
- const newBalance = (_g = (_f = (_e = res == null ? void 0 : res.unsigned) == null ? void 0 : _e.data) == null ? void 0 : _f.totalBalance) == null ? void 0 : _g.amount;
7870
- return (_h = params == null ? void 0 : params.success) == null ? void 0 : _h.call(params, { balance: newBalance });
7845
+ if (res.ppFetchResult !== "success") {
7846
+ return (_b = params == null ? void 0 : params.fail) == null ? void 0 : _b.call(params, { errorCode: getFailErrorCode(res.ppFetchResult) });
7847
+ } else {
7848
+ const newBalance = (_f = (_e = (_d = (_c = res == null ? void 0 : res.body) == null ? void 0 : _c.unsigned) == null ? void 0 : _d.data) == null ? void 0 : _e.totalBalance) == null ? void 0 : _f.amount;
7849
+ return (_g = params == null ? void 0 : params.success) == null ? void 0 : _g.call(params, { balance: newBalance });
7871
7850
  }
7872
7851
  } finally {
7873
7852
  }
7874
- return (_i = params == null ? void 0 : params.fail) == null ? void 0 : _i.call(params, { errorCode: MiniAppErrorType.serverError });
7853
+ return (_h = params == null ? void 0 : params.fail) == null ? void 0 : _h.call(params, { errorCode: MiniAppErrorType.serverError });
7875
7854
  }
7876
7855
  async function getKycInformation(params) {
7877
7856
  const newParams = reconstructParams(params);
@@ -7893,7 +7872,7 @@ async function execute$a(params) {
7893
7872
  }
7894
7873
  });
7895
7874
  if (res.ppFetchResult !== "success") {
7896
- return (_c = params == null ? void 0 : params.fail) == null ? void 0 : _c.call(params, { errorCode: MiniAppErrorType.serverError });
7875
+ return (_c = params == null ? void 0 : params.fail) == null ? void 0 : _c.call(params, { errorCode: getFailErrorCode(res.ppFetchResult) });
7897
7876
  }
7898
7877
  if ((_d = res.body.unsigned) == null ? void 0 : _d.data) {
7899
7878
  let response = res.body.unsigned.data;
@@ -26050,7 +26029,7 @@ const _sfc_main$W = defineComponent({
26050
26029
  const res = await getAddressByZip({
26051
26030
  zipcode: (_b = state.zip) == null ? void 0 : _b.replace(/-/g, "")
26052
26031
  });
26053
- if (res.ppFetchResult === "success" && ((_f = (_e = (_d = (_c = res == null ? void 0 : res.body) == null ? void 0 : _c.unsigned) == null ? void 0 : _d.data) == null ? void 0 : _e.payload) == null ? void 0 : _f.addressList)) {
26032
+ if ((res == null ? void 0 : res.ppFetchResult) === "success" && ((_f = (_e = (_d = (_c = res == null ? void 0 : res.body) == null ? void 0 : _c.unsigned) == null ? void 0 : _d.data) == null ? void 0 : _e.payload) == null ? void 0 : _f.addressList)) {
26054
26033
  const zipAddress2 = (_k = (_j = (_i = (_h = (_g = res == null ? void 0 : res.body) == null ? void 0 : _g.unsigned) == null ? void 0 : _h.data) == null ? void 0 : _i.payload) == null ? void 0 : _j.addressList) == null ? void 0 : _k[0];
26055
26034
  const { cityAndOaza, prefecture } = zipAddress2 || {};
26056
26035
  if (cityAndOaza)
@@ -29011,7 +28990,7 @@ var BirthdayConfirmError = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["render",
29011
28990
  const KEY$2 = "makepayment_age_confirm";
29012
28991
  function initAgeConfirm(props) {
29013
28992
  const postAgeConfirm = async (sendAgePayload, dateString) => {
29014
- var _a, _b, _c, _d;
28993
+ var _a, _b, _c, _d, _e;
29015
28994
  const _date = dateString.split("-");
29016
28995
  const year = parseInt(_date[0]);
29017
28996
  const month = parseInt(_date[1]);
@@ -29027,9 +29006,9 @@ function initAgeConfirm(props) {
29027
29006
  api: "ageConfirm",
29028
29007
  dryRun: true
29029
29008
  });
29030
- if ("error" in res || !errorHappen)
29009
+ if ((res == null ? void 0 : res.ppFetchResult) !== "success" || !errorHappen)
29031
29010
  return false;
29032
- return (_d = (_c = (_b = (_a = res == null ? void 0 : res.unsigned) == null ? void 0 : _a.data) == null ? void 0 : _b.payload) == null ? void 0 : _c.isEligibleForCashBack) != null ? _d : false;
29011
+ return (_e = (_d = (_c = (_b = (_a = res == null ? void 0 : res.body) == null ? void 0 : _a.unsigned) == null ? void 0 : _b.data) == null ? void 0 : _c.payload) == null ? void 0 : _d.isEligibleForCashBack) != null ? _e : false;
29033
29012
  };
29034
29013
  const store = {
29035
29014
  postAgeConfirm
@@ -30635,14 +30614,13 @@ function createErrorFromErrorCodeAndType(type, code) {
30635
30614
  }
30636
30615
  }
30637
30616
  function createErrorCodeForFailCallBack(res, api2) {
30638
- var _a;
30639
30617
  switch (api2) {
30640
30618
  case "consult":
30641
30619
  return MiniAppErrorType.paymentFail;
30642
30620
  case "topup":
30643
30621
  return MiniAppErrorType.topupFail;
30644
30622
  case "payment": {
30645
- const timeOut = "error" in res ? ((_a = res.error) == null ? void 0 : _a.message) === MiniAppErrorType.timeOut : false;
30623
+ const timeOut = res.ppFetchResult === "timeout";
30646
30624
  return timeOut ? MiniAppErrorType.timeOut : MiniAppErrorType.paymentFail;
30647
30625
  }
30648
30626
  default:
@@ -30697,11 +30675,23 @@ function initErrorHandling(props) {
30697
30675
  return false;
30698
30676
  };
30699
30677
  const handleError2 = (res, options) => {
30700
- var _a, _b, _c, _d, _e, _f;
30678
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
30701
30679
  const errorCodeForFailBack = createErrorCodeForFailCallBack(res, options == null ? void 0 : options.api);
30702
- if ("error" in res) {
30680
+ if ((res == null ? void 0 : res.ppFetchResult) === "apiError" && options.api === "consult") {
30681
+ return true;
30682
+ }
30683
+ if ((res == null ? void 0 : res.ppFetchResult) !== "success") {
30703
30684
  if (!options.dryRun) {
30704
30685
  const { errorDescription, errorIcon: errorIcon2, errorTitle: errorTitle2 } = createErrorFromType(options.type);
30686
+ if ((_b = (_a = res == null ? void 0 : res.body) == null ? void 0 : _a.uiComponents) == null ? void 0 : _b.displayErrorResponse) {
30687
+ if (!options.dryRun) {
30688
+ errorState.consultError = (_c = res.body.uiComponents) == null ? void 0 : _c.displayErrorResponse;
30689
+ errorState.showConsultError = true;
30690
+ errorState.errorCode = errorCodeForFailBack;
30691
+ preFail(errorCodeForFailBack, (_d = res == null ? void 0 : res.body.signed) == null ? void 0 : _d.jws);
30692
+ }
30693
+ return false;
30694
+ }
30705
30695
  errorState.visible = true;
30706
30696
  errorState.errorCode = errorCodeForFailBack;
30707
30697
  errorState.errorTitle = errorTitle2;
@@ -30711,16 +30701,7 @@ function initErrorHandling(props) {
30711
30701
  }
30712
30702
  return false;
30713
30703
  }
30714
- if ((_a = res.uiComponents) == null ? void 0 : _a.displayErrorResponse) {
30715
- if (!options.dryRun) {
30716
- errorState.consultError = (_b = res.uiComponents) == null ? void 0 : _b.displayErrorResponse;
30717
- errorState.showConsultError = true;
30718
- errorState.errorCode = errorCodeForFailBack;
30719
- preFail(errorCodeForFailBack, (_c = res == null ? void 0 : res.signed) == null ? void 0 : _c.jws);
30720
- }
30721
- return false;
30722
- }
30723
- const errorCode = (_e = (_d = res.unsigned) == null ? void 0 : _d.resultInfo) == null ? void 0 : _e.code;
30704
+ const errorCode = (_g = (_f = (_e = res == null ? void 0 : res.body) == null ? void 0 : _e.unsigned) == null ? void 0 : _f.resultInfo) == null ? void 0 : _g.code;
30724
30705
  if (![MiniAppErrorType.success].includes(errorCode)) {
30725
30706
  if (!options.dryRun) {
30726
30707
  const { errorTitle: errorTitle2, errorDescription, errorIcon: errorIcon2 } = createErrorFromErrorCodeAndType(options.type, errorCode);
@@ -30729,7 +30710,7 @@ function initErrorHandling(props) {
30729
30710
  errorState.errorTitle = errorTitle2;
30730
30711
  errorState.errorDescription = errorDescription;
30731
30712
  errorState.errorIcon = errorIcon2;
30732
- preFail(errorCodeForFailBack, (_f = res == null ? void 0 : res.signed) == null ? void 0 : _f.jws);
30713
+ preFail(errorCodeForFailBack, (_i = (_h = res == null ? void 0 : res.body) == null ? void 0 : _h.signed) == null ? void 0 : _i.jws);
30733
30714
  }
30734
30715
  return false;
30735
30716
  }
@@ -30831,22 +30812,22 @@ function usePaymentMethod(props) {
30831
30812
  const showPaymentMethod = () => {
30832
30813
  paymentState.showPaymentMethodList = true;
30833
30814
  };
30834
- const getPaymentMethods$1 = async (dryRun) => {
30835
- var _a, _b, _c, _d;
30836
- const res = await getPaymentMethods({
30815
+ const getPaymentMethods = async (dryRun) => {
30816
+ var _a, _b, _c, _d, _e, _f, _g, _h;
30817
+ const res = await getPaymentMethods2({
30837
30818
  merchant: (_a = props == null ? void 0 : props.paymentParams) == null ? void 0 : _a.merchantAlias,
30838
30819
  type: ((_b = props.paymentParams) == null ? void 0 : _b.isAuthorization) ? "PRE_AUTH" : "ACQUIRING",
30839
30820
  productType: (_c = props == null ? void 0 : props.paymentParams) == null ? void 0 : _c.productType,
30840
30821
  sourceInfoApp: (_d = props == null ? void 0 : props.paymentParams) == null ? void 0 : _d.sourceInfoApp
30841
30822
  });
30842
30823
  const result2 = handleError2(res, { api: "paymentMethod", dryRun });
30843
- if (!result2 || "error" in res) {
30824
+ if (!result2 || (res == null ? void 0 : res.ppFetchResult) !== "success") {
30844
30825
  return {
30845
30826
  res,
30846
30827
  result: false
30847
30828
  };
30848
30829
  }
30849
- const paymentMethodList = res.unsigned.data.payload.paymentMethodList;
30830
+ const paymentMethodList = (_h = (_g = (_f = (_e = res == null ? void 0 : res.body) == null ? void 0 : _e.unsigned) == null ? void 0 : _f.data) == null ? void 0 : _g.payload) == null ? void 0 : _h.paymentMethodList;
30850
30831
  paymentState.paymentMethods = paymentMethodList;
30851
30832
  const walletPaymentMethod = paymentMethodList.find((elem2) => elem2.paymentMethodType === PaymentMethodType.WALLET) || null;
30852
30833
  if (walletPaymentMethod && walletPaymentMethod.descriptionBannerInfo) {
@@ -30865,7 +30846,7 @@ function usePaymentMethod(props) {
30865
30846
  paymentState.showPaymentMethodList = false;
30866
30847
  };
30867
30848
  return {
30868
- getPaymentMethods: getPaymentMethods$1,
30849
+ getPaymentMethods,
30869
30850
  showPaymentMethod,
30870
30851
  selectPayment,
30871
30852
  paymentMethod: computed(() => paymentState.paymentMethods[paymentState.selectPaymentIndex]),
@@ -30892,32 +30873,26 @@ function useConsult(props) {
30892
30873
  productType: (_d = props.paymentParams) == null ? void 0 : _d.productType
30893
30874
  });
30894
30875
  const errorHandled = handleError2(res, { api: "consult" });
30895
- if ("error" in res || !errorHandled)
30896
- return false;
30897
- if ((_f = (_e = res.unsigned.data) == null ? void 0 : _e.error) == null ? void 0 : _f.displayErrorResponse) {
30898
- consultState.consultInfo = res.unsigned.data.error.displayErrorResponse;
30899
- consultState.showConsult = true;
30900
- consultState.errorType = true;
30901
- return false;
30902
- }
30903
- if ((_h = (_g = res.unsigned.data) == null ? void 0 : _g.error) == null ? void 0 : _h.insufficientBalanceInfo) {
30904
- consultState.insufficientBalanceInfo = res.unsigned.data.error.insufficientBalanceInfo;
30876
+ if ((res == null ? void 0 : res.ppFetchResult) === "apiError" && ((_h = (_g = (_f = (_e = res == null ? void 0 : res.body) == null ? void 0 : _e.unsigned) == null ? void 0 : _f.data) == null ? void 0 : _g.error) == null ? void 0 : _h.insufficientBalanceInfo)) {
30877
+ consultState.insufficientBalanceInfo = res.body.unsigned.data.error.insufficientBalanceInfo;
30905
30878
  return true;
30906
30879
  }
30880
+ if ((res == null ? void 0 : res.ppFetchResult) !== "success" || !errorHandled)
30881
+ return false;
30907
30882
  return true;
30908
30883
  };
30909
30884
  const getConsultForTopup = async (_retryCount = 4) => {
30910
- var _a, _b;
30885
+ var _a, _b, _c, _d;
30911
30886
  let retryCount = _retryCount;
30912
30887
  const retryFunctions = async () => {
30913
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
30888
+ var _a2, _b2, _c2, _d2, _e, _f, _g, _h, _i, _j, _k, _l;
30914
30889
  const res = await getConsult({
30915
30890
  merchant: (_a2 = props.paymentParams) == null ? void 0 : _a2.merchantAlias,
30916
- amount: (_c = (_b2 = props.paymentParams) == null ? void 0 : _b2.amount) == null ? void 0 : _c.amount,
30917
- productType: (_d = props.paymentParams) == null ? void 0 : _d.productType
30891
+ amount: (_c2 = (_b2 = props.paymentParams) == null ? void 0 : _b2.amount) == null ? void 0 : _c2.amount,
30892
+ productType: (_d2 = props.paymentParams) == null ? void 0 : _d2.productType
30918
30893
  });
30919
30894
  const noError = handleError2(res, { dryRun: true, api: "consult" });
30920
- if (!noError || "error" in res || ((_f = (_e = res.unsigned.data) == null ? void 0 : _e.error) == null ? void 0 : _f.insufficientBalanceInfo) || ((_i = (_h = (_g = res.unsigned) == null ? void 0 : _g.data) == null ? void 0 : _h.header) == null ? void 0 : _i.resultCode) !== "S0000") {
30895
+ if (!noError || (res == null ? void 0 : res.ppFetchResult) !== "success" || ((_h = (_g = (_f = (_e = res == null ? void 0 : res.body) == null ? void 0 : _e.unsigned) == null ? void 0 : _f.data) == null ? void 0 : _g.error) == null ? void 0 : _h.insufficientBalanceInfo) || ((_l = (_k = (_j = (_i = res == null ? void 0 : res.body) == null ? void 0 : _i.unsigned) == null ? void 0 : _j.data) == null ? void 0 : _k.header) == null ? void 0 : _l.resultCode) !== "S0000") {
30921
30896
  retryCount = retryCount - 1;
30922
30897
  if (retryCount <= 0) {
30923
30898
  return {
@@ -30936,7 +30911,7 @@ function useConsult(props) {
30936
30911
  if (retryResult.result) {
30937
30912
  return retryResult.res;
30938
30913
  }
30939
- const jws = "error" in retryResult.res ? null : (_b = (_a = retryResult.res) == null ? void 0 : _a.signed) == null ? void 0 : _b.jws;
30914
+ const jws = ((_a = retryResult == null ? void 0 : retryResult.res) == null ? void 0 : _a.ppFetchResult) !== "success" ? null : (_d = (_c = (_b = retryResult == null ? void 0 : retryResult.res) == null ? void 0 : _b.body) == null ? void 0 : _c.signed) == null ? void 0 : _d.jws;
30940
30915
  openLogicError({ type: "topupSuccessButNotAddToBalance" }, jws);
30941
30916
  return false;
30942
30917
  };
@@ -30972,7 +30947,7 @@ function usePayment(props, {
30972
30947
  paymentId: ""
30973
30948
  });
30974
30949
  const pay2 = async () => {
30975
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
30950
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
30976
30951
  state.paymentId = "";
30977
30952
  const requestBody = __spreadProps(__spreadValues({
30978
30953
  merchantPaymentId: (_a = props == null ? void 0 : props.paymentParams) == null ? void 0 : _a.merchantPaymentId
@@ -31001,12 +30976,12 @@ function usePayment(props, {
31001
30976
  });
31002
30977
  const res = await makePayment$2(requestParams, requestBody, (_r = (_q = props == null ? void 0 : props.paymentParams) == null ? void 0 : _q.isAuthorization) != null ? _r : false);
31003
30978
  saveLastPaymentMethod(paymentMethod2.value.paymentMethodId);
31004
- if (!res.isSuccess) {
30979
+ if ((res == null ? void 0 : res.ppFetchResult) !== "success") {
31005
30980
  handleError2(res, { type: "pay", api: "payment" });
31006
30981
  return;
31007
30982
  }
31008
- state.paymentId = (_s = res == null ? void 0 : res.unsigned) == null ? void 0 : _s.data.paymentId;
31009
- return res;
30983
+ state.paymentId = (_t = (_s = res == null ? void 0 : res.body) == null ? void 0 : _s.unsigned) == null ? void 0 : _t.data.paymentId;
30984
+ return res == null ? void 0 : res.body;
31010
30985
  };
31011
30986
  return {
31012
30987
  pay: pay2,
@@ -31025,25 +31000,25 @@ function useCashBackDetail(props) {
31025
31000
  const getCashBackDetail = async ({
31026
31001
  paymentId: paymentId2
31027
31002
  }) => {
31028
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
31003
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
31029
31004
  state.calculated = false;
31030
31005
  await delay(300);
31031
31006
  let res = await getCashBackDetails(paymentId2);
31032
- const cashBackInfo2 = "error" in res ? null : (_b = (_a = res.unsigned) == null ? void 0 : _a.data) == null ? void 0 : _b.payload;
31033
- if (!(cashBackInfo2 == null ? void 0 : cashBackInfo2.cashBackAmount) && !((_c = cashBackInfo2 == null ? void 0 : cashBackInfo2.animationInfoList) == null ? void 0 : _c.length)) {
31007
+ const cashBackInfo2 = (res == null ? void 0 : res.ppFetchResult) !== "success" ? null : (_c = (_b = (_a = res == null ? void 0 : res.body) == null ? void 0 : _a.unsigned) == null ? void 0 : _b.data) == null ? void 0 : _c.payload;
31008
+ if (!(cashBackInfo2 == null ? void 0 : cashBackInfo2.cashBackAmount) && !((_d = cashBackInfo2 == null ? void 0 : cashBackInfo2.animationInfoList) == null ? void 0 : _d.length)) {
31034
31009
  await delay(1100);
31035
31010
  res = await getCashBackDetails(paymentId2);
31036
31011
  }
31037
31012
  const errorHandled = handleError2(res, { dryRun: true, api: "cashback" });
31038
- if ("error" in res || !errorHandled) {
31013
+ if ((res == null ? void 0 : res.ppFetchResult) !== "success" || !errorHandled) {
31039
31014
  return {
31040
31015
  cashBackDetail: null,
31041
31016
  shouldShowPaymentCompletion: false
31042
31017
  };
31043
31018
  }
31044
- const cashBackDetail = (_e = (_d = res.unsigned) == null ? void 0 : _d.data) == null ? void 0 : _e.payload;
31045
- const cashBackIsExist = (cashBackDetail == null ? void 0 : cashBackDetail.cashBackAmount) > 0 && ((_f = cashBackDetail == null ? void 0 : cashBackDetail.cashBackDetailList) == null ? void 0 : _f.length) > 0;
31046
- const shouldShowPaymentCompletion = ((_g = props == null ? void 0 : props.paymentParams) == null ? void 0 : _g.alwaysDisplayCompletionScreen) || ((_h = props == null ? void 0 : props.paymentParams) == null ? void 0 : _h.isAuthorization) || cashBackIsExist && !((_i = props == null ? void 0 : props.paymentParams) == null ? void 0 : _i.isAuthorization);
31019
+ const cashBackDetail = (_g = (_f = (_e = res == null ? void 0 : res.body) == null ? void 0 : _e.unsigned) == null ? void 0 : _f.data) == null ? void 0 : _g.payload;
31020
+ const cashBackIsExist = (cashBackDetail == null ? void 0 : cashBackDetail.cashBackAmount) > 0 && ((_h = cashBackDetail == null ? void 0 : cashBackDetail.cashBackDetailList) == null ? void 0 : _h.length) > 0;
31021
+ const shouldShowPaymentCompletion = ((_i = props == null ? void 0 : props.paymentParams) == null ? void 0 : _i.alwaysDisplayCompletionScreen) || ((_j = props == null ? void 0 : props.paymentParams) == null ? void 0 : _j.isAuthorization) || cashBackIsExist && !((_k = props == null ? void 0 : props.paymentParams) == null ? void 0 : _k.isAuthorization);
31047
31022
  state.calculated = true;
31048
31023
  return {
31049
31024
  cashBackDetail,
@@ -31103,7 +31078,7 @@ function useCharge(props) {
31103
31078
  saveLastTopupPayMethod(paymentMethodId);
31104
31079
  const res = await topup$3(query, body2);
31105
31080
  const errorHandled = handleError2(res, { type: "topup", api: "topup" });
31106
- if ("error" in res || !errorHandled) {
31081
+ if ((res == null ? void 0 : res.ppFetchResult) !== "success" || !errorHandled) {
31107
31082
  return false;
31108
31083
  }
31109
31084
  return true;
@@ -31512,7 +31487,7 @@ const _sfc_main$z = defineComponent({
31512
31487
  updateAddressList
31513
31488
  } = useAddressControl();
31514
31489
  const {
31515
- getPaymentMethods: getPaymentMethods3,
31490
+ getPaymentMethods,
31516
31491
  selectPayment,
31517
31492
  paymentMethod: paymentMethod2,
31518
31493
  paymentMethods,
@@ -31553,7 +31528,7 @@ const _sfc_main$z = defineComponent({
31553
31528
  } = useCloseConfirmation();
31554
31529
  onMounted(async () => {
31555
31530
  startLoading();
31556
- const res = await Promise.all([getPaymentMethods3(true), getConsult2()]);
31531
+ const res = await Promise.all([getPaymentMethods(true), getConsult2()]);
31557
31532
  const paymentMethodResult = res[0];
31558
31533
  const consultResult = res[1];
31559
31534
  if (consultResult === true && paymentMethodResult.result === false) {
@@ -32124,9 +32099,9 @@ const initMakePayment = async (initMakePayment2) => {
32124
32099
  let showUserAddress;
32125
32100
  if ((_d = (_c = initMakePayment2 == null ? void 0 : initMakePayment2.additionalUserInfo) == null ? void 0 : _c.userAddress) == null ? void 0 : _d.visible) {
32126
32101
  const res = await getAddressList();
32127
- if (res.ppFetchResult !== "success") {
32102
+ if ((res == null ? void 0 : res.ppFetchResult) !== "success") {
32128
32103
  (_e = initMakePayment2 == null ? void 0 : initMakePayment2.fail) == null ? void 0 : _e.call(initMakePayment2, {
32129
- errorCode: MiniAppErrorType.serverError
32104
+ errorCode: getFailErrorCode(res == null ? void 0 : res.ppFetchResult)
32130
32105
  });
32131
32106
  (_f = initMakePayment2 == null ? void 0 : initMakePayment2.complete) == null ? void 0 : _f.call(initMakePayment2);
32132
32107
  return;
@@ -32986,22 +32961,22 @@ const _sfc_main$t = defineComponent({
32986
32961
  }
32987
32962
  },
32988
32963
  async switchInput() {
32989
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
32964
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
32990
32965
  this.isInput = true;
32991
32966
  const cashbackInfo2 = await getCashBackInfo();
32992
- if (!cashbackInfo2 || "error" in cashbackInfo2) {
32993
- this.errorCode = MiniAppErrorType.serverError;
32967
+ if (!cashbackInfo2 || (cashbackInfo2 == null ? void 0 : cashbackInfo2.ppFetchResult) !== "success") {
32968
+ this.errorCode = (cashbackInfo2 == null ? void 0 : cashbackInfo2.ppFetchResult) === "notAuthorized" ? MiniAppErrorType.notAuthorized : (cashbackInfo2 == null ? void 0 : cashbackInfo2.ppFetchResult) === "timeout" ? MiniAppErrorType.timeOut : MiniAppErrorType.serverError;
32994
32969
  this.showError();
32995
32970
  return;
32996
32971
  }
32997
- this.cashbackData = (_a = cashbackInfo2 == null ? void 0 : cashbackInfo2.data) == null ? void 0 : _a.payload;
32972
+ this.cashbackData = (_b = (_a = cashbackInfo2 == null ? void 0 : cashbackInfo2.body) == null ? void 0 : _a.data) == null ? void 0 : _b.payload;
32998
32973
  this.inputMoney = 0;
32999
32974
  this.minAmountUnmet = false;
33000
32975
  this.maxAmountExceeded = false;
33001
- this.fixBalMoney = (_f = (_e = (_d = (_c = (_b = cashbackInfo2 == null ? void 0 : cashbackInfo2.data) == null ? void 0 : _b.payload) == null ? void 0 : _c.walletSummary) == null ? void 0 : _d.totalBalanceInfo) == null ? void 0 : _e.balance) != null ? _f : 0;
32976
+ this.fixBalMoney = (_h = (_g = (_f = (_e = (_d = (_c = cashbackInfo2 == null ? void 0 : cashbackInfo2.body) == null ? void 0 : _c.data) == null ? void 0 : _d.payload) == null ? void 0 : _e.walletSummary) == null ? void 0 : _f.totalBalanceInfo) == null ? void 0 : _g.balance) != null ? _h : 0;
33002
32977
  this.balMoney = formatCurrency(this.inputMoney + this.fixBalMoney, 0);
33003
- this.fixCashbackBalance = (_k = (_j = (_i = (_h = (_g = cashbackInfo2 == null ? void 0 : cashbackInfo2.data) == null ? void 0 : _g.payload) == null ? void 0 : _h.walletSummary) == null ? void 0 : _i.allTotalBalanceInfo) == null ? void 0 : _j.balance) != null ? _k : 0;
33004
- this.totalCashbackBalance = (_l = formatCurrency(this.inputMoney + this.fixCashbackBalance, 0)) != null ? _l : "0";
32978
+ this.fixCashbackBalance = (_n = (_m = (_l = (_k = (_j = (_i = cashbackInfo2 == null ? void 0 : cashbackInfo2.body) == null ? void 0 : _i.data) == null ? void 0 : _j.payload) == null ? void 0 : _k.walletSummary) == null ? void 0 : _l.allTotalBalanceInfo) == null ? void 0 : _m.balance) != null ? _n : 0;
32979
+ this.totalCashbackBalance = (_o = formatCurrency(this.inputMoney + this.fixCashbackBalance, 0)) != null ? _o : "0";
33005
32980
  setTimeout(() => {
33006
32981
  var _a2;
33007
32982
  (_a2 = document.getElementById("inputmoney")) == null ? void 0 : _a2.focus();
@@ -33095,7 +33070,7 @@ const _sfc_main$t = defineComponent({
33095
33070
  this.$emit("click");
33096
33071
  },
33097
33072
  async clickTopup(agreeSimilarTransaction) {
33098
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
33073
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P;
33099
33074
  if (this.selectedCardMethod) {
33100
33075
  const isAuthenticated = (_a = this.selectedCardMethod.creditCardInfo) == null ? void 0 : _a.isAuthenticated;
33101
33076
  if (!isAuthenticated) {
@@ -33135,38 +33110,37 @@ const _sfc_main$t = defineComponent({
33135
33110
  },
33136
33111
  requestedAt: (_h = (_g = this.topupParams) == null ? void 0 : _g.requestedAt) != null ? _h : 0
33137
33112
  });
33138
- if (!res || "error" in res) {
33139
- this.errorCode = MiniAppErrorType.serverError;
33113
+ if ((res == null ? void 0 : res.ppFetchResult) === "apiError" && ((_i = res == null ? void 0 : res.body) == null ? void 0 : _i.uiComponents)) {
33114
+ if ((_k = (_j = res == null ? void 0 : res.body) == null ? void 0 : _j.uiComponents) == null ? void 0 : _k.displayErrorResponse) {
33115
+ this.errorInfo.iconUrl = (_o = (_n = (_m = (_l = res == null ? void 0 : res.body) == null ? void 0 : _l.uiComponents) == null ? void 0 : _m.displayErrorResponse) == null ? void 0 : _n.iconUrl) != null ? _o : "";
33116
+ this.errorInfo.title = (_r = (_q = (_p = res == null ? void 0 : res.body) == null ? void 0 : _p.uiComponents) == null ? void 0 : _q.displayErrorResponse) == null ? void 0 : _r.title;
33117
+ this.errorInfo.desc = (_u = (_t = (_s = res == null ? void 0 : res.body) == null ? void 0 : _s.uiComponents) == null ? void 0 : _t.displayErrorResponse) == null ? void 0 : _u.description;
33118
+ this.errorInfo.buttonList = (_x = (_w = (_v = res == null ? void 0 : res.body) == null ? void 0 : _v.uiComponents) == null ? void 0 : _w.displayErrorResponse) == null ? void 0 : _x.buttonList;
33119
+ }
33120
+ this.errorCode = MiniAppErrorType.topupFail;
33121
+ this.jws = ((_z = (_y = res == null ? void 0 : res.body) == null ? void 0 : _y.signed) == null ? void 0 : _z.jws) || "";
33122
+ this.showError();
33123
+ } else if (!res || (res == null ? void 0 : res.ppFetchResult) !== "success") {
33124
+ this.errorCode = (res == null ? void 0 : res.ppFetchResult) === "notAuthorized" ? MiniAppErrorType.notAuthorized : (res == null ? void 0 : res.ppFetchResult) === "timeout" ? MiniAppErrorType.timeOut : MiniAppErrorType.serverError;
33140
33125
  this.errorShow = true;
33141
33126
  return;
33142
- }
33143
- if (((_j = (_i = res == null ? void 0 : res.unsigned) == null ? void 0 : _i.resultInfo) == null ? void 0 : _j.code) === "SUCCESS" && ((_l = (_k = res == null ? void 0 : res.unsigned) == null ? void 0 : _k.data) == null ? void 0 : _l.status) === "COMPLETED") {
33127
+ } else if (((_C = (_B = (_A = res == null ? void 0 : res.body) == null ? void 0 : _A.unsigned) == null ? void 0 : _B.resultInfo) == null ? void 0 : _C.code) === "SUCCESS" && ((_F = (_E = (_D = res == null ? void 0 : res.body) == null ? void 0 : _D.unsigned) == null ? void 0 : _E.data) == null ? void 0 : _F.status) === "COMPLETED") {
33144
33128
  this.loading = false;
33145
- this.completionData.unsignedData = (_m = res == null ? void 0 : res.unsigned) == null ? void 0 : _m.data;
33146
- this.completionData.jws = ((_n = res == null ? void 0 : res.signed) == null ? void 0 : _n.jws) || "";
33129
+ this.completionData.unsignedData = (_H = (_G = res == null ? void 0 : res.body) == null ? void 0 : _G.unsigned) == null ? void 0 : _H.data;
33130
+ this.completionData.jws = ((_J = (_I = res == null ? void 0 : res.body) == null ? void 0 : _I.signed) == null ? void 0 : _J.jws) || "";
33147
33131
  this.done = true;
33148
33132
  setTimeout(() => {
33149
33133
  this.isInput = false;
33150
33134
  this.done = false;
33151
33135
  this.complete = true;
33152
33136
  }, 1500);
33153
- } else if (res.uiComponents) {
33154
- if ((_o = res.uiComponents) == null ? void 0 : _o.displayErrorResponse) {
33155
- this.errorInfo.iconUrl = (_r = (_q = (_p = res.uiComponents) == null ? void 0 : _p.displayErrorResponse) == null ? void 0 : _q.iconUrl) != null ? _r : "";
33156
- this.errorInfo.title = (_t = (_s = res.uiComponents) == null ? void 0 : _s.displayErrorResponse) == null ? void 0 : _t.title;
33157
- this.errorInfo.desc = (_v = (_u = res.uiComponents) == null ? void 0 : _u.displayErrorResponse) == null ? void 0 : _v.description;
33158
- this.errorInfo.buttonList = (_x = (_w = res.uiComponents) == null ? void 0 : _w.displayErrorResponse) == null ? void 0 : _x.buttonList;
33159
- }
33160
- this.errorCode = MiniAppErrorType.topupFail;
33161
- this.jws = ((_y = res == null ? void 0 : res.signed) == null ? void 0 : _y.jws) || "";
33162
- this.showError();
33163
- } else if (res.status === 401 || res.status === 400) {
33137
+ } else if (((_K = res == null ? void 0 : res.body) == null ? void 0 : _K.status) === 401 || ((_L = res == null ? void 0 : res.body) == null ? void 0 : _L.status) === 400) {
33164
33138
  this.errorCode = MiniAppErrorType.invalidHeader;
33165
- this.jws = ((_z = res == null ? void 0 : res.signed) == null ? void 0 : _z.jws) || "";
33139
+ this.jws = ((_N = (_M = res == null ? void 0 : res.body) == null ? void 0 : _M.signed) == null ? void 0 : _N.jws) || "";
33166
33140
  this.showError();
33167
33141
  } else {
33168
33142
  this.errorCode = MiniAppErrorType.topupFail;
33169
- this.jws = ((_A = res == null ? void 0 : res.signed) == null ? void 0 : _A.jws) || "";
33143
+ this.jws = ((_P = (_O = res == null ? void 0 : res.body) == null ? void 0 : _O.signed) == null ? void 0 : _P.jws) || "";
33170
33144
  this.showError();
33171
33145
  }
33172
33146
  } catch (error2) {
@@ -33950,7 +33924,7 @@ function setTitle(setTitleParams) {
33950
33924
  (_a = params == null ? void 0 : params.success) == null ? void 0 : _a.call(params);
33951
33925
  }
33952
33926
  async function getUserLocation(getUserLocationParams) {
33953
- var _a, _b, _c;
33927
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
33954
33928
  const params = reconstructParams(getUserLocationParams);
33955
33929
  try {
33956
33930
  const grantStatus = await checkPermission(PermissionName.mini_app_user_location);
@@ -33964,10 +33938,10 @@ async function getUserLocation(getUserLocationParams) {
33964
33938
  }
33965
33939
  if (validTimeMinutes > 0) {
33966
33940
  const resp = await getUserLocationRequest({ validTimeMinutes });
33967
- if (!("error" in resp) && resp.unsigned.data.location) {
33968
- const lat = Number.parseFloat(resp.unsigned.data.location.lat);
33969
- const long = Number.parseFloat(resp.unsigned.data.location.lon);
33970
- (_b = params == null ? void 0 : params.success) == null ? void 0 : _b.call(params, {
33941
+ if ((resp == null ? void 0 : resp.ppFetchResult) === "success" && ((_d = (_c = (_b = resp == null ? void 0 : resp.body) == null ? void 0 : _b.unsigned) == null ? void 0 : _c.data) == null ? void 0 : _d.location)) {
33942
+ const lat = Number.parseFloat((_h = (_g = (_f = (_e = resp == null ? void 0 : resp.body) == null ? void 0 : _e.unsigned) == null ? void 0 : _f.data) == null ? void 0 : _g.location) == null ? void 0 : _h.lat);
33943
+ const long = Number.parseFloat((_l = (_k = (_j = (_i = resp == null ? void 0 : resp.body) == null ? void 0 : _i.unsigned) == null ? void 0 : _j.data) == null ? void 0 : _k.location) == null ? void 0 : _l.lon);
33944
+ (_m = params == null ? void 0 : params.success) == null ? void 0 : _m.call(params, {
33971
33945
  result: {
33972
33946
  lat,
33973
33947
  long
@@ -34010,7 +33984,7 @@ async function getUserLocation(getUserLocationParams) {
34010
33984
  }
34011
33985
  });
34012
33986
  } catch {
34013
- (_c = params == null ? void 0 : params.fail) == null ? void 0 : _c.call(params, { errorCode: MiniAppErrorType.other });
33987
+ (_n = params == null ? void 0 : params.fail) == null ? void 0 : _n.call(params, { errorCode: MiniAppErrorType.other });
34014
33988
  }
34015
33989
  }
34016
33990
  const initGetUserAddress = async (params) => {
@@ -34024,9 +33998,9 @@ const initGetUserAddress = async (params) => {
34024
33998
  const container2 = document.createElement("div");
34025
33999
  container2.className = "ppmna-reset-css";
34026
34000
  const res = await getAddressList();
34027
- if (res.ppFetchResult !== "success") {
34001
+ if ((res == null ? void 0 : res.ppFetchResult) !== "success") {
34028
34002
  (_b = params == null ? void 0 : params.fail) == null ? void 0 : _b.call(params, {
34029
- errorCode: MiniAppErrorType.serverError
34003
+ errorCode: getFailErrorCode(res == null ? void 0 : res.ppFetchResult)
34030
34004
  });
34031
34005
  return;
34032
34006
  }
@@ -34631,14 +34605,14 @@ function openMiniApp(openMiniappParams) {
34631
34605
  (_b = params == null ? void 0 : params.success) == null ? void 0 : _b.call(params);
34632
34606
  }
34633
34607
  async function checkPaymentMethod(checkPayMethodParams) {
34634
- var _a, _b, _c, _d, _e, _f, _g, _h;
34608
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
34635
34609
  const params = reconstructParams(checkPayMethodParams);
34636
34610
  try {
34637
34611
  const grantStatus = await checkPermission(PermissionName.mini_app_check_payment_method);
34638
34612
  if (grantStatus !== PermissionStatus.granted) {
34639
34613
  return (_a = params == null ? void 0 : params.fail) == null ? void 0 : _a.call(params, { errorCode: MiniAppErrorType.insufficientScope });
34640
34614
  }
34641
- let result2 = await ppFetch({
34615
+ let result2 = await ppFetch2({
34642
34616
  method: "GET",
34643
34617
  url: "web-api/app/v2/payment/methods",
34644
34618
  params: {
@@ -34650,28 +34624,30 @@ async function checkPaymentMethod(checkPayMethodParams) {
34650
34624
  sourceInfoApp: params == null ? void 0 : params.sourceInfoApp
34651
34625
  }
34652
34626
  });
34653
- let paymentMethodList = (_d = (_c = (_b = result2 == null ? void 0 : result2.unsigned) == null ? void 0 : _b.data) == null ? void 0 : _c.payload) == null ? void 0 : _d.paymentMethodList;
34627
+ if (result2.ppFetchResult !== "success") {
34628
+ return (_b = params == null ? void 0 : params.fail) == null ? void 0 : _b.call(params, { errorCode: getFailErrorCode(result2.ppFetchResult) });
34629
+ }
34630
+ let paymentMethodList = (_e = (_d = (_c = result2 == null ? void 0 : result2.body.unsigned) == null ? void 0 : _c.data) == null ? void 0 : _d.payload) == null ? void 0 : _e.paymentMethodList;
34654
34631
  if (!paymentMethodList) {
34655
- (_e = params == null ? void 0 : params.fail) == null ? void 0 : _e.call(params, { errorCode: MiniAppErrorType.serverError });
34632
+ return (_f = params == null ? void 0 : params.fail) == null ? void 0 : _f.call(params, { errorCode: MiniAppErrorType.serverError });
34656
34633
  } else if (paymentMethodList.length > 0) {
34657
- (_f = params == null ? void 0 : params.success) == null ? void 0 : _f.call(params, { status: "AVAILABLE" });
34634
+ return (_g = params == null ? void 0 : params.success) == null ? void 0 : _g.call(params, { status: "AVAILABLE" });
34658
34635
  } else {
34659
- (_g = params == null ? void 0 : params.success) == null ? void 0 : _g.call(params, { status: "UNAVAILABLE" });
34636
+ return (_h = params == null ? void 0 : params.success) == null ? void 0 : _h.call(params, { status: "UNAVAILABLE" });
34660
34637
  }
34661
34638
  } catch {
34662
- (_h = params == null ? void 0 : params.fail) == null ? void 0 : _h.call(params, { errorCode: MiniAppErrorType.serverError });
34639
+ return (_i = params == null ? void 0 : params.fail) == null ? void 0 : _i.call(params, { errorCode: MiniAppErrorType.serverError });
34663
34640
  }
34664
34641
  }
34665
34642
  async function requestInternal(requestInternalParams) {
34666
- var _a, _b, _c, _d;
34643
+ var _a, _b, _c, _d, _e, _f;
34667
34644
  const params = reconstructParams(requestInternalParams);
34668
34645
  try {
34669
34646
  const appDetail = getAppDetail();
34670
34647
  if (!(appDetail == null ? void 0 : appDetail.isInternal)) {
34671
- (_a = params == null ? void 0 : params.fail) == null ? void 0 : _a.call(params, { errorCode: MiniAppErrorType.insufficientScope });
34672
- return;
34648
+ return (_a = params == null ? void 0 : params.fail) == null ? void 0 : _a.call(params, { errorCode: MiniAppErrorType.insufficientScope });
34673
34649
  }
34674
- const response = await ppFetch({
34650
+ const response = await ppFetch2({
34675
34651
  method: "POST",
34676
34652
  url: "web-api/app/v1/internal/request",
34677
34653
  data: {
@@ -34682,17 +34658,17 @@ async function requestInternal(requestInternalParams) {
34682
34658
  },
34683
34659
  headers: params == null ? void 0 : params.header
34684
34660
  });
34685
- if (!response || "error" in response) {
34686
- return (_b = params == null ? void 0 : params.fail) == null ? void 0 : _b.call(params, { errorCode: MiniAppErrorType.serverError });
34661
+ if (response.ppFetchResult !== "success") {
34662
+ return (_b = params == null ? void 0 : params.fail) == null ? void 0 : _b.call(params, { errorCode: getFailErrorCode(response.ppFetchResult) });
34687
34663
  }
34688
- const statusCode = response.statusCode;
34689
- delete response.statusCode;
34690
- (_c = params == null ? void 0 : params.success) == null ? void 0 : _c.call(params, {
34664
+ const statusCode = (_c = response == null ? void 0 : response.body) == null ? void 0 : _c.statusCode;
34665
+ (_d = response == null ? void 0 : response.body) == null ? true : delete _d.statusCode;
34666
+ return (_e = params == null ? void 0 : params.success) == null ? void 0 : _e.call(params, {
34691
34667
  statusCode,
34692
- data: JSON.stringify(response)
34668
+ data: JSON.stringify(response == null ? void 0 : response.body)
34693
34669
  });
34694
34670
  } catch (error2) {
34695
- (_d = params == null ? void 0 : params.fail) == null ? void 0 : _d.call(params, { errorCode: MiniAppErrorType.statusCodeError });
34671
+ return (_f = params == null ? void 0 : params.fail) == null ? void 0 : _f.call(params, { errorCode: MiniAppErrorType.statusCodeError });
34696
34672
  }
34697
34673
  }
34698
34674
  function debug(params) {
@@ -34702,7 +34678,7 @@ function debug(params) {
34702
34678
  function execute$6(params) {
34703
34679
  var _a;
34704
34680
  (_a = params == null ? void 0 : params.success) == null ? void 0 : _a.call(params, {
34705
- v: "1.39.0"
34681
+ v: "1.40.0"
34706
34682
  });
34707
34683
  }
34708
34684
  function useCallBack(props, ctx) {
@@ -34733,15 +34709,17 @@ const defaultError = {
34733
34709
  description: lg$1.registerEmail.errorDescription
34734
34710
  };
34735
34711
  const createErrorMessage = (res) => {
34736
- if ("error" in res)
34737
- return defaultError;
34738
- if (res.statusCode !== 200 && res.uiComponents)
34712
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
34713
+ if ((res == null ? void 0 : res.ppFetchResult) === "apiError" && ((_a = res == null ? void 0 : res.body) == null ? void 0 : _a.uiComponents)) {
34739
34714
  return {
34740
34715
  open: true,
34741
- iconUrl: res.uiComponents.displayErrorResponse.iconUrl,
34742
- title: res.uiComponents.displayErrorResponse.title,
34743
- description: res.uiComponents.displayErrorResponse.description
34716
+ iconUrl: (_d = (_c = (_b = res == null ? void 0 : res.body) == null ? void 0 : _b.uiComponents) == null ? void 0 : _c.displayErrorResponse) == null ? void 0 : _d.iconUrl,
34717
+ title: (_h = (_g = (_f = (_e = res == null ? void 0 : res.body) == null ? void 0 : _e.uiComponents) == null ? void 0 : _f.displayErrorResponse) == null ? void 0 : _g.title) != null ? _h : lg$1.registerEmail.errorTitle,
34718
+ description: (_l = (_k = (_j = (_i = res == null ? void 0 : res.body) == null ? void 0 : _i.uiComponents) == null ? void 0 : _j.displayErrorResponse) == null ? void 0 : _k.description) != null ? _l : lg$1.registerEmail.errorDescription
34744
34719
  };
34720
+ }
34721
+ if ((res == null ? void 0 : res.ppFetchResult) !== "success")
34722
+ return defaultError;
34745
34723
  return {
34746
34724
  open: false,
34747
34725
  title: "",
@@ -35105,9 +35083,10 @@ const _sfc_main$l = defineComponent({
35105
35083
  });
35106
35084
  };
35107
35085
  const checkEmailAuth = async () => {
35086
+ var _a, _b, _c, _d, _e, _f;
35108
35087
  try {
35109
35088
  const res = await getUserProfileData();
35110
- if (res.signed.result_info.code === "SUCCESS" && res.unsigned.data.emailStatus === "VERIFIED") {
35089
+ if ((res == null ? void 0 : res.ppFetchResult) === "success" && ((_c = (_b = (_a = res == null ? void 0 : res.body) == null ? void 0 : _a.signed) == null ? void 0 : _b.result_info) == null ? void 0 : _c.code) === "SUCCESS" && ((_f = (_e = (_d = res == null ? void 0 : res.body) == null ? void 0 : _d.unsigned) == null ? void 0 : _e.data) == null ? void 0 : _f.emailStatus) === "VERIFIED") {
35111
35090
  toggleIsSentEmailDoneSheetVisible(true);
35112
35091
  } else {
35113
35092
  state.error = true;
@@ -35710,20 +35689,20 @@ function validType(params) {
35710
35689
  return authTypes.includes(params == null ? void 0 : params.type);
35711
35690
  }
35712
35691
  async function execute$4(params) {
35713
- var _a, _b, _c;
35692
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
35714
35693
  if (!validType(params)) {
35715
35694
  return (_a = params == null ? void 0 : params.fail) == null ? void 0 : _a.call(params, { errorCode: MiniAppErrorType.invalidType });
35716
35695
  }
35717
35696
  try {
35718
- const res = await ppFetch({
35697
+ const res = await ppFetch2({
35719
35698
  method: "GET",
35720
35699
  url: "/web-api/app/v1/authentication/sessionId"
35721
35700
  });
35722
- if (!res || "error" in res) {
35723
- return (_b = params == null ? void 0 : params.fail) == null ? void 0 : _b.call(params, { errorCode: MiniAppErrorType.serverError });
35701
+ if (res.ppFetchResult !== "success") {
35702
+ return (_b = params == null ? void 0 : params.fail) == null ? void 0 : _b.call(params, { errorCode: getFailErrorCode(res.ppFetchResult) });
35724
35703
  }
35725
- if (res.unsigned.data.sessionId) {
35726
- const sessionId = res.unsigned.data.sessionId;
35704
+ if ((_e = (_d = (_c = res == null ? void 0 : res.body) == null ? void 0 : _c.unsigned) == null ? void 0 : _d.data) == null ? void 0 : _e.sessionId) {
35705
+ const sessionId = (_h = (_g = (_f = res == null ? void 0 : res.body) == null ? void 0 : _f.unsigned) == null ? void 0 : _g.data) == null ? void 0 : _h.sessionId;
35727
35706
  const deeplink = `paypay://miniAppMFA?ppSessionId=${sessionId}&type=${params.type}&callbackUrl=${params == null ? void 0 : params.callbackUrl}`;
35728
35707
  closeApp({
35729
35708
  options: {
@@ -35734,7 +35713,7 @@ async function execute$4(params) {
35734
35713
  throw new Error();
35735
35714
  }
35736
35715
  } catch {
35737
- return (_c = params == null ? void 0 : params.fail) == null ? void 0 : _c.call(params, { errorCode: MiniAppErrorType.serverError });
35716
+ return (_i = params == null ? void 0 : params.fail) == null ? void 0 : _i.call(params, { errorCode: MiniAppErrorType.serverError });
35738
35717
  }
35739
35718
  }
35740
35719
  function logout(params) {
@@ -35759,36 +35738,36 @@ async function verifyMultiFactorAuthResult(params) {
35759
35738
  await execute$2(newParams);
35760
35739
  }
35761
35740
  async function execute$2(params) {
35762
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
35741
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
35763
35742
  const urlParams = new URLSearchParams(window.location.search);
35764
35743
  const sessionId = urlParams == null ? void 0 : urlParams.get("ppSessionId");
35765
35744
  if (!sessionId || sessionId.length < 1) {
35766
35745
  return (_a = params == null ? void 0 : params.fail) == null ? void 0 : _a.call(params, { errorCode: MiniAppErrorType.sessionNotFound });
35767
35746
  }
35768
35747
  try {
35769
- const res = await ppFetch({
35748
+ const res = await ppFetch2({
35770
35749
  method: "GET",
35771
35750
  url: "/web-api/app/v1/authentication/status",
35772
35751
  params: {
35773
35752
  sessionId
35774
35753
  }
35775
35754
  });
35776
- if (!res || "error" in res) {
35777
- return (_b = params == null ? void 0 : params.fail) == null ? void 0 : _b.call(params, { errorCode: MiniAppErrorType.serverError });
35755
+ if (res.ppFetchResult !== "success") {
35756
+ return (_b = params == null ? void 0 : params.fail) == null ? void 0 : _b.call(params, { errorCode: getFailErrorCode(res.ppFetchResult) });
35778
35757
  }
35779
- const isSuccess = ((_d = (_c = res == null ? void 0 : res.unsigned) == null ? void 0 : _c.resultInfo) == null ? void 0 : _d.code) === MiniAppStatusType.success;
35758
+ const isSuccess = ((_e = (_d = (_c = res == null ? void 0 : res.body) == null ? void 0 : _c.unsigned) == null ? void 0 : _d.resultInfo) == null ? void 0 : _e.code) === MiniAppStatusType.success;
35780
35759
  if (isSuccess) {
35781
- const data2 = (_e = res == null ? void 0 : res.unsigned) == null ? void 0 : _e.data;
35760
+ const data2 = (_g = (_f = res == null ? void 0 : res.body) == null ? void 0 : _f.unsigned) == null ? void 0 : _g.data;
35782
35761
  if (data2) {
35783
- return (_f = params == null ? void 0 : params.success) == null ? void 0 : _f.call(params, data2);
35762
+ return (_h = params == null ? void 0 : params.success) == null ? void 0 : _h.call(params, data2);
35784
35763
  } else {
35785
35764
  throw Error();
35786
35765
  }
35787
35766
  } else {
35788
- throw Error(((_h = (_g = res == null ? void 0 : res.unsigned) == null ? void 0 : _g.resultInfo) == null ? void 0 : _h.code) || MiniAppErrorType.serverError);
35767
+ throw Error(((_k = (_j = (_i = res == null ? void 0 : res.body) == null ? void 0 : _i.unsigned) == null ? void 0 : _j.resultInfo) == null ? void 0 : _k.code) || MiniAppErrorType.serverError);
35789
35768
  }
35790
35769
  } catch (e) {
35791
- return (_i = params == null ? void 0 : params.fail) == null ? void 0 : _i.call(params, {
35770
+ return (_l = params == null ? void 0 : params.fail) == null ? void 0 : _l.call(params, {
35792
35771
  errorCode: (e == null ? void 0 : e.message) || MiniAppErrorType.serverError
35793
35772
  });
35794
35773
  }
@@ -35798,7 +35777,7 @@ async function getAuthStatus(params) {
35798
35777
  await execute$1(newParams);
35799
35778
  }
35800
35779
  async function execute$1(params) {
35801
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
35780
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
35802
35781
  try {
35803
35782
  const clientId = getClientId();
35804
35783
  if (!clientId) {
@@ -35809,30 +35788,24 @@ async function execute$1(params) {
35809
35788
  url: "/web-api/app/v1/smartpayment/auth/status",
35810
35789
  params: {}
35811
35790
  });
35812
- if (res.ppFetchResult === "notAuthorized") {
35813
- return (_b = params == null ? void 0 : params.fail) == null ? void 0 : _b.call(params, { errorCode: MiniAppErrorType.notAuthorized });
35814
- }
35815
35791
  if (res.ppFetchResult !== "success") {
35816
- if (res.ppFetchResult === "tokenExpired" && res.statusCode === 401) {
35817
- return (_c = params == null ? void 0 : params.fail) == null ? void 0 : _c.call(params, { errorCode: MiniAppErrorType.tokenExpired });
35818
- }
35819
- return (_d = params == null ? void 0 : params.fail) == null ? void 0 : _d.call(params, { errorCode: MiniAppErrorType.serverError });
35792
+ return (_b = params == null ? void 0 : params.fail) == null ? void 0 : _b.call(params, { errorCode: getFailErrorCode(res.ppFetchResult) });
35820
35793
  }
35821
- const isSuccess = ((_g = (_f = (_e = res == null ? void 0 : res.body) == null ? void 0 : _e.unsigned) == null ? void 0 : _f.resultInfo) == null ? void 0 : _g.code) === MiniAppStatusType.success;
35794
+ const isSuccess = ((_e = (_d = (_c = res == null ? void 0 : res.body) == null ? void 0 : _c.unsigned) == null ? void 0 : _d.resultInfo) == null ? void 0 : _e.code) === MiniAppStatusType.success;
35822
35795
  if (isSuccess) {
35823
- const data2 = (_i = (_h = res == null ? void 0 : res.body) == null ? void 0 : _h.unsigned) == null ? void 0 : _i.data;
35796
+ const data2 = (_g = (_f = res == null ? void 0 : res.body) == null ? void 0 : _f.unsigned) == null ? void 0 : _g.data;
35824
35797
  if (!(data2 == null ? void 0 : data2.isActive)) {
35825
- return (_j = params == null ? void 0 : params.fail) == null ? void 0 : _j.call(params, { errorCode: MiniAppErrorType.notAuthorized });
35798
+ return (_h = params == null ? void 0 : params.fail) == null ? void 0 : _h.call(params, { errorCode: MiniAppErrorType.notAuthorized });
35826
35799
  } else if (data2 == null ? void 0 : data2.showPermission) {
35827
- return (_k = params == null ? void 0 : params.fail) == null ? void 0 : _k.call(params, {
35800
+ return (_i = params == null ? void 0 : params.fail) == null ? void 0 : _i.call(params, {
35828
35801
  errorCode: MiniAppErrorType.permissionRequired
35829
35802
  });
35830
35803
  } else if ((data2 == null ? void 0 : data2.isActive) && !(data2 == null ? void 0 : data2.showPermission)) {
35831
- return (_l = params == null ? void 0 : params.success) == null ? void 0 : _l.call(params, { statusCode: MiniAppStatusType.connected });
35804
+ return (_j = params == null ? void 0 : params.success) == null ? void 0 : _j.call(params, { statusCode: MiniAppStatusType.connected });
35832
35805
  }
35833
35806
  }
35834
35807
  } catch (e) {
35835
- return (_m = params == null ? void 0 : params.fail) == null ? void 0 : _m.call(params, {
35808
+ return (_k = params == null ? void 0 : params.fail) == null ? void 0 : _k.call(params, {
35836
35809
  errorCode: (e == null ? void 0 : e.message) || MiniAppErrorType.serverError
35837
35810
  });
35838
35811
  }
@@ -36458,7 +36431,7 @@ function render(params) {
36458
36431
  }
36459
36432
  }
36460
36433
  async function renderPay(params, smartPay2, preferredLanguage, loggedIn) {
36461
- var _a, _b, _c;
36434
+ var _a, _b, _c, _d, _e;
36462
36435
  if ((params == null ? void 0 : params.orderInfo) && loggedIn) {
36463
36436
  const { orderInfo } = params;
36464
36437
  const query = {
@@ -36473,18 +36446,18 @@ async function renderPay(params, smartPay2, preferredLanguage, loggedIn) {
36473
36446
  storeId: orderInfo == null ? void 0 : orderInfo.storeId,
36474
36447
  merchantPaymentId: orderInfo == null ? void 0 : orderInfo.merchantPaymentId
36475
36448
  };
36476
- const res = await ppFetch({
36449
+ const res = await ppFetch2({
36477
36450
  method: "POST",
36478
36451
  url: "web-api/app/v1/smartpayment/cashback/expected",
36479
36452
  params: query,
36480
36453
  data: body2
36481
36454
  });
36482
- if (!res || "error" in res) {
36483
- return (_a = params == null ? void 0 : params.fail) == null ? void 0 : _a.call(params, { errorCode: MiniAppErrorType.serverError });
36455
+ if (res.ppFetchResult !== "success") {
36456
+ return (_a = params == null ? void 0 : params.fail) == null ? void 0 : _a.call(params, { errorCode: getFailErrorCode(res.ppFetchResult) });
36484
36457
  }
36485
36458
  let cashbackInfo2 = "";
36486
- if ((_b = res == null ? void 0 : res.unsigned) == null ? void 0 : _b.data) {
36487
- const { normalCashbackPercentage, lotteryCashbackPercentage } = (_c = res == null ? void 0 : res.unsigned) == null ? void 0 : _c.data;
36459
+ if ((_c = (_b = res == null ? void 0 : res.body) == null ? void 0 : _b.unsigned) == null ? void 0 : _c.data) {
36460
+ const { normalCashbackPercentage, lotteryCashbackPercentage } = (_e = (_d = res == null ? void 0 : res.body) == null ? void 0 : _d.unsigned) == null ? void 0 : _e.data;
36488
36461
  if (normalCashbackPercentage || lotteryCashbackPercentage) {
36489
36462
  let tempCashback = Number((parseFloat(normalCashbackPercentage != null ? normalCashbackPercentage : "0") + parseFloat(lotteryCashbackPercentage != null ? lotteryCashbackPercentage : "0")).toFixed(1));
36490
36463
  cashbackInfo2 = tempCashback ? tempCashback.toString() : "";