@qssolutions/ssas-registration-form 1.0.1 → 1.0.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.
- package/README.md +117 -100
- package/dist/components/LowerFormSection.d.ts.map +1 -1
- package/dist/components/SSASRegistrationForm.d.ts.map +1 -1
- package/dist/components/UpperFormSection.d.ts.map +1 -1
- package/dist/index.esm.js +20 -25
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +20 -25
- package/dist/index.js.map +1 -1
- package/dist/models/config.d.ts +1 -8
- package/dist/models/config.d.ts.map +1 -1
- package/dist/styles/defaultStyles.d.ts +1 -1
- package/dist/styles/defaultStyles.d.ts.map +1 -1
- package/dist/web-component.js +20 -25
- package/dist/web-component.js.map +1 -1
- package/dist/web-component.min.js +2 -2
- package/dist/web-component.min.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Reusable registration form library for SSAS scenarios, with:
|
|
|
4
4
|
|
|
5
5
|
- React component usage (`SSASRegistrationForm`)
|
|
6
6
|
- Framework-agnostic Web Component usage (`<ssas-registration-form>`)
|
|
7
|
-
- Configurable theme and feature flags
|
|
7
|
+
- Configurable theme, language, and feature flags
|
|
8
8
|
- Built-in API integration for partner lookup, localization, and registration
|
|
9
9
|
|
|
10
10
|
## Installation
|
|
@@ -13,29 +13,24 @@ Reusable registration form library for SSAS scenarios, with:
|
|
|
13
13
|
npm install @qssolutions/ssas-registration-form
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
```
|
|
16
|
+
> **Peer dependencies** — `react` and `react-dom` must be installed in your project:
|
|
17
|
+
> ```bash
|
|
18
|
+
> npm install react react-dom
|
|
19
|
+
> ```
|
|
21
20
|
|
|
22
21
|
## Quick start (React)
|
|
23
22
|
|
|
24
23
|
```tsx
|
|
25
24
|
import React from 'react';
|
|
26
|
-
import { SSASRegistrationForm, FormLibraryConfig } from '@qssolutions/ssas-registration-form';
|
|
25
|
+
import { SSASRegistrationForm, type FormLibraryConfig } from '@qssolutions/ssas-registration-form';
|
|
27
26
|
|
|
28
27
|
const config: FormLibraryConfig = {
|
|
29
|
-
partnerName: '
|
|
30
|
-
apiBaseUrl: 'https://portal.selfserviceassessment.com',
|
|
28
|
+
partnerName: 'MyPartner',
|
|
31
29
|
theme: {
|
|
32
30
|
primaryColor: '#00BAE4',
|
|
31
|
+
backgroundColor: '#FCFCFF',
|
|
33
32
|
},
|
|
34
|
-
|
|
35
|
-
enablePartnerMode: true,
|
|
36
|
-
requireTermsAcceptance: true,
|
|
37
|
-
requirePrivacyAcceptance: true,
|
|
38
|
-
},
|
|
33
|
+
languageCode: 'en',
|
|
39
34
|
onSuccess: (email) => {
|
|
40
35
|
console.log('Registration successful for', email);
|
|
41
36
|
},
|
|
@@ -59,8 +54,12 @@ Use the browser bundle directly:
|
|
|
59
54
|
<script>
|
|
60
55
|
const form = document.getElementById('registrationForm');
|
|
61
56
|
form.config = {
|
|
62
|
-
partnerName: '
|
|
63
|
-
|
|
57
|
+
partnerName: 'MyPartner',
|
|
58
|
+
languageCode: 'en',
|
|
59
|
+
theme: {
|
|
60
|
+
primaryColor: '#00BAE4',
|
|
61
|
+
backgroundColor: '#FCFCFF',
|
|
62
|
+
},
|
|
64
63
|
onSuccess: (email) => console.log('Success:', email),
|
|
65
64
|
onError: (error) => console.error('Error:', error),
|
|
66
65
|
};
|
|
@@ -73,7 +72,7 @@ Use the browser bundle directly:
|
|
|
73
72
|
|
|
74
73
|
## Configuration
|
|
75
74
|
|
|
76
|
-
`FormLibraryConfig
|
|
75
|
+
Full `FormLibraryConfig` reference:
|
|
77
76
|
|
|
78
77
|
```ts
|
|
79
78
|
type SupportedLanguage =
|
|
@@ -81,136 +80,154 @@ type SupportedLanguage =
|
|
|
81
80
|
| 'ar' | 'he' | 'pt-br' | 'tr' | 'id' | 'th' | 'vi' | 'pl';
|
|
82
81
|
|
|
83
82
|
interface FormLibraryConfig {
|
|
84
|
-
// Required
|
|
83
|
+
// ── Required ────────────────────────────────────────────────────────────────
|
|
84
|
+
|
|
85
|
+
// Partner identifier used for lookup and domain resolution
|
|
85
86
|
partnerName: string;
|
|
86
87
|
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
// ── Language ────────────────────────────────────────────────────────────────
|
|
89
|
+
|
|
90
|
+
// Override the form language. Falls back to the partner's configured language,
|
|
91
|
+
// then to 'en' if neither is set.
|
|
92
|
+
languageCode?: SupportedLanguage;
|
|
93
|
+
|
|
94
|
+
// ── Theme ───────────────────────────────────────────────────────────────────
|
|
90
95
|
|
|
91
|
-
// Visual customization
|
|
92
96
|
theme?: {
|
|
97
|
+
// Accent color used for buttons and interactive elements
|
|
98
|
+
// Default: resolved from partner's ColorWidget setting, falling back to #00BAE4
|
|
93
99
|
primaryColor?: string;
|
|
100
|
+
|
|
101
|
+
// Page background color
|
|
102
|
+
// Default: #FCFCFF
|
|
94
103
|
backgroundColor?: string;
|
|
104
|
+
|
|
95
105
|
fonts?: {
|
|
106
|
+
// Default: 'Proxima Nova, sans-serif'
|
|
96
107
|
family?: string;
|
|
97
108
|
sizes?: {
|
|
98
|
-
heading?: number;
|
|
99
|
-
subheading?: number;
|
|
100
|
-
body?: number;
|
|
109
|
+
heading?: number; // Default: 36
|
|
110
|
+
subheading?: number; // Default: 18
|
|
111
|
+
body?: number; // Default: 16
|
|
101
112
|
};
|
|
102
113
|
};
|
|
103
114
|
};
|
|
104
115
|
|
|
105
|
-
//
|
|
116
|
+
// ── Layout overrides ────────────────────────────────────────────────────────
|
|
117
|
+
|
|
118
|
+
// Inline style overrides applied on top of the default FluentUI class styles.
|
|
119
|
+
// topWrapper — the outer centering/padding container
|
|
120
|
+
// formWrapper — the white card that wraps the form fields
|
|
106
121
|
customStyles?: {
|
|
107
122
|
topWrapper?: React.CSSProperties;
|
|
108
123
|
formWrapper?: React.CSSProperties;
|
|
109
124
|
};
|
|
110
125
|
|
|
111
|
-
//
|
|
112
|
-
features?: {
|
|
113
|
-
enablePartnerMode?: boolean;
|
|
114
|
-
requireTermsAcceptance?: boolean;
|
|
115
|
-
requirePrivacyAcceptance?: boolean;
|
|
116
|
-
};
|
|
126
|
+
// ── Callbacks ───────────────────────────────────────────────────────────────
|
|
117
127
|
|
|
118
|
-
//
|
|
119
|
-
onSubmit?: (data: IUser) => Promise<void>;
|
|
128
|
+
// Custom async email validation (receives AbortSignal for debounce cancellation)
|
|
120
129
|
onValidateEmail?: (email: string, signal?: AbortSignal) => Promise<boolean>;
|
|
130
|
+
|
|
131
|
+
// Called with the registered email on successful submission
|
|
121
132
|
onSuccess?: (email: string) => void;
|
|
133
|
+
|
|
134
|
+
// Called with a human-readable error message on failure
|
|
122
135
|
onError?: (error: string) => void;
|
|
123
|
-
onNavigate?: (path: string) => void;
|
|
124
136
|
|
|
125
|
-
//
|
|
137
|
+
// ── Policy links ────────────────────────────────────────────────────────────
|
|
138
|
+
|
|
126
139
|
termsAndConditionsUrl?: string;
|
|
127
140
|
privacyNoticeUrl?: string;
|
|
128
141
|
}
|
|
129
142
|
```
|
|
130
143
|
|
|
131
|
-
###
|
|
132
|
-
|
|
133
|
-
- Default fonts: `Proxima Nova, sans-serif`
|
|
134
|
-
- Default primary color fallback in styles: `#00BAE4`
|
|
135
|
-
- Default feature flags:
|
|
136
|
-
- `enablePartnerMode: true`
|
|
137
|
-
- `requireTermsAcceptance: true`
|
|
138
|
-
- `requirePrivacyAcceptance: true`
|
|
139
|
-
|
|
140
|
-
## Runtime flow
|
|
144
|
+
### Defaults
|
|
141
145
|
|
|
142
|
-
|
|
146
|
+
| Option | Default |
|
|
147
|
+
|---|---|
|
|
148
|
+
| `languageCode` | `'en'` (or partner language if set) |
|
|
149
|
+
| `theme.backgroundColor` | `'#FCFCFF'` |
|
|
150
|
+
| `theme.primaryColor` | Partner's ColorWidget value → `'#00BAE4'` |
|
|
151
|
+
| `theme.fonts.family` | `'Proxima Nova, sans-serif'` |
|
|
152
|
+
| `theme.fonts.sizes.heading` | `36` |
|
|
153
|
+
| `theme.fonts.sizes.subheading` | `18` |
|
|
154
|
+
| `theme.fonts.sizes.body` | `16` |
|
|
143
155
|
|
|
144
|
-
|
|
145
|
-
2. Build partner-specific API base (`https://{partner.domain}`)
|
|
146
|
-
3. Fetch countries, org sizes, industries, and localization
|
|
147
|
-
4. Submit registration via `/user/add-from-partner`
|
|
156
|
+
### Custom layout styles
|
|
148
157
|
|
|
149
|
-
|
|
158
|
+
`customStyles` lets you override the two main layout containers with plain CSS properties. These are applied as inline `style` attributes on top of the default class styles:
|
|
150
159
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
Currently emitted event:
|
|
160
|
+
```ts
|
|
161
|
+
customStyles: {
|
|
162
|
+
// outer container — controls padding/alignment around the form card
|
|
163
|
+
topWrapper: { padding: '20px 10%' },
|
|
157
164
|
|
|
158
|
-
|
|
165
|
+
// the white form card — controls border, radius, width, etc.
|
|
166
|
+
formWrapper: { borderRadius: 0, border: 'none', minWidth: 'unset' },
|
|
167
|
+
}
|
|
168
|
+
```
|
|
159
169
|
|
|
160
|
-
##
|
|
170
|
+
## Runtime flow
|
|
161
171
|
|
|
162
|
-
|
|
172
|
+
1. Fetch partner record by `partnerName`
|
|
173
|
+
2. Resolve partner domain → build service base URL (`https://{partner.domain}`)
|
|
174
|
+
3. In parallel: fetch countries, org sizes, industries, localization
|
|
175
|
+
4. Render form
|
|
163
176
|
|
|
164
|
-
|
|
165
|
-
- `index.esm.js` (ESM)
|
|
166
|
-
- `index.d.ts` (types)
|
|
167
|
-
- `web-component.js` (IIFE)
|
|
168
|
-
- `web-component.min.js` (IIFE, minified)
|
|
177
|
+
**Language resolution order:** `config.languageCode` → `partner.languageCode` → `'en'`
|
|
169
178
|
|
|
170
|
-
|
|
179
|
+
**Primary color resolution order:** `config.theme.primaryColor` → partner ColorWidget setting → `#00BAE4`
|
|
171
180
|
|
|
172
|
-
|
|
173
|
-
- `npm run build:lib` — build React/library bundles
|
|
174
|
-
- `npm run build:webcomponent` — build browser web-component bundles
|
|
175
|
-
- `npm run watch` — watch library build
|
|
176
|
-
- `npm run watch:webcomponent` — watch web-component build
|
|
177
|
-
- `npm run dev` — build and open example react demo on port 8080
|
|
178
|
-
- `npm run dev:watch` — watch web-component bundle and serve examples
|
|
179
|
-
- `npm run serve` — serve project root at `http://localhost:8080`
|
|
180
|
-
- `npm run lint` — run ESLint on `src`
|
|
181
|
+
## Callbacks
|
|
181
182
|
|
|
182
|
-
|
|
183
|
+
| Callback | Signature | Description |
|
|
184
|
+
|---|---|---|
|
|
185
|
+
| `onSuccess` | `(email: string) => void` | Fired after successful registration |
|
|
186
|
+
| `onError` | `(error: string) => void` | Fired on API or validation error |
|
|
187
|
+
| `onValidateEmail` | `(email, signal?) => Promise<boolean>` | Custom async email check |
|
|
183
188
|
|
|
184
|
-
|
|
185
|
-
- `example/react-example.html` — integration-style demo page
|
|
189
|
+
## Web Component events
|
|
186
190
|
|
|
187
|
-
|
|
191
|
+
| Event | Description |
|
|
192
|
+
|---|---|
|
|
193
|
+
| `ssas-form-ready` | Fired after the React component mounts inside the custom element |
|
|
188
194
|
|
|
189
|
-
|
|
190
|
-
npm install
|
|
191
|
-
npm run build
|
|
192
|
-
npm run serve
|
|
193
|
-
```
|
|
195
|
+
## Build outputs
|
|
194
196
|
|
|
195
|
-
|
|
197
|
+
Generated in `dist/`:
|
|
196
198
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
+
| File | Format | Description |
|
|
200
|
+
|---|---|---|
|
|
201
|
+
| `index.js` | CJS | Node / CommonJS consumers |
|
|
202
|
+
| `index.esm.js` | ESM | Vite / Webpack 5 / modern bundlers |
|
|
203
|
+
| `index.d.ts` | — | TypeScript declarations |
|
|
204
|
+
| `web-component.js` | IIFE | Browser bundle (unminified) |
|
|
205
|
+
| `web-component.min.js` | IIFE | Browser bundle (minified, CDN) |
|
|
199
206
|
|
|
200
207
|
## Public exports
|
|
201
208
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
209
|
+
```ts
|
|
210
|
+
// Components
|
|
211
|
+
export { SSASRegistrationForm } from '...'
|
|
212
|
+
export { SSASFormElement } from '...' // web component class
|
|
213
|
+
|
|
214
|
+
// Config & types
|
|
215
|
+
export type { FormLibraryConfig, SupportedLanguage }
|
|
216
|
+
export type { IUser, IPartnerModel, IPartnerSetting, IColorWidget,
|
|
217
|
+
ICountry, IOrgSize, IIndustry, ApiResponse }
|
|
218
|
+
export { FormModel, FormType }
|
|
219
|
+
|
|
220
|
+
// Data & utilities
|
|
221
|
+
export { FormDataModels } // static dropdown option sets
|
|
222
|
+
export { ApiService }
|
|
223
|
+
export { useFormConfig }
|
|
224
|
+
|
|
225
|
+
// Style helpers
|
|
226
|
+
export { createFormStyles, textFieldStyles, choiceGroupStyles,
|
|
227
|
+
dropdownStyles, comboboxStyles, checkboxStyles }
|
|
228
|
+
```
|
|
213
229
|
|
|
214
230
|
## License
|
|
215
231
|
|
|
216
|
-
MIT
|
|
232
|
+
MIT
|
|
233
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LowerFormSection.d.ts","sourceRoot":"","sources":["../../src/components/LowerFormSection.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAY,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"LowerFormSection.d.ts","sourceRoot":"","sources":["../../src/components/LowerFormSection.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAY,MAAM,OAAO,CAAA;AAC3C,OAAO,EAEH,KAAK,EACL,oBAAoB,EACpB,aAAa,EAChB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAI9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAMpD,KAAK,qBAAqB,GAAG;IACzB,QAAQ,EAAE,eAAe,CAAC,KAAK,CAAC,CAAA;IAChC,aAAa,EAAE,OAAO,CAAA;IACtB,MAAM,EAAE,WAAW,CAAC,KAAK,CAAC,CAAA;IAC1B,WAAW,EAAE,oBAAoB,CAAA;IACjC,MAAM,EAAE,iBAAiB,CAAA;IACzB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,aAAa,CAAA;CAC9B,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CA8ItD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SSASRegistrationForm.d.ts","sourceRoot":"","sources":["../../src/components/SSASRegistrationForm.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAgC,MAAM,OAAO,CAAA;AAY/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAWpD,eAAO,MAAM,WAAW;;;;;CAKvB,CAAA;AAED,UAAU,yBAAyB;IAC/B,MAAM,EAAE,iBAAiB,CAAA;CAC5B;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,yBAAyB,
|
|
1
|
+
{"version":3,"file":"SSASRegistrationForm.d.ts","sourceRoot":"","sources":["../../src/components/SSASRegistrationForm.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAgC,MAAM,OAAO,CAAA;AAY/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAWpD,eAAO,MAAM,WAAW;;;;;CAKvB,CAAA;AAED,UAAU,yBAAyB;IAC/B,MAAM,EAAE,iBAAiB,CAAA;CAC5B;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,y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,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IAC3B,OAAO,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;IAC/B,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;IAC3B,WAAW,EAAE,oBAAoB,CAAC;IAClC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,GAAG,CAAC;IACZ,cAAc,CAAC,EAAE,eAAe,EAAE,CAAC;IACnC,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IACrC,kBAAkB,CAAC,EAAE,eAAe,EAAE,CAAC;IACvC,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IACrC,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CA4FtD,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -36,6 +36,7 @@ var FormType;
|
|
|
36
36
|
})(FormType || (FormType = {}));
|
|
37
37
|
|
|
38
38
|
const defaultConfig = {
|
|
39
|
+
languageCode: 'en',
|
|
39
40
|
theme: {
|
|
40
41
|
// primaryColor: '#006B83',
|
|
41
42
|
backgroundColor: '#FCFCFF',
|
|
@@ -48,11 +49,6 @@ const defaultConfig = {
|
|
|
48
49
|
},
|
|
49
50
|
},
|
|
50
51
|
},
|
|
51
|
-
features: {
|
|
52
|
-
enablePartnerMode: true,
|
|
53
|
-
requireTermsAcceptance: true,
|
|
54
|
-
requirePrivacyAcceptance: true,
|
|
55
|
-
},
|
|
56
52
|
};
|
|
57
53
|
|
|
58
54
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -21523,11 +21519,11 @@ class ApiService {
|
|
|
21523
21519
|
}
|
|
21524
21520
|
}
|
|
21525
21521
|
|
|
21526
|
-
const createFormStyles = (primaryColor = '#00BAE4', fonts) => {
|
|
21522
|
+
const createFormStyles = (primaryColor = '#00BAE4', fonts, backgroundColor = '#FCFCFF') => {
|
|
21527
21523
|
const fontFamily = fonts?.family || 'Proxima Nova, sans-serif';
|
|
21528
21524
|
return mergeStyleSets({
|
|
21529
21525
|
mainContainer: {
|
|
21530
|
-
backgroundColor:
|
|
21526
|
+
backgroundColor: backgroundColor,
|
|
21531
21527
|
fontFamily: fontFamily,
|
|
21532
21528
|
WebkitFontSmoothing: 'antialiased',
|
|
21533
21529
|
},
|
|
@@ -22178,14 +22174,14 @@ const UpperFormSection = ({ isRegistering, performByPartner, setPerformByPartner
|
|
|
22178
22174
|
isHearAbout ? FormModel.HearAbout : false,
|
|
22179
22175
|
];
|
|
22180
22176
|
return (React__default.createElement(React__default.Fragment, null,
|
|
22181
|
-
|
|
22177
|
+
React__default.createElement(ChoiceGroup, { defaultSelectedKey: "ByCustomer", options: choiceGroupOptions, styles: choiceGroupStyles(isRTLContent(partnerData?.languageCode), primaryColor, config.theme?.fonts), onChange: (e, option) => {
|
|
22182
22178
|
// Reset the partner fields
|
|
22183
22179
|
setValue(FormModel.CustomerPartnerMail, "");
|
|
22184
22180
|
setValue(FormModel.CustomerPartnerName, "");
|
|
22185
22181
|
clearErrors(FormModel.CustomerPartnerMail);
|
|
22186
22182
|
clearErrors(FormModel.CustomerPartnerName);
|
|
22187
22183
|
setPerformByPartner(option?.key === "ByPartner");
|
|
22188
|
-
} })
|
|
22184
|
+
} }),
|
|
22189
22185
|
React__default.createElement("div", { className: styles.inputFieldContainer },
|
|
22190
22186
|
React__default.createElement(FormComponentRenderer, { formModels: formComponentList, isRegistering: isRegistering, control: control, setValue: setValue, setError: setError, clearErrors: clearErrors, errors: errors, trigger: trigger, performByPartner: performByPartner, watchFormField: watch, translation: translation, config: config, apiService: apiService, styles: styles, countryOptions: countryOptions, orgSizingOptions: orgSizingOptions, orgIndustryOptions: orgIndustryOptions, hearAboutOptions: hearAboutOptions, partnerData: partnerData, primaryColor: primaryColor }))));
|
|
22191
22187
|
};
|
|
@@ -22306,7 +22302,8 @@ const LowerFormSection = ({ setValue, isRegistering, errors, translation, config
|
|
|
22306
22302
|
const [privacyAcceptance, setPrivacyAcceptance] = useState(false);
|
|
22307
22303
|
const primaryColor = primaryColorProp || DEFAULT_PRIMARY_COLOR;
|
|
22308
22304
|
const recaptchaSiteKey = RECAPTCHA_DEFAULT_SITE_KEY;
|
|
22309
|
-
const termsUrl = config.termsAndConditionsUrl ||
|
|
22305
|
+
const termsUrl = config.termsAndConditionsUrl ||
|
|
22306
|
+
(partnerData ? partnerData.domain + "/terms-and-conditions" : "");
|
|
22310
22307
|
const privacyUrl = config.privacyNoticeUrl || translation.PrivacyStatementLink;
|
|
22311
22308
|
const onChangeTermCheckbox = (ev, checked) => {
|
|
22312
22309
|
if (checked) {
|
|
@@ -22340,15 +22337,13 @@ const LowerFormSection = ({ setValue, isRegistering, errors, translation, config
|
|
|
22340
22337
|
else
|
|
22341
22338
|
return defaultRender ? defaultRender() : null;
|
|
22342
22339
|
};
|
|
22343
|
-
const shouldRequireTerms = config.features?.requireTermsAcceptance !== false;
|
|
22344
|
-
const shouldRequirePrivacy = config.features?.requirePrivacyAcceptance !== false;
|
|
22345
22340
|
return (React__default.createElement("div", null,
|
|
22346
22341
|
React__default.createElement("div", { style: { margin: "20px 0" } }, React__default.createElement(ReCAPTCHA, {
|
|
22347
22342
|
sitekey: recaptchaSiteKey,
|
|
22348
|
-
onChange: (token) => token ? setCaptcha(true) : setCaptcha(false)
|
|
22343
|
+
onChange: (token) => token ? setCaptcha(true) : setCaptcha(false),
|
|
22349
22344
|
})),
|
|
22350
|
-
|
|
22351
|
-
|
|
22345
|
+
React__default.createElement(SSASCheckbox, { onRenderLabel: renderCheckboxPrivacy, styles: { root: { margin: "30px 0" } }, onChange: onChangePrivacyCheckbox, disabled: isRegistering, primaryColor: primaryColor, fonts: config.theme?.fonts }),
|
|
22346
|
+
React__default.createElement(SSASCheckbox, { onRenderLabel: renderCheckboxTerm, styles: { root: { margin: "30px 0" } }, onChange: onChangeTermCheckbox, disabled: isRegistering, primaryColor: primaryColor, fonts: config.theme?.fonts }),
|
|
22352
22347
|
submissionError && (React__default.createElement("div", { style: {
|
|
22353
22348
|
backgroundColor: "#FDE7E9",
|
|
22354
22349
|
border: "1px solid #DC3545",
|
|
@@ -22367,9 +22362,9 @@ const LowerFormSection = ({ setValue, isRegistering, errors, translation, config
|
|
|
22367
22362
|
root: { display: "block", width: "100%" },
|
|
22368
22363
|
}, type: "submit", disabled: !(Object.keys(errors).length === 0 &&
|
|
22369
22364
|
!isRegistering &&
|
|
22370
|
-
|
|
22371
|
-
|
|
22372
|
-
|
|
22365
|
+
termAcceptance &&
|
|
22366
|
+
privacyAcceptance &&
|
|
22367
|
+
captcha), onRenderMenuIcon: renderLoadingIcon })));
|
|
22373
22368
|
};
|
|
22374
22369
|
|
|
22375
22370
|
const SettingKeys = {
|
|
@@ -22391,7 +22386,7 @@ const SSASRegistrationForm = ({ config, }) => {
|
|
|
22391
22386
|
const partnerApiService = useMemo(() => new ApiService(initCheckUrl), []);
|
|
22392
22387
|
// Main service uses the partner's own domain once loaded
|
|
22393
22388
|
const apiService = useMemo(() => new ApiService(partnerData?.domain ? new URL(`https://${partnerData?.domain}`).toString() : ""), [partnerData?.domain]);
|
|
22394
|
-
const styles = useMemo(() => createFormStyles(mergedConfig.theme?.primaryColor || colorWidget?.column1, mergedConfig.theme?.fonts), [mergedConfig.theme?.primaryColor, mergedConfig.theme?.fonts, colorWidget?.column1]);
|
|
22389
|
+
const styles = useMemo(() => createFormStyles(mergedConfig.theme?.primaryColor || colorWidget?.column1, mergedConfig.theme?.fonts, mergedConfig.theme?.backgroundColor), [mergedConfig.theme?.primaryColor, mergedConfig.theme?.fonts, mergedConfig.theme?.backgroundColor, colorWidget?.column1]);
|
|
22395
22390
|
const [isRegistering, setIsRegistering] = useState(false);
|
|
22396
22391
|
const [performByPartner, setPerformByPartner] = useState(false);
|
|
22397
22392
|
const [finalStep, setFinalStep] = useState("");
|
|
@@ -22428,10 +22423,10 @@ const SSASRegistrationForm = ({ config, }) => {
|
|
|
22428
22423
|
return LANGUAGE_OPTIONS.filter((l) => supportedLangs.includes(l.data.code));
|
|
22429
22424
|
}, [partnerData?.supportedLanguages]);
|
|
22430
22425
|
const defaultLanguage = useMemo(() => {
|
|
22431
|
-
const currentLang = partnerData?.languageCode || "en";
|
|
22426
|
+
const currentLang = mergedConfig.languageCode || partnerData?.languageCode || "en";
|
|
22432
22427
|
return (languageOptions.find((x) => x.data.code === currentLang)?.text ||
|
|
22433
22428
|
"English");
|
|
22434
|
-
}, [partnerData?.languageCode, languageOptions]);
|
|
22429
|
+
}, [mergedConfig.languageCode, partnerData?.languageCode, languageOptions]);
|
|
22435
22430
|
const { handleSubmit, setValue, setError, control, watch, clearErrors, trigger, formState: { errors }, } = useForm({
|
|
22436
22431
|
defaultValues: {
|
|
22437
22432
|
orgSizingId: 1,
|
|
@@ -22522,7 +22517,7 @@ const SSASRegistrationForm = ({ config, }) => {
|
|
|
22522
22517
|
// Load localization
|
|
22523
22518
|
setIsLoadingLocalization(true);
|
|
22524
22519
|
apiService
|
|
22525
|
-
.getFormScreenLocalization(partnerData.languageCode || "en", partnerData.id, partnerData.languageCode)
|
|
22520
|
+
.getFormScreenLocalization(mergedConfig.languageCode || partnerData.languageCode || "en", partnerData.id, mergedConfig.languageCode || partnerData.languageCode)
|
|
22526
22521
|
.then((localization) => {
|
|
22527
22522
|
setLocalizationData(localization);
|
|
22528
22523
|
})
|
|
@@ -22664,7 +22659,7 @@ const SSASRegistrationForm = ({ config, }) => {
|
|
|
22664
22659
|
if (finalStep) {
|
|
22665
22660
|
// Default success screen
|
|
22666
22661
|
return (React__default.createElement("div", { className: styles.mainContainer },
|
|
22667
|
-
React__default.createElement("div", { className: styles.topWrapper },
|
|
22662
|
+
React__default.createElement("div", { className: styles.topWrapper, style: mergedConfig.customStyles?.topWrapper },
|
|
22668
22663
|
React__default.createElement("div", { className: styles.finalStepContainer },
|
|
22669
22664
|
React__default.createElement("div", { className: styles.textBlock },
|
|
22670
22665
|
React__default.createElement("div", { style: {
|
|
@@ -22688,7 +22683,7 @@ const SSASRegistrationForm = ({ config, }) => {
|
|
|
22688
22683
|
} }, finalStep))))));
|
|
22689
22684
|
}
|
|
22690
22685
|
return (React__default.createElement("div", { className: styles.mainContainer },
|
|
22691
|
-
React__default.createElement("div", { className: styles.topWrapper }, isLoadingData ? (React__default.createElement(Spinner, { label: "Loading form data...", styles: {
|
|
22686
|
+
React__default.createElement("div", { className: styles.topWrapper, style: mergedConfig.customStyles?.topWrapper }, isLoadingData ? (React__default.createElement(Spinner, { label: "Loading form data...", styles: {
|
|
22692
22687
|
root: {
|
|
22693
22688
|
marginBottom: "20px",
|
|
22694
22689
|
},
|
|
@@ -22707,7 +22702,7 @@ const SSASRegistrationForm = ({ config, }) => {
|
|
|
22707
22702
|
fontSize: mergedConfig.theme?.fonts?.sizes
|
|
22708
22703
|
?.subheading || 16,
|
|
22709
22704
|
lineHeight: "28px",
|
|
22710
|
-
} }, "Your company is not eligible to use this form. Please contact your administrator for assistance."))) : (React__default.createElement("form", { className: styles.formWrapper, onSubmit: handleSubmit(submitForm), noValidate: true },
|
|
22705
|
+
} }, "Your company is not eligible to use this form. Please contact your administrator for assistance."))) : (React__default.createElement("form", { className: styles.formWrapper, style: mergedConfig.customStyles?.formWrapper, onSubmit: handleSubmit(submitForm), noValidate: true },
|
|
22711
22706
|
React__default.createElement("div", { style: { textAlign: "center" } },
|
|
22712
22707
|
React__default.createElement("div", { style: {
|
|
22713
22708
|
fontSize: mergedConfig.theme?.fonts?.sizes
|