@sitecore-content-sdk/react 2.1.0-canary.1 → 2.1.0-canary.11

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.
@@ -34,14 +34,16 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  };
35
35
  })();
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.Form = exports.mockFormModule = void 0;
37
+ exports.Form = exports.mockAnalyticsInternalModule = exports.mockFormModule = void 0;
38
38
  const react_1 = __importStar(require("react"));
39
+ const analyticsCoreInternalModule = __importStar(require("@sitecore-content-sdk/analytics-core/internal"));
39
40
  const content_1 = require("@sitecore-content-sdk/content");
40
41
  const core_1 = require("@sitecore-content-sdk/core");
41
42
  const SitecoreProvider_1 = require("./SitecoreProvider");
42
43
  const ErrorBoundary_1 = require("./ErrorBoundary");
43
44
  const { ERROR_MESSAGES } = core_1.constants;
44
45
  let { executeScriptElements, loadForm, subscribeToFormSubmitEvent } = content_1.form;
46
+ let { isBotClientSide } = analyticsCoreInternalModule;
45
47
  /**
46
48
  * Mock function to replace the form module functions for `testing` purposes.
47
49
  * @param {any} formModule - The form module to mock
@@ -52,6 +54,10 @@ const mockFormModule = (formModule) => {
52
54
  subscribeToFormSubmitEvent = formModule.subscribeToFormSubmitEvent;
53
55
  };
54
56
  exports.mockFormModule = mockFormModule;
57
+ const mockAnalyticsInternalModule = (analyticsCoreInternalModule) => {
58
+ isBotClientSide = analyticsCoreInternalModule.isBotClientSide;
59
+ };
60
+ exports.mockAnalyticsInternalModule = mockAnalyticsInternalModule;
55
61
  /**
56
62
  * The Form component.
57
63
  * @param {FormProps} props incoming props
@@ -88,7 +94,7 @@ const Form = ({ params, rendering }) => {
88
94
  if (!formRef.current)
89
95
  return;
90
96
  // If we are in editing mode, we don't want to send any events
91
- if (!isEditing) {
97
+ if (!isEditing && !isBotClientSide()) {
92
98
  subscribeToFormSubmitEvent(formRef.current, rendering.uid);
93
99
  }
94
100
  executeScriptElements(formRef.current);
@@ -1,11 +1,13 @@
1
1
  'use client';
2
2
  import React, { useEffect, useRef, useState } from 'react';
3
+ import * as analyticsCoreInternalModule from '@sitecore-content-sdk/analytics-core/internal';
3
4
  import { form } from '@sitecore-content-sdk/content';
4
5
  import { constants } from '@sitecore-content-sdk/core';
5
6
  import { useSitecore } from './SitecoreProvider';
6
7
  import { ErrorComponent } from './ErrorBoundary';
7
8
  const { ERROR_MESSAGES } = constants;
8
9
  let { executeScriptElements, loadForm, subscribeToFormSubmitEvent } = form;
10
+ let { isBotClientSide } = analyticsCoreInternalModule;
9
11
  /**
10
12
  * Mock function to replace the form module functions for `testing` purposes.
11
13
  * @param {any} formModule - The form module to mock
@@ -15,6 +17,9 @@ export const mockFormModule = (formModule) => {
15
17
  loadForm = formModule.loadForm;
16
18
  subscribeToFormSubmitEvent = formModule.subscribeToFormSubmitEvent;
17
19
  };
20
+ export const mockAnalyticsInternalModule = (analyticsCoreInternalModule) => {
21
+ isBotClientSide = analyticsCoreInternalModule.isBotClientSide;
22
+ };
18
23
  /**
19
24
  * The Form component.
20
25
  * @param {FormProps} props incoming props
@@ -51,7 +56,7 @@ export const Form = ({ params, rendering }) => {
51
56
  if (!formRef.current)
52
57
  return;
53
58
  // If we are in editing mode, we don't want to send any events
54
- if (!isEditing) {
59
+ if (!isEditing && !isBotClientSide()) {
55
60
  subscribeToFormSubmitEvent(formRef.current, rendering.uid);
56
61
  }
57
62
  executeScriptElements(formRef.current);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-content-sdk/react",
3
- "version": "2.1.0-canary.1",
3
+ "version": "2.1.0-canary.11",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "sideEffects": false,
@@ -32,6 +32,7 @@
32
32
  "url": "https://github.com/sitecore/content-sdk/issues"
33
33
  },
34
34
  "devDependencies": {
35
+ "@sitecore-content-sdk/analytics-core": "2.1.0-canary.11",
35
36
  "@sitecore-feaas/clientside": "^0.6.0",
36
37
  "@stylistic/eslint-plugin": "^5.2.2",
37
38
  "@testing-library/dom": "^10.4.0",
@@ -70,21 +71,21 @@
70
71
  "typescript": "~5.8.3"
71
72
  },
72
73
  "peerDependencies": {
73
- "@sitecore-content-sdk/analytics-core": "^2.0.2-canary.2",
74
- "@sitecore-content-sdk/events": "^2.0.2-canary.2",
74
+ "@sitecore-content-sdk/analytics-core": "^2.1.0-canary.3",
75
+ "@sitecore-content-sdk/events": "^2.1.0-canary.3",
75
76
  "@sitecore-feaas/clientside": "^0.6.0",
76
77
  "react": "^19.2.1",
77
78
  "react-dom": "^19.2.1"
78
79
  },
79
80
  "dependencies": {
80
- "@sitecore-content-sdk/content": "2.1.0-canary.1",
81
- "@sitecore-content-sdk/core": "2.1.0-canary.1",
82
- "@sitecore-content-sdk/search": "0.2.2-canary.10",
81
+ "@sitecore-content-sdk/content": "2.1.0-canary.11",
82
+ "@sitecore-content-sdk/core": "2.1.0-canary.11",
83
+ "@sitecore-content-sdk/search": "0.2.2-canary.20",
83
84
  "fast-deep-equal": "^3.1.3"
84
85
  },
85
86
  "description": "",
86
87
  "types": "types/index.d.ts",
87
- "gitHead": "59794666566c6d47740b8e505ad8186c09363d64",
88
+ "gitHead": "c9e3b397b4f0402f6044dafd3dfd300070cd9dc1",
88
89
  "files": [
89
90
  "dist",
90
91
  "types",
@@ -5,6 +5,7 @@ import { ComponentRendering } from '@sitecore-content-sdk/content/layout';
5
5
  * @param {any} formModule - The form module to mock
6
6
  */
