@bootpay/client-js 5.4.0 → 5.5.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/README.md +39 -28
- package/dist/index.mjs +2283 -2078
- package/dist/index.umd.js +34 -24
- package/dist/src/bootpay.d.ts +2 -1
- package/dist/src/lib/event/onboarding.d.ts +17 -0
- package/dist/src/lib/template/onboarding.d.ts +40 -0
- package/dist/src/lib/template/payment.d.ts +13 -0
- package/dist/src/support/environment.d.ts +2 -0
- package/dist/src/types/bootpay-interface.d.ts +31 -1
- package/package.json +1 -1
package/dist/src/bootpay.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BootpayAnalyticsModel, BootpayAnalyticsUserModel, RequestAuthenticationModel, RequestPaymentModel, RequestPaymentUrlModel, RequestSubscriptionModel } from './types/bootpay-interface';
|
|
1
|
+
import { BootpayAnalyticsModel, BootpayAnalyticsUserModel, OnboardingResultModel, RequestAuthenticationModel, RequestOnboardingModel, RequestPaymentModel, RequestPaymentUrlModel, RequestSubscriptionModel } from './types/bootpay-interface';
|
|
2
2
|
import { EnvironmentInterface } from './support/environment';
|
|
3
3
|
import { BootpayRequestPaymentManager } from './lib/bootpay';
|
|
4
4
|
import { BootpayAnalyticsManager } from './lib/analytics';
|
|
@@ -11,6 +11,7 @@ export interface BootpayInterface {
|
|
|
11
11
|
requestSubscription(data: RequestSubscriptionModel): Promise<any>;
|
|
12
12
|
requestAuthentication(data: RequestAuthenticationModel): Promise<any>;
|
|
13
13
|
requestPaymentUrl(data: RequestPaymentUrlModel): Promise<any>;
|
|
14
|
+
requestOnboarding(data: RequestOnboardingModel): Promise<OnboardingResultModel>;
|
|
14
15
|
confirm(): Promise<any>;
|
|
15
16
|
errorHandler(data: any): any;
|
|
16
17
|
setEnvironmentMode(env: 'development' | 'stage' | 'production', hostname?: string | undefined | null): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BootpayWindowEvent } from '../../vendor/mixins/event';
|
|
2
|
+
import { OnboardingResultModel } from '../../types/bootpay-interface';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 리셀러 등록 폼(PG 신청 화면) 결과 메시지 — Bootpay.requestOnboarding 전용
|
|
6
|
+
* 신청 화면은 JSON 문자열 { bootpay_event: true, event: 'done' | 'cancel', id, kind, pg_wait_id, status } 를 보낸다.
|
|
7
|
+
* 결과는 리셀러 화면 상태를 바꾸므로 기존 리스너와 달리 origin 을 확인한다 — 신청 화면 origin 에서,
|
|
8
|
+
* 이 SDK 가 연 창(popup · iframe)이 보낸 메시지만 받는다.
|
|
9
|
+
* 토큰 · 결과는 로그나 분석 이벤트로 보내지 않는다.
|
|
10
|
+
* @date: 26-10-27
|
|
11
|
+
*/
|
|
12
|
+
export declare class BootpayOnboardingEventManager extends BootpayWindowEvent {
|
|
13
|
+
$messageEventName: string;
|
|
14
|
+
constructor();
|
|
15
|
+
bindOnboarding(allowedOrigin: string, expectedSource: () => Window | null, onDone: (result: OnboardingResultModel) => void, onCancel: () => void): void;
|
|
16
|
+
unbind(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { TemplateManager } from '../../vendor/mixins/template-manager';
|
|
2
|
+
import { BootpayOnboardingEventManager } from '../event/onboarding';
|
|
3
|
+
import { OnboardingResultModel, RequestOnboardingModel } from '../../types/bootpay-interface';
|
|
4
|
+
|
|
5
|
+
type OnboardingDisplay = 'popup' | 'iframe' | 'redirect';
|
|
6
|
+
/**
|
|
7
|
+
* 리셀러 등록 폼(PG 신청 화면) 창 — Bootpay.requestOnboarding 전용
|
|
8
|
+
* - popup: window.open + 500ms 닫힘 감시(결제창 readyToPopup 과 같은 방식) — 닫히면 cancel
|
|
9
|
+
* - iframe(기본): 결제창 덮개(bootpay-payment-background) + iframe, 본문 스크롤 잠금 — 끝나면 덮개 제거 · 스크롤 복구
|
|
10
|
+
* - redirect: 현재 창 이동. Promise 는 끝나지 않는다(결과는 return_url 쿼리 · 리셀러 웹훅)
|
|
11
|
+
* 신청 화면 주소: {ONBOARDING_URL}/onboarding/s/{token}?display=…&origin={리셀러 페이지 origin}
|
|
12
|
+
* @date: 26-10-27
|
|
13
|
+
*/
|
|
14
|
+
export declare class OnboardingTemplateManager extends TemplateManager {
|
|
15
|
+
$template: string;
|
|
16
|
+
$windowId: string;
|
|
17
|
+
$iFrameId: string;
|
|
18
|
+
$onboardingWindowId: string;
|
|
19
|
+
$event: BootpayOnboardingEventManager;
|
|
20
|
+
$popup: Window | null;
|
|
21
|
+
$popupWatcher: ReturnType<typeof setInterval> | undefined;
|
|
22
|
+
$abortPrevious: (() => void) | null;
|
|
23
|
+
constructor();
|
|
24
|
+
template(): string;
|
|
25
|
+
/**
|
|
26
|
+
* 신청 화면 주소 — url 을 주면 부트페이 신청 화면 주소(ONBOARDING_URL)일 때만 쓴다
|
|
27
|
+
*/
|
|
28
|
+
onboardingUrl(data: RequestOnboardingModel, display: OnboardingDisplay): string;
|
|
29
|
+
/**
|
|
30
|
+
* 신청 화면을 연다. done 은 resolve, cancel 과 error 는 reject
|
|
31
|
+
*/
|
|
32
|
+
open(data: RequestOnboardingModel): Promise<OnboardingResultModel>;
|
|
33
|
+
currentWindow(display: OnboardingDisplay): Window | null;
|
|
34
|
+
/**
|
|
35
|
+
* 창 · 덮개 · 감시 · 리스너를 정리하고 본문 스크롤을 되돌린다
|
|
36
|
+
*/
|
|
37
|
+
destroy(): void;
|
|
38
|
+
}
|
|
39
|
+
export declare const OnboardingTemplate: OnboardingTemplateManager;
|
|
40
|
+
export {};
|
|
@@ -111,6 +111,19 @@ declare class TemplatePaymentManager extends TemplateManager {
|
|
|
111
111
|
* @returns void
|
|
112
112
|
*/
|
|
113
113
|
showPopupMessage(displayData: PopupDisplayResponseModel): void;
|
|
114
|
+
/**
|
|
115
|
+
* 팝업 안내 창에 결제 요청 extra.theme_color 를 적용한다
|
|
116
|
+
* 값이 없거나 CSS 색상이 아니면 common.sass 의 기본색(--bootpay-primary)을 쓴다
|
|
117
|
+
*/
|
|
118
|
+
private applyPopupThemeColor;
|
|
119
|
+
/**
|
|
120
|
+
* CSS 색상 문자열을 [r, g, b] 로 변환한다 — 브라우저가 계산한 값을 읽으므로 hex/rgb/hsl/색상명 모두 지원한다
|
|
121
|
+
*/
|
|
122
|
+
private resolveRgb;
|
|
123
|
+
/**
|
|
124
|
+
* WCAG 상대 휘도 — 버튼 글자색(흰색/검정)을 고르는 데 쓴다
|
|
125
|
+
*/
|
|
126
|
+
private relativeLuminance;
|
|
114
127
|
/**
|
|
115
128
|
* 팝업 버튼 창을 닫는다
|
|
116
129
|
* Comment by GOSOMI
|
|
@@ -27,6 +27,7 @@ export interface EnvironmentInterface {
|
|
|
27
27
|
ANALYTICS_URL: EnvironmentMode;
|
|
28
28
|
DOOR_URL: EnvironmentMode;
|
|
29
29
|
WIDGET_URL: EnvironmentMode;
|
|
30
|
+
ONBOARDING_URL: EnvironmentMode;
|
|
30
31
|
sdkNames: SdkNameInterface;
|
|
31
32
|
sdkVersion: string;
|
|
32
33
|
packageVersion: string;
|
|
@@ -40,6 +41,7 @@ export interface EnvironmentInterface {
|
|
|
40
41
|
toApi(uri: string): string;
|
|
41
42
|
toDoor(uri: string): string;
|
|
42
43
|
toWidget(uri: string): string;
|
|
44
|
+
toOnboarding(uri: string): string;
|
|
43
45
|
isMobile(): boolean;
|
|
44
46
|
isMobileSafari(): any;
|
|
45
47
|
toAnalytics(uri: string): string;
|
|
@@ -17,6 +17,8 @@ interface RequestPaymentBaseModel {
|
|
|
17
17
|
deposit_price?: number
|
|
18
18
|
platform_type?: number
|
|
19
19
|
currency?: string // 결제 currency 화폐단위
|
|
20
|
+
currencies?: string[] // 통합결제창에서 결제 가능한 통화 목록 ex) ['krw', 'usd']
|
|
21
|
+
currency_prices?: { [currency: string]: number } // 통화별 결제 금액 ex) { usd: 11.12, cny: 100.23 }, 없으면 price를 환율로 환산
|
|
20
22
|
uuid?: string // UUID
|
|
21
23
|
sk?: string // 세션 고유키
|
|
22
24
|
ti?: number // 재방문까지 걸린 시각
|
|
@@ -236,6 +238,7 @@ export interface ExtraModel {
|
|
|
236
238
|
|
|
237
239
|
theme_color?: string // 부트페이 결제창(카드 등록 등) 강조색 — 버튼 배경 · 입력 focus, CSS 색상값 ( 비우면 기본색 #3182F6, 이니시스는 결제창 SKIN 으로도 쓴다 )
|
|
238
240
|
theme_text_color?: string // theme_color 배경 위 글자색, CSS 색상값 ( 비우면 기본색 #FFFFFF )
|
|
241
|
+
force_redirect?: boolean
|
|
239
242
|
}
|
|
240
243
|
|
|
241
244
|
export interface WidgetExtraModel extends Partial<ExtraModel> {
|
|
@@ -306,4 +309,31 @@ export interface PopupDisplayResponseModel {
|
|
|
306
309
|
export interface CommissionKeyModel {
|
|
307
310
|
commerce?: string
|
|
308
311
|
marketer?: string
|
|
309
|
-
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* 리셀러 등록 폼(PG 신청) 열기 요청 — Bootpay.requestOnboarding
|
|
316
|
+
* token: 리셀러 서버가 발급받은 등록 폼 토큰(rst_…)
|
|
317
|
+
* display: 'iframe'(기본, 현재 페이지 위 덮개) | 'popup'(새 창) | 'redirect'(현재 창 이동 — Promise 가 끝나지 않는다)
|
|
318
|
+
* url: 발급 응답의 url 을 그대로 쓸 때만. 부트페이 신청 화면 주소일 때만 받는다
|
|
319
|
+
* @date: 26-10-27
|
|
320
|
+
*/
|
|
321
|
+
export interface RequestOnboardingModel {
|
|
322
|
+
token: string
|
|
323
|
+
display?: 'popup' | 'iframe' | 'redirect'
|
|
324
|
+
url?: string
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* 리셀러 등록 폼 결과 — done 은 resolve, cancel(창 닫기 · 나중에 할게요)과 error 는 reject
|
|
329
|
+
* @date: 26-10-27
|
|
330
|
+
*/
|
|
331
|
+
export interface OnboardingResultModel {
|
|
332
|
+
event: 'done' | 'cancel' | 'error'
|
|
333
|
+
id?: string
|
|
334
|
+
kind?: 'pg_join' | string
|
|
335
|
+
pg_wait_id?: string
|
|
336
|
+
status?: number | null
|
|
337
|
+
error_code?: 'ONBOARDING_TOKEN_REQUIRED' | 'ONBOARDING_URL_INVALID' | 'POPUP_BLOCKED' | string
|
|
338
|
+
message?: string
|
|
339
|
+
}
|