@paypay/mini-app-js-sdk 2.58.0 → 2.60.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 +1 @@
1
- export declare const success = "SUCCESS", invalidUrl = "INVALID_URL", invalidData = "INVALID_DATA", invalidHeader = "INVALID_HEADER", invalidMethod = "INVALID_METHOD", invalidPath = "INVALID_PATH", notReachable = "NOT_REACHABLE", notAvailable = "NOT_AVAILABLE", timeOut = "TIME_OUT", whiteListError = "NONE_WHITELIST_DOMAIN", statusCodeError = "STATUS_CODE_ERROR", invalidResponse = "INVALID_RESPONSE", noLocationPermission = "NO_USER_LOCATION_PERMISSION", noPermissionListAvailable = "NO_PERMISSION_LIST_AVAILABLE", other = "other", serverError = "SERVER_ERROR", noCameraPermission = "HOST_APP_CAMERA_DENIED", noAlbumPermission = "HOST_APP_ALBUM_DENIED", insufficientScope = "INSUFFICIENT_SCOPE", userCanceled = "USER_CANCELED", invalidJSAPIParams = "INVALID_JS_API_PARAMS", hostAppLocationDenied = "HOST_APP_LOCATION_DENIED", hostAppContactsDenied = "HOST_APP_READING_CONTACT_DENIED", badRequestInsufficientParameter = "BAD_REQUEST_INSUFFICIENT_PARAMETER", badRequest = "BAD_REQUEST", paymentFail = "PAYMENT_FAIL", topupFail = "TOPUP_FAIL", topupSuccessButNotAddToBalance = "TOPUP_SUCCESS_BUT_NOT_ADD_TO_BALANCE", userCanceledSimilarTxn = "USER_CANCELED_SIMILAR_TRANSACTION", mapAppNotFound = "MAP_APP_NOT_FOUND", invalidAppSchemeURL = "INVALID_APP_SCHEME_URL", noValueFound = "NO_VALUE_FOUND", securityNotSetup = "SECURITY_NOT_SETUP", userDenied = "USER_DENIED", securityTemporaryLocked = "SECURITY_TEMPORARY_LOCKED", couldNotGenerateBarcode = "COULD_NOT_GENERATE_BARCODE", cannotDetectAvailability = "CAN_NOT_DETECT_AVAILABILITY", suspectedDuplicatePayment = "SUSPECTED_DUPLICATE_PAYMENT", noSufficientFund = "NO_SUFFICIENT_FUND", unknown = "UNKNOWN", sdkNotInitialized = "SDK_NOT_INITIALIZED", tokenNotFound = "TOKEN_NOT_FOUND", tokenExpired = "TOKEN_EXPIRED", activeRequestExists = "ACTIVE_REQUEST_EXISTS", invalidType = "INVALID_TYPE", sessionNotFound = "SESSION_NOT_FOUND", cookieError = "COOKIE_ERROR", notAuthorized = "NOT_AUTHORIZED", permissionRequired = "PERMISSION_REQUIRED", deeplinkUnavailable = "DEEPLINK_UNAVAILABLE", kycIncompleted = "KYC_INCOMPLETED", noBankAccount = "NO_BANK_ACCOUNT", invalidPaymentIdentifier = "INVALID_PAYMENT_IDENTIFIER", otpSendTooShort = "OTP_SEND_TOO_SHORT", otpSendOverLimit = "OTP_SEND_OVER_LIMIT", userVerificationFailure = "USER_VERIFICATION_FAILURE", unacceptableOp = "UNACCEPTABLE_OP", kycUpdateRequired = "KYC_UPDATE_REQUIRED", notCompleted = "NOT_COMPLETED", kycValidationInProcess = "KYC_VALIDATION_IN_PROCESS", noLocationData = "NO_LOCATION_DATA", functionNotFound = "FUNCTION_NOT_FOUND", originNotAllowed = "ORIGIN_NOT_ALLOWED", messageSendingFailed = "MESSAGE_SENDING_FAILED", transactionNotFound = "TRANSACTION_NOT_FOUND", unexpectedOperation = "UNEXPECTED_OP", merchantTimeout = "MERCHANT_TIMEOUT", rateLimitExceeded = "RATE_LIMIT_EXCEEDED", sdkUpgradeRequired = "SDK_UPGRADE_REQUIRED", authorizationNeeded = "AUTHORIZATION_NEEDED", invalidVirtualAccount = "INVALID_VIRTUAL_ACCOUNT", notSupportedUser = "NOT_SUPPORTED_USER";
1
+ export declare const success = "SUCCESS", invalidUrl = "INVALID_URL", invalidData = "INVALID_DATA", invalidHeader = "INVALID_HEADER", invalidMethod = "INVALID_METHOD", invalidPath = "INVALID_PATH", notReachable = "NOT_REACHABLE", notAvailable = "NOT_AVAILABLE", timeOut = "TIME_OUT", whiteListError = "NONE_WHITELIST_DOMAIN", statusCodeError = "STATUS_CODE_ERROR", invalidResponse = "INVALID_RESPONSE", noLocationPermission = "NO_USER_LOCATION_PERMISSION", noPermissionListAvailable = "NO_PERMISSION_LIST_AVAILABLE", other = "other", serverError = "SERVER_ERROR", noCameraPermission = "HOST_APP_CAMERA_DENIED", noAlbumPermission = "HOST_APP_ALBUM_DENIED", insufficientScope = "INSUFFICIENT_SCOPE", userCanceled = "USER_CANCELED", invalidJSAPIParams = "INVALID_JS_API_PARAMS", hostAppLocationDenied = "HOST_APP_LOCATION_DENIED", hostAppContactsDenied = "HOST_APP_READING_CONTACT_DENIED", badRequestInsufficientParameter = "BAD_REQUEST_INSUFFICIENT_PARAMETER", badRequest = "BAD_REQUEST", paymentFail = "PAYMENT_FAIL", topupFail = "TOPUP_FAIL", topupSuccessButNotAddToBalance = "TOPUP_SUCCESS_BUT_NOT_ADD_TO_BALANCE", userCanceledSimilarTxn = "USER_CANCELED_SIMILAR_TRANSACTION", mapAppNotFound = "MAP_APP_NOT_FOUND", invalidAppSchemeURL = "INVALID_APP_SCHEME_URL", noValueFound = "NO_VALUE_FOUND", securityNotSetup = "SECURITY_NOT_SETUP", userDenied = "USER_DENIED", securityTemporaryLocked = "SECURITY_TEMPORARY_LOCKED", couldNotGenerateBarcode = "COULD_NOT_GENERATE_BARCODE", cannotDetectAvailability = "CAN_NOT_DETECT_AVAILABILITY", suspectedDuplicatePayment = "SUSPECTED_DUPLICATE_PAYMENT", noSufficientFund = "NO_SUFFICIENT_FUND", unknown = "UNKNOWN", sdkNotInitialized = "SDK_NOT_INITIALIZED", tokenNotFound = "TOKEN_NOT_FOUND", tokenExpired = "TOKEN_EXPIRED", activeRequestExists = "ACTIVE_REQUEST_EXISTS", invalidType = "INVALID_TYPE", sessionNotFound = "SESSION_NOT_FOUND", cookieError = "COOKIE_ERROR", notAuthorized = "NOT_AUTHORIZED", permissionRequired = "PERMISSION_REQUIRED", deeplinkUnavailable = "DEEPLINK_UNAVAILABLE", kycIncompleted = "KYC_INCOMPLETED", noBankAccount = "NO_BANK_ACCOUNT", invalidPaymentIdentifier = "INVALID_PAYMENT_IDENTIFIER", otpSendTooShort = "OTP_SEND_TOO_SHORT", otpSendOverLimit = "OTP_SEND_OVER_LIMIT", userVerificationFailure = "USER_VERIFICATION_FAILURE", unacceptableOp = "UNACCEPTABLE_OP", kycUpdateRequired = "KYC_UPDATE_REQUIRED", notCompleted = "NOT_COMPLETED", kycValidationInProcess = "KYC_VALIDATION_IN_PROCESS", noLocationData = "NO_LOCATION_DATA", functionNotFound = "FUNCTION_NOT_FOUND", originNotAllowed = "ORIGIN_NOT_ALLOWED", messageSendingFailed = "MESSAGE_SENDING_FAILED", transactionNotFound = "TRANSACTION_NOT_FOUND", unexpectedOperation = "UNEXPECTED_OP", merchantTimeout = "MERCHANT_TIMEOUT", rateLimitExceeded = "RATE_LIMIT_EXCEEDED", sdkUpgradeRequired = "SDK_UPGRADE_REQUIRED", authorizationNeeded = "AUTHORIZATION_NEEDED", invalidVirtualAccount = "INVALID_VIRTUAL_ACCOUNT", notSupportedUser = "NOT_SUPPORTED_USER", maintenanceMode = "MAINTENANCE_MODE";
@@ -1 +1 @@
1
- export declare const init = "init", getBankInfo = "getBankInfo", showAlert = "showAlert", render = "render", makePayment = "makePayment", getUAID = "getUAID", logout = "logout", startMultiFactorAuth = "startMultiFactorAuth", verifyMultiFactorAuthResult = "verifyMultiFactorAuthResult", getPermissionStatus = "getPermissionStatus", registerKyc = "registerKyc", getKycInformation = "getKycInformation", getUserAddress = "getUserAddress", getUserLocation = "getUserLocation", getUserProfile = "getUserProfile", registerEmail = "registerEmail", showUpdateWarning = "showUpdateWarning", showErrorSheet = "showErrorSheet", getPlatformInformation = "getPlatformInformation", share = "share", getTopBarHeight = "getTopBarHeight", openWebview = "openWebview", openMap = "openMap", closeApp = "closeApp", openApp = "openApp", checkPaymentMethod = "checkPaymentMethod", getBalance = "getBalance", topup = "topup", registerPaymentFeatures = "registerPaymentFeatures", registerUserInfo = "registerUserInfo", requestInternal = "requestInternal", scanCode = "scanCode", getAuthStatus = "getAuthStatus", inputAddress = "inputAddress", getCashbackInformation = "getCashbackInformation", request = "request", getDeviceInformation = "getDeviceInformation", createOrder = "createOrder", handleMessageFromNative = "handleMessageFromNative", initKycPassport = "initKycPassport", smsAuth = "smsAuth", getKycPassportInfo = "getKycPassportInfo";
1
+ export declare const init = "init", getBankInfo = "getBankInfo", showAlert = "showAlert", render = "render", renderButton = "renderButton", makePayment = "makePayment", getUAID = "getUAID", logout = "logout", startMultiFactorAuth = "startMultiFactorAuth", verifyMultiFactorAuthResult = "verifyMultiFactorAuthResult", getPermissionStatus = "getPermissionStatus", registerKyc = "registerKyc", getKycInformation = "getKycInformation", getUserAddress = "getUserAddress", getUserLocation = "getUserLocation", getUserProfile = "getUserProfile", registerEmail = "registerEmail", showUpdateWarning = "showUpdateWarning", showErrorSheet = "showErrorSheet", getPlatformInformation = "getPlatformInformation", share = "share", getTopBarHeight = "getTopBarHeight", openWebview = "openWebview", openMap = "openMap", closeApp = "closeApp", openApp = "openApp", checkPaymentMethod = "checkPaymentMethod", getBalance = "getBalance", topup = "topup", registerPaymentFeatures = "registerPaymentFeatures", registerUserInfo = "registerUserInfo", requestInternal = "requestInternal", scanCode = "scanCode", getAuthStatus = "getAuthStatus", inputAddress = "inputAddress", getCashbackInformation = "getCashbackInformation", request = "request", getDeviceInformation = "getDeviceInformation", createOrder = "createOrder", handleMessageFromNative = "handleMessageFromNative", initKycPassport = "initKycPassport", smsAuth = "smsAuth", getKycPassportInfo = "getKycPassportInfo";
@@ -1,6 +1,5 @@
1
1
  export declare const JS_SDK_VERSION: string;
