@adstage/web-sdk 3.0.7 → 3.0.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adstage/web-sdk",
3
- "version": "3.0.7",
3
+ "version": "3.0.8",
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",
@@ -49,6 +49,16 @@ export class AdvertisementEventTracker {
49
49
  return;
50
50
  }
51
51
 
52
+ // DOM 요소가 실제로 존재하는지 확인 (이미 제거된 요소에 대한 추적 방지)
53
+ const element = document.getElementById(slot.containerId) ||
54
+ document.querySelector(`[data-adstage-slot-id="${slotId}"]`);
55
+ if (!element) {
56
+ if (this.debug) {
57
+ console.warn(`⚠️ DOM element not found for slotId: ${slotId} (containerId: ${slot.containerId}). Skipping event tracking.`);
58
+ }
59
+ return;
60
+ }
61
+
52
62
  // 디바이스 정보 수집
53
63
  const deviceInfo = DeviceInfoCollector.collectDeviceInfo();
54
64
 
@@ -119,9 +119,26 @@ export class DeviceInfoCollector {
119
119
 
120
120
  /**
121
121
  * 슬롯 위치 정보 가져오기 (SSR 안전)
122
+ * 슬라이더 내부 광고 요소도 지원
122
123
  */
123
124
  static getSlotPosition(containerId: string): string {
124
- const element = DOMUtils.safeGetElementById(containerId);
125
+ // 1. 기본 컨테이너 ID로 먼저 찾기
126
+ let element = DOMUtils.safeGetElementById(containerId);
127
+
128
+ // 2. 컨테이너를 찾지 못한 경우, 슬라이더 래퍼 찾기
129
+ if (!element) {
130
+ // 슬라이더 래퍼는 일반적으로 원본 컨테이너 내부에 있음
131
+ const sliderWrapper = DOMUtils.safeQuerySelector(`#${containerId} .adstage-slider-wrapper`);
132
+ if (sliderWrapper) {
133
+ element = sliderWrapper as HTMLElement;
134
+ }
135
+ }
136
+
137
+ // 3. 여전히 찾지 못한 경우, data-adstage-slot-id 속성으로 찾기
138
+ if (!element) {
139
+ element = DOMUtils.safeQuerySelector(`[data-adstage-slot-id="${containerId}"]`);
140
+ }
141
+
125
142
  if (!element) return 'unknown';
126
143
 
127
144
  const rect = element.getBoundingClientRect();