@qssolutions/ssas-registration-form 1.0.1 → 1.0.3

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 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
- ### Peer dependencies
17
-
18
- ```bash
19
- npm install react react-dom react-hook-form @fluentui/react react-i18next i18next react-google-recaptcha
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: 'Microsoft',
30
- apiBaseUrl: 'https://portal.selfserviceassessment.com',
28
+ partnerName: 'MyPartner',
31
29
  theme: {
32
30
  primaryColor: '#00BAE4',
31
+ backgroundColor: '#FCFCFF',
33
32
  },
34
- features: {
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
  },
@@ -51,7 +46,7 @@ export default function App() {
51
46
 
52
47
  ## Quick start (Web Component)
53
48
 
54
- Use the browser bundle directly:
49
+ Use the browser bundle directly — no React installation needed:
55
50
 
56
51
  ```html
57
52
  <script src="https://unpkg.com/@qssolutions/ssas-registration-form/dist/web-component.min.js"></script>
@@ -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: 'Microsoft',
63
- apiBaseUrl: 'https://portal.selfserviceassessment.com',
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
  };
@@ -71,9 +70,92 @@ Use the browser bundle directly:
71
70
  </script>
72
71
  ```
73
72
 
73
+ ## Quick start (Angular)
74
+
75
+ The Web Component bundle includes React internally — no extra dependencies needed.
76
+
77
+ ```ts
78
+ // app.module.ts
79
+ import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
80
+
81
+ @NgModule({
82
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
83
+ })
84
+ export class AppModule {}
85
+ ```
86
+
87
+ ```html
88
+ <!-- index.html -->
89
+ <script src="https://unpkg.com/@qssolutions/ssas-registration-form/dist/web-component.min.js"></script>
90
+ ```
91
+
92
+ ```html
93
+ <!-- registration.component.html -->
94
+ <ssas-registration-form #form></ssas-registration-form>
95
+ ```
96
+
97
+ ```ts
98
+ // registration.component.ts
99
+ import { Component, ElementRef, ViewChild, AfterViewInit } from '@angular/core';
100
+
101
+ @Component({ selector: 'app-registration', templateUrl: './registration.component.html' })
102
+ export class RegistrationComponent implements AfterViewInit {
103
+ @ViewChild('form') formEl!: ElementRef;
104
+
105
+ ngAfterViewInit() {
106
+ this.formEl.nativeElement.config = {
107
+ partnerName: 'MyPartner',
108
+ languageCode: 'en',
109
+ onSuccess: (email: string) => console.log('Success:', email),
110
+ onError: (error: string) => console.error('Error:', error),
111
+ };
112
+ }
113
+ }
114
+ ```
115
+
116
+ ## Quick start (Vue)
117
+
118
+ ```html
119
+ <!-- index.html -->
120
+ <script src="https://unpkg.com/@qssolutions/ssas-registration-form/dist/web-component.min.js"></script>
121
+ ```
122
+
123
+ ```vue
124
+ <!-- RegistrationForm.vue -->
125
+ <template>
126
+ <ssas-registration-form ref="form" />
127
+ </template>
128
+
129
+ <script setup>
130
+ import { onMounted, ref } from 'vue'
131
+
132
+ const form = ref(null)
133
+
134
+ onMounted(() => {
135
+ form.value.config = {
136
+ partnerName: 'MyPartner',
137
+ languageCode: 'en',
138
+ onSuccess: (email) => console.log('Success:', email),
139
+ onError: (error) => console.error('Error:', error),
140
+ }
141
+ })
142
+ </script>
143
+ ```
144
+
145
+ > **Vue note** — add `vue: { compilerOptions: { isCustomElement: (tag) => tag.startsWith('ssas-') } }` to your `vite.config.ts` to suppress unknown element warnings.
146
+
147
+ ## Framework comparison
148
+
149
+ | | React | Angular / Vue | Vanilla JS |
150
+ |---|---|---|---|
151
+ | **Install** | `npm install @qssolutions/ssas-registration-form` | CDN script tag | CDN script tag |
152
+ | **React required** | Yes (peer dep) | No — bundled in IIFE | No — bundled in IIFE |
153
+ | **Entry point** | `dist/index.esm.js` | `dist/web-component.min.js` | `dist/web-component.min.js` |
154
+ | **Usage** | `<SSASRegistrationForm config={...} />` | `<ssas-registration-form>` + `.config = {...}` | `<ssas-registration-form>` + `.config = {...}` |
155
+
74
156
  ## Configuration
75
157
 
76
- `FormLibraryConfig`:
158
+ Full `FormLibraryConfig` reference:
77
159
 
78
160
  ```ts
