@paypay/mini-app-js-sdk 1.39.0 → 1.40.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/mini-app-js-sdk.browser.js +1 -1
- package/dist/mini-app-js-sdk.es.js +238 -265
- package/dist/model/makePayment.d.ts +7 -9
- package/dist/types.d.ts +27 -0
- package/dist/utils/api.d.ts +53 -6
- package/dist/utils/fetch.d.ts +8 -0
- package/dist/utils/helper.d.ts +1 -0
- package/dist/views/make-payment/hooks/app-hooks.d.ts +5 -5
- package/dist/views/make-payment/store/handle-error.d.ts +2 -2
- package/dist/views/make-payment/store/util-for-handle-error.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PPFetchResult } from '../utils/fetch';
|
|
2
2
|
import { MiniAppErrorType } from './miniAppError';
|
|
3
3
|
import { Amount, OrderItem } from '../types';
|
|
4
4
|
import { UIComponentsError } from './uiComponents';
|
|
@@ -199,13 +199,13 @@ export declare const getPaymentMethods: (params: {
|
|
|
199
199
|
type: string;
|
|
200
200
|
productType?: string;
|
|
201
201
|
sourceInfoApp?: string;
|
|
202
|
-
}) => Promise<
|
|
202
|
+
}) => Promise<GetPaymentMethodsResponse | import("../utils/fetch").ErrorResponse>;
|
|
203
203
|
export declare const getPaymentMethods2: (params: {
|
|
204
204
|
merchant?: string;
|
|
205
205
|
type: string;
|
|
206
206
|
productType?: string;
|
|
207
207
|
sourceInfoApp?: string;
|
|
208
|
-
}) => Promise<
|
|
208
|
+
}) => Promise<PPFetchResult<GetPaymentMethodsResponse, Record<string, unknown>>>;
|
|
209
209
|
export declare type PaymentResult = {
|
|
210
210
|
requestedAt: number;
|
|
211
211
|
storeId: string;
|
|
@@ -228,9 +228,7 @@ export declare type MakePaymentResponse = ResponseBase & {
|
|
|
228
228
|
data: PaymentResult;
|
|
229
229
|
};
|
|
230
230
|
};
|
|
231
|
-
export declare const makePayment: (queryParams: PaymentQuery, body: PaymentBody, isAuthorization: boolean) => Promise<
|
|
232
|
-
isSuccess: boolean;
|
|
233
|
-
} & (MakePaymentResponse | ErrorResponse)>;
|
|
231
|
+
export declare const makePayment: (queryParams: PaymentQuery, body: PaymentBody, isAuthorization: boolean) => Promise<PPFetchResult<MakePaymentResponse>>;
|
|
234
232
|
export declare type AppealDescription = {
|
|
235
233
|
backgroundColor: string;
|
|
236
234
|
color: string;
|
|
@@ -273,7 +271,7 @@ export declare const getConsult: ({ merchant, amount, productType, }: {
|
|
|
273
271
|
merchant: string;
|
|
274
272
|
amount: number;
|
|
275
273
|
productType: string;
|
|
276
|
-
}) => Promise<
|
|
274
|
+
}) => Promise<PPFetchResult<ConsultResponse, ConsultResponse>>;
|
|
277
275
|
export declare enum CashBackAnimationType {
|
|
278
276
|
TIER_CAMPAIGN_BOTTOM = "TIER_CAMPAIGN_BOTTOM",
|
|
279
277
|
LOTTERY = "LOTTERY",
|
|
@@ -327,7 +325,7 @@ export declare type CashBackDetailResponse = ResponseBase & {
|
|
|
327
325
|
};
|
|
328
326
|
};
|
|
329
327
|
};
|
|
330
|
-
export declare const getCashBackDetails: (paymentId: string) => Promise<
|
|
328
|
+
export declare const getCashBackDetails: (paymentId: string) => Promise<PPFetchResult<CashBackDetailResponse, Record<string, unknown>>>;
|
|
331
329
|
export declare type SendAgePayload = {
|
|
332
330
|
month: number;
|
|
333
331
|
orderId: string;
|
|
@@ -346,5 +344,5 @@ export declare type SendAgeResponse = ResponseBase & {
|
|
|
346
344
|
};
|
|
347
345
|
};
|
|
348
346
|
};
|
|
349
|
-
export declare const sendAge: (payload: SendAgePayload) => Promise<
|
|
347
|
+
export declare const sendAge: (payload: SendAgePayload) => Promise<PPFetchResult<SendAgeResponse, Record<string, unknown>>>;
|
|
350
348
|
export {};
|
package/dist/types.d.ts
CHANGED
|
@@ -407,4 +407,31 @@ export declare type AddressUpdateEvent = {
|
|
|
407
407
|
selectedAddress: Address;
|
|
408
408
|
addresses: Address[];
|
|
409
409
|
};
|
|
410
|
+
export declare type GrantedPermissionRespone = {
|
|
411
|
+
unsigned?: {
|
|
412
|
+
data?: {
|
|
413
|
+
scopes?: Array<string>;
|
|
414
|
+
};
|
|
415
|
+
};
|
|
416
|
+
};
|
|
417
|
+
export declare type BalanceType = {
|
|
418
|
+
unsigned?: {
|
|
419
|
+
resultInfo?: {
|
|
420
|
+
code?: string;
|
|
421
|
+
};
|
|
422
|
+
data?: {
|
|
423
|
+
totalBalance?: {
|
|
424
|
+
amount?: number;
|
|
425
|
+
};
|
|
426
|
+
};
|
|
427
|
+
};
|
|
428
|
+
};
|
|
429
|
+
export declare type SessionResponse = {
|
|
430
|
+
unsigned?: {
|
|
431
|
+
data?: Record<string, unknown>;
|
|
432
|
+
resultInfo?: {
|
|
433
|
+
code?: string;
|
|
434
|
+
};
|
|
435
|
+
};
|
|
436
|
+
};
|
|
410
437
|
export {};
|
package/dist/utils/api.d.ts
CHANGED
|
@@ -71,7 +71,54 @@ declare type WalletInfoResponse = {
|
|
|
71
71
|
};
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
|
-
export declare function topup(queryParams: TopupQuery, body: TopupBody): Promise<
|
|
74
|
+
export declare function topup(queryParams: TopupQuery, body: TopupBody): Promise<{
|
|
75
|
+
ppFetchResult: "notAuthorized";
|
|
76
|
+
body: null;
|
|
77
|
+
} | {
|
|
78
|
+
ppFetchResult: "fetchError";
|
|
79
|
+
body: null;
|
|
80
|
+
} | {
|
|
81
|
+
ppFetchResult: "timeout";
|
|
82
|
+
body: null;
|
|
83
|
+
} | {
|
|
84
|
+
ppFetchResult: "tokenExpired";
|
|
85
|
+
statusCode: number;
|
|
86
|
+
body?: null | undefined;
|
|
87
|
+
} | {
|
|
88
|
+
ppFetchResult: "apiError";
|
|
89
|
+
statusCode: number;
|
|
90
|
+
body: ({
|
|
91
|
+
signed: {
|
|
92
|
+
jws: string;
|
|
93
|
+
};
|
|
94
|
+
unsigned: {
|
|
95
|
+
resultInfo: {
|
|
96
|
+
code: string;
|
|
97
|
+
};
|
|
98
|
+
data?: {
|
|
99
|
+
header?: {
|
|
100
|
+
resultCode?: string | undefined;
|
|
101
|
+
} | undefined;
|
|
102
|
+
} | undefined;
|
|
103
|
+
};
|
|
104
|
+
uiComponents?: {
|
|
105
|
+
displayErrorResponse?: UIComponentsError | undefined;
|
|
106
|
+
} | undefined;
|
|
107
|
+
} | {
|
|
108
|
+
signed?: undefined;
|
|
109
|
+
unsigned?: undefined;
|
|
110
|
+
resultInfo: {
|
|
111
|
+
code: string;
|
|
112
|
+
};
|
|
113
|
+
uiComponents?: {
|
|
114
|
+
displayErrorResponse: UIComponentsError;
|
|
115
|
+
} | undefined;
|
|
116
|
+
}) & Record<string, unknown>;
|
|
117
|
+
} | {
|
|
118
|
+
ppFetchResult: "success";
|
|
119
|
+
statusCode: number;
|
|
120
|
+
body: TopupResponse;
|
|
121
|
+
}>;
|
|
75
122
|
export declare type BalanceParams = {
|
|
76
123
|
clientId?: string;
|
|
77
124
|
currency?: string;
|
|
@@ -79,8 +126,8 @@ export declare type BalanceParams = {
|
|
|
79
126
|
productType?: string;
|
|
80
127
|
sourceInfoApp?: string;
|
|
81
128
|
};
|
|
82
|
-
export declare function getBalance(params?: BalanceParams): Promise<unknown
|
|
83
|
-
export declare function getCashBackInfo(): Promise<import("./fetch").
|
|
129
|
+
export declare function getBalance(params?: BalanceParams): Promise<import("./fetch").PPFetchResult<unknown, Record<string, unknown>>>;
|
|
130
|
+
export declare function getCashBackInfo(): Promise<import("./fetch").PPFetchResult<WalletInfoResponse, Record<string, unknown>>>;
|
|
84
131
|
export declare type getCashBackResponse = {
|
|
85
132
|
signed: unknown;
|
|
86
133
|
unsigned: unknown;
|
|
@@ -158,7 +205,7 @@ export declare type ProfileResponse = {
|
|
|
158
205
|
};
|
|
159
206
|
statusCode: number;
|
|
160
207
|
};
|
|
161
|
-
export declare function getUserProfileData(): Promise<import("./fetch").
|
|
208
|
+
export declare function getUserProfileData(): Promise<import("./fetch").PPFetchResult<ProfileResponse, Record<string, unknown>>>;
|
|
162
209
|
export declare function getUserProfileDataV2(): Promise<import("./fetch").PPFetchResult<ProfileResponse, Record<string, unknown>>>;
|
|
163
210
|
export declare type RegisterEmailResponse = {
|
|
164
211
|
signed: unknown;
|
|
@@ -178,7 +225,7 @@ export declare type RegisterEmailResponse = {
|
|
|
178
225
|
};
|
|
179
226
|
};
|
|
180
227
|
};
|
|
181
|
-
export declare function registerEmail(email: string): Promise<import("./fetch").
|
|
228
|
+
export declare function registerEmail(email: string): Promise<import("./fetch").PPFetchResult<RegisterEmailResponse, Record<string, unknown>>>;
|
|
182
229
|
export declare function resendEmail(): Promise<import("./fetch").PPFetchResult<RegisterEmailResponse, Record<string, unknown>>>;
|
|
183
230
|
export declare type UserLocationResponse = {
|
|
184
231
|
unsigned: {
|
|
@@ -192,6 +239,6 @@ export declare type UserLocationResponse = {
|
|
|
192
239
|
};
|
|
193
240
|
export declare function getUserLocationRequest(params: {
|
|
194
241
|
validTimeMinutes: number;
|
|
195
|
-
}): Promise<import("./fetch").
|
|
242
|
+
}): Promise<import("./fetch").PPFetchResult<UserLocationResponse, Record<string, unknown>>>;
|
|
196
243
|
export declare function isValidUrl(urlChallenge: string): boolean;
|
|
197
244
|
export {};
|
package/dist/utils/fetch.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UIComponentsError } from '../model/uiComponents';
|
|
1
2
|
declare const createHeaderMiniAppApi: (urlEndpoint: string, customHeaders?: Record<string, string> | undefined) => Headers | undefined;
|
|
2
3
|
export declare type ErrorResponse = {
|
|
3
4
|
error: {
|
|
@@ -12,6 +13,7 @@ declare type PPFetchOptions = {
|
|
|
12
13
|
headers?: Record<string, string>;
|
|
13
14
|
suppressRefresh?: boolean;
|
|
14
15
|
timeout?: number;
|
|
16
|
+
skipResultCodeCheck?: boolean;
|
|
15
17
|
};
|
|
16
18
|
declare function ppFetch<T>(options: PPFetchOptions): Promise<T | ErrorResponse>;
|
|
17
19
|
declare type APIBaseResponse = {
|
|
@@ -28,12 +30,18 @@ declare type APIBaseResponse = {
|
|
|
28
30
|
};
|
|
29
31
|
};
|
|
30
32
|
};
|
|
33
|
+
uiComponents?: {
|
|
34
|
+
displayErrorResponse?: UIComponentsError;
|
|
35
|
+
};
|
|
31
36
|
} | {
|
|
32
37
|
signed?: undefined;
|
|
33
38
|
unsigned?: undefined;
|
|
34
39
|
resultInfo: {
|
|
35
40
|
code: string;
|
|
36
41
|
};
|
|
42
|
+
uiComponents?: {
|
|
43
|
+
displayErrorResponse: UIComponentsError;
|
|
44
|
+
};
|
|
37
45
|
};
|
|
38
46
|
export declare type PPFetchResult<T, E = Record<string, unknown>> = {
|
|
39
47
|
ppFetchResult: 'success';
|
package/dist/utils/helper.d.ts
CHANGED
|
@@ -49,4 +49,5 @@ export declare function updateLocalisedString(data: string, target: string, valu
|
|
|
49
49
|
export declare function handleHeightResize(el: HTMLElement, windowHeight: number, isScrollable: boolean, offsetHeight: number): boolean;
|
|
50
50
|
export declare function getPaymentMethodStatus(isExpired: boolean, val?: PaymentMethodStatus): unknown;
|
|
51
51
|
export declare function filterErrorButtonList(buttonList: UIComponentsErrorButton[] | null): UIComponentsErrorButton[] | undefined;
|
|
52
|
+
export declare function getFailErrorCode(ppFetchResult: string): MiniAppErrorType.timeOut | MiniAppErrorType.serverError | MiniAppErrorType.tokenExpired | MiniAppErrorType.notAuthorized;
|
|
52
53
|
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ComputedRef } from 'vue';
|
|
2
|
-
import { BannerInfo, CashBackDetail, ConsultResponse, GetPaymentMethodsResponse,
|
|
2
|
+
import { BannerInfo, CashBackDetail, ConsultResponse, GetPaymentMethodsResponse, PaymentMethod, PaymentMethodType } from '../../../model/makePayment';
|
|
3
3
|
import { UIComponentsError } from '../../../model/uiComponents';
|
|
4
4
|
import { MakePaymentParams } from '../../../types';
|
|
5
|
-
import {
|
|
5
|
+
import { PPFetchResult } from '../../../utils/fetch';
|
|
6
6
|
export interface Props {
|
|
7
7
|
show?: boolean;
|
|
8
8
|
paymentParams: MakePaymentParams;
|
|
9
9
|
}
|
|
10
10
|
export declare function usePaymentMethod(props: Props): {
|
|
11
11
|
getPaymentMethods: (dryRun?: boolean | undefined) => Promise<{
|
|
12
|
-
res:
|
|
12
|
+
res: PPFetchResult<GetPaymentMethodsResponse>;
|
|
13
13
|
result: boolean;
|
|
14
14
|
}>;
|
|
15
15
|
showPaymentMethod: () => void;
|
|
@@ -312,13 +312,13 @@ export declare function useConsult(props: Props): {
|
|
|
312
312
|
getConsult: () => Promise<boolean>;
|
|
313
313
|
closeConsult: () => void;
|
|
314
314
|
setConsult: (consult: UIComponentsError) => void;
|
|
315
|
-
getConsultForTopup: (_retryCount?: number) => Promise<false |
|
|
315
|
+
getConsultForTopup: (_retryCount?: number) => Promise<false | PPFetchResult<ConsultResponse, Record<string, unknown>>>;
|
|
316
316
|
};
|
|
317
317
|
export declare function usePayment(props: Props, { paymentMethod, duplicatePayment, }: {
|
|
318
318
|
paymentMethod: ComputedRef<PaymentMethod>;
|
|
319
319
|
duplicatePayment: ComputedRef<boolean>;
|
|
320
320
|
}): {
|
|
321
|
-
pay: () => Promise<MakePaymentResponse | undefined>;
|
|
321
|
+
pay: () => Promise<import('../../../model/makePayment').MakePaymentResponse | undefined>;
|
|
322
322
|
paymentId: ComputedRef<string>;
|
|
323
323
|
};
|
|
324
324
|
export declare function useCashBackDetail(props: Props): {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComputedRef } from 'vue';
|
|
2
2
|
import { ResponseBase } from '../../../model/makePayment';
|
|
3
3
|
import { UIComponentsError } from '../../../model/uiComponents';
|
|
4
|
-
import {
|
|
4
|
+
import { PPFetchResult } from '../../../utils/fetch';
|
|
5
5
|
import { RootStore } from './root';
|
|
6
6
|
import { API_TYPES_NEVER_RETURN, API_TYPES } from './util-for-handle-error';
|
|
7
7
|
declare type InsufficientParams = {
|
|
@@ -14,7 +14,7 @@ export declare type ErrorHandlingStore = {
|
|
|
14
14
|
isError: ComputedRef<boolean>;
|
|
15
15
|
isErrorOverlay: ComputedRef<boolean>;
|
|
16
16
|
closeError: (immediately: boolean) => void;
|
|
17
|
-
handleError: (res: ResponseBase
|
|
17
|
+
handleError: (res: PPFetchResult<ResponseBase>, options: HandleErrorOptions) => boolean;
|
|
18
18
|
consultError: ComputedRef<UIComponentsError | null>;
|
|
19
19
|
showConsultError: ComputedRef<boolean>;
|
|
20
20
|
openLogicError: (options?: InsufficientParams, jws?: string | null) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MiniAppErrorType } from '../../../model/miniAppError';
|
|
2
2
|
import { ResponseBase } from '../../../model/makePayment';
|
|
3
|
-
import {
|
|
3
|
+
import { PPFetchResult } from '../../../utils/fetch';
|
|
4
4
|
export declare type API_TYPES = 'consult' | 'payment' | 'topup' | 'paymentMethod' | 'address';
|
|
5
5
|
export declare type API_TYPES_NEVER_RETURN = 'ageConfirm' | 'cashback';
|
|
6
6
|
export declare function createErrorFromType(type?: string): {
|
|
@@ -13,4 +13,4 @@ export declare function createErrorFromErrorCodeAndType(type?: string, code?: st
|
|
|
13
13
|
errorDescription: string;
|
|
14
14
|
errorIcon: string;
|
|
15
15
|
};
|
|
16
|
-
export declare function createErrorCodeForFailCallBack(res: ResponseBase
|
|
16
|
+
export declare function createErrorCodeForFailCallBack(res: PPFetchResult<ResponseBase>, api: API_TYPES | API_TYPES_NEVER_RETURN): MiniAppErrorType;
|