@adstage/web-sdk 2.3.0 → 2.3.3
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.cjs.js
CHANGED
|
@@ -1619,8 +1619,20 @@ class AdvertisementEventTracker {
|
|
|
1619
1619
|
// 필수 필드들
|
|
1620
1620
|
adType: slot?.adType || 'BANNER',
|
|
1621
1621
|
platform: deviceInfo.platform,
|
|
1622
|
-
// 디바이스
|
|
1623
|
-
|
|
1622
|
+
// 디바이스 정보 - 스키마에 맞게 최상위 레벨로 추출
|
|
1623
|
+
deviceId: deviceInfo.deviceId,
|
|
1624
|
+
osVersion: deviceInfo.osVersion,
|
|
1625
|
+
deviceModel: deviceInfo.deviceModel,
|
|
1626
|
+
appVersion: deviceInfo.appVersion,
|
|
1627
|
+
sdkVersion: deviceInfo.sdkVersion,
|
|
1628
|
+
language: deviceInfo.language,
|
|
1629
|
+
country: deviceInfo.country,
|
|
1630
|
+
timezone: deviceInfo.timezone,
|
|
1631
|
+
viewportWidth: deviceInfo.viewportWidth,
|
|
1632
|
+
viewportHeight: deviceInfo.viewportHeight,
|
|
1633
|
+
screenWidth: deviceInfo.screenWidth,
|
|
1634
|
+
screenHeight: deviceInfo.screenHeight,
|
|
1635
|
+
connectionType: deviceInfo.connectionType,
|
|
1624
1636
|
// 페이지 및 슬롯 정보
|
|
1625
1637
|
pageUrl: DOMUtils.getPageInfo().url,
|
|
1626
1638
|
pageTitle: DOMUtils.getPageInfo().title,
|
|
@@ -1629,7 +1641,6 @@ class AdvertisementEventTracker {
|
|
|
1629
1641
|
slotPosition: DeviceInfoCollector.getSlotPosition(slot?.containerId || ''),
|
|
1630
1642
|
slotWidth: AdvertisementEventTracker.parseNumericValue(slot?.width),
|
|
1631
1643
|
slotHeight: AdvertisementEventTracker.parseNumericValue(slot?.height),
|
|
1632
|
-
sessionId: deviceInfo.sessionId,
|
|
1633
1644
|
// 성능 메트릭
|
|
1634
1645
|
pageLoadTime: performance.now(),
|
|
1635
1646
|
// 추가 메타데이터
|
|
@@ -2802,7 +2813,7 @@ class AdsModule {
|
|
|
2802
2813
|
throw new Error(`Container not found: ${slot.containerId}`);
|
|
2803
2814
|
}
|
|
2804
2815
|
// 이벤트 추적 콜백 함수 (중복 노출 방지 포함)
|
|
2805
|
-
const trackEventCallback = (adId, slotId, eventType) => {
|
|
2816
|
+
const trackEventCallback = async (adId, slotId, eventType) => {
|
|
2806
2817
|
// 노출 이벤트인 경우 중복 확인
|
|
2807
2818
|
if (eventType === AdEventType.VIEWABLE) {
|
|
2808
2819
|
if (ViewableEventTracker.isDuplicateViewable(adId, slotId, this._config?.debug)) {
|
|
@@ -2815,8 +2826,20 @@ class AdsModule {
|
|
|
2815
2826
|
console.log(`✅ New viewable recorded for ad ${adId} in slot ${slotId}`);
|
|
2816
2827
|
}
|
|
2817
2828
|
}
|
|
2818
|
-
|
|
2819
|
-
|
|
2829
|
+
// 실제 API 호출로 이벤트 전송
|
|
2830
|
+
if (this.advertisementEventTracker) {
|
|
2831
|
+
try {
|
|
2832
|
+
await this.advertisementEventTracker.trackAdvertisementEvent(adId, slotId, eventType, {} // 기본 메타데이터
|
|
2833
|
+
);
|
|
2834
|
+
if (this._config?.debug) {
|
|
2835
|
+
console.log(`📊 Advertisement event tracked: ${eventType} for ad ${adId} in slot ${slotId}`);
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
catch (error) {
|
|
2839
|
+
if (this._config?.debug) {
|
|
2840
|
+
console.error(`❌ Failed to track ${eventType} event for ad ${adId}:`, error);
|
|
2841
|
+
}
|
|
2842
|
+
}
|
|
2820
2843
|
}
|
|
2821
2844
|
};
|
|
2822
2845
|
let sliderElement;
|
|
@@ -3239,6 +3262,13 @@ class AdStage {
|
|
|
3239
3262
|
productionMode: false,
|
|
3240
3263
|
...config
|
|
3241
3264
|
};
|
|
3265
|
+
// baseUrl이 설정되었으면 endpoints에 적용
|
|
3266
|
+
if (config.baseUrl) {
|
|
3267
|
+
endpoints.setBaseUrl(config.baseUrl);
|
|
3268
|
+
if (config.debug) {
|
|
3269
|
+
console.log('🔄 API base URL set to:', config.baseUrl);
|
|
3270
|
+
}
|
|
3271
|
+
}
|
|
3242
3272
|
// 모듈 동기 초기화
|
|
3243
3273
|
const enabledModules = instance._config.modules || ['ads', 'events', 'config'];
|
|
3244
3274
|
for (const moduleName of enabledModules) {
|
package/dist/index.esm.js
CHANGED
|
@@ -1617,8 +1617,20 @@ class AdvertisementEventTracker {
|
|
|
1617
1617
|
// 필수 필드들
|
|
1618
1618
|
adType: slot?.adType || 'BANNER',
|
|
1619
1619
|
platform: deviceInfo.platform,
|
|
1620
|
-
// 디바이스
|
|
1621
|
-
|
|
1620
|
+
// 디바이스 정보 - 스키마에 맞게 최상위 레벨로 추출
|
|
1621
|
+
deviceId: deviceInfo.deviceId,
|
|
1622
|
+
osVersion: deviceInfo.osVersion,
|
|
1623
|
+
deviceModel: deviceInfo.deviceModel,
|
|
1624
|
+
appVersion: deviceInfo.appVersion,
|
|
1625
|
+
sdkVersion: deviceInfo.sdkVersion,
|
|
1626
|
+
language: deviceInfo.language,
|
|
1627
|
+
country: deviceInfo.country,
|
|
1628
|
+
timezone: deviceInfo.timezone,
|
|
1629
|
+
viewportWidth: deviceInfo.viewportWidth,
|
|
1630
|
+
viewportHeight: deviceInfo.viewportHeight,
|
|
1631
|
+
screenWidth: deviceInfo.screenWidth,
|
|
1632
|
+
screenHeight: deviceInfo.screenHeight,
|
|
1633
|
+
connectionType: deviceInfo.connectionType,
|
|
1622
1634
|
// 페이지 및 슬롯 정보
|
|
1623
1635
|
pageUrl: DOMUtils.getPageInfo().url,
|
|
1624
1636
|
pageTitle: DOMUtils.getPageInfo().title,
|
|
@@ -1627,7 +1639,6 @@ class AdvertisementEventTracker {
|
|
|
1627
1639
|
slotPosition: DeviceInfoCollector.getSlotPosition(slot?.containerId || ''),
|
|
1628
1640
|
slotWidth: AdvertisementEventTracker.parseNumericValue(slot?.width),
|
|
1629
1641
|
slotHeight: AdvertisementEventTracker.parseNumericValue(slot?.height),
|
|
1630
|
-
sessionId: deviceInfo.sessionId,
|
|
1631
1642
|
// 성능 메트릭
|
|
1632
1643
|
pageLoadTime: performance.now(),
|
|
1633
1644
|
// 추가 메타데이터
|
|
@@ -2800,7 +2811,7 @@ class AdsModule {
|
|
|
2800
2811
|
throw new Error(`Container not found: ${slot.containerId}`);
|
|
2801
2812
|
}
|
|
2802
2813
|
// 이벤트 추적 콜백 함수 (중복 노출 방지 포함)
|
|
2803
|
-
const trackEventCallback = (adId, slotId, eventType) => {
|
|
2814
|
+
const trackEventCallback = async (adId, slotId, eventType) => {
|
|
2804
2815
|
// 노출 이벤트인 경우 중복 확인
|
|
2805
2816
|
if (eventType === AdEventType.VIEWABLE) {
|
|
2806
2817
|
if (ViewableEventTracker.isDuplicateViewable(adId, slotId, this._config?.debug)) {
|
|
@@ -2813,8 +2824,20 @@ class AdsModule {
|
|
|
2813
2824
|
console.log(`✅ New viewable recorded for ad ${adId} in slot ${slotId}`);
|
|
2814
2825
|
}
|
|
2815
2826
|
}
|
|
2816
|
-
|
|
2817
|
-
|
|
2827
|
+
// 실제 API 호출로 이벤트 전송
|
|
2828
|
+
if (this.advertisementEventTracker) {
|
|
2829
|
+
try {
|
|
2830
|
+
await this.advertisementEventTracker.trackAdvertisementEvent(adId, slotId, eventType, {} // 기본 메타데이터
|
|
2831
|
+
);
|
|
2832
|
+
if (this._config?.debug) {
|
|
2833
|
+
console.log(`📊 Advertisement event tracked: ${eventType} for ad ${adId} in slot ${slotId}`);
|
|
2834
|
+
}
|
|
2835
|
+
}
|
|
2836
|
+
catch (error) {
|
|
2837
|
+
if (this._config?.debug) {
|
|
2838
|
+
console.error(`❌ Failed to track ${eventType} event for ad ${adId}:`, error);
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
2818
2841
|
}
|
|
2819
2842
|
};
|
|
2820
2843
|
let sliderElement;
|
|
@@ -3237,6 +3260,13 @@ class AdStage {
|
|
|
3237
3260
|
productionMode: false,
|
|
3238
3261
|
...config
|
|
3239
3262
|
};
|
|
3263
|
+
// baseUrl이 설정되었으면 endpoints에 적용
|
|
3264
|
+
if (config.baseUrl) {
|
|
3265
|
+
endpoints.setBaseUrl(config.baseUrl);
|
|
3266
|
+
if (config.debug) {
|
|
3267
|
+
console.log('🔄 API base URL set to:', config.baseUrl);
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3240
3270
|
// 모듈 동기 초기화
|
|
3241
3271
|
const enabledModules = instance._config.modules || ['ads', 'events', 'config'];
|
|
3242
3272
|
for (const moduleName of enabledModules) {
|
package/dist/index.standalone.js
CHANGED
|
@@ -1614,8 +1614,20 @@ class AdvertisementEventTracker {
|
|
|
1614
1614
|
// 필수 필드들
|
|
1615
1615
|
adType: slot?.adType || 'BANNER',
|
|
1616
1616
|
platform: deviceInfo.platform,
|
|
1617
|
-
// 디바이스
|
|
1618
|
-
|
|
1617
|
+
// 디바이스 정보 - 스키마에 맞게 최상위 레벨로 추출
|
|
1618
|
+
deviceId: deviceInfo.deviceId,
|
|
1619
|
+
osVersion: deviceInfo.osVersion,
|
|
1620
|
+
deviceModel: deviceInfo.deviceModel,
|
|
1621
|
+
appVersion: deviceInfo.appVersion,
|
|
1622
|
+
sdkVersion: deviceInfo.sdkVersion,
|
|
1623
|
+
language: deviceInfo.language,
|
|
1624
|
+
country: deviceInfo.country,
|
|
1625
|
+
timezone: deviceInfo.timezone,
|
|
1626
|
+
viewportWidth: deviceInfo.viewportWidth,
|
|
1627
|
+
viewportHeight: deviceInfo.viewportHeight,
|
|
1628
|
+
screenWidth: deviceInfo.screenWidth,
|
|
1629
|
+
screenHeight: deviceInfo.screenHeight,
|
|
1630
|
+
connectionType: deviceInfo.connectionType,
|
|
1619
1631
|
// 페이지 및 슬롯 정보
|
|
1620
1632
|
pageUrl: DOMUtils.getPageInfo().url,
|
|
1621
1633
|
pageTitle: DOMUtils.getPageInfo().title,
|
|
@@ -1624,7 +1636,6 @@ class AdvertisementEventTracker {
|
|
|
1624
1636
|
slotPosition: DeviceInfoCollector.getSlotPosition(slot?.containerId || ''),
|
|
1625
1637
|
slotWidth: AdvertisementEventTracker.parseNumericValue(slot?.width),
|
|
1626
1638
|
slotHeight: AdvertisementEventTracker.parseNumericValue(slot?.height),
|
|
1627
|
-
sessionId: deviceInfo.sessionId,
|
|
1628
1639
|
// 성능 메트릭
|
|
1629
1640
|
pageLoadTime: performance.now(),
|
|
1630
1641
|
// 추가 메타데이터
|
|
@@ -2797,7 +2808,7 @@ class AdsModule {
|
|
|
2797
2808
|
throw new Error(`Container not found: ${slot.containerId}`);
|
|
2798
2809
|
}
|
|
2799
2810
|
// 이벤트 추적 콜백 함수 (중복 노출 방지 포함)
|
|
2800
|
-
const trackEventCallback = (adId, slotId, eventType) => {
|
|
2811
|
+
const trackEventCallback = async (adId, slotId, eventType) => {
|
|
2801
2812
|
// 노출 이벤트인 경우 중복 확인
|
|
2802
2813
|
if (eventType === AdEventType.VIEWABLE) {
|
|
2803
2814
|
if (ViewableEventTracker.isDuplicateViewable(adId, slotId, this._config?.debug)) {
|
|
@@ -2810,8 +2821,20 @@ class AdsModule {
|
|
|
2810
2821
|
console.log(`✅ New viewable recorded for ad ${adId} in slot ${slotId}`);
|
|
2811
2822
|
}
|
|
2812
2823
|
}
|
|
2813
|
-
|
|
2814
|
-
|
|
2824
|
+
// 실제 API 호출로 이벤트 전송
|
|
2825
|
+
if (this.advertisementEventTracker) {
|
|
2826
|
+
try {
|
|
2827
|
+
await this.advertisementEventTracker.trackAdvertisementEvent(adId, slotId, eventType, {} // 기본 메타데이터
|
|
2828
|
+
);
|
|
2829
|
+
if (this._config?.debug) {
|
|
2830
|
+
console.log(`📊 Advertisement event tracked: ${eventType} for ad ${adId} in slot ${slotId}`);
|
|
2831
|
+
}
|
|
2832
|
+
}
|
|
2833
|
+
catch (error) {
|
|
2834
|
+
if (this._config?.debug) {
|
|
2835
|
+
console.error(`❌ Failed to track ${eventType} event for ad ${adId}:`, error);
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2815
2838
|
}
|
|
2816
2839
|
};
|
|
2817
2840
|
let sliderElement;
|
|
@@ -3234,6 +3257,13 @@ class AdStage {
|
|
|
3234
3257
|
productionMode: false,
|
|
3235
3258
|
...config
|
|
3236
3259
|
};
|
|
3260
|
+
// baseUrl이 설정되었으면 endpoints에 적용
|
|
3261
|
+
if (config.baseUrl) {
|
|
3262
|
+
endpoints.setBaseUrl(config.baseUrl);
|
|
3263
|
+
if (config.debug) {
|
|
3264
|
+
console.log('🔄 API base URL set to:', config.baseUrl);
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3237
3267
|
// 모듈 동기 초기화
|
|
3238
3268
|
const enabledModules = instance._config.modules || ['ads', 'events', 'config'];
|
|
3239
3269
|
for (const moduleName of enabledModules) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adstage/web-sdk",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.3",
|
|
4
4
|
"description": "AdStage Web SDK - Production-ready marketing platform SDK with React Provider support for seamless integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"ads",
|
|
40
40
|
"banner",
|
|
41
41
|
"text",
|
|
42
|
-
"video",
|
|
42
|
+
"video",
|
|
43
43
|
"native",
|
|
44
44
|
"interstitial",
|
|
45
45
|
"sdk",
|
package/src/core/AdStage.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { AdStageConfig, ModuleName } from '../types/config';
|
|
|
7
7
|
import { AdsModule } from '../modules/ads/AdsModule';
|
|
8
8
|
import { ConfigModule } from '../modules/config/ConfigModule';
|
|
9
9
|
import { EventsModule } from '../modules/events/EventsModule';
|
|
10
|
+
import { endpoints } from '../constants/endpoints';
|
|
10
11
|
|
|
11
12
|
export class AdStage {
|
|
12
13
|
private static instance: AdStage;
|
|
@@ -52,6 +53,14 @@ export class AdStage {
|
|
|
52
53
|
...config
|
|
53
54
|
};
|
|
54
55
|
|
|
56
|
+
// baseUrl이 설정되었으면 endpoints에 적용
|
|
57
|
+
if (config.baseUrl) {
|
|
58
|
+
endpoints.setBaseUrl(config.baseUrl);
|
|
59
|
+
if (config.debug) {
|
|
60
|
+
console.log('🔄 API base URL set to:', config.baseUrl);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
55
64
|
// 모듈 동기 초기화
|
|
56
65
|
const enabledModules = instance._config.modules || ['ads', 'events', 'config'];
|
|
57
66
|
|
|
@@ -65,8 +65,20 @@ export class AdvertisementEventTracker {
|
|
|
65
65
|
adType: slot?.adType || 'BANNER',
|
|
66
66
|
platform: deviceInfo.platform,
|
|
67
67
|
|
|
68
|
-
// 디바이스
|
|
69
|
-
|
|
68
|
+
// 디바이스 정보 - 스키마에 맞게 최상위 레벨로 추출
|
|
69
|
+
deviceId: deviceInfo.deviceId,
|
|
70
|
+
osVersion: deviceInfo.osVersion,
|
|
71
|
+
deviceModel: deviceInfo.deviceModel,
|
|
72
|
+
appVersion: deviceInfo.appVersion,
|
|
73
|
+
sdkVersion: deviceInfo.sdkVersion,
|
|
74
|
+
language: deviceInfo.language,
|
|
75
|
+
country: deviceInfo.country,
|
|
76
|
+
timezone: deviceInfo.timezone,
|
|
77
|
+
viewportWidth: deviceInfo.viewportWidth,
|
|
78
|
+
viewportHeight: deviceInfo.viewportHeight,
|
|
79
|
+
screenWidth: deviceInfo.screenWidth,
|
|
80
|
+
screenHeight: deviceInfo.screenHeight,
|
|
81
|
+
connectionType: deviceInfo.connectionType,
|
|
70
82
|
|
|
71
83
|
// 페이지 및 슬롯 정보
|
|
72
84
|
pageUrl: DOMUtils.getPageInfo().url,
|
|
@@ -76,7 +88,6 @@ export class AdvertisementEventTracker {
|
|
|
76
88
|
slotPosition: DeviceInfoCollector.getSlotPosition(slot?.containerId || ''),
|
|
77
89
|
slotWidth: AdvertisementEventTracker.parseNumericValue(slot?.width),
|
|
78
90
|
slotHeight: AdvertisementEventTracker.parseNumericValue(slot?.height),
|
|
79
|
-
sessionId: deviceInfo.sessionId,
|
|
80
91
|
|
|
81
92
|
// 성능 메트릭
|
|
82
93
|
pageLoadTime: performance.now(),
|
|
@@ -106,6 +117,7 @@ export class AdvertisementEventTracker {
|
|
|
106
117
|
}),
|
|
107
118
|
};
|
|
108
119
|
|
|
120
|
+
|
|
109
121
|
await fetch(
|
|
110
122
|
`${this.baseUrl}/advertisements/events/${adId}/${eventType}`,
|
|
111
123
|
{
|
|
@@ -929,7 +929,7 @@ export class AdsModule implements BaseModule {
|
|
|
929
929
|
}
|
|
930
930
|
|
|
931
931
|
// 이벤트 추적 콜백 함수 (중복 노출 방지 포함)
|
|
932
|
-
const trackEventCallback = (adId: string, slotId: string, eventType: AdEventType) => {
|
|
932
|
+
const trackEventCallback = async (adId: string, slotId: string, eventType: AdEventType) => {
|
|
933
933
|
// 노출 이벤트인 경우 중복 확인
|
|
934
934
|
if (eventType === AdEventType.VIEWABLE) {
|
|
935
935
|
if (ViewableEventTracker.isDuplicateViewable(adId, slotId, this._config?.debug)) {
|
|
@@ -944,8 +944,24 @@ export class AdsModule implements BaseModule {
|
|
|
944
944
|
}
|
|
945
945
|
}
|
|
946
946
|
|
|
947
|
-
|
|
948
|
-
|
|
947
|
+
// 실제 API 호출로 이벤트 전송
|
|
948
|
+
if (this.advertisementEventTracker) {
|
|
949
|
+
try {
|
|
950
|
+
await this.advertisementEventTracker.trackAdvertisementEvent(
|
|
951
|
+
adId,
|
|
952
|
+
slotId,
|
|
953
|
+
eventType,
|
|
954
|
+
{} // 기본 메타데이터
|
|
955
|
+
);
|
|
956
|
+
|
|
957
|
+
if (this._config?.debug) {
|
|
958
|
+
console.log(`📊 Advertisement event tracked: ${eventType} for ad ${adId} in slot ${slotId}`);
|
|
959
|
+
}
|
|
960
|
+
} catch (error) {
|
|
961
|
+
if (this._config?.debug) {
|
|
962
|
+
console.error(`❌ Failed to track ${eventType} event for ad ${adId}:`, error);
|
|
963
|
+
}
|
|
964
|
+
}
|
|
949
965
|
}
|
|
950
966
|
};
|
|
951
967
|
|