@paypay/mini-app-js-sdk 2.56.0 → 2.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/communicationWithCore.d.ts +2 -1
- package/dist/composition-api/useKycPassport.d.ts +2 -2
- package/dist/constants/clientUtilFunctionName.d.ts +1 -0
- package/dist/constants/errorCodes.d.ts +1 -0
- package/dist/constants/index.d.ts +11 -0
- package/dist/constants/localStorageKeys.d.ts +1 -0
- package/dist/constants/permissionName.d.ts +1 -0
- package/dist/constants/sdkFunctionNames.d.ts +1 -0
- package/dist/core/coreFunctions/renderButton/types.d.ts +1 -0
- package/dist/core/sentry.d.ts +2 -2
- package/dist/mini-app-js-sdk.browser.js +1 -1
- package/dist/mini-app-js-sdk.es.js +85 -1211
- package/dist/model/miniAppError.d.ts +2 -1
- package/dist/model/permission.d.ts +2 -1
- package/dist/resources/images.d.ts +1 -0
- package/dist/resources/locales/payment/index.d.ts +20 -0
- package/dist/resources/locales/payment/ja.d.ts +10 -0
- package/dist/resources/locales/topup/index.d.ts +2 -0
- package/dist/resources/locales/topup/ja.d.ts +1 -0
- package/dist/types/getPermissionStatus.d.ts +1 -43
- package/dist/types/makePayment.d.ts +23 -3
- package/dist/types.d.ts +3 -80
- package/dist/utils/analytics.d.ts +2 -1
- package/dist/utils/api.d.ts +7 -7
- package/dist/utils/errors.d.ts +3 -3
- package/dist/utils/fetch.d.ts +6 -6
- package/dist/utils/helper.d.ts +7 -8
- package/dist/utils/miniAppRequest.d.ts +2 -2
- package/dist/utils/pureHelpers.d.ts +2 -0
- package/dist/utils/storage.d.ts +1 -1
- package/dist/utils/windowBridge.d.ts +4 -1
- package/dist/views/make-payment/store/util-for-handle-error.d.ts +2 -2
- package/dist/views/make-payment/store.d.ts +8525 -603
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as clientWindowBridgeFunctions from '../client/windowBridgeFunctions';
|
|
2
2
|
import { NativeParams } from '../jsbridge-core/jsbridge';
|
|
3
|
-
import { ClientMessageData,
|
|
3
|
+
import { ClientMessageData, ResultErrorType } from '../types';
|
|
4
4
|
import { WindowBridgeFunctions } from '../utils/windowBridge';
|
|
5
|
+
import { PPFunctionNameType } from '../constants';
|
|
5
6
|
export declare type ClientFunctions = WindowBridgeFunctions<typeof clientWindowBridgeFunctions>;
|
|
6
7
|
export declare const coreFunctions: WindowBridgeFunctions<{
|
|
7
8
|
claimCoupon: typeof import("../core/coreFunctions/claimCoupon").claimCoupon;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { InitKycPassportParams } from '../types/initKycPassport';
|
|
2
|
-
import {
|
|
3
|
-
declare const initKycPassportError: (params: InitKycPassportParams, errorCode:
|
|
2
|
+
import { ErrorCodesType } from '../constants';
|
|
3
|
+
declare const initKycPassportError: (params: InitKycPassportParams, errorCode: ErrorCodesType, helpUrl?: string | undefined) => void;
|
|
4
4
|
export { initKycPassportError };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const reload = "reload", link = "link", saveRefreshToken = "saveRefreshToken", saveCodeVerifier = "saveCodeVerifier", makeVisible = "makeVisible", hideIframe = "hideIframe", showIframe = "showIframe", consoleDebugInfo = "consoleDebugInfo", clientPopState = "clientPopState";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const success = "SUCCESS", invalidUrl = "INVALID_URL", invalidData = "INVALID_DATA", invalidHeader = "INVALID_HEADER", invalidMethod = "INVALID_METHOD", invalidPath = "INVALID_PATH", notReachable = "NOT_REACHABLE", notAvailable = "NOT_AVAILABLE", timeOut = "TIME_OUT", whiteListError = "NONE_WHITELIST_DOMAIN", statusCodeError = "STATUS_CODE_ERROR", invalidResponse = "INVALID_RESPONSE", noLocationPermission = "NO_USER_LOCATION_PERMISSION", noPermissionListAvailable = "NO_PERMISSION_LIST_AVAILABLE", other = "other", serverError = "SERVER_ERROR", noCameraPermission = "HOST_APP_CAMERA_DENIED", noAlbumPermission = "HOST_APP_ALBUM_DENIED", insufficientScope = "INSUFFICIENT_SCOPE", userCanceled = "USER_CANCELED", invalidJSAPIParams = "INVALID_JS_API_PARAMS", hostAppLocationDenied = "HOST_APP_LOCATION_DENIED", hostAppContactsDenied = "HOST_APP_READING_CONTACT_DENIED", badRequestInsufficientParameter = "BAD_REQUEST_INSUFFICIENT_PARAMETER", badRequest = "BAD_REQUEST", paymentFail = "PAYMENT_FAIL", topupFail = "TOPUP_FAIL", topupSuccessButNotAddToBalance = "TOPUP_SUCCESS_BUT_NOT_ADD_TO_BALANCE", userCanceledSimilarTxn = "USER_CANCELED_SIMILAR_TRANSACTION", mapAppNotFound = "MAP_APP_NOT_FOUND", invalidAppSchemeURL = "INVALID_APP_SCHEME_URL", noValueFound = "NO_VALUE_FOUND", securityNotSetup = "SECURITY_NOT_SETUP", userDenied = "USER_DENIED", securityTemporaryLocked = "SECURITY_TEMPORARY_LOCKED", couldNotGenerateBarcode = "COULD_NOT_GENERATE_BARCODE", cannotDetectAvailability = "CAN_NOT_DETECT_AVAILABILITY", suspectedDuplicatePayment = "SUSPECTED_DUPLICATE_PAYMENT", noSufficientFund = "NO_SUFFICIENT_FUND", unknown = "UNKNOWN", sdkNotInitialized = "SDK_NOT_INITIALIZED", tokenNotFound = "TOKEN_NOT_FOUND", tokenExpired = "TOKEN_EXPIRED", activeRequestExists = "ACTIVE_REQUEST_EXISTS", invalidType = "INVALID_TYPE", sessionNotFound = "SESSION_NOT_FOUND", cookieError = "COOKIE_ERROR", notAuthorized = "NOT_AUTHORIZED", permissionRequired = "PERMISSION_REQUIRED", deeplinkUnavailable = "DEEPLINK_UNAVAILABLE", kycIncompleted = "KYC_INCOMPLETED", noBankAccount = "NO_BANK_ACCOUNT", invalidPaymentIdentifier = "INVALID_PAYMENT_IDENTIFIER", otpSendTooShort = "OTP_SEND_TOO_SHORT", otpSendOverLimit = "OTP_SEND_OVER_LIMIT", userVerificationFailure = "USER_VERIFICATION_FAILURE", unacceptableOp = "UNACCEPTABLE_OP", kycUpdateRequired = "KYC_UPDATE_REQUIRED", notCompleted = "NOT_COMPLETED", kycValidationInProcess = "KYC_VALIDATION_IN_PROCESS", noLocationData = "NO_LOCATION_DATA", functionNotFound = "FUNCTION_NOT_FOUND", originNotAllowed = "ORIGIN_NOT_ALLOWED", messageSendingFailed = "MESSAGE_SENDING_FAILED", transactionNotFound = "TRANSACTION_NOT_FOUND", unexpectedOperation = "UNEXPECTED_OP", merchantTimeout = "MERCHANT_TIMEOUT", rateLimitExceeded = "RATE_LIMIT_EXCEEDED", sdkUpgradeRequired = "SDK_UPGRADE_REQUIRED", authorizationNeeded = "AUTHORIZATION_NEEDED", invalidVirtualAccount = "INVALID_VIRTUAL_ACCOUNT", notSupportedUser = "NOT_SUPPORTED_USER";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as ErrorCodes from './errorCodes';
|
|
2
|
+
import * as PermissionName from './permissionName';
|
|
3
|
+
import * as LocalStorageKeys from './localStorageKeys';
|
|
4
|
+
import * as PPFunctionName from './sdkFunctionNames';
|
|
5
|
+
import * as PPUtilFunctionName from './clientUtilFunctionName';
|
|
6
|
+
export declare type ErrorCodesType = ObjectValues<typeof ErrorCodes>;
|
|
7
|
+
export declare type PermissionNameType = ObjectValues<typeof PermissionName>;
|
|
8
|
+
export declare type LocalStorageKeysType = ObjectValues<typeof LocalStorageKeys>;
|
|
9
|
+
export declare type PPFunctionNameType = ObjectValues<typeof PPFunctionName>;
|
|
10
|
+
export declare type PPUtilFunctionNameType = ObjectValues<typeof PPUtilFunctionName>;
|
|
11
|
+
export { ErrorCodes, PermissionName, LocalStorageKeys, PPFunctionName, PPUtilFunctionName, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const accessToken = "ppjssdk.accessToken", refreshToken = "ppjssdk.refreshToken", env = "ppjssdk.env", deviceUUID = "ppjssdk.deviceUUID", clientUUID = "ppjssdk.clientUUID", lastPayment = "ppjssdk.lastPayment", lastTopup = "ppjssdk.lastTopup", appDetail = "ppjssdk.appDetail", appConfig = "ppjssdk.appConfig", userInfo = "ppjssdk.userInfo", lastPaymentMethod = "ppjssdk.lastPaymentMethod", lastTopupPayMethod = "ppjssdk.lastTopupPayMethod", codeVerifier = "ppjssdk.codeVerifier", clientOrigin = "ppjssdk.clientOrigin", clientVersion = "ppjssdk.clientVersion", debugMode = "ppjssdk.debugMode", claimCouponImmediately = "ppjssdk.claimCouponImmediately", merchant = "ppjssdk.merchant", consumedOTT = "ppjssdk.consumedOTT", initializedAt = "ppjssdk.initializedAt";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const mini_app_payment_balance = "mini_app_payment_balance", mini_app_device_info = "mini_app_device_info", mini_app_user_contacts = "mini_app_user_contacts", mini_app_device_battery = "mini_app_device_battery", mini_app_kyc = "mini_app_kyc", mini_app_user_location = "mini_app_user_location", mini_app_check_payment_method = "mini_app_check_payment_method", cashback = "cashback", bank_registration = "bank_registration", mini_app_user_email_address = "mini_app_user_email_address", mini_app_user_address = "mini_app_user_address", mini_app_user_phone_camera = "mini_app_user_phone_camera", mini_app_user_phone_album = "mini_app_user_phone_album", mini_app_bank_information = "mini_app_bank_information", mini_app_cashback_information = "mini_app_cashback_information", mini_app_user_phone_number = "mini_app_user_phone_number", mini_app_user_name = "mini_app_user_name", mini_app_user_nickname = "mini_app_user_nickname", mini_app_user_avatar = "mini_app_user_avatar", mini_app_user_signup_date = "mini_app_user_signup_date", mini_app_user_employer_info = "mini_app_user_employer_info", mini_app_user_gender = "mini_app_user_gender", direct_debit = "direct_debit", continuous_payments = "continuous_payments", pending_payments = "pending_payments", preauth_capture_native = "preauth_capture_native", mini_app_point_usage_setting = "mini_app_point_usage_setting", mini_app_user_payment_limit = "mini_app_user_payment_limit", mini_app_user_p2p_limit = "mini_app_user_p2p_limit", mini_app_user_topup_limit = "mini_app_user_topup_limit", merchant_topup = "merchant_topup", mini_app_notification_center = "mini_app_notification_center", push_notification = "push_notification", notification_center_tl = "notification_center_tl", user_info_softbank_user = "user_info_softbank_user", user_info_yahoo_mobile_user = "user_info_yahoo_mobile_user", user_info_yahoo_premium_user = "user_info_yahoo_premium_user", user_info_tpoint = "user_info_tpoint", mini_app_transaction = "mini_app_transaction", mini_app_device_esim_info = "mini_app_device_esim_info";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const init = "init", getBankInfo = "getBankInfo", showAlert = "showAlert", render = "render", makePayment = "makePayment", getUAID = "getUAID", logout = "logout", startMultiFactorAuth = "startMultiFactorAuth", verifyMultiFactorAuthResult = "verifyMultiFactorAuthResult", getPermissionStatus = "getPermissionStatus", registerKyc = "registerKyc", getKycInformation = "getKycInformation", getUserAddress = "getUserAddress", getUserLocation = "getUserLocation", getUserProfile = "getUserProfile", registerEmail = "registerEmail", showUpdateWarning = "showUpdateWarning", showErrorSheet = "showErrorSheet", getPlatformInformation = "getPlatformInformation", share = "share", getTopBarHeight = "getTopBarHeight", openWebview = "openWebview", openMap = "openMap", closeApp = "closeApp", openApp = "openApp", checkPaymentMethod = "checkPaymentMethod", getBalance = "getBalance", topup = "topup", registerPaymentFeatures = "registerPaymentFeatures", registerUserInfo = "registerUserInfo", requestInternal = "requestInternal", scanCode = "scanCode", getAuthStatus = "getAuthStatus", inputAddress = "inputAddress", getCashbackInformation = "getCashbackInformation", request = "request", getDeviceInformation = "getDeviceInformation", createOrder = "createOrder", handleMessageFromNative = "handleMessageFromNative", initKycPassport = "initKycPassport", smsAuth = "smsAuth", getKycPassportInfo = "getKycPassportInfo";
|
|
@@ -20,6 +20,7 @@ export interface RenderButtonParamsWithOrderInfo extends RenderButtonParamsBase
|
|
|
20
20
|
callbacks: {
|
|
21
21
|
onPaymentSuccess: (response: MakePaymentResult) => void;
|
|
22
22
|
onPaymentFailure: (error: ErrorResponse) => void;
|
|
23
|
+
onPaymentCompletion?: () => void;
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
26
|
export interface RenderButtonParamsWithoutOrderInfo extends RenderButtonParamsBase {
|
package/dist/core/sentry.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ErrorCodesType } from '../constants';
|
|
2
2
|
import * as Sentry from '@sentry/browser';
|
|
3
3
|
export declare function initSentry(): void;
|
|
4
|
-
export declare function sendWindowBridgeErrorToSentry(functionName: string, message: string, error:
|
|
4
|
+
export declare function sendWindowBridgeErrorToSentry(functionName: string, message: string, error: ErrorCodesType): void;
|
|
5
5
|
export declare function addBreadcrumbToSentry(breadcrumb: Sentry.Breadcrumb): void;
|
|
6
6
|
export declare function setClientIdForSentry(clientId: string): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
!function(){"use strict";try{if("undefined"!=typeof document){var p=document.createElement("style");p.appendChild(document.createTextNode(".ppmna-reset-css{all:initial}.ppmna-reset-css *{text-align:unset;color:unset;background:initial;background-color:transparent;margin:revert;padding:revert;font-weight:revert;font-style:unset;font-size:unset;-webkit-user-select:none;user-select:none;border:unset;border-radius:revert;vertical-align:unset;word-break:unset;outline:none;box-sizing:content-box}.ppmna-reset-css * img{display:inline-block}.ppmna-reset-css * input,.ppmna-reset-css * select{-webkit-user-select:auto;user-select:auto}.ppmna-reset-css * li{list-style:none}.ppmna-reset-css * :where(*:not(svg,svg *)){all:revert}.pp-smartButtonWrapper .pp-smartBtn{display:flex;align-items:center;border-radius:8px;border:none;font-size:14px;font-weight:600;line-height:22px;color:#fff;padding:0;width:100%;height:44px;margin:auto;-webkit-tap-highlight-color:transparent;text-decoration:none;box-sizing:border-box}.pp-smartButtonWrapper .pp-smartBtn.pp-sm .pp-leftSection .pp-btnContent{flex-direction:column}.pp-smartButtonWrapper .pp-smartBtn.pp-light{background:#fff;color:#242323}.pp-smartButtonWrapper .pp-smartBtn.pp-dark{background:#000}.pp-smartButtonWrapper .pp-smartBtn.pp-red{background:#f03}.pp-smartButtonWrapper .pp-smartBtn.pp-login{min-width:180px}.pp-smartButtonWrapper .pp-smartBtn.pp-login.pp-sm{width:180px!important}.pp-smartButtonWrapper .pp-smartBtn.pp-login.pp-light{border:1px solid #e4e4e8}.pp-smartButtonWrapper .pp-smartBtn.pp-login.pp-light .pp-userProfile{margin-right:4px}.pp-smartButtonWrapper .pp-smartBtn.pp-login .pp-leftSection .pp-btnContent{display:grid}.pp-smartButtonWrapper .pp-smartBtn.pp-pay{min-width:160px}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-light{border:1px solid #dddddd}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-light .pp-cashbackInfo{color:#ff954c;background:#fff0e5}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-red .pp-cashbackInfo{color:#f03}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-ja .pp-cashbackInfo{padding:2px 16px}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-sm{width:160px!important}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-sm.pp-cashback{height:66px;flex-direction:column;justify-content:center}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-sm .pp-cashbackInfo{margin:8px 0 0}.pp-smartButtonWrapper .pp-smartBtn.pp-pay .pp-leftSection .pp-img{width:24px;height:24px}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-shortText{font-size:16px}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-sm .pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-cashback .pp-leftSection .pp-btnContent,.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-shortText .pp-leftSection .pp-btnContent{margin-left:4px}.pp-smartButtonWrapper .pp-smartBtn .pp-leftSection{display:flex;justify-content:center;align-items:center;width:100%;box-sizing:border-box;padding:0 8px}.pp-smartButtonWrapper .pp-smartBtn .pp-leftSection .pp-img{width:20px;height:20px;display:inline-block}.pp-smartButtonWrapper .pp-smartBtn .pp-leftSection .pp-btnContent{margin-left:8px}.pp-smartButtonWrapper .pp-smartBtn .pp-leftSection .pp-btnContent .pp-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pp-smartButtonWrapper .pp-smartBtn .pp-cashbackInfo{font-size:12px;color:#242323;background:#fff;line-height:14px;padding:2px 8px;border-radius:9px;margin-left:8px}.pp-smartButtonWrapper .pp-smartBtn .pp-userProfile{width:34px;height:34px;border-radius:50%;margin-right:5px}.pp-smartButtonWrapper.pp-button{padding:0;margin:0;background:none;border:none;width:100%;border-radius:8px;-webkit-tap-highlight-color:transparent;font-family:revert!important}.pp-smartButtonWrapper.pp-button *{font-family:revert!important}")),document.head.appendChild(p)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();
|
|
2
|
-
var pp=function(){"use strict";var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,i=(t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,a=(e,t)=>{for(var n in t||(t={}))s.call(t,n)&&i(e,n,t[n]);if(o)for(var n of o(t))r.call(t,n)&&i(e,n,t[n]);return e},c=(e,o)=>t(e,n(o)),l=(e,t,n)=>new Promise(((o,s)=>{var r=e=>{try{a(n.next(e))}catch(t){s(t)}},i=e=>{try{a(n.throw(e))}catch(t){s(t)}},a=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,i);a((n=n.apply(e,t)).next())}));function u(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}var d=function e(t,n){function o(e,o,s){if("undefined"!=typeof document){"number"==typeof(s=u({},n,s)).expires&&(s.expires=new Date(Date.now()+864e5*s.expires)),s.expires&&(s.expires=s.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var r="";for(var i in s)s[i]&&(r+="; "+i,!0!==s[i]&&(r+="="+s[i].split(";")[0]));return document.cookie=e+"="+t.write(o,e)+r}}return Object.create({set:o,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],o={},s=0;s<n.length;s++){var r=n[s].split("="),i=r.slice(1).join("=");try{var a=decodeURIComponent(r[0]);if(o[a]=t.read(i,a),e===a)break}catch(c){}}return e?o[e]:o}},remove:function(e,t){o(e,"",u({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,u({},this.attributes,t))},withConverter:function(t){return e(u({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"}),p=(e=>(e.accessToken="ppjssdk.accessToken",e.refreshToken="ppjssdk.refreshToken",e.env="ppjssdk.env",e.deviceUUID="ppjssdk.deviceUUID",e.clientUUID="ppjssdk.clientUUID",e.lastPayment="ppjssdk.lastPayment",e.lastTopup="ppjssdk.lastTopup",e.appDetail="ppjssdk.appDetail",e.appConfig="ppjssdk.appConfig",e.userInfo="ppjssdk.userInfo",e.lastPaymentMethod="ppjssdk.lastPaymentMethod",e.lastTopupPayMethod="ppjssdk.lastTopupPayMethod",e.codeVerifier="ppjssdk.codeVerifier",e.clientOrigin="ppjssdk.clientOrigin",e.clientVersion="ppjssdk.clientVersion",e.debugMode="ppjssdk.debugMode",e.claimCouponImmediately="ppjssdk.claimCouponImmediately",e.merchant="ppjssdk.merchant",e.consumedOTT="ppjssdk.consumedOTT",e.initializedAt="ppjssdk.initializedAt",e))(p||{});const h="success",g="fail",m="complete",f="init",_="verifyMultiFactorAuthResult",v="share",S="scanCode",y="handleMessageFromNative",E="getKycPassportInfo",I="reload",w="link",A="makeVisible",b="hideIframe",T="showIframe",N="consoleDebugInfo",C="clientPopState";var O=(e=>(e.MiniApp="MiniApp",e.SmartPayment="SmartPayment",e))(O||{});const k="_PayPayJsBridge",P=["init","openWebview","openMap","closeApp","makePayment","topup","setSessionData","getSessionData","setStorageData","getStorageData","removeStorageData","getPermissionStatus","scanCode","showAlert","showErrorSheet","getTopBarHeight","setTitle","showUpdateWarning","getPlatformInformation","openApp","share","getKycInformation","getUserLocation","checkPaymentMethod","registerKyc","startMultiFactorAuth","verifyMultiFactorAuthResult","getBankInfo","logout","getUserProfile","getBalance","getUserAddress","getUAID","copyToClipboard","registerUserInfo","setEnablePullDownRefresh","registerEmail","inputAddress","getDeviceInformation","request","requestInternal","registerPaymentFeatures","initKycPassport","getKycPassportInfo","shortcutExists","addShortcut","getAllUserAddresses","getUserPaymentFeatureSettings","getPaymentSettings","getTransactionInfo","getTransactions","getPayPayCardInfo","getExternalLinkageInformation","markAsReady","renderCoupons"],D=["init","createOrder","makePayment","render","logout","getAuthStatus","getUserProfile","getBalance","getUserAddress","getUAID","getCashbackInformation","renderCoupons","getLoginUrl","renderButton"],L="2.56.0",R=new URL("https://mini-app-sdk-core.paypay.ne.jp/"),U=R.origin,x=new URL(`./iframe.html?v=${L}&rev=8161aa8`,R).href,M=new URL(`./coupon/iframe.html?v=${L}`,R).href;new URL(`./button/iframe.html?v=${L}`,R).href;var F=(e=>(e.success="SUCCESS",e.invalidUrl="INVALID_URL",e.invalidData="INVALID_DATA",e.invalidHeader="INVALID_HEADER",e.invalidMethod="INVALID_METHOD",e.invalidPath="INVALID_PATH",e.notReachable="NOT_REACHABLE",e.notAvailable="NOT_AVAILABLE",e.timeOut="TIME_OUT",e.whiteListError="NONE_WHITELIST_DOMAIN",e.statusCodeError="STATUS_CODE_ERROR",e.invalidResponse="INVALID_RESPONSE",e.noLocationPermission="NO_USER_LOCATION_PERMISSION",e.noPermissionListAvailable="NO_PERMISSION_LIST_AVAILABLE",e.other="other",e.serverError="SERVER_ERROR",e.noCameraPermission="HOST_APP_CAMERA_DENIED",e.noAlbumPermission="HOST_APP_ALBUM_DENIED",e.insufficientScope="INSUFFICIENT_SCOPE",e.userCanceled="USER_CANCELED",e.invalidJSAPIParams="INVALID_JS_API_PARAMS",e.hostAppLocationDenied="HOST_APP_LOCATION_DENIED",e.hostAppContactsDenied="HOST_APP_READING_CONTACT_DENIED",e.badRequestInsufficientParameter="BAD_REQUEST_INSUFFICIENT_PARAMETER",e.badRequest="BAD_REQUEST",e.paymentFail="PAYMENT_FAIL",e.topupFail="TOPUP_FAIL",e.topupSuccessButNotAddToBalance="TOPUP_SUCCESS_BUT_NOT_ADD_TO_BALANCE",e.userCanceledSimilarTxn="USER_CANCELED_SIMILAR_TRANSACTION",e.mapAppNotFound="MAP_APP_NOT_FOUND",e.invalidAppSchemeURL="INVALID_APP_SCHEME_URL",e.noValueFound="NO_VALUE_FOUND",e.securityNotSetup="SECURITY_NOT_SETUP",e.userDenied="USER_DENIED",e.securityTemporaryLocked="SECURITY_TEMPORARY_LOCKED",e.couldNotGenerateBarcode="COULD_NOT_GENERATE_BARCODE",e.cannotDetectAvailability="CAN_NOT_DETECT_AVAILABILITY",e.suspectedDuplicatePayment="SUSPECTED_DUPLICATE_PAYMENT",e.noSufficientFund="NO_SUFFICIENT_FUND",e.unknown="UNKNOWN",e.sdkNotInitialized="SDK_NOT_INITIALIZED",e.tokenNotFound="TOKEN_NOT_FOUND",e.tokenExpired="TOKEN_EXPIRED",e.activeRequestExists="ACTIVE_REQUEST_EXISTS",e.invalidType="INVALID_TYPE",e.sessionNotFound="SESSION_NOT_FOUND",e.cookieError="COOKIE_ERROR",e.notAuthorized="NOT_AUTHORIZED",e.permissionRequired="PERMISSION_REQUIRED",e.deeplinkUnavailable="DEEPLINK_UNAVAILABLE",e.kycIncompleted="KYC_INCOMPLETED",e.noBankAccount="NO_BANK_ACCOUNT",e.invalidPaymentIdentifier="INVALID_PAYMENT_IDENTIFIER",e.otpSendTooShort="OTP_SEND_TOO_SHORT",e.otpSendOverLimit="OTP_SEND_OVER_LIMIT",e.userVerificationFailure="USER_VERIFICATION_FAILURE",e.unacceptableOp="UNACCEPTABLE_OP",e.kycUpdateRequired="KYC_UPDATE_REQUIRED",e.notCompleted="NOT_COMPLETED",e.kycValidationInProcess="KYC_VALIDATION_IN_PROCESS",e.noLocationData="NO_LOCATION_DATA",e.functionNotFound="FUNCTION_NOT_FOUND",e.originNotAllowed="ORIGIN_NOT_ALLOWED",e.messageSendingFailed="MESSAGE_SENDING_FAILED",e.transactionNotFound="TRANSACTION_NOT_FOUND",e.unexpectedOperation="UNEXPECTED_OP",e.merchantTimeout="MERCHANT_TIMEOUT",e.rateLimitExceeded="RATE_LIMIT_EXCEEDED",e.sdkUpgradeRequired="SDK_UPGRADE_REQUIRED",e.authorizationNeeded="AUTHORIZATION_NEEDED",e.invalidVirtualAccount="INVALID_VIRTUAL_ACCOUNT",e))(F||{});class j extends Error{constructor(e,t){super(e),this.errorCode=t}}const B=Object.freeze(Object.defineProperty({__proto__:null,getCookie:function({name:e}){return d.get(e)},getLocalStorage:function({name:e}){return localStorage.getItem(e)},getSessionStorage:function({name:e}){return sessionStorage.getItem(e)},getUrl:function(){return window.location.href},insertIframe:function(e){var{containerSelector:t,attributes:n}=e,i=n,{styles:a}=i,c=((e,t)=>{var n={};for(var i in e)s.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&o)for(var i of o(e))t.indexOf(i)<0&&r.call(e,i)&&(n[i]=e[i]);return n})(i,["styles"]);return new Promise(((e,n)=>{const o=document.querySelector(t);if(!o)return void n(new j(`Container with selector "${t}" not found.`,F.badRequestInsufficientParameter));const s=document.createElement("iframe");s.onload=()=>{e(!0)},s.onerror=()=>{n(new j("Failed to load iframe.",F.notReachable))},Object.assign(s.style,a),Object.entries(c).forEach((([e,t])=>{s.setAttribute(e,t)})),o.innerHTML="",o.appendChild(s)}))},removeCookie:function({name:e,options:t}){return d.remove(e,t)},removeElement:function({selector:e}){const t=document.querySelector(e);return!!t&&(t.remove(),!0)},removeLocalStorage:function({name:e}){return localStorage.removeItem(e)},removeQueryParametersFromUrl:function(e){const t=new URL(window.location.href);e.forEach((e=>t.searchParams.delete(e)));const n=`${t.pathname}${t.search}`;history.replaceState(history.state,"",n)},removeSessionStorage:function({name:e}){return sessionStorage.removeItem(e)},setCookie:function({name:e,value:t,options:n}){return d.set(e,t,n)},setLocalStorage:function({name:e,value:t}){return localStorage.setItem(e,t)},setSessionStorage:function({name:e,value:t}){return sessionStorage.setItem(e,t)},updateElementStyle:function({selector:e,styles:t}){const n=document.querySelector(e);return!!n&&(Object.assign(n.style,t),!0)}},Symbol.toStringTag,{value:"Module"})),V="8.45.1",$=globalThis;function q(e,t,n){const o=$,s=o.__SENTRY__=o.__SENTRY__||{},r=s[V]=s[V]||{};return r[e]||(r[e]=t())}const z="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,H=["debug","info","warn","error","log","assert","trace"],W={};function K(e){if(!("console"in $))return e();const t=$.console,n={},o=Object.keys(W);o.forEach((e=>{const o=W[e];n[e]=t[e],t[e]=o}));try{return e()}finally{o.forEach((e=>{t[e]=n[e]}))}}const Y=q("logger",(function(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return z?H.forEach((n=>{t[n]=(...t)=>{e&&K((()=>{$.console[n](`Sentry Logger [${n}]:`,...t)}))}})):H.forEach((e=>{t[e]=()=>{}})),t}));function G(){return J($),$}function J(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||V,t[V]=t[V]||{}}const Q=Object.prototype.toString;function X(e){return function(e,t){return Q.call(e)===`[object ${t}]`}(e,"Object")}function Z(){return Date.now()/1e3}const ee=function(){const{performance:e}=$;if(!e||!e.now)return Z;const t=Date.now()-e.now(),n=null==e.timeOrigin?t:e.timeOrigin;return()=>(n+e.now())/1e3}();function te(){const e=$,t=e.crypto||e.msCrypto;let n=()=>16*Math.random();try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(n=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch(o){}return"10000000100040008000100000000000".replace(/[018]/g,(e=>(e^(15&n())>>e/4).toString(16)))}function ne(){return te()}function oe(){return te().substring(16)}function se(e,t,n=2){if(!t||"object"!=typeof t||n<=0)return t;if(e&&t&&0===Object.keys(t).length)return e;const o=a({},e);for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(o[s]=se(o[s],t[s],n-1));return o}(()=>{const{performance:e}=$;if(!e||!e.now)return;const t=36e5,n=e.now(),o=Date.now(),s=e.timeOrigin?Math.abs(e.timeOrigin+n-o):t,r=s<t,i=e.timing&&e.timing.navigationStart,a="number"==typeof i?Math.abs(i+n-o):t;(r||a<t)&&(s<=a&&e.timeOrigin)})();const re="_sentrySpan";function ie(e,t){t?function(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch(o){z&&Y.log(`Failed to add non-enumerable property "${t}" to object`,e)}}(e,re,t):delete e[re]}function ae(e){return e[re]}class ce{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:ne(),spanId:oe()}}clone(){const e=new ce;return e._breadcrumbs=[...this._breadcrumbs],e._tags=a({},this._tags),e._extra=a({},this._extra),e._contexts=a({},this._contexts),this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata=a({},this._sdkProcessingMetadata),e._propagationContext=a({},this._propagationContext),e._client=this._client,e._lastEventId=this._lastEventId,ie(e,ae(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&function(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),e.did||t.did||(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||ee(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:te()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{const t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags=a(a({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,t){return this._tags=c(a({},this._tags),{[e]:t}),this._notifyScopeListeners(),this}setExtras(e){return this._extra=a(a({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,t){return this._extra=c(a({},this._extra),{[e]:t}),this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return null===t?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t="function"==typeof e?e(this):e,[n,o]=t instanceof le?[t.getScopeData(),t.getRequestSession()]:X(t)?[e,e.requestSession]:[],{tags:s,extra:r,user:i,contexts:c,level:l,fingerprint:u=[],propagationContext:d}=n||{};return this._tags=a(a({},this._tags),s),this._extra=a(a({},this._extra),r),this._contexts=a(a({},this._contexts),c),i&&Object.keys(i).length&&(this._user=i),l&&(this._level=l),u.length&&(this._fingerprint=u),d&&(this._propagationContext=d),o&&(this._requestSession=o),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,ie(this,void 0),this._attachments=[],this.setPropagationContext({traceId:ne()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const o=a({timestamp:Z()},e),s=this._breadcrumbs;return s.push(o),this._breadcrumbs=s.length>n?s.slice(-n):s,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:ae(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=se(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=a({spanId:oe()},e),this}getPropagationContext(){return this._propagationContext}captureException(e,t){const n=t&&t.event_id?t.event_id:te();if(!this._client)return Y.warn("No client configured on scope - will not capture exception!"),n;const o=new Error("Sentry syntheticException");return this._client.captureException(e,c(a({originalException:e,syntheticException:o},t),{event_id:n}),this),n}captureMessage(e,t,n){const o=n&&n.event_id?n.event_id:te();if(!this._client)return Y.warn("No client configured on scope - will not capture message!"),o;const s=new Error(e);return this._client.captureMessage(e,t,c(a({originalException:e,syntheticException:s},n),{event_id:o}),this),o}captureEvent(e,t){const n=t&&t.event_id?t.event_id:te();return this._client?(this._client.captureEvent(e,c(a({},t),{event_id:n}),this),n):(Y.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}}const le=ce;class ue{constructor(e,t){let n,o;n=e||new le,o=t||new le,this._stack=[{scope:n}],this._isolationScope=o}withScope(e){const t=this._pushScope();let n;try{n=e(t)}catch(s){throw this._popScope(),s}return o=n,Boolean(o&&o.then&&"function"==typeof o.then)?n.then((e=>(this._popScope(),e)),(e=>{throw this._popScope(),e})):(this._popScope(),n);var o}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return!(this._stack.length<=1)&&!!this._stack.pop()}}function de(){const e=J(G());return e.stack=e.stack||new ue(q("defaultCurrentScope",(()=>new le)),q("defaultIsolationScope",(()=>new le)))}function pe(e){return de().withScope(e)}function he(e,t){const n=de();return n.withScope((()=>(n.getStackTop().scope=e,t(e))))}function ge(e){return de().withScope((()=>e(de().getIsolationScope())))}function me(e){const t=J(e);return t.acs?t.acs:{withIsolationScope:ge,withScope:pe,withSetScope:he,withSetIsolationScope:(e,t)=>ge(t),getCurrentScope:()=>de().getScope(),getIsolationScope:()=>de().getIsolationScope()}}function fe(){return me(G()).getCurrentScope()}const _e=100;function ve(e,t){const n=fe().getClient(),o=me(G()).getIsolationScope();if(!n)return;const{beforeBreadcrumb:s=null,maxBreadcrumbs:r=_e}=n.getOptions();if(r<=0)return;const i=Z(),c=a({timestamp:i},e),l=s?K((()=>s(c,t))):c;null!==l&&(n.emit&&n.emit("beforeAddBreadcrumb",l,t),o.addBreadcrumb(l,r))}const Se=[F.sdkNotInitialized,F.notAuthorized,F.userCanceled,F.userCanceledSimilarTxn,F.suspectedDuplicatePayment,F.noSufficientFund];function ye(e,t,n){Se.includes(n)||function(e,t){const n=t;fe().captureMessage(e,n,void 0)}(`windowBridge.${e} failed. error: ${n}, message: ${t}`,"log")}class Ee{constructor(){var e;this.useLocalStorage=!0,this.memoryStorage={};try{localStorage.setItem(p.initializedAt,Date.now().toString());for(let t=0;t<localStorage.length;t++){const n=localStorage.key(t);null!=n&&(this.memoryStorage[n]=null!=(e=localStorage.getItem(n))?e:"")}}catch(t){this.useLocalStorage=!1}}getItem(e){var t,n;if(this.useLocalStorage)try{if(null!=localStorage.getItem(p.initializedAt)){const n=localStorage.getItem(e);return null!=n?n:null!=(t=d.get(e))?t:null}console.debug("local storage value has lost unexpectedly."),ve({message:"local storage value has lost unexpectedly.",category:"storage"})}catch(o){}return this.useLocalStorage=!1,null!=(n=this.memoryStorage[e])?n:null}setItem(e,t){if(this.memoryStorage[e]=t,this.useLocalStorage)try{localStorage.setItem(e,t),we(e)}catch(n){this.useLocalStorage=!1,console.warn("localStorage has become unavailable.")}}removeItem(e){delete this.memoryStorage[e];try{localStorage.removeItem(e),we(e)}catch(t){this.useLocalStorage=!1}}clear(){try{localStorage.clear(),localStorage.setItem(p.initializedAt,Date.now().toString()),function(){const e=d.get();for(const o in e)we(o);t=p.initializedAt,n=Date.now().toString(),d.set(t,n,Ie);var t,n}()}catch(e){}this.memoryStorage={}}}const Ie=Object.freeze(a({expires:365,sameSite:"None"},{secure:!0,Partitioned:!0}));function we(e){d.remove(e,Ie)}function Ae(){return Math.random().toString(36).substring(7)}new Ee;const be=e=>"object"!=typeof e||null===e?e:JSON.parse(JSON.stringify(e)),Te=e=>{var t;const n=null==(t=e[0])?void 0:t.callbacks;return"object"==typeof n&&null!==n},Ne=e=>Object.keys(e).reduce(((e,t)=>(e[t]=!0,e)),{});class Ce{constructor(e,t,n=[]){this.deferredPromises={},this.functions=e,this.allowedOrigins=t,this.middlewares=n,this.registeredCallbacks={},this.messageEventHandler=this.messageEventHandler.bind(this),this.subscribeToMessageEvent()}subscribeToMessageEvent(){window.addEventListener("message",this.messageEventHandler)}unsubscribeToMessageEvent(){window.removeEventListener("message",this.messageEventHandler)}messageEventHandler(e){var t;if(null==(t=e.data)?void 0:t.forWindowBridge)return this.allowedOrigins&&"request"===e.data.type&&!this.allowedOrigins.includes(e.origin)?this.sendErrorResponse(e,`${e.origin} is not allowed to make requests`,F.originNotAllowed):void("request"===e.data.type?this.handleRequest(e):"response"===e.data.type?this.handleResponse(e):"callback"===e.data.type&&this.handleCallback(e))}handleRequest(e){return l(this,null,(function*(){var t;const n=e.data.functionName,o=this.functions[n];o||this.sendErrorResponse(e,`Function '${n}' does not exists on the target window`,F.functionNotFound);const s=be(e.data.params);Te(s)&&(s[0].callbacks=Object.keys(s[0].callbacks).reduce(((t,n)=>(t[n]=(...t)=>{this.invokeCallback(e,n,t)},t)),{}));try{this.sendSuccessResponse(e,yield function(e,t,n,o){let s=-1;const r=o=>l(this,null,(function*(){if(++s,s<e.length){const n=e[s];return yield n(t,o,r)}return n(...o)}));return r(o)}([...this.middlewares,...null!=(t=o.middlewares)?t:[]],e,o,s))}catch(r){let t="Some error occurred while processing the request",n=F.unknown;r instanceof j?(t=r.message,n=r.errorCode):console.error(r),this.sendErrorResponse(e,t,n)}}))}handleResponse(e){if(!this.deferredPromises[e.data.key])return void console.warn(`Promise for ${e.data.functionName} not found`);const[t,n]=this.deferredPromises[e.data.key];delete this.deferredPromises[e.data.key],"success"===e.data.status?t(e.data.result):(delete this.registeredCallbacks[e.data.key],n(new j(e.data.message,e.data.errorCode)))}handleCallback(e){var t;const{key:n,callbackName:o,args:s}=e.data,r=null==(t=this.registeredCallbacks[n])?void 0:t[o];r?r(...s):console.warn(`Callback with key ${n} and name ${o} not found.`)}sendErrorResponse(e,t,n){ye(e.data.functionName,t,n),this.sendResponse(e,{status:"failure",message:t,errorCode:n})}sendSuccessResponse(e,t){this.sendResponse(e,{status:"success",result:t})}sendResponse(e,t){this.sendMessage(e.source,e.origin,a({type:"response",key:e.data.key,functionName:e.data.functionName},t))}invokeCallback(e,t,n){this.sendMessage(e.source,e.origin,{type:"callback",key:e.data.key,functionName:e.data.functionName,callbackName:t,args:n})}sendMessage(e,t,n){e.postMessage(a({forWindowBridge:!0},be(n)),t)}sendRequest(e,t,n,o){return new Promise(((s,r)=>l(this,null,(function*(){const i=`${n}--${Ae()}`;try{const l=yield e();if(!l)throw new Error("Target window is undefined");let u=o[0];if(Te(o)){const e=o[0].callbacks;this.addFunctionCallbacks(i,e),u=c(a({},o[0]),{callbacks:Ne(e)})}this.deferredPromises[i]=[s,r],this.sendMessage(l,t,{type:"request",key:i,functionName:n,params:[u]})}catch(l){delete this.deferredPromises[i],delete this.registeredCallbacks[i],r(new j(l.message,F.messageSendingFailed))}}))))}addFunctionCallbacks(e,t){Object.keys(t).forEach((e=>{if("function"!=typeof t[e])throw new Error(`Callback ${e} is not a function`)})),this.registeredCallbacks[e]=a({},t)}static init(e,t,n=[]){if(this._instance)throw new Error("WindowBridge already initialized, you can't call WindowBridge.init more than once");return this._instance=new this(e,t,n),this._instance}static destroy(){this._instance&&(this._instance.unsubscribeToMessageEvent(),this._instance=void 0)}static getBridge(){if(!this._instance)throw new Error("WindowBridge not initialized, please call WindowBridge.init before calling WindowBridge.getBridge");return this._instance}static getTargetWindowFunctionProxy(e,t){return Ce.getBridge().getTargetWindowFunctionProxy(e,t)}getTargetWindowFunctionProxy(e,t){return new Proxy(this,{get:(n,o)=>(...s)=>n.sendRequest(e,t,o.toString(),s)})}}const Oe="ppmna-iframe",ke="ppsdk-container";let Pe,De;function Le(){return Pe||(Pe=function(){if(document.getElementById(Oe))return;const e=document.createElement("div");return document.createElement("div"),e.setAttribute("id",ke),e.setAttribute("class",ke),e.style.all="initial",e.style.display="none",e.style.position="fixed",e.style.width="100%",e.style.height="100%",e.style.top="0",e.style.left="0",e.style.zIndex="2147483637",document.body.appendChild(e),e}()),Pe}function Re(e){const t=Le();t&&(t.style.display=e?"initial":"none")}function Ue(){return De||(De=new Promise(((e,t)=>{function n(){const n=document.createElement("iframe");n.setAttribute("src",x),n.setAttribute("name",Oe),n.setAttribute("id",Oe),n.setAttribute("class",Oe),n.setAttribute("allow","geolocation"),n.onload=()=>{e(n),n.onerror=null},n.onerror=t,n.style.all="initial",n.style.width="100%",n.style.height="100%",n.style.border="none";const o=Le();o&&(o.innerHTML="",o.append(n))}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(()=>{n()})):n()}))),De}Ce.init(B,[U]);const xe=Ce.getTargetWindowFunctionProxy((function(){return Ue().then((e=>null==e?void 0:e.contentWindow)).catch((()=>null))}),U);function Me(e,t,n){const o=Ae(),s=n=>{Fe(n.origin)&&n.data.name===e&&n.data.messageId===o&&function(e,t,n){var o,s,r;e.result===g&&(null==(o=null==t?void 0:t.fail)||o.call(t,e.data)),e.result===h&&(null==(s=null==t?void 0:t.success)||s.call(t,null==e?void 0:e.data)),e.result===m&&(null==(r=null==t?void 0:t.complete)||r.call(t),removeEventListener("message",n))}(n.data,t,s)};addEventListener("message",s),function(e){l(this,null,(function*(){var t;const n=yield Ue().catch((()=>{}));null==(t=null==n?void 0:n.contentWindow)||t.postMessage(JSON.parse(JSON.stringify(e)),U)}))}({name:e,params:n,messageId:o})}function Fe(e){return e===U}function je(e){return P.includes(e)}function Be(e){return D.includes(e)}function Ve(e,t,n){return function(o={}){const s=null==n?void 0:n(o);xe.logEvent(a({event_action:`pp_${e}_called`,event_category_suffix:e},s));const r=t(o);return r.then((t=>{var n;xe.logEvent(a({event_action:`pp_${e}_success`,event_category_suffix:e},s)),null==(n=o.success)||n.call(o,t)})).catch((t=>{var n;console.error(t.message),xe.logEvent(a({event_action:`pp_${e}_fail`,event_category_suffix:e,error_value:t.errorCode},s)),null==(n=o.fail)||n.call(o,{errorCode:t.errorCode})})).finally((()=>{var e;null==(e=o.complete)||e.call(o)})),r}}const $e={[F.sdkNotInitialized]:F.authorizationNeeded,[F.tokenNotFound]:F.authorizationNeeded,[F.tokenExpired]:F.tokenExpired};let qe,ze;Ue(),ze=Promise.resolve(!1);function He(e){const t=function(e,t){if(t){const t=localStorage.getItem(`${p.refreshToken}.${e}`);if(t)return t}return d.get(`${p.refreshToken}.${e}`)||d.get(p.refreshToken)||""}(e.clientId,e.useLocalStorage),n=function(e,t){if(t){const t=localStorage.getItem(`${p.codeVerifier}.${e}`);if(t)return t}return d.get(`${p.codeVerifier}.${e}`)||d.get(p.codeVerifier)||""}(e.clientId,e.useLocalStorage),o=c(a({},e),{refreshToken:t,clientVersion:"2.56.0",codeVerifier:n,clientSdkType:qe,clientUrl:window.location.href});let s;const r=new Promise((e=>s=e)),i=()=>{var t;s(!0),null==(t=e.complete)||t.call(e)};ze.then((()=>Ue())).then((()=>{Me(f,c(a({},e),{complete:i}),o)})).catch((()=>{var t;null==(t=e.fail)||t.call(e,{errorCode:F.sdkNotInitialized}),i()})),ze=r}addEventListener("message",(e=>{var t;if(!(null==(t=e.data)?void 0:t.forWindowBridge)&&Fe(e.origin))if(e.data.name===I&&window.location.reload(),e.data.name!==A)if(e.data.name!==T)if(e.data.name!==b){if(e.data.name===w){const t=e.data.data;"_blank"===t.target?window.open(t.url,"_blank"):window.location.href=t.url}if(e.data.name===N){const{params:t}=e.data.data;!function(e){console.debug(...e)}(t)}}else Re(!1);else Re(!0);else Re(!0)})),addEventListener("popstate",(()=>{Ue().then((e=>{var t;const n={name:C};null==(t=null==e?void 0:e.contentWindow)||t.postMessage(n,U)})).catch((e=>console.warn(e)))}));var We;We={_handleMessageFromNative:e=>{Ue().then((t=>{var n;null==(n=null==t?void 0:t.contentWindow)||n.postMessage(JSON.parse(JSON.stringify({name:y,params:{json:e}})),U)}))}},(!window.hasOwnProperty(k)||window[k]!==We)&&(window[k]=We);const Ke=["init","setTitle","copyToClipboard","getSessionData","setSessionData","getStorageData","setStorageData","removeStorageData","getLoginUrl"],Ye=["renderCoupons"];const Ge={version:"2.56.0",revision:"8161aa8"};Ve("getLoginUrl",xe.getLoginUrl);const Je=Ve("getPaymentSettings",xe.getPaymentSettings),Qe=Ve("markAsReady",xe.markAsReady);Ve("renderButton",xe.renderButton);var Xe=(e=>(e.validToken="TOKEN_VALID",e.initialized="INITIALIZED",e.emailRegistered="EMAIL_REGISTERED",e.emailNotVerified="EMAIL_NOT_VERIFIED",e.success="SUCCESS",e.loggedOut="LOGGED_OUT",e.connected="CONNECTED",e))(Xe||{});const Ze=Ve("logout",(()=>l(this,null,(function*(){try{return yield xe.logout(),{statusCode:Xe.loggedOut}}catch(e){throw new j(`An error occurred while trying to logout the user, error=${e}`,F.unknown)}}))));const et={verifyMultiFactorAuthResult:function(e){const t=new URL(window.location.href);Me(_,e,c(a({},e),{sessionId:t.searchParams.get("ppSessionId")}))},share:function(e){if(!(null==navigator?void 0:navigator.share))return void Me(v,e,e);const t={text:null==e?void 0:e.text};navigator.share(t).then((()=>{var t,n;null==(t=null==e?void 0:e.success)||t.call(e),null==(n=null==e?void 0:e.complete)||n.call(e)})).catch((()=>{var t,n;null==(t=null==e?void 0:e.fail)||t.call(e,{errorCode:F.unknown}),null==(n=null==e?void 0:e.complete)||n.call(e)}))},setTitle:function(e){var t,n,o;document.title=null!=(t=null==e?void 0:e.title)?t:"",null==(n=null==e?void 0:e.success)||n.call(e),null==(o=null==e?void 0:e.complete)||o.call(e)},renderCoupons:Ve("renderCoupons",(e=>l(this,null,(function*(){const{merchant:t,couponId:n,containerId:o,postLoginRedirectUrl:s=window.location.href,postLoginRedirectType:r,locale:i}=e,a=document.getElementById(o);if(!a)throw new j("Invalid coupon container Id",F.badRequestInsufficientParameter);const c=yield xe.fetchCoupons({merchantId:t,couponId:n,postLoginRedirectUrl:s,postLoginRedirectType:r});try{const e=document.createElement("iframe");e.src=M,e.style.cssText="width:100%;height: 0;border: none;transition: height 300ms ease-in;display: block;",yield new Promise(((t,n)=>{e.onload=()=>t(!0),e.onerror=()=>n(new Error("Failed to load coupon iframe")),a.innerHTML="",a.append(e)})),e.onload=null,e.onerror=null,window.addEventListener("message",(({data:t,source:n})=>{"update-iframe-height"===(null==t?void 0:t.eventName)&&e.contentWindow===n&&(e.style.height=`${t.height}px`)}));const n=Ce.getTargetWindowFunctionProxy((()=>e.contentWindow),U);yield n.renderCoupons({coupons:c,merchantId:t,locale:i,postLoginRedirectUrl:s,postLoginRedirectType:r})}catch(l){throw new j(`An error occurred while displaying coupons, merchantId=${t}, couponId=${n}, error=${l}`,F.unknown)}}))),(e=>({event_label2:e.couponId,merchant_id:e.merchant}))),scanCode:function(e){var t;const n=c(a({},e),{redirectUrlOnCancel:null!=(t=null==e?void 0:e.redirectUrlOnCancel)?t:window.location.href});Me(S,e,n)},copyToClipboard:function(e){var t,n,o;const s=document.createElement("textarea");s.setAttribute("readonly","true"),s.setAttribute("contenteditable","true"),s.value=e.value,document.body.appendChild(s),s.select(),s.setSelectionRange(0,s.value.length);const r=document.execCommand("copy");document.body.removeChild(s),r?null==(t=null==e?void 0:e.success)||t.call(e):null==(n=null==e?void 0:e.fail)||n.call(e,{errorCode:F.other}),null==(o=e.complete)||o.call(e)},getSessionData:function(e){var t,n;const o=sessionStorage.getItem(null==e?void 0:e.key);null==(t=null==e?void 0:e.success)||t.call(e,{[null==e?void 0:e.key]:null!=o?o:""}),null==(n=null==e?void 0:e.complete)||n.call(e)},setSessionData:function(e){var t,n,o;sessionStorage.setItem(null==e?void 0:e.key,null!=(t=null==e?void 0:e.value)?t:""),null==(n=null==e?void 0:e.success)||n.call(e),null==(o=null==e?void 0:e.complete)||o.call(e)},getStorageData:function(e){var t,n;const o=localStorage.getItem(null==e?void 0:e.key);null==(t=null==e?void 0:e.success)||t.call(e,{[null==e?void 0:e.key]:null!=o?o:""}),null==(n=null==e?void 0:e.complete)||n.call(e)},setStorageData:function(e){var t,n,o;localStorage.setItem(null==e?void 0:e.key,null!=(t=null==e?void 0:e.value)?t:""),null==(n=null==e?void 0:e.success)||n.call(e),null==(o=null==e?void 0:e.complete)||o.call(e)},removeStorageData:function(e){var t,n;localStorage.removeItem(null==e?void 0:e.key),null==(t=null==e?void 0:e.success)||t.call(e),null==(n=null==e?void 0:e.complete)||n.call(e)},getKycPassportInfo:function(e){const t=window.location.href;Me(E,e,c(a({},e),{url:t}))},logout:Ze,getPaymentSettings:Je,markAsReady:Qe};return function({sdkType:e,clientFunctions:t}){qe=e;const n=e===O.MiniApp?je:Be,o=new Proxy(c(a({},t),{init:He}),{get(t,o){if(o in Ge)return Ge[o];const s=o;if(!n(s))throw new Error(`${s} is not supported by ${e} JS SDK`);return function(e,t){return(n={})=>new Promise(((o,s)=>{let r,i;e(c(a({},n),{success:e=>{var t;i=e,null==(t=n.success)||t.call(n,e)},fail:e=>{var o;"init"===t&&$e[e.errorCode]?i={statusCode:$e[e.errorCode]}:r=e,null==(o=n.fail)||o.call(n,e)},complete:()=>{var e;r?s(r):o(i),null==(e=n.complete)||e.call(n)}}))}))}((function(e){return l(this,null,(function*(){var n,r;if(!Ke.includes(s)&&!(yield ze)){if(!Ye.includes(s)||!function(e){return void 0!==e.clientId}(e))return null==(n=e.fail)||n.call(e,{errorCode:F.sdkNotInitialized}),void(null==(r=e.complete)||r.call(e));He({clientId:e.clientId,env:e.env}),yield ze}const i=t[s];if(i&&"function"==typeof i)return i(e);Me(o,e,e)}))}),s)}});return window._pp=o,function(e){const t=window._ppcs;if(t){window._ppcs=void 0;for(const[n,o,s]of t){const t=e[n](o);s&&s(t)}}}(o),o}({sdkType:O.MiniApp,clientFunctions:et})}();
|
|
2
|
+
var pp=function(){"use strict";var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,s=(t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,a=(e,t)=>{for(var n in t||(t={}))r.call(t,n)&&s(e,n,t[n]);if(o)for(var n of o(t))i.call(t,n)&&s(e,n,t[n]);return e},l=(e,o)=>t(e,n(o)),c=(e,t,n)=>new Promise(((o,r)=>{var i=e=>{try{a(n.next(e))}catch(t){r(t)}},s=e=>{try{a(n.throw(e))}catch(t){r(t)}},a=e=>e.done?o(e.value):Promise.resolve(e.value).then(i,s);a((n=n.apply(e,t)).next())}));function u(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}var d=function e(t,n){function o(e,o,r){if("undefined"!=typeof document){"number"==typeof(r=u({},n,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var i="";for(var s in r)r[s]&&(i+="; "+s,!0!==r[s]&&(i+="="+r[s].split(";")[0]));return document.cookie=e+"="+t.write(o,e)+i}}return Object.create({set:o,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],o={},r=0;r<n.length;r++){var i=n[r].split("="),s=i.slice(1).join("=");try{var a=decodeURIComponent(i[0]);if(o[a]=t.read(s,a),e===a)break}catch(l){}}return e?o[e]:o}},remove:function(e,t){o(e,"",u({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,u({},this.attributes,t))},withConverter:function(t){return e(u({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});const g="_PayPayJsBridge",f=["init","openWebview","openMap","closeApp","makePayment","topup","setSessionData","getSessionData","setStorageData","getStorageData","removeStorageData","getPermissionStatus","scanCode","showAlert","showErrorSheet","getTopBarHeight","setTitle","showUpdateWarning","getPlatformInformation","openApp","share","getKycInformation","getUserLocation","checkPaymentMethod","registerKyc","startMultiFactorAuth","verifyMultiFactorAuthResult","getBankInfo","logout","getUserProfile","getBalance","getUserAddress","getUAID","copyToClipboard","registerUserInfo","setEnablePullDownRefresh","registerEmail","inputAddress","getDeviceInformation","request","requestInternal","registerPaymentFeatures","initKycPassport","getKycPassportInfo","shortcutExists","addShortcut","getAllUserAddresses","getUserPaymentFeatureSettings","getPaymentSettings","getTransactionInfo","getTransactions","getPayPayCardInfo","getExternalLinkageInformation","markAsReady","renderCoupons"],m=["init","createOrder","makePayment","render","logout","getAuthStatus","getUserProfile","getBalance","getUserAddress","getUAID","getCashbackInformation","renderCoupons","getLoginUrl","renderButton"],p="2.58.0",h=new URL("https://mini-app-sdk-core.paypay.ne.jp/"),v=h.origin,y=new URL(`./iframe.html?v=${p}&rev=5c56199`,h).href,w=new URL(`./coupon/iframe.html?v=${p}`,h).href;new URL(`./button/iframe.html?v=${p}`,h).href;const b="BAD_REQUEST_INSUFFICIENT_PARAMETER",S="UNKNOWN",I="SDK_NOT_INITIALIZED",E="TOKEN_NOT_FOUND",k="TOKEN_EXPIRED",C="AUTHORIZATION_NEEDED",P="ppjssdk.refreshToken",O="ppjssdk.codeVerifier";class _ extends Error{constructor(e,t){super(e),this.errorCode=t}}const T=Object.freeze(Object.defineProperty({__proto__:null,getCookie:function({name:e}){return d.get(e)},getLocalStorage:function({name:e}){return localStorage.getItem(e)},getSessionStorage:function({name:e}){return sessionStorage.getItem(e)},getUrl:function(){return window.location.href},insertIframe:function(e){var{containerSelector:t,attributes:n}=e,s=n,{styles:a}=s,l=((e,t)=>{var n={};for(var s in e)r.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&o)for(var s of o(e))t.indexOf(s)<0&&i.call(e,s)&&(n[s]=e[s]);return n})(s,["styles"]);return new Promise(((e,n)=>{const o=document.querySelector(t);if(!o)return void n(new _(`Container with selector "${t}" not found.`,b));const r=document.createElement("iframe");r.onload=()=>{e(!0)},r.onerror=()=>{n(new _("Failed to load iframe.","NOT_REACHABLE"))},Object.assign(r.style,a),Object.entries(l).forEach((([e,t])=>{r.setAttribute(e,t)})),o.innerHTML="",o.appendChild(r)}))},removeCookie:function({name:e,options:t}){return d.remove(e,t)},removeElement:function({selector:e}){const t=document.querySelector(e);return!!t&&(t.remove(),!0)},removeLocalStorage:function({name:e}){return localStorage.removeItem(e)},removeQueryParametersFromUrl:function(e){const t=new URL(window.location.href);e.forEach((e=>t.searchParams.delete(e)));const n=`${t.pathname}${t.search}`;history.replaceState(history.state,"",n)},removeSessionStorage:function({name:e}){return sessionStorage.removeItem(e)},setCookie:function({name:e,value:t,options:n}){return d.set(e,t,n)},setLocalStorage:function({name:e,value:t}){return localStorage.setItem(e,t)},setSessionStorage:function({name:e,value:t}){return sessionStorage.setItem(e,t)},updateElementStyle:function({selector:e,styles:t}){const n=document.querySelector(e);return!!n&&(Object.assign(n.style,t),!0)}},Symbol.toStringTag,{value:"Module"})),A="success",R="fail",L="complete";var N=(e=>(e.MiniApp="MiniApp",e.SmartPayment="SmartPayment",e))(N||{});function U(){return Math.random().toString(36).substring(7)}const D=e=>"object"!=typeof e||null===e?e:JSON.parse(JSON.stringify(e)),M=e=>{var t;const n=null==(t=e[0])?void 0:t.callbacks;return"object"==typeof n&&null!==n},x=e=>Object.keys(e).reduce(((e,t)=>(e[t]=!0,e)),{});class ${constructor(e,t,n=[],o){this.deferredPromises={},this.functions=e,this.allowedOrigins=t,this.middlewares=n,this.registeredCallbacks={},this.messageEventHandler=this.messageEventHandler.bind(this),this.errorLogger=o,this.subscribeToMessageEvent()}subscribeToMessageEvent(){window.addEventListener("message",this.messageEventHandler)}unsubscribeToMessageEvent(){window.removeEventListener("message",this.messageEventHandler)}messageEventHandler(e){var t;if(null==(t=e.data)?void 0:t.forWindowBridge)return this.allowedOrigins&&"request"===e.data.type&&!this.allowedOrigins.includes(e.origin)?this.sendErrorResponse(e,`${e.origin} is not allowed to make requests`,"ORIGIN_NOT_ALLOWED"):void("request"===e.data.type?this.handleRequest(e):"response"===e.data.type?this.handleResponse(e):"callback"===e.data.type&&this.handleCallback(e))}handleRequest(e){return c(this,null,(function*(){var t;const n=e.data.functionName,o=this.functions[n];o||this.sendErrorResponse(e,`Function '${n}' does not exists on the target window`,"FUNCTION_NOT_FOUND");const r=D(e.data.params);M(r)&&(r[0].callbacks=Object.keys(r[0].callbacks).reduce(((t,n)=>(t[n]=(...t)=>{this.invokeCallback(e,n,t)},t)),{}));try{this.sendSuccessResponse(e,yield function(e,t,n,o){let r=-1;const i=o=>c(this,null,(function*(){if(++r,r<e.length){const n=e[r];return yield n(t,o,i)}return n(...o)}));return i(o)}([...this.middlewares,...null!=(t=o.middlewares)?t:[]],e,o,r))}catch(i){let t="Some error occurred while processing the request",n=S;i instanceof _?(t=i.message,n=i.errorCode):console.error(i),this.sendErrorResponse(e,t,n)}}))}handleResponse(e){if(!this.deferredPromises[e.data.key])return void console.warn(`Promise for ${e.data.functionName} not found`);const[t,n]=this.deferredPromises[e.data.key];delete this.deferredPromises[e.data.key],"success"===e.data.status?t(e.data.result):(delete this.registeredCallbacks[e.data.key],n(new _(e.data.message,e.data.errorCode)))}handleCallback(e){var t;const{key:n,callbackName:o,args:r}=e.data,i=null==(t=this.registeredCallbacks[n])?void 0:t[o];i?i(...r):console.warn(`Callback with key ${n} and name ${o} not found.`)}sendErrorResponse(e,t,n){this.errorLogger&&this.errorLogger(e.data.functionName,t,n),this.sendResponse(e,{status:"failure",message:t,errorCode:n})}sendSuccessResponse(e,t){this.sendResponse(e,{status:"success",result:t})}sendResponse(e,t){this.sendMessage(e.source,e.origin,a({type:"response",key:e.data.key,functionName:e.data.functionName},t))}invokeCallback(e,t,n){this.sendMessage(e.source,e.origin,{type:"callback",key:e.data.key,functionName:e.data.functionName,callbackName:t,args:n})}sendMessage(e,t,n){e.postMessage(a({forWindowBridge:!0},D(n)),t)}sendRequest(e,t,n,o){return new Promise(((r,i)=>c(this,null,(function*(){const s=`${n}--${U()}`;try{const c=yield e();if(!c)throw new Error("Target window is undefined");let u=o[0];if(M(o)){const e=o[0].callbacks;this.addFunctionCallbacks(s,e),u=l(a({},o[0]),{callbacks:x(e)})}this.deferredPromises[s]=[r,i],this.sendMessage(c,t,{type:"request",key:s,functionName:n,params:[u]})}catch(c){delete this.deferredPromises[s],delete this.registeredCallbacks[s],i(new _(c.message,"MESSAGE_SENDING_FAILED"))}}))))}addFunctionCallbacks(e,t){Object.keys(t).forEach((e=>{if("function"!=typeof t[e])throw new Error(`Callback ${e} is not a function`)})),this.registeredCallbacks[e]=a({},t)}static init(e,t,n=[],o){if(this._instance)throw new Error("WindowBridge already initialized, you can't call WindowBridge.init more than once");return this._instance=new this(e,t,n,o),this._instance}static destroy(){this._instance&&(this._instance.unsubscribeToMessageEvent(),this._instance=void 0)}static getBridge(){if(!this._instance)throw new Error("WindowBridge not initialized, please call WindowBridge.init before calling WindowBridge.getBridge");return this._instance}static getTargetWindowFunctionProxy(e,t){return $.getBridge().getTargetWindowFunctionProxy(e,t)}getTargetWindowFunctionProxy(e,t){return new Proxy(this,{get:(n,o)=>(...r)=>n.sendRequest(e,t,o.toString(),r)})}}const F="ppmna-iframe",B="ppsdk-container";let j,W;function q(){return j||(j=function(){if(document.getElementById(F))return;const e=document.createElement("div");return document.createElement("div"),e.setAttribute("id",B),e.setAttribute("class",B),e.style.all="initial",e.style.display="none",e.style.position="fixed",e.style.width="100%",e.style.height="100%",e.style.top="0",e.style.left="0",e.style.zIndex="2147483637",document.body.appendChild(e),e}()),j}function K(e){const t=q();t&&(t.style.display=e?"initial":"none")}function H(){return W||(W=new Promise(((e,t)=>{function n(){const n=document.createElement("iframe");n.setAttribute("src",y),n.setAttribute("name",F),n.setAttribute("id",F),n.setAttribute("class",F),n.setAttribute("allow","geolocation"),n.onload=()=>{e(n),n.onerror=null},n.onerror=t,n.style.all="initial",n.style.width="100%",n.style.height="100%",n.style.border="none";const o=q();o&&(o.innerHTML="",o.append(n))}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(()=>{n()})):n()}))),W}$.init(T,[v]);const J=$.getTargetWindowFunctionProxy((function(){return H().then((e=>null==e?void 0:e.contentWindow)).catch((()=>null))}),v);function z(e,t,n){const o=U(),r=n=>{V(n.origin)&&n.data.name===e&&n.data.messageId===o&&function(e,t,n){var o,r,i;e.result===R&&(null==(o=null==t?void 0:t.fail)||o.call(t,e.data)),e.result===A&&(null==(r=null==t?void 0:t.success)||r.call(t,null==e?void 0:e.data)),e.result===L&&(null==(i=null==t?void 0:t.complete)||i.call(t),removeEventListener("message",n))}(n.data,t,r)};addEventListener("message",r),function(e){c(this,null,(function*(){var t;const n=yield H().catch((()=>{}));null==(t=null==n?void 0:n.contentWindow)||t.postMessage(JSON.parse(JSON.stringify(e)),v)}))}({name:e,params:n,messageId:o})}function V(e){return e===v}function G(e){return f.includes(e)}function Z(e){return m.includes(e)}function Q(e,t,n){return function(o={}){const r=null==n?void 0:n(o);J.logEvent(a({event_action:`pp_${e}_called`,event_category_suffix:e},r));const i=t(o);return i.then((t=>{var n;J.logEvent(a({event_action:`pp_${e}_success`,event_category_suffix:e},r)),null==(n=o.success)||n.call(o,t)})).catch((t=>{var n;console.error(t.message),J.logEvent(a({event_action:`pp_${e}_fail`,event_category_suffix:e,error_value:t.errorCode},r)),null==(n=o.fail)||n.call(o,{errorCode:t.errorCode})})).finally((()=>{var e;null==(e=o.complete)||e.call(o)})),i}}const X={[I]:C,[E]:C,[k]:k};let Y,ee;H(),ee=Promise.resolve(!1);function te(e){const t=function(e,t){if(t){const t=localStorage.getItem(`${P}.${e}`);if(t)return t}return d.get(`${P}.${e}`)||d.get(P)||""}(e.clientId,e.useLocalStorage),n=function(e,t){if(t){const t=localStorage.getItem(`${O}.${e}`);if(t)return t}return d.get(`${O}.${e}`)||d.get(O)||""}(e.clientId,e.useLocalStorage),o=l(a({},e),{refreshToken:t,clientVersion:"2.58.0",codeVerifier:n,clientSdkType:Y,clientUrl:window.location.href});let r;const i=new Promise((e=>r=e)),s=()=>{var t;r(!0),null==(t=e.complete)||t.call(e)};ee.then((()=>H())).then((()=>{z("init",l(a({},e),{complete:s}),o)})).catch((()=>{var t;null==(t=e.fail)||t.call(e,{errorCode:I}),s()})),ee=i}addEventListener("message",(e=>{var t;if(!(null==(t=e.data)?void 0:t.forWindowBridge)&&V(e.origin))if("reload"===e.data.name&&window.location.reload(),"makeVisible"!==e.data.name)if("showIframe"!==e.data.name)if("hideIframe"!==e.data.name){if("link"===e.data.name){const t=e.data.data;"_blank"===t.target?window.open(t.url,"_blank"):window.location.href=t.url}if("consoleDebugInfo"===e.data.name){const{params:t}=e.data.data;!function(e){console.debug(...e)}(t)}}else K(!1);else K(!0);else K(!0)})),addEventListener("popstate",(()=>{H().then((e=>{var t;const n={name:"clientPopState"};null==(t=null==e?void 0:e.contentWindow)||t.postMessage(n,v)})).catch((e=>console.warn(e)))}));var ne;ne={_handleMessageFromNative:e=>{H().then((t=>{var n;null==(n=null==t?void 0:t.contentWindow)||n.postMessage(JSON.parse(JSON.stringify({name:"handleMessageFromNative",params:{json:e}})),v)}))}},(!window.hasOwnProperty(g)||window[g]!==ne)&&(window[g]=ne);const oe=["init","setTitle","copyToClipboard","getSessionData","setSessionData","getStorageData","setStorageData","removeStorageData","getLoginUrl"],re=["renderCoupons"];const ie={version:"2.58.0",revision:"5c56199"};Q("getLoginUrl",J.getLoginUrl);const se=Q("getPaymentSettings",J.getPaymentSettings),ae=Q("markAsReady",J.markAsReady);Q("renderButton",J.renderButton);var le=(e=>(e.validToken="TOKEN_VALID",e.initialized="INITIALIZED",e.emailRegistered="EMAIL_REGISTERED",e.emailNotVerified="EMAIL_NOT_VERIFIED",e.success="SUCCESS",e.loggedOut="LOGGED_OUT",e.connected="CONNECTED",e))(le||{});const ce=Q("logout",(()=>c(this,null,(function*(){try{return yield J.logout(),{statusCode:le.loggedOut}}catch(e){throw new _(`An error occurred while trying to logout the user, error=${e}`,S)}}))));const ue={verifyMultiFactorAuthResult:function(e){const t=new URL(window.location.href);z("verifyMultiFactorAuthResult",e,l(a({},e),{sessionId:t.searchParams.get("ppSessionId")}))},share:function(e){if(!(null==navigator?void 0:navigator.share))return void z("share",e,e);const t={text:null==e?void 0:e.text};navigator.share(t).then((()=>{var t,n;null==(t=null==e?void 0:e.success)||t.call(e),null==(n=null==e?void 0:e.complete)||n.call(e)})).catch((()=>{var t,n;null==(t=null==e?void 0:e.fail)||t.call(e,{errorCode:S}),null==(n=null==e?void 0:e.complete)||n.call(e)}))},setTitle:function(e){var t,n,o;document.title=null!=(t=null==e?void 0:e.title)?t:"",null==(n=null==e?void 0:e.success)||n.call(e),null==(o=null==e?void 0:e.complete)||o.call(e)},renderCoupons:Q("renderCoupons",(e=>c(this,null,(function*(){const{merchant:t,couponId:n,containerId:o,postLoginRedirectUrl:r=window.location.href,postLoginRedirectType:i,locale:s}=e,a=document.getElementById(o);if(!a)throw new _("Invalid coupon container Id",b);const l=yield J.fetchCoupons({merchantId:t,couponId:n,postLoginRedirectUrl:r,postLoginRedirectType:i});try{const e=document.createElement("iframe");e.src=w,e.style.cssText="width:100%;height: 0;border: none;transition: height 300ms ease-in;display: block;",yield new Promise(((t,n)=>{e.onload=()=>t(!0),e.onerror=()=>n(new Error("Failed to load coupon iframe")),a.innerHTML="",a.append(e)})),e.onload=null,e.onerror=null,window.addEventListener("message",(({data:t,source:n})=>{"update-iframe-height"===(null==t?void 0:t.eventName)&&e.contentWindow===n&&(e.style.height=`${t.height}px`)}));const n=$.getTargetWindowFunctionProxy((()=>e.contentWindow),v);yield n.renderCoupons({coupons:l,merchantId:t,locale:s,postLoginRedirectUrl:r,postLoginRedirectType:i})}catch(c){throw new _(`An error occurred while displaying coupons, merchantId=${t}, couponId=${n}, error=${c}`,S)}}))),(e=>({event_label2:e.couponId,merchant_id:e.merchant}))),scanCode:function(e){var t;z("scanCode",e,l(a({},e),{redirectUrlOnCancel:null!=(t=null==e?void 0:e.redirectUrlOnCancel)?t:window.location.href}))},copyToClipboard:function(e){var t,n,o;const r=document.createElement("textarea");r.setAttribute("readonly","true"),r.setAttribute("contenteditable","true"),r.value=e.value,document.body.appendChild(r),r.select(),r.setSelectionRange(0,r.value.length);const i=document.execCommand("copy");document.body.removeChild(r),i?null==(t=null==e?void 0:e.success)||t.call(e):null==(n=null==e?void 0:e.fail)||n.call(e,{errorCode:"other"}),null==(o=e.complete)||o.call(e)},getSessionData:function(e){var t,n;const o=sessionStorage.getItem(null==e?void 0:e.key);null==(t=null==e?void 0:e.success)||t.call(e,{[null==e?void 0:e.key]:null!=o?o:""}),null==(n=null==e?void 0:e.complete)||n.call(e)},setSessionData:function(e){var t,n,o;sessionStorage.setItem(null==e?void 0:e.key,null!=(t=null==e?void 0:e.value)?t:""),null==(n=null==e?void 0:e.success)||n.call(e),null==(o=null==e?void 0:e.complete)||o.call(e)},getStorageData:function(e){var t,n;const o=localStorage.getItem(null==e?void 0:e.key);null==(t=null==e?void 0:e.success)||t.call(e,{[null==e?void 0:e.key]:null!=o?o:""}),null==(n=null==e?void 0:e.complete)||n.call(e)},setStorageData:function(e){var t,n,o;localStorage.setItem(null==e?void 0:e.key,null!=(t=null==e?void 0:e.value)?t:""),null==(n=null==e?void 0:e.success)||n.call(e),null==(o=null==e?void 0:e.complete)||o.call(e)},removeStorageData:function(e){var t,n;localStorage.removeItem(null==e?void 0:e.key),null==(t=null==e?void 0:e.success)||t.call(e),null==(n=null==e?void 0:e.complete)||n.call(e)},getKycPassportInfo:function(e){const t=window.location.href;z("getKycPassportInfo",e,l(a({},e),{url:t}))},logout:ce,getPaymentSettings:se,markAsReady:ae};return function({sdkType:e,clientFunctions:t}){Y=e;const n=e===N.MiniApp?G:Z,o=new Proxy(l(a({},t),{init:te}),{get(t,o){if(o in ie)return ie[o];const r=o;if(!n(r))throw new Error(`${r} is not supported by ${e} JS SDK`);return function(e,t){return(n={})=>new Promise(((o,r)=>{let i,s;e(l(a({},n),{success:e=>{var t;s=e,null==(t=n.success)||t.call(n,e)},fail:e=>{var o;"init"===t&&X[e.errorCode]?s={statusCode:X[e.errorCode]}:i=e,null==(o=n.fail)||o.call(n,e)},complete:()=>{var e;i?r(i):o(s),null==(e=n.complete)||e.call(n)}}))}))}((function(e){return c(this,null,(function*(){var n,i;if(!oe.includes(r)&&!(yield ee)){if(!re.includes(r)||!function(e){return void 0!==e.clientId}(e))return null==(n=e.fail)||n.call(e,{errorCode:I}),void(null==(i=e.complete)||i.call(e));te({clientId:e.clientId,env:e.env}),yield ee}const s=t[r];if(s&&"function"==typeof s)return s(e);z(o,e,e)}))}),r)}});return window._pp=o,function(e){const t=window._ppcs;if(t){window._ppcs=void 0;for(const[n,o,r]of t){const t=e[n](o);r&&r(t)}}}(o),o}({sdkType:N.MiniApp,clientFunctions:ue})}();
|