@paypay/mini-app-js-sdk 1.32.0 → 1.33.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.32.0";
69
- this.revision = "19afd4b";
68
+ this.version = "1.33.0";
69
+ this.revision = "9441111";
70
70
  this.messageHandlers = new Map();
71
71
  this.responseCallbacks = new Map();
72
72
  this.global = global2;
@@ -1657,7 +1657,7 @@ const opaUrl = () => {
1657
1657
  const createHeaderMiniAppApi = (urlEndpoint, customHeaders) => {
1658
1658
  let headers = new Headers(__spreadValues({
1659
1659
  "Content-Type": "application/json",
1660
- "Client-Version": "1.32.0",
1660
+ "Client-Version": "1.33.0",
1661
1661
  "Client-OS-Type": getRuntime()
1662
1662
  }, customHeaders));
1663
1663
  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") {
@@ -1976,344 +1976,6 @@ async function execute$c(params) {
1976
1976
  (_f = params == null ? void 0 : params.fail) == null ? void 0 : _f.call(params, { errorCode: MiniAppErrorType.serverError });
1977
1977
  }
1978
1978
  }
1979
- async function init(params) {
1980
- reconstructParams(params);
1981
- await execute$b(params);
1982
- }
1983
- async function execute$b(params) {
1984
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1985
- try {
1986
- saveEnv((_a = params == null ? void 0 : params.env) != null ? _a : "");
1987
- saveClientId((_b = params == null ? void 0 : params.clientId) != null ? _b : "");
1988
- const appVersion = getAppVersion();
1989
- if (appVersion) {
1990
- if (semVerCompare("2.69.0", appVersion)) {
1991
- setTimeout(fixDeprecatedCloseApp, 1e4);
1992
- const jsBridge2 = new JsBridge(window);
1993
- return jsBridge2.callNative("showUpdateWarning", {
1994
- isMandatory: true
1995
- });
1996
- }
1997
- }
1998
- const urlParams = new URLSearchParams(window.location.search);
1999
- let token = urlParams == null ? void 0 : urlParams.get("token");
2000
- if (!token || token.length < 1) {
2001
- token = urlParams == null ? void 0 : urlParams.get("one_time_token");
2002
- if (!token || token.length < 1) {
2003
- return checkAccessToken({
2004
- success: params.success,
2005
- fail: params.fail
2006
- });
2007
- }
2008
- }
2009
- urlParams.delete("token");
2010
- urlParams.delete("one_time_token");
2011
- const newUrlParams = urlParams.toString().length ? "?" + urlParams.toString() : "";
2012
- const newUrl = location.pathname + newUrlParams + location.hash;
2013
- history.replaceState(null, "", newUrl);
2014
- const res = await ppFetch({
2015
- method: "POST",
2016
- url: "web-api/app/token/v1/issue",
2017
- data: { ott: token, opaClientId: params == null ? void 0 : params.clientId }
2018
- });
2019
- if (!res || "error" in res) {
2020
- throw Error();
2021
- }
2022
- if (((_c = res == null ? void 0 : res.resultInfo) == null ? void 0 : _c.code) === "SUCCESS") {
2023
- const appDetailResult = await initAppDetail((_e = (_d = res == null ? void 0 : res.data) == null ? void 0 : _d.accessToken) != null ? _e : "");
2024
- if (!appDetailResult) {
2025
- throw Error();
2026
- }
2027
- saveEnv((_f = params == null ? void 0 : params.env) != null ? _f : "");
2028
- saveAccessToken((_h = (_g = res == null ? void 0 : res.data) == null ? void 0 : _g.accessToken) != null ? _h : "");
2029
- saveRefreshToken((_j = (_i = res == null ? void 0 : res.data) == null ? void 0 : _i.refreshToken) != null ? _j : "");
2030
- saveUserData();
2031
- saveClientId((_k = params == null ? void 0 : params.clientId) != null ? _k : "");
2032
- const configResult = await initAppConfiguration();
2033
- if (!configResult) {
2034
- throw Error();
2035
- }
2036
- } else {
2037
- throw Error();
2038
- }
2039
- } catch (_) {
2040
- failedAuth(params, MiniAppErrorType.serverError);
2041
- return;
2042
- }
2043
- (_l = params == null ? void 0 : params.success) == null ? void 0 : _l.call(params, {
2044
- statusCode: MiniAppStatusType.initialized
2045
- });
2046
- }
2047
- function fixDeprecatedCloseApp() {
2048
- const jsBridge2 = new JsBridge(window);
2049
- jsBridge2.callNative("closeApp", {});
2050
- setTimeout(fixDeprecatedCloseApp, 500);
2051
- }
2052
- function failedAuth(params, errorCode) {
2053
- var _a;
2054
- (_a = params == null ? void 0 : params.fail) == null ? void 0 : _a.call(params, { errorCode });
2055
- }
2056
- function saveUserData() {
2057
- getUserProfile({
2058
- success: (res) => {
2059
- saveUserInfo(JSON.stringify({
2060
- avatarUrl: res == null ? void 0 : res.avatarUrl,
2061
- nickName: res == null ? void 0 : res.nickName
2062
- }));
2063
- }
2064
- }).catch(() => {
2065
- });
2066
- }
2067
- function copyToClipboard(params) {
2068
- var _a, _b;
2069
- reconstructParams(params);
2070
- let textarea = document.createElement("textarea");
2071
- textarea.setAttribute("readonly", "true");
2072
- textarea.setAttribute("contenteditable", "true");
2073
- textarea.value = params.value;
2074
- document.body.appendChild(textarea);
2075
- textarea.select();
2076
- textarea.setSelectionRange(0, textarea.value.length);
2077
- const result2 = document.execCommand("copy");
2078
- document.body.removeChild(textarea);
2079
- result2 ? (_a = params == null ? void 0 : params.success) == null ? void 0 : _a.call(params) : (_b = params == null ? void 0 : params.fail) == null ? void 0 : _b.call(params, { errorCode: MiniAppErrorType.other });
2080
- }
2081
- var PermissionStatus;
2082
- (function(PermissionStatus2) {
2083
- PermissionStatus2["granted"] = "GRANTED";
2084
- PermissionStatus2["denied"] = "DENIED";
2085
- })(PermissionStatus || (PermissionStatus = {}));
2086
- const PermissionName = {
2087
- mini_app_payment_balance: "mini_app_payment_balance",
2088
- mini_app_device_info: "mini_app_device_info",
2089
- mini_app_user_contacts: "mini_app_user_contacts",
2090
- mini_app_device_battery: "mini_app_device_battery",
2091
- mini_app_kyc: "mini_app_kyc",
2092
- mini_app_user_location: "mini_app_user_location",
2093
- mini_app_check_payment_method: "mini_app_check_payment_method",
2094
- cashback: "cashback",
2095
- bank_registration: "bank_registration",
2096
- mini_app_user_email_address: "mini_app_user_email_address",
2097
- mini_app_user_address: "mini_app_user_address",
2098
- mini_app_user_phone_camera: "mini_app_user_phone_camera",
2099
- mini_app_user_phone_album: "mini_app_user_phone_album"
2100
- };
2101
- const checkPermission = async (permissionNames) => {
2102
- var _a;
2103
- if ((_a = getAppDetail()) == null ? void 0 : _a.isInternal) {
2104
- return PermissionStatus.granted;
2105
- }
2106
- const resPermission = await getUserGrantedPermission();
2107
- permissionNames = Array.isArray(permissionNames) ? permissionNames : [permissionNames];
2108
- for (const permissionName of permissionNames) {
2109
- if (!(resPermission == null ? void 0 : resPermission.find((name) => name === permissionName))) {
2110
- return PermissionStatus.denied;
2111
- }
2112
- }
2113
- return PermissionStatus.granted;
2114
- };
2115
- async function getUserGrantedPermission() {
2116
- var _a, _b, _c;
2117
- const response = await ppFetch({
2118
- method: "GET",
2119
- url: "web-api/app/v1/users/permissions/granted"
2120
- });
2121
- return (_c = (_b = (_a = response == null ? void 0 : response.unsigned) == null ? void 0 : _a.data) == null ? void 0 : _b.scopes) != null ? _c : [];
2122
- }
2123
- async function getBalance(params) {
2124
- reconstructParams(params);
2125
- await execute$a(params);
2126
- }
2127
- async function execute$a(params) {
2128
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2129
- try {
2130
- const grantStatus = await checkPermission(PermissionName.mini_app_payment_balance);
2131
- if (grantStatus !== PermissionStatus.granted) {
2132
- return (_a = params == null ? void 0 : params.fail) == null ? void 0 : _a.call(params, { errorCode: MiniAppErrorType.insufficientScope });
2133
- }
2134
- const payload = { currency: "JPY" };
2135
- payload.merchant = params.merchant;
2136
- payload.productType = params.productType;
2137
- payload.sourceInfoApp = params.sourceInfoApp;
2138
- const res = await ppFetch({
2139
- method: "GET",
2140
- url: "web-api/app/v1/payment/balance",
2141
- params: payload
2142
- });
2143
- if (!res || "error" in res) {
2144
- return (_b = params == null ? void 0 : params.fail) == null ? void 0 : _b.call(params, { errorCode: MiniAppErrorType.serverError });
2145
- }
2146
- if (((_d = (_c = res == null ? void 0 : res.unsigned) == null ? void 0 : _c.resultInfo) == null ? void 0 : _d.code) === "SUCCESS") {
2147
- 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;
2148
- return (_h = params == null ? void 0 : params.success) == null ? void 0 : _h.call(params, { balance: newBalance });
2149
- }
2150
- } finally {
2151
- }
2152
- return (_i = params == null ? void 0 : params.fail) == null ? void 0 : _i.call(params, { errorCode: MiniAppErrorType.serverError });
2153
- }
2154
- async function getKycInformation(params) {
2155
- reconstructParams(params);
2156
- await execute$9(params);
2157
- }
2158
- async function execute$9(params) {
2159
- var _a, _b, _c, _d, _e, _f, _g, _h;
2160
- try {
2161
- const grantStatus = await checkPermission(PermissionName.mini_app_kyc);
2162
- if (grantStatus !== PermissionStatus.granted) {
2163
- return (_a = params == null ? void 0 : params.fail) == null ? void 0 : _a.call(params, { errorCode: MiniAppErrorType.insufficientScope });
2164
- }
2165
- const res = await ppFetch2({
2166
- method: "GET",
2167
- url: "web-api/app/v2/users/kyc",
2168
- params: {
2169
- type: params.type,
2170
- eKycDocuments: (_b = params.eKycDocuments) == null ? void 0 : _b.toString()
2171
- }
2172
- });
2173
- if (res.ppFetchResult !== "success") {
2174
- return (_c = params == null ? void 0 : params.fail) == null ? void 0 : _c.call(params, { errorCode: MiniAppErrorType.serverError });
2175
- }
2176
- if ((_d = res.body.unsigned) == null ? void 0 : _d.data) {
2177
- let response = res.body.unsigned.data;
2178
- response.jws = (_e = res.body.signed) == null ? void 0 : _e.jws;
2179
- return (_f = params == null ? void 0 : params.success) == null ? void 0 : _f.call(params, response);
2180
- } else {
2181
- return (_g = params == null ? void 0 : params.fail) == null ? void 0 : _g.call(params, { errorCode: MiniAppErrorType.serverError });
2182
- }
2183
- } catch {
2184
- return (_h = params == null ? void 0 : params.fail) == null ? void 0 : _h.call(params, { errorCode: MiniAppErrorType.serverError });
2185
- }
2186
- }
2187
- async function getPermissionStatus(params) {
2188
- reconstructParams(params);
2189
- await execute$8(params);
2190
- }
2191
- async function execute$8(params) {
2192
- var _a, _b, _c, _d;
2193
- try {
2194
- const permissionList = await getUserGrantedPermission();
2195
- if (!permissionList) {
2196
- return (_a = params == null ? void 0 : params.fail) == null ? void 0 : _a.call(params, { errorCode: MiniAppErrorType.serverError });
2197
- }
2198
- if (!(params == null ? void 0 : params.name)) {
2199
- return (_b = params == null ? void 0 : params.success) == null ? void 0 : _b.call(params, {
2200
- granted_permissions: permissionList
2201
- });
2202
- } else {
2203
- const thePermission = permissionList == null ? void 0 : permissionList.find((name) => {
2204
- return name === (params == null ? void 0 : params.name);
2205
- });
2206
- const status2 = thePermission ? PermissionStatus.granted : PermissionStatus.denied;
2207
- return (_c = params == null ? void 0 : params.success) == null ? void 0 : _c.call(params, { status: status2 });
2208
- }
2209
- } catch (_) {
2210
- return (_d = params == null ? void 0 : params.fail) == null ? void 0 : _d.call(params, { errorCode: MiniAppErrorType.serverError });
2211
- }
2212
- }
2213
- function useGetHeights() {
2214
- const agents = navigator.userAgent;
2215
- const heights = {
2216
- statusBarHeight: 0,
2217
- navBarHeight: 0,
2218
- bottomHeight: 0,
2219
- isNative: false
2220
- };
2221
- agents.split(" ").forEach((property2) => {
2222
- if (/Offset.*/.test(property2)) {
2223
- const offsetString = property2 == null ? void 0 : property2.split("/")[1];
2224
- const offsets = offsetString == null ? void 0 : offsetString.split(";");
2225
- heights.isNative = true;
2226
- if (offsets.length !== 3)
2227
- return;
2228
- heights.statusBarHeight = parseInt(offsets[0], 10);
2229
- heights.navBarHeight = parseInt(offsets[1], 10);
2230
- heights.bottomHeight = parseInt(offsets[2], 10);
2231
- }
2232
- });
2233
- return heights;
2234
- }
2235
- function useGetHeightProperties() {
2236
- var _a;
2237
- const { navBarHeight, statusBarHeight, bottomHeight, isNative } = useGetHeights();
2238
- const detail = getAppDetail();
2239
- const navigationStyle = (_a = detail == null ? void 0 : detail.window) == null ? void 0 : _a.navigationStyle;
2240
- const isDefault = navigationStyle === "default";
2241
- const isNone = navigationStyle === "none";
2242
- const isCustom = navigationStyle === "custom";
2243
- const bottomHeightProperty = `${bottomHeight}px`;
2244
- let innerHeightProperty = `calc(100vh - ${bottomHeight}px)`;
2245
- let fullFillHeightProperty = innerHeightProperty;
2246
- let headerHeight = 0;
2247
- if (navigationStyle === "custom") {
2248
- headerHeight = statusBarHeight + navBarHeight;
2249
- innerHeightProperty = `calc(100vh - ${bottomHeight}px - ${headerHeight}px)`;
2250
- fullFillHeightProperty = `calc(100vh - ${bottomHeight}px - ${headerHeight}px)`;
2251
- } else if (navigationStyle === "none") {
2252
- headerHeight = statusBarHeight;
2253
- innerHeightProperty = `calc(100vh - ${bottomHeight}px - ${headerHeight}px)`;
2254
- }
2255
- return {
2256
- innerHeightProperty,
2257
- bottomHeightProperty,
2258
- fullFillHeightProperty,
2259
- headerHeight,
2260
- navBarHeight,
2261
- statusBarHeight,
2262
- bottomHeight,
2263
- isNone,
2264
- isCustom,
2265
- isDefault,
2266
- isNative
2267
- };
2268
- }
2269
- function getTopBarHeight(params) {
2270
- var _a;
2271
- reconstructParams(params);
2272
- const { headerHeight } = useGetHeightProperties();
2273
- (_a = params == null ? void 0 : params.success) == null ? void 0 : _a.call(params, { height: headerHeight });
2274
- }
2275
- async function getPlatformInformation(params) {
2276
- reconstructParams(params);
2277
- await execute$7(params);
2278
- }
2279
- async function execute$7(params) {
2280
- var _a, _b;
2281
- let sdkVersion = null;
2282
- let preferredLanguage = getPayPayLanguage();
2283
- const appVersion = getAppVersion();
2284
- if (appVersion) {
2285
- try {
2286
- const response = await fetch("https://static.paypay.ne.jp/libs/mini-app-js-sdk/versions.json");
2287
- const res = await response.json();
2288
- Object.keys(res == null ? void 0 : res.app).forEach(function(key) {
2289
- var _a2;
2290
- if (!semVerCompare(key, appVersion)) {
2291
- sdkVersion = (_a2 = res == null ? void 0 : res.app[key]) == null ? void 0 : _a2.jsSdkSupport;
2292
- } else {
2293
- return;
2294
- }
2295
- });
2296
- } catch (_) {
2297
- return (_a = params == null ? void 0 : params.fail) == null ? void 0 : _a.call(params, { errorCode: MiniAppErrorType.serverError });
2298
- }
2299
- }
2300
- (_b = params == null ? void 0 : params.success) == null ? void 0 : _b.call(params, {
2301
- appVersion,
2302
- sdkVersion,
2303
- preferredLanguage
2304
- });
2305
- }
2306
- function getDeviceInformation(params) {
2307
- reconstructParams(params);
2308
- execute$6(params);
2309
- }
2310
- function execute$6(params) {
2311
- var _a;
2312
- const runtime = getRuntime();
2313
- (_a = params == null ? void 0 : params.success) == null ? void 0 : _a.call(params, {
2314
- os: runtime === MiniAppRuntime.web ? navigator.platform : runtime.toLowerCase()
2315
- });
2316
- }
2317
1979
  function makeMap(str, expectsLowerCase) {
2318
1980
  const map = Object.create(null);
2319
1981
  const list2 = str.split(",");
@@ -7435,6 +7097,579 @@ function normalizeContainer(container2) {
7435
7097
  }
7436
7098
  return container2;
7437
7099
  }
7100
+ function onMountedOrActivated(hook) {
7101
+ let mounted;
7102
+ onMounted(() => {
7103
+ hook();
7104
+ nextTick(() => {
7105
+ mounted = true;
7106
+ }).catch(() => {
7107
+ });
7108
+ });
7109
+ onActivated(() => {
7110
+ if (mounted) {
7111
+ hook();
7112
+ }
7113
+ });
7114
+ }
7115
+ function useEventListener(type, listener, options = {}) {
7116
+ const { target = window, passive = false, capture = false } = options;
7117
+ let attached;
7118
+ const add2 = () => {
7119
+ const element = unref(target);
7120
+ if (element && !attached) {
7121
+ element.addEventListener(type, listener, capture);
7122
+ attached = true;
7123
+ }
7124
+ };
7125
+ const remove2 = () => {
7126
+ const element = unref(target);
7127
+ if (element && attached) {
7128
+ element.removeEventListener(type, listener, capture);
7129
+ attached = false;
7130
+ }
7131
+ };
7132
+ onUnmounted(remove2);
7133
+ onDeactivated(remove2);
7134
+ onMountedOrActivated(add2);
7135
+ }
7136
+ const HORIZONTAL_SCROLL_KEY = "horizontal-scroll";
7137
+ class StopPropagation$1 {
7138
+ constructor(el) {
7139
+ this.el = el;
7140
+ this.executer = (e) => {
7141
+ const el2 = this.el;
7142
+ if (el2.scrollLeft === 0) {
7143
+ el2.scrollTo(1, 0);
7144
+ } else if (this.prevent) {
7145
+ el2.scrollTo(el2.scrollLeft - 1, 0);
7146
+ }
7147
+ e.stopPropagation();
7148
+ };
7149
+ this.move = (e) => {
7150
+ if (this.prevent && e.cancelable)
7151
+ e.preventDefault();
7152
+ e.stopPropagation();
7153
+ };
7154
+ }
7155
+ get prevent() {
7156
+ const el = this.el;
7157
+ const prevent = el.scrollWidth - el.scrollLeft === el.clientWidth;
7158
+ return prevent;
7159
+ }
7160
+ }
7161
+ const useHorizontalScrollDirective = {
7162
+ mounted: function(el) {
7163
+ const stopInstance = new StopPropagation$1(el);
7164
+ el.addEventListener("touchstart", stopInstance.executer, { passive: true });
7165
+ el.addEventListener("touchend", stopInstance.executer, { passive: true });
7166
+ el.addEventListener("touchmove", stopInstance.move);
7167
+ }
7168
+ };
7169
+ const VERTICAL_SCROLL_KEY = "vertical-scroll";
7170
+ class StopPropagation {
7171
+ constructor(el) {
7172
+ this.el = el;
7173
+ this.executer = (e) => {
7174
+ const el2 = this.el;
7175
+ if (el2.scrollTop === 0) {
7176
+ el2.scrollTo(0, 1);
7177
+ } else if (this.prevent) {
7178
+ el2.scrollTo(0, el2.scrollTop - 1);
7179
+ }
7180
+ e.stopPropagation();
7181
+ };
7182
+ this.move = (e) => {
7183
+ if (this.prevent)
7184
+ e.preventDefault();
7185
+ e.stopPropagation();
7186
+ };
7187
+ }
7188
+ get prevent() {
7189
+ const el = this.el;
7190
+ const scrollHeight = el.scrollHeight - el.scrollTop;
7191
+ const clientHeight = el.clientHeight;
7192
+ const prevent = clientHeight - 1 < scrollHeight && scrollHeight < clientHeight + 1;
7193
+ return prevent;
7194
+ }
7195
+ }
7196
+ const useVerticalScrollDirective = {
7197
+ mounted: function(el) {
7198
+ const stopInstance = new StopPropagation(el);
7199
+ el.addEventListener("touchstart", stopInstance.executer, { passive: true });
7200
+ el.addEventListener("touchend", stopInstance.executer, { passive: true });
7201
+ el.addEventListener("touchmove", stopInstance.move);
7202
+ }
7203
+ };
7204
+ let prev = Date.now();
7205
+ function rafPolyfill(fn) {
7206
+ const curr = Date.now();
7207
+ const ms = Math.max(0, 16 - (curr - prev));
7208
+ const id = setTimeout(fn, ms);
7209
+ prev = curr + ms;
7210
+ return id;
7211
+ }
7212
+ function raf(fn) {
7213
+ const requestAnimationFrame2 = window.requestAnimationFrame || rafPolyfill;
7214
+ return requestAnimationFrame2.call(window, fn);
7215
+ }
7216
+ function cancelRaf(id) {
7217
+ const cancelAnimationFrame2 = window.cancelAnimationFrame || window.clearTimeout;
7218
+ cancelAnimationFrame2.call(window, id);
7219
+ }
7220
+ const SECOND = 1e3;
7221
+ const MINUTE = 60 * SECOND;
7222
+ const HOUR = 60 * MINUTE;
7223
+ const DAY = 24 * HOUR;
7224
+ function parseTime(time2) {
7225
+ const days = Math.floor(time2 / DAY);
7226
+ const hours = Math.floor(time2 % DAY / HOUR);
7227
+ const minutes = Math.floor(time2 % HOUR / MINUTE);
7228
+ const seconds = Math.floor(time2 % MINUTE / SECOND);
7229
+ const milliseconds = Math.floor(time2 % SECOND);
7230
+ return {
7231
+ total: time2,
7232
+ days,
7233
+ hours,
7234
+ minutes,
7235
+ seconds,
7236
+ milliseconds
7237
+ };
7238
+ }
7239
+ function isSameSecond(time1, time2) {
7240
+ return Math.floor(time1 / 1e3) === Math.floor(time2 / 1e3);
7241
+ }
7242
+ function useCountDown(options) {
7243
+ let rafId;
7244
+ let endTime;
7245
+ let counting;
7246
+ let deactivated;
7247
+ const remain = ref(options.time);
7248
+ const current = computed(() => parseTime(remain.value));
7249
+ const pause = () => {
7250
+ counting = false;
7251
+ cancelRaf(rafId);
7252
+ };
7253
+ const getCurrentRemain = () => Math.max(endTime - Date.now(), 0);
7254
+ const setRemain = (value2) => {
7255
+ var _a, _b;
7256
+ remain.value = value2;
7257
+ (_a = options.onChange) == null ? void 0 : _a.call(options, current.value);
7258
+ if (value2 === 0) {
7259
+ pause();
7260
+ (_b = options.onFinish) == null ? void 0 : _b.call(options);
7261
+ }
7262
+ };
7263
+ const microTick = () => {
7264
+ rafId = raf(() => {
7265
+ if (counting) {
7266
+ setRemain(getCurrentRemain());
7267
+ if (remain.value > 0) {
7268
+ microTick();
7269
+ }
7270
+ }
7271
+ });
7272
+ };
7273
+ const macroTick = () => {
7274
+ rafId = raf(() => {
7275
+ if (counting) {
7276
+ const remainRemain = getCurrentRemain();
7277
+ if (!isSameSecond(remainRemain, remain.value) || remainRemain === 0) {
7278
+ setRemain(remainRemain);
7279
+ }
7280
+ if (remain.value > 0) {
7281
+ macroTick();
7282
+ }
7283
+ }
7284
+ });
7285
+ };
7286
+ const tick = () => {
7287
+ if (options.millisecond) {
7288
+ microTick();
7289
+ } else {
7290
+ macroTick();
7291
+ }
7292
+ };
7293
+ const start = () => {
7294
+ if (!counting) {
7295
+ endTime = Date.now() + remain.value;
7296
+ counting = true;
7297
+ tick();
7298
+ }
7299
+ };
7300
+ const reset2 = (totalTime = options.time) => {
7301
+ pause();
7302
+ remain.value = totalTime;
7303
+ };
7304
+ onBeforeUnmount(pause);
7305
+ onActivated(() => {
7306
+ if (deactivated) {
7307
+ counting = true;
7308
+ deactivated = false;
7309
+ tick();
7310
+ }
7311
+ });
7312
+ onDeactivated(() => {
7313
+ if (counting) {
7314
+ pause();
7315
+ deactivated = true;
7316
+ }
7317
+ });
7318
+ return {
7319
+ start,
7320
+ pause,
7321
+ reset: reset2,
7322
+ current
7323
+ };
7324
+ }
7325
+ const OTTLoginState = reactive({
7326
+ isJustLoggedIn: false,
7327
+ setLoginState(value2) {
7328
+ this.isJustLoggedIn = value2;
7329
+ }
7330
+ });
7331
+ async function init(params) {
7332
+ reconstructParams(params);
7333
+ await execute$b(params);
7334
+ }
7335
+ async function execute$b(params) {
7336
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
7337
+ try {
7338
+ saveEnv((_a = params == null ? void 0 : params.env) != null ? _a : "");
7339
+ saveClientId((_b = params == null ? void 0 : params.clientId) != null ? _b : "");
7340
+ const appVersion = getAppVersion();
7341
+ if (appVersion) {
7342
+ if (semVerCompare("2.69.0", appVersion)) {
7343
+ setTimeout(fixDeprecatedCloseApp, 1e4);
7344
+ const jsBridge2 = new JsBridge(window);
7345
+ return jsBridge2.callNative("showUpdateWarning", {
7346
+ isMandatory: true
7347
+ });
7348
+ }
7349
+ }
7350
+ const urlParams = new URLSearchParams(window.location.search);
7351
+ let token = urlParams == null ? void 0 : urlParams.get("token");
7352
+ if (!token || token.length < 1) {
7353
+ token = urlParams == null ? void 0 : urlParams.get("one_time_token");
7354
+ if (!token || token.length < 1) {
7355
+ return checkAccessToken({
7356
+ success: params.success,
7357
+ fail: params.fail
7358
+ });
7359
+ }
7360
+ }
7361
+ urlParams.delete("token");
7362
+ urlParams.delete("one_time_token");
7363
+ const newUrlParams = urlParams.toString().length ? "?" + urlParams.toString() : "";
7364
+ const newUrl = location.pathname + newUrlParams + location.hash;
7365
+ history.replaceState(null, "", newUrl);
7366
+ const res = await ppFetch({
7367
+ method: "POST",
7368
+ url: "web-api/app/token/v1/issue",
7369
+ data: { ott: token, opaClientId: params == null ? void 0 : params.clientId }
7370
+ });
7371
+ if (!res || "error" in res) {
7372
+ throw Error();
7373
+ }
7374
+ if (((_c = res == null ? void 0 : res.resultInfo) == null ? void 0 : _c.code) === "SUCCESS") {
7375
+ const appDetailResult = await initAppDetail((_e = (_d = res == null ? void 0 : res.data) == null ? void 0 : _d.accessToken) != null ? _e : "");
7376
+ if (!appDetailResult) {
7377
+ throw Error();
7378
+ }
7379
+ saveEnv((_f = params == null ? void 0 : params.env) != null ? _f : "");
7380
+ saveAccessToken((_h = (_g = res == null ? void 0 : res.data) == null ? void 0 : _g.accessToken) != null ? _h : "");
7381
+ saveRefreshToken((_j = (_i = res == null ? void 0 : res.data) == null ? void 0 : _i.refreshToken) != null ? _j : "");
7382
+ OTTLoginState.setLoginState(true);
7383
+ setTimeout(() => {
7384
+ OTTLoginState.setLoginState(false);
7385
+ }, 5e3);
7386
+ saveUserData();
7387
+ saveClientId((_k = params == null ? void 0 : params.clientId) != null ? _k : "");
7388
+ const configResult = await initAppConfiguration();
7389
+ if (!configResult) {
7390
+ throw Error();
7391
+ }
7392
+ } else {
7393
+ throw Error();
7394
+ }
7395
+ } catch (_) {
7396
+ failedAuth(params, MiniAppErrorType.serverError);
7397
+ return;
7398
+ }
7399
+ (_l = params == null ? void 0 : params.success) == null ? void 0 : _l.call(params, {
7400
+ statusCode: MiniAppStatusType.initialized
7401
+ });
7402
+ }
7403
+ function fixDeprecatedCloseApp() {
7404
+ const jsBridge2 = new JsBridge(window);
7405
+ jsBridge2.callNative("closeApp", {});
7406
+ setTimeout(fixDeprecatedCloseApp, 500);
7407
+ }
7408
+ function failedAuth(params, errorCode) {
7409
+ var _a;
7410
+ (_a = params == null ? void 0 : params.fail) == null ? void 0 : _a.call(params, { errorCode });
7411
+ }
7412
+ function saveUserData() {
7413
+ getUserProfile({
7414
+ success: (res) => {
7415
+ saveUserInfo(JSON.stringify({
7416
+ avatarUrl: res == null ? void 0 : res.avatarUrl,
7417
+ nickName: res == null ? void 0 : res.nickName
7418
+ }));
7419
+ }
7420
+ }).catch(() => {
7421
+ });
7422
+ }
7423
+ function copyToClipboard(params) {
7424
+ var _a, _b;
7425
+ reconstructParams(params);
7426
+ let textarea = document.createElement("textarea");
7427
+ textarea.setAttribute("readonly", "true");
7428
+ textarea.setAttribute("contenteditable", "true");
7429
+ textarea.value = params.value;
7430
+ document.body.appendChild(textarea);
7431
+ textarea.select();
7432
+ textarea.setSelectionRange(0, textarea.value.length);
7433
+ const result2 = document.execCommand("copy");
7434
+ document.body.removeChild(textarea);
7435
+ result2 ? (_a = params == null ? void 0 : params.success) == null ? void 0 : _a.call(params) : (_b = params == null ? void 0 : params.fail) == null ? void 0 : _b.call(params, { errorCode: MiniAppErrorType.other });
7436
+ }
7437
+ var PermissionStatus;
7438
+ (function(PermissionStatus2) {
7439
+ PermissionStatus2["granted"] = "GRANTED";
7440
+ PermissionStatus2["denied"] = "DENIED";
7441
+ })(PermissionStatus || (PermissionStatus = {}));
7442
+ const PermissionName = {
7443
+ mini_app_payment_balance: "mini_app_payment_balance",
7444
+ mini_app_device_info: "mini_app_device_info",
7445
+ mini_app_user_contacts: "mini_app_user_contacts",
7446
+ mini_app_device_battery: "mini_app_device_battery",
7447
+ mini_app_kyc: "mini_app_kyc",
7448
+ mini_app_user_location: "mini_app_user_location",
7449
+ mini_app_check_payment_method: "mini_app_check_payment_method",
7450
+ cashback: "cashback",
7451
+ bank_registration: "bank_registration",
7452
+ mini_app_user_email_address: "mini_app_user_email_address",
7453
+ mini_app_user_address: "mini_app_user_address",
7454
+ mini_app_user_phone_camera: "mini_app_user_phone_camera",
7455
+ mini_app_user_phone_album: "mini_app_user_phone_album"
7456
+ };
7457
+ const checkPermission = async (permissionNames) => {
7458
+ var _a;
7459
+ if ((_a = getAppDetail()) == null ? void 0 : _a.isInternal) {
7460
+ return PermissionStatus.granted;
7461
+ }
7462
+ const resPermission = await getUserGrantedPermission();
7463
+ permissionNames = Array.isArray(permissionNames) ? permissionNames : [permissionNames];
7464
+ for (const permissionName of permissionNames) {
7465
+ if (!(resPermission == null ? void 0 : resPermission.find((name) => name === permissionName))) {
7466
+ return PermissionStatus.denied;
7467
+ }
7468
+ }
7469
+ return PermissionStatus.granted;
7470
+ };
7471
+ async function getUserGrantedPermission() {
7472
+ var _a, _b, _c;
7473
+ const response = await ppFetch({
7474
+ method: "GET",
7475
+ url: "web-api/app/v1/users/permissions/granted"
7476
+ });
7477
+ return (_c = (_b = (_a = response == null ? void 0 : response.unsigned) == null ? void 0 : _a.data) == null ? void 0 : _b.scopes) != null ? _c : [];
7478
+ }
7479
+ async function getBalance(params) {
7480
+ reconstructParams(params);
7481
+ await execute$a(params);
7482
+ }
7483
+ async function execute$a(params) {
7484
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
7485
+ try {
7486
+ const grantStatus = await checkPermission(PermissionName.mini_app_payment_balance);
7487
+ if (grantStatus !== PermissionStatus.granted) {
7488
+ return (_a = params == null ? void 0 : params.fail) == null ? void 0 : _a.call(params, { errorCode: MiniAppErrorType.insufficientScope });
7489
+ }
7490
+ const payload = { currency: "JPY" };
7491
+ payload.merchant = params.merchant;
7492
+ payload.productType = params.productType;
7493
+ payload.sourceInfoApp = params.sourceInfoApp;
7494
+ const res = await ppFetch({
7495
+ method: "GET",
7496
+ url: "web-api/app/v1/payment/balance",
7497
+ params: payload
7498
+ });
7499
+ if (!res || "error" in res) {
7500
+ return (_b = params == null ? void 0 : params.fail) == null ? void 0 : _b.call(params, { errorCode: MiniAppErrorType.serverError });
7501
+ }
7502
+ if (((_d = (_c = res == null ? void 0 : res.unsigned) == null ? void 0 : _c.resultInfo) == null ? void 0 : _d.code) === "SUCCESS") {
7503
+ 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;
7504
+ return (_h = params == null ? void 0 : params.success) == null ? void 0 : _h.call(params, { balance: newBalance });
7505
+ }
7506
+ } finally {
7507
+ }
7508
+ return (_i = params == null ? void 0 : params.fail) == null ? void 0 : _i.call(params, { errorCode: MiniAppErrorType.serverError });
7509
+ }
7510
+ async function getKycInformation(params) {
7511
+ reconstructParams(params);
7512
+ await execute$9(params);
7513
+ }
7514
+ async function execute$9(params) {
7515
+ var _a, _b, _c, _d, _e, _f, _g, _h;
7516
+ try {
7517
+ const grantStatus = await checkPermission(PermissionName.mini_app_kyc);
7518
+ if (grantStatus !== PermissionStatus.granted) {
7519
+ return (_a = params == null ? void 0 : params.fail) == null ? void 0 : _a.call(params, { errorCode: MiniAppErrorType.insufficientScope });
7520
+ }
7521
+ const res = await ppFetch2({
7522
+ method: "GET",
7523
+ url: "web-api/app/v2/users/kyc",
7524
+ params: {
7525
+ type: params.type,
7526
+ eKycDocuments: (_b = params.eKycDocuments) == null ? void 0 : _b.toString()
7527
+ }
7528
+ });
7529
+ if (res.ppFetchResult !== "success") {
7530
+ return (_c = params == null ? void 0 : params.fail) == null ? void 0 : _c.call(params, { errorCode: MiniAppErrorType.serverError });
7531
+ }
7532
+ if ((_d = res.body.unsigned) == null ? void 0 : _d.data) {
7533
+ let response = res.body.unsigned.data;
7534
+ response.jws = (_e = res.body.signed) == null ? void 0 : _e.jws;
7535
+ return (_f = params == null ? void 0 : params.success) == null ? void 0 : _f.call(params, response);
7536
+ } else {
7537
+ return (_g = params == null ? void 0 : params.fail) == null ? void 0 : _g.call(params, { errorCode: MiniAppErrorType.serverError });
7538
+ }
7539
+ } catch {
7540
+ return (_h = params == null ? void 0 : params.fail) == null ? void 0 : _h.call(params, { errorCode: MiniAppErrorType.serverError });
7541
+ }
7542
+ }
7543
+ async function getPermissionStatus(params) {
7544
+ reconstructParams(params);
7545
+ await execute$8(params);
7546
+ }
7547
+ async function execute$8(params) {
7548
+ var _a, _b, _c, _d;
7549
+ try {
7550
+ const permissionList = await getUserGrantedPermission();
7551
+ if (!permissionList) {
7552
+ return (_a = params == null ? void 0 : params.fail) == null ? void 0 : _a.call(params, { errorCode: MiniAppErrorType.serverError });
7553
+ }
7554
+ if (!(params == null ? void 0 : params.name)) {
7555
+ return (_b = params == null ? void 0 : params.success) == null ? void 0 : _b.call(params, {
7556
+ granted_permissions: permissionList
7557
+ });
7558
+ } else {
7559
+ const thePermission = permissionList == null ? void 0 : permissionList.find((name) => {
7560
+ return name === (params == null ? void 0 : params.name);
7561
+ });
7562
+ const status2 = thePermission ? PermissionStatus.granted : PermissionStatus.denied;
7563
+ return (_c = params == null ? void 0 : params.success) == null ? void 0 : _c.call(params, { status: status2 });
7564
+ }
7565
+ } catch (_) {
7566
+ return (_d = params == null ? void 0 : params.fail) == null ? void 0 : _d.call(params, { errorCode: MiniAppErrorType.serverError });
7567
+ }
7568
+ }
7569
+ function useGetHeights() {
7570
+ const agents = navigator.userAgent;
7571
+ const heights = {
7572
+ statusBarHeight: 0,
7573
+ navBarHeight: 0,
7574
+ bottomHeight: 0,
7575
+ isNative: false
7576
+ };
7577
+ agents.split(" ").forEach((property2) => {
7578
+ if (/Offset.*/.test(property2)) {
7579
+ const offsetString = property2 == null ? void 0 : property2.split("/")[1];
7580
+ const offsets = offsetString == null ? void 0 : offsetString.split(";");
7581
+ heights.isNative = true;
7582
+ if (offsets.length !== 3)
7583
+ return;
7584
+ heights.statusBarHeight = parseInt(offsets[0], 10);
7585
+ heights.navBarHeight = parseInt(offsets[1], 10);
7586
+ heights.bottomHeight = parseInt(offsets[2], 10);
7587
+ }
7588
+ });
7589
+ return heights;
7590
+ }
7591
+ function useGetHeightProperties() {
7592
+ var _a;
7593
+ const { navBarHeight, statusBarHeight, bottomHeight, isNative } = useGetHeights();
7594
+ const detail = getAppDetail();
7595
+ const navigationStyle = (_a = detail == null ? void 0 : detail.window) == null ? void 0 : _a.navigationStyle;
7596
+ const isDefault = navigationStyle === "default";
7597
+ const isNone = navigationStyle === "none";
7598
+ const isCustom = navigationStyle === "custom";
7599
+ const bottomHeightProperty = `${bottomHeight}px`;
7600
+ let innerHeightProperty = `calc(100vh - ${bottomHeight}px)`;
7601
+ let fullFillHeightProperty = innerHeightProperty;
7602
+ let headerHeight = 0;
7603
+ if (navigationStyle === "custom") {
7604
+ headerHeight = statusBarHeight + navBarHeight;
7605
+ innerHeightProperty = `calc(100vh - ${bottomHeight}px - ${headerHeight}px)`;
7606
+ fullFillHeightProperty = `calc(100vh - ${bottomHeight}px - ${headerHeight}px)`;
7607
+ } else if (navigationStyle === "none") {
7608
+ headerHeight = statusBarHeight;
7609
+ innerHeightProperty = `calc(100vh - ${bottomHeight}px - ${headerHeight}px)`;
7610
+ }
7611
+ return {
7612
+ innerHeightProperty,
7613
+ bottomHeightProperty,
7614
+ fullFillHeightProperty,
7615
+ headerHeight,
7616
+ navBarHeight,
7617
+ statusBarHeight,
7618
+ bottomHeight,
7619
+ isNone,
7620
+ isCustom,
7621
+ isDefault,
7622
+ isNative
7623
+ };
7624
+ }
7625
+ function getTopBarHeight(params) {
7626
+ var _a;
7627
+ reconstructParams(params);
7628
+ const { headerHeight } = useGetHeightProperties();
7629
+ (_a = params == null ? void 0 : params.success) == null ? void 0 : _a.call(params, { height: headerHeight });
7630
+ }
7631
+ async function getPlatformInformation(params) {
7632
+ reconstructParams(params);
7633
+ await execute$7(params);
7634
+ }
7635
+ async function execute$7(params) {
7636
+ var _a, _b;
7637
+ let sdkVersion = null;
7638
+ let preferredLanguage = getPayPayLanguage();
7639
+ const appVersion = getAppVersion();
7640
+ if (appVersion) {
7641
+ try {
7642
+ const response = await fetch("https://static.paypay.ne.jp/libs/mini-app-js-sdk/versions.json");
7643
+ const res = await response.json();
7644
+ Object.keys(res == null ? void 0 : res.app).forEach(function(key) {
7645
+ var _a2;
7646
+ if (!semVerCompare(key, appVersion)) {
7647
+ sdkVersion = (_a2 = res == null ? void 0 : res.app[key]) == null ? void 0 : _a2.jsSdkSupport;
7648
+ } else {
7649
+ return;
7650
+ }
7651
+ });
7652
+ } catch (_) {
7653
+ return (_a = params == null ? void 0 : params.fail) == null ? void 0 : _a.call(params, { errorCode: MiniAppErrorType.serverError });
7654
+ }
7655
+ }
7656
+ (_b = params == null ? void 0 : params.success) == null ? void 0 : _b.call(params, {
7657
+ appVersion,
7658
+ sdkVersion,
7659
+ preferredLanguage
7660
+ });
7661
+ }
7662
+ function getDeviceInformation(params) {
7663
+ reconstructParams(params);
7664
+ execute$6(params);
7665
+ }
7666
+ function execute$6(params) {
7667
+ var _a;
7668
+ const runtime = getRuntime();
7669
+ (_a = params == null ? void 0 : params.success) == null ? void 0 : _a.call(params, {
7670
+ os: runtime === MiniAppRuntime.web ? navigator.platform : runtime.toLowerCase()
7671
+ });
7672
+ }
7438
7673
  function gen(name, mods) {
7439
7674
  if (!mods) {
7440
7675
  return "";
@@ -21010,42 +21245,6 @@ const PaymentMethod = defineComponent({
21010
21245
  return null;
21011
21246
  }
21012
21247
  });
21013
- function onMountedOrActivated(hook) {
21014
- let mounted;
21015
- onMounted(() => {
21016
- hook();
21017
- nextTick(() => {
21018
- mounted = true;
21019
- }).catch(() => {
21020
- });
21021
- });
21022
- onActivated(() => {
21023
- if (mounted) {
21024
- hook();
21025
- }
21026
- });
21027
- }
21028
- function useEventListener(type, listener, options = {}) {
21029
- const { target = window, passive = false, capture = false } = options;
21030
- let attached;
21031
- const add2 = () => {
21032
- const element = unref(target);
21033
- if (element && !attached) {
21034
- element.addEventListener(type, listener, capture);
21035
- attached = true;
21036
- }
21037
- };
21038
- const remove2 = () => {
21039
- const element = unref(target);
21040
- if (element && attached) {
21041
- element.removeEventListener(type, listener, capture);
21042
- attached = false;
21043
- }
21044
- };
21045
- onUnmounted(remove2);
21046
- onDeactivated(remove2);
21047
- onMountedOrActivated(add2);
21048
- }
21049
21248
  const UI_BREAKPOINT = 767;
21050
21249
  function useBreakpoints() {
21051
21250
  let windowWidth = ref(window.innerWidth);
@@ -25992,195 +26191,6 @@ function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
25992
26191
  const cssModules$g = {};
25993
26192
  cssModules$g["$style"] = style0$f;
25994
26193
  var CashBackDetailRow = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["render", _sfc_render$s], ["__cssModules", cssModules$g]]);
25995
- const HORIZONTAL_SCROLL_KEY = "horizontal-scroll";
25996
- class StopPropagation$1 {
25997
- constructor(el) {
25998
- this.el = el;
25999
- this.executer = (e) => {
26000
- const el2 = this.el;
26001
- if (el2.scrollLeft === 0) {
26002
- el2.scrollTo(1, 0);
26003
- } else if (this.prevent) {
26004
- el2.scrollTo(el2.scrollLeft - 1, 0);
26005
- }
26006
- e.stopPropagation();
26007
- };
26008
- this.move = (e) => {
26009
- if (this.prevent && e.cancelable)
26010
- e.preventDefault();
26011
- e.stopPropagation();
26012
- };
26013
- }
26014
- get prevent() {
26015
- const el = this.el;
26016
- const prevent = el.scrollWidth - el.scrollLeft === el.clientWidth;
26017
- return prevent;
26018
- }
26019
- }
26020
- const useHorizontalScrollDirective = {
26021
- mounted: function(el) {
26022
- const stopInstance = new StopPropagation$1(el);
26023
- el.addEventListener("touchstart", stopInstance.executer, { passive: true });
26024
- el.addEventListener("touchend", stopInstance.executer, { passive: true });
26025
- el.addEventListener("touchmove", stopInstance.move);
26026
- }
26027
- };
26028
- const VERTICAL_SCROLL_KEY = "vertical-scroll";
26029
- class StopPropagation {
26030
- constructor(el) {
26031
- this.el = el;
26032
- this.executer = (e) => {
26033
- const el2 = this.el;
26034
- if (el2.scrollTop === 0) {
26035
- el2.scrollTo(0, 1);
26036
- } else if (this.prevent) {
26037
- el2.scrollTo(0, el2.scrollTop - 1);
26038
- }
26039
- e.stopPropagation();
26040
- };
26041
- this.move = (e) => {
26042
- if (this.prevent)
26043
- e.preventDefault();
26044
- e.stopPropagation();
26045
- };
26046
- }
26047
- get prevent() {
26048
- const el = this.el;
26049
- const scrollHeight = el.scrollHeight - el.scrollTop;
26050
- const clientHeight = el.clientHeight;
26051
- const prevent = clientHeight - 1 < scrollHeight && scrollHeight < clientHeight + 1;
26052
- return prevent;
26053
- }
26054
- }
26055
- const useVerticalScrollDirective = {
26056
- mounted: function(el) {
26057
- const stopInstance = new StopPropagation(el);
26058
- el.addEventListener("touchstart", stopInstance.executer, { passive: true });
26059
- el.addEventListener("touchend", stopInstance.executer, { passive: true });
26060
- el.addEventListener("touchmove", stopInstance.move);
26061
- }
26062
- };
26063
- let prev = Date.now();
26064
- function rafPolyfill(fn) {
26065
- const curr = Date.now();
26066
- const ms = Math.max(0, 16 - (curr - prev));
26067
- const id = setTimeout(fn, ms);
26068
- prev = curr + ms;
26069
- return id;
26070
- }
26071
- function raf(fn) {
26072
- const requestAnimationFrame2 = window.requestAnimationFrame || rafPolyfill;
26073
- return requestAnimationFrame2.call(window, fn);
26074
- }
26075
- function cancelRaf(id) {
26076
- const cancelAnimationFrame2 = window.cancelAnimationFrame || window.clearTimeout;
26077
- cancelAnimationFrame2.call(window, id);
26078
- }
26079
- const SECOND = 1e3;
26080
- const MINUTE = 60 * SECOND;
26081
- const HOUR = 60 * MINUTE;
26082
- const DAY = 24 * HOUR;
26083
- function parseTime(time2) {
26084
- const days = Math.floor(time2 / DAY);
26085
- const hours = Math.floor(time2 % DAY / HOUR);
26086
- const minutes = Math.floor(time2 % HOUR / MINUTE);
26087
- const seconds = Math.floor(time2 % MINUTE / SECOND);
26088
- const milliseconds = Math.floor(time2 % SECOND);
26089
- return {
26090
- total: time2,
26091
- days,
26092
- hours,
26093
- minutes,
26094
- seconds,
26095
- milliseconds
26096
- };
26097
- }
26098
- function isSameSecond(time1, time2) {
26099
- return Math.floor(time1 / 1e3) === Math.floor(time2 / 1e3);
26100
- }
26101
- function useCountDown(options) {
26102
- let rafId;
26103
- let endTime;
26104
- let counting;
26105
- let deactivated;
26106
- const remain = ref(options.time);
26107
- const current = computed(() => parseTime(remain.value));
26108
- const pause = () => {
26109
- counting = false;
26110
- cancelRaf(rafId);
26111
- };
26112
- const getCurrentRemain = () => Math.max(endTime - Date.now(), 0);
26113
- const setRemain = (value2) => {
26114
- var _a, _b;
26115
- remain.value = value2;
26116
- (_a = options.onChange) == null ? void 0 : _a.call(options, current.value);
26117
- if (value2 === 0) {
26118
- pause();
26119
- (_b = options.onFinish) == null ? void 0 : _b.call(options);
26120
- }
26121
- };
26122
- const microTick = () => {
26123
- rafId = raf(() => {
26124
- if (counting) {
26125
- setRemain(getCurrentRemain());
26126
- if (remain.value > 0) {
26127
- microTick();
26128
- }
26129
- }
26130
- });
26131
- };
26132
- const macroTick = () => {
26133
- rafId = raf(() => {
26134
- if (counting) {
26135
- const remainRemain = getCurrentRemain();
26136
- if (!isSameSecond(remainRemain, remain.value) || remainRemain === 0) {
26137
- setRemain(remainRemain);
26138
- }
26139
- if (remain.value > 0) {
26140
- macroTick();
26141
- }
26142
- }
26143
- });
26144
- };
26145
- const tick = () => {
26146
- if (options.millisecond) {
26147
- microTick();
26148
- } else {
26149
- macroTick();
26150
- }
26151
- };
26152
- const start = () => {
26153
- if (!counting) {
26154
- endTime = Date.now() + remain.value;
26155
- counting = true;
26156
- tick();
26157
- }
26158
- };
26159
- const reset2 = (totalTime = options.time) => {
26160
- pause();
26161
- remain.value = totalTime;
26162
- };
26163
- onBeforeUnmount(pause);
26164
- onActivated(() => {
26165
- if (deactivated) {
26166
- counting = true;
26167
- deactivated = false;
26168
- tick();
26169
- }
26170
- });
26171
- onDeactivated(() => {
26172
- if (counting) {
26173
- pause();
26174
- deactivated = true;
26175
- }
26176
- });
26177
- return {
26178
- start,
26179
- pause,
26180
- reset: reset2,
26181
- current
26182
- };
26183
- }
26184
26194
  const root$3 = "_root_12nmp_7";
26185
26195
  const container$4 = "_container_12nmp_21";
26186
26196
  const subContainer = "_subContainer_12nmp_37";
@@ -27932,13 +27942,13 @@ function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
27932
27942
  const cssModules$b = {};
27933
27943
  cssModules$b["$style"] = style0$a;
27934
27944
  var TopContent = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$j], ["__cssModules", cssModules$b]]);
