@sitecore-jss/sitecore-jss-forms 22.3.0 → 22.3.1-canary.2

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,31 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.instanceOfFormFieldSection = exports.instanceOfButtonFormField = exports.instanceOfValueFormField = exports.instanceOfFormField = void 0;
3
+ exports.instanceOfFormField = instanceOfFormField;
4
+ exports.instanceOfValueFormField = instanceOfValueFormField;
5
+ exports.instanceOfButtonFormField = instanceOfButtonFormField;
6
+ exports.instanceOfFormFieldSection = instanceOfFormFieldSection;
4
7
  /**
5
8
  * @param {object} object
6
9
  */
7
10
  function instanceOfFormField(object) {
8
11
  return 'model' in object;
9
12
  }
10
- exports.instanceOfFormField = instanceOfFormField;
11
13
  /**
12
14
  * @param {FormField} object
13
15
  */
14
16
  function instanceOfValueFormField(object) {
15
17
  return 'indexField' in object;
16
18
  }
17
- exports.instanceOfValueFormField = instanceOfValueFormField;
18
19
  /**
19
20
  * @param {FormField} object
20
21
  */
21
22
  function instanceOfButtonFormField(object) {
22
23
  return 'buttonField' in object;
23
24
  }
24
- exports.instanceOfButtonFormField = instanceOfButtonFormField;
25
25
  /**
26
26
  * @param {FormField} object
27
27
  */
28
28
  function instanceOfFormFieldSection(object) {
29
29
  return 'fields' in object;
30
30
  }
31
- exports.instanceOfFormFieldSection = instanceOfFormFieldSection;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FormTracker = exports.createFetchBasedTrackerFetcher = void 0;
3
+ exports.FormTracker = void 0;
4
+ exports.createFetchBasedTrackerFetcher = createFetchBasedTrackerFetcher;
4
5
  var EventIds;
5
6
  (function (EventIds) {
6
7
  EventIds["FieldCompleted"] = "2ca692cb-bdb2-4c9d-a3b5-917b3656c46a";
@@ -14,7 +15,6 @@ function createFetchBasedTrackerFetcher(options) {
14
15
  // IMPORTANT: Sitecore forms relies on cookies for some state management, so credentials must be included.
15
16
  credentials: 'include' }, options));
16
17
  }
