@frontegg/types 7.67.0 → 7.68.0-alpha.1
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/Localizations/AdminPortalLocalizations/provisioning.d.ts +4 -0
- package/Localizations/LocalizationOverrides.d.ts +1 -1
- package/Localizations/LoginBoxLocalization/activateAccount.d.ts +13 -0
- package/Localizations/LoginBoxLocalization/signup.d.ts +27 -2
- package/ThemeOptions/LoginBoxTheme/DynamicFields/OverrideSignupFields.d.ts +175 -0
- package/ThemeOptions/LoginBoxTheme/DynamicFields/OverrideSignupFields.js +1 -0
- package/ThemeOptions/LoginBoxTheme/DynamicFields/helpers.d.ts +55 -0
- package/ThemeOptions/LoginBoxTheme/DynamicFields/helpers.js +1 -0
- package/ThemeOptions/LoginBoxTheme/DynamicFields/index.d.ts +1 -0
- package/ThemeOptions/LoginBoxTheme/DynamicFields/index.js +1 -0
- package/ThemeOptions/LoginBoxTheme/SignupPageTheme.d.ts +13 -0
- package/ThemeOptions/LoginBoxTheme/index.d.ts +1 -0
- package/ThemeOptions/LoginBoxTheme/index.js +1 -0
- package/index.js +1 -1
- package/node/ThemeOptions/LoginBoxTheme/DynamicFields/OverrideSignupFields.js +5 -0
- package/node/ThemeOptions/LoginBoxTheme/DynamicFields/helpers.js +5 -0
- package/node/ThemeOptions/LoginBoxTheme/DynamicFields/index.js +16 -0
- package/node/ThemeOptions/LoginBoxTheme/index.js +11 -0
- package/node/index.js +1 -1
- package/package.json +2 -2
|
@@ -16,7 +16,7 @@ export interface LocalizationOverrides {
|
|
|
16
16
|
validations?: ValidationLocalizationOverrides;
|
|
17
17
|
loginBox?: LoginBoxLocalizationOverrides;
|
|
18
18
|
adminPortal?: AdminPortalLocalizationOverrides;
|
|
19
|
-
errors
|
|
19
|
+
errors?: Partial<Localization['errors']>;
|
|
20
20
|
custom?: Record<string, string>;
|
|
21
21
|
}
|
|
22
22
|
export {};
|
|
@@ -87,7 +87,20 @@ export interface ActivateAccountLocalization {
|
|
|
87
87
|
* Consts for terms and conditions & privacy for activate account page
|
|
88
88
|
*/
|
|
89
89
|
disclaimerText: string;
|
|
90
|
+
/**
|
|
91
|
+
* Signup disclaimer checkbox label
|
|
92
|
+
* this text is optional
|
|
93
|
+
*/
|
|
90
94
|
disclaimerCheckboxLabel: string;
|
|
95
|
+
/**
|
|
96
|
+
* Signup disclaimer checkbox suffix label
|
|
97
|
+
* this text is optional
|
|
98
|
+
*/
|
|
99
|
+
disclaimerCheckboxSuffixLabel: string;
|
|
100
|
+
/**
|
|
101
|
+
* Signup disclaimer checkbox suffix label
|
|
102
|
+
* this text is optional
|
|
103
|
+
*/
|
|
91
104
|
disclaimerTextRequired: string;
|
|
92
105
|
termsLinkText: string;
|
|
93
106
|
termsLink: string;
|
|
@@ -48,6 +48,22 @@ export interface SignupLocalizationOptions {
|
|
|
48
48
|
* error message displayed if password is empty
|
|
49
49
|
*/
|
|
50
50
|
passwordIsRequired: string;
|
|
51
|
+
/**
|
|
52
|
+
* Confirm password input label
|
|
53
|
+
*/
|
|
54
|
+
confirmPasswordInputLabel: string;
|
|
55
|
+
/**
|
|
56
|
+
* String displayed as placeholder when confirm password field is empty
|
|
57
|
+
*/
|
|
58
|
+
confirmPasswordInputPlaceholder: string;
|
|
59
|
+
/**
|
|
60
|
+
* Error displayed when confirm password is empty
|
|
61
|
+
*/
|
|
62
|
+
confirmPasswordIsRequired: string;
|
|
63
|
+
/**
|
|
64
|
+
* Error displayed when passwords does not match
|
|
65
|
+
*/
|
|
66
|
+
confirmPasswordMustMatch: string;
|
|
51
67
|
/**
|
|
52
68
|
* Signup phone input label
|
|
53
69
|
*/
|
|
@@ -93,6 +109,11 @@ export interface SignupLocalizationOptions {
|
|
|
93
109
|
* this text is optional
|
|
94
110
|
*/
|
|
95
111
|
disclaimerCheckboxLabel: string;
|
|
112
|
+
/**
|
|
113
|
+
* Signup disclaimer checkbox suffix label
|
|
114
|
+
* this text is optional
|
|
115
|
+
*/
|
|
116
|
+
disclaimerCheckboxSuffixLabel: string;
|
|
96
117
|
/**
|
|
97
118
|
* error message displayed if disclaimer is not acceppted
|
|
98
119
|
*/
|
|
@@ -200,7 +221,11 @@ export interface SignupLocalization {
|
|
|
200
221
|
* strings in signup page
|
|
201
222
|
*/
|
|
202
223
|
signup: {
|
|
203
|
-
account: SignupLocalizationOptions
|
|
204
|
-
|
|
224
|
+
account: Omit<SignupLocalizationOptions, 'title'> & {
|
|
225
|
+
title?: string;
|
|
226
|
+
};
|
|
227
|
+
user: Omit<SignupLocalizationOptions, 'title'> & {
|
|
228
|
+
title?: string;
|
|
229
|
+
};
|
|
205
230
|
} & SignupLocalizationOptions;
|
|
206
231
|
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { i18nTranslation, ValidationSchema, YupInstance } from './helpers';
|
|
2
|
+
/**
|
|
3
|
+
* A minimal FC (Functional Component) type.
|
|
4
|
+
* This avoids importing React while still allowing you to type component props.
|
|
5
|
+
*/
|
|
6
|
+
type FC<P = {}> = (props: P) => any;
|
|
7
|
+
interface CommonFieldConfig {
|
|
8
|
+
/**
|
|
9
|
+
* used to override input grid size (12 columns), default is 12
|
|
10
|
+
* 6 is half, in smaller screens it will force to 12
|
|
11
|
+
*/
|
|
12
|
+
flex?: number;
|
|
13
|
+
/**
|
|
14
|
+
* The order of the field in the form.
|
|
15
|
+
* If not specified, the order will be determined by the order of the fields in the object.
|
|
16
|
+
*/
|
|
17
|
+
order?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Whether to show the field or not.
|
|
20
|
+
*/
|
|
21
|
+
hide?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whether to autofocus on first appear
|
|
24
|
+
* make sure you have only one field with this prop
|
|
25
|
+
*/
|
|
26
|
+
autoFocus?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Config for a custom field.
|
|
30
|
+
*/
|
|
31
|
+
interface BaseCustomFieldConfig extends CommonFieldConfig {
|
|
32
|
+
type: 'custom';
|
|
33
|
+
initialValue?: any;
|
|
34
|
+
validationSchema?: ValidationSchema;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Config for a custom input field.
|
|
38
|
+
*/
|
|
39
|
+
interface InputCustomFieldConfig extends BaseCustomFieldConfig {
|
|
40
|
+
fieldType: 'input';
|
|
41
|
+
initialValue?: string;
|
|
42
|
+
fieldProps?: {
|
|
43
|
+
/**
|
|
44
|
+
* The label to be displayed before the input.
|
|
45
|
+
*/
|
|
46
|
+
label?: string;
|
|
47
|
+
/**
|
|
48
|
+
* The placeholder to be displayed inside the input.
|
|
49
|
+
*/
|
|
50
|
+
placeholder?: string;
|
|
51
|
+
/**
|
|
52
|
+
* The tooltip to be displayed on hover '?'.
|
|
53
|
+
*/
|
|
54
|
+
tip?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Whether to show the required '*' sign or not.
|
|
57
|
+
*/
|
|
58
|
+
addRequiredAsterisk?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* The data test id to be injected to the input element.
|
|
61
|
+
*/
|
|
62
|
+
'data-test-id'?: string;
|
|
63
|
+
/**
|
|
64
|
+
* the autocomplete attribute for the input
|
|
65
|
+
*/
|
|
66
|
+
autoComplete?: string;
|
|
67
|
+
/**
|
|
68
|
+
* if true, the input will be multiline
|
|
69
|
+
*/
|
|
70
|
+
multiline?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* the html input type default: text
|
|
73
|
+
*/
|
|
74
|
+
type?: string;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Config for a custom select field.
|
|
79
|
+
*/
|
|
80
|
+
interface SelectCustomFieldConfig extends BaseCustomFieldConfig {
|
|
81
|
+
fieldType: 'select';
|
|
82
|
+
fieldProps?: {
|
|
83
|
+
/**
|
|
84
|
+
* The label to be displayed before the select.
|
|
85
|
+
*/
|
|
86
|
+
label?: string;
|
|
87
|
+
/**
|
|
88
|
+
* The tooltip to be displayed on hover '?'.
|
|
89
|
+
*/
|
|
90
|
+
tip?: string;
|
|
91
|
+
/**
|
|
92
|
+
* The data test id to be injected to the select element.
|
|
93
|
+
*/
|
|
94
|
+
'data-test-id'?: string;
|
|
95
|
+
/**
|
|
96
|
+
* If true, you can select multiple options
|
|
97
|
+
*/
|
|
98
|
+
multi?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* The options to be displayed in the select.
|
|
101
|
+
*/
|
|
102
|
+
options: {
|
|
103
|
+
label: string;
|
|
104
|
+
value: string | number;
|
|
105
|
+
}[];
|
|
106
|
+
/**
|
|
107
|
+
* If true, will show a clear button to clear the selected value.
|
|
108
|
+
*/
|
|
109
|
+
clearable?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* If true, the select popup will close when an option is selected.
|
|
112
|
+
*/
|
|
113
|
+
closeOnSelect?: boolean;
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Config for a custom select field.
|
|
118
|
+
*/
|
|
119
|
+
interface DisclaimerCustomFieldConfig extends BaseCustomFieldConfig {
|
|
120
|
+
fieldType: 'disclaimer';
|
|
121
|
+
fieldProps: {
|
|
122
|
+
name: string;
|
|
123
|
+
/**
|
|
124
|
+
* The label of the field that will be shown beside the checkbox.
|
|
125
|
+
*/
|
|
126
|
+
label: string;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
export type CustomFieldConfig = InputCustomFieldConfig | SelectCustomFieldConfig | DisclaimerCustomFieldConfig;
|
|
130
|
+
/**
|
|
131
|
+
* Config for a standard field.
|
|
132
|
+
*/
|
|
133
|
+
interface StandardFieldConfig extends CommonFieldConfig {
|
|
134
|
+
type: 'email' | 'name' | 'firstName' | 'lastName' | 'password' | 'confirmPassword' | 'companyName' | 'disclaimer' | 'phoneNumber';
|
|
135
|
+
initialValue?: any;
|
|
136
|
+
Component?: FC<any>;
|
|
137
|
+
validationSchema?: any;
|
|
138
|
+
}
|
|
139
|
+
export interface FronteggFields {
|
|
140
|
+
email: StandardFieldConfig;
|
|
141
|
+
name: StandardFieldConfig;
|
|
142
|
+
firstName: StandardFieldConfig;
|
|
143
|
+
lastName: StandardFieldConfig;
|
|
144
|
+
password: StandardFieldConfig;
|
|
145
|
+
confirmPassword: StandardFieldConfig;
|
|
146
|
+
companyName: StandardFieldConfig;
|
|
147
|
+
disclaimer: StandardFieldConfig;
|
|
148
|
+
phoneNumber: StandardFieldConfig;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Union type for any form field configuration.
|
|
152
|
+
* Every field must have a unique key.
|
|
153
|
+
*/
|
|
154
|
+
export type SignupFormFieldConfig = StandardFieldConfig | CustomFieldConfig;
|
|
155
|
+
export type SignupFormFieldConfigWithKey = SignupFormFieldConfig & {
|
|
156
|
+
key: string;
|
|
157
|
+
};
|
|
158
|
+
export type SignupFormFields = Record<string, SignupFormFieldConfig>;
|
|
159
|
+
export type OverrideSignupFieldsParams = {
|
|
160
|
+
fields: FronteggFields;
|
|
161
|
+
Yup: YupInstance;
|
|
162
|
+
t: i18nTranslation;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Function type for customers to override or extend the signup fields.
|
|
166
|
+
* It receives:
|
|
167
|
+
* - fields: An array of form field configurations.
|
|
168
|
+
* - yup: An instance of our minimal Yup builder.
|
|
169
|
+
* - t: A translation function.
|
|
170
|
+
*
|
|
171
|
+
* The function should return a modified array of form field configurations.
|
|
172
|
+
*/
|
|
173
|
+
type OverrideSignupFieldsFunction = (params: OverrideSignupFieldsParams) => SignupFormFields;
|
|
174
|
+
export type OverrideSignupFields = OverrideSignupFieldsFunction;
|
|
175
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A basic i18n translation function type.
|
|
3
|
+
*/
|
|
4
|
+
export type i18nTranslation = (key: string, options?: Record<string, any>) => string;
|
|
5
|
+
/**
|
|
6
|
+
* Minimal Yup instance interface exposing basic builders.
|
|
7
|
+
*/
|
|
8
|
+
export interface YupInstance {
|
|
9
|
+
string: () => YupString;
|
|
10
|
+
number: () => YupNumber;
|
|
11
|
+
boolean: () => YupBoolean;
|
|
12
|
+
email: () => YupString;
|
|
13
|
+
object: <T extends Record<string, any>>(schema: T) => YupObject<T>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Minimal Yup string schema.
|
|
17
|
+
*/
|
|
18
|
+
export interface YupString {
|
|
19
|
+
required: (message?: string) => YupString;
|
|
20
|
+
email: (message?: string) => YupString;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Minimal Yup number schema.
|
|
24
|
+
*/
|
|
25
|
+
export interface YupNumber {
|
|
26
|
+
required: (message?: string) => YupNumber;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Minimal Yup boolean schema.
|
|
30
|
+
*/
|
|
31
|
+
export interface YupBoolean {
|
|
32
|
+
required: (message?: string) => YupBoolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Minimal Yup object schema.
|
|
36
|
+
*/
|
|
37
|
+
export interface YupObject<T> {
|
|
38
|
+
shape: (fields: T) => YupObject<T>;
|
|
39
|
+
}
|
|
40
|
+
export type ValidationSchema = YupObject<any> | YupString | YupNumber | YupBoolean;
|
|
41
|
+
export interface ValidationSchemaObj {
|
|
42
|
+
type?: 'string' | 'number' | 'boolean' | 'object';
|
|
43
|
+
length?: {
|
|
44
|
+
min?: number;
|
|
45
|
+
max?: number;
|
|
46
|
+
};
|
|
47
|
+
required?: {
|
|
48
|
+
enabled: boolean;
|
|
49
|
+
message: string;
|
|
50
|
+
};
|
|
51
|
+
regex?: {
|
|
52
|
+
enabled: boolean;
|
|
53
|
+
message: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './OverrideSignupFields';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './OverrideSignupFields';
|
|
@@ -2,6 +2,7 @@ import { LoginBoxCommonTheme, LoginBoxCommonThemeOptions } from '../index';
|
|
|
2
2
|
import { ExtendedCSSProperties } from '../../Common';
|
|
3
3
|
import { CustomComponent } from '../ComponentsOptions';
|
|
4
4
|
import { DisclaimerOptions } from '../DisclaimerOptions';
|
|
5
|
+
import { OverrideSignupFields } from './DynamicFields';
|
|
5
6
|
interface TitleProps {
|
|
6
7
|
title: string;
|
|
7
8
|
}
|
|
@@ -117,6 +118,18 @@ export interface SignupPageComponentsTheme {
|
|
|
117
118
|
* by default: false.
|
|
118
119
|
*/
|
|
119
120
|
splitFullName?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Use this options to override the default signup fields
|
|
123
|
+
* This function will be called before rendering the signup form
|
|
124
|
+
* and will receive the default signup fields, the Yup instance and the translation function
|
|
125
|
+
* The function should return the modified array of form field configurations
|
|
126
|
+
*/
|
|
127
|
+
overrideSignupFields?: OverrideSignupFields;
|
|
128
|
+
/**
|
|
129
|
+
* If true, beside the password field will be displayed a confirmation password field
|
|
130
|
+
* Default is false
|
|
131
|
+
*/
|
|
132
|
+
requirePasswordConfirmation?: boolean;
|
|
120
133
|
}
|
|
121
134
|
export interface SignupPageThemeOptions extends LoginBoxCommonThemeOptions, SignupPageComponentsTheme {
|
|
122
135
|
}
|
|
@@ -24,6 +24,7 @@ export * from './ResetPasswordTheme';
|
|
|
24
24
|
export * from './ActivateAccountPageTheme';
|
|
25
25
|
export * from './AcceptInvitationTheme';
|
|
26
26
|
export * from './OpenAppPageTheme';
|
|
27
|
+
export * from './DynamicFields';
|
|
27
28
|
export interface AuthPageThemeOptions extends BaseThemeOptions, AuthPageCustomComponents {
|
|
28
29
|
style?: ExtendedCSSProperties;
|
|
29
30
|
layout?: {
|
package/index.js
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _OverrideSignupFields = require("./OverrideSignupFields");
|
|
7
|
+
Object.keys(_OverrideSignupFields).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _OverrideSignupFields[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _OverrideSignupFields[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -134,4 +134,15 @@ Object.keys(_OpenAppPageTheme).forEach(function (key) {
|
|
|
134
134
|
return _OpenAppPageTheme[key];
|
|
135
135
|
}
|
|
136
136
|
});
|
|
137
|
+
});
|
|
138
|
+
var _DynamicFields = require("./DynamicFields");
|
|
139
|
+
Object.keys(_DynamicFields).forEach(function (key) {
|
|
140
|
+
if (key === "default" || key === "__esModule") return;
|
|
141
|
+
if (key in exports && exports[key] === _DynamicFields[key]) return;
|
|
142
|
+
Object.defineProperty(exports, key, {
|
|
143
|
+
enumerable: true,
|
|
144
|
+
get: function () {
|
|
145
|
+
return _DynamicFields[key];
|
|
146
|
+
}
|
|
147
|
+
});
|
|
137
148
|
});
|
package/node/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/types",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.68.0-alpha.1",
|
|
4
4
|
"main": "./node/index.js",
|
|
5
5
|
"author": "Frontegg LTD",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@babel/runtime": "^7.18.6",
|
|
9
|
-
"@frontegg/redux-store": "7.
|
|
9
|
+
"@frontegg/redux-store": "7.68.0-alpha.1",
|
|
10
10
|
"csstype": "^3.0.9",
|
|
11
11
|
"deepmerge": "^4.2.2"
|
|
12
12
|
},
|