@qssolutions/ssas-registration-form 1.0.4 → 1.0.6

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
@@ -217,10 +217,6 @@ interface FormLibraryConfig {
217
217
  // Called with a human-readable error message on failure
218
218
  onError?: (error: string) => void;
219
219
 
220
- // ── Policy links ────────────────────────────────────────────────────────────
221
-
222
- termsAndConditionsUrl?: string;
223
- privacyNoticeUrl?: string;
224
220
  }
225
221
  ```
226
222
 
@@ -1 +1 @@
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
+ {"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,CAgJtD,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,CA4hB9D,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,CA6hB9D,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"SSASPrimaryButton.d.ts","sourceRoot":"","sources":["../../../src/components/common/SSASPrimaryButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAiB,YAAY,EAAuC,MAAM,iBAAiB,CAAC;AA6CnG,UAAU,uBAAwB,SAAQ,YAAY;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAMD,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAuB/D,CAAC"}
1
+ {"version":3,"file":"SSASPrimaryButton.d.ts","sourceRoot":"","sources":["../../../src/components/common/SSASPrimaryButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAiB,YAAY,EAAuC,MAAM,iBAAiB,CAAC;AA6CnG,UAAU,uBAAwB,SAAQ,YAAY;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAMD,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAsB/D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ControlledComboBox.d.ts","sourceRoot":"","sources":["../../../src/components/form-fields/ControlledComboBox.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAY,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,aAAa,GAAG,cAAc,CAsCjE,CAAC"}
1
+ {"version":3,"file":"ControlledComboBox.d.ts","sourceRoot":"","sources":["../../../src/components/form-fields/ControlledComboBox.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAY,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,aAAa,GAAG,cAAc,CAuDjE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ControlledDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/form-fields/ControlledDropdown.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAY,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,aAAa,GAAG,cAAc,CA4CjE,CAAC"}
1
+ {"version":3,"file":"ControlledDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/form-fields/ControlledDropdown.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAY,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,aAAa,GAAG,cAAc,CAuDjE,CAAC"}
package/dist/index.esm.js CHANGED
@@ -36,7 +36,7 @@ var FormType;
36
36
  })(FormType || (FormType = {}));
37
37
 
38
38
  const defaultConfig = {
39
- languageCode: 'en',
39
+ // languageCode: 'en',
40
40
  theme: {
41
41
  // primaryColor: '#006B83',
42
42
  backgroundColor: '#FCFCFF',
@@ -21498,13 +21498,10 @@ class ApiService {
21498
21498
  }
21499
21499
  /**
21500
21500
  * Get localization data for FormScreen by language code and partner ID
21501
- * Prioritizes defaultLanguage if provided over languageCode
21502
21501
  */
21503
- async getFormScreenLocalization(languageCode, partnerId, defaultLanguage) {
21502
+ async getFormScreenLocalization(languageCode, partnerId) {
21504
21503
  try {
21505
- // Prioritize defaultLanguage if provided, otherwise use languageCode
21506
- const selectedLanguage = defaultLanguage || languageCode;
21507
- const response = await axios$1.get(this.getUrl(`${API_ENDPOINTS.GET_LOCALIZATION}/${selectedLanguage}/FormScreen/${partnerId}`));
21504
+ const response = await axios$1.get(this.getUrl(`${API_ENDPOINTS.GET_LOCALIZATION}/${languageCode}/FormScreen/${partnerId}`));
21508
21505
  if (response.data.isSuccess) {
21509
21506
  return response.data.data;
21510
21507
  }
@@ -21958,7 +21955,15 @@ const ControlledDropdown = ({ name, control, rules, defaultValue, options, ...pr
21958
21955
  typeof option?.key === "string" || name == FormModel.CompanySize || name == FormModel.OrgIndustryId
21959
21956
  ? onChange(option?.key)
21960
21957
  : onChange(option?.text);
21961
- }, onBlur: onBlur, errorMessage: error && error.message })) }));
21958
+ }, onBlur: onBlur, errorMessage: error && error.message, styles: error
21959
+ ? {
21960
+ ...props.styles,
21961
+ title: {
21962
+ ...(props.styles?.title),
21963
+ border: "solid 1px #a4262c",
21964
+ },
21965
+ }
21966
+ : props.styles })) }));
21962
21967
  };
21963
21968
 
21964
21969
  const ControlledCombobox = ({ name, control, rules, defaultValue, options, ...props }) => {
@@ -21967,7 +21972,21 @@ const ControlledCombobox = ({ name, control, rules, defaultValue, options, ...pr
21967
21972
  typeof option?.key === "string"
21968
21973
  ? onChange(option.key)
21969
21974
  : onChange(option?.text);
21970
- }, onBlur: onBlur, errorMessage: error && error.message, defaultValue: undefined, allowFreeInput: true, autoComplete: "on" }));
21975
+ }, onBlur: onBlur, errorMessage: error && error.message, defaultValue: undefined, allowFreeInput: true, autoComplete: "on", styles: error
21976
+ ? {
21977
+ ...props.styles,
21978
+ root: {
21979
+ ...(props.styles?.root),
21980
+ selectors: {
21981
+ ...(props.styles?.root?.selectors),
21982
+ ":after": {
21983
+ ...(props.styles?.root?.selectors?.[":after"]),
21984
+ border: "solid 1px #a4262c",
21985
+ },
21986
+ },
21987
+ },
21988
+ }
21989
+ : props.styles }));
21971
21990
  } }));
21972
21991
  };
21973
21992
 
@@ -22079,13 +22098,13 @@ const FormComponentRenderer = ({ formModels, isRegistering, control, setValue, s
22079
22098
  };
22080
22099
  });
22081
22100
  };
22082
- const renderByType = (component, index) => {
22101
+ const renderByType = (component, key) => {
22083
22102
  const isValidating = validatingFields[component.name] || false;
22084
22103
  switch (component.type) {
22085
22104
  case FormType.Text:
22086
- return (React__default.createElement(ControlledTextField, { name: component.name, control: control, rules: component.rules, label: component.label, placeholder: component.placeholder, required: component.rules?.required, disabled: isRegistering, styles: textFieldStyles(config.theme?.fonts), key: index }));
22105
+ return (React__default.createElement(ControlledTextField, { name: component.name, control: control, rules: component.rules, label: component.label, placeholder: component.placeholder, required: component.rules?.required, disabled: isRegistering, styles: textFieldStyles(config.theme?.fonts), key: key }));
22087
22106
  case FormType.AsyncText:
22088
- return (React__default.createElement("div", { key: index },
22107
+ return (React__default.createElement("div", { key: key },
22089
22108
  React__default.createElement(ControlledTextFieldAsync, { label: component.label, placeholder: component.placeholder, control: control, setValue: setValue, setError: setError, clearErrors: clearErrors, name: component.name, styles: textFieldStyles(config.theme?.fonts), trigger: trigger, setIsValidating: setFieldValidating(component.name), translation: translation, config: config, apiService: apiService, rules: {
22090
22109
  required: translation.EmailError,
22091
22110
  }, required: component.rules?.required, description: !(component.name in errors) && !isValidating
@@ -22102,16 +22121,16 @@ const FormComponentRenderer = ({ formModels, isRegistering, control, setValue, s
22102
22121
  },
22103
22122
  } }))));
22104
22123
  case FormType.Dropdown:
22105
- return (React__default.createElement(ControlledDropdown, { key: index, required: component.rules?.required !== undefined, options: getDropdownOptions(component.name), label: component.label, rules: component.rules, control: control, name: component.name, placeholder: component.placeholder, disabled: isDropdownDisabled(component.name), className: component.bigColumn ? styles.bigColumn : "", styles: dropdownStyles(config.theme?.fonts) }));
22124
+ return (React__default.createElement(ControlledDropdown, { key: key, required: component.rules?.required !== undefined, options: getDropdownOptions(component.name), label: component.label, rules: component.rules, control: control, name: component.name, placeholder: component.placeholder, disabled: isDropdownDisabled(component.name), className: component.bigColumn ? styles.bigColumn : "", styles: dropdownStyles(config.theme?.fonts) }));
22106
22125
  case FormType.ComboBox:
22107
- return (React__default.createElement(ControlledCombobox, { key: index, options: countryOptions || [], label: component.label, control: control, rules: component.rules, name: component.name, placeholder: component.placeholder, required: component.rules?.required !== "", disabled: isRegistering, autoComplete: "off", styles: comboboxStyles(config.theme?.fonts) }));
22126
+ return (React__default.createElement(ControlledCombobox, { key: key, options: countryOptions || [], label: component.label, control: control, rules: component.rules, name: component.name, placeholder: component.placeholder, required: component.rules?.required !== "", disabled: isRegistering, autoComplete: "off", styles: comboboxStyles(config.theme?.fonts) }));
22108
22127
  case FormType.CheckBox:
22109
- return (React__default.createElement(ControlledCheckbox, { key: index, name: component.name, label: component.label, rules: component.rules, disabled: isRegistering, control: control, primaryColor: primaryColor, className: styles.checkboxIsSharedMail }));
22128
+ return (React__default.createElement(ControlledCheckbox, { key: key, name: component.name, label: component.label, rules: component.rules, disabled: isRegistering, control: control, primaryColor: primaryColor, className: styles.checkboxIsSharedMail }));
22110
22129
  default:
22111
22130
  return null;
22112
22131
  }
22113
22132
  };
22114
- return (React__default.createElement(React__default.Fragment, null, renderList.map((component, index) => renderByType(component, index))));
22133
+ return (React__default.createElement(React__default.Fragment, null, renderList.map((component) => renderByType(component, component.name))));
22115
22134
  };
22116
22135
 
22117
22136
  /**
@@ -22294,7 +22313,7 @@ const SSASPrimaryButton = (props) => {
22294
22313
  if (noIcon)
22295
22314
  return React.createElement(PrimaryButton, { ...buttonProps, styles: modifiedStyles });
22296
22315
  return (!iconProps) ?
22297
- React.createElement(PrimaryButton, { ...buttonProps, styles: modifiedStyles, menuIconProps: { iconName: icon }, disabled: loadingIcon, onRenderIcon: () => loadingIcon ? renderSpinner() : null }) :
22316
+ React.createElement(PrimaryButton, { ...buttonProps, styles: modifiedStyles, menuIconProps: { iconName: icon }, onRenderIcon: () => loadingIcon ? renderSpinner() : null }) :
22298
22317
  React.createElement(PrimaryButton, { ...buttonProps, styles: modifiedStyles, iconProps: { iconName: icon }, disabled: loadingIcon, onRenderIcon: () => loadingIcon ? renderSpinner() : null });
22299
22318
  };
22300
22319
 
@@ -22304,9 +22323,13 @@ const LowerFormSection = ({ setValue, isRegistering, errors, translation, config
22304
22323
  const [privacyAcceptance, setPrivacyAcceptance] = useState(false);
22305
22324
  const primaryColor = primaryColorProp || DEFAULT_PRIMARY_COLOR;
22306
22325
  const recaptchaSiteKey = RECAPTCHA_DEFAULT_SITE_KEY;
22307
- const termsUrl = config.termsAndConditionsUrl ||
22308
- (partnerData ? partnerData.domain + "/terms-and-conditions" : "");
22309
- const privacyUrl = config.privacyNoticeUrl || translation.PrivacyStatementLink;
22326
+ const termsUrl = partnerData
22327
+ ? `https://${partnerData.domain}/terms-and-conditions`
22328
+ : "";
22329
+ const rawPrivacyUrl = translation.PrivacyStatementLink;
22330
+ const privacyUrl = rawPrivacyUrl && !/^https?:\/\//.test(rawPrivacyUrl) && partnerData
22331
+ ? `https://${partnerData.domain}${rawPrivacyUrl}`
22332
+ : rawPrivacyUrl;
22310
22333
  const onChangeTermCheckbox = (ev, checked) => {
22311
22334
  if (checked) {
22312
22335
  setTermAcceptance(true);
@@ -22362,11 +22385,11 @@ const LowerFormSection = ({ setValue, isRegistering, errors, translation, config
22362
22385
  React__default.createElement("span", null, submissionError))),
22363
22386
  React__default.createElement(SSASPrimaryButton, { text: translation.SubmitRequest, primaryColor: primaryColor, styles: {
22364
22387
  root: { display: "block", width: "100%" },
22365
- }, type: "submit", disabled: !(Object.keys(errors).length === 0 &&
22366
- !isRegistering &&
22367
- termAcceptance &&
22368
- privacyAcceptance &&
22369
- captcha), onRenderMenuIcon: renderLoadingIcon })));
22388
+ }, type: "submit", disabled: Object.keys(errors).length > 0 ||
22389
+ isRegistering ||
22390
+ !termAcceptance ||
22391
+ !privacyAcceptance ||
22392
+ !captcha, onRenderMenuIcon: renderLoadingIcon })));
22370
22393
  };