79
161
  type SupportedLanguage =
@@ -81,136 +163,154 @@ type SupportedLanguage =
81
163
  | 'ar' | 'he' | 'pt-br' | 'tr' | 'id' | 'th' | 'vi' | 'pl';
82
164
 
83
165
  interface FormLibraryConfig {
84
- // Required for partner-based initialization
166
+ // ── Required ────────────────────────────────────────────────────────────────
167
+
168
+ // Partner identifier used for lookup and domain resolution
85
169
  partnerName: string;
86
170
 
87
- // Optional base URL used for initial partner lookup
88
- // Default fallback: https://portal.selfserviceassessment.com
89
- apiBaseUrl?: string;
171
+ // ── Language ────────────────────────────────────────────────────────────────
172
+
173
+ // Override the form language. Falls back to the partner's configured language,
174
+ // then to 'en' if neither is set.
175
+ languageCode?: SupportedLanguage;
176
+
177
+ // ── Theme ───────────────────────────────────────────────────────────────────
90
178
 
91
- // Visual customization
92
179
  theme?: {
180
+ // Accent color used for buttons and interactive elements
181
+ // Default: resolved from partner's ColorWidget setting, falling back to #00BAE4
93
182
  primaryColor?: string;
183
+
184
+ // Page background color
185
+ // Default: #FCFCFF
94
186
  backgroundColor?: string;
187
+
95
188
  fonts?: {
189
+ // Default: 'Proxima Nova, sans-serif'
96
190
  family?: string;
97
191
  sizes?: {
98
- heading?: number;
99
- subheading?: number;
100
- body?: number;
192
+ heading?: number; // Default: 36
193
+ subheading?: number; // Default: 18
194
+ body?: number; // Default: 16
101
195
  };
102
196
  };
103
197
  };
104
198
 
105
- // Inline style overrides
199
+ // ── Layout overrides ────────────────────────────────────────────────────────
200
+
201
+ // Inline style overrides applied on top of the default FluentUI class styles.
202
+ // topWrapper — the outer centering/padding container
203
+ // formWrapper — the white card that wraps the form fields
106
204
  customStyles?: {
107
205
  topWrapper?: React.CSSProperties;
108
206
  formWrapper?: React.CSSProperties;
109
207
  };
110
208
 
111
- // Feature flags
112
- features?: {
113
- enablePartnerMode?: boolean;
114
- requireTermsAcceptance?: boolean;
115
- requirePrivacyAcceptance?: boolean;
116
- };
209
+ // ── Callbacks ───────────────────────────────────────────────────────────────
117
210
 
118
- // Optional callbacks
119
- onSubmit?: (data: IUser) => Promise<void>;
211
+ // Custom async email validation (receives AbortSignal for debounce cancellation)
120
212
  onValidateEmail?: (email: string, signal?: AbortSignal) => Promise<boolean>;
213
+
214
+ // Called with the registered email on successful submission
121
215
  onSuccess?: (email: string) => void;
216
+
217
+ // Called with a human-readable error message on failure
122
218
  onError?: (error: string) => void;
123
- onNavigate?: (path: string) => void;
124
219
 
125
- // Optional custom policy links
220
+ // ── Policy links ────────────────────────────────────────────────────────────
221
+
126
222
  termsAndConditionsUrl?: string;
127
223
  privacyNoticeUrl?: string;
128
224
  }
