@adstage/web-sdk 1.1.0 → 1.3.1

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/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
- * AdSlot의 래퍼로 adType이 BANNER로 고정됨
156
+ * AdStage SDK Standalone API
157
+ * 간단하고 직관적인 사용을 위한 통합 API
173
158
  */
174
- declare const BannerAd: React.FC<BannerAdProps>;
175
-
176
- interface TextAdProps {
177
- slotId: string;
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 const TextAd: React.FC<TextAdProps>;
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 const NativeAd: React.FC<NativeAdProps>;
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
- className?: string;
217
- style?: React.CSSProperties;
218
- autoSlideInterval?: number;
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 const VideoAd: React.FC<VideoAdProps>;
229
-
230
- interface InterstitialAdProps {
231
- slotId: string;
232
- width?: string | number;
233
- height?: string | number;
234
- className?: string;
235
- style?: React.CSSProperties;
236
- autoSlideInterval?: number;
237
- sliderEffect?: 'slide' | 'fade';
238
- language?: string;
239
- deviceType?: string;
240
- country?: string;
241
- }
180
+ declare function createTextAd(containerId: string, options?: {
181
+ maxLines?: number;
182
+ style?: 'minimal' | 'card' | 'banner';
183
+ }): Promise<void>;
242
184
  /**
243
- * 인터스티셜 광고 전용 컴포넌트
244
- * AdSlot의 래퍼로 adType이 INTERSTITIAL로 고정됨
185
+ * 비디오 광고 생성
245
186
  */
246
- declare const InterstitialAd: React.FC<InterstitialAdProps>;
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
- }
187
+ declare function createVideoAd(containerId: string, options?: {
188
+ width?: string | number;
189
+ height?: string | number;
190
+ autoplay?: boolean;
191
+ muted?: boolean;
192
+ }): Promise<void>;
257
193
  /**
258
- * 광고 컴포넌트에서 발생하는 오류를 포착하는 Error Boundary
259
- * 광고 로딩 실패 시 fallback UI를 표시하고 앱 전체가 크래시되는 것을 방지
194
+ * 커스텀 이벤트 추적
260
195
  */
261
- declare class AdErrorBoundary extends Component<AdErrorBoundaryProps, AdErrorBoundaryState> {
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
-
196
+ declare function trackEvent(eventName: string, params?: Record<string, any>): void;
285
197
  /**
286
- * AdStage SDK 인스턴스에 접근하기 위한 Hook
287
- * AdStageProvider 내부에서만 사용 가능
198
+ * SDK 상태 확인
288
199
  */
289
- declare const useAdStage: () => AdStageContextValue;
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
- }
200
+ declare function isAdStageReady(): boolean;
310
201
  /**
311
- * 광고 슬롯 생성 관리를 위한 Hook
312
- * 컴포넌트에서 직접 슬롯을 제어하고 싶을 때 사용
202
+ * SDK 인스턴스 가져오기 (고급 사용자용)
313
203
  */
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
- * 광고 이벤트 추적을 위한 Hook
325
- * 커스텀 이벤트 추적이 필요할 때 사용
206
+ * SDK 초기화 해제 (필요시)
326
207
  */
327
- declare const useAdTracking: () => UseAdTrackingReturn;
208
+ declare function destroyAdStage(): void;
328
209
 
329
210
  /**
330
211
  * AdStage SDK 설정
@@ -411,6 +292,10 @@ declare class AdStageSDK {
411
292
  * 모든 슬롯 정보 가져오기
412
293
  */
413
294
  getAllSlots(): Map<string, AdSlot>;
295
+ /**
296
+ * 커스텀 이벤트 추적
297
+ */
298
+ trackCustomEvent(eventName: string, params?: Record<string, any>): void;
414
299
  }
415
300
 
416
- export { AdErrorBoundary, AdEventType, AdSlot, AdStageConfig, AdStageProvider, AdStageSDK, AdType, Advertisement, BannerAd, InterstitialAd, NativeAd, TextAd, VideoAd, AdStageSDK as default, useAdSlot, useAdStage, useAdTracking };
301
+ export { AdEventType, AdSlot, AdStageConfig, AdStageSDK, AdType, Advertisement, SimpleAdStageConfig, createBanner, createTextAd, createVideoAd, AdStageSDK as default, destroyAdStage, getAdStageInstance, initAdStage, isAdStageReady, trackEvent };