@paypay/mini-app-js-sdk 2.12.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.
- package/dist/client/clientUtils.d.ts +0 -4
- package/dist/client/index.d.ts +2 -2
- package/dist/client/types.d.ts +3 -3
- package/dist/mini-app-js-sdk.browser.js +2 -2
- package/dist/mini-app-js-sdk.es.js +191 -171
- package/dist/model/bridge/getLoginUrl.d.ts +1 -0
- package/dist/model/makePayment.d.ts +2 -1
- package/dist/model/miniAppError.d.ts +4 -1
- package/dist/types.d.ts +6 -0
- package/dist/utils/api.d.ts +1 -1
- package/dist/utils/errors.d.ts +5 -0
- package/dist/utils/fetch.d.ts +1 -1
- package/dist/utils/helper.d.ts +1 -1
- package/package.json +7 -4
|
@@ -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;
|
package/dist/client/index.d.ts
CHANGED
|
@@ -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
|
|
45
|
-
export default
|
|
44
|
+
declare const client: ClientSDKType;
|
|
45
|
+
export default client;
|
package/dist/client/types.d.ts
CHANGED
|
@@ -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
|
|
5
|
-
export default
|
|
3
|
+
export declare type MiniAppSdkType = Pick<typeof proxy, (typeof miniAppSupportedFunctions)[number]>;
|
|
4
|
+
declare const miniAppSdk: MiniAppSdkType;
|
|
5
|
+
export default miniAppSdk;
|
|
@@ -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.12.0",y=new URL("https://mini-app-sdk-core.paypay.ne.jp/"),w=y.origin,k=new URL(`./iframe.html?v=${A}&rev=12c80ef`,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 P(){const e=E();return C.push(e),e}class D 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.12.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 D("Invalid coupon container Id",{errorCode:h.badRequestInsufficientParameter});const c=await q.fetchCoupons({merchantId:t,couponId:n,postLoginRedirectUrl:r,postLoginRedirectType:a}).catch((()=>{throw new D(`An error occurred while fetching coupons, merchantId=${t} and couponId=${n}`,{errorCode:h.unknown})}));if(0===c.length)throw new D(`No coupon found for merchantId=${t} and couponId=${n}`,{errorCode:h.notAvailable});const l=c[0],d=(new Date).getTime();if(new Date(l.liveEndDate).getTime()<d)throw new D("Coupon has expired",{errorCode:h.invalidData});if("SCHEDULED"!==l.status)throw new D(`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 D(`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 D(`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=P();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=P(),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.revision="12c80ef",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,8 +712,8 @@ 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.
|
|
674
|
-
const REVISION = "
|
|
715
|
+
const JS_SDK_VERSION = "2.14.0";
|
|
716
|
+
const REVISION = "66ade73";
|
|
675
717
|
const coreBaseUrl = new URL("https://mini-app-sdk-core.paypay.ne.jp/");
|
|
676
718
|
const CORE_IFRAME_ORIGIN = coreBaseUrl.origin;
|
|
677
719
|
const CORE_IFRAME_URL = new URL(
|
|
@@ -748,42 +790,39 @@ function functionStart() {
|
|
|
748
790
|
runningFunctions.push(messageId);
|
|
749
791
|
return messageId;
|
|
750
792
|
}
|
|
751
|
-
class ClientError extends Error {
|
|
752
|
-
constructor(message, payload) {
|
|
753
|
-
super(message);
|
|
754
|
-
this.payload = payload;
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
793
|
function promiseToCallback(functionName, target, getCore2, getLoggingParams) {
|
|
758
794
|
return function(params = {}) {
|
|
759
795
|
const core2 = getCore2();
|
|
760
796
|
const loggingParams = getLoggingParams == null ? void 0 : getLoggingParams(params);
|
|
761
|
-
void core2.logEvent({
|
|
762
|
-
event_action: `pp_${functionName}_called
|
|
763
|
-
|
|
764
|
-
});
|
|
797
|
+
void core2.logEvent(__spreadValues({
|
|
798
|
+
event_action: `pp_${functionName}_called`
|
|
799
|
+
}, loggingParams));
|
|
765
800
|
target(params).then((result) => {
|
|
766
801
|
var _a;
|
|
767
|
-
void core2.logEvent({
|
|
768
|
-
event_action: `pp_${functionName}_success
|
|
769
|
-
|
|
770
|
-
});
|
|
802
|
+
void core2.logEvent(__spreadValues({
|
|
803
|
+
event_action: `pp_${functionName}_success`
|
|
804
|
+
}, loggingParams));
|
|
771
805
|
(_a = params.success) == null ? void 0 : _a.call(params, result);
|
|
772
806
|
}).catch((error) => {
|
|
773
807
|
var _a;
|
|
774
808
|
console.error(error.message);
|
|
775
|
-
void core2.logEvent({
|
|
809
|
+
void core2.logEvent(__spreadValues({
|
|
776
810
|
event_action: `pp_${functionName}_fail`,
|
|
777
|
-
error_value: error.
|
|
778
|
-
|
|
779
|
-
});
|
|
780
|
-
(_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 });
|
|
781
814
|
}).finally(() => {
|
|
782
815
|
var _a;
|
|
783
816
|
(_a = params.complete) == null ? void 0 : _a.call(params);
|
|
784
817
|
});
|
|
785
818
|
};
|
|
786
819
|
}
|
|
820
|
+
class PPError extends Error {
|
|
821
|
+
constructor(message, errorCode) {
|
|
822
|
+
super(message);
|
|
823
|
+
this.errorCode = errorCode;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
787
826
|
class WindowBridge {
|
|
788
827
|
constructor(functions, allowedOrigins) {
|
|
789
828
|
this.deferredCallbacks = {};
|
|
@@ -808,8 +847,8 @@ class WindowBridge {
|
|
|
808
847
|
if (this.allowedOrigins && !this.allowedOrigins.includes(receivedMessageEvent.origin)) {
|
|
809
848
|
return this.sendErrorResponse(
|
|
810
849
|
receivedMessageEvent,
|
|
811
|
-
|
|
812
|
-
|
|
850
|
+
`${receivedMessageEvent.origin} is not allowed to make requests`,
|
|
851
|
+
MiniAppErrorType.originNotAllowed
|
|
813
852
|
);
|
|
814
853
|
}
|
|
815
854
|
if (receivedMessageEvent.data.type === "request") {
|
|
@@ -824,27 +863,32 @@ class WindowBridge {
|
|
|
824
863
|
}
|
|
825
864
|
);
|
|
826
865
|
}
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
this.
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
"
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
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
|
+
});
|
|
848
892
|
}
|
|
849
893
|
handleResponse(receivedMessageEvent) {
|
|
850
894
|
if (!this.deferredCallbacks[receivedMessageEvent.data.key]) {
|
|
@@ -858,17 +902,19 @@ class WindowBridge {
|
|
|
858
902
|
if (receivedMessageEvent.data.status === "success") {
|
|
859
903
|
resolve(receivedMessageEvent.data.result);
|
|
860
904
|
} else {
|
|
861
|
-
reject(
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
905
|
+
reject(
|
|
906
|
+
new PPError(
|
|
907
|
+
receivedMessageEvent.data.message,
|
|
908
|
+
receivedMessageEvent.data.errorCode
|
|
909
|
+
)
|
|
910
|
+
);
|
|
865
911
|
}
|
|
866
912
|
}
|
|
867
|
-
sendErrorResponse(receivedMessageEvent,
|
|
913
|
+
sendErrorResponse(receivedMessageEvent, message, errorCode) {
|
|
868
914
|
this.sendResponse(receivedMessageEvent, {
|
|
869
915
|
status: "failure",
|
|
870
|
-
|
|
871
|
-
|
|
916
|
+
message,
|
|
917
|
+
errorCode
|
|
872
918
|
});
|
|
873
919
|
}
|
|
874
920
|
sendSuccessResponse(receivedMessageEvent, result) {
|
|
@@ -880,13 +926,12 @@ class WindowBridge {
|
|
|
880
926
|
sendResponse(receivedMessageEvent, data) {
|
|
881
927
|
var _a;
|
|
882
928
|
(_a = receivedMessageEvent.source) == null ? void 0 : _a.postMessage(
|
|
883
|
-
{
|
|
929
|
+
__spreadValues({
|
|
884
930
|
forWindowBridge: true,
|
|
885
931
|
type: "response",
|
|
886
932
|
key: receivedMessageEvent.data.key,
|
|
887
|
-
functionName: receivedMessageEvent.data.functionName
|
|
888
|
-
|
|
889
|
-
},
|
|
933
|
+
functionName: receivedMessageEvent.data.functionName
|
|
934
|
+
}, data),
|
|
890
935
|
// Just a hack to overcome weird function overload mismatch
|
|
891
936
|
receivedMessageEvent.origin
|
|
892
937
|
);
|
|
@@ -943,11 +988,11 @@ class WindowBridge {
|
|
|
943
988
|
get(windowBridgeInstance, functionName) {
|
|
944
989
|
return (...params) => (
|
|
945
990
|
// eslint-disable-next-line no-async-promise-executor, @typescript-eslint/no-misused-promises
|
|
946
|
-
new Promise(
|
|
991
|
+
new Promise((resolve, reject) => __async(this, null, function* () {
|
|
947
992
|
const functionNameString = functionName.toString();
|
|
948
993
|
const key = `${functionNameString}--${getRandomString()}`;
|
|
949
994
|
try {
|
|
950
|
-
const targetWindow =
|
|
995
|
+
const targetWindow = yield getTargetWindow();
|
|
951
996
|
if (!targetWindow) {
|
|
952
997
|
throw new Error("Target window is undefined");
|
|
953
998
|
}
|
|
@@ -957,18 +1002,20 @@ class WindowBridge {
|
|
|
957
1002
|
type: "request",
|
|
958
1003
|
functionName: functionNameString,
|
|
959
1004
|
key,
|
|
960
|
-
params
|
|
1005
|
+
params: JSON.parse(JSON.stringify(params))
|
|
961
1006
|
},
|
|
962
1007
|
targetWindowOrigin
|
|
963
1008
|
);
|
|
964
1009
|
windowBridgeInstance.deferredCallbacks[key] = [resolve, reject];
|
|
965
1010
|
} catch (error) {
|
|
966
|
-
reject(
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
1011
|
+
reject(
|
|
1012
|
+
new PPError(
|
|
1013
|
+
error.message,
|
|
1014
|
+
MiniAppErrorType.messageSendingFailed
|
|
1015
|
+
)
|
|
1016
|
+
);
|
|
970
1017
|
}
|
|
971
|
-
})
|
|
1018
|
+
}))
|
|
972
1019
|
);
|
|
973
1020
|
}
|
|
974
1021
|
});
|
|
@@ -1004,6 +1051,10 @@ function getCoreIframeContainer() {
|
|
|
1004
1051
|
return iframeContainer;
|
|
1005
1052
|
}
|
|
1006
1053
|
function createIframeContainer() {
|
|
1054
|
+
const frameExists = document.getElementById(IFRAME_NAME);
|
|
1055
|
+
if (frameExists) {
|
|
1056
|
+
return;
|
|
1057
|
+
}
|
|
1007
1058
|
const container = document.createElement("div");
|
|
1008
1059
|
document.createElement("div");
|
|
1009
1060
|
container.setAttribute("id", IFRAME_CONTAINER_NAME);
|
|
@@ -1021,7 +1072,9 @@ function createIframeContainer() {
|
|
|
1021
1072
|
}
|
|
1022
1073
|
function showCoreIframe(visible) {
|
|
1023
1074
|
const container = getCoreIframeContainer();
|
|
1024
|
-
container
|
|
1075
|
+
if (container) {
|
|
1076
|
+
container.style.display = visible ? "initial" : "none";
|
|
1077
|
+
}
|
|
1025
1078
|
}
|
|
1026
1079
|
let coreIframeLoadingPromise;
|
|
1027
1080
|
function getCoreIframe() {
|
|
@@ -1050,15 +1103,17 @@ function createIframe() {
|
|
|
1050
1103
|
iframe.style.height = "100%";
|
|
1051
1104
|
iframe.style.border = "none";
|
|
1052
1105
|
const container = getCoreIframeContainer();
|
|
1053
|
-
container
|
|
1054
|
-
|
|
1106
|
+
if (container) {
|
|
1107
|
+
container.innerHTML = "";
|
|
1108
|
+
container.append(iframe);
|
|
1109
|
+
}
|
|
1055
1110
|
});
|
|
1056
1111
|
}
|
|
1057
|
-
const windowBridge = WindowBridge.init({});
|
|
1058
1112
|
let useAllFunctions = false;
|
|
1059
1113
|
let initDonePromise;
|
|
1114
|
+
WindowBridge.init({});
|
|
1060
1115
|
initCoreIframe();
|
|
1061
|
-
const core =
|
|
1116
|
+
const core = WindowBridge.getTargetWindowFunctionProxy(
|
|
1062
1117
|
getCoreIframeWindow,
|
|
1063
1118
|
CORE_IFRAME_ORIGIN
|
|
1064
1119
|
);
|
|
@@ -1108,7 +1163,7 @@ function init(params) {
|
|
|
1108
1163
|
const ott = url2.searchParams.get("one_time_token");
|
|
1109
1164
|
const refreshToken = getRefreshToken();
|
|
1110
1165
|
const codeVerifier = getCodeVerifier();
|
|
1111
|
-
const clientVersion = "2.
|
|
1166
|
+
const clientVersion = "2.14.0";
|
|
1112
1167
|
useAllFunctions = !!params.useAllFunctions;
|
|
1113
1168
|
if (token || ott) {
|
|
1114
1169
|
removeTokenFromUrl(url2);
|
|
@@ -1135,7 +1190,7 @@ function init(params) {
|
|
|
1135
1190
|
triggerPostMessageToCore(
|
|
1136
1191
|
PPFunctionName.init,
|
|
1137
1192
|
false,
|
|
1138
|
-
{
|
|
1193
|
+
__spreadProps(__spreadValues({}, params), { complete }),
|
|
1139
1194
|
initParams
|
|
1140
1195
|
);
|
|
1141
1196
|
}).catch(() => {
|
|
@@ -1150,10 +1205,9 @@ function getAuthStatus(params) {
|
|
|
1150
1205
|
PPFunctionName.getAuthStatus,
|
|
1151
1206
|
false,
|
|
1152
1207
|
params,
|
|
1153
|
-
{
|
|
1154
|
-
...params,
|
|
1208
|
+
__spreadProps(__spreadValues({}, params), {
|
|
1155
1209
|
url: url2
|
|
1156
|
-
}
|
|
1210
|
+
})
|
|
1157
1211
|
);
|
|
1158
1212
|
}
|
|
1159
1213
|
function verifyMultiFactorAuthResult(params) {
|
|
@@ -1162,15 +1216,14 @@ function verifyMultiFactorAuthResult(params) {
|
|
|
1162
1216
|
PPFunctionName.verifyMultiFactorAuthResult,
|
|
1163
1217
|
false,
|
|
1164
1218
|
params,
|
|
1165
|
-
{
|
|
1219
|
+
__spreadProps(__spreadValues({}, params), { sessionId: url2.searchParams.get("ppSessionId") })
|
|
1166
1220
|
);
|
|
1167
1221
|
}
|
|
1168
1222
|
function getKycPassportInfo(params) {
|
|
1169
|
-
const url2 =
|
|
1170
|
-
triggerPostMessageToCore(PPFunctionName.getKycPassportInfo, false, params, {
|
|
1171
|
-
...params,
|
|
1223
|
+
const url2 = window.location.href;
|
|
1224
|
+
triggerPostMessageToCore(PPFunctionName.getKycPassportInfo, false, params, __spreadProps(__spreadValues({}, params), {
|
|
1172
1225
|
url: url2
|
|
1173
|
-
});
|
|
1226
|
+
}));
|
|
1174
1227
|
}
|
|
1175
1228
|
function share(params) {
|
|
1176
1229
|
if (!(navigator == null ? void 0 : navigator.share)) {
|
|
@@ -1217,9 +1270,7 @@ function render(params) {
|
|
|
1217
1270
|
if (e.data.result === PPFunctionResult.success) {
|
|
1218
1271
|
renderButton(data, params);
|
|
1219
1272
|
if (info.type === "pay" && (data == null ? void 0 : data.isJustLoggedIn) && params.autoInvoke && (data == null ? void 0 : data.isLoggedIn)) {
|
|
1220
|
-
triggerPostMessageToCore(PPFunctionName.makePayment, true, params, {
|
|
1221
|
-
...params.orderInfo
|
|
1222
|
-
});
|
|
1273
|
+
triggerPostMessageToCore(PPFunctionName.makePayment, true, params, __spreadValues({}, params.orderInfo));
|
|
1223
1274
|
}
|
|
1224
1275
|
}
|
|
1225
1276
|
if (e.data.result === PPFunctionResult.complete) {
|
|
@@ -1230,16 +1281,15 @@ function render(params) {
|
|
|
1230
1281
|
addEventListener("message", getRenderMessageHandler);
|
|
1231
1282
|
void postMessageToCore({
|
|
1232
1283
|
name: PPFunctionName.render,
|
|
1233
|
-
params: {
|
|
1234
|
-
...params,
|
|
1284
|
+
params: __spreadProps(__spreadValues({}, params), {
|
|
1235
1285
|
redirectUrl: params.redirectUrl || window.location.href
|
|
1236
|
-
},
|
|
1286
|
+
}),
|
|
1237
1287
|
messageId
|
|
1238
1288
|
});
|
|
1239
1289
|
}
|
|
1240
1290
|
const renderCoupons = promiseToCallback(
|
|
1241
1291
|
"renderCoupons",
|
|
1242
|
-
|
|
1292
|
+
(params) => __async(void 0, null, function* () {
|
|
1243
1293
|
const {
|
|
1244
1294
|
merchant: merchantId,
|
|
1245
1295
|
couponId,
|
|
@@ -1250,51 +1300,22 @@ const renderCoupons = promiseToCallback(
|
|
|
1250
1300
|
} = params;
|
|
1251
1301
|
const containerElement = document.getElementById(containerId);
|
|
1252
1302
|
if (!containerElement) {
|
|
1253
|
-
throw new
|
|
1254
|
-
|
|
1255
|
-
|
|
1303
|
+
throw new PPError(
|
|
1304
|
+
"Invalid coupon container Id",
|
|
1305
|
+
MiniAppErrorType.badRequestInsufficientParameter
|
|
1306
|
+
);
|
|
1256
1307
|
}
|
|
1257
|
-
const coupons =
|
|
1308
|
+
const coupons = yield core.fetchCoupons({
|
|
1258
1309
|
merchantId,
|
|
1259
1310
|
couponId,
|
|
1260
1311
|
postLoginRedirectUrl,
|
|
1261
1312
|
postLoginRedirectType
|
|
1262
|
-
}).catch(() => {
|
|
1263
|
-
throw new ClientError(
|
|
1264
|
-
`An error occurred while fetching coupons, merchantId=${merchantId} and couponId=${couponId}`,
|
|
1265
|
-
{
|
|
1266
|
-
errorCode: MiniAppErrorType.unknown
|
|
1267
|
-
}
|
|
1268
|
-
);
|
|
1269
1313
|
});
|
|
1270
|
-
if (coupons.length === 0) {
|
|
1271
|
-
throw new ClientError(
|
|
1272
|
-
`No coupon found for merchantId=${merchantId} and couponId=${couponId}`,
|
|
1273
|
-
{
|
|
1274
|
-
errorCode: MiniAppErrorType.notAvailable
|
|
1275
|
-
}
|
|
1276
|
-
);
|
|
1277
|
-
}
|
|
1278
|
-
const firstCoupon = coupons[0];
|
|
1279
|
-
const currentTimeStamp = (/* @__PURE__ */ new Date()).getTime();
|
|
1280
|
-
if (new Date(firstCoupon.liveEndDate).getTime() < currentTimeStamp) {
|
|
1281
|
-
throw new ClientError("Coupon has expired", {
|
|
1282
|
-
errorCode: MiniAppErrorType.invalidData
|
|
1283
|
-
});
|
|
1284
|
-
}
|
|
1285
|
-
if (firstCoupon.status !== "SCHEDULED") {
|
|
1286
|
-
throw new ClientError(
|
|
1287
|
-
`Coupon status is ${firstCoupon.status} that is not valid`,
|
|
1288
|
-
{
|
|
1289
|
-
errorCode: MiniAppErrorType.invalidData
|
|
1290
|
-
}
|
|
1291
|
-
);
|
|
1292
|
-
}
|
|
1293
1314
|
try {
|
|
1294
1315
|
const iframeElement = document.createElement("iframe");
|
|
1295
1316
|
iframeElement.src = COUPON_IFRAME_URL;
|
|
1296
1317
|
iframeElement.style.cssText = "width:100%;height: 0;border: none;transition: height 300ms ease-in;display: block;";
|
|
1297
|
-
|
|
1318
|
+
yield new Promise((resolve, reject) => {
|
|
1298
1319
|
iframeElement.onload = () => resolve(true);
|
|
1299
1320
|
iframeElement.onerror = () => reject(false);
|
|
1300
1321
|
containerElement.innerHTML = "";
|
|
@@ -1310,20 +1331,18 @@ const renderCoupons = promiseToCallback(
|
|
|
1310
1331
|
}
|
|
1311
1332
|
}
|
|
1312
1333
|
);
|
|
1313
|
-
const couponFunctions =
|
|
1334
|
+
const couponFunctions = WindowBridge.getTargetWindowFunctionProxy(
|
|
1314
1335
|
() => iframeElement.contentWindow,
|
|
1315
1336
|
CORE_IFRAME_ORIGIN
|
|
1316
1337
|
);
|
|
1317
|
-
|
|
1338
|
+
yield couponFunctions.renderCoupons({ coupons, merchantId, locale });
|
|
1318
1339
|
} catch (error) {
|
|
1319
|
-
throw new
|
|
1340
|
+
throw new PPError(
|
|
1320
1341
|
`An error ocurred while displaying coupons, merchantId=${merchantId}, couponId=${couponId}, error=${error}`,
|
|
1321
|
-
|
|
1322
|
-
errorCode: MiniAppErrorType.unknown
|
|
1323
|
-
}
|
|
1342
|
+
MiniAppErrorType.unknown
|
|
1324
1343
|
);
|
|
1325
1344
|
}
|
|
1326
|
-
},
|
|
1345
|
+
}),
|
|
1327
1346
|
getCore,
|
|
1328
1347
|
(params) => ({
|
|
1329
1348
|
event_label_suffix: params.merchant,
|
|
@@ -1331,10 +1350,10 @@ const renderCoupons = promiseToCallback(
|
|
|
1331
1350
|
})
|
|
1332
1351
|
);
|
|
1333
1352
|
function scanCode(params) {
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
redirectUrlOnCancel: (params == null ? void 0 : params.redirectUrlOnCancel)
|
|
1337
|
-
};
|
|
1353
|
+
var _a;
|
|
1354
|
+
const scanCodeParams = __spreadProps(__spreadValues({}, params), {
|
|
1355
|
+
redirectUrlOnCancel: (_a = params == null ? void 0 : params.redirectUrlOnCancel) != null ? _a : window.location.href
|
|
1356
|
+
});
|
|
1338
1357
|
triggerPostMessageToCore(
|
|
1339
1358
|
PPFunctionName.scanCode,
|
|
1340
1359
|
false,
|
|
@@ -1345,25 +1364,25 @@ function scanCode(params) {
|
|
|
1345
1364
|
function getSessionData(params) {
|
|
1346
1365
|
var _a, _b;
|
|
1347
1366
|
const value = sessionStorage.getItem(params == null ? void 0 : params.key);
|
|
1348
|
-
(_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 : "" });
|
|
1349
1368
|
(_b = params == null ? void 0 : params.complete) == null ? void 0 : _b.call(params);
|
|
1350
1369
|
}
|
|
1351
1370
|
function setSessionData(params) {
|
|
1352
|
-
var _a, _b;
|
|
1353
|
-
sessionStorage.setItem(params == null ? void 0 : params.key, (params == null ? void 0 : params.value)
|
|
1354
|
-
(
|
|
1355
|
-
(
|
|
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);
|
|
1356
1375
|
}
|
|
1357
1376
|
function setStorageData(params) {
|
|
1358
|
-
var _a, _b;
|
|
1359
|
-
localStorage.setItem(params == null ? void 0 : params.key, (params == null ? void 0 : params.value)
|
|
1360
|
-
(
|
|
1361
|
-
(
|
|
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);
|
|
1362
1381
|
}
|
|
1363
1382
|
function getStorageData(params) {
|
|
1364
1383
|
var _a, _b;
|
|
1365
1384
|
const value = localStorage.getItem(params == null ? void 0 : params.key);
|
|
1366
|
-
(_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 : "" });
|
|
1367
1386
|
(_b = params == null ? void 0 : params.complete) == null ? void 0 : _b.call(params);
|
|
1368
1387
|
}
|
|
1369
1388
|
function removeStorageData(params) {
|
|
@@ -1374,9 +1393,9 @@ function removeStorageData(params) {
|
|
|
1374
1393
|
}
|
|
1375
1394
|
const logout = promiseToCallback(
|
|
1376
1395
|
"logout",
|
|
1377
|
-
|
|
1396
|
+
() => __async(void 0, null, function* () {
|
|
1378
1397
|
try {
|
|
1379
|
-
const subdomainCookieSharing =
|
|
1398
|
+
const subdomainCookieSharing = yield core.logout();
|
|
1380
1399
|
const clientDomain = getDomain(
|
|
1381
1400
|
subdomainCookieSharing,
|
|
1382
1401
|
window.location.hostname
|
|
@@ -1385,14 +1404,12 @@ const logout = promiseToCallback(
|
|
|
1385
1404
|
removeCookie(PpLocalStorageKey.codeVerifier, clientDomain);
|
|
1386
1405
|
return { statusCode: MiniAppStatusType.loggedOut };
|
|
1387
1406
|
} catch (error) {
|
|
1388
|
-
throw new
|
|
1407
|
+
throw new PPError(
|
|
1389
1408
|
`An error ocurred while trying to logout the user, error=${error}`,
|
|
1390
|
-
|
|
1391
|
-
errorCode: MiniAppErrorType.unknown
|
|
1392
|
-
}
|
|
1409
|
+
MiniAppErrorType.unknown
|
|
1393
1410
|
);
|
|
1394
1411
|
}
|
|
1395
|
-
},
|
|
1412
|
+
}),
|
|
1396
1413
|
getCore
|
|
1397
1414
|
);
|
|
1398
1415
|
function copyToClipboard(params) {
|
|
@@ -1426,13 +1443,15 @@ function receiveMessageFromIframe(messageData, params, eventHandler) {
|
|
|
1426
1443
|
}
|
|
1427
1444
|
}
|
|
1428
1445
|
}
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
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
|
+
});
|
|
1436
1455
|
}
|
|
1437
1456
|
function removeTokenFromUrl(url2) {
|
|
1438
1457
|
url2.searchParams.delete("token");
|
|
@@ -1464,15 +1483,15 @@ function triggerPostMessageToCore(type, showIframeFlag, params, postMessageParam
|
|
|
1464
1483
|
});
|
|
1465
1484
|
}
|
|
1466
1485
|
function renderButton(data, params) {
|
|
1467
|
-
var _a, _b, _c, _d, _e;
|
|
1486
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1468
1487
|
const container = document.getElementById(params.containerId);
|
|
1469
1488
|
const button = document.createElement("button");
|
|
1470
1489
|
button.className = "ppmna-reset-css pp-smartButtonWrapper pp-button";
|
|
1471
1490
|
const iconUrl = getIconUrl(params == null ? void 0 : params.theme);
|
|
1472
1491
|
const cashbackClass = ((_b = (_a = data == null ? void 0 : data.data) == null ? void 0 : _a.cashbackInfo) == null ? void 0 : _b.length) ? "pp-cashback" : "";
|
|
1473
1492
|
const shortTextClass = params.isShortText ? "pp-shortText" : "";
|
|
1474
|
-
const buttonSize = (params == null ? void 0 : params.buttonSize)
|
|
1475
|
-
const theme = (params == null ? void 0 : params.theme)
|
|
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";
|
|
1476
1495
|
const aTag = document.createElement("a");
|
|
1477
1496
|
aTag.className = `pp-smartBtn pp-${theme} pp-${buttonSize} pp-${convertToString(
|
|
1478
1497
|
params.type
|
|
@@ -1489,14 +1508,14 @@ function renderButton(data, params) {
|
|
|
1489
1508
|
btnSpan.className = "pp-btnContent";
|
|
1490
1509
|
const titleSpan = document.createElement("span");
|
|
1491
1510
|
titleSpan.className = "pp-title";
|
|
1492
|
-
titleSpan.innerText = (
|
|
1511
|
+
titleSpan.innerText = (_e = data == null ? void 0 : data.data) == null ? void 0 : _e.title;
|
|
1493
1512
|
btnSpan.appendChild(titleSpan);
|
|
1494
1513
|
leftSpan.appendChild(btnSpan);
|
|
1495
1514
|
aTag.append(leftSpan);
|
|
1496
1515
|
const cashbackSpan = document.createElement("span");
|
|
1497
|
-
if ((
|
|
1516
|
+
if ((_f = data == null ? void 0 : data.data) == null ? void 0 : _f.cashbackInfo) {
|
|
1498
1517
|
cashbackSpan.className = "pp-cashbackInfo";
|
|
1499
|
-
cashbackSpan.innerText = (
|
|
1518
|
+
cashbackSpan.innerText = (_g = data == null ? void 0 : data.data) == null ? void 0 : _g.cashbackInfo;
|
|
1500
1519
|
btnSpan.append(cashbackSpan);
|
|
1501
1520
|
}
|
|
1502
1521
|
if (data.data.avatarUrl) {
|
|
@@ -1521,9 +1540,7 @@ function renderButton(data, params) {
|
|
|
1521
1540
|
if (params == null ? void 0 : params.callback) {
|
|
1522
1541
|
(_a2 = params == null ? void 0 : params.callback) == null ? void 0 : _a2.call(params);
|
|
1523
1542
|
} else if (params.orderInfo) {
|
|
1524
|
-
triggerPostMessageToCore(PPFunctionName.makePayment, true, params, {
|
|
1525
|
-
...params.orderInfo
|
|
1526
|
-
});
|
|
1543
|
+
triggerPostMessageToCore(PPFunctionName.makePayment, true, params, __spreadValues({}, params.orderInfo));
|
|
1527
1544
|
}
|
|
1528
1545
|
});
|
|
1529
1546
|
}
|
|
@@ -1586,12 +1603,12 @@ const proxy = new Proxy(clientFunctions, {
|
|
|
1586
1603
|
throw new Error(`${functionName} is not supported by Mini Apps JS SDK`);
|
|
1587
1604
|
}
|
|
1588
1605
|
}
|
|
1589
|
-
return
|
|
1606
|
+
return (params) => __async(this, null, function* () {
|
|
1590
1607
|
var _a, _b;
|
|
1591
|
-
if (!initExemptedFunctions.includes(functionName) && !
|
|
1608
|
+
if (!initExemptedFunctions.includes(functionName) && !(yield initDonePromise)) {
|
|
1592
1609
|
if (autoInitFunctions.includes(functionName) && params.clientId) {
|
|
1593
1610
|
init({ clientId: params.clientId, env: params.env });
|
|
1594
|
-
|
|
1611
|
+
yield initDonePromise;
|
|
1595
1612
|
} else {
|
|
1596
1613
|
(_a = params.fail) == null ? void 0 : _a.call(params, { errorCode: MiniAppErrorType.sdkNotInitialized });
|
|
1597
1614
|
(_b = params.complete) == null ? void 0 : _b.call(params);
|
|
@@ -1607,7 +1624,7 @@ const proxy = new Proxy(clientFunctions, {
|
|
|
1607
1624
|
params,
|
|
1608
1625
|
params
|
|
1609
1626
|
);
|
|
1610
|
-
};
|
|
1627
|
+
});
|
|
1611
1628
|
}
|
|
1612
1629
|
});
|
|
1613
1630
|
function executePendingFunctionCalls() {
|
|
@@ -1621,7 +1638,10 @@ function executePendingFunctionCalls() {
|
|
|
1621
1638
|
}
|
|
1622
1639
|
}
|
|
1623
1640
|
executePendingFunctionCalls();
|
|
1624
|
-
proxy.revision = "
|
|
1641
|
+
proxy.revision = "66ade73";
|
|
1642
|
+
const client = proxy;
|
|
1643
|
+
window._pp = client;
|
|
1644
|
+
const miniAppSdk = client;
|
|
1625
1645
|
export {
|
|
1626
|
-
|
|
1646
|
+
miniAppSdk as default
|
|
1627
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);
|
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 {};
|
package/dist/utils/api.d.ts
CHANGED
|
@@ -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: {
|
package/dist/utils/fetch.d.ts
CHANGED
package/dist/utils/helper.d.ts
CHANGED
|
@@ -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>;
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paypay/mini-app-js-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
|
-
"build": "yarn build:client && yarn build:core && yarn build:init
|
|
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.
|
|
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",
|