@ht-sdks/events-sdk-js-browser 1.0.4 → 1.1.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.
Files changed (123) hide show
  1. package/README.md +22 -22
  2. package/dist/cjs/browser/index.js +16 -16
  3. package/dist/cjs/browser/index.js.map +1 -1
  4. package/dist/cjs/browser/standalone-analytics.js +1 -1
  5. package/dist/cjs/browser/standalone-analytics.js.map +1 -1
  6. package/dist/cjs/core/analytics/index.js.map +1 -1
  7. package/dist/cjs/core/arguments-resolver/index.js.map +1 -1
  8. package/dist/cjs/core/buffer/index.js.map +1 -1
  9. package/dist/cjs/core/context/index.js.map +1 -1
  10. package/dist/cjs/core/events/index.js.map +1 -1
  11. package/dist/cjs/core/page/add-page-context.js.map +1 -1
  12. package/dist/cjs/generated/version.js +1 -1
  13. package/dist/cjs/lib/global-analytics-helper.js +1 -1
  14. package/dist/cjs/lib/global-analytics-helper.js.map +1 -1
  15. package/dist/cjs/lib/merged-options.js +1 -1
  16. package/dist/cjs/lib/parse-cdn.js +1 -1
  17. package/dist/cjs/lib/parse-cdn.js.map +1 -1
  18. package/dist/cjs/lib/to-facade.js.map +1 -1
  19. package/dist/cjs/plugins/ajs-destination/utils.js +1 -1
  20. package/dist/cjs/plugins/ajs-destination/utils.js.map +1 -1
  21. package/dist/cjs/plugins/analytics-node/index.js.map +1 -1
  22. package/dist/cjs/plugins/env-enrichment/index.js.map +1 -1
  23. package/dist/cjs/plugins/hightouchio/batched-dispatcher.js.map +1 -1
  24. package/dist/cjs/plugins/legacy-video-plugins/index.js +4 -4
  25. package/dist/cjs/plugins/legacy-video-plugins/index.js.map +1 -1
  26. package/dist/cjs/plugins/middleware/index.js.map +1 -1
  27. package/dist/pkg/browser/index.js +15 -15
  28. package/dist/pkg/browser/index.js.map +1 -1
  29. package/dist/pkg/browser/standalone-analytics.js +2 -2
  30. package/dist/pkg/browser/standalone-analytics.js.map +1 -1
  31. package/dist/pkg/core/analytics/index.js.map +1 -1
  32. package/dist/pkg/core/arguments-resolver/index.js.map +1 -1
  33. package/dist/pkg/core/buffer/index.js.map +1 -1
  34. package/dist/pkg/core/context/index.js.map +1 -1
  35. package/dist/pkg/core/events/index.js.map +1 -1
  36. package/dist/pkg/core/page/add-page-context.js.map +1 -1
  37. package/dist/pkg/generated/version.js +1 -1
  38. package/dist/pkg/lib/global-analytics-helper.js +1 -1
  39. package/dist/pkg/lib/global-analytics-helper.js.map +1 -1
  40. package/dist/pkg/lib/merged-options.js +1 -1
  41. package/dist/pkg/lib/parse-cdn.js +1 -1
  42. package/dist/pkg/lib/parse-cdn.js.map +1 -1
  43. package/dist/pkg/lib/to-facade.js.map +1 -1
  44. package/dist/pkg/plugins/ajs-destination/utils.js +1 -1
  45. package/dist/pkg/plugins/ajs-destination/utils.js.map +1 -1
  46. package/dist/pkg/plugins/analytics-node/index.js.map +1 -1
  47. package/dist/pkg/plugins/env-enrichment/index.js.map +1 -1
  48. package/dist/pkg/plugins/hightouchio/batched-dispatcher.js.map +1 -1
  49. package/dist/pkg/plugins/legacy-video-plugins/index.js +6 -6
  50. package/dist/pkg/plugins/legacy-video-plugins/index.js.map +1 -1
  51. package/dist/pkg/plugins/middleware/index.js.map +1 -1
  52. package/dist/types/browser/index.d.ts +12 -12
  53. package/dist/types/browser/index.d.ts.map +1 -1
  54. package/dist/types/browser/standalone-interface.d.ts +1 -1
  55. package/dist/types/browser/standalone-interface.d.ts.map +1 -1
  56. package/dist/types/core/analytics/index.d.ts +3 -3
  57. package/dist/types/core/analytics/index.d.ts.map +1 -1
  58. package/dist/types/core/analytics/interfaces.d.ts +5 -5
  59. package/dist/types/core/analytics/interfaces.d.ts.map +1 -1
  60. package/dist/types/core/arguments-resolver/index.d.ts +2 -2
  61. package/dist/types/core/arguments-resolver/index.d.ts.map +1 -1
  62. package/dist/types/core/buffer/index.d.ts +10 -10
  63. package/dist/types/core/buffer/index.d.ts.map +1 -1
  64. package/dist/types/core/context/index.d.ts +3 -3
  65. package/dist/types/core/context/index.d.ts.map +1 -1
  66. package/dist/types/core/events/index.d.ts +8 -8
  67. package/dist/types/core/events/index.d.ts.map +1 -1
  68. package/dist/types/core/events/interfaces.d.ts +2 -2
  69. package/dist/types/core/events/interfaces.d.ts.map +1 -1
  70. package/dist/types/core/page/add-page-context.d.ts +2 -2
  71. package/dist/types/core/page/add-page-context.d.ts.map +1 -1
  72. package/dist/types/core/page/get-page-context.d.ts +1 -1
  73. package/dist/types/core/stats/remote-metrics.d.ts +1 -1
  74. package/dist/types/generated/version.d.ts +1 -1
  75. package/dist/types/index.d.ts +1 -1
  76. package/dist/types/index.d.ts.map +1 -1
  77. package/dist/types/lib/global-analytics-helper.d.ts +4 -4
  78. package/dist/types/lib/global-analytics-helper.d.ts.map +1 -1
  79. package/dist/types/lib/merged-options.d.ts +1 -1
  80. package/dist/types/lib/to-facade.d.ts +4 -4
  81. package/dist/types/lib/to-facade.d.ts.map +1 -1
  82. package/dist/types/plugins/analytics-node/index.d.ts +2 -2
  83. package/dist/types/plugins/analytics-node/index.d.ts.map +1 -1
  84. package/dist/types/plugins/legacy-video-plugins/index.d.ts +1 -1
  85. package/dist/types/plugins/legacy-video-plugins/index.d.ts.map +1 -1
  86. package/dist/types/plugins/middleware/index.d.ts +4 -4
  87. package/dist/types/plugins/middleware/index.d.ts.map +1 -1
  88. package/dist/umd/{ajs-destination.bundle.5a985a542b0de08e3e49.js → ajs-destination.bundle.48266e86bbbc2531ac42.js} +2 -2
  89. package/dist/umd/{ajs-destination.bundle.5a985a542b0de08e3e49.js.map → ajs-destination.bundle.48266e86bbbc2531ac42.js.map} +1 -1
  90. package/dist/umd/events.min.js +1 -1
  91. package/dist/umd/events.min.js.map +1 -1
  92. package/dist/umd/index.js +1 -1
  93. package/dist/umd/index.js.map +1 -1
  94. package/dist/umd/legacyVideos.bundle.6250709892bb05b68333.js.map +1 -1
  95. package/package.json +2 -2
  96. package/src/browser/index.ts +20 -20
  97. package/src/browser/standalone-analytics.ts +3 -3
  98. package/src/browser/standalone-interface.ts +1 -1
  99. package/src/core/analytics/index.ts +4 -4
  100. package/src/core/analytics/interfaces.ts +5 -5
  101. package/src/core/arguments-resolver/index.ts +2 -2
  102. package/src/core/buffer/index.ts +4 -4
  103. package/src/core/context/index.ts +3 -3
  104. package/src/core/events/index.ts +22 -19
  105. package/src/core/events/interfaces.ts +2 -2
  106. package/src/core/page/add-page-context.ts +2 -2
  107. package/src/core/page/get-page-context.ts +1 -1
  108. package/src/core/stats/remote-metrics.ts +1 -1
  109. package/src/generated/version.ts +1 -1
  110. package/src/index.ts +1 -1
  111. package/src/lib/global-analytics-helper.ts +4 -4
  112. package/src/lib/merged-options.ts +1 -1
  113. package/src/lib/parse-cdn.ts +1 -1
  114. package/src/lib/to-facade.ts +7 -4
  115. package/src/plugins/ajs-destination/types.ts +1 -1
  116. package/src/plugins/ajs-destination/utils.ts +1 -1
  117. package/src/plugins/analytics-node/index.ts +3 -3
  118. package/src/plugins/env-enrichment/index.ts +2 -2
  119. package/src/plugins/hightouchio/batched-dispatcher.ts +3 -3
  120. package/src/plugins/legacy-video-plugins/index.ts +4 -4
  121. package/src/plugins/middleware/index.ts +10 -10
  122. package/src/test-helpers/fixtures/cdn-settings.ts +2 -2
  123. package/src/test-helpers/test-writekeys.ts +1 -1
