@paypay/mini-app-js-sdk 1.29.0 → 1.30.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.29.0";
69
- this.revision = "c280ce6";
68
+ this.version = "1.30.0";
69
+ this.revision = "f13dc1f";
70
70
  this.messageHandlers = new Map();
71
71
  this.responseCallbacks = new Map();
72
72
  this.global = global2;
@@ -1316,6 +1316,120 @@ const sendAge = (payload) => {
1316
1316
  data: payload
1317
1317
  });
1318
1318
  };
1319
+ var UIComponentsButtonActionType;
1320
+ (function(UIComponentsButtonActionType2) {
1321
+ UIComponentsButtonActionType2["DEEPLINK"] = "DEEPLINK";
1322
+ UIComponentsButtonActionType2["CLOSE"] = "CLOSE";
1323
+ UIComponentsButtonActionType2["NATIVE"] = "NATIVE";
1324
+ })(UIComponentsButtonActionType || (UIComponentsButtonActionType = {}));
1325
+ var UIComponentsButtonType;
1326
+ (function(UIComponentsButtonType2) {
1327
+ UIComponentsButtonType2["BLUE"] = "BLUE";
1328
+ UIComponentsButtonType2["WHITE"] = "WHITE";
1329
+ })(UIComponentsButtonType || (UIComponentsButtonType = {}));
1330
+ async function topup$3(queryParams, body) {
1331
+ var _a, _b, _c, _d, _e, _f, _g;
1332
+ const res = await ppFetch({
1333
+ method: "POST",
1334
+ url: "web-api/app/v1/payment/topup",
1335
+ params: queryParams,
1336
+ data: body
1337
+ });
1338
+ if ("error" in res) {
1339
+ return res;
1340
+ }
1341
+ 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);
1342
+ if (isSuccess) {
1343
+ saveTopup({
1344
+ amount: (_g = (_f = (_e = res.unsigned) == null ? void 0 : _e.data) == null ? void 0 : _f.amount) == null ? void 0 : _g.amount
1345
+ });
1346
+ }
1347
+ return res;
1348
+ }
1349
+ async function getCashBackInfo() {
1350
+ return await ppFetch({
1351
+ method: "GET",
1352
+ url: "/web-api/app/platform/v1/balance",
1353
+ headers: {
1354
+ "INTERNAL-CALL": "true"
1355
+ }
1356
+ });
1357
+ }
1358
+ async function getAddressByZip(params) {
1359
+ return await ppFetch({
1360
+ method: "GET",
1361
+ url: "web-api/app/v1/addressbyzip",
1362
+ params
1363
+ });
1364
+ }
1365
+ async function getAddressList() {
1366
+ return ppFetch({
1367
+ method: "GET",
1368
+ url: "web-api/app/v1/users/addresslist",
1369
+ params: {
1370
+ type: "PREFERRED"
1371
+ }
1372
+ });
1373
+ }
1374
+ async function postAddress(body) {
1375
+ return await ppFetch({
1376
+ method: "POST",
1377
+ url: "web-api/app/v1/users/address",
1378
+ data: body
1379
+ });
1380
+ }
1381
+ async function editAddress(body, id) {
1382
+ return await ppFetch({
1383
+ method: "PUT",
1384
+ url: `web-api/app/v1/users/address/${id}`,
1385
+ data: body
1386
+ });
1387
+ }
1388
+ async function deleteAddress(id) {
1389
+ return await ppFetch({
1390
+ method: "DELETE",
1391
+ url: `web-api/app/v1/users/address/${id}`
1392
+ });
1393
+ }
1394
+ async function setSelectedAddress(addressId) {
1395
+ return ppFetch({
1396
+ url: `web-api/app/v1/users/address/selected/${addressId}`,
1397
+ method: "PUT"
1398
+ });
1399
+ }
1400
+ async function getUserProfileData() {
1401
+ return ppFetch({
1402
+ url: "web-api/app/v1/users/profile",
1403
+ method: "GET"
1404
+ });
1405
+ }
1406
+ async function registerEmail$1(email) {
1407
+ return ppFetch({
1408
+ url: "web-api/app/v1/users/email",
1409
+ method: "POST",
1410
+ data: {
1411
+ email
1412
+ }
1413
+ });
1414
+ }
1415
+ async function resendEmail() {
1416
+ return ppFetch({
1417
+ url: "web-api/app/v1/users/resendVerification",
1418
+ method: "POST"
1419
+ });
1420
+ }
1421
+ function getUserLocationRequest(params) {
1422
+ return ppFetch({
1423
+ url: "web-api/app/v1/location",
1424
+ method: "GET",
1425
+ params: {
1426
+ validTimeMinutes: params.validTimeMinutes
1427
+ }
1428
+ });
1429
+ }
1430
+ function isValidUrl(urlChallenge) {
1431
+ return /^https?:\/\//.test(urlChallenge);
1432
+ }
1319
1433
  function isDef(val2) {
1320
1434
  return val2 !== void 0 && val2 !== null;
1321
1435
  }
