@sitecore-cloudsdk/events 0.1.1 → 0.1.3

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 (80) hide show
  1. package/README.md +31 -24
  2. package/dist/cjs/package.json +1 -1
  3. package/dist/cjs/src/browser.d.ts +1 -1
  4. package/dist/cjs/src/lib/ep/EventApiClient.d.ts +18 -0
  5. package/dist/cjs/src/lib/{cdp → ep}/EventApiClient.js +3 -3
  6. package/dist/cjs/src/lib/eventStorage/addToEventQueue.d.ts +2 -2
  7. package/dist/cjs/src/lib/eventStorage/eventStorage.d.ts +7 -7
  8. package/dist/cjs/src/lib/eventStorage/eventStorage.js +2 -2
  9. package/dist/cjs/src/lib/events/base-event.d.ts +8 -8
  10. package/dist/cjs/src/lib/events/base-event.js +1 -1
  11. package/dist/cjs/src/lib/events/common-interfaces.d.ts +10 -18
  12. package/dist/cjs/src/lib/events/custom-event/custom-event.d.ts +17 -17
  13. package/dist/cjs/src/lib/events/custom-event/custom-event.js +2 -2
  14. package/dist/cjs/src/lib/events/custom-event/event.d.ts +4 -4
  15. package/dist/cjs/src/lib/events/custom-event/event.js +1 -1
  16. package/dist/cjs/src/lib/events/custom-event/eventServer.d.ts +5 -5
  17. package/dist/cjs/src/lib/events/custom-event/eventServer.js +1 -1
  18. package/dist/cjs/src/lib/events/custom-event/form.d.ts +3 -3
  19. package/dist/cjs/src/lib/events/custom-event/form.js +1 -1
  20. package/dist/cjs/src/lib/events/identity/identity-event.d.ts +20 -20
  21. package/dist/cjs/src/lib/events/identity/identity-event.js +3 -3
  22. package/dist/cjs/src/lib/events/identity/identity.d.ts +4 -4
  23. package/dist/cjs/src/lib/events/identity/identity.js +1 -1
  24. package/dist/cjs/src/lib/events/identity/identityServer.d.ts +5 -5
  25. package/dist/cjs/src/lib/events/identity/identityServer.js +1 -1
  26. package/dist/cjs/src/lib/events/index.d.ts +4 -4
  27. package/dist/cjs/src/lib/events/page-view/page-view-event.d.ts +25 -18
  28. package/dist/cjs/src/lib/events/page-view/page-view-event.js +21 -2
  29. package/dist/cjs/src/lib/events/page-view/page-view-server.d.ts +5 -5
  30. package/dist/cjs/src/lib/events/page-view/page-view-server.js +1 -1
  31. package/dist/cjs/src/lib/events/page-view/page-view.d.ts +5 -5
  32. package/dist/cjs/src/lib/events/page-view/page-view.js +1 -1
  33. package/dist/cjs/src/lib/initializer/browser/initializer.d.ts +7 -7
  34. package/dist/cjs/src/lib/initializer/browser/initializer.js +2 -2
  35. package/dist/cjs/src/lib/initializer/server/initializer.d.ts +8 -8
  36. package/dist/cjs/src/lib/initializer/server/initializer.js +2 -2
  37. package/dist/cjs/src/server.d.ts +2 -3
  38. package/dist/cjs/src/server.js +1 -3
  39. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  40. package/dist/esm/package.json +1 -1
  41. package/dist/esm/src/browser.d.ts +1 -1
  42. package/dist/esm/src/lib/ep/EventApiClient.d.ts +18 -0
  43. package/dist/esm/src/lib/{cdp → ep}/EventApiClient.js +3 -3
  44. package/dist/esm/src/lib/eventStorage/addToEventQueue.d.ts +2 -2
  45. package/dist/esm/src/lib/eventStorage/eventStorage.d.ts +7 -7
  46. package/dist/esm/src/lib/eventStorage/eventStorage.js +2 -2
  47. package/dist/esm/src/lib/events/base-event.d.ts +8 -8
  48. package/dist/esm/src/lib/events/base-event.js +1 -1
  49. package/dist/esm/src/lib/events/common-interfaces.d.ts +10 -18
  50. package/dist/esm/src/lib/events/custom-event/custom-event.d.ts +17 -17
  51. package/dist/esm/src/lib/events/custom-event/custom-event.js +2 -2
  52. package/dist/esm/src/lib/events/custom-event/event.d.ts +4 -4
  53. package/dist/esm/src/lib/events/custom-event/event.js +1 -1
  54. package/dist/esm/src/lib/events/custom-event/eventServer.d.ts +5 -5
  55. package/dist/esm/src/lib/events/custom-event/eventServer.js +1 -1
  56. package/dist/esm/src/lib/events/custom-event/form.d.ts +3 -3
  57. package/dist/esm/src/lib/events/custom-event/form.js +1 -1
  58. package/dist/esm/src/lib/events/identity/identity-event.d.ts +20 -20
  59. package/dist/esm/src/lib/events/identity/identity-event.js +3 -3
  60. package/dist/esm/src/lib/events/identity/identity.d.ts +4 -4
  61. package/dist/esm/src/lib/events/identity/identity.js +1 -1
  62. package/dist/esm/src/lib/events/identity/identityServer.d.ts +5 -5
  63. package/dist/esm/src/lib/events/identity/identityServer.js +1 -1
  64. package/dist/esm/src/lib/events/index.d.ts +4 -4
  65. package/dist/esm/src/lib/events/page-view/page-view-event.d.ts +25 -18
  66. package/dist/esm/src/lib/events/page-view/page-view-event.js +22 -3
  67. package/dist/esm/src/lib/events/page-view/page-view-server.d.ts +5 -5
  68. package/dist/esm/src/lib/events/page-view/page-view-server.js +1 -1
  69. package/dist/esm/src/lib/events/page-view/page-view.d.ts +5 -5
  70. package/dist/esm/src/lib/events/page-view/page-view.js +1 -1
  71. package/dist/esm/src/lib/initializer/browser/initializer.d.ts +7 -7
  72. package/dist/esm/src/lib/initializer/browser/initializer.js +2 -2
  73. package/dist/esm/src/lib/initializer/server/initializer.d.ts +8 -8
  74. package/dist/esm/src/lib/initializer/server/initializer.js +3 -3
  75. package/dist/esm/src/server.d.ts +2 -3
  76. package/dist/esm/src/server.js +0 -1
  77. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  78. package/package.json +1 -1
  79. package/dist/cjs/src/lib/cdp/EventApiClient.d.ts +0 -24
  80. package/dist/esm/src/lib/cdp/EventApiClient.d.ts +0 -24
