@surfside/ads 3.6.2 → 3.6.4-4c0a326f.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.
Files changed (86) hide show
  1. package/lib/cjs/BuildInfo.js +9 -0
  2. package/lib/cjs/BuildInfo.js.map +1 -0
  3. package/lib/cjs/Constants.js +5 -0
  4. package/lib/cjs/Constants.js.map +1 -0
  5. package/lib/cjs/Init.js +130 -0
  6. package/lib/cjs/Init.js.map +1 -0
  7. package/lib/cjs/components/Banner.js +135 -0
  8. package/lib/cjs/components/Banner.js.map +1 -0
  9. package/lib/cjs/components/Card.js +162 -0
  10. package/lib/cjs/components/Card.js.map +1 -0
  11. package/lib/cjs/components/Carousel.js +241 -0
  12. package/lib/cjs/components/Carousel.js.map +1 -0
  13. package/lib/cjs/components/Creative.js +203 -0
  14. package/lib/cjs/components/Creative.js.map +1 -0
  15. package/lib/cjs/components/Dynamic.js +300 -0
  16. package/lib/cjs/components/Dynamic.js.map +1 -0
  17. package/lib/cjs/components/SimpleCreative.js +75 -0
  18. package/lib/cjs/components/SimpleCreative.js.map +1 -0
  19. package/lib/cjs/components/Video.js +134 -0
  20. package/lib/cjs/components/Video.js.map +1 -0
  21. package/lib/cjs/demo/test.js +7 -0
  22. package/lib/cjs/demo/test.js.map +1 -0
  23. package/lib/cjs/index.module.js +107 -0
  24. package/lib/cjs/index.module.js.map +1 -0
  25. package/lib/cjs/index.script.js +102 -0
  26. package/lib/cjs/index.script.js.map +1 -0
  27. package/lib/cjs/index.script.mock.js +154 -0
  28. package/lib/cjs/index.script.mock.js.map +1 -0
  29. package/lib/cjs/service/Init.js +3 -0
  30. package/lib/cjs/service/Init.js.map +1 -0
  31. package/lib/cjs/util/Attributes.js +93 -0
  32. package/lib/cjs/util/Attributes.js.map +1 -0
  33. package/lib/cjs/util/Types.js +3 -0
  34. package/lib/cjs/util/Types.js.map +1 -0
  35. package/lib/esm/BuildInfo.js +6 -0
  36. package/lib/esm/BuildInfo.js.map +1 -0
  37. package/lib/esm/Constants.js +2 -0
  38. package/lib/esm/Constants.js.map +1 -0
  39. package/lib/esm/Init.js +92 -0
  40. package/lib/esm/Init.js.map +1 -0
  41. package/lib/esm/components/Banner.js +131 -0
  42. package/lib/esm/components/Banner.js.map +1 -0
  43. package/lib/esm/components/Card.js +158 -0
  44. package/lib/esm/components/Card.js.map +1 -0
  45. package/lib/esm/components/Carousel.js +237 -0
  46. package/lib/esm/components/Carousel.js.map +1 -0
  47. package/lib/esm/components/Creative.js +198 -0
  48. package/lib/esm/components/Creative.js.map +1 -0
  49. package/lib/esm/components/Dynamic.js +296 -0
  50. package/lib/esm/components/Dynamic.js.map +1 -0
  51. package/lib/esm/components/SimpleCreative.js +69 -0
  52. package/lib/esm/components/SimpleCreative.js.map +1 -0
  53. package/lib/esm/components/Video.js +130 -0
  54. package/lib/esm/components/Video.js.map +1 -0
  55. package/lib/esm/demo/test.js +5 -0
  56. package/lib/esm/demo/test.js.map +1 -0
  57. package/lib/esm/index.module.js +67 -0
  58. package/lib/esm/index.module.js.map +1 -0
  59. package/lib/esm/index.script.js +100 -0
  60. package/lib/esm/index.script.js.map +1 -0
  61. package/lib/esm/index.script.mock.js +152 -0
  62. package/lib/esm/index.script.mock.js.map +1 -0
  63. package/lib/esm/service/Init.js +2 -0
  64. package/lib/esm/service/Init.js.map +1 -0
  65. package/lib/esm/util/Attributes.js +81 -0
  66. package/lib/esm/util/Attributes.js.map +1 -0
  67. package/lib/esm/util/Types.js +2 -0
  68. package/lib/esm/util/Types.js.map +1 -0
  69. package/lib/types/BuildInfo.d.ts +5 -0
  70. package/lib/types/Constants.d.ts +1 -0
  71. package/lib/types/Init.d.ts +31 -0
  72. package/lib/types/components/Banner.d.ts +18 -0
  73. package/lib/types/components/Card.d.ts +17 -0
  74. package/lib/types/components/Carousel.d.ts +31 -0
  75. package/lib/types/components/Creative.d.ts +65 -0
  76. package/lib/types/components/Dynamic.d.ts +23 -0
  77. package/lib/types/components/SimpleCreative.d.ts +19 -0
  78. package/lib/types/components/Video.d.ts +22 -0
  79. package/lib/types/demo/test.d.ts +1 -0
  80. package/lib/types/index.module.d.ts +12 -0
  81. package/lib/types/index.script.d.ts +1 -0
  82. package/lib/types/index.script.mock.d.ts +1 -0
  83. package/lib/types/service/Init.d.ts +1 -0
  84. package/lib/types/util/Attributes.d.ts +24 -0
  85. package/lib/types/util/Types.d.ts +3 -0
  86. package/package.json +10 -10
