@adstage/web-sdk 2.1.4 → 2.2.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/dist/index.cjs.js +45 -4
- package/dist/index.d.ts +4 -0
- package/dist/index.esm.js +45 -4
- package/dist/index.standalone.js +45 -4
- package/package.json +2 -2
- package/src/core/AdStage.ts +44 -0
- package/src/managers/ads/carousel-slider-manager.ts +4 -3
- package/src/managers/ads/text-transition-manager.ts +2 -1
package/dist/index.cjs.js
CHANGED
|
@@ -795,11 +795,12 @@ class CarouselSliderManager {
|
|
|
795
795
|
width = `${slot.width}px`;
|
|
796
796
|
}
|
|
797
797
|
containerStyles.width = width;
|
|
798
|
-
containerStyles.display = '
|
|
798
|
+
containerStyles.display = 'block'; // ✅ 하단 공백 제거를 위해 block 사용
|
|
799
799
|
}
|
|
800
800
|
else {
|
|
801
|
-
// 컨텐츠 크기에 맞춤
|
|
802
|
-
containerStyles.display = '
|
|
801
|
+
// 컨텐츠 크기에 맞춤 - fit-content로 컨텐츠에 맞는 크기 설정
|
|
802
|
+
containerStyles.display = 'block';
|
|
803
|
+
containerStyles.width = 'fit-content'; // 컨텐츠 크기에 맞춤
|
|
803
804
|
}
|
|
804
805
|
if (slot.height && slot.height !== 0) {
|
|
805
806
|
const height = typeof slot.height === 'string' ? slot.height : `${slot.height}px`;
|
|
@@ -1119,7 +1120,8 @@ class TextTransitionManager {
|
|
|
1119
1120
|
const containerStyles = {
|
|
1120
1121
|
position: 'relative',
|
|
1121
1122
|
overflow: 'hidden',
|
|
1122
|
-
display: '
|
|
1123
|
+
display: 'block', // ✅ 하단 공백 제거를 위해 block 사용
|
|
1124
|
+
width: 'fit-content', // 컨텐츠 크기에 맞춤
|
|
1123
1125
|
};
|
|
1124
1126
|
// 사용자가 크기를 지정한 경우
|
|
1125
1127
|
if (slot.width && slot.width !== 0) {
|
|
@@ -3220,14 +3222,53 @@ class AdStage {
|
|
|
3220
3222
|
* 편의성을 위한 정적 모듈 접근자들
|
|
3221
3223
|
*/
|
|
3222
3224
|
static get ads() {
|
|
3225
|
+
// 🚀 자동 초기화: 아직 초기화되지 않았으면 환경변수로 자동 초기화
|
|
3226
|
+
if (!AdStage.instance?._isInitialized) {
|
|
3227
|
+
AdStage.autoInit();
|
|
3228
|
+
}
|
|
3223
3229
|
return AdStage.getInstance().ads;
|
|
3224
3230
|
}
|
|
3225
3231
|
static get events() {
|
|
3232
|
+
if (!AdStage.instance?._isInitialized) {
|
|
3233
|
+
AdStage.autoInit();
|
|
3234
|
+
}
|
|
3226
3235
|
return AdStage.getInstance().events;
|
|
3227
3236
|
}
|
|
3228
3237
|
static get config() {
|
|
3238
|
+
if (!AdStage.instance?._isInitialized) {
|
|
3239
|
+
AdStage.autoInit();
|
|
3240
|
+
}
|
|
3229
3241
|
return AdStage.getInstance().config;
|
|
3230
3242
|
}
|
|
3243
|
+
/**
|
|
3244
|
+
* 🆕 자동 초기화 - 환경변수 기반
|
|
3245
|
+
*/
|
|
3246
|
+
static autoInit() {
|
|
3247
|
+
if (typeof window === 'undefined')
|
|
3248
|
+
return; // 서버 사이드에서는 실행 안함
|
|
3249
|
+
try {
|
|
3250
|
+
// 환경변수에서 API 키 자동 로드
|
|
3251
|
+
const apiKey = window.__ADSTAGE_API_KEY__ || // 런타임 설정
|
|
3252
|
+
process.env.NEXT_PUBLIC_ADSTAGE_API_KEY || // Next.js
|
|
3253
|
+
process.env.REACT_APP_ADSTAGE_API_KEY || // Create React App
|
|
3254
|
+
process.env.VITE_ADSTAGE_API_KEY || // Vite
|
|
3255
|
+
'demo-api-key'; // 개발용 fallback
|
|
3256
|
+
const isDevelopment = "production" === 'development' ||
|
|
3257
|
+
window.__ADSTAGE_DEBUG__ === true;
|
|
3258
|
+
AdStage.init({
|
|
3259
|
+
apiKey: apiKey,
|
|
3260
|
+
debug: isDevelopment,
|
|
3261
|
+
modules: ['ads', 'config']
|
|
3262
|
+
});
|
|
3263
|
+
if (isDevelopment) {
|
|
3264
|
+
console.log('🔄 AdStage SDK auto-initialized with API key:', apiKey.substring(0, 8) + '...');
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3267
|
+
catch (error) {
|
|
3268
|
+
console.warn('AdStage auto-initialization failed:', error);
|
|
3269
|
+
console.warn('Please call AdStage.init() manually or set NEXT_PUBLIC_ADSTAGE_API_KEY environment variable');
|
|
3270
|
+
}
|
|
3271
|
+
}
|
|
3231
3272
|
/**
|
|
3232
3273
|
* SDK 리셋 (테스트용)
|
|
3233
3274
|
*/
|
package/dist/index.d.ts
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -793,11 +793,12 @@ class CarouselSliderManager {
|
|
|
793
793
|
width = `${slot.width}px`;
|
|
794
794
|
}
|
|
795
795
|
containerStyles.width = width;
|
|
796
|
-
containerStyles.display = '
|
|
796
|
+
containerStyles.display = 'block'; // ✅ 하단 공백 제거를 위해 block 사용
|
|
797
797
|
}
|
|
798
798
|
else {
|
|
799
|
-
// 컨텐츠 크기에 맞춤
|
|
800
|
-
containerStyles.display = '
|
|
799
|
+
// 컨텐츠 크기에 맞춤 - fit-content로 컨텐츠에 맞는 크기 설정
|
|
800
|
+
containerStyles.display = 'block';
|
|
801
|
+
containerStyles.width = 'fit-content'; // 컨텐츠 크기에 맞춤
|
|
801
802
|
}
|
|
802
803
|
if (slot.height && slot.height !== 0) {
|
|
803
804
|
const height = typeof slot.height === 'string' ? slot.height : `${slot.height}px`;
|
|
@@ -1117,7 +1118,8 @@ class TextTransitionManager {
|
|
|
1117
1118
|
const containerStyles = {
|
|
1118
1119
|
position: 'relative',
|
|
1119
1120
|
overflow: 'hidden',
|
|
1120
|
-
display: '
|
|
1121
|
+
display: 'block', // ✅ 하단 공백 제거를 위해 block 사용
|
|
1122
|
+
width: 'fit-content', // 컨텐츠 크기에 맞춤
|
|
1121
1123
|
};
|
|
1122
1124
|
// 사용자가 크기를 지정한 경우
|
|
1123
1125
|
if (slot.width && slot.width !== 0) {
|
|
@@ -3218,14 +3220,53 @@ class AdStage {
|
|
|
3218
3220
|
* 편의성을 위한 정적 모듈 접근자들
|
|
3219
3221
|
*/
|
|
3220
3222
|
static get ads() {
|
|
3223
|
+
// 🚀 자동 초기화: 아직 초기화되지 않았으면 환경변수로 자동 초기화
|
|
3224
|
+
if (!AdStage.instance?._isInitialized) {
|
|
3225
|
+
AdStage.autoInit();
|
|
3226
|
+
}
|
|
3221
3227
|
return AdStage.getInstance().ads;
|
|
3222
3228
|
}
|
|
3223
3229
|
static get events() {
|
|
3230
|
+
if (!AdStage.instance?._isInitialized) {
|
|
3231
|
+
AdStage.autoInit();
|
|
3232
|
+
}
|
|
3224
3233
|
return AdStage.getInstance().events;
|
|
3225
3234
|
}
|
|
3226
3235
|
static get config() {
|
|
3236
|
+
if (!AdStage.instance?._isInitialized) {
|
|
3237
|
+
AdStage.autoInit();
|
|
3238
|
+
}
|
|
3227
3239
|
return AdStage.getInstance().config;
|
|
3228
3240
|
}
|
|
3241
|
+
/**
|
|
3242
|
+
* 🆕 자동 초기화 - 환경변수 기반
|
|
3243
|
+
*/
|
|
3244
|
+
static autoInit() {
|
|
3245
|
+
if (typeof window === 'undefined')
|
|
3246
|
+
return; // 서버 사이드에서는 실행 안함
|
|
3247
|
+
try {
|
|
3248
|
+
// 환경변수에서 API 키 자동 로드
|
|
3249
|
+
const apiKey = window.__ADSTAGE_API_KEY__ || // 런타임 설정
|
|
3250
|
+
process.env.NEXT_PUBLIC_ADSTAGE_API_KEY || // Next.js
|
|
3251
|
+
process.env.REACT_APP_ADSTAGE_API_KEY || // Create React App
|
|
3252
|
+
process.env.VITE_ADSTAGE_API_KEY || // Vite
|
|
3253
|
+
'demo-api-key'; // 개발용 fallback
|
|
3254
|
+
const isDevelopment = "production" === 'development' ||
|
|
3255
|
+
window.__ADSTAGE_DEBUG__ === true;
|
|
3256
|
+
AdStage.init({
|
|
3257
|
+
apiKey: apiKey,
|
|
3258
|
+
debug: isDevelopment,
|
|
3259
|
+
modules: ['ads', 'config']
|
|
3260
|
+
});
|
|
3261
|
+
if (isDevelopment) {
|
|
3262
|
+
console.log('🔄 AdStage SDK auto-initialized with API key:', apiKey.substring(0, 8) + '...');
|
|
3263
|
+
}
|
|
3264
|
+
}
|
|
3265
|
+
catch (error) {
|
|
3266
|
+
console.warn('AdStage auto-initialization failed:', error);
|
|
3267
|
+
console.warn('Please call AdStage.init() manually or set NEXT_PUBLIC_ADSTAGE_API_KEY environment variable');
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3229
3270
|
/**
|
|
3230
3271
|
* SDK 리셋 (테스트용)
|
|
3231
3272
|
*/
|
package/dist/index.standalone.js
CHANGED
|
@@ -793,11 +793,12 @@ class CarouselSliderManager {
|
|
|
793
793
|
width = `${slot.width}px`;
|
|
794
794
|
}
|
|
795
795
|
containerStyles.width = width;
|
|
796
|
-
containerStyles.display = '
|
|
796
|
+
containerStyles.display = 'block'; // ✅ 하단 공백 제거를 위해 block 사용
|
|
797
797
|
}
|
|
798
798
|
else {
|
|
799
|
-
// 컨텐츠 크기에 맞춤
|
|
800
|
-
containerStyles.display = '
|
|
799
|
+
// 컨텐츠 크기에 맞춤 - fit-content로 컨텐츠에 맞는 크기 설정
|
|
800
|
+
containerStyles.display = 'block';
|
|
801
|
+
containerStyles.width = 'fit-content'; // 컨텐츠 크기에 맞춤
|
|
801
802
|
}
|
|
802
803
|
if (slot.height && slot.height !== 0) {
|
|
803
804
|
const height = typeof slot.height === 'string' ? slot.height : `${slot.height}px`;
|
|
@@ -1117,7 +1118,8 @@ class TextTransitionManager {
|
|
|
1117
1118
|
const containerStyles = {
|
|
1118
1119
|
position: 'relative',
|
|
1119
1120
|
overflow: 'hidden',
|
|
1120
|
-
display: '
|
|
1121
|
+
display: 'block', // ✅ 하단 공백 제거를 위해 block 사용
|
|
1122
|
+
width: 'fit-content', // 컨텐츠 크기에 맞춤
|
|
1121
1123
|
};
|
|
1122
1124
|
// 사용자가 크기를 지정한 경우
|
|
1123
1125
|
if (slot.width && slot.width !== 0) {
|
|
@@ -3218,14 +3220,53 @@ class AdStage {
|
|
|
3218
3220
|
* 편의성을 위한 정적 모듈 접근자들
|
|
3219
3221
|
*/
|
|
3220
3222
|
static get ads() {
|
|
3223
|
+
// 🚀 자동 초기화: 아직 초기화되지 않았으면 환경변수로 자동 초기화
|
|
3224
|
+
if (!AdStage.instance?._isInitialized) {
|
|
3225
|
+
AdStage.autoInit();
|
|
3226
|
+
}
|
|
3221
3227
|
return AdStage.getInstance().ads;
|
|
3222
3228
|
}
|
|
3223
3229
|
static get events() {
|
|
3230
|
+
if (!AdStage.instance?._isInitialized) {
|
|
3231
|
+
AdStage.autoInit();
|
|
3232
|
+
}
|
|
3224
3233
|
return AdStage.getInstance().events;
|
|
3225
3234
|
}
|
|
3226
3235
|
static get config() {
|
|
3236
|
+
if (!AdStage.instance?._isInitialized) {
|
|
3237
|
+
AdStage.autoInit();
|
|
3238
|
+
}
|
|
3227
3239
|
return AdStage.getInstance().config;
|
|
3228
3240
|
}
|
|
3241
|
+
/**
|
|
3242
|
+
* 🆕 자동 초기화 - 환경변수 기반
|
|
3243
|
+
*/
|
|
3244
|
+
static autoInit() {
|
|
3245
|
+
if (typeof window === 'undefined')
|
|
3246
|
+
return; // 서버 사이드에서는 실행 안함
|
|
3247
|
+
try {
|
|
3248
|
+
// 환경변수에서 API 키 자동 로드
|
|
3249
|
+
const apiKey = window.__ADSTAGE_API_KEY__ || // 런타임 설정
|
|
3250
|
+
process.env.NEXT_PUBLIC_ADSTAGE_API_KEY || // Next.js
|
|
3251
|
+
process.env.REACT_APP_ADSTAGE_API_KEY || // Create React App
|
|
3252
|
+
process.env.VITE_ADSTAGE_API_KEY || // Vite
|
|
3253
|
+
'demo-api-key'; // 개발용 fallback
|
|
3254
|
+
const isDevelopment = "production" === 'development' ||
|
|
3255
|
+
window.__ADSTAGE_DEBUG__ === true;
|
|
3256
|
+
AdStage.init({
|
|
3257
|
+
apiKey: apiKey,
|
|
3258
|
+
debug: isDevelopment,
|
|
3259
|
+
modules: ['ads', 'config']
|
|
3260
|
+
});
|
|
3261
|
+
if (isDevelopment) {
|
|
3262
|
+
console.log('🔄 AdStage SDK auto-initialized with API key:', apiKey.substring(0, 8) + '...');
|
|
3263
|
+
}
|
|
3264
|
+
}
|
|
3265
|
+
catch (error) {
|
|
3266
|
+
console.warn('AdStage auto-initialization failed:', error);
|
|
3267
|
+
console.warn('Please call AdStage.init() manually or set NEXT_PUBLIC_ADSTAGE_API_KEY environment variable');
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3229
3270
|
/**
|
|
3230
3271
|
* SDK 리셋 (테스트용)
|
|
3231
3272
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adstage/web-sdk",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "AdStage Web SDK - Production-ready marketing platform SDK with
|
|
3
|
+
"version": "2.2.0",
|
|
4
|
+
"description": "AdStage Web SDK - Production-ready marketing platform SDK with auto-initialization and namespace architecture",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
7
7
|
"module": "dist/index.esm.js",
|
package/src/core/AdStage.ts
CHANGED
|
@@ -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
|
*/
|
|
@@ -39,10 +39,11 @@ export class CarouselSliderManager {
|
|
|
39
39
|
width = `${slot.width}px`;
|
|
40
40
|
}
|
|
41
41
|
containerStyles.width = width;
|
|
42
|
-
containerStyles.display = '
|
|
42
|
+
containerStyles.display = 'block'; // ✅ 하단 공백 제거를 위해 block 사용
|
|
43
43
|
} else {
|
|
44
|
-
// 컨텐츠 크기에 맞춤
|
|
45
|
-
containerStyles.display = '
|
|
44
|
+
// 컨텐츠 크기에 맞춤 - fit-content로 컨텐츠에 맞는 크기 설정
|
|
45
|
+
containerStyles.display = 'block';
|
|
46
|
+
containerStyles.width = 'fit-content'; // 컨텐츠 크기에 맞춤
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
if (slot.height && slot.height !== 0) {
|
|
@@ -25,7 +25,8 @@ export class TextTransitionManager {
|
|
|
25
25
|
const containerStyles: Record<string, string> = {
|
|
26
26
|
position: 'relative',
|
|
27
27
|
overflow: 'hidden',
|
|
28
|
-
display: '
|
|
28
|
+
display: 'block', // ✅ 하단 공백 제거를 위해 block 사용
|
|
29
|
+
width: 'fit-content', // 컨텐츠 크기에 맞춤
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
// 사용자가 크기를 지정한 경우
|