@coveo/relay 0.7.0 → 0.7.1
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/lib/cdn/relay.min.js +1 -1
- package/lib/cdn/relay.min.js.map +1 -1
- package/lib/cdn/types/config/config.d.ts +6 -0
- package/lib/cdn/types/config/config.d.ts.map +1 -1
- package/lib/cdn/types/event/meta/meta.d.ts +5 -1
- package/lib/cdn/types/event/meta/meta.d.ts.map +1 -1
- package/lib/docs/relay-docs.json +133 -87
- package/lib/relay.cjs +2 -1
- package/lib/relay.js +2 -1
- package/lib/relay.mjs +2 -1
- package/lib/types/config/config.d.ts +6 -0
- package/lib/types/config/config.d.ts.map +1 -1
- package/lib/types/event/meta/meta.d.ts +5 -1
- package/lib/types/event/meta/meta.d.ts.map +1 -1
- package/package.json +1 -1
package/lib/cdn/relay.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function t(t){const n="visitorId";return{getClientId:()=>{const r=t.get(),o=r.storage,c=o.getItem(n),a=c&&("string"==typeof(
|
|
1
|
+
var e=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function t(t){const n="visitorId";return{getClientId:()=>{const r=t.get(),o=r.storage,c=o.getItem(n),a=c&&("string"==typeof(s=c)&&e.test(s))?c:r.generateUUID();var s;return o.setItem(n,a),a},clear:()=>{t.get().storage.removeItem(n)}}}const n="0.7.1";function r(e){return(e.source||[]).concat([`relay@${n}`])}function o(e,t,n,o){const{getReferrer:c,getLocation:a,getUserAgent:s}=n,i=function(e){const{trackingId:t}=e;return{trackingId:t}}(t),u=o.getClientId();return Object.freeze({type:e,config:i,ts:Date.now(),source:r(t),clientId:u,user:null,userAgent:s(),referrer:c(),location:a()})}const c="*";function a(){const e=[];function t({type:t,callback:n}){return e.findIndex((e=>e.type===t&&e.callback===n))}function n(n,r){r?function(n){const r=t(n);r>=0&&e.splice(r,1)}({type:n,callback:r}):function(t){if(t===c)e.length=0;else for(let n=e.length-1;n>=0;n--)e[n].type===t&&e.splice(n,1)}(n)}return{add:function(r){return t(r)<0&&e.push(r),()=>n(r.type,r.callback)},call:function(t){e.forEach((e=>{if(function(e,t){return"*"===e.type||t===e.type}(e,t.meta.type))try{e.callback(t)}catch(e){console.error(e)}}))},remove:n}}function s({url:e,token:t,trackingId:n,...r}){return Object.freeze({url:e,token:t,trackingId:n,...!!r.mode&&{mode:r.mode},...!!r.source&&{source:r.source}})}const i=function(){const e="coveo_";return{getItem(t){const n=`${e}${t}=`,r=document.cookie.split(";");for(const e of r){const t=e.replace(/^\s+/,"");if(0===t.lastIndexOf(n,0))return t.substring(n.length,t.length)}return null},setItem(t,n,r){const o=(e=>{const t=e.split(".").slice(-2);return 2==t.length?t.join("."):""})(window.location.hostname),c=`;expires=${new Date((new Date).getTime()+r).toUTCString()}`,a=o?`;domain=${o}`:"";document.cookie=`${e}${t}=${n}${c}${a};path=/;SameSite=Lax`},removeItem(e){this.setItem(e,"",-1)}}}();function u(){return{runtime:"browser",send:(e,t,n)=>{const r=navigator.sendBeacon(`${e}?access_token=${t}`,new Blob([JSON.stringify([n])],{type:"application/json"})),o=function(){const e="undefined"!=typeof window;return{sendMessage(t){e&&window.postMessage(t,"*")}}}();if(o.sendMessage({kind:"EVENT_PROTOCOL",event:n,url:e,token:t}),!r)throw new Error("Failed to send the event(s) because the payload size exceeded the maximum allowed size (32 KB). Please contact support if the problem persists.")},getReferrer:()=>function(){const e=document.referrer;return""===e?null:e}(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,generateUUID:()=>crypto.randomUUID(),storage:{getItem:e=>i.getItem(e)||localStorage.getItem(e),removeItem(e){i.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),i.setItem(e,t,31556952e3)}}}}function l(e){return"disabled"!==e.get().mode&&function(){try{return"object"==typeof window}catch(e){return!1}}()?u():{runtime:"null",send:()=>{},getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,generateUUID:()=>"",storage:{getItem:()=>null,removeItem(){},setItem(){}}}}function g(e){const r=function(e){let t=s(e);return{get:()=>t,update:e=>{t=s({...t,...e})}}}(e),c=a(),i=function(e){return{get:()=>Object.freeze(l(e))}}(r),u=t(i);return{emit:(e,t)=>{const n=r.get(),a=i.get(),s=function(e,t,n,r,c){return{...t,meta:o(e,n,r,c)}}(e,t,n,a,u);return function({config:e,environment:t,event:n,listenerManager:r}){const{url:o,token:c,mode:a}=e;"disabled"!==a&&(r.call(n),t.send(o,c,n))}({config:n,environment:a,event:s,listenerManager:c})},getMeta:e=>o(e,r.get(),i.get(),u),on:(e,t)=>c.add({type:e,callback:t}),off:(e,t)=>c.remove(e,t),updateConfig:e=>r.update(e),version:n,clearStorage:()=>{u.clear()}}}export{g as createRelay};
|
|
2
2
|
//# sourceMappingURL=relay.min.js.map
|
package/lib/cdn/relay.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relay.min.js","sources":["../../../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/regex.js","../../src/client-id/client-id.ts","../../../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/validate.js","../../src/version.ts","../../src/event/meta/meta.ts","../../src/listener/listener.ts","../../src/config/config.ts","../../src/environment/browser/storage/cookie.ts","../../src/environment/browser/browser.ts","../../../../node_modules/.pnpm/@coveo+explorer-messenger@0.1.1/node_modules/@coveo/explorer-messenger/dist/messenger.js","../../src/environment/browser/storage/storage.ts","../../src/environment/manager/manager.ts","../../src/environment/null/null.ts","../../src/environment/storage.ts","../../src/relay.ts","../../src/event/relay-event.ts","../../src/emit/emit.ts"],"sourcesContent":["export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;","import { validate } from \"uuid\";\nimport { EnvironmentManager } from \"../environment/manager/manager\";\n\nexport interface ClientIdManager {\n getClientId: () => string;\n clear: () => void;\n}\n\nexport function createClientIdManager(\n environmentManager: EnvironmentManager\n): ClientIdManager {\n const key = \"visitorId\";\n\n return {\n getClientId: () => {\n const environment = environmentManager.get();\n const storage = environment.storage;\n\n const existingClientId = storage.getItem(key);\n const clientId =\n existingClientId && validate(existingClientId)\n ? existingClientId\n : environment.generateUUID();\n storage.setItem(key, clientId);\n return clientId;\n },\n clear: () => {\n environmentManager.get().storage.removeItem(key);\n },\n };\n}\n","import REGEX from './regex.js';\n\nfunction validate(uuid) {\n return typeof uuid === 'string' && REGEX.test(uuid);\n}\n\nexport default validate;","export const version = \"process.env.VERSION\";\n","import { ClientIdManager } from \"../../client-id/client-id\";\nimport { Environment } from \"../../environment/environment\";\nimport { RelayConfig } from \"../../config/config\";\nimport { version } from \"../../version\";\n\n/**\n * The `EventConfig` object provides additonal information for the configuration associated with the event.\n */\nexport interface EventConfig {\n /**\n * The unique identifier of a web property. See [Tracking ID](https://docs.coveo.com/en/n8tg0567/).\n */\n trackingId: string;\n}\n\n/**\n * The `Meta` object provides a structured representation of metadata associated with an emitted event.\n */\nexport interface Meta {\n /**\n * Event's type that was emitted.\n */\n type: string;\n\n /**\n * Configuration associated with the event.\n */\n config: EventConfig;\n\n /**\n * Timestamp when the event was emitted.\n */\n ts: number;\n\n /**\n * Names and versions of the client side libraries which built and emitted this event.\n */\n source: string[];\n\n /**\n * Persistent unique identifier of a device.\n */\n clientId: string;\n\n /**\n * Browser Navigator's [user agent](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent) property if set.\n */\n userAgent: string | null;\n\n /**\n * Browser Document's [referrer](https://developer.mozilla.org/en-US/docs/Web/API/Document/referrer) property if set.\n */\n referrer: string | null;\n\n /**\n * Browser Location's [href](https://developer.mozilla.org/en-US/docs/Web/API/Location/href) property if set.\n */\n location: string | null;\n}\n\nfunction getEventConfig(config: RelayConfig): EventConfig {\n const { trackingId } = config;\n return { trackingId };\n}\n\nfunction getSource(config: RelayConfig): string[] {\n return (config.source || []).concat([`relay@${version}`]);\n}\n\nexport function createMeta(\n type: string,\n config: RelayConfig,\n environment: Environment,\n clientIdManager: ClientIdManager\n): Readonly<Meta> {\n const { getReferrer, getLocation, getUserAgent } = environment;\n const eventConfig = getEventConfig(config);\n const clientId = clientIdManager.getClientId();\n\n return Object.freeze({\n type,\n config: eventConfig,\n ts: Date.now(),\n source: getSource(config),\n clientId,\n userAgent: getUserAgent(),\n referrer: getReferrer(),\n location: getLocation(),\n });\n}\n","import { RelayEvent } from \"../event/relay-event\";\n\nconst ANY_EVENT_TYPE = \"*\";\n\n/**\n * Callback to perform an action when a specified event is emitted.\n * @typedef {function} EventCallback\n * @param {RelayEvent} event\n * @returns {void}\n */\nexport type EventCallback = (event: RelayEvent) => void;\n\ninterface Listener {\n type: string;\n callback: EventCallback;\n}\n\nexport interface ListenerManager {\n add: (listener: Listener) => () => void;\n call: (event: RelayEvent) => void;\n remove: (type: string, callback?: EventCallback) => void;\n}\n\nexport function createListenerManager(): ListenerManager {\n const listeners: Listener[] = [];\n\n function getListenerIndex({ type, callback }: Listener): number {\n return listeners.findIndex(\n (listener) => listener.type === type && listener.callback === callback\n );\n }\n\n function isMatchesType(listener: Listener, type: string): boolean {\n return listener.type === \"*\" || type === listener.type;\n }\n\n function add(listener: Listener): () => void {\n if (getListenerIndex(listener) < 0) {\n listeners.push(listener);\n }\n return () => remove(listener.type, listener.callback);\n }\n\n function call(event: RelayEvent) {\n listeners.forEach((listener) => {\n if (isMatchesType(listener, event.meta.type)) {\n try {\n listener.callback(event);\n } catch (e) {\n console.error(e);\n }\n }\n });\n }\n\n function removeMultiple(type: string) {\n if (type === ANY_EVENT_TYPE) {\n listeners.length = 0;\n } else {\n for (let i = listeners.length - 1; i >= 0; i--) {\n if (listeners[i].type === type) {\n listeners.splice(i, 1);\n }\n }\n }\n }\n\n function removeOne(listener: Listener) {\n const index = getListenerIndex(listener);\n if (index >= 0) {\n listeners.splice(index, 1);\n }\n }\n\n function remove(type: string, callback?: EventCallback) {\n !!callback ? removeOne({ type, callback }) : removeMultiple(type);\n }\n\n return {\n add,\n call,\n remove,\n };\n}\n","export type RelayMode = \"emit\" | \"disabled\";\n\n/**\n * The `RelayConfig` object defines the configuration options for initializing a Relay instance.\n */\nexport interface RelayConfig {\n /**\n * Endpoint defined to communicate with the Event API.\n */\n url: string;\n\n /**\n * Token to authorize the access to the Event API endpoint.\n */\n token: string;\n\n /**\n * The unique identifier of a web property. See [Tracking ID](https://docs.coveo.com/en/n8tg0567/).\n */\n trackingId: string;\n\n /**\n * Defines the library mode. The possible values are:\n * \"emit\": Sends analytics events to Coveo to be stored.\n * \"disabled\": Prevents the emission of events and does not trigger callbacks.\n * @default emit\n */\n mode?: RelayMode;\n\n /**\n * Optionally allows a Relay integration to specify the name(s) of software package(s) relay is\n * being called from. These names will be transmitted with each event, along with Relay's own\n * version. The recommendation is to specify them using a 'softwarename@softwareversion' string.\n */\n source?: string[];\n}\n\nexport interface ConfigManager {\n get: () => Readonly<RelayConfig>;\n update: (updatedConfig: Partial<RelayConfig>) => void;\n}\n\nfunction pick({\n url,\n token,\n trackingId,\n ...rest\n}: RelayConfig): Readonly<RelayConfig> {\n return Object.freeze({\n url,\n token,\n trackingId,\n ...(!!rest.mode && { mode: rest.mode }),\n ...(!!rest.source && { source: rest.source }),\n });\n}\n\nexport function createConfigManager(\n initialConfig: RelayConfig\n): Readonly<ConfigManager> {\n let _config: Readonly<RelayConfig> = pick(initialConfig);\n\n return {\n get: () => _config,\n update: (updatedConfig: Partial<RelayConfig>) => {\n _config = pick({ ..._config, ...updatedConfig });\n },\n };\n}\n","export interface CookieManager {\n getItem: (key: string) => string | null;\n removeItem: (key: string) => void;\n setItem: (key: string, data: string, expire: number) => void;\n}\n\nexport const cookieManager: CookieManager = createCookieManager();\n\nfunction createCookieManager(): CookieManager {\n const prefix = \"coveo_\";\n const getDomain = (host: string) => {\n const parts = host.split(\".\").slice(-2);\n return parts.length == 2 ? parts.join(\".\") : \"\";\n };\n\n return {\n getItem(key: string): string | null {\n const cookiePrefix = `${prefix}${key}=`;\n const cookieArray = document.cookie.split(\";\");\n for (const cookie of cookieArray) {\n const prettifyCookie = cookie.replace(/^\\s+/, \"\");\n if (prettifyCookie.lastIndexOf(cookiePrefix, 0) === 0) {\n return prettifyCookie.substring(\n cookiePrefix.length,\n prettifyCookie.length\n );\n }\n }\n return null;\n },\n setItem(key: string, data: string, expire: number): void {\n const domain = getDomain(window.location.hostname);\n const expireSection = `;expires=${new Date(\n new Date().getTime() + expire\n ).toUTCString()}`;\n const domainSection = domain ? `;domain=${domain}` : \"\";\n document.cookie = `${prefix}${key}=${data}${expireSection}${domainSection};path=/;SameSite=Lax`;\n },\n\n removeItem(key: string): void {\n this.setItem(key, \"\", -1);\n },\n };\n}\n","import { createExplorerMessenger } from \"@coveo/explorer-messenger\";\nimport { Environment } from \"../environment\";\nimport { createBrowserStorage } from \"./storage/storage\";\nimport { RelayEvent } from \"../../event/relay-event\";\n\nfunction getReferrer() {\n const referrer = document.referrer;\n\n return referrer === \"\" ? null : referrer;\n}\n\nexport function buildBrowserEnvironment(): Environment {\n return {\n runtime: \"browser\",\n send: (url: string, token: string, event: RelayEvent) => {\n const response = navigator.sendBeacon(\n `${url}?access_token=${token}`,\n new Blob([JSON.stringify([event])], {\n type: \"application/json\",\n })\n );\n\n const messenger = createExplorerMessenger();\n messenger.sendMessage({ kind: \"EVENT_PROTOCOL\", event, url, token });\n\n if (!response) {\n throw new Error(\n `Failed to send the event(s) because the payload size exceeded the maximum allowed size (32 KB). Please contact support if the problem persists.`\n );\n }\n },\n getReferrer: () => getReferrer(),\n getLocation: () => window.location.href,\n getUserAgent: () => navigator.userAgent,\n generateUUID: () => crypto.randomUUID(),\n storage: createBrowserStorage(),\n };\n}\n","function createExplorerMessenger() {\n const isBrowser = typeof window !== \"undefined\";\n return {\n sendMessage(message) {\n isBrowser && window.postMessage(message, \"*\");\n }\n };\n}\nexport {\n createExplorerMessenger\n};\n","import { Storage } from \"../../storage\";\nimport { cookieManager } from \"./cookie\";\n\nexport function createBrowserStorage(): Storage {\n return {\n getItem(key: string): string | null {\n return cookieManager.getItem(key) || localStorage.getItem(key);\n },\n\n removeItem(key: string): void {\n cookieManager.removeItem(key);\n localStorage.removeItem(key);\n },\n\n setItem(key: string, data: string): void {\n const oneYear = 31556952000;\n localStorage.setItem(key, data);\n cookieManager.setItem(key, data, oneYear);\n },\n };\n}\n","import { ConfigManager } from \"../../config/config\";\nimport { buildBrowserEnvironment } from \"../browser/browser\";\nimport { Environment } from \"../environment\";\nimport { buildNullEnvironment } from \"../null/null\";\n\nexport interface EnvironmentManager {\n get: () => Readonly<Environment>;\n}\n\nfunction buildEnvironment(configManager: ConfigManager) {\n const active = configManager.get().mode !== \"disabled\";\n\n if (active && isBrowser()) {\n return buildBrowserEnvironment();\n }\n\n return buildNullEnvironment();\n}\n\nfunction isBrowser() {\n try {\n return typeof window === \"object\";\n } catch (e) {\n return false;\n }\n}\n\nexport function createEnvironmentManager(\n configManager: ConfigManager\n): Readonly<EnvironmentManager> {\n return {\n get: () => Object.freeze(buildEnvironment(configManager)),\n };\n}\n","import { Environment } from \"../environment\";\nimport { createNullStorage } from \"../storage\";\n\nexport function buildNullEnvironment(): Environment {\n return {\n runtime: \"null\",\n send: () => undefined,\n getReferrer: () => null,\n getLocation: () => null,\n getUserAgent: () => null,\n generateUUID: () => \"\",\n storage: createNullStorage(),\n };\n}\n","export interface Storage {\n getItem: (key: string) => string | null;\n removeItem: (key: string) => void;\n setItem: (key: string, data: string) => void;\n}\n\nexport function createNullStorage(): Storage {\n return {\n getItem(): string | null {\n return null;\n },\n removeItem(): void {\n return;\n },\n setItem(): void {\n return;\n },\n };\n}\n","import { emit } from \"./emit/emit\";\nimport { createClientIdManager } from \"./client-id/client-id\";\nimport { createRelayEvent } from \"./event/relay-event\";\nimport { version } from \"./version\";\nimport { createMeta, Meta, EventConfig } from \"./event/meta/meta\";\nimport { createListenerManager, EventCallback } from \"./listener/listener\";\nimport { createConfigManager, RelayConfig } from \"./config/config\";\nimport { createEnvironmentManager } from \"./environment/manager/manager\";\n\ntype Off = () => void;\n\n/**\n * Relay instance.\n * This object provides a comprehensive set of variables and methods for interacting with the Event API.\n */\ninterface Relay {\n /**\n * Sends an event to the Event API.\n * @param {string} type - event's type to be emitted.\n * @param {Record<string,any>} payload - payload to include within the event.\n * @returns {void}\n */\n emit: (type: string, payload: Record<string, any>) => void;\n\n /**\n * Gets the client-side generated meta object.\n * @param {string} type - event's type that will be included in the meta object.\n * @returns {Meta}\n */\n getMeta: (type: string) => Meta;\n\n /**\n * Attaches an event callback to either all event types or a specific one.\n * The callback set will be called when an event with the specified type is emitted.\n * Setting type as \"*\" will trigger the callback for all event types.\n * Returns the \"off\" function to detach the event callback.\n * @param {string} type - event's type.\n * @param {EventCallback} callback\n * @returns {Off}\n */\n on: (type: string, callback: EventCallback) => Off;\n\n /**\n * Detach callback(s) from events.\n * If only the \"type\" parameter is set, all callbacks for the specified type will be removed.\n * @param {string} type - event's type.\n * @param {EventCallback} callback - callback that should be removed.\n * @returns {void}\n */\n off: (type: string, callback?: EventCallback) => void;\n\n /**\n * Updates Relay's configuration after its initialization.\n * @param {Partial<RelayConfig>} config - configuration that should be updated.\n * @returns {void}\n */\n updateConfig: (config: Partial<RelayConfig>) => void;\n\n /**\n * Current version of the Relay library.\n */\n version: string;\n\n /**\n * Removes the visitorId cookie and localStorage key.\n * @returns {void}\n */\n clearStorage: () => void;\n}\n\n/**\n * Initializes the Relay library object.\n * @param {RelayConfig} initialConfig\n * @returns {Relay}\n */\nexport function createRelay(initialConfig: RelayConfig): Relay {\n const configManager = createConfigManager(initialConfig);\n const listenerManager = createListenerManager();\n const environmentManager = createEnvironmentManager(configManager);\n const clientIdManager = createClientIdManager(environmentManager);\n\n return {\n emit: (type: string, payload: Record<string, any>) => {\n const config = configManager.get();\n const environment = environmentManager.get();\n\n const event = createRelayEvent(\n type,\n payload,\n config,\n environment,\n clientIdManager\n );\n\n return emit({\n config,\n environment,\n event,\n listenerManager,\n });\n },\n getMeta: (type: string) =>\n createMeta(\n type,\n configManager.get(),\n environmentManager.get(),\n clientIdManager\n ),\n on: (type: string, callback: EventCallback) =>\n listenerManager.add({ type, callback }),\n off: (type: string, callback?: EventCallback) =>\n listenerManager.remove(type, callback),\n updateConfig: (config: Partial<RelayConfig>) =>\n configManager.update(config),\n version,\n clearStorage: () => {\n clientIdManager.clear();\n },\n };\n}\n\nexport type { Relay, Meta, EventConfig, EventCallback, RelayConfig };\n","import { ClientIdManager } from \"../client-id/client-id\";\nimport { Environment } from \"../environment/environment\";\nimport { RelayPayload } from \"../internal-types\";\nimport { RelayConfig } from \"../relay\";\nimport { createMeta, Meta } from \"./meta/meta\";\n\nexport interface RelayEvent extends RelayPayload {\n meta: Readonly<Meta>;\n}\n\nexport function createRelayEvent(\n type: string,\n payload: RelayPayload,\n config: RelayConfig,\n environment: Environment,\n clientIdManager: ClientIdManager\n): Readonly<RelayEvent> {\n return {\n ...payload,\n meta: createMeta(type, config, environment, clientIdManager),\n };\n}\n","import { Environment } from \"../environment/environment\";\nimport { ListenerManager } from \"../listener/listener\";\nimport { RelayEvent } from \"../event/relay-event\";\nimport { RelayConfig } from \"../relay\";\n\nexport interface EmitParams {\n config: RelayConfig;\n environment: Environment;\n event: RelayEvent;\n listenerManager: ListenerManager;\n}\n\nexport function emit({\n config,\n environment,\n event,\n listenerManager,\n}: EmitParams) {\n const { url, token, mode } = config;\n const isEnabled = mode !== \"disabled\";\n\n if (isEnabled) {\n listenerManager.call(event);\n environment.send(url, token, event);\n }\n}\n"],"names":["REGEX","createClientIdManager","environmentManager","key","getClientId","environment","get","storage","existingClientId","getItem","clientId","uuid","test","generateUUID","setItem","clear","removeItem","version","getSource","config","source","concat","createMeta","type","clientIdManager","getReferrer","getLocation","getUserAgent","eventConfig","trackingId","getEventConfig","Object","freeze","ts","Date","now","userAgent","referrer","location","ANY_EVENT_TYPE","createListenerManager","listeners","getListenerIndex","callback","findIndex","listener","remove","index","splice","removeOne","length","i","removeMultiple","add","push","call","event","forEach","isMatchesType","meta","e","console","error","pick","url","token","rest","mode","cookieManager","prefix","cookiePrefix","cookieArray","document","cookie","split","prettifyCookie","replace","lastIndexOf","substring","data","expire","domain","host","parts","slice","join","getDomain","window","hostname","expireSection","getTime","toUTCString","domainSection","this","createCookieManager","buildBrowserEnvironment","runtime","send","response","navigator","sendBeacon","Blob","JSON","stringify","messenger","isBrowser","sendMessage","message","postMessage","createExplorerMessenger","kind","Error","href","crypto","randomUUID","localStorage","buildEnvironment","configManager","createRelay","initialConfig","_config","update","updatedConfig","createConfigManager","listenerManager","createEnvironmentManager","emit","payload","createRelayEvent","getMeta","on","off","updateConfig","clearStorage"],"mappings":"AAAA,IAAAA,EAAe,sHCQT,SAAUC,EACdC,GAEA,MAAMC,EAAM,YAEZ,MAAO,CACLC,YAAa,KACX,MAAMC,EAAcH,EAAmBI,MACjCC,EAAUF,EAAYE,QAEtBC,EAAmBD,EAAQE,QAAQN,GACnCO,EACJF,ICjBiB,iBADPG,EDkBmBH,ICjBAR,EAAMY,KAAKD,IDkBpCH,EACAH,EAAYQ,eCpBxB,IAAkBF,EDsBZ,OADAJ,EAAQO,QAAQX,EAAKO,GACdA,CAAQ,EAEjBK,MAAO,KACLb,EAAmBI,MAAMC,QAAQS,WAAWb,EAAI,EAGtD,CE9BO,MAAMc,EAAU,QCiEvB,SAASC,EAAUC,GACjB,OAAQA,EAAOC,QAAU,IAAIC,OAAO,CAAC,SAASJ,KAChD,CAEM,SAAUK,EACdC,EACAJ,EACAd,EACAmB,GAEA,MAAMC,YAAEA,EAAWC,YAAEA,EAAWC,aAAEA,GA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IAAMyB,OAAOC,OAAOoF,EAAiBC,IAE9C,CG6C6BQ,CAAyBR,GAC9C7F,EAAkBvB,EAAsBC,GAE9C,MAAO,CACL4H,KAAM,CAACvG,EAAcwG,KACnB,MAAM5G,EAASkG,EAAc/G,MACvBD,EAAcH,EAAmBI,MAEjCkD,EC5EN,SACJjC,EACAwG,EACA5G,EACAd,EACAmB,GAEA,MAAO,IACFuG,EACHpE,KAAMrC,EAAWC,EAAMJ,EAAQd,EAAamB,GAEhD,CDiEoBwG,CACZzG,EACAwG,EACA5G,EACAd,EACAmB,GAGF,OElFA,UAAeL,OACnBA,EAAMd,YACNA,EAAWmD,MACXA,EAAKoE,gBACLA,IAEA,MAAM5D,IAAEA,EAAGC,MAAEA,EAAKE,KAAEA,GAAShD,EACF,aAATgD,IAGhByD,EAAgBrE,KAAKC,GACrBnD,EAAY4F,KAAKjC,EAAKC,EAAOT,GAEjC,CFqEasE,CAAK,CACV3G,SACAd,cACAmD,QACAoE,mBACA,EAEJK,QAAU1G,GACRD,EACEC,EACA8F,EAAc/G,MACdJ,EAAmBI,MACnBkB,GAEJ0G,GAAI,CAAC3G,EAAcoB,IACjBiF,EAAgBvE,IAAI,CAAE9B,OAAMoB,aAC9BwF,IAAK,CAAC5G,EAAcoB,IAClBiF,EAAgB9E,OAAOvB,EAAMoB,GAC/ByF,aAAejH,GACbkG,EAAcI,OAAOtG,GACvBF,UACAoH,aAAc,KACZ7G,EAAgBT,OAAO,EAG7B","x_google_ignoreList":[0,2,9]}
|
|
1
|
+
{"version":3,"file":"relay.min.js","sources":["../../../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/regex.js","../../src/client-id/client-id.ts","../../../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/validate.js","../../src/version.ts","../../src/event/meta/meta.ts","../../src/listener/listener.ts","../../src/config/config.ts","../../src/environment/browser/storage/cookie.ts","../../src/environment/browser/browser.ts","../../../../node_modules/.pnpm/@coveo+explorer-messenger@0.1.1/node_modules/@coveo/explorer-messenger/dist/messenger.js","../../src/environment/browser/storage/storage.ts","../../src/environment/manager/manager.ts","../../src/environment/null/null.ts","../../src/environment/storage.ts","../../src/relay.ts","../../src/event/relay-event.ts","../../src/emit/emit.ts"],"sourcesContent":["export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;","import { validate } from \"uuid\";\nimport { EnvironmentManager } from \"../environment/manager/manager\";\n\nexport interface ClientIdManager {\n getClientId: () => string;\n clear: () => void;\n}\n\nexport function createClientIdManager(\n environmentManager: EnvironmentManager\n): ClientIdManager {\n const key = \"visitorId\";\n\n return {\n getClientId: () => {\n const environment = environmentManager.get();\n const storage = environment.storage;\n\n const existingClientId = storage.getItem(key);\n const clientId =\n existingClientId && validate(existingClientId)\n ? existingClientId\n : environment.generateUUID();\n storage.setItem(key, clientId);\n return clientId;\n },\n clear: () => {\n environmentManager.get().storage.removeItem(key);\n },\n };\n}\n","import REGEX from './regex.js';\n\nfunction validate(uuid) {\n return typeof uuid === 'string' && REGEX.test(uuid);\n}\n\nexport default validate;","export const version = \"process.env.VERSION\";\n","import { ClientIdManager } from \"../../client-id/client-id\";\nimport { Environment } from \"../../environment/environment\";\nimport { RelayConfig, User } from \"../../config/config\";\nimport { version } from \"../../version\";\n\n/**\n * The `EventConfig` object provides additonal information for the configuration associated with the event.\n */\nexport interface EventConfig {\n /**\n * The unique identifier of a web property. See [Tracking ID](https://docs.coveo.com/en/n8tg0567/).\n */\n trackingId: string;\n}\n\n/**\n * The `Meta` object provides a structured representation of metadata associated with an emitted event.\n */\nexport interface Meta {\n /**\n * Event's type that was emitted.\n */\n type: string;\n\n /**\n * Configuration associated with the event.\n */\n config: EventConfig;\n\n /**\n * Timestamp when the event was emitted.\n */\n ts: number;\n\n /**\n * Names and versions of the client side libraries which built and emitted this event.\n */\n source: string[];\n\n /**\n * Persistent unique identifier of a device.\n */\n clientId: string;\n\n /**\n * Named user identity which logged this event.\n */\n user: User | null;\n\n /**\n * Browser Navigator's [user agent](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent) property if set.\n */\n userAgent: string | null;\n\n /**\n * Browser Document's [referrer](https://developer.mozilla.org/en-US/docs/Web/API/Document/referrer) property if set.\n */\n referrer: string | null;\n\n /**\n * Browser Location's [href](https://developer.mozilla.org/en-US/docs/Web/API/Location/href) property if set.\n */\n location: string | null;\n}\n\nfunction getEventConfig(config: RelayConfig): EventConfig {\n const { trackingId } = config;\n return { trackingId };\n}\n\nfunction getSource(config: RelayConfig): string[] {\n return (config.source || []).concat([`relay@${version}`]);\n}\n\nexport function createMeta(\n type: string,\n config: RelayConfig,\n environment: Environment,\n clientIdManager: ClientIdManager\n): Readonly<Meta> {\n const { getReferrer, getLocation, getUserAgent } = environment;\n const eventConfig = getEventConfig(config);\n const clientId = clientIdManager.getClientId();\n\n return Object.freeze({\n type,\n config: eventConfig,\n ts: Date.now(),\n source: getSource(config),\n clientId,\n user: null,\n userAgent: getUserAgent(),\n referrer: getReferrer(),\n location: getLocation(),\n });\n}\n","import { RelayEvent } from \"../event/relay-event\";\n\nconst ANY_EVENT_TYPE = \"*\";\n\n/**\n * Callback to perform an action when a specified event is emitted.\n * @typedef {function} EventCallback\n * @param {RelayEvent} event\n * @returns {void}\n */\nexport type EventCallback = (event: RelayEvent) => void;\n\ninterface Listener {\n type: string;\n callback: EventCallback;\n}\n\nexport interface ListenerManager {\n add: (listener: Listener) => () => void;\n call: (event: RelayEvent) => void;\n remove: (type: string, callback?: EventCallback) => void;\n}\n\nexport function createListenerManager(): ListenerManager {\n const listeners: Listener[] = [];\n\n function getListenerIndex({ type, callback }: Listener): number {\n return listeners.findIndex(\n (listener) => listener.type === type && listener.callback === callback\n );\n }\n\n function isMatchesType(listener: Listener, type: string): boolean {\n return listener.type === \"*\" || type === listener.type;\n }\n\n function add(listener: Listener): () => void {\n if (getListenerIndex(listener) < 0) {\n listeners.push(listener);\n }\n return () => remove(listener.type, listener.callback);\n }\n\n function call(event: RelayEvent) {\n listeners.forEach((listener) => {\n if (isMatchesType(listener, event.meta.type)) {\n try {\n listener.callback(event);\n } catch (e) {\n console.error(e);\n }\n }\n });\n }\n\n function removeMultiple(type: string) {\n if (type === ANY_EVENT_TYPE) {\n listeners.length = 0;\n } else {\n for (let i = listeners.length - 1; i >= 0; i--) {\n if (listeners[i].type === type) {\n listeners.splice(i, 1);\n }\n }\n }\n }\n\n function removeOne(listener: Listener) {\n const index = getListenerIndex(listener);\n if (index >= 0) {\n listeners.splice(index, 1);\n }\n }\n\n function remove(type: string, callback?: EventCallback) {\n !!callback ? removeOne({ type, callback }) : removeMultiple(type);\n }\n\n return {\n add,\n call,\n remove,\n };\n}\n","export type RelayMode = \"emit\" | \"disabled\";\n\n/**\n * The `RelayConfig` object defines the configuration options for initializing a Relay instance.\n */\nexport interface RelayConfig {\n /**\n * Endpoint defined to communicate with the Event API.\n */\n url: string;\n\n /**\n * Token to authorize the access to the Event API endpoint.\n */\n token: string;\n\n /**\n * The unique identifier of a web property. See [Tracking ID](https://docs.coveo.com/en/n8tg0567/).\n */\n trackingId: string;\n\n /**\n * Defines the library mode. The possible values are:\n * \"emit\": Sends analytics events to Coveo to be stored.\n * \"disabled\": Prevents the emission of events and does not trigger callbacks.\n * @default emit\n */\n mode?: RelayMode;\n\n /**\n * Optionally allows a Relay integration to specify the name(s) of software package(s) relay is\n * being called from. These names will be transmitted with each event, along with Relay's own\n * version. The recommendation is to specify them using a 'softwarename@softwareversion' string.\n */\n source?: string[];\n}\n\nexport interface User {\n /**\n * The application's user identifier.\n */\n id: string;\n}\n\nexport interface ConfigManager {\n get: () => Readonly<RelayConfig>;\n update: (updatedConfig: Partial<RelayConfig>) => void;\n}\n\nfunction pick({\n url,\n token,\n trackingId,\n ...rest\n}: RelayConfig): Readonly<RelayConfig> {\n return Object.freeze({\n url,\n token,\n trackingId,\n ...(!!rest.mode && { mode: rest.mode }),\n ...(!!rest.source && { source: rest.source }),\n });\n}\n\nexport function createConfigManager(\n initialConfig: RelayConfig\n): Readonly<ConfigManager> {\n let _config: Readonly<RelayConfig> = pick(initialConfig);\n\n return {\n get: () => _config,\n update: (updatedConfig: Partial<RelayConfig>) => {\n _config = pick({ ..._config, ...updatedConfig });\n },\n };\n}\n","export interface CookieManager {\n getItem: (key: string) => string | null;\n removeItem: (key: string) => void;\n setItem: (key: string, data: string, expire: number) => void;\n}\n\nexport const cookieManager: CookieManager = createCookieManager();\n\nfunction createCookieManager(): CookieManager {\n const prefix = \"coveo_\";\n const getDomain = (host: string) => {\n const parts = host.split(\".\").slice(-2);\n return parts.length == 2 ? parts.join(\".\") : \"\";\n };\n\n return {\n getItem(key: string): string | null {\n const cookiePrefix = `${prefix}${key}=`;\n const cookieArray = document.cookie.split(\";\");\n for (const cookie of cookieArray) {\n const prettifyCookie = cookie.replace(/^\\s+/, \"\");\n if (prettifyCookie.lastIndexOf(cookiePrefix, 0) === 0) {\n return prettifyCookie.substring(\n cookiePrefix.length,\n prettifyCookie.length\n );\n }\n }\n return null;\n },\n setItem(key: string, data: string, expire: number): void {\n const domain = getDomain(window.location.hostname);\n const expireSection = `;expires=${new Date(\n new Date().getTime() + expire\n ).toUTCString()}`;\n const domainSection = domain ? `;domain=${domain}` : \"\";\n document.cookie = `${prefix}${key}=${data}${expireSection}${domainSection};path=/;SameSite=Lax`;\n },\n\n removeItem(key: string): void {\n this.setItem(key, \"\", -1);\n },\n };\n}\n","import { createExplorerMessenger } from \"@coveo/explorer-messenger\";\nimport { Environment } from \"../environment\";\nimport { createBrowserStorage } from \"./storage/storage\";\nimport { RelayEvent } from \"../../event/relay-event\";\n\nfunction getReferrer() {\n const referrer = document.referrer;\n\n return referrer === \"\" ? null : referrer;\n}\n\nexport function buildBrowserEnvironment(): Environment {\n return {\n runtime: \"browser\",\n send: (url: string, token: string, event: RelayEvent) => {\n const response = navigator.sendBeacon(\n `${url}?access_token=${token}`,\n new Blob([JSON.stringify([event])], {\n type: \"application/json\",\n })\n );\n\n const messenger = createExplorerMessenger();\n messenger.sendMessage({ kind: \"EVENT_PROTOCOL\", event, url, token });\n\n if (!response) {\n throw new Error(\n `Failed to send the event(s) because the payload size exceeded the maximum allowed size (32 KB). Please contact support if the problem persists.`\n );\n }\n },\n getReferrer: () => getReferrer(),\n getLocation: () => window.location.href,\n getUserAgent: () => navigator.userAgent,\n generateUUID: () => crypto.randomUUID(),\n storage: createBrowserStorage(),\n };\n}\n","function createExplorerMessenger() {\n const isBrowser = typeof window !== \"undefined\";\n return {\n sendMessage(message) {\n isBrowser && window.postMessage(message, \"*\");\n }\n };\n}\nexport {\n createExplorerMessenger\n};\n","import { Storage } from \"../../storage\";\nimport { cookieManager } from \"./cookie\";\n\nexport function createBrowserStorage(): Storage {\n return {\n getItem(key: string): string | null {\n return cookieManager.getItem(key) || localStorage.getItem(key);\n },\n\n removeItem(key: string): void {\n cookieManager.removeItem(key);\n localStorage.removeItem(key);\n },\n\n setItem(key: string, data: string): void {\n const oneYear = 31556952000;\n localStorage.setItem(key, data);\n cookieManager.setItem(key, data, oneYear);\n },\n };\n}\n","import { ConfigManager } from \"../../config/config\";\nimport { buildBrowserEnvironment } from \"../browser/browser\";\nimport { Environment } from \"../environment\";\nimport { buildNullEnvironment } from \"../null/null\";\n\nexport interface EnvironmentManager {\n get: () => Readonly<Environment>;\n}\n\nfunction buildEnvironment(configManager: ConfigManager) {\n const active = configManager.get().mode !== \"disabled\";\n\n if (active && isBrowser()) {\n return buildBrowserEnvironment();\n }\n\n return buildNullEnvironment();\n}\n\nfunction isBrowser() {\n try {\n return typeof window === \"object\";\n } catch (e) {\n return false;\n }\n}\n\nexport function createEnvironmentManager(\n configManager: ConfigManager\n): Readonly<EnvironmentManager> {\n return {\n get: () => Object.freeze(buildEnvironment(configManager)),\n };\n}\n","import { Environment } from \"../environment\";\nimport { createNullStorage } from \"../storage\";\n\nexport function buildNullEnvironment(): Environment {\n return {\n runtime: \"null\",\n send: () => undefined,\n getReferrer: () => null,\n getLocation: () => null,\n getUserAgent: () => null,\n generateUUID: () => \"\",\n storage: createNullStorage(),\n };\n}\n","export interface Storage {\n getItem: (key: string) => string | null;\n removeItem: (key: string) => void;\n setItem: (key: string, data: string) => void;\n}\n\nexport function createNullStorage(): Storage {\n return {\n getItem(): string | null {\n return null;\n },\n removeItem(): void {\n return;\n },\n setItem(): void {\n return;\n },\n };\n}\n","import { emit } from \"./emit/emit\";\nimport { createClientIdManager } from \"./client-id/client-id\";\nimport { createRelayEvent } from \"./event/relay-event\";\nimport { version } from \"./version\";\nimport { createMeta, Meta, EventConfig } from \"./event/meta/meta\";\nimport { createListenerManager, EventCallback } from \"./listener/listener\";\nimport { createConfigManager, RelayConfig } from \"./config/config\";\nimport { createEnvironmentManager } from \"./environment/manager/manager\";\n\ntype Off = () => void;\n\n/**\n * Relay instance.\n * This object provides a comprehensive set of variables and methods for interacting with the Event API.\n */\ninterface Relay {\n /**\n * Sends an event to the Event API.\n * @param {string} type - event's type to be emitted.\n * @param {Record<string,any>} payload - payload to include within the event.\n * @returns {void}\n */\n emit: (type: string, payload: Record<string, any>) => void;\n\n /**\n * Gets the client-side generated meta object.\n * @param {string} type - event's type that will be included in the meta object.\n * @returns {Meta}\n */\n getMeta: (type: string) => Meta;\n\n /**\n * Attaches an event callback to either all event types or a specific one.\n * The callback set will be called when an event with the specified type is emitted.\n * Setting type as \"*\" will trigger the callback for all event types.\n * Returns the \"off\" function to detach the event callback.\n * @param {string} type - event's type.\n * @param {EventCallback} callback\n * @returns {Off}\n */\n on: (type: string, callback: EventCallback) => Off;\n\n /**\n * Detach callback(s) from events.\n * If only the \"type\" parameter is set, all callbacks for the specified type will be removed.\n * @param {string} type - event's type.\n * @param {EventCallback} callback - callback that should be removed.\n * @returns {void}\n */\n off: (type: string, callback?: EventCallback) => void;\n\n /**\n * Updates Relay's configuration after its initialization.\n * @param {Partial<RelayConfig>} config - configuration that should be updated.\n * @returns {void}\n */\n updateConfig: (config: Partial<RelayConfig>) => void;\n\n /**\n * Current version of the Relay library.\n */\n version: string;\n\n /**\n * Removes the visitorId cookie and localStorage key.\n * @returns {void}\n */\n clearStorage: () => void;\n}\n\n/**\n * Initializes the Relay library object.\n * @param {RelayConfig} initialConfig\n * @returns {Relay}\n */\nexport function createRelay(initialConfig: RelayConfig): Relay {\n const configManager = createConfigManager(initialConfig);\n const listenerManager = createListenerManager();\n const environmentManager = createEnvironmentManager(configManager);\n const clientIdManager = createClientIdManager(environmentManager);\n\n return {\n emit: (type: string, payload: Record<string, any>) => {\n const config = configManager.get();\n const environment = environmentManager.get();\n\n const event = createRelayEvent(\n type,\n payload,\n config,\n environment,\n clientIdManager\n );\n\n return emit({\n config,\n environment,\n event,\n listenerManager,\n });\n },\n getMeta: (type: string) =>\n createMeta(\n type,\n configManager.get(),\n environmentManager.get(),\n clientIdManager\n ),\n on: (type: string, callback: EventCallback) =>\n listenerManager.add({ type, callback }),\n off: (type: string, callback?: EventCallback) =>\n listenerManager.remove(type, callback),\n updateConfig: (config: Partial<RelayConfig>) =>\n configManager.update(config),\n version,\n clearStorage: () => {\n clientIdManager.clear();\n },\n };\n}\n\nexport type { Relay, Meta, EventConfig, EventCallback, RelayConfig };\n","import { ClientIdManager } from \"../client-id/client-id\";\nimport { Environment } from \"../environment/environment\";\nimport { RelayPayload } from \"../internal-types\";\nimport { RelayConfig } from \"../relay\";\nimport { createMeta, Meta } from \"./meta/meta\";\n\nexport interface RelayEvent extends RelayPayload {\n meta: Readonly<Meta>;\n}\n\nexport function createRelayEvent(\n type: string,\n payload: RelayPayload,\n config: RelayConfig,\n environment: Environment,\n clientIdManager: ClientIdManager\n): Readonly<RelayEvent> {\n return {\n ...payload,\n meta: createMeta(type, config, environment, clientIdManager),\n };\n}\n","import { Environment } from \"../environment/environment\";\nimport { ListenerManager } from \"../listener/listener\";\nimport { RelayEvent } from \"../event/relay-event\";\nimport { RelayConfig } from \"../relay\";\n\nexport interface EmitParams {\n config: RelayConfig;\n environment: Environment;\n event: RelayEvent;\n listenerManager: ListenerManager;\n}\n\nexport function emit({\n config,\n environment,\n event,\n listenerManager,\n}: EmitParams) {\n const { url, token, mode } = config;\n const isEnabled = mode !== \"disabled\";\n\n if (isEnabled) {\n listenerManager.call(event);\n environment.send(url, token, event);\n }\n}\n"],"names":["REGEX","createClientIdManager","environmentManager","key","getClientId","environment","get","storage","existingClientId","getItem","clientId","uuid","test","generateUUID","setItem","clear","removeItem","version","getSource","config","source","concat","createMeta","type","clientIdManager","getReferrer","getLocation","getUserAgent","eventConfig","trackingId","getEventConfig","Object","freeze","ts","Date","now","user","userAgent","referrer","location","ANY_EVENT_TYPE","createListenerManager","listeners","getListenerIndex","callback","findIndex","listener","remove","index","splice","removeOne","length","i","removeMultiple","add","push","call","event","forEach","isMatchesType","meta","e","console","error","pick","url","token","rest","mode","cookieManager","prefix","cookiePrefix","cookieArray","document","cookie","split","prettifyCookie","replace","lastIndexOf","substring","data","expire","domain","host","parts","slice","join","getDomain","window","hostname","expireSection","getTime","toUTCString","domainSection","this","createCookieManager","buildBrowserEnvironment","runtime","send","response","navigator","sendBeacon","Blob","JSON","stringify","messenger","isBrowser","sendMessage","message","postMessage","createExplorerMessenger","kind","Error","href","crypto","randomUUID","localStorage","buildEnvironment","configManager","createRelay","initialConfig","_config","update","updatedConfig","createConfigManager","listenerManager","createEnvironmentManager","emit","payload","createRelayEvent","getMeta","on","off","updateConfig","clearStorage"],"mappings":"AAAA,IAAAA,EAAe,sHCQT,SAAUC,EACdC,GAEA,MAAMC,EAAM,YAEZ,MAAO,CACLC,YAAa,KACX,MAAMC,EAAcH,EAAmBI,MACjCC,EAAUF,EAAYE,QAEtBC,EAAmBD,EAAQE,QAAQN,GACnCO,EACJF,ICjBiB,iBADPG,EDkBmBH,ICjBAR,EAAMY,KAAKD,IDkBpCH,EACAH,EAAYQ,eCpBxB,IAAkBF,EDsBZ,OADAJ,EAAQO,QAAQX,EAAKO,GACdA,C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ig {
|
|
|
29
29
|
*/
|
|
30
30
|
source?: string[];
|
|
31
31
|
}
|
|
32
|
+
export interface User {
|
|
33
|
+
/**
|
|
34
|
+
* The application's user identifier.
|
|
35
|
+
*/
|
|
36
|
+
id: string;
|
|
37
|
+
}
|
|
32
38
|
export interface ConfigManager {
|
|
33
39
|
get: () => Readonly<RelayConfig>;
|
|
34
40
|
update: (updatedConfig: Partial<RelayConfig>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config/config.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,QAAQ,CAAC,WAAW,CAAC,CAAC;IACjC,MAAM,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CACvD;AAiBD,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,WAAW,GACzB,QAAQ,CAAC,aAAa,CAAC,CASzB"}
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config/config.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,IAAI;IACnB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,QAAQ,CAAC,WAAW,CAAC,CAAC;IACjC,MAAM,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CACvD;AAiBD,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,WAAW,GACzB,QAAQ,CAAC,aAAa,CAAC,CASzB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ClientIdManager } from "../../client-id/client-id";
|
|
2
2
|
import { Environment } from "../../environment/environment";
|
|
3
|
-
import { RelayConfig } from "../../config/config";
|
|
3
|
+
import { RelayConfig, User } from "../../config/config";
|
|
4
4
|
/**
|
|
5
5
|
* The `EventConfig` object provides additonal information for the configuration associated with the event.
|
|
6
6
|
*/
|
|
@@ -34,6 +34,10 @@ export interface Meta {
|
|
|
34
34
|
* Persistent unique identifier of a device.
|
|
35
35
|
*/
|
|
36
36
|
clientId: string;
|
|
37
|
+
/**
|
|
38
|
+
* Named user identity which logged this event.
|
|
39
|
+
*/
|
|
40
|
+
user: User | null;
|
|
37
41
|
/**
|
|
38
42
|
* Browser Navigator's [user agent](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent) property if set.
|
|
39
43
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../../src/event/meta/meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../../src/event/meta/meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,MAAM,EAAE,WAAW,CAAC;IAEpB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAElB;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAWD,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,WAAW,EACnB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,eAAe,GAC/B,QAAQ,CAAC,IAAI,CAAC,CAgBhB"}
|
package/lib/docs/relay-docs.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"flags": {},
|
|
7
7
|
"children": [
|
|
8
8
|
{
|
|
9
|
-
"id":
|
|
9
|
+
"id": 42,
|
|
10
10
|
"name": "EventConfig",
|
|
11
11
|
"variant": "declaration",
|
|
12
12
|
"kind": 256,
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"children": [
|
|
31
31
|
{
|
|
32
|
-
"id":
|
|
32
|
+
"id": 43,
|
|
33
33
|
"name": "trackingId",
|
|
34
34
|
"variant": "declaration",
|
|
35
35
|
"kind": 1024,
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"fileName": "event/meta/meta.ts",
|
|
48
48
|
"line": 13,
|
|
49
49
|
"character": 2,
|
|
50
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
50
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/event/meta/meta.ts#L13"
|
|
51
51
|
}
|
|
52
52
|
],
|
|
53
53
|
"type": {
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
{
|
|
61
61
|
"title": "Properties",
|
|
62
62
|
"children": [
|
|
63
|
-
|
|
63
|
+
43
|
|
64
64
|
]
|
|
65
65
|
}
|
|
66
66
|
],
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"fileName": "event/meta/meta.ts",
|
|
70
70
|
"line": 9,
|
|
71
71
|
"character": 17,
|
|
72
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
72
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/event/meta/meta.ts#L9"
|
|
73
73
|
}
|
|
74
74
|
]
|
|
75
75
|
},
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"fileName": "event/meta/meta.ts",
|
|
116
116
|
"line": 43,
|
|
117
117
|
"character": 2,
|
|
118
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
118
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/event/meta/meta.ts#L43"
|
|
119
119
|
}
|
|
120
120
|
],
|
|
121
121
|
"type": {
|
|
@@ -142,18 +142,18 @@
|
|
|
142
142
|
"fileName": "event/meta/meta.ts",
|
|
143
143
|
"line": 28,
|
|
144
144
|
"character": 2,
|
|
145
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
145
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/event/meta/meta.ts#L28"
|
|
146
146
|
}
|
|
147
147
|
],
|
|
148
148
|
"type": {
|
|
149
149
|
"type": "reference",
|
|
150
|
-
"target":
|
|
150
|
+
"target": 42,
|
|
151
151
|
"name": "EventConfig",
|
|
152
152
|
"package": "@coveo/relay"
|
|
153
153
|
}
|
|
154
154
|
},
|
|
155
155
|
{
|
|
156
|
-
"id":
|
|
156
|
+
"id": 41,
|
|
157
157
|
"name": "location",
|
|
158
158
|
"variant": "declaration",
|
|
159
159
|
"kind": 1024,
|
|
@@ -169,9 +169,9 @@
|
|
|
169
169
|
"sources": [
|
|
170
170
|
{
|
|
171
171
|
"fileName": "event/meta/meta.ts",
|
|
172
|
-
"line":
|
|
172
|
+
"line": 63,
|
|
173
173
|
"character": 2,
|
|
174
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
174
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/event/meta/meta.ts#L63"
|
|
175
175
|
}
|
|
176
176
|
],
|
|
177
177
|
"type": {
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
}
|
|
190
190
|
},
|
|
191
191
|
{
|
|
192
|
-
"id":
|
|
192
|
+
"id": 40,
|
|
193
193
|
"name": "referrer",
|
|
194
194
|
"variant": "declaration",
|
|
195
195
|
"kind": 1024,
|
|
@@ -205,9 +205,9 @@
|
|
|
205
205
|
"sources": [
|
|
206
206
|
{
|
|
207
207
|
"fileName": "event/meta/meta.ts",
|
|
208
|
-
"line":
|
|
208
|
+
"line": 58,
|
|
209
209
|
"character": 2,
|
|
210
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
210
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/event/meta/meta.ts#L58"
|
|
211
211
|
}
|
|
212
212
|
],
|
|
213
213
|
"type": {
|
|
@@ -243,7 +243,7 @@
|
|
|
243
243
|
"fileName": "event/meta/meta.ts",
|
|
244
244
|
"line": 38,
|
|
245
245
|
"character": 2,
|
|
246
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
246
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/event/meta/meta.ts#L38"
|
|
247
247
|
}
|
|
248
248
|
],
|
|
249
249
|
"type": {
|
|
@@ -273,7 +273,7 @@
|
|
|
273
273
|
"fileName": "event/meta/meta.ts",
|
|
274
274
|
"line": 33,
|
|
275
275
|
"character": 2,
|
|
276
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
276
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/event/meta/meta.ts#L33"
|
|
277
277
|
}
|
|
278
278
|
],
|
|
279
279
|
"type": {
|
|
@@ -300,7 +300,7 @@
|
|
|
300
300
|
"fileName": "event/meta/meta.ts",
|
|
301
301
|
"line": 23,
|
|
302
302
|
"character": 2,
|
|
303
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
303
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/event/meta/meta.ts#L23"
|
|
304
304
|
}
|
|
305
305
|
],
|
|
306
306
|
"type": {
|
|
@@ -310,6 +310,47 @@
|
|
|
310
310
|
},
|
|
311
311
|
{
|
|
312
312
|
"id": 38,
|
|
313
|
+
"name": "user",
|
|
314
|
+
"variant": "declaration",
|
|
315
|
+
"kind": 1024,
|
|
316
|
+
"flags": {},
|
|
317
|
+
"comment": {
|
|
318
|
+
"summary": [
|
|
319
|
+
{
|
|
320
|
+
"kind": "text",
|
|
321
|
+
"text": "Named user identity which logged this event."
|
|
322
|
+
}
|
|
323
|
+
]
|
|
324
|
+
},
|
|
325
|
+
"sources": [
|
|
326
|
+
{
|
|
327
|
+
"fileName": "event/meta/meta.ts",
|
|
328
|
+
"line": 48,
|
|
329
|
+
"character": 2,
|
|
330
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/event/meta/meta.ts#L48"
|
|
331
|
+
}
|
|
332
|
+
],
|
|
333
|
+
"type": {
|
|
334
|
+
"type": "union",
|
|
335
|
+
"types": [
|
|
336
|
+
{
|
|
337
|
+
"type": "literal",
|
|
338
|
+
"value": null
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"type": "reference",
|
|
342
|
+
"target": {
|
|
343
|
+
"sourceFileName": "src/config/config.ts",
|
|
344
|
+
"qualifiedName": "User"
|
|
345
|
+
},
|
|
346
|
+
"name": "User",
|
|
347
|
+
"package": "@coveo/relay"
|
|
348
|
+
}
|
|
349
|
+
]
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"id": 39,
|
|
313
354
|
"name": "userAgent",
|
|
314
355
|
"variant": "declaration",
|
|
315
356
|
"kind": 1024,
|
|
@@ -325,9 +366,9 @@
|
|
|
325
366
|
"sources": [
|
|
326
367
|
{
|
|
327
368
|
"fileName": "event/meta/meta.ts",
|
|
328
|
-
"line":
|
|
369
|
+
"line": 53,
|
|
329
370
|
"character": 2,
|
|
330
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
371
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/event/meta/meta.ts#L53"
|
|
331
372
|
}
|
|
332
373
|
],
|
|
333
374
|
"type": {
|
|
@@ -351,12 +392,13 @@
|
|
|
351
392
|
"children": [
|
|
352
393
|
37,
|
|
353
394
|
34,
|
|
395
|
+
41,
|
|
354
396
|
40,
|
|
355
|
-
39,
|
|
356
397
|
36,
|
|
357
398
|
35,
|
|
358
399
|
33,
|
|
359
|
-
38
|
|
400
|
+
38,
|
|
401
|
+
39
|
|
360
402
|
]
|
|
361
403
|
}
|
|
362
404
|
],
|
|
@@ -365,7 +407,7 @@
|
|
|
365
407
|
"fileName": "event/meta/meta.ts",
|
|
366
408
|
"line": 19,
|
|
367
409
|
"character": 17,
|
|
368
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
410
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/event/meta/meta.ts#L19"
|
|
369
411
|
}
|
|
370
412
|
]
|
|
371
413
|
},
|
|
@@ -395,7 +437,7 @@
|
|
|
395
437
|
"fileName": "relay.ts",
|
|
396
438
|
"line": 68,
|
|
397
439
|
"character": 2,
|
|
398
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
440
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/relay.ts#L68"
|
|
399
441
|
}
|
|
400
442
|
],
|
|
401
443
|
"type": {
|
|
@@ -411,7 +453,7 @@
|
|
|
411
453
|
"fileName": "relay.ts",
|
|
412
454
|
"line": 68,
|
|
413
455
|
"character": 16,
|
|
414
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
456
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/relay.ts#L68"
|
|
415
457
|
}
|
|
416
458
|
],
|
|
417
459
|
"signatures": [
|
|
@@ -440,7 +482,7 @@
|
|
|
440
482
|
"fileName": "relay.ts",
|
|
441
483
|
"line": 68,
|
|
442
484
|
"character": 16,
|
|
443
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
485
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/relay.ts#L68"
|
|
444
486
|
}
|
|
445
487
|
],
|
|
446
488
|
"type": {
|
|
@@ -463,7 +505,7 @@
|
|
|
463
505
|
"fileName": "relay.ts",
|
|
464
506
|
"line": 23,
|
|
465
507
|
"character": 2,
|
|
466
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
508
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/relay.ts#L23"
|
|
467
509
|
}
|
|
468
510
|
],
|
|
469
511
|
"type": {
|
|
@@ -479,7 +521,7 @@
|
|
|
479
521
|
"fileName": "relay.ts",
|
|
480
522
|
"line": 23,
|
|
481
523
|
"character": 8,
|
|
482
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
524
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/relay.ts#L23"
|
|
483
525
|
}
|
|
484
526
|
],
|
|
485
527
|
"signatures": [
|
|
@@ -508,7 +550,7 @@
|
|
|
508
550
|
"fileName": "relay.ts",
|
|
509
551
|
"line": 23,
|
|
510
552
|
"character": 8,
|
|
511
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
553
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/relay.ts#L23"
|
|
512
554
|
}
|
|
513
555
|
],
|
|
514
556
|
"parameters": [
|
|
@@ -586,7 +628,7 @@
|
|
|
586
628
|
"fileName": "relay.ts",
|
|
587
629
|
"line": 30,
|
|
588
630
|
"character": 2,
|
|
589
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
631
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/relay.ts#L30"
|
|
590
632
|
}
|
|
591
633
|
],
|
|
592
634
|
"type": {
|
|
@@ -602,7 +644,7 @@
|
|
|
602
644
|
"fileName": "relay.ts",
|
|
603
645
|
"line": 30,
|
|
604
646
|
"character": 11,
|
|
605
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
647
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/relay.ts#L30"
|
|
606
648
|
}
|
|
607
649
|
],
|
|
608
650
|
"signatures": [
|
|
@@ -631,7 +673,7 @@
|
|
|
631
673
|
"fileName": "relay.ts",
|
|
632
674
|
"line": 30,
|
|
633
675
|
"character": 11,
|
|
634
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
676
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/relay.ts#L30"
|
|
635
677
|
}
|
|
636
678
|
],
|
|
637
679
|
"parameters": [
|
|
@@ -677,7 +719,7 @@
|
|
|
677
719
|
"fileName": "relay.ts",
|
|
678
720
|
"line": 50,
|
|
679
721
|
"character": 2,
|
|
680
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
722
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/relay.ts#L50"
|
|
681
723
|
}
|
|
682
724
|
],
|
|
683
725
|
"type": {
|
|
@@ -693,7 +735,7 @@
|
|
|
693
735
|
"fileName": "relay.ts",
|
|
694
736
|
"line": 50,
|
|
695
737
|
"character": 7,
|
|
696
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
738
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/relay.ts#L50"
|
|
697
739
|
}
|
|
698
740
|
],
|
|
699
741
|
"signatures": [
|
|
@@ -722,7 +764,7 @@
|
|
|
722
764
|
"fileName": "relay.ts",
|
|
723
765
|
"line": 50,
|
|
724
766
|
"character": 7,
|
|
725
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
767
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/relay.ts#L50"
|
|
726
768
|
}
|
|
727
769
|
],
|
|
728
770
|
"parameters": [
|
|
@@ -763,7 +805,7 @@
|
|
|
763
805
|
},
|
|
764
806
|
"type": {
|
|
765
807
|
"type": "reference",
|
|
766
|
-
"target":
|
|
808
|
+
"target": 44,
|
|
767
809
|
"name": "EventCallback",
|
|
768
810
|
"package": "@coveo/relay"
|
|
769
811
|
}
|
|
@@ -789,7 +831,7 @@
|
|
|
789
831
|
"fileName": "relay.ts",
|
|
790
832
|
"line": 41,
|
|
791
833
|
"character": 2,
|
|
792
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
834
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/relay.ts#L41"
|
|
793
835
|
}
|
|
794
836
|
],
|
|
795
837
|
"type": {
|
|
@@ -805,7 +847,7 @@
|
|
|
805
847
|
"fileName": "relay.ts",
|
|
806
848
|
"line": 41,
|
|
807
849
|
"character": 6,
|
|
808
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
850
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/relay.ts#L41"
|
|
809
851
|
}
|
|
810
852
|
],
|
|
811
853
|
"signatures": [
|
|
@@ -834,7 +876,7 @@
|
|
|
834
876
|
"fileName": "relay.ts",
|
|
835
877
|
"line": 41,
|
|
836
878
|
"character": 6,
|
|
837
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
879
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/relay.ts#L41"
|
|
838
880
|
}
|
|
839
881
|
],
|
|
840
882
|
"parameters": [
|
|
@@ -865,7 +907,7 @@
|
|
|
865
907
|
"flags": {},
|
|
866
908
|
"type": {
|
|
867
909
|
"type": "reference",
|
|
868
|
-
"target":
|
|
910
|
+
"target": 44,
|
|
869
911
|
"name": "EventCallback",
|
|
870
912
|
"package": "@coveo/relay"
|
|
871
913
|
}
|
|
@@ -896,7 +938,7 @@
|
|
|
896
938
|
"fileName": "relay.ts",
|
|
897
939
|
"line": 57,
|
|
898
940
|
"character": 2,
|
|
899
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
941
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/relay.ts#L57"
|
|
900
942
|
}
|
|
901
943
|
],
|
|
902
944
|
"type": {
|
|
@@ -912,7 +954,7 @@
|
|
|
912
954
|
"fileName": "relay.ts",
|
|
913
955
|
"line": 57,
|
|
914
956
|
"character": 16,
|
|
915
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
957
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/relay.ts#L57"
|
|
916
958
|
}
|
|
917
959
|
],
|
|
918
960
|
"signatures": [
|
|
@@ -941,7 +983,7 @@
|
|
|
941
983
|
"fileName": "relay.ts",
|
|
942
984
|
"line": 57,
|
|
943
985
|
"character": 16,
|
|
944
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
986
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/relay.ts#L57"
|
|
945
987
|
}
|
|
946
988
|
],
|
|
947
989
|
"parameters": [
|
|
@@ -968,7 +1010,7 @@
|
|
|
968
1010
|
"typeArguments": [
|
|
969
1011
|
{
|
|
970
1012
|
"type": "reference",
|
|
971
|
-
"target":
|
|
1013
|
+
"target": 48,
|
|
972
1014
|
"name": "RelayConfig",
|
|
973
1015
|
"package": "@coveo/relay"
|
|
974
1016
|
}
|
|
@@ -1006,7 +1048,7 @@
|
|
|
1006
1048
|
"fileName": "relay.ts",
|
|
1007
1049
|
"line": 62,
|
|
1008
1050
|
"character": 2,
|
|
1009
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
1051
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/relay.ts#L62"
|
|
1010
1052
|
}
|
|
1011
1053
|
],
|
|
1012
1054
|
"type": {
|
|
@@ -1034,12 +1076,12 @@
|
|
|
1034
1076
|
"fileName": "relay.ts",
|
|
1035
1077
|
"line": 16,
|
|
1036
1078
|
"character": 10,
|
|
1037
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
1079
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/relay.ts#L16"
|
|
1038
1080
|
}
|
|
1039
1081
|
]
|
|
1040
1082
|
},
|
|
1041
1083
|
{
|
|
1042
|
-
"id":
|
|
1084
|
+
"id": 48,
|
|
1043
1085
|
"name": "RelayConfig",
|
|
1044
1086
|
"variant": "declaration",
|
|
1045
1087
|
"kind": 256,
|
|
@@ -1062,7 +1104,7 @@
|
|
|
1062
1104
|
},
|
|
1063
1105
|
"children": [
|
|
1064
1106
|
{
|
|
1065
|
-
"id":
|
|
1107
|
+
"id": 52,
|
|
1066
1108
|
"name": "mode",
|
|
1067
1109
|
"variant": "declaration",
|
|
1068
1110
|
"kind": 1024,
|
|
@@ -1093,7 +1135,7 @@
|
|
|
1093
1135
|
"fileName": "config/config.ts",
|
|
1094
1136
|
"line": 28,
|
|
1095
1137
|
"character": 2,
|
|
1096
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
1138
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/config/config.ts#L28"
|
|
1097
1139
|
}
|
|
1098
1140
|
],
|
|
1099
1141
|
"type": {
|
|
@@ -1107,7 +1149,7 @@
|
|
|
1107
1149
|
}
|
|
1108
1150
|
},
|
|
1109
1151
|
{
|
|
1110
|
-
"id":
|
|
1152
|
+
"id": 53,
|
|
1111
1153
|
"name": "source",
|
|
1112
1154
|
"variant": "declaration",
|
|
1113
1155
|
"kind": 1024,
|
|
@@ -1127,7 +1169,7 @@
|
|
|
1127
1169
|
"fileName": "config/config.ts",
|
|
1128
1170
|
"line": 35,
|
|
1129
1171
|
"character": 2,
|
|
1130
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
1172
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/config/config.ts#L35"
|
|
1131
1173
|
}
|
|
1132
1174
|
],
|
|
1133
1175
|
"type": {
|
|
@@ -1139,7 +1181,7 @@
|
|
|
1139
1181
|
}
|
|
1140
1182
|
},
|
|
1141
1183
|
{
|
|
1142
|
-
"id":
|
|
1184
|
+
"id": 50,
|
|
1143
1185
|
"name": "token",
|
|
1144
1186
|
"variant": "declaration",
|
|
1145
1187
|
"kind": 1024,
|
|
@@ -1157,7 +1199,7 @@
|
|
|
1157
1199
|
"fileName": "config/config.ts",
|
|
1158
1200
|
"line": 15,
|
|
1159
1201
|
"character": 2,
|
|
1160
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
1202
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/config/config.ts#L15"
|
|
1161
1203
|
}
|
|
1162
1204
|
],
|
|
1163
1205
|
"type": {
|
|
@@ -1166,7 +1208,7 @@
|
|
|
1166
1208
|
}
|
|
1167
1209
|
},
|
|
1168
1210
|
{
|
|
1169
|
-
"id":
|
|
1211
|
+
"id": 51,
|
|
1170
1212
|
"name": "trackingId",
|
|
1171
1213
|
"variant": "declaration",
|
|
1172
1214
|
"kind": 1024,
|
|
@@ -1184,7 +1226,7 @@
|
|
|
1184
1226
|
"fileName": "config/config.ts",
|
|
1185
1227
|
"line": 20,
|
|
1186
1228
|
"character": 2,
|
|
1187
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
1229
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/config/config.ts#L20"
|
|
1188
1230
|
}
|
|
1189
1231
|
],
|
|
1190
1232
|
"type": {
|
|
@@ -1193,7 +1235,7 @@
|
|
|
1193
1235
|
}
|
|
1194
1236
|
},
|
|
1195
1237
|
{
|
|
1196
|
-
"id":
|
|
1238
|
+
"id": 49,
|
|
1197
1239
|
"name": "url",
|
|
1198
1240
|
"variant": "declaration",
|
|
1199
1241
|
"kind": 1024,
|
|
@@ -1211,7 +1253,7 @@
|
|
|
1211
1253
|
"fileName": "config/config.ts",
|
|
1212
1254
|
"line": 10,
|
|
1213
1255
|
"character": 2,
|
|
1214
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
1256
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/config/config.ts#L10"
|
|
1215
1257
|
}
|
|
1216
1258
|
],
|
|
1217
1259
|
"type": {
|
|
@@ -1224,11 +1266,11 @@
|
|
|
1224
1266
|
{
|
|
1225
1267
|
"title": "Properties",
|
|
1226
1268
|
"children": [
|
|
1227
|
-
51,
|
|
1228
1269
|
52,
|
|
1229
|
-
|
|
1270
|
+
53,
|
|
1230
1271
|
50,
|
|
1231
|
-
|
|
1272
|
+
51,
|
|
1273
|
+
49
|
|
1232
1274
|
]
|
|
1233
1275
|
}
|
|
1234
1276
|
],
|
|
@@ -1237,12 +1279,12 @@
|
|
|
1237
1279
|
"fileName": "config/config.ts",
|
|
1238
1280
|
"line": 6,
|
|
1239
1281
|
"character": 17,
|
|
1240
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
1282
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/config/config.ts#L6"
|
|
1241
1283
|
}
|
|
1242
1284
|
]
|
|
1243
1285
|
},
|
|
1244
1286
|
{
|
|
1245
|
-
"id":
|
|
1287
|
+
"id": 44,
|
|
1246
1288
|
"name": "EventCallback",
|
|
1247
1289
|
"variant": "declaration",
|
|
1248
1290
|
"kind": 2097152,
|
|
@@ -1252,13 +1294,13 @@
|
|
|
1252
1294
|
"fileName": "listener/listener.ts",
|
|
1253
1295
|
"line": 11,
|
|
1254
1296
|
"character": 12,
|
|
1255
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
1297
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/listener/listener.ts#L11"
|
|
1256
1298
|
}
|
|
1257
1299
|
],
|
|
1258
1300
|
"type": {
|
|
1259
1301
|
"type": "reflection",
|
|
1260
1302
|
"declaration": {
|
|
1261
|
-
"id":
|
|
1303
|
+
"id": 45,
|
|
1262
1304
|
"name": "__type",
|
|
1263
1305
|
"variant": "declaration",
|
|
1264
1306
|
"kind": 65536,
|
|
@@ -1268,12 +1310,12 @@
|
|
|
1268
1310
|
"fileName": "listener/listener.ts",
|
|
1269
1311
|
"line": 11,
|
|
1270
1312
|
"character": 28,
|
|
1271
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
1313
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/listener/listener.ts#L11"
|
|
1272
1314
|
}
|
|
1273
1315
|
],
|
|
1274
1316
|
"signatures": [
|
|
1275
1317
|
{
|
|
1276
|
-
"id":
|
|
1318
|
+
"id": 46,
|
|
1277
1319
|
"name": "__type",
|
|
1278
1320
|
"variant": "signature",
|
|
1279
1321
|
"kind": 4096,
|
|
@@ -1294,7 +1336,7 @@
|
|
|
1294
1336
|
},
|
|
1295
1337
|
"parameters": [
|
|
1296
1338
|
{
|
|
1297
|
-
"id":
|
|
1339
|
+
"id": 47,
|
|
1298
1340
|
"name": "event",
|
|
1299
1341
|
"variant": "param",
|
|
1300
1342
|
"kind": 32768,
|
|
@@ -1330,7 +1372,7 @@
|
|
|
1330
1372
|
"fileName": "relay.ts",
|
|
1331
1373
|
"line": 76,
|
|
1332
1374
|
"character": 16,
|
|
1333
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
1375
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/relay.ts#L76"
|
|
1334
1376
|
}
|
|
1335
1377
|
],
|
|
1336
1378
|
"signatures": [
|
|
@@ -1359,7 +1401,7 @@
|
|
|
1359
1401
|
"fileName": "relay.ts",
|
|
1360
1402
|
"line": 76,
|
|
1361
1403
|
"character": 16,
|
|
1362
|
-
"url": "https://github.com/coveo/relay/blob/
|
|
1404
|
+
"url": "https://github.com/coveo/relay/blob/540ceec/packages/relay/src/relay.ts#L76"
|
|
1363
1405
|
}
|
|
1364
1406
|
],
|
|
1365
1407
|
"parameters": [
|
|
@@ -1371,7 +1413,7 @@
|
|
|
1371
1413
|
"flags": {},
|
|
1372
1414
|
"type": {
|
|
1373
1415
|
"type": "reference",
|
|
1374
|
-
"target":
|
|
1416
|
+
"target": 48,
|
|
1375
1417
|
"name": "RelayConfig",
|
|
1376
1418
|
"package": "@coveo/relay"
|
|
1377
1419
|
}
|
|
@@ -1391,16 +1433,16 @@
|
|
|
1391
1433
|
{
|
|
1392
1434
|
"title": "Interfaces",
|
|
1393
1435
|
"children": [
|
|
1394
|
-
|
|
1436
|
+
42,
|
|
1395
1437
|
32,
|
|
1396
1438
|
4,
|
|
1397
|
-
|
|
1439
|
+
48
|
|
1398
1440
|
]
|
|
1399
1441
|
},
|
|
1400
1442
|
{
|
|
1401
1443
|
"title": "Type Aliases",
|
|
1402
1444
|
"children": [
|
|
1403
|
-
|
|
1445
|
+
44
|
|
1404
1446
|
]
|
|
1405
1447
|
},
|
|
1406
1448
|
{
|
|
@@ -1411,7 +1453,7 @@
|
|
|
1411
1453
|
}
|
|
1412
1454
|
],
|
|
1413
1455
|
"packageName": "@coveo/relay",
|
|
1414
|
-
"packageVersion": "0.7.
|
|
1456
|
+
"packageVersion": "0.7.1",
|
|
1415
1457
|
"readme": [
|
|
1416
1458
|
{
|
|
1417
1459
|
"kind": "text",
|
|
@@ -1613,31 +1655,31 @@
|
|
|
1613
1655
|
},
|
|
1614
1656
|
"38": {
|
|
1615
1657
|
"sourceFileName": "src/event/meta/meta.ts",
|
|
1616
|
-
"qualifiedName": "Meta.
|
|
1658
|
+
"qualifiedName": "Meta.user"
|
|
1617
1659
|
},
|
|
1618
1660
|
"39": {
|
|
1619
1661
|
"sourceFileName": "src/event/meta/meta.ts",
|
|
1620
|
-
"qualifiedName": "Meta.
|
|
1662
|
+
"qualifiedName": "Meta.userAgent"
|
|
1621
1663
|
},
|
|
1622
1664
|
"40": {
|
|
1623
1665
|
"sourceFileName": "src/event/meta/meta.ts",
|
|
1624
|
-
"qualifiedName": "Meta.
|
|
1666
|
+
"qualifiedName": "Meta.referrer"
|
|
1625
1667
|
},
|
|
1626
1668
|
"41": {
|
|
1627
1669
|
"sourceFileName": "src/event/meta/meta.ts",
|
|
1628
|
-
"qualifiedName": "
|
|
1670
|
+
"qualifiedName": "Meta.location"
|
|
1629
1671
|
},
|
|
1630
1672
|
"42": {
|
|
1631
1673
|
"sourceFileName": "src/event/meta/meta.ts",
|
|
1632
|
-
"qualifiedName": "EventConfig
|
|
1674
|
+
"qualifiedName": "EventConfig"
|
|
1633
1675
|
},
|
|
1634
1676
|
"43": {
|
|
1635
|
-
"sourceFileName": "src/
|
|
1636
|
-
"qualifiedName": "
|
|
1677
|
+
"sourceFileName": "src/event/meta/meta.ts",
|
|
1678
|
+
"qualifiedName": "EventConfig.trackingId"
|
|
1637
1679
|
},
|
|
1638
1680
|
"44": {
|
|
1639
1681
|
"sourceFileName": "src/listener/listener.ts",
|
|
1640
|
-
"qualifiedName": "
|
|
1682
|
+
"qualifiedName": "EventCallback"
|
|
1641
1683
|
},
|
|
1642
1684
|
"45": {
|
|
1643
1685
|
"sourceFileName": "src/listener/listener.ts",
|
|
@@ -1645,29 +1687,33 @@
|
|
|
1645
1687
|
},
|
|
1646
1688
|
"46": {
|
|
1647
1689
|
"sourceFileName": "src/listener/listener.ts",
|
|
1648
|
-
"qualifiedName": "
|
|
1690
|
+
"qualifiedName": "__type"
|
|
1649
1691
|
},
|
|
1650
1692
|
"47": {
|
|
1693
|
+
"sourceFileName": "src/listener/listener.ts",
|
|
1694
|
+
"qualifiedName": "event"
|
|
1695
|
+
},
|
|
1696
|
+
"48": {
|
|
1651
1697
|
"sourceFileName": "src/config/config.ts",
|
|
1652
1698
|
"qualifiedName": "RelayConfig"
|
|
1653
1699
|
},
|
|
1654
|
-
"
|
|
1700
|
+
"49": {
|
|
1655
1701
|
"sourceFileName": "src/config/config.ts",
|
|
1656
1702
|
"qualifiedName": "RelayConfig.url"
|
|
1657
1703
|
},
|
|
1658
|
-
"
|
|
1704
|
+
"50": {
|
|
1659
1705
|
"sourceFileName": "src/config/config.ts",
|
|
1660
1706
|
"qualifiedName": "RelayConfig.token"
|
|
1661
1707
|
},
|
|
1662
|
-
"
|
|
1708
|
+
"51": {
|
|
1663
1709
|
"sourceFileName": "src/config/config.ts",
|
|
1664
1710
|
"qualifiedName": "RelayConfig.trackingId"
|
|
1665
1711
|
},
|
|
1666
|
-
"
|
|
1712
|
+
"52": {
|
|
1667
1713
|
"sourceFileName": "src/config/config.ts",
|
|
1668
1714
|
"qualifiedName": "RelayConfig.mode"
|
|
1669
1715
|
},
|
|
1670
|
-
"
|
|
1716
|
+
"53": {
|
|
1671
1717
|
"sourceFileName": "src/config/config.ts",
|
|
1672
1718
|
"qualifiedName": "RelayConfig.source"
|
|
1673
1719
|
}
|
package/lib/relay.cjs
CHANGED
|
@@ -34,7 +34,7 @@ function createClientIdManager(environmentManager) {
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const version = "0.7.
|
|
37
|
+
const version = "0.7.1";
|
|
38
38
|
|
|
39
39
|
function getEventConfig(config) {
|
|
40
40
|
const { trackingId } = config;
|
|
@@ -53,6 +53,7 @@ function createMeta(type, config, environment, clientIdManager) {
|
|
|
53
53
|
ts: Date.now(),
|
|
54
54
|
source: getSource(config),
|
|
55
55
|
clientId,
|
|
56
|
+
user: null,
|
|
56
57
|
userAgent: getUserAgent(),
|
|
57
58
|
referrer: getReferrer(),
|
|
58
59
|
location: getLocation(),
|
package/lib/relay.js
CHANGED
|
@@ -32,7 +32,7 @@ function createClientIdManager(environmentManager) {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
const version = "0.7.
|
|
35
|
+
const version = "0.7.1";
|
|
36
36
|
|
|
37
37
|
function getEventConfig(config) {
|
|
38
38
|
const { trackingId } = config;
|
|
@@ -51,6 +51,7 @@ function createMeta(type, config, environment, clientIdManager) {
|
|
|
51
51
|
ts: Date.now(),
|
|
52
52
|
source: getSource(config),
|
|
53
53
|
clientId,
|
|
54
|
+
user: null,
|
|
54
55
|
userAgent: getUserAgent(),
|
|
55
56
|
referrer: getReferrer(),
|
|
56
57
|
location: getLocation(),
|
package/lib/relay.mjs
CHANGED
|
@@ -32,7 +32,7 @@ function createClientIdManager(environmentManager) {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
const version = "0.7.
|
|
35
|
+
const version = "0.7.1";
|
|
36
36
|
|
|
37
37
|
function getEventConfig(config) {
|
|
38
38
|
const { trackingId } = config;
|
|
@@ -51,6 +51,7 @@ function createMeta(type, config, environment, clientIdManager) {
|
|
|
51
51
|
ts: Date.now(),
|
|
52
52
|
source: getSource(config),
|
|
53
53
|
clientId,
|
|
54
|
+
user: null,
|
|
54
55
|
userAgent: getUserAgent(),
|
|
55
56
|
referrer: getReferrer(),
|
|
56
57
|
location: getLocation(),
|
|
@@ -29,6 +29,12 @@ export interface RelayConfig {
|
|
|
29
29
|
*/
|
|
30
30
|
source?: string[];
|
|
31
31
|
}
|
|
32
|
+
export interface User {
|
|
33
|
+
/**
|
|
34
|
+
* The application's user identifier.
|
|
35
|
+
*/
|
|
36
|
+
id: string;
|
|
37
|
+
}
|
|
32
38
|
export interface ConfigManager {
|
|
33
39
|
get: () => Readonly<RelayConfig>;
|
|
34
40
|
update: (updatedConfig: Partial<RelayConfig>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config/config.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,QAAQ,CAAC,WAAW,CAAC,CAAC;IACjC,MAAM,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CACvD;AAiBD,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,WAAW,GACzB,QAAQ,CAAC,aAAa,CAAC,CASzB"}
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config/config.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,IAAI;IACnB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,QAAQ,CAAC,WAAW,CAAC,CAAC;IACjC,MAAM,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CACvD;AAiBD,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,WAAW,GACzB,QAAQ,CAAC,aAAa,CAAC,CASzB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ClientIdManager } from "../../client-id/client-id";
|
|
2
2
|
import { Environment } from "../../environment/environment";
|
|
3
|
-
import { RelayConfig } from "../../config/config";
|
|
3
|
+
import { RelayConfig, User } from "../../config/config";
|
|
4
4
|
/**
|
|
5
5
|
* The `EventConfig` object provides additonal information for the configuration associated with the event.
|
|
6
6
|
*/
|
|
@@ -34,6 +34,10 @@ export interface Meta {
|
|
|
34
34
|
* Persistent unique identifier of a device.
|
|
35
35
|
*/
|
|
36
36
|
clientId: string;
|
|
37
|
+
/**
|
|
38
|
+
* Named user identity which logged this event.
|
|
39
|
+
*/
|
|
40
|
+
user: User | null;
|
|
37
41
|
/**
|
|
38
42
|
* Browser Navigator's [user agent](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent) property if set.
|
|
39
43
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../../src/event/meta/meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../../src/event/meta/meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,MAAM,EAAE,WAAW,CAAC;IAEpB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAElB;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAWD,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,WAAW,EACnB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,eAAe,GAC/B,QAAQ,CAAC,IAAI,CAAC,CAgBhB"}
|