@ht-sdks/events-sdk-js-browser 1.0.4 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -22
- package/dist/cjs/browser/index.js +36 -28
- package/dist/cjs/browser/index.js.map +1 -1
- package/dist/cjs/browser/standalone-analytics.js +1 -1
- package/dist/cjs/browser/standalone-analytics.js.map +1 -1
- package/dist/cjs/core/analytics/index.js +1 -1
- package/dist/cjs/core/analytics/index.js.map +1 -1
- package/dist/cjs/core/arguments-resolver/index.js.map +1 -1
- package/dist/cjs/core/buffer/index.js.map +1 -1
- package/dist/cjs/core/context/index.js.map +1 -1
- package/dist/cjs/core/events/index.js.map +1 -1
- package/dist/cjs/core/http-cookies/index.js +166 -0
- package/dist/cjs/core/http-cookies/index.js.map +1 -0
- package/dist/cjs/core/page/add-page-context.js.map +1 -1
- package/dist/cjs/core/user/index.js +25 -5
- package/dist/cjs/core/user/index.js.map +1 -1
- package/dist/cjs/generated/version.js +1 -1
- package/dist/cjs/lib/global-analytics-helper.js +1 -1
- package/dist/cjs/lib/global-analytics-helper.js.map +1 -1
- package/dist/cjs/lib/merged-options.js +1 -1
- package/dist/cjs/lib/parse-cdn.js +1 -1
- package/dist/cjs/lib/parse-cdn.js.map +1 -1
- package/dist/cjs/lib/to-facade.js.map +1 -1
- package/dist/cjs/node/index.js +1 -1
- package/dist/cjs/node/index.js.map +1 -1
- package/dist/cjs/plugins/ajs-destination/utils.js +1 -1
- package/dist/cjs/plugins/ajs-destination/utils.js.map +1 -1
- package/dist/cjs/plugins/analytics-node/index.js +2 -2
- package/dist/cjs/plugins/analytics-node/index.js.map +1 -1
- package/dist/cjs/plugins/env-enrichment/index.js.map +1 -1
- package/dist/cjs/plugins/hightouchio/batched-dispatcher.js.map +1 -1
- package/dist/cjs/plugins/legacy-video-plugins/index.js +4 -4
- package/dist/cjs/plugins/legacy-video-plugins/index.js.map +1 -1
- package/dist/cjs/plugins/middleware/index.js.map +1 -1
- package/dist/pkg/browser/index.js +35 -27
- package/dist/pkg/browser/index.js.map +1 -1
- package/dist/pkg/browser/standalone-analytics.js +2 -2
- package/dist/pkg/browser/standalone-analytics.js.map +1 -1
- package/dist/pkg/core/analytics/index.js +1 -1
- package/dist/pkg/core/analytics/index.js.map +1 -1
- package/dist/pkg/core/arguments-resolver/index.js.map +1 -1
- package/dist/pkg/core/buffer/index.js.map +1 -1
- package/dist/pkg/core/context/index.js.map +1 -1
- package/dist/pkg/core/events/index.js.map +1 -1
- package/dist/pkg/core/http-cookies/index.js +163 -0
- package/dist/pkg/core/http-cookies/index.js.map +1 -0
- package/dist/pkg/core/page/add-page-context.js.map +1 -1
- package/dist/pkg/core/user/index.js +25 -5
- package/dist/pkg/core/user/index.js.map +1 -1
- package/dist/pkg/generated/version.js +1 -1
- package/dist/pkg/lib/global-analytics-helper.js +1 -1
- package/dist/pkg/lib/global-analytics-helper.js.map +1 -1
- package/dist/pkg/lib/merged-options.js +1 -1
- package/dist/pkg/lib/parse-cdn.js +1 -1
- package/dist/pkg/lib/parse-cdn.js.map +1 -1
- package/dist/pkg/lib/to-facade.js.map +1 -1
- package/dist/pkg/node/index.js +1 -1
- package/dist/pkg/node/index.js.map +1 -1
- package/dist/pkg/plugins/ajs-destination/utils.js +1 -1
- package/dist/pkg/plugins/ajs-destination/utils.js.map +1 -1
- package/dist/pkg/plugins/analytics-node/index.js +2 -2
- package/dist/pkg/plugins/analytics-node/index.js.map +1 -1
- package/dist/pkg/plugins/env-enrichment/index.js.map +1 -1
- package/dist/pkg/plugins/hightouchio/batched-dispatcher.js.map +1 -1
- package/dist/pkg/plugins/legacy-video-plugins/index.js +6 -6
- package/dist/pkg/plugins/legacy-video-plugins/index.js.map +1 -1
- package/dist/pkg/plugins/middleware/index.js.map +1 -1
- package/dist/types/browser/index.d.ts +12 -12
- package/dist/types/browser/index.d.ts.map +1 -1
- package/dist/types/browser/standalone-interface.d.ts +1 -1
- package/dist/types/browser/standalone-interface.d.ts.map +1 -1
- package/dist/types/core/analytics/index.d.ts +12 -3
- package/dist/types/core/analytics/index.d.ts.map +1 -1
- package/dist/types/core/analytics/interfaces.d.ts +5 -5
- package/dist/types/core/analytics/interfaces.d.ts.map +1 -1
- package/dist/types/core/arguments-resolver/index.d.ts +2 -2
- package/dist/types/core/arguments-resolver/index.d.ts.map +1 -1
- package/dist/types/core/buffer/index.d.ts +10 -10
- package/dist/types/core/buffer/index.d.ts.map +1 -1
- package/dist/types/core/context/index.d.ts +3 -3
- package/dist/types/core/context/index.d.ts.map +1 -1
- package/dist/types/core/events/index.d.ts +8 -8
- package/dist/types/core/events/index.d.ts.map +1 -1
- package/dist/types/core/events/interfaces.d.ts +2 -2
- package/dist/types/core/events/interfaces.d.ts.map +1 -1
- package/dist/types/core/http-cookies/index.d.ts +53 -0
- package/dist/types/core/http-cookies/index.d.ts.map +1 -0
- package/dist/types/core/page/add-page-context.d.ts +2 -2
- package/dist/types/core/page/add-page-context.d.ts.map +1 -1
- package/dist/types/core/page/get-page-context.d.ts +1 -1
- package/dist/types/core/stats/remote-metrics.d.ts +1 -1
- package/dist/types/core/user/index.d.ts +5 -0
- package/dist/types/core/user/index.d.ts.map +1 -1
- package/dist/types/generated/version.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/global-analytics-helper.d.ts +4 -4
- package/dist/types/lib/global-analytics-helper.d.ts.map +1 -1
- package/dist/types/lib/merged-options.d.ts +1 -1
- package/dist/types/lib/to-facade.d.ts +4 -4
- package/dist/types/lib/to-facade.d.ts.map +1 -1
- package/dist/types/plugins/analytics-node/index.d.ts +2 -2
- package/dist/types/plugins/analytics-node/index.d.ts.map +1 -1
- package/dist/types/plugins/legacy-video-plugins/index.d.ts +1 -1
- package/dist/types/plugins/legacy-video-plugins/index.d.ts.map +1 -1
- package/dist/types/plugins/middleware/index.d.ts +4 -4
- package/dist/types/plugins/middleware/index.d.ts.map +1 -1
- package/dist/umd/{ajs-destination.bundle.5a985a542b0de08e3e49.js → ajs-destination.bundle.48266e86bbbc2531ac42.js} +2 -2
- package/dist/umd/{ajs-destination.bundle.5a985a542b0de08e3e49.js.map → ajs-destination.bundle.48266e86bbbc2531ac42.js.map} +1 -1
- package/dist/umd/events.min.js +1 -1
- package/dist/umd/events.min.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/legacyVideos.bundle.6250709892bb05b68333.js.map +1 -1
- package/package.json +3 -3
- package/src/browser/index.ts +27 -20
- package/src/browser/standalone-analytics.ts +3 -3
- package/src/browser/standalone-interface.ts +1 -1
- package/src/core/analytics/index.ts +18 -4
- package/src/core/analytics/interfaces.ts +5 -5
- package/src/core/arguments-resolver/index.ts +2 -2
- package/src/core/buffer/index.ts +4 -4
- package/src/core/context/index.ts +3 -3
- package/src/core/events/index.ts +22 -19
- package/src/core/events/interfaces.ts +2 -2
- package/src/core/http-cookies/README.md +194 -0
- package/src/core/http-cookies/index.ts +152 -0
- package/src/core/page/add-page-context.ts +2 -2
- package/src/core/page/get-page-context.ts +1 -1
- package/src/core/stats/remote-metrics.ts +1 -1
- package/src/core/user/index.ts +34 -4
- package/src/generated/version.ts +1 -1
- package/src/index.ts +1 -1
- package/src/lib/global-analytics-helper.ts +4 -4
- package/src/lib/merged-options.ts +1 -1
- package/src/lib/parse-cdn.ts +1 -1
- package/src/lib/to-facade.ts +7 -4
- package/src/node/index.ts +1 -1
- package/src/plugins/ajs-destination/types.ts +1 -1
- package/src/plugins/ajs-destination/utils.ts +1 -1
- package/src/plugins/analytics-node/index.ts +5 -5
- package/src/plugins/env-enrichment/index.ts +2 -2
- package/src/plugins/hightouchio/batched-dispatcher.ts +3 -3
- package/src/plugins/legacy-video-plugins/index.ts +4 -4
- package/src/plugins/middleware/index.ts +10 -10
- package/src/test-helpers/fixtures/cdn-settings.ts +2 -2
- package/src/test-helpers/test-writekeys.ts +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Analytics } from '../../core/analytics'
|
|
2
2
|
|
|
3
3
|
export async function loadLegacyVideoPlugins(
|
|
4
|
-
|
|
4
|
+
htevents: Analytics
|
|
5
5
|
): Promise<void> {
|
|
6
6
|
const plugins = await import(
|
|
7
7
|
// @ts-expect-error
|
|
8
8
|
'@segment/analytics.js-video-plugins/dist/index.umd.js'
|
|
9
9
|
)
|
|
10
10
|
|
|
11
|
-
// This is super gross, but we need to support the `window.
|
|
12
|
-
// that is linked in the
|
|
11
|
+
// This is super gross, but we need to support the `window.htevents.plugins` namespace
|
|
12
|
+
// that is linked in the hightouch docs in order to be backwards compatible with ajs-classic
|
|
13
13
|
|
|
14
14
|
// @ts-expect-error
|
|
15
|
-
|
|
15
|
+
htevents._plugins = plugins
|
|
16
16
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Context, ContextCancelation } from '../../core/context'
|
|
2
|
-
import {
|
|
2
|
+
import { HightouchEvent } from '../../core/events'
|
|
3
3
|
import { Plugin } from '../../core/plugin'
|
|
4
4
|
import { SegmentFacade, toFacade } from '../../lib/to-facade'
|
|
5
5
|
|
|
6
6
|
export interface MiddlewareParams {
|
|
7
7
|
payload: SegmentFacade
|
|
8
8
|
|
|
9
|
-
integrations?:
|
|
9
|
+
integrations?: HightouchEvent['integrations']
|
|
10
10
|
next: (payload: MiddlewareParams['payload'] | null) => void
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -26,20 +26,20 @@ export type DestinationMiddlewareFunction = (
|
|
|
26
26
|
|
|
27
27
|
export async function applyDestinationMiddleware(
|
|
28
28
|
destination: string,
|
|
29
|
-
evt:
|
|
29
|
+
evt: HightouchEvent,
|
|
30
30
|
middleware: DestinationMiddlewareFunction[]
|
|
31
|
-
): Promise<
|
|
31
|
+
): Promise<HightouchEvent | null> {
|
|
32
32
|
// Clone the event so mutations are localized to a single destination.
|
|
33
33
|
let modifiedEvent = toFacade(evt, {
|
|
34
34
|
clone: true,
|
|
35
35
|
traverse: false,
|
|
36
|
-
}).rawEvent() as
|
|
36
|
+
}).rawEvent() as HightouchEvent
|
|
37
37
|
async function applyMiddleware(
|
|
38
|
-
event:
|
|
38
|
+
event: HightouchEvent,
|
|
39
39
|
fn: DestinationMiddlewareFunction
|
|
40
|
-
): Promise<
|
|
40
|
+
): Promise<HightouchEvent | null> {
|
|
41
41
|
let nextCalled = false
|
|
42
|
-
let returnedEvent:
|
|
42
|
+
let returnedEvent: HightouchEvent | null = null
|
|
43
43
|
|
|
44
44
|
await fn({
|
|
45
45
|
payload: toFacade(event, {
|
|
@@ -61,7 +61,7 @@ export async function applyDestinationMiddleware(
|
|
|
61
61
|
})
|
|
62
62
|
|
|
63
63
|
if (!nextCalled && returnedEvent !== null) {
|
|
64
|
-
returnedEvent = returnedEvent as
|
|
64
|
+
returnedEvent = returnedEvent as HightouchEvent
|
|
65
65
|
returnedEvent.integrations = {
|
|
66
66
|
...event.integrations,
|
|
67
67
|
[destination]: false,
|
|
@@ -84,7 +84,7 @@ export async function applyDestinationMiddleware(
|
|
|
84
84
|
|
|
85
85
|
export function sourceMiddlewarePlugin(
|
|
86
86
|
fn: MiddlewareFunction,
|
|
87
|
-
integrations:
|
|
87
|
+
integrations: HightouchEvent['integrations']
|
|
88
88
|
): Plugin {
|
|
89
89
|
async function apply(ctx: Context): Promise<Context> {
|
|
90
90
|
let nextCalled = false
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HtEventsBrowserSettings } from '../..'
|
|
2
2
|
import { mockIntegrationName } from './classic-destination'
|
|
3
3
|
|
|
4
|
-
type CDNSettings = NonNullable<
|
|
4
|
+
type CDNSettings = NonNullable<HtEventsBrowserSettings['cdnSettings']>
|
|
5
5
|
|
|
6
6
|
export const cdnSettingsKitchenSink: CDNSettings = {
|
|
7
7
|
integrations: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Writekeys that are used in different unit/integration tests. These writekeys
|
|
2
2
|
// were created for the purpose of testing AJS and are not used for anything else.
|
|
3
3
|
|
|
4
|
-
export const TEST_WRITEKEY = 'D8frB7upBChqDN9PMWksNvZYDaKJIYo6' // Test
|
|
4
|
+
export const TEST_WRITEKEY = 'D8frB7upBChqDN9PMWksNvZYDaKJIYo6' // Test writekey
|
|
5
5
|
export const AMPLITUDE_WRITEKEY = 'c56fd8ca27d0f9adfe8ad78d846dfcc8' // Test amplitude writekey
|