@bootpay/client-js 5.3.1 → 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.
@@ -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 {};
@@ -17,6 +17,7 @@ declare class TemplatePaymentManager extends TemplateManager {
17
17
  $env: any;
18
18
  $popup?: any;
19
19
  $popupWatcher?: any;
20
+ $themeColor?: string;
20
21
  mode: string;
21
22
  modeApiUrl: any;
22
23
  constructor();
@@ -110,6 +111,19 @@ declare class TemplatePaymentManager extends TemplateManager {
110
111
  * @returns void
111
112
  */
112
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;
113
127
  /**
114
128
  * 팝업 버튼 창을 닫는다
115
129
  * Comment by GOSOMI
@@ -169,6 +183,11 @@ declare class TemplatePaymentManager extends TemplateManager {
169
183
  */
170
184
  moveToUrl(url: string): void;
171
185
  apiUrl(): any;
186
+ /**
187
+ * Progress 창을 보여준다 — 결제 요청 extra.theme_color 가 있으면 로딩 점 색을 그 색으로 바꾼다
188
+ * 값이 없거나 CSS 색상이 아니면 alfred-progress 기본색(--bootpay-progress-accent)을 쓴다
189
+ */
190
+ showProgress(message: string): void;
172
191
  /**
173
192
  * Form 설정 공통 메서드
174
193
  * 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 // 재방문까지 걸린 시각
@@ -232,12 +234,20 @@ export interface ExtraModel {
232
234
  webhook_delay_duration?: number // webhook delay duration ( sec )
233
235
 
234
236
  force_browser_mode?: 'pc' | 'mobile' // 강제로 브라우저 모드 지정 옵션 ( 현재 미구현 PG사마다 정책이 달라서 확인 이후에 업데이트 될 예정 )
237
+ card_interest_merchant_share?: boolean // 가맹점 분담 무이자 사용 여부
238
+
239
+ theme_color?: string // 부트페이 결제창(카드 등록 등) 강조색 — 버튼 배경 · 입력 focus, CSS 색상값 ( 비우면 기본색 #3182F6, 이니시스는 결제창 SKIN 으로도 쓴다 )
240
+ theme_text_color?: string // theme_color 배경 위 글자색, CSS 색상값 ( 비우면 기본색 #FFFFFF )
241
+ force_redirect?: boolean
235
242
  }
236
243
 
237
244
  export interface WidgetExtraModel extends Partial<ExtraModel> {
238
245
  card_quota?: string | string[] | number[] // 카드 할부 개월수 노출 설정
239
246
  direct_card_company?: string
240
247
  direct_card_quota?: string
248
+ // true 면 카드사 바로 호출을 지원하는 PG(나이스페이 · KCP 등)라도 위젯이 카드사 목록을 그리지 않고
249
+ // PG 결제창(카드사 선택 화면)을 띄운다 — PG 심사처럼 PG 전용 창이 필요한 경우에 쓴다. 기본 false
250
+ use_pg_card_window?: boolean
241
251
 
242
252
  hide_title?: boolean
243
253
  hide_divider_line?: boolean
@@ -299,4 +309,31 @@ export interface PopupDisplayResponseModel {
299
309
  export interface CommissionKeyModel {
300
310
  commerce?: string
301
311
  marketer?: string
302
- }
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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bootpay/client-js",
3
- "version": "5.3.1",
3
+ "version": "5.5.0",
4
4
  "main": "dist/index.mjs",
5
5
  "exports": {
6
6
  ".": {