@paypay/mini-app-js-sdk 2.11.0 → 2.14.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.
@@ -16,8 +16,4 @@ export declare function isSupportedSmartpayment(functionName: string): boolean;
16
16
  export declare function isFunctionRunning(): boolean;
17
17
  export declare function functionEnd(messageId: string): void;
18
18
  export declare function functionStart(): string;
19
- export declare class ClientError<T extends MiniAppErrorResultType = MiniAppErrorResultType> extends Error {
20
- payload: T;
21
- constructor(message: string, payload: T);
22
- }
23
19
  export declare function promiseToCallback<S, E extends MiniAppErrorResultType = MiniAppErrorResultType, P extends NativeParams<S, E> = NativeParams<S, E>>(functionName: string, target: (params: P) => Promise<S>, getCore: () => CoreFunctions, getLoggingParams?: (params: P) => Partial<Parameters<CoreFunctions['logEvent']>[0]>): (params: P) => void;
@@ -41,5 +41,5 @@ declare const clientFunctions: {
41
41
  }, import('../types').MiniAppErrorResultType>) => void;
42
42
  };
43
43
  declare type ClientSDKType = Omit<MiniAppModule, keyof typeof clientFunctions> & typeof clientFunctions;
44
- declare const _default: ClientSDKType;
45
- export default _default;
44
+ declare const client: ClientSDKType;
45
+ export default client;
@@ -1,5 +1,5 @@
1
1
  import proxy from '../client/index';
2
2
  import { miniAppSupportedFunctions } from '../client/supportedFunctionsList';
3
- declare type MiniAppSdkType = Pick<typeof proxy, (typeof miniAppSupportedFunctions)[number]>;
4
- declare const _default: MiniAppSdkType;
5
- export default _default;
3
+ export declare type MiniAppSdkType = Pick<typeof proxy, (typeof miniAppSupportedFunctions)[number]>;
4
+ declare const miniAppSdk: MiniAppSdkType;
5
+ export default miniAppSdk;
@@ -2,3 +2,4 @@ export declare const JS_SDK_VERSION: string;
2
2
  export declare const CORE_IFRAME_ORIGIN: string;
3
3
  export declare const CORE_IFRAME_URL: string;
4
4
  export declare const COUPON_IFRAME_URL: string;
