@surfside/surfside-events 1.0.0 → 2.1.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/README.md CHANGED
@@ -21,7 +21,7 @@ npm install @surfside/surfside-events
21
21
  Use the available functions from this package to track to all trackers which have been initialized with this plugin:
22
22
 
23
23
  ```js
24
- import { addProduct, addPromo, setAction } from '@surfside/browser-plugin-surfside';
24
+ import { addProduct, addPromo, setAction } from '@surfside/surfside-events';
25
25
 
26
26
  addProduct({
27
27
  id: 'P12345',
@@ -168,6 +168,63 @@ interface segmentContext {
168
168
  * @param trackers - The tracker identifiers which the context will be stored against
169
169
  */
170
170
  declare function segment(context?: segmentContext, trackers?: Array<string>): void;
171
+ /**
172
+ * Removes a Surfside Segment Context
173
+ *
174
+ * @param context - The context to be stored
175
+ * @param trackers - The tracker identifiers which the context will be stored against
176
+ */
177
+ declare function removeSegment(context?: segmentContext, trackers?: Array<string>): void;
178
+ /**
179
+ * A Surfside Local Business Location Context
180
+ */
181
+ interface localBusinessLocationContext {
182
+ /** The Location ID */
183
+ id?: string;
184
+ /** The Location Latitude */
185
+ latitude?: string;
186
+ /** The Location Longitude */
187
+ longitude?: string;
188
+ /** The Location Country Code */
189
+ country_code?: string;
190
+ /** The Location Zip */
191
+ zip?: string;
192
+ /** The Location State Label */
193
+ state_label?: string;
194
+ /** The Location State */
195
+ state?: string;
196
+ /** The Location City */
197
+ city?: string;
198
+ /** The Location Street */
199
+ street?: string;
200
+ /** The Location Name */
201
+ name?: string;
202
+ /** The Location Parent */
203
+ parent?: string;
204
+ /** The Location Type */
205
+ type?: string;
206
+ /** The Location Category */
207
+ category?: string;
208
+ }
209
+ declare global {
210
+ interface Window {
211
+ surf: any;
212
+ }
213
+ }
214
+ /**
215
+ * Adds a Surfside Local Business Location Context
216
+ *
217
+ * @param context - The context to be stored
218
+ * @param trackers - The tracker identifiers which the context will be stored against
219
+ */
220
+ declare function setLocation(context?: localBusinessLocationContext, trackers?: Array<string>): void;
221
+ /**
222
+ * Removes a Surfside Local Business Location Context
223
+ *
224
+ * @param context - The context to be stored
225
+ * @param trackers - The tracker identifiers which the context will be stored against
226
+ */
227
+ declare function removeLocation(context?: localBusinessLocationContext, trackers?: Array<string>): void;
171
228
  /**
172
229
  * A Surfside User Context
173
230
  */
@@ -192,6 +249,8 @@ interface userContext {
192
249
  userId?: string;
193
250
  /** The last name of the user */
194
251
  lastName?: string;
252
+ /** The phone number of the user */
253
+ phone?: string;
195
254
  }
196
255
  /**
197
256
  * Adds a Surfside User Context
@@ -200,6 +259,11 @@ interface userContext {
200
259
  * @param trackers - The tracker identifiers which the context will be stored against
201
260
  */
202
261
  declare function setUser(context?: userContext, trackers?: Array<string>): void;
262
+ interface SurfIdContextRequest {
263
+ email?: string;
264
+ phone?: string;
265
+ }
266
+ declare function setSurfId(context?: SurfIdContextRequest, trackers?: Array<string>): void;
203
267
  /**
204
268
  * A Surfside User Context
205
269
  */
@@ -242,4 +306,136 @@ interface identifyUserContext {
242
306
  * @param trackers - The tracker identifiers which the context will be stored against
243
307
  */
244
308
  declare function identifyUser(context?: identifyUserContext, trackers?: Array<string>): void;
245
- export { SurfsideCommercePlugin, commerceAction, setCommerceAction, commerceTransactionContext, addTransaction, commerceImpressionContext, addImpression, commerceProductContext, addProduct, commercePromoContext, addPromotion, sourceContext, source, segmentContext, segment, userContext, setUser, identifyUserContext, identifyUser };
309
+ type AuctionInitEvent = {
310
+ auctionId: string;
311
+ timestamp: number;
312
+ auctionStatus: string;
313
+ adUnits: AuctionInitEventAdUnit[];
314
+ bidderRequests: AdUnitBidderRequest[];
315
+ };
316
+ type AuctionInitEventAdUnit = {
317
+ requestId: string;
318
+ mediaTypes: object;
319
+ bids: AdUnitBid[];
320
+ timeout: number;
321
+ sizes: number[][];
322
+ transactionId: string;
323
+ };
324
+ type AdUnitBid = {
325
+ params: object;
326
+ user: object;
327
+ };
328
+ type AdUnitBidderRequest = {
329
+ bidderRequestId: string;
330
+ bids: BidderRequestBid[];
331
+ auctionStart: number;
332
+ timeout: number;
333
+ refererInfo: BidderRequestRefererInfo;
334
+ };
335
+ type BidderRequestBid = {
336
+ ortb2: {
337
+ site: {
338
+ page: string;
339
+ domain: string;
340
+ };
341
+ device: {
342
+ w: number;
343
+ h: number;
344
+ dnt: number;
345
+ ua: string;
346
+ language: string;
347
+ };
348
+ };
349
+ };
350
+ type BidderRequestRefererInfo = {
351
+ stack: string[];
352
+ location: string;
353
+ page: string;
354
+ domain: string;
355
+ };
356
+ declare function auctionInit(e: AuctionInitEvent & CommonEventProperties, trackers?: Array<string>): void;
357
+ type BidRequestedEvent = {
358
+ auctionId: string;
359
+ bidderRequestId: string;
360
+ bids: BidRequestedBid[];
361
+ auctionStart: number;
362
+ timeout: number;
363
+ refererInfo: BidderRequestRefererInfo;
364
+ start: number;
365
+ };
366
+ type BidRequestedBid = {
367
+ params: object;
368
+ user: object;
369
+ ortb2Imp: object;
370
+ mediaTypes: object;
371
+ transactionId: string;
372
+ sizes: [];
373
+ bidId: string;
374
+ ortb2: {
375
+ site: {
376
+ page: string;
377
+ domain: string;
378
+ };
379
+ device: {
380
+ w: number;
381
+ h: number;
382
+ dnt: number;
383
+ ua: string;
384
+ language: string;
385
+ };
386
+ };
387
+ };
388
+ declare function bidRequested(e: BidRequestedEvent, trackers?: Array<string>): void;
389
+ type BidResponseEvent = {
390
+ width: number;
391
+ height: number;
392
+ statusMessage: string;
393
+ adId: string;
394
+ requestId: string;
395
+ transactionId: string;
396
+ auctionId: string;
397
+ mediaType: string;
398
+ ad: string;
399
+ seatBidId: string;
400
+ cpm: number;
401
+ currency: string;
402
+ creative_id: string;
403
+ creativeId: string;
404
+ ttl: number;
405
+ netRevenue: boolean;
406
+ meta: {
407
+ advertiserDomains: string[];
408
+ };
409
+ originalRequest: {
410
+ ext: {
411
+ tid: string;
412
+ };
413
+ id: string;
414
+ banner: {
415
+ topFrame: number;
416
+ format: {
417
+ w: number;
418
+ h: number;
419
+ }[];
420
+ };
421
+ tagid: string;
422
+ };
423
+ originalCpm: number;
424
+ originalCurrency: string;
425
+ responseTimestamp: number;
426
+ requestTimestamp: number;
427
+ timeToRespond: number;
428
+ size: string;
429
+ };
430
+ declare function bidResponse(e: BidResponseEvent, trackers?: Array<string>): void;
431
+ type BidderDoneEvent = BidRequestedEvent;
432
+ declare function bidderDone(e: BidderDoneEvent, trackers?: Array<string>): void;
433
+ type BidderErrorEvent = {
434
+ error: object;
435
+ } & {
436
+ bidderRequest: BidRequestedEvent;
437
+ };
438
+ declare function bidderError(e: BidderErrorEvent, trackers?: Array<string>): void;
439
+ type NoBidEvent = BidRequestedEvent;
440
+ declare function noBid(e: NoBidEvent, trackers?: Array<string>): void;
441
+ export { SurfsideCommercePlugin, commerceAction, setCommerceAction, commerceTransactionContext, addTransaction, commerceImpressionContext, addImpression, commerceProductContext, addProduct, commercePromoContext, addPromotion, sourceContext, source, segmentContext, segment, removeSegment, localBusinessLocationContext, setLocation, removeLocation, userContext, setUser, SurfIdContextRequest, setSurfId, identifyUserContext, identifyUser, auctionInit, bidRequested, bidResponse, bidderDone, bidderError, noBid };
@@ -1,8 +1,9 @@
1
1
  /*!
2
- * Surfside Digital Analytics v0.0.1 (https://surfside.io)
2
+ * Surfside Digital Analytics > Custom Events v2.1.0 (https://surfside.io)
3
3
  * Copyright 2022 Surfside Solutions Inc, Snowplow Analytics Ltd, 2010 Anthon Pang
4
4
  */
5
5
 
6
+ import { __awaiter, __generator } from 'tslib';
6
7
  import { dispatchToTrackersInCollection, parseAndValidateFloat, parseAndValidateInt } from '@surfside/browser-core';
7
8
  import { buildSelfDescribingEvent } from '@surfside/digital-core';
8
9
 
@@ -215,6 +216,13 @@ function segment(context, trackers) {
215
216
  if (context === void 0) { context = {}; }
216
217
  if (trackers === void 0) { trackers = Object.keys(_trackers); }
217
218
  var segmentId = context.segmentId, segmentVal = context.segmentVal;
219
+ var currentSegment = {
220
+ segmentId: segmentId,
221
+ segmentVal: segmentVal
222
+ };
223
+ if (window.surf.surfSegment !== undefined) {
224
+ removeSegment(window.surf.surfSegment);
225
+ }
218
226
  dispatchToTrackersInCollection(trackers, _trackers, function (t) {
219
227
  _context[t.id].length = 0;
220
228
  t.core.addGlobalContexts([
@@ -227,6 +235,103 @@ function segment(context, trackers) {
227
235
  },
228
236
  ]);
229
237
  });
238
+ window.surf.surfSegment = currentSegment;
239
+ }
240
+ /**
241
+ * Removes a Surfside Segment Context
242
+ *
243
+ * @param context - The context to be stored
244
+ * @param trackers - The tracker identifiers which the context will be stored against
245
+ */
246
+ function removeSegment(context, trackers) {
247
+ if (context === void 0) { context = {}; }
248
+ if (trackers === void 0) { trackers = Object.keys(_trackers); }
249
+ var segmentId = context.segmentId, segmentVal = context.segmentVal;
250
+ dispatchToTrackersInCollection(trackers, _trackers, function (t) {
251
+ _context[t.id].length = 0;
252
+ t.core.removeGlobalContexts([
253
+ {
254
+ schema: 'iglu:io.surfside/segment/jsonschema/1-0-0',
255
+ data: {
256
+ segmentId: segmentId,
257
+ segmentVal: segmentVal
258
+ }
259
+ },
260
+ ]);
261
+ });
262
+ }
263
+ /**
264
+ * Adds a Surfside Local Business Location Context
265
+ *
266
+ * @param context - The context to be stored
267
+ * @param trackers - The tracker identifiers which the context will be stored against
268
+ */
269
+ //check if location is already set, so check if window surf exists, if it's the same, if it isn't remove and update
270
+ function setLocation(context, trackers) {
271
+ if (context === void 0) { context = {}; }
272
+ if (trackers === void 0) { trackers = Object.keys(_trackers); }
273
+ var id = context.id, latitude = context.latitude, longitude = context.longitude, country_code = context.country_code, zip = context.zip, state_label = context.state_label, state = context.state, city = context.city, street = context.street, name = context.name, parent = context.parent, type = context.type, category = context.category;
274
+ if (window.surf.currentLocation !== undefined) {
275
+ removeLocation(window.surf.currentLocation);
276
+ }
277
+ dispatchToTrackersInCollection(trackers, _trackers, function (t) {
278
+ _context[t.id].length = 0;
279
+ t.core.addGlobalContexts([
280
+ {
281
+ schema: 'iglu:io.surfside.local-business/location/jsonschema/1-0-0',
282
+ data: {
283
+ id: id,
284
+ latitude: latitude,
285
+ longitude: longitude,
286
+ country_code: country_code,
287
+ zip: zip,
288
+ state_label: state_label,
289
+ state: state,
290
+ city: city,
291
+ street: street,
292
+ name: name,
293
+ parent: parent,
294
+ type: type,
295
+ category: category
296
+ }
297
+ },
298
+ ]);
299
+ });
300
+ window.surf.currentLocation = context;
301
+ }
302
+ /**
303
+ * Removes a Surfside Local Business Location Context
304
+ *
305
+ * @param context - The context to be stored
306
+ * @param trackers - The tracker identifiers which the context will be stored against
307
+ */
308
+ function removeLocation(context, trackers) {
309
+ if (context === void 0) { context = {}; }
310
+ if (trackers === void 0) { trackers = Object.keys(_trackers); }
311
+ var id = context.id, latitude = context.latitude, longitude = context.longitude, country_code = context.country_code, zip = context.zip, state_label = context.state_label, state = context.state, city = context.city, street = context.street, name = context.name, parent = context.parent, type = context.type, category = context.category;
312
+ dispatchToTrackersInCollection(trackers, _trackers, function (t) {
313
+ _context[t.id].length = 0;
314
+ t.core.removeGlobalContexts([
315
+ {
316
+ schema: 'iglu:io.surfside.local-business/location/jsonschema/1-0-0',
317
+ data: {
318
+ id: id,
319
+ latitude: latitude,
320
+ longitude: longitude,
321
+ country_code: country_code,
322
+ zip: zip,
323
+ state_label: state_label,
324
+ state: state,
325
+ city: city,
326
+ street: street,
327
+ name: name,
328
+ parent: parent,
329
+ type: type,
330
+ category: category
331
+ }
332
+ },
333
+ ]);
334
+ });
230
335
  }
231
336
  /**
232
337
  * Adds a Surfside User Context
@@ -237,7 +342,7 @@ function segment(context, trackers) {
237
342
  function setUser(context, trackers) {
238
343
  if (context === void 0) { context = {}; }
239
344
  if (trackers === void 0) { trackers = Object.keys(_trackers); }
240
- var address = context.address, age = context.age, company = context.company, createdAt = context.createdAt, dateOfBirth = context.dateOfBirth, email = context.email, firstName = context.firstName, gender = context.gender, userId = context.userId, lastName = context.lastName;
345
+ var address = context.address, age = context.age, company = context.company, createdAt = context.createdAt, dateOfBirth = context.dateOfBirth, email = context.email, firstName = context.firstName, gender = context.gender, userId = context.userId, lastName = context.lastName, phone = context.phone;
241
346
  trackers.forEach(function (trackerId) {
242
347
  if (_context[trackerId]) {
243
348
  _context[trackerId].push({
@@ -252,12 +357,64 @@ function setUser(context, trackers) {
252
357
  firstName: firstName,
253
358
  gender: gender,
254
359
  userId: userId,
255
- lastName: lastName
360
+ lastName: lastName,
361
+ phone: phone
256
362
  }
257
363
  });
258
364
  }
259
365
  });
260
366
  }
367
+ function setSurfId(context, trackers) {
368
+ var _this = this;
369
+ if (context === void 0) { context = {}; }
370
+ if (trackers === void 0) { trackers = Object.keys(_trackers); }
371
+ var query;
372
+ if (context.email) {
373
+ query = "email=".concat(context.email);
374
+ }
375
+ else if (context.phone) {
376
+ query = "phone=".concat(context.phone);
377
+ }
378
+ else {
379
+ return;
380
+ }
381
+ fetch("//i.surfside.io/id?".concat(query)).then(function (response) { return __awaiter(_this, void 0, void 0, function () {
382
+ var data, status, body, token;
383
+ var _a;
384
+ return __generator(this, function (_b) {
385
+ switch (_b.label) {
386
+ case 0: return [4 /*yield*/, response.json()];
387
+ case 1:
388
+ data = _b.sent();
389
+ status = data === null || data === void 0 ? void 0 : data.status;
390
+ if (status !== 'success') {
391
+ return [2 /*return*/];
392
+ }
393
+ body = data === null || data === void 0 ? void 0 : data.body;
394
+ if (!body || body.length === 0) {
395
+ return [2 /*return*/];
396
+ }
397
+ token = (_a = body[0]) === null || _a === void 0 ? void 0 : _a.advertisingToken;
398
+ if (!token) {
399
+ return [2 /*return*/];
400
+ }
401
+ localStorage.setItem('surf_uid2', token);
402
+ dispatchToTrackersInCollection(trackers, _trackers, function (t) {
403
+ _context[t.id].length = 0;
404
+ t.core.addGlobalContexts([
405
+ {
406
+ schema: 'iglu:io.surfside/uid2_context/jsonschema/1-0-0',
407
+ data: {
408
+ uid2: token
409
+ }
410
+ },
411
+ ]);
412
+ });
413
+ return [2 /*return*/];
414
+ }
415
+ });
416
+ }); });
417
+ }
261
418
  /**
262
419
  * Adds a Surfside Context
263
420
  *
@@ -293,6 +450,239 @@ function identifyUser(context, trackers) {
293
450
  }
294
451
  });
295
452
  }
453
+ function auctionInit(e, trackers) {
454
+ if (trackers === void 0) { trackers = Object.keys(_trackers); }
455
+ dispatchToTrackersInCollection(trackers, _trackers, function (t) {
456
+ var combinedContexts = _context[t.id].concat(e.context || []);
457
+ _context[t.id].length = 0;
458
+ t.core.track(buildSelfDescribingEvent({
459
+ event: {
460
+ schema: 'iglu:io.surfside.advertising/auction_init/jsonschema/1-0-0',
461
+ data: {
462
+ auctionId: e.auctionId,
463
+ timestamp: e.timestamp,
464
+ auctionStatus: e.auctionStatus,
465
+ adUnits: e.adUnits.map(function (unit) {
466
+ return {
467
+ requestId: unit.requestId,
468
+ mediaTypes: unit.mediaTypes,
469
+ bids: unit.bids.map(function (bid) {
470
+ return {
471
+ params: bid.params,
472
+ user: bid.user
473
+ };
474
+ }),
475
+ timeout: unit.timeout,
476
+ sizes: unit.sizes,
477
+ transactionId: unit.transactionId
478
+ };
479
+ }),
480
+ bidderRequests: e.bidderRequests.map(function (req) {
481
+ return {
482
+ bidderRequestId: req.bidderRequestId,
483
+ bids: req.bids.map(function (bid) {
484
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
485
+ return {
486
+ ortb2: {
487
+ site: {
488
+ page: (_b = (_a = bid.ortb2) === null || _a === void 0 ? void 0 : _a.site) === null || _b === void 0 ? void 0 : _b.page,
489
+ domain: (_d = (_c = bid.ortb2) === null || _c === void 0 ? void 0 : _c.site) === null || _d === void 0 ? void 0 : _d.domain
490
+ },
491
+ device: {
492
+ w: (_f = (_e = bid.ortb2) === null || _e === void 0 ? void 0 : _e.device) === null || _f === void 0 ? void 0 : _f.w,
493
+ h: (_h = (_g = bid.ortb2) === null || _g === void 0 ? void 0 : _g.device) === null || _h === void 0 ? void 0 : _h.h,
494
+ dnt: (_k = (_j = bid.ortb2) === null || _j === void 0 ? void 0 : _j.device) === null || _k === void 0 ? void 0 : _k.dnt,
495
+ ua: (_m = (_l = bid.ortb2) === null || _l === void 0 ? void 0 : _l.device) === null || _m === void 0 ? void 0 : _m.ua,
496
+ language: (_p = (_o = bid.ortb2) === null || _o === void 0 ? void 0 : _o.device) === null || _p === void 0 ? void 0 : _p.language
497
+ }
498
+ }
499
+ };
500
+ }),
501
+ auctionStart: req.auctionStart,
502
+ timeout: req.timeout,
503
+ refererInfo: {
504
+ stack: req.refererInfo.stack,
505
+ location: req.refererInfo.location,
506
+ page: req.refererInfo.page,
507
+ domain: req.refererInfo.domain
508
+ }
509
+ };
510
+ })
511
+ }
512
+ }
513
+ }), combinedContexts, e.timestamp);
514
+ });
515
+ }
516
+ function bidRequested(e, trackers) {
517
+ if (trackers === void 0) { trackers = Object.keys(_trackers); }
518
+ dispatchToTrackersInCollection(trackers, _trackers, function (t) {
519
+ t.core.track(buildSelfDescribingEvent({
520
+ event: {
521
+ schema: 'iglu:io.surfside.advertising/bid_requested/jsonschema/1-0-0',
522
+ data: {
523
+ auctionId: e.auctionId,
524
+ bidderRequestId: e.bidderRequestId,
525
+ bids: e.bids.map(function (bid) {
526
+ return {
527
+ params: bid.params,
528
+ user: bid.user,
529
+ ortb2Imp: bid.ortb2Imp,
530
+ mediaTypes: bid.mediaTypes,
531
+ transactionId: bid.transactionId,
532
+ sizes: bid.sizes,
533
+ bidId: bid.bidId,
534
+ ortb2: {
535
+ site: {
536
+ page: bid.ortb2.site.page,
537
+ domain: bid.ortb2.site.domain
538
+ },
539
+ device: bid.ortb2.device
540
+ }
541
+ };
542
+ }),
543
+ auctionStart: e.auctionStart,
544
+ timeout: e.timeout,
545
+ refererInfo: e.refererInfo,
546
+ start: e.start
547
+ }
548
+ }
549
+ }));
550
+ });
551
+ }
552
+ function bidResponse(e, trackers) {
553
+ if (trackers === void 0) { trackers = Object.keys(_trackers); }
554
+ dispatchToTrackersInCollection(trackers, _trackers, function (t) {
555
+ var _a, _b;
556
+ t.core.track(buildSelfDescribingEvent({
557
+ event: {
558
+ schema: 'iglu:io.surfside.advertising/bid_response/jsonschema/1-0-0',
559
+ data: {
560
+ width: e.width,
561
+ height: e.height,
562
+ statusMessage: e.statusMessage,
563
+ adId: e.adId,
564
+ requestId: e.requestId,
565
+ transactionId: e.transactionId,
566
+ auctionId: e.auctionId,
567
+ mediaType: e.mediaType,
568
+ ad: e.ad,
569
+ seatBidId: e.seatBidId,
570
+ cpm: e.cpm,
571
+ currency: e.currency,
572
+ creative_id: e.creative_id,
573
+ creativeId: e.creativeId,
574
+ ttl: e.ttl,
575
+ netRevenue: e.netRevenue,
576
+ meta: {
577
+ advertiserDomains: (_a = e === null || e === void 0 ? void 0 : e.meta) === null || _a === void 0 ? void 0 : _a.advertiserDomains
578
+ },
579
+ originalRequest: {
580
+ ext: e.originalRequest.ext,
581
+ id: e.originalRequest.id,
582
+ banner: (_b = e.originalRequest) === null || _b === void 0 ? void 0 : _b.banner
583
+ },
584
+ originalCpm: e.originalCpm,
585
+ originalCurrency: e.originalCurrency,
586
+ responseTimestamp: e.responseTimestamp,
587
+ requestTimestamp: e.requestTimestamp,
588
+ timeToRespond: e.timeToRespond,
589
+ size: e.size
590
+ }
591
+ }
592
+ }));
593
+ });
594
+ }
595
+ function bidderDone(e, trackers) {
596
+ if (trackers === void 0) { trackers = Object.keys(_trackers); }
597
+ dispatchToTrackersInCollection(trackers, _trackers, function (t) {
598
+ t.core.track(buildSelfDescribingEvent({
599
+ event: {
600
+ schema: 'iglu:io.surfside.advertising/bidder_done/jsonschema/1-0-0',
601
+ data: {
602
+ auctionId: e.auctionId,
603
+ bidderRequestId: e.bidderRequestId,
604
+ bids: e.bids.map(function (bid) {
605
+ return {
606
+ params: bid.params,
607
+ user: bid.user,
608
+ ortb2Imp: bid.ortb2Imp,
609
+ mediaTypes: bid.mediaTypes,
610
+ transactionId: bid.transactionId,
611
+ sizes: bid.sizes,
612
+ bidId: bid.bidId,
613
+ ortb2: {
614
+ site: {
615
+ page: bid.ortb2.site.page,
616
+ domain: bid.ortb2.site.domain
617
+ },
618
+ device: bid.ortb2.device
619
+ }
620
+ };
621
+ }),
622
+ auctionStart: e.auctionStart,
623
+ timeout: e.timeout,
624
+ refererInfo: e.refererInfo,
625
+ start: e.start
626
+ }
627
+ }
628
+ }));
629
+ });
630
+ }
631
+ function bidderError(e, trackers) {
632
+ if (trackers === void 0) { trackers = Object.keys(_trackers); }
633
+ dispatchToTrackersInCollection(trackers, _trackers, function (t) {
634
+ t.core.track(buildSelfDescribingEvent({
635
+ event: {
636
+ schema: 'iglu:io.surfside.advertising/bidder_error/jsonschema/1-0-0',
637
+ data: {
638
+ error: e.error,
639
+ auctionId: e.bidderRequest.auctionId,
640
+ bidderRequestId: e.bidderRequest.bidderRequestId,
641
+ bids: e.bidderRequest.bids.map(function (bid) {
642
+ return {
643
+ params: bid.params,
644
+ user: bid.user,
645
+ ortb2Imp: bid.ortb2Imp,
646
+ mediaTypes: bid.mediaTypes,
647
+ transactionId: bid.transactionId,
648
+ sizes: bid.sizes,
649
+ bidId: bid.bidId,
650
+ ortb2: {
651
+ site: {
652
+ page: bid.ortb2.site.page,
653
+ domain: bid.ortb2.site.domain
654
+ },
655
+ device: bid.ortb2.device
656
+ }
657
+ };
658
+ }),
659
+ auctionStart: e.bidderRequest.auctionStart,
660
+ timeout: e.bidderRequest.timeout,
661
+ refererInfo: e.bidderRequest.refererInfo,
662
+ start: e.bidderRequest.start
663
+ }
664
+ }
665
+ }));
666
+ });
667
+ }
668
+ function noBid(e, trackers) {
669
+ if (trackers === void 0) { trackers = Object.keys(_trackers); }
670
+ dispatchToTrackersInCollection(trackers, _trackers, function (t) {
671
+ t.core.track(buildSelfDescribingEvent({
672
+ event: {
673
+ schema: 'iglu:io.surfside.advertising/no_bid/jsonschema/1-0-0',
674
+ data: {
675
+ auctionId: e.auctionId,
676
+ bidderRequestId: e.bidderRequestId,
677
+ auctionStart: e.auctionStart,
678
+ timeout: e.timeout,
679
+ refererInfo: e.refererInfo,
680
+ start: e.start
681
+ }
682
+ }
683
+ }));
684
+ });
685
+ }
296
686
 
297
- export { SurfsideCommercePlugin, addImpression, addProduct, addPromotion, addTransaction, identifyUser, segment, setCommerceAction, setUser, source };
687
+ export { SurfsideCommercePlugin, addImpression, addProduct, addPromotion, addTransaction, auctionInit, bidRequested, bidResponse, bidderDone, bidderError, identifyUser, noBid, removeLocation, removeSegment, segment, setCommerceAction, setLocation, setSurfId, setUser, source };
298
688
  //# sourceMappingURL=index.module.js.map