@@ -0,0 +1,241 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SurfsideCarousel = exports.NextType = void 0;
4
+ const ads_core_1 = require("@surfside/ads-core");
5
+ const Creative_1 = require("./Creative");
6
+ const SimpleCreative_1 = require("./SimpleCreative");
7
+ const Constants_1 = require("../Constants");
8
+ exports.NextType = {
9
+ Product: 'product',
10
+ Page: 'page'
11
+ };
12
+ class SurfsideCarousel extends Creative_1.CreativeComponent {
13
+ _cancellationToken = new ads_core_1.CancellationToken();
14
+ _renderDebounce;
15
+ maxItems;
16
+ cardMinWidth = Constants_1.DefaultMinCardWidth;
17
+ cardMaxWidth;
18
+ strategy = Creative_1.ProductFeedStrategy.Hybrid;
19
+ recommend = 'top-products';
20
+ nextType = exports.NextType.Page;
21
+ static get observedAttributes() {
22
+ return [
23
+ ...Creative_1.CreativeComponent.observedBaseAttributes,
24
+ 'max-items',
25
+ 'card-min-width',
26
+ 'card-max-width',
27
+ 'strategy',
28
+ 'recommend',
29
+ 'next-type'
30
+ ];
31
+ }
32
+ constructor(initApi, getUserId, logger) {
33
+ logger?.info('Building carousel');
34
+ super(initApi, getUserId, logger);
35
+ }
36
+ getComponentName() {
37
+ return 'SurfsideCarousel';
38
+ }
39
+ async attributeChangedCallback(name, oldValue, newValue) {
40
+ const log = this.log?.with('attributeChangedCallback');
41
+ log?.info('Carousel attribute changed');
42
+ switch (name) {
43
+ case 'max-items': {
44
+ try {
45
+ this.maxItems = (0, SimpleCreative_1.IntValOrThrow)(this, 'max-items', newValue);
46
+ }
47
+ catch (err) {
48
+ log?.warn('Failed to parse. Got', err);
49
+ }
50
+ break;
51
+ }
52
+ case 'card-min-width': {
53
+ try {
54
+ this.cardMinWidth = (0, SimpleCreative_1.IntValOrThrow)(this, 'card-min-width', newValue);
55
+ }
56
+ catch (err) {
57
+ log?.warn('Failed to parse. Got', err);
58
+ }
59
+ break;
60
+ }
61
+ case 'card-max-width': {
62
+ try {
63
+ this.cardMaxWidth = (0, SimpleCreative_1.IntValOrThrow)(this, 'card-max-width', newValue);
64
+ }
65
+ catch (err) {
66
+ log?.warn('Failed to parse. Got', err);
67
+ }
68
+ break;
69
+ }
70
+ case 'strategy': {
71
+ const strategy = newValue?.toLowerCase();
72
+ switch (strategy) {
73
+ case Creative_1.ProductFeedStrategy.Sponsored:
74
+ case Creative_1.ProductFeedStrategy.Hybrid:
75
+ case Creative_1.ProductFeedStrategy.Recommended:
76
+ this.strategy = strategy;
77
+ break;
78
+ default:
79
+ log?.warn('Unrecognized or null strategy:', newValue);
80
+ break;
81
+ }
82
+ break;
83
+ }
84
+ case 'recommend': {
85
+ const recommend = newValue?.toLowerCase();
86
+ switch (recommend) {
87
+ case Creative_1.RecommenderTypeInputs.TopProducts:
88
+ this.recommend = 'top-products';
89
+ break;
90
+ case Creative_1.RecommenderTypeInputs.ForYou:
91
+ this.recommend = 'for-you';
92
+ break;
93
+ case Creative_1.RecommenderTypeInputs.PastPurchases:
94
+ case Creative_1.RecommenderTypeInputs.BuyAgain:
95
+ this.recommend = 'past-purchases';
96
+ break;
97
+ default:
98
+ log?.warn('Unrecognized or null recommender type:', newValue);
99
+ break;
100
+ }
101
+ break;
102
+ }
103
+ case 'next-type': {
104
+ const nextType = newValue?.toLowerCase();
105
+ switch (nextType) {
106
+ case exports.NextType.Page:
107
+ case exports.NextType.Product:
108
+ this.nextType = nextType;
109
+ break;
110
+ default:
111
+ log?.warn('Unrecognized or null next-type:', newValue);
112
+ break;
113
+ }
114
+ break;
115
+ }
116
+ default: {
117
+ const baseName = name;
118
+ if (Creative_1.CreativeComponent.observedBaseAttributes.includes(baseName)) {
119
+ await super.baseAttributeChangedCallback(baseName, oldValue, newValue, log);
120
+ }
121
+ break;
122
+ }
123
+ }
124
+ const totem = crypto.randomUUID();
125
+ this.totem = totem;
126
+ log?.debug(name, 'totem', totem);
127
+ if (!this.attributesLoaded()) {
128
+ log?.debug('Attributes not ready yet...', this.accountId);
129
+ return;
130
+ }
131
+ else {
132
+ log?.debug('Attributes ready!');
133
+ }
134
+ await this.lazyLoadApi();
135
+ if (this.totem !== totem) {
136
+ log?.debug('Totem changed. Deferring rendering of carousel until last attribute changed', totem, this.totem);
137
+ return;
138
+ }
139
+ if (this.isConnected) {
140
+ log?.debug(`Rendering carousel upon [${name}] changed`);
141
+ await this.render();
142
+ }
143
+ }
144
+ async connectedCallback() {
145
+ super.connectedCallback();
146
+ const log = this.log?.with('connectedCallback');
147
+ log?.info('connectedCallback');
148
+ super.readBaseAttributes();
149
+ await this.initApi();
150
+ const totem = crypto.randomUUID();
151
+ this.totem = totem;
152
+ if (this.attributesLoaded()) {
153
+ await this.lazyLoadApi();
154
+ if (this.totem !== totem) {
155
+ log?.debug('Attributes changed after connectedCallback, waiting to render');
156
+ return;
157
+ }
158
+ log?.debug('Rendering upon connectedCallback');
159
+ await this.render();
160
+ }
161
+ else {
162
+ this.log?.warn('ConnectedCallback called before attributes were all ready.');
163
+ }
164
+ }
165
+ async render() {
166
+ const log = this.log?.with('SurfsideCarousel', { zoneId: this.zoneId });
167
+ log?.info('Rendering carousel');
168
+ if (this._renderDebounce !== undefined) {
169
+ log?.debug('Debounce was not undefined');
170
+ globalThis.clearTimeout(this._renderDebounce);
171
+ }
172
+ this._renderDebounce = globalThis.setTimeout(async () => {
173
+ log?.info('Rendering carousel', this.api);
174
+ const stopTimer = log?.time?.('render carousel');
175
+ this._cancellationToken.cancel();
176
+ const token = new ads_core_1.CancellationToken();
177
+ this._cancellationToken = token;
178
+ const { startRequest, defaultNative, buildHybridCarousel, buildSponsoredCarousel, buildRecommendedCarousel, renderCarousel } = this.api;
179
+ const carousel = (0, ads_core_1.TryDoFlat)(() => {
180
+ log?.debug('Starting request');
181
+ const request = startRequest(this.zoneId)
182
+ .withSurfCategory(this.category)
183
+ .withKeywords(this.keywords)
184
+ .withProductCards(defaultNative())
185
+ .build();
186
+ switch (this.strategy) {
187
+ case Creative_1.ProductFeedStrategy.Hybrid:
188
+ log?.debug('building Hybrid carousel');
189
+ return buildHybridCarousel({
190
+ type: this.recommend
191
+ }, request);
192
+ case Creative_1.ProductFeedStrategy.Sponsored:
193
+ log?.debug('Building sponsored carousel');
194
+ return buildSponsoredCarousel(request);
195
+ case Creative_1.ProductFeedStrategy.Recommended:
196
+ log?.debug('Building recommended carousel');
197
+ return buildRecommendedCarousel({
198
+ type: this.recommend
199
+ }, this.category?.[0]);
200
+ default:
201
+ return (0, ads_core_1.Err)(new ads_core_1.InvalidRecommenderTypeError(this.strategy));
202
+ }
203
+ });
204
+ if (!carousel.ok) {
205
+ log?.error('Failed to build carousel!', carousel.error);
206
+ return;
207
+ }
208
+ log?.info('Rendering carousel');
209
+ const element = await renderCarousel(carousel.value, this.cardMinWidth, this.maxItems === undefined || this.maxItems === 0
210
+ ? {
211
+ type: 'infinite'
212
+ }
213
+ : {
214
+ type: 'limited',
215
+ limit: this.maxItems
216
+ }, this.nextType, this.cardMaxWidth);
217
+ log?.info('rendered carousel element');
218
+ if (!element.ok) {
219
+ log?.error(element.error);
220
+ return;
221
+ }
222
+ if (this._cancellationToken.cancelled) {
223
+ log?.info('Cancelled rendering carousel');
224
+ return;
225
+ }
226
+ stopTimer?.();
227
+ element.value.element.classList.add(`surf-zone-${this.zoneId}`);
228
+ this.shadow.innerHTML = '';
229
+ this.shadow.appendChild(element.value.element);
230
+ const elementInitRes = await element.value.init();
231
+ if (!elementInitRes.ok) {
232
+ log?.error('Carousel first page was empty', elementInitRes);
233
+ this.remove();
234
+ }
235
+ log?.info('Appended carousel to DOM');
236
+ this.restartEndToEndTimer();
237
+ }, Creative_1.DEBOUNCE_THRESHOLD);
238
+ }
239
+ }
240
+ exports.SurfsideCarousel = SurfsideCarousel;
241
+ //# sourceMappingURL=Carousel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Carousel.js","sourceRoot":"../@surfside-ads/","sources":["components/Carousel.ts"],"names":[],"mappings":";;;AAAA,iDAQ4B;AAC5B,yCAQoB;AAEpB,qDAAiD;AACjD,4CAAmD;AAEtC,QAAA,QAAQ,GAAG;IACpB,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;CACN,CAAC;AAWX,MAAa,gBAAiB,SAAQ,4BAAiB;IAC3C,kBAAkB,GAAsB,IAAI,4BAAiB,EAAE,CAAC;IAChE,eAAe,CAAa;IAE1B,QAAQ,CAAiB;IACzB,YAAY,GAAW,+BAAmB,CAAC;IAC3C,YAAY,CAAiB;IAE7B,QAAQ,GAAW,8BAAmB,CAAC,MAAM,CAAC;IAC9C,SAAS,GAAoB,cAAc,CAAC;IAC5C,QAAQ,GAAuB,gBAAQ,CAAC,IAAI,CAAC;IAEhD,MAAM,KAAK,kBAAkB;QAChC,OAAO;YACH,GAAG,4BAAiB,CAAC,sBAAsB;YAC3C,WAAW;YACX,gBAAgB;YAChB,gBAAgB;YAChB,UAAU;YACV,WAAW;YACX,WAAW;SACd,CAAC;IACN,CAAC;IAED,YACI,OAAgB,EAChB,SAAsB,EACtB,MAAgB;QAEhB,MAAM,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAClC,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC;IAES,gBAAgB;QACtB,OAAO,kBAAkB,CAAC;IAC9B,CAAC;IAEM,KAAK,CAAC,wBAAwB,CACjC,IAAY,EACZ,QAAuB,EACvB,QAAuB;QAEvB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,0BAA0B,CAAC,CAAC;QACvD,GA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,+BAA+B,EAAE,cAAc,CAAC,CAAC;gBAC5D,IAAI,CAAC,MAAM,EAAE,CAAC;YAClB,CAAC;YACD,GAAG,EAAE,IAAI,CAAC,0BAA0B,CAAC,CAAC;YACtC,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAChC,CAAC,EACD,6BAAkB,CACjB,CAAC;IACN,CAAC;CACJ;AArQD,4CAqQC"}
@@ -0,0 +1,203 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreativeComponent = exports.DEBOUNCE_THRESHOLD = exports.AttributeValOrThrow = exports.RecommenderTypeInputs = exports.ProductFeedStrategy = void 0;
4
+ const ads_core_1 = require("@surfside/ads-core");
5
+ const Attributes_1 = require("../util/Attributes");
6
+ exports.ProductFeedStrategy = {
7
+ Sponsored: 'sponsored',
8
+ Hybrid: 'hybrid',
9
+ Recommended: 'recommended'
10
+ };
11
+ exports.RecommenderTypeInputs = {
12
+ TopProducts: 'top-products',
13
+ ForYou: 'for-you',
14
+ BuyAgain: 'buy-again',
15
+ PastPurchases: 'past-purchases'
16
+ };
17
+ const AttributeValOrThrow = (element, attribute, value) => {
18
+ if (value !== null) {
19
+ return value;
20
+ }
21
+ throw new Attributes_1.AttributeNotFoundError(element, attribute);
22
+ };
23
+ exports.AttributeValOrThrow = AttributeValOrThrow;
24
+ exports.DEBOUNCE_THRESHOLD = 10;
25
+ class CreativeComponent extends HTMLElement {
26
+ _initApi;
27
+ _getUserId;
28
+ accountId;
29
+ siteId;
30
+ locationId;
31
+ channelId;
32
+ zoneId;
33
+ category = [];
34
+ keywords = [];
35
+ shadow;
36
+ api;
37
+ log;
38
+ /* Value to check for mutibility */
39
+ totem;
40
+ _stopTimer;
41
+ restartEndToEndTimer;
42
+ /* Checking for equality while debugging */
43
+ _instanceId;
44
+ get instanceId() {
45
+ return this._instanceId;
46
+ }
47
+ _monkeyHistoryReplaceCallback = () => {
48
+ this.log?.info('Running monkey-patch re-init function');
49
+ this.initApi();
50
+ };
51
+ constructor(_initApi, _getUserId, logger) {
52
+ super();
53
+ this._initApi = _initApi;
54
+ this._getUserId = _getUserId;
55
+ this._instanceId = crypto.randomUUID();
56
+ this.shadow = this.attachShadow({ mode: 'open' });
57
+ this.log = (0, ads_core_1.Ctx)(logger)?.with(this.getComponentName());
58
+ this.restartEndToEndTimer = () => {
59
+ if (this._stopTimer !== undefined) {
60
+ this._stopTimer();
61
+ }
62
+ this._stopTimer = this.log?.time?.(this.constructor.name + '-e2e');
63
+ };
64
+ this.restartEndToEndTimer();
65
+ }
66
+ connectedCallback() {
67
+ globalThis.window.addEventListener('monkeyHistoryReplace', this._monkeyHistoryReplaceCallback);
68
+ globalThis.window.addEventListener('popstate', this._monkeyHistoryReplaceCallback);
69
+ }
70
+ static get observedBaseAttributes() {
71
+ return [
72
+ 'account-id',
73
+ 'site-id',
74
+ 'location-id',
75
+ 'channel-id',
76
+ 'zone-id',
77
+ 'keywords',
78
+ 'category',
79
+ ];
80
+ }
81
+ getBaseAttributeValues() {
82
+ return {
83
+ accountId: this.accountId,
84
+ siteId: this.siteId,
85
+ channelId: this.channelId,
86
+ locationId: this.locationId,
87
+ zoneId: this.zoneId,
88
+ category: this.category,
89
+ keywords: this.keywords
90
+ };
91
+ }
92
+ attributesLoaded() {
93
+ return (this.accountId !== undefined &&
94
+ this.siteId !== undefined &&
95
+ this.channelId !== undefined &&
96
+ this.locationId !== undefined &&
97
+ this.zoneId !== undefined &&
98
+ this.category !== undefined &&
99
+ this.keywords !== undefined &&
100
+ this.accountId !== null &&
101
+ this.siteId !== null &&
102
+ this.channelId !== null &&
103
+ this.locationId !== null &&
104
+ this.zoneId !== null &&
105
+ this.category !== null &&
106
+ this.keywords !== null);
107
+ }
108
+ async lazyLoadApi() {
109
+ if (this.api === undefined && this.attributesLoaded()) {
110
+ await this.initApi();
111
+ }
112
+ }
113
+ async baseAttributeChangedCallback(key, oldValue, newValue, logger) {
114
+ const log = logger?.with('baseAttributeChangedCallback');
115
+ log?.info('Detected base attribute change. key, oldValue, newValue:', key, oldValue, newValue);
116
+ let reInit = false;
117
+ switch (key) {
118
+ case 'account-id':
119
+ this.accountId = newValue ?? undefined;
120
+ reInit = true;
121
+ log?.debug('account-id', this.accountId);
122
+ break;
123
+ case 'site-id':
124
+ this.siteId = newValue ?? undefined;
125
+ reInit = true;
126
+ log?.debug('site-id', this.siteId);
127
+ break;
128
+ case 'location-id':
129
+ this.locationId = newValue ?? undefined;
130
+ reInit = true;
131
+ log?.debug('location-id', this.locationId);
132
+ break;
133
+ case 'channel-id':
134
+ this.channelId = newValue ?? undefined;
135
+ reInit = true;
136
+ log?.debug('channel-id', this.channelId);
137
+ break;
138
+ case 'zone-id':
139
+ this.zoneId = newValue ?? undefined;
140
+ log?.debug('zone-id', this.zoneId);
141
+ break;
142
+ case 'category':
143
+ this.category = (0, ads_core_1.GetValue)((0, Attributes_1.ReadAttribute)(this, 'category'))
144
+ ?.split(',')
145
+ .map(k => k.trim())
146
+ ?? this.category ?? [this.api?.configuration.category];
147
+ log?.debug('surf-category', this.category);
148
+ break;
149
+ case 'keywords':
150
+ this.keywords = (0, ads_core_1.GetValue)((0, Attributes_1.ReadAttribute)(this, 'keywords'))
151
+ ?.split(',')
152
+ .map(k => k.trim())
153
+ ?? this.keywords ?? [];
154
+ log?.debug('keywords', this.keywords);
155
+ break;
156
+ }
157
+ if (reInit) {
158
+ log?.info('Re-initializing API');
159
+ await this.initApi();
160
+ }
161
+ }
162
+ disconnectedCallback() {
163
+ this.log?.info('Disconnected - removing monkey history listeners');
164
+ globalThis.window.removeEventListener('monkeyHistoryReplace', this._monkeyHistoryReplaceCallback);
165
+ globalThis.window.removeEventListener('popstate', this._monkeyHistoryReplaceCallback);
166
+ }
167
+ async initApi() {
168
+ const log = this.log?.with('initApi');
169
+ log?.info('Initializing API');
170
+ const userId = await this._getUserId();
171
+ log?.info(this.accountId, this.siteId, this.channelId, this.locationId, userId);
172
+ if (this.accountId === undefined ||
173
+ this.siteId === undefined ||
174
+ this.channelId === undefined ||
175
+ this.locationId === undefined) {
176
+ log?.warn('Component isn\'t fully initialized yet');
177
+ return;
178
+ }
179
+ log?.info('Component initialized');
180
+ this.api = (0, ads_core_1.GetValueOrThrow)(await this._initApi(this.accountId, this.siteId, this.channelId, this.locationId, userId, globalThis.window.location.href));
181
+ }
182
+ readBaseAttributes() {
183
+ const log = this.log?.with('readBaseAttributes');
184
+ log?.info('Reading base attributes');
185
+ this.accountId = (0, ads_core_1.GetValue)((0, Attributes_1.ReadAttribute)(this, 'account-id')) ?? this.accountId;
186
+ this.siteId = (0, ads_core_1.GetValue)((0, Attributes_1.ReadAttribute)(this, 'site-id')) ?? this.siteId;
187
+ this.locationId = (0, ads_core_1.GetValue)((0, ads_core_1.First)((0, Attributes_1.ReadAttribute)(this, 'location-id'), (0, Attributes_1.ReadAttribute)(this, 'store-id'))) ?? this.locationId;
188
+ this.channelId = (0, ads_core_1.GetValue)((0, Attributes_1.ReadAttribute)(this, 'channel-id')) ?? this.channelId;
189
+ this.zoneId = (0, ads_core_1.GetValue)((0, ads_core_1.First)((0, Attributes_1.ReadAttribute)(this, 'zone-id'), (0, Attributes_1.ReadAttribute)(this, 'placement-id'))) ?? this.zoneId;
190
+ this.category = (0, ads_core_1.GetValue)((0, Attributes_1.ReadAttribute)(this, 'category'))
191
+ ?.split(',')
192
+ .map(k => k.trim())
193
+ ?? this.category ?? [this.api?.configuration.category];
194
+ log?.info('category', this.category);
195
+ this.keywords = (0, ads_core_1.GetValue)((0, Attributes_1.ReadAttribute)(this, 'keywords'))
196
+ ?.split(',')
197
+ .map(k => k.trim())
198
+ ?? this.keywords ?? [];
199
+ log?.debug(this.accountId, this.siteId, this.channelId, this.locationId, this.zoneId, this.category, this.keywords);
200
+ }
201
+ }
202
+ exports.CreativeComponent = CreativeComponent;
203
+ //# sourceMappingURL=Creative.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Creative.js","sourceRoot":"../@surfside-ads/","sources":["components/Creative.ts"],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