@@ -1512,6 +1626,20 @@ function getPaymentMethodStatus(isExpired, val2) {
1512
1626
  return lg2.paymentMethod.expired;
1513
1627
  return val2 && val2 in PaymentMethodStatus ? lg2.paymentMethodStatus[val2] : "";
1514
1628
  }
1629
+ function filterErrorButtonList(buttonList) {
1630
+ return buttonList == null ? void 0 : buttonList.filter((button2) => {
1631
+ var _a, _b;
1632
+ if (button2.actionType === UIComponentsButtonActionType.NATIVE) {
1633
+ return false;
1634
+ } else {
1635
+ if (isPayPayMiniApp() || button2.actionType === UIComponentsButtonActionType.CLOSE) {
1636
+ return true;
1637
+ } else {
1638
+ return (button2 == null ? void 0 : button2.deeplink) && isValidUrl(button2 == null ? void 0 : button2.deeplink) || ((_a = button2 == null ? void 0 : button2.deeplink) == null ? void 0 : _a.startsWith("paypay://embed")) && ((_b = button2 == null ? void 0 : button2.deeplink) == null ? void 0 : _b.includes("?url="));
1639
+ }
1640
+ }
1641
+ });
1642
+ }
1515
1643
  const opaUrl = () => {
1516
1644
  switch (getEnv()) {
1517
1645
  case "staging":
@@ -1528,7 +1656,7 @@ const opaUrl = () => {
1528
1656
  const createHeaderMiniAppApi = (urlEndpoint, customHeaders) => {
1529
1657
  let headers = new Headers(__spreadValues({
1530
1658
  "Content-Type": "application/json",
1531
- "Client-Version": "1.29.0",
1659
+ "Client-Version": "1.30.0",
1532
1660
  "Client-OS-Type": getRuntime()
1533
1661
  }, customHeaders));
1534
1662
  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") {
@@ -21929,6 +22057,11 @@ const _sfc_main$Q = defineComponent({
21929
22057
  type: Array,
21930
22058
  default: () => [2e3, 3e3, 5e3, 1e4, 3e4, 5e4, 1e5],
21931
22059
  required: false
22060
+ },
22061
+ isTopup: {
22062
+ type: Boolean,
22063
+ required: false,
22064
+ default: false
21932
22065
  }
21933
22066
  },
21934
22067
  emits: ["setmoney", "switchinput", "selectmoremoney"],
@@ -21960,7 +22093,7 @@ const _sfc_main$Q = defineComponent({
21960
22093
  };
21961
22094
  const handleSelectMoreClick = (e) => {
21962
22095
  e == null ? void 0 : e.stopPropagation();
21963
- if (isMobile.value) {
22096
+ if (isMobile.value || props.isTopup) {
21964
22097
  emit("selectmoremoney");
21965
22098
  } else {
21966
22099
  state.toggleDropdown = true;
@@ -23117,109 +23250,6 @@ function useAddressControl$1() {
23117
23250
  confirmSelectedAddress
23118
23251
  };
23119
23252
  }
23120
- async function topup$3(queryParams, body) {
23121
- var _a, _b, _c, _d, _e, _f, _g;
23122
- const res = await ppFetch({
23123
- method: "POST",
23124
- url: "web-api/app/v1/payment/topup",
23125
- params: queryParams,
23126
- data: body
23127
- });
23128
- if ("error" in res) {
23129
- return res;
23130
- }
23131
- 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);
23132
- if (isSuccess) {
23133
- saveTopup({
23134
- amount: (_g = (_f = (_e = res.unsigned) == null ? void 0 : _e.data) == null ? void 0 : _f.amount) == null ? void 0 : _g.amount
23135
- });
23136
- }
23137
- return res;
23138
- }
23139
- async function getCashBackInfo() {
23140
- return await ppFetch({
23141
- method: "GET",
23142
- url: "/web-api/app/platform/v1/balance",
23143
- headers: {
23144
- "INTERNAL-CALL": "true"
23145
- }
23146
- });
23147
- }
23148
- async function getAddressByZip(params) {
23149
- return await ppFetch({
23150
- method: "GET",
23151
- url: "web-api/app/v1/addressbyzip",
23152
- params
23153
- });
23154
- }
23155
- async function getAddressList() {
23156
- return ppFetch({
23157
- method: "GET",
23158
- url: "web-api/app/v1/users/addresslist",
23159
- params: {
23160
- type: "PREFERRED"
23161
- }
23162
- });
23163
- }
23164
- async function postAddress(body) {
23165
- return await ppFetch({
23166
- method: "POST",
23167
- url: "web-api/app/v1/users/address",
23168
- data: body
23169
- });
23170
- }
23171
- async function editAddress(body, id) {
23172
- return await ppFetch({
23173
- method: "PUT",
23174
- url: `web-api/app/v1/users/address/${id}`,
23175
- data: body
23176
- });
23177
- }
23178
- async function deleteAddress(id) {
23179
- return await ppFetch({
23180
- method: "DELETE",
23181
- url: `web-api/app/v1/users/address/${id}`
23182
- });
23183
- }
23184
- async function setSelectedAddress(addressId) {
23185
- return ppFetch({
23186
- url: `web-api/app/v1/users/address/selected/${addressId}`,
23187
- method: "PUT"
23188
- });
23189
- }
23190
- async function getUserProfileData() {
23191
- return ppFetch({
23192
- url: "web-api/app/v1/users/profile",
23193
- method: "GET"
23194
- });
23195
- }
23196
- async function registerEmail$1(email) {
23197
- return ppFetch({
23198
- url: "web-api/app/v1/users/email",
23199
- method: "POST",
23200
- data: {
23201
- email
23202
- }
23203
- });
23204
- }
23205
- async function resendEmail() {
23206
- return ppFetch({
23207
- url: "web-api/app/v1/users/resendVerification",
23208
- method: "POST"
23209
- });
23210
- }
23211
- function getUserLocationRequest(params) {
23212
- return ppFetch({
23213
- url: "web-api/app/v1/location",
23214
- method: "GET",
23215
- params: {
23216
- validTimeMinutes: params.validTimeMinutes
23217
- }
23218
- });
23219
- }
23220
- function isValidUrl(urlChallenge) {
23221
- return /^https?:\/\//.test(urlChallenge);
23222
- }
23223
23253
  const root$6 = "_root_122l2_2";
23224
23254
  const title$5 = "_title_122l2_6";
23225
23255
  const container$a = "_container_122l2_13";
@@ -24660,6 +24690,23 @@ function _sfc_render$z(_ctx, _cache, $props, $setup, $data, $options) {
24660
24690
  const cssModules$l = {};
24661
24691
  cssModules$l["$style"] = style0$k;
24662
24692
  var App = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["render", _sfc_render$z], ["__cssModules", cssModules$l]]);
24693
+ function closeApp(params) {
24694
+ var _a;
24695
+ if (params) {
24696
+ reconstructParams(params);
24697
+ }
24698
+ if (isPayPayMiniApp()) {
24699
+ if ((_a = params == null ? void 0 : params.options) == null ? void 0 : _a.deeplink) {
24700
+ window.location.href = params.options.deeplink;
24701
+ } else {
24702
+ window.location.href = "paypay://closeMiniApp";
24703
+ }
24704
+ }
24705
+ setTimeout(function() {
24706
+ var _a2;
24707
+ (_a2 = params == null ? void 0 : params.fail) == null ? void 0 : _a2.call(params, { errorCode: MiniAppErrorType.deeplinkUnavailable });
24708
+ }, 300);
24709
+ }
24663
24710
  function openWebview(params) {
24664
24711
  var _a, _b, _c, _d;
24665
24712
  reconstructParams(params);
@@ -24727,23 +24774,13 @@ function getAuthUrl(redirectUrl) {
24727
24774
  const clientId = (_a = getClientId()) != null ? _a : "";
24728
24775
  return `${authUrl}/portal/auth/mini-app/permission?clientId=${clientId}&redirectUrl=${encodeURIComponent(redirectUrl)}`;
24729
24776
  }
24730
- var UIComponentsButtonActionType;
24731
- (function(UIComponentsButtonActionType2) {
24732
- UIComponentsButtonActionType2["DEEPLINK"] = "DEEPLINK";
24733
- UIComponentsButtonActionType2["CLOSE"] = "CLOSE";
24734
- })(UIComponentsButtonActionType || (UIComponentsButtonActionType = {}));
24735
- var UIComponentsButtonType;
24736
- (function(UIComponentsButtonType2) {
24737
- UIComponentsButtonType2["BLUE"] = "BLUE";
24738
- UIComponentsButtonType2["WHITE"] = "WHITE";
24739
- })(UIComponentsButtonType || (UIComponentsButtonType = {}));
24740
- const errorContainer = "_errorContainer_9pch3_1";
24741
- const errorIcon = "_errorIcon_9pch3_8";
24742
- const unit$2 = "_unit_9pch3_15";
24743
- const errorTitle = "_errorTitle_9pch3_18";
24744
- const subTitle = "_subTitle_9pch3_26";
24745
- const btnContainer$2 = "_btnContainer_9pch3_34";
24746
- const closeBtn = "_closeBtn_9pch3_38";
24777
+ const errorContainer = "_errorContainer_169nl_1";
24778
+ const errorIcon = "_errorIcon_169nl_8";
24779
+ const unit$2 = "_unit_169nl_15";
24780
+ const errorTitle = "_errorTitle_169nl_18";
24781
+ const subTitle = "_subTitle_169nl_26";
24782
+ const btnContainer$2 = "_btnContainer_169nl_34";
24783
+ const closeBtn = "_closeBtn_169nl_38";
24747
24784
  var style0$j = {
24748
24785
  errorContainer,
24749
24786
  errorIcon,
@@ -24793,6 +24830,15 @@ const _sfc_main$y = defineComponent({
24793
24830
  lg: getLanguage()
24794
24831
  };
24795
24832
  },
24833
+ computed: {
24834
+ buttonListData() {
24835
+ return filterErrorButtonList(this.buttonList);
24836
+ },
24837
+ onlyButton() {
24838
+ var _a;
24839
+ return ((_a = this.buttonListData) == null ? void 0 : _a.length) === 1;
24840
+ }
24841
+ },
24796
24842
  methods: {
24797
24843
  buttonClick(buttonInfo) {
24798
24844
  var _a;
@@ -24803,12 +24849,24 @@ const _sfc_main$y = defineComponent({
24803
24849
  const splitUrl = (_a = buttonInfo == null ? void 0 : buttonInfo.deeplink) == null ? void 0 : _a.split("?url=");
24804
24850
  if ((splitUrl == null ? void 0 : splitUrl.length) === 2) {
24805
24851
  openWebviewInternal({ url: splitUrl[1] });
24852
+ } else {
24853
+ closeApp({
24854
+ options: {
24855
+ deeplink: buttonInfo.deeplink
24856
+ }
24857
+ });
24806
24858
  }
24807
24859
  }
24808
24860
  return;
24809
24861
  }
24810
24862
  this.$emit("close-click");
24811
24863
  return;
24864
+ },
24865
+ getButtonType(type) {
24866
+ if (type === UIComponentsButtonType.BLUE || this.onlyButton) {
24867
+ return "primary";
24868
+ }
24869
+ return "link";
24812
24870
  }
24813
24871
  }
24814
24872
  });
@@ -24840,15 +24898,15 @@ function _sfc_render$y(_ctx, _cache, $props, $setup, $data, $options) {
24840
24898
  createBaseVNode("div", {
24841
24899
  class: normalizeClass(_ctx.style.subTitle)
24842
24900
  }, toDisplayString(_ctx.errorText), 3),
24843
- _ctx.buttonList ? (openBlock(), createElementBlock("span", {
24901
+ _ctx.buttonListData ? (openBlock(), createElementBlock("span", {
24844
24902
  key: 1,
24845
24903
  class: normalizeClass(_ctx.style.btnContainer)
24846
24904
  }, [
24847
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.buttonList, (item, index2) => {
24905
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.buttonListData, (item, index2) => {
24848
24906
  return openBlock(), createElementBlock("div", { key: index2 }, [
24849
24907
  createVNode(_component_Button, {
24850
24908
  block: "",
24851
- type: item.buttonType === "BLUE" ? "primary" : "link",
24909
+ type: _ctx.getButtonType(item.buttonType),
24852
24910
  onClick: ($event) => _ctx.buttonClick(item)
24853
24911
  }, {
24854
24912
  default: withCtx(() => [
@@ -26565,7 +26623,8 @@ const _sfc_main$p = defineComponent({
26565
26623
  emits: ["close"],
26566
26624
  setup(props, context) {
26567
26625
  const getButtonType = (type) => {
26568
- if (type === UIComponentsButtonType.BLUE) {
26626
+ var _a;
26627
+ if (type === UIComponentsButtonType.BLUE || ((_a = buttonList == null ? void 0 : buttonList.value) == null ? void 0 : _a.length) === 1) {
26569
26628
  return "primary";
26570
26629
  }
26571
26630
  return "link";
@@ -26579,6 +26638,12 @@ const _sfc_main$p = defineComponent({
26579
26638
  const splitUrl = (_a = buttonInfo == null ? void 0 : buttonInfo.deeplink) == null ? void 0 : _a.split("?url=");
26580
26639
  if ((splitUrl == null ? void 0 : splitUrl.length) === 2) {
26581
26640
  openWebviewInternal({ url: splitUrl[1] });
26641
+ } else {
26642
+ closeApp({
26643
+ options: {
26644
+ deeplink: buttonInfo.deeplink
26645
+ }
26646
+ });
26582
26647
  }
26583
26648
  }
26584
26649
  return;
@@ -26587,14 +26652,7 @@ const _sfc_main$p = defineComponent({
26587
26652
  return;
26588
26653
  };
26589
26654
  const buttonList = computed(() => {
26590
- if (isPayPayMiniApp()) {
26591
- return props.consultInfo.buttonList;
26592
- } else {
26593
- return props.consultInfo.buttonList.filter((button2) => {
26594
- var _a;
26595
- return !((_a = button2.deeplink) == null ? void 0 : _a.startsWith("paypay://"));
26596
- });
26597
- }
26655
+ return filterErrorButtonList(props.consultInfo.buttonList);
26598
26656
  });
26599
26657
  return {
26600
26658
  getButtonType,
@@ -30601,6 +30659,8 @@ const _sfc_main$a = defineComponent({
30601
30659
  }
30602
30660
  this.cashbackData = (_a = cashbackInfo == null ? void 0 : cashbackInfo.data) == null ? void 0 : _a.payload;
30603
30661
  this.inputMoney = 0;
30662
+ this.minAmountUnmet = false;
30663
+ this.maxAmountExceeded = false;
30604
30664
  this.fixBalMoney = (_f = (_e = (_d = (_c = (_b = cashbackInfo == null ? void 0 : cashbackInfo.data) == null ? void 0 : _b.payload) == null ? void 0 : _c.walletSummary) == null ? void 0 : _d.totalBalanceInfo) == null ? void 0 : _e.balance) != null ? _f : 0;
30605
30665
  this.balMoney = formatCurrency(this.inputMoney + this.fixBalMoney, 0);
30606
30666
  this.fixCashbackBalance = (_k = (_j = (_i = (_h = (_g = cashbackInfo == null ? void 0 : cashbackInfo.data) == null ? void 0 : _g.payload) == null ? void 0 : _h.walletSummary) == null ? void 0 : _i.allTotalBalanceInfo) == null ? void 0 : _j.balance) != null ? _k : 0;
@@ -30672,6 +30732,7 @@ const _sfc_main$a = defineComponent({
30672
30732
  setCurrentMoney(price2) {
30673
30733
  this.inputMoney = price2;
30674
30734
  this.isSelectMoreMoney = false;
30735
+ this.checkValidAmount();
30675
30736
  },
30676
30737
  selectPaymentMethod(index2) {
30677
30738
  this.selectPaymentIndex = index2;
@@ -30896,6 +30957,7 @@ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
30896
30957
  isfullheight: !_ctx.isInput,
30897
30958
  small: true,
30898
30959
  class: normalizeClass(_ctx.$style.amountList),
30960
+ "is-topup": true,
30899
30961
  onSetmoney: _ctx.setMoney,
30900
30962
  onSelectmoremoney: _ctx.selectMoreMoney,
30901
30963
  onSwitchinput: _ctx.switchInput
@@ -30961,7 +31023,7 @@ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
30961
31023
  createVNode(_component_Button, {
30962
31024
  type: "primary",
30963
31025
  block: "",
30964
- disabled: _ctx.disablePaymentBtn || _ctx.loading,
31026
+ disabled: _ctx.disablePaymentBtn || _ctx.loading || _ctx.inputMoney == 0,
30965
31027
  loading: _ctx.loading,
30966
31028
  "data-test": "click-topup",
30967
31029
  onClick: _cache[4] || (_cache[4] = ($event) => _ctx.clickTopup(false))
@@ -31138,23 +31200,6 @@ function topup$1(params) {
31138
31200
  reconstructParams(params);
31139
31201
  initTopup(params);
31140
31202
  }
31141
- function closeApp(params) {
31142
- var _a;
31143
- if (params) {
31144
- reconstructParams(params);
31145
- }
31146
- if (isPayPayMiniApp()) {
31147
- if ((_a = params == null ? void 0 : params.options) == null ? void 0 : _a.deeplink) {
31148
- window.location.href = params.options.deeplink;
31149
- } else {
31150
- window.location.href = "paypay://closeMiniApp";
31151
- }
31152
- }
31153
- setTimeout(function() {
31154
- var _a2;
31155
- (_a2 = params == null ? void 0 : params.fail) == null ? void 0 : _a2.call(params, { errorCode: MiniAppErrorType.deeplinkUnavailable });
31156
- }, 300);
31157
- }
31158
31203
  var App_vue_vue_type_style_index_0_scoped_true_lang$1 = "";
31159
31204
  const _sfc_main$9 = defineComponent({
31160
31205
  components: {
@@ -32230,7 +32275,7 @@ function debug(params) {
32230
32275
  function execute$5(params) {
32231
32276
  var _a;
32232
32277
  (_a = params == null ? void 0 : params.success) == null ? void 0 : _a.call(params, {
32233
- v: "1.29.0"
32278
+ v: "1.30.0"
32234
32279
  });
32235
32280
  }
32236
32281
  function useCallBack(props, ctx) {