coveo.analytics 2.25.3 → 2.26.2

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.
@@ -49,6 +49,7 @@ export interface AnalyticsClient {
49
49
  version: string;
50
50
  readonly currentVisitorId: string;
51
51
  getCurrentVisitorId?(): Promise<string>;
52
+ setAcceptedLinkReferrers?(hosts: string[]): void;
52
53
  }
53
54
  export interface BufferedRequest {
54
55
  eventType: EventType;
@@ -65,6 +66,7 @@ export declare class CoveoAnalyticsClient implements AnalyticsClient, VisitorIdP
65
66
  private afterSendHooks;
66
67
  private eventTypeMapping;
67
68
  private options;
69
+ private acceptedLinkReferrers;
68
70
  constructor(opts: Partial<ClientOptions>);
69
71
  private initRuntime;
70
72
  private get storage();
@@ -76,6 +78,7 @@ export declare class CoveoAnalyticsClient implements AnalyticsClient, VisitorIdP
76
78
  getPayload(eventType: EventType | string, ...payload: VariableArgumentsPayload): Promise<any>;
77
79
  get currentVisitorId(): string;
78
80
  set currentVisitorId(visitorId: string);
81
+ private extractClientIdFromLink;
79
82
  resolveParameters(eventType: EventType | string, ...payload: VariableArgumentsPayload): Promise<VariableArgumentsPayload>;
80
83
  resolvePayloadForParameters(eventType: EventType | string, parameters: any): Promise<any>;
81
84
  makeEvent<TPreparedRequest, TCompleteRequest, TResponse extends AnyEventResponse>(eventType: EventType | string, ...payload: VariableArgumentsPayload): Promise<PreparedEvent<TPreparedRequest, TCompleteRequest, TResponse>>;
@@ -97,6 +100,7 @@ export declare class CoveoAnalyticsClient implements AnalyticsClient, VisitorIdP
97
100
  registerBeforeSendEventHook(hook: AnalyticsClientSendEventHook): void;
98
101
  registerAfterSendEventHook(hook: AnalyticsClientSendEventHook): void;
99
102
  addEventTypeMapping(eventType: string, eventConfig: EventTypeConfig): void;
103
+ setAcceptedLinkReferrers(hosts: string[]): void;
100
104
  private parseVariableArgumentsPayload;
101
105
  private isKeyAllowedEmpty;
102
106
  private removeEmptyPayloadValues;
@@ -1,8 +1,4 @@
1
- import { PluginClass, PluginOptions, BasePlugin } from '../plugins/BasePlugin';
2
- export declare type UAPluginOptions = any[];
3
- export declare type Plugin = BasePlugin & {
4
- [propName: string]: unknown;
5
- };
1
+ import { PluginClass, PluginOptions } from '../plugins/BasePlugin';
6
2
  export declare class Plugins {
7
3
  static readonly DefaultPlugins: string[];
8
4
  private registeredPluginsMap;
@@ -10,5 +6,5 @@ export declare class Plugins {
10
6
  require(name: string, options: PluginOptions): void;
11
7
  provide(name: string, plugin: PluginClass): void;
12
8
  clearRequired(): void;
13
- execute(name: string, fn: string, ...pluginOptions: UAPluginOptions): any;
9
+ execute(name: string, fn: string, ...args: any[]): any;
14
10
  }
@@ -21,7 +21,7 @@ export declare class CoveoUA {
21
21
  onLoad(callback: Function): void;
22
22
  provide(name: string, plugin: PluginClass): void;
23
23
  require(name: string, options: Omit<PluginOptions, 'client'>): void;
24
- callPlugin(pluginName: string, fn: string, ...args: any): void;
24
+ callPlugin(pluginName: string, fn: string, ...args: any): any;
25
25
  reset(): void;
26
26
  version(): string;
27
27
  }
@@ -3,7 +3,7 @@ import { v4 as uuidv4 } from 'uuid';
3
3
  declare type PluginWithId = {
4
4
  readonly Id: string;
5
5
  };
6
- export declare type PluginClass = typeof BasePlugin & PluginWithId;
6
+ export declare type PluginClass = typeof Plugin & PluginWithId;
7
7
  export declare const BasePluginEventTypes: {
8
8
  pageview: string;
9
9
  event: string;
@@ -12,9 +12,13 @@ export declare type PluginOptions = {
12
12
  client: AnalyticsClient;
13
13
  uuidGenerator?: typeof uuidv4;
14
14
  };
15
- export declare abstract class BasePlugin {
15
+ export declare abstract class Plugin {
16
16
  protected client: AnalyticsClient;
17
17
  protected uuidGenerator: typeof uuidv4;
18
+ constructor({ client, uuidGenerator }: PluginOptions);
19
+ abstract getApi(name: string): any;
20
+ }
21
+ export declare abstract class BasePlugin extends Plugin {
18
22
  protected action?: string;
19
23
  protected actionData: {
20
24
  [name: string]: string;
@@ -27,6 +31,7 @@ export declare abstract class BasePlugin {
27
31
  constructor({ client, uuidGenerator }: PluginOptions);
28
32
  protected abstract addHooks(): void;
29
33
  protected abstract clearPluginData(): void;
34
+ getApi(name: string): Function | null;
30
35
  setAction(action: string, options?: any): void;
31
36
  clearData(): void;
32
37
  getLocationInformation(eventType: string, payload: any): {
@@ -35,7 +40,7 @@ export declare abstract class BasePlugin {
35
40
  location: string;
36
41
  hitType: string;
37
42
  };
38
- updateLocationInformation(eventType: string, payload: any): void;
43
+ protected updateLocationInformation(eventType: string, payload: any): void;
39
44
  getDefaultContextInformation(eventType: string): {
40
45
  title: string;
41
46
  encoding: string;
@@ -47,6 +47,7 @@ export declare class ECPlugin extends BasePlugin {
47
47
  private products;
48
48
  private impressions;
49
49
  constructor({ client, uuidGenerator }: PluginOptions);
50
+ getApi(name: string): Function | null;
50
51
  protected addHooks(): void;
51
52
  addProduct(product: Product): void;
52
53
  addImpression(impression: Impression): void;
@@ -0,0 +1,21 @@
1
+ import { Plugin, PluginOptions, PluginClass } from './BasePlugin';
2
+ export declare class CoveoLinkParam {
3
+ static readonly cvo_cid: string;
4
+ private static readonly expirationTime;
5
+ readonly clientId: string;
6
+ readonly creationDate: number;
7
+ constructor(clientId: string, timestamp: number);
8
+ toString(): string;
9
+ get expired(): boolean;
10
+ validate(referrerString: string, referrerList: string[]): boolean;
11
+ private matchReferrer;
12
+ static fromString(input: string): CoveoLinkParam | null;
13
+ }
14
+ export declare class LinkPlugin extends Plugin {
15
+ static readonly Id = "link";
16
+ constructor({ client, uuidGenerator }: PluginOptions);
17
+ getApi(name: string): Function | null;
18
+ decorate(urlString: string): Promise<string>;
19
+ acceptFrom(acceptedReferrers: string[]): void;
20
+ }
21
+ export declare const Link: PluginClass;
@@ -19,6 +19,7 @@ export declare class SVCPlugin extends BasePlugin {
19
19
  static readonly Id = "svc";
20
20
  private ticket;
21
21
  constructor({ client, uuidGenerator }: PluginOptions);
22
+ getApi(name: string): Function | null;
22
23
  protected addHooks(): void;
23
24
  setTicket(ticket: Ticket): void;
24
25
  protected clearPluginData(): void;
@@ -1,8 +1,4 @@
1
- import { PluginClass, PluginOptions, BasePlugin } from '../plugins/BasePlugin';
2
- export declare type UAPluginOptions = any[];
3
- export declare type Plugin = BasePlugin & {
4
- [propName: string]: unknown;
5
- };
1
+ import { PluginClass, PluginOptions } from '../plugins/BasePlugin';
6
2
  export declare class Plugins {
7
3
  static readonly DefaultPlugins: string[];
8
4
  private registeredPluginsMap;
@@ -10,5 +6,5 @@ export declare class Plugins {
10
6
  require(name: string, options: PluginOptions): void;
11
7
  provide(name: string, plugin: PluginClass): void;
12
8
  clearRequired(): void;
13
- execute(name: string, fn: string, ...pluginOptions: UAPluginOptions): any;
9
+ execute(name: string, fn: string, ...args: any[]): any;
14
10
  }
@@ -21,7 +21,7 @@ export declare class CoveoUA {
21
21
  onLoad(callback: Function): void;
22
22
  provide(name: string, plugin: PluginClass): void;
23
23
  require(name: string, options: Omit<PluginOptions, 'client'>): void;
24
- callPlugin(pluginName: string, fn: string, ...args: any): void;
24
+ callPlugin(pluginName: string, fn: string, ...args: any): any;
25
25
  reset(): void;
26
26
  version(): string;
27
27
  }
@@ -47,6 +47,7 @@ export declare class ECPlugin extends BasePlugin {
47
47
  private products;
48
48
  private impressions;
49
49
  constructor({ client, uuidGenerator }: PluginOptions);
50
+ getApi(name: string): Function | null;
50
51
  protected addHooks(): void;
51
52
  addProduct(product: Product): void;
52
53
  addImpression(impression: Impression): void;
@@ -1 +1 @@
1
- export declare const libVersion = "2.25.3";
1
+ export declare const libVersion = "2.26.2";
@@ -415,7 +415,7 @@ function stringToBytes(str) {
415
415
  }
416
416
 
417
417
  const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
418
- const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
418
+ const URL$1 = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
419
419
  function v35(name, version, hashfunc) {
420
420
  function generateUUID(value, namespace, buf, offset) {
421
421
  var _namespace;
@@ -462,7 +462,7 @@ function v35(name, version, hashfunc) {
462
462
 
463
463
 
464
464
  generateUUID.DNS = DNS;
465
- generateUUID.URL = URL;
465
+ generateUUID.URL = URL$1;
466
466
  return generateUUID;
467
467
  }
468
468
 
@@ -593,7 +593,197 @@ function sha1(bytes) {
593
593
  const v5 = v35('v5', 0x50, sha1);
594
594
  var uuidv5 = v5;
595
595
 
596
- const libVersion = "2.25.3" ;
596
+ const libVersion = "2.26.2" ;
597
+
598
+ const getFormattedLocation = (location) => `${location.protocol}//${location.hostname}${location.pathname.indexOf('/') === 0 ? location.pathname : `/${location.pathname}`}${location.search}`;
599
+
600
+ const BasePluginEventTypes = {
601
+ pageview: 'pageview',
602
+ event: 'event',
603
+ };
604
+ class Plugin {
605
+ constructor({ client, uuidGenerator = v4 }) {
606
+ this.client = client;
607
+ this.uuidGenerator = uuidGenerator;
608
+ }
609
+ }
610
+ class BasePlugin extends Plugin {
611
+ constructor({ client, uuidGenerator = v4 }) {
612
+ super({ client, uuidGenerator });
613
+ this.actionData = {};
614
+ this.pageViewId = uuidGenerator();
615
+ this.nextPageViewId = this.pageViewId;
616
+ this.currentLocation = getFormattedLocation(window.location);
617
+ this.lastReferrer = hasDocument() ? document.referrer : '';
618
+ this.addHooks();
619
+ }
620
+ getApi(name) {
621
+ switch (name) {
622
+ case 'setAction':
623
+ return this.setAction;
624
+ default:
625
+ return null;
626
+ }
627
+ }
628
+ setAction(action, options) {
629
+ this.action = action;
630
+ this.actionData = options;
631
+ }
632
+ clearData() {
633
+ this.clearPluginData();
634
+ this.action = undefined;
635
+ this.actionData = {};
636
+ }
637
+ getLocationInformation(eventType, payload) {
638
+ return Object.assign({ hitType: eventType }, this.getNextValues(eventType, payload));
639
+ }
640
+ updateLocationInformation(eventType, payload) {
641
+ this.updateLocationForNextPageView(eventType, payload);
642
+ }
643
+ getDefaultContextInformation(eventType) {
644
+ const documentContext = {
645
+ title: hasDocument() ? document.title : '',
646
+ encoding: hasDocument() ? document.characterSet : 'UTF-8',
647
+ };
648
+ const screenContext = {
649
+ screenResolution: `${screen.width}x${screen.height}`,
650
+ screenColor: `${screen.colorDepth}-bit`,
651
+ };
652
+ const navigatorContext = {
653
+ language: navigator.language,
654
+ userAgent: navigator.userAgent,
655
+ };
656
+ const eventContext = {
657
+ time: Date.now(),
658
+ eventId: this.uuidGenerator(),
659
+ };
660
+ return Object.assign(Object.assign(Object.assign(Object.assign({}, eventContext), screenContext), navigatorContext), documentContext);
661
+ }
662
+ updateLocationForNextPageView(eventType, payload) {
663
+ const { pageViewId, referrer, location } = this.getNextValues(eventType, payload);
664
+ this.lastReferrer = referrer;
665
+ this.pageViewId = pageViewId;
666
+ this.currentLocation = location;
667
+ if (eventType === BasePluginEventTypes.pageview) {
668
+ this.nextPageViewId = this.uuidGenerator();
669
+ this.hasSentFirstPageView = true;
670
+ }
671
+ }
672
+ getNextValues(eventType, payload) {
673
+ return {
674
+ pageViewId: eventType === BasePluginEventTypes.pageview ? this.nextPageViewId : this.pageViewId,
675
+ referrer: eventType === BasePluginEventTypes.pageview && this.hasSentFirstPageView
676
+ ? this.currentLocation
677
+ : this.lastReferrer,
678
+ location: eventType === BasePluginEventTypes.pageview
679
+ ? this.getCurrentLocationFromPayload(payload)
680
+ : this.currentLocation,
681
+ };
682
+ }
683
+ getCurrentLocationFromPayload(payload) {
684
+ if (!!payload.page) {
685
+ const removeStartingSlash = (page) => page.replace(/^\/?(.*)$/, '/$1');
686
+ const extractHostnamePart = (location) => location.split('/').slice(0, 3).join('/');
687
+ return `${extractHostnamePart(this.currentLocation)}${removeStartingSlash(payload.page)}`;
688
+ }
689
+ else {
690
+ return getFormattedLocation(window.location);
691
+ }
692
+ }
693
+ }
694
+
695
+ class CoveoLinkParam {
696
+ constructor(clientId, timestamp) {
697
+ if (!validate(clientId))
698
+ throw Error('Not a valid uuid');
699
+ this.clientId = clientId;
700
+ this.creationDate = Math.floor(timestamp / 1000);
701
+ }
702
+ toString() {
703
+ return this.clientId.replace(/-/g, '') + '.' + this.creationDate.toString();
704
+ }
705
+ get expired() {
706
+ const age = Math.floor(Date.now() / 1000) - this.creationDate;
707
+ return age < 0 || age > CoveoLinkParam.expirationTime;
708
+ }
709
+ validate(referrerString, referrerList) {
710
+ return !this.expired && this.matchReferrer(referrerString, referrerList);
711
+ }
712
+ matchReferrer(referrerString, referrerList) {
713
+ try {
714
+ const url = new URL(referrerString);
715
+ return referrerList.some((value) => {
716
+ const hostRegExp = new RegExp(value.replace(/\\/g, '\\\\').replace(/\./g, '\\.').replace(/\*/g, '.*') + '$');
717
+ return hostRegExp.test(url.host);
718
+ });
719
+ }
720
+ catch (error) {
721
+ return false;
722
+ }
723
+ }
724
+ static fromString(input) {
725
+ const parts = input.split('.');
726
+ if (parts.length !== 2) {
727
+ return null;
728
+ }
729
+ const [clientIdPart, creationDate] = parts;
730
+ if (clientIdPart.length !== 32 || isNaN(parseInt(creationDate))) {
731
+ return null;
732
+ }
733
+ const clientId = clientIdPart.substring(0, 8) +
734
+ '-' +
735
+ clientIdPart.substring(8, 12) +
736
+ '-' +
737
+ clientIdPart.substring(12, 16) +
738
+ '-' +
739
+ clientIdPart.substring(16, 20) +
740
+ '-' +
741
+ clientIdPart.substring(20, 32);
742
+ if (validate(clientId)) {
743
+ return new CoveoLinkParam(clientId, Number.parseInt(creationDate) * 1000);
744
+ }
745
+ else {
746
+ return null;
747
+ }
748
+ }
749
+ }
750
+ CoveoLinkParam.cvo_cid = 'cvo_cid';
751
+ CoveoLinkParam.expirationTime = 120;
752
+ class LinkPlugin extends Plugin {
753
+ constructor({ client, uuidGenerator = v4 }) {
754
+ super({ client, uuidGenerator });
755
+ }
756
+ getApi(name) {
757
+ switch (name) {
758
+ case 'decorate':
759
+ return this.decorate;
760
+ case 'acceptFrom':
761
+ return this.acceptFrom;
762
+ default:
763
+ return null;
764
+ }
765
+ }
766
+ decorate(urlString) {
767
+ return __awaiter(this, void 0, void 0, function* () {
768
+ if (!this.client.getCurrentVisitorId) {
769
+ throw new Error('Could not retrieve current clientId');
770
+ }
771
+ try {
772
+ const url = new URL(urlString);
773
+ const clientId = yield this.client.getCurrentVisitorId();
774
+ url.searchParams.set(CoveoLinkParam.cvo_cid, new CoveoLinkParam(clientId, Date.now()).toString());
775
+ return url.toString();
776
+ }
777
+ catch (error) {
778
+ throw new Error('Invalid URL provided');
779
+ }
780
+ });
781
+ }
782
+ acceptFrom(acceptedReferrers) {
783
+ this.client.setAcceptedLinkReferrers(acceptedReferrers);
784
+ }
785
+ }
786
+ LinkPlugin.Id = 'link';
597
787
 
598
788
  const keysOf = Object.keys;
599
789
  function isObject(o) {
@@ -1018,6 +1208,7 @@ function buildBaseUrl(endpoint = Endpoints.default, apiVersion = Version) {
1018
1208
  const COVEO_NAMESPACE = '38824e1f-37f5-42d3-8372-a4b8fa9df946';
1019
1209
  class CoveoAnalyticsClient {
1020
1210
  constructor(opts) {
1211
+ this.acceptedLinkReferrers = [];
1021
1212
  if (!opts) {
1022
1213
  throw new Error('You have to pass options to this constructor');
1023
1214
  }
@@ -1070,7 +1261,9 @@ class CoveoAnalyticsClient {
1070
1261
  determineVisitorId() {
1071
1262
  return __awaiter(this, void 0, void 0, function* () {
1072
1263
  try {
1073
- return (yield this.storage.getItem('visitorId')) || v4();
1264
+ return (this.extractClientIdFromLink(window.location.href) ||
1265
+ (yield this.storage.getItem('visitorId')) ||
1266
+ v4());
1074
1267
  }
1075
1268
  catch (err) {
1076
1269
  console.log('Could not get visitor ID from the current runtime environment storage. Using a random ID instead.', err);
@@ -1128,6 +1321,25 @@ class CoveoAnalyticsClient {
1128
1321
  this.visitorId = visitorId;
1129
1322
  this.storage.setItem('visitorId', visitorId);
1130
1323
  }
1324
+ extractClientIdFromLink(urlString) {
1325
+ if (doNotTrack()) {
1326
+ return null;
1327
+ }
1328
+ try {
1329
+ const linkParam = new URL(urlString).searchParams.get(CoveoLinkParam.cvo_cid);
1330
+ if (linkParam == null) {
1331
+ return null;
1332
+ }
1333
+ const linker = CoveoLinkParam.fromString(linkParam);
1334
+ if (!linker || !hasDocument() || !linker.validate(document.referrer, this.acceptedLinkReferrers)) {
1335
+ return null;
1336
+ }
1337
+ return linker.clientId;
1338
+ }
1339
+ catch (error) {
1340
+ }
1341
+ return null;
1342
+ }
1131
1343
  resolveParameters(eventType, ...payload) {
1132
1344
  return __awaiter(this, void 0, void 0, function* () {
1133
1345
  const { variableLengthArgumentsNames = [], addVisitorIdParameter = false, usesMeasurementProtocol = false, addClientIdParameter = false, } = this.eventTypeMapping[eventType] || {};
@@ -1295,6 +1507,12 @@ class CoveoAnalyticsClient {
1295
1507
  addEventTypeMapping(eventType, eventConfig) {
1296
1508
  this.eventTypeMapping[eventType] = eventConfig;
1297
1509
  }
1510
+ setAcceptedLinkReferrers(hosts) {
1511
+ if (Array.isArray(hosts) && hosts.every((host) => typeof host == 'string'))
1512
+ this.acceptedLinkReferrers = hosts;
1513
+ else
1514
+ throw Error('Parameter should be an array of domain strings');
1515
+ }
1298
1516
  parseVariableArgumentsPayload(fieldsOrder, payload) {
1299
1517
  const parsedArguments = {};
1300
1518
  for (let i = 0, length = payload.length; i < length; i++) {
@@ -2312,90 +2530,6 @@ class CoveoSearchPageClient {
2312
2530
  }
2313
2531
  }
2314
2532
 
2315
- const getFormattedLocation = (location) => `${location.protocol}//${location.hostname}${location.pathname.indexOf('/') === 0 ? location.pathname : `/${location.pathname}`}${location.search}`;
2316
-
2317
- const BasePluginEventTypes = {
2318
- pageview: 'pageview',
2319
- event: 'event',
2320
- };
2321
- class BasePlugin {
2322
- constructor({ client, uuidGenerator = v4 }) {
2323
- this.actionData = {};
2324
- this.client = client;
2325
- this.uuidGenerator = uuidGenerator;
2326
- this.pageViewId = uuidGenerator();
2327
- this.nextPageViewId = this.pageViewId;
2328
- this.currentLocation = getFormattedLocation(window.location);
2329
- this.lastReferrer = hasDocument() ? document.referrer : '';
2330
- this.addHooks();
2331
- }
2332
- setAction(action, options) {
2333
- this.action = action;
2334
- this.actionData = options;
2335
- }
2336
- clearData() {
2337
- this.clearPluginData();
2338
- this.action = undefined;
2339
- this.actionData = {};
2340
- }
2341
- getLocationInformation(eventType, payload) {
2342
- return Object.assign({ hitType: eventType }, this.getNextValues(eventType, payload));
2343
- }
2344
- updateLocationInformation(eventType, payload) {
2345
- this.updateLocationForNextPageView(eventType, payload);
2346
- }
2347
- getDefaultContextInformation(eventType) {
2348
- const documentContext = {
2349
- title: hasDocument() ? document.title : '',
2350
- encoding: hasDocument() ? document.characterSet : 'UTF-8',
2351
- };
2352
- const screenContext = {
2353
- screenResolution: `${screen.width}x${screen.height}`,
2354
- screenColor: `${screen.colorDepth}-bit`,
2355
- };
2356
- const navigatorContext = {
2357
- language: navigator.language,
2358
- userAgent: navigator.userAgent,
2359
- };
2360
- const eventContext = {
2361
- time: Date.now(),
2362
- eventId: this.uuidGenerator(),
2363
- };
2364
- return Object.assign(Object.assign(Object.assign(Object.assign({}, eventContext), screenContext), navigatorContext), documentContext);
2365
- }
2366
- updateLocationForNextPageView(eventType, payload) {
2367
- const { pageViewId, referrer, location } = this.getNextValues(eventType, payload);
2368
- this.lastReferrer = referrer;
2369
- this.pageViewId = pageViewId;
2370
- this.currentLocation = location;
2371
- if (eventType === BasePluginEventTypes.pageview) {
2372
- this.nextPageViewId = this.uuidGenerator();
2373
- this.hasSentFirstPageView = true;
2374
- }
2375
- }
2376
- getNextValues(eventType, payload) {
2377
- return {
2378
- pageViewId: eventType === BasePluginEventTypes.pageview ? this.nextPageViewId : this.pageViewId,
2379
- referrer: eventType === BasePluginEventTypes.pageview && this.hasSentFirstPageView
2380
- ? this.currentLocation
2381
- : this.lastReferrer,
2382
- location: eventType === BasePluginEventTypes.pageview
2383
- ? this.getCurrentLocationFromPayload(payload)
2384
- : this.currentLocation,
2385
- };
2386
- }
2387
- getCurrentLocationFromPayload(payload) {
2388
- if (!!payload.page) {
2389
- const removeStartingSlash = (page) => page.replace(/^\/?(.*)$/, '/$1');
2390
- const extractHostnamePart = (location) => location.split('/').slice(0, 3).join('/');
2391
- return `${extractHostnamePart(this.currentLocation)}${removeStartingSlash(payload.page)}`;
2392
- }
2393
- else {
2394
- return getFormattedLocation(window.location);
2395
- }
2396
- }
2397
- }
2398
-
2399
2533
  const SVCPluginEventTypes = Object.assign({}, BasePluginEventTypes);
2400
2534
  const allSVCEventTypes = Object.keys(SVCPluginEventTypes).map((key) => SVCPluginEventTypes[key]);
2401
2535
  class SVCPlugin extends BasePlugin {
@@ -2403,6 +2537,17 @@ class SVCPlugin extends BasePlugin {
2403
2537
  super({ client, uuidGenerator });
2404
2538
  this.ticket = {};
2405
2539
  }
2540
+ getApi(name) {
2541
+ const superCall = super.getApi(name);
2542
+ if (superCall !== null)
2543
+ return superCall;
2544
+ switch (name) {
2545
+ case 'setTicket':
2546
+ return this.setTicket;
2547
+ default:
2548
+ return null;
2549
+ }
2550
+ }
2406
2551
  addHooks() {
2407
2552
  this.addHooksForEvent();
2408
2553
  this.addHooksForPageView();