@paypay/mini-app-js-sdk 2.8.0 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/clientUtils.d.ts +1 -3
- package/dist/client/coreIframe.d.ts +1 -1
- package/dist/core/coreUtils.d.ts +5 -2
- package/dist/environment-variables.d.ts +3 -0
- package/dist/mini-app-js-sdk.browser.js +1 -1
- package/dist/mini-app-js-sdk.es.js +51 -65
- package/dist/model/bridge/getConfigure.d.ts +2 -2
- package/dist/package/button/index.d.ts +1 -1
- package/dist/types.d.ts +4 -3
- package/dist/utils/helper.d.ts +0 -1
- package/dist/utils/storage.d.ts +2 -0
- package/dist/views/registerPaymentFeatures/types.d.ts +1 -0
- package/package.json +8 -7
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { ClientJsBridge } from '../types';
|
|
2
|
-
export declare function checkIFrameOrigin(origin: string
|
|
3
|
-
export declare function getIframeOrigin(env: string | undefined, coreVersion?: string): string;
|
|
4
|
-
export declare function getIframeUrl(env: string | undefined, coreVersion?: string): string;
|
|
2
|
+
export declare function checkIFrameOrigin(origin: string): boolean;
|
|
5
3
|
export declare function getIconUrl(theme?: string): string;
|
|
6
4
|
export declare function convertToString(str?: string): string;
|
|
7
5
|
export declare function removeCookie(key: string, domain: string): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const IFRAME_NAME = "ppmna-iframe";
|
|
2
2
|
export declare const IFRAME_CONTAINER_NAME = "ppsdk-container";
|
|
3
|
-
export declare function initCoreIframe(
|
|
3
|
+
export declare function initCoreIframe(): void;
|
|
4
4
|
export declare function showCoreIframe(visible: boolean): void;
|
|
5
5
|
export declare function getCoreIframe(): Promise<HTMLIFrameElement | undefined>;
|
|
6
6
|
export declare function removeCoreIframe(): void;
|
package/dist/core/coreUtils.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NativeParams } from '../jsbridge-core/jsbridge';
|
|
2
|
+
import { Address, ConsoleDebugInfoParams, MiniAppResult } from '../types';
|
|
2
3
|
export declare function initCoreUtil(targetOrigin: string): void;
|
|
3
4
|
export declare function linkOpen(url: string, target?: string, isFocus?: boolean): void;
|
|
5
|
+
export declare function checkClientOrigin(origin: string | undefined): boolean;
|
|
4
6
|
export declare function sendRefreshTokenToClient(refreshToken: string, subdomainCookieSharing?: boolean): void;
|
|
5
7
|
export declare function sendCodeVerifierToClient(codeVerifier: string, url: string): void;
|
|
6
|
-
export declare function sendMakeIframeVisible(): void;
|
|
8
|
+
export declare function sendMakeIframeVisible(params: NativeParams<void> | NativeParams<MiniAppResult> | NativeParams<Address>): void;
|
|
9
|
+
export declare function checkMakeIframeVisible(): void;
|
|
7
10
|
export declare function sendDebugInfoToClient(data: ConsoleDebugInfoParams, env?: string | null, debugMode?: boolean): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document!="undefined"){var p=document.createElement("style");p.appendChild(document.createTextNode(".ppmna-reset-css{all:initial}.ppmna-reset-css *{text-align:unset;color:unset;background:initial;background-color:transparent;margin:revert;padding:revert;font-weight:revert;font-style:unset;font-size:unset;user-select:none;border:unset;border-radius:revert;vertical-align:unset;word-break:unset;outline:none;box-sizing:content-box}.ppmna-reset-css * img{display:inline-block}.ppmna-reset-css * input,.ppmna-reset-css * select{user-select:auto}.ppmna-reset-css * li{list-style:none}.ppmna-reset-css * :where(*:not(svg,svg *)){all:revert}.pp-smartButtonWrapper .pp-smartBtn{display:flex;align-items:center;border-radius:8px;border:none;font-size:14px;font-weight:600;line-height:22px;color:#fff;padding:0;width:100%;height:44px;margin:auto;-webkit-tap-highlight-color:transparent;text-decoration:none;box-sizing:border-box}.pp-smartButtonWrapper .pp-smartBtn.pp-sm .pp-leftSection .pp-btnContent{flex-direction:column}.pp-smartButtonWrapper .pp-smartBtn.pp-light{background:#fff;color:#242323}.pp-smartButtonWrapper .pp-smartBtn.pp-dark{background:#000}.pp-smartButtonWrapper .pp-smartBtn.pp-red{background:#ff0033}.pp-smartButtonWrapper .pp-smartBtn.pp-login{min-width:180px}.pp-smartButtonWrapper .pp-smartBtn.pp-login.pp-sm{width:180px!important}.pp-smartButtonWrapper .pp-smartBtn.pp-login.pp-light{border:1px solid #e4e4e8}.pp-smartButtonWrapper .pp-smartBtn.pp-login.pp-light .pp-userProfile{margin-right:4px}.pp-smartButtonWrapper .pp-smartBtn.pp-login .pp-leftSection .pp-btnContent{display:grid}.pp-smartButtonWrapper .pp-smartBtn.pp-pay{min-width:160px}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-light{border:1px solid #dddddd}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-light .pp-cashbackInfo{color:#ff954c;background:#fff0e5}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-red .pp-cashbackInfo{color:#f03}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-ja .pp-cashbackInfo{padding:2px 16px}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-sm{width:160px!important}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-sm.pp-cashback{height:66px;flex-direction:column;justify-content:center}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-sm .pp-cashbackInfo{margin:8px 0 0}.pp-smartButtonWrapper .pp-smartBtn.pp-pay .pp-leftSection .pp-img{width:24px;height:24px}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-shortText{font-size:16px}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-sm .pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-cashback .pp-leftSection .pp-btnContent,.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-shortText .pp-leftSection .pp-btnContent{margin-left:4px}.pp-smartButtonWrapper .pp-smartBtn .pp-leftSection{display:flex;justify-content:center;align-items:center;width:100%;box-sizing:border-box;padding:0 8px}.pp-smartButtonWrapper .pp-smartBtn .pp-leftSection .pp-img{width:20px;height:20px;display:inline-block}.pp-smartButtonWrapper .pp-smartBtn .pp-leftSection .pp-btnContent{margin-left:8px}.pp-smartButtonWrapper .pp-smartBtn .pp-leftSection .pp-btnContent .pp-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pp-smartButtonWrapper .pp-smartBtn .pp-cashbackInfo{font-size:12px;color:#242323;background:#fff;line-height:14px;padding:2px 8px;border-radius:9px;margin-left:8px}.pp-smartButtonWrapper .pp-smartBtn .pp-userProfile{width:34px;height:34px;border-radius:50%;margin-right:5px}.pp-smartButtonWrapper.pp-button{padding:0;margin:0;background:none;border:none;width:100%;border-radius:8px;-webkit-tap-highlight-color:transparent;font-family:revert!important}.pp-smartButtonWrapper.pp-button *{font-family:revert!important}")),document.head.appendChild(p)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
-
var pp=function(){"use strict";function e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)e[a]=n[a]}return e}var t=function t(n,a){function o(t,o,i){if("undefined"!=typeof document){"number"==typeof(i=e({},a,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var l="";for(var r in i)i[r]&&(l+="; "+r,!0!==i[r]&&(l+="="+i[r].split(";")[0]));return document.cookie=t+"="+n.write(o,t)+l}}return Object.create({set:o,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var t=document.cookie?document.cookie.split("; "):[],a={},o=0;o<t.length;o++){var i=t[o].split("="),l=i.slice(1).join("=");try{var r=decodeURIComponent(i[0]);if(a[r]=n.read(l,r),e===r)break}catch(s){}}return e?a[e]:a}},remove:function(t,n){o(t,"",e({},n,{expires:-1}))},withAttributes:function(n){return t(this.converter,e({},this.attributes,n))},withConverter:function(n){return t(e({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(a)},converter:{value:Object.freeze(n)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"}),n=(e=>(e.accessToken="ppjssdk.accessToken",e.refreshToken="ppjssdk.refreshToken",e.env="ppjssdk.env",e.deviceUUID="ppjssdk.deviceUUID",e.clientUUID="ppjssdk.clientUUID",e.lastPayment="ppjssdk.lastPayment",e.lastTopup="ppjssdk.lastTopup",e.appDetail="ppjssdk.appDetail",e.appConfig="ppjssdk.appConfig",e.userInfo="ppjssdk.userInfo",e.lastPaymentMethod="ppjssdk.lastPaymentMethod",e.lastTopupPayMethod="ppjssdk.lastTopupPayMethod",e.codeVerifier="ppjssdk.codeVerifier",e.clientOrigin="ppjssdk.clientOrigin",e.clientVersion="ppjssdk.clientVersion",e.debugMode="ppjssdk.debugMode",e.merchant="ppjssdk.merchant",e))(n||{});const a="success",o="fail",i="complete",l="init",r="render",s="makePayment",c="verifyMultiFactorAuthResult",d="share",u="scanCode",p="getAuthStatus",m="handleMessageFromNative",v="getKycPassportInfo",f="reload",I="link",E="saveRefreshToken",g="saveCodeVerifier",A="makeVisible",_="consoleDebugInfo",h="_PayPayJsBridge",T=["init","openWebview","openMap","closeApp","makePayment","topup","setSessionData","getSessionData","setStorageData","getStorageData","removeStorageData","getPermissionStatus","scanCode","showAlert","showErrorSheet","getTopBarHeight","setTitle","showUpdateWarning","getPlatformInformation","openApp","share","getKycInformation","getUserLocation","checkPaymentMethod","registerKyc","startMultiFactorAuth","verifyMultiFactorAuthResult","getBankInfo","logout","getUserProfile","getBalance","getUserAddress","getUAID","copyToClipboard","registerUserInfo","setEnablePullDownRefresh","registerEmail","checkAccessToken","debug","inputAddress","getDeviceInformation","openMiniApp","request","requestInternal","registerPaymentFeatures","initKycPassport","getKycPassportInfo","shortcutExists","addShortcut","logAppsFlyerEvent","getAllUserAddresses"];function N(e){return"https://image.paypay.ne.jp/miniapps/mini-app-sdk/"+e}const S=N("icon-paypay-rec.svg"),y=N("icon-paypay-rec-white.svg");function P(e,t,n){return e===D(t,n)}function D(e,t){return new URL(O(e,t)).origin}function O(e,t){return`${function(){switch(e){case"staging":case"sandbox":case"canary":case"qa":return"staging"===t?"https://mini-app-sdk-core.paypay.ne.jp/dev/stg/iframe.html":"https://mini-app-sdk-core.paypay.ne.jp/iframe.html";default:return"https://mini-app-sdk-core.paypay.ne.jp/iframe.html"}}()}?v=2.8.0`}function C(e){return e?String(e):""}function k(e,n){t.remove(e),t.remove(e,{domain:n})}let R=[];function U(e){R=R.filter((t=>t!==e))}function L(){const e=Math.random().toString(36).substring(7);return R.push(e),e}var b=(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))(b||{});const w="ppmna-iframe",M="ppsdk-container";let F,V,B,j,x,K;function H(){return j||(j=function(){const e=document.createElement("div");return document.createElement("div"),e.setAttribute("id",M),e.setAttribute("class",M),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=B||"2147483637",document.body.appendChild(e),e}()),j}function J(e){H().style.display=e?"initial":"none"}function Y(){return x||(x=new Promise(((e,t)=>{const n=document.createElement("iframe");n.setAttribute("src",O(F,V)),n.setAttribute("name",w),n.setAttribute("id",w),n.setAttribute("class",w),n.setAttribute("allow","geolocation"),n.onload=()=>{e(n)},n.onerror=t,n.style.all="initial",n.style.width="100%",n.style.height="100%",n.style.border="none";const a=H();a.innerHTML="",a.append(n)}))),x}let q=!1,$="";function z(e,t,n){var l,r,s;e.result===o&&(null==(l=null==t?void 0:t.fail)||l.call(t,e.data)),e.result===a&&(null==(r=null==t?void 0:t.success)||r.call(t,null==e?void 0:e.data)),e.result===i&&(null==(s=null==t?void 0:t.complete)||s.call(t),removeEventListener("message",n),U(e.messageId),R.length>0||J(!1))}async function W(e){var t;const n=await Y().catch((()=>{}));null==(t=null==n?void 0:n.contentWindow)||t.postMessage(JSON.parse(JSON.stringify(e)),D(K))}function Q(e,t,n,a){const o=L();J(t);const i=t=>{P(t.origin,K,$)&&t.data.name===e&&t.data.messageId===o&&z(t.data,n,i)};addEventListener("message",i),W({name:e,params:a,messageId:o})}addEventListener("message",(e=>{if(P(e.origin,K,$))if(e.data.name===f&&window.location.reload(),e.data.name!==A){if(e.data.name===I){const t=e.data.data;"_blank"===t.target?window.open(t.url,"_blank"):window.location.href=t.url}if(e.data.name===E){const{refreshToken:a,domain:o,isSecure:i}=e.data.data;!function(e,a,o){k(n.refreshToken,a),t.set(n.refreshToken,e,{domain:a,expires:90,secure:o})}(a,o,i)}if(e.data.name===g){const{codeVerifier:a,domain:o,isSecure:i}=e.data.data;!function(e,a,o){k(n.codeVerifier,a),t.set(n.codeVerifier,e,{domain:a,secure:o})}(a,o,i)}if(e.data.name===_){const{params:t}=e.data.data;!function(e){console.debug(...e)}(t)}}else J(!0)}));!function(e){const t=window;(!t.hasOwnProperty(h)||t._PayPayJsBridge!==e)&&(t._PayPayJsBridge=e)}({_handleMessageFromNative:async e=>{var t;const n=await Y();null==(t=null==n?void 0:n.contentWindow)||t.postMessage(JSON.parse(JSON.stringify({name:m,params:{json:e}})),D(K))}});const G=new Proxy({init:function(e){$=e.coreVersion;const a=new URL(window.location.href),o=a.searchParams.get("token"),i=a.searchParams.get("one_time_token"),r=t.get(n.refreshToken)||"",s=t.get(n.codeVerifier)||"";q=!!e.useAllFunctions,(o||i)&&function(e){e.searchParams.delete("token"),e.searchParams.delete("one_time_token"),e.search=e.searchParams.toString(),history.replaceState(null,"",e)}(a),K=e.env;const c={env:e.env,mode:e.mode,debugMode:e.debugMode,clientId:e.clientId,token:o,ott:i,refreshToken:r,clientVersion:"2.8.0",codeVerifier:s};var d,u,p;d=K,u=$,p=e.zIndex,F=d,V=u,B=p,Y(),Q(l,!1,e,c)},verifyMultiFactorAuthResult:function(e){const t=new URL(window.location.href);Q(c,!1,e,{...e,sessionId:t.searchParams.get("ppSessionId")})},share:function(e){if(!(null==navigator?void 0:navigator.share))return void Q(d,!1,e,e);const t={text:null==e?void 0:e.text};navigator.share(t).then((()=>{var t,n;null==(t=null==e?void 0:e.success)||t.call(e),null==(n=null==e?void 0:e.complete)||n.call(e)})).catch((()=>{var t,n;null==(t=null==e?void 0:e.fail)||t.call(e,{errorCode:b.unknown}),null==(n=null==e?void 0:e.complete)||n.call(e)}))},setTitle:function(e){var t,n;document.title=(null==e?void 0:e.title)||"",null==(t=null==e?void 0:e.success)||t.call(e),null==(n=null==e?void 0:e.complete)||n.call(e)},render:function(e){var t;if(!(null==e?void 0:e.containerId)||!document.getElementById(null==e?void 0:e.containerId))return null==(t=null==e?void 0:e.fail)||t.call(e,{errorCode:b.badRequestInsufficientParameter}),console.error("Invalid container Id");const n=L(),o=t=>{var l,c;if(!P(t.origin,K,$)||t.data.name!==r||t.data.messageId!==n)return;const d=null==(l=t.data)?void 0:l.data,u=null==(c=t.data)?void 0:c.data;t.data.result===a&&(!function(e,t){var n,a,o,i,l,r,c;const d=document.getElementById(t.containerId),u=document.createElement("button");u.className="ppmna-reset-css pp-smartButtonWrapper pp-button";const p=function(e){return"red"===e?y:S}(null==t?void 0:t.theme),m=(null==(a=null==(n=null==e?void 0:e.data)?void 0:n.cashbackInfo)?void 0:a.length)?"pp-cashback":"",v=t.isShortText?"pp-shortText":"",f=null!=(o=null==t?void 0:t.buttonSize)?o:"lg",I=null!=(i=null==t?void 0:t.theme)?i:"light",E=document.createElement("a");E.className=`pp-smartBtn pp-${I} pp-${f} pp-${C(t.type)} pp-${e.preferredLanguage} ${m} ${v}`,E.href=C(t.url);const g=document.createElement("span");g.className="pp-leftSection";const A=document.createElement("img");A.className="pp-img",A.src=p,A.alt="",g.appendChild(A);const _=document.createElement("span");_.className="pp-btnContent";const h=document.createElement("span");h.className="pp-title",h.innerText=null==(l=null==e?void 0:e.data)?void 0:l.title,_.appendChild(h),g.appendChild(_),E.append(g);const T=document.createElement("span");(null==(r=null==e?void 0:e.data)?void 0:r.cashbackInfo)&&(T.className="pp-cashbackInfo",T.innerText=null==(c=null==e?void 0:e.data)?void 0:c.cashbackInfo,_.append(T));if(e.data.avatarUrl){const t=document.createElement("img");t.className="pp-userProfile",t.src=e.data.avatarUrl,t.addEventListener("error",(function(e){var t;const n=e.target;null==(t=null==n?void 0:n.parentNode)||t.removeChild(n)})),E.append(t)}u.append(E),d&&(d.innerHTML="",d.appendChild(u),"pay"===t.type&&(null==e?void 0:e.isLoggedIn)&&u.addEventListener("click",(e=>{var n;e.preventDefault(),(null==t?void 0:t.callback)?null==(n=null==t?void 0:t.callback)||n.call(t):t.orderInfo&&Q(s,!0,t,{...t.orderInfo})})))}(u,e),"pay"===d.type&&(null==u?void 0:u.isJustLoggedIn)&&e.autoInvoke&&(null==u?void 0:u.isLoggedIn)&&Q(s,!0,e,{...e.orderInfo})),t.data.result===i&&(U(t.data.messageId),removeEventListener("message",o))};addEventListener("message",o),W({name:r,params:e,messageId:n})},scanCode:function(e){var t;const n={...e,redirectUrlOnCancel:null!=(t=null==e?void 0:e.redirectUrlOnCancel)?t:window.location.href};Q(u,!1,e,n)},copyToClipboard:function(e){var t,n,a;const o=document.createElement("textarea");o.setAttribute("readonly","true"),o.setAttribute("contenteditable","true"),o.value=e.value,document.body.appendChild(o),o.select(),o.setSelectionRange(0,o.value.length);const i=document.execCommand("copy");document.body.removeChild(o),i?null==(t=null==e?void 0:e.success)||t.call(e):null==(n=null==e?void 0:e.fail)||n.call(e,{errorCode:b.other}),null==(a=e.complete)||a.call(e)},getSessionData:function(e){var t,n;const a=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!=a?a:""}),null==(n=null==e?void 0:e.complete)||n.call(e)},setSessionData:function(e){var t,n,a;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==(a=null==e?void 0:e.complete)||a.call(e)},getStorageData:function(e){var t,n;const a=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!=a?a:""}),null==(n=null==e?void 0:e.complete)||n.call(e)},setStorageData:function(e){var t,n,a;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==(a=null==e?void 0:e.complete)||a.call(e)},removeStorageData:function(e){var t,n;localStorage.removeItem(null==e?void 0:e.key),null==(t=null==e?void 0:e.success)||t.call(e),null==(n=null==e?void 0:e.complete)||n.call(e)},getKycPassportInfo:function(e){const t=new URL(window.location.href);Q(v,!1,e,{...e,url:t})},getAuthStatus:function(e){const t=window.location.href;Q(p,!1,e,{...e,url:t})}},{get(e,t){const n=t;if(!q&&!function(e){return T.includes(e)}(n))throw new Error(`${n} is not supported by Mini Apps JS SDK`);return Object.prototype.hasOwnProperty.call(e,t)?e[t]:e=>{Q(t,!1,e,e)}}});return async function(){const e=window._ppcs;if(e){window._ppcs=void 0;for(const[t,n]of e)"init"===t?await new Promise((e=>{G[t]({...n,complete:()=>{var t;e(!0),null==(t=n.complete)||t.call(n)}})})).catch((()=>!1)):G[t](n)}}(),G}();
|
|
2
|
+
var pp=function(){"use strict";function e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}var t=function t(n,o){function a(t,a,l){if("undefined"!=typeof document){"number"==typeof(l=e({},o,l)).expires&&(l.expires=new Date(Date.now()+864e5*l.expires)),l.expires&&(l.expires=l.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var i="";for(var r in l)l[r]&&(i+="; "+r,!0!==l[r]&&(i+="="+l[r].split(";")[0]));return document.cookie=t+"="+n.write(a,t)+i}}return Object.create({set:a,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var t=document.cookie?document.cookie.split("; "):[],o={},a=0;a<t.length;a++){var l=t[a].split("="),i=l.slice(1).join("=");try{var r=decodeURIComponent(l[0]);if(o[r]=n.read(i,r),e===r)break}catch(s){}}return e?o[e]:o}},remove:function(t,n){a(t,"",e({},n,{expires:-1}))},withAttributes:function(n){return t(this.converter,e({},this.attributes,n))},withConverter:function(n){return t(e({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(n)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"}),n=(e=>(e.accessToken="ppjssdk.accessToken",e.refreshToken="ppjssdk.refreshToken",e.env="ppjssdk.env",e.deviceUUID="ppjssdk.deviceUUID",e.clientUUID="ppjssdk.clientUUID",e.lastPayment="ppjssdk.lastPayment",e.lastTopup="ppjssdk.lastTopup",e.appDetail="ppjssdk.appDetail",e.appConfig="ppjssdk.appConfig",e.userInfo="ppjssdk.userInfo",e.lastPaymentMethod="ppjssdk.lastPaymentMethod",e.lastTopupPayMethod="ppjssdk.lastTopupPayMethod",e.codeVerifier="ppjssdk.codeVerifier",e.clientOrigin="ppjssdk.clientOrigin",e.clientVersion="ppjssdk.clientVersion",e.debugMode="ppjssdk.debugMode",e.merchant="ppjssdk.merchant",e.consumedOTT="ppjssdk.consumedOTT",e))(n||{});const o="success",a="fail",l="complete",i="init",r="render",s="makePayment",c="verifyMultiFactorAuthResult",d="share",u="scanCode",p="getAuthStatus",m="handleMessageFromNative",v="getKycPassportInfo",I="reload",f="link",E="saveRefreshToken",A="saveCodeVerifier",g="makeVisible",_="consoleDebugInfo",h="_PayPayJsBridge",T=["init","openWebview","openMap","closeApp","makePayment","topup","setSessionData","getSessionData","setStorageData","getStorageData","removeStorageData","getPermissionStatus","scanCode","showAlert","showErrorSheet","getTopBarHeight","setTitle","showUpdateWarning","getPlatformInformation","openApp","share","getKycInformation","getUserLocation","checkPaymentMethod","registerKyc","startMultiFactorAuth","verifyMultiFactorAuthResult","getBankInfo","logout","getUserProfile","getBalance","getUserAddress","getUAID","copyToClipboard","registerUserInfo","setEnablePullDownRefresh","registerEmail","checkAccessToken","debug","inputAddress","getDeviceInformation","openMiniApp","request","requestInternal","registerPaymentFeatures","initKycPassport","getKycPassportInfo","shortcutExists","addShortcut","logAppsFlyerEvent","getAllUserAddresses"];function N(e){return"https://image.paypay.ne.jp/miniapps/mini-app-sdk/"+e}const S=N("icon-paypay-rec.svg"),y=N("icon-paypay-rec-white.svg"),O=new URL("https://mini-app-sdk-core.paypay.ne.jp/"),D=O.origin,P=new URL("./iframe.html?v=2.10.0",O).href;function C(e){return e===D}function k(e){return e?String(e):""}function R(e,n){t.remove(e),t.remove(e,{domain:n})}let U=[];function L(e){U=U.filter((t=>t!==e))}function b(){const e=Math.random().toString(36).substring(7);return U.push(e),e}var w=(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))(w||{});const M="ppmna-iframe",F="ppsdk-container";let V,B;function j(){return V||(V=function(){const e=document.createElement("div");return document.createElement("div"),e.setAttribute("id",F),e.setAttribute("class",F),e.style.all="initial",e.style.display="none",e.style.position="fixed",e.style.width="100%",e.style.height="100%",e.style.top="0",e.style.left="0",e.style.zIndex="2147483637",document.body.appendChild(e),e}()),V}function x(e){j().style.display=e?"initial":"none"}function K(){return B||(B=new Promise(((e,t)=>{const n=document.createElement("iframe");n.setAttribute("src",P),n.setAttribute("name",M),n.setAttribute("id",M),n.setAttribute("class",M),n.setAttribute("allow","geolocation"),n.onload=()=>{e(n)},n.onerror=t,n.style.all="initial",n.style.width="100%",n.style.height="100%",n.style.border="none";const o=j();o.innerHTML="",o.append(n)}))),B}let H=!1;"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(()=>{K()})):K();function J(e,t,n){var i,r,s;e.result===a&&(null==(i=null==t?void 0:t.fail)||i.call(t,e.data)),e.result===o&&(null==(r=null==t?void 0:t.success)||r.call(t,null==e?void 0:e.data)),e.result===l&&(null==(s=null==t?void 0:t.complete)||s.call(t),removeEventListener("message",n),L(e.messageId),U.length>0||x(!1))}async function Y(e){var t;const n=await K().catch((()=>{}));null==(t=null==n?void 0:n.contentWindow)||t.postMessage(JSON.parse(JSON.stringify(e)),D)}function q(e,t,n,o){const a=b();x(t);const l=t=>{C(t.origin)&&t.data.name===e&&t.data.messageId===a&&J(t.data,n,l)};addEventListener("message",l),Y({name:e,params:o,messageId:a})}addEventListener("message",(e=>{if(C(e.origin))if(e.data.name===I&&window.location.reload(),e.data.name!==g){if(e.data.name===f){const t=e.data.data;"_blank"===t.target?window.open(t.url,"_blank"):window.location.href=t.url}if(e.data.name===E){const{refreshToken:o,domain:a,isSecure:l}=e.data.data;!function(e,o,a){R(n.refreshToken,o),t.set(n.refreshToken,e,{domain:o,expires:90,secure:a})}(o,a,l)}if(e.data.name===A){const{codeVerifier:o,domain:a,isSecure:l}=e.data.data;!function(e,o,a){R(n.codeVerifier,o),t.set(n.codeVerifier,e,{domain:o,secure:a})}(o,a,l)}if(e.data.name===_){const{params:t}=e.data.data;!function(e){console.debug(...e)}(t)}}else x(!0)}));!function(e){const t=window;(!t.hasOwnProperty(h)||t._PayPayJsBridge!==e)&&(t._PayPayJsBridge=e)}({_handleMessageFromNative:e=>{K().then((t=>{var n;null==(n=null==t?void 0:t.contentWindow)||n.postMessage(JSON.parse(JSON.stringify({name:m,params:{json:e}})),D)}))}});const z=new Proxy({init:function(e){const o=new URL(window.location.href),a=o.searchParams.get("token"),l=o.searchParams.get("one_time_token"),r=t.get(n.refreshToken)||"",s=t.get(n.codeVerifier)||"";H=!!e.useAllFunctions,(a||l)&&function(e){e.searchParams.delete("token"),e.searchParams.delete("one_time_token"),e.search=e.searchParams.toString(),history.replaceState(null,"",e)}(o);const c={env:e.env,mode:e.mode,debugMode:e.debugMode,clientId:e.clientId,token:a,ott:l,refreshToken:r,clientVersion:"2.10.0",codeVerifier:s};K().then((()=>{q(i,!1,e,c)})).catch((()=>{var t,n;null==(t=e.fail)||t.call(e,{errorCode:w.sdkNotInitialized}),null==(n=e.complete)||n.call(e)}))},verifyMultiFactorAuthResult:function(e){const t=new URL(window.location.href);q(c,!1,e,{...e,sessionId:t.searchParams.get("ppSessionId")})},share:function(e){if(!(null==navigator?void 0:navigator.share))return void q(d,!1,e,e);const t={text:null==e?void 0:e.text};navigator.share(t).then((()=>{var t,n;null==(t=null==e?void 0:e.success)||t.call(e),null==(n=null==e?void 0:e.complete)||n.call(e)})).catch((()=>{var t,n;null==(t=null==e?void 0:e.fail)||t.call(e,{errorCode:w.unknown}),null==(n=null==e?void 0:e.complete)||n.call(e)}))},setTitle:function(e){var t,n;document.title=(null==e?void 0:e.title)||"",null==(t=null==e?void 0:e.success)||t.call(e),null==(n=null==e?void 0:e.complete)||n.call(e)},render:function(e){var t;if(!(null==e?void 0:e.containerId)||!document.getElementById(null==e?void 0:e.containerId))return null==(t=null==e?void 0:e.fail)||t.call(e,{errorCode:w.badRequestInsufficientParameter}),console.error("Invalid container Id");const n=b(),a=t=>{var i,c;if(!C(t.origin)||t.data.name!==r||t.data.messageId!==n)return;const d=null==(i=t.data)?void 0:i.data,u=null==(c=t.data)?void 0:c.data;t.data.result===o&&(!function(e,t){var n,o,a,l,i,r,c;const d=document.getElementById(t.containerId),u=document.createElement("button");u.className="ppmna-reset-css pp-smartButtonWrapper pp-button";const p=function(e){return"red"===e?y:S}(null==t?void 0:t.theme),m=(null==(o=null==(n=null==e?void 0:e.data)?void 0:n.cashbackInfo)?void 0:o.length)?"pp-cashback":"",v=t.isShortText?"pp-shortText":"",I=null!=(a=null==t?void 0:t.buttonSize)?a:"lg",f=null!=(l=null==t?void 0:t.theme)?l:"light",E=document.createElement("a");E.className=`pp-smartBtn pp-${f} pp-${I} pp-${k(t.type)} pp-${e.preferredLanguage} ${m} ${v}`,E.href=k(t.url);const A=document.createElement("span");A.className="pp-leftSection";const g=document.createElement("img");g.className="pp-img",g.src=p,g.alt="",A.appendChild(g);const _=document.createElement("span");_.className="pp-btnContent";const h=document.createElement("span");h.className="pp-title",h.innerText=null==(i=null==e?void 0:e.data)?void 0:i.title,_.appendChild(h),A.appendChild(_),E.append(A);const T=document.createElement("span");(null==(r=null==e?void 0:e.data)?void 0:r.cashbackInfo)&&(T.className="pp-cashbackInfo",T.innerText=null==(c=null==e?void 0:e.data)?void 0:c.cashbackInfo,_.append(T));if(e.data.avatarUrl){const t=document.createElement("img");t.className="pp-userProfile",t.src=e.data.avatarUrl,t.addEventListener("error",(function(e){var t;const n=e.target;null==(t=null==n?void 0:n.parentNode)||t.removeChild(n)})),E.append(t)}u.append(E),d&&(d.innerHTML="",d.appendChild(u),"pay"===t.type&&(null==e?void 0:e.isLoggedIn)&&u.addEventListener("click",(e=>{var n;e.preventDefault(),(null==t?void 0:t.callback)?null==(n=null==t?void 0:t.callback)||n.call(t):t.orderInfo&&q(s,!0,t,{...t.orderInfo})})))}(u,e),"pay"===d.type&&(null==u?void 0:u.isJustLoggedIn)&&e.autoInvoke&&(null==u?void 0:u.isLoggedIn)&&q(s,!0,e,{...e.orderInfo})),t.data.result===l&&(L(t.data.messageId),removeEventListener("message",a))};addEventListener("message",a),Y({name:r,params:e,messageId:n})},scanCode:function(e){var t;const n={...e,redirectUrlOnCancel:null!=(t=null==e?void 0:e.redirectUrlOnCancel)?t:window.location.href};q(u,!1,e,n)},copyToClipboard:function(e){var t,n,o;const a=document.createElement("textarea");a.setAttribute("readonly","true"),a.setAttribute("contenteditable","true"),a.value=e.value,document.body.appendChild(a),a.select(),a.setSelectionRange(0,a.value.length);const l=document.execCommand("copy");document.body.removeChild(a),l?null==(t=null==e?void 0:e.success)||t.call(e):null==(n=null==e?void 0:e.fail)||n.call(e,{errorCode:w.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=new URL(window.location.href);q(v,!1,e,{...e,url:t})},getAuthStatus:function(e){const t=window.location.href;q(p,!1,e,{...e,url:t})}},{get(e,t){const n=t;if(!H&&!function(e){return T.includes(e)}(n))throw new Error(`${n} is not supported by Mini Apps JS SDK`);return Object.prototype.hasOwnProperty.call(e,t)?e[t]:e=>{q(t,!1,e,e)}}});return async function(){const e=window._ppcs;if(e){window._ppcs=void 0;for(const[t,n]of e)"init"===t?await new Promise((e=>{z[t]({...n,complete:()=>{var t;e(!0),null==(t=n.complete)||t.call(n)}})})).catch((()=>!1)):z[t](n)}}(),z}();
|
|
@@ -114,6 +114,7 @@ var PpLocalStorageKey = /* @__PURE__ */ ((PpLocalStorageKey2) => {
|
|
|
114
114
|
PpLocalStorageKey2["clientVersion"] = "ppjssdk.clientVersion";
|
|
115
115
|
PpLocalStorageKey2["debugMode"] = "ppjssdk.debugMode";
|
|
116
116
|
PpLocalStorageKey2["merchant"] = "ppjssdk.merchant";
|
|
117
|
+
PpLocalStorageKey2["consumedOTT"] = "ppjssdk.consumedOTT";
|
|
117
118
|
return PpLocalStorageKey2;
|
|
118
119
|
})(PpLocalStorageKey || {});
|
|
119
120
|
const PPFunctionResult = {
|
|
@@ -237,33 +238,15 @@ function url(path) {
|
|
|
237
238
|
}
|
|
238
239
|
const img_paypayRec = url("icon-paypay-rec.svg");
|
|
239
240
|
const img_paypayRecWhite = url("icon-paypay-rec-white.svg");
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
function
|
|
248
|
-
|
|
249
|
-
return `${getUrl()}?v=${version}`;
|
|
250
|
-
function getUrl() {
|
|
251
|
-
switch (env2) {
|
|
252
|
-
case "staging":
|
|
253
|
-
case "sandbox":
|
|
254
|
-
case "canary":
|
|
255
|
-
case "qa": {
|
|
256
|
-
if (coreVersion2 === "staging") {
|
|
257
|
-
return "https://mini-app-sdk-core.paypay.ne.jp/dev/stg/iframe.html";
|
|
258
|
-
} else {
|
|
259
|
-
return "https://mini-app-sdk-core.paypay.ne.jp/iframe.html";
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
case "production":
|
|
263
|
-
default:
|
|
264
|
-
return "https://mini-app-sdk-core.paypay.ne.jp/iframe.html";
|
|
265
|
-
}
|
|
266
|
-
}
|
|
241
|
+
const JS_SDK_VERSION = "2.10.0";
|
|
242
|
+
const coreBaseUrl = new URL("https://mini-app-sdk-core.paypay.ne.jp/");
|
|
243
|
+
const CORE_IFRAME_ORIGIN = coreBaseUrl.origin;
|
|
244
|
+
const CORE_IFRAME_URL = new URL(
|
|
245
|
+
`./iframe.html?v=${JS_SDK_VERSION}`,
|
|
246
|
+
coreBaseUrl
|
|
247
|
+
).href;
|
|
248
|
+
function checkIFrameOrigin(origin) {
|
|
249
|
+
return origin === CORE_IFRAME_ORIGIN;
|
|
267
250
|
}
|
|
268
251
|
function getIconUrl(theme) {
|
|
269
252
|
return theme === "red" ? img_paypayRecWhite : img_paypayRec;
|
|
@@ -394,14 +377,14 @@ var MiniAppErrorType = /* @__PURE__ */ ((MiniAppErrorType2) => {
|
|
|
394
377
|
var style = "";
|
|
395
378
|
const IFRAME_NAME = "ppmna-iframe";
|
|
396
379
|
const IFRAME_CONTAINER_NAME = "ppsdk-container";
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
380
|
+
function initCoreIframe() {
|
|
381
|
+
if (document.readyState === "loading") {
|
|
382
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
383
|
+
void getCoreIframe();
|
|
384
|
+
});
|
|
385
|
+
} else {
|
|
386
|
+
void getCoreIframe();
|
|
387
|
+
}
|
|
405
388
|
}
|
|
406
389
|
let iframeContainer;
|
|
407
390
|
function getCoreIframeContainer() {
|
|
@@ -422,7 +405,7 @@ function createIframeContainer() {
|
|
|
422
405
|
container.style.height = "100%";
|
|
423
406
|
container.style.top = "0";
|
|
424
407
|
container.style.left = "0";
|
|
425
|
-
container.style.zIndex =
|
|
408
|
+
container.style.zIndex = "2147483637";
|
|
426
409
|
document.body.appendChild(container);
|
|
427
410
|
return container;
|
|
428
411
|
}
|
|
@@ -440,7 +423,7 @@ function getCoreIframe() {
|
|
|
440
423
|
function createIframe() {
|
|
441
424
|
return new Promise((resolve, reject) => {
|
|
442
425
|
const iframe = document.createElement("iframe");
|
|
443
|
-
iframe.setAttribute("src",
|
|
426
|
+
iframe.setAttribute("src", CORE_IFRAME_URL);
|
|
444
427
|
iframe.setAttribute("name", IFRAME_NAME);
|
|
445
428
|
iframe.setAttribute("id", IFRAME_NAME);
|
|
446
429
|
iframe.setAttribute("class", IFRAME_NAME);
|
|
@@ -458,11 +441,10 @@ function createIframe() {
|
|
|
458
441
|
container.append(iframe);
|
|
459
442
|
});
|
|
460
443
|
}
|
|
461
|
-
let env;
|
|
462
444
|
let useAllFunctions = false;
|
|
463
|
-
|
|
445
|
+
initCoreIframe();
|
|
464
446
|
const commonMessageHandler = (e) => {
|
|
465
|
-
if (!checkIFrameOrigin(e.origin
|
|
447
|
+
if (!checkIFrameOrigin(e.origin)) {
|
|
466
448
|
return;
|
|
467
449
|
}
|
|
468
450
|
if (e.data.name === PPUtilFunctionName.reload) {
|
|
@@ -495,18 +477,16 @@ const commonMessageHandler = (e) => {
|
|
|
495
477
|
};
|
|
496
478
|
addEventListener("message", commonMessageHandler);
|
|
497
479
|
function init(params) {
|
|
498
|
-
coreVersion = params.coreVersion;
|
|
499
480
|
const url2 = new URL(window.location.href);
|
|
500
481
|
const token = url2.searchParams.get("token");
|
|
501
482
|
const ott = url2.searchParams.get("one_time_token");
|
|
502
483
|
const refreshToken = getRefreshToken();
|
|
503
484
|
const codeVerifier = getCodeVerifier();
|
|
504
|
-
const clientVersion = "2.
|
|
485
|
+
const clientVersion = "2.10.0";
|
|
505
486
|
useAllFunctions = !!params.useAllFunctions;
|
|
506
487
|
if (token || ott) {
|
|
507
488
|
removeTokenFromUrl(url2);
|
|
508
489
|
}
|
|
509
|
-
env = params.env;
|
|
510
490
|
const initParams = {
|
|
511
491
|
env: params.env,
|
|
512
492
|
mode: params.mode,
|
|
@@ -518,8 +498,13 @@ function init(params) {
|
|
|
518
498
|
clientVersion,
|
|
519
499
|
codeVerifier
|
|
520
500
|
};
|
|
521
|
-
|
|
522
|
-
|
|
501
|
+
getCoreIframe().then(() => {
|
|
502
|
+
triggerPostMessageToCore(PPFunctionName.init, false, params, initParams);
|
|
503
|
+
}).catch(() => {
|
|
504
|
+
var _a, _b;
|
|
505
|
+
(_a = params.fail) == null ? void 0 : _a.call(params, { errorCode: MiniAppErrorType.sdkNotInitialized });
|
|
506
|
+
(_b = params.complete) == null ? void 0 : _b.call(params);
|
|
507
|
+
});
|
|
523
508
|
}
|
|
524
509
|
function getAuthStatus(params) {
|
|
525
510
|
const url2 = window.location.href;
|
|
@@ -584,7 +569,7 @@ function render(params) {
|
|
|
584
569
|
const messageId = functionStart();
|
|
585
570
|
const getRenderMessageHandler = (e) => {
|
|
586
571
|
var _a2, _b;
|
|
587
|
-
if (!checkIFrameOrigin(e.origin
|
|
572
|
+
if (!checkIFrameOrigin(e.origin) || e.data.name !== PPFunctionName.render || e.data.messageId !== messageId) {
|
|
588
573
|
return;
|
|
589
574
|
}
|
|
590
575
|
const info = (_a2 = e.data) == null ? void 0 : _a2.data;
|
|
@@ -603,7 +588,7 @@ function render(params) {
|
|
|
603
588
|
}
|
|
604
589
|
};
|
|
605
590
|
addEventListener("message", getRenderMessageHandler);
|
|
606
|
-
postMessageToCore({
|
|
591
|
+
void postMessageToCore({
|
|
607
592
|
name: PPFunctionName.render,
|
|
608
593
|
params,
|
|
609
594
|
messageId
|
|
@@ -688,7 +673,7 @@ async function postMessageToCore(messageData) {
|
|
|
688
673
|
const iframe = await getCoreIframe().catch(() => void 0);
|
|
689
674
|
(_a = iframe == null ? void 0 : iframe.contentWindow) == null ? void 0 : _a.postMessage(
|
|
690
675
|
JSON.parse(JSON.stringify(messageData)),
|
|
691
|
-
|
|
676
|
+
CORE_IFRAME_ORIGIN
|
|
692
677
|
);
|
|
693
678
|
}
|
|
694
679
|
function removeTokenFromUrl(url2) {
|
|
@@ -701,7 +686,7 @@ function triggerPostMessageToCore(type, showIframeFlag, params, postMessageParam
|
|
|
701
686
|
const messageId = functionStart();
|
|
702
687
|
showCoreIframe(showIframeFlag);
|
|
703
688
|
const fnMessageHandler = (e) => {
|
|
704
|
-
if (!checkIFrameOrigin(e.origin
|
|
689
|
+
if (!checkIFrameOrigin(e.origin)) {
|
|
705
690
|
return;
|
|
706
691
|
}
|
|
707
692
|
if (e.data.name === type) {
|
|
@@ -711,7 +696,7 @@ function triggerPostMessageToCore(type, showIframeFlag, params, postMessageParam
|
|
|
711
696
|
}
|
|
712
697
|
};
|
|
713
698
|
addEventListener("message", fnMessageHandler);
|
|
714
|
-
postMessageToCore({
|
|
699
|
+
void postMessageToCore({
|
|
715
700
|
name: type,
|
|
716
701
|
params: postMessageParams,
|
|
717
702
|
messageId
|
|
@@ -784,20 +769,21 @@ function renderButton(data, params) {
|
|
|
784
769
|
}
|
|
785
770
|
}
|
|
786
771
|
const clientJsBridge = {
|
|
787
|
-
_handleMessageFromNative:
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
772
|
+
_handleMessageFromNative: (json) => {
|
|
773
|
+
void getCoreIframe().then((iframe) => {
|
|
774
|
+
var _a;
|
|
775
|
+
(_a = iframe == null ? void 0 : iframe.contentWindow) == null ? void 0 : _a.postMessage(
|
|
776
|
+
JSON.parse(
|
|
777
|
+
JSON.stringify({
|
|
778
|
+
name: PPFunctionName.handleMessageFromNative,
|
|
779
|
+
params: {
|
|
780
|
+
json
|
|
781
|
+
}
|
|
782
|
+
})
|
|
783
|
+
),
|
|
784
|
+
CORE_IFRAME_ORIGIN
|
|
785
|
+
);
|
|
786
|
+
});
|
|
801
787
|
}
|
|
802
788
|
};
|
|
803
789
|
exposeClientJsBridge(clientJsBridge);
|
|
@@ -865,5 +851,5 @@ async function executePendingFunctionCalls() {
|
|
|
865
851
|
}
|
|
866
852
|
}
|
|
867
853
|
}
|
|
868
|
-
executePendingFunctionCalls();
|
|
854
|
+
void executePendingFunctionCalls();
|
|
869
855
|
export { proxy as default };
|
|
@@ -33,7 +33,7 @@ export declare type ConfigurationResponse = {
|
|
|
33
33
|
variables: Variables;
|
|
34
34
|
};
|
|
35
35
|
export declare function initAppConfiguration(): Promise<boolean>;
|
|
36
|
-
declare type AppConfig = {
|
|
36
|
+
export declare type AppConfig = {
|
|
37
37
|
topupButtonsAmount: Array<{
|
|
38
38
|
description: string;
|
|
39
39
|
value: number[];
|
|
@@ -58,5 +58,5 @@ declare type AppConfig = {
|
|
|
58
58
|
value: number;
|
|
59
59
|
}>;
|
|
60
60
|
};
|
|
61
|
-
export declare function getAppConfig(): AppConfig | null
|
|
61
|
+
export declare function getAppConfig(): Promise<AppConfig | null>;
|
|
62
62
|
export {};
|
|
@@ -82,8 +82,8 @@ export declare const Button: import("vue").DefineComponent<{
|
|
|
82
82
|
}, {
|
|
83
83
|
type: ButtonType;
|
|
84
84
|
name: string;
|
|
85
|
-
class: string | Record<string, any>;
|
|
86
85
|
loading: boolean;
|
|
86
|
+
class: string | Record<string, any>;
|
|
87
87
|
disabled: boolean;
|
|
88
88
|
block: boolean;
|
|
89
89
|
size: ButtonSize;
|
package/dist/types.d.ts
CHANGED
|
@@ -52,8 +52,6 @@ export interface InitClientParams extends NativeParams<MiniAppResult> {
|
|
|
52
52
|
mode?: string;
|
|
53
53
|
debugMode?: boolean;
|
|
54
54
|
useAllFunctions?: boolean;
|
|
55
|
-
coreVersion?: string;
|
|
56
|
-
zIndex?: string;
|
|
57
55
|
}
|
|
58
56
|
export interface InitParams extends NativeParams<MiniAppResult> {
|
|
59
57
|
clientId?: string;
|
|
@@ -310,6 +308,7 @@ export interface RenderSmartButtonParams extends NativeParams<MiniAppResult> {
|
|
|
310
308
|
callback?: () => void;
|
|
311
309
|
getDefault?: boolean;
|
|
312
310
|
renderId?: string;
|
|
311
|
+
clientOrigin?: string;
|
|
313
312
|
}
|
|
314
313
|
export interface SmartButtonParam {
|
|
315
314
|
title: string;
|
|
@@ -424,7 +423,8 @@ export declare enum PpLocalStorageKey {
|
|
|
424
423
|
clientOrigin = "ppjssdk.clientOrigin",
|
|
425
424
|
clientVersion = "ppjssdk.clientVersion",
|
|
426
425
|
debugMode = "ppjssdk.debugMode",
|
|
427
|
-
merchant = "ppjssdk.merchant"
|
|
426
|
+
merchant = "ppjssdk.merchant",
|
|
427
|
+
consumedOTT = "ppjssdk.consumedOTT"
|
|
428
428
|
}
|
|
429
429
|
export declare enum KycPassportMethod {
|
|
430
430
|
biometric = "BIOMETRIC",
|
|
@@ -499,6 +499,7 @@ export interface GetAuthStatusClientParams extends NativeParams<MiniAppResult, A
|
|
|
499
499
|
export interface GetAuthStatusParams extends NativeParams<MiniAppResult, AuthStatusFailResult> {
|
|
500
500
|
isInternal?: boolean;
|
|
501
501
|
url?: string;
|
|
502
|
+
clientOrigin?: string;
|
|
502
503
|
}
|
|
503
504
|
export declare type ErrorSheetButton = {
|
|
504
505
|
title: string;
|
package/dist/utils/helper.d.ts
CHANGED
|
@@ -62,7 +62,6 @@ export declare function generateCodeChallange(codeVerifier: string): Promise<str
|
|
|
62
62
|
export declare function openUrl(linkUrl: string): void;
|
|
63
63
|
export declare function getButtonType(button: UIComponentsErrorButton | ErrorSheetButton, onlyButton?: boolean): "success" | "default" | "primary" | "warning" | "danger" | "link" | "outLined";
|
|
64
64
|
export declare function saveUserData(): void;
|
|
65
|
-
export declare function getDomain(subdomainCookieSharing: boolean, hostname: string): string;
|
|
66
65
|
export declare function getRandomString(): string;
|
|
67
66
|
export declare function isAlphabet(value: string): boolean;
|
|
68
67
|
export declare function reconstructKycPassportCallbackUrl(url: string, type: string): string;
|
package/dist/utils/storage.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export declare function removeLocalStorage(key: string): void;
|
|
|
5
5
|
export declare function saveAccessToken(token: string): void;
|
|
6
6
|
export declare function getRefreshToken(): string;
|
|
7
7
|
export declare function saveRefreshToken(token: string): void;
|
|
8
|
+
export declare function getConsumedOtt(): string | null;
|
|
9
|
+
export declare function saveConsumedOtt(ott: string): void;
|
|
8
10
|
export declare function saveEnv(env: string): void;
|
|
9
11
|
export declare function getEnv(): string | null;
|
|
10
12
|
export declare function getClientUUID(): string;
|
|
@@ -21,6 +21,7 @@ export declare type TopupConfigurationData = {
|
|
|
21
21
|
paymentMethodList?: PaymentMethodInfo[];
|
|
22
22
|
appealDescription: DescriptionInfo;
|
|
23
23
|
preTransactionAutoTopupPaymentMethod?: PaymentMethodInfo;
|
|
24
|
+
notificationDescription?: DescriptionInfo;
|
|
24
25
|
};
|
|
25
26
|
export declare type UpdatePreTransactionAutoTopupConfigurationParams = {
|
|
26
27
|
isEnabled: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paypay/mini-app-js-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "yarn build:client && yarn build:core && yarn build:init && yarn build:client:nightly",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"upgrade": "yarn upgrade-interactive",
|
|
21
21
|
"test": "jest --silent --coverage",
|
|
22
22
|
"test:watch": "jest --watch",
|
|
23
|
-
"preview": "
|
|
23
|
+
"preview": "yarn dev:client & vite preview --config vite.config.core.ts --port 3100"
|
|
24
24
|
},
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"author": "paypay",
|
|
@@ -35,11 +35,6 @@
|
|
|
35
35
|
"js-cookie": "^3.0.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"uuid": "^8.3.2",
|
|
39
|
-
"vue": "^3.2.39",
|
|
40
|
-
"ua-parser-js": "^1.0.2",
|
|
41
|
-
"pinia": "^2.0.20",
|
|
42
|
-
"lottie-web": "^5.9.6",
|
|
43
38
|
"@babel/core": "^7.15.5",
|
|
44
39
|
"@babel/plugin-transform-typescript": "^7.15.4",
|
|
45
40
|
"@babel/preset-env": "^7.15.4",
|
|
@@ -51,6 +46,7 @@
|
|
|
51
46
|
"@types/ip": "^1.1.0",
|
|
52
47
|
"@types/jest": "^26.0.24",
|
|
53
48
|
"@types/js-cookie": "^2.2.7",
|
|
49
|
+
"@types/lodash": "^4.14.195",
|
|
54
50
|
"@types/ua-parser-js": "^0.7.36",
|
|
55
51
|
"@types/uuid": "^8.3.1",
|
|
56
52
|
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
|
@@ -76,15 +72,20 @@
|
|
|
76
72
|
"jest-transform-stub": "^2.0.0",
|
|
77
73
|
"less": "^4.1.1",
|
|
78
74
|
"lint-staged": "^11.1.2",
|
|
75
|
+
"lottie-web": "^5.9.6",
|
|
76
|
+
"pinia": "^2.0.20",
|
|
79
77
|
"postcss-html": "^1.4.1",
|
|
80
78
|
"postcss-less": "^6.0.0",
|
|
81
79
|
"prettier": "^2.8.7",
|
|
82
80
|
"stylelint": "^14.9.1",
|
|
83
81
|
"ts-jest": "^26.5.6",
|
|
84
82
|
"typescript": "~4.4.2",
|
|
83
|
+
"ua-parser-js": "^1.0.2",
|
|
84
|
+
"uuid": "^8.3.2",
|
|
85
85
|
"vite": "^2.9.15",
|
|
86
86
|
"vite-plugin-css-injected-by-js": "^2.1.0",
|
|
87
87
|
"vite-plugin-dts": "^0.9.10",
|
|
88
|
+
"vue": "^3.2.39",
|
|
88
89
|
"vue-eslint-parser": "^9.1.1",
|
|
89
90
|
"vue-jest": "5.0.0-alpha.9",
|
|
90
91
|
"vue-tsc": "^1.0.24"
|