@defra/fcp-sfd-frontend-engine 0.2.6 → 0.2.8

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.
package/dist/index.cjs CHANGED
@@ -72,9 +72,23 @@ var businessSchemas = {
72
72
  sbi: businessSbiSchema
73
73
  };
74
74
 
75
+ // src/schemas/customer/customer-crn-schema.js
76
+ var import_joi2 = __toESM(require("joi"), 1);
77
+ var customerCrnSchema = import_joi2.default.object({
78
+ crn: import_joi2.default.string().pattern(/^\d{10}$/).allow("").optional().messages({
79
+ "string.pattern.base": "Enter the full CRN"
80
+ })
81
+ });
82
+
83
+ // src/schemas/customer/customer-schemas.js
84
+ var customerSchemas = {
85
+ crn: customerCrnSchema
86
+ };
87
+
75
88
  // src/schemas/schemas.js
76
89
  var schemas = {
77
- business: businessSchemas
90
+ business: businessSchemas,
91
+ customer: customerSchemas
78
92
  };
79
93
 
80
94
  // src/utils/format-validation-errors.js
package/dist/index.js CHANGED
@@ -35,9 +35,23 @@ var businessSchemas = {
35
35
  sbi: businessSbiSchema
36
36
  };
37
37
 
38
+ // src/schemas/customer/customer-crn-schema.js
39
+ import Joi2 from "joi";
40
+ var customerCrnSchema = Joi2.object({
41
+ crn: Joi2.string().pattern(/^\d{10}$/).allow("").optional().messages({
42
+ "string.pattern.base": "Enter the full CRN"
43
+ })
44
+ });
45
+
46
+ // src/schemas/customer/customer-schemas.js
47
+ var customerSchemas = {
48
+ crn: customerCrnSchema
49
+ };
50
+
38
51
  // src/schemas/schemas.js
39
52
  var schemas = {
40
- business: businessSchemas
53
+ business: businessSchemas,
54
+ customer: customerSchemas
41
55
  };
42
56
 
43
57
  // src/utils/format-validation-errors.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/fcp-sfd-frontend-engine",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "Shared frontend engine used by both the internal and external frontend applications.",
5
5
  "main": "./dist/index.cjs",
6
6
  "exports": {
@@ -0,0 +1,11 @@
1
+ import Joi from 'joi'
2
+
3
+ export const customerCrnSchema = Joi.object({
4
+ crn: Joi.string()
5
+ .pattern(/^\d{10}$/)
6
+ .allow('')
7
+ .optional()
8
+ .messages({
9
+ 'string.pattern.base': 'Enter the full CRN'
10
+ })
11
+ })
@@ -0,0 +1,5 @@
1
+ import { customerCrnSchema } from './customer-crn-schema.js'
2
+
3
+ export const customerSchemas = {
4
+ crn: customerCrnSchema
5
+ }
@@ -1,5 +1,7 @@
1
1
  import { businessSchemas } from './business/business-schemas.js'
2
+ import { customerSchemas } from './customer/customer-schemas.js'
2
3
 
3
4
  export const schemas = {
4
- business: businessSchemas
5
+ business: businessSchemas,
6
+ customer: customerSchemas
5
7
  }