@financial-times/n-conversion-forms 28.1.2 → 28.1.4

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.
@@ -62,7 +62,7 @@
62
62
  "@financial-times/o-buttons": "^7.5.0",
63
63
  "@financial-times/o-colors": "^6.4.2",
64
64
  "@financial-times/o-expander": "^6.2.2",
65
- "@financial-times/o-forms": "^9.4.2",
65
+ "@financial-times/o-forms": "^9.6.0",
66
66
  "@financial-times/o-grid": "^6.1.5",
67
67
  "@financial-times/o-header-services": "^5.2.2",
68
68
  "@financial-times/o-icons": "^7.2.1",
@@ -2587,10 +2587,14 @@
2587
2587
  }
2588
2588
  },
2589
2589
  "node_modules/@financial-times/o-forms": {
2590
- "version": "9.4.2",
2591
- "resolved": "https://registry.npmjs.org/@financial-times/o-forms/-/o-forms-9.4.2.tgz",
2592
- "integrity": "sha512-j8Hh+LF6OvZcxkNqUDaMEui0C3KcOpY4fLPevTY5Q87YcStzRn7mhphIVvpj6Pt+3AqpZmm1Kv1n65QgRoll+g==",
2590
+ "version": "9.6.0",
2591
+ "resolved": "https://registry.npmjs.org/@financial-times/o-forms/-/o-forms-9.6.0.tgz",
2592
+ "integrity": "sha512-PzskWdHCHApEOzobN05Hmig1C2xFsq0/kPdrApPli1dl8K32RGx5K7HRPwPVl9dwvcQifwccDxDMVAHpoQPFJg==",
2593
2593
  "peer": true,
2594
+ "dependencies": {
2595
+ "@types/lodash.uniqueid": "^4.0.7",
2596
+ "lodash.uniqueid": "^4.0.1"
2597
+ },
2594
2598
  "engines": {
2595
2599
  "npm": "^7 || ^8"
2596
2600
  },
@@ -2602,7 +2606,7 @@
2602
2606
  "@financial-times/o-grid": "^6.0.0",
2603
2607
  "@financial-times/o-icons": "^7.0.0",
2604
2608
  "@financial-times/o-loading": "^5.0.0",
2605
- "@financial-times/o-normalise": "^3.2.0",
2609
+ "@financial-times/o-normalise": "^3.3.0",
2606
2610
  "@financial-times/o-spacing": "^3.0.0",
2607
2611
  "@financial-times/o-typography": "^7.0.1"
2608
2612
  }
@@ -2708,9 +2712,9 @@
2708
2712
  }
2709
2713
  },
