@paypay/mini-app-js-sdk 2.51.0 → 2.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/composition-api/useMakePayment.d.ts +1 -1
- package/dist/environment-variables.d.ts +1 -0
- package/dist/mini-app-js-sdk.browser.js +1 -1
- package/dist/mini-app-js-sdk.es.js +228 -2132
- package/dist/resources/images.d.ts +1 -0
- package/dist/types/getTransactions.d.ts +5 -0
- package/dist/types/makePayment.d.ts +5 -8
- package/dist/types.d.ts +2 -7
- package/dist/utils/api.d.ts +19 -76
- package/dist/utils/helper.d.ts +7 -4
- package/dist/utils/windowBridge.d.ts +15 -2
- package/package.json +1 -1
|
@@ -8,3 +8,4 @@ export declare const SENTRY_DSN: string | undefined;
|
|
|
8
8
|
export declare const SENTRY_SAMPLE_RATE: number;
|
|
9
9
|
export declare const GA_API_SECRET: string | undefined;
|
|
10
10
|
export declare const GA_MEASUREMENT_ID: string | undefined;
|
|
11
|
+
export declare const IMAGE_URL: string | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
!function(){"use strict";try{if("undefined"!=typeof document){var p=document.createElement("style");p.appendChild(document.createTextNode(".ppmna-reset-css{all:initial}.ppmna-reset-css *{text-align:unset;color:unset;background:initial;background-color:transparent;margin:revert;padding:revert;font-weight:revert;font-style:unset;font-size:unset;-webkit-user-select:none;user-select:none;border:unset;border-radius:revert;vertical-align:unset;word-break:unset;outline:none;box-sizing:content-box}.ppmna-reset-css * img{display:inline-block}.ppmna-reset-css * input,.ppmna-reset-css * select{-webkit-user-select:auto;user-select:auto}.ppmna-reset-css * li{list-style:none}.ppmna-reset-css * :where(*:not(svg,svg *)){all:revert}.pp-smartButtonWrapper .pp-smartBtn{display:flex;align-items:center;border-radius:8px;border:none;font-size:14px;font-weight:600;line-height:22px;color:#fff;padding:0;width:100%;height:44px;margin:auto;-webkit-tap-highlight-color:transparent;text-decoration:none;box-sizing:border-box}.pp-smartButtonWrapper .pp-smartBtn.pp-sm .pp-leftSection .pp-btnContent{flex-direction:column}.pp-smartButtonWrapper .pp-smartBtn.pp-light{background:#fff;color:#242323}.pp-smartButtonWrapper .pp-smartBtn.pp-dark{background:#000}.pp-smartButtonWrapper .pp-smartBtn.pp-red{background:#f03}.pp-smartButtonWrapper .pp-smartBtn.pp-login{min-width:180px}.pp-smartButtonWrapper .pp-smartBtn.pp-login.pp-sm{width:180px!important}.pp-smartButtonWrapper .pp-smartBtn.pp-login.pp-light{border:1px solid #e4e4e8}.pp-smartButtonWrapper .pp-smartBtn.pp-login.pp-light .pp-userProfile{margin-right:4px}.pp-smartButtonWrapper .pp-smartBtn.pp-login .pp-leftSection .pp-btnContent{display:grid}.pp-smartButtonWrapper .pp-smartBtn.pp-pay{min-width:160px}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-light{border:1px solid #dddddd}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-light .pp-cashbackInfo{color:#ff954c;background:#fff0e5}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-red .pp-cashbackInfo{color:#f03}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-ja .pp-cashbackInfo{padding:2px 16px}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-sm{width:160px!important}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-sm.pp-cashback{height:66px;flex-direction:column;justify-content:center}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-sm .pp-cashbackInfo{margin:8px 0 0}.pp-smartButtonWrapper .pp-smartBtn.pp-pay .pp-leftSection .pp-img{width:24px;height:24px}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-shortText{font-size:16px}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-sm .pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-cashback .pp-leftSection .pp-btnContent,.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-shortText .pp-leftSection .pp-btnContent{margin-left:4px}.pp-smartButtonWrapper .pp-smartBtn .pp-leftSection{display:flex;justify-content:center;align-items:center;width:100%;box-sizing:border-box;padding:0 8px}.pp-smartButtonWrapper .pp-smartBtn .pp-leftSection .pp-img{width:20px;height:20px;display:inline-block}.pp-smartButtonWrapper .pp-smartBtn .pp-leftSection .pp-btnContent{margin-left:8px}.pp-smartButtonWrapper .pp-smartBtn .pp-leftSection .pp-btnContent .pp-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pp-smartButtonWrapper .pp-smartBtn .pp-cashbackInfo{font-size:12px;color:#242323;background:#fff;line-height:14px;padding:2px 8px;border-radius:9px;margin-left:8px}.pp-smartButtonWrapper .pp-smartBtn .pp-userProfile{width:34px;height:34px;border-radius:50%;margin-right:5px}.pp-smartButtonWrapper.pp-button{padding:0;margin:0;background:none;border:none;width:100%;border-radius:8px;-webkit-tap-highlight-color:transparent;font-family:revert!important}.pp-smartButtonWrapper.pp-button *{font-family:revert!important}")),document.head.appendChild(p)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();
|
|
2
|
-
var pp=function(){"use strict";var e=Object.defineProperty,t=Object.defineProperties,s=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,o=(t,s,r)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r,a=(e,t)=>{for(var s in t||(t={}))n.call(t,s)&&o(e,s,t[s]);if(r)for(var s of r(t))i.call(t,s)&&o(e,s,t[s]);return e},c=(e,r)=>t(e,s(r)),l=(e,t,s)=>new Promise(((r,n)=>{var i=e=>{try{a(s.next(e))}catch(t){n(t)}},o=e=>{try{a(s.throw(e))}catch(t){n(t)}},a=e=>e.done?r(e.value):Promise.resolve(e.value).then(i,o);a((s=s.apply(e,t)).next())}));function d(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)e[r]=s[r]}return e}var u=function e(t,s){function r(e,r,n){if("undefined"!=typeof document){"number"==typeof(n=d({},s,n)).expires&&(n.expires=new Date(Date.now()+864e5*n.expires)),n.expires&&(n.expires=n.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var i="";for(var o in n)n[o]&&(i+="; "+o,!0!==n[o]&&(i+="="+n[o].split(";")[0]));return document.cookie=e+"="+t.write(r,e)+i}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var s=document.cookie?document.cookie.split("; "):[],r={},n=0;n<s.length;n++){var i=s[n].split("="),o=i.slice(1).join("=");try{var a=decodeURIComponent(i[0]);if(r[a]=t.read(o,a),e===a)break}catch(c){}}return e?r[e]:r}},remove:function(e,t){r(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(s)},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:"/"}),h=(e=>(e.accessToken="ppjssdk.accessToken",e.refreshToken="ppjssdk.refreshToken",e.env="ppjssdk.env",e.deviceUUID="ppjssdk.deviceUUID",e.clientUUID="ppjssdk.clientUUID",e.lastPayment="ppjssdk.lastPayment",e.lastTopup="ppjssdk.lastTopup",e.appDetail="ppjssdk.appDetail",e.appConfig="ppjssdk.appConfig",e.userInfo="ppjssdk.userInfo",e.lastPaymentMethod="ppjssdk.lastPaymentMethod",e.lastTopupPayMethod="ppjssdk.lastTopupPayMethod",e.codeVerifier="ppjssdk.codeVerifier",e.clientOrigin="ppjssdk.clientOrigin",e.clientVersion="ppjssdk.clientVersion",e.debugMode="ppjssdk.debugMode",e.claimCouponImmediately="ppjssdk.claimCouponImmediately",e.merchant="ppjssdk.merchant",e.consumedOTT="ppjssdk.consumedOTT",e.initializedAt="ppjssdk.initializedAt",e))(h||{});const p="success",g="fail",m="complete",f="init",_="verifyMultiFactorAuthResult",v="share",S="scanCode",b="handleMessageFromNative",y="getKycPassportInfo",w="reload",E="link",I="makeVisible",A="consoleDebugInfo",M="clientPopState";var N=(e=>(e.MiniApp="MiniApp",e.SmartPayment="SmartPayment",e))(N||{});const O="_PayPayJsBridge",k=["init","openWebview","openMap","closeApp","makePayment","topup","setSessionData","getSessionData","setStorageData","getStorageData","removeStorageData","getPermissionStatus","scanCode","showAlert","showErrorSheet","getTopBarHeight","setTitle","showUpdateWarning","getPlatformInformation","openApp","share","getKycInformation","getUserLocation","checkPaymentMethod","registerKyc","startMultiFactorAuth","verifyMultiFactorAuthResult","getBankInfo","logout","getUserProfile","getBalance","getUserAddress","getUAID","copyToClipboard","registerUserInfo","setEnablePullDownRefresh","registerEmail","inputAddress","getDeviceInformation","request","requestInternal","registerPaymentFeatures","initKycPassport","getKycPassportInfo","shortcutExists","addShortcut","getAllUserAddresses","getUserPaymentFeatureSettings","getPaymentSettings","getTransactionInfo","getTransactions","getPayPayCardInfo","getExternalLinkageInformation","markAsReady","renderCoupons"],T=["init","createOrder","makePayment","render","logout","getAuthStatus","getUserProfile","getBalance","getUserAddress","getUAID","getCashbackInformation","renderCoupons","getLoginUrl"];class C extends Error{constructor(e,t){super(e),this.errorCode=t}}var P=(e=>(e.success="SUCCESS",e.invalidUrl="INVALID_URL",e.invalidData="INVALID_DATA",e.invalidHeader="INVALID_HEADER",e.invalidMethod="INVALID_METHOD",e.invalidPath="INVALID_PATH",e.notReachable="NOT_REACHABLE",e.notAvailable="NOT_AVAILABLE",e.timeOut="TIME_OUT",e.whiteListError="NONE_WHITELIST_DOMAIN",e.statusCodeError="STATUS_CODE_ERROR",e.invalidResponse="INVALID_RESPONSE",e.noLocationPermission="NO_USER_LOCATION_PERMISSION",e.noPermissionListAvailable="NO_PERMISSION_LIST_AVAILABLE",e.other="other",e.serverError="SERVER_ERROR",e.noCameraPermission="HOST_APP_CAMERA_DENIED",e.noAlbumPermission="HOST_APP_ALBUM_DENIED",e.insufficientScope="INSUFFICIENT_SCOPE",e.userCanceled="USER_CANCELED",e.invalidJSAPIParams="INVALID_JS_API_PARAMS",e.hostAppLocationDenied="HOST_APP_LOCATION_DENIED",e.hostAppContactsDenied="HOST_APP_READING_CONTACT_DENIED",e.badRequestInsufficientParameter="BAD_REQUEST_INSUFFICIENT_PARAMETER",e.badRequest="BAD_REQUEST",e.paymentFail="PAYMENT_FAIL",e.topupFail="TOPUP_FAIL",e.topupSuccessButNotAddToBalance="TOPUP_SUCCESS_BUT_NOT_ADD_TO_BALANCE",e.userCanceledSimilarTxn="USER_CANCELED_SIMILAR_TRANSACTION",e.mapAppNotFound="MAP_APP_NOT_FOUND",e.invalidAppSchemeURL="INVALID_APP_SCHEME_URL",e.noValueFound="NO_VALUE_FOUND",e.securityNotSetup="SECURITY_NOT_SETUP",e.userDenied="USER_DENIED",e.securityTemporaryLocked="SECURITY_TEMPORARY_LOCKED",e.couldNotGenerateBarcode="COULD_NOT_GENERATE_BARCODE",e.cannotDetectAvailability="CAN_NOT_DETECT_AVAILABILITY",e.suspectedDuplicatePayment="SUSPECTED_DUPLICATE_PAYMENT",e.noSufficientFund="NO_SUFFICIENT_FUND",e.unknown="UNKNOWN",e.sdkNotInitialized="SDK_NOT_INITIALIZED",e.tokenNotFound="TOKEN_NOT_FOUND",e.tokenExpired="TOKEN_EXPIRED",e.activeRequestExists="ACTIVE_REQUEST_EXISTS",e.invalidType="INVALID_TYPE",e.sessionNotFound="SESSION_NOT_FOUND",e.cookieError="COOKIE_ERROR",e.notAuthorized="NOT_AUTHORIZED",e.permissionRequired="PERMISSION_REQUIRED",e.deeplinkUnavailable="DEEPLINK_UNAVAILABLE",e.kycIncompleted="KYC_INCOMPLETED",e.noBankAccount="NO_BANK_ACCOUNT",e.invalidPaymentIdentifier="INVALID_PAYMENT_IDENTIFIER",e.otpSendTooShort="OTP_SEND_TOO_SHORT",e.otpSendOverLimit="OTP_SEND_OVER_LIMIT",e.userVerificationFailure="USER_VERIFICATION_FAILURE",e.unacceptableOp="UNACCEPTABLE_OP",e.kycUpdateRequired="KYC_UPDATE_REQUIRED",e.notCompleted="NOT_COMPLETED",e.kycValidationInProcess="KYC_VALIDATION_IN_PROCESS",e.noLocationData="NO_LOCATION_DATA",e.functionNotFound="FUNCTION_NOT_FOUND",e.originNotAllowed="ORIGIN_NOT_ALLOWED",e.messageSendingFailed="MESSAGE_SENDING_FAILED",e.transactionNotFound="TRANSACTION_NOT_FOUND",e.unexpectedOperation="UNEXPECTED_OP",e.merchantTimeout="MERCHANT_TIMEOUT",e.rateLimitExceeded="RATE_LIMIT_EXCEEDED",e.sdkUpgradeRequired="SDK_UPGRADE_REQUIRED",e.authorizationNeeded="AUTHORIZATION_NEEDED",e.invalidVirtualAccount="INVALID_VIRTUAL_ACCOUNT",e))(P||{});const R="2.51.0",F=new URL("https://mini-app-sdk-core.paypay.ne.jp/"),L=F.origin,D=new URL(`./iframe.html?v=${R}&rev=9c03362`,F).href,x=new URL(`./coupon/iframe.html?v=${R}`,F).href,B="8.45.1",U=globalThis;function V(e,t,s){const r=U,n=r.__SENTRY__=r.__SENTRY__||{},i=n[B]=n[B]||{};return i[e]||(i[e]=t())}const j="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,W=["debug","info","warn","error","log","assert","trace"],z={};function q(e){if(!("console"in U))return e();const t=U.console,s={},r=Object.keys(z);r.forEach((e=>{const r=z[e];s[e]=t[e],t[e]=r}));try{return e()}finally{r.forEach((e=>{t[e]=s[e]}))}}const H=V("logger",(function(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return j?W.forEach((s=>{t[s]=(...t)=>{e&&q((()=>{U.console[s](`Sentry Logger [${s}]:`,...t)}))}})):W.forEach((e=>{t[e]=()=>{}})),t}));function K(){return $(U),U}function $(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||B,t[B]=t[B]||{}}const G=Object.prototype.toString;function Q(e){return function(e,t){return G.call(e)===`[object ${t}]`}(e,"Object")}function Y(){return Date.now()/1e3}const J=function(){const{performance:e}=U;if(!e||!e.now)return Y;const t=Date.now()-e.now(),s=null==e.timeOrigin?t:e.timeOrigin;return()=>(s+e.now())/1e3}();function Z(){const e=U,t=e.crypto||e.msCrypto;let s=()=>16*Math.random();try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(s=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch(r){}return"10000000100040008000100000000000".replace(/[018]/g,(e=>(e^(15&s())>>e/4).toString(16)))}function X(){return Z()}function ee(){return Z().substring(16)}function te(e,t,s=2){if(!t||"object"!=typeof t||s<=0)return t;if(e&&t&&0===Object.keys(t).length)return e;const r=a({},e);for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=te(r[n],t[n],s-1));return r}(()=>{const{performance:e}=U;if(!e||!e.now)return;const t=36e5,s=e.now(),r=Date.now(),n=e.timeOrigin?Math.abs(e.timeOrigin+s-r):t,i=n<t,o=e.timing&&e.timing.navigationStart,a="number"==typeof o?Math.abs(o+s-r):t;(i||a<t)&&(n<=a&&e.timeOrigin)})();const se="_sentrySpan";function re(e,t){t?function(e,t,s){try{Object.defineProperty(e,t,{value:s,writable:!0,configurable:!0})}catch(r){j&&H.log(`Failed to add non-enumerable property "${t}" to object`,e)}}(e,se,t):delete e[se]}function ne(e){return e[se]}class ie{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:X(),spanId:ee()}}clone(){const e=new ie;return e._breadcrumbs=[...this._breadcrumbs],e._tags=a({},this._tags),e._extra=a({},this._extra),e._contexts=a({},this._contexts),this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata=a({},this._sdkProcessingMetadata),e._propagationContext=a({},this._propagationContext),e._client=this._client,e._lastEventId=this._lastEventId,re(e,ne(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&function(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),e.did||t.did||(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||J(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:Z()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{const t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags=a(a({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,t){return this._tags=c(a({},this._tags),{[e]:t}),this._notifyScopeListeners(),this}setExtras(e){return this._extra=a(a({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,t){return this._extra=c(a({},this._extra),{[e]:t}),this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return null===t?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t="function"==typeof e?e(this):e,[s,r]=t instanceof oe?[t.getScopeData(),t.getRequestSession()]:Q(t)?[e,e.requestSession]:[],{tags:n,extra:i,user:o,contexts:c,level:l,fingerprint:d=[],propagationContext:u}=s||{};return this._tags=a(a({},this._tags),n),this._extra=a(a({},this._extra),i),this._contexts=a(a({},this._contexts),c),o&&Object.keys(o).length&&(this._user=o),l&&(this._level=l),d.length&&(this._fingerprint=d),u&&(this._propagationContext=u),r&&(this._requestSession=r),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,re(this,void 0),this._attachments=[],this.setPropagationContext({traceId:X()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const s="number"==typeof t?t:100;if(s<=0)return this;const r=a({timestamp:Y()},e),n=this._breadcrumbs;return n.push(r),this._breadcrumbs=n.length>s?n.slice(-s):n,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:ne(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=te(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=a({spanId:ee()},e),this}getPropagationContext(){return this._propagationContext}captureException(e,t){const s=t&&t.event_id?t.event_id:Z();if(!this._client)return H.warn("No client configured on scope - will not capture exception!"),s;const r=new Error("Sentry syntheticException");return this._client.captureException(e,c(a({originalException:e,syntheticException:r},t),{event_id:s}),this),s}captureMessage(e,t,s){const r=s&&s.event_id?s.event_id:Z();if(!this._client)return H.warn("No client configured on scope - will not capture message!"),r;const n=new Error(e);return this._client.captureMessage(e,t,c(a({originalException:e,syntheticException:n},s),{event_id:r}),this),r}captureEvent(e,t){const s=t&&t.event_id?t.event_id:Z();return this._client?(this._client.captureEvent(e,c(a({},t),{event_id:s}),this),s):(H.warn("No client configured on scope - will not capture event!"),s)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}}const oe=ie;class ae{constructor(e,t){let s,r;s=e||new oe,r=t||new oe,this._stack=[{scope:s}],this._isolationScope=r}withScope(e){const t=this._pushScope();let s;try{s=e(t)}catch(n){throw this._popScope(),n}return r=s,Boolean(r&&r.then&&"function"==typeof r.then)?s.then((e=>(this._popScope(),e)),(e=>{throw this._popScope(),e})):(this._popScope(),s);var r}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return!(this._stack.length<=1)&&!!this._stack.pop()}}function ce(){const e=$(K());return e.stack=e.stack||new ae(V("defaultCurrentScope",(()=>new oe)),V("defaultIsolationScope",(()=>new oe)))}function le(e){return ce().withScope(e)}function de(e,t){const s=ce();return s.withScope((()=>(s.getStackTop().scope=e,t(e))))}function ue(e){return ce().withScope((()=>e(ce().getIsolationScope())))}function he(e){const t=$(e);return t.acs?t.acs:{withIsolationScope:ue,withScope:le,withSetScope:de,withSetIsolationScope:(e,t)=>ue(t),getCurrentScope:()=>ce().getScope(),getIsolationScope:()=>ce().getIsolationScope()}}function pe(){return he(K()).getCurrentScope()}const ge=100;function me(e,t){const s=pe().getClient(),r=he(K()).getIsolationScope();if(!s)return;const{beforeBreadcrumb:n=null,maxBreadcrumbs:i=ge}=s.getOptions();if(i<=0)return;const o=Y(),c=a({timestamp:o},e),l=n?q((()=>n(c,t))):c;null!==l&&(s.emit&&s.emit("beforeAddBreadcrumb",l,t),r.addBreadcrumb(l,i))}const fe=[P.sdkNotInitialized,P.notAuthorized,P.userCanceled,P.userCanceledSimilarTxn,P.suspectedDuplicatePayment,P.noSufficientFund];function _e(e,t,s){fe.includes(s)||function(e,t){const s=t;pe().captureMessage(e,s,void 0)}(`windowBridge.${e} failed. error: ${s}, message: ${t}`,"log")}function ve(e){me(e)}const Se=e=>"object"!=typeof e||null===e?e:JSON.parse(JSON.stringify(e));class be{constructor(e,t,s=[]){this.deferredCallbacks={},this.functions=e,this.allowedOrigins=t,this.middlewares=s,this.messageEventHandler=this.messageEventHandler.bind(this),this.subscribeToMessageEvent()}subscribeToMessageEvent(){window.addEventListener("message",this.messageEventHandler)}unsubscribeToMessageEvent(){window.removeEventListener("message",this.messageEventHandler)}messageEventHandler(e){var t;if(null==(t=e.data)?void 0:t.forWindowBridge)return this.allowedOrigins&&"request"===e.data.type&&!this.allowedOrigins.includes(e.origin)?this.sendErrorResponse(e,`${e.origin} is not allowed to make requests`,P.originNotAllowed):void("request"===e.data.type?this.handleRequest(e):"response"===e.data.type&&this.handleResponse(e))}handleRequest(e){return l(this,null,(function*(){var t;const s=e.data.functionName,r=this.functions[s];r||this.sendErrorResponse(e,`Function '${s}' does not exists on the target window`,P.functionNotFound);try{this.sendSuccessResponse(e,yield function(e,t,s,r){let n=-1;const i=r=>l(this,null,(function*(){if(++n,n<e.length){const s=e[n];return yield s(t,r,i)}return s(...r)}));return i(r)}([...this.middlewares,...null!=(t=r.middlewares)?t:[]],e,r,Se(e.data.params)))}catch(n){let t="Some error occurred while processing the request",s=P.unknown;n instanceof C?(t=n.message,s=n.errorCode):console.error(n),this.sendErrorResponse(e,t,s)}}))}handleResponse(e){if(!this.deferredCallbacks[e.data.key])return void console.warn(`Callback for ${e.data.functionName} not found`);const[t,s]=this.deferredCallbacks[e.data.key];delete this.deferredCallbacks[e.data.key],"success"===e.data.status?t(e.data.result):s(new C(e.data.message,e.data.errorCode))}sendErrorResponse(e,t,s){_e(e.data.functionName,t,s),this.sendResponse(e,{status:"failure",message:t,errorCode:s})}sendSuccessResponse(e,t){this.sendResponse(e,{status:"success",result:t})}sendResponse(e,t){var s;null==(s=e.source)||s.postMessage(a({forWindowBridge:!0,type:"response",key:e.data.key,functionName:e.data.functionName},Se(t)),e.origin)}static init(e,t,s=[]){if(this._instance)throw new Error("WindowBridge already initialized, you can't call WindowBridge.init more than once");return this._instance=new this(e,t,s),this._instance}static destroy(){this._instance&&(this._instance.unsubscribeToMessageEvent(),this._instance=void 0)}static getBridge(){if(!this._instance)throw new Error("WindowBridge not initialized, please call WindowBridge.init before calling WindowBridge.getBridge");return this._instance}static getTargetWindowFunctionProxy(e,t){return be.getBridge().getTargetWindowFunctionProxy(e,t)}getTargetWindowFunctionProxy(e,t){return new Proxy(this,{get(s,r){return(...n)=>new Promise(((i,o)=>l(this,null,(function*(){const a=r.toString(),c=`${a}--${xe()}`;try{const r=yield e();if(!r)throw new Error("Target window is undefined");s.deferredCallbacks[c]=[i,o],r.postMessage({forWindowBridge:!0,type:"request",functionName:a,key:c,params:Se(n)},t)}catch(l){delete s.deferredCallbacks[c],o(new C(l.message,P.messageSendingFailed))}}))))}})}}const ye={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},we={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},Ee={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},Ie={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},Ae={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class Me{static getFirstMatch(e,t){const s=t.match(e);return s&&s.length>0&&s[1]||""}static getSecondMatch(e,t){const s=t.match(e);return s&&s.length>1&&s[2]||""}static matchAndReturnConst(e,t,s){if(e.test(t))return s}static getWindowsVersionName(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(e){const t=e.split(".").splice(0,2).map((e=>parseInt(e,10)||0));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(e){const t=e.split(".").splice(0,2).map((e=>parseInt(e,10)||0));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,t,s=!1){const r=Me.getVersionPrecision(e),n=Me.getVersionPrecision(t);let i=Math.max(r,n),o=0;const a=Me.map([e,t],(e=>{const t=i-Me.getVersionPrecision(e),s=e+new Array(t+1).join(".0");return Me.map(s.split("."),(e=>new Array(20-e.length).join("0")+e)).reverse()}));for(s&&(o=i-Math.min(r,n)),i-=1;i>=o;){if(a[0][i]>a[1][i])return 1;if(a[0][i]===a[1][i]){if(i===o)return 0;i-=1}else if(a[0][i]<a[1][i])return-1}}static map(e,t){const s=[];let r;if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r+=1)s.push(t(e[r]));return s}static find(e,t){let s,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(s=0,r=e.length;s<r;s+=1){const r=e[s];if(t(r,s))return r}}static assign(e,...t){const s=e;let r,n;if(Object.assign)return Object.assign(e,...t);for(r=0,n=t.length;r<n;r+=1){const e=t[r];if("object"==typeof e&&null!==e){Object.keys(e).forEach((t=>{s[t]=e[t]}))}}return e}static getBrowserAlias(e){return ye[e]}static getBrowserTypeByAlias(e){return we[e]||""}}const Ne=/version\/(\d+(\.?_?\d+)+)/i,Oe=[{test:[/googlebot/i],describe(e){const t={name:"Googlebot"},s=Me.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||Me.getFirstMatch(Ne,e);return s&&(t.version=s),t}},{test:[/opera/i],describe(e){const t={name:"Opera"},s=Me.getFirstMatch(Ne,e)||Me.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/opr\/|opios/i],describe(e){const t={name:"Opera"},s=Me.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||Me.getFirstMatch(Ne,e);return s&&(t.version=s),t}},{test:[/SamsungBrowser/i],describe(e){const t={name:"Samsung Internet for Android"},s=Me.getFirstMatch(Ne,e)||Me.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/Whale/i],describe(e){const t={name:"NAVER Whale Browser"},s=Me.getFirstMatch(Ne,e)||Me.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/MZBrowser/i],describe(e){const t={name:"MZ Browser"},s=Me.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||Me.getFirstMatch(Ne,e);return s&&(t.version=s),t}},{test:[/focus/i],describe(e){const t={name:"Focus"},s=Me.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||Me.getFirstMatch(Ne,e);return s&&(t.version=s),t}},{test:[/swing/i],describe(e){const t={name:"Swing"},s=Me.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||Me.getFirstMatch(Ne,e);return s&&(t.version=s),t}},{test:[/coast/i],describe(e){const t={name:"Opera Coast"},s=Me.getFirstMatch(Ne,e)||Me.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(e){const t={name:"Opera Touch"},s=Me.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||Me.getFirstMatch(Ne,e);return s&&(t.version=s),t}},{test:[/yabrowser/i],describe(e){const t={name:"Yandex Browser"},s=Me.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||Me.getFirstMatch(Ne,e);return s&&(t.version=s),t}},{test:[/ucbrowser/i],describe(e){const t={name:"UC Browser"},s=Me.getFirstMatch(Ne,e)||Me.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/Maxthon|mxios/i],describe(e){const t={name:"Maxthon"},s=Me.getFirstMatch(Ne,e)||Me.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/epiphany/i],describe(e){const t={name:"Epiphany"},s=Me.getFirstMatch(Ne,e)||Me.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/puffin/i],describe(e){const t={name:"Puffin"},s=Me.getFirstMatch(Ne,e)||Me.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/sleipnir/i],describe(e){const t={name:"Sleipnir"},s=Me.getFirstMatch(Ne,e)||Me.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/k-meleon/i],describe(e){const t={name:"K-Meleon"},s=Me.getFirstMatch(Ne,e)||Me.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/micromessenger/i],describe(e){const t={name:"WeChat"},s=Me.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||Me.getFirstMatch(Ne,e);return s&&(t.version=s),t}},{test:[/qqbrowser/i],describe(e){const t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},s=Me.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||Me.getFirstMatch(Ne,e);return s&&(t.version=s),t}},{test:[/msie|trident/i],describe(e){const t={name:"Internet Explorer"},s=Me.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/\sedg\//i],describe(e){const t={name:"Microsoft Edge"},s=Me.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/edg([ea]|ios)/i],describe(e){const t={name:"Microsoft Edge"},s=Me.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/vivaldi/i],describe(e){const t={name:"Vivaldi"},s=Me.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/seamonkey/i],describe(e){const t={name:"SeaMonkey"},s=Me.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/sailfish/i],describe(e){const t={name:"Sailfish"},s=Me.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return s&&(t.version=s),t}},{test:[/silk/i],describe(e){const t={name:"Amazon Silk"},s=Me.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/phantom/i],describe(e){const t={name:"PhantomJS"},s=Me.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/slimerjs/i],describe(e){const t={name:"SlimerJS"},s=Me.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t={name:"BlackBerry"},s=Me.getFirstMatch(Ne,e)||Me.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/(web|hpw)[o0]s/i],describe(e){const t={name:"WebOS Browser"},s=Me.getFirstMatch(Ne,e)||Me.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/bada/i],describe(e){const t={name:"Bada"},s=Me.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/tizen/i],describe(e){const t={name:"Tizen"},s=Me.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||Me.getFirstMatch(Ne,e);return s&&(t.version=s),t}},{test:[/qupzilla/i],describe(e){const t={name:"QupZilla"},s=Me.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||Me.getFirstMatch(Ne,e);return s&&(t.version=s),t}},{test:[/firefox|iceweasel|fxios/i],describe(e){const t={name:"Firefox"},s=Me.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/electron/i],describe(e){const t={name:"Electron"},s=Me.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/MiuiBrowser/i],describe(e){const t={name:"Miui"},s=Me.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/chromium/i],describe(e){const t={name:"Chromium"},s=Me.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||Me.getFirstMatch(Ne,e);return s&&(t.version=s),t}},{test:[/chrome|crios|crmo/i],describe(e){const t={name:"Chrome"},s=Me.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/GSA/i],describe(e){const t={name:"Google Search"},s=Me.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test(e){const t=!e.test(/like android/i),s=e.test(/android/i);return t&&s},describe(e){const t={name:"Android Browser"},s=Me.getFirstMatch(Ne,e);return s&&(t.version=s),t}},{test:[/playstation 4/i],describe(e){const t={name:"PlayStation 4"},s=Me.getFirstMatch(Ne,e);return s&&(t.version=s),t}},{test:[/safari|applewebkit/i],describe(e){const t={name:"Safari"},s=Me.getFirstMatch(Ne,e);return s&&(t.version=s),t}},{test:[/.*/i],describe(e){const t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:Me.getFirstMatch(t,e),version:Me.getSecondMatch(t,e)}}}],ke=[{test:[/Roku\/DVP/],describe(e){const t=Me.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:Ie.Roku,version:t}}},{test:[/windows phone/i],describe(e){const t=Me.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:Ie.WindowsPhone,version:t}}},{test:[/windows /i],describe(e){const t=Me.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),s=Me.getWindowsVersionName(t);return{name:Ie.Windows,version:t,versionName:s}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(e){const t={name:Ie.iOS},s=Me.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return s&&(t.version=s),t}},{test:[/macintosh/i],describe(e){const t=Me.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),s=Me.getMacOSVersionName(t),r={name:Ie.MacOS,version:t};return s&&(r.versionName=s),r}},{test:[/(ipod|iphone|ipad)/i],describe(e){const t=Me.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:Ie.iOS,version:t}}},{test(e){const t=!e.test(/like android/i),s=e.test(/android/i);return t&&s},describe(e){const t=Me.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),s=Me.getAndroidVersionName(t),r={name:Ie.Android,version:t};return s&&(r.versionName=s),r}},{test:[/(web|hpw)[o0]s/i],describe(e){const t=Me.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),s={name:Ie.WebOS};return t&&t.length&&(s.version=t),s}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t=Me.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||Me.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||Me.getFirstMatch(/\bbb(\d+)/i,e);return{name:Ie.BlackBerry,version:t}}},{test:[/bada/i],describe(e){const t=Me.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:Ie.Bada,version:t}}},{test:[/tizen/i],describe(e){const t=Me.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:Ie.Tizen,version:t}}},{test:[/linux/i],describe:()=>({name:Ie.Linux})},{test:[/CrOS/],describe:()=>({name:Ie.ChromeOS})},{test:[/PlayStation 4/],describe(e){const t=Me.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:Ie.PlayStation4,version:t}}}],Te=[{test:[/googlebot/i],describe:()=>({type:"bot",vendor:"Google"})},{test:[/huawei/i],describe(e){const t=Me.getFirstMatch(/(can-l01)/i,e)&&"Nova",s={type:Ee.mobile,vendor:"Huawei"};return t&&(s.model=t),s}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:()=>({type:Ee.tablet,vendor:"Nexus"})},{test:[/ipad/i],describe:()=>({type:Ee.tablet,vendor:"Apple",model:"iPad"})},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:()=>({type:Ee.tablet,vendor:"Apple",model:"iPad"})},{test:[/kftt build/i],describe:()=>({type:Ee.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"})},{test:[/silk/i],describe:()=>({type:Ee.tablet,vendor:"Amazon"})},{test:[/tablet(?! pc)/i],describe:()=>({type:Ee.tablet})},{test(e){const t=e.test(/ipod|iphone/i),s=e.test(/like (ipod|iphone)/i);return t&&!s},describe(e){const t=Me.getFirstMatch(/(ipod|iphone)/i,e);return{type:Ee.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:()=>({type:Ee.mobile,vendor:"Nexus"})},{test:[/[^-]mobi/i],describe:()=>({type:Ee.mobile})},{test:e=>"blackberry"===e.getBrowserName(!0),describe:()=>({type:Ee.mobile,vendor:"BlackBerry"})},{test:e=>"bada"===e.getBrowserName(!0),describe:()=>({type:Ee.mobile})},{test:e=>"windows phone"===e.getBrowserName(),describe:()=>({type:Ee.mobile,vendor:"Microsoft"})},{test(e){const t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:()=>({type:Ee.tablet})},{test:e=>"android"===e.getOSName(!0),describe:()=>({type:Ee.mobile})},{test:e=>"macos"===e.getOSName(!0),describe:()=>({type:Ee.desktop,vendor:"Apple"})},{test:e=>"windows"===e.getOSName(!0),describe:()=>({type:Ee.desktop})},{test:e=>"linux"===e.getOSName(!0),describe:()=>({type:Ee.desktop})},{test:e=>"playstation 4"===e.getOSName(!0),describe:()=>({type:Ee.tv})},{test:e=>"roku"===e.getOSName(!0),describe:()=>({type:Ee.tv})}],Ce=[{test:e=>"microsoft edge"===e.getBrowserName(!0),describe(e){if(/\sedg\//i.test(e))return{name:Ae.Blink};const t=Me.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:Ae.EdgeHTML,version:t}}},{test:[/trident/i],describe(e){const t={name:Ae.Trident},s=Me.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:e=>e.test(/presto/i),describe(e){const t={name:Ae.Presto},s=Me.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test(e){const t=e.test(/gecko/i),s=e.test(/like gecko/i);return t&&!s},describe(e){const t={name:Ae.Gecko},s=Me.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/(apple)?webkit\/537\.36/i],describe:()=>({name:Ae.Blink})},{test:[/(apple)?webkit/i],describe(e){const t={name:Ae.WebKit},s=Me.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}}];class Pe{constructor(e,t=!1){if(null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=Me.find(Oe,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.browser=e.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const e=Me.find(ke,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os}getOSName(e){const{name:t}=this.getOS();return e?String(t).toLowerCase()||"":t||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:t}=this.getPlatform();return e?String(t).toLowerCase()||"":t||""}parsePlatform(){this.parsedResult.platform={};const e=Me.find(Te,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const e=Me.find(Ce,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return Me.assign({},this.parsedResult)}satisfies(e){const t={};let s=0;const r={};let n=0;if(Object.keys(e).forEach((i=>{const o=e[i];"string"==typeof o?(r[i]=o,n+=1):"object"==typeof o&&(t[i]=o,s+=1)})),s>0){const e=Object.keys(t),s=Me.find(e,(e=>this.isOS(e)));if(s){const e=this.satisfies(t[s]);if(void 0!==e)return e}const r=Me.find(e,(e=>this.isPlatform(e)));if(r){const e=this.satisfies(t[r]);if(void 0!==e)return e}}if(n>0){const e=Object.keys(r),t=Me.find(e,(e=>this.isBrowser(e,!0)));if(void 0!==t)return this.compareVersion(r[t])}}isBrowser(e,t=!1){const s=this.getBrowserName().toLowerCase();let r=e.toLowerCase();const n=Me.getBrowserTypeByAlias(r);return t&&n&&(r=n.toLowerCase()),r===s}compareVersion(e){let t=[0],s=e,r=!1;const n=this.getBrowserVersion();if("string"==typeof n)return">"===e[0]||"<"===e[0]?(s=e.substr(1),"="===e[1]?(r=!0,s=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?s=e.substr(1):"~"===e[0]&&(r=!0,s=e.substr(1)),t.indexOf(Me.compareVersions(n,s,r))>-1}isOS(e){return this.getOSName(!0)===String(e).toLowerCase()}isPlatform(e){return this.getPlatformType(!0)===String(e).toLowerCase()}isEngine(e){return this.getEngineName(!0)===String(e).toLowerCase()}is(e,t=!1){return this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some((e=>this.is(e)))}}class Re{static getParser(e,t=!1){if("string"!=typeof e)throw new Error("UserAgent should be a string");return new Pe(e,t)}static parse(e){return new Pe(e).getResult()}static get BROWSER_MAP(){return we}static get ENGINE_MAP(){return Ae}static get OS_MAP(){return Ie}static get PLATFORMS_MAP(){return Ee}}class Fe{constructor(){var e;this.useLocalStorage=!0,this.memoryStorage={};try{localStorage.setItem(h.initializedAt,Date.now().toString());for(let t=0;t<localStorage.length;t++){const s=localStorage.key(t);null!=s&&(this.memoryStorage[s]=null!=(e=localStorage.getItem(s))?e:"")}}catch(t){this.useLocalStorage=!1}}getItem(e){var t;if(this.useLocalStorage)try{if(null!=localStorage.getItem(h.initializedAt))return localStorage.getItem(e);console.debug("local storage value has lost unexpectedly."),ve({message:"local storage value has lost unexpectedly.",category:"storage"})}catch(s){}return this.useLocalStorage=!1,null!=(t=this.memoryStorage[e])?t:null}setItem(e,t){if(this.memoryStorage[e]=t,this.useLocalStorage)try{localStorage.setItem(e,t)}catch(s){this.useLocalStorage=!1,console.warn("localStorage has become unavailable.")}}removeItem(e){delete this.memoryStorage[e];try{localStorage.removeItem(e)}catch(t){this.useLocalStorage=!1}}clear(){try{localStorage.clear(),localStorage.setItem(h.initializedAt,Date.now().toString())}catch(e){}this.memoryStorage={}}}function Le(e,t){u.set(e,t,a({expires:365,sameSite:"None"},{secure:!0,Partitioned:!0}))}class De{constructor(){var e;this.useCookie=!0,this.memoryStorage={};try{Le(h.initializedAt,Date.now().toString());const t=u.get();for(const s in t)this.memoryStorage[s]=null!=(e=t[s])?e:""}catch(t){this.useCookie=!1}}getItem(e){var t;if(this.useCookie)try{if(null!=u.get(h.initializedAt)){const t=u.get(e);return null!=t?t:localStorage.getItem(e)}ve({message:"cookie value has lost unexpectedly.",category:"storage"})}catch(s){}return this.useCookie=!1,null!=(t=this.memoryStorage[e])?t:null}setItem(e,t){if(this.memoryStorage[e]=t,this.useCookie)try{Le(e,t),localStorage.removeItem(e)}catch(s){this.useCookie=!1,console.warn("cookie has become unavailable.")}}removeItem(e){delete this.memoryStorage[e];try{u.remove(e),localStorage.removeItem(e)}catch(t){this.useCookie=!1}}clear(){try{localStorage.clear();const e=u.get();for(const t in e)u.remove(t);Le(h.initializedAt,Date.now().toString())}catch(e){}this.memoryStorage={}}}function xe(){return Math.random().toString(36).substring(7)}Re.getParser(window.navigator.userAgent).satisfies({safari:">=18.4",chrome:">=0",edge:">=0"})?new De:new Fe;const Be=Object.freeze(Object.defineProperty({__proto__:null,getCookie:function({name:e}){return u.get(e)},getLocalStorage:function({name:e}){return localStorage.getItem(e)},getSessionStorage:function({name:e}){return sessionStorage.getItem(e)},getUrl:function(){return window.location.href},removeCookie:function({name:e,options:t}){return u.remove(e,t)},removeLocalStorage:function({name:e}){return localStorage.removeItem(e)},removeQueryParametersFromUrl:function(e){const t=new URL(window.location.href);e.forEach((e=>t.searchParams.delete(e)));const s=`${t.pathname}${t.search}`;history.replaceState(history.state,"",s)},removeSessionStorage:function({name:e}){return sessionStorage.removeItem(e)},setCookie:function({name:e,value:t,options:s}){return u.set(e,t,s)},setLocalStorage:function({name:e,value:t}){return localStorage.setItem(e,t)},setSessionStorage:function({name:e,value:t}){return sessionStorage.setItem(e,t)}},Symbol.toStringTag,{value:"Module"})),Ue="ppmna-iframe",Ve="ppsdk-container";let je,We;function ze(){return je||(je=function(){if(document.getElementById(Ue))return;const e=document.createElement("div");return document.createElement("div"),e.setAttribute("id",Ve),e.setAttribute("class",Ve),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}()),je}function qe(e){const t=ze();t&&(t.style.display=e?"initial":"none")}function He(){return We||(We=new Promise(((e,t)=>{function s(){const s=document.createElement("iframe");s.setAttribute("src",D),s.setAttribute("name",Ue),s.setAttribute("id",Ue),s.setAttribute("class",Ue),s.setAttribute("allow","geolocation"),s.onload=()=>{e(s),s.onerror=null},s.onerror=t,s.style.all="initial",s.style.width="100%",s.style.height="100%",s.style.border="none";const r=ze();r&&(r.innerHTML="",r.append(s))}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(()=>{s()})):s()}))),We}be.init(Be,[L]);const Ke=be.getTargetWindowFunctionProxy((function(){return He().then((e=>null==e?void 0:e.contentWindow)).catch((()=>null))}),L);function $e(e,t,s){var r,n,i,o;e.result===g&&(null==(r=null==t?void 0:t.fail)||r.call(t,e.data)),e.result===p&&(null==(n=null==t?void 0:t.success)||n.call(t,null==e?void 0:e.data)),e.result===m&&(null==(i=null==t?void 0:t.complete)||i.call(t),removeEventListener("message",s),o=e.messageId,Ze=Ze.filter((e=>e!==o)),Ze.length>0||qe(!1))}function Ge(e,t,s,r){const n=function(){const e=xe();return Ze.push(e),e}(),i=t=>{Qe(t.origin)&&t.data.name===e&&t.data.messageId===n&&$e(t.data,s,i)};addEventListener("message",i),function(e){l(this,null,(function*(){var t;const s=yield He().catch((()=>{}));null==(t=null==s?void 0:s.contentWindow)||t.postMessage(JSON.parse(JSON.stringify(e)),L)}))}({name:e,params:r,messageId:n})}function Qe(e){return e===L}function Ye(e){return k.includes(e)}function Je(e){return T.includes(e)}let Ze=[];function Xe(e,t,s){return function(r={}){const n=null==s?void 0:s(r);Ke.logEvent(a({event_action:`pp_${e}_called`,event_category_suffix:e},n));const i=t(r);return i.then((t=>{var s;Ke.logEvent(a({event_action:`pp_${e}_success`,event_category_suffix:e},n)),null==(s=r.success)||s.call(r,t)})).catch((t=>{var s;console.error(t.message),Ke.logEvent(a({event_action:`pp_${e}_fail`,event_category_suffix:e,error_value:t.errorCode},n)),null==(s=r.fail)||s.call(r,{errorCode:t.errorCode})})).finally((()=>{var e;null==(e=r.complete)||e.call(r)})),i}}const et={[P.sdkNotInitialized]:P.authorizationNeeded,[P.tokenNotFound]:P.authorizationNeeded,[P.tokenExpired]:P.tokenExpired};let tt,st;He(),st=Promise.resolve(!1);function rt(e){const t=(s=e.clientId,u.get(`${h.refreshToken}.${s}`)||u.get(h.refreshToken)||"");var s;const r=function(e){return u.get(`${h.codeVerifier}.${e}`)||u.get(h.codeVerifier)||""}(e.clientId),n={env:e.env,mode:e.mode,debugMode:e.debugMode,clientId:e.clientId,refreshToken:t,clientVersion:"2.51.0",codeVerifier:r,clientSdkType:tt,clientUrl:window.location.href};let i;const o=new Promise((e=>i=e)),l=()=>{var t;i(!0),null==(t=e.complete)||t.call(e)};st.then((()=>He())).then((()=>{Ge(f,0,c(a({},e),{complete:l}),n)})).catch((()=>{var t;null==(t=e.fail)||t.call(e,{errorCode:P.sdkNotInitialized}),l()})),st=o}addEventListener("message",(e=>{var t;if(!(null==(t=e.data)?void 0:t.forWindowBridge)&&Qe(e.origin))if(e.data.name===w&&window.location.reload(),e.data.name!==I){if(e.data.name===E){const t=e.data.data;"_blank"===t.target?window.open(t.url,"_blank"):window.location.href=t.url}if(e.data.name===A){const{params:t}=e.data.data;!function(e){console.debug(...e)}(t)}}else qe(!0)})),addEventListener("popstate",(()=>{He().then((e=>{var t;const s={name:M};null==(t=null==e?void 0:e.contentWindow)||t.postMessage(s,L)})).catch((e=>console.warn(e)))}));var nt;nt={_handleMessageFromNative:e=>{He().then((t=>{var s;null==(s=null==t?void 0:t.contentWindow)||s.postMessage(JSON.parse(JSON.stringify({name:b,params:{json:e}})),L)}))}},(!window.hasOwnProperty(O)||window[O]!==nt)&&(window[O]=nt);const it=["init","setTitle","copyToClipboard","getSessionData","setSessionData","getStorageData","setStorageData","removeStorageData","getLoginUrl"],ot=["renderCoupons"];const at={version:"2.51.0",revision:"9c03362"};Xe("getLoginUrl",Ke.getLoginUrl);const ct=Xe("getPaymentSettings",Ke.getPaymentSettings),lt=Xe("markAsReady",Ke.markAsReady);var dt=(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))(dt||{});const ut=Xe("logout",(()=>l(this,null,(function*(){try{return yield Ke.logout(),{statusCode:dt.loggedOut}}catch(e){throw new C(`An error occurred while trying to logout the user, error=${e}`,P.unknown)}}))));const ht={verifyMultiFactorAuthResult:function(e){const t=new URL(window.location.href);Ge(_,0,e,c(a({},e),{sessionId:t.searchParams.get("ppSessionId")}))},share:function(e){if(!(null==navigator?void 0:navigator.share))return void Ge(v,0,e,e);const t={text:null==e?void 0:e.text};navigator.share(t).then((()=>{var t,s;null==(t=null==e?void 0:e.success)||t.call(e),null==(s=null==e?void 0:e.complete)||s.call(e)})).catch((()=>{var t,s;null==(t=null==e?void 0:e.fail)||t.call(e,{errorCode:P.unknown}),null==(s=null==e?void 0:e.complete)||s.call(e)}))},setTitle:function(e){var t,s,r;document.title=null!=(t=null==e?void 0:e.title)?t:"",null==(s=null==e?void 0:e.success)||s.call(e),null==(r=null==e?void 0:e.complete)||r.call(e)},renderCoupons:Xe("renderCoupons",(e=>l(this,null,(function*(){const{merchant:t,couponId:s,containerId:r,postLoginRedirectUrl:n=window.location.href,postLoginRedirectType:i,locale:o}=e,a=document.getElementById(r);if(!a)throw new C("Invalid coupon container Id",P.badRequestInsufficientParameter);const c=yield Ke.fetchCoupons({merchantId:t,couponId:s,postLoginRedirectUrl:n,postLoginRedirectType:i});try{const e=document.createElement("iframe");e.src=x,e.style.cssText="width:100%;height: 0;border: none;transition: height 300ms ease-in;display: block;",yield new Promise(((t,s)=>{e.onload=()=>t(!0),e.onerror=()=>s(new Error("Failed to load coupon iframe")),a.innerHTML="",a.append(e)})),e.onload=null,e.onerror=null,window.addEventListener("message",(({data:t,source:s})=>{"update-iframe-height"===(null==t?void 0:t.eventName)&&e.contentWindow===s&&(e.style.height=`${t.height}px`)}));const s=be.getTargetWindowFunctionProxy((()=>e.contentWindow),L);yield s.renderCoupons({coupons:c,merchantId:t,locale:o,postLoginRedirectUrl:n,postLoginRedirectType:i})}catch(l){throw new C(`An error occurred while displaying coupons, merchantId=${t}, couponId=${s}, error=${l}`,P.unknown)}}))),(e=>({event_label2:e.couponId,merchant_id:e.merchant}))),scanCode:function(e){var t;const s=c(a({},e),{redirectUrlOnCancel:null!=(t=null==e?void 0:e.redirectUrlOnCancel)?t:window.location.href});Ge(S,0,e,s)},copyToClipboard:function(e){var t,s,r;const n=document.createElement("textarea");n.setAttribute("readonly","true"),n.setAttribute("contenteditable","true"),n.value=e.value,document.body.appendChild(n),n.select(),n.setSelectionRange(0,n.value.length);const i=document.execCommand("copy");document.body.removeChild(n),i?null==(t=null==e?void 0:e.success)||t.call(e):null==(s=null==e?void 0:e.fail)||s.call(e,{errorCode:P.other}),null==(r=e.complete)||r.call(e)},getSessionData:function(e){var t,s;const r=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!=r?r:""}),null==(s=null==e?void 0:e.complete)||s.call(e)},setSessionData:function(e){var t,s,r;sessionStorage.setItem(null==e?void 0:e.key,null!=(t=null==e?void 0:e.value)?t:""),null==(s=null==e?void 0:e.success)||s.call(e),null==(r=null==e?void 0:e.complete)||r.call(e)},getStorageData:function(e){var t,s;const r=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!=r?r:""}),null==(s=null==e?void 0:e.complete)||s.call(e)},setStorageData:function(e){var t,s,r;localStorage.setItem(null==e?void 0:e.key,null!=(t=null==e?void 0:e.value)?t:""),null==(s=null==e?void 0:e.success)||s.call(e),null==(r=null==e?void 0:e.complete)||r.call(e)},removeStorageData:function(e){var t,s;localStorage.removeItem(null==e?void 0:e.key),null==(t=null==e?void 0:e.success)||t.call(e),null==(s=null==e?void 0:e.complete)||s.call(e)},getKycPassportInfo:function(e){const t=window.location.href;Ge(y,0,e,c(a({},e),{url:t}))},logout:ut,getPaymentSettings:ct,markAsReady:lt};return function({sdkType:e,clientFunctions:t}){tt=e;const s=e===N.MiniApp?Ye:Je,r=new Proxy(c(a({},t),{init:rt}),{get(t,r){if(r in at)return at[r];const n=r;if(!s(n))throw new Error(`${n} is not supported by ${e} JS SDK`);return function(e,t){return(s={})=>new Promise(((r,n)=>{let i,o;e(c(a({},s),{success:e=>{var t;o=e,null==(t=s.success)||t.call(s,e)},fail:e=>{var r;"init"===t&&et[e.errorCode]?o={statusCode:et[e.errorCode]}:i=e,null==(r=s.fail)||r.call(s,e)},complete:()=>{var e;i?n(i):r(o),null==(e=s.complete)||e.call(s)}}))}))}((function(e){return l(this,null,(function*(){var s,i;if(!it.includes(n)&&!(yield st)){if(!ot.includes(n)||!function(e){return void 0!==e.clientId}(e))return null==(s=e.fail)||s.call(e,{errorCode:P.sdkNotInitialized}),void(null==(i=e.complete)||i.call(e));rt({clientId:e.clientId,env:e.env}),yield st}const o=t[n];if(o&&"function"==typeof o)return o(e);Ge(r,0,e,e)}))}),n)}});return window._pp=r,function(e){const t=window._ppcs;if(t){window._ppcs=void 0;for(const[s,r,n]of t){const t=e[s](r);n&&n(t)}}}(r),r}({sdkType:N.MiniApp,clientFunctions:ht})}();
|
|
2
|
+
var pp=function(){"use strict";var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,r=(t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,a=(e,t)=>{for(var n in t||(t={}))s.call(t,n)&&r(e,n,t[n]);if(o)for(var n of o(t))i.call(t,n)&&r(e,n,t[n]);return e},c=(e,o)=>t(e,n(o)),l=(e,t,n)=>new Promise(((o,s)=>{var i=e=>{try{a(n.next(e))}catch(t){s(t)}},r=e=>{try{a(n.throw(e))}catch(t){s(t)}},a=e=>e.done?o(e.value):Promise.resolve(e.value).then(i,r);a((n=n.apply(e,t)).next())}));function u(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}var d=function e(t,n){function o(e,o,s){if("undefined"!=typeof document){"number"==typeof(s=u({},n,s)).expires&&(s.expires=new Date(Date.now()+864e5*s.expires)),s.expires&&(s.expires=s.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var i="";for(var r in s)s[r]&&(i+="; "+r,!0!==s[r]&&(i+="="+s[r].split(";")[0]));return document.cookie=e+"="+t.write(o,e)+i}}return Object.create({set:o,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],o={},s=0;s<n.length;s++){var i=n[s].split("="),r=i.slice(1).join("=");try{var a=decodeURIComponent(i[0]);if(o[a]=t.read(r,a),e===a)break}catch(c){}}return e?o[e]:o}},remove:function(e,t){o(e,"",u({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,u({},this.attributes,t))},withConverter:function(t){return e(u({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"}),p=(e=>(e.accessToken="ppjssdk.accessToken",e.refreshToken="ppjssdk.refreshToken",e.env="ppjssdk.env",e.deviceUUID="ppjssdk.deviceUUID",e.clientUUID="ppjssdk.clientUUID",e.lastPayment="ppjssdk.lastPayment",e.lastTopup="ppjssdk.lastTopup",e.appDetail="ppjssdk.appDetail",e.appConfig="ppjssdk.appConfig",e.userInfo="ppjssdk.userInfo",e.lastPaymentMethod="ppjssdk.lastPaymentMethod",e.lastTopupPayMethod="ppjssdk.lastTopupPayMethod",e.codeVerifier="ppjssdk.codeVerifier",e.clientOrigin="ppjssdk.clientOrigin",e.clientVersion="ppjssdk.clientVersion",e.debugMode="ppjssdk.debugMode",e.claimCouponImmediately="ppjssdk.claimCouponImmediately",e.merchant="ppjssdk.merchant",e.consumedOTT="ppjssdk.consumedOTT",e.initializedAt="ppjssdk.initializedAt",e))(p||{});const h="success",g="fail",m="complete",_="init",f="verifyMultiFactorAuthResult",v="share",S="scanCode",y="handleMessageFromNative",E="getKycPassportInfo",I="reload",w="link",A="makeVisible",b="consoleDebugInfo",T="clientPopState";var N=(e=>(e.MiniApp="MiniApp",e.SmartPayment="SmartPayment",e))(N||{});const C="_PayPayJsBridge",O=["init","openWebview","openMap","closeApp","makePayment","topup","setSessionData","getSessionData","setStorageData","getStorageData","removeStorageData","getPermissionStatus","scanCode","showAlert","showErrorSheet","getTopBarHeight","setTitle","showUpdateWarning","getPlatformInformation","openApp","share","getKycInformation","getUserLocation","checkPaymentMethod","registerKyc","startMultiFactorAuth","verifyMultiFactorAuthResult","getBankInfo","logout","getUserProfile","getBalance","getUserAddress","getUAID","copyToClipboard","registerUserInfo","setEnablePullDownRefresh","registerEmail","inputAddress","getDeviceInformation","request","requestInternal","registerPaymentFeatures","initKycPassport","getKycPassportInfo","shortcutExists","addShortcut","getAllUserAddresses","getUserPaymentFeatureSettings","getPaymentSettings","getTransactionInfo","getTransactions","getPayPayCardInfo","getExternalLinkageInformation","markAsReady","renderCoupons"],k=["init","createOrder","makePayment","render","logout","getAuthStatus","getUserProfile","getBalance","getUserAddress","getUAID","getCashbackInformation","renderCoupons","getLoginUrl"],P="2.54.0",D=new URL("https://mini-app-sdk-core.paypay.ne.jp/"),L=D.origin,R=new URL(`./iframe.html?v=${P}&rev=cd1d284`,D).href,U=new URL(`./coupon/iframe.html?v=${P}`,D).href;var x=(e=>(e.success="SUCCESS",e.invalidUrl="INVALID_URL",e.invalidData="INVALID_DATA",e.invalidHeader="INVALID_HEADER",e.invalidMethod="INVALID_METHOD",e.invalidPath="INVALID_PATH",e.notReachable="NOT_REACHABLE",e.notAvailable="NOT_AVAILABLE",e.timeOut="TIME_OUT",e.whiteListError="NONE_WHITELIST_DOMAIN",e.statusCodeError="STATUS_CODE_ERROR",e.invalidResponse="INVALID_RESPONSE",e.noLocationPermission="NO_USER_LOCATION_PERMISSION",e.noPermissionListAvailable="NO_PERMISSION_LIST_AVAILABLE",e.other="other",e.serverError="SERVER_ERROR",e.noCameraPermission="HOST_APP_CAMERA_DENIED",e.noAlbumPermission="HOST_APP_ALBUM_DENIED",e.insufficientScope="INSUFFICIENT_SCOPE",e.userCanceled="USER_CANCELED",e.invalidJSAPIParams="INVALID_JS_API_PARAMS",e.hostAppLocationDenied="HOST_APP_LOCATION_DENIED",e.hostAppContactsDenied="HOST_APP_READING_CONTACT_DENIED",e.badRequestInsufficientParameter="BAD_REQUEST_INSUFFICIENT_PARAMETER",e.badRequest="BAD_REQUEST",e.paymentFail="PAYMENT_FAIL",e.topupFail="TOPUP_FAIL",e.topupSuccessButNotAddToBalance="TOPUP_SUCCESS_BUT_NOT_ADD_TO_BALANCE",e.userCanceledSimilarTxn="USER_CANCELED_SIMILAR_TRANSACTION",e.mapAppNotFound="MAP_APP_NOT_FOUND",e.invalidAppSchemeURL="INVALID_APP_SCHEME_URL",e.noValueFound="NO_VALUE_FOUND",e.securityNotSetup="SECURITY_NOT_SETUP",e.userDenied="USER_DENIED",e.securityTemporaryLocked="SECURITY_TEMPORARY_LOCKED",e.couldNotGenerateBarcode="COULD_NOT_GENERATE_BARCODE",e.cannotDetectAvailability="CAN_NOT_DETECT_AVAILABILITY",e.suspectedDuplicatePayment="SUSPECTED_DUPLICATE_PAYMENT",e.noSufficientFund="NO_SUFFICIENT_FUND",e.unknown="UNKNOWN",e.sdkNotInitialized="SDK_NOT_INITIALIZED",e.tokenNotFound="TOKEN_NOT_FOUND",e.tokenExpired="TOKEN_EXPIRED",e.activeRequestExists="ACTIVE_REQUEST_EXISTS",e.invalidType="INVALID_TYPE",e.sessionNotFound="SESSION_NOT_FOUND",e.cookieError="COOKIE_ERROR",e.notAuthorized="NOT_AUTHORIZED",e.permissionRequired="PERMISSION_REQUIRED",e.deeplinkUnavailable="DEEPLINK_UNAVAILABLE",e.kycIncompleted="KYC_INCOMPLETED",e.noBankAccount="NO_BANK_ACCOUNT",e.invalidPaymentIdentifier="INVALID_PAYMENT_IDENTIFIER",e.otpSendTooShort="OTP_SEND_TOO_SHORT",e.otpSendOverLimit="OTP_SEND_OVER_LIMIT",e.userVerificationFailure="USER_VERIFICATION_FAILURE",e.unacceptableOp="UNACCEPTABLE_OP",e.kycUpdateRequired="KYC_UPDATE_REQUIRED",e.notCompleted="NOT_COMPLETED",e.kycValidationInProcess="KYC_VALIDATION_IN_PROCESS",e.noLocationData="NO_LOCATION_DATA",e.functionNotFound="FUNCTION_NOT_FOUND",e.originNotAllowed="ORIGIN_NOT_ALLOWED",e.messageSendingFailed="MESSAGE_SENDING_FAILED",e.transactionNotFound="TRANSACTION_NOT_FOUND",e.unexpectedOperation="UNEXPECTED_OP",e.merchantTimeout="MERCHANT_TIMEOUT",e.rateLimitExceeded="RATE_LIMIT_EXCEEDED",e.sdkUpgradeRequired="SDK_UPGRADE_REQUIRED",e.authorizationNeeded="AUTHORIZATION_NEEDED",e.invalidVirtualAccount="INVALID_VIRTUAL_ACCOUNT",e))(x||{});class M extends Error{constructor(e,t){super(e),this.errorCode=t}}const F="8.45.1",j=globalThis;function B(e,t,n){const o=j,s=o.__SENTRY__=o.__SENTRY__||{},i=s[F]=s[F]||{};return i[e]||(i[e]=t())}const V="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,$=["debug","info","warn","error","log","assert","trace"],q={};function z(e){if(!("console"in j))return e();const t=j.console,n={},o=Object.keys(q);o.forEach((e=>{const o=q[e];n[e]=t[e],t[e]=o}));try{return e()}finally{o.forEach((e=>{t[e]=n[e]}))}}const W=B("logger",(function(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return V?$.forEach((n=>{t[n]=(...t)=>{e&&z((()=>{j.console[n](`Sentry Logger [${n}]:`,...t)}))}})):$.forEach((e=>{t[e]=()=>{}})),t}));function H(){return K(j),j}function K(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||F,t[F]=t[F]||{}}const Y=Object.prototype.toString;function G(e){return function(e,t){return Y.call(e)===`[object ${t}]`}(e,"Object")}function J(){return Date.now()/1e3}const Q=function(){const{performance:e}=j;if(!e||!e.now)return J;const t=Date.now()-e.now(),n=null==e.timeOrigin?t:e.timeOrigin;return()=>(n+e.now())/1e3}();function X(){const e=j,t=e.crypto||e.msCrypto;let n=()=>16*Math.random();try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(n=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch(o){}return"10000000100040008000100000000000".replace(/[018]/g,(e=>(e^(15&n())>>e/4).toString(16)))}function Z(){return X()}function ee(){return X().substring(16)}function te(e,t,n=2){if(!t||"object"!=typeof t||n<=0)return t;if(e&&t&&0===Object.keys(t).length)return e;const o=a({},e);for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(o[s]=te(o[s],t[s],n-1));return o}(()=>{const{performance:e}=j;if(!e||!e.now)return;const t=36e5,n=e.now(),o=Date.now(),s=e.timeOrigin?Math.abs(e.timeOrigin+n-o):t,i=s<t,r=e.timing&&e.timing.navigationStart,a="number"==typeof r?Math.abs(r+n-o):t;(i||a<t)&&(s<=a&&e.timeOrigin)})();const ne="_sentrySpan";function oe(e,t){t?function(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch(o){V&&W.log(`Failed to add non-enumerable property "${t}" to object`,e)}}(e,ne,t):delete e[ne]}function se(e){return e[ne]}class ie{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Z(),spanId:ee()}}clone(){const e=new ie;return e._breadcrumbs=[...this._breadcrumbs],e._tags=a({},this._tags),e._extra=a({},this._extra),e._contexts=a({},this._contexts),this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata=a({},this._sdkProcessingMetadata),e._propagationContext=a({},this._propagationContext),e._client=this._client,e._lastEventId=this._lastEventId,oe(e,se(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&function(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),e.did||t.did||(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||Q(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:X()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{const t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags=a(a({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,t){return this._tags=c(a({},this._tags),{[e]:t}),this._notifyScopeListeners(),this}setExtras(e){return this._extra=a(a({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,t){return this._extra=c(a({},this._extra),{[e]:t}),this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return null===t?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t="function"==typeof e?e(this):e,[n,o]=t instanceof re?[t.getScopeData(),t.getRequestSession()]:G(t)?[e,e.requestSession]:[],{tags:s,extra:i,user:r,contexts:c,level:l,fingerprint:u=[],propagationContext:d}=n||{};return this._tags=a(a({},this._tags),s),this._extra=a(a({},this._extra),i),this._contexts=a(a({},this._contexts),c),r&&Object.keys(r).length&&(this._user=r),l&&(this._level=l),u.length&&(this._fingerprint=u),d&&(this._propagationContext=d),o&&(this._requestSession=o),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,oe(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Z()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const o=a({timestamp:J()},e),s=this._breadcrumbs;return s.push(o),this._breadcrumbs=s.length>n?s.slice(-n):s,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:se(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=te(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=a({spanId:ee()},e),this}getPropagationContext(){return this._propagationContext}captureException(e,t){const n=t&&t.event_id?t.event_id:X();if(!this._client)return W.warn("No client configured on scope - will not capture exception!"),n;const o=new Error("Sentry syntheticException");return this._client.captureException(e,c(a({originalException:e,syntheticException:o},t),{event_id:n}),this),n}captureMessage(e,t,n){const o=n&&n.event_id?n.event_id:X();if(!this._client)return W.warn("No client configured on scope - will not capture message!"),o;const s=new Error(e);return this._client.captureMessage(e,t,c(a({originalException:e,syntheticException:s},n),{event_id:o}),this),o}captureEvent(e,t){const n=t&&t.event_id?t.event_id:X();return this._client?(this._client.captureEvent(e,c(a({},t),{event_id:n}),this),n):(W.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}}const re=ie;class ae{constructor(e,t){let n,o;n=e||new re,o=t||new re,this._stack=[{scope:n}],this._isolationScope=o}withScope(e){const t=this._pushScope();let n;try{n=e(t)}catch(s){throw this._popScope(),s}return o=n,Boolean(o&&o.then&&"function"==typeof o.then)?n.then((e=>(this._popScope(),e)),(e=>{throw this._popScope(),e})):(this._popScope(),n);var o}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return!(this._stack.length<=1)&&!!this._stack.pop()}}function ce(){const e=K(H());return e.stack=e.stack||new ae(B("defaultCurrentScope",(()=>new re)),B("defaultIsolationScope",(()=>new re)))}function le(e){return ce().withScope(e)}function ue(e,t){const n=ce();return n.withScope((()=>(n.getStackTop().scope=e,t(e))))}function de(e){return ce().withScope((()=>e(ce().getIsolationScope())))}function pe(e){const t=K(e);return t.acs?t.acs:{withIsolationScope:de,withScope:le,withSetScope:ue,withSetIsolationScope:(e,t)=>de(t),getCurrentScope:()=>ce().getScope(),getIsolationScope:()=>ce().getIsolationScope()}}function he(){return pe(H()).getCurrentScope()}const ge=100;function me(e,t){const n=he().getClient(),o=pe(H()).getIsolationScope();if(!n)return;const{beforeBreadcrumb:s=null,maxBreadcrumbs:i=ge}=n.getOptions();if(i<=0)return;const r=J(),c=a({timestamp:r},e),l=s?z((()=>s(c,t))):c;null!==l&&(n.emit&&n.emit("beforeAddBreadcrumb",l,t),o.addBreadcrumb(l,i))}const _e=[x.sdkNotInitialized,x.notAuthorized,x.userCanceled,x.userCanceledSimilarTxn,x.suspectedDuplicatePayment,x.noSufficientFund];function fe(e,t,n){_e.includes(n)||function(e,t){const n=t;he().captureMessage(e,n,void 0)}(`windowBridge.${e} failed. error: ${n}, message: ${t}`,"log")}const ve=e=>"object"!=typeof e||null===e?e:JSON.parse(JSON.stringify(e)),Se=e=>{var t;const n=null==(t=e[0])?void 0:t.callbacks;return"object"==typeof n&&null!==n},ye=e=>Object.keys(e).reduce(((e,t)=>(e[t]=!0,e)),{});class Ee{constructor(e,t,n=[]){this.deferredPromises={},this.functions=e,this.allowedOrigins=t,this.middlewares=n,this.registeredCallbacks={},this.messageEventHandler=this.messageEventHandler.bind(this),this.subscribeToMessageEvent()}subscribeToMessageEvent(){window.addEventListener("message",this.messageEventHandler)}unsubscribeToMessageEvent(){window.removeEventListener("message",this.messageEventHandler)}messageEventHandler(e){var t;if(null==(t=e.data)?void 0:t.forWindowBridge)return this.allowedOrigins&&"request"===e.data.type&&!this.allowedOrigins.includes(e.origin)?this.sendErrorResponse(e,`${e.origin} is not allowed to make requests`,x.originNotAllowed):void("request"===e.data.type?this.handleRequest(e):"response"===e.data.type?this.handleResponse(e):"callback"===e.data.type&&this.handleCallback(e))}handleRequest(e){return l(this,null,(function*(){var t;const n=e.data.functionName,o=this.functions[n];o||this.sendErrorResponse(e,`Function '${n}' does not exists on the target window`,x.functionNotFound);const s=ve(e.data.params);Se(s)&&(s[0].callbacks=Object.keys(s[0].callbacks).reduce(((t,n)=>(t[n]=(...t)=>{this.invokeCallback(e,n,t)},t)),{}));try{this.sendSuccessResponse(e,yield function(e,t,n,o){let s=-1;const i=o=>l(this,null,(function*(){if(++s,s<e.length){const n=e[s];return yield n(t,o,i)}return n(...o)}));return i(o)}([...this.middlewares,...null!=(t=o.middlewares)?t:[]],e,o,s))}catch(i){let t="Some error occurred while processing the request",n=x.unknown;i instanceof M?(t=i.message,n=i.errorCode):console.error(i),this.sendErrorResponse(e,t,n)}}))}handleResponse(e){if(!this.deferredPromises[e.data.key])return void console.warn(`Promise for ${e.data.functionName} not found`);const[t,n]=this.deferredPromises[e.data.key];delete this.deferredPromises[e.data.key],"success"===e.data.status?t(e.data.result):(delete this.registeredCallbacks[e.data.key],n(new M(e.data.message,e.data.errorCode)))}handleCallback(e){var t;const{key:n,callbackName:o,args:s}=e.data,i=null==(t=this.registeredCallbacks[n])?void 0:t[o];i?i(...s):console.warn(`Callback with key ${n} and name ${o} not found.`)}sendErrorResponse(e,t,n){fe(e.data.functionName,t,n),this.sendResponse(e,{status:"failure",message:t,errorCode:n})}sendSuccessResponse(e,t){this.sendResponse(e,{status:"success",result:t})}sendResponse(e,t){this.sendMessage(e.source,e.origin,a({type:"response",key:e.data.key,functionName:e.data.functionName},t))}invokeCallback(e,t,n){this.sendMessage(e.source,e.origin,{type:"callback",key:e.data.key,functionName:e.data.functionName,callbackName:t,args:n})}sendMessage(e,t,n){e.postMessage(a({forWindowBridge:!0},ve(n)),t)}sendRequest(e,t,n,o){return new Promise(((s,i)=>l(this,null,(function*(){const r=`${n}--${be()}`;try{const l=yield e();if(!l)throw new Error("Target window is undefined");let u=o[0];if(Se(o)){const e=o[0].callbacks;this.addFunctionCallbacks(r,e),u=c(a({},o[0]),{callbacks:ye(e)})}this.deferredPromises[r]=[s,i],this.sendMessage(l,t,{type:"request",key:r,functionName:n,params:[u]})}catch(l){delete this.deferredPromises[r],delete this.registeredCallbacks[r],i(new M(l.message,x.messageSendingFailed))}}))))}addFunctionCallbacks(e,t){Object.keys(t).forEach((e=>{if("function"!=typeof t[e])throw new Error(`Callback ${e} is not a function`)})),this.registeredCallbacks[e]=a({},t)}static init(e,t,n=[]){if(this._instance)throw new Error("WindowBridge already initialized, you can't call WindowBridge.init more than once");return this._instance=new this(e,t,n),this._instance}static destroy(){this._instance&&(this._instance.unsubscribeToMessageEvent(),this._instance=void 0)}static getBridge(){if(!this._instance)throw new Error("WindowBridge not initialized, please call WindowBridge.init before calling WindowBridge.getBridge");return this._instance}static getTargetWindowFunctionProxy(e,t){return Ee.getBridge().getTargetWindowFunctionProxy(e,t)}getTargetWindowFunctionProxy(e,t){return new Proxy(this,{get:(n,o)=>(...s)=>n.sendRequest(e,t,o.toString(),s)})}}class Ie{constructor(){var e;this.useLocalStorage=!0,this.memoryStorage={};try{localStorage.setItem(p.initializedAt,Date.now().toString());for(let t=0;t<localStorage.length;t++){const n=localStorage.key(t);null!=n&&(this.memoryStorage[n]=null!=(e=localStorage.getItem(n))?e:"")}}catch(t){this.useLocalStorage=!1}}getItem(e){var t,n;if(this.useLocalStorage)try{if(null!=localStorage.getItem(p.initializedAt)){const n=localStorage.getItem(e);return null!=n?n:null!=(t=d.get(e))?t:null}console.debug("local storage value has lost unexpectedly."),me({message:"local storage value has lost unexpectedly.",category:"storage"})}catch(o){}return this.useLocalStorage=!1,null!=(n=this.memoryStorage[e])?n:null}setItem(e,t){if(this.memoryStorage[e]=t,this.useLocalStorage)try{localStorage.setItem(e,t),Ae(e)}catch(n){this.useLocalStorage=!1,console.warn("localStorage has become unavailable.")}}removeItem(e){delete this.memoryStorage[e];try{localStorage.removeItem(e),Ae(e)}catch(t){this.useLocalStorage=!1}}clear(){try{localStorage.clear(),localStorage.setItem(p.initializedAt,Date.now().toString()),function(){const e=d.get();for(const o in e)Ae(o);t=p.initializedAt,n=Date.now().toString(),d.set(t,n,we);var t,n}()}catch(e){}this.memoryStorage={}}}const we=Object.freeze(a({expires:365,sameSite:"None"},{secure:!0,Partitioned:!0}));function Ae(e){d.remove(e,we)}function be(){return Math.random().toString(36).substring(7)}new Ie;const Te=Object.freeze(Object.defineProperty({__proto__:null,getCookie:function({name:e}){return d.get(e)},getLocalStorage:function({name:e}){return localStorage.getItem(e)},getSessionStorage:function({name:e}){return sessionStorage.getItem(e)},getUrl:function(){return window.location.href},removeCookie:function({name:e,options:t}){return d.remove(e,t)},removeLocalStorage:function({name:e}){return localStorage.removeItem(e)},removeQueryParametersFromUrl:function(e){const t=new URL(window.location.href);e.forEach((e=>t.searchParams.delete(e)));const n=`${t.pathname}${t.search}`;history.replaceState(history.state,"",n)},removeSessionStorage:function({name:e}){return sessionStorage.removeItem(e)},setCookie:function({name:e,value:t,options:n}){return d.set(e,t,n)},setLocalStorage:function({name:e,value:t}){return localStorage.setItem(e,t)},setSessionStorage:function({name:e,value:t}){return sessionStorage.setItem(e,t)}},Symbol.toStringTag,{value:"Module"})),Ne="ppmna-iframe",Ce="ppsdk-container";let Oe,ke;function Pe(){return Oe||(Oe=function(){if(document.getElementById(Ne))return;const e=document.createElement("div");return document.createElement("div"),e.setAttribute("id",Ce),e.setAttribute("class",Ce),e.style.all="initial",e.style.display="none",e.style.position="fixed",e.style.width="100%",e.style.height="100%",e.style.top="0",e.style.left="0",e.style.zIndex="2147483637",document.body.appendChild(e),e}()),Oe}function De(e){const t=Pe();t&&(t.style.display=e?"initial":"none")}function Le(){return ke||(ke=new Promise(((e,t)=>{function n(){const n=document.createElement("iframe");n.setAttribute("src",R),n.setAttribute("name",Ne),n.setAttribute("id",Ne),n.setAttribute("class",Ne),n.setAttribute("allow","geolocation"),n.onload=()=>{e(n),n.onerror=null},n.onerror=t,n.style.all="initial",n.style.width="100%",n.style.height="100%",n.style.border="none";const o=Pe();o&&(o.innerHTML="",o.append(n))}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(()=>{n()})):n()}))),ke}Ee.init(Te,[L]);const Re=Ee.getTargetWindowFunctionProxy((function(){return Le().then((e=>null==e?void 0:e.contentWindow)).catch((()=>null))}),L);function Ue(e,t,n){var o,s,i,r;e.result===g&&(null==(o=null==t?void 0:t.fail)||o.call(t,e.data)),e.result===h&&(null==(s=null==t?void 0:t.success)||s.call(t,null==e?void 0:e.data)),e.result===m&&(null==(i=null==t?void 0:t.complete)||i.call(t),removeEventListener("message",n),r=e.messageId,Be=Be.filter((e=>e!==r)),Be.length>0||De(!1))}function xe(e,t,n,o){const s=function(){const e=be();return Be.push(e),e}(),i=t=>{Me(t.origin)&&t.data.name===e&&t.data.messageId===s&&Ue(t.data,n,i)};addEventListener("message",i),function(e){l(this,null,(function*(){var t;const n=yield Le().catch((()=>{}));null==(t=null==n?void 0:n.contentWindow)||t.postMessage(JSON.parse(JSON.stringify(e)),L)}))}({name:e,params:o,messageId:s})}function Me(e){return e===L}function Fe(e){return O.includes(e)}function je(e){return k.includes(e)}let Be=[];function Ve(e,t,n){return function(o={}){const s=null==n?void 0:n(o);Re.logEvent(a({event_action:`pp_${e}_called`,event_category_suffix:e},s));const i=t(o);return i.then((t=>{var n;Re.logEvent(a({event_action:`pp_${e}_success`,event_category_suffix:e},s)),null==(n=o.success)||n.call(o,t)})).catch((t=>{var n;console.error(t.message),Re.logEvent(a({event_action:`pp_${e}_fail`,event_category_suffix:e,error_value:t.errorCode},s)),null==(n=o.fail)||n.call(o,{errorCode:t.errorCode})})).finally((()=>{var e;null==(e=o.complete)||e.call(o)})),i}}const $e={[x.sdkNotInitialized]:x.authorizationNeeded,[x.tokenNotFound]:x.authorizationNeeded,[x.tokenExpired]:x.tokenExpired};let qe,ze;Le(),ze=Promise.resolve(!1);function We(e){const t=(n=e.clientId,d.get(`${p.refreshToken}.${n}`)||d.get(p.refreshToken)||"");var n;const o=function(e){return d.get(`${p.codeVerifier}.${e}`)||d.get(p.codeVerifier)||""}(e.clientId),s={env:e.env,mode:e.mode,debugMode:e.debugMode,clientId:e.clientId,refreshToken:t,clientVersion:"2.54.0",codeVerifier:o,clientSdkType:qe,clientUrl:window.location.href};let i;const r=new Promise((e=>i=e)),l=()=>{var t;i(!0),null==(t=e.complete)||t.call(e)};ze.then((()=>Le())).then((()=>{xe(_,0,c(a({},e),{complete:l}),s)})).catch((()=>{var t;null==(t=e.fail)||t.call(e,{errorCode:x.sdkNotInitialized}),l()})),ze=r}addEventListener("message",(e=>{var t;if(!(null==(t=e.data)?void 0:t.forWindowBridge)&&Me(e.origin))if(e.data.name===I&&window.location.reload(),e.data.name!==A){if(e.data.name===w){const t=e.data.data;"_blank"===t.target?window.open(t.url,"_blank"):window.location.href=t.url}if(e.data.name===b){const{params:t}=e.data.data;!function(e){console.debug(...e)}(t)}}else De(!0)})),addEventListener("popstate",(()=>{Le().then((e=>{var t;const n={name:T};null==(t=null==e?void 0:e.contentWindow)||t.postMessage(n,L)})).catch((e=>console.warn(e)))}));var He;He={_handleMessageFromNative:e=>{Le().then((t=>{var n;null==(n=null==t?void 0:t.contentWindow)||n.postMessage(JSON.parse(JSON.stringify({name:y,params:{json:e}})),L)}))}},(!window.hasOwnProperty(C)||window[C]!==He)&&(window[C]=He);const Ke=["init","setTitle","copyToClipboard","getSessionData","setSessionData","getStorageData","setStorageData","removeStorageData","getLoginUrl"],Ye=["renderCoupons"];const Ge={version:"2.54.0",revision:"cd1d284"};Ve("getLoginUrl",Re.getLoginUrl);const Je=Ve("getPaymentSettings",Re.getPaymentSettings),Qe=Ve("markAsReady",Re.markAsReady);var Xe=(e=>(e.validToken="TOKEN_VALID",e.initialized="INITIALIZED",e.emailRegistered="EMAIL_REGISTERED",e.emailNotVerified="EMAIL_NOT_VERIFIED",e.success="SUCCESS",e.loggedOut="LOGGED_OUT",e.connected="CONNECTED",e))(Xe||{});const Ze=Ve("logout",(()=>l(this,null,(function*(){try{return yield Re.logout(),{statusCode:Xe.loggedOut}}catch(e){throw new M(`An error occurred while trying to logout the user, error=${e}`,x.unknown)}}))));const et={verifyMultiFactorAuthResult:function(e){const t=new URL(window.location.href);xe(f,0,e,c(a({},e),{sessionId:t.searchParams.get("ppSessionId")}))},share:function(e){if(!(null==navigator?void 0:navigator.share))return void xe(v,0,e,e);const t={text:null==e?void 0:e.text};navigator.share(t).then((()=>{var t,n;null==(t=null==e?void 0:e.success)||t.call(e),null==(n=null==e?void 0:e.complete)||n.call(e)})).catch((()=>{var t,n;null==(t=null==e?void 0:e.fail)||t.call(e,{errorCode:x.unknown}),null==(n=null==e?void 0:e.complete)||n.call(e)}))},setTitle:function(e){var t,n,o;document.title=null!=(t=null==e?void 0:e.title)?t:"",null==(n=null==e?void 0:e.success)||n.call(e),null==(o=null==e?void 0:e.complete)||o.call(e)},renderCoupons:Ve("renderCoupons",(e=>l(this,null,(function*(){const{merchant:t,couponId:n,containerId:o,postLoginRedirectUrl:s=window.location.href,postLoginRedirectType:i,locale:r}=e,a=document.getElementById(o);if(!a)throw new M("Invalid coupon container Id",x.badRequestInsufficientParameter);const c=yield Re.fetchCoupons({merchantId:t,couponId:n,postLoginRedirectUrl:s,postLoginRedirectType:i});try{const e=document.createElement("iframe");e.src=U,e.style.cssText="width:100%;height: 0;border: none;transition: height 300ms ease-in;display: block;",yield new Promise(((t,n)=>{e.onload=()=>t(!0),e.onerror=()=>n(new Error("Failed to load coupon iframe")),a.innerHTML="",a.append(e)})),e.onload=null,e.onerror=null,window.addEventListener("message",(({data:t,source:n})=>{"update-iframe-height"===(null==t?void 0:t.eventName)&&e.contentWindow===n&&(e.style.height=`${t.height}px`)}));const n=Ee.getTargetWindowFunctionProxy((()=>e.contentWindow),L);yield n.renderCoupons({coupons:c,merchantId:t,locale:r,postLoginRedirectUrl:s,postLoginRedirectType:i})}catch(l){throw new M(`An error occurred while displaying coupons, merchantId=${t}, couponId=${n}, error=${l}`,x.unknown)}}))),(e=>({event_label2:e.couponId,merchant_id:e.merchant}))),scanCode:function(e){var t;const n=c(a({},e),{redirectUrlOnCancel:null!=(t=null==e?void 0:e.redirectUrlOnCancel)?t:window.location.href});xe(S,0,e,n)},copyToClipboard:function(e){var t,n,o;const s=document.createElement("textarea");s.setAttribute("readonly","true"),s.setAttribute("contenteditable","true"),s.value=e.value,document.body.appendChild(s),s.select(),s.setSelectionRange(0,s.value.length);const i=document.execCommand("copy");document.body.removeChild(s),i?null==(t=null==e?void 0:e.success)||t.call(e):null==(n=null==e?void 0:e.fail)||n.call(e,{errorCode:x.other}),null==(o=e.complete)||o.call(e)},getSessionData:function(e){var t,n;const o=sessionStorage.getItem(null==e?void 0:e.key);null==(t=null==e?void 0:e.success)||t.call(e,{[null==e?void 0:e.key]:null!=o?o:""}),null==(n=null==e?void 0:e.complete)||n.call(e)},setSessionData:function(e){var t,n,o;sessionStorage.setItem(null==e?void 0:e.key,null!=(t=null==e?void 0:e.value)?t:""),null==(n=null==e?void 0:e.success)||n.call(e),null==(o=null==e?void 0:e.complete)||o.call(e)},getStorageData:function(e){var t,n;const o=localStorage.getItem(null==e?void 0:e.key);null==(t=null==e?void 0:e.success)||t.call(e,{[null==e?void 0:e.key]:null!=o?o:""}),null==(n=null==e?void 0:e.complete)||n.call(e)},setStorageData:function(e){var t,n,o;localStorage.setItem(null==e?void 0:e.key,null!=(t=null==e?void 0:e.value)?t:""),null==(n=null==e?void 0:e.success)||n.call(e),null==(o=null==e?void 0:e.complete)||o.call(e)},removeStorageData:function(e){var t,n;localStorage.removeItem(null==e?void 0:e.key),null==(t=null==e?void 0:e.success)||t.call(e),null==(n=null==e?void 0:e.complete)||n.call(e)},getKycPassportInfo:function(e){const t=window.location.href;xe(E,0,e,c(a({},e),{url:t}))},logout:Ze,getPaymentSettings:Je,markAsReady:Qe};return function({sdkType:e,clientFunctions:t}){qe=e;const n=e===N.MiniApp?Fe:je,o=new Proxy(c(a({},t),{init:We}),{get(t,o){if(o in Ge)return Ge[o];const s=o;if(!n(s))throw new Error(`${s} is not supported by ${e} JS SDK`);return function(e,t){return(n={})=>new Promise(((o,s)=>{let i,r;e(c(a({},n),{success:e=>{var t;r=e,null==(t=n.success)||t.call(n,e)},fail:e=>{var o;"init"===t&&$e[e.errorCode]?r={statusCode:$e[e.errorCode]}:i=e,null==(o=n.fail)||o.call(n,e)},complete:()=>{var e;i?s(i):o(r),null==(e=n.complete)||e.call(n)}}))}))}((function(e){return l(this,null,(function*(){var n,i;if(!Ke.includes(s)&&!(yield ze)){if(!Ye.includes(s)||!function(e){return void 0!==e.clientId}(e))return null==(n=e.fail)||n.call(e,{errorCode:x.sdkNotInitialized}),void(null==(i=e.complete)||i.call(e));We({clientId:e.clientId,env:e.env}),yield ze}const r=t[s];if(r&&"function"==typeof r)return r(e);xe(o,0,e,e)}))}),s)}});return window._pp=o,function(e){const t=window._ppcs;if(t){window._ppcs=void 0;for(const[n,o,s]of t){const t=e[n](o);s&&s(t)}}}(o),o}({sdkType:N.MiniApp,clientFunctions:et})}();
|