@adhese/sdk 0.3.0 → 0.5.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/cjs/index.js +627 -530
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.js +629 -532
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +71 -150
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ComputedRef, Ref, MaybeRef } from '@vue/runtime-core';
|
|
1
2
|
import * as zod from 'zod';
|
|
2
3
|
import { TypeOf, ZodType } from 'zod';
|
|
3
4
|
|
|
@@ -62,7 +63,7 @@ type SlotManager = {
|
|
|
62
63
|
/**
|
|
63
64
|
* Adds a new slot to the Adhese instance and renders it.
|
|
64
65
|
*/
|
|
65
|
-
add(slot: Omit<AdheseSlotOptions, 'context'>):
|
|
66
|
+
add(slot: Omit<AdheseSlotOptions, 'context'>): Readonly<AdheseSlot>;
|
|
66
67
|
/**
|
|
67
68
|
* Finds all slots in the DOM and adds them to the Adhese instance.
|
|
68
69
|
*/
|
|
@@ -86,13 +87,8 @@ type SlotManagerOptions = {
|
|
|
86
87
|
context: AdheseContext;
|
|
87
88
|
};
|
|
88
89
|
|
|
89
|
-
declare const
|
|
90
|
+
declare const baseSchema: zod.ZodObject<{
|
|
90
91
|
adDuration: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, number | undefined, string>>;
|
|
91
|
-
adDuration2nd: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, number | undefined, string>>;
|
|
92
|
-
adDuration3rd: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, number | undefined, string>>;
|
|
93
|
-
adDuration4th: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, number | undefined, string>>;
|
|
94
|
-
adDuration5th: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, number | undefined, string>>;
|
|
95
|
-
adDuration6th: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, number | undefined, string>>;
|
|
96
92
|
adFormat: zod.ZodOptional<zod.ZodString>;
|
|
97
93
|
adType: zod.ZodString;
|
|
98
94
|
additionalCreativeTracker: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, URL | undefined, string>>;
|
|
@@ -104,13 +100,12 @@ declare const baseAdResponseScheme: zod.ZodObject<{
|
|
|
104
100
|
advertiserId: zod.ZodOptional<zod.ZodString>;
|
|
105
101
|
altText: zod.ZodOptional<zod.ZodString>;
|
|
106
102
|
auctionable: zod.ZodOptional<zod.ZodUnion<[zod.ZodBoolean, zod.ZodLiteral<"">]>>;
|
|
107
|
-
body: zod.ZodOptional<zod.ZodString
|
|
103
|
+
body: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodUnion<[zod.ZodEffects<zod.ZodString, Record<string, unknown> | readonly unknown[], string>, zod.ZodEffects<zod.ZodString, string, string>]>]>, string | Record<string, unknown> | readonly unknown[] | undefined, string>>;
|
|
108
104
|
clickTag: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, URL | undefined, string>>;
|
|
109
105
|
comment: zod.ZodOptional<zod.ZodString>;
|
|
110
106
|
creativeName: zod.ZodOptional<zod.ZodString>;
|
|
111
107
|
deliveryGroupId: zod.ZodOptional<zod.ZodString>;
|
|
112
108
|
deliveryMultiples: zod.ZodOptional<zod.ZodString>;
|
|
113
|
-
dm: zod.ZodOptional<zod.ZodString>;
|
|
114
109
|
ext: zod.ZodOptional<zod.ZodString>;
|
|
115
110
|
extension: zod.ZodOptional<zod.ZodObject<{
|
|
116
111
|
mediaType: zod.ZodString;
|
|
@@ -122,22 +117,16 @@ declare const baseAdResponseScheme: zod.ZodObject<{
|
|
|
122
117
|
mediaType: string;
|
|
123
118
|
prebid?: unknown;
|
|
124
119
|
}>>;
|
|
125
|
-
|
|
126
|
-
extraField2: zod.ZodOptional<zod.ZodString>;
|
|
127
|
-
height: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, number | undefined, string>>;
|
|
128
|
-
height3rd: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, number | undefined, string>>;
|
|
129
|
-
height4th: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, number | undefined, string>>;
|
|
130
|
-
height5th: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, number | undefined, string>>;
|
|
131
|
-
height6th: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, number | undefined, string>>;
|
|
132
|
-
heightLarge: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, number | undefined, string>>;
|
|
120
|
+
height: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">, zod.ZodNumber]>, string | undefined, string | number>>;
|
|
133
121
|
id: zod.ZodOptional<zod.ZodString>;
|
|
134
122
|
impressionCounter: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, URL | undefined, string>>;
|
|
135
123
|
libId: zod.ZodOptional<zod.ZodString>;
|
|
136
124
|
orderId: zod.ZodOptional<zod.ZodString>;
|
|
137
125
|
orderName: zod.ZodOptional<zod.ZodString>;
|
|
138
126
|
orderProperty: zod.ZodOptional<zod.ZodString>;
|
|
139
|
-
origin: zod.
|
|
127
|
+
origin: zod.ZodUnion<[zod.ZodLiteral<"JERLICIA">, zod.ZodLiteral<"DALE">]>;
|
|
140
128
|
originData: zod.ZodOptional<zod.ZodUnknown>;
|
|
129
|
+
originInstance: zod.ZodOptional<zod.ZodString>;
|
|
141
130
|
poolPath: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, URL | undefined, string>>;
|
|
142
131
|
preview: zod.ZodOptional<zod.ZodUnion<[zod.ZodBoolean, zod.ZodLiteral<"">]>>;
|
|
143
132
|
priority: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, number | undefined, string>>;
|
|
@@ -145,12 +134,7 @@ declare const baseAdResponseScheme: zod.ZodObject<{
|
|
|
145
134
|
slotID: zod.ZodString;
|
|
146
135
|
slotName: zod.ZodString;
|
|
147
136
|
swfSrc: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, URL | undefined, string>>;
|
|
148
|
-
|
|
149
|
-
swfSrc3rd: zod.ZodOptional<zod.ZodString>;
|
|
150
|
-
swfSrc4th: zod.ZodOptional<zod.ZodString>;
|
|
151
|
-
swfSrc5th: zod.ZodOptional<zod.ZodString>;
|
|
152
|
-
swfSrc6th: zod.ZodOptional<zod.ZodString>;
|
|
153
|
-
tag: zod.ZodString;
|
|
137
|
+
tag: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodUnion<[zod.ZodEffects<zod.ZodString, Record<string, unknown> | readonly unknown[], string>, zod.ZodEffects<zod.ZodString, string, string>]>]>, string | Record<string, unknown> | readonly unknown[] | undefined, string>>;
|
|
154
138
|
tagUrl: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, URL | undefined, string>>;
|
|
155
139
|
timeStamp: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, Date | undefined, string>>;
|
|
156
140
|
trackedImpressionCounter: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, URL | undefined, string>>;
|
|
@@ -158,23 +142,14 @@ declare const baseAdResponseScheme: zod.ZodObject<{
|
|
|
158
142
|
trackingUrl: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, URL | undefined, string>>;
|
|
159
143
|
url: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, URL | undefined, string>>;
|
|
160
144
|
viewableImpressionCounter: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, URL | undefined, string>>;
|
|
161
|
-
width: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<""
|
|
162
|
-
|
|
163
|
-
width4th: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, number | undefined, string>>;
|
|
164
|
-
width5th: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, number | undefined, string>>;
|
|
165
|
-
width6th: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, number | undefined, string>>;
|
|
166
|
-
widthLarge: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">]>, number | undefined, string>>;
|
|
145
|
+
width: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">, zod.ZodNumber]>, string | undefined, string | number>>;
|
|
146
|
+
widthLarge: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodLiteral<"">, zod.ZodNumber]>, string | undefined, string | number>>;
|
|
167
147
|
}, "strip", zod.ZodTypeAny, {
|
|
148
|
+
origin: "JERLICIA" | "DALE";
|
|
168
149
|
adType: string;
|
|
169
150
|
slotID: string;
|
|
170
151
|
slotName: string;
|
|
171
|
-
tag: string;
|
|
172
152
|
adDuration?: number | undefined;
|
|
173
|
-
adDuration2nd?: number | undefined;
|
|
174
|
-
adDuration3rd?: number | undefined;
|
|
175
|
-
adDuration4th?: number | undefined;
|
|
176
|
-
adDuration5th?: number | undefined;
|
|
177
|
-
adDuration6th?: number | undefined;
|
|
178
153
|
adFormat?: string | undefined;
|
|
179
154
|
additionalCreativeTracker?: URL | undefined;
|
|
180
155
|
additionalViewableTracker?: string | undefined;
|
|
@@ -185,44 +160,32 @@ declare const baseAdResponseScheme: zod.ZodObject<{
|
|
|
185
160
|
advertiserId?: string | undefined;
|
|
186
161
|
altText?: string | undefined;
|
|
187
162
|
auctionable?: boolean | "" | undefined;
|
|
188
|
-
body?: string | undefined;
|
|
163
|
+
body?: string | Record<string, unknown> | readonly unknown[] | undefined;
|
|
189
164
|
clickTag?: URL | undefined;
|
|
190
165
|
comment?: string | undefined;
|
|
191
166
|
creativeName?: string | undefined;
|
|
192
167
|
deliveryGroupId?: string | undefined;
|
|
193
168
|
deliveryMultiples?: string | undefined;
|
|
194
|
-
dm?: string | undefined;
|
|
195
169
|
ext?: string | undefined;
|
|
196
170
|
extension?: {
|
|
197
171
|
mediaType: string;
|
|
198
172
|
prebid?: unknown;
|
|
199
173
|
} | undefined;
|
|
200
|
-
|
|
201
|
-
extraField2?: string | undefined;
|
|
202
|
-
height?: number | undefined;
|
|
203
|
-
height3rd?: number | undefined;
|
|
204
|
-
height4th?: number | undefined;
|
|
205
|
-
height5th?: number | undefined;
|
|
206
|
-
height6th?: number | undefined;
|
|
207
|
-
heightLarge?: number | undefined;
|
|
174
|
+
height?: string | undefined;
|
|
208
175
|
id?: string | undefined;
|
|
209
176
|
impressionCounter?: URL | undefined;
|
|
210
177
|
libId?: string | undefined;
|
|
211
178
|
orderId?: string | undefined;
|
|
212
179
|
orderName?: string | undefined;
|
|
213
180
|
orderProperty?: string | undefined;
|
|
214
|
-
origin?: string | undefined;
|
|
215
181
|
originData?: unknown;
|
|
182
|
+
originInstance?: string | undefined;
|
|
216
183
|
poolPath?: URL | undefined;
|
|
217
184
|
preview?: boolean | "" | undefined;
|
|
218
185
|
priority?: number | undefined;
|
|
219
186
|
share?: string | undefined;
|
|
220
187
|
swfSrc?: URL | undefined;
|
|
221
|
-
|
|
222
|
-
swfSrc3rd?: string | undefined;
|
|
223
|
-
swfSrc4th?: string | undefined;
|
|
224
|
-
swfSrc5th?: string | undefined;
|
|
225
|
-
swfSrc6th?: string | undefined;
|
|
188
|
+
tag?: string | Record<string, unknown> | readonly unknown[] | undefined;
|
|
226
189
|
tagUrl?: URL | undefined;
|
|
227
190
|
timeStamp?: Date | undefined;
|
|
228
191
|
trackedImpressionCounter?: URL | undefined;
|
|
@@ -230,23 +193,14 @@ declare const baseAdResponseScheme: zod.ZodObject<{
|
|
|
230
193
|
trackingUrl?: URL | undefined;
|
|
231
194
|
url?: URL | undefined;
|
|
232
195
|
viewableImpressionCounter?: URL | undefined;
|
|
233
|
-
width?:
|
|
234
|
-
|
|
235
|
-
width4th?: number | undefined;
|
|
236
|
-
width5th?: number | undefined;
|
|
237
|
-
width6th?: number | undefined;
|
|
238
|
-
widthLarge?: number | undefined;
|
|
196
|
+
width?: string | undefined;
|
|
197
|
+
widthLarge?: string | undefined;
|
|
239
198
|
}, {
|
|
199
|
+
origin: "JERLICIA" | "DALE";
|
|
240
200
|
adType: string;
|
|
241
201
|
slotID: string;
|
|
242
202
|
slotName: string;
|
|
243
|
-
tag: string;
|
|
244
203
|
adDuration?: string | undefined;
|
|
245
|
-
adDuration2nd?: string | undefined;
|
|
246
|
-
adDuration3rd?: string | undefined;
|
|
247
|
-
adDuration4th?: string | undefined;
|
|
248
|
-
adDuration5th?: string | undefined;
|
|
249
|
-
adDuration6th?: string | undefined;
|
|
250
204
|
adFormat?: string | undefined;
|
|
251
205
|
additionalCreativeTracker?: string | undefined;
|
|
252
206
|
additionalViewableTracker?: string | undefined;
|
|
@@ -263,38 +217,26 @@ declare const baseAdResponseScheme: zod.ZodObject<{
|
|
|
263
217
|
creativeName?: string | undefined;
|
|
264
218
|
deliveryGroupId?: string | undefined;
|
|
265
219
|
deliveryMultiples?: string | undefined;
|
|
266
|
-
dm?: string | undefined;
|
|
267
220
|
ext?: string | undefined;
|
|
268
221
|
extension?: {
|
|
269
222
|
mediaType: string;
|
|
270
223
|
prebid?: unknown;
|
|
271
224
|
} | undefined;
|
|
272
|
-
|
|
273
|
-
extraField2?: string | undefined;
|
|
274
|
-
height?: string | undefined;
|
|
275
|
-
height3rd?: string | undefined;
|
|
276
|
-
height4th?: string | undefined;
|
|
277
|
-
height5th?: string | undefined;
|
|
278
|
-
height6th?: string | undefined;
|
|
279
|
-
heightLarge?: string | undefined;
|
|
225
|
+
height?: string | number | undefined;
|
|
280
226
|
id?: string | undefined;
|
|
281
227
|
impressionCounter?: string | undefined;
|
|
282
228
|
libId?: string | undefined;
|
|
283
229
|
orderId?: string | undefined;
|
|
284
230
|
orderName?: string | undefined;
|
|
285
231
|
orderProperty?: string | undefined;
|
|
286
|
-
origin?: string | undefined;
|
|
287
232
|
originData?: unknown;
|
|
233
|
+
originInstance?: string | undefined;
|
|
288
234
|
poolPath?: string | undefined;
|
|
289
235
|
preview?: boolean | "" | undefined;
|
|
290
236
|
priority?: string | undefined;
|
|
291
237
|
share?: string | undefined;
|
|
292
238
|
swfSrc?: string | undefined;
|
|
293
|
-
|
|
294
|
-
swfSrc3rd?: string | undefined;
|
|
295
|
-
swfSrc4th?: string | undefined;
|
|
296
|
-
swfSrc5th?: string | undefined;
|
|
297
|
-
swfSrc6th?: string | undefined;
|
|
239
|
+
tag?: string | undefined;
|
|
298
240
|
tagUrl?: string | undefined;
|
|
299
241
|
timeStamp?: string | undefined;
|
|
300
242
|
trackedImpressionCounter?: string | undefined;
|
|
@@ -302,19 +244,18 @@ declare const baseAdResponseScheme: zod.ZodObject<{
|
|
|
302
244
|
trackingUrl?: string | undefined;
|
|
303
245
|
url?: string | undefined;
|
|
304
246
|
viewableImpressionCounter?: string | undefined;
|
|
305
|
-
width?: string | undefined;
|
|
306
|
-
|
|
307
|
-
width4th?: string | undefined;
|
|
308
|
-
width5th?: string | undefined;
|
|
309
|
-
width6th?: string | undefined;
|
|
310
|
-
widthLarge?: string | undefined;
|
|
247
|
+
width?: string | number | undefined;
|
|
248
|
+
widthLarge?: string | number | undefined;
|
|
311
249
|
}>;
|
|
312
|
-
type AdResponse = TypeOf<typeof
|
|
250
|
+
type AdResponse = (TypeOf<typeof baseSchema> & {
|
|
313
251
|
additionalCreatives?: ReadonlyArray<AdResponse> | string;
|
|
314
|
-
};
|
|
252
|
+
});
|
|
315
253
|
declare const adResponseSchema: ZodType<AdResponse>;
|
|
316
|
-
type
|
|
317
|
-
additionalCreatives?: ReadonlyArray<
|
|
254
|
+
type PreParsedAd = TypeOf<typeof adResponseSchema> & {
|
|
255
|
+
additionalCreatives?: ReadonlyArray<PreParsedAd> | string;
|
|
256
|
+
};
|
|
257
|
+
type Ad<T = string | Record<string, unknown> | ReadonlyArray<unknown>> = Omit<PreParsedAd, 'tag'> & {
|
|
258
|
+
tag: T;
|
|
318
259
|
};
|
|
319
260
|
|
|
320
261
|
type RenderMode = 'iframe' | 'inline';
|
|
@@ -361,6 +302,15 @@ type AdheseSlotOptions = {
|
|
|
361
302
|
* Callback that is called when the format of the slot changes.
|
|
362
303
|
*/
|
|
363
304
|
onNameChange?(newName: string, oldName: string): void;
|
|
305
|
+
/**
|
|
306
|
+
* Callback that is called when the slot is rendered.
|
|
307
|
+
*/
|
|
308
|
+
onRender?(element: HTMLElement): void;
|
|
309
|
+
/**
|
|
310
|
+
* Callback that is called before the ad is rendered. This can be used to modify the ad before it is rendered.
|
|
311
|
+
* Particularly useful for rendering ads with custom HTML if the ad tag contains a JSON object.
|
|
312
|
+
*/
|
|
313
|
+
onBeforeRender?(ad: Ad): Ad | void;
|
|
364
314
|
} & ({
|
|
365
315
|
/**
|
|
366
316
|
* If the slot should be lazy loaded. This means that the ad will only be requested when the slot is in the viewport.
|
|
@@ -379,49 +329,48 @@ type AdheseSlotOptions = {
|
|
|
379
329
|
});
|
|
380
330
|
type AdheseSlot = Merge<Omit<AdheseSlotOptions, 'onDispose' | 'context' | 'onFormatChange' | 'format'>, {
|
|
381
331
|
/**
|
|
382
|
-
* The
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* The parameters that are used to render the ad.
|
|
387
|
-
*/
|
|
388
|
-
parameters: Map<string, ReadonlyArray<string> | string>;
|
|
389
|
-
/**
|
|
390
|
-
* Renders the slot in the containing element. If no ad is provided, a new ad will be requested from the API.
|
|
332
|
+
* The name of the slot. This is used to identify the slot in the Adhese instance.
|
|
333
|
+
*
|
|
334
|
+
* The name is generated based on the location, format, and slot of the slot.
|
|
391
335
|
*/
|
|
392
|
-
|
|
336
|
+
name: ComputedRef<string>;
|
|
393
337
|
/**
|
|
394
|
-
*
|
|
338
|
+
* The format code of the slot. Used to find the correct element on the page to render the ad in.
|
|
339
|
+
*
|
|
340
|
+
* If the format is a string, it is used as the format code. If the format is an array, the format code is determined
|
|
341
|
+
* by the query detector.
|
|
342
|
+
*
|
|
343
|
+
* When you change the format, the slot will request a new ad from the API automatically.
|
|
395
344
|
*/
|
|
396
|
-
|
|
345
|
+
format: Ref<string>;
|
|
397
346
|
/**
|
|
398
|
-
*
|
|
347
|
+
* The location of the slot. This is the location that is used to determine the current page URL.
|
|
399
348
|
*/
|
|
400
|
-
|
|
349
|
+
location: string;
|
|
401
350
|
/**
|
|
402
|
-
*
|
|
351
|
+
* The parameters that are used to render the ad.
|
|
403
352
|
*/
|
|
404
|
-
|
|
353
|
+
parameters: Map<string, ReadonlyArray<string> | string>;
|
|
405
354
|
/**
|
|
406
|
-
*
|
|
355
|
+
* Whether the viewability tracking pixel has been fired.
|
|
407
356
|
*/
|
|
408
|
-
|
|
357
|
+
isViewabilityTracked: ComputedRef<boolean>;
|
|
409
358
|
/**
|
|
410
|
-
*
|
|
359
|
+
* Whether the impression tracking pixel has been fired.
|
|
411
360
|
*/
|
|
412
|
-
|
|
361
|
+
isImpressionTracked: ComputedRef<boolean>;
|
|
413
362
|
/**
|
|
414
|
-
*
|
|
363
|
+
* Ad object that is fetched from the API.
|
|
415
364
|
*/
|
|
416
|
-
|
|
365
|
+
ad: Ref<Ad | null>;
|
|
417
366
|
/**
|
|
418
|
-
*
|
|
367
|
+
* Renders the slot in the containing element. If no ad is provided, a new ad will be requested from the API.
|
|
419
368
|
*/
|
|
420
|
-
|
|
369
|
+
render(ad?: Ad): Promise<HTMLElement>;
|
|
421
370
|
/**
|
|
422
|
-
* Returns the
|
|
371
|
+
* Returns the rendered element.
|
|
423
372
|
*/
|
|
424
|
-
|
|
373
|
+
getElement(): HTMLElement | null;
|
|
425
374
|
/**
|
|
426
375
|
* Removes the slot from the DOM and cleans up the slot instance.
|
|
427
376
|
*/
|
|
@@ -432,41 +381,13 @@ type AdRequestOptions = {
|
|
|
432
381
|
/**
|
|
433
382
|
* List of slots you want to fetch the ad for
|
|
434
383
|
*/
|
|
435
|
-
slots: ReadonlyArray<
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
/**
|
|
441
|
-
* The Adhese account name.
|
|
442
|
-
*/
|
|
443
|
-
account: string;
|
|
444
|
-
/**
|
|
445
|
-
* Request method to use for the requestAds
|
|
446
|
-
*
|
|
447
|
-
* @default 'POST'
|
|
448
|
-
*/
|
|
449
|
-
method?: 'GET' | 'POST' | 'get' | 'post';
|
|
450
|
-
/**
|
|
451
|
-
* The parameters that are used for all ads.
|
|
452
|
-
*/
|
|
453
|
-
parameters?: Map<string, ReadonlyArray<string> | string>;
|
|
454
|
-
context: Partial<Adhese>;
|
|
384
|
+
slots: ReadonlyArray<{
|
|
385
|
+
name: MaybeRef<string>;
|
|
386
|
+
parameters: Map<string, ReadonlyArray<string> | string>;
|
|
387
|
+
}>;
|
|
388
|
+
context: AdheseContext;
|
|
455
389
|
};
|
|
456
390
|
|
|
457
|
-
declare class MapWithEvents<T, U> extends Map<T, U> {
|
|
458
|
-
private readonly listeners;
|
|
459
|
-
addEventListener(listener: () => void): void;
|
|
460
|
-
removeEventListener(listener: () => void): void;
|
|
461
|
-
set(key: T, value: U): this;
|
|
462
|
-
clear(): void;
|
|
463
|
-
delete(key: T): boolean;
|
|
464
|
-
/**
|
|
465
|
-
* Remove all listeners and clear the map.
|
|
466
|
-
*/
|
|
467
|
-
dispose(): void;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
391
|
/**
|
|
471
392
|
* A log entry saved by the logger
|
|
472
393
|
*/
|
|
@@ -660,7 +581,7 @@ type Adhese = Omit<AdheseOptions, 'location' | 'parameters' | 'consent'> & Merge
|
|
|
660
581
|
/**
|
|
661
582
|
* The parameters that are used for all ads.
|
|
662
583
|
*/
|
|
663
|
-
parameters:
|
|
584
|
+
parameters: Map<string, ReadonlyArray<string> | string>;
|
|
664
585
|
/**
|
|
665
586
|
* The event manager for the Adhese instance.
|
|
666
587
|
*/
|
|
@@ -731,6 +652,6 @@ type AdheseContext = Partial<Pick<Adhese, 'events' | 'getAll' | 'get' | 'paramet
|
|
|
731
652
|
*
|
|
732
653
|
* @return Promise<Adhese> The Adhese instance.
|
|
733
654
|
*/
|
|
734
|
-
declare function createAdhese(options: AdheseOptions):
|
|
655
|
+
declare function createAdhese(options: AdheseOptions): Readonly<Adhese>;
|
|
735
656
|
|
|
736
657
|
export { type Ad, type AdRequestOptions, type Adhese, type AdheseContext, type AdheseOptions, type AdheseSlot, type AdheseSlotOptions, createAdhese };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adhese/sdk",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"description": "Adhese SDK",
|
|
6
6
|
"license": "GPL-3.0",
|
|
7
7
|
"repository": {
|
|
@@ -22,10 +22,11 @@
|
|
|
22
22
|
"lint:fix": "eslint --fix .",
|
|
23
23
|
"clean": "rm -rf dist",
|
|
24
24
|
"typecheck": "tsc --noEmit",
|
|
25
|
-
"
|
|
25
|
+
"prepareRelease": "npm run build"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@adhese/sdk-devtools": "^0.
|
|
28
|
+
"@adhese/sdk-devtools": "^0.5.0",
|
|
29
|
+
"@vue/runtime-core": "^3.4.21",
|
|
29
30
|
"lodash-es": "^4.17.21",
|
|
30
31
|
"zod": "^3.22.4"
|
|
31
32
|
}
|