@paypay/mini-app-js-sdk 2.12.0 → 2.15.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.
@@ -3,6 +3,7 @@ interface GetLoginUrlParams extends PostLogInRedirectParams {
3
3
  pkceCodeChallenge: PKCEChallengeType;
4
4
  scopes?: Array<string>;
5
5
  }
6
+ export declare const getLoginUrlEndpoint = "public/auth/v1/loginUrl";
6
7
  export declare function getLoginUrl({ pkceCodeChallenge, postLoginRedirectUrl, postLoginRedirectType, scopes, }: GetLoginUrlParams): Promise<string>;
7
8
  export declare function getLoginUrlWithPkce(params: Omit<GetLoginUrlParams, 'pkceCodeChallenge'>): Promise<string>;
8
9
  export declare function getLoginUrlIfUserNotSignedIn(params: Omit<GetLoginUrlParams, 'pkceCodeChallenge'>): Promise<string | undefined>;
@@ -0,0 +1,2 @@
1
+ import { GetTransactionInfoParams } from '../../types';
2
+ export declare function getTransactionInfo(params: GetTransactionInfoParams): Promise<void | undefined>;
@@ -0,0 +1,2 @@
1
+ import { GetTransactionsParams } from '../../types';
2
+ export declare function getTransactions(params: GetTransactionsParams): Promise<void | undefined>;
@@ -1,2 +1,2 @@
1
1
  import { MakePaymentParams } from '../../types';
2
- export declare const makePayment: (params: MakePaymentParams) => Promise<void>;
2
+ export declare const makePayment: (params: MakePaymentParams) => void;
@@ -304,10 +304,11 @@ export declare type ConsultResponse = ResponseBase & {
304
304
  };
305
305
  };
306
306
  };