2710
2714
  "node_modules/@financial-times/o-normalise": {
2711
- "version": "3.2.2",
2712
- "resolved": "https://registry.npmjs.org/@financial-times/o-normalise/-/o-normalise-3.2.2.tgz",
2713
- "integrity": "sha512-w7eYm2EB4Wf4cY5IJ/B55xst32mFQIW41f+HZpfykJEvI0ohBM2ghfaLu+JpJdaAv8kRaV8245FdDcngDst3wA==",
2715
+ "version": "3.3.0",
2716
+ "resolved": "https://registry.npmjs.org/@financial-times/o-normalise/-/o-normalise-3.3.0.tgz",
2717
+ "integrity": "sha512-1ibVtNNZGODl4l9nOBQ1CS9wwdqP4m26p4AWTrJ1glIx/DXR14n3V0W+ZwKIyohUcNkfZJsPtax1laeS9wgPcg==",
2714
2718
  "peer": true,
2715
2719
  "engines": {
2716
2720
  "npm": "^7 || ^8"
@@ -9770,8 +9774,16 @@
9770
9774
  "node_modules/@types/lodash": {
9771
9775
  "version": "4.14.186",
9772
9776
  "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.186.tgz",
9773
- "integrity": "sha512-eHcVlLXP0c2FlMPm56ITode2AgLMSa6aJ05JTTbYbI+7EMkCEE5qk2E41d5g2lCVTqRe0GnnRFurmlCsDODrPw==",
9774
- "dev": true
9777
+ "integrity": "sha512-eHcVlLXP0c2FlMPm56ITode2AgLMSa6aJ05JTTbYbI+7EMkCEE5qk2E41d5g2lCVTqRe0GnnRFurmlCsDODrPw=="
9778
+ },
9779
+ "node_modules/@types/lodash.uniqueid": {
9780
+ "version": "4.0.7",
9781
+ "resolved": "https://registry.npmjs.org/@types/lodash.uniqueid/-/lodash.uniqueid-4.0.7.tgz",
9782
+ "integrity": "sha512-ipMGW5nR+DTR6U5O08k1Ufr1F9iH+F3p7bhdwsnq6V6nCn/HgMq22UalDq4n91+03+pHFKyeXV1Y7vdJrm7S4g==",
9783
+ "peer": true,
9784
+ "dependencies": {
9785
+ "@types/lodash": "*"
9786
+ }
9775
9787
  },
9776
9788
  "node_modules/@types/mdast": {
9777
9789
  "version": "3.0.10",
@@ -22753,6 +22765,12 @@
22753
22765
  "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=",
22754
22766
  "dev": true
22755
22767
  },
22768
+ "node_modules/lodash.uniqueid": {
22769
+ "version": "4.0.1",
22770
+ "resolved": "https://registry.npmjs.org/lodash.uniqueid/-/lodash.uniqueid-4.0.1.tgz",
22771
+ "integrity": "sha512-GQQWaIeGlL6DIIr06kj1j6sSmBxyNMwI8kaX9aKpHR/XsMTiaXDVPNPAkiboOTK9OJpTJF/dXT3xYoFQnj386Q==",
22772
+ "peer": true
22773
+ },
22756
22774
  "node_modules/lodash.values": {
22757
22775
  "version": "4.3.0",
22758
22776
  "integrity": "sha1-o6bCsOvsxcLLocF+bmIP6BtT00c=",
@@ -35194,11 +35212,14 @@
35194
35212
  "requires": {}
35195
35213
  },
35196
35214
  "@financial-times/o-forms": {
35197
- "version": "9.4.2",
35198
- "resolved": "https://registry.npmjs.org/@financial-times/o-forms/-/o-forms-9.4.2.tgz",
35199
- "integrity": "sha512-j8Hh+LF6OvZcxkNqUDaMEui0C3KcOpY4fLPevTY5Q87YcStzRn7mhphIVvpj6Pt+3AqpZmm1Kv1n65QgRoll+g==",
35215
+ "version": "9.6.0",
35216
+ "resolved": "https://registry.npmjs.org/@financial-times/o-forms/-/o-forms-9.6.0.tgz",
35217
+ "integrity": "sha512-PzskWdHCHApEOzobN05Hmig1C2xFsq0/kPdrApPli1dl8K32RGx5K7HRPwPVl9dwvcQifwccDxDMVAHpoQPFJg==",
35200
35218
  "peer": true,
35201
- "requires": {}
35219
+ "requires": {
35220
+ "@types/lodash.uniqueid": "^4.0.7",
35221
+ "lodash.uniqueid": "^4.0.1"
35222
+ }
35202
35223
  },
35203
35224
  "@financial-times/o-grid": {
35204
35225
  "version": "6.1.5",
@@ -35243,9 +35264,9 @@
35243
35264
  "requires": {}
35244
35265
  },
35245
35266
  "@financial-times/o-normalise": {
35246
- "version": "3.2.2",
35247
- "resolved": "https://registry.npmjs.org/@financial-times/o-normalise/-/o-normalise-3.2.2.tgz",
35248
- "integrity": "sha512-w7eYm2EB4Wf4cY5IJ/B55xst32mFQIW41f+HZpfykJEvI0ohBM2ghfaLu+JpJdaAv8kRaV8245FdDcngDst3wA==",
35267
+ "version": "3.3.0",
35268
+ "resolved": "https://registry.npmjs.org/@financial-times/o-normalise/-/o-normalise-3.3.0.tgz",
35269
+ "integrity": "sha512-1ibVtNNZGODl4l9nOBQ1CS9wwdqP4m26p4AWTrJ1glIx/DXR14n3V0W+ZwKIyohUcNkfZJsPtax1laeS9wgPcg==",
35249
35270
  "peer": true,
35250
35271
  "requires": {}
35251
35272
  },
@@ -40583,8 +40604,16 @@
40583
40604
  "@types/lodash": {
40584
40605
  "version": "4.14.186",
40585
40606
  "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.186.tgz",
40586
- "integrity": "sha512-eHcVlLXP0c2FlMPm56ITode2AgLMSa6aJ05JTTbYbI+7EMkCEE5qk2E41d5g2lCVTqRe0GnnRFurmlCsDODrPw==",
40587
- "dev": true
40607
+ "integrity": "sha512-eHcVlLXP0c2FlMPm56ITode2AgLMSa6aJ05JTTbYbI+7EMkCEE5qk2E41d5g2lCVTqRe0GnnRFurmlCsDODrPw=="
40608
+ },
40609
+ "@types/lodash.uniqueid": {
40610
+ "version": "4.0.7",
40611
+ "resolved": "https://registry.npmjs.org/@types/lodash.uniqueid/-/lodash.uniqueid-4.0.7.tgz",
40612
+ "integrity": "sha512-ipMGW5nR+DTR6U5O08k1Ufr1F9iH+F3p7bhdwsnq6V6nCn/HgMq22UalDq4n91+03+pHFKyeXV1Y7vdJrm7S4g==",
40613
+ "peer": true,
40614
+ "requires": {
40615
+ "@types/lodash": "*"
40616
+ }
40588
40617
  },
40589
40618
  "@types/mdast": {
40590
40619
  "version": "3.0.10",
@@ -50558,6 +50587,12 @@
50558
50587
  "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=",
50559
50588
  "dev": true
50560
50589
  },
50590
+ "lodash.uniqueid": {
50591
+ "version": "4.0.1",
50592
+ "resolved": "https://registry.npmjs.org/lodash.uniqueid/-/lodash.uniqueid-4.0.1.tgz",
50593
+ "integrity": "sha512-GQQWaIeGlL6DIIr06kj1j6sSmBxyNMwI8kaX9aKpHR/XsMTiaXDVPNPAkiboOTK9OJpTJF/dXT3xYoFQnj386Q==",
50594
+ "peer": true
50595
+ },
50561
50596
  "lodash.values": {
50562
50597
  "version": "4.3.0",
50563
50598
  "integrity": "sha1-o6bCsOvsxcLLocF+bmIP6BtT00c=",
@@ -1,3 +1,3 @@
1
1
  const { billingCountries } = require('n-common-static-data');
2
2
 
3
- export { billingCountries };
3
+ module.exports = { billingCountries };
@@ -1,3 +1,3 @@
1
1
  const { demographics } = require('n-common-static-data');
2
2
 
3
- export { demographics };
3
+ module.exports = { demographics };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/n-conversion-forms",
3
- "version": "28.1.2",
3
+ "version": "28.1.4",
4
4
  "description": "Containing jsx components and styles for forms included on Accounts and Acqusition apps (next-signup, next-profile, next-retention, etc).",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -88,7 +88,7 @@
88
88
  "@financial-times/o-buttons": "^7.5.0",
89
89
  "@financial-times/o-colors": "^6.4.2",
90
90
  "@financial-times/o-expander": "^6.2.2",
91
- "@financial-times/o-forms": "^9.4.2",
91
+ "@financial-times/o-forms": "^9.6.0",
92
92
  "@financial-times/o-grid": "^6.1.5",
93
93
  "@financial-times/o-header-services": "^5.2.2",
94
94
  "@financial-times/o-icons": "^7.2.1",
@@ -2,22 +2,20 @@ const OForms = require('@financial-times/o-forms').default;
2
2
  const Input = require('@financial-times/o-forms/src/js/input').default;
3
3
 
4
4
  class Validation {
5
+ /**
6
+ * @typedef FormsOptions
7
+ * @type {object}
8
+ * @property {string} [errorSummaryMessage="There is a problem"] - A message to show in the header of the error summary. It defaults to: 'There is a problem'
9
+ */
10
+
5
11
  /**
6
12
  * Set up the Validation utility
7
- * @param {Boolean} mutePromptBeforeLeaving (default: false) Whether to prompt the user before leaving if there have been changes in any of the fields.
8
- * @param {string} [errorSummaryMessage='There is a problem'] - A message to show in the header of the error summary. It defaults to: 'There is a problem'
9
- * @param {Boolean} [useBrowserValidation=false] - Whether to use the browsers validation and error messages. Defaults to `false`.
13
+ * @param {boolean} [mutePromptBeforeLeaving=false] (default: false) Whether to prompt the user before leaving if there have been changes in any of the fields.
14
+ * @param {FormsOptions} [formsOptions={}] Options object for Origami Forms: https://github.com/Financial-Times/origami/blob/main/components/o-forms/src/js/forms.js
10
15
  */
11
- constructor({
12
- errorSummaryMessage,
13
- mutePromptBeforeLeaving,
14
- useBrowserValidation,
15
- } = {}) {
16
+ constructor({ mutePromptBeforeLeaving, formsOptions } = {}) {
16
17
  this.$form = document.querySelector('form.ncf');
17
- this.oForms = OForms.init(this.$form, {
18
- errorSummaryMessage,
19
- useBrowserValidation,
20
- });
18
+ this.oForms = OForms.init(this.$form, formsOptions);
21
19
  this.$requiredEls = this.oForms.formInputs.filter(
22
20
  ({ input }) => input.type !== 'hidden' && input.required
23
21
  );
@@ -8,6 +8,7 @@ describe('Validation - Util', () => {
8
8
  let validation;
9
9
  const mockErrorSummaryMessage = 'mockError';
10
10
  const mockUseBrowserValidation = false;
11
+ const mockPreventSubmit = true;
11
12
 
12
13
  beforeEach(() => {
13
14
  document.body.innerHTML = `
@@ -20,8 +21,11 @@ describe('Validation - Util', () => {
20
21
  </html>`;
21
22
 
22
23
  validation = new ValidationUtil({
23
- errorSummaryMessage: mockErrorSummaryMessage,
24
- useBrowserValidation: mockUseBrowserValidation,
24
+ formsOptions: {
25
+ errorSummaryMessage: mockErrorSummaryMessage,
26
+ useBrowserValidation: mockUseBrowserValidation,
27
+ preventSubmit: mockPreventSubmit,
28
+ },
25
29
  });
26
30
  jest.spyOn(validation, 'checkFormValidity');
27
31
  validation.init();
@@ -38,6 +42,7 @@ describe('Validation - Util', () => {
38
42
  expect(OForms.default.init).toHaveBeenCalledWith(form, {
39
43
  errorSummaryMessage: mockErrorSummaryMessage,
40
44
  useBrowserValidation: mockUseBrowserValidation,
45
+ preventSubmit: mockPreventSubmit,
41
46
  });
42
47
  });
43
48