27935
- const container$2 = "_container_4e8q4_7";
27936
- const payment$1 = "_payment_4e8q4_10";
27937
- const paymentList = "_paymentList_4e8q4_13";
27938
- const bottomContainer = "_bottomContainer_4e8q4_28";
27939
- const bottomText = "_bottomText_4e8q4_47";
27945
+ const container$2 = "_container_j3wik_7";
27946
+ const payment$1 = "_payment_j3wik_10";
27947
+ const paymentList = "_paymentList_j3wik_13";
27948
+ const bottomContainer = "_bottomContainer_j3wik_29";
27949
+ const bottomText = "_bottomText_j3wik_48";
27940
27950
  var style0$9 = {
27941
- "ppmna-default-font": "_ppmna-default-font_4e8q4_1",
27951
+ "ppmna-default-font": "_ppmna-default-font_j3wik_1",
27942
27952
  container: container$2,
27943
27953
  payment: payment$1,
27944
27954
  paymentList,
@@ -32311,7 +32321,7 @@ function debug(params) {
32311
32321
  function execute$5(params) {
32312
32322
  var _a;
32313
32323
  (_a = params == null ? void 0 : params.success) == null ? void 0 : _a.call(params, {
32314
- v: "1.32.0"
32324
+ v: "1.33.0"
32315
32325
  });
32316
32326
  }
32317
32327
  function useCallBack(props, ctx) {
@@ -33433,29 +33443,27 @@ const _sfc_main = defineComponent({
33433
33443
  url: {
33434
33444
  type: String,
33435
33445
  default: void 0
33436
- },
33437
- success: {
33438
- type: Function,
33439
- default: () => {
33440
- },
33441
- required: false
33442
33446
  }
33443
33447
  },
33444
- emits: ["click"],
33448
+ emits: {
33449
+ click: () => true,
33450
+ mount: () => true
33451
+ },
33445
33452
  setup(props, { emit }) {
33446
- var _a;
33447
33453
  const onClick = () => emit("click");
33448
33454
  const onError = (e) => {
33449
- var _a2;
33455
+ var _a;
33450
33456
  const el = e.target;
33451
- (_a2 = el == null ? void 0 : el.parentNode) == null ? void 0 : _a2.removeChild(el);
33457
+ (_a = el == null ? void 0 : el.parentNode) == null ? void 0 : _a.removeChild(el);
33452
33458
  };
33453
33459
  let iconUrl = images.paypayRec;
33454
33460
  if (props.theme === "red") {
33455
33461
  iconUrl = images.paypayRecWhite;
33456
33462
  }
33457
33463
  let smallBtn = props.buttonSize === "sm";
33458
- (_a = props == null ? void 0 : props.success) == null ? void 0 : _a.call(props);
33464
+ onMounted(() => {
33465
+ emit("mount");
33466
+ });
33459
33467
  return {
33460
33468
  onClick,
33461
33469
  onError,
@@ -33515,9 +33523,26 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
33515
33523
  ], 10, _hoisted_2)
33516
33524
  ]);
33517
33525
  }
33518
- var AppVue = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-04b9ac25"]]);
33526
+ var AppVue = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-fb345984"]]);
33519
33527
  const initSmartButton = (params, data2, preferredLanguage, isLoggedIn) => {
33520
33528
  const smartButtonParams = reactive(params);
33529
+ const triggerPayment = () => {
33530
+ makePayment(__spreadProps(__spreadValues({}, smartButtonParams == null ? void 0 : smartButtonParams.orderInfo), {
33531
+ success: (res) => {
33532
+ var _a;
33533
+ (_a = smartButtonParams == null ? void 0 : smartButtonParams.success) == null ? void 0 : _a.call(smartButtonParams, __spreadValues({}, res));
33534
+ },
33535
+ fail: (err) => {
33536
+ var _a;
33537
+ (_a = smartButtonParams == null ? void 0 : smartButtonParams.fail) == null ? void 0 : _a.call(smartButtonParams, __spreadValues({}, err));
33538
+ },
33539
+ complete: () => {
33540
+ var _a;
33541
+ (_a = smartButtonParams == null ? void 0 : smartButtonParams.complete) == null ? void 0 : _a.call(smartButtonParams);
33542
+ }
33543
+ })).catch(() => {
33544
+ });
33545
+ };
33521
33546
  const app = createApp({
33522
33547
  setup() {
33523
33548
  return () => h(AppVue, {
@@ -33530,11 +33555,19 @@ const initSmartButton = (params, data2, preferredLanguage, isLoggedIn) => {
33530
33555
  isShortText: smartButtonParams.isShortText,
33531
33556
  preferredLanguage: preferredLanguage === "ja" ? "ja" : "en",
33532
33557
  url: (smartButtonParams == null ? void 0 : smartButtonParams.url) || void 0,
33533
- success: smartButtonParams == null ? void 0 : smartButtonParams.success,
33534
33558
  onClick: () => {
33535
33559
  var _a;
33536
33560
  if (smartButtonParams.type === "pay" && isLoggedIn) {
33537
- (_a = params == null ? void 0 : params.callback) == null ? void 0 : _a.call(params);
33561
+ if (smartButtonParams == null ? void 0 : smartButtonParams.callback) {
33562
+ (_a = smartButtonParams == null ? void 0 : smartButtonParams.callback) == null ? void 0 : _a.call(smartButtonParams);
33563
+ } else if (smartButtonParams == null ? void 0 : smartButtonParams.orderInfo) {
33564
+ triggerPayment();
33565
+ }
33566
+ }
33567
+ },
33568
+ onMount: () => {
33569
+ if (smartButtonParams.type === "pay" && isLoggedIn && (smartButtonParams == null ? void 0 : smartButtonParams.autoInvoke) && OTTLoginState.isJustLoggedIn) {
33570
+ triggerPayment();
33538
33571
  }
33539
33572
  }
33540
33573
  });