2
2
  export declare const REVISION: string;
3
- export declare const BUILD_TYPE: "prod" | "stg" | "preview" | "dev";
4
3
  export declare const CORE_IFRAME_ORIGIN: string;
5
4
  export declare const CORE_IFRAME_URL: string;
6
5
  export declare const COUPON_IFRAME_URL: string;
@@ -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,r=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,s=(t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,a=(e,t)=>{for(var n in t||(t={}))r.call(t,n)&&s(e,n,t[n]);if(o)for(var n of o(t))i.call(t,n)&&s(e,n,t[n]);return e},l=(e,o)=>t(e,n(o)),c=(e,t,n)=>new Promise(((o,r)=>{var i=e=>{try{a(n.next(e))}catch(t){r(t)}},s=e=>{try{a(n.throw(e))}catch(t){r(t)}},a=e=>e.done?o(e.value):Promise.resolve(e.value).then(i,s);a((n=n.apply(e,t)).next())}));function u(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}var d=function e(t,n){function o(e,o,r){if("undefined"!=typeof document){"number"==typeof(r=u({},n,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var i="";for(var s in r)r[s]&&(i+="; "+s,!0!==r[s]&&(i+="="+r[s].split(";")[0]));return document.cookie=e+"="+t.write(o,e)+i}}return Object.create({set:o,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],o={},r=0;r<n.length;r++){var i=n[r].split("="),s=i.slice(1).join("=");try{var a=decodeURIComponent(i[0]);if(o[a]=t.read(s,a),e===a)break}catch(l){}}return e?o[e]:o}},remove:function(e,t){o(e,"",u({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,u({},this.attributes,t))},withConverter:function(t){return e(u({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});const g="_PayPayJsBridge",f=["init","openWebview","openMap","closeApp","makePayment","topup","setSessionData","getSessionData","setStorageData","getStorageData","removeStorageData","getPermissionStatus","scanCode","showAlert","showErrorSheet","getTopBarHeight","setTitle","showUpdateWarning","getPlatformInformation","openApp","share","getKycInformation","getUserLocation","checkPaymentMethod","registerKyc","startMultiFactorAuth","verifyMultiFactorAuthResult","getBankInfo","logout","getUserProfile","getBalance","getUserAddress","getUAID","copyToClipboard","registerUserInfo","setEnablePullDownRefresh","registerEmail","inputAddress","getDeviceInformation","request","requestInternal","registerPaymentFeatures","initKycPassport","getKycPassportInfo","shortcutExists","addShortcut","getAllUserAddresses","getUserPaymentFeatureSettings","getPaymentSettings","getTransactionInfo","getTransactions","getPayPayCardInfo","getExternalLinkageInformation","markAsReady","renderCoupons"],m=["init","createOrder","makePayment","render","logout","getAuthStatus","getUserProfile","getBalance","getUserAddress","getUAID","getCashbackInformation","renderCoupons","getLoginUrl","renderButton"],p="2.58.0",h=new URL("https://mini-app-sdk-core.paypay.ne.jp/"),v=h.origin,y=new URL(`./iframe.html?v=${p}&rev=5c56199`,h).href,w=new URL(`./coupon/iframe.html?v=${p}`,h).href;new URL(`./button/iframe.html?v=${p}`,h).href;const b="BAD_REQUEST_INSUFFICIENT_PARAMETER",S="UNKNOWN",I="SDK_NOT_INITIALIZED",E="TOKEN_NOT_FOUND",k="TOKEN_EXPIRED",C="AUTHORIZATION_NEEDED",P="ppjssdk.refreshToken",O="ppjssdk.codeVerifier";class _ extends Error{constructor(e,t){super(e),this.errorCode=t}}const T=Object.freeze(Object.defineProperty({__proto__:null,getCookie:function({name:e}){return d.get(e)},getLocalStorage:function({name:e}){return localStorage.getItem(e)},getSessionStorage:function({name:e}){return sessionStorage.getItem(e)},getUrl:function(){return window.location.href},insertIframe:function(e){var{containerSelector:t,attributes:n}=e,s=n,{styles:a}=s,l=((e,t)=>{var n={};for(var s in e)r.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&o)for(var s of o(e))t.indexOf(s)<0&&i.call(e,s)&&(n[s]=e[s]);return n})(s,["styles"]);return new Promise(((e,n)=>{const o=document.querySelector(t);if(!o)return void n(new _(`Container with selector "${t}" not found.`,b));const r=document.createElement("iframe");r.onload=()=>{e(!0)},r.onerror=()=>{n(new _("Failed to load iframe.","NOT_REACHABLE"))},Object.assign(r.style,a),Object.entries(l).forEach((([e,t])=>{r.setAttribute(e,t)})),o.innerHTML="",o.appendChild(r)}))},removeCookie:function({name:e,options:t}){return d.remove(e,t)},removeElement:function({selector:e}){const t=document.querySelector(e);return!!t&&(t.remove(),!0)},removeLocalStorage:function({name:e}){return localStorage.removeItem(e)},removeQueryParametersFromUrl:function(e){const t=new URL(window.location.href);e.forEach((e=>t.searchParams.delete(e)));const n=`${t.pathname}${t.search}`;history.replaceState(history.state,"",n)},removeSessionStorage:function({name:e}){return sessionStorage.removeItem(e)},setCookie:function({name:e,value:t,options:n}){return d.set(e,t,n)},setLocalStorage:function({name:e,value:t}){return localStorage.setItem(e,t)},setSessionStorage:function({name:e,value:t}){return sessionStorage.setItem(e,t)},updateElementStyle:function({selector:e,styles:t}){const n=document.querySelector(e);return!!n&&(Object.assign(n.style,t),!0)}},Symbol.toStringTag,{value:"Module"})),A="success",R="fail",L="complete";var N=(e=>(e.MiniApp="MiniApp",e.SmartPayment="SmartPayment",e))(N||{});function U(){return Math.random().toString(36).substring(7)}const D=e=>"object"!=typeof e||null===e?e:JSON.parse(JSON.stringify(e)),M=e=>{var t;const n=null==(t=e[0])?void 0:t.callbacks;return"object"==typeof n&&null!==n},x=e=>Object.keys(e).reduce(((e,t)=>(e[t]=!0,e)),{});class ${constructor(e,t,n=[],o){this.deferredPromises={},this.functions=e,this.allowedOrigins=t,this.middlewares=n,this.registeredCallbacks={},this.messageEventHandler=this.messageEventHandler.bind(this),this.errorLogger=o,this.subscribeToMessageEvent()}subscribeToMessageEvent(){window.addEventListener("message",this.messageEventHandler)}unsubscribeToMessageEvent(){window.removeEventListener("message",this.messageEventHandler)}messageEventHandler(e){var t;if(null==(t=e.data)?void 0:t.forWindowBridge)return this.allowedOrigins&&"request"===e.data.type&&!this.allowedOrigins.includes(e.origin)?this.sendErrorResponse(e,`${e.origin} is not allowed to make requests`,"ORIGIN_NOT_ALLOWED"):void("request"===e.data.type?this.handleRequest(e):"response"===e.data.type?this.handleResponse(e):"callback"===e.data.type&&this.handleCallback(e))}handleRequest(e){return c(this,null,(function*(){var t;const n=e.data.functionName,o=this.functions[n];o||this.sendErrorResponse(e,`Function '${n}' does not exists on the target window`,"FUNCTION_NOT_FOUND");const r=D(e.data.params);M(r)&&(r[0].callbacks=Object.keys(r[0].callbacks).reduce(((t,n)=>(t[n]=(...t)=>{this.invokeCallback(e,n,t)},t)),{}));try{this.sendSuccessResponse(e,yield function(e,t,n,o){let r=-1;const i=o=>c(this,null,(function*(){if(++r,r<e.length){const n=e[r];return yield n(t,o,i)}return n(...o)}));return i(o)}([...this.middlewares,...null!=(t=o.middlewares)?t:[]],e,o,r))}catch(i){let t="Some error occurred while processing the request",n=S;i instanceof _?(t=i.message,n=i.errorCode):console.error(i),this.sendErrorResponse(e,t,n)}}))}handleResponse(e){if(!this.deferredPromises[e.data.key])return void console.warn(`Promise for ${e.data.functionName} not found`);const[t,n]=this.deferredPromises[e.data.key];delete this.deferredPromises[e.data.key],"success"===e.data.status?t(e.data.result):(delete this.registeredCallbacks[e.data.key],n(new _(e.data.message,e.data.errorCode)))}handleCallback(e){var t;const{key:n,callbackName:o,args:r}=e.data,i=null==(t=this.registeredCallbacks[n])?void 0:t[o];i?i(...r):console.warn(`Callback with key ${n} and name ${o} not found.`)}sendErrorResponse(e,t,n){this.errorLogger&&this.errorLogger(e.data.functionName,t,n),this.sendResponse(e,{status:"failure",message:t,errorCode:n})}sendSuccessResponse(e,t){this.sendResponse(e,{status:"success",result:t})}sendResponse(e,t){this.sendMessage(e.source,e.origin,a({type:"response",key:e.data.key,functionName:e.data.functionName},t))}invokeCallback(e,t,n){this.sendMessage(e.source,e.origin,{type:"callback",key:e.data.key,functionName:e.data.functionName,callbackName:t,args:n})}sendMessage(e,t,n){e.postMessage(a({forWindowBridge:!0},D(n)),t)}sendRequest(e,t,n,o){return new Promise(((r,i)=>c(this,null,(function*(){const s=`${n}--${U()}`;try{const c=yield e();if(!c)throw new Error("Target window is undefined");let u=o[0];if(M(o)){const e=o[0].callbacks;this.addFunctionCallbacks(s,e),u=l(a({},o[0]),{callbacks:x(e)})}this.deferredPromises[s]=[r,i],this.sendMessage(c,t,{type:"request",key:s,functionName:n,params:[u]})}catch(c){delete this.deferredPromises[s],delete this.registeredCallbacks[s],i(new _(c.message,"MESSAGE_SENDING_FAILED"))}}))))}addFunctionCallbacks(e,t){Object.keys(t).forEach((e=>{if("function"!=typeof t[e])throw new Error(`Callback ${e} is not a function`)})),this.registeredCallbacks[e]=a({},t)}static init(e,t,n=[],o){if(this._instance)throw new Error("WindowBridge already initialized, you can't call WindowBridge.init more than once");return this._instance=new this(e,t,n,o),this._instance}static destroy(){this._instance&&(this._instance.unsubscribeToMessageEvent(),this._instance=void 0)}static getBridge(){if(!this._instance)throw new Error("WindowBridge not initialized, please call WindowBridge.init before calling WindowBridge.getBridge");return this._instance}static getTargetWindowFunctionProxy(e,t){return $.getBridge().getTargetWindowFunctionProxy(e,t)}getTargetWindowFunctionProxy(e,t){return new Proxy(this,{get:(n,o)=>(...r)=>n.sendRequest(e,t,o.toString(),r)})}}const F="ppmna-iframe",B="ppsdk-container";let j,W;function q(){return j||(j=function(){if(document.getElementById(F))return;const e=document.createElement("div");return document.createElement("div"),e.setAttribute("id",B),e.setAttribute("class",B),e.style.all="initial",e.style.display="none",e.style.position="fixed",e.style.width="100%",e.style.height="100%",e.style.top="0",e.style.left="0",e.style.zIndex="2147483637",document.body.appendChild(e),e}()),j}function K(e){const t=q();t&&(t.style.display=e?"initial":"none")}function H(){return W||(W=new Promise(((e,t)=>{function n(){const n=document.createElement("iframe");n.setAttribute("src",y),n.setAttribute("name",F),n.setAttribute("id",F),n.setAttribute("class",F),n.setAttribute("allow","geolocation"),n.onload=()=>{e(n),n.onerror=null},n.onerror=t,n.style.all="initial",n.style.width="100%",n.style.height="100%",n.style.border="none";const o=q();o&&(o.innerHTML="",o.append(n))}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(()=>{n()})):n()}))),W}$.init(T,[v]);const J=$.getTargetWindowFunctionProxy((function(){return H().then((e=>null==e?void 0:e.contentWindow)).catch((()=>null))}),v);function z(e,t,n){const o=U(),r=n=>{V(n.origin)&&n.data.name===e&&n.data.messageId===o&&function(e,t,n){var o,r,i;e.result===R&&(null==(o=null==t?void 0:t.fail)||o.call(t,e.data)),e.result===A&&(null==(r=null==t?void 0:t.success)||r.call(t,null==e?void 0:e.data)),e.result===L&&(null==(i=null==t?void 0:t.complete)||i.call(t),removeEventListener("message",n))}(n.data,t,r)};addEventListener("message",r),function(e){c(this,null,(function*(){var t;const n=yield H().catch((()=>{}));null==(t=null==n?void 0:n.contentWindow)||t.postMessage(JSON.parse(JSON.stringify(e)),v)}))}({name:e,params:n,messageId:o})}function V(e){return e===v}function G(e){return f.includes(e)}function Z(e){return m.includes(e)}function Q(e,t,n){return function(o={}){const r=null==n?void 0:n(o);J.logEvent(a({event_action:`pp_${e}_called`,event_category_suffix:e},r));const i=t(o);return i.then((t=>{var n;J.logEvent(a({event_action:`pp_${e}_success`,event_category_suffix:e},r)),null==(n=o.success)||n.call(o,t)})).catch((t=>{var n;console.error(t.message),J.logEvent(a({event_action:`pp_${e}_fail`,event_category_suffix:e,error_value:t.errorCode},r)),null==(n=o.fail)||n.call(o,{errorCode:t.errorCode})})).finally((()=>{var e;null==(e=o.complete)||e.call(o)})),i}}const X={[I]:C,[E]:C,[k]:k};let Y,ee;H(),ee=Promise.resolve(!1);function te(e){const t=function(e,t){if(t){const t=localStorage.getItem(`${P}.${e}`);if(t)return t}return d.get(`${P}.${e}`)||d.get(P)||""}(e.clientId,e.useLocalStorage),n=function(e,t){if(t){const t=localStorage.getItem(`${O}.${e}`);if(t)return t}return d.get(`${O}.${e}`)||d.get(O)||""}(e.clientId,e.useLocalStorage),o=l(a({},e),{refreshToken:t,clientVersion:"2.58.0",codeVerifier:n,clientSdkType:Y,clientUrl:window.location.href});let r;const i=new Promise((e=>r=e)),s=()=>{var t;r(!0),null==(t=e.complete)||t.call(e)};ee.then((()=>H())).then((()=>{z("init",l(a({},e),{complete:s}),o)})).catch((()=>{var t;null==(t=e.fail)||t.call(e,{errorCode:I}),s()})),ee=i}addEventListener("message",(e=>{var t;if(!(null==(t=e.data)?void 0:t.forWindowBridge)&&V(e.origin))if("reload"===e.data.name&&window.location.reload(),"makeVisible"!==e.data.name)if("showIframe"!==e.data.name)if("hideIframe"!==e.data.name){if("link"===e.data.name){const t=e.data.data;"_blank"===t.target?window.open(t.url,"_blank"):window.location.href=t.url}if("consoleDebugInfo"===e.data.name){const{params:t}=e.data.data;!function(e){console.debug(...e)}(t)}}else K(!1);else K(!0);else K(!0)})),addEventListener("popstate",(()=>{H().then((e=>{var t;const n={name:"clientPopState"};null==(t=null==e?void 0:e.contentWindow)||t.postMessage(n,v)})).catch((e=>console.warn(e)))}));var ne;ne={_handleMessageFromNative:e=>{H().then((t=>{var n;null==(n=null==t?void 0:t.contentWindow)||n.postMessage(JSON.parse(JSON.stringify({name:"handleMessageFromNative",params:{json:e}})),v)}))}},(!window.hasOwnProperty(g)||window[g]!==ne)&&(window[g]=ne);const oe=["init","setTitle","copyToClipboard","getSessionData","setSessionData","getStorageData","setStorageData","removeStorageData","getLoginUrl"],re=["renderCoupons"];const ie={version:"2.58.0",revision:"5c56199"};Q("getLoginUrl",J.getLoginUrl);const se=Q("getPaymentSettings",J.getPaymentSettings),ae=Q("markAsReady",J.markAsReady);Q("renderButton",J.renderButton);var le=(e=>(e.validToken="TOKEN_VALID",e.initialized="INITIALIZED",e.emailRegistered="EMAIL_REGISTERED",e.emailNotVerified="EMAIL_NOT_VERIFIED",e.success="SUCCESS",e.loggedOut="LOGGED_OUT",e.connected="CONNECTED",e))(le||{});const ce=Q("logout",(()=>c(this,null,(function*(){try{return yield J.logout(),{statusCode:le.loggedOut}}catch(e){throw new _(`An error occurred while trying to logout the user, error=${e}`,S)}}))));const ue={verifyMultiFactorAuthResult:function(e){const t=new URL(window.location.href);z("verifyMultiFactorAuthResult",e,l(a({},e),{sessionId:t.searchParams.get("ppSessionId")}))},share:function(e){if(!(null==navigator?void 0:navigator.share))return void z("share",e,e);const t={text:null==e?void 0:e.text};navigator.share(t).then((()=>{var t,n;null==(t=null==e?void 0:e.success)||t.call(e),null==(n=null==e?void 0:e.complete)||n.call(e)})).catch((()=>{var t,n;null==(t=null==e?void 0:e.fail)||t.call(e,{errorCode:S}),null==(n=null==e?void 0:e.complete)||n.call(e)}))},setTitle:function(e){var t,n,o;document.title=null!=(t=null==e?void 0:e.title)?t:"",null==(n=null==e?void 0:e.success)||n.call(e),null==(o=null==e?void 0:e.complete)||o.call(e)},renderCoupons:Q("renderCoupons",(e=>c(this,null,(function*(){const{merchant:t,couponId:n,containerId:o,postLoginRedirectUrl:r=window.location.href,postLoginRedirectType:i,locale:s}=e,a=document.getElementById(o);if(!a)throw new _("Invalid coupon container Id",b);const l=yield J.fetchCoupons({merchantId:t,couponId:n,postLoginRedirectUrl:r,postLoginRedirectType:i});try{const e=document.createElement("iframe");e.src=w,e.style.cssText="width:100%;height: 0;border: none;transition: height 300ms ease-in;display: block;",yield new Promise(((t,n)=>{e.onload=()=>t(!0),e.onerror=()=>n(new Error("Failed to load coupon iframe")),a.innerHTML="",a.append(e)})),e.onload=null,e.onerror=null,window.addEventListener("message",(({data:t,source:n})=>{"update-iframe-height"===(null==t?void 0:t.eventName)&&e.contentWindow===n&&(e.style.height=`${t.height}px`)}));const n=$.getTargetWindowFunctionProxy((()=>e.contentWindow),v);yield n.renderCoupons({coupons:l,merchantId:t,locale:s,postLoginRedirectUrl:r,postLoginRedirectType:i})}catch(c){throw new _(`An error occurred while displaying coupons, merchantId=${t}, couponId=${n}, error=${c}`,S)}}))),(e=>({event_label2:e.couponId,merchant_id:e.merchant}))),scanCode:function(e){var t;z("scanCode",e,l(a({},e),{redirectUrlOnCancel:null!=(t=null==e?void 0:e.redirectUrlOnCancel)?t:window.location.href}))},copyToClipboard:function(e){var t,n,o;const r=document.createElement("textarea");r.setAttribute("readonly","true"),r.setAttribute("contenteditable","true"),r.value=e.value,document.body.appendChild(r),r.select(),r.setSelectionRange(0,r.value.length);const i=document.execCommand("copy");document.body.removeChild(r),i?null==(t=null==e?void 0:e.success)||t.call(e):null==(n=null==e?void 0:e.fail)||n.call(e,{errorCode:"other"}),null==(o=e.complete)||o.call(e)},getSessionData:function(e){var t,n;const o=sessionStorage.getItem(null==e?void 0:e.key);null==(t=null==e?void 0:e.success)||t.call(e,{[null==e?void 0:e.key]:null!=o?o:""}),null==(n=null==e?void 0:e.complete)||n.call(e)},setSessionData:function(e){var t,n,o;sessionStorage.setItem(null==e?void 0:e.key,null!=(t=null==e?void 0:e.value)?t:""),null==(n=null==e?void 0:e.success)||n.call(e),null==(o=null==e?void 0:e.complete)||o.call(e)},getStorageData:function(e){var t,n;const o=localStorage.getItem(null==e?void 0:e.key);null==(t=null==e?void 0:e.success)||t.call(e,{[null==e?void 0:e.key]:null!=o?o:""}),null==(n=null==e?void 0:e.complete)||n.call(e)},setStorageData:function(e){var t,n,o;localStorage.setItem(null==e?void 0:e.key,null!=(t=null==e?void 0:e.value)?t:""),null==(n=null==e?void 0:e.success)||n.call(e),null==(o=null==e?void 0:e.complete)||o.call(e)},removeStorageData:function(e){var t,n;localStorage.removeItem(null==e?void 0:e.key),null==(t=null==e?void 0:e.success)||t.call(e),null==(n=null==e?void 0:e.complete)||n.call(e)},getKycPassportInfo:function(e){const t=window.location.href;z("getKycPassportInfo",e,l(a({},e),{url:t}))},logout:ce,getPaymentSettings:se,markAsReady:ae};return function({sdkType:e,clientFunctions:t}){Y=e;const n=e===N.MiniApp?G:Z,o=new Proxy(l(a({},t),{init:te}),{get(t,o){if(o in ie)return ie[o];const r=o;if(!n(r))throw new Error(`${r} is not supported by ${e} JS SDK`);return function(e,t){return(n={})=>new Promise(((o,r)=>{let i,s;e(l(a({},n),{success:e=>{var t;s=e,null==(t=n.success)||t.call(n,e)},fail:e=>{var o;"init"===t&&X[e.errorCode]?s={statusCode:X[e.errorCode]}:i=e,null==(o=n.fail)||o.call(n,e)},complete:()=>{var e;i?r(i):o(s),null==(e=n.complete)||e.call(n)}}))}))}((function(e){return c(this,null,(function*(){var n,i;if(!oe.includes(r)&&!(yield ee)){if(!re.includes(r)||!function(e){return void 0!==e.clientId}(e))return null==(n=e.fail)||n.call(e,{errorCode:I}),void(null==(i=e.complete)||i.call(e));te({clientId:e.clientId,env:e.env}),yield ee}const s=t[r];if(s&&"function"==typeof s)return s(e);z(o,e,e)}))}),r)}});return window._pp=o,function(e){const t=window._ppcs;if(t){window._ppcs=void 0;for(const[n,o,r]of t){const t=e[n](o);r&&r(t)}}}(o),o}({sdkType:N.MiniApp,clientFunctions:ue})}();
2
+ var pp=function(){"use strict";var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,s=(t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,i=(e,t)=>{for(var n in t||(t={}))r.call(t,n)&&s(e,n,t[n]);if(o)for(var n of o(t))a.call(t,n)&&s(e,n,t[n]);return e},l=(e,o)=>t(e,n(o)),c=(e,t,n)=>new Promise(((o,r)=>{var a=e=>{try{i(n.next(e))}catch(t){r(t)}},s=e=>{try{i(n.throw(e))}catch(t){r(t)}},i=e=>e.done?o(e.value):Promise.resolve(e.value).then(a,s);i((n=n.apply(e,t)).next())}));function d(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 u=function e(t,n){function o(e,o,r){if("undefined"!=typeof document){"number"==typeof(r=d({},n,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var s in r)r[s]&&(a+="; "+s,!0!==r[s]&&(a+="="+r[s].split(";")[0]));return document.cookie=e+"="+t.write(o,e)+a}}return Object.create({set:o,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],o={},r=0;r<n.length;r++){var a=n[r].split("="),s=a.slice(1).join("=");try{var i=decodeURIComponent(a[0]);if(o[i]=t.read(s,i),e===i)break}catch(l){}}return e?o[e]:o}},remove:function(e,t){o(e,"",d({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,d({},this.attributes,t))},withConverter:function(t){return e(d({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});const g="_PayPayJsBridge",f=["init","openWebview","openMap","closeApp","makePayment","topup","setSessionData","getSessionData","setStorageData","getStorageData","removeStorageData","getPermissionStatus","scanCode","showAlert","showErrorSheet","getTopBarHeight","setTitle","showUpdateWarning","getPlatformInformation","openApp","share","getKycInformation","getUserLocation","checkPaymentMethod","registerKyc","startMultiFactorAuth","verifyMultiFactorAuthResult","getBankInfo","logout","getUserProfile","getBalance","getUserAddress","getUAID","copyToClipboard","registerUserInfo","setEnablePullDownRefresh","registerEmail","inputAddress","getDeviceInformation","request","requestInternal","registerPaymentFeatures","initKycPassport","getKycPassportInfo","shortcutExists","addShortcut","getAllUserAddresses","getUserPaymentFeatureSettings","getPaymentSettings","getTransactionInfo","getTransactions","getPayPayCardInfo","getExternalLinkageInformation","markAsReady","renderCoupons"],m=["init","createOrder","makePayment","render","logout","getAuthStatus","getUserProfile","getBalance","getUserAddress","getUAID","getCashbackInformation","renderCoupons","getLoginUrl","renderButton"],p="2.60.0",h=new URL("https://mini-app-sdk-core.paypay.ne.jp/"),v=h.origin,y=new URL(`./iframe.html?v=${p}&rev=d7dadae`,h).href,w=new URL(`./coupon/iframe.html?v=${p}`,h).href;new URL(`./button/iframe.html?v=${p}`,h).href;const b="BAD_REQUEST_INSUFFICIENT_PARAMETER",S="UNKNOWN",I="SDK_NOT_INITIALIZED",E="TOKEN_NOT_FOUND",k="TOKEN_EXPIRED",C="AUTHORIZATION_NEEDED",P="ppjssdk.refreshToken",O="ppjssdk.codeVerifier";class _ extends Error{constructor(e,t){super(e),this.errorCode=t}}const T=Object.freeze(Object.defineProperty({__proto__:null,getCookie:function({name:e}){return u.get(e)},getLocalStorage:function({name:e}){return localStorage.getItem(e)},getSessionStorage:function({name:e}){return sessionStorage.getItem(e)},getUrl:function(){return window.location.href},insertIframe:function(e){var{containerSelector:t,attributes:n}=e,s=n,{styles:i}=s,l=((e,t)=>{var n={};for(var s in e)r.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&o)for(var s of o(e))t.indexOf(s)<0&&a.call(e,s)&&(n[s]=e[s]);return n})(s,["styles"]);return new Promise(((e,n)=>{const o=document.querySelector(t);if(!o)return void n(new _(`Container with selector "${t}" not found.`,b));const r=document.createElement("iframe");r.onload=()=>{e(!0)},r.onerror=()=>{n(new _("Failed to load iframe.","NOT_REACHABLE"))},Object.assign(r.style,i),Object.entries(l).forEach((([e,t])=>{r.setAttribute(e,t)})),o.innerHTML="",o.appendChild(r)}))},removeCookie:function({name:e,options:t}){return u.remove(e,t)},removeElement:function({selector:e}){const t=document.querySelector(e);return!!t&&(t.remove(),!0)},removeLocalStorage:function({name:e}){return localStorage.removeItem(e)},removeQueryParametersFromUrl:function(e){const t=new URL(window.location.href);e.forEach((e=>t.searchParams.delete(e)));const n=`${t.pathname}${t.search}`;history.replaceState(history.state,"",n)},removeSessionStorage:function({name:e}){return sessionStorage.removeItem(e)},setCookie:function({name:e,value:t,options:n}){return u.set(e,t,n)},setLocalStorage:function({name:e,value:t}){return localStorage.setItem(e,t)},setSessionStorage:function({name:e,value:t}){return sessionStorage.setItem(e,t)},updateElementStyle:function({selector:e,styles:t}){const n=document.querySelector(e);return!!n&&(Object.assign(n.style,t),!0)}},Symbol.toStringTag,{value:"Module"})),R="success",A="fail",L="complete";var N=(e=>(e.MiniApp="MiniApp",e.SmartPayment="SmartPayment",e))(N||{});function U(){return Math.random().toString(36).substring(7)}const D=e=>"object"!=typeof e||null===e?e:JSON.parse(JSON.stringify(e)),M=e=>{var t;const n=null==(t=e[0])?void 0:t.callbacks;return"object"==typeof n&&null!==n},x=e=>Object.keys(e).reduce(((e,t)=>(e[t]=!0,e)),{});class F{constructor(e,t,n=[],o){this.deferredPromises={},this.functions=e,this.allowedOrigins=t,this.middlewares=n,this.registeredCallbacks={},this.messageEventHandler=this.messageEventHandler.bind(this),this.errorLogger=o,this.subscribeToMessageEvent()}subscribeToMessageEvent(){window.addEventListener("message",this.messageEventHandler)}unsubscribeToMessageEvent(){window.removeEventListener("message",this.messageEventHandler)}messageEventHandler(e){var t;if(null==(t=e.data)?void 0:t.forWindowBridge)return this.allowedOrigins&&"request"===e.data.type&&!this.allowedOrigins.includes(e.origin)?this.sendErrorResponse(e,`${e.origin} is not allowed to make requests`,"ORIGIN_NOT_ALLOWED"):void("request"===e.data.type?this.handleRequest(e):"response"===e.data.type?this.handleResponse(e):"callback"===e.data.type&&this.handleCallback(e))}handleRequest(e){return c(this,null,(function*(){var t;const n=e.data.functionName,o=this.functions[n];o||this.sendErrorResponse(e,`Function '${n}' does not exists on the target window`,"FUNCTION_NOT_FOUND");const r=D(e.data.params);M(r)&&(r[0].callbacks=Object.keys(r[0].callbacks).reduce(((t,n)=>(t[n]=(...t)=>{this.invokeCallback(e,n,t)},t)),{}));try{this.sendSuccessResponse(e,yield function(e,t,n,o){let r=-1;const a=o=>c(this,null,(function*(){if(++r,r<e.length){const n=e[r];return yield n(t,o,a)}return n(...o)}));return a(o)}([...this.middlewares,...null!=(t=o.middlewares)?t:[]],e,o,r))}catch(a){let t="Some error occurred while processing the request",n=S;a instanceof _?(t=a.message,n=a.errorCode):console.error(a),this.sendErrorResponse(e,t,n)}}))}handleResponse(e){if(!this.deferredPromises[e.data.key])return void console.warn(`Promise for ${e.data.functionName} not found`);const[t,n]=this.deferredPromises[e.data.key];delete this.deferredPromises[e.data.key],"success"===e.data.status?t(e.data.result):(delete this.registeredCallbacks[e.data.key],n(new _(e.data.message,e.data.errorCode)))}handleCallback(e){var t;const{key:n,callbackName:o,args:r}=e.data,a=null==(t=this.registeredCallbacks[n])?void 0:t[o];a?a(...r):console.warn(`Callback with key ${n} and name ${o} not found.`)}sendErrorResponse(e,t,n){this.errorLogger&&this.errorLogger(e.data.functionName,t,n),this.sendResponse(e,{status:"failure",message:t,errorCode:n})}sendSuccessResponse(e,t){this.sendResponse(e,{status:"success",result:t})}sendResponse(e,t){this.sendMessage(e.source,e.origin,i({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(i({forWindowBridge:!0},D(n)),t)}sendRequest(e,t,n,o){return new Promise(((r,a)=>c(this,null,(function*(){const s=`${n}--${U()}`;try{const c=yield e();if(!c)throw new Error("Target window is undefined");let d=o[0];if(M(o)){const e=o[0].callbacks;this.addFunctionCallbacks(s,e),d=l(i({},o[0]),{callbacks:x(e)})}this.deferredPromises[s]=[r,a],this.sendMessage(c,t,{type:"request",key:s,functionName:n,params:[d]})}catch(c){delete this.deferredPromises[s],delete this.registeredCallbacks[s],a(new _(c.message,"MESSAGE_SENDING_FAILED"))}}))))}addFunctionCallbacks(e,t){Object.keys(t).forEach((e=>{if("function"!=typeof t[e])throw new Error(`Callback ${e} is not a function`)})),this.registeredCallbacks[e]=i({},t)}static init(e,t,n=[],o){if(this._instance)throw new Error("WindowBridge already initialized, you can't call WindowBridge.init more than once");return this._instance=new this(e,t,n,o),this._instance}static destroy(){this._instance&&(this._instance.unsubscribeToMessageEvent(),this._instance=void 0)}static getBridge(){if(!this._instance)throw new Error("WindowBridge not initialized, please call WindowBridge.init before calling WindowBridge.getBridge");return this._instance}static getTargetWindowFunctionProxy(e,t){return F.getBridge().getTargetWindowFunctionProxy(e,t)}getTargetWindowFunctionProxy(e,t){return new Proxy(this,{get:(n,o)=>(...r)=>n.sendRequest(e,t,o.toString(),r)})}}const $="ppmna-iframe",B="ppsdk-container";let j,W;function q(){return j||(j=function(){if(document.getElementById($))return;const e=document.createElement("div");return document.createElement("div"),e.setAttribute("id",B),e.setAttribute("class",B),e.style.all="initial",e.style.display="none",e.style.position="fixed",e.style.width="100%",e.style.height="100%",e.style.top="0",e.style.left="0",e.style.zIndex="2147483637",document.body.appendChild(e),e}()),j}function K(e){const t=q();t&&(t.style.display=e?"initial":"none")}function H(){return W||(W=new Promise(((e,t)=>{function n(){const n=document.createElement("iframe");n.setAttribute("src",y),n.setAttribute("name",$),n.setAttribute("id",$),n.setAttribute("class",$),n.setAttribute("allow","geolocation"),n.onload=()=>{e(n),n.onerror=null},n.onerror=t,n.style.all="initial",n.style.width="100%",n.style.height="100%",n.style.border="none";const o=q();o&&(o.innerHTML="",o.append(n))}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(()=>{n()})):n()}))),W}F.init(T,[v]);const J=F.getTargetWindowFunctionProxy((function(){return H().then((e=>null==e?void 0:e.contentWindow)).catch((()=>null))}),v);function z(e,t,n){const o=U(),r=n=>{V(n.origin)&&n.data.name===e&&n.data.messageId===o&&function(e,t,n){var o,r,a;e.result===A&&(null==(o=null==t?void 0:t.fail)||o.call(t,e.data)),e.result===R&&(null==(r=null==t?void 0:t.success)||r.call(t,null==e?void 0:e.data)),e.result===L&&(null==(a=null==t?void 0:t.complete)||a.call(t),removeEventListener("message",n))}(n.data,t,r)};addEventListener("message",r),function(e){c(this,null,(function*(){var t;const n=yield H().catch((()=>{}));null==(t=null==n?void 0:n.contentWindow)||t.postMessage(JSON.parse(JSON.stringify(e)),v)}))}({name:e,params:n,messageId:o})}function V(e){return e===v}function G(e){return f.includes(e)}function Z(e){return m.includes(e)}function Q(e,t,n){return function(o={}){const r=null==n?void 0:n(o);J.logEvent(i({event_action:`pp_${e}_called`,event_category_suffix:e},r));const a=t(o);return a.then((t=>{var n;J.logEvent(i({event_action:`pp_${e}_success`,event_category_suffix:e},r)),null==(n=o.success)||n.call(o,t)})).catch((t=>{var n;console.error(t.message),J.logEvent(i({event_action:`pp_${e}_fail`,event_category_suffix:e,error_value:t.errorCode},r)),null==(n=o.fail)||n.call(o,{errorCode:t.errorCode})})).finally((()=>{var e;null==(e=o.complete)||e.call(o)})),a}}const X={[I]:C,[E]:C,[k]:k};let Y,ee;H(),ee=Promise.resolve(!1);function te(e){const t=function(e,t){if(t){const t=localStorage.getItem(`${P}.${e}`);if(t)return t}return u.get(`${P}.${e}`)||u.get(P)||""}(e.clientId,e.useLocalStorage),n=function(e,t){if(t){const t=localStorage.getItem(`${O}.${e}`);if(t)return t}return u.get(`${O}.${e}`)||u.get(O)||""}(e.clientId,e.useLocalStorage),o=l(i({},e),{refreshToken:t,clientVersion:"2.60.0",codeVerifier:n,clientSdkType:Y,clientUrl:window.location.href});let r;const a=new Promise((e=>r=e)),s=()=>{var t;r(!0),null==(t=e.complete)||t.call(e)};ee.then((()=>H())).then((()=>{z("init",l(i({},e),{complete:s}),o)})).catch((()=>{var t;null==(t=e.fail)||t.call(e,{errorCode:I}),s()})),ee=a}addEventListener("message",(e=>{var t;if(!(null==(t=e.data)?void 0:t.forWindowBridge)&&V(e.origin))if("reload"===e.data.name&&window.location.reload(),"makeVisible"!==e.data.name)if("showIframe"!==e.data.name)if("hideIframe"!==e.data.name){if("link"===e.data.name){const t=e.data.data;"_blank"===t.target?window.open(t.url,"_blank"):window.location.href=t.url}if("consoleDebugInfo"===e.data.name){const{params:t}=e.data.data;!function(e){console.debug(...e)}(t)}}else K(!1);else K(!0);else K(!0)})),addEventListener("popstate",(()=>{H().then((e=>{var t;const n={name:"clientPopState"};null==(t=null==e?void 0:e.contentWindow)||t.postMessage(n,v)})).catch((e=>console.warn(e)))}));var ne;ne={_handleMessageFromNative:e=>{H().then((t=>{var n;null==(n=null==t?void 0:t.contentWindow)||n.postMessage(JSON.parse(JSON.stringify({name:"handleMessageFromNative",params:{json:e}})),v)}))}},(!window.hasOwnProperty(g)||window[g]!==ne)&&(window[g]=ne);const oe=["init","setTitle","copyToClipboard","getSessionData","setSessionData","getStorageData","setStorageData","removeStorageData","getLoginUrl"],re=["renderCoupons"];const ae={version:"2.60.0",revision:"d7dadae"};Q("getLoginUrl",J.getLoginUrl);const se=Q("getPaymentSettings",J.getPaymentSettings),ie=Q("markAsReady",J.markAsReady);Q("renderButton",J.renderButton);var le=(e=>(e.validToken="TOKEN_VALID",e.initialized="INITIALIZED",e.emailRegistered="EMAIL_REGISTERED",e.emailNotVerified="EMAIL_NOT_VERIFIED",e.success="SUCCESS",e.loggedOut="LOGGED_OUT",e.connected="CONNECTED",e))(le||{});const ce=Q("logout",(()=>c(this,null,(function*(){return yield J.logout(),{statusCode:le.loggedOut}}))));const de={verifyMultiFactorAuthResult:function(e){const t=new URL(window.location.href);z("verifyMultiFactorAuthResult",e,l(i({},e),{sessionId:t.searchParams.get("ppSessionId")}))},share:function(e){if(!(null==navigator?void 0:navigator.share))return void z("share",e,e);const t={text:null==e?void 0:e.text};navigator.share(t).then((()=>{var t,n;null==(t=null==e?void 0:e.success)||t.call(e),null==(n=null==e?void 0:e.complete)||n.call(e)})).catch((()=>{var t,n;null==(t=null==e?void 0:e.fail)||t.call(e,{errorCode:S}),null==(n=null==e?void 0:e.complete)||n.call(e)}))},setTitle:function(e){var t,n,o;document.title=null!=(t=null==e?void 0:e.title)?t:"",null==(n=null==e?void 0:e.success)||n.call(e),null==(o=null==e?void 0:e.complete)||o.call(e)},renderCoupons:Q("renderCoupons",(e=>c(this,null,(function*(){const{merchant:t,couponId:n,containerId:o,postLoginRedirectUrl:r=window.location.href,postLoginRedirectType:a,locale:s}=e,i=document.getElementById(o);if(!i)throw new _("Invalid coupon container Id",b);const l=yield J.fetchCoupons({merchantId:t,couponId:n,postLoginRedirectUrl:r,postLoginRedirectType:a});try{const e=document.createElement("iframe");e.src=w,e.style.cssText="width:100%;height: 0;border: none;transition: height 300ms ease-in;display: block;",yield new Promise(((t,n)=>{e.onload=()=>t(!0),e.onerror=()=>n(new Error("Failed to load coupon iframe")),i.innerHTML="",i.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=F.getTargetWindowFunctionProxy((()=>e.contentWindow),v);yield n.renderCoupons({coupons:l,merchantId:t,locale:s,postLoginRedirectUrl:r,postLoginRedirectType:a})}catch(c){throw new _(`An error occurred while displaying coupons, merchantId=${t}, couponId=${n}, error=${c}`,S)}}))),(e=>({event_label2:e.couponId,merchant_id:e.merchant}))),scanCode:function(e){var t;z("scanCode",e,l(i({},e),{redirectUrlOnCancel:null!=(t=null==e?void 0:e.redirectUrlOnCancel)?t:window.location.href}))},copyToClipboard:function(e){var t,n,o;const r=document.createElement("textarea");r.setAttribute("readonly","true"),r.setAttribute("contenteditable","true"),r.value=e.value,document.body.appendChild(r),r.select(),r.setSelectionRange(0,r.value.length);const a=document.execCommand("copy");document.body.removeChild(r),a?null==(t=null==e?void 0:e.success)||t.call(e):null==(n=null==e?void 0:e.fail)||n.call(e,{errorCode:"other"}),null==(o=e.complete)||o.call(e)},getSessionData:function(e){var t,n;const o=sessionStorage.getItem(null==e?void 0:e.key);null==(t=null==e?void 0:e.success)||t.call(e,{[null==e?void 0:e.key]:null!=o?o:""}),null==(n=null==e?void 0:e.complete)||n.call(e)},setSessionData:function(e){var t,n,o;sessionStorage.setItem(null==e?void 0:e.key,null!=(t=null==e?void 0:e.value)?t:""),null==(n=null==e?void 0:e.success)||n.call(e),null==(o=null==e?void 0:e.complete)||o.call(e)},getStorageData:function(e){var t,n;const o=localStorage.getItem(null==e?void 0:e.key);null==(t=null==e?void 0:e.success)||t.call(e,{[null==e?void 0:e.key]:null!=o?o:""}),null==(n=null==e?void 0:e.complete)||n.call(e)},setStorageData:function(e){var t,n,o;localStorage.setItem(null==e?void 0:e.key,null!=(t=null==e?void 0:e.value)?t:""),null==(n=null==e?void 0:e.success)||n.call(e),null==(o=null==e?void 0:e.complete)||o.call(e)},removeStorageData:function(e){var t,n;localStorage.removeItem(null==e?void 0:e.key),null==(t=null==e?void 0:e.success)||t.call(e),null==(n=null==e?void 0:e.complete)||n.call(e)},getKycPassportInfo:function(e){const t=window.location.href;z("getKycPassportInfo",e,l(i({},e),{url:t}))},logout:ce,getPaymentSettings:se,markAsReady:ie};return function({sdkType:e,clientFunctions:t}){Y=e;const n=e===N.MiniApp?G:Z,o=new Proxy(l(i({},t),{init:te}),{get(t,o){if(o in ae)return ae[o];const r=o;if(!n(r))throw new Error(`${r} is not supported by ${e} JS SDK`);return function(e,t){return(n={})=>new Promise(((o,r)=>{let a,s;e(l(i({},n),{success:e=>{var t;s=e,null==(t=n.success)||t.call(n,e)},fail:e=>{var o;"init"===t&&X[e.errorCode]?s={statusCode:X[e.errorCode]}:a=e,null==(o=n.fail)||o.call(n,e)},complete:()=>{var e;a?r(a):o(s),null==(e=n.complete)||e.call(n)}}))}))}((function(e){return c(this,null,(function*(){var n,a;if(!oe.includes(r)&&!(yield ee)){if(!re.includes(r)||!function(e){return void 0!==e.clientId}(e))return null==(n=e.fail)||n.call(e,{errorCode:I}),void(null==(a=e.complete)||a.call(e));te({clientId:e.clientId,env:e.env}),yield ee}const s=t[r];if(s&&"function"==typeof s)return s(e);z(o,e,e)}))}),r)}});return window._pp=o,function(e){const t=window._ppcs;if(t){window._ppcs=void 0;for(const[n,o,r]of t){const t=e[n](o);r&&r(t)}}}(o),o}({sdkType:N.MiniApp,clientFunctions:de})}();
@@ -221,8 +221,8 @@ const smartPaymentSupportedFunctions = [
221
221
  "getLoginUrl",
222
222
  "renderButton"
223
223
  ];
224
- const JS_SDK_VERSION = "2.58.0";
225
- const REVISION = "5c56199";
224
+ const JS_SDK_VERSION = "2.60.0";
225
+ const REVISION = "d7dadae";
226
226
  const coreBaseUrl = new URL("https://mini-app-sdk-core.paypay.ne.jp/");
227
227
  const CORE_IFRAME_ORIGIN = coreBaseUrl.origin;
228
228
  const CORE_IFRAME_URL = new URL(
@@ -1001,7 +1001,7 @@ addEventListener("popstate", () => {
1001
1001
  function init(params) {
1002
1002
  const refreshToken2 = getRefreshToken(params.clientId, params.useLocalStorage);
1003
1003
  const codeVerifier2 = getCodeVerifier(params.clientId, params.useLocalStorage);
1004
- const clientVersion = "2.58.0";
1004
+ const clientVersion = "2.60.0";
1005
1005
  const initParams = __spreadProps(__spreadValues({}, params), {
1006
1006
  refreshToken: refreshToken2,
1007
1007
  clientVersion,
@@ -1076,8 +1076,8 @@ function executePendingFunctionCalls(client2) {
1076
1076
  }
1077
1077
  }
1078
1078
  const clientProperties = {
1079
- version: "2.58.0",
1080
- revision: "5c56199"
1079
+ version: "2.60.0",
1080
+ revision: "d7dadae"
1081
1081
  };
1082
1082
  function isInitClientParams(params) {
1083
1083
  return params.clientId !== void 0;
@@ -1189,15 +1189,8 @@ var MiniAppStatusType = /* @__PURE__ */ ((MiniAppStatusType2) => {
1189
1189
  return MiniAppStatusType2;
1190
1190
  })(MiniAppStatusType || {});
1191
1191
  const logout = promiseToCallback("logout", () => __async(void 0, null, function* () {
1192
- try {
1193
- yield coreFunctions.logout();
1194
- return { statusCode: MiniAppStatusType.loggedOut };
1195
- } catch (error) {
1196
- throw new PPError(
1197
- `An error occurred while trying to logout the user, error=${error}`,
1198
- unknown
1199
- );
1200
- }
1192
+ yield coreFunctions.logout();
1193
+ return { statusCode: MiniAppStatusType.loggedOut };
1201
1194
  }));
1202
1195
  const renderCoupons = promiseToCallback(
1203
1196
  "renderCoupons",
@@ -1,2 +1,2 @@
1
1
  import { GetTransactionInfoParams } from '../../types/getTransactionInfo';
2
- export declare function getTransactionInfo(params: GetTransactionInfoParams): Promise<void>;
2
+ export declare function getTransactionInfo(params: GetTransactionInfoParams): Promise<void | undefined>;
@@ -1,2 +1,2 @@
1
1
  import { GetTransactionsParams } from '../../types/getTransactions';
2
- export declare function getTransactions(params: GetTransactionsParams): Promise<void>;
2
+ export declare function getTransactions(params: GetTransactionsParams): Promise<void | undefined>;
@@ -68,6 +68,7 @@ export declare enum MiniAppErrorType {
68
68
  merchantTimeout = "MERCHANT_TIMEOUT",
69
69
  rateLimitExceeded = "RATE_LIMIT_EXCEEDED",
70
70
  sdkUpgradeRequired = "SDK_UPGRADE_REQUIRED",
71
+ maintenanceMode = "MAINTENANCE_MODE",
71
72
  authorizationNeeded = "AUTHORIZATION_NEEDED",
72
73
  invalidVirtualAccount = "INVALID_VIRTUAL_ACCOUNT",
73
74
  notSupportedUser = "NOT_SUPPORTED_USER"
@@ -1,4 +1,7 @@
1
- import { PermissionNameType } from '../constants';
2
- import { PermissionStatus } from '../types/getPermissionStatus';
3
- export declare const checkPermission: (permissionNames: string[] | string) => Promise<PermissionStatus>;
4
- export declare function getUserGrantedPermission(): Promise<PermissionNameType[]>;
1
+ import { GrantedPermissionRespone } from '../types/getPermissionStatus';
2
+ import { PPFetchResult } from '../utils/fetch';
3
+ import { ErrorCodesType } from '../constants';
4
+ export declare const checkPermissionOrFail: (permissionNames: string[] | string, fail: ((error: {
5
+ errorCode: ErrorCodesType;
6
+ }) => void) | undefined) => Promise<boolean>;
7
+ export declare function getUserGrantedPermission(): Promise<PPFetchResult<GrantedPermissionRespone>>;
@@ -16,7 +16,7 @@ export interface GetPermissionStatusParams extends NativeParams<GetPermissionSta
16
16
  export declare type GrantedPermissionRespone = {
17
17
  unsigned?: {
18
18
  data?: {
19
- scopes?: Array<string>;
19
+ scopes?: Array<PermissionNameType>;
20
20
  };
21
21
  };
22
22
  };
@@ -192,7 +192,13 @@ export declare type VerifyKycPassportResponse = {
192
192
  data: GetKycPassportInfoResult;
193
193
  };
194
194
  };
195
- export declare function getInitKycPassport(params: InitKycPassportParams): Promise<PPFetchResult<KycTypeResponse, Record<string, unknown>>>;
195
+ export declare function getInitKycPassport(params: InitKycPassportParams): Promise<PPFetchResult<KycTypeResponse, {
196
+ unsigned: {
197
+ data: {
198
+ helpUrl?: string;
199
+ };
200
+ };
201
+ }>>;
196
202
  export declare function verifyOtp(body: VerifyOTPBody): Promise<PPFetchResult<VerifyOTPResponse, Record<string, unknown>>>;
197
203
  export declare function editAddress(body: NewAddress, id: number): Promise<PPFetchResult<GetAddressListResponse, Record<string, unknown>>>;
198
204
  export declare function deleteAddress(id: number): Promise<PPFetchResult<GetAddressListResponse, Record<string, unknown>>>;
@@ -34,7 +34,6 @@ declare type APIBaseResponse = {
34
34
  resultCode?: string;
35
35
  };
36
36
  error?: unknown;
37
- helpUrl?: string;
38
37
  };
39
38
  };
40
39
  uiComponents?: {
@@ -57,7 +56,7 @@ export declare type PPFetchResult<T, E = Record<string, unknown>> = {
57
56
  statusCode: number;
58
57
  body: T;
59
58
  } | {
60
- ppFetchResult: 'apiError' | 'rateLimitExceeded';
59
+ ppFetchResult: 'apiError' | 'rateLimitExceeded' | 'maintenance';
61
60
  errorCode: ErrorCodesType;
62
61
  statusCode: number;
63
62
  body: APIBaseResponse & E;
@@ -80,5 +79,8 @@ export declare type PPFetchResult<T, E = Record<string, unknown>> = {
80
79
  body?: null;
81
80
  };
82
81
  export declare function ppFetch<T, E = Record<string, unknown>>(options: PPFetchOptions): Promise<PPFetchResult<T, E>>;
83
- export declare function fetchRefreshToken(refreshToken: string, clientOrigin?: string): Promise<boolean>;
82
+ export declare function fetchRefreshToken(refreshToken: string, clientOrigin?: string): Promise<{
83
+ success: boolean;
84
+ errorCode?: ErrorCodesType;
85
+ }>;
84
86
  export { createHeaderMiniAppApi };
@@ -4,6 +4,7 @@ import { ErrorSheetButton, PaymentLabelType, SmartPayParams } from '../types';
4
4
  import { FontSize } from '../types/getPlatformInformation';
5
5
  import { InitParams } from '../types/init';
6
6
  import { BankInfo, CreditCardInfo, InfoBanner, MakePaymentParams, OrderType, PayLaterCCInfo, PaymentMethod, SbidBankInfo } from '../types/makePayment';
7
+ import { PPFetchResult } from './fetch';
7
8
  export declare function isDef<T>(val: T): val is NonNullable<T>;
8
9
  export declare function isNumeric(val: string | number): val is string;
9
10
  export declare function formatNumber(value: string, options?: {
@@ -63,7 +64,7 @@ export declare function hasOmittedPrimaryButton(params: {
63
64
  filteredButtonList: UIComponentsErrorButton[] | undefined;
64
65
  }): boolean;
65
66
  export declare function checkPrimaryButtonNotPresent(buttonList: UIComponentsErrorButton[] | undefined): boolean;
66
- export declare function getFailErrorCode(ppFetchResult: string): "TIME_OUT" | "SERVER_ERROR" | "TOKEN_EXPIRED" | "NOT_AUTHORIZED" | "RATE_LIMIT_EXCEEDED";
67
+ export declare function getFailErrorCode(ppFetchResult: Exclude<PPFetchResult<unknown>['ppFetchResult'], 'success'>): "TIME_OUT" | "SERVER_ERROR" | "TOKEN_EXPIRED" | "NOT_AUTHORIZED" | "RATE_LIMIT_EXCEEDED" | "MAINTENANCE_MODE";
67
68
  export declare function getStoreUrl(): "https://play.google.com/store/apps/details?id=jp.ne.paypay.android.app" | "https://itunes.apple.com/app/id1435783608";
68
69
  export declare function generateCodeVerifier(length?: number): string;
69
70
  export declare function generateCodeChallenge(codeVerifier: string): Promise<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paypay/mini-app-js-sdk",
3
- "version": "2.58.0",
3
+ "version": "2.60.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "build": "yarn build:client && yarn build:core",