@@ -1,4 +1,4 @@
1
- import { SegmentEvent } from '../../core/events'
1
+ import { HightouchEvent } from '../../core/events'
2
2
  import { fetch } from '../../lib/fetch'
3
3
  import { onPageChange } from '../../lib/on-page-change'
4
4
 
@@ -59,11 +59,11 @@ export default function batch(
59
59
  return
60
60
  }
61
61
 
62
- const writeKey = (batch[0] as SegmentEvent)?.writeKey
62
+ const writeKey = (batch[0] as HightouchEvent)?.writeKey
63
63
 
64
64
  // Remove sentAt from every event as batching only needs a single timestamp
65
65
  const updatedBatch = batch.map((event) => {
66
- const { sentAt, ...newEvent } = event as SegmentEvent
66
+ const { sentAt, ...newEvent } = event as HightouchEvent
67
67
  return newEvent
68
68
  })
69
69
 
@@ -1,16 +1,16 @@
1
1
  import { Analytics } from '../../core/analytics'
2
2
 
3
3
  export async function loadLegacyVideoPlugins(
4
- analytics: Analytics
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.analytics.plugins` namespace
12
- // that is linked in the segment docs in order to be backwards compatible with ajs-classic
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
- analytics._plugins = plugins
15
+ htevents._plugins = plugins
16
16
  }
@@ -1,12 +1,12 @@
1
1
  import { Context, ContextCancelation } from '../../core/context'
2
- import { SegmentEvent } from '../../core/events'
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?: SegmentEvent['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: SegmentEvent,
29
+ evt: HightouchEvent,
30
30
  middleware: DestinationMiddlewareFunction[]
31
- ): Promise<SegmentEvent | null> {
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 SegmentEvent
36
+ }).rawEvent() as HightouchEvent
37
37
  async function applyMiddleware(
38
- event: SegmentEvent,
38
+ event: HightouchEvent,
39
39
  fn: DestinationMiddlewareFunction
40
- ): Promise<SegmentEvent | null> {
40
+ ): Promise<HightouchEvent | null> {
41
41
  let nextCalled = false
42
- let returnedEvent: SegmentEvent | null = null
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 SegmentEvent
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: SegmentEvent['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 { AnalyticsBrowserSettings } from '../..'
1
+ import { HtEventsBrowserSettings } from '../..'
2
2
  import { mockIntegrationName } from './classic-destination'
3
3
 
4
- type CDNSettings = NonNullable<AnalyticsBrowserSettings['cdnSettings']>
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 segment writekey
4
+ export const TEST_WRITEKEY = 'D8frB7upBChqDN9PMWksNvZYDaKJIYo6' // Test writekey
5
5
  export const AMPLITUDE_WRITEKEY = 'c56fd8ca27d0f9adfe8ad78d846dfcc8' // Test amplitude writekey