17
- exports.createFetchBasedTrackerFetcher = createFetchBasedTrackerFetcher;
18
18
  class FormTracker {
19
19
  constructor(options) {
20
20
  this._currentField = null;
@@ -36,7 +36,7 @@ class JssFormData {
36
36
  }
37
37
  /**
38
38
  * Merges form data from a client-side state store (i.e. the user-specified values), overwriting any existing values for the keys
39
- * @param {Object} values
39
+ * @param {object} values
40
40
  */
41
41
  mergeOverwritingExisting(values) {
42
42
  Object.keys(values).forEach((key) => {
@@ -68,7 +68,7 @@ class JssFormData {
68
68
  }
69
69
  /**
70
70
  * Gets all key/values in the store. Duplicate keys with different values are possible.
71
- * @returns {Object} data
71
+ * @returns {object} data
72
72
  */
73
73
  get() {
74
74
  return [...this.data];
@@ -1,18 +1,17 @@
1
1
  "use strict";
2
2
  /** The model for a given field's data elements */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.instanceOfListViewModel = exports.instanceOfInputViewModel = void 0;
4
+ exports.instanceOfInputViewModel = instanceOfInputViewModel;
5
+ exports.instanceOfListViewModel = instanceOfListViewModel;
5
6
  /**
6
7
  * @param {ViewModel} object
7
8
  */
8
9
  function instanceOfInputViewModel(object) {
9
10
  return 'value' in object;
10
11
  }
11
- exports.instanceOfInputViewModel = instanceOfInputViewModel;
12
12
  /**
13
13
  * @param {ViewModel} object
14
14
  */
15
15
  function instanceOfListViewModel(object) {
16
16
  return 'items' in object;
17
17
  }
18
- exports.instanceOfListViewModel = instanceOfListViewModel;
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFieldValueFromModel = void 0;
3
+ exports.getFieldValueFromModel = getFieldValueFromModel;
4
4
  const ViewModel_1 = require("./ViewModel");
5
- /** Retrieves the current value of a form field from the form model returned from the JSON API
5
+ /**
6
+ * Retrieves the current value of a form field from the form model returned from the JSON API
6
7
  * @param {FormField} field
7
8
  * @returns {string | string[] | boolean} field value
8
9
  */
@@ -24,4 +25,3 @@ function getFieldValueFromModel(field) {
24
25
  // the model cannot be null or undefined as in React a controlled field must be bound to a non-null value
25
26
  return '';
26
27
  }
27
- exports.getFieldValueFromModel = getFieldValueFromModel;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.serializeForm = void 0;
3
+ exports.serializeForm = serializeForm;
4
4
  const FormField_1 = require("./FormField");
5
5
  const getFieldValueFromModel_1 = require("./getFieldValueFromModel");
6
6
  const JssFormData_1 = require("./JssFormData");
@@ -26,7 +26,6 @@ function serializeForm(form, options) {
26
26
  pushFields(result, form.fields, options);
27
27
  return result;
28
28
  }
29
- exports.serializeForm = serializeForm;
30
29
  /**
31
30
  * @param {JssFormData} result
32
31
  * @param {Array<FormField>} fields
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.submitForm = exports.createFetchBasedFormFetcher = void 0;
3
+ exports.createFetchBasedFormFetcher = createFetchBasedFormFetcher;
4
+ exports.submitForm = submitForm;
4
5
  /**
5
6
  * @param {RequestInit} [options]
6
7
  */
@@ -11,7 +12,6 @@ function createFetchBasedFormFetcher(options) {
11
12
  .then((res) => res.json())
12
13
  .then((res) => res);
13
14
  }
14
- exports.createFetchBasedFormFetcher = createFetchBasedFormFetcher;
15
15
  /**
16
16
  * @param {JssFormData} formData
17
17
  * @param {string} endpoint
@@ -24,4 +24,3 @@ function submitForm(formData, endpoint, options) {
24
24
  }
25
25
  return options.fetcher(formData, endpoint);
26
26
  }
27
- exports.submitForm = submitForm;
@@ -33,7 +33,7 @@ export class JssFormData {
33
33
  }
34
34
  /**
35
35
  * Merges form data from a client-side state store (i.e. the user-specified values), overwriting any existing values for the keys
36
- * @param {Object} values
36
+ * @param {object} values
37
37
  */
38
38
  mergeOverwritingExisting(values) {
39
39
  Object.keys(values).forEach((key) => {
@@ -65,7 +65,7 @@ export class JssFormData {
65
65
  }
66
66
  /**
67
67
  * Gets all key/values in the store. Duplicate keys with different values are possible.
68
- * @returns {Object} data
68
+ * @returns {object} data
69
69
  */
70
70
  get() {
71
71
  return [...this.data];
@@ -1,5 +1,6 @@
1
1
  import { instanceOfInputViewModel, instanceOfListViewModel } from './ViewModel';
2
- /** Retrieves the current value of a form field from the form model returned from the JSON API
2
+ /**
3
+ * Retrieves the current value of a form field from the form model returned from the JSON API
3
4
  * @param {FormField} field
4
5
  * @returns {string | string[] | boolean} field value
5
6
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-jss/sitecore-jss-forms",
3
- "version": "22.3.0",
3
+ "version": "22.3.1-canary.2",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "sideEffects": false,
@@ -11,10 +11,10 @@
11
11
  "test": "mocha --require ts-node/register \"./src/**/*.test.ts\"",
12
12
  "prepublishOnly": "npm run build",
13
13
  "coverage": "nyc npm test",
14
- "generate-docs": "npx typedoc --plugin typedoc-plugin-markdown --readme none --out ../../ref-docs/sitecore-jss-forms src/index.ts --githubPages false"
14
+ "generate-docs": "npx typedoc --plugin typedoc-plugin-markdown --outputFileStrategy Members --parametersFormat table --readme none --out ../../ref-docs/sitecore-jss-forms src/index.ts --githubPages false"
15
15
  },
16
16
  "engines": {
17
- "node": ">=20"
17
+ "node": ">=22"
18
18
  },
19
19
  "author": {
20
20
  "name": "Sitecore Corporation",
@@ -30,24 +30,24 @@
30
30
  "@types/chai-string": "^1.4.2",
31
31
  "@types/lodash.unescape": "^4.0.7",
32
32
  "@types/mocha": "^10.0.1",
33
- "@types/node": "^20.14.2",
33
+ "@types/node": "^22.9.0",
34
34
  "axios": "^1.3.0",
35
35
  "chai": "^4.3.7",
36
36
  "chai-string": "^1.5.0",
37
37
  "del-cli": "^5.0.0",
38
- "eslint": "^8.33.0",
38
+ "eslint": "^8.56.0",
39
39
  "mocha": "^10.2.0",
40
40
  "nyc": "^15.1.0",
41
41
  "ts-node": "^10.9.1",
42
42
  "tslib": "^2.5.0",
43
- "typescript": "~4.9.5"
43
+ "typescript": "~5.6.3"
44
44
  },
45
45
  "dependencies": {
46
- "@sitecore-jss/sitecore-jss": "22.3.0"
46
+ "@sitecore-jss/sitecore-jss": "^22.3.1-canary.2"
47
47
  },
48
48
  "description": "",
49
49
  "types": "types/index.d.ts",
50
- "gitHead": "81b0239517966b6d0debdf6da3f12a98228c4d0c",
50
+ "gitHead": "5b35bbbe22b6ea21a1829950e371d54422ebf8fd",
51
51
  "files": [
52
52
  "dist",
53
53
  "types"
@@ -24,14 +24,14 @@ export declare class JssFormData {
24
24
  remove(key: string): void;
25
25
  /**
26
26
  * Merges form data from a client-side state store (i.e. the user-specified values), overwriting any existing values for the keys
27
- * @param {Object} values
27
+ * @param {object} values
28
28
  */
29
29
  mergeOverwritingExisting(values: {
30
30
  [key: string]: string | string[] | boolean | File[];
31
31
  }): void;
32
32
  /**
33
33
  * Gets all key/values in the store. Duplicate keys with different values are possible.
34
- * @returns {Object} data
34
+ * @returns {object} data
35
35
  */
36
36
  get(): {
37
37
  key: string;
@@ -1,5 +1,6 @@
1
1
  import { FormField } from './FormField';
2
- /** Retrieves the current value of a form field from the form model returned from the JSON API
2
+ /**
3
+ * Retrieves the current value of a form field from the form model returned from the JSON API
3
4
  * @param {FormField} field
4
5
  * @returns {string | string[] | boolean} field value
5
6
  */