@adstage/web-sdk 2.1.5 β†’ 2.2.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.cjs.js CHANGED
@@ -394,6 +394,7 @@ class BaseAdRenderer {
394
394
  display: 'block',
395
395
  'max-width': '100%',
396
396
  height: 'auto',
397
+ 'object-position': 'center', // 🎯 이미지 항상 쀑앙 μ •λ ¬
397
398
  };
398
399
  // μ‚¬μš©μžκ°€ μ»¨ν…Œμ΄λ„ˆ 크기λ₯Ό μ§€μ •ν•œ κ²½μš°μ—λ§Œ 크기 μ œν•œ
399
400
  const parsedWidth = this.parseSizeValue(slot?.width);
@@ -402,6 +403,7 @@ class BaseAdRenderer {
402
403
  styles.width = '100%';
403
404
  styles.height = '100%';
404
405
  styles['object-fit'] = 'cover';
406
+ styles['object-position'] = 'center'; // 🎯 크기 μ‘°μ • μ‹œμ—λ„ 쀑앙 μ •λ ¬
405
407
  }
406
408
  return styles;
407
409
  }
@@ -2920,6 +2922,7 @@ class AdsModule {
2920
2922
  img.style.width = '100%';
2921
2923
  img.style.height = '100%';
2922
2924
  img.style.objectFit = 'cover';
2925
+ img.style.objectPosition = 'center'; // 🎯 폴백 이미지도 쀑앙 μ •λ ¬
2923
2926
  adElement.appendChild(img);
2924
2927
  }
2925
2928
  }
