@paypay/mini-app-js-sdk 2.49.0 → 2.54.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.
@@ -1,2 +1,2 @@
1
- export declare const miniAppSupportedFunctions: readonly ["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", "checkAccessToken", "debug", "inputAddress", "getDeviceInformation", "openMiniApp", "request", "requestInternal", "registerPaymentFeatures", "initKycPassport", "getKycPassportInfo", "shortcutExists", "addShortcut", "getAllUserAddresses", "getUserPaymentFeatureSettings", "getPaymentSettings", "getTransactionInfo", "getTransactions", "getPayPayCardInfo", "getExternalLinkageInformation", "markAsReady", "renderCoupons"];
1
+ export declare const miniAppSupportedFunctions: readonly ["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"];
2
2
  export declare const smartPaymentSupportedFunctions: readonly ["init", "createOrder", "makePayment", "render", "logout", "getAuthStatus", "getUserProfile", "getBalance", "getUserAddress", "getUAID", "getCashbackInformation", "renderCoupons", "getLoginUrl"];
@@ -1,3 +1,3 @@
1
1
  import { MakePaymentParams } from '../types/makePayment';
2
- declare const initMakePayment: (initMakePayment: MakePaymentParams) => Promise<void>;
2
+ declare const initMakePayment: (initMakePayment: MakePaymentParams) => void;
3
3
  export { initMakePayment };
@@ -8,3 +8,4 @@ export declare const SENTRY_DSN: string | undefined;
8
8
  export declare const SENTRY_SAMPLE_RATE: number;
9
9
  export declare const GA_API_SECRET: string | undefined;
10
10
  export declare const GA_MEASUREMENT_ID: string | undefined;
11
+ export declare const IMAGE_URL: string | undefined;
@@ -21,7 +21,7 @@ import { StartMultiFactorAuthParams } from './types/startMultiFactorAuth';
21
21
  import { TopupParams } from './types/topup';
22
22
  import { VerifyMultiFactorAuthResultParams } from './types/verifyMultiFactorAuthResult';
23
23
  import { JsBridge, NativeParams } from './jsbridge-core/jsbridge';