307
- export declare const getConsult: ({ merchant, amount, productType, }: {
307
+ export declare const getConsult: ({ merchant, amount, productType, metaData, }: {
308
308
  merchant: string;
309
309
  amount: number;
310
310
  productType: string;
311
+ metaData: unknown;
311
312
  }) => Promise<PPFetchResult<ConsultResponse, ConsultResponse>>;
312
313
  export declare enum CashBackAnimationType {
313
314
  TIER_CAMPAIGN_BOTTOM = "TIER_CAMPAIGN_BOTTOM",
@@ -59,7 +59,12 @@ export declare enum MiniAppErrorType {
59
59
  kycUpdateRequired = "KYC_UPDATE_REQUIRED",
60
60
  notCompleted = "NOT_COMPLETED",
61
61
  kycValidationInProcess = "KYC_VALIDATION_IN_PROCESS",
62
- noLocationData = "NO_LOCATION_DATA"
62
+ noLocationData = "NO_LOCATION_DATA",
63
+ functionNotFound = "FUNCTION_NOT_FOUND",
64
+ originNotAllowed = "ORIGIN_NOT_ALLOWED",
65
+ messageSendingFailed = "MESSAGE_SENDING_FAILED",
66
+ transactionNotFound = "TRANSACTION_NOT_FOUND",
67
+ unexpectedOperation = "UNEXPECTED_OP"
63
68
  }
64
69
  export declare class MiniAppError extends Error {
65
70
  constructor(type: MiniAppErrorType);
@@ -18,6 +18,7 @@ export declare const PermissionName: {
18
18
  mini_app_user_phone_album: string;
19
19
  mini_app_bank_information: string;
20
20
  mini_app_cashback_information: string;
21
+ mini_app_transaction: string;
21
22
  };
22
23
  export declare const checkPermission: (permissionNames: string[] | string) => Promise<PermissionStatus>;
23
24
  export declare function getUserGrantedPermission(): Promise<string[]>;
@@ -82,11 +82,11 @@ export declare const PButton: import("vue").DefineComponent<{
82
82
  }, {
83
83
  type: ButtonType;
84
84
  name: string;
85
- loading: boolean;
85
+ size: ButtonSize;
86
86
  class: string | Record<string, any>;
87
+ loading: boolean;
87
88
  disabled: boolean;
88
89
  block: boolean;
89
- size: ButtonSize;
90
90
  tabIndex: number;
91
91
  disabledClassName: string;
92
92
  noMargin: boolean;
package/dist/types.d.ts CHANGED
@@ -493,6 +493,11 @@ export declare type BalanceType = {
493
493
  totalBalance?: {
494
494
  amount?: number;
495
495
  };
496
+ details?: {
497
+ money?: number;
498
+ moneyLite?: number;
499
+ point?: number;
500
+ };
496
501
  };
497
502
  };
498
503
  };
@@ -703,4 +708,23 @@ export interface PayPayCallStackParamsType {
703
708
  [index: string]: unknown;
704
709
  }
705
710
  export declare type PayPayCallStackType = Array<[string, PayPayCallStackParamsType]>;
711
+ declare global {
712
+ interface Window {
713
+ _ppcs?: PayPayCallStackType;
714
+ _ppsl?: boolean;
715
+ }
716
+ }
717
+ export interface GetTransactionInfoParams extends NativeParams<MiniAppResult> {
718
+ orderId: string;
719
+ orderType?: string;
720
+ }
721
+ export interface GetTransactionsParams extends NativeParams<MiniAppResult> {
722
+ types?: string | string[];
723
+ statuses?: string | string[];
724
+ mids?: string | string[];
725
+ startDate?: string;
726
+ endDate?: string;
727
+ cursor?: string;
728
+ size?: number;
729
+ }
706
730
  export {};
@@ -75,19 +75,24 @@ export declare type WalletInfo = {
75
75
  };
76
76
  export declare function topup(queryParams: TopupQuery, body: TopupBody, paymentParams?: MakePaymentParams): Promise<{
77
77
  ppFetchResult: "notAuthorized";
78
+ errorCode: MiniAppErrorType.notAuthorized;
78
79
  body: null;
79
80
  } | {
80
81
  ppFetchResult: "fetchError";
82
+ errorCode: MiniAppErrorType.serverError;
81
83
  body: null;
82
84
  } | {
83
85
  ppFetchResult: "timeout";
86
+ errorCode: MiniAppErrorType.timeOut;
84
87
  body: null;
85
88
  } | {
86
89
  ppFetchResult: "tokenExpired";
90
+ errorCode: MiniAppErrorType.tokenExpired;
87
91
  statusCode: number;
88
92
  body?: null | undefined;
89
93
  } | {
90
94
  ppFetchResult: "apiError";
95
+ errorCode: MiniAppErrorType;
91
96
  statusCode: number;
92
97
  body: ({
93
98
  signed: {
@@ -0,0 +1,5 @@
1
+ import { MiniAppErrorType } from '../model/miniAppError';
2
+ export declare class PPError extends Error {
3
+ errorCode: MiniAppErrorType;
4
+ constructor(message: string, errorCode: MiniAppErrorType);
5
+ }
@@ -1,3 +1,4 @@
1
+ import { MiniAppErrorType } from '../model/miniAppError';
1
2
  import { UIComponentsError } from '../model/uiComponents';
2
3
  declare const createHeaderMiniAppApi: (urlEndpoint: string, authorizationRequired?: boolean, customHeaders?: Record<string, string> | undefined) => Headers | undefined;
3
4
  export declare type ErrorResponse = {
@@ -8,7 +9,7 @@ export declare type ErrorResponse = {
8
9
  declare type PPFetchOptions = {
9
10
  method: string;
10
11
  url: string;
11
- params?: Record<string, string | number | boolean | undefined>;
12
+ params?: Record<string, string | string[] | number | number[] | boolean | undefined>;
12
13
  data?: unknown;
13
14
  headers?: Record<string, string>;
14
15
  suppressRefresh?: boolean;
@@ -52,19 +53,24 @@ export declare type PPFetchResult<T, E = Record<string, unknown>> = {
52
53
  body: T;
53
54
  } | {
54
55
  ppFetchResult: 'apiError';
56
+ errorCode: MiniAppErrorType;
55
57
  statusCode: number;
56
58
  body: APIBaseResponse & E;
57
59
  } | {
58
60
  ppFetchResult: 'notAuthorized';
61
+ errorCode: MiniAppErrorType.notAuthorized;
59
62
  body: null;
60
63
  } | {
61
64
  ppFetchResult: 'fetchError';
65
+ errorCode: MiniAppErrorType.serverError;
62
66
  body: null;
63
67
  } | {
64
68
  ppFetchResult: 'timeout';
69
+ errorCode: MiniAppErrorType.timeOut;
65
70
  body: null;
66
71
  } | {
67
72
  ppFetchResult: 'tokenExpired';
73
+ errorCode: MiniAppErrorType.tokenExpired;
68
74
  statusCode: number;
69
75
  body?: null;
70
76
  };
@@ -68,4 +68,5 @@ export declare function reconstructKycPassportCallbackUrl(url: string, type: str
68
68
  export declare function getValueFromUA(paramName: string): string | undefined;
69
69
  export declare function replaceStringPlaceholders(str: string, values: Record<string, string>): string;
70
70
  export declare function validateUrl(url: string): boolean;
71
+ export declare function constructUrl(baseUrl: string, params: Record<string, string | string[] | number | number[] | boolean | undefined>): string;
71
72
  export {};
@@ -5,18 +5,21 @@ export declare type WindowBridgeFunctions<T extends FunctionsCollection> = {
5
5
  [K in keyof T]: Parameters<T[K]>[0] extends undefined ? () => Promise<Awaited<ReturnType<T[K]>>> : (params: Parameters<T[K]>[0]) => Promise<Awaited<ReturnType<T[K]>>>;
6
6
  };
7
7
  export declare class WindowBridge {
8
- private static _instance;
8
+ private static _instance?;
9
9
  private deferredCallbacks;
10
10
  private functions;
11
11
  private allowedOrigins?;
12
12
  private constructor();
13
13
  private subscribeToMessageEvent;
14
+ private unsubscribeToMessageEvent;
15
+ private messageEventHandler;
14
16
  private handleRequest;
15
17
  private handleResponse;
16
18
  private sendErrorResponse;
17
19
  private sendSuccessResponse;
18
20
  private sendResponse;
19
21
  static init(functions: FunctionsCollection, allowedOrigins?: Array<string>): WindowBridge;
22
+ static destroy(): void;
20
23
  static getBridge(): WindowBridge;
21
24
  static getTargetWindowFunctionProxy<T extends FunctionsCollection = FunctionsCollection>(getTargetWindow: GetTargetWindowFunctionType, targetWindowOrigin: string): T;
22
25
  getTargetWindowFunctionProxy<T extends FunctionsCollection = FunctionsCollection>(getTargetWindow: GetTargetWindowFunctionType, targetWindowOrigin: string): T;
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "@paypay/mini-app-js-sdk",
3
- "version": "2.12.0",
3
+ "version": "2.15.0",
4
4
  "private": false,
5
5
  "scripts": {
6
- "build": "yarn build:client && yarn build:core && yarn build:init && yarn build:client:nightly",
6
+ "build": "yarn build:client && yarn build:core && yarn build:init",
7
7
  "build:miniApp": "SDK_TYPE=miniApp yarn build",
8
8
  "build:smartPayment": "SDK_TYPE=smartPayment yarn build",
9
9
  "build:client": "vite build",
10
- "build:client:nightly": "NIGHTLY_BUILD=1 vite build",
11
10
  "build:core": "vite build --config vite.config.core.ts",
12
11
  "build:init": "vite build --config vite.config.init.ts",
12
+ "build:miniAppPackage": "rollup -c",
13
+ "build:coreEntryPoint": "rollup -c",
13
14
  "dev": "run-p dev:client dev:core",
14
15
  "dev:client": "vite --host 0.0.0.0",
15
16
  "dev:core": "vite --config vite.config.core.ts",
@@ -41,7 +42,9 @@
41
42
  "@braintree/browser-detection": "^1.16.0",
42
43
  "@braintree/sanitize-url": "^6.0.2",
43
44
  "@pinia/testing": "^0.0.12",
45
+ "@rollup/plugin-html": "^1.0.2",
44
46
  "@rollup/plugin-replace": "^3.0.0",
47
+ "@rollup/plugin-terser": "^0.4.3",
45
48
  "@testing-library/jest-dom": "^5.16.2",
46
49
  "@testing-library/vue": "^6.4.2",
47
50
  "@types/ip": "^1.1.0",
@@ -52,6 +55,7 @@
52
55
  "@types/uuid": "^8.3.1",
53
56
  "@typescript-eslint/eslint-plugin": "^5.58.0",
54
57
  "@typescript-eslint/parser": "^5.58.0",
58
+ "@vitejs/plugin-legacy": "^4.1.1",
55
59
  "@vitejs/plugin-vue": "^4.2.3",
56
60
  "@vitejs/plugin-vue-jsx": "^1.3.10",
57
61
  "@vue/babel-plugin-jsx": "^1.0.7",
@@ -79,13 +83,15 @@
79
83
  "postcss-html": "^1.4.1",
80
84
  "postcss-less": "^6.0.0",
81
85
  "prettier": "^2.8.7",
86
+ "rollup": "3.28.0",
87
+ "rollup-plugin-ts": "^3.4.4",
82
88
  "stylelint": "^14.9.1",
83
89
  "terser": "^5.18.1",
84
90
  "ts-jest": "^26.5.6",
85
91
  "typescript": "~4.5.5",
86
92
  "ua-parser-js": "^1.0.2",
87
93
  "uuid": "^8.3.2",
88
- "vite": "^4.3.9",
94
+ "vite": "^4.4.9",
89
95
  "vite-plugin-css-injected-by-js": "^2.1.0",
90
96
  "vite-plugin-dts": "^0.9.10",
91
97
  "vue": "^3.2.39",