package/README.md CHANGED
@@ -2,14 +2,13 @@
2
2
 
3
3
  © Sitecore Corporation A/S. All rights reserved. Sitecore© is a registered trademark of Sitecore Corporation A/S.
4
4
 
5
- This package provides browser- and server-side functions to ​capture events in your app and send them to Sitecore. Events are for collecting behavioral and transactional data about your users as they interact with your app.
5
+ This package provides browser- and server-side functions to ​capture events in your app and send them to Sitecore. Events are for collecting behavioral data about your users as they interact with your app.
6
6
 
7
7
  ## Prerequisites
8
8
 
9
- To use the Sitecore Cloud SDK, you need:
9
+ To use the Sitecore Cloud SDK, you need an XM Cloud project. This project has to be created from the [XM Cloud foundation template](https://github.com/sitecorelabs/xmcloud-foundation-head) and deployed on XM Cloud.
10
10
 
11
- - A Next.js 13 app deployed on Sitecore XM Cloud.
12
- - An XM Cloud Plus subscription.
11
+ The foundation template contains an XM Cloud JSS Next.js app. You use the Sitecore Cloud SDK in this app. To be able to use the Sitecore Cloud SDK, you need JSS version 21.6.0 or newer.
13
12
 
14
13
  ## Installation
15
14
 
@@ -28,12 +27,20 @@ npm install @sitecore-cloudsdk/events
28
27
 
29
28
  ## Code examples
30
29
 
30
+ ---
31
+
32
+ **NOTE**
33
+
34
+ These code examples illustrate how the Sitecore Cloud SDK works in a standalone Next.js app. In production, you implement Sitecore Cloud SDK functionality differently, in a JSS Next.js app. See code examples for that environment in the official documentation.
35
+
36
+ ---
37
+
31
38
  Capture and send a VIEW event from the browser side:
32
39
 
33
40
  ```ts
34
- "use client";
35
- import { useEffect } from "react";
36
- import { init, pageView } from "@sitecore-cloudsdk/events/browser";
41
+ 'use client';
42
+ import { useEffect } from 'react';
43
+ import { init, pageView } from '@sitecore-cloudsdk/events/browser';
37
44
 
38
45
  export default function Home() {
39
46
  useEffect(() => {
@@ -42,8 +49,8 @@ export default function Home() {
42
49
 
43
50
  const initEvents = async () => {
44
51
  await init({
45
- sitecoreEdgeContextId: process.env.NEXT_PUBLIC_SITECORE_EDGE_CONTEXT_ID || "",
46
- siteName: process.env.NEXT_PUBLIC_SITENAME || "",
52
+ sitecoreEdgeContextId: process.env.NEXT_PUBLIC_SITECORE_EDGE_CONTEXT_ID || '',
53
+ siteName: process.env.NEXT_PUBLIC_SITENAME || '',
47
54
  enableBrowserCookie: true,
48
55
  });
49
56
 
@@ -52,17 +59,17 @@ export default function Home() {
52
59
 
53
60
  const sendPageViewEvent = async () => {
54
61
  let eventData: any = {
55
- channel: "WEB",
56
- currency: "EUR",
62
+ channel: 'WEB',
63
+ currency: 'EUR',
57
64
  };
58
65
 
59
66
  let extensionData: any = {
60
- customKey: "customValue",
67
+ customKey: 'customValue',
61
68
  };
62
69
 
63
70
  await pageView(eventData, extensionData);
64
71
 
65
- console.log("Sent VIEW event.");
72
+ console.log('Sent VIEW event.');
66
73
  };
67
74
 
68
75
  return (
@@ -76,17 +83,17 @@ export default function Home() {
76
83
  Capture and send a VIEW event from the server side:
77
84
 
78
85
  ```ts
79
- import { NextResponse } from "next/server";
80
- import type { NextRequest } from "next/server";
81
- import { init, pageView } from "@sitecore-cloudsdk/events/server";
86
+ import { NextResponse } from 'next/server';
87
+ import type { NextRequest } from 'next/server';
88
+ import { init, pageView } from '@sitecore-cloudsdk/events/server';
82
89
 
83
90
  export async function middleware(req: NextRequest) {
84
91
  const res = NextResponse.next();
85
92
 
86
93
  await init(
87
94
  {
88
- sitecoreEdgeContextId: process.env.NEXT_PUBLIC_SITECORE_EDGE_CONTEXT_ID || "",
89
- siteName: process.env.NEXT_PUBLIC_SITENAME || "",
95
+ sitecoreEdgeContextId: process.env.NEXT_PUBLIC_SITECORE_EDGE_CONTEXT_ID || '',
96
+ siteName: process.env.NEXT_PUBLIC_SITENAME || '',
90
97
  enableServerCookie: true,
91
98
  },
92
99
  req,
@@ -96,17 +103,17 @@ export async function middleware(req: NextRequest) {
96
103
  console.log(`Initialized "@sitecore-cloudsdk/events/server".`);
97
104
 
98
105
  let eventData: any = {
99
- channel: "WEB",
100
- currency: "EUR",
106
+ channel: 'WEB',
107
+ currency: 'EUR',
101
108
  };
102
109
 
103
110
  let extensionData: any = {
104
- customKey: "customValue",
111
+ customKey: 'customValue',
105
112
  };
106
113
 
107
114
  const pageViewRes = await pageView(eventData, req, extensionData);
108
115
 
109
- console.log("Sent VIEW event.");
116
+ console.log('Sent VIEW event.');
110
117
 
111
118
  return res;
112
119
  }
@@ -114,8 +121,8 @@ export async function middleware(req: NextRequest) {
114
121
 
115
122
  ## Documentation
116
123
 
117
- Coming soon.
124
+ [Official Sitecore Cloud SDK documentation](https://doc.sitecore.com/xmc/en/developers/xm-cloud/sitecore-cloud-sdk.html)
118
125
 
119
126
  ### License
120
127
 
121
- The Sitecore Cloud SDK uses the [Apache 2.0 license](https://www.apache.org/licenses/LICENSE-2.0).
128
+ The Sitecore Cloud SDK uses the [Apache 2.0 license](https://www.apache.org/licenses/LICENSE-2.0).
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-cloudsdk/events",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "license": "Apache-2.0",
5
5
  "exports": {
6
6
  "./server": {
@@ -1,6 +1,6 @@
1
1
  export { getBrowserId } from '@sitecore-cloudsdk/core';
2
2
  export { init } from './lib/initializer/browser/initializer';
3
- export type { IPageViewEventInput, ICustomEventInput, IIdentityEventAttributesInput } from './lib/events';
3
+ export type { PageViewEventInput, CustomEventInput, IdentityEventAttributesInput } from './lib/events';
4
4
  export { addToEventQueue } from './lib/eventStorage/addToEventQueue';
5
5
  export { processEventQueue } from './lib/eventStorage/processEventQueue';
6
6
  export { clearEventQueue } from './lib/eventStorage/clearEventQueue';
@@ -0,0 +1,18 @@
1
+ import { EPResponse } from '@sitecore-cloudsdk/core';
2
+ import type { BasePayload, PageViewEventPayload, IdentityEventPayload, CustomEventPayload } from '../events';
3
+ export declare class EventApiClient implements EventApiClient {
4
+ private targetURL;
5
+ private readonly eventUrl;
6
+ constructor(targetURL: string, sitecoreEdgeContextId: string, siteName: string);
7
+ }
8
+ /**
9
+ * The interface of EventApiClient class
10
+ */
11
+ export interface EventApiClient {
12
+ send(body: EPFetchBody & BasePayload): Promise<EPResponse | null>;
13
+ }
14
+ /**
15
+ * The type describing all possible event payloads
16
+ */
17
+ type EPFetchBody = PageViewEventPayload | IdentityEventPayload | CustomEventPayload;
18
+ export {};
@@ -10,9 +10,9 @@ class EventApiClient {
10
10
  this.eventUrl = `${this.targetURL}/events/${core_1.API_VERSION}/events?sitecoreContextId=${sitecoreEdgeContextId}&siteId=${siteName}`;
11
11
  }
12
12
  /**
13
- * A function that sends the payload to Sitecore CDP
14
- * @param body - The Request body for the Sitecore CDP
15
- * @returns - A promise that resolves with either the Sitecore CDP response object or null
13
+ * A function that sends the payload to Sitecore EP
14
+ * @param body - The Request body for the Sitecore EP
15
+ * @returns - A promise that resolves with either the Sitecore EP response object or null
16
16
  */
17
17
  async send(body) {
18
18
  const fetchOptions = {
@@ -1,4 +1,4 @@
1
- import { ICustomEventInput, ExtensionData } from '../events';
1
+ import { CustomEventInput, ExtensionData } from '../events';
2
2
  /**
3
3
  * A function that adds event to the queue
4
4
  * @param type - The required type of the event
@@ -6,4 +6,4 @@ import { ICustomEventInput, ExtensionData } from '../events';
6
6
  * @param extensionData - The optional extensionData attributes that will be sent to SitecoreCloud API.
7
7
  * This object will be flattened and sent in the ext object of the payload
8
8
  */
9
- export declare function addToEventQueue(type: string, eventData: ICustomEventInput, extensionData?: ExtensionData): void;
9
+ export declare function addToEventQueue(type: string, eventData: CustomEventInput, extensionData?: ExtensionData): void;
@@ -1,16 +1,16 @@
1
- import { EventApiClient } from '../cdp/EventApiClient';
2
- import { ICustomEventArguments } from '../events';
1
+ import { EventApiClient } from '../ep/EventApiClient';
2
+ import { CustomEventArguments } from '../events';
3
3
  export declare class EventQueue {
4
4
  private storage;
5
5
  private eventApiClient;
6
6
  /**
7
7
  * Initialize the Event Storage
8
8
  * @param storage - Interface that describes the storage functionality
9
- * @param eventApiClient - The API client which sends events to CDP
9
+ * @param eventApiClient - The API client which sends events to EP
10
10
  * @param infer - The instance of the infer class
11
11
  */
12
12
  private key;
13
- constructor(storage: IStorage, eventApiClient: EventApiClient);
13
+ constructor(storage: Storage, eventApiClient: EventApiClient);
14
14
  /** Returns the stored array of data with type QueueEventPayload, or empty array if the given key does not exist. */
15
15
  private getEventQueue;
16
16
  /**
@@ -20,7 +20,7 @@ export declare class EventQueue {
20
20
  */
21
21
  enqueueEvent(queueEventPayload: QueueEventPayload): void;
22
22
  /**
23
- * Iterates the queue, and sends sequently the custom events to Sitecore CDP.
23
+ * Iterates the queue, and sends sequently the custom events to Sitecore EP.
24
24
  */
25
25
  sendAllEvents(): Promise<void>;
26
26
  /**
@@ -31,9 +31,9 @@ export declare class EventQueue {
31
31
  /**
32
32
  * This Storage interface represents the required storage functionality.
33
33
  */
34
- export interface IStorage {
34
+ export interface Storage {
35
35
  getItem(key: string): string | null;
36
36
  setItem(key: string, value: string): void;
37
37
  removeItem(key: string): void;
38
38
  }
39
- export type QueueEventPayload = Pick<ICustomEventArguments, 'eventData' | 'extensionData' | 'type' | 'settings' | 'id'>;
39
+ export type QueueEventPayload = Pick<CustomEventArguments, 'eventData' | 'extensionData' | 'type' | 'settings' | 'id'>;
@@ -11,7 +11,7 @@ class EventQueue {
11
11
  /**
12
12
  * Initialize the Event Storage
13
13
  * @param storage - Interface that describes the storage functionality
14
- * @param eventApiClient - The API client which sends events to CDP
14
+ * @param eventApiClient - The API client which sends events to EP
15
15
  * @param infer - The instance of the infer class
16
16
  */
17
17
  this.key = 'EventQueue';
@@ -46,7 +46,7 @@ class EventQueue {
46
46
  this.storage.setItem(this.key, JSON.stringify(eventQueue));
47
47
  }
48
48
  /**
49
- * Iterates the queue, and sends sequently the custom events to Sitecore CDP.
49
+ * Iterates the queue, and sends sequently the custom events to Sitecore EP.
50
50
  */
51
51
  async sendAllEvents() {
52
52
  const eventQueue = this.getEventQueue();
@@ -1,8 +1,8 @@
1
- import type { ISettings } from '@sitecore-cloudsdk/core';
2
- import { IEventAttributesInput } from './common-interfaces';
1
+ import type { Settings } from '@sitecore-cloudsdk/core';
2
+ import { EventAttributesInput } from './common-interfaces';
3
3
  export declare class BaseEvent {
4
4
  private baseEventData;
5
- protected settings: ISettings;
5
+ protected settings: Settings;
6
6
  private readonly browserId;
7
7
  private readonly language;
8
8
  page: string;
@@ -13,17 +13,17 @@ export declare class BaseEvent {
13
13
  * @param id - The browser id
14
14
  * @param infer - The source of methods to estimate language and page parameters
15
15
  */
16
- constructor(baseEventData: IBaseEventData, settings: ISettings, id: string);
16
+ constructor(baseEventData: BaseEventData, settings: Settings, id: string);
17
17
  /**
18
- * A function that returns the properties for sending events to Sitecore CDP
18
+ * A function that returns the properties for sending events to Sitecore EP
19
19
  * @returns an object that is required
20
20
  */
21
- protected mapBaseEventPayload(): IBasePayload;
21
+ protected mapBaseEventPayload(): BasePayload;
22
22
  }
23
23
  /**
24
24
  * An interface describing the basic payload to be sent to the API
25
25
  */
26
- export interface IBasePayload {
26
+ export interface BasePayload {
27
27
  browser_id: string;
28
28
  channel?: string;
29
29
  client_key: string;
@@ -32,5 +32,5 @@ export interface IBasePayload {
32
32
  page?: string;
33
33
  pos: string;
34
34
  }
35
- type IBaseEventData = Partial<IEventAttributesInput>;
35
+ type BaseEventData = Partial<EventAttributesInput>;
36
36
  export {};
@@ -19,7 +19,7 @@ class BaseEvent {
19
19
  this.page = this.baseEventData.page ?? (0, core_1.pageName)();
20
20
  }
21
21
  /**
22
- * A function that returns the properties for sending events to Sitecore CDP
22
+ * A function that returns the properties for sending events to Sitecore EP
23
23
  * @returns an object that is required
24
24
  */
25
25
  mapBaseEventPayload() {
@@ -1,39 +1,31 @@
1
- import { BasicTypes, INestedObject } from '@sitecore-cloudsdk/utils';
1
+ import { NestedObject } from '@sitecore-cloudsdk/utils';
2
2
  /**
3
- * Event data received as input to be sent to Sitecore CDP
3
+ * Event data received as input to be sent to Sitecore EP
4
4
  */
5
- interface IMandatoryInput {
5
+ interface MandatoryInput {
6
6
  channel: string;
7
7
  currency: string;
8
8
  }
9
- type IMandatoryEventInput = IMandatoryInput;
9
+ type MandatoryEventInput = MandatoryInput;
10
10
  /**
11
- * Event data that is sent to Sitecore CDP
11
+ * Event data that is sent to Sitecore EP
12
12
  */
13
- interface IInferrableInput {
13
+ interface InferrableInput {
14
14
  /**
15
- * To be restored back to IMandatoryEventInput Interface
15
+ * To be restored back to MandatoryEventInput Interface
16
16
  * as mandatory input parameter in version 1.0.0
17
17
  */
18
- pointOfSale?: string;
19
18
  language?: string;
20
19
  page?: string;
21
20
  }
22
- type IInferrableEventInput = IInferrableInput;
21
+ type InferrableEventInput = InferrableInput;
23
22
  /**
24
23
  * Interface to hold the base event attributes
25
24
  */
26
- export interface IEventAttributesInput extends IMandatoryEventInput, IInferrableEventInput {
27
- }
28
- /**
29
- * Interface to hold the "ext" data
30
- */
31
- export interface IExtensionData {
32
- pageVariantId?: string;
33
- [key: string]: BasicTypes;
25
+ export interface EventAttributesInput extends MandatoryEventInput, InferrableEventInput {
34
26
  }
35
27
  /**
36
28
  * Type of the extension data that the developer can pass to events
37
29
  */
38
- export type ExtensionData = INestedObject;
30
+ export type ExtensionData = NestedObject;
39
31
  export {};
@@ -1,38 +1,38 @@
1
1
  import { BaseEvent } from '../base-event';
2
- import { IEventAttributesInput } from '../common-interfaces';
3
- import { IEventApiClient } from '../../cdp/EventApiClient';
4
- import { ICdpResponse, ISettings } from '@sitecore-cloudsdk/core';
5
- import { BasicTypes, INestedObject } from '@sitecore-cloudsdk/utils';
2
+ import { EventAttributesInput } from '../common-interfaces';
3
+ import { EventApiClient } from '../../ep/EventApiClient';
4
+ import { EPResponse, Settings } from '@sitecore-cloudsdk/core';
5
+ import { BasicTypes, NestedObject } from '@sitecore-cloudsdk/utils';
6
6
  export declare class CustomEvent extends BaseEvent {
7
- customEventPayload: ICustomEventPayload;
7
+ customEventPayload: CustomEventPayload;
8
8
  private eventApiClient;
9
9
  private extensionData;
10
10
  /**
11
11
  * A class that extends from {@link BaseEvent} and has all the required functionality to send a VIEW event
12
12
  * @param args - Unified object containing the required properties
13
13
  */
14
- constructor(args: ICustomEventArguments);
14
+ constructor(args: CustomEventArguments);
15
15
  /**
16
- * Sends the event to Sitecore CDP
17
- * @returns - A promise that resolves with either the Sitecore CDP response object or null
16
+ * Sends the event to Sitecore EP
17
+ * @returns - A promise that resolves with either the Sitecore EP response object or null
18
18
  */
19
- send(): Promise<ICdpResponse | null>;
19
+ send(): Promise<EPResponse | null>;
20
20
  }
21
21
  /**
22
22
  * Interface of the unified arguments object for custom event
23
23
  */
24
- export interface ICustomEventArguments {
25
- eventApiClient: IEventApiClient;
26
- eventData: ICustomEventData;
24
+ export interface CustomEventArguments {
25
+ eventApiClient: EventApiClient;
26
+ eventData: CustomEventData;
27
27
  id: string;
28
- extensionData?: INestedObject;
29
- settings: ISettings;
28
+ extensionData?: NestedObject;
29
+ settings: Settings;
30
30
  type: string;
31
31
  }
32
32
  /**
33
33
  * Interface with the required/optional attributes in order to send a custom event to SitecoreCloud API
34
34
  */
35
- export interface ICustomEventPayload extends INestedObject {
35
+ export interface CustomEventPayload extends NestedObject {
36
36
  ext?: {
37
37
  [key: string]: BasicTypes;
38
38
  };
@@ -40,11 +40,11 @@ export interface ICustomEventPayload extends INestedObject {
40
40
  /**
41
41
  * Interface with the required/optional attributes in order to send a custom event to SitecoreCloud API
42
42
  */
43
- export interface ICustomEventInput extends IEventAttributesInput, INestedObject {
43
+ export interface CustomEventInput extends EventAttributesInput, NestedObject {
44
44
  }
45
45
  /**
46
46
  * Internal interface with the required/optional attributes in order to send a custom event to SitecoreCloud API
47
47
  */
48
- interface ICustomEventData extends Partial<IEventAttributesInput>, INestedObject {
48
+ interface CustomEventData extends Partial<EventAttributesInput>, NestedObject {
49
49
  }
50
50
  export {};
@@ -28,8 +28,8 @@ class CustomEvent extends base_event_1.BaseEvent {
28
28
  this.customEventPayload.ext = this.extensionData;
29
29
  }
30
30
  /**
31
- * Sends the event to Sitecore CDP
32
- * @returns - A promise that resolves with either the Sitecore CDP response object or null
31
+ * Sends the event to Sitecore EP
32
+ * @returns - A promise that resolves with either the Sitecore EP response object or null
33
33
  */
34
34
  async send() {
35
35
  const baseAttr = this.mapBaseEventPayload();
@@ -1,12 +1,12 @@
1
- import { ICdpResponse } from '@sitecore-cloudsdk/core';
1
+ import { EPResponse } from '@sitecore-cloudsdk/core';
2
2
  import { ExtensionData } from '../common-interfaces';
3
- import { ICustomEventInput } from './custom-event';
3
+ import { CustomEventInput } from './custom-event';
4
4
  /**
5
5
  * A function that sends an event to SitecoreCloud API with the specified type
6
6
  * @param type - The required type of the event
7
7
  * @param eventData - The required/optional attributes in order to be send to SitecoreCloud API
8
8
  * @param extensionData - The optional extensionData attributes that will be sent to SitecoreCloud API.
9
9
  * This object will be flattened and sent in the ext object of the payload
10
- * @returns The response object that Sitecore CDP returns
10
+ * @returns The response object that Sitecore EP returns
11
11
  */
12
- export declare function event(type: string, eventData: ICustomEventInput, extensionData?: ExtensionData): Promise<ICdpResponse | null>;
12
+ export declare function event(type: string, eventData: CustomEventInput, extensionData?: ExtensionData): Promise<EPResponse | null>;
@@ -10,7 +10,7 @@ const initializer_1 = require("../../initializer/browser/initializer");
10
10
  * @param eventData - The required/optional attributes in order to be send to SitecoreCloud API
11
11
  * @param extensionData - The optional extensionData attributes that will be sent to SitecoreCloud API.
12
12
  * This object will be flattened and sent in the ext object of the payload
13
- * @returns The response object that Sitecore CDP returns
13
+ * @returns The response object that Sitecore EP returns
14
14
  */
15
15
  function event(type, eventData, extensionData) {
16
16
  const { eventApiClient, id, settings } = (0, initializer_1.getDependencies)();
@@ -1,13 +1,13 @@
1
- import { ICdpResponse } from '@sitecore-cloudsdk/core';
1
+ import { EPResponse } from '@sitecore-cloudsdk/core';
2
2
  import { ExtensionData } from '../common-interfaces';
3
- import { ICustomEventInput } from './custom-event';
4
- import { TRequest } from '@sitecore-cloudsdk/utils';
3
+ import { CustomEventInput } from './custom-event';
4
+ import { Request } from '@sitecore-cloudsdk/utils';
5
5
  /**
6
6
  * A function that sends an event to SitecoreCloud API with the specified type
7
7
  * @param type - The required type of the event
8
8
  * @param eventData - The required/optional attributes in order to be send to SitecoreCloud API
9
9
  * @param request - Interface with constraint for extending request
10
10
  * @param extensionData - The optional extensionData attributes that will be sent to SitecoreCloud API.
11
- * @returns The response object that Sitecore CDP returns
11
+ * @returns The response object that Sitecore EP returns
12
12
  */
13
- export declare function eventServer<T extends TRequest>(type: string, eventData: ICustomEventInput, request: T, extensionData?: ExtensionData): Promise<ICdpResponse | null>;
13
+ export declare function eventServer<T extends Request>(type: string, eventData: CustomEventInput, request: T, extensionData?: ExtensionData): Promise<EPResponse | null>;
@@ -11,7 +11,7 @@ const initializer_1 = require("../../initializer/server/initializer");
11
11
  * @param eventData - The required/optional attributes in order to be send to SitecoreCloud API
12
12
  * @param request - Interface with constraint for extending request
13
13
  * @param extensionData - The optional extensionData attributes that will be sent to SitecoreCloud API.
14
- * @returns The response object that Sitecore CDP returns
14
+ * @returns The response object that Sitecore EP returns
15
15
  */
16
16
  function eventServer(type, eventData, request, extensionData) {
17
17
  const { eventApiClient, settings } = (0, initializer_1.getServerDependencies)();
@@ -1,9 +1,9 @@
1
- import { ICdpResponse } from '@sitecore-cloudsdk/core';
1
+ import { EPResponse } from '@sitecore-cloudsdk/core';
2
2
  /**
3
3
  * A function that sends a form event to SitecoreCloud API
4
4
  * @param formId - The required form ID string
5
5
  * @param interactionType - The required interaction type string. Possible values: "VIEWED", "SUBMITTED"
6
6
  * settings object, you must specify it here
7
- * @returns The response object that Sitecore CDP returns or null
7
+ * @returns The response object that Sitecore EP returns or null
8
8
  */
9
- export declare function form(formId: string, interactionType: 'VIEWED' | 'SUBMITTED'): Promise<ICdpResponse | null>;
9
+ export declare function form(formId: string, interactionType: 'VIEWED' | 'SUBMITTED'): Promise<EPResponse | null>;
@@ -9,7 +9,7 @@ const custom_event_1 = require("./custom-event");
9
9
  * @param formId - The required form ID string
10
10
  * @param interactionType - The required interaction type string. Possible values: "VIEWED", "SUBMITTED"
11
11
  * settings object, you must specify it here
12
- * @returns The response object that Sitecore CDP returns or null
12
+ * @returns The response object that Sitecore EP returns or null
13
13
  */
14
14
  function form(formId, interactionType) {
15
15
  const { eventApiClient, id, settings } = (0, initializer_1.getDependencies)();
@@ -1,8 +1,8 @@
1
1
  import { BaseEvent } from '../base-event';
2
- import { ExtensionData, IEventAttributesInput } from '../common-interfaces';
3
- import { IEventApiClient } from '../../cdp/EventApiClient';
4
- import { IFlattenedObject } from '@sitecore-cloudsdk/utils';
5
- import { ICdpResponse, IInfer, ISettings } from '@sitecore-cloudsdk/core';
2
+ import { ExtensionData, EventAttributesInput } from '../common-interfaces';
3
+ import { EventApiClient } from '../../ep/EventApiClient';
4
+ import { FlattenedObject } from '@sitecore-cloudsdk/utils';
5
+ import { EPResponse, Infer, Settings } from '@sitecore-cloudsdk/core';
6
6
  export declare class IdentityEvent extends BaseEvent {
7
7
  private eventData;
8
8
  private eventApiClient;
@@ -12,7 +12,7 @@ export declare class IdentityEvent extends BaseEvent {
12
12
  * A class that extends from {@link BaseEvent} and has all the required functionality to send a VIEW event
13
13
  * @param args - Unified object containing the required properties
14
14
  */
15
- constructor(args: IIdentityEventArguments);
15
+ constructor(args: IdentityEventArguments);
16
16
  /**
17
17
  * Function that validates the identifiers object, email and date attributes for CDN users
18
18
  * * @param eventData - The data to be validated
@@ -24,15 +24,15 @@ export declare class IdentityEvent extends BaseEvent {
24
24
  */
25
25
  private mapAttributes;
26
26
  /**
27
- * Sends the event to Sitecore CDP
28
- * @returns - A promise that resolves with either the Sitecore CDP response object or null
27
+ * Sends the event to Sitecore EP
28
+ * @returns - A promise that resolves with either the Sitecore EP response object or null
29
29
  */
30
- send(): Promise<ICdpResponse | null>;
30
+ send(): Promise<EPResponse | null>;
31
31
  }
32
32
  /**
33
33
  * The JSON array of objects that contain the identity identifiers
34
34
  */
35
- interface ICDPIdentifier {
35
+ interface EPIdentifier {
36
36
  expiry_date?: string;
37
37
  id: string;
38
38
  provider: string;
@@ -40,14 +40,14 @@ interface ICDPIdentifier {
40
40
  /**
41
41
  * Interface with the necessary attributes for the input for sending Identity events
42
42
  */
43
- export interface IIdentityEventAttributesInput extends IEventAttributesInput {
43
+ export interface IdentityEventAttributesInput extends EventAttributesInput {
44
44
  city?: string;
45
45
  country?: string;
46
46
  dob?: string;
47
47
  email?: string;
48
48
  firstName?: string;
49
49
  gender?: string;
50
- identifiers: IIdentifier[];
50
+ identifiers: Identifier[];
51
51
  lastName?: string;
52
52
  mobile?: string;
53
53
  phone?: string;
@@ -59,7 +59,7 @@ export interface IIdentityEventAttributesInput extends IEventAttributesInput {
59
59
  /**
60
60
  * The JSON array of objects that contain the identity identifiers
61
61
  */
62
- export interface IIdentifier {
62
+ export interface Identifier {
63
63
  expiryDate?: string;
64
64
  id: string;
65
65
  provider: string;
@@ -67,14 +67,14 @@ export interface IIdentifier {
67
67
  /**
68
68
  * An interface describing the identity event specific payload to be sent to the API
69
69
  */
70
- export interface IIdentityEventPayload {
70
+ export interface IdentityEventPayload {
71
71
  city?: string;
72
72
  country?: string;
73
73
  dob?: string;
74
74
  email?: string;
75
75
  firstname?: string;
76
76
  gender?: string;
77
- identifiers: ICDPIdentifier[];
77
+ identifiers: EPIdentifier[];
78
78
  lastname?: string;
79
79
  mobile?: string;
80
80
  phone?: string;
@@ -83,17 +83,17 @@ export interface IIdentityEventPayload {
83
83
  street?: string[];
84
84
  title?: string;
85
85
  type: 'IDENTITY';
86
- ext?: IFlattenedObject;
86
+ ext?: FlattenedObject;
87
87
  }
88
88
  /**
89
89
  * Interface of the unified arguments object for identity event
90
90
  */
91
- export interface IIdentityEventArguments {
92
- eventApiClient: IEventApiClient;
93
- eventData: IIdentityEventAttributesInput;
91
+ export interface IdentityEventArguments {
92
+ eventApiClient: EventApiClient;
93
+ eventData: IdentityEventAttributesInput;
94
94
  extensionData?: ExtensionData;
95
95
  id: string;
96
- settings: ISettings;
97
- infer?: IInfer;
96
+ settings: Settings;
97
+ infer?: Infer;
98
98
  }
99
99
  export {};
@@ -30,7 +30,7 @@ class IdentityEvent extends base_event_1.BaseEvent {
30
30
  */
31
31
  validateAttributes(eventData) {
32
32
  if (eventData.identifiers.length === 0)
33
- throw new Error(`[MV-0004] "identifiers" is required.`);
33
+ throw new Error(`[MV-0003] "identifiers" is required.`);
34
34
  if (eventData.dob !== undefined && !(0, utils_1.isShortISODateString)(eventData.dob))
35
35
  throw new Error(`[IV-0002] Incorrect value for "dob". Format the value according to ISO 8601.`);
36
36
  eventData.identifiers.forEach((identifier) => {
@@ -75,8 +75,8 @@ class IdentityEvent extends base_event_1.BaseEvent {
75
75
  return identityPayload;
76
76
  }
77
77
  /**
78
- * Sends the event to Sitecore CDP
79
- * @returns - A promise that resolves with either the Sitecore CDP response object or null
78
+ * Sends the event to Sitecore EP
79
+ * @returns - A promise that resolves with either the Sitecore EP response object or null
80
80
  */
81
81
  async send() {
82
82
  const baseAttr = this.mapBaseEventPayload();