129
225
  ```
130
226
 
131
- ### Default behavior
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
227
+ ### Defaults
141
228
 
142
- The component resolves runtime data in this order:
229
+ | Option | Default |
230
+ |---|---|
231
+ | `languageCode` | `'en'` (or partner language if set) |
232
+ | `theme.backgroundColor` | `'#FCFCFF'` |
233
+ | `theme.primaryColor` | Partner's ColorWidget value → `'#00BAE4'` |
234
+ | `theme.fonts.family` | `'Proxima Nova, sans-serif'` |
235
+ | `theme.fonts.sizes.heading` | `36` |
236
+ | `theme.fonts.sizes.subheading` | `18` |
237
+ | `theme.fonts.sizes.body` | `16` |
143
238
 
144
- 1. Fetch partner by `partnerName`
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`
239
+ ### Custom layout styles
148
240
 
149
- On submit lifecycle:
241
+ `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
242
 
151
- - Success calls `onSuccess(email)`
152
- - Failures call `onError(message)`
153
-
154
- ## Web Component event
155
-
156
- Currently emitted event:
243
+ ```ts
244
+ customStyles: {
245
+ // outer container — controls padding/alignment around the form card
246
+ topWrapper: { padding: '20px 10%' },
157
247
 
158
- - `ssas-form-ready` — fired after the React form is mounted inside the custom element
248
+ // the white form card controls border, radius, width, etc.
249
+ formWrapper: { borderRadius: 0, border: 'none', minWidth: 'unset' },
250
+ }
251
+ ```
159
252
 
160
- ## Build outputs
253
+ ## Runtime flow
161
254
 
162
- Generated in `dist/`:
255
+ 1. Fetch partner record by `partnerName`
256
+ 2. Resolve partner domain → build service base URL (`https://{partner.domain}`)
257
+ 3. In parallel: fetch countries, org sizes, industries, localization
258
+ 4. Render form
163
259
 
164
- - `index.js` (CJS)
165
- - `index.esm.js` (ESM)
166
- - `index.d.ts` (types)
167
- - `web-component.js` (IIFE)
168
- - `web-component.min.js` (IIFE, minified)
260
+ **Language resolution order:** `config.languageCode` → `partner.languageCode` → `'en'`
169
261
 
170
- ## Scripts
262
+ **Primary color resolution order:** `config.theme.primaryColor` → partner ColorWidget setting → `#00BAE4`
171
263
 
172
- - `npm run build` — build library + web component bundles
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`
264
+ ## Callbacks
181
265
 
182
- ## Example pages
266
+ | Callback | Signature | Description |
267
+ |---|---|---|
268
+ | `onSuccess` | `(email: string) => void` | Fired after successful registration |
269
+ | `onError` | `(error: string) => void` | Fired on API or validation error |
270
+ | `onValidateEmail` | `(email, signal?) => Promise<boolean>` | Custom async email check |
183
271
 
184
- - `example/index.html` vanilla web-component demo
185
- - `example/react-example.html` — integration-style demo page
272
+ ## Web Component events
186
273
 
187
- Run locally:
274
+ | Event | Description |
275
+ |---|---|
276
+ | `ssas-form-ready` | Fired after the React component mounts inside the custom element |
188
277
 
189
- ```bash
190
- npm install
191
- npm run build
192
- npm run serve
193
- ```
278
+ ## Build outputs
194
279
 
195
- Then open:
280
+ Generated in `dist/`:
196
281
 
197
- - `http://localhost:8080/example/index.html`
198
- - `http://localhost:8080/example/react-example.html`
282
+ | File | Format | Description |
283
+ |---|---|---|
284
+ | `index.js` | CJS | Node / CommonJS consumers |
285
+ | `index.esm.js` | ESM | Vite / Webpack 5 / modern bundlers |
286
+ | `index.d.ts` | — | TypeScript declarations |
287
+ | `web-component.js` | IIFE | Browser bundle (unminified) |
288
+ | `web-component.min.js` | IIFE | Browser bundle (minified, CDN) |
199
289
 
