@gcforms/types 0.0.7 → 0.0.9
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/package.json +11 -29
- package/src/form-response-types.ts +18 -0
- package/src/form-types.ts +216 -0
- package/src/index.ts +39 -0
- package/tsconfig.json +14 -0
- package/dist/cjs/form-response-types.js +0 -2
- package/dist/cjs/form-types.js +0 -24
- package/dist/cjs/index.js +0 -5
- package/dist/esm/form-response-types.js +0 -1
- package/dist/esm/form-types.js +0 -21
- package/dist/esm/index.js +0 -1
- package/dist/types/cjs/form-response-types.d.ts +0 -9
- package/dist/types/cjs/form-types.d.ts +0 -165
- package/dist/types/cjs/index.d.ts +0 -2
- package/dist/types/esm/form-response-types.d.ts +0 -9
- package/dist/types/esm/form-types.d.ts +0 -165
- package/dist/types/esm/index.d.ts +0 -2
- package/dist/types/index.d.ts +0 -2
package/package.json
CHANGED
|
@@ -1,46 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gcforms/types",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"author": "Canadian Digital Service",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"types": "./dist/types/index.d.ts",
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"module": "./dist/index.mjs",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
13
12
|
"exports": {
|
|
14
13
|
".": {
|
|
15
|
-
"
|
|
16
|
-
"require": "./dist/
|
|
17
|
-
"
|
|
18
|
-
},
|
|
19
|
-
"./cjs": {
|
|
20
|
-
"require": "./dist/cjs/index.js",
|
|
21
|
-
"types": "./dist/types/cjs/index.d.ts"
|
|
22
|
-
},
|
|
23
|
-
"./esm": {
|
|
24
|
-
"import": "./dist/esm/index.js",
|
|
25
|
-
"types": "./dist/types/esm/index.d.ts"
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"require": "./dist/index.js",
|
|
16
|
+
"import": "./dist/index.mjs"
|
|
26
17
|
}
|
|
27
18
|
},
|
|
28
|
-
"files": [
|
|
29
|
-
"dist",
|
|
30
|
-
"package.json"
|
|
31
|
-
],
|
|
32
19
|
"scripts": {
|
|
33
|
-
"build
|
|
34
|
-
"
|
|
35
|
-
"build": "rm -rf dist && yarn build:cjs && yarn build:esm && node copy-types.mjs",
|
|
36
|
-
"prepare": "yarn build"
|
|
37
|
-
},
|
|
38
|
-
"dependencies": {
|
|
39
|
-
"axios": "^1.7.9"
|
|
20
|
+
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
|
|
21
|
+
"prepare": "yarn && yarn build"
|
|
40
22
|
},
|
|
41
23
|
"devDependencies": {
|
|
42
24
|
"@types/node": "^20.11.0",
|
|
25
|
+
"tsup": "^8.3.6",
|
|
43
26
|
"typescript": "^5.3.3"
|
|
44
|
-
}
|
|
45
|
-
"packageManager": "yarn@4.6.0"
|
|
27
|
+
}
|
|
46
28
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type Responses = {
|
|
2
|
+
[key: string]: Response;
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
export type Response =
|
|
6
|
+
| string
|
|
7
|
+
| string[]
|
|
8
|
+
| number
|
|
9
|
+
| Record<string, unknown>[]
|
|
10
|
+
| FileInputResponse
|
|
11
|
+
| FileInputResponse[]
|
|
12
|
+
| Record<string, unknown>;
|
|
13
|
+
|
|
14
|
+
export type FileInputResponse = {
|
|
15
|
+
name: string | null;
|
|
16
|
+
size: number | null;
|
|
17
|
+
based64EncodedFile: string | null;
|
|
18
|
+
};
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
// Utility type creator
|
|
2
|
+
export type TypeOmit<Type, Key extends PropertyKey> = {
|
|
3
|
+
[Property in keyof Type as Exclude<Property, Key>]: Type[Property];
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export type FormChangeEvent = {
|
|
7
|
+
target: {
|
|
8
|
+
value: string | number | boolean | string[];
|
|
9
|
+
name?: string;
|
|
10
|
+
type?: string;
|
|
11
|
+
checked?: boolean;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type Group = {
|
|
16
|
+
name: string;
|
|
17
|
+
titleEn: string;
|
|
18
|
+
titleFr: string;
|
|
19
|
+
nextAction?: string | NextActionRule[];
|
|
20
|
+
elements: string[]; // NOTE: these are elementIds
|
|
21
|
+
autoFlow?: boolean;
|
|
22
|
+
exitUrlEn?: string; // Used when a nextAction is set to "exit"
|
|
23
|
+
exitUrlFr?: string; // Used when a nextAction is set to "exit"
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type GroupsType = Record<string, Group>;
|
|
27
|
+
export type FormValues = Record<string, string | string[]>;
|
|
28
|
+
export type ChoiceRule = { elementId: string; choiceId: string };
|
|
29
|
+
export type NextActionRule = { groupId: string; choiceId: string };
|
|
30
|
+
export type HTMLTextInputTypeAttribute =
|
|
31
|
+
| "text"
|
|
32
|
+
| "email"
|
|
33
|
+
| "name"
|
|
34
|
+
| "number"
|
|
35
|
+
| "password"
|
|
36
|
+
| "search"
|
|
37
|
+
| "tel"
|
|
38
|
+
| "url";
|
|
39
|
+
|
|
40
|
+
// all the possible types of form elements
|
|
41
|
+
export enum FormElementTypes {
|
|
42
|
+
textField = "textField",
|
|
43
|
+
textArea = "textArea",
|
|
44
|
+
dropdown = "dropdown",
|
|
45
|
+
radio = "radio",
|
|
46
|
+
checkbox = "checkbox",
|
|
47
|
+
fileInput = "fileInput",
|
|
48
|
+
richText = "richText",
|
|
49
|
+
dynamicRow = "dynamicRow",
|
|
50
|
+
attestation = "attestation",
|
|
51
|
+
address = "address",
|
|
52
|
+
addressComplete = "addressComplete",
|
|
53
|
+
name = "name",
|
|
54
|
+
firstMiddleLastName = "firstMiddleLastName",
|
|
55
|
+
departments = "departments",
|
|
56
|
+
contact = "contact",
|
|
57
|
+
combobox = "combobox",
|
|
58
|
+
formattedDate = "formattedDate",
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type ConditionalRule = {
|
|
62
|
+
choiceId: string;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// used to define attributes on the validation object which controls form validation for
|
|
66
|
+
// individual field
|
|
67
|
+
export interface ValidationProperties {
|
|
68
|
+
required: boolean;
|
|
69
|
+
type?: HTMLTextInputTypeAttribute;
|
|
70
|
+
regex?: string;
|
|
71
|
+
maxLength?: number;
|
|
72
|
+
descriptionEN?: string;
|
|
73
|
+
descriptionFR?: string;
|
|
74
|
+
[key: string]: unknown;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// the choices available for fields with multiple options like dropdowns or radio buttons
|
|
78
|
+
export interface PropertyChoices {
|
|
79
|
+
en: string;
|
|
80
|
+
fr: string;
|
|
81
|
+
[key: string]: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export type AddressComponents = {
|
|
85
|
+
canadianOnly?: boolean;
|
|
86
|
+
splitAddress?: boolean;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// defines the fields in the object that controls how form submissions are delivered
|
|
90
|
+
export interface DeliveryOption {
|
|
91
|
+
emailAddress: string;
|
|
92
|
+
emailSubjectEn?: string;
|
|
93
|
+
emailSubjectFr?: string;
|
|
94
|
+
[key: string]: string | undefined;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// used to define attributes for the properties of an element in the form
|
|
98
|
+
export interface ElementProperties {
|
|
99
|
+
titleEn: string;
|
|
100
|
+
titleFr: string;
|
|
101
|
+
placeholderEn?: string;
|
|
102
|
+
placeholderFr?: string;
|
|
103
|
+
descriptionEn?: string;
|
|
104
|
+
descriptionFr?: string;
|
|
105
|
+
validation?: ValidationProperties | undefined;
|
|
106
|
+
choices?: PropertyChoices[];
|
|
107
|
+
managedChoices?: string;
|
|
108
|
+
subElements?: FormElement[];
|
|
109
|
+
fileType?: string | undefined;
|
|
110
|
+
headingLevel?: string | undefined;
|
|
111
|
+
isSectional?: boolean;
|
|
112
|
+
maxNumberOfRows?: number;
|
|
113
|
+
autoComplete?: string;
|
|
114
|
+
dateFormat?: string;
|
|
115
|
+
conditionalRules?: ConditionalRule[];
|
|
116
|
+
full?: boolean;
|
|
117
|
+
addressComponents?: AddressComponents | undefined;
|
|
118
|
+
dynamicRow?: dynamicRowType;
|
|
119
|
+
[key: string]:
|
|
120
|
+
| string
|
|
121
|
+
| number
|
|
122
|
+
| boolean
|
|
123
|
+
| Array<PropertyChoices>
|
|
124
|
+
| Array<FormElement>
|
|
125
|
+
| ValidationProperties
|
|
126
|
+
| Array<ConditionalRule>
|
|
127
|
+
| AddressComponents
|
|
128
|
+
| dynamicRowType
|
|
129
|
+
| undefined;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// defines the fields in the object that controls form branding
|
|
133
|
+
export interface BrandProperties {
|
|
134
|
+
name?: string;
|
|
135
|
+
logoEn: string;
|
|
136
|
+
logoFr: string;
|
|
137
|
+
logoTitleEn: string;
|
|
138
|
+
logoTitleFr: string;
|
|
139
|
+
urlEn?: string;
|
|
140
|
+
urlFr?: string;
|
|
141
|
+
// if set to true the GC branding will be removed from the footer
|
|
142
|
+
disableGcBranding?: boolean;
|
|
143
|
+
[key: string]: string | boolean | undefined;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// used to define attributes for a form element or field
|
|
147
|
+
export interface FormElement {
|
|
148
|
+
id: number;
|
|
149
|
+
subId?: string;
|
|
150
|
+
type: FormElementTypes;
|
|
151
|
+
properties: ElementProperties;
|
|
152
|
+
onchange?: (event: FormChangeEvent) => void;
|
|
153
|
+
brand?: BrandProperties;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// defines the fields for the main form configuration object
|
|
157
|
+
export interface FormProperties {
|
|
158
|
+
titleEn: string;
|
|
159
|
+
titleFr: string;
|
|
160
|
+
introduction?: Record<string, string>;
|
|
161
|
+
privacyPolicy?: Record<string, string>;
|
|
162
|
+
confirmation?: Record<string, string>;
|
|
163
|
+
closedMessage?: Record<string, string>;
|
|
164
|
+
layout: number[];
|
|
165
|
+
groups?: GroupsType;
|
|
166
|
+
groupsLayout?: string[];
|
|
167
|
+
elements: FormElement[];
|
|
168
|
+
lastGeneratedElementId?: number;
|
|
169
|
+
brand?: BrandProperties;
|
|
170
|
+
formPurpose?: string;
|
|
171
|
+
[key: string]:
|
|
172
|
+
| string
|
|
173
|
+
| number
|
|
174
|
+
| boolean
|
|
175
|
+
| Array<string | number | FormElement>
|
|
176
|
+
| Record<string, string>
|
|
177
|
+
| BrandProperties
|
|
178
|
+
| GroupsType
|
|
179
|
+
| undefined;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export type dynamicRowType = {
|
|
183
|
+
rowTitleEn: string;
|
|
184
|
+
rowTitleFr: string;
|
|
185
|
+
addButtonTextEn: string;
|
|
186
|
+
removeButtonTextEn: string;
|
|
187
|
+
addButtonTextFr: string;
|
|
188
|
+
removeButtonTextFr: string;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
// defines the fields for the form record that is available in authenticated spaces and backend processes
|
|
192
|
+
export type FormRecord = {
|
|
193
|
+
id: string;
|
|
194
|
+
createdAt?: string;
|
|
195
|
+
updatedAt?: string;
|
|
196
|
+
name: string;
|
|
197
|
+
form: FormProperties;
|
|
198
|
+
isPublished: boolean;
|
|
199
|
+
deliveryOption?: DeliveryOption;
|
|
200
|
+
securityAttribute: SecurityAttribute;
|
|
201
|
+
closingDate?: string;
|
|
202
|
+
closedDetails?: ClosedDetails;
|
|
203
|
+
saveAndResume?: boolean;
|
|
204
|
+
[key: string]: string | boolean | FormProperties | DeliveryOption | ClosedDetails | undefined;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
export type SecurityAttribute = "Unclassified" | "Protected A" | "Protected B";
|
|
208
|
+
export type FormPurpose = "" | "admin" | "nonAdmin";
|
|
209
|
+
|
|
210
|
+
export type ClosedDetails = {
|
|
211
|
+
messageEn?: string;
|
|
212
|
+
messageFr?: string;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
// defines the fields for the form record that is available to unauthenticated users
|
|
216
|
+
export type PublicFormRecord = TypeOmit<FormRecord, "name" | "deliveryOption">;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
dynamicRowType,
|
|
3
|
+
FormElement,
|
|
4
|
+
Group,
|
|
5
|
+
FormElementTypes,
|
|
6
|
+
ElementProperties,
|
|
7
|
+
PropertyChoices,
|
|
8
|
+
BrandProperties,
|
|
9
|
+
DeliveryOption,
|
|
10
|
+
ConditionalRule,
|
|
11
|
+
FormRecord,
|
|
12
|
+
SecurityAttribute,
|
|
13
|
+
FormPurpose,
|
|
14
|
+
PublicFormRecord,
|
|
15
|
+
ValidationProperties,
|
|
16
|
+
FormProperties,
|
|
17
|
+
AddressComponents,
|
|
18
|
+
ClosedDetails,
|
|
19
|
+
} from "./form-types";
|
|
20
|
+
|
|
21
|
+
export type { Response, Responses, FileInputResponse } from "./form-response-types";
|
|
22
|
+
|
|
23
|
+
export { type dynamicRowType };
|
|
24
|
+
export type { FormElement };
|
|
25
|
+
export { FormElementTypes };
|
|
26
|
+
export type { Group };
|
|
27
|
+
export type { ElementProperties };
|
|
28
|
+
export type { PropertyChoices };
|
|
29
|
+
export type { BrandProperties };
|
|
30
|
+
export type { DeliveryOption };
|
|
31
|
+
export type { ConditionalRule };
|
|
32
|
+
export type { FormRecord };
|
|
33
|
+
export type { SecurityAttribute };
|
|
34
|
+
export type { FormPurpose };
|
|
35
|
+
export type { PublicFormRecord };
|
|
36
|
+
export type { ValidationProperties };
|
|
37
|
+
export type { FormProperties };
|
|
38
|
+
export type { AddressComponents };
|
|
39
|
+
export type { ClosedDetails };
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2020",
|
|
4
|
+
"downlevelIteration": true,
|
|
5
|
+
"module": "esnext",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"outDir": "./dist",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": false,
|
|
10
|
+
"typeRoots": ["./src/@types"]
|
|
11
|
+
},
|
|
12
|
+
"include": ["src"],
|
|
13
|
+
"exclude": ["node_modules", "dist"]
|
|
14
|
+
}
|
package/dist/cjs/form-types.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FormElementTypes = void 0;
|
|
4
|
-
// all the possible types of form elements
|
|
5
|
-
var FormElementTypes;
|
|
6
|
-
(function (FormElementTypes) {
|
|
7
|
-
FormElementTypes["textField"] = "textField";
|
|
8
|
-
FormElementTypes["textArea"] = "textArea";
|
|
9
|
-
FormElementTypes["dropdown"] = "dropdown";
|
|
10
|
-
FormElementTypes["radio"] = "radio";
|
|
11
|
-
FormElementTypes["checkbox"] = "checkbox";
|
|
12
|
-
FormElementTypes["fileInput"] = "fileInput";
|
|
13
|
-
FormElementTypes["richText"] = "richText";
|
|
14
|
-
FormElementTypes["dynamicRow"] = "dynamicRow";
|
|
15
|
-
FormElementTypes["attestation"] = "attestation";
|
|
16
|
-
FormElementTypes["address"] = "address";
|
|
17
|
-
FormElementTypes["addressComplete"] = "addressComplete";
|
|
18
|
-
FormElementTypes["name"] = "name";
|
|
19
|
-
FormElementTypes["firstMiddleLastName"] = "firstMiddleLastName";
|
|
20
|
-
FormElementTypes["departments"] = "departments";
|
|
21
|
-
FormElementTypes["contact"] = "contact";
|
|
22
|
-
FormElementTypes["combobox"] = "combobox";
|
|
23
|
-
FormElementTypes["formattedDate"] = "formattedDate";
|
|
24
|
-
})(FormElementTypes || (exports.FormElementTypes = FormElementTypes = {}));
|
package/dist/cjs/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FormElementTypes = void 0;
|
|
4
|
-
var form_types_js_1 = require("./form-types.js");
|
|
5
|
-
Object.defineProperty(exports, "FormElementTypes", { enumerable: true, get: function () { return form_types_js_1.FormElementTypes; } });
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/esm/form-types.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// all the possible types of form elements
|
|
2
|
-
export var FormElementTypes;
|
|
3
|
-
(function (FormElementTypes) {
|
|
4
|
-
FormElementTypes["textField"] = "textField";
|
|
5
|
-
FormElementTypes["textArea"] = "textArea";
|
|
6
|
-
FormElementTypes["dropdown"] = "dropdown";
|
|
7
|
-
FormElementTypes["radio"] = "radio";
|
|
8
|
-
FormElementTypes["checkbox"] = "checkbox";
|
|
9
|
-
FormElementTypes["fileInput"] = "fileInput";
|
|
10
|
-
FormElementTypes["richText"] = "richText";
|
|
11
|
-
FormElementTypes["dynamicRow"] = "dynamicRow";
|
|
12
|
-
FormElementTypes["attestation"] = "attestation";
|
|
13
|
-
FormElementTypes["address"] = "address";
|
|
14
|
-
FormElementTypes["addressComplete"] = "addressComplete";
|
|
15
|
-
FormElementTypes["name"] = "name";
|
|
16
|
-
FormElementTypes["firstMiddleLastName"] = "firstMiddleLastName";
|
|
17
|
-
FormElementTypes["departments"] = "departments";
|
|
18
|
-
FormElementTypes["contact"] = "contact";
|
|
19
|
-
FormElementTypes["combobox"] = "combobox";
|
|
20
|
-
FormElementTypes["formattedDate"] = "formattedDate";
|
|
21
|
-
})(FormElementTypes || (FormElementTypes = {}));
|
package/dist/esm/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { FormElementTypes, } from "./form-types.js";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export type Responses = {
|
|
2
|
-
[key: string]: Response;
|
|
3
|
-
};
|
|
4
|
-
export type Response = string | string[] | number | Record<string, unknown>[] | FileInputResponse | FileInputResponse[] | Record<string, unknown>;
|
|
5
|
-
export type FileInputResponse = {
|
|
6
|
-
name: string | null;
|
|
7
|
-
size: number | null;
|
|
8
|
-
based64EncodedFile: string | null;
|
|
9
|
-
};
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
export type TypeOmit<Type, Key extends PropertyKey> = {
|
|
2
|
-
[Property in keyof Type as Exclude<Property, Key>]: Type[Property];
|
|
3
|
-
};
|
|
4
|
-
export type FormChangeEvent = {
|
|
5
|
-
target: {
|
|
6
|
-
value: string | number | boolean | string[];
|
|
7
|
-
name?: string;
|
|
8
|
-
type?: string;
|
|
9
|
-
checked?: boolean;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export type Group = {
|
|
13
|
-
name: string;
|
|
14
|
-
titleEn: string;
|
|
15
|
-
titleFr: string;
|
|
16
|
-
nextAction?: string | NextActionRule[];
|
|
17
|
-
elements: string[];
|
|
18
|
-
autoFlow?: boolean;
|
|
19
|
-
exitUrlEn?: string;
|
|
20
|
-
exitUrlFr?: string;
|
|
21
|
-
};
|
|
22
|
-
export type GroupsType = Record<string, Group>;
|
|
23
|
-
export type FormValues = Record<string, string | string[]>;
|
|
24
|
-
export type ChoiceRule = {
|
|
25
|
-
elementId: string;
|
|
26
|
-
choiceId: string;
|
|
27
|
-
};
|
|
28
|
-
export type NextActionRule = {
|
|
29
|
-
groupId: string;
|
|
30
|
-
choiceId: string;
|
|
31
|
-
};
|
|
32
|
-
export type HTMLTextInputTypeAttribute = "text" | "email" | "name" | "number" | "password" | "search" | "tel" | "url";
|
|
33
|
-
export declare enum FormElementTypes {
|
|
34
|
-
textField = "textField",
|
|
35
|
-
textArea = "textArea",
|
|
36
|
-
dropdown = "dropdown",
|
|
37
|
-
radio = "radio",
|
|
38
|
-
checkbox = "checkbox",
|
|
39
|
-
fileInput = "fileInput",
|
|
40
|
-
richText = "richText",
|
|
41
|
-
dynamicRow = "dynamicRow",
|
|
42
|
-
attestation = "attestation",
|
|
43
|
-
address = "address",
|
|
44
|
-
addressComplete = "addressComplete",
|
|
45
|
-
name = "name",
|
|
46
|
-
firstMiddleLastName = "firstMiddleLastName",
|
|
47
|
-
departments = "departments",
|
|
48
|
-
contact = "contact",
|
|
49
|
-
combobox = "combobox",
|
|
50
|
-
formattedDate = "formattedDate"
|
|
51
|
-
}
|
|
52
|
-
export type ConditionalRule = {
|
|
53
|
-
choiceId: string;
|
|
54
|
-
};
|
|
55
|
-
export interface ValidationProperties {
|
|
56
|
-
required: boolean;
|
|
57
|
-
type?: HTMLTextInputTypeAttribute;
|
|
58
|
-
regex?: string;
|
|
59
|
-
maxLength?: number;
|
|
60
|
-
descriptionEN?: string;
|
|
61
|
-
descriptionFR?: string;
|
|
62
|
-
[key: string]: unknown;
|
|
63
|
-
}
|
|
64
|
-
export interface PropertyChoices {
|
|
65
|
-
en: string;
|
|
66
|
-
fr: string;
|
|
67
|
-
[key: string]: string;
|
|
68
|
-
}
|
|
69
|
-
export type AddressComponents = {
|
|
70
|
-
canadianOnly?: boolean;
|
|
71
|
-
splitAddress?: boolean;
|
|
72
|
-
};
|
|
73
|
-
export interface DeliveryOption {
|
|
74
|
-
emailAddress: string;
|
|
75
|
-
emailSubjectEn?: string;
|
|
76
|
-
emailSubjectFr?: string;
|
|
77
|
-
[key: string]: string | undefined;
|
|
78
|
-
}
|
|
79
|
-
export interface ElementProperties {
|
|
80
|
-
titleEn: string;
|
|
81
|
-
titleFr: string;
|
|
82
|
-
placeholderEn?: string;
|
|
83
|
-
placeholderFr?: string;
|
|
84
|
-
descriptionEn?: string;
|
|
85
|
-
descriptionFr?: string;
|
|
86
|
-
validation?: ValidationProperties | undefined;
|
|
87
|
-
choices?: PropertyChoices[];
|
|
88
|
-
managedChoices?: string;
|
|
89
|
-
subElements?: FormElement[];
|
|
90
|
-
fileType?: string | undefined;
|
|
91
|
-
headingLevel?: string | undefined;
|
|
92
|
-
isSectional?: boolean;
|
|
93
|
-
maxNumberOfRows?: number;
|
|
94
|
-
autoComplete?: string;
|
|
95
|
-
dateFormat?: string;
|
|
96
|
-
conditionalRules?: ConditionalRule[];
|
|
97
|
-
full?: boolean;
|
|
98
|
-
addressComponents?: AddressComponents | undefined;
|
|
99
|
-
dynamicRow?: dynamicRowType;
|
|
100
|
-
[key: string]: string | number | boolean | Array<PropertyChoices> | Array<FormElement> | ValidationProperties | Array<ConditionalRule> | AddressComponents | dynamicRowType | undefined;
|
|
101
|
-
}
|
|
102
|
-
export interface BrandProperties {
|
|
103
|
-
name?: string;
|
|
104
|
-
logoEn: string;
|
|
105
|
-
logoFr: string;
|
|
106
|
-
logoTitleEn: string;
|
|
107
|
-
logoTitleFr: string;
|
|
108
|
-
urlEn?: string;
|
|
109
|
-
urlFr?: string;
|
|
110
|
-
disableGcBranding?: boolean;
|
|
111
|
-
[key: string]: string | boolean | undefined;
|
|
112
|
-
}
|
|
113
|
-
export interface FormElement {
|
|
114
|
-
id: number;
|
|
115
|
-
subId?: string;
|
|
116
|
-
type: FormElementTypes;
|
|
117
|
-
properties: ElementProperties;
|
|
118
|
-
onchange?: (event: FormChangeEvent) => void;
|
|
119
|
-
brand?: BrandProperties;
|
|
120
|
-
}
|
|
121
|
-
export interface FormProperties {
|
|
122
|
-
titleEn: string;
|
|
123
|
-
titleFr: string;
|
|
124
|
-
introduction?: Record<string, string>;
|
|
125
|
-
privacyPolicy?: Record<string, string>;
|
|
126
|
-
confirmation?: Record<string, string>;
|
|
127
|
-
closedMessage?: Record<string, string>;
|
|
128
|
-
layout: number[];
|
|
129
|
-
groups?: GroupsType;
|
|
130
|
-
groupsLayout?: string[];
|
|
131
|
-
elements: FormElement[];
|
|
132
|
-
lastGeneratedElementId?: number;
|
|
133
|
-
brand?: BrandProperties;
|
|
134
|
-
formPurpose?: string;
|
|
135
|
-
[key: string]: string | number | boolean | Array<string | number | FormElement> | Record<string, string> | BrandProperties | GroupsType | undefined;
|
|
136
|
-
}
|
|
137
|
-
export type dynamicRowType = {
|
|
138
|
-
rowTitleEn: string;
|
|
139
|
-
rowTitleFr: string;
|
|
140
|
-
addButtonTextEn: string;
|
|
141
|
-
removeButtonTextEn: string;
|
|
142
|
-
addButtonTextFr: string;
|
|
143
|
-
removeButtonTextFr: string;
|
|
144
|
-
};
|
|
145
|
-
export type FormRecord = {
|
|
146
|
-
id: string;
|
|
147
|
-
createdAt?: string;
|
|
148
|
-
updatedAt?: string;
|
|
149
|
-
name: string;
|
|
150
|
-
form: FormProperties;
|
|
151
|
-
isPublished: boolean;
|
|
152
|
-
deliveryOption?: DeliveryOption;
|
|
153
|
-
securityAttribute: SecurityAttribute;
|
|
154
|
-
closingDate?: string;
|
|
155
|
-
closedDetails?: ClosedDetails;
|
|
156
|
-
saveAndResume?: boolean;
|
|
157
|
-
[key: string]: string | boolean | FormProperties | DeliveryOption | ClosedDetails | undefined;
|
|
158
|
-
};
|
|
159
|
-
export type SecurityAttribute = "Unclassified" | "Protected A" | "Protected B";
|
|
160
|
-
export type FormPurpose = "" | "admin" | "nonAdmin";
|
|
161
|
-
export type ClosedDetails = {
|
|
162
|
-
messageEn?: string;
|
|
163
|
-
messageFr?: string;
|
|
164
|
-
};
|
|
165
|
-
export type PublicFormRecord = TypeOmit<FormRecord, "name" | "deliveryOption">;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { FormElementTypes, type dynamicRowType, type FormElement, type Group, type ElementProperties, type PropertyChoices, type BrandProperties, type DeliveryOption, type ConditionalRule, type FormRecord, type SecurityAttribute, type FormPurpose, type PublicFormRecord, type ValidationProperties, type FormProperties, type AddressComponents, type ClosedDetails, } from "./form-types.js";
|
|
2
|
-
export type { Response, Responses, FileInputResponse } from "./form-response-types.js";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export type Responses = {
|
|
2
|
-
[key: string]: Response;
|
|
3
|
-
};
|
|
4
|
-
export type Response = string | string[] | number | Record<string, unknown>[] | FileInputResponse | FileInputResponse[] | Record<string, unknown>;
|
|
5
|
-
export type FileInputResponse = {
|
|
6
|
-
name: string | null;
|
|
7
|
-
size: number | null;
|
|
8
|
-
based64EncodedFile: string | null;
|
|
9
|
-
};
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
export type TypeOmit<Type, Key extends PropertyKey> = {
|
|
2
|
-
[Property in keyof Type as Exclude<Property, Key>]: Type[Property];
|
|
3
|
-
};
|
|
4
|
-
export type FormChangeEvent = {
|
|
5
|
-
target: {
|
|
6
|
-
value: string | number | boolean | string[];
|
|
7
|
-
name?: string;
|
|
8
|
-
type?: string;
|
|
9
|
-
checked?: boolean;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export type Group = {
|
|
13
|
-
name: string;
|
|
14
|
-
titleEn: string;
|
|
15
|
-
titleFr: string;
|
|
16
|
-
nextAction?: string | NextActionRule[];
|
|
17
|
-
elements: string[];
|
|
18
|
-
autoFlow?: boolean;
|
|
19
|
-
exitUrlEn?: string;
|
|
20
|
-
exitUrlFr?: string;
|
|
21
|
-
};
|
|
22
|
-
export type GroupsType = Record<string, Group>;
|
|
23
|
-
export type FormValues = Record<string, string | string[]>;
|
|
24
|
-
export type ChoiceRule = {
|
|
25
|
-
elementId: string;
|
|
26
|
-
choiceId: string;
|
|
27
|
-
};
|
|
28
|
-
export type NextActionRule = {
|
|
29
|
-
groupId: string;
|
|
30
|
-
choiceId: string;
|
|
31
|
-
};
|
|
32
|
-
export type HTMLTextInputTypeAttribute = "text" | "email" | "name" | "number" | "password" | "search" | "tel" | "url";
|
|
33
|
-
export declare enum FormElementTypes {
|
|
34
|
-
textField = "textField",
|
|
35
|
-
textArea = "textArea",
|
|
36
|
-
dropdown = "dropdown",
|
|
37
|
-
radio = "radio",
|
|
38
|
-
checkbox = "checkbox",
|
|
39
|
-
fileInput = "fileInput",
|
|
40
|
-
richText = "richText",
|
|
41
|
-
dynamicRow = "dynamicRow",
|
|
42
|
-
attestation = "attestation",
|
|
43
|
-
address = "address",
|
|
44
|
-
addressComplete = "addressComplete",
|
|
45
|
-
name = "name",
|
|
46
|
-
firstMiddleLastName = "firstMiddleLastName",
|
|
47
|
-
departments = "departments",
|
|
48
|
-
contact = "contact",
|
|
49
|
-
combobox = "combobox",
|
|
50
|
-
formattedDate = "formattedDate"
|
|
51
|
-
}
|
|
52
|
-
export type ConditionalRule = {
|
|
53
|
-
choiceId: string;
|
|
54
|
-
};
|
|
55
|
-
export interface ValidationProperties {
|
|
56
|
-
required: boolean;
|
|
57
|
-
type?: HTMLTextInputTypeAttribute;
|
|
58
|
-
regex?: string;
|
|
59
|
-
maxLength?: number;
|
|
60
|
-
descriptionEN?: string;
|
|
61
|
-
descriptionFR?: string;
|
|
62
|
-
[key: string]: unknown;
|
|
63
|
-
}
|
|
64
|
-
export interface PropertyChoices {
|
|
65
|
-
en: string;
|
|
66
|
-
fr: string;
|
|
67
|
-
[key: string]: string;
|
|
68
|
-
}
|
|
69
|
-
export type AddressComponents = {
|
|
70
|
-
canadianOnly?: boolean;
|
|
71
|
-
splitAddress?: boolean;
|
|
72
|
-
};
|
|
73
|
-
export interface DeliveryOption {
|
|
74
|
-
emailAddress: string;
|
|
75
|
-
emailSubjectEn?: string;
|
|
76
|
-
emailSubjectFr?: string;
|
|
77
|
-
[key: string]: string | undefined;
|
|
78
|
-
}
|
|
79
|
-
export interface ElementProperties {
|
|
80
|
-
titleEn: string;
|
|
81
|
-
titleFr: string;
|
|
82
|
-
placeholderEn?: string;
|
|
83
|
-
placeholderFr?: string;
|
|
84
|
-
descriptionEn?: string;
|
|
85
|
-
descriptionFr?: string;
|
|
86
|
-
validation?: ValidationProperties | undefined;
|
|
87
|
-
choices?: PropertyChoices[];
|
|
88
|
-
managedChoices?: string;
|
|
89
|
-
subElements?: FormElement[];
|
|
90
|
-
fileType?: string | undefined;
|
|
91
|
-
headingLevel?: string | undefined;
|
|
92
|
-
isSectional?: boolean;
|
|
93
|
-
maxNumberOfRows?: number;
|
|
94
|
-
autoComplete?: string;
|
|
95
|
-
dateFormat?: string;
|
|
96
|
-
conditionalRules?: ConditionalRule[];
|
|
97
|
-
full?: boolean;
|
|
98
|
-
addressComponents?: AddressComponents | undefined;
|
|
99
|
-
dynamicRow?: dynamicRowType;
|
|
100
|
-
[key: string]: string | number | boolean | Array<PropertyChoices> | Array<FormElement> | ValidationProperties | Array<ConditionalRule> | AddressComponents | dynamicRowType | undefined;
|
|
101
|
-
}
|
|
102
|
-
export interface BrandProperties {
|
|
103
|
-
name?: string;
|
|
104
|
-
logoEn: string;
|
|
105
|
-
logoFr: string;
|
|
106
|
-
logoTitleEn: string;
|
|
107
|
-
logoTitleFr: string;
|
|
108
|
-
urlEn?: string;
|
|
109
|
-
urlFr?: string;
|
|
110
|
-
disableGcBranding?: boolean;
|
|
111
|
-
[key: string]: string | boolean | undefined;
|
|
112
|
-
}
|
|
113
|
-
export interface FormElement {
|
|
114
|
-
id: number;
|
|
115
|
-
subId?: string;
|
|
116
|
-
type: FormElementTypes;
|
|
117
|
-
properties: ElementProperties;
|
|
118
|
-
onchange?: (event: FormChangeEvent) => void;
|
|
119
|
-
brand?: BrandProperties;
|
|
120
|
-
}
|
|
121
|
-
export interface FormProperties {
|
|
122
|
-
titleEn: string;
|
|
123
|
-
titleFr: string;
|
|
124
|
-
introduction?: Record<string, string>;
|
|
125
|
-
privacyPolicy?: Record<string, string>;
|
|
126
|
-
confirmation?: Record<string, string>;
|
|
127
|
-
closedMessage?: Record<string, string>;
|
|
128
|
-
layout: number[];
|
|
129
|
-
groups?: GroupsType;
|
|
130
|
-
groupsLayout?: string[];
|
|
131
|
-
elements: FormElement[];
|
|
132
|
-
lastGeneratedElementId?: number;
|
|
133
|
-
brand?: BrandProperties;
|
|
134
|
-
formPurpose?: string;
|
|
135
|
-
[key: string]: string | number | boolean | Array<string | number | FormElement> | Record<string, string> | BrandProperties | GroupsType | undefined;
|
|
136
|
-
}
|
|
137
|
-
export type dynamicRowType = {
|
|
138
|
-
rowTitleEn: string;
|
|
139
|
-
rowTitleFr: string;
|
|
140
|
-
addButtonTextEn: string;
|
|
141
|
-
removeButtonTextEn: string;
|
|
142
|
-
addButtonTextFr: string;
|
|
143
|
-
removeButtonTextFr: string;
|
|
144
|
-
};
|
|
145
|
-
export type FormRecord = {
|
|
146
|
-
id: string;
|
|
147
|
-
createdAt?: string;
|
|
148
|
-
updatedAt?: string;
|
|
149
|
-
name: string;
|
|
150
|
-
form: FormProperties;
|
|
151
|
-
isPublished: boolean;
|
|
152
|
-
deliveryOption?: DeliveryOption;
|
|
153
|
-
securityAttribute: SecurityAttribute;
|
|
154
|
-
closingDate?: string;
|
|
155
|
-
closedDetails?: ClosedDetails;
|
|
156
|
-
saveAndResume?: boolean;
|
|
157
|
-
[key: string]: string | boolean | FormProperties | DeliveryOption | ClosedDetails | undefined;
|
|
158
|
-
};
|
|
159
|
-
export type SecurityAttribute = "Unclassified" | "Protected A" | "Protected B";
|
|
160
|
-
export type FormPurpose = "" | "admin" | "nonAdmin";
|
|
161
|
-
export type ClosedDetails = {
|
|
162
|
-
messageEn?: string;
|
|
163
|
-
messageFr?: string;
|
|
164
|
-
};
|
|
165
|
-
export type PublicFormRecord = TypeOmit<FormRecord, "name" | "deliveryOption">;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { FormElementTypes, type dynamicRowType, type FormElement, type Group, type ElementProperties, type PropertyChoices, type BrandProperties, type DeliveryOption, type ConditionalRule, type FormRecord, type SecurityAttribute, type FormPurpose, type PublicFormRecord, type ValidationProperties, type FormProperties, type AddressComponents, type ClosedDetails, } from "./form-types.js";
|
|
2
|
-
export type { Response, Responses, FileInputResponse } from "./form-response-types.js";
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { FormElementTypes, type dynamicRowType, type FormElement, type Group, type ElementProperties, type PropertyChoices, type BrandProperties, type DeliveryOption, type ConditionalRule, type FormRecord, type SecurityAttribute, type FormPurpose, type PublicFormRecord, type ValidationProperties, type FormProperties, type AddressComponents, type ClosedDetails, } from "./form-types.js";
|
|
2
|
-
export type { Response, Responses, FileInputResponse } from "./form-response-types.js";
|