@@ -3222,14 +3225,53 @@ class AdStage {
3222
3225
  * νŽΈμ˜μ„±μ„ μœ„ν•œ 정적 λͺ¨λ“ˆ μ ‘κ·Όμžλ“€
3223
3226
  */
3224
3227
  static get ads() {
3228
+ // πŸš€ μžλ™ μ΄ˆκΈ°ν™”: 아직 μ΄ˆκΈ°ν™”λ˜μ§€ μ•Šμ•˜μœΌλ©΄ ν™˜κ²½λ³€μˆ˜λ‘œ μžλ™ μ΄ˆκΈ°ν™”
3229
+ if (!AdStage.instance?._isInitialized) {
3230
+ AdStage.autoInit();
3231
+ }
3225
3232
  return AdStage.getInstance().ads;
3226
3233
  }
3227
3234
  static get events() {
3235
+ if (!AdStage.instance?._isInitialized) {
3236
+ AdStage.autoInit();
3237
+ }
3228
3238
  return AdStage.getInstance().events;
3229
3239
  }
3230
3240
  static get config() {
3241
+ if (!AdStage.instance?._isInitialized) {
3242
+ AdStage.autoInit();
3243
+ }
3231
3244
  return AdStage.getInstance().config;
3232
3245
  }
3246
+ /**
3247
+ * πŸ†• μžλ™ μ΄ˆκΈ°ν™” - ν™˜κ²½λ³€μˆ˜ 기반
3248
+ */
3249
+ static autoInit() {
3250
+ if (typeof window === 'undefined')
3251
+ return; // μ„œλ²„ μ‚¬μ΄λ“œμ—μ„œλŠ” μ‹€ν–‰ μ•ˆν•¨
3252
+ try {
3253
+ // ν™˜κ²½λ³€μˆ˜μ—μ„œ API ν‚€ μžλ™ λ‘œλ“œ
3254
+ const apiKey = window.__ADSTAGE_API_KEY__ || // λŸ°νƒ€μž„ μ„€μ •
3255
+ process.env.NEXT_PUBLIC_ADSTAGE_API_KEY || // Next.js
3256
+ process.env.REACT_APP_ADSTAGE_API_KEY || // Create React App
3257
+ process.env.VITE_ADSTAGE_API_KEY || // Vite
3258
+ 'demo-api-key'; // 개발용 fallback
3259
+ const isDevelopment = "production" === 'development' ||
3260
+ window.__ADSTAGE_DEBUG__ === true;
3261
+ AdStage.init({
3262
+ apiKey: apiKey,
3263
+ debug: isDevelopment,
3264
+ modules: ['ads', 'config']
3265
+ });
3266
+ if (isDevelopment) {
3267
+ console.log('πŸ”„ AdStage SDK auto-initialized with API key:', apiKey.substring(0, 8) + '...');
3268
+ }
3269
+ }
3270
+ catch (error) {
3271
+ console.warn('AdStage auto-initialization failed:', error);
3272
+ console.warn('Please call AdStage.init() manually or set NEXT_PUBLIC_ADSTAGE_API_KEY environment variable');
3273
+ }
3274
+ }
3233
3275
  /**
3234
3276
  * SDK 리셋 (ν…ŒμŠ€νŠΈμš©)
3235
3277
  */
package/dist/index.d.ts CHANGED
@@ -513,6 +513,10 @@ declare class AdStage {
513
513
  static get ads(): AdsModule;
514
514
  static get events(): EventsModule;
515
515
  static get config(): ConfigModule;
516
+ /**
517
+ * πŸ†• μžλ™ μ΄ˆκΈ°ν™” - ν™˜κ²½λ³€μˆ˜ 기반
518
+ */
519
+ private static autoInit;
516
520
  /**
517
521
  * SDK 리셋 (ν…ŒμŠ€νŠΈμš©)
518
522
  */
package/dist/index.esm.js CHANGED
@@ -392,6 +392,7 @@ class BaseAdRenderer {
392
392
  display: 'block',
393
393
  'max-width': '100%',
394
394
  height: 'auto',
395
+ 'object-position': 'center', // 🎯 이미지 항상 쀑앙 μ •λ ¬
395
396
  };
396
397
  // μ‚¬μš©μžκ°€ μ»¨ν…Œμ΄λ„ˆ 크기λ₯Ό μ§€μ •ν•œ κ²½μš°μ—λ§Œ 크기 μ œν•œ
397
398
  const parsedWidth = this.parseSizeValue(slot?.width);
@@ -400,6 +401,7 @@ class BaseAdRenderer {
400
401
  styles.width = '100%';
401
402
  styles.height = '100%';
402
403
  styles['object-fit'] = 'cover';
404
+ styles['object-position'] = 'center'; // 🎯 크기 μ‘°μ • μ‹œμ—λ„ 쀑앙 μ •λ ¬
403
405
  }
404
406
  return styles;
405
407
  }
@@ -2918,6 +2920,7 @@ class AdsModule {
2918
2920
  img.style.width = '100%';
2919
2921
  img.style.height = '100%';
2920
2922
  img.style.objectFit = 'cover';
2923
+ img.style.objectPosition = 'center'; // 🎯 폴백 이미지도 쀑앙 μ •λ ¬
2921
2924
  adElement.appendChild(img);
2922
2925
  }
2923
2926
  }