24
- import { AddShortcutParams, CloseAppParams, GetCashbackInfoParams, MapParams, MiniAppResult, OpenAppParams, OpenMiniAppParams, RegisterPaymentFeaturesParams, RegisterUserInfoParams, RequestInternalParams, RequestParams, ScanCodeParams, SetEnablePullDownRefreshParams, ShareParams, ShortcutExistsParams, ShowAlertParams, ShowErrorSheetParams, SmsAuthParams } from './types';
24
+ import { AddShortcutParams, CloseAppParams, GetCashbackInfoParams, MapParams, MiniAppResult, OpenAppParams, RegisterPaymentFeaturesParams, RegisterUserInfoParams, RequestInternalParams, RequestParams, ScanCodeParams, SetEnablePullDownRefreshParams, ShareParams, ShortcutExistsParams, ShowAlertParams, ShowErrorSheetParams, SmsAuthParams } from './types';
25
25
  export declare class MiniAppModule {
26
26
  private jsBridge;
27
27
  private isExecuting;
@@ -33,7 +33,6 @@ export declare class MiniAppModule {
33
33
  getCashbackInformation(params: GetCashbackInfoParams): void;
34
34
  openWebview(params: OpenWebviewParams): void;
35
35
  openMap(params: MapParams): void;
36
- openMiniApp(params: OpenMiniAppParams): void;
37
36
  closeApp(params: CloseAppParams): void;
38
37
  request(params: RequestParams): void;
39
38
  requestInternal(params: RequestInternalParams): void;
@@ -59,8 +58,6 @@ export declare class MiniAppModule {
59
58
  inputAddress(params: InputAddressParams): void;
60
59
  getUserLocation(params: GetUserLocationParams): void;
61
60
  checkPaymentMethod(params: CheckPaymentMethodParams): void;
62
- debug(params: NativeParams<MiniAppResult>): void;
63
- checkAccessToken(params: NativeParams<MiniAppResult>): void;
64
61
  registerEmail(params: NativeParams<unknown>): void;
65
62
  setEnablePullDownRefresh(params?: SetEnablePullDownRefreshParams): void;
66
63
  registerKyc(params: RegisterKycParams): 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,i=Object.prototype.propertyIsEnumerable,r=(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)&&r(e,n,t[n]);if(o)for(var n of o(t))i.call(t,n)&&r(e,n,t[n]);return e},c=(e,o)=>t(e,n(o)),l=(e,t,n)=>new Promise(((o,s)=>{var i=e=>{try{a(n.next(e))}catch(t){s(t)}},r=e=>{try{a(n.throw(e))}catch(t){s(t)}},a=e=>e.done?o(e.value):Promise.resolve(e.value).then(i,r);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 i="";for(var r in s)s[r]&&(i+="; "+r,!0!==s[r]&&(i+="="+s[r].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={},s=0;s<n.length;s++){var i=n[s].split("="),r=i.slice(1).join("=");try{var a=decodeURIComponent(i[0]);if(o[a]=t.read(r,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",_="complete",m="init",f="verifyMultiFactorAuthResult",v="share",S="scanCode",E="handleMessageFromNative",y="getKycPassportInfo",I="reload",w="link",A="makeVisible",T="consoleDebugInfo",N="clientPopState";var b=(e=>(e.MiniApp="MiniApp",e.SmartPayment="SmartPayment",e))(b||{});const C="_PayPayJsBridge",O=["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","checkAccessToken","debug","inputAddress","getDeviceInformation","openMiniApp","request","requestInternal","registerPaymentFeatures","initKycPassport","getKycPassportInfo","shortcutExists","addShortcut","getAllUserAddresses","getUserPaymentFeatureSettings","getPaymentSettings","getTransactionInfo","getTransactions","getPayPayCardInfo","getExternalLinkageInformation","markAsReady","renderCoupons"],P=["init","createOrder","makePayment","render","logout","getAuthStatus","getUserProfile","getBalance","getUserAddress","getUAID","getCashbackInformation","renderCoupons","getLoginUrl"];class D extends Error{constructor(e,t){super(e),this.errorCode=t}}var L=(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))(L||{});const k="2.49.0",R=new URL("https://mini-app-sdk-core.paypay.ne.jp/"),U=R.origin,x=new URL(`./iframe.html?v=${k}&rev=a7eaf68`,R).href,M=new URL(`./coupon/iframe.html?v=${k}`,R).href,F="8.45.1",B=globalThis;function j(e,t,n){const o=B,s=o.__SENTRY__=o.__SENTRY__||{},i=s[F]=s[F]||{};return i[e]||(i[e]=t())}const V="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,$=["debug","info","warn","error","log","assert","trace"],q={};function W(e){if(!("console"in B))return e();const t=B.console,n={},o=Object.keys(q);o.forEach((e=>{const o=q[e];n[e]=t[e],t[e]=o}));try{return e()}finally{o.forEach((e=>{t[e]=n[e]}))}}const H=j("logger",(function(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return V?$.forEach((n=>{t[n]=(...t)=>{e&&W((()=>{B.console[n](`Sentry Logger [${n}]:`,...t)}))}})):$.forEach((e=>{t[e]=()=>{}})),t}));function z(){return K(B),B}function K(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||F,t[F]=t[F]||{}}const Y=Object.prototype.toString;function G(e){return function(e,t){return Y.call(e)===`[object ${t}]`}(e,"Object")}function J(){return Date.now()/1e3}const Q=function(){const{performance:e}=B;if(!e||!e.now)return J;const t=Date.now()-e.now(),n=null==e.timeOrigin?t:e.timeOrigin;return()=>(n+e.now())/1e3}();function X(){const e=B,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 Z(){return X()}function ee(){return X().substring(16)}function te(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]=te(o[s],t[s],n-1));return o}(()=>{const{performance:e}=B;if(!e||!e.now)return;const t=36e5,n=e.now(),o=Date.now(),s=e.timeOrigin?Math.abs(e.timeOrigin+n-o):t,i=s<t,r=e.timing&&e.timing.navigationStart,a="number"==typeof r?Math.abs(r+n-o):t;(i||a<t)&&(s<=a&&e.timeOrigin)})();const ne="_sentrySpan";function oe(e,t){t?function(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch(o){V&&H.log(`Failed to add non-enumerable property "${t}" to object`,e)}}(e,ne,t):delete e[ne]}function se(e){return e[ne]}class ie{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:Z(),spanId:ee()}}clone(){const e=new ie;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,oe(e,se(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||Q(),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:X()),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 re?[t.getScopeData(),t.getRequestSession()]:G(t)?[e,e.requestSession]:[],{tags:s,extra:i,user:r,contexts:c,level:l,fingerprint:u=[],propagationContext:d}=n||{};return this._tags=a(a({},this._tags),s),this._extra=a(a({},this._extra),i),this._contexts=a(a({},this._contexts),c),r&&Object.keys(r).length&&(this._user=r),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,oe(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Z()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const o=a({timestamp:J()},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:se(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=te(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=a({spanId:ee()},e),this}getPropagationContext(){return this._propagationContext}captureException(e,t){const n=t&&t.event_id?t.event_id:X();if(!this._client)return H.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:X();if(!this._client)return H.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:X();return this._client?(this._client.captureEvent(e,c(a({},t),{event_id:n}),this),n):(H.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 re=ie;class ae{constructor(e,t){let n,o;n=e||new re,o=t||new re,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 ce(){const e=K(z());return e.stack=e.stack||new ae(j("defaultCurrentScope",(()=>new re)),j("defaultIsolationScope",(()=>new re)))}function le(e){return ce().withScope(e)}function ue(e,t){const n=ce();return n.withScope((()=>(n.getStackTop().scope=e,t(e))))}function de(e){return ce().withScope((()=>e(ce().getIsolationScope())))}function pe(e){const t=K(e);return t.acs?t.acs:{withIsolationScope:de,withScope:le,withSetScope:ue,withSetIsolationScope:(e,t)=>de(t),getCurrentScope:()=>ce().getScope(),getIsolationScope:()=>ce().getIsolationScope()}}function he(){return pe(z()).getCurrentScope()}const ge=100;function _e(e,t){const n=he().getClient(),o=pe(z()).getIsolationScope();if(!n)return;const{beforeBreadcrumb:s=null,maxBreadcrumbs:i=ge}=n.getOptions();if(i<=0)return;const r=J(),c=a({timestamp:r},e),l=s?W((()=>s(c,t))):c;null!==l&&(n.emit&&n.emit("beforeAddBreadcrumb",l,t),o.addBreadcrumb(l,i))}const me=[L.sdkNotInitialized,L.notAuthorized,L.userCanceled,L.userCanceledSimilarTxn,L.suspectedDuplicatePayment,L.noSufficientFund];function fe(e,t,n){me.includes(n)||function(e,t){const n=t;he().captureMessage(e,n,void 0)}(`windowBridge.${e} failed. error: ${n}, message: ${t}`,"log")}const ve=e=>"object"!=typeof e||null===e?e:JSON.parse(JSON.stringify(e));class Se{constructor(e,t,n=[]){this.deferredCallbacks={},this.functions=e,this.allowedOrigins=t,this.middlewares=n,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`,L.originNotAllowed):void("request"===e.data.type?this.handleRequest(e):"response"===e.data.type&&this.handleResponse(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`,L.functionNotFound);try{this.sendSuccessResponse(e,yield function(e,t,n,o){let s=-1;const i=o=>l(this,null,(function*(){if(++s,s<e.length){const n=e[s];return yield n(t,o,i)}return n(...o)}));return i(o)}([...this.middlewares,...null!=(t=o.middlewares)?t:[]],e,o,ve(e.data.params)))}catch(s){let t="Some error occurred while processing the request",n=L.unknown;s instanceof D?(t=s.message,n=s.errorCode):console.error(s),this.sendErrorResponse(e,t,n)}}))}handleResponse(e){if(!this.deferredCallbacks[e.data.key])return void console.warn(`Callback for ${e.data.functionName} not found`);const[t,n]=this.deferredCallbacks[e.data.key];delete this.deferredCallbacks[e.data.key],"success"===e.data.status?t(e.data.result):n(new D(e.data.message,e.data.errorCode))}sendErrorResponse(e,t,n){fe(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){var n;null==(n=e.source)||n.postMessage(a({forWindowBridge:!0,type:"response",key:e.data.key,functionName:e.data.functionName},ve(t)),e.origin)}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 Se.getBridge().getTargetWindowFunctionProxy(e,t)}getTargetWindowFunctionProxy(e,t){return new Proxy(this,{get(n,o){return(...s)=>new Promise(((i,r)=>l(this,null,(function*(){const a=o.toString(),c=`${a}--${Ee()}`;try{const o=yield e();if(!o)throw new Error("Target window is undefined");n.deferredCallbacks[c]=[i,r],o.postMessage({forWindowBridge:!0,type:"request",functionName:a,key:c,params:ve(s)},t)}catch(l){delete n.deferredCallbacks[c],r(new D(l.message,L.messageSendingFailed))}}))))}})}}function Ee(){return Math.random().toString(36).substring(7)}new class{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;if(this.useLocalStorage)try{if(null!=localStorage.getItem(p.initializedAt))return localStorage.getItem(e);console.debug("local storage value has lost unexpectedly."),_e({message:"local storage value has lost unexpectedly.",category:"storage"})}catch(n){}return this.useLocalStorage=!1,null!=(t=this.memoryStorage[e])?t:null}setItem(e,t){if(this.memoryStorage[e]=t,this.useLocalStorage)try{localStorage.setItem(e,t)}catch(n){this.useLocalStorage=!1,console.warn("localStorage has become unavailable.")}}removeItem(e){delete this.memoryStorage[e];try{localStorage.removeItem(e)}catch(t){this.useLocalStorage=!1}}clear(){try{localStorage.clear(),localStorage.setItem(p.initializedAt,Date.now().toString())}catch(e){}this.memoryStorage={}}};const ye=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},removeCookie:function({name:e,options:t}){return d.remove(e,t)},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)}},Symbol.toStringTag,{value:"Module"})),Ie="ppmna-iframe",we="ppsdk-container";let Ae,Te;function Ne(){return Ae||(Ae=function(){if(document.getElementById(Ie))return;const e=document.createElement("div");return document.createElement("div"),e.setAttribute("id",we),e.setAttribute("class",we),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}()),Ae}function be(e){const t=Ne();t&&(t.style.display=e?"initial":"none")}function Ce(){return Te||(Te=new Promise(((e,t)=>{function n(){const n=document.createElement("iframe");n.setAttribute("src",x),n.setAttribute("name",Ie),n.setAttribute("id",Ie),n.setAttribute("class",Ie),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=Ne();o&&(o.innerHTML="",o.append(n))}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(()=>{n()})):n()}))),Te}Se.init(ye,[U]);const Oe=Se.getTargetWindowFunctionProxy((function(){return Ce().then((e=>null==e?void 0:e.contentWindow)).catch((()=>null))}),U);function Pe(e,t,n){var o,s,i,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===_&&(null==(i=null==t?void 0:t.complete)||i.call(t),removeEventListener("message",n),r=e.messageId,Ue=Ue.filter((e=>e!==r)),Ue.length>0||be(!1))}function De(e,t,n,o){const s=function(){const e=Ee();return Ue.push(e),e}(),i=t=>{Le(t.origin)&&t.data.name===e&&t.data.messageId===s&&Pe(t.data,n,i)};addEventListener("message",i),function(e){l(this,null,(function*(){var t;const n=yield Ce().catch((()=>{}));null==(t=null==n?void 0:n.contentWindow)||t.postMessage(JSON.parse(JSON.stringify(e)),U)}))}({name:e,params:o,messageId:s})}function Le(e){return e===U}function ke(e){return O.includes(e)}function Re(e){return P.includes(e)}let Ue=[];function xe(e,t,n){return function(o={}){const s=null==n?void 0:n(o);Oe.logEvent(a({event_action:`pp_${e}_called`,event_category_suffix:e},s));const i=t(o);return i.then((t=>{var n;Oe.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),Oe.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)})),i}}const Me={[L.sdkNotInitialized]:L.authorizationNeeded,[L.tokenNotFound]:L.authorizationNeeded,[L.tokenExpired]:L.tokenExpired};let Fe,Be;Ce(),Be=Promise.resolve(!1);function je(e){const t=(n=e.clientId,d.get(`${p.refreshToken}.${n}`)||d.get(p.refreshToken)||"");var n;const o=function(e){return d.get(`${p.codeVerifier}.${e}`)||d.get(p.codeVerifier)||""}(e.clientId),s={env:e.env,mode:e.mode,debugMode:e.debugMode,clientId:e.clientId,refreshToken:t,clientVersion:"2.49.0",codeVerifier:o,clientSdkType:Fe,clientUrl:window.location.href};let i;const r=new Promise((e=>i=e)),l=()=>{var t;i(!0),null==(t=e.complete)||t.call(e)};Be.then((()=>Ce())).then((()=>{De(m,0,c(a({},e),{complete:l}),s)})).catch((()=>{var t;null==(t=e.fail)||t.call(e,{errorCode:L.sdkNotInitialized}),l()})),Be=r}addEventListener("message",(e=>{var t;if(!(null==(t=e.data)?void 0:t.forWindowBridge)&&Le(e.origin))if(e.data.name===I&&window.location.reload(),e.data.name!==A){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===T){const{params:t}=e.data.data;!function(e){console.debug(...e)}(t)}}else be(!0)})),addEventListener("popstate",(()=>{Ce().then((e=>{var t;const n={name:N};null==(t=null==e?void 0:e.contentWindow)||t.postMessage(n,U)})).catch((e=>console.warn(e)))}));var Ve;Ve={_handleMessageFromNative:e=>{Ce().then((t=>{var n;null==(n=null==t?void 0:t.contentWindow)||n.postMessage(JSON.parse(JSON.stringify({name:E,params:{json:e}})),U)}))}},(!window.hasOwnProperty(C)||window[C]!==Ve)&&(window[C]=Ve);const $e=["init","setTitle","copyToClipboard","getSessionData","setSessionData","getStorageData","setStorageData","removeStorageData","getLoginUrl"],qe=["renderCoupons"];const We={version:"2.49.0",revision:"a7eaf68"};xe("getLoginUrl",Oe.getLoginUrl);const He=xe("getPaymentSettings",Oe.getPaymentSettings),ze=xe("markAsReady",Oe.markAsReady);var Ke=(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))(Ke||{});const Ye=xe("logout",(()=>l(this,null,(function*(){try{return yield Oe.logout(),{statusCode:Ke.loggedOut}}catch(e){throw new D(`An error occurred while trying to logout the user, error=${e}`,L.unknown)}}))));const Ge={verifyMultiFactorAuthResult:function(e){const t=new URL(window.location.href);De(f,0,e,c(a({},e),{sessionId:t.searchParams.get("ppSessionId")}))},share:function(e){if(!(null==navigator?void 0:navigator.share))return void De(v,0,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:L.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:xe("renderCoupons",(e=>l(this,null,(function*(){const{merchant:t,couponId:n,containerId:o,postLoginRedirectUrl:s=window.location.href,postLoginRedirectType:i,locale:r}=e,a=document.getElementById(o);if(!a)throw new D("Invalid coupon container Id",L.badRequestInsufficientParameter);const c=yield Oe.fetchCoupons({merchantId:t,couponId:n,postLoginRedirectUrl:s,postLoginRedirectType:i});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=Se.getTargetWindowFunctionProxy((()=>e.contentWindow),U);yield n.renderCoupons({coupons:c,merchantId:t,locale:r,postLoginRedirectUrl:s,postLoginRedirectType:i})}catch(l){throw new D(`An error occurred while displaying coupons, merchantId=${t}, couponId=${n}, error=${l}`,L.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});De(S,0,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 i=document.execCommand("copy");document.body.removeChild(s),i?null==(t=null==e?void 0:e.success)||t.call(e):null==(n=null==e?void 0:e.fail)||n.call(e,{errorCode:L.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;De(y,0,e,c(a({},e),{url:t}))},logout:Ye,getPaymentSettings:He,markAsReady:ze};return function({sdkType:e,clientFunctions:t}){Fe=e;const n=e===b.MiniApp?ke:Re,o=new Proxy(c(a({},t),{init:je}),{get(t,o){if(o in We)return We[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 i,r;e(c(a({},n),{success:e=>{var t;r=e,null==(t=n.success)||t.call(n,e)},fail:e=>{var o;"init"===t&&Me[e.errorCode]?r={statusCode:Me[e.errorCode]}:i=e,null==(o=n.fail)||o.call(n,e)},complete:()=>{var e;i?s(i):o(r),null==(e=n.complete)||e.call(n)}}))}))}((function(e){return l(this,null,(function*(){var n,i;if(!$e.includes(s)&&!(yield Be)){if(!qe.includes(s)||!function(e){return void 0!==e.clientId}(e))return null==(n=e.fail)||n.call(e,{errorCode:L.sdkNotInitialized}),void(null==(i=e.complete)||i.call(e));je({clientId:e.clientId,env:e.env}),yield Be}const r=t[s];if(r&&"function"==typeof r)return r(e);De(o,0,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:b.MiniApp,clientFunctions:Ge})}();
2
+ var pp=function(){"use strict";var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,r=(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)&&r(e,n,t[n]);if(o)for(var n of o(t))i.call(t,n)&&r(e,n,t[n]);return e},c=(e,o)=>t(e,n(o)),l=(e,t,n)=>new Promise(((o,s)=>{var i=e=>{try{a(n.next(e))}catch(t){s(t)}},r=e=>{try{a(n.throw(e))}catch(t){s(t)}},a=e=>e.done?o(e.value):Promise.resolve(e.value).then(i,r);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 i="";for(var r in s)s[r]&&(i+="; "+r,!0!==s[r]&&(i+="="+s[r].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={},s=0;s<n.length;s++){var i=n[s].split("="),r=i.slice(1).join("=");try{var a=decodeURIComponent(i[0]);if(o[a]=t.read(r,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",_="init",f="verifyMultiFactorAuthResult",v="share",S="scanCode",y="handleMessageFromNative",E="getKycPassportInfo",I="reload",w="link",A="makeVisible",b="consoleDebugInfo",T="clientPopState";var N=(e=>(e.MiniApp="MiniApp",e.SmartPayment="SmartPayment",e))(N||{});const C="_PayPayJsBridge",O=["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"],k=["init","createOrder","makePayment","render","logout","getAuthStatus","getUserProfile","getBalance","getUserAddress","getUAID","getCashbackInformation","renderCoupons","getLoginUrl"],P="2.54.0",D=new URL("https://mini-app-sdk-core.paypay.ne.jp/"),L=D.origin,R=new URL(`./iframe.html?v=${P}&rev=cd1d284`,D).href,U=new URL(`./coupon/iframe.html?v=${P}`,D).href;var x=(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))(x||{});class M extends Error{constructor(e,t){super(e),this.errorCode=t}}const F="8.45.1",j=globalThis;function B(e,t,n){const o=j,s=o.__SENTRY__=o.__SENTRY__||{},i=s[F]=s[F]||{};return i[e]||(i[e]=t())}const V="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,$=["debug","info","warn","error","log","assert","trace"],q={};function z(e){if(!("console"in j))return e();const t=j.console,n={},o=Object.keys(q);o.forEach((e=>{const o=q[e];n[e]=t[e],t[e]=o}));try{return e()}finally{o.forEach((e=>{t[e]=n[e]}))}}const W=B("logger",(function(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return V?$.forEach((n=>{t[n]=(...t)=>{e&&z((()=>{j.console[n](`Sentry Logger [${n}]:`,...t)}))}})):$.forEach((e=>{t[e]=()=>{}})),t}));function H(){return K(j),j}function K(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||F,t[F]=t[F]||{}}const Y=Object.prototype.toString;function G(e){return function(e,t){return Y.call(e)===`[object ${t}]`}(e,"Object")}function J(){return Date.now()/1e3}const Q=function(){const{performance:e}=j;if(!e||!e.now)return J;const t=Date.now()-e.now(),n=null==e.timeOrigin?t:e.timeOrigin;return()=>(n+e.now())/1e3}();function X(){const e=j,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 Z(){return X()}function ee(){return X().substring(16)}function te(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]=te(o[s],t[s],n-1));return o}(()=>{const{performance:e}=j;if(!e||!e.now)return;const t=36e5,n=e.now(),o=Date.now(),s=e.timeOrigin?Math.abs(e.timeOrigin+n-o):t,i=s<t,r=e.timing&&e.timing.navigationStart,a="number"==typeof r?Math.abs(r+n-o):t;(i||a<t)&&(s<=a&&e.timeOrigin)})();const ne="_sentrySpan";function oe(e,t){t?function(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch(o){V&&W.log(`Failed to add non-enumerable property "${t}" to object`,e)}}(e,ne,t):delete e[ne]}function se(e){return e[ne]}class ie{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:Z(),spanId:ee()}}clone(){const e=new ie;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,oe(e,se(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||Q(),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:X()),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 re?[t.getScopeData(),t.getRequestSession()]:G(t)?[e,e.requestSession]:[],{tags:s,extra:i,user:r,contexts:c,level:l,fingerprint:u=[],propagationContext:d}=n||{};return this._tags=a(a({},this._tags),s),this._extra=a(a({},this._extra),i),this._contexts=a(a({},this._contexts),c),r&&Object.keys(r).length&&(this._user=r),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,oe(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Z()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const o=a({timestamp:J()},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:se(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=te(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=a({spanId:ee()},e),this}getPropagationContext(){return this._propagationContext}captureException(e,t){const n=t&&t.event_id?t.event_id:X();if(!this._client)return W.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:X();if(!this._client)return W.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:X();return this._client?(this._client.captureEvent(e,c(a({},t),{event_id:n}),this),n):(W.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 re=ie;class ae{constructor(e,t){let n,o;n=e||new re,o=t||new re,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 ce(){const e=K(H());return e.stack=e.stack||new ae(B("defaultCurrentScope",(()=>new re)),B("defaultIsolationScope",(()=>new re)))}function le(e){return ce().withScope(e)}function ue(e,t){const n=ce();return n.withScope((()=>(n.getStackTop().scope=e,t(e))))}function de(e){return ce().withScope((()=>e(ce().getIsolationScope())))}function pe(e){const t=K(e);return t.acs?t.acs:{withIsolationScope:de,withScope:le,withSetScope:ue,withSetIsolationScope:(e,t)=>de(t),getCurrentScope:()=>ce().getScope(),getIsolationScope:()=>ce().getIsolationScope()}}function he(){return pe(H()).getCurrentScope()}const ge=100;function me(e,t){const n=he().getClient(),o=pe(H()).getIsolationScope();if(!n)return;const{beforeBreadcrumb:s=null,maxBreadcrumbs:i=ge}=n.getOptions();if(i<=0)return;const r=J(),c=a({timestamp:r},e),l=s?z((()=>s(c,t))):c;null!==l&&(n.emit&&n.emit("beforeAddBreadcrumb",l,t),o.addBreadcrumb(l,i))}const _e=[x.sdkNotInitialized,x.notAuthorized,x.userCanceled,x.userCanceledSimilarTxn,x.suspectedDuplicatePayment,x.noSufficientFund];function fe(e,t,n){_e.includes(n)||function(e,t){const n=t;he().captureMessage(e,n,void 0)}(`windowBridge.${e} failed. error: ${n}, message: ${t}`,"log")}const ve=e=>"object"!=typeof e||null===e?e:JSON.parse(JSON.stringify(e)),Se=e=>{var t;const n=null==(t=e[0])?void 0:t.callbacks;return"object"==typeof n&&null!==n},ye=e=>Object.keys(e).reduce(((e,t)=>(e[t]=!0,e)),{});class Ee{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`,x.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`,x.functionNotFound);const s=ve(e.data.params);Se(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 i=o=>l(this,null,(function*(){if(++s,s<e.length){const n=e[s];return yield n(t,o,i)}return n(...o)}));return i(o)}([...this.middlewares,...null!=(t=o.middlewares)?t:[]],e,o,s))}catch(i){let t="Some error occurred while processing the request",n=x.unknown;i instanceof M?(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 M(e.data.message,e.data.errorCode)))}handleCallback(e){var t;const{key:n,callbackName:o,args:s}=e.data,i=null==(t=this.registeredCallbacks[n])?void 0:t[o];i?i(...s):console.warn(`Callback with key ${n} and name ${o} not found.`)}sendErrorResponse(e,t,n){fe(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},ve(n)),t)}sendRequest(e,t,n,o){return new Promise(((s,i)=>l(this,null,(function*(){const r=`${n}--${be()}`;try{const l=yield e();if(!l)throw new Error("Target window is undefined");let u=o[0];if(Se(o)){const e=o[0].callbacks;this.addFunctionCallbacks(r,e),u=c(a({},o[0]),{callbacks:ye(e)})}this.deferredPromises[r]=[s,i],this.sendMessage(l,t,{type:"request",key:r,functionName:n,params:[u]})}catch(l){delete this.deferredPromises[r],delete this.registeredCallbacks[r],i(new M(l.message,x.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 Ee.getBridge().getTargetWindowFunctionProxy(e,t)}getTargetWindowFunctionProxy(e,t){return new Proxy(this,{get:(n,o)=>(...s)=>n.sendRequest(e,t,o.toString(),s)})}}class Ie{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."),me({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),Ae(e)}catch(n){this.useLocalStorage=!1,console.warn("localStorage has become unavailable.")}}removeItem(e){delete this.memoryStorage[e];try{localStorage.removeItem(e),Ae(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)Ae(o);t=p.initializedAt,n=Date.now().toString(),d.set(t,n,we);var t,n}()}catch(e){}this.memoryStorage={}}}const we=Object.freeze(a({expires:365,sameSite:"None"},{secure:!0,Partitioned:!0}));function Ae(e){d.remove(e,we)}function be(){return Math.random().toString(36).substring(7)}new Ie;const Te=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},removeCookie:function({name:e,options:t}){return d.remove(e,t)},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)}},Symbol.toStringTag,{value:"Module"})),Ne="ppmna-iframe",Ce="ppsdk-container";let Oe,ke;function Pe(){return Oe||(Oe=function(){if(document.getElementById(Ne))return;const e=document.createElement("div");return document.createElement("div"),e.setAttribute("id",Ce),e.setAttribute("class",Ce),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}()),Oe}function De(e){const t=Pe();t&&(t.style.display=e?"initial":"none")}function Le(){return ke||(ke=new Promise(((e,t)=>{function n(){const n=document.createElement("iframe");n.setAttribute("src",R),n.setAttribute("name",Ne),n.setAttribute("id",Ne),n.setAttribute("class",Ne),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=Pe();o&&(o.innerHTML="",o.append(n))}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(()=>{n()})):n()}))),ke}Ee.init(Te,[L]);const Re=Ee.getTargetWindowFunctionProxy((function(){return Le().then((e=>null==e?void 0:e.contentWindow)).catch((()=>null))}),L);function Ue(e,t,n){var o,s,i,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==(i=null==t?void 0:t.complete)||i.call(t),removeEventListener("message",n),r=e.messageId,Be=Be.filter((e=>e!==r)),Be.length>0||De(!1))}function xe(e,t,n,o){const s=function(){const e=be();return Be.push(e),e}(),i=t=>{Me(t.origin)&&t.data.name===e&&t.data.messageId===s&&Ue(t.data,n,i)};addEventListener("message",i),function(e){l(this,null,(function*(){var t;const n=yield Le().catch((()=>{}));null==(t=null==n?void 0:n.contentWindow)||t.postMessage(JSON.parse(JSON.stringify(e)),L)}))}({name:e,params:o,messageId:s})}function Me(e){return e===L}function Fe(e){return O.includes(e)}function je(e){return k.includes(e)}let Be=[];function Ve(e,t,n){return function(o={}){const s=null==n?void 0:n(o);Re.logEvent(a({event_action:`pp_${e}_called`,event_category_suffix:e},s));const i=t(o);return i.then((t=>{var n;Re.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),Re.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)})),i}}const $e={[x.sdkNotInitialized]:x.authorizationNeeded,[x.tokenNotFound]:x.authorizationNeeded,[x.tokenExpired]:x.tokenExpired};let qe,ze;Le(),ze=Promise.resolve(!1);function We(e){const t=(n=e.clientId,d.get(`${p.refreshToken}.${n}`)||d.get(p.refreshToken)||"");var n;const o=function(e){return d.get(`${p.codeVerifier}.${e}`)||d.get(p.codeVerifier)||""}(e.clientId),s={env:e.env,mode:e.mode,debugMode:e.debugMode,clientId:e.clientId,refreshToken:t,clientVersion:"2.54.0",codeVerifier:o,clientSdkType:qe,clientUrl:window.location.href};let i;const r=new Promise((e=>i=e)),l=()=>{var t;i(!0),null==(t=e.complete)||t.call(e)};ze.then((()=>Le())).then((()=>{xe(_,0,c(a({},e),{complete:l}),s)})).catch((()=>{var t;null==(t=e.fail)||t.call(e,{errorCode:x.sdkNotInitialized}),l()})),ze=r}addEventListener("message",(e=>{var t;if(!(null==(t=e.data)?void 0:t.forWindowBridge)&&Me(e.origin))if(e.data.name===I&&window.location.reload(),e.data.name!==A){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===b){const{params:t}=e.data.data;!function(e){console.debug(...e)}(t)}}else De(!0)})),addEventListener("popstate",(()=>{Le().then((e=>{var t;const n={name:T};null==(t=null==e?void 0:e.contentWindow)||t.postMessage(n,L)})).catch((e=>console.warn(e)))}));var He;He={_handleMessageFromNative:e=>{Le().then((t=>{var n;null==(n=null==t?void 0:t.contentWindow)||n.postMessage(JSON.parse(JSON.stringify({name:y,params:{json:e}})),L)}))}},(!window.hasOwnProperty(C)||window[C]!==He)&&(window[C]=He);const Ke=["init","setTitle","copyToClipboard","getSessionData","setSessionData","getStorageData","setStorageData","removeStorageData","getLoginUrl"],Ye=["renderCoupons"];const Ge={version:"2.54.0",revision:"cd1d284"};Ve("getLoginUrl",Re.getLoginUrl);const Je=Ve("getPaymentSettings",Re.getPaymentSettings),Qe=Ve("markAsReady",Re.markAsReady);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 Re.logout(),{statusCode:Xe.loggedOut}}catch(e){throw new M(`An error occurred while trying to logout the user, error=${e}`,x.unknown)}}))));const et={verifyMultiFactorAuthResult:function(e){const t=new URL(window.location.href);xe(f,0,e,c(a({},e),{sessionId:t.searchParams.get("ppSessionId")}))},share:function(e){if(!(null==navigator?void 0:navigator.share))return void xe(v,0,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:x.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:i,locale:r}=e,a=document.getElementById(o);if(!a)throw new M("Invalid coupon container Id",x.badRequestInsufficientParameter);const c=yield Re.fetchCoupons({merchantId:t,couponId:n,postLoginRedirectUrl:s,postLoginRedirectType:i});try{const e=document.createElement("iframe");e.src=U,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=Ee.getTargetWindowFunctionProxy((()=>e.contentWindow),L);yield n.renderCoupons({coupons:c,merchantId:t,locale:r,postLoginRedirectUrl:s,postLoginRedirectType:i})}catch(l){throw new M(`An error occurred while displaying coupons, merchantId=${t}, couponId=${n}, error=${l}`,x.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});xe(S,0,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 i=document.execCommand("copy");document.body.removeChild(s),i?null==(t=null==e?void 0:e.success)||t.call(e):null==(n=null==e?void 0:e.fail)||n.call(e,{errorCode:x.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;xe(E,0,e,c(a({},e),{url:t}))},logout:Ze,getPaymentSettings:Je,markAsReady:Qe};return function({sdkType:e,clientFunctions:t}){qe=e;const n=e===N.MiniApp?Fe:je,o=new Proxy(c(a({},t),{init:We}),{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 i,r;e(c(a({},n),{success:e=>{var t;r=e,null==(t=n.success)||t.call(n,e)},fail:e=>{var o;"init"===t&&$e[e.errorCode]?r={statusCode:$e[e.errorCode]}:i=e,null==(o=n.fail)||o.call(n,e)},complete:()=>{var e;i?s(i):o(r),null==(e=n.complete)||e.call(n)}}))}))}((function(e){return l(this,null,(function*(){var n,i;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:x.sdkNotInitialized}),void(null==(i=e.complete)||i.call(e));We({clientId:e.clientId,env:e.env}),yield ze}const r=t[s];if(r&&"function"==typeof r)return r(e);xe(o,0,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:N.MiniApp,clientFunctions:et})}();
@@ -197,13 +197,10 @@ const PPFunctionName = {
197
197
  requestInternal: "requestInternal",
198
198
  scanCode: "scanCode",
199
199
  getAuthStatus: "getAuthStatus",
200
- openMiniApp: "openMiniApp",
201
200
  inputAddress: "inputAddress",
202
- checkAccessToken: "checkAccessToken",
203
201
  getCashbackInformation: "getCashbackInformation",
204
202
  request: "request",
205
203
  getDeviceInformation: "getDeviceInformation",
206
- debug: "debug",
207
204
  createOrder: "createOrder",
208
205
  handleMessageFromNative: "handleMessageFromNative",
209
206
  initKycPassport: "initKycPassport",
@@ -263,11 +260,8 @@ const miniAppSupportedFunctions = [
263
260
  "registerUserInfo",
264
261
  "setEnablePullDownRefresh",
265
262
  "registerEmail",
266
- "checkAccessToken",
267
- "debug",
268
263
  "inputAddress",
269
264
  "getDeviceInformation",
270
- "openMiniApp",
271
265
  "request",
272
266
  "requestInternal",
273
267
  "registerPaymentFeatures",
@@ -300,12 +294,19 @@ const smartPaymentSupportedFunctions = [
300
294
  "renderCoupons",
301
295
  "getLoginUrl"
302
296
  ];
303
- class PPError extends Error {
304
- constructor(message, errorCode) {
305
- super(message);
306
- this.errorCode = errorCode;
307
- }
308
- }
297
+ const JS_SDK_VERSION = "2.54.0";
298
+ const REVISION = "cd1d284";
299
+ const coreBaseUrl = new URL("https://mini-app-sdk-core.paypay.ne.jp/");
300
+ const CORE_IFRAME_ORIGIN = coreBaseUrl.origin;
301
+ const CORE_IFRAME_URL = new URL(
302
+ `./iframe.html?v=${JS_SDK_VERSION}&rev=${REVISION}`,
303
+ coreBaseUrl
304
+ ).href;
305
+ const COUPON_IFRAME_URL = new URL(
306
+ `./coupon/iframe.html?v=${JS_SDK_VERSION}`,
307
+ coreBaseUrl
308
+ ).href;
309
+ const SENTRY_DSN = "https://377b45f154b1fb17d8e98a6ffb67030a@o4505819519320064.ingest.sentry.io/4506579323453440";
309
310
  var MiniAppErrorType = /* @__PURE__ */ ((MiniAppErrorType2) => {
310
311
  MiniAppErrorType2["success"] = "SUCCESS";
311
312
  MiniAppErrorType2["invalidUrl"] = "INVALID_URL";
@@ -377,21 +378,15 @@ var MiniAppErrorType = /* @__PURE__ */ ((MiniAppErrorType2) => {
377
378
  MiniAppErrorType2["rateLimitExceeded"] = "RATE_LIMIT_EXCEEDED";
378
379
  MiniAppErrorType2["sdkUpgradeRequired"] = "SDK_UPGRADE_REQUIRED";
379
380
  MiniAppErrorType2["authorizationNeeded"] = "AUTHORIZATION_NEEDED";
381
+ MiniAppErrorType2["invalidVirtualAccount"] = "INVALID_VIRTUAL_ACCOUNT";
380
382
  return MiniAppErrorType2;
381
383
  })(MiniAppErrorType || {});
382
- const JS_SDK_VERSION = "2.49.0";
383
- const REVISION = "a7eaf68";
384
- const coreBaseUrl = new URL("https://mini-app-sdk-core.paypay.ne.jp/");
385
- const CORE_IFRAME_ORIGIN = coreBaseUrl.origin;
386
- const CORE_IFRAME_URL = new URL(
387
- `./iframe.html?v=${JS_SDK_VERSION}&rev=${REVISION}`,
388
- coreBaseUrl
389
- ).href;
390
- const COUPON_IFRAME_URL = new URL(
391
- `./coupon/iframe.html?v=${JS_SDK_VERSION}`,
392
- coreBaseUrl
393
- ).href;
394
- const SENTRY_DSN = "https://377b45f154b1fb17d8e98a6ffb67030a@o4505819519320064.ingest.sentry.io/4506579323453440";
384
+ class PPError extends Error {
385
+ constructor(message, errorCode) {
386
+ super(message);
387
+ this.errorCode = errorCode;
388
+ }
389
+ }
395
390
  const SDK_VERSION = "8.45.1";
396
391
  const GLOBAL_OBJ = globalThis;
397
392
  function getGlobalSingleton(name, creator, obj) {
@@ -1293,12 +1288,27 @@ const deepClone = (obj) => {
1293
1288
  }
1294
1289
  return JSON.parse(JSON.stringify(obj));
1295
1290
  };
1291
+ const hasCallbacks = (params) => {
1292
+ var _a;
1293
+ const callbacks = (_a = params[0]) == null ? void 0 : _a.callbacks;
1294
+ return typeof callbacks === "object" && callbacks !== null;
1295
+ };
1296
+ const getCallbacksPlaceholder = (callbacks) => {
1297
+ return Object.keys(callbacks).reduce(
1298
+ (cbs, name) => {
1299
+ cbs[name] = true;
1300
+ return cbs;
1301
+ },
1302
+ {}
1303
+ );
1304
+ };
1296
1305
  class WindowBridge {
1297
1306
  constructor(functions, allowedOrigins, middlewares = []) {
1298
- this.deferredCallbacks = {};
1307
+ this.deferredPromises = {};
1299
1308
  this.functions = functions;
1300
1309
  this.allowedOrigins = allowedOrigins;
1301
1310
  this.middlewares = middlewares;
1311
+ this.registeredCallbacks = {};
1302
1312
  this.messageEventHandler = this.messageEventHandler.bind(this);
1303
1313
  this.subscribeToMessageEvent();
1304
1314
  }
@@ -1337,6 +1347,10 @@ class WindowBridge {
1337
1347
  this.handleResponse(
1338
1348
  receivedMessageEvent
1339
1349
  );
1350
+ } else if (receivedMessageEvent.data.type === "callback") {
1351
+ this.handleCallback(
1352
+ receivedMessageEvent
1353
+ );
1340
1354
  }
1341
1355
  }
1342
1356
  handleRequest(receivedMessageEvent) {
@@ -1351,6 +1365,18 @@ class WindowBridge {
1351
1365
  MiniAppErrorType.functionNotFound
1352
1366
  );
1353
1367
  }
1368
+ const params = deepClone(receivedMessageEvent.data.params);
1369
+ if (hasCallbacks(params)) {
1370
+ params[0].callbacks = Object.keys(params[0].callbacks).reduce(
1371
+ (cbs, name) => {
1372
+ cbs[name] = (...args) => {
1373
+ this.invokeCallback(receivedMessageEvent, name, args);
1374
+ };
1375
+ return cbs;
1376
+ },
1377
+ {}
1378
+ );
1379
+ }
1354
1380
  try {
1355
1381
  this.sendSuccessResponse(
1356
1382
  receivedMessageEvent,
@@ -1358,7 +1384,7 @@ class WindowBridge {
1358
1384
  [...this.middlewares, ...(_a = functionToInvoke.middlewares) != null ? _a : []],
1359
1385
  receivedMessageEvent,
1360
1386
  functionToInvoke,
1361
- deepClone(receivedMessageEvent.data.params)
1387
+ params
1362
1388
  )
1363
1389
  );
1364
1390
  } catch (error) {
@@ -1375,17 +1401,18 @@ class WindowBridge {
1375
1401
  });
1376
1402
  }
1377
1403
  handleResponse(receivedMessageEvent) {
1378
- if (!this.deferredCallbacks[receivedMessageEvent.data.key]) {
1404
+ if (!this.deferredPromises[receivedMessageEvent.data.key]) {
1379
1405
  console.warn(
1380
- `Callback for ${receivedMessageEvent.data.functionName} not found`
1406
+ `Promise for ${receivedMessageEvent.data.functionName} not found`
1381
1407
  );
1382
1408
  return;
1383
1409
  }
1384
- const [resolve, reject] = this.deferredCallbacks[receivedMessageEvent.data.key];
1385
- delete this.deferredCallbacks[receivedMessageEvent.data.key];
1410
+ const [resolve, reject] = this.deferredPromises[receivedMessageEvent.data.key];
1411
+ delete this.deferredPromises[receivedMessageEvent.data.key];
1386
1412
  if (receivedMessageEvent.data.status === "success") {
1387
1413
  resolve(receivedMessageEvent.data.result);
1388
1414
  } else {
1415
+ delete this.registeredCallbacks[receivedMessageEvent.data.key];
1389
1416
  reject(
1390
1417
  new PPError(
1391
1418
  receivedMessageEvent.data.message,
@@ -1394,6 +1421,18 @@ class WindowBridge {
1394
1421
  );
1395
1422
  }
1396
1423
  }
1424
+ handleCallback(receivedMessageEvent) {
1425
+ var _a;
1426
+ const { key, callbackName, args } = receivedMessageEvent.data;
1427
+ const callback = (_a = this.registeredCallbacks[key]) == null ? void 0 : _a[callbackName];
1428
+ if (!callback) {
1429
+ console.warn(
1430
+ `Callback with key ${key} and name ${callbackName} not found.`
1431
+ );
1432
+ return;
1433
+ }
1434
+ callback(...args);
1435
+ }
1397
1436
  sendErrorResponse(receivedMessageEvent, message, errorCode) {
1398
1437
  sendWindowBridgeErrorToSentry(
1399
1438
  receivedMessageEvent.data.functionName,
@@ -1413,18 +1452,81 @@ class WindowBridge {
1413
1452
  });
1414
1453
  }
1415
1454
  sendResponse(receivedMessageEvent, data) {
1416
- var _a;
1417
- (_a = receivedMessageEvent.source) == null ? void 0 : _a.postMessage(
1455
+ this.sendMessage(
1456
+ receivedMessageEvent.source,
1457
+ receivedMessageEvent.origin,
1418
1458
  __spreadValues({
1419
- forWindowBridge: true,
1420
1459
  type: "response",
1421
1460
  key: receivedMessageEvent.data.key,
1422
1461
  functionName: receivedMessageEvent.data.functionName
1462
+ }, data)
1463
+ );
1464
+ }
1465
+ invokeCallback(receivedMessageEvent, callbackName, args) {
1466
+ this.sendMessage(
1467
+ receivedMessageEvent.source,
1468
+ receivedMessageEvent.origin,
1469
+ {
1470
+ type: "callback",
1471
+ key: receivedMessageEvent.data.key,
1472
+ functionName: receivedMessageEvent.data.functionName,
1473
+ callbackName,
1474
+ args
1475
+ }
1476
+ );
1477
+ }
1478
+ sendMessage(targetWindow, origin, data) {
1479
+ targetWindow.postMessage(
1480
+ __spreadValues({
1481
+ forWindowBridge: true
1423
1482
  }, deepClone(data)),
1424
- // Just a hack to overcome weird function overload mismatch
1425
- receivedMessageEvent.origin
1483
+ origin
1426
1484
  );
1427
1485
  }
1486
+ sendRequest(getTargetWindow, targetWindowOrigin, functionName, params) {
1487
+ return new Promise((resolve, reject) => __async(this, null, function* () {
1488
+ const key = `${functionName}--${getRandomString()}`;
1489
+ try {
1490
+ const targetWindow = yield getTargetWindow();
1491
+ if (!targetWindow) {
1492
+ throw new Error("Target window is undefined");
1493
+ }
1494
+ let messageParams = params[0];
1495
+ if (hasCallbacks(params)) {
1496
+ const callbacks = params[0].callbacks;
1497
+ this.addFunctionCallbacks(key, callbacks);
1498
+ messageParams = __spreadProps(__spreadValues({}, params[0]), {
1499
+ // Convert callbacks to a format that can be sent over postMessage
1500
+ callbacks: getCallbacksPlaceholder(callbacks)
1501
+ });
1502
+ }
1503
+ this.deferredPromises[key] = [resolve, reject];
1504
+ this.sendMessage(targetWindow, targetWindowOrigin, {
1505
+ type: "request",
1506
+ key,
1507
+ functionName,
1508
+ params: [messageParams]
1509
+ });
1510
+ } catch (error) {
1511
+ delete this.deferredPromises[key];
1512
+ delete this.registeredCallbacks[key];
1513
+ reject(
1514
+ new PPError(
1515
+ error.message,
1516
+ MiniAppErrorType.messageSendingFailed
1517
+ )
1518
+ );
1519
+ }
1520
+ }));
1521
+ }
1522
+ addFunctionCallbacks(key, callbacks) {
1523
+ Object.keys(callbacks).forEach((callbackName) => {
1524
+ if (typeof callbacks[callbackName] !== "function") {
1525
+ throw new Error(`Callback ${callbackName} is not a function`);
1526
+ }
1527
+ });
1528
+ this.registeredCallbacks[key] = __spreadValues({}, callbacks);
1529
+ }
1428
1530
  /**
1429
1531
  * A static method to create a new `WindowBridge` instance and enforce singleton pattern
1430
1532
  * @param functions an objection of functions that can be invoked on the current window
@@ -1484,37 +1586,11 @@ class WindowBridge {
1484
1586
  getTargetWindowFunctionProxy(getTargetWindow, targetWindowOrigin) {
1485
1587
  return new Proxy(this, {
1486
1588
  get(windowBridgeInstance, functionName) {
1487
- return (...params) => (
1488
- // eslint-disable-next-line no-async-promise-executor, @typescript-eslint/no-misused-promises
1489
- new Promise((resolve, reject) => __async(this, null, function* () {
1490
- const functionNameString = functionName.toString();
1491
- const key = `${functionNameString}--${getRandomString()}`;
1492
- try {
1493
- const targetWindow = yield getTargetWindow();
1494
- if (!targetWindow) {
1495
- throw new Error("Target window is undefined");
1496
- }
1497
- windowBridgeInstance.deferredCallbacks[key] = [resolve, reject];
1498
- targetWindow.postMessage(
1499
- {
1500
- forWindowBridge: true,
1501
- type: "request",
1502
- functionName: functionNameString,
1503
- key,
1504
- params: deepClone(params)
1505
- },
1506
- targetWindowOrigin
1507
- );
1508
- } catch (error) {
1509
- delete windowBridgeInstance.deferredCallbacks[key];
1510
- reject(
1511
- new PPError(
1512
- error.message,
1513
- MiniAppErrorType.messageSendingFailed
1514
- )
1515
- );
1516
- }
1517
- }))
1589
+ return (...params) => windowBridgeInstance.sendRequest(
1590
+ getTargetWindow,
1591
+ targetWindowOrigin,
1592
+ functionName.toString(),
1593
+ params
1518
1594
  );
1519
1595
  }
1520
1596
  });
@@ -1541,11 +1617,15 @@ class LocalStorageProxy {
1541
1617
  }
1542
1618
  }
1543
1619
  getItem(key) {
1544
- var _a;
1620
+ var _a, _b;
1545
1621
  if (this.useLocalStorage) {
1546
1622
  try {
1547
1623
  if (localStorage.getItem(PpLocalStorageKey.initializedAt) != null) {
1548
- return localStorage.getItem(key);
1624
+ const val = localStorage.getItem(key);
1625
+ if (val != null) {
1626
+ return val;
1627
+ }
1628
+ return (_a = api.get(key)) != null ? _a : null;
1549
1629
  } else {
1550
1630
  console.debug("local storage value has lost unexpectedly.");
1551
1631
  addBreadcrumbToSentry({
@@ -1557,13 +1637,14 @@ class LocalStorageProxy {
1557
1637
  }
1558
1638
  }
1559
1639
  this.useLocalStorage = false;
1560
- return (_a = this.memoryStorage[key]) != null ? _a : null;
1640
+ return (_b = this.memoryStorage[key]) != null ? _b : null;
1561
1641
  }
1562
1642
  setItem(key, value) {
1563
1643
  this.memoryStorage[key] = value;
1564
1644
  if (this.useLocalStorage) {
1565
1645
  try {
1566
1646
  localStorage.setItem(key, value);
1647
+ removeCookie$1(key);
1567
1648
  } catch (e) {
1568
1649
  this.useLocalStorage = false;
1569
1650
  console.warn("localStorage has become unavailable.");
@@ -1574,6 +1655,7 @@ class LocalStorageProxy {
1574
1655
  delete this.memoryStorage[key];
1575
1656
  try {
1576
1657
  localStorage.removeItem(key);
1658
+ removeCookie$1(key);
1577
1659
  } catch (e) {
1578
1660
  this.useLocalStorage = false;
1579
1661
  }
@@ -1585,12 +1667,32 @@ class LocalStorageProxy {
1585
1667
  PpLocalStorageKey.initializedAt,
1586
1668
  Date.now().toString()
1587
1669
  );
1670
+ clearAllCookies();
1588
1671
  } catch (e) {
1589
1672
  }
1590
1673
  this.memoryStorage = {};
1591
1674
  }
1592
1675
  }
1593
- new LocalStorageProxy();
1676
+ const cookieAttributes = Object.freeze(__spreadValues({
1677
+ expires: 365,
1678
+ sameSite: "None"
1679
+ }, { secure: true, Partitioned: true }));
1680
+ function writeCookie(key, value) {
1681
+ api.set(key, value, cookieAttributes);
1682
+ }
1683
+ function removeCookie$1(key) {
1684
+ api.remove(key, cookieAttributes);
1685
+ }
1686
+ (() => {
1687
+ return new LocalStorageProxy();
1688
+ })();
1689
+ function clearAllCookies() {
1690
+ const cookies = api.get();
1691
+ for (const key in cookies) {
1692
+ removeCookie$1(key);
1693
+ }
1694
+ writeCookie(PpLocalStorageKey.initializedAt, Date.now().toString());
1695
+ }
1594
1696
  function isFunction(val) {
1595
1697
  return typeof val === "function";
1596
1698
  }
@@ -1945,7 +2047,7 @@ addEventListener("popstate", () => {
1945
2047
  function init(params) {
1946
2048
  const refreshToken = getRefreshToken(params.clientId);
1947
2049
  const codeVerifier = getCodeVerifier(params.clientId);
1948
- const clientVersion = "2.49.0";
2050
+ const clientVersion = "2.54.0";
1949
2051
  const initParams = {
1950
2052
  env: params.env,
1951
2053
  mode: params.mode,
@@ -2025,8 +2127,8 @@ function executePendingFunctionCalls(client2) {
2025
2127
  }
2026
2128
  }
2027
2129
  const clientProperties = {
2028
- version: "2.49.0",
2029
- revision: "a7eaf68"
2130
+ version: "2.54.0",
2131
+ revision: "cd1d284"
2030
2132
  };
2031
2133
  function isInitClientParams(params) {
2032
2134
  return params.clientId !== void 0;
@@ -2,24 +2,16 @@ declare type AppSetting = unknown;
2
2
  declare type AppSwitch = unknown;
3
3
  declare type TextSetting = unknown;
4
4
  declare type Variables = {
5
- topupHalfSheetRecommendedAmount: Array<{
6
- description: string;
7
- value: number[];
8
- }>;
9
5
  topupButtonsAmount: Array<{
10
- description: string;
11
6
  value: number[];
12
7
  }>;
13
8
  topupHalfSheetAmount: Array<{
14
- description: string;
15
9
  value: number[];
16
10
  }>;
17
11
  autoChargeTopupHalfSheetAmount: Array<{
18
- description: string;
19
12
  value: number[];
20
13
  }>;
21
14
  autoChargeRecommendedTopupAmount: Array<{
22
- description: string;
23
15
  value: number;
24
16
  }>;
25
17
  topupMinAmount: Array<{
@@ -32,31 +24,24 @@ export declare type ConfigurationResponse = {
32
24
  textSetting: TextSetting;
33
25
  variables: Variables;
34
26
  };
35
- export declare function initAppConfiguration(): Promise<boolean>;
36
27
  export declare type AppConfig = {
37
28
  topupButtonsAmount: Array<{
38
- description: string;
39
29
  value: number[];
40
30
  }>;
41
31
  topupHalfSheetAmount: Array<{
42
- description: string;
43
32
  value: number[];
44
33
  }>;
45
- topupHalfSheetRecommendedAmount: Array<{
46
- description: string;
47
- value: number;
48
- }>;
49
34
  autoChargeTopupHalfSheetAmount: Array<{
50
- description: string;
51
35
  value: number[];
52
36
  }>;
53
37
  autoChargeRecommendedTopupAmount: Array<{
54
- description: string;
55
38
  value: number;
56
39
  }>;
57
40
  topupMinAmount: Array<{
58
41
  value: number;
59
42
  }>;
60
43
  };
44
+ export declare function initAppConfiguration(): Promise<boolean>;
61
45
  export declare function getAppConfig(): Promise<AppConfig | null>;
46
+ export declare function clearAppConfig(): void;
62
47
  export {};
@@ -68,5 +68,6 @@ export declare enum MiniAppErrorType {
68
68
  merchantTimeout = "MERCHANT_TIMEOUT",
69
69
  rateLimitExceeded = "RATE_LIMIT_EXCEEDED",
70
70
  sdkUpgradeRequired = "SDK_UPGRADE_REQUIRED",
71
- authorizationNeeded = "AUTHORIZATION_NEEDED"
71
+ authorizationNeeded = "AUTHORIZATION_NEEDED",
72
+ invalidVirtualAccount = "INVALID_VIRTUAL_ACCOUNT"
72
73
  }
@@ -1,5 +1,4 @@
1
1
  import { PropType } from 'vue';
2
- import { AnimationItem } from 'lottie-web/build/player/lottie_svg';
3
2
  import { RenderType } from '../../types';
4
3
  declare type TRenderType = (typeof RenderType)[keyof typeof RenderType];
5
4
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
@@ -11,6 +10,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
11
10
  type: BooleanConstructor;
12
11
  default: boolean;
13
12
  };
13
+ play: {
14
+ type: BooleanConstructor;
15
+ default: boolean;
16
+ };
14
17
  path: {
15
18
  type: StringConstructor;
16
19
  default: string;
@@ -33,7 +36,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
33
36
  required: false;
34
37
  };
35
38
  }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
36
- 'create-lottie': (_p: AnimationItem) => true;
39
+ animationEnd: () => true;
40
+ dataLoadFail: () => true;
37
41
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
38
42
  loop: {
39
43
  type: BooleanConstructor;
@@ -43,6 +47,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
43
47
  type: BooleanConstructor;
44
48
  default: boolean;
45
49
  };
50
+ play: {
51
+ type: BooleanConstructor;
52
+ default: boolean;
53
+ };
46
54
  path: {
47
55
  type: StringConstructor;
48
56
  default: string;
@@ -65,10 +73,12 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
65
73
  required: false;
66
74
  };
67
75
  }>> & Readonly<{
68
- "onCreate-lottie"?: ((_p: AnimationItem) => any) | undefined;
76
+ onAnimationEnd?: (() => any) | undefined;
77
+ onDataLoadFail?: (() => any) | undefined;
69
78
  }>, {
70
79
  path: string;
71
80
  type: TRenderType;
81
+ play: boolean;
72
82
  loop: boolean;
73
83
  autoplay: boolean;
74
84
  styles: Record<string, any>;
@@ -55,3 +55,4 @@ export declare const img_kyc: string;
55
55
  export declare const img_ppCredit: string;
56
56
  export declare const qr_kyc: string;
57
57
  export declare const qr_topup: string;
58
+ export declare const img_iconEmail: string;
@@ -18,6 +18,9 @@ declare const _default: {
18
18
  remittance: {
19
19
  pay: string;
20
20
  };
21
+ deposit: {
22
+ pay: string;
23
+ };
21
24
  };
22
25
  };
23
26
  export default _default;
@@ -18,6 +18,9 @@ declare const _default: {
18
18
  remittance: {
19
19
  pay: string;
20
20
  };
21
+ deposit: {
22
+ pay: string;
23
+ };
21
24
  };
22
25
  };
23
26
  export default _default;
@@ -9,6 +9,11 @@ export interface GetTransactionsParams extends NativeParams<GetTransactionsResul
9
9
  cursor?: string;
10
10
  size?: number;
11
11
  }
12
+ export declare type GetTransactionsApiResponseData = {
13
+ hasNext: boolean;
14
+ nextPageKey: string;
15
+ transactions: TransactionItem[];
16
+ };
12
17
  export declare type GetTransactionsResult = {
13
18
  hasNext: boolean;
14
19
  nextCursor: string;
@@ -1,5 +1,4 @@
1
1
  import { NativeParams } from '../jsbridge-core/jsbridge';
2
- import { Address } from '../types/getUserAddress';
3
2
  import { UIComponentsError } from '../model/uiComponents';
4
3
  import { MiniAppErrorType } from '../model/miniAppError';
5
4
  export declare const Order: {
@@ -27,12 +26,6 @@ export interface MakePaymentParams extends NativeParams<MakePaymentResult> {
27
26
  storeInfo?: string;
28
27
  productType?: string;
29
28
  taxExempt?: boolean;
30
- additionalUserInfo?: {
31
- userAddress?: {
32
- visible: boolean;
33
- mandatory: boolean;
34
- };
35
- };
36
29
  merchantTimeoutAt?: number;
37
30
  orderType?: OrderType;
38
31
  }
@@ -49,7 +42,6 @@ export interface OrderItem {
49
42
  }
50
43
  export declare type MakePaymentResult = {
51
44
  jws: string;
52
- address: Address | null;
53
45
  };
54
46
  export declare const PaymentConsultResultCode: {
55
47
  EKYC_REQUIRED_FOR_DONATION: string;
@@ -105,6 +97,7 @@ declare type MethodBase = {
105
97
  paymentMethodId: string;
106
98
  paymentMethodType: PaymentMethodNameType;
107
99
  descriptionBannerInfo?: BannerInfo;
100
+ pointToggleInfo?: PointToggleInfo;
108
101
  walletInfo?: unknown;
109
102
  creditCardInfo?: unknown;
110
103
  bankInfo?: unknown;
@@ -156,10 +149,14 @@ export declare type WalletMethod = MethodBase & {
156
149
  totalEmoneyBalanceInfo?: Balance;
157
150
  prepaidBalanceInfo?: Balance;
158
151
  cashBackBalanceInfo?: Balance;
152
+ totalPayPayPointsInfo?: Balance;
159
153
  cashBackExpirableBalanceInfo?: Balance;
160
154
  };
161
155
  };
162
156
  };
157
+ declare type PointToggleInfo = {
158
+ cashBackUseStatus: 'USE' | 'SAVE' | 'INVEST' | null;
159
+ };
163
160
  export declare enum CreditTypes {
164
161
  VISA = "VISA",
165
162
  MASTER = "MASTER",
package/dist/types.d.ts CHANGED
@@ -123,12 +123,10 @@ export declare enum Environment {
123
123
  CANARY = "canary",
124
124
  PRD = "prd"
125
125
  }
126
- export interface OpenMiniAppParams extends NativeParams<void> {
127
- redirectUrl?: string;
128
- }
129
- export interface CloseAppParams extends NativeParams<unknown> {
126
+ export interface CloseAppParams extends NativeParams<void> {
130
127
  options?: {
131
128
  deeplink?: string;
129
+ closeConfirmation?: boolean;
132
130
  };
133
131
  }
134
132
  export interface GetKycInformationParams extends NativeParams<MiniAppResult> {
@@ -143,7 +141,7 @@ export declare type SmartButtonType = 'login' | 'pay';
143
141
  export declare type SmartButtonSize = 'lg' | 'sm';
144
142
  export declare type SmartButtonTheme = 'light' | 'dark' | 'red';
145
143
  export declare type SmartButtonLg = 'en' | 'ja';
146
- export declare type PaymentLabelType = 'payment' | 'donation' | 'remittance';
144
+ export declare type PaymentLabelType = 'payment' | 'donation' | 'remittance' | 'deposit';
147
145
  export interface RenderSmartButtonParams extends NativeParams<MiniAppResult> {
148
146
  type: SmartButtonType;
149
147
  containerId: string;
@@ -213,12 +211,6 @@ export interface SmartPayParams {
213
211
  expiresAt?: number;
214
212
  agreeSimilarTransaction?: boolean;
215
213
  terminalId?: string;
216
- additionalUserInfo?: {
217
- userAddress?: {
218
- visible: boolean;
219
- mandatory: boolean;
220
- };
221
- };
222
214
  orderType?: OrderType;
223
215
  }
224
216
  export interface UserInfo {
@@ -445,13 +437,10 @@ export declare const PPFunctionName: {
445
437
  readonly requestInternal: "requestInternal";
446
438
  readonly scanCode: "scanCode";
447
439
  readonly getAuthStatus: "getAuthStatus";
448
- readonly openMiniApp: "openMiniApp";
449
440
  readonly inputAddress: "inputAddress";
450
- readonly checkAccessToken: "checkAccessToken";
451
441
  readonly getCashbackInformation: "getCashbackInformation";
452
442
  readonly request: "request";
453
443
  readonly getDeviceInformation: "getDeviceInformation";
454
- readonly debug: "debug";
455
444
  readonly createOrder: "createOrder";
456
445
  readonly handleMessageFromNative: "handleMessageFromNative";
457
446
  readonly initKycPassport: "initKycPassport";
@@ -1,6 +1,7 @@
1
1
  import { MiniAppErrorType } from '../model/miniAppError';
2
2
  import { UIComponentsError } from '../model/uiComponents';
3
3
  import { CashbackResponse, SmartPayParams } from '../types';
4
+ import { PPFetchResult } from './fetch';
4
5
  import { Address, NewAddress } from '../types/getUserAddress';
5
6
  import { MakePaymentParams } from '../types/makePayment';
6
7
  import { GetKycPassportInfoResult } from '../types/getKycPassportInfo';
@@ -56,99 +57,33 @@ export interface TopupResponse {
56
57
  data: TopupResponseData;
57
58
  };
58
59
  }
59
- export declare type WalletInfo = {
60
- walletSummary: {
61
- allTotalBalanceInfo: {
62
- balance: number;
63
- currency: string;
64
- };
65
- totalBalanceInfo: {
66
- balance: number;
67
- currency: string;
68
- };
69
- transferableBalanceInfo: {
70
- balance: number;
71
- currency: string;
72
- };
73
- payoutableBalanceInfo: {
74
- balance: number;
75
- currency: string;
76
- };
60
+ export declare type BalanceInfo = {
61
+ totalBalance: {
62
+ amount: number;
63
+ currency: string;
64
+ };
65
+ totalUsableBalance: {
66
+ amount: number;
67
+ currency: string;
77
68
  };
78
- cashBackUseStatus: string;
79
69
  };
80
- export declare function topup(queryParams: TopupQuery, body: TopupBody, paymentParams?: MakePaymentParams): Promise<{
81
- ppFetchResult: "notAuthorized";
82
- errorCode: MiniAppErrorType.notAuthorized;
83
- body: null;
84
- } | {
85
- ppFetchResult: "fetchError";
86
- errorCode: MiniAppErrorType.serverError;
87
- body: null;
88
- } | {
89
- ppFetchResult: "timeout";
90
- errorCode: MiniAppErrorType.timeOut;
91
- body: null;
92
- } | {
93
- ppFetchResult: "tokenExpired";
94
- errorCode: MiniAppErrorType.tokenExpired;
95
- statusCode: number;
96
- body?: null | undefined;
97
- } | {
98
- ppFetchResult: "apiError" | "rateLimitExceeded";
99
- errorCode: MiniAppErrorType;
100
- statusCode: number;
101
- body: ({
102
- signed: {
103
- jws: string;
104
- };
105
- unsigned: {
106
- resultInfo: {
107
- code: string;
108
- codeId?: string | undefined;
109
- message?: string | undefined;
110
- };
111
- data?: {
112
- header?: {
113
- resultCode?: string | undefined;
114
- } | undefined;
115
- error?: unknown;
116
- helpUrl?: string | undefined;
117
- } | undefined;
118
- };
119
- uiComponents?: {
120
- displayErrorResponse?: UIComponentsError | undefined;
121
- } | undefined;
122
- } | {
123
- signed?: undefined;
124
- unsigned?: undefined;
125
- resultInfo: {
126
- code: string;
127
- codeId?: string | undefined;
128
- message?: string | undefined;
129
- };
130
- uiComponents?: {
131
- displayErrorResponse: UIComponentsError;
132
- } | undefined;
133
- }) & Record<string, unknown>;
134
- } | {
135
- ppFetchResult: "success";
136
- statusCode: number;
137
- body: TopupResponse;
138
- }>;
70
+ export declare function topup(queryParams: TopupQuery, body: TopupBody, paymentParams?: MakePaymentParams): Promise<PPFetchResult<TopupResponse>>;
139
71
  export declare type BalanceParams = {
140
72
  clientId?: string;
141
73
  currency?: string;
142
74
  merchant?: string;
143
75
  productType?: string;
144
76
  };
145
- export declare function getBalance(params?: BalanceParams): Promise<import("./fetch").PPFetchResult<unknown, Record<string, unknown>>>;
146
- declare type WalletInfoResponse = {
147
- data: {
148
- payload: WalletInfo;
149
- };
77
+ export declare function getBalance(params?: BalanceParams): Promise<PPFetchResult<unknown, Record<string, unknown>>>;
78
+ declare type BalanceInfoForTopupSheetResponse = {
79
+ data: BalanceInfo;
80
+ };
81
+ declare type BalanceInfoForTopupSheetRequestParams = {
82
+ merchant?: string;
83
+ productType?: string;
84
+ clientId: string;
150
85
  };
151
- export declare function getWalletInfo(): Promise<import("./fetch").PPFetchResult<WalletInfoResponse, Record<string, unknown>>>;
86
+ export declare function getBalanceInfoForTopupSheet(params: BalanceInfoForTopupSheetRequestParams): Promise<PPFetchResult<BalanceInfoForTopupSheetResponse, Record<string, unknown>>>;
152
87
  export declare type ShallowAddress = {
153
88
  prefecture: string;
154
89
  cityAndOaza: string;
@@ -165,7 +100,7 @@ export declare type GetAddressByZipResponse = {
165
100
  export declare type AddressParams = {
166
101
  zipcode: string;
167
102
  };
168
- export declare function getAddressByZip(params: AddressParams): Promise<import("./fetch").PPFetchResult<GetAddressByZipResponse, Record<string, unknown>>>;
103
+ export declare function getAddressByZip(params: AddressParams): Promise<PPFetchResult<GetAddressByZipResponse, Record<string, unknown>>>;
169
104
  export declare type SetSelectedAddressResponse = {
170
105
  signed: unknown;
171
106
  statusCode: number;
@@ -183,8 +118,8 @@ export declare type GetAddressListResponse = {
183
118
  };
184
119
  };
185
120
  };
186
- export declare function getAddressList(): Promise<import("./fetch").PPFetchResult<GetAddressListResponse, Record<string, unknown>>>;
187
- export declare function postAddress(body: NewAddress): Promise<import("./fetch").PPFetchResult<GetAddressListResponse, Record<string, unknown>>>;
121
+ export declare function getAddressList(): Promise<PPFetchResult<GetAddressListResponse, Record<string, unknown>>>;
122
+ export declare function postAddress(body: NewAddress): Promise<PPFetchResult<GetAddressListResponse, Record<string, unknown>>>;
188
123
  export declare type GetOTPResponse = {
189
124
  signed: {
190
125
  jws: string;
@@ -221,7 +156,7 @@ export declare type VerifyOTPBody = {
221
156
  otpKey: string;
222
157
  otp: number;
223
158
  };
224
- export declare function getOtp(): Promise<import("./fetch").PPFetchResult<GetOTPResponse, Record<string, unknown>>>;
159
+ export declare function getOtp(): Promise<PPFetchResult<GetOTPResponse, Record<string, unknown>>>;
225
160
  export declare type KycTypeResponse = {
226
161
  signed: {
227
162
  resultInfo?: {
@@ -257,11 +192,11 @@ export declare type VerifyKycPassportResponse = {
257
192
  data: GetKycPassportInfoResult;
258
193
  };
259
194
  };
260
- export declare function getInitKycPassport(params: InitKycPassportParams): Promise<import("./fetch").PPFetchResult<KycTypeResponse, Record<string, unknown>>>;
261
- export declare function verifyOtp(body: VerifyOTPBody): Promise<import("./fetch").PPFetchResult<VerifyOTPResponse, Record<string, unknown>>>;
262
- export declare function editAddress(body: NewAddress, id: number): Promise<import("./fetch").PPFetchResult<GetAddressListResponse, Record<string, unknown>>>;
263
- export declare function deleteAddress(id: number): Promise<import("./fetch").PPFetchResult<GetAddressListResponse, Record<string, unknown>>>;
264
- export declare function setSelectedAddress(addressId: number): Promise<import("./fetch").PPFetchResult<SetSelectedAddressResponse, Record<string, unknown>>>;
195
+ export declare function getInitKycPassport(params: InitKycPassportParams): Promise<PPFetchResult<KycTypeResponse, Record<string, unknown>>>;
196
+ export declare function verifyOtp(body: VerifyOTPBody): Promise<PPFetchResult<VerifyOTPResponse, Record<string, unknown>>>;
197
+ export declare function editAddress(body: NewAddress, id: number): Promise<PPFetchResult<GetAddressListResponse, Record<string, unknown>>>;
198
+ export declare function deleteAddress(id: number): Promise<PPFetchResult<GetAddressListResponse, Record<string, unknown>>>;
199
+ export declare function setSelectedAddress(addressId: number): Promise<PPFetchResult<SetSelectedAddressResponse, Record<string, unknown>>>;
265
200
  export declare type VERIFY_STATUS = 'NOT_VERIFIED' | 'VERIFIED';
266
201
  export declare type ProfileInfo = {
267
202
  firstName?: string;
@@ -292,8 +227,8 @@ export declare type ProfileResponse = {
292
227
  };
293
228
  statusCode: number;
294
229
  };
295
- export declare function getUserProfileData(): Promise<import("./fetch").PPFetchResult<ProfileResponse, Record<string, unknown>>>;
296
- export declare function getUserProfileDataV2(): Promise<import("./fetch").PPFetchResult<ProfileResponse, Record<string, unknown>>>;
230
+ export declare function getUserProfileData(): Promise<PPFetchResult<ProfileResponse, Record<string, unknown>>>;
231
+ export declare function getUserProfileDataV2(): Promise<PPFetchResult<ProfileResponse, Record<string, unknown>>>;
297
232
  export declare type RegisterEmailResponse = {
298
233
  signed: unknown;
299
234
  statusCode: number;
@@ -312,8 +247,8 @@ export declare type RegisterEmailResponse = {
312
247
  };
313
248
  };
314
249
  };
315
- export declare function registerEmail(email: string): Promise<import("./fetch").PPFetchResult<RegisterEmailResponse, Record<string, unknown>>>;
316
- export declare function resendEmail(): Promise<import("./fetch").PPFetchResult<RegisterEmailResponse, Record<string, unknown>>>;
250
+ export declare function registerEmail(email: string): Promise<PPFetchResult<RegisterEmailResponse, Record<string, unknown>>>;
251
+ export declare function resendEmail(): Promise<PPFetchResult<RegisterEmailResponse, Record<string, unknown>>>;
317
252
  export declare type UserLocationResponse = {
318
253
  unsigned: {
319
254
  data: {
@@ -326,6 +261,6 @@ export declare type UserLocationResponse = {
326
261
  };
327
262
  export declare function getUserLocationRequest(params: {
328
263
  validTimeMinutes: number;
329
- }): Promise<import("./fetch").PPFetchResult<UserLocationResponse, Record<string, unknown>>>;
330
- export declare function getExpectedCashbackInfo(orderInfo: SmartPayParams): Promise<import("./fetch").PPFetchResult<CashbackResponse, Record<string, unknown>>>;
264
+ }): Promise<PPFetchResult<UserLocationResponse, Record<string, unknown>>>;
265
+ export declare function getExpectedCashbackInfo(orderInfo: SmartPayParams): Promise<PPFetchResult<CashbackResponse, Record<string, unknown>>>;
331
266
  export {};
@@ -2,10 +2,8 @@ import { MiniAppErrorType } from '../model/miniAppError';
2
2
  import { UIComponentsErrorButton } from '../model/uiComponents';
3
3
  import { ErrorSheetButton, PaymentLabelType, SmartPayParams } from '../types';
4
4
  import { FontSize } from '../types/getPlatformInformation';
5
- import { NativeParams } from '../jsbridge-core/jsbridge';
6
- import { App } from 'vue';
7
- import { OrderType, MakePaymentParams, BankInfo, CreditCardInfo, InfoBanner, PayLaterCCInfo, PaymentMethod, SbidBankInfo } from '../types/makePayment';
8
5
  import { InitParams } from '../types/init';
6
+ import { BankInfo, CreditCardInfo, InfoBanner, MakePaymentParams, OrderType, PayLaterCCInfo, PaymentMethod, SbidBankInfo } from '../types/makePayment';
9
7
  export declare function isDef<T>(val: T): val is NonNullable<T>;
10
8
  export declare function isFunction(val: unknown): val is (...ars: Array<unknown>) => unknown;
11
9
  export declare function isNumeric(val: string | number): val is string;
@@ -36,6 +34,7 @@ export declare function getLastPayment(): (LastPayment & PersistenceLastPayment)
36
34
  export declare function getLastPaymentMethod(): string | null;
37
35
  export declare function getLastTopupPayMethod(): string | null;
38
36
  export declare function existDuplicatePayment(price: number): boolean;
37
+ export declare function defaultTopupAmountOptions(): number[];
39
38
  export declare enum MiniAppRuntime {
40
39
  android = "ANDROID",
41
40
  ios = "IOS",
@@ -80,7 +79,11 @@ export declare function isBffSitEnvironment(): boolean;
80
79
  export declare function replaceStringPlaceholders(str: string, values: Record<string, string>): string;
81
80
  export declare function validateUrl(url: string): boolean;
82
81
  export declare function constructUrl(baseUrl: string, params: Record<string, string | string[] | number | number[] | boolean | undefined>): string;
83
- export declare function makeDefaultErrorHandler(app: App, params: NativeParams<never> | undefined): (err: unknown) => void;
82
+ export declare function makeDefaultErrorHandler(params: {
83
+ fail?: (error: {
84
+ errorCode: MiniAppErrorType;
85
+ }) => void;
86
+ } | undefined, onComplete: () => void): (err: unknown) => void;
84
87
  export declare function getCardBrandImage(brandName: string): string;
85
88
  export declare function hasMultiplePPCD(paymentMethods: PaymentMethod[] | undefined): boolean;
86
89
  export declare function addAdditionalInfoForMultiplePPCD(paymentMethods: PaymentMethod[]): void;
@@ -12,7 +12,9 @@ export declare function saveConsumedOtt(ott: string): void;
12
12
  export declare function saveEnv(env?: PPEnvType): void;
13
13
  export declare function getEnv(): PPEnvType | null;
14
14
  export declare function isProdEnv(): boolean;
15
+ export declare function saveClientUUID(uuid: string): void;
15
16
  export declare function getClientUUID(): string;
17
+ export declare function saveDeviceUUID(uuid: string): void;
16
18
  export declare function getDeviceUUIDFromNative(): string;
17
19
  export declare function getDeviceUUID(): string;
18
20
  export declare function saveLastPayment(payment: string): void;
@@ -37,10 +39,10 @@ export declare type SerializedAppDetail = {
37
39
  export declare function saveAppDetail(appDetail: SerializedAppDetail): void;
38
40
  export declare function getAppDetail(clientId?: string): SerializedAppDetail | null;
39
41
  export declare function removeAppDetail(): void;
40
- export declare function saveAppConfig(appConfig: string): void;
41
- export declare function getAppConfig(): string | null;
42
42
  export declare function getUserInfo(): string | null;
43
43
  export declare function saveUserInfo(userData: string): void;
44
+ export declare function saveCodeVerifier(codeVerifier: string): void;
45
+ export declare function getCodeVerifier(): string | null;
44
46
  export declare function removeCodeVerifier(): void;
45
47
  export declare function saveAuthorizedClientOrigin(clientId: string, origin: string): void;
46
48
  export declare function getAuthorizedClientOrigin(clientId: string): string | null;
@@ -1,6 +1,7 @@
1
1
  declare enum MessageType {
2
2
  request = "request",
3
- response = "response"
3
+ response = "response",
4
+ callback = "callback"
4
5
  }
5
6
  declare type GetTargetWindowFunctionType = () => Promise<Window | undefined | null> | Window | undefined | null;
6
7
  interface MessageBaseType {
@@ -12,6 +13,12 @@ interface PartialMessageRequestType {
12
13
  type: MessageType.request;
13
14
  params: Array<unknown>;
14
15
  }
16
+ export interface MessageCallbackType extends MessageBaseType {
17
+ type: MessageType.callback;
18
+ callbackName: string;
19
+ args: Array<unknown>;
20
+ }
21
+ export declare type Callbacks = Record<string, (...args: Array<unknown>) => void>;
15
22
  export declare type MessageRequestType = MessageBaseType & PartialMessageRequestType;
16
23
  export declare type Params = Array<any>;
17
24
  export interface FunctionType {
@@ -26,19 +33,25 @@ export declare type WindowBridgeFunctions<T extends FunctionsCollection> = {
26
33
  };
27
34
  export declare class WindowBridge {
28
35
  private static _instance?;
29
- private deferredCallbacks;
36
+ private deferredPromises;
30
37
  private functions;
31
38
  private allowedOrigins?;
32
39
  private middlewares;
40
+ private registeredCallbacks;
33
41
  private constructor();
34
42
  private subscribeToMessageEvent;
35
43
  private unsubscribeToMessageEvent;
36
44
  private messageEventHandler;
37
45
  private handleRequest;
38
46
  private handleResponse;
47
+ private handleCallback;
39
48
  private sendErrorResponse;
40
49
  private sendSuccessResponse;
41
50
  private sendResponse;
51
+ private invokeCallback;
52
+ private sendMessage;
53
+ private sendRequest;
54
+ private addFunctionCallbacks;
42
55
  static init(functions: FunctionsCollection, allowedOrigins?: Array<string>, middlewares?: Array<Middleware>): WindowBridge;
43
56
  static destroy(): void;
44
57
  static getBridge(): WindowBridge;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paypay/mini-app-js-sdk",
3
- "version": "2.49.0",
3
+ "version": "2.54.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "build": "yarn build:client && yarn build:core",
@@ -41,7 +41,6 @@
41
41
  "js-cookie": "^3.0.5"
42
42
  },
43
43
  "devDependencies": {
44
- "@braintree/browser-detection": "^2.0.1",
45
44
  "@pinia/testing": "0.1.7",
46
45
  "@playwright/test": "^1.49.1",
47
46
  "@rollup/plugin-html": "^1.1.0",
@@ -63,6 +62,7 @@
63
62
  "@vitest/coverage-v8": "^2.1.8",
64
63
  "@vue/compiler-sfc": "^3.5.13",
65
64
  "@vue/test-utils": "^2.0.0-rc.21",
65
+ "bowser": "^2.11.0",
66
66
  "detectincognitojs": "^1.3.7",
67
67
  "dotenv": "^16.4.7",
68
68
  "eslint": "^8.57.1",
@@ -1,5 +0,0 @@
1
- import { NativeParams } from '../../jsbridge-core/jsbridge';
2
- import { MiniAppStatusType } from '../miniAppStatus';
3
- export declare function checkAccessToken(params: NativeParams<{
4
- statusCode: MiniAppStatusType.validToken;
5
- }>): void;
@@ -1,3 +0,0 @@
1
- import { NativeParams } from '../../jsbridge-core/jsbridge';
2
- import { MiniAppResult } from '../../types';
3
- export declare function debug(params: NativeParams<MiniAppResult>): void;
@@ -1,2 +0,0 @@
1
- import { OpenMiniAppParams } from '../../types';
2
- export declare function openMiniApp(openMiniappParams?: OpenMiniAppParams): void;