@paypay/mini-app-js-sdk 2.63.0 → 2.64.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/communicationWithCore.d.ts +1 -0
- package/dist/core/clientState.d.ts +2 -0
- package/dist/core/cookieMode.d.ts +3 -0
- package/dist/core/coreFunctions/claimCoupon.d.ts +4 -1
- package/dist/core/coreFunctions/getCurrentClientOrigin.d.ts +5 -0
- package/dist/core/coreFunctions/index.d.ts +2 -0
- package/dist/core/coreFunctions/logout.d.ts +1 -1
- package/dist/core/coreFunctions/middlewares/internalOnly.d.ts +2 -0
- package/dist/core/coreUtils.d.ts +3 -5
- package/dist/core/coupon/couponFunctions/renderCoupons.d.ts +1 -1
- package/dist/jsbridge-core/jsbridge.d.ts +1 -1
- package/dist/mini-app-api.d.ts +1 -1
- package/dist/mini-app-js-sdk.browser.js +1 -1
- package/dist/mini-app-js-sdk.es.js +18 -23
- package/dist/model/bridge/getConfigure.d.ts +3 -6
- package/dist/model/bridge/init.d.ts +3 -0
- package/dist/types/makePayment.d.ts +1 -0
- package/dist/utils/fetch.d.ts +11 -0
- package/dist/utils/helper.d.ts +0 -2
- package/dist/utils/pureHelpers.d.ts +1 -1
- package/dist/utils/storage.d.ts +1 -0
- package/dist/views/coupon/components/CouponAction/index.d.ts +2 -0
- package/dist/views/coupon/index.d.ts +10 -0
- package/dist/views/make-payment/store.d.ts +13 -0
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ export declare type ClientFunctions = WindowBridgeFunctions<typeof clientWindowB
|
|
|
7
7
|
export declare const coreFunctions: WindowBridgeFunctions<{
|
|
8
8
|
claimCoupon: typeof import("../core/coreFunctions/claimCoupon").claimCoupon;
|
|
9
9
|
fetchCoupons: typeof import("../core/coreFunctions/fetchCoupons").fetchCoupons;
|
|
10
|
+
getCurrentClientOrigin: typeof import("../core/coreFunctions/getCurrentClientOrigin").getCurrentClientOrigin;
|
|
10
11
|
getLoginUrl: typeof import("../core/coreFunctions/getLoginUrl").getLoginUrl;
|
|
11
12
|
getPaymentSettings: typeof import("../core/coreFunctions/getPaymentSettings").getPaymentSettings;
|
|
12
13
|
logEvent: typeof import("../core/coreFunctions/logEvent").logEvent;
|
|
@@ -3,6 +3,8 @@ export declare function getCurrentClientId(): string;
|
|
|
3
3
|
export declare function getCurrentClientOrigin(): string;
|
|
4
4
|
export declare function getCurrentClientSdkType(): SdkType | undefined;
|
|
5
5
|
export declare function getUseLocalStorage(): boolean;
|
|
6
|
+
export declare const MINI_APP_CLIENTS: readonly string[];
|
|
7
|
+
export declare function isOnMiniAppWebView(): boolean;
|
|
6
8
|
export declare function getClientSdkTypeFallback(clientId: string): SdkType;
|
|
7
9
|
export declare function isMessageAllowed(e: MessageEvent<ClientMessageData>): boolean;
|
|
8
10
|
export declare function initClientState(params: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { internalOnly } from './middlewares/internalOnly';
|
|
1
2
|
interface ClaimCouponParams {
|
|
2
3
|
merchantId: string;
|
|
3
4
|
couponId: string;
|
|
@@ -8,6 +9,8 @@ declare type ClaimCouponResult = {
|
|
|
8
9
|
} | {
|
|
9
10
|
userActionRequired: false;
|
|
10
11
|
};
|
|
11
|
-
export declare const CLAIM_COUPON_URL = "web-api/app/v1/coupons/claim";
|
|
12
12
|
export declare function claimCoupon({ merchantId, couponId, }: ClaimCouponParams): Promise<ClaimCouponResult>;
|
|
13
|
+
export declare namespace claimCoupon {
|
|
14
|
+
var middlewares: (typeof internalOnly)[];
|
|
15
|
+
}
|
|
13
16
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { claimCoupon } from './claimCoupon';
|
|
2
2
|
import { fetchCoupons } from './fetchCoupons';
|
|
3
|
+
import { getCurrentClientOrigin } from './getCurrentClientOrigin';
|
|
3
4
|
import { getLoginUrl } from './getLoginUrl';
|
|
4
5
|
import { getPaymentSettings } from './getPaymentSettings';
|
|
5
6
|
import { logEvent } from './logEvent';
|
|
@@ -9,6 +10,7 @@ import { renderButton } from './renderButton';
|
|
|
9
10
|
declare const coreFunctions: {
|
|
10
11
|
claimCoupon: typeof claimCoupon;
|
|
11
12
|
fetchCoupons: typeof fetchCoupons;
|
|
13
|
+
getCurrentClientOrigin: typeof getCurrentClientOrigin;
|
|
12
14
|
getLoginUrl: typeof getLoginUrl;
|
|
13
15
|
getPaymentSettings: typeof getPaymentSettings;
|
|
14
16
|
logEvent: typeof logEvent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function logout(): boolean
|
|
1
|
+
export declare function logout(): Promise<boolean>;
|
package/dist/core/coreUtils.d.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { NativeParams } from '../jsbridge-core/jsbridge';
|
|
2
2
|
import { ConsoleDebugInfoParams } from '../types';
|
|
3
|
-
import {
|
|
3
|
+
import { PKCEChallengeType } from '../types/getAuthStatus';
|
|
4
4
|
export declare const OTT_QUERY_PARAMETERS: string[];
|
|
5
5
|
export declare function getClientFunctions(): import('../utils/windowBridge').WindowBridgeFunctions<typeof import("../client/windowBridgeFunctions")>;
|
|
6
6
|
export declare function linkOpen(url: string, target?: string, isFocus?: boolean): void;
|
|
7
7
|
export declare function getDomain(subdomainCookieSharing: boolean, hostname: string): string;
|
|
8
|
+
export declare function isConfirmedMiniApp(): boolean;
|
|
8
9
|
export declare function sendRefreshTokenToClient(refreshToken: string, subdomainCookieSharing: boolean): void;
|
|
9
10
|
export declare function removeRefreshTokenFromClient(subdomainCookieSharing: boolean | undefined): void;
|
|
10
|
-
export declare function getPkceCodeChallenge(): Promise<
|
|
11
|
-
challenge: string;
|
|
12
|
-
challengeMethod: ChallengeMethod;
|
|
13
|
-
}>;
|
|
11
|
+
export declare function getPkceCodeChallenge(): Promise<PKCEChallengeType>;
|
|
14
12
|
export declare function sendMakeIframeVisible<T extends NativeParams<any>>(params: T): void;
|
|
15
13
|
export declare function checkMakeIframeVisible(): void;
|
|
16
14
|
export declare function sendDebugInfoToClient(data: ConsoleDebugInfoParams, env?: string | null, debugMode?: boolean): void;
|
|
@@ -5,5 +5,5 @@ interface RenderCouponsParams extends PostLogInRedirectParams {
|
|
|
5
5
|
merchantId: string;
|
|
6
6
|
locale?: Locale;
|
|
7
7
|
}
|
|
8
|
-
export declare function renderCoupons({ coupons, merchantId, locale, postLoginRedirectUrl, postLoginRedirectType, }: RenderCouponsParams): void
|
|
8
|
+
export declare function renderCoupons({ coupons, merchantId, locale, postLoginRedirectUrl, postLoginRedirectType, }: RenderCouponsParams): Promise<void>;
|
|
9
9
|
export {};
|
|
@@ -46,7 +46,7 @@ export declare class JsBridge {
|
|
|
46
46
|
version: string | undefined;
|
|
47
47
|
revision: string | undefined;
|
|
48
48
|
responseCallbacks: Map<string, NativeResponseCallback>;
|
|
49
|
-
private global;
|
|
49
|
+
private readonly global;
|
|
50
50
|
constructor(global: WebViewWindow);
|
|
51
51
|
generateCallbackId(): string;
|
|
52
52
|
callNative<E extends MiniAppErrorResultType, T extends NativeParams<unknown, E>>(methodName: string, params?: T, options?: NativeOptions): void;
|
package/dist/mini-app-api.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ import { VerifyMultiFactorAuthResultParams } from './types/verifyMultiFactorAuth
|
|
|
23
23
|
import { JsBridge, NativeParams } from './jsbridge-core/jsbridge';
|
|
24
24
|
import { AddShortcutParams, CloseAppParams, GetCashbackInfoParams, MapParams, MiniAppResult, OpenAppParams, RegisterPaymentFeaturesParams, RegisterUserInfoParams, RequestInternalParams, RequestParams, ScanCodeParams, SetEnablePullDownRefreshParams, ShareParams, ShortcutExistsParams, ShowAlertParams, ShowErrorSheetParams, SmsAuthParams } from './types';
|
|
25
25
|
export declare class MiniAppModule {
|
|
26
|
-
private jsBridge;
|
|
26
|
+
private readonly jsBridge;
|
|
27
27
|
private isExecuting;
|
|
28
28
|
constructor(jsBridge: JsBridge);
|
|
29
29
|
private isExecutableService;
|
|
@@ -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}@font-face{font-family:Graphik;font-weight:400;font-display:swap;src:url(https://static.paypay.ne.jp/font/Graphik-Regular-Web.woff2) format("woff2"),url(https://static.paypay.ne.jp/font/Graphik-Regular-Web.woff) format("woff")}@font-face{font-family:Graphik;font-weight:600;font-display:swap;src:url(https://static.paypay.ne.jp/font/Graphik-Semibold-Web.woff2) format("woff2"),url(https://static.paypay.ne.jp/font/Graphik-Semibold-Web.woff) format("woff")}.pp-smartButtonWrapper .pp-smartBtn{display:flex;align-items:center;border-radius:8px;border:none;font-size:14px;font-weight:600;line-height:22px;color:#fff;padding:0;width:100%;height:44px;margin:auto;-webkit-tap-highlight-color:transparent;text-decoration:none;box-sizing:border-box}.pp-smartButtonWrapper .pp-smartBtn.pp-sm .pp-leftSection .pp-btnContent{flex-direction:column}.pp-smartButtonWrapper .pp-smartBtn.pp-light{background:#fff;color:#242323}.pp-smartButtonWrapper .pp-smartBtn.pp-dark{background:#000}.pp-smartButtonWrapper .pp-smartBtn.pp-red{background:#f03}.pp-smartButtonWrapper .pp-smartBtn.pp-login{min-width:180px}.pp-smartButtonWrapper .pp-smartBtn.pp-login.pp-sm{width:180px!important}.pp-smartButtonWrapper .pp-smartBtn.pp-login.pp-light{border:1px solid #e4e4e8}.pp-smartButtonWrapper .pp-smartBtn.pp-login.pp-light .pp-userProfile{margin-right:4px}.pp-smartButtonWrapper .pp-smartBtn.pp-login .pp-leftSection .pp-btnContent{display:grid}.pp-smartButtonWrapper .pp-smartBtn.pp-pay{min-width:160px}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-light{border:1px solid #dddddd}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-light .pp-cashbackInfo{color:#ff954c;background:#fff0e5}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-red .pp-cashbackInfo{color:#f03}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-ja .pp-cashbackInfo{padding:2px 16px}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-sm{width:160px!important}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-sm.pp-cashback{height:66px;flex-direction:column;justify-content:center}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-sm .pp-cashbackInfo{margin:8px 0 0}.pp-smartButtonWrapper .pp-smartBtn.pp-pay .pp-leftSection .pp-img{width:24px;height:24px}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-shortText{font-size:16px}.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-sm .pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-cashback .pp-leftSection .pp-btnContent,.pp-smartButtonWrapper .pp-smartBtn.pp-pay.pp-shortText .pp-leftSection .pp-btnContent{margin-left:4px}.pp-smartButtonWrapper .pp-smartBtn .pp-leftSection{display:flex;justify-content:center;align-items:center;width:100%;box-sizing:border-box;padding:0 8px}.pp-smartButtonWrapper .pp-smartBtn .pp-leftSection .pp-img{width:20px;height:20px;display:inline-block}.pp-smartButtonWrapper .pp-smartBtn .pp-leftSection .pp-btnContent{margin-left:8px}.pp-smartButtonWrapper .pp-smartBtn .pp-leftSection .pp-btnContent .pp-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pp-smartButtonWrapper .pp-smartBtn .pp-cashbackInfo{font-size:12px;color:#242323;background:#fff;line-height:14px;padding:2px 8px;border-radius:9px;margin-left:8px}.pp-smartButtonWrapper .pp-smartBtn .pp-userProfile{width:34px;height:34px;border-radius:50%;margin-right:5px}.pp-smartButtonWrapper.pp-button{padding:0;margin:0;background:none;border:none;width:100%;border-radius:8px;-webkit-tap-highlight-color:transparent;font-family:revert!important}.pp-smartButtonWrapper.pp-button *{font-family:revert!important}')),document.head.appendChild(p)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();
|
|
2
|
-
var pp=function(){"use strict";var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,s=(t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,a=(e,t)=>{for(var n in t||(t={}))r.call(t,n)&&s(e,n,t[n]);if(o)for(var n of o(t))i.call(t,n)&&s(e,n,t[n]);return e},l=(e,o)=>t(e,n(o)),c=(e,t,n)=>new Promise(((o,r)=>{var i=e=>{try{a(n.next(e))}catch(t){r(t)}},s=e=>{try{a(n.throw(e))}catch(t){r(t)}},a=e=>e.done?o(e.value):Promise.resolve(e.value).then(i,s);a((n=n.apply(e,t)).next())}));function d(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}var u=function e(t,n){function o(e,o,r){if("undefined"!=typeof document){"number"==typeof(r=d({},n,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var i="";for(var s in r)r[s]&&(i+="; "+s,!0!==r[s]&&(i+="="+r[s].split(";")[0]));return document.cookie=e+"="+t.write(o,e)+i}}return Object.create({set:o,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],o={},r=0;r<n.length;r++){var i=n[r].split("="),s=i.slice(1).join("=");try{var a=decodeURIComponent(i[0]);if(o[a]=t.read(s,a),e===a)break}catch(l){}}return e?o[e]:o}},remove:function(e,t){o(e,"",d({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,d({},this.attributes,t))},withConverter:function(t){return e(d({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});const g="_PayPayJsBridge",f=["init","openWebview","openMap","closeApp","makePayment","topup","setSessionData","getSessionData","setStorageData","getStorageData","removeStorageData","getPermissionStatus","scanCode","showAlert","showErrorSheet","getTopBarHeight","setTitle","showUpdateWarning","getPlatformInformation","openApp","share","getKycInformation","getUserLocation","checkPaymentMethod","registerKyc","startMultiFactorAuth","verifyMultiFactorAuthResult","getBankInfo","logout","getUserProfile","getBalance","getUserAddress","getUAID","copyToClipboard","registerUserInfo","setEnablePullDownRefresh","registerEmail","inputAddress","getDeviceInformation","request","requestInternal","registerPaymentFeatures","initKycPassport","getKycPassportInfo","shortcutExists","addShortcut","getAllUserAddresses","getUserPaymentFeatureSettings","getPaymentSettings","getTransactionInfo","getTransactions","getPayPayCardInfo","getExternalLinkageInformation","markAsReady","renderCoupons"],m=["init","createOrder","makePayment","render","logout","getAuthStatus","getUserProfile","getBalance","getUserAddress","getUAID","getCashbackInformation","renderCoupons","getLoginUrl","renderButton"],p="2.63.0",v=new URL("https://mini-app-sdk-core.paypay.ne.jp/"),h=v.origin,y=new URL(`./iframe.html?v=${p}&rev=d96b2cd`,v).href,w=new URL(`./coupon/iframe.html?v=${p}`,v).href;new URL(`./button/iframe.html?v=${p}`,v).href;const b="BAD_REQUEST_INSUFFICIENT_PARAMETER",S="UNKNOWN",I="SDK_NOT_INITIALIZED",E="TOKEN_NOT_FOUND",k="TOKEN_EXPIRED",C="AUTHORIZATION_NEEDED",P="ppjssdk.refreshToken",O="ppjssdk.codeVerifier";class _ extends Error{constructor(e,t){super(e),this.errorCode=t}}const T=Object.freeze(Object.defineProperty({__proto__:null,getCookie:function({name:e}){return u.get(e)},getLocalStorage:function({name:e}){return localStorage.getItem(e)},getSessionStorage:function({name:e}){return sessionStorage.getItem(e)},getUrl:function(){return window.location.href},insertIframe:function(e){var{containerSelector:t,attributes:n}=e,s=n,{styles:a}=s,l=((e,t)=>{var n={};for(var s in e)r.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&o)for(var s of o(e))t.indexOf(s)<0&&i.call(e,s)&&(n[s]=e[s]);return n})(s,["styles"]);return new Promise(((e,n)=>{const o=document.querySelector(t);if(!o)return void n(new _(`Container with selector "${t}" not found.`,b));const r=document.createElement("iframe");r.onload=()=>{e(!0)},r.onerror=()=>{n(new _("Failed to load iframe.","NOT_REACHABLE"))},Object.assign(r.style,a),Object.entries(l).forEach((([e,t])=>{r.setAttribute(e,t)})),o.innerHTML="",o.appendChild(r)}))},removeCookie:function({name:e,options:t}){return u.remove(e,t)},removeElement:function({selector:e}){const t=document.querySelector(e);return!!t&&(t.remove(),!0)},removeLocalStorage:function({name:e}){return localStorage.removeItem(e)},removeQueryParametersFromUrl:function(e){const t=new URL(window.location.href);e.forEach((e=>t.searchParams.delete(e)));const n=t.toString().replace(t.origin,"");history.replaceState(history.state,"",n)},removeSessionStorage:function({name:e}){return sessionStorage.removeItem(e)},setCookie:function({name:e,value:t,options:n}){return u.set(e,t,n)},setLocalStorage:function({name:e,value:t}){return localStorage.setItem(e,t)},setSessionStorage:function({name:e,value:t}){return sessionStorage.setItem(e,t)},updateElementStyle:function({selector:e,styles:t}){const n=document.querySelector(e);return!!n&&(Object.assign(n.style,t),!0)}},Symbol.toStringTag,{value:"Module"})),R="success",A="fail",L="complete";var N=(e=>(e.MiniApp="MiniApp",e.SmartPayment="SmartPayment",e))(N||{});function U(){return Math.random().toString(36).substring(7)}const D=e=>"object"!=typeof e||null===e?e:JSON.parse(JSON.stringify(e)),M=e=>{var t;const n=null==(t=e[0])?void 0:t.callbacks;return"object"==typeof n&&null!==n},x=e=>Object.keys(e).reduce(((e,t)=>(e[t]=!0,e)),{});class F{constructor(e,t,n=[],o){this.deferredPromises={},this.functions=e,this.allowedOrigins=t,this.middlewares=n,this.registeredCallbacks={},this.messageEventHandler=this.messageEventHandler.bind(this),this.errorLogger=o,this.subscribeToMessageEvent()}subscribeToMessageEvent(){window.addEventListener("message",this.messageEventHandler)}unsubscribeToMessageEvent(){window.removeEventListener("message",this.messageEventHandler)}messageEventHandler(e){var t;if(null==(t=e.data)?void 0:t.forWindowBridge)return this.allowedOrigins&&"request"===e.data.type&&!this.allowedOrigins.includes(e.origin)?this.sendErrorResponse(e,`${e.origin} is not allowed to make requests`,"ORIGIN_NOT_ALLOWED"):void("request"===e.data.type?this.handleRequest(e):"response"===e.data.type?this.handleResponse(e):"callback"===e.data.type&&this.handleCallback(e))}handleRequest(e){return c(this,null,(function*(){var t;const n=e.data.functionName,o=this.functions[n];o||this.sendErrorResponse(e,`Function '${n}' does not exists on the target window`,"FUNCTION_NOT_FOUND");const r=D(e.data.params);M(r)&&(r[0].callbacks=Object.keys(r[0].callbacks).reduce(((t,n)=>(t[n]=(...t)=>{this.invokeCallback(e,n,t)},t)),{}));try{this.sendSuccessResponse(e,yield function(e,t,n,o){let r=-1;const i=o=>c(this,null,(function*(){if(++r,r<e.length){const n=e[r];return yield n(t,o,i)}return n(...o)}));return i(o)}([...this.middlewares,...null!=(t=o.middlewares)?t:[]],e,o,r))}catch(i){let t="Some error occurred while processing the request",n=S;i instanceof _?(t=i.message,n=i.errorCode):console.error(i),this.sendErrorResponse(e,t,n)}}))}handleResponse(e){if(!this.deferredPromises[e.data.key])return void console.warn(`Promise for ${e.data.functionName} not found`);const[t,n]=this.deferredPromises[e.data.key];delete this.deferredPromises[e.data.key],"success"===e.data.status?t(e.data.result):(delete this.registeredCallbacks[e.data.key],n(new _(e.data.message,e.data.errorCode)))}handleCallback(e){var t;const{key:n,callbackName:o,args:r}=e.data,i=null==(t=this.registeredCallbacks[n])?void 0:t[o];i?i(...r):console.warn(`Callback with key ${n} and name ${o} not found.`)}sendErrorResponse(e,t,n){this.errorLogger&&this.errorLogger(e.data.functionName,t,n),this.sendResponse(e,{status:"failure",message:t,errorCode:n})}sendSuccessResponse(e,t){this.sendResponse(e,{status:"success",result:t})}sendResponse(e,t){this.sendMessage(e.source,e.origin,a({type:"response",key:e.data.key,functionName:e.data.functionName},t))}invokeCallback(e,t,n){this.sendMessage(e.source,e.origin,{type:"callback",key:e.data.key,functionName:e.data.functionName,callbackName:t,args:n})}sendMessage(e,t,n){e.postMessage(a({forWindowBridge:!0},D(n)),t)}sendRequest(e,t,n,o){return new Promise(((r,i)=>c(this,null,(function*(){const s=`${n}--${U()}`;try{const c=yield e();if(!c)throw new Error("Target window is undefined");let d=o[0];if(M(o)){const e=o[0].callbacks;this.addFunctionCallbacks(s,e),d=l(a({},o[0]),{callbacks:x(e)})}this.deferredPromises[s]=[r,i],this.sendMessage(c,t,{type:"request",key:s,functionName:n,params:[d]})}catch(c){delete this.deferredPromises[s],delete this.registeredCallbacks[s],i(new _(c.message,"MESSAGE_SENDING_FAILED"))}}))))}addFunctionCallbacks(e,t){Object.keys(t).forEach((e=>{if("function"!=typeof t[e])throw new Error(`Callback ${e} is not a function`)})),this.registeredCallbacks[e]=a({},t)}static init(e,t,n=[],o){if(this._instance)throw new Error("WindowBridge already initialized, you can't call WindowBridge.init more than once");return this._instance=new this(e,t,n,o),this._instance}static destroy(){this._instance&&(this._instance.unsubscribeToMessageEvent(),this._instance=void 0)}static getBridge(){if(!this._instance)throw new Error("WindowBridge not initialized, please call WindowBridge.init before calling WindowBridge.getBridge");return this._instance}static getTargetWindowFunctionProxy(e,t){return F.getBridge().getTargetWindowFunctionProxy(e,t)}getTargetWindowFunctionProxy(e,t){return new Proxy(this,{get:(n,o)=>(...r)=>n.sendRequest(e,t,o.toString(),r)})}}const B="ppmna-iframe",$="ppsdk-container";let j;function W(){return j||(j=function(){if(document.getElementById(B))return;const e=document.createElement("div");return document.createElement("div"),e.setAttribute("id",$),e.setAttribute("class",$),e.style.all="initial",e.style.display="none",e.style.position="fixed",e.style.width="100%",e.style.height="100%",e.style.top="0",e.style.left="0",e.style.zIndex="2147483637",document.body.appendChild(e),e}()),j}let q,K=!1,H=null;function J(e){const t=W();t&&(t.style.display=e?"initial":"none",e?null!==H||K||(H=document.body.style.overflow,document.body.style.overflow="hidden"):null!==H&&(document.body.style.overflow=H,H=null))}function z(){return q||(q=new Promise(((e,t)=>{function n(){const n=document.createElement("iframe");n.setAttribute("src",y),n.setAttribute("name",B),n.setAttribute("id",B),n.setAttribute("class",B),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=W();o&&(o.innerHTML="",o.append(n))}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(()=>{n()})):n()}))),q}F.init(T,[h]);const V=F.getTargetWindowFunctionProxy((function(){return z().then((e=>null==e?void 0:e.contentWindow)).catch((()=>null))}),h);function G(e,t,n){const o=U(),r=n=>{Z(n.origin)&&n.data.name===e&&n.data.messageId===o&&function(e,t,n){var o,r,i;e.result===A&&(null==(o=null==t?void 0:t.fail)||o.call(t,e.data)),e.result===R&&(null==(r=null==t?void 0:t.success)||r.call(t,null==e?void 0:e.data)),e.result===L&&(null==(i=null==t?void 0:t.complete)||i.call(t),removeEventListener("message",n))}(n.data,t,r)};addEventListener("message",r),function(e){c(this,null,(function*(){var t;const n=yield z().catch((()=>{}));null==(t=null==n?void 0:n.contentWindow)||t.postMessage(JSON.parse(JSON.stringify(e)),h)}))}({name:e,params:n,messageId:o})}function Z(e){return e===h}function Q(e){return f.includes(e)}function X(e){return m.includes(e)}function Y(e,t,n){return function(o={}){const r=null==n?void 0:n(o);V.logEvent(a({event_action:`pp_${e}_called`,event_category_suffix:e},r));const i=t(o);return i.then((t=>{var n;V.logEvent(a({event_action:`pp_${e}_success`,event_category_suffix:e},r)),null==(n=o.success)||n.call(o,t)})).catch((t=>{var n;console.error(t.message),V.logEvent(a({event_action:`pp_${e}_fail`,event_category_suffix:e,error_value:t.errorCode},r)),null==(n=o.fail)||n.call(o,{errorCode:t.errorCode})})).finally((()=>{var e;null==(e=o.complete)||e.call(o)})),i}}const ee={[I]:C,[E]:C,[k]:k};let te,ne;z(),ne=Promise.resolve(!1);function oe(e){const t=function(e,t){if(t){const t=localStorage.getItem(`${P}.${e}`);if(t)return t}return u.get(`${P}.${e}`)||u.get(P)||""}(e.clientId,e.useLocalStorage),n=function(e,t){if(t){const t=localStorage.getItem(`${O}.${e}`);if(t)return t}return u.get(`${O}.${e}`)||u.get(O)||""}(e.clientId,e.useLocalStorage),o=l(a({},e),{refreshToken:t,clientVersion:"2.63.0",codeVerifier:n,clientSdkType:te,clientUrl:window.location.href});var r;let i;null!=e.disableBackgroundScrollLock&&(r=!!e.disableBackgroundScrollLock,K=r);const s=new Promise((e=>i=e)),c=()=>{var t;i(!0),null==(t=e.complete)||t.call(e)};ne.then((()=>z())).then((()=>{G("init",l(a({},e),{complete:c}),o)})).catch((()=>{var t;null==(t=e.fail)||t.call(e,{errorCode:I}),c()})),ne=s}addEventListener("message",(e=>{var t;if(!(null==(t=e.data)?void 0:t.forWindowBridge)&&Z(e.origin))if("reload"===e.data.name&&window.location.reload(),"makeVisible"!==e.data.name)if("showIframe"!==e.data.name)if("hideIframe"!==e.data.name){if("link"===e.data.name){const t=e.data.data;"_blank"===t.target?window.open(t.url,"_blank"):window.location.href=t.url}if("consoleDebugInfo"===e.data.name){const{params:t}=e.data.data;!function(e){console.debug(...e)}(t)}}else J(!1);else J(!0);else J(!0)})),addEventListener("popstate",(()=>{z().then((e=>{var t;const n={name:"clientPopState"};null==(t=null==e?void 0:e.contentWindow)||t.postMessage(n,h)})).catch((e=>console.warn(e)))}));var re;re={_handleMessageFromNative:e=>{z().then((t=>{var n;null==(n=null==t?void 0:t.contentWindow)||n.postMessage(JSON.parse(JSON.stringify({name:"handleMessageFromNative",params:{json:e}})),h)}))}},(!window.hasOwnProperty(g)||window[g]!==re)&&(window[g]=re);const ie=["init","setTitle","copyToClipboard","getSessionData","setSessionData","getStorageData","setStorageData","removeStorageData","getLoginUrl"],se=["renderCoupons"];const ae={version:"2.63.0",revision:"d96b2cd"};Y("getLoginUrl",V.getLoginUrl);const le=Y("getPaymentSettings",V.getPaymentSettings),ce=Y("markAsReady",V.markAsReady);Y("renderButton",V.renderButton);var de=(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))(de||{});const ue=Y("logout",(()=>c(this,null,(function*(){return yield V.logout(),{statusCode:de.loggedOut}}))));const ge={verifyMultiFactorAuthResult:function(e){const t=new URL(window.location.href);G("verifyMultiFactorAuthResult",e,l(a({},e),{sessionId:t.searchParams.get("ppSessionId")}))},share:function(e){if(!(null==navigator?void 0:navigator.share))return void G("share",e,e);const t={text:null==e?void 0:e.text};navigator.share(t).then((()=>{var t,n;null==(t=null==e?void 0:e.success)||t.call(e),null==(n=null==e?void 0:e.complete)||n.call(e)})).catch((()=>{var t,n;null==(t=null==e?void 0:e.fail)||t.call(e,{errorCode:S}),null==(n=null==e?void 0:e.complete)||n.call(e)}))},setTitle:function(e){var t,n,o;document.title=null!=(t=null==e?void 0:e.title)?t:"",null==(n=null==e?void 0:e.success)||n.call(e),null==(o=null==e?void 0:e.complete)||o.call(e)},renderCoupons:Y("renderCoupons",(e=>c(this,null,(function*(){const{merchant:t,couponId:n,containerId:o,postLoginRedirectUrl:r=window.location.href,postLoginRedirectType:i,locale:s}=e,a=document.getElementById(o);if(!a)throw new _("Invalid coupon container Id",b);const l=yield V.fetchCoupons({merchantId:t,couponId:n,postLoginRedirectUrl:r,postLoginRedirectType:i});try{const e=document.createElement("iframe");e.src=w,e.style.cssText="width:100%;height: 0;border: none;transition: height 300ms ease-in;display: block;",yield new Promise(((t,n)=>{e.onload=()=>t(!0),e.onerror=()=>n(new Error("Failed to load coupon iframe")),a.innerHTML="",a.append(e)})),e.onload=null,e.onerror=null,window.addEventListener("message",(({data:t,source:n})=>{"update-iframe-height"===(null==t?void 0:t.eventName)&&e.contentWindow===n&&(e.style.height=`${t.height}px`)}));const n=F.getTargetWindowFunctionProxy((()=>e.contentWindow),h);yield n.renderCoupons({coupons:l,merchantId:t,locale:s,postLoginRedirectUrl:r,postLoginRedirectType:i})}catch(c){throw new _(`An error occurred while displaying coupons, merchantId=${t}, couponId=${n}, error=${c}`,S)}}))),(e=>({event_label2:e.couponId,merchant_id:e.merchant}))),scanCode:function(e){var t;G("scanCode",e,l(a({},e),{redirectUrlOnCancel:null!=(t=null==e?void 0:e.redirectUrlOnCancel)?t:window.location.href}))},copyToClipboard:function(e){var t,n,o;const r=document.createElement("textarea");r.setAttribute("readonly","true"),r.setAttribute("contenteditable","true"),r.value=e.value,document.body.appendChild(r),r.select(),r.setSelectionRange(0,r.value.length);const i=document.execCommand("copy");document.body.removeChild(r),i?null==(t=null==e?void 0:e.success)||t.call(e):null==(n=null==e?void 0:e.fail)||n.call(e,{errorCode:"other"}),null==(o=e.complete)||o.call(e)},getSessionData:function(e){var t,n;const o=sessionStorage.getItem(null==e?void 0:e.key);null==(t=null==e?void 0:e.success)||t.call(e,{[null==e?void 0:e.key]:null!=o?o:""}),null==(n=null==e?void 0:e.complete)||n.call(e)},setSessionData:function(e){var t,n,o;sessionStorage.setItem(null==e?void 0:e.key,null!=(t=null==e?void 0:e.value)?t:""),null==(n=null==e?void 0:e.success)||n.call(e),null==(o=null==e?void 0:e.complete)||o.call(e)},getStorageData:function(e){var t,n;const o=localStorage.getItem(null==e?void 0:e.key);null==(t=null==e?void 0:e.success)||t.call(e,{[null==e?void 0:e.key]:null!=o?o:""}),null==(n=null==e?void 0:e.complete)||n.call(e)},setStorageData:function(e){var t,n,o;localStorage.setItem(null==e?void 0:e.key,null!=(t=null==e?void 0:e.value)?t:""),null==(n=null==e?void 0:e.success)||n.call(e),null==(o=null==e?void 0:e.complete)||o.call(e)},removeStorageData:function(e){var t,n;localStorage.removeItem(null==e?void 0:e.key),null==(t=null==e?void 0:e.success)||t.call(e),null==(n=null==e?void 0:e.complete)||n.call(e)},getKycPassportInfo:function(e){const t=window.location.href;G("getKycPassportInfo",e,l(a({},e),{url:t}))},logout:ue,getPaymentSettings:le,markAsReady:ce};return function({sdkType:e,clientFunctions:t}){te=e;const n=e===N.MiniApp?Q:X,o=new Proxy(l(a({},t),{init:oe}),{get(t,o){if(o in ae)return ae[o];const r=o;if(!n(r))throw new Error(`${r} is not supported by ${e} JS SDK`);return function(e,t){return(n={})=>new Promise(((o,r)=>{let i,s;e(l(a({},n),{success:e=>{var t;s=e,null==(t=n.success)||t.call(n,e)},fail:e=>{var o;"init"===t&&ee[e.errorCode]?s={statusCode:ee[e.errorCode]}:i=e,null==(o=n.fail)||o.call(n,e)},complete:()=>{var e;i?r(i):o(s),null==(e=n.complete)||e.call(n)}}))}))}((function(e){return c(this,null,(function*(){var n,i;if(!ie.includes(r)&&!(yield ne)){if(!se.includes(r)||!function(e){return void 0!==e.clientId}(e))return null==(n=e.fail)||n.call(e,{errorCode:I}),void(null==(i=e.complete)||i.call(e));oe({clientId:e.clientId,env:e.env}),yield ne}const s=t[r];if(s&&"function"==typeof s)return s(e);G(o,e,e)}))}),r)}});return window._pp=o,function(e){const t=window._ppcs;if(t){window._ppcs=void 0;for(const[n,o,r]of t){const t=e[n](o);r&&r(t)}}}(o),o}({sdkType:N.MiniApp,clientFunctions:ge})}();
|
|
2
|
+
var pp=function(){"use strict";var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,i=(t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,s=(e,t)=>{for(var n in t||(t={}))r.call(t,n)&&i(e,n,t[n]);if(o)for(var n of o(t))a.call(t,n)&&i(e,n,t[n]);return e},l=(e,o)=>t(e,n(o)),c=(e,t,n)=>new Promise(((o,r)=>{var a=e=>{try{s(n.next(e))}catch(t){r(t)}},i=e=>{try{s(n.throw(e))}catch(t){r(t)}},s=e=>e.done?o(e.value):Promise.resolve(e.value).then(a,i);s((n=n.apply(e,t)).next())}));function u(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}var d=function e(t,n){function o(e,o,r){if("undefined"!=typeof document){"number"==typeof(r=u({},n,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var i in r)r[i]&&(a+="; "+i,!0!==r[i]&&(a+="="+r[i].split(";")[0]));return document.cookie=e+"="+t.write(o,e)+a}}return Object.create({set:o,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],o={},r=0;r<n.length;r++){var a=n[r].split("="),i=a.slice(1).join("=");try{var s=decodeURIComponent(a[0]);if(o[s]=t.read(i,s),e===s)break}catch(l){}}return e?o[e]:o}},remove:function(e,t){o(e,"",u({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,u({},this.attributes,t))},withConverter:function(t){return e(u({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});const g="_PayPayJsBridge",f=["init","openWebview","openMap","closeApp","makePayment","topup","setSessionData","getSessionData","setStorageData","getStorageData","removeStorageData","getPermissionStatus","scanCode","showAlert","showErrorSheet","getTopBarHeight","setTitle","showUpdateWarning","getPlatformInformation","openApp","share","getKycInformation","getUserLocation","checkPaymentMethod","registerKyc","startMultiFactorAuth","verifyMultiFactorAuthResult","getBankInfo","logout","getUserProfile","getBalance","getUserAddress","getUAID","copyToClipboard","registerUserInfo","setEnablePullDownRefresh","registerEmail","inputAddress","getDeviceInformation","request","requestInternal","registerPaymentFeatures","initKycPassport","getKycPassportInfo","shortcutExists","addShortcut","getAllUserAddresses","getUserPaymentFeatureSettings","getPaymentSettings","getTransactionInfo","getTransactions","getPayPayCardInfo","getExternalLinkageInformation","markAsReady","renderCoupons"],m=["init","createOrder","makePayment","render","logout","getAuthStatus","getUserProfile","getBalance","getUserAddress","getUAID","getCashbackInformation","renderCoupons","getLoginUrl","renderButton"],p="2.64.0",v=new URL("https://mini-app-sdk-core.paypay.ne.jp/"),h=v.origin,y=new URL(`./iframe.html?v=${p}&rev=ad03932`,v).href,w=new URL(`./coupon/iframe.html?v=${p}`,v).href;new URL(`./button/iframe.html?v=${p}`,v).href;const b="BAD_REQUEST_INSUFFICIENT_PARAMETER",S="UNKNOWN",E="SDK_NOT_INITIALIZED",I="TOKEN_NOT_FOUND",k="TOKEN_EXPIRED",C="AUTHORIZATION_NEEDED",P="ppjssdk.refreshToken";class O extends Error{constructor(e,t){super(e),this.errorCode=t}}const _=Object.freeze(Object.defineProperty({__proto__:null,getCookie:function({name:e}){return d.get(e)},getLocalStorage:function({name:e}){return localStorage.getItem(e)},getSessionStorage:function({name:e}){return sessionStorage.getItem(e)},getUrl:function(){return window.location.href},insertIframe:function(e){var{containerSelector:t,attributes:n}=e,i=n,{styles:s}=i,l=((e,t)=>{var n={};for(var i in e)r.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&o)for(var i of o(e))t.indexOf(i)<0&&a.call(e,i)&&(n[i]=e[i]);return n})(i,["styles"]);return new Promise(((e,n)=>{const o=document.querySelector(t);if(!o)return void n(new O(`Container with selector "${t}" not found.`,b));const r=document.createElement("iframe");r.onload=()=>{e(!0)},r.onerror=()=>{n(new O("Failed to load iframe.","NOT_REACHABLE"))},Object.assign(r.style,s),Object.entries(l).forEach((([e,t])=>{r.setAttribute(e,t)})),o.innerHTML="",o.appendChild(r)}))},removeCookie:function({name:e,options:t}){return d.remove(e,t)},removeElement:function({selector:e}){const t=document.querySelector(e);return!!t&&(t.remove(),!0)},removeLocalStorage:function({name:e}){return localStorage.removeItem(e)},removeQueryParametersFromUrl:function(e){const t=new URL(window.location.href);e.forEach((e=>t.searchParams.delete(e)));const n=t.toString().replace(t.origin,"");history.replaceState(history.state,"",n)},removeSessionStorage:function({name:e}){return sessionStorage.removeItem(e)},setCookie:function({name:e,value:t,options:n}){return d.set(e,t,n)},setLocalStorage:function({name:e,value:t}){return localStorage.setItem(e,t)},setSessionStorage:function({name:e,value:t}){return sessionStorage.setItem(e,t)},updateElementStyle:function({selector:e,styles:t}){const n=document.querySelector(e);return!!n&&(Object.assign(n.style,t),!0)}},Symbol.toStringTag,{value:"Module"})),A="success",R="fail",T="complete";var L=(e=>(e.MiniApp="MiniApp",e.SmartPayment="SmartPayment",e))(L||{});function N(e=6){const t=new Uint8Array(e);return crypto.getRandomValues(t),Array.from(t,(e=>(e%36).toString(36))).join("")}const U=e=>"object"!=typeof e||null===e?e:JSON.parse(JSON.stringify(e)),D=e=>{var t;const n=null==(t=e[0])?void 0:t.callbacks;return"object"==typeof n&&null!==n},M=e=>Object.keys(e).reduce(((e,t)=>(e[t]=!0,e)),{});class x{constructor(e,t,n=[],o){this.deferredPromises={},this.functions=e,this.allowedOrigins=t,this.middlewares=n,this.registeredCallbacks={},this.messageEventHandler=this.messageEventHandler.bind(this),this.errorLogger=o,this.subscribeToMessageEvent()}subscribeToMessageEvent(){window.addEventListener("message",this.messageEventHandler)}unsubscribeToMessageEvent(){window.removeEventListener("message",this.messageEventHandler)}messageEventHandler(e){var t;if(null==(t=e.data)?void 0:t.forWindowBridge)return this.allowedOrigins&&"request"===e.data.type&&!this.allowedOrigins.includes(e.origin)?this.sendErrorResponse(e,`${e.origin} is not allowed to make requests`,"ORIGIN_NOT_ALLOWED"):void("request"===e.data.type?this.handleRequest(e):"response"===e.data.type?this.handleResponse(e):"callback"===e.data.type&&this.handleCallback(e))}handleRequest(e){return c(this,null,(function*(){var t;const n=e.data.functionName,o=this.functions[n];o||this.sendErrorResponse(e,`Function '${n}' does not exists on the target window`,"FUNCTION_NOT_FOUND");const r=U(e.data.params);D(r)&&(r[0].callbacks=Object.keys(r[0].callbacks).reduce(((t,n)=>(t[n]=(...t)=>{this.invokeCallback(e,n,t)},t)),{}));try{this.sendSuccessResponse(e,yield function(e,t,n,o){let r=-1;const a=o=>c(this,null,(function*(){if(++r,r<e.length){const n=e[r];return yield n(t,o,a)}return n(...o)}));return a(o)}([...this.middlewares,...null!=(t=o.middlewares)?t:[]],e,o,r))}catch(a){let t="Some error occurred while processing the request",n=S;a instanceof O?(t=a.message,n=a.errorCode):console.error(a),this.sendErrorResponse(e,t,n)}}))}handleResponse(e){if(!this.deferredPromises[e.data.key])return void console.warn(`Promise for ${e.data.functionName} not found`);const[t,n]=this.deferredPromises[e.data.key];delete this.deferredPromises[e.data.key],"success"===e.data.status?t(e.data.result):(delete this.registeredCallbacks[e.data.key],n(new O(e.data.message,e.data.errorCode)))}handleCallback(e){var t;const{key:n,callbackName:o,args:r}=e.data,a=null==(t=this.registeredCallbacks[n])?void 0:t[o];a?a(...r):console.warn(`Callback with key ${n} and name ${o} not found.`)}sendErrorResponse(e,t,n){this.errorLogger&&this.errorLogger(e.data.functionName,t,n),this.sendResponse(e,{status:"failure",message:t,errorCode:n})}sendSuccessResponse(e,t){this.sendResponse(e,{status:"success",result:t})}sendResponse(e,t){this.sendMessage(e.source,e.origin,s({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(s({forWindowBridge:!0},U(n)),t)}sendRequest(e,t,n,o){return new Promise(((r,a)=>c(this,null,(function*(){const i=`${n}--${N()}`;try{const c=yield e();if(!c)throw new Error("Target window is undefined");let u=o[0];if(D(o)){const e=o[0].callbacks;this.addFunctionCallbacks(i,e),u=l(s({},o[0]),{callbacks:M(e)})}this.deferredPromises[i]=[r,a],this.sendMessage(c,t,{type:"request",key:i,functionName:n,params:[u]})}catch(c){delete this.deferredPromises[i],delete this.registeredCallbacks[i],a(new O(c.message,"MESSAGE_SENDING_FAILED"))}}))))}addFunctionCallbacks(e,t){Object.keys(t).forEach((e=>{if("function"!=typeof t[e])throw new Error(`Callback ${e} is not a function`)})),this.registeredCallbacks[e]=s({},t)}static init(e,t,n=[],o){if(this._instance)throw new Error("WindowBridge already initialized, you can't call WindowBridge.init more than once");return this._instance=new this(e,t,n,o),this._instance}static destroy(){this._instance&&(this._instance.unsubscribeToMessageEvent(),this._instance=void 0)}static getBridge(){if(!this._instance)throw new Error("WindowBridge not initialized, please call WindowBridge.init before calling WindowBridge.getBridge");return this._instance}static getTargetWindowFunctionProxy(e,t){return x.getBridge().getTargetWindowFunctionProxy(e,t)}getTargetWindowFunctionProxy(e,t){return new Proxy(this,{get:(n,o)=>(...r)=>n.sendRequest(e,t,o.toString(),r)})}}const F="ppmna-iframe",B="ppsdk-container";let $;function j(){return $||($=function(){if(document.getElementById(F))return;const e=document.createElement("div");return document.createElement("div"),e.setAttribute("id",B),e.setAttribute("class",B),e.style.all="initial",e.style.display="none",e.style.position="fixed",e.style.width="100%",e.style.height="100%",e.style.top="0",e.style.left="0",e.style.zIndex="2147483637",document.body.appendChild(e),e}()),$}let W,q=!1,K=null;function H(e){const t=j();t&&(t.style.display=e?"initial":"none",e?null!==K||q||(K=document.body.style.overflow,document.body.style.overflow="hidden"):null!==K&&(document.body.style.overflow=K,K=null))}function J(){return W||(W=new Promise(((e,t)=>{function n(){const n=document.createElement("iframe");n.setAttribute("src",y),n.setAttribute("name",F),n.setAttribute("id",F),n.setAttribute("class",F),n.setAttribute("allow","geolocation"),n.onload=()=>{e(n),n.onerror=null},n.onerror=t,n.style.all="initial",n.style.width="100%",n.style.height="100%",n.style.border="none";const o=j();o&&(o.innerHTML="",o.append(n))}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(()=>{n()})):n()}))),W}x.init(_,[h]);const z=x.getTargetWindowFunctionProxy((function(){return J().then((e=>null==e?void 0:e.contentWindow)).catch((()=>null))}),h);function G(e,t,n){const o=N(),r=n=>{V(n.origin)&&n.data.name===e&&n.data.messageId===o&&function(e,t,n){var o,r,a;e.result===R&&(null==(o=null==t?void 0:t.fail)||o.call(t,e.data)),e.result===A&&(null==(r=null==t?void 0:t.success)||r.call(t,null==e?void 0:e.data)),e.result===T&&(null==(a=null==t?void 0:t.complete)||a.call(t),removeEventListener("message",n))}(n.data,t,r)};addEventListener("message",r),function(e){c(this,null,(function*(){var t;const n=yield J().catch((()=>{}));null==(t=null==n?void 0:n.contentWindow)||t.postMessage(JSON.parse(JSON.stringify(e)),h)}))}({name:e,params:n,messageId:o})}function V(e){return e===h}function Z(e){return f.includes(e)}function Q(e){return m.includes(e)}function X(e,t,n){return function(o={}){const r=null==n?void 0:n(o);z.logEvent(s({event_action:`pp_${e}_called`,event_category_suffix:e},r));const a=t(o);return a.then((t=>{var n;z.logEvent(s({event_action:`pp_${e}_success`,event_category_suffix:e},r)),null==(n=o.success)||n.call(o,t)})).catch((t=>{var n;console.error(t.message),z.logEvent(s({event_action:`pp_${e}_fail`,event_category_suffix:e,error_value:t.errorCode},r)),null==(n=o.fail)||n.call(o,{errorCode:t.errorCode})})).finally((()=>{var e;null==(e=o.complete)||e.call(o)})),a}}const Y={[E]:C,[I]:C,[k]:k};let ee,te;J(),te=Promise.resolve(!1);function ne(e){const t=ee===L.MiniApp?function(e,t){if(t){const t=localStorage.getItem(`${P}.${e}`);if(t)return t}return d.get(`${P}.${e}`)||d.get(P)||""}(e.clientId,e.useLocalStorage):"",n=l(s({},e),{refreshToken:t,clientVersion:"2.64.0",clientSdkType:ee,clientUrl:window.location.href});var o;let r;null!=e.disableBackgroundScrollLock&&(o=!!e.disableBackgroundScrollLock,q=o);const a=new Promise((e=>r=e)),i=()=>{var t;r(!0),null==(t=e.complete)||t.call(e)};te.then((()=>J())).then((()=>{G("init",l(s({},e),{complete:i}),n)})).catch((()=>{var t;null==(t=e.fail)||t.call(e,{errorCode:E}),i()})),te=a}addEventListener("message",(e=>{var t;if(!(null==(t=e.data)?void 0:t.forWindowBridge)&&V(e.origin))if("reload"===e.data.name&&window.location.reload(),"makeVisible"!==e.data.name)if("showIframe"!==e.data.name)if("hideIframe"!==e.data.name){if("link"===e.data.name){const t=e.data.data;"_blank"===t.target?window.open(t.url,"_blank"):window.location.href=t.url}if("consoleDebugInfo"===e.data.name){const{params:t}=e.data.data;!function(e){console.debug(...e)}(t)}}else H(!1);else H(!0);else H(!0)})),addEventListener("popstate",(()=>{J().then((e=>{var t;const n={name:"clientPopState"};null==(t=null==e?void 0:e.contentWindow)||t.postMessage(n,h)})).catch((e=>console.warn(e)))}));var oe;oe={_handleMessageFromNative:e=>{J().then((t=>{var n;null==(n=null==t?void 0:t.contentWindow)||n.postMessage(JSON.parse(JSON.stringify({name:"handleMessageFromNative",params:{json:e}})),h)}))}},(!window.hasOwnProperty(g)||window[g]!==oe)&&(window[g]=oe);const re=["init","setTitle","copyToClipboard","getSessionData","setSessionData","getStorageData","setStorageData","removeStorageData","getLoginUrl"],ae=["renderCoupons"];const ie={version:"2.64.0",revision:"ad03932"};X("getLoginUrl",z.getLoginUrl);const se=X("getPaymentSettings",z.getPaymentSettings),le=X("markAsReady",z.markAsReady);X("renderButton",z.renderButton);var ce=(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))(ce||{});const ue=X("logout",(()=>c(this,null,(function*(){return yield z.logout(),{statusCode:ce.loggedOut}}))));const de={verifyMultiFactorAuthResult:function(e){const t=new URL(window.location.href);G("verifyMultiFactorAuthResult",e,l(s({},e),{sessionId:t.searchParams.get("ppSessionId")}))},share:function(e){if(!(null==navigator?void 0:navigator.share))return void G("share",e,e);const t={text:null==e?void 0:e.text};navigator.share(t).then((()=>{var t,n;null==(t=null==e?void 0:e.success)||t.call(e),null==(n=null==e?void 0:e.complete)||n.call(e)})).catch((()=>{var t,n;null==(t=null==e?void 0:e.fail)||t.call(e,{errorCode:S}),null==(n=null==e?void 0:e.complete)||n.call(e)}))},setTitle:function(e){var t,n,o;document.title=null!=(t=null==e?void 0:e.title)?t:"",null==(n=null==e?void 0:e.success)||n.call(e),null==(o=null==e?void 0:e.complete)||o.call(e)},renderCoupons:X("renderCoupons",(e=>c(this,null,(function*(){const{merchant:t,couponId:n,containerId:o,postLoginRedirectUrl:r=window.location.href,postLoginRedirectType:a,locale:i}=e,s=document.getElementById(o);if(!s)throw new O("Invalid coupon container Id",b);const l=yield z.fetchCoupons({merchantId:t,couponId:n,postLoginRedirectUrl:r,postLoginRedirectType:a});try{const e=document.createElement("iframe");e.src=w,e.style.cssText="width:100%;height: 0;border: none;transition: height 300ms ease-in;display: block;",yield new Promise(((t,n)=>{e.onload=()=>t(!0),e.onerror=()=>n(new Error("Failed to load coupon iframe")),s.innerHTML="",s.append(e)})),e.onload=null,e.onerror=null,window.addEventListener("message",(({data:t,source:n})=>{"update-iframe-height"===(null==t?void 0:t.eventName)&&e.contentWindow===n&&(e.style.height=`${t.height}px`)}));const n=x.getTargetWindowFunctionProxy((()=>e.contentWindow),h);yield n.renderCoupons({coupons:l,merchantId:t,locale:i,postLoginRedirectUrl:r,postLoginRedirectType:a})}catch(c){throw new O(`An error occurred while displaying coupons, merchantId=${t}, couponId=${n}, error=${c}`,S)}}))),(e=>({event_label2:e.couponId,merchant_id:e.merchant}))),scanCode:function(e){var t;G("scanCode",e,l(s({},e),{redirectUrlOnCancel:null!=(t=null==e?void 0:e.redirectUrlOnCancel)?t:window.location.href}))},copyToClipboard:function(e){var t,n,o;const r=document.createElement("textarea");r.setAttribute("readonly","true"),r.setAttribute("contenteditable","true"),r.value=e.value,document.body.appendChild(r),r.select(),r.setSelectionRange(0,r.value.length);const a=document.execCommand("copy");document.body.removeChild(r),a?null==(t=null==e?void 0:e.success)||t.call(e):null==(n=null==e?void 0:e.fail)||n.call(e,{errorCode:"other"}),null==(o=e.complete)||o.call(e)},getSessionData:function(e){var t,n;const o=sessionStorage.getItem(null==e?void 0:e.key);null==(t=null==e?void 0:e.success)||t.call(e,{[null==e?void 0:e.key]:null!=o?o:""}),null==(n=null==e?void 0:e.complete)||n.call(e)},setSessionData:function(e){var t,n,o;sessionStorage.setItem(null==e?void 0:e.key,null!=(t=null==e?void 0:e.value)?t:""),null==(n=null==e?void 0:e.success)||n.call(e),null==(o=null==e?void 0:e.complete)||o.call(e)},getStorageData:function(e){var t,n;const o=localStorage.getItem(null==e?void 0:e.key);null==(t=null==e?void 0:e.success)||t.call(e,{[null==e?void 0:e.key]:null!=o?o:""}),null==(n=null==e?void 0:e.complete)||n.call(e)},setStorageData:function(e){var t,n,o;localStorage.setItem(null==e?void 0:e.key,null!=(t=null==e?void 0:e.value)?t:""),null==(n=null==e?void 0:e.success)||n.call(e),null==(o=null==e?void 0:e.complete)||o.call(e)},removeStorageData:function(e){var t,n;localStorage.removeItem(null==e?void 0:e.key),null==(t=null==e?void 0:e.success)||t.call(e),null==(n=null==e?void 0:e.complete)||n.call(e)},getKycPassportInfo:function(e){const t=window.location.href;G("getKycPassportInfo",e,l(s({},e),{url:t}))},logout:ue,getPaymentSettings:se,markAsReady:le};return function({sdkType:e,clientFunctions:t}){ee=e;const n=e===L.MiniApp?Z:Q,o=new Proxy(l(s({},t),{init:ne}),{get(t,o){if(o in ie)return ie[o];const r=o;if(!n(r))throw new Error(`${r} is not supported by ${e} JS SDK`);return function(e,t){return(n={})=>{const o=new Promise(((o,r)=>{let a,i;e(l(s({},n),{success:e=>{var t;i=e,null==(t=n.success)||t.call(n,e)},fail:e=>{var o;"init"===t&&Y[e.errorCode]?i={statusCode:Y[e.errorCode]}:a=e,null==(o=n.fail)||o.call(n,e)},complete:()=>{var e;a?r(a):o(i),null==(e=n.complete)||e.call(n)}}))}));return n.fail&&o.catch((()=>{})),o}}((function(e){return c(this,null,(function*(){var n,a;if(!re.includes(r)&&!(yield te)){if(!ae.includes(r)||!function(e){return void 0!==e.clientId}(e))return null==(n=e.fail)||n.call(e,{errorCode:E}),void(null==(a=e.complete)||a.call(e));ne({clientId:e.clientId,env:e.env}),yield te}const i=t[r];if(i&&"function"==typeof i)return i(e);G(o,e,e)}))}),r)}});return window._pp=o,function(e){const t=window._ppcs;if(t){window._ppcs=void 0;for(const[n,o,r]of t){const t=e[n](o);r&&r(t)}}}(o),o}({sdkType:L.MiniApp,clientFunctions:de})}();
|
|
@@ -221,8 +221,8 @@ const smartPaymentSupportedFunctions = [
|
|
|
221
221
|
"getLoginUrl",
|
|
222
222
|
"renderButton"
|
|
223
223
|
];
|
|
224
|
-
const JS_SDK_VERSION = "2.
|
|
225
|
-
const REVISION = "
|
|
224
|
+
const JS_SDK_VERSION = "2.64.0";
|
|
225
|
+
const REVISION = "ad03932";
|
|
226
226
|
const coreBaseUrl = new URL("https://mini-app-sdk-core.paypay.ne.jp/");
|
|
227
227
|
const CORE_IFRAME_ORIGIN = coreBaseUrl.origin;
|
|
228
228
|
const CORE_IFRAME_URL = new URL(
|
|
@@ -238,7 +238,7 @@ new URL(
|
|
|
238
238
|
coreBaseUrl
|
|
239
239
|
).href;
|
|
240
240
|
const notReachable = "NOT_REACHABLE", other = "other", badRequestInsufficientParameter = "BAD_REQUEST_INSUFFICIENT_PARAMETER", unknown = "UNKNOWN", sdkNotInitialized = "SDK_NOT_INITIALIZED", tokenNotFound = "TOKEN_NOT_FOUND", tokenExpired = "TOKEN_EXPIRED", functionNotFound = "FUNCTION_NOT_FOUND", originNotAllowed = "ORIGIN_NOT_ALLOWED", messageSendingFailed = "MESSAGE_SENDING_FAILED", authorizationNeeded = "AUTHORIZATION_NEEDED";
|
|
241
|
-
const refreshToken = "ppjssdk.refreshToken"
|
|
241
|
+
const refreshToken = "ppjssdk.refreshToken";
|
|
242
242
|
const init$1 = "init", verifyMultiFactorAuthResult$1 = "verifyMultiFactorAuthResult", share$1 = "share", scanCode$1 = "scanCode", handleMessageFromNative = "handleMessageFromNative", getKycPassportInfo$1 = "getKycPassportInfo";
|
|
243
243
|
const reload = "reload", link = "link", makeVisible = "makeVisible", hideIframe = "hideIframe", showIframe = "showIframe", consoleDebugInfo$1 = "consoleDebugInfo", clientPopState = "clientPopState";
|
|
244
244
|
function setCookie({ name, value, options }) {
|
|
@@ -369,8 +369,10 @@ var SdkType = /* @__PURE__ */ ((SdkType2) => {
|
|
|
369
369
|
function isFunction(val) {
|
|
370
370
|
return typeof val === "function";
|
|
371
371
|
}
|
|
372
|
-
function getRandomString() {
|
|
373
|
-
|
|
372
|
+
function getRandomString(length = 6) {
|
|
373
|
+
const randomValues = new Uint8Array(length);
|
|
374
|
+
crypto.getRandomValues(randomValues);
|
|
375
|
+
return Array.from(randomValues, (n) => (n % 36).toString(36)).join("");
|
|
374
376
|
}
|
|
375
377
|
function middlewareHandler(middlewares, message, messageHandler, params) {
|
|
376
378
|
let index = -1;
|
|
@@ -862,17 +864,6 @@ function getRefreshToken(clientId, useLocalStorage) {
|
|
|
862
864
|
);
|
|
863
865
|
return refreshTokenWithClientId || api.get(refreshToken) || "";
|
|
864
866
|
}
|
|
865
|
-
function getCodeVerifier(clientId, useLocalStorage) {
|
|
866
|
-
if (useLocalStorage) {
|
|
867
|
-
const codeVerifier$1 = localStorage.getItem(
|
|
868
|
-
`${codeVerifier}.${clientId}`
|
|
869
|
-
);
|
|
870
|
-
if (codeVerifier$1) {
|
|
871
|
-
return codeVerifier$1;
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
return api.get(`${codeVerifier}.${clientId}`) || api.get(codeVerifier) || "";
|
|
875
|
-
}
|
|
876
867
|
function exposeClientJsBridge(jsBridge) {
|
|
877
868
|
if (window.hasOwnProperty(jsBridgeNamespace) && window[jsBridgeNamespace] === jsBridge) {
|
|
878
869
|
return false;
|
|
@@ -929,7 +920,7 @@ const INIT_STATUS_CODE_REMAP = {
|
|
|
929
920
|
};
|
|
930
921
|
function callbackToPromise(target, functionName) {
|
|
931
922
|
return (params = {}) => {
|
|
932
|
-
|
|
923
|
+
const promise = new Promise((resolve, reject) => {
|
|
933
924
|
let _error;
|
|
934
925
|
let _result;
|
|
935
926
|
target(__spreadProps(__spreadValues({}, params), {
|
|
@@ -960,6 +951,11 @@ function callbackToPromise(target, functionName) {
|
|
|
960
951
|
}
|
|
961
952
|
}));
|
|
962
953
|
});
|
|
954
|
+
if (params.fail) {
|
|
955
|
+
promise.catch(() => {
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
return promise;
|
|
963
959
|
};
|
|
964
960
|
}
|
|
965
961
|
let clientSdkType;
|
|
@@ -1016,13 +1012,12 @@ addEventListener("popstate", () => {
|
|
|
1016
1012
|
}).catch((error) => console.warn(error));
|
|
1017
1013
|
});
|
|
1018
1014
|
function init(params) {
|
|
1019
|
-
const
|
|
1020
|
-
const
|
|
1021
|
-
const clientVersion = "2.
|
|
1015
|
+
const isMiniApp = clientSdkType === SdkType.MiniApp;
|
|
1016
|
+
const refreshToken2 = isMiniApp ? getRefreshToken(params.clientId, params.useLocalStorage) : "";
|
|
1017
|
+
const clientVersion = "2.64.0";
|
|
1022
1018
|
const initParams = __spreadProps(__spreadValues({}, params), {
|
|
1023
1019
|
refreshToken: refreshToken2,
|
|
1024
1020
|
clientVersion,
|
|
1025
|
-
codeVerifier: codeVerifier2,
|
|
1026
1021
|
clientSdkType,
|
|
1027
1022
|
clientUrl: window.location.href
|
|
1028
1023
|
});
|
|
@@ -1096,8 +1091,8 @@ function executePendingFunctionCalls(client2) {
|
|
|
1096
1091
|
}
|
|
1097
1092
|
}
|
|
1098
1093
|
const clientProperties = {
|
|
1099
|
-
version: "2.
|
|
1100
|
-
revision: "
|
|
1094
|
+
version: "2.64.0",
|
|
1095
|
+
revision: "ad03932"
|
|
1101
1096
|
};
|
|
1102
1097
|
function isInitClientParams(params) {
|
|
1103
1098
|
return params.clientId !== void 0;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
declare type AppSetting = unknown;
|
|
2
|
-
declare type AppSwitch = unknown;
|
|
3
|
-
declare type TextSetting = unknown;
|
|
4
1
|
declare type Variables = {
|
|
5
2
|
topupButtonsAmount: Array<{
|
|
6
3
|
value: number[];
|
|
@@ -19,9 +16,9 @@ declare type Variables = {
|
|
|
19
16
|
}>;
|
|
20
17
|
};
|
|
21
18
|
export declare type ConfigurationResponse = {
|
|
22
|
-
appSetting:
|
|
23
|
-
appSwitch:
|
|
24
|
-
textSetting:
|
|
19
|
+
appSetting: unknown;
|
|
20
|
+
appSwitch: unknown;
|
|
21
|
+
textSetting: unknown;
|
|
25
22
|
variables: Variables;
|
|
26
23
|
};
|
|
27
24
|
export declare type AppConfig = {
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import { InitParams } from '../../types/init';
|
|
2
2
|
export declare function init(params: InitParams): Promise<void>;
|
|
3
|
+
declare type TokenCheckResult = 'COOKIE' | 'AUTHORIZATION_HEADER' | 'EXPIRED' | 'TOKEN_NOT_FOUND';
|
|
4
|
+
export declare function fetchTokenCheck(clientId: string): Promise<TokenCheckResult>;
|
|
5
|
+
export {};
|
package/dist/utils/fetch.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ErrorCodes, ErrorCodesType } from '../constants';
|
|
2
2
|
import { UIComponentsError } from '../model/uiComponents';
|
|
3
|
+
export declare function getApiUrl(path: string): string;
|
|
3
4
|
declare const createHeaderMiniAppApi: (urlEndpoint: string, authorizationRequired?: boolean, customHeaders?: Record<string, string> | undefined) => Headers | undefined;
|
|
4
5
|
export declare type ErrorResponse = {
|
|
5
6
|
error: {
|
|
@@ -18,6 +19,7 @@ declare type PPFetchOptions = {
|
|
|
18
19
|
skipStatusCodeCheck?: boolean;
|
|
19
20
|
authorizationRequired?: boolean;
|
|
20
21
|
priority?: 'high' | 'low' | 'auto';
|
|
22
|
+
credentials?: RequestCredentials;
|
|
21
23
|
};
|
|
22
24
|
declare type APIBaseResponse = {
|
|
23
25
|
signed: {
|
|
@@ -83,4 +85,13 @@ export declare function fetchRefreshToken(refreshToken: string, clientOrigin?: s
|
|
|
83
85
|
success: boolean;
|
|
84
86
|
errorCode?: ErrorCodesType;
|
|
85
87
|
}>;
|
|
88
|
+
export declare function deleteCookie(): Promise<{
|
|
89
|
+
success: boolean;
|
|
90
|
+
}>;
|
|
91
|
+
export declare function fetchCookieSignal(clientId: string): Promise<void>;
|
|
92
|
+
export declare type CodeVerifierResult = {
|
|
93
|
+
codeChallenge: string;
|
|
94
|
+
codeVerifier?: string;
|
|
95
|
+
};
|
|
96
|
+
export declare function fetchCodeVerifier(clientId: string): Promise<CodeVerifierResult | null>;
|
|
86
97
|
export { createHeaderMiniAppApi };
|
package/dist/utils/helper.d.ts
CHANGED
|
@@ -66,8 +66,6 @@ export declare function hasOmittedPrimaryButton(params: {
|
|
|
66
66
|
export declare function checkPrimaryButtonNotPresent(buttonList: UIComponentsErrorButton[] | undefined): boolean;
|
|
67
67
|
export declare function getFailErrorCode(ppFetchResult: Exclude<PPFetchResult<unknown>['ppFetchResult'], 'success'>): "TIME_OUT" | "SERVER_ERROR" | "TOKEN_EXPIRED" | "NOT_AUTHORIZED" | "RATE_LIMIT_EXCEEDED" | "MAINTENANCE_MODE";
|
|
68
68
|
export declare function getStoreUrl(): "https://play.google.com/store/apps/details?id=jp.ne.paypay.android.app" | "https://itunes.apple.com/app/id1435783608";
|
|
69
|
-
export declare function generateCodeVerifier(length?: number): string;
|
|
70
|
-
export declare function generateCodeChallenge(codeVerifier: string): Promise<string>;
|
|
71
69
|
export declare function sha256Hex(text: string): Promise<string>;
|
|
72
70
|
export declare function openUrl(linkUrl: string): void;
|
|
73
71
|
export declare function getButtonType(button: UIComponentsErrorButton | ErrorSheetButton, primary?: boolean): "success" | "default" | "link" | "primary" | "warning" | "danger" | "outLined";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare function isFunction(val: unknown): val is (...ars: Array<unknown>) => unknown;
|
|
2
|
-
export declare function getRandomString(): string;
|
|
2
|
+
export declare function getRandomString(length?: number): string;
|
package/dist/utils/storage.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export declare function saveUserInfo(userData: string): void;
|
|
|
44
44
|
export declare function saveCodeVerifier(codeVerifier: string): void;
|
|
45
45
|
export declare function getCodeVerifier(): string | null;
|
|
46
46
|
export declare function removeCodeVerifier(): void;
|
|
47
|
+
export declare function removeCredentials(): void;
|
|
47
48
|
export declare function saveAuthorizedClientOrigin(clientId: string, origin: string): void;
|
|
48
49
|
export declare function getAuthorizedClientOrigin(clientId: string): string | null;
|
|
49
50
|
export declare function getClientVersion(): string;
|
|
@@ -14,6 +14,7 @@ declare const CouponAction: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
14
14
|
type: PropType<import("../../../../utils/windowBridge").WindowBridgeFunctions<{
|
|
15
15
|
claimCoupon: typeof import("../../../../core/coreFunctions/claimCoupon").claimCoupon;
|
|
16
16
|
fetchCoupons: typeof import("../../../../core/coreFunctions/fetchCoupons").fetchCoupons;
|
|
17
|
+
getCurrentClientOrigin: typeof import("../../../../core/coreFunctions/getCurrentClientOrigin").getCurrentClientOrigin;
|
|
17
18
|
getLoginUrl: typeof import("../../../../core/coreFunctions/getLoginUrl").getLoginUrl;
|
|
18
19
|
getPaymentSettings: typeof import("../../../../core/coreFunctions/getPaymentSettings").getPaymentSettings;
|
|
19
20
|
logEvent: typeof import("../../../../core/coreFunctions/logEvent").logEvent;
|
|
@@ -49,6 +50,7 @@ declare const CouponAction: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
49
50
|
type: PropType<import("../../../../utils/windowBridge").WindowBridgeFunctions<{
|
|
50
51
|
claimCoupon: typeof import("../../../../core/coreFunctions/claimCoupon").claimCoupon;
|
|
51
52
|
fetchCoupons: typeof import("../../../../core/coreFunctions/fetchCoupons").fetchCoupons;
|
|
53
|
+
getCurrentClientOrigin: typeof import("../../../../core/coreFunctions/getCurrentClientOrigin").getCurrentClientOrigin;
|
|
52
54
|
getLoginUrl: typeof import("../../../../core/coreFunctions/getLoginUrl").getLoginUrl;
|
|
53
55
|
getPaymentSettings: typeof import("../../../../core/coreFunctions/getPaymentSettings").getPaymentSettings;
|
|
54
56
|
logEvent: typeof import("../../../../core/coreFunctions/logEvent").logEvent;
|
|
@@ -2,6 +2,10 @@ import { PropType } from 'vue';
|
|
|
2
2
|
import { Locale, RedirectType, Translation } from '../../types';
|
|
3
3
|
import { FormattedCoupon } from './types';
|
|
4
4
|
export declare const CouponView: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
+
clientOrigin: {
|
|
6
|
+
type: StringConstructor;
|
|
7
|
+
required: true;
|
|
8
|
+
};
|
|
5
9
|
coupon: {
|
|
6
10
|
type: PropType<FormattedCoupon>;
|
|
7
11
|
required: true;
|
|
@@ -14,6 +18,7 @@ export declare const CouponView: import("vue").DefineComponent<import("vue").Ext
|
|
|
14
18
|
type: PropType<import("../../utils/windowBridge").WindowBridgeFunctions<{
|
|
15
19
|
claimCoupon: typeof import("../../core/coreFunctions/claimCoupon").claimCoupon;
|
|
16
20
|
fetchCoupons: typeof import("../../core/coreFunctions/fetchCoupons").fetchCoupons;
|
|
21
|
+
getCurrentClientOrigin: typeof import("../../core/coreFunctions/getCurrentClientOrigin").getCurrentClientOrigin;
|
|
17
22
|
getLoginUrl: typeof import("../../core/coreFunctions/getLoginUrl").getLoginUrl;
|
|
18
23
|
getPaymentSettings: typeof import("../../core/coreFunctions/getPaymentSettings").getPaymentSettings;
|
|
19
24
|
logEvent: typeof import("../../core/coreFunctions/logEvent").logEvent;
|
|
@@ -41,6 +46,10 @@ export declare const CouponView: import("vue").DefineComponent<import("vue").Ext
|
|
|
41
46
|
default: undefined;
|
|
42
47
|
};
|
|
43
48
|
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
49
|
+
clientOrigin: {
|
|
50
|
+
type: StringConstructor;
|
|
51
|
+
required: true;
|
|
52
|
+
};
|
|
44
53
|
coupon: {
|
|
45
54
|
type: PropType<FormattedCoupon>;
|
|
46
55
|
required: true;
|
|
@@ -53,6 +62,7 @@ export declare const CouponView: import("vue").DefineComponent<import("vue").Ext
|
|
|
53
62
|
type: PropType<import("../../utils/windowBridge").WindowBridgeFunctions<{
|
|
54
63
|
claimCoupon: typeof import("../../core/coreFunctions/claimCoupon").claimCoupon;
|
|
55
64
|
fetchCoupons: typeof import("../../core/coreFunctions/fetchCoupons").fetchCoupons;
|
|
65
|
+
getCurrentClientOrigin: typeof import("../../core/coreFunctions/getCurrentClientOrigin").getCurrentClientOrigin;
|
|
56
66
|
getLoginUrl: typeof import("../../core/coreFunctions/getLoginUrl").getLoginUrl;
|
|
57
67
|
getPaymentSettings: typeof import("../../core/coreFunctions/getPaymentSettings").getPaymentSettings;
|
|
58
68
|
logEvent: typeof import("../../core/coreFunctions/logEvent").logEvent;
|
|
@@ -144,6 +144,7 @@ export declare const useMakePaymentStore: import("pinia").StoreDefinition<"makeP
|
|
|
144
144
|
taxExempt?: boolean | undefined;
|
|
145
145
|
merchantTimeoutAt?: number | undefined;
|
|
146
146
|
orderType?: OrderType | undefined;
|
|
147
|
+
internal_disableAutoCloseCompletion?: boolean | undefined;
|
|
147
148
|
success?: ((t: MakePaymentResult) => void) | undefined;
|
|
148
149
|
fail?: ((e: import("../../types").MiniAppErrorResultType) => void) | undefined;
|
|
149
150
|
complete?: (() => void) | undefined;
|
|
@@ -2625,6 +2626,7 @@ export declare const useMakePaymentStore: import("pinia").StoreDefinition<"makeP
|
|
|
2625
2626
|
taxExempt?: boolean | undefined;
|
|
2626
2627
|
merchantTimeoutAt?: number | undefined;
|
|
2627
2628
|
orderType?: OrderType | undefined;
|
|
2629
|
+
internal_disableAutoCloseCompletion?: boolean | undefined;
|
|
2628
2630
|
success?: ((t: MakePaymentResult) => void) | undefined;
|
|
2629
2631
|
fail?: ((e: import("../../types").MiniAppErrorResultType) => void) | undefined;
|
|
2630
2632
|
complete?: (() => void) | undefined;
|
|
@@ -5106,6 +5108,7 @@ export declare const useMakePaymentStore: import("pinia").StoreDefinition<"makeP
|
|
|
5106
5108
|
taxExempt?: boolean | undefined;
|
|
5107
5109
|
merchantTimeoutAt?: number | undefined;
|
|
5108
5110
|
orderType?: OrderType | undefined;
|
|
5111
|
+
internal_disableAutoCloseCompletion?: boolean | undefined;
|
|
5109
5112
|
success?: ((t: MakePaymentResult) => void) | undefined;
|
|
5110
5113
|
fail?: ((e: import("../../types").MiniAppErrorResultType) => void) | undefined;
|
|
5111
5114
|
complete?: (() => void) | undefined;
|
|
@@ -7587,6 +7590,7 @@ export declare const useMakePaymentStore: import("pinia").StoreDefinition<"makeP
|
|
|
7587
7590
|
taxExempt?: boolean | undefined;
|
|
7588
7591
|
merchantTimeoutAt?: number | undefined;
|
|
7589
7592
|
orderType?: OrderType | undefined;
|
|
7593
|
+
internal_disableAutoCloseCompletion?: boolean | undefined;
|
|
7590
7594
|
success?: ((t: MakePaymentResult) => void) | undefined;
|
|
7591
7595
|
fail?: ((e: import("../../types").MiniAppErrorResultType) => void) | undefined;
|
|
7592
7596
|
complete?: (() => void) | undefined;
|
|
@@ -10068,6 +10072,7 @@ export declare const useMakePaymentStore: import("pinia").StoreDefinition<"makeP
|
|
|
10068
10072
|
taxExempt?: boolean | undefined;
|
|
10069
10073
|
merchantTimeoutAt?: number | undefined;
|
|
10070
10074
|
orderType?: OrderType | undefined;
|
|
10075
|
+
internal_disableAutoCloseCompletion?: boolean | undefined;
|
|
10071
10076
|
success?: ((t: MakePaymentResult) => void) | undefined;
|
|
10072
10077
|
fail?: ((e: import("../../types").MiniAppErrorResultType) => void) | undefined;
|
|
10073
10078
|
complete?: (() => void) | undefined;
|
|
@@ -12549,6 +12554,7 @@ export declare const useMakePaymentStore: import("pinia").StoreDefinition<"makeP
|
|
|
12549
12554
|
taxExempt?: boolean | undefined;
|
|
12550
12555
|
merchantTimeoutAt?: number | undefined;
|
|
12551
12556
|
orderType?: OrderType | undefined;
|
|
12557
|
+
internal_disableAutoCloseCompletion?: boolean | undefined;
|
|
12552
12558
|
success?: ((t: MakePaymentResult) => void) | undefined;
|
|
12553
12559
|
fail?: ((e: import("../../types").MiniAppErrorResultType) => void) | undefined;
|
|
12554
12560
|
complete?: (() => void) | undefined;
|
|
@@ -15030,6 +15036,7 @@ export declare const useMakePaymentStore: import("pinia").StoreDefinition<"makeP
|
|
|
15030
15036
|
taxExempt?: boolean | undefined;
|
|
15031
15037
|
merchantTimeoutAt?: number | undefined;
|
|
15032
15038
|
orderType?: OrderType | undefined;
|
|
15039
|
+
internal_disableAutoCloseCompletion?: boolean | undefined;
|
|
15033
15040
|
success?: ((t: MakePaymentResult) => void) | undefined;
|
|
15034
15041
|
fail?: ((e: import("../../types").MiniAppErrorResultType) => void) | undefined;
|
|
15035
15042
|
complete?: (() => void) | undefined;
|
|
@@ -17511,6 +17518,7 @@ export declare const useMakePaymentStore: import("pinia").StoreDefinition<"makeP
|
|
|
17511
17518
|
taxExempt?: boolean | undefined;
|
|
17512
17519
|
merchantTimeoutAt?: number | undefined;
|
|
17513
17520
|
orderType?: OrderType | undefined;
|
|
17521
|
+
internal_disableAutoCloseCompletion?: boolean | undefined;
|
|
17514
17522
|
success?: ((t: MakePaymentResult) => void) | undefined;
|
|
17515
17523
|
fail?: ((e: import("../../types").MiniAppErrorResultType) => void) | undefined;
|
|
17516
17524
|
complete?: (() => void) | undefined;
|
|
@@ -19995,6 +20003,7 @@ export declare const useMakePaymentStore: import("pinia").StoreDefinition<"makeP
|
|
|
19995
20003
|
taxExempt?: boolean | undefined;
|
|
19996
20004
|
merchantTimeoutAt?: number | undefined;
|
|
19997
20005
|
orderType?: OrderType | undefined;
|
|
20006
|
+
internal_disableAutoCloseCompletion?: boolean | undefined;
|
|
19998
20007
|
success?: ((t: MakePaymentResult) => void) | undefined;
|
|
19999
20008
|
fail?: ((e: import("../../types").MiniAppErrorResultType) => void) | undefined;
|
|
20000
20009
|
complete?: (() => void) | undefined;
|
|
@@ -22476,6 +22485,7 @@ export declare const useMakePaymentStore: import("pinia").StoreDefinition<"makeP
|
|
|
22476
22485
|
taxExempt?: boolean | undefined;
|
|
22477
22486
|
merchantTimeoutAt?: number | undefined;
|
|
22478
22487
|
orderType?: OrderType | undefined;
|
|
22488
|
+
internal_disableAutoCloseCompletion?: boolean | undefined;
|
|
22479
22489
|
success?: ((t: MakePaymentResult) => void) | undefined;
|
|
22480
22490
|
fail?: ((e: import("../../types").MiniAppErrorResultType) => void) | undefined;
|
|
22481
22491
|
complete?: (() => void) | undefined;
|
|
@@ -24957,6 +24967,7 @@ export declare const useMakePaymentStore: import("pinia").StoreDefinition<"makeP
|
|
|
24957
24967
|
taxExempt?: boolean | undefined;
|
|
24958
24968
|
merchantTimeoutAt?: number | undefined;
|
|
24959
24969
|
orderType?: OrderType | undefined;
|
|
24970
|
+
internal_disableAutoCloseCompletion?: boolean | undefined;
|
|
24960
24971
|
success?: ((t: MakePaymentResult) => void) | undefined;
|
|
24961
24972
|
fail?: ((e: import("../../types").MiniAppErrorResultType) => void) | undefined;
|
|
24962
24973
|
complete?: (() => void) | undefined;
|
|
@@ -27442,6 +27453,7 @@ export declare const useMakePaymentStore: import("pinia").StoreDefinition<"makeP
|
|
|
27442
27453
|
taxExempt?: boolean | undefined;
|
|
27443
27454
|
merchantTimeoutAt?: number | undefined;
|
|
27444
27455
|
orderType?: OrderType | undefined;
|
|
27456
|
+
internal_disableAutoCloseCompletion?: boolean | undefined;
|
|
27445
27457
|
success?: ((t: MakePaymentResult) => void) | undefined;
|
|
27446
27458
|
fail?: ((e: import("../../types").MiniAppErrorResultType) => void) | undefined;
|
|
27447
27459
|
complete?: (() => void) | undefined;
|
|
@@ -29923,6 +29935,7 @@ export declare const useMakePaymentStore: import("pinia").StoreDefinition<"makeP
|
|
|
29923
29935
|
taxExempt?: boolean | undefined;
|
|
29924
29936
|
merchantTimeoutAt?: number | undefined;
|
|
29925
29937
|
orderType?: OrderType | undefined;
|
|
29938
|
+
internal_disableAutoCloseCompletion?: boolean | undefined;
|
|
29926
29939
|
success?: ((t: MakePaymentResult) => void) | undefined;
|
|
29927
29940
|
fail?: ((e: import("../../types").MiniAppErrorResultType) => void) | undefined;
|
|
29928
29941
|
complete?: (() => void) | undefined;
|