22371
22394
 
22372
22395
  const SettingKeys = {
@@ -22385,7 +22408,7 @@ const SSASRegistrationForm = ({ config, }) => {
22385
22408
  const mergedConfig = useFormConfig(config);
22386
22409
  // Stable service used only for partner lookup (works with relative URLs)
22387
22410
  const initCheckUrl = mergedConfig.apiBaseUrl || "https://portal.selfserviceassessment.com";
22388
- const partnerApiService = useMemo(() => new ApiService(initCheckUrl), []);
22411
+ const partnerApiService = useMemo(() => new ApiService(initCheckUrl), [initCheckUrl]);
22389
22412
  // Main service uses the partner's own domain once loaded
22390
22413
  const apiService = useMemo(() => new ApiService(partnerData?.domain ? new URL(`https://${partnerData?.domain}`).toString() : ""), [partnerData?.domain]);
22391
22414
  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]);
@@ -22518,8 +22541,9 @@ const SSASRegistrationForm = ({ config, }) => {
22518
22541
  });
22519
22542
  // Load localization
22520
22543
  setIsLoadingLocalization(true);
22544
+ const selectedLanguage = mergedConfig.languageCode || partnerData.languageCode || "en";
22521
22545
  apiService
22522
- .getFormScreenLocalization(mergedConfig.languageCode || partnerData.languageCode || "en", partnerData.id, mergedConfig.languageCode || partnerData.languageCode)
22546
+ .getFormScreenLocalization(selectedLanguage, partnerData.id)
22523
22547
  .then((localization) => {
22524
22548
  setLocalizationData(localization);
22525
22549
  })
@@ -22529,7 +22553,7 @@ const SSASRegistrationForm = ({ config, }) => {
22529
22553
  .finally(() => {
22530
22554
  setIsLoadingLocalization(false);
22531
22555
  });
22532
- }, [apiService, partnerData]);
22556
+ }, [apiService, partnerData, mergedConfig.languageCode]);
22533
22557
  // Set Default Language based on Country (Australia = English only)
22534
22558
  const countryWatch = useWatch({ control, name: FormModel.Country });
22535
22559
  useEffect(() => {