@sitecore-cloudsdk/events
Advanced tools
Comparing version 0.2.1 to 0.2.2
{ | ||
"name": "@sitecore-cloudsdk/events", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"license": "Apache-2.0", | ||
"homepage": "https://doc.sitecore.com/xmc/en/developers/xm-cloud/sitecore-cloud-sdk.html", | ||
"exports": { | ||
@@ -18,4 +19,4 @@ "./server": { | ||
"dependencies": { | ||
"@sitecore-cloudsdk/core": "^0.2.0", | ||
"@sitecore-cloudsdk/utils": "^0.2.0" | ||
"@sitecore-cloudsdk/core": "^0.2.2", | ||
"@sitecore-cloudsdk/utils": "^0.2.2" | ||
}, | ||
@@ -22,0 +23,0 @@ "scripts": { |
@@ -9,2 +9,3 @@ "use strict"; | ||
const sendEvent_1 = require("../send-event/sendEvent"); | ||
const consts_1 = require("../../consts"); | ||
/** | ||
@@ -20,3 +21,3 @@ * A function that sends an event to SitecoreCloud API with the specified type | ||
await (0, initializer_1.awaitInit)(); | ||
const settings = (0, core_1.getSettings)(); | ||
const settings = (0, core_1.handleGetSettingsError)(core_1.getSettings, consts_1.ErrorMessages.IE_0004); | ||
const id = (0, core_1.getBrowserId)(); | ||
@@ -23,0 +24,0 @@ return new custom_event_1.CustomEvent({ |
@@ -8,2 +8,3 @@ "use strict"; | ||
const sendEvent_1 = require("../send-event/sendEvent"); | ||
const consts_1 = require("../../consts"); | ||
/** | ||
@@ -18,3 +19,3 @@ * A function that sends an event to SitecoreCloud API with the specified type | ||
function eventServer(type, eventData, request, extensionData) { | ||
const settings = (0, core_1.getSettingsServer)(); | ||
const settings = (0, core_1.handleGetSettingsError)(core_1.getSettingsServer, consts_1.ErrorMessages.IE_0005); | ||
const id = (0, core_1.getBrowserIdFromRequest)(request, settings.cookieSettings.cookieName); | ||
@@ -21,0 +22,0 @@ return new custom_event_1.CustomEvent({ |
@@ -9,2 +9,3 @@ "use strict"; | ||
const initializer_1 = require("../../initializer/browser/initializer"); | ||
const consts_1 = require("../../consts"); | ||
/** | ||
@@ -19,3 +20,3 @@ * A function that sends a form event to SitecoreCloud API | ||
await (0, initializer_1.awaitInit)(); | ||
const settings = (0, core_1.getSettings)(); | ||
const settings = (0, core_1.handleGetSettingsError)(core_1.getSettings, consts_1.ErrorMessages.IE_0004); | ||
const id = (0, core_1.getBrowserId)(); | ||
@@ -22,0 +23,0 @@ const formEvent = new custom_event_1.CustomEvent({ |
@@ -8,2 +8,3 @@ "use strict"; | ||
const sendEvent_1 = require("../send-event/sendEvent"); | ||
const consts_1 = require("../../consts"); | ||
/** | ||
@@ -18,3 +19,3 @@ * A function that sends an IDENTITY event to SitecoreCloud API | ||
await (0, initializer_1.awaitInit)(); | ||
const settings = (0, core_1.getSettings)(); | ||
const settings = (0, core_1.handleGetSettingsError)(core_1.getSettings, consts_1.ErrorMessages.IE_0004); | ||
const id = (0, core_1.getBrowserId)(); | ||
@@ -21,0 +22,0 @@ return new identity_event_1.IdentityEvent({ |
@@ -8,2 +8,3 @@ "use strict"; | ||
const sendEvent_1 = require("../send-event/sendEvent"); | ||
const consts_1 = require("../../consts"); | ||
/** | ||
@@ -18,3 +19,3 @@ * A function that sends an IDENTITY event to SitecoreCloud API | ||
function identityServer(eventData, request, extensionData) { | ||
const settings = (0, core_1.getSettingsServer)(); | ||
const settings = (0, core_1.handleGetSettingsError)(core_1.getSettingsServer, consts_1.ErrorMessages.IE_0005); | ||
const id = (0, core_1.getBrowserIdFromRequest)(request, settings.cookieSettings.cookieName); | ||
@@ -21,0 +22,0 @@ return new identity_event_1.IdentityEvent({ |
@@ -8,2 +8,3 @@ "use strict"; | ||
const sendEvent_1 = require("../send-event/sendEvent"); | ||
const consts_1 = require("../../consts"); | ||
/** | ||
@@ -18,3 +19,3 @@ * A function that sends a VIEW event to SitecoreCloud API | ||
function pageViewServer(eventData, request, extensionData) { | ||
const settings = (0, core_1.getSettingsServer)(); | ||
const settings = (0, core_1.handleGetSettingsError)(core_1.getSettingsServer, consts_1.ErrorMessages.IE_0005); | ||
const id = (0, core_1.getBrowserIdFromRequest)(request, settings.cookieSettings.cookieName); | ||
@@ -21,0 +22,0 @@ // Host is irrelevant but necessary to support relative URL |
@@ -9,2 +9,3 @@ "use strict"; | ||
const sendEvent_1 = require("../send-event/sendEvent"); | ||
const consts_1 = require("../../consts"); | ||
/** | ||
@@ -19,3 +20,3 @@ * A function that sends a VIEW event to SitecoreCloud API | ||
await (0, initializer_1.awaitInit)(); | ||
const settings = (0, core_1.getSettings)(); | ||
const settings = (0, core_1.handleGetSettingsError)(core_1.getSettings, consts_1.ErrorMessages.IE_0004); | ||
const id = (0, core_1.getBrowserId)(); | ||
@@ -22,0 +23,0 @@ return new page_view_event_1.PageViewEvent({ |
@@ -13,3 +13,3 @@ "use strict"; | ||
async function sendEvent(body, settings) { | ||
const eventUrl = `${settings.sitecoreEdgeUrl}/events/${core_1.API_VERSION}/events?sitecoreContextId=${settings.sitecoreEdgeContextId}&siteId=${settings.siteName}`; | ||
const eventUrl = `${settings.sitecoreEdgeUrl}/v1/events/${core_1.API_VERSION}/events?sitecoreContextId=${settings.sitecoreEdgeContextId}&siteId=${settings.siteName}`; | ||
const fetchOptions = { | ||
@@ -16,0 +16,0 @@ body: JSON.stringify(body), |
@@ -8,2 +8,3 @@ "use strict"; | ||
const core_1 = require("@sitecore-cloudsdk/core"); | ||
const consts_1 = require("../consts"); | ||
/** | ||
@@ -18,3 +19,3 @@ * A function that adds event to the queue | ||
await (0, initializer_1.awaitInit)(); | ||
const settings = (0, core_1.getSettings)(); | ||
const settings = (0, core_1.handleGetSettingsError)(core_1.getSettings, consts_1.ErrorMessages.IE_0004); | ||
const id = (0, core_1.getBrowserId)(); | ||
@@ -21,0 +22,0 @@ const queueEventPayload = { |
@@ -5,2 +5,3 @@ "use strict"; | ||
// © Sitecore Corporation A/S. All rights reserved. Sitecore® is a registered trademark of Sitecore Corporation A/S. | ||
const consts_1 = require("../consts"); | ||
const initializer_1 = require("../initializer/browser/initializer"); | ||
@@ -15,3 +16,3 @@ const core_1 = require("@sitecore-cloudsdk/core"); | ||
await (0, initializer_1.awaitInit)(); | ||
const settings = (0, core_1.getSettings)(); | ||
const settings = (0, core_1.handleGetSettingsError)(core_1.getSettings, consts_1.ErrorMessages.IE_0004); | ||
const id = (0, core_1.getBrowserId)(); | ||
@@ -18,0 +19,0 @@ return (0, core_1.getGuestId)(id, settings.sitecoreEdgeContextId, settings.sitecoreEdgeUrl); |
{ | ||
"name": "@sitecore-cloudsdk/events", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"license": "Apache-2.0", | ||
"homepage": "https://doc.sitecore.com/xmc/en/developers/xm-cloud/sitecore-cloud-sdk.html", | ||
"exports": { | ||
@@ -18,4 +19,4 @@ "./server": { | ||
"dependencies": { | ||
"@sitecore-cloudsdk/core": "^0.2.0", | ||
"@sitecore-cloudsdk/utils": "^0.2.0" | ||
"@sitecore-cloudsdk/core": "^0.2.2", | ||
"@sitecore-cloudsdk/utils": "^0.2.2" | ||
}, | ||
@@ -22,0 +23,0 @@ "scripts": { |
// © Sitecore Corporation A/S. All rights reserved. Sitecore® is a registered trademark of Sitecore Corporation A/S. | ||
import { getBrowserId, getSettings } from '@sitecore-cloudsdk/core'; | ||
import { getBrowserId, getSettings, handleGetSettingsError } from '@sitecore-cloudsdk/core'; | ||
import { CustomEvent } from './custom-event'; | ||
import { awaitInit } from '../../initializer/browser/initializer'; | ||
import { sendEvent } from '../send-event/sendEvent'; | ||
import { ErrorMessages } from '../../consts'; | ||
/** | ||
@@ -16,3 +17,3 @@ * A function that sends an event to SitecoreCloud API with the specified type | ||
await awaitInit(); | ||
const settings = getSettings(); | ||
const settings = handleGetSettingsError(getSettings, ErrorMessages.IE_0004); | ||
const id = getBrowserId(); | ||
@@ -19,0 +20,0 @@ return new CustomEvent({ |
// © Sitecore Corporation A/S. All rights reserved. Sitecore® is a registered trademark of Sitecore Corporation A/S. | ||
import { getBrowserIdFromRequest, getSettingsServer } from '@sitecore-cloudsdk/core'; | ||
import { getBrowserIdFromRequest, getSettingsServer, handleGetSettingsError, } from '@sitecore-cloudsdk/core'; | ||
import { CustomEvent } from './custom-event'; | ||
import { sendEvent } from '../send-event/sendEvent'; | ||
import { ErrorMessages } from '../../consts'; | ||
/** | ||
@@ -14,3 +15,3 @@ * A function that sends an event to SitecoreCloud API with the specified type | ||
export function eventServer(type, eventData, request, extensionData) { | ||
const settings = getSettingsServer(); | ||
const settings = handleGetSettingsError(getSettingsServer, ErrorMessages.IE_0005); | ||
const id = getBrowserIdFromRequest(request, settings.cookieSettings.cookieName); | ||
@@ -17,0 +18,0 @@ return new CustomEvent({ |
// © Sitecore Corporation A/S. All rights reserved. Sitecore® is a registered trademark of Sitecore Corporation A/S. | ||
import { getBrowserId, getSettings } from '@sitecore-cloudsdk/core'; | ||
import { getBrowserId, getSettings, handleGetSettingsError } from '@sitecore-cloudsdk/core'; | ||
import { CustomEvent } from './custom-event'; | ||
import { sendEvent } from '../send-event/sendEvent'; | ||
import { awaitInit } from '../../initializer/browser/initializer'; | ||
import { ErrorMessages } from '../../consts'; | ||
/** | ||
@@ -15,3 +16,3 @@ * A function that sends a form event to SitecoreCloud API | ||
await awaitInit(); | ||
const settings = getSettings(); | ||
const settings = handleGetSettingsError(getSettings, ErrorMessages.IE_0004); | ||
const id = getBrowserId(); | ||
@@ -18,0 +19,0 @@ const formEvent = new CustomEvent({ |
@@ -1,5 +0,6 @@ | ||
import { getBrowserId, getSettings } from '@sitecore-cloudsdk/core'; | ||
import { getBrowserId, getSettings, handleGetSettingsError } from '@sitecore-cloudsdk/core'; | ||
import { IdentityEvent } from './identity-event'; | ||
import { awaitInit } from '../../initializer/browser/initializer'; | ||
import { sendEvent } from '../send-event/sendEvent'; | ||
import { ErrorMessages } from '../../consts'; | ||
/** | ||
@@ -14,3 +15,3 @@ * A function that sends an IDENTITY event to SitecoreCloud API | ||
await awaitInit(); | ||
const settings = getSettings(); | ||
const settings = handleGetSettingsError(getSettings, ErrorMessages.IE_0004); | ||
const id = getBrowserId(); | ||
@@ -17,0 +18,0 @@ return new IdentityEvent({ |
// © Sitecore Corporation A/S. All rights reserved. Sitecore® is a registered trademark of Sitecore Corporation A/S. | ||
import { getBrowserIdFromRequest, getSettingsServer } from '@sitecore-cloudsdk/core'; | ||
import { getBrowserIdFromRequest, getSettingsServer, handleGetSettingsError, } from '@sitecore-cloudsdk/core'; | ||
import { IdentityEvent } from './identity-event'; | ||
import { sendEvent } from '../send-event/sendEvent'; | ||
import { ErrorMessages } from '../../consts'; | ||
/** | ||
@@ -14,3 +15,3 @@ * A function that sends an IDENTITY event to SitecoreCloud API | ||
export function identityServer(eventData, request, extensionData) { | ||
const settings = getSettingsServer(); | ||
const settings = handleGetSettingsError(getSettingsServer, ErrorMessages.IE_0005); | ||
const id = getBrowserIdFromRequest(request, settings.cookieSettings.cookieName); | ||
@@ -17,0 +18,0 @@ return new IdentityEvent({ |
// © Sitecore Corporation A/S. All rights reserved. Sitecore® is a registered trademark of Sitecore Corporation A/S. | ||
import { getBrowserIdFromRequest, getSettingsServer } from '@sitecore-cloudsdk/core'; | ||
import { getBrowserIdFromRequest, getSettingsServer, handleGetSettingsError, } from '@sitecore-cloudsdk/core'; | ||
import { PageViewEvent } from './page-view-event'; | ||
import { sendEvent } from '../send-event/sendEvent'; | ||
import { ErrorMessages } from '../../consts'; | ||
/** | ||
@@ -14,3 +15,3 @@ * A function that sends a VIEW event to SitecoreCloud API | ||
export function pageViewServer(eventData, request, extensionData) { | ||
const settings = getSettingsServer(); | ||
const settings = handleGetSettingsError(getSettingsServer, ErrorMessages.IE_0005); | ||
const id = getBrowserIdFromRequest(request, settings.cookieSettings.cookieName); | ||
@@ -17,0 +18,0 @@ // Host is irrelevant but necessary to support relative URL |
// © Sitecore Corporation A/S. All rights reserved. Sitecore® is a registered trademark of Sitecore Corporation A/S. | ||
import { getBrowserId, getSettings } from '@sitecore-cloudsdk/core'; | ||
import { getBrowserId, getSettings, handleGetSettingsError } from '@sitecore-cloudsdk/core'; | ||
import { PageViewEvent } from './page-view-event'; | ||
import { awaitInit } from '../../initializer/browser/initializer'; | ||
import { sendEvent } from '../send-event/sendEvent'; | ||
import { ErrorMessages } from '../../consts'; | ||
/** | ||
@@ -15,3 +16,3 @@ * A function that sends a VIEW event to SitecoreCloud API | ||
await awaitInit(); | ||
const settings = getSettings(); | ||
const settings = handleGetSettingsError(getSettings, ErrorMessages.IE_0004); | ||
const id = getBrowserId(); | ||
@@ -18,0 +19,0 @@ return new PageViewEvent({ |
@@ -10,3 +10,3 @@ // © Sitecore Corporation A/S. All rights reserved. Sitecore® is a registered trademark of Sitecore Corporation A/S. | ||
export async function sendEvent(body, settings) { | ||
const eventUrl = `${settings.sitecoreEdgeUrl}/events/${API_VERSION}/events?sitecoreContextId=${settings.sitecoreEdgeContextId}&siteId=${settings.siteName}`; | ||
const eventUrl = `${settings.sitecoreEdgeUrl}/v1/events/${API_VERSION}/events?sitecoreContextId=${settings.sitecoreEdgeContextId}&siteId=${settings.siteName}`; | ||
const fetchOptions = { | ||
@@ -13,0 +13,0 @@ body: JSON.stringify(body), |
// © Sitecore Corporation A/S. All rights reserved. Sitecore® is a registered trademark of Sitecore Corporation A/S. | ||
import { awaitInit } from '../initializer/browser/initializer'; | ||
import { eventQueue } from './eventStorage'; | ||
import { getBrowserId, getSettings } from '@sitecore-cloudsdk/core'; | ||
import { getBrowserId, getSettings, handleGetSettingsError } from '@sitecore-cloudsdk/core'; | ||
import { ErrorMessages } from '../consts'; | ||
/** | ||
@@ -14,3 +15,3 @@ * A function that adds event to the queue | ||
await awaitInit(); | ||
const settings = getSettings(); | ||
const settings = handleGetSettingsError(getSettings, ErrorMessages.IE_0004); | ||
const id = getBrowserId(); | ||
@@ -17,0 +18,0 @@ const queueEventPayload = { |
// © Sitecore Corporation A/S. All rights reserved. Sitecore® is a registered trademark of Sitecore Corporation A/S. | ||
import { ErrorMessages } from '../consts'; | ||
import { awaitInit } from '../initializer/browser/initializer'; | ||
import { getBrowserId, getGuestId as getGuestIdFromCore, getSettings } from '@sitecore-cloudsdk/core'; | ||
import { getBrowserId, getGuestId as getGuestIdFromCore, getSettings, handleGetSettingsError, } from '@sitecore-cloudsdk/core'; | ||
/** | ||
@@ -11,5 +12,5 @@ * A function that returns the guest id. | ||
await awaitInit(); | ||
const settings = getSettings(); | ||
const settings = handleGetSettingsError(getSettings, ErrorMessages.IE_0004); | ||
const id = getBrowserId(); | ||
return getGuestIdFromCore(id, settings.sitecoreEdgeContextId, settings.sitecoreEdgeUrl); | ||
} |
{ | ||
"name": "@sitecore-cloudsdk/events", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"license": "Apache-2.0", | ||
"homepage": "https://doc.sitecore.com/xmc/en/developers/xm-cloud/sitecore-cloud-sdk.html", | ||
"exports": { | ||
@@ -18,4 +19,4 @@ "./server": { | ||
"dependencies": { | ||
"@sitecore-cloudsdk/core": "^0.2.0", | ||
"@sitecore-cloudsdk/utils": "^0.2.0" | ||
"@sitecore-cloudsdk/core": "^0.2.2", | ||
"@sitecore-cloudsdk/utils": "^0.2.2" | ||
}, | ||
@@ -22,0 +23,0 @@ "scripts": { |
# events | ||
© Sitecore Corporation A/S. All rights reserved. Sitecore© is a registered trademark of Sitecore Corporation A/S. | ||
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. | ||
@@ -125,5 +123,1 @@ | ||
[Official Sitecore Cloud SDK documentation](https://doc.sitecore.com/xmc/en/developers/xm-cloud/sitecore-cloud-sdk.html) | ||
### License | ||
The Sitecore Cloud SDK uses the [Apache 2.0 license](https://www.apache.org/licenses/LICENSE-2.0). |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
186399
2573
1
123