@adstage/web-sdk 1.1.0 → 1.3.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 -47
- package/dist/index.cjs.js +124 -352
- package/dist/index.d.ts +34 -153
- package/dist/index.esm.js +117 -342
- package/dist/index.standalone.js +117 -385
- package/package.json +6 -2
- package/src/index.ts +5 -2
- package/src/utils/sdk-standalone.ts +175 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import React, { Component, ErrorInfo, ReactNode } from 'react';
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
-
|
|
4
1
|
declare enum AdType {
|
|
5
2
|
BANNER = "BANNER",
|
|
6
3
|
POPUP = "POPUP",
|
|
@@ -155,176 +152,60 @@ interface AdSlot {
|
|
|
155
152
|
destroy(): void;
|
|
156
153
|
}
|
|
157
154
|
|
|
158
|
-
interface BannerAdProps {
|
|
159
|
-
slotId: string;
|
|
160
|
-
width?: string | number;
|
|
161
|
-
height?: string | number;
|
|
162
|
-
className?: string;
|
|
163
|
-
style?: React.CSSProperties;
|
|
164
|
-
autoSlideInterval?: number;
|
|
165
|
-
sliderEffect?: 'slide' | 'fade';
|
|
166
|
-
language?: string;
|
|
167
|
-
deviceType?: string;
|
|
168
|
-
country?: string;
|
|
169
|
-
}
|
|
170
155
|
/**
|
|
171
|
-
*
|
|
172
|
-
*
|
|
156
|
+
* AdStage SDK Standalone API
|
|
157
|
+
* 간단하고 직관적인 사용을 위한 통합 API
|
|
173
158
|
*/
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
width?: string | number;
|
|
179
|
-
height?: string | number;
|
|
180
|
-
className?: string;
|
|
181
|
-
style?: React.CSSProperties;
|
|
182
|
-
autoSlideInterval?: number;
|
|
183
|
-
sliderEffect?: 'slide' | 'fade';
|
|
184
|
-
language?: string;
|
|
185
|
-
deviceType?: string;
|
|
186
|
-
country?: string;
|
|
159
|
+
interface SimpleAdStageConfig {
|
|
160
|
+
apiKey: string;
|
|
161
|
+
debug?: boolean;
|
|
162
|
+
baseUrl?: string;
|
|
187
163
|
}
|
|
188
164
|
/**
|
|
189
|
-
*
|
|
190
|
-
* AdSlot의 래퍼로 adType이 TEXT로 고정됨
|
|
165
|
+
* SDK 초기화 (한 번만 호출)
|
|
191
166
|
*/
|
|
192
|
-
declare
|
|
193
|
-
|
|
194
|
-
interface NativeAdProps {
|
|
195
|
-
slotId: string;
|
|
196
|
-
width?: string | number;
|
|
197
|
-
height?: string | number;
|
|
198
|
-
className?: string;
|
|
199
|
-
style?: React.CSSProperties;
|
|
200
|
-
autoSlideInterval?: number;
|
|
201
|
-
sliderEffect?: 'slide' | 'fade';
|
|
202
|
-
language?: string;
|
|
203
|
-
deviceType?: string;
|
|
204
|
-
country?: string;
|
|
205
|
-
}
|
|
167
|
+
declare function initAdStage(config: SimpleAdStageConfig): Promise<void>;
|
|
206
168
|
/**
|
|
207
|
-
*
|
|
208
|
-
* AdSlot의 래퍼로 adType이 NATIVE로 고정됨
|
|
169
|
+
* 배너 광고 생성 (가장 간단한 API)
|
|
209
170
|
*/
|
|
210
|
-
declare
|
|
211
|
-
|
|
212
|
-
interface VideoAdProps {
|
|
213
|
-
slotId: string;
|
|
171
|
+
declare function createBanner(containerId: string, options?: {
|
|
214
172
|
width?: string | number;
|
|
215
173
|
height?: string | number;
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
sliderEffect?: 'slide' | 'fade';
|
|
220
|
-
language?: string;
|
|
221
|
-
deviceType?: string;
|
|
222
|
-
country?: string;
|
|
223
|
-
}
|
|
174
|
+
autoSlide?: boolean;
|
|
175
|
+
slideInterval?: number;
|
|
176
|
+
}): Promise<void>;
|
|
224
177
|
/**
|
|
225
|
-
*
|
|
226
|
-
* AdSlot의 래퍼로 adType이 VIDEO로 고정됨
|
|
178
|
+
* 텍스트 광고 생성
|
|
227
179
|
*/
|
|
228
|
-
declare
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
180
|
+
declare function createTextAd(containerId: string, options?: {
|
|
181
|
+
maxLines?: number;
|
|
182
|
+
style?: 'minimal' | 'card' | 'banner';
|
|
183
|
+
}): Promise<void>;
|
|
184
|
+
/**
|
|
185
|
+
* 비디오 광고 생성
|
|
186
|
+
*/
|
|
187
|
+
declare function createVideoAd(containerId: string, options?: {
|
|
232
188
|
width?: string | number;
|
|
233
189
|
height?: string | number;
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
sliderEffect?: 'slide' | 'fade';
|
|
238
|
-
language?: string;
|
|
239
|
-
deviceType?: string;
|
|
240
|
-
country?: string;
|
|
241
|
-
}
|
|
190
|
+
autoplay?: boolean;
|
|
191
|
+
muted?: boolean;
|
|
192
|
+
}): Promise<void>;
|
|
242
193
|
/**
|
|
243
|
-
*
|
|
244
|
-
* AdSlot의 래퍼로 adType이 INTERSTITIAL로 고정됨
|
|
194
|
+
* 커스텀 이벤트 추적
|
|
245
195
|
*/
|
|
246
|
-
declare
|
|
247
|
-
|
|
248
|
-
interface AdErrorBoundaryProps {
|
|
249
|
-
children: ReactNode;
|
|
250
|
-
fallback?: ReactNode;
|
|
251
|
-
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
252
|
-
}
|
|
253
|
-
interface AdErrorBoundaryState {
|
|
254
|
-
hasError: boolean;
|
|
255
|
-
error: Error | null;
|
|
256
|
-
}
|
|
196
|
+
declare function trackEvent(eventName: string, params?: Record<string, any>): void;
|
|
257
197
|
/**
|
|
258
|
-
*
|
|
259
|
-
* 광고 로딩 실패 시 fallback UI를 표시하고 앱 전체가 크래시되는 것을 방지
|
|
198
|
+
* SDK 상태 확인
|
|
260
199
|
*/
|
|
261
|
-
declare
|
|
262
|
-
constructor(props: AdErrorBoundaryProps);
|
|
263
|
-
static getDerivedStateFromError(error: Error): AdErrorBoundaryState;
|
|
264
|
-
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
265
|
-
render(): string | number | boolean | Iterable<React.ReactNode> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
interface AdStageSDKInstance {
|
|
269
|
-
createSlot: (...args: any[]) => Promise<void>;
|
|
270
|
-
removeSlot?: (slotId: string) => void;
|
|
271
|
-
}
|
|
272
|
-
interface AdStageContextValue {
|
|
273
|
-
sdk: AdStageSDKInstance | null;
|
|
274
|
-
isLoading: boolean;
|
|
275
|
-
error: string | null;
|
|
276
|
-
isInitialized: boolean;
|
|
277
|
-
}
|
|
278
|
-
interface AdStageProviderProps {
|
|
279
|
-
config: AdStageConfig;
|
|
280
|
-
children: ReactNode;
|
|
281
|
-
autoInit?: boolean;
|
|
282
|
-
}
|
|
283
|
-
declare const AdStageProvider: React.FC<AdStageProviderProps>;
|
|
284
|
-
|
|
200
|
+
declare function isAdStageReady(): boolean;
|
|
285
201
|
/**
|
|
286
|
-
*
|
|
287
|
-
* AdStageProvider 내부에서만 사용 가능
|
|
202
|
+
* SDK 인스턴스 가져오기 (고급 사용자용)
|
|
288
203
|
*/
|
|
289
|
-
declare
|
|
290
|
-
|
|
291
|
-
interface UseAdSlotOptions {
|
|
292
|
-
slotId: string;
|
|
293
|
-
containerId: string;
|
|
294
|
-
adType: AdType;
|
|
295
|
-
width?: string | number;
|
|
296
|
-
height?: string | number;
|
|
297
|
-
language?: string;
|
|
298
|
-
deviceType?: string;
|
|
299
|
-
country?: string;
|
|
300
|
-
autoSlideInterval?: number;
|
|
301
|
-
sliderEffect?: 'slide' | 'fade';
|
|
302
|
-
}
|
|
303
|
-
interface UseAdSlotReturn {
|
|
304
|
-
isLoading: boolean;
|
|
305
|
-
error: string | null;
|
|
306
|
-
isCreated: boolean;
|
|
307
|
-
createSlot: () => Promise<void>;
|
|
308
|
-
resetSlot: () => void;
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* 광고 슬롯 생성 및 관리를 위한 Hook
|
|
312
|
-
* 컴포넌트에서 직접 슬롯을 제어하고 싶을 때 사용
|
|
313
|
-
*/
|
|
314
|
-
declare const useAdSlot: (options: UseAdSlotOptions) => UseAdSlotReturn;
|
|
315
|
-
|
|
316
|
-
interface UseAdTrackingReturn {
|
|
317
|
-
trackEvent: (adId: string, slotId: string, eventType: AdEventType) => void;
|
|
318
|
-
trackClick: (adId: string, slotId: string) => void;
|
|
319
|
-
trackImpression: (adId: string, slotId: string) => void;
|
|
320
|
-
trackView: (adId: string, slotId: string) => void;
|
|
321
|
-
trackClose: (adId: string, slotId: string) => void;
|
|
322
|
-
}
|
|
204
|
+
declare function getAdStageInstance(): any;
|
|
323
205
|
/**
|
|
324
|
-
*
|
|
325
|
-
* 커스텀 이벤트 추적이 필요할 때 사용
|
|
206
|
+
* SDK 초기화 해제 (필요시)
|
|
326
207
|
*/
|
|
327
|
-
declare
|
|
208
|
+
declare function destroyAdStage(): void;
|
|
328
209
|
|
|
329
210
|
/**
|
|
330
211
|
* AdStage SDK 설정
|
|
@@ -413,4 +294,4 @@ declare class AdStageSDK {
|
|
|
413
294
|
getAllSlots(): Map<string, AdSlot>;
|
|
414
295
|
}
|
|
415
296
|
|
|
416
|
-
export {
|
|
297
|
+
export { AdEventType, AdSlot, AdStageConfig, AdStageSDK, AdType, Advertisement, SimpleAdStageConfig, createBanner, createTextAd, createVideoAd, AdStageSDK as default, destroyAdStage, getAdStageInstance, initAdStage, isAdStageReady, trackEvent };
|