5
+ export declare const REMOTE_STRINGS_URL: string;
@@ -1,2 +1,2 @@
1
- (function(){"use strict";try{if(typeof document!="undefined"){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;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{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:#ff0033}.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";function e(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 t=function t(n,o){function r(t,r,a){if("undefined"!=typeof document){"number"==typeof(a=e({},o,a)).expires&&(a.expires=new Date(Date.now()+864e5*a.expires)),a.expires&&(a.expires=a.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var i="";for(var s in a)a[s]&&(i+="; "+s,!0!==a[s]&&(i+="="+a[s].split(";")[0]));return document.cookie=t+"="+n.write(r,t)+i}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var t=document.cookie?document.cookie.split("; "):[],o={},r=0;r<t.length;r++){var a=t[r].split("="),i=a.slice(1).join("=");try{var s=decodeURIComponent(a[0]);if(o[s]=n.read(i,s),e===s)break}catch(c){}}return e?o[e]:o}},remove:function(t,n){r(t,"",e({},n,{expires:-1}))},withAttributes:function(n){return t(this.converter,e({},this.attributes,n))},withConverter:function(n){return t(e({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(n)}})}({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:"/"}),n=(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))(n||{});const o={success:"success",fail:"fail",complete:"complete"},r={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",setTitle:"setTitle",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",openMiniApp:"openMiniApp",inputAddress:"inputAddress",checkAccessToken:"checkAccessToken",getCashbackInformation:"getCashbackInformation",request:"request",getDeviceInformation:"getDeviceInformation",debug:"debug",copyToClipboard:"copyToClipboard",createOrder:"createOrder",handleMessageFromNative:"handleMessageFromNative",initKycPassport:"initKycPassport",smsAuth:"smsAuth",getKycPassportInfo:"getKycPassportInfo",renderCoupons:"renderCoupons"},a="reload",i="link",s="saveRefreshToken",c="saveCodeVerifier",l="makeVisible",d="consoleDebugInfo",u="_PayPayJsBridge",p=["init","openWebview","openMap","closeApp","makePayment","topup","setSessionData","getSessionData","setStorageData","getStorageData","removeStorageData","getPermissionStatus","scanCode","showAlert","showErrorSheet","getTopBarHeight","setTitle","showUpdateWarning","getPlatformInformation","openApp","share","getKycInformation","getUserLocation","checkPaymentMethod","registerKyc","startMultiFactorAuth","verifyMultiFactorAuthResult","getBankInfo","logout","getUserProfile","getBalance","getUserAddress","getUAID","copyToClipboard","registerUserInfo","setEnablePullDownRefresh","registerEmail","checkAccessToken","debug","inputAddress","getDeviceInformation","openMiniApp","request","requestInternal","registerPaymentFeatures","initKycPassport","getKycPassportInfo","shortcutExists","addShortcut","logAppsFlyerEvent","getAllUserAddresses","getUserPaymentFeatureSettings"];function m(e){return"https://image.paypay.ne.jp/miniapps/mini-app-sdk/"+e}const g=m("icon-paypay-rec.svg"),f=m("icon-paypay-rec-white.svg");!function(){try{return localStorage.getItem("ppjssdk.canWriteToLocalStorage"),!0}catch(e){return console.log(e),!1}}();var h=(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))(h||{});const v=["ab.ca","ac.ac","ac.ae","ac.at","ac.be","ac.cn","ac.il","ac.in","ac.jp","ac.kr","ac.th","ac.uk","ac.sg","ad.jp","adm.br","adv.br","ah.cn","am.br","arq.br","art.br","arts.ro","asn.au","asso.fr","asso.mc","bc.ca","bio.br","biz.pl","biz.tr","bj.cn","bel.tr","br.com","cn.com","cng.br","cnt.br","co.ac","co.at","co.de","co.gl","co.hk","co.id","co.il","co.in","co.jp","co.kr","co.mg","co.ms","co.nz","co.th","cp.tz","co.uk","co.ve","co.vi","co.za","com.ag","com.ai","com.ar","com.au","com.br","com.co","com.cn","com.cy","com.de","com.do","com.ec","com.es","com.fj","com.fr","com.gl","com.gt","com.hk","com.hr","com.hu","com.kg","com.ki","com.lc","com.mg","com.mm","com.ms","com.mt","com.mu","com.mx","com.my","com.na","com.nf","com.ng","com.ni","com.pa","com.ph","com.pl","com.pt","com.qa","com.ro","com.ru","com.sb","com.sc","com.sg","com.sv","com.tr","com.tw","com.ua","com.uy","com.ve","com.vn","cq.cn","de.com","de.org","ecn.br","ed.jp","edu.au","edu.cn","edu.hk","edu.mm","edu.my","edu.pl","edu.pt","edu.qa","edu.sg","edu.tr","edu.tw","eng.br","ernet.in","esp.br","etc.br","eti.br","eu.com","eu.int","eu.lv","firm.in","firm.ro","fm.br","fot.br","fst.br","g12.br","gb.com","gb.net","gd.cn","gen.in","go.jp","go.kr","go.th","gov.au","gov.az","gov.br","gov.cn","gov.il","gov.in","gov.mm","gov.my","gov.qa","gov.sg","gov.tr","gov.tw","gov.uk","govt.nz","gr.jp","gs.cn","gv.ac","gv.at","gx.cn","gz.cn","he.cn","hi.cn","hk.cn","hl.cn","hu.com","id.au","idv.tw","in.ua","in.th","ind.br","ind.in","inf.br","info.pl","info.ro","info.tr","info.ve","iwi.nz","jl.cn","jor.br","js.cn","jus.br","k12.il","k12.tr","kr.com","lel.br","lg.jp","ln.cn","ltd.uk","mb.ca","me.uk","med.br","mi.th","mil.br","mil.uk","mo.cn","mod.uk","muni.il","nb.ca","ne.jp","ne.kr","net.ag","net.ai","net.au","net.br","net.cn","net.do","net.gl","net.hk","net.il","net.in","net.kg","net.ki","net.lc","net.mg","net.mm","net.mu","net.ni","net.nz","net.pl","net.ru","net.sb","net.sc","net.sg","net.th","net.tr","net.tw","net.uk","net.ve","nf.ca","nhs.uk","nm.cn","nm.kr","no.com","nom.br","nom.ni","nom.ro","ns.ca","nt.ca","nt.ro","ntr.br","nx.cn","odo.br","off.ai","on.ca","or.ac","or.at","or.jp","or.kr","or.th","org.ag","org.ai","org.au","org.br","org.cn","org.do","org.es","org.gl","org.hk","org.in","org.kg","org.ki","org.lc","org.mg","org.mm","org.ms","org.nf","org.ng","org.ni","org.nz","org.pl","org.ro","org.ru","org.sb","org.sc","org.sg","org.tr","org.tw","org.uk","org.ve","pe.ca","plc.uk","ppg.br","pro.br","psc.br","psi.br","qc.ca","qc.com","qh.cn","rec.br","rec.ro","res.in","sa.com","sc.cn","sch.uk","se.com","se.net","sh.cn","sk.ca","slg.br","sn.cn","store.ro","tj.cn","tm.fr","tm.mc","tm.ro","tmp.br","tur.br","tv.br","tv.tr","tw.cn","uk.com","uk.net","us.com","uy.com","vet.br","waw.pl","web.ve","www.ro","xj.cn","xz.cn","yk.ca","yn.cn","zj.cn","zlg.br"];function I(e,t){return e?function(e){const t=e.split(".");if(function(e){return/(^\s*(((\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]))\s*$)/.test(e)}(n=e)||function(e){return/(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$)/.test(e)}(n)||t.length<=2)return e;var n;const o=t.slice(t.length-2).join(".");return v.includes(o)&&t.length>=3?t.slice(t.length-3).join("."):t.slice(t.length-2).join(".")}(t):t}function E(){return Math.random().toString(36).substring(7)}const A="2.11.0",y=new URL("https://mini-app-sdk-core.paypay.ne.jp/"),w=y.origin,k=new URL(`./iframe.html?v=${A}`,y).href,T=new URL(`./coupon/iframe.html?v=${A}`,y).href;function b(e){return e===w}function _(e){return e?String(e):""}function S(e,n){t.remove(e),t.remove(e,{domain:n})}let C=[];function N(e){C=C.filter((t=>t!==e))}function D(){const e=E();return C.push(e),e}class P extends Error{constructor(e,t){super(e),this.payload=t}}function O(e,t,n,o){return function(r={}){const a=n(),i=null==o?void 0:o(r);a.logEvent({event_action:`pp_${e}_called`,...i}),t(r).then((t=>{var n;a.logEvent({event_action:`pp_${e}_success`,...i}),null==(n=r.success)||n.call(r,t)})).catch((t=>{var n;console.error(t.message),a.logEvent({event_action:`pp_${e}_fail`,error_value:t.payload.errorCode,...i}),null==(n=r.fail)||n.call(r,t.payload)})).finally((()=>{var e;null==(e=r.complete)||e.call(r)}))}}class R{constructor(e,t){this.deferredCallbacks={},this.functions=e,this.allowedOrigins=t,this.subscribeToMessageEvent()}subscribeToMessageEvent(){window.addEventListener("message",(e=>{var t;if(null==(t=e.data)?void 0:t.forWindowBridge)return this.allowedOrigins&&!this.allowedOrigins.includes(e.origin)?this.sendErrorResponse(e,"originNotAllowed",`${e.origin} is not allowed to make requests`):void("request"===e.data.type?this.handleRequest(e):"response"===e.data.type&&this.handleResponse(e))}))}async handleRequest(e){const t=this.functions[e.data.functionName];t||this.sendErrorResponse(e,"functionNotFound");try{this.sendSuccessResponse(e,await t(...e.data.params))}catch(n){this.sendErrorResponse(e,"runTimeError",n.message)}}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({code:e.data.code,message:e.data.message})}sendErrorResponse(e,t,n){this.sendResponse(e,{status:"failure",code:t,message:n})}sendSuccessResponse(e,t){this.sendResponse(e,{status:"success",result:t})}sendResponse(e,t){var n;null==(n=e.source)||n.postMessage({forWindowBridge:!0,type:"response",key:e.data.key,functionName:e.data.functionName,...t},e.origin)}static init(e,t){if(this._instance)throw new Error("WindowBridge already initialized, you can't call WindowBridge.init twice");return this._instance=new this(e,t),this._instance}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 R.getBridge().getTargetWindowFunctionProxy(e,t)}getTargetWindowFunctionProxy(e,t){return new Proxy(this,{get:(n,o)=>(...r)=>new Promise((async(a,i)=>{const s=o.toString(),c=`${s}--${E()}`;try{const o=await e();if(!o)throw new Error("Target window is undefined");o.postMessage({forWindowBridge:!0,type:"request",functionName:s,key:c,params:r},t),n.deferredCallbacks[c]=[a,i]}catch(l){i({code:"messageSendingFailed",message:l.message})}}))})}}var U=(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))(U||{});const L="ppmna-iframe",F="ppsdk-container";let M,j;function B(){return M||(M=function(){const e=document.createElement("div");return document.createElement("div"),e.setAttribute("id",F),e.setAttribute("class",F),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}()),M}function x(e){B().style.display=e?"initial":"none"}function V(){return j||(j=new Promise(((e,t)=>{const n=document.createElement("iframe");n.setAttribute("src",k),n.setAttribute("name",L),n.setAttribute("id",L),n.setAttribute("class",L),n.setAttribute("allow","geolocation"),n.onload=()=>{e(n)},n.onerror=t,n.style.all="initial",n.style.width="100%",n.style.height="100%",n.style.border="none";const o=B();o.innerHTML="",o.append(n)}))),j}const W=R.init({});let $,K=!1;"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(()=>{V()})):V();const q=W.getTargetWindowFunctionProxy((function(){return V().then((e=>null==e?void 0:e.contentWindow)).catch((()=>null))}),w);function z(){return q}function H(e){const o=new URL(window.location.href),a=o.searchParams.get("token"),i=o.searchParams.get("one_time_token"),s=t.get(n.refreshToken)||"",c=t.get(n.codeVerifier)||"";K=!!e.useAllFunctions,(a||i)&&function(e){e.searchParams.delete("token"),e.searchParams.delete("one_time_token"),e.search=e.searchParams.toString();const t=e.toString().replace(e.origin,"");history.replaceState(null,"",t)}(o);const l={env:e.env,mode:e.mode,debugMode:e.debugMode,clientId:e.clientId,token:a,ott:i,refreshToken:s,clientVersion:"2.11.0",codeVerifier:c};let d;$=new Promise((e=>d=e));const u=()=>{var t;d(!0),null==(t=e.complete)||t.call(e)};V().then((()=>{Z(r.init,!1,{...e,complete:u},l)})).catch((()=>{var t;null==(t=e.fail)||t.call(e,{errorCode:h.sdkNotInitialized}),u()}))}addEventListener("message",(e=>{var o;if(!(null==(o=e.data)?void 0:o.forWindowBridge)&&b(e.origin))if(e.data.name===a&&window.location.reload(),e.data.name!==l){if(e.data.name===i){const t=e.data.data;"_blank"===t.target?window.open(t.url,"_blank"):window.location.href=t.url}if(e.data.name===s){const{refreshToken:o,domain:r,isSecure:a}=e.data.data;!function(e,o,r){S(n.refreshToken,o),t.set(n.refreshToken,e,{domain:o,expires:90,secure:r})}(o,r,a)}if(e.data.name===c){const{codeVerifier:o,domain:r,isSecure:a}=e.data.data;!function(e,o,r){S(n.codeVerifier,o),t.set(n.codeVerifier,e,{domain:o,secure:r})}(o,r,a)}if(e.data.name===d){const{params:t}=e.data.data;!function(e){console.debug(...e)}(t)}}else x(!0)}));const Y=O("renderCoupons",(async e=>{const{merchant:t,couponId:n,containerId:o,postLoginRedirectUrl:r=window.location.href,postLoginRedirectType:a,locale:i}=e,s=document.getElementById(o);if(!s)throw new P("Invalid coupon container Id",{errorCode:h.badRequestInsufficientParameter});const c=await q.fetchCoupons({merchantId:t,couponId:n,postLoginRedirectUrl:r,postLoginRedirectType:a}).catch((()=>{throw new P(`An error occurred while fetching coupons, merchantId=${t} and couponId=${n}`,{errorCode:h.unknown})}));if(0===c.length)throw new P(`No coupon found for merchantId=${t} and couponId=${n}`,{errorCode:h.notAvailable});const l=c[0],d=(new Date).getTime();if(new Date(l.liveStartDate).getTime()>d)throw new P("Coupon is not live yet",{errorCode:h.invalidData});if(new Date(l.liveEndDate).getTime()<d)throw new P("Coupon has expired",{errorCode:h.invalidData});if("SCHEDULED"!==l.status)throw new P(`Coupon status is ${l.status} that is not valid`,{errorCode:h.invalidData});try{const e=document.createElement("iframe");e.src=T,e.style.cssText="width:100%;height: 0;border: none;transition: height 300ms ease-in;display: block;",await new Promise(((t,n)=>{e.onload=()=>t(!0),e.onerror=()=>n(!1),s.innerHTML="",s.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=W.getTargetWindowFunctionProxy((()=>e.contentWindow),w);await n.renderCoupons({coupons:c,merchantId:t,locale:i})}catch(u){throw new P(`An error ocurred while displaying coupons, merchantId=${t}, couponId=${n}, error=${u}`,{errorCode:h.unknown})}}),z,(e=>({event_label_suffix:e.merchant,event_label2:e.couponId})));const J=O("logout",(async()=>{try{const e=I(await q.logout(),window.location.hostname);return S(n.refreshToken,e),S(n.codeVerifier,e),{statusCode:U.loggedOut}}catch(e){throw new P(`An error ocurred while trying to logout the user, error=${e}`,{errorCode:h.unknown})}}),z);function G(e,t,n){var r,a,i;e.result===o.fail&&(null==(r=null==t?void 0:t.fail)||r.call(t,e.data)),e.result===o.success&&(null==(a=null==t?void 0:t.success)||a.call(t,null==e?void 0:e.data)),e.result===o.complete&&(null==(i=null==t?void 0:t.complete)||i.call(t),removeEventListener("message",n),N(e.messageId),C.length>0||x(!1))}async function Q(e){var t;const n=await V().catch((()=>{}));null==(t=null==n?void 0:n.contentWindow)||t.postMessage(JSON.parse(JSON.stringify(e)),w)}function Z(e,t,n,o){const r=D();t&&x(!0);const a=t=>{b(t.origin)&&t.data.name===e&&t.data.messageId===r&&G(t.data,n,a)};addEventListener("message",a),Q({name:e,params:o,messageId:r})}!function(e){const t=window;(!t.hasOwnProperty(u)||t[u]!==e)&&(t[u]=e)}({_handleMessageFromNative:e=>{V().then((t=>{var n;null==(n=null==t?void 0:t.contentWindow)||n.postMessage(JSON.parse(JSON.stringify({name:r.handleMessageFromNative,params:{json:e}})),w)}))}});const X=["init","setTitle","copyToClipboard","getSessionData","setSessionData","getStorageData","setStorageData","removeStorageData"],ee=["renderCoupons"],te=new Proxy({init:H,verifyMultiFactorAuthResult:function(e){const t=new URL(window.location.href);Z(r.verifyMultiFactorAuthResult,!1,e,{...e,sessionId:t.searchParams.get("ppSessionId")})},share:function(e){if(!(null==navigator?void 0:navigator.share))return void Z(r.share,!1,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:h.unknown}),null==(n=null==e?void 0:e.complete)||n.call(e)}))},setTitle:function(e){var t,n;document.title=(null==e?void 0:e.title)||"",null==(t=null==e?void 0:e.success)||t.call(e),null==(n=null==e?void 0:e.complete)||n.call(e)},render:function(e){var t;if(!(null==e?void 0:e.containerId)||!document.getElementById(null==e?void 0:e.containerId))return null==(t=null==e?void 0:e.fail)||t.call(e,{errorCode:h.badRequestInsufficientParameter}),console.error("Invalid container Id");const n=D(),a=t=>{var i,s;if(!b(t.origin)||t.data.name!==r.render||t.data.messageId!==n)return;const c=null==(i=t.data)?void 0:i.data,l=null==(s=t.data)?void 0:s.data;t.data.result===o.success&&(!function(e,t){var n,o,a,i,s;const c=document.getElementById(t.containerId),l=document.createElement("button");l.className="ppmna-reset-css pp-smartButtonWrapper pp-button";const d=function(e){return"red"===e?f:g}(null==t?void 0:t.theme),u=(null==(o=null==(n=null==e?void 0:e.data)?void 0:n.cashbackInfo)?void 0:o.length)?"pp-cashback":"",p=t.isShortText?"pp-shortText":"",m=(null==t?void 0:t.buttonSize)??"lg",h=(null==t?void 0:t.theme)??"light",v=document.createElement("a");v.className=`pp-smartBtn pp-${h} pp-${m} pp-${_(t.type)} pp-${e.preferredLanguage} ${u} ${p}`,v.href=_(e.data.loginUrl);const I=document.createElement("span");I.className="pp-leftSection";const E=document.createElement("img");E.className="pp-img",E.src=d,E.alt="",I.appendChild(E);const A=document.createElement("span");A.className="pp-btnContent";const y=document.createElement("span");y.className="pp-title",y.innerText=null==(a=null==e?void 0:e.data)?void 0:a.title,A.appendChild(y),I.appendChild(A),v.append(I);const w=document.createElement("span");(null==(i=null==e?void 0:e.data)?void 0:i.cashbackInfo)&&(w.className="pp-cashbackInfo",w.innerText=null==(s=null==e?void 0:e.data)?void 0:s.cashbackInfo,A.append(w));if(e.data.avatarUrl){const t=document.createElement("img");t.className="pp-userProfile",t.src=e.data.avatarUrl,t.addEventListener("error",(function(e){var t;const n=e.target;null==(t=null==n?void 0:n.parentNode)||t.removeChild(n)})),v.append(t)}l.append(v),c&&(c.innerHTML="",c.appendChild(l),"pay"===t.type&&(null==e?void 0:e.isLoggedIn)&&l.addEventListener("click",(e=>{var n;e.preventDefault(),(null==t?void 0:t.callback)?null==(n=null==t?void 0:t.callback)||n.call(t):t.orderInfo&&Z(r.makePayment,!0,t,{...t.orderInfo})})))}(l,e),"pay"===c.type&&(null==l?void 0:l.isJustLoggedIn)&&e.autoInvoke&&(null==l?void 0:l.isLoggedIn)&&Z(r.makePayment,!0,e,{...e.orderInfo})),t.data.result===o.complete&&(N(t.data.messageId),removeEventListener("message",a))};addEventListener("message",a),Q({name:r.render,params:{...e,redirectUrl:e.redirectUrl||window.location.href},messageId:n})},renderCoupons:Y,scanCode:function(e){const t={...e,redirectUrlOnCancel:(null==e?void 0:e.redirectUrlOnCancel)??window.location.href};Z(r.scanCode,!1,e,t)},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:h.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]:o??""}),null==(n=null==e?void 0:e.complete)||n.call(e)},setSessionData:function(e){var t,n;sessionStorage.setItem(null==e?void 0:e.key,(null==e?void 0:e.value)??""),null==(t=null==e?void 0:e.success)||t.call(e),null==(n=null==e?void 0:e.complete)||n.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]:o??""}),null==(n=null==e?void 0:e.complete)||n.call(e)},setStorageData:function(e){var t,n;localStorage.setItem(null==e?void 0:e.key,(null==e?void 0:e.value)??""),null==(t=null==e?void 0:e.success)||t.call(e),null==(n=null==e?void 0:e.complete)||n.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=new URL(window.location.href);Z(r.getKycPassportInfo,!1,e,{...e,url:t})},getAuthStatus:function(e){const t=window.location.href;Z(r.getAuthStatus,!1,e,{...e,url:t})},logout:J},{get(e,t){const n=t;if(!K&&!function(e){return p.includes(e)}(n))throw new Error(`${n} is not supported by Mini Apps JS SDK`);return async o=>{var r,a;if(!X.includes(n)&&!(await $)){if(!ee.includes(n)||!o.clientId)return null==(r=o.fail)||r.call(o,{errorCode:h.sdkNotInitialized}),void(null==(a=o.complete)||a.call(o));H({clientId:o.clientId,env:o.env}),await $}if(Object.prototype.hasOwnProperty.call(e,n))return e[n](o);Z(t,!1,o,o)}}});return function(){const e=window._ppcs;if(e){window._ppcs=void 0;for(const[t,n]of e)te[t](n)}}(),te}();
1
+ (function(){"use strict";try{if(typeof document!="undefined"){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:#ff0033}.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,a=Object.prototype.propertyIsEnumerable,i=(t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,s=(e,t)=>{for(var n in t||(t={}))r.call(t,n)&&i(e,n,t[n]);if(o)for(var n of o(t))a.call(t,n)&&i(e,n,t[n]);return e},c=(e,o)=>t(e,n(o)),l=(e,t,n)=>new Promise(((o,r)=>{var a=e=>{try{s(n.next(e))}catch(t){r(t)}},i=e=>{try{s(n.throw(e))}catch(t){r(t)}},s=e=>e.done?o(e.value):Promise.resolve(e.value).then(a,i);s((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 i in r)r[i]&&(a+="; "+i,!0!==r[i]&&(a+="="+r[i].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("="),i=a.slice(1).join("=");try{var s=decodeURIComponent(a[0]);if(o[s]=t.read(i,s),e===s)break}catch(c){}}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:"/"}),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))(p||{});const m={success:"success",fail:"fail",complete:"complete"},g={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",setTitle:"setTitle",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",openMiniApp:"openMiniApp",inputAddress:"inputAddress",checkAccessToken:"checkAccessToken",getCashbackInformation:"getCashbackInformation",request:"request",getDeviceInformation:"getDeviceInformation",debug:"debug",copyToClipboard:"copyToClipboard",createOrder:"createOrder",handleMessageFromNative:"handleMessageFromNative",initKycPassport:"initKycPassport",smsAuth:"smsAuth",getKycPassportInfo:"getKycPassportInfo",renderCoupons:"renderCoupons"},f="reload",h="link",v="saveRefreshToken",I="saveCodeVerifier",E="makeVisible",A="consoleDebugInfo",y="_PayPayJsBridge",b=["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","logAppsFlyerEvent","getAllUserAddresses","getUserPaymentFeatureSettings"];function _(e){return"https://image.paypay.ne.jp/miniapps/mini-app-sdk/"+e}const k=_("icon-paypay-rec.svg"),w=_("icon-paypay-rec-white.svg");!function(){try{return localStorage.getItem("ppjssdk.canWriteToLocalStorage"),!0}catch(e){return console.log(e),!1}}();var T=(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))(T||{});const N=["ab.ca","ac.ac","ac.ae","ac.at","ac.be","ac.cn","ac.il","ac.in","ac.jp","ac.kr","ac.th","ac.uk","ac.sg","ad.jp","adm.br","adv.br","ah.cn","am.br","arq.br","art.br","arts.ro","asn.au","asso.fr","asso.mc","bc.ca","bio.br","biz.pl","biz.tr","bj.cn","bel.tr","br.com","cn.com","cng.br","cnt.br","co.ac","co.at","co.de","co.gl","co.hk","co.id","co.il","co.in","co.jp","co.kr","co.mg","co.ms","co.nz","co.th","cp.tz","co.uk","co.ve","co.vi","co.za","com.ag","com.ai","com.ar","com.au","com.br","com.co","com.cn","com.cy","com.de","com.do","com.ec","com.es","com.fj","com.fr","com.gl","com.gt","com.hk","com.hr","com.hu","com.kg","com.ki","com.lc","com.mg","com.mm","com.ms","com.mt","com.mu","com.mx","com.my","com.na","com.nf","com.ng","com.ni","com.pa","com.ph","com.pl","com.pt","com.qa","com.ro","com.ru","com.sb","com.sc","com.sg","com.sv","com.tr","com.tw","com.ua","com.uy","com.ve","com.vn","cq.cn","de.com","de.org","ecn.br","ed.jp","edu.au","edu.cn","edu.hk","edu.mm","edu.my","edu.pl","edu.pt","edu.qa","edu.sg","edu.tr","edu.tw","eng.br","ernet.in","esp.br","etc.br","eti.br","eu.com","eu.int","eu.lv","firm.in","firm.ro","fm.br","fot.br","fst.br","g12.br","gb.com","gb.net","gd.cn","gen.in","go.jp","go.kr","go.th","gov.au","gov.az","gov.br","gov.cn","gov.il","gov.in","gov.mm","gov.my","gov.qa","gov.sg","gov.tr","gov.tw","gov.uk","govt.nz","gr.jp","gs.cn","gv.ac","gv.at","gx.cn","gz.cn","he.cn","hi.cn","hk.cn","hl.cn","hu.com","id.au","idv.tw","in.ua","in.th","ind.br","ind.in","inf.br","info.pl","info.ro","info.tr","info.ve","iwi.nz","jl.cn","jor.br","js.cn","jus.br","k12.il","k12.tr","kr.com","lel.br","lg.jp","ln.cn","ltd.uk","mb.ca","me.uk","med.br","mi.th","mil.br","mil.uk","mo.cn","mod.uk","muni.il","nb.ca","ne.jp","ne.kr","net.ag","net.ai","net.au","net.br","net.cn","net.do","net.gl","net.hk","net.il","net.in","net.kg","net.ki","net.lc","net.mg","net.mm","net.mu","net.ni","net.nz","net.pl","net.ru","net.sb","net.sc","net.sg","net.th","net.tr","net.tw","net.uk","net.ve","nf.ca","nhs.uk","nm.cn","nm.kr","no.com","nom.br","nom.ni","nom.ro","ns.ca","nt.ca","nt.ro","ntr.br","nx.cn","odo.br","off.ai","on.ca","or.ac","or.at","or.jp","or.kr","or.th","org.ag","org.ai","org.au","org.br","org.cn","org.do","org.es","org.gl","org.hk","org.in","org.kg","org.ki","org.lc","org.mg","org.mm","org.ms","org.nf","org.ng","org.ni","org.nz","org.pl","org.ro","org.ru","org.sb","org.sc","org.sg","org.tr","org.tw","org.uk","org.ve","pe.ca","plc.uk","ppg.br","pro.br","psc.br","psi.br","qc.ca","qc.com","qh.cn","rec.br","rec.ro","res.in","sa.com","sc.cn","sch.uk","se.com","se.net","sh.cn","sk.ca","slg.br","sn.cn","store.ro","tj.cn","tm.fr","tm.mc","tm.ro","tmp.br","tur.br","tv.br","tv.tr","tw.cn","uk.com","uk.net","us.com","uy.com","vet.br","waw.pl","web.ve","www.ro","xj.cn","xz.cn","yk.ca","yn.cn","zj.cn","zlg.br"];function S(e,t){return e?function(e){const t=e.split(".");if(function(e){return/(^\s*(((\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]))\s*$)/.test(e)}(n=e)||function(e){return/(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$)/.test(e)}(n)||t.length<=2)return e;var n;const o=t.slice(t.length-2).join(".");return N.includes(o)&&t.length>=3?t.slice(t.length-3).join("."):t.slice(t.length-2).join(".")}(t):t}function C(){return Math.random().toString(36).substring(7)}const O="2.14.0",P=new URL("https://mini-app-sdk-core.paypay.ne.jp/"),D=P.origin,R=new URL(`./iframe.html?v=${O}&rev=66ade73`,P).href,U=new URL(`./coupon/iframe.html?v=${O}`,P).href;function L(e){return e===D}function F(e){return e?String(e):""}function M(e,t){u.remove(e),u.remove(e,{domain:t})}let j=[];function B(e){j=j.filter((t=>t!==e))}function x(){const e=C();return j.push(e),e}function V(e,t,n,o){return function(r={}){const a=n(),i=null==o?void 0:o(r);a.logEvent(s({event_action:`pp_${e}_called`},i)),t(r).then((t=>{var n;a.logEvent(s({event_action:`pp_${e}_success`},i)),null==(n=r.success)||n.call(r,t)})).catch((t=>{var n;console.error(t.message),a.logEvent(s({event_action:`pp_${e}_fail`,error_value:t.errorCode},i)),null==(n=r.fail)||n.call(r,{errorCode:t.errorCode})})).finally((()=>{var e;null==(e=r.complete)||e.call(r)}))}}class W extends Error{constructor(e,t){super(e),this.errorCode=t}}class q{constructor(e,t){this.deferredCallbacks={},this.functions=e,this.allowedOrigins=t,this.subscribeToMessageEvent()}subscribeToMessageEvent(){window.addEventListener("message",(e=>{var t;if(null==(t=e.data)?void 0:t.forWindowBridge)return this.allowedOrigins&&!this.allowedOrigins.includes(e.origin)?this.sendErrorResponse(e,`${e.origin} is not allowed to make requests`,T.originNotAllowed):void("request"===e.data.type?this.handleRequest(e):"response"===e.data.type&&this.handleResponse(e))}))}handleRequest(e){return l(this,null,(function*(){const t=e.data.functionName,n=this.functions[t];n||this.sendErrorResponse(e,`Function '${t}' does not exists on the target window`,T.functionNotFound);try{this.sendSuccessResponse(e,yield n(...e.data.params))}catch(o){let t="Some error ocurred while processing the request",n=T.unknown;o instanceof W&&(t=o.message,n=o.errorCode),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 W(e.data.message,e.data.errorCode))}sendErrorResponse(e,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(s({forWindowBridge:!0,type:"response",key:e.data.key,functionName:e.data.functionName},t),e.origin)}static init(e,t){if(this._instance)throw new Error("WindowBridge already initialized, you can't call WindowBridge.init twice");return this._instance=new this(e,t),this._instance}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 q.getBridge().getTargetWindowFunctionProxy(e,t)}getTargetWindowFunctionProxy(e,t){return new Proxy(this,{get(n,o){return(...r)=>new Promise(((a,i)=>l(this,null,(function*(){const s=o.toString(),c=`${s}--${C()}`;try{const o=yield e();if(!o)throw new Error("Target window is undefined");o.postMessage({forWindowBridge:!0,type:"request",functionName:s,key:c,params:JSON.parse(JSON.stringify(r))},t),n.deferredCallbacks[c]=[a,i]}catch(l){i(new W(l.message,T.messageSendingFailed))}}))))}})}}var K=(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))(K||{});const z="ppmna-iframe",$="ppsdk-container";let H,J;function Y(){return H||(H=function(){if(document.getElementById(z))return;const e=document.createElement("div");return document.createElement("div"),e.setAttribute("id",$),e.setAttribute("class",$),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}()),H}function G(e){const t=Y();t&&(t.style.display=e?"initial":"none")}function Q(){return J||(J=new Promise(((e,t)=>{const n=document.createElement("iframe");n.setAttribute("src",R),n.setAttribute("name",z),n.setAttribute("id",z),n.setAttribute("class",z),n.setAttribute("allow","geolocation"),n.onload=()=>{e(n)},n.onerror=t,n.style.all="initial",n.style.width="100%",n.style.height="100%",n.style.border="none";const o=Y();o&&(o.innerHTML="",o.append(n))}))),J}let Z,X=!1;q.init({}),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(()=>{Q()})):Q();const ee=q.getTargetWindowFunctionProxy((function(){return Q().then((e=>null==e?void 0:e.contentWindow)).catch((()=>null))}),D);function te(){return ee}function ne(e){const t=new URL(window.location.href),n=t.searchParams.get("token"),o=t.searchParams.get("one_time_token"),r=u.get(p.refreshToken)||"",a=u.get(p.codeVerifier)||"";X=!!e.useAllFunctions,(n||o)&&function(e){e.searchParams.delete("token"),e.searchParams.delete("one_time_token"),e.search=e.searchParams.toString();const t=e.toString().replace(e.origin,"");history.replaceState(null,"",t)}(t);const i={env:e.env,mode:e.mode,debugMode:e.debugMode,clientId:e.clientId,token:n,ott:o,refreshToken:r,clientVersion:"2.14.0",codeVerifier:a};let l;Z=new Promise((e=>l=e));const d=()=>{var t;l(!0),null==(t=e.complete)||t.call(e)};Q().then((()=>{se(g.init,!1,c(s({},e),{complete:d}),i)})).catch((()=>{var t;null==(t=e.fail)||t.call(e,{errorCode:T.sdkNotInitialized}),d()}))}addEventListener("message",(e=>{var t;if(!(null==(t=e.data)?void 0:t.forWindowBridge)&&L(e.origin))if(e.data.name===f&&window.location.reload(),e.data.name!==E){if(e.data.name===h){const t=e.data.data;"_blank"===t.target?window.open(t.url,"_blank"):window.location.href=t.url}if(e.data.name===v){const{refreshToken:t,domain:n,isSecure:o}=e.data.data;!function(e,t,n){M(p.refreshToken,t),u.set(p.refreshToken,e,{domain:t,expires:90,secure:n})}(t,n,o)}if(e.data.name===I){const{codeVerifier:t,domain:n,isSecure:o}=e.data.data;!function(e,t,n){M(p.codeVerifier,t),u.set(p.codeVerifier,e,{domain:t,secure:n})}(t,n,o)}if(e.data.name===A){const{params:t}=e.data.data;!function(e){console.debug(...e)}(t)}}else G(!0)}));const oe=V("renderCoupons",(e=>l(this,null,(function*(){const{merchant:t,couponId:n,containerId:o,postLoginRedirectUrl:r=window.location.href,postLoginRedirectType:a,locale:i}=e,s=document.getElementById(o);if(!s)throw new W("Invalid coupon container Id",T.badRequestInsufficientParameter);const c=yield ee.fetchCoupons({merchantId:t,couponId:n,postLoginRedirectUrl:r,postLoginRedirectType:a});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(!1),s.innerHTML="",s.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=q.getTargetWindowFunctionProxy((()=>e.contentWindow),D);yield n.renderCoupons({coupons:c,merchantId:t,locale:i})}catch(l){throw new W(`An error ocurred while displaying coupons, merchantId=${t}, couponId=${n}, error=${l}`,T.unknown)}}))),te,(e=>({event_label_suffix:e.merchant,event_label2:e.couponId})));const re=V("logout",(()=>l(this,null,(function*(){try{const e=S(yield ee.logout(),window.location.hostname);return M(p.refreshToken,e),M(p.codeVerifier,e),{statusCode:K.loggedOut}}catch(e){throw new W(`An error ocurred while trying to logout the user, error=${e}`,T.unknown)}}))),te);function ae(e,t,n){var o,r,a;e.result===m.fail&&(null==(o=null==t?void 0:t.fail)||o.call(t,e.data)),e.result===m.success&&(null==(r=null==t?void 0:t.success)||r.call(t,null==e?void 0:e.data)),e.result===m.complete&&(null==(a=null==t?void 0:t.complete)||a.call(t),removeEventListener("message",n),B(e.messageId),j.length>0||G(!1))}function ie(e){return l(this,null,(function*(){var t;const n=yield Q().catch((()=>{}));null==(t=null==n?void 0:n.contentWindow)||t.postMessage(JSON.parse(JSON.stringify(e)),D)}))}function se(e,t,n,o){const r=x();t&&G(!0);const a=t=>{L(t.origin)&&t.data.name===e&&t.data.messageId===r&&ae(t.data,n,a)};addEventListener("message",a),ie({name:e,params:o,messageId:r})}!function(e){const t=window;(!t.hasOwnProperty(y)||t[y]!==e)&&(t[y]=e)}({_handleMessageFromNative:e=>{Q().then((t=>{var n;null==(n=null==t?void 0:t.contentWindow)||n.postMessage(JSON.parse(JSON.stringify({name:g.handleMessageFromNative,params:{json:e}})),D)}))}});const ce=["init","setTitle","copyToClipboard","getSessionData","setSessionData","getStorageData","setStorageData","removeStorageData"],le=["renderCoupons"],de=new Proxy({init:ne,verifyMultiFactorAuthResult:function(e){const t=new URL(window.location.href);se(g.verifyMultiFactorAuthResult,!1,e,c(s({},e),{sessionId:t.searchParams.get("ppSessionId")}))},share:function(e){if(!(null==navigator?void 0:navigator.share))return void se(g.share,!1,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:T.unknown}),null==(n=null==e?void 0:e.complete)||n.call(e)}))},setTitle:function(e){var t,n;document.title=(null==e?void 0:e.title)||"",null==(t=null==e?void 0:e.success)||t.call(e),null==(n=null==e?void 0:e.complete)||n.call(e)},render:function(e){var t;if(!(null==e?void 0:e.containerId)||!document.getElementById(null==e?void 0:e.containerId))return null==(t=null==e?void 0:e.fail)||t.call(e,{errorCode:T.badRequestInsufficientParameter}),console.error("Invalid container Id");const n=x(),o=t=>{var r,a;if(!L(t.origin)||t.data.name!==g.render||t.data.messageId!==n)return;const i=null==(r=t.data)?void 0:r.data,c=null==(a=t.data)?void 0:a.data;t.data.result===m.success&&(!function(e,t){var n,o,r,a,i,c,l;const d=document.getElementById(t.containerId),u=document.createElement("button");u.className="ppmna-reset-css pp-smartButtonWrapper pp-button";const p=function(e){return"red"===e?w:k}(null==t?void 0:t.theme),m=(null==(o=null==(n=null==e?void 0:e.data)?void 0:n.cashbackInfo)?void 0:o.length)?"pp-cashback":"",f=t.isShortText?"pp-shortText":"",h=null!=(r=null==t?void 0:t.buttonSize)?r:"lg",v=null!=(a=null==t?void 0:t.theme)?a:"light",I=document.createElement("a");I.className=`pp-smartBtn pp-${v} pp-${h} pp-${F(t.type)} pp-${e.preferredLanguage} ${m} ${f}`,I.href=F(e.data.loginUrl);const E=document.createElement("span");E.className="pp-leftSection";const A=document.createElement("img");A.className="pp-img",A.src=p,A.alt="",E.appendChild(A);const y=document.createElement("span");y.className="pp-btnContent";const b=document.createElement("span");b.className="pp-title",b.innerText=null==(i=null==e?void 0:e.data)?void 0:i.title,y.appendChild(b),E.appendChild(y),I.append(E);const _=document.createElement("span");(null==(c=null==e?void 0:e.data)?void 0:c.cashbackInfo)&&(_.className="pp-cashbackInfo",_.innerText=null==(l=null==e?void 0:e.data)?void 0:l.cashbackInfo,y.append(_));if(e.data.avatarUrl){const t=document.createElement("img");t.className="pp-userProfile",t.src=e.data.avatarUrl,t.addEventListener("error",(function(e){var t;const n=e.target;null==(t=null==n?void 0:n.parentNode)||t.removeChild(n)})),I.append(t)}u.append(I),d&&(d.innerHTML="",d.appendChild(u),"pay"===t.type&&(null==e?void 0:e.isLoggedIn)&&u.addEventListener("click",(e=>{var n;e.preventDefault(),(null==t?void 0:t.callback)?null==(n=null==t?void 0:t.callback)||n.call(t):t.orderInfo&&se(g.makePayment,!0,t,s({},t.orderInfo))})))}(c,e),"pay"===i.type&&(null==c?void 0:c.isJustLoggedIn)&&e.autoInvoke&&(null==c?void 0:c.isLoggedIn)&&se(g.makePayment,!0,e,s({},e.orderInfo))),t.data.result===m.complete&&(B(t.data.messageId),removeEventListener("message",o))};addEventListener("message",o),ie({name:g.render,params:c(s({},e),{redirectUrl:e.redirectUrl||window.location.href}),messageId:n})},renderCoupons:oe,scanCode:function(e){var t;const n=c(s({},e),{redirectUrlOnCancel:null!=(t=null==e?void 0:e.redirectUrlOnCancel)?t:window.location.href});se(g.scanCode,!1,e,n)},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:T.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;se(g.getKycPassportInfo,!1,e,c(s({},e),{url:t}))},getAuthStatus:function(e){const t=window.location.href;se(g.getAuthStatus,!1,e,c(s({},e),{url:t}))},logout:re},{get(e,t){const n=t;if(!X&&!function(e){return b.includes(e)}(n))throw new Error(`${n} is not supported by Mini Apps JS SDK`);return o=>l(this,null,(function*(){var r,a;if(!ce.includes(n)&&!(yield Z)){if(!le.includes(n)||!o.clientId)return null==(r=o.fail)||r.call(o,{errorCode:T.sdkNotInitialized}),void(null==(a=o.complete)||a.call(o));ne({clientId:o.clientId,env:o.env}),yield Z}if(Object.prototype.hasOwnProperty.call(e,n))return e[n](o);se(t,!1,o,o)}))}});!function(){const e=window._ppcs;if(e){window._ppcs=void 0;for(const[t,n]of e)de[t](n)}}(),de.revision="66ade73";const ue=de;window._pp=ue;return ue}();
@@ -1,4 +1,43 @@
1
- (function(){"use strict";try{if(typeof document!="undefined"){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;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{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:#ff0033}.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)}})();
1
+ (function(){"use strict";try{if(typeof document!="undefined"){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:#ff0033}.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 __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
+ var __async = (__this, __arguments, generator) => {
22
+ return new Promise((resolve, reject) => {
23
+ var fulfilled = (value) => {
24
+ try {
25
+ step(generator.next(value));
26
+ } catch (e) {
27
+ reject(e);
28
+ }
29
+ };
30
+ var rejected = (value) => {
31
+ try {
32
+ step(generator.throw(value));
33
+ } catch (e) {
34
+ reject(e);
35
+ }
36
+ };
37
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
38
+ step((generator = generator.apply(__this, __arguments)).next());
39
+ });
40
+ };
2
41
  /*! js-cookie v3.0.1 | MIT */
3
42
  function assign(target) {
4
43
  for (var i = 1; i < arguments.length; i++) {
@@ -314,6 +353,9 @@ var MiniAppErrorType = /* @__PURE__ */ ((MiniAppErrorType2) => {
314
353
  MiniAppErrorType2["notCompleted"] = "NOT_COMPLETED";
315
354
  MiniAppErrorType2["kycValidationInProcess"] = "KYC_VALIDATION_IN_PROCESS";
316
355
  MiniAppErrorType2["noLocationData"] = "NO_LOCATION_DATA";
356
+ MiniAppErrorType2["functionNotFound"] = "FUNCTION_NOT_FOUND";
357
+ MiniAppErrorType2["originNotAllowed"] = "ORIGIN_NOT_ALLOWED";
358
+ MiniAppErrorType2["messageSendingFailed"] = "MESSAGE_SENDING_FAILED";
317
359
  return MiniAppErrorType2;
318
360
  })(MiniAppErrorType || {});
319
361
  function isIP(hostName) {
@@ -670,11 +712,12 @@ function getDomain(subdomainCookieSharing, hostname) {
670
712
  function getRandomString() {
671
713
  return Math.random().toString(36).substring(7);
672
714
  }
673
- const JS_SDK_VERSION = "2.11.0";
715
+ const JS_SDK_VERSION = "2.14.0";
716
+ const REVISION = "66ade73";
674
717
  const coreBaseUrl = new URL("https://mini-app-sdk-core.paypay.ne.jp/");
675
718
  const CORE_IFRAME_ORIGIN = coreBaseUrl.origin;
676
719
  const CORE_IFRAME_URL = new URL(
677
- `./iframe.html?v=${JS_SDK_VERSION}`,
720
+ `./iframe.html?v=${JS_SDK_VERSION}&rev=${REVISION}`,
678
721
  coreBaseUrl
679
722
  ).href;
680
723
  const COUPON_IFRAME_URL = new URL(
@@ -747,42 +790,39 @@ function functionStart() {
747
790
  runningFunctions.push(messageId);
748
791
  return messageId;
749
792
  }
750
- class ClientError extends Error {
751
- constructor(message, payload) {
752
- super(message);
753
- this.payload = payload;
754
- }
755
- }
756
793
  function promiseToCallback(functionName, target, getCore2, getLoggingParams) {
757
794
  return function(params = {}) {
758
795
  const core2 = getCore2();
759
796
  const loggingParams = getLoggingParams == null ? void 0 : getLoggingParams(params);
760
- void core2.logEvent({
761
- event_action: `pp_${functionName}_called`,
762
- ...loggingParams
763
- });
797
+ void core2.logEvent(__spreadValues({
798
+ event_action: `pp_${functionName}_called`
799
+ }, loggingParams));
764
800
  target(params).then((result) => {
765
801
  var _a;
766
- void core2.logEvent({
767
- event_action: `pp_${functionName}_success`,
768
- ...loggingParams
769
- });
802
+ void core2.logEvent(__spreadValues({
803
+ event_action: `pp_${functionName}_success`
804
+ }, loggingParams));
770
805
  (_a = params.success) == null ? void 0 : _a.call(params, result);
771
806
  }).catch((error) => {
772
807
  var _a;
773
808
  console.error(error.message);
774
- void core2.logEvent({
809
+ void core2.logEvent(__spreadValues({
775
810
  event_action: `pp_${functionName}_fail`,
776
- error_value: error.payload.errorCode,
777
- ...loggingParams
778
- });
779
- (_a = params.fail) == null ? void 0 : _a.call(params, error.payload);
811
+ error_value: error.errorCode
812
+ }, loggingParams));
813
+ (_a = params.fail) == null ? void 0 : _a.call(params, { errorCode: error.errorCode });
780
814
  }).finally(() => {
781
815
  var _a;
782
816
  (_a = params.complete) == null ? void 0 : _a.call(params);
783
817
  });
784
818
  };
785
819
  }
820
+ class PPError extends Error {
821
+ constructor(message, errorCode) {
822
+ super(message);
823
+ this.errorCode = errorCode;
824
+ }
825
+ }
786
826
  class WindowBridge {
787
827
  constructor(functions, allowedOrigins) {
788
828
  this.deferredCallbacks = {};
@@ -807,8 +847,8 @@ class WindowBridge {
807
847
  if (this.allowedOrigins && !this.allowedOrigins.includes(receivedMessageEvent.origin)) {
808
848
  return this.sendErrorResponse(
809
849
  receivedMessageEvent,
810
- "originNotAllowed",
811
- `${receivedMessageEvent.origin} is not allowed to make requests`
850
+ `${receivedMessageEvent.origin} is not allowed to make requests`,
851
+ MiniAppErrorType.originNotAllowed
812
852
  );
813
853
  }
814
854
  if (receivedMessageEvent.data.type === "request") {
@@ -823,27 +863,32 @@ class WindowBridge {
823
863
  }
824
864
  );
825
865
  }
826
- async handleRequest(receivedMessageEvent) {
827
- const functionToInvoke = this.functions[receivedMessageEvent.data.functionName];
828
- if (!functionToInvoke) {
829
- this.sendErrorResponse(
830
- receivedMessageEvent,
831
- "functionNotFound"
832
- /* functionNotFound */
833
- );
834
- }
835
- try {
836
- this.sendSuccessResponse(
837
- receivedMessageEvent,
838
- await functionToInvoke(...receivedMessageEvent.data.params)
839
- );
840
- } catch (error) {
841
- this.sendErrorResponse(
842
- receivedMessageEvent,
843
- "runTimeError",
844
- error.message
845
- );
846
- }
866
+ handleRequest(receivedMessageEvent) {
867
+ return __async(this, null, function* () {
868
+ const functionName = receivedMessageEvent.data.functionName;
869
+ const functionToInvoke = this.functions[functionName];
870
+ if (!functionToInvoke) {
871
+ this.sendErrorResponse(
872
+ receivedMessageEvent,
873
+ `Function '${functionName}' does not exists on the target window`,
874
+ MiniAppErrorType.functionNotFound
875
+ );
876
+ }
877
+ try {
878
+ this.sendSuccessResponse(
879
+ receivedMessageEvent,
880
+ yield functionToInvoke(...receivedMessageEvent.data.params)
881
+ );
882
+ } catch (error) {
883
+ let message = "Some error ocurred while processing the request";
884
+ let errorCode = MiniAppErrorType.unknown;
885
+ if (error instanceof PPError) {
886
+ message = error.message;
887
+ errorCode = error.errorCode;
888
+ }
889
+ this.sendErrorResponse(receivedMessageEvent, message, errorCode);
890
+ }
891
+ });
847
892
  }
848
893
  handleResponse(receivedMessageEvent) {
849
894
  if (!this.deferredCallbacks[receivedMessageEvent.data.key]) {
@@ -857,17 +902,19 @@ class WindowBridge {
857
902
  if (receivedMessageEvent.data.status === "success") {
858
903
  resolve(receivedMessageEvent.data.result);
859
904
  } else {
860
- reject({
861
- code: receivedMessageEvent.data.code,
862
- message: receivedMessageEvent.data.message
863
- });
905
+ reject(
906
+ new PPError(
907
+ receivedMessageEvent.data.message,
908
+ receivedMessageEvent.data.errorCode
909
+ )
910
+ );
864
911
  }
865
912
  }
866
- sendErrorResponse(receivedMessageEvent, code, message) {
913
+ sendErrorResponse(receivedMessageEvent, message, errorCode) {
867
914
  this.sendResponse(receivedMessageEvent, {
868
915
  status: "failure",
869
- code,
870
- message
916
+ message,
917
+ errorCode
871
918
  });
872
919
  }
873
920
  sendSuccessResponse(receivedMessageEvent, result) {
@@ -879,13 +926,12 @@ class WindowBridge {
879
926
  sendResponse(receivedMessageEvent, data) {
880
927
  var _a;
881
928
  (_a = receivedMessageEvent.source) == null ? void 0 : _a.postMessage(
882
- {
929
+ __spreadValues({
883
930
  forWindowBridge: true,
884
931
  type: "response",
885
932
  key: receivedMessageEvent.data.key,
886
- functionName: receivedMessageEvent.data.functionName,
887
- ...data
888
- },
933
+ functionName: receivedMessageEvent.data.functionName
934
+ }, data),
889
935
  // Just a hack to overcome weird function overload mismatch
890
936
  receivedMessageEvent.origin
891
937
  );
@@ -942,11 +988,11 @@ class WindowBridge {
942
988
  get(windowBridgeInstance, functionName) {
943
989
  return (...params) => (
944
990
  // eslint-disable-next-line no-async-promise-executor, @typescript-eslint/no-misused-promises
945
- new Promise(async (resolve, reject) => {
991
+ new Promise((resolve, reject) => __async(this, null, function* () {
946
992
  const functionNameString = functionName.toString();
947
993
  const key = `${functionNameString}--${getRandomString()}`;
948
994
  try {
949
- const targetWindow = await getTargetWindow();
995
+ const targetWindow = yield getTargetWindow();
950
996
  if (!targetWindow) {
951
997
  throw new Error("Target window is undefined");
952
998
  }
@@ -956,18 +1002,20 @@ class WindowBridge {
956
1002
  type: "request",
957
1003
  functionName: functionNameString,
958
1004
  key,
959
- params
1005
+ params: JSON.parse(JSON.stringify(params))
960
1006
  },
961
1007
  targetWindowOrigin
962
1008
  );
963
1009
  windowBridgeInstance.deferredCallbacks[key] = [resolve, reject];
964
1010
  } catch (error) {
965
- reject({
966
- code: "messageSendingFailed",
967
- message: error.message
968
- });
1011
+ reject(
1012
+ new PPError(
1013
+ error.message,
1014
+ MiniAppErrorType.messageSendingFailed
1015
+ )
1016
+ );
969
1017
  }
970
- })
1018
+ }))
971
1019
  );
972
1020
  }
973
1021
  });
@@ -1003,6 +1051,10 @@ function getCoreIframeContainer() {
1003
1051
  return iframeContainer;
1004
1052
  }
1005
1053
  function createIframeContainer() {
1054
+ const frameExists = document.getElementById(IFRAME_NAME);
1055
+ if (frameExists) {
1056
+ return;
1057
+ }
1006
1058
  const container = document.createElement("div");
1007
1059
  document.createElement("div");
1008
1060
  container.setAttribute("id", IFRAME_CONTAINER_NAME);
@@ -1020,7 +1072,9 @@ function createIframeContainer() {
1020
1072
  }
1021
1073
  function showCoreIframe(visible) {
1022
1074
  const container = getCoreIframeContainer();
1023
- container.style.display = visible ? "initial" : "none";
1075
+ if (container) {
1076
+ container.style.display = visible ? "initial" : "none";
1077
+ }
1024
1078
  }
1025
1079
  let coreIframeLoadingPromise;
1026
1080
  function getCoreIframe() {
@@ -1049,15 +1103,17 @@ function createIframe() {
1049
1103
  iframe.style.height = "100%";
1050
1104
  iframe.style.border = "none";
1051
1105
  const container = getCoreIframeContainer();
1052
- container.innerHTML = "";
1053
- container.append(iframe);
1106
+ if (container) {
1107
+ container.innerHTML = "";
1108
+ container.append(iframe);
1109
+ }
1054
1110
  });
1055
1111
  }
1056
- const windowBridge = WindowBridge.init({});
1057
1112
  let useAllFunctions = false;
1058
1113
  let initDonePromise;
1114
+ WindowBridge.init({});
1059
1115
  initCoreIframe();
1060
- const core = windowBridge.getTargetWindowFunctionProxy(
1116
+ const core = WindowBridge.getTargetWindowFunctionProxy(
1061
1117
  getCoreIframeWindow,
1062
1118
  CORE_IFRAME_ORIGIN
1063
1119
  );
@@ -1107,7 +1163,7 @@ function init(params) {
1107
1163
  const ott = url2.searchParams.get("one_time_token");
1108
1164
  const refreshToken = getRefreshToken();
1109
1165
  const codeVerifier = getCodeVerifier();
1110
- const clientVersion = "2.11.0";
1166
+ const clientVersion = "2.14.0";
1111
1167
  useAllFunctions = !!params.useAllFunctions;
1112
1168
  if (token || ott) {
1113
1169
  removeTokenFromUrl(url2);
@@ -1134,7 +1190,7 @@ function init(params) {
1134
1190
  triggerPostMessageToCore(
1135
1191
  PPFunctionName.init,
1136
1192
  false,
1137
- { ...params, complete },
1193
+ __spreadProps(__spreadValues({}, params), { complete }),
1138
1194
  initParams
1139
1195
  );
1140
1196
  }).catch(() => {
@@ -1149,10 +1205,9 @@ function getAuthStatus(params) {
1149
1205
  PPFunctionName.getAuthStatus,
1150
1206
  false,
1151
1207
  params,
1152
- {
1153
- ...params,
1208
+ __spreadProps(__spreadValues({}, params), {
1154
1209
  url: url2
1155
- }
1210
+ })
1156
1211
  );
1157
1212
  }
1158
1213
  function verifyMultiFactorAuthResult(params) {
@@ -1161,15 +1216,14 @@ function verifyMultiFactorAuthResult(params) {
1161
1216
  PPFunctionName.verifyMultiFactorAuthResult,
1162
1217
  false,
1163
1218
  params,
1164
- { ...params, sessionId: url2.searchParams.get("ppSessionId") }
1219
+ __spreadProps(__spreadValues({}, params), { sessionId: url2.searchParams.get("ppSessionId") })
1165
1220
  );
1166
1221
  }
1167
1222
  function getKycPassportInfo(params) {
1168
- const url2 = new URL(window.location.href);
1169
- triggerPostMessageToCore(PPFunctionName.getKycPassportInfo, false, params, {
1170
- ...params,
1223
+ const url2 = window.location.href;
1224
+ triggerPostMessageToCore(PPFunctionName.getKycPassportInfo, false, params, __spreadProps(__spreadValues({}, params), {
1171
1225
  url: url2
1172
- });
1226
+ }));
1173
1227
  }
1174
1228
  function share(params) {
1175
1229
  if (!(navigator == null ? void 0 : navigator.share)) {
@@ -1216,9 +1270,7 @@ function render(params) {
1216
1270
  if (e.data.result === PPFunctionResult.success) {
1217
1271
  renderButton(data, params);
1218
1272
  if (info.type === "pay" && (data == null ? void 0 : data.isJustLoggedIn) && params.autoInvoke && (data == null ? void 0 : data.isLoggedIn)) {
1219
- triggerPostMessageToCore(PPFunctionName.makePayment, true, params, {
1220
- ...params.orderInfo
1221
- });
1273
+ triggerPostMessageToCore(PPFunctionName.makePayment, true, params, __spreadValues({}, params.orderInfo));
1222
1274
  }
1223
1275
  }
1224
1276
  if (e.data.result === PPFunctionResult.complete) {
@@ -1229,16 +1281,15 @@ function render(params) {
1229
1281
  addEventListener("message", getRenderMessageHandler);
1230
1282
  void postMessageToCore({
1231
1283
  name: PPFunctionName.render,
1232
- params: {
1233
- ...params,
1284
+ params: __spreadProps(__spreadValues({}, params), {
1234
1285
  redirectUrl: params.redirectUrl || window.location.href
1235
- },
1286
+ }),
1236
1287
  messageId
1237
1288
  });
1238
1289
  }
1239
1290
  const renderCoupons = promiseToCallback(
1240
1291
  "renderCoupons",
1241
- async (params) => {
1292
+ (params) => __async(void 0, null, function* () {
1242
1293
  const {
1243
1294
  merchant: merchantId,
1244
1295
  couponId,
@@ -1249,56 +1300,22 @@ const renderCoupons = promiseToCallback(
1249
1300
  } = params;
1250
1301
  const containerElement = document.getElementById(containerId);
1251
1302
  if (!containerElement) {
1252
- throw new ClientError("Invalid coupon container Id", {
1253
- errorCode: MiniAppErrorType.badRequestInsufficientParameter
1254
- });
1303
+ throw new PPError(
1304
+ "Invalid coupon container Id",
1305
+ MiniAppErrorType.badRequestInsufficientParameter
1306
+ );
1255
1307
  }
1256
- const coupons = await core.fetchCoupons({
1308
+ const coupons = yield core.fetchCoupons({
1257
1309
  merchantId,
1258
1310
  couponId,
1259
1311
  postLoginRedirectUrl,
1260
1312
  postLoginRedirectType
1261
- }).catch(() => {
1262
- throw new ClientError(
1263
- `An error occurred while fetching coupons, merchantId=${merchantId} and couponId=${couponId}`,
1264
- {
1265
- errorCode: MiniAppErrorType.unknown
1266
- }
1267
- );
1268
1313
  });
1269
- if (coupons.length === 0) {
1270
- throw new ClientError(
1271
- `No coupon found for merchantId=${merchantId} and couponId=${couponId}`,
1272
- {
1273
- errorCode: MiniAppErrorType.notAvailable
1274
- }
1275
- );
1276
- }
1277
- const firstCoupon = coupons[0];
1278
- const currentTimeStamp = (/* @__PURE__ */ new Date()).getTime();
1279
- if (new Date(firstCoupon.liveStartDate).getTime() > currentTimeStamp) {
1280
- throw new ClientError("Coupon is not live yet", {
1281
- errorCode: MiniAppErrorType.invalidData
1282
- });
1283
- }
1284
- if (new Date(firstCoupon.liveEndDate).getTime() < currentTimeStamp) {
1285
- throw new ClientError("Coupon has expired", {
1286
- errorCode: MiniAppErrorType.invalidData
1287
- });
1288
- }
1289
- if (firstCoupon.status !== "SCHEDULED") {
1290
- throw new ClientError(
1291
- `Coupon status is ${firstCoupon.status} that is not valid`,
1292
- {
1293
- errorCode: MiniAppErrorType.invalidData
1294
- }
1295
- );
1296
- }
1297
1314
  try {
1298
1315
  const iframeElement = document.createElement("iframe");
1299
1316
  iframeElement.src = COUPON_IFRAME_URL;
1300
1317
  iframeElement.style.cssText = "width:100%;height: 0;border: none;transition: height 300ms ease-in;display: block;";
1301
- await new Promise((resolve, reject) => {
1318
+ yield new Promise((resolve, reject) => {
1302
1319
  iframeElement.onload = () => resolve(true);
1303
1320
  iframeElement.onerror = () => reject(false);
1304
1321
  containerElement.innerHTML = "";
@@ -1314,20 +1331,18 @@ const renderCoupons = promiseToCallback(
1314
1331
  }
1315
1332
  }
1316
1333
  );
1317
- const couponFunctions = windowBridge.getTargetWindowFunctionProxy(
1334
+ const couponFunctions = WindowBridge.getTargetWindowFunctionProxy(
1318
1335
  () => iframeElement.contentWindow,
1319
1336
  CORE_IFRAME_ORIGIN
1320
1337
  );
1321
- await couponFunctions.renderCoupons({ coupons, merchantId, locale });
1338
+ yield couponFunctions.renderCoupons({ coupons, merchantId, locale });
1322
1339
  } catch (error) {
1323
- throw new ClientError(
1340
+ throw new PPError(
1324
1341
  `An error ocurred while displaying coupons, merchantId=${merchantId}, couponId=${couponId}, error=${error}`,
1325
- {
1326
- errorCode: MiniAppErrorType.unknown
1327
- }
1342
+ MiniAppErrorType.unknown
1328
1343
  );
1329
1344
  }
1330
- },
1345
+ }),
1331
1346
  getCore,
1332
1347
  (params) => ({
1333
1348
  event_label_suffix: params.merchant,
@@ -1335,10 +1350,10 @@ const renderCoupons = promiseToCallback(
1335
1350
  })
1336
1351
  );
1337
1352
  function scanCode(params) {
1338
- const scanCodeParams = {
1339
- ...params,
1340
- redirectUrlOnCancel: (params == null ? void 0 : params.redirectUrlOnCancel) ?? window.location.href
1341
- };
1353
+ var _a;
1354
+ const scanCodeParams = __spreadProps(__spreadValues({}, params), {
1355
+ redirectUrlOnCancel: (_a = params == null ? void 0 : params.redirectUrlOnCancel) != null ? _a : window.location.href
1356
+ });
1342
1357
  triggerPostMessageToCore(
1343
1358
  PPFunctionName.scanCode,
1344
1359
  false,
@@ -1349,25 +1364,25 @@ function scanCode(params) {
1349
1364
  function getSessionData(params) {
1350
1365
  var _a, _b;
1351
1366
  const value = sessionStorage.getItem(params == null ? void 0 : params.key);
1352
- (_a = params == null ? void 0 : params.success) == null ? void 0 : _a.call(params, { [params == null ? void 0 : params.key]: value ?? "" });
1367
+ (_a = params == null ? void 0 : params.success) == null ? void 0 : _a.call(params, { [params == null ? void 0 : params.key]: value != null ? value : "" });
1353
1368
  (_b = params == null ? void 0 : params.complete) == null ? void 0 : _b.call(params);
1354
1369
  }
1355
1370
  function setSessionData(params) {
1356
- var _a, _b;
1357
- sessionStorage.setItem(params == null ? void 0 : params.key, (params == null ? void 0 : params.value) ?? "");
1358
- (_a = params == null ? void 0 : params.success) == null ? void 0 : _a.call(params);
1359
- (_b = params == null ? void 0 : params.complete) == null ? void 0 : _b.call(params);
1371
+ var _a, _b, _c;
1372
+ sessionStorage.setItem(params == null ? void 0 : params.key, (_a = params == null ? void 0 : params.value) != null ? _a : "");
1373
+ (_b = params == null ? void 0 : params.success) == null ? void 0 : _b.call(params);
1374
+ (_c = params == null ? void 0 : params.complete) == null ? void 0 : _c.call(params);
1360
1375
  }
1361
1376
  function setStorageData(params) {
1362
- var _a, _b;
1363
- localStorage.setItem(params == null ? void 0 : params.key, (params == null ? void 0 : params.value) ?? "");
1364
- (_a = params == null ? void 0 : params.success) == null ? void 0 : _a.call(params);
1365
- (_b = params == null ? void 0 : params.complete) == null ? void 0 : _b.call(params);
1377
+ var _a, _b, _c;
1378
+ localStorage.setItem(params == null ? void 0 : params.key, (_a = params == null ? void 0 : params.value) != null ? _a : "");
1379
+ (_b = params == null ? void 0 : params.success) == null ? void 0 : _b.call(params);
1380
+ (_c = params == null ? void 0 : params.complete) == null ? void 0 : _c.call(params);
1366
1381
  }
1367
1382
  function getStorageData(params) {
1368
1383
  var _a, _b;
1369
1384
  const value = localStorage.getItem(params == null ? void 0 : params.key);
1370
- (_a = params == null ? void 0 : params.success) == null ? void 0 : _a.call(params, { [params == null ? void 0 : params.key]: value ?? "" });
1385
+ (_a = params == null ? void 0 : params.success) == null ? void 0 : _a.call(params, { [params == null ? void 0 : params.key]: value != null ? value : "" });
1371
1386
  (_b = params == null ? void 0 : params.complete) == null ? void 0 : _b.call(params);
1372
1387
  }
1373
1388
  function removeStorageData(params) {
@@ -1378,9 +1393,9 @@ function removeStorageData(params) {
1378
1393
  }
1379
1394
  const logout = promiseToCallback(
1380
1395
  "logout",
1381
- async () => {
1396
+ () => __async(void 0, null, function* () {
1382
1397
  try {
1383
- const subdomainCookieSharing = await core.logout();
1398
+ const subdomainCookieSharing = yield core.logout();
1384
1399
  const clientDomain = getDomain(
1385
1400
  subdomainCookieSharing,
1386
1401
  window.location.hostname
@@ -1389,14 +1404,12 @@ const logout = promiseToCallback(
1389
1404
  removeCookie(PpLocalStorageKey.codeVerifier, clientDomain);
1390
1405
  return { statusCode: MiniAppStatusType.loggedOut };
1391
1406
  } catch (error) {
1392
- throw new ClientError(
1407
+ throw new PPError(
1393
1408
  `An error ocurred while trying to logout the user, error=${error}`,
1394
- {
1395
- errorCode: MiniAppErrorType.unknown
1396
- }
1409
+ MiniAppErrorType.unknown
1397
1410
  );
1398
1411
  }
1399
- },
1412
+ }),
1400
1413
  getCore
1401
1414
  );
1402
1415
  function copyToClipboard(params) {
@@ -1430,13 +1443,15 @@ function receiveMessageFromIframe(messageData, params, eventHandler) {
1430
1443
  }
1431
1444
  }
1432
1445
  }
1433
- async function postMessageToCore(messageData) {
1434
- var _a;
1435
- const iframe = await getCoreIframe().catch(() => void 0);
1436
- (_a = iframe == null ? void 0 : iframe.contentWindow) == null ? void 0 : _a.postMessage(
1437
- JSON.parse(JSON.stringify(messageData)),
1438
- CORE_IFRAME_ORIGIN
1439
- );
1446
+ function postMessageToCore(messageData) {
1447
+ return __async(this, null, function* () {
1448
+ var _a;
1449
+ const iframe = yield getCoreIframe().catch(() => void 0);
1450
+ (_a = iframe == null ? void 0 : iframe.contentWindow) == null ? void 0 : _a.postMessage(
1451
+ JSON.parse(JSON.stringify(messageData)),
1452
+ CORE_IFRAME_ORIGIN
1453
+ );
1454
+ });
1440
1455
  }
1441
1456
  function removeTokenFromUrl(url2) {
1442
1457
  url2.searchParams.delete("token");
@@ -1468,15 +1483,15 @@ function triggerPostMessageToCore(type, showIframeFlag, params, postMessageParam
1468
1483
  });
1469
1484
  }
1470
1485
  function renderButton(data, params) {
1471
- var _a, _b, _c, _d, _e;
1486
+ var _a, _b, _c, _d, _e, _f, _g;
1472
1487
  const container = document.getElementById(params.containerId);
1473
1488
  const button = document.createElement("button");
1474
1489
  button.className = "ppmna-reset-css pp-smartButtonWrapper pp-button";
1475
1490
  const iconUrl = getIconUrl(params == null ? void 0 : params.theme);
1476
1491
  const cashbackClass = ((_b = (_a = data == null ? void 0 : data.data) == null ? void 0 : _a.cashbackInfo) == null ? void 0 : _b.length) ? "pp-cashback" : "";
1477
1492
  const shortTextClass = params.isShortText ? "pp-shortText" : "";
1478
- const buttonSize = (params == null ? void 0 : params.buttonSize) ?? "lg";
1479
- const theme = (params == null ? void 0 : params.theme) ?? "light";
1493
+ const buttonSize = (_c = params == null ? void 0 : params.buttonSize) != null ? _c : "lg";
1494
+ const theme = (_d = params == null ? void 0 : params.theme) != null ? _d : "light";
1480
1495
  const aTag = document.createElement("a");
1481
1496
  aTag.className = `pp-smartBtn pp-${theme} pp-${buttonSize} pp-${convertToString(
1482
1497
  params.type
@@ -1493,14 +1508,14 @@ function renderButton(data, params) {
1493
1508
  btnSpan.className = "pp-btnContent";
1494
1509
  const titleSpan = document.createElement("span");
1495
1510
  titleSpan.className = "pp-title";
1496
- titleSpan.innerText = (_c = data == null ? void 0 : data.data) == null ? void 0 : _c.title;
1511
+ titleSpan.innerText = (_e = data == null ? void 0 : data.data) == null ? void 0 : _e.title;
1497
1512
  btnSpan.appendChild(titleSpan);
1498
1513
  leftSpan.appendChild(btnSpan);
1499
1514
  aTag.append(leftSpan);
1500
1515
  const cashbackSpan = document.createElement("span");
1501
- if ((_d = data == null ? void 0 : data.data) == null ? void 0 : _d.cashbackInfo) {
1516
+ if ((_f = data == null ? void 0 : data.data) == null ? void 0 : _f.cashbackInfo) {
1502
1517
  cashbackSpan.className = "pp-cashbackInfo";
1503
- cashbackSpan.innerText = (_e = data == null ? void 0 : data.data) == null ? void 0 : _e.cashbackInfo;
1518
+ cashbackSpan.innerText = (_g = data == null ? void 0 : data.data) == null ? void 0 : _g.cashbackInfo;
1504
1519
  btnSpan.append(cashbackSpan);
1505
1520
  }
1506
1521
  if (data.data.avatarUrl) {
@@ -1525,9 +1540,7 @@ function renderButton(data, params) {
1525
1540
  if (params == null ? void 0 : params.callback) {
1526
1541
  (_a2 = params == null ? void 0 : params.callback) == null ? void 0 : _a2.call(params);
1527
1542
  } else if (params.orderInfo) {
1528
- triggerPostMessageToCore(PPFunctionName.makePayment, true, params, {
1529
- ...params.orderInfo
1530
- });
1543
+ triggerPostMessageToCore(PPFunctionName.makePayment, true, params, __spreadValues({}, params.orderInfo));
1531
1544
  }
1532
1545
  });
1533
1546
  }
@@ -1590,12 +1603,12 @@ const proxy = new Proxy(clientFunctions, {
1590
1603
  throw new Error(`${functionName} is not supported by Mini Apps JS SDK`);
1591
1604
  }
1592
1605
  }
1593
- return async (params) => {
1606
+ return (params) => __async(this, null, function* () {
1594
1607
  var _a, _b;
1595
- if (!initExemptedFunctions.includes(functionName) && !await initDonePromise) {
1608
+ if (!initExemptedFunctions.includes(functionName) && !(yield initDonePromise)) {
1596
1609
  if (autoInitFunctions.includes(functionName) && params.clientId) {
1597
1610
  init({ clientId: params.clientId, env: params.env });
1598
- await initDonePromise;
1611
+ yield initDonePromise;
1599
1612
  } else {
1600
1613
  (_a = params.fail) == null ? void 0 : _a.call(params, { errorCode: MiniAppErrorType.sdkNotInitialized });
1601
1614
  (_b = params.complete) == null ? void 0 : _b.call(params);
@@ -1611,7 +1624,7 @@ const proxy = new Proxy(clientFunctions, {
1611
1624
  params,
1612
1625
  params
1613
1626
  );
1614
- };
1627
+ });
1615
1628
  }
1616
1629
  });
1617
1630
  function executePendingFunctionCalls() {
@@ -1625,6 +1638,10 @@ function executePendingFunctionCalls() {
1625
1638
  }
1626
1639
  }
1627
1640
  executePendingFunctionCalls();
1641
+ proxy.revision = "66ade73";
1642
+ const client = proxy;
1643
+ window._pp = client;
1644
+ const miniAppSdk = client;
1628
1645
  export {
1629
- proxy as default
1646
+ miniAppSdk as default
1630
1647
  };
@@ -3,6 +3,7 @@ interface GetLoginUrlParams extends PostLogInRedirectParams {
3
3
  pkceCodeChallenge: PKCEChallengeType;
4
4
  scopes?: Array<string>;
5
5
  }
6
+ export declare const getLoginUrlEndpoint = "public/auth/v1/loginUrl";
6
7
  export declare function getLoginUrl({ pkceCodeChallenge, postLoginRedirectUrl, postLoginRedirectType, scopes, }: GetLoginUrlParams): Promise<string>;
7
8
  export declare function getLoginUrlWithPkce(params: Omit<GetLoginUrlParams, 'pkceCodeChallenge'>): Promise<string>;
8
9
  export declare function getLoginUrlIfUserNotSignedIn(params: Omit<GetLoginUrlParams, 'pkceCodeChallenge'>): Promise<string | undefined>;
@@ -304,10 +304,11 @@ export declare type ConsultResponse = ResponseBase & {
304
304
  };
305
305
  };
306
306
  };
307
- export declare const getConsult: ({ merchant, amount, productType, }: {
307
+ export declare const getConsult: ({ merchant, amount, productType, metaData, }: {
308
308
  merchant: string;
309
309
  amount: number;
310
310
  productType: string;
311
+ metaData: unknown;
311
312
  }) => Promise<PPFetchResult<ConsultResponse, ConsultResponse>>;
312
313
  export declare enum CashBackAnimationType {
313
314
  TIER_CAMPAIGN_BOTTOM = "TIER_CAMPAIGN_BOTTOM",
@@ -59,7 +59,10 @@ export declare enum MiniAppErrorType {
59
59
  kycUpdateRequired = "KYC_UPDATE_REQUIRED",
60
60
  notCompleted = "NOT_COMPLETED",
61
61
  kycValidationInProcess = "KYC_VALIDATION_IN_PROCESS",
62
- noLocationData = "NO_LOCATION_DATA"
62
+ noLocationData = "NO_LOCATION_DATA",
63
+ functionNotFound = "FUNCTION_NOT_FOUND",
64
+ originNotAllowed = "ORIGIN_NOT_ALLOWED",
65
+ messageSendingFailed = "MESSAGE_SENDING_FAILED"
63
66
  }
64
67
  export declare class MiniAppError extends Error {
65
68
  constructor(type: MiniAppErrorType);
@@ -1,7 +1,7 @@
1
1
  import { PropType } from 'vue';
2
2
  export declare type ButtonType = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'link' | 'outLined';
3
3
  export declare type ButtonSize = 'large' | 'normal' | 'small';
4
- export declare const Button: import("vue").DefineComponent<{
4
+ export declare const PButton: import("vue").DefineComponent<{
5
5
  disabled: BooleanConstructor;
6
6
  loading: BooleanConstructor;
7
7
  block: BooleanConstructor;
package/dist/types.d.ts CHANGED
@@ -703,4 +703,10 @@ export interface PayPayCallStackParamsType {
703
703
  [index: string]: unknown;
704
704
  }
705
705
  export declare type PayPayCallStackType = Array<[string, PayPayCallStackParamsType]>;
706
+ declare global {
707
+ interface Window {
708
+ _ppcs?: PayPayCallStackType;
709
+ _ppsl?: boolean;
710
+ }
711
+ }
706
712
  export {};
@@ -87,7 +87,7 @@ export declare function topup(queryParams: TopupQuery, body: TopupBody, paymentP
87
87
  statusCode: number;
88
88
  body?: null | undefined;
89
89
  } | {
90
- ppFetchResult: "apiError";
90
+ ppFetchResult: "badRequest" | "apiError";
91
91
  statusCode: number;
92
92
  body: ({
93
93
  signed: {
@@ -0,0 +1,5 @@
1
+ import { MiniAppErrorType } from '../model/miniAppError';
2
+ export declare class PPError extends Error {
3
+ errorCode: MiniAppErrorType;
4
+ constructor(message: string, errorCode: MiniAppErrorType);
5
+ }
@@ -51,7 +51,7 @@ export declare type PPFetchResult<T, E = Record<string, unknown>> = {
51
51
  statusCode: number;
52
52
  body: T;
53
53
  } | {
54
- ppFetchResult: 'apiError';
54
+ ppFetchResult: 'badRequest' | 'apiError';
55
55
  statusCode: number;
56
56
  body: APIBaseResponse & E;
57
57
  } | {
@@ -55,7 +55,7 @@ export declare function updateLocalisedString(data: string, target: string, valu
55
55
  export declare function handleHeightResize(el: HTMLElement, windowHeight: number, isScrollable: boolean, offsetHeight: number): boolean;
56
56
  export declare function getPaymentMethodStatus(isExpired: boolean, paymentMethodInfo?: BankInfo | CreditCardInfo | SbidBankInfo | PayLaterCCInfo): unknown;
57
57
  export declare function filterErrorButtonList(buttonList: UIComponentsErrorButton[] | null): UIComponentsErrorButton[] | undefined;
58
- export declare function getFailErrorCode(ppFetchResult: string): MiniAppErrorType.timeOut | MiniAppErrorType.serverError | MiniAppErrorType.tokenExpired | MiniAppErrorType.notAuthorized;
58
+ export declare function getFailErrorCode(ppFetchResult: string): MiniAppErrorType.timeOut | MiniAppErrorType.serverError | MiniAppErrorType.badRequest | MiniAppErrorType.tokenExpired | MiniAppErrorType.notAuthorized;
59
59
  export declare function getStoreUrl(): "https://play.google.com/store/apps/details?id=jp.ne.paypay.android.app" | "https://itunes.apple.com/app/id1435783608";
60
60
  export declare function generateCodeVerifier(length?: number): string;
61
61
  export declare function generateCodeChallenge(codeVerifier: string): Promise<string>;
@@ -1,4 +1,4 @@
1
- export declare type ClaimStatus = 'CLAIMED_DELETABLE' | 'CLAIMED_NOT_DELETABLE' | 'NOT_CLAIMED_ELIGIBLE' | 'NOT_CLAIMED_NOT_ELIGIBLE' | 'FULLY_USED' | 'NOT_LOGGED_IN' | 'CLAIMING' | 'CLAIM_FAILED' | 'LOG_IN_FAILED';
1
+ export declare type ClaimStatus = 'CLAIMED_DELETABLE' | 'CLAIMED_NOT_DELETABLE' | 'NOT_CLAIMED_ELIGIBLE' | 'NOT_CLAIMED_NOT_ELIGIBLE' | 'FULLY_USED' | 'NOT_LOGGED_IN' | 'CLAIMING' | 'CLAIM_FAILED' | 'LOG_IN_FAILED' | 'COMING_SOON';
2
2
  export interface Coupon {
3
3
  merchantLogoUrl?: string;
4
4
  merchantName?: string;
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@paypay/mini-app-js-sdk",
3
- "version": "2.11.0",
3
+ "version": "2.14.0",
4
4
  "private": false,
5
5
  "scripts": {
6
- "build": "yarn build:client && yarn build:core && yarn build:init && yarn build:client:nightly",
6
+ "build": "yarn build:client && yarn build:core && yarn build:init",
7
7
  "build:miniApp": "SDK_TYPE=miniApp yarn build",
8
8
  "build:smartPayment": "SDK_TYPE=smartPayment yarn build",
9
9
  "build:client": "vite build",
10
- "build:client:nightly": "NIGHTLY_BUILD=1 vite build",
11
10
  "build:core": "vite build --config vite.config.core.ts",
12
11
  "build:init": "vite build --config vite.config.init.ts",
12
+ "build:miniAppPackage": "rollup -c",
13
13
  "dev": "run-p dev:client dev:core",
14
14
  "dev:client": "vite --host 0.0.0.0",
15
15
  "dev:core": "vite --config vite.config.core.ts",
@@ -52,6 +52,7 @@
52
52
  "@types/uuid": "^8.3.1",
53
53
  "@typescript-eslint/eslint-plugin": "^5.58.0",
54
54
  "@typescript-eslint/parser": "^5.58.0",
55
+ "@vitejs/plugin-legacy": "^4.1.1",
55
56
  "@vitejs/plugin-vue": "^4.2.3",
56
57
  "@vitejs/plugin-vue-jsx": "^1.3.10",
57
58
  "@vue/babel-plugin-jsx": "^1.0.7",
@@ -79,13 +80,15 @@
79
80
  "postcss-html": "^1.4.1",
80
81
  "postcss-less": "^6.0.0",
81
82
  "prettier": "^2.8.7",
83
+ "rollup": "3.28.0",
84
+ "rollup-plugin-ts": "^3.4.4",
82
85
  "stylelint": "^14.9.1",
83
86
  "terser": "^5.18.1",
84
87
  "ts-jest": "^26.5.6",
85
88
  "typescript": "~4.5.5",
86
89
  "ua-parser-js": "^1.0.2",
87
90
  "uuid": "^8.3.2",
88
- "vite": "^4.3.9",
91
+ "vite": "^4.4.9",
89
92
  "vite-plugin-css-injected-by-js": "^2.1.0",
90
93
  "vite-plugin-dts": "^0.9.10",
91
94
  "vue": "^3.2.39",