@datadog/browser-rum-shopify 7.11.0 → 7.12.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.
@@ -1,36 +0,0 @@
1
- import { initShopifyBindings } from "../domain/shopifyBindings.mjs";
2
- import { patchSandboxedIframeApis } from "./patchSandboxedIframeApis.mjs";
3
- import { mockable } from "@datadog/browser-core";
4
- //#region src/boot/makeShopifyRumPublicApi.ts
5
- /**
6
- * Wraps `RumPublicApi.init()`. When the caller passes a `shopifyAnalytics` handle (the Custom
7
- * Pixel sandbox's `analytics` global) in the init configuration, patches the sandboxed iframe's
8
- * APIs, wires Shopify Web Pixel events to the RUM public API, and applies default configuration
9
- * suited to that iframe (see below). Otherwise (storefront context), forwards to `init()` as-is.
10
- */
11
- function makeShopifyRumPublicApi(datadogRum) {
12
- const originalInit = datadogRum.init.bind(datadogRum);
13
- datadogRum.init = function(initConfiguration) {
14
- if ("shopifyAnalytics" in initConfiguration && initConfiguration.shopifyAnalytics) {
15
- const { shopifyAnalytics: analytics, ...initOptions } = initConfiguration;
16
- mockable(patchSandboxedIframeApis)();
17
- mockable(initShopifyBindings)(datadogRum, analytics);
18
- return originalInit({
19
- ...initOptions,
20
- trackViewsManually: true,
21
- sessionReplaySampleRate: 0,
22
- profilingSampleRate: 0,
23
- trackUserInteractions: false,
24
- trackResources: false,
25
- trackLongTasks: false,
26
- sessionPersistence: "cookie"
27
- });
28
- }
29
- return originalInit(initConfiguration);
30
- };
31
- return datadogRum;
32
- }
33
- //#endregion
34
- export { makeShopifyRumPublicApi };
35
-
36
- //# sourceMappingURL=makeShopifyRumPublicApi.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"makeShopifyRumPublicApi.mjs","names":[],"sources":["../../src/boot/makeShopifyRumPublicApi.ts"],"sourcesContent":["import { mockable } from '@datadog/browser-core'\nimport type { RumInitConfiguration, RumPublicApi } from '@datadog/browser-rum-core'\nimport type { ShopifyAnalyticsApi } from '../domain/shopifyAnalytics'\nimport { initShopifyBindings } from '../domain/shopifyBindings'\nimport { patchSandboxedIframeApis } from './patchSandboxedIframeApis'\n\ninterface ShopifyInitConfiguration extends RumInitConfiguration {\n shopifyAnalytics?: ShopifyAnalyticsApi\n}\n\n/**\n * Wraps `RumPublicApi.init()`. When the caller passes a `shopifyAnalytics` handle (the Custom\n * Pixel sandbox's `analytics` global) in the init configuration, patches the sandboxed iframe's\n * APIs, wires Shopify Web Pixel events to the RUM public API, and applies default configuration\n * suited to that iframe (see below). Otherwise (storefront context), forwards to `init()` as-is.\n */\nexport function makeShopifyRumPublicApi(datadogRum: RumPublicApi): RumPublicApi {\n const originalInit = datadogRum.init.bind(datadogRum)\n\n datadogRum.init = function (initConfiguration: RumInitConfiguration | ShopifyInitConfiguration) {\n if ('shopifyAnalytics' in initConfiguration && initConfiguration.shopifyAnalytics) {\n const { shopifyAnalytics: analytics, ...initOptions } = initConfiguration\n mockable(patchSandboxedIframeApis)()\n mockable(initShopifyBindings)(datadogRum, analytics)\n\n return originalInit({\n ...initOptions,\n trackViewsManually: true, // Views are started explicitly via startView()\n sessionReplaySampleRate: 0, // Session Replay is not usable in the Pixel sandbox iframe\n profilingSampleRate: 0, // Profiling is not usable in the Pixel sandbox iframe\n trackUserInteractions: false, // Pixel sandbox iframe has no real DOM to interact with\n trackResources: false, // Iframe resources are not meaningful\n trackLongTasks: false, // PerformanceObserver tracks the empty iframe\n sessionPersistence: 'cookie',\n })\n }\n\n return originalInit(initConfiguration)\n }\n\n return datadogRum\n}\n"],"mappings":";;;;;;;;;;AAgBA,SAAgB,wBAAwB,YAAwC;CAC9E,MAAM,eAAe,WAAW,KAAK,KAAK,UAAU;CAEpD,WAAW,OAAO,SAAU,mBAAoE;EAC9F,IAAI,sBAAsB,qBAAqB,kBAAkB,kBAAkB;GACjF,MAAM,EAAE,kBAAkB,WAAW,GAAG,gBAAgB;GACxD,SAAS,wBAAwB,CAAC,CAAC;GACnC,SAAS,mBAAmB,CAAC,CAAC,YAAY,SAAS;GAEnD,OAAO,aAAa;IAClB,GAAG;IACH,oBAAoB;IACpB,yBAAyB;IACzB,qBAAqB;IACrB,uBAAuB;IACvB,gBAAgB;IAChB,gBAAgB;IAChB,oBAAoB;GACtB,CAAC;EACH;EAEA,OAAO,aAAa,iBAAiB;CACvC;CAEA,OAAO;AACT"}
@@ -1,42 +0,0 @@
1
- import { mockable } from '@datadog/browser-core'
2
- import type { RumInitConfiguration, RumPublicApi } from '@datadog/browser-rum-core'
3
- import type { ShopifyAnalyticsApi } from '../domain/shopifyAnalytics'
4
- import { initShopifyBindings } from '../domain/shopifyBindings'
5
- import { patchSandboxedIframeApis } from './patchSandboxedIframeApis'
6
-
7
- interface ShopifyInitConfiguration extends RumInitConfiguration {
8
- shopifyAnalytics?: ShopifyAnalyticsApi
9
- }
10
-
11
- /**
12
- * Wraps `RumPublicApi.init()`. When the caller passes a `shopifyAnalytics` handle (the Custom
13
- * Pixel sandbox's `analytics` global) in the init configuration, patches the sandboxed iframe's
14
- * APIs, wires Shopify Web Pixel events to the RUM public API, and applies default configuration
15
- * suited to that iframe (see below). Otherwise (storefront context), forwards to `init()` as-is.
16
- */
17
- export function makeShopifyRumPublicApi(datadogRum: RumPublicApi): RumPublicApi {
18
- const originalInit = datadogRum.init.bind(datadogRum)
19
-
20
- datadogRum.init = function (initConfiguration: RumInitConfiguration | ShopifyInitConfiguration) {
21
- if ('shopifyAnalytics' in initConfiguration && initConfiguration.shopifyAnalytics) {
22
- const { shopifyAnalytics: analytics, ...initOptions } = initConfiguration
23
- mockable(patchSandboxedIframeApis)()
24
- mockable(initShopifyBindings)(datadogRum, analytics)
25
-
26
- return originalInit({
27
- ...initOptions,
28
- trackViewsManually: true, // Views are started explicitly via startView()
29
- sessionReplaySampleRate: 0, // Session Replay is not usable in the Pixel sandbox iframe
30
- profilingSampleRate: 0, // Profiling is not usable in the Pixel sandbox iframe
31
- trackUserInteractions: false, // Pixel sandbox iframe has no real DOM to interact with
32
- trackResources: false, // Iframe resources are not meaningful
33
- trackLongTasks: false, // PerformanceObserver tracks the empty iframe
34
- sessionPersistence: 'cookie',
35
- })
36
- }
37
-
38
- return originalInit(initConfiguration)
39
- }
40
-
41
- return datadogRum
42
- }