200
290
  ## Public exports
201
291
 
202
- Main entry exports include:
203
-
204
- - `SSASRegistrationForm`
205
- - `SSASFormElement`
206
- - `FormLibraryConfig`, `SupportedLanguage`
207
- - Model types (`IUser`, `IPartnerModel`, etc.)
208
- - `FormModel`, `FormType`
209
- - `FormDataModels`
210
- - `ApiService`
211
- - `useFormConfig`
212
- - Style helpers (`createFormStyles`, `textFieldStyles`, `choiceGroupStyles`)
292
+ ```ts
293
+ // Components
294
+ export { SSASRegistrationForm } from '...'
295
+ export { SSASFormElement } from '...' // web component class
296
+
297
+ // Config & types
298
+ export type { FormLibraryConfig, SupportedLanguage }
299
+ export type { IUser, IPartnerModel, IPartnerSetting, IColorWidget,
300
+ ICountry, IOrgSize, IIndustry, ApiResponse }
301
+ export { FormModel, FormType }
302
+
303
+ // Data & utilities
304
+ export { FormDataModels } // static dropdown option sets
305
+ export { ApiService }
306
+ export { useFormConfig }
307
+
308
+ // Style helpers
309
+ export { createFormStyles, textFieldStyles, choiceGroupStyles,
310
+ dropdownStyles, comboboxStyles, checkboxStyles }
311
+ ```
213
312
 
214
313
  ## License
215
314
 
216
- MIT
315
+ MIT
316
+
@@ -1 +1 @@
1
- {"version":3,"file":"LowerFormSection.d.ts","sourceRoot":"","sources":["../../src/components/LowerFormSection.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAa,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAI/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,KAAK,qBAAqB,GAAG;IACzB,QAAQ,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;IACjC,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IAC3B,WAAW,EAAE,oBAAoB,CAAC;IAClC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,aAAa,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAkJtD,CAAC"}
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,CA0hB9D,CAAA"}
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,CA4hB9D,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"UpperFormSection.d.ts","sourceRoot":"","sources":["../../src/components/UpperFormSection.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAmC,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACpG,OAAO,EACH,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,cAAc,EACd,YAAY,EACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,EAAa,oBAAoB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAKpD,KAAK,qBAAqB,GAAG;IACzB,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,mBAAmB,EAAE,KAAK,CAAC,QAAQ,CAA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ig = {
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: '#FCFCFF',
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
- config.features?.enablePartnerMode && (React__default.createElement(ChoiceGroup, { defaultSelectedKey: "ByCustomer", options: choiceGroupOptions, styles: choiceGroupStyles(isRTLContent(partnerData?.languageCode), primaryColor, config.theme?.fonts), onChange: (e, option) => {
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 || (partnerData ? partnerData.domain + "/terms-and-conditions" : "");
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
- shouldRequirePrivacy && (React__default.createElement(SSASCheckbox, { onRenderLabel: renderCheckboxPrivacy, styles: { root: { margin: "30px 0" } }, onChange: onChangePrivacyCheckbox, disabled: isRegistering, primaryColor: primaryColor, fonts: config.theme?.fonts })),
22351
- shouldRequireTerms && (React__default.createElement(SSASCheckbox, { onRenderLabel: renderCheckboxTerm, styles: { root: { margin: "30px 0" } }, onChange: onChangeTermCheckbox, disabled: isRegistering, primaryColor: primaryColor, fonts: config.theme?.fonts })),
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
- (!shouldRequireTerms || termAcceptance) &&
22371
- (!shouldRequirePrivacy || privacyAcceptance) &&
22372
- (captcha)), onRenderMenuIcon: renderLoadingIcon })));
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