7
7
  export declare const mockFormModule: (formModule: any) => void;
8
+ export declare const mockAnalyticsInternalModule: (analyticsCoreInternalModule: any) => void;
8
9
  /**
9
10
  * Shape of the Form component rendering data.
10
11
  * FormId is the rendering parameter that specifies the ID of the Sitecore Form to render.
@@ -1 +1 @@
1
- {"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../src/components/Form.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAU1E;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,YAAY,GAAG,SAI7C,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,EAAE,kBAAkB,CAAC;IAC9B,MAAM,EAAE;QACN;;WAEG;QACH,MAAM,EAAE,MAAM,CAAC;QACf;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;WAEG;QACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;KAC9B,CAAC;CACH,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,IAAI,GAAI,uBAAuB,SAAS,sBA6DpD,CAAC"}
1
+ {"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../src/components/Form.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAY1E;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,YAAY,GAAG,SAI7C,CAAC;AAEF,eAAO,MAAM,2BAA2B,GAAI,6BAA6B,GAAG,SAE3E,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,EAAE,kBAAkB,CAAC;IAC9B,MAAM,EAAE;QACN;;WAEG;QACH,MAAM,EAAE,MAAM,CAAC;QACf;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;WAEG;QACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;KAC9B,CAAC;CACH,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,IAAI,GAAI,uBAAuB,SAAS,sBA6DpD,CAAC"}