@@ -3220,14 +3223,53 @@ class AdStage {
3220
3223
  * νŽΈμ˜μ„±μ„ μœ„ν•œ 정적 λͺ¨λ“ˆ μ ‘κ·Όμžλ“€
3221
3224
  */
3222
3225
  static get ads() {
3226
+ // πŸš€ μžλ™ μ΄ˆκΈ°ν™”: 아직 μ΄ˆκΈ°ν™”λ˜μ§€ μ•Šμ•˜μœΌλ©΄ ν™˜κ²½λ³€μˆ˜λ‘œ μžλ™ μ΄ˆκΈ°ν™”
3227
+ if (!AdStage.instance?._isInitialized) {
3228
+ AdStage.autoInit();
3229
+ }
3223
3230
  return AdStage.getInstance().ads;
3224
3231
  }
3225
3232
  static get events() {
3233
+ if (!AdStage.instance?._isInitialized) {
3234
+ AdStage.autoInit();
3235
+ }
3226
3236
  return AdStage.getInstance().events;
3227
3237
  }
3228
3238
  static get config() {
3239
+ if (!AdStage.instance?._isInitialized) {
3240
+ AdStage.autoInit();
3241
+ }
3229
3242
  return AdStage.getInstance().config;
3230
3243
  }
3244
+ /**
3245
+ * πŸ†• μžλ™ μ΄ˆκΈ°ν™” - ν™˜κ²½λ³€μˆ˜ 기반
3246
+ */
3247
+ static autoInit() {
3248
+ if (typeof window === 'undefined')
3249
+ return; // μ„œλ²„ μ‚¬μ΄λ“œμ—μ„œλŠ” μ‹€ν–‰ μ•ˆν•¨
3250
+ try {
3251
+ // ν™˜κ²½λ³€μˆ˜μ—μ„œ API ν‚€ μžλ™ λ‘œλ“œ
3252
+ const apiKey = window.__ADSTAGE_API_KEY__ || // λŸ°νƒ€μž„ μ„€μ •
3253
+ process.env.NEXT_PUBLIC_ADSTAGE_API_KEY || // Next.js
3254
+ process.env.REACT_APP_ADSTAGE_API_KEY || // Create React App
3255
+ process.env.VITE_ADSTAGE_API_KEY || // Vite
3256
+ 'demo-api-key'; // 개발용 fallback
3257
+ const isDevelopment = "production" === 'development' ||
3258
+ window.__ADSTAGE_DEBUG__ === true;
3259
+ AdStage.init({
3260
+ apiKey: apiKey,
3261
+ debug: isDevelopment,
3262
+ modules: ['ads', 'config']
3263
+ });
3264
+ if (isDevelopment) {
3265
+ console.log('πŸ”„ AdStage SDK auto-initialized with API key:', apiKey.substring(0, 8) + '...');
3266
+ }
3267
+ }
3268
+ catch (error) {
3269
+ console.warn('AdStage auto-initialization failed:', error);
3270
+ console.warn('Please call AdStage.init() manually or set NEXT_PUBLIC_ADSTAGE_API_KEY environment variable');
3271
+ }
3272
+ }
3231
3273
  /**
3232
3274
  * SDK 리셋 (ν…ŒμŠ€νŠΈμš©)
3233
3275
  */
@@ -392,6 +392,7 @@ class BaseAdRenderer {
392
392
  display: 'block',
393
393
  'max-width': '100%',
394
394
  height: 'auto',
395
+ 'object-position': 'center', // 🎯 이미지 항상 쀑앙 μ •λ ¬
395
396
  };
396
397
  // μ‚¬μš©μžκ°€ μ»¨ν…Œμ΄λ„ˆ 크기λ₯Ό μ§€μ •ν•œ κ²½μš°μ—λ§Œ 크기 μ œν•œ
397
398
  const parsedWidth = this.parseSizeValue(slot?.width);
@@ -400,6 +401,7 @@ class BaseAdRenderer {
400
401
  styles.width = '100%';
401
402
  styles.height = '100%';
402
403
  styles['object-fit'] = 'cover';
404
+ styles['object-position'] = 'center'; // 🎯 크기 μ‘°μ • μ‹œμ—λ„ 쀑앙 μ •λ ¬
403
405
  }
404
406
  return styles;
405
407
  }
@@ -2918,6 +2920,7 @@ class AdsModule {
2918
2920
  img.style.width = '100%';
2919
2921
  img.style.height = '100%';
2920
2922
  img.style.objectFit = 'cover';
2923
+ img.style.objectPosition = 'center'; // 🎯 폴백 이미지도 쀑앙 μ •λ ¬
2921
2924
  adElement.appendChild(img);
2922
2925
  }
2923
2926
  }
@@ -3220,14 +3223,53 @@ class AdStage {
3220
3223
  * νŽΈμ˜μ„±μ„ μœ„ν•œ 정적 λͺ¨λ“ˆ μ ‘κ·Όμžλ“€
3221
3224
  */
3222
3225
  static get ads() {
3226
+ // πŸš€ μžλ™ μ΄ˆκΈ°ν™”: 아직 μ΄ˆκΈ°ν™”λ˜μ§€ μ•Šμ•˜μœΌλ©΄ ν™˜κ²½λ³€μˆ˜λ‘œ μžλ™ μ΄ˆκΈ°ν™”
3227
+ if (!AdStage.instance?._isInitialized) {
3228
+ AdStage.autoInit();
3229
+ }
3223
3230
  return AdStage.getInstance().ads;
3224
3231
  }
3225
3232
  static get events() {
3233
+ if (!AdStage.instance?._isInitialized) {
3234
+ AdStage.autoInit();
3235
+ }
3226
3236
  return AdStage.getInstance().events;
3227
3237
  }
3228
3238
  static get config() {
3239
+ if (!AdStage.instance?._isInitialized) {
3240
+ AdStage.autoInit();
3241
+ }
3229
3242
  return AdStage.getInstance().config;
3230
3243
  }
3244
+ /**
3245
+ * πŸ†• μžλ™ μ΄ˆκΈ°ν™” - ν™˜κ²½λ³€μˆ˜ 기반
3246
+ */
3247
+ static autoInit() {
3248
+ if (typeof window === 'undefined')
3249
+ return; // μ„œλ²„ μ‚¬μ΄λ“œμ—μ„œλŠ” μ‹€ν–‰ μ•ˆν•¨
3250
+ try {
3251
+ // ν™˜κ²½λ³€μˆ˜μ—μ„œ API ν‚€ μžλ™ λ‘œλ“œ
3252
+ const apiKey = window.__ADSTAGE_API_KEY__ || // λŸ°νƒ€μž„ μ„€μ •
3253
+ process.env.NEXT_PUBLIC_ADSTAGE_API_KEY || // Next.js
3254
+ process.env.REACT_APP_ADSTAGE_API_KEY || // Create React App
3255
+ process.env.VITE_ADSTAGE_API_KEY || // Vite
3256
+ 'demo-api-key'; // 개발용 fallback
3257
+ const isDevelopment = "production" === 'development' ||
3258
+ window.__ADSTAGE_DEBUG__ === true;
3259
+ AdStage.init({
3260
+ apiKey: apiKey,
3261
+ debug: isDevelopment,
3262
+ modules: ['ads', 'config']
3263
+ });
3264
+ if (isDevelopment) {
3265
+ console.log('πŸ”„ AdStage SDK auto-initialized with API key:', apiKey.substring(0, 8) + '...');
3266
+ }
3267
+ }
3268
+ catch (error) {
3269
+ console.warn('AdStage auto-initialization failed:', error);
3270
+ console.warn('Please call AdStage.init() manually or set NEXT_PUBLIC_ADSTAGE_API_KEY environment variable');
3271
+ }
3272
+ }
3231
3273
  /**
3232
3274
  * SDK 리셋 (ν…ŒμŠ€νŠΈμš©)
3233
3275
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adstage/web-sdk",
3
- "version": "2.1.5",
4
- "description": "AdStage Web SDK - Production-ready marketing platform SDK with namespace architecture for ads, events, and config management",
3
+ "version": "2.2.1",
4
+ "description": "AdStage Web SDK - Production-ready marketing platform SDK with auto-initialization, dynamic sizing, and centered image positioning",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",
7
7
  "module": "dist/index.esm.js",
@@ -102,17 +102,61 @@ export class AdStage {
102
102
  * νŽΈμ˜μ„±μ„ μœ„ν•œ 정적 λͺ¨λ“ˆ μ ‘κ·Όμžλ“€
103
103
  */
104
104
  public static get ads() {
105
+ // πŸš€ μžλ™ μ΄ˆκΈ°ν™”: 아직 μ΄ˆκΈ°ν™”λ˜μ§€ μ•Šμ•˜μœΌλ©΄ ν™˜κ²½λ³€μˆ˜λ‘œ μžλ™ μ΄ˆκΈ°ν™”
106
+ if (!AdStage.instance?._isInitialized) {
107
+ AdStage.autoInit();
108
+ }
105
109
  return AdStage.getInstance().ads;
106
110
  }
107
111
 
108
112
  public static get events() {
113
+ if (!AdStage.instance?._isInitialized) {
114
+ AdStage.autoInit();
115
+ }
109
116
  return AdStage.getInstance().events;
110
117
  }
111
118
 
112
119
  public static get config() {
120
+ if (!AdStage.instance?._isInitialized) {
121
+ AdStage.autoInit();
122
+ }
113
123
  return AdStage.getInstance().config;
114
124
  }
115
125
 
126
+ /**
127
+ * πŸ†• μžλ™ μ΄ˆκΈ°ν™” - ν™˜κ²½λ³€μˆ˜ 기반
128
+ */
129
+ private static autoInit(): void {
130
+ if (typeof window === 'undefined') return; // μ„œλ²„ μ‚¬μ΄λ“œμ—μ„œλŠ” μ‹€ν–‰ μ•ˆν•¨
131
+
132
+ try {
133
+ // ν™˜κ²½λ³€μˆ˜μ—μ„œ API ν‚€ μžλ™ λ‘œλ“œ
134
+ const apiKey =
135
+ (window as any).__ADSTAGE_API_KEY__ || // λŸ°νƒ€μž„ μ„€μ •
136
+ process.env.NEXT_PUBLIC_ADSTAGE_API_KEY || // Next.js
137
+ process.env.REACT_APP_ADSTAGE_API_KEY || // Create React App
138
+ process.env.VITE_ADSTAGE_API_KEY || // Vite
139
+ 'demo-api-key'; // 개발용 fallback
140
+
141
+ const isDevelopment =
142
+ process.env.NODE_ENV === 'development' ||
143
+ (window as any).__ADSTAGE_DEBUG__ === true;
144
+
145
+ AdStage.init({
146
+ apiKey: apiKey,
147
+ debug: isDevelopment,
148
+ modules: ['ads', 'config']
149
+ });
150
+
151
+ if (isDevelopment) {
152
+ console.log('πŸ”„ AdStage SDK auto-initialized with API key:', apiKey.substring(0, 8) + '...');
153
+ }
154
+ } catch (error) {
155
+ console.warn('AdStage auto-initialization failed:', error);
156
+ console.warn('Please call AdStage.init() manually or set NEXT_PUBLIC_ADSTAGE_API_KEY environment variable');
157
+ }
158
+ }
159
+
116
160
  /**
117
161
  * SDK 리셋 (ν…ŒμŠ€νŠΈμš©)
118
162
  */
@@ -1119,6 +1119,7 @@ export class AdsModule implements BaseModule {
1119
1119
  img.style.width = '100%';
1120
1120
  img.style.height = '100%';
1121
1121
  img.style.objectFit = 'cover';
1122
+ img.style.objectPosition = 'center'; // 🎯 폴백 이미지도 쀑앙 μ •λ ¬
1122
1123
  adElement.appendChild(img);
1123
1124
  }
1124
1125
  }
@@ -110,6 +110,7 @@ export abstract class BaseAdRenderer implements AdRenderer {
110
110
  display: 'block',
111
111
  'max-width': '100%',
112
112
  height: 'auto',
113
+ 'object-position': 'center', // 🎯 이미지 항상 쀑앙 μ •λ ¬
113
114
  };
114
115
 
115
116
  // μ‚¬μš©μžκ°€ μ»¨ν…Œμ΄λ„ˆ 크기λ₯Ό μ§€μ •ν•œ κ²½μš°μ—λ§Œ 크기 μ œν•œ
@@ -120,6 +121,7 @@ export abstract class BaseAdRenderer implements AdRenderer {
120
121
  styles.width = '100%';
121
122
  styles.height = '100%';
122
123
  styles['object-fit'] = 'cover';
124
+ styles['object-position'] = 'center'; // 🎯 크기 μ‘°μ • μ‹œμ—λ„ 쀑앙 μ •λ ¬
123
125
  }
124
126
 
125
127
  return styles;