@qssolutions/ssas-registration-form 1.0.5 → 1.0.7

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
@@ -25,7 +25,7 @@ import React from 'react';
25
25
  import { SSASRegistrationForm, type FormLibraryConfig } from '@qssolutions/ssas-registration-form';
26
26
 
27
27
  const config: FormLibraryConfig = {
28
- partnerName: 'MyPartner',
28
+ partnerGuid: 'your-partner-guid', // Contact QSSolutions to obtain your Guid
29
29
  theme: {
30
30
  primaryColor: '#00BAE4',
31
31
  backgroundColor: '#FCFCFF',
@@ -54,7 +54,7 @@ Use the browser bundle directly — no React installation needed:
54
54
  <script>
55
55
  const form = document.getElementById('registrationForm');
56
56
  form.config = {
57
- partnerName: 'MyPartner',
57
+ partnerGuid: 'your-partner-guid', // Contact QSSolutions to obtain your Guid
58
58
  languageCode: 'en',
59
59
  theme: {
60
60
  primaryColor: '#00BAE4',
@@ -104,7 +104,7 @@ export class RegistrationComponent implements AfterViewInit {
104
104
 
105
105
  ngAfterViewInit() {
106
106
  this.formEl.nativeElement.config = {
107
- partnerName: 'MyPartner',
107
+ partnerGuid: 'your-partner-guid', // Contact QSSolutions to obtain your Guid
108
108
  languageCode: 'en',
109
109
  onSuccess: (email: string) => console.log('Success:', email),
110
110
  onError: (error: string) => console.error('Error:', error),
@@ -133,7 +133,7 @@ const form = ref(null)
133
133
 
134
134
  onMounted(() => {
135
135
  form.value.config = {
136
- partnerName: 'MyPartner',
136
+ partnerGuid: 'your-partner-guid', // Contact QSSolutions to obtain your Guid
137
137
  languageCode: 'en',
138
138
  onSuccess: (email) => console.log('Success:', email),
139
139
  onError: (error) => console.error('Error:', error),
@@ -165,8 +165,9 @@ type SupportedLanguage =
165
165
  interface FormLibraryConfig {
166
166
  // ── Required ────────────────────────────────────────────────────────────────
167
167
 
168
- // Partner identifier used for lookup and domain resolution
169
- partnerName: string;
168
+ // Unique partner identifier (GUID) used for lookup and domain resolution.
169
+ // Contact QSSolutions to obtain your Guid.
170
+ partnerGuid: string;
170
171
 
171
172
  // ── Language ────────────────────────────────────────────────────────────────
172
173
 
@@ -217,10 +218,6 @@ interface FormLibraryConfig {
217
218
  // Called with a human-readable error message on failure
218
219
  onError?: (error: string) => void;
219
220
 
220
- // ── Policy links ────────────────────────────────────────────────────────────
221
-
222
- termsAndConditionsUrl?: string;
223
- privacyNoticeUrl?: string;
224
221
  }
225
222
  ```
226
223
 
@@ -252,7 +249,7 @@ customStyles: {
252
249
 
253
250
  ## Runtime flow
254
251
 
255
- 1. Fetch partner record by `partnerName`
252
+ 1. Fetch partner record by `partnerGuid`
256
253
  2. Resolve partner domain → build service base URL (`https://{partner.domain}`)
257
254
  3. In parallel: fetch countries, org sizes, industries, localization
258
255
  4. Render form
@@ -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":"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
@@ -21283,7 +21283,7 @@ const API_ENDPOINTS = {
21283
21283
  GET_ORG_SIZES: '/common/orgsizing-list',
21284
21284
  GET_INDUSTRIES: '/common/industry-list',
21285
21285
  GET_PARTNER: '/partner/get',
21286
- GET_PARTNER_BY_NAME: '/partner/get-by-name',
21286
+ GET_PARTNER_BY_GUID: '/partner/get-by-guid',
21287
21287
  GET_LOCALIZATION: '/localization/get',
21288
21288
  };
21289
21289
 
@@ -21477,10 +21477,10 @@ class ApiService {
21477
21477
  * Get partner by name
21478
21478
  * Extracts name from the baseUrl automatically and cleans it
21479
21479
  */
21480
- async getPartnerByName(partnerName) {
21480
+ async getPartnerByGuid(partnerGuid) {
21481
21481
  try {
21482
- const response = await axios$1.get(this.getUrl(API_ENDPOINTS.GET_PARTNER_BY_NAME), {
21483
- params: { name: partnerName },
21482
+ const response = await axios$1.get(this.getUrl(API_ENDPOINTS.GET_PARTNER_BY_GUID), {
21483
+ params: { guid: partnerGuid },
21484
21484
  });
21485
21485
  if (response.data.isSuccess) {
21486
21486
  return response.data.data;
@@ -21955,7 +21955,15 @@ const ControlledDropdown = ({ name, control, rules, defaultValue, options, ...pr
21955
21955
  typeof option?.key === "string" || name == FormModel.CompanySize || name == FormModel.OrgIndustryId
21956
21956
  ? onChange(option?.key)
21957
21957
  : onChange(option?.text);
21958
- }, 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 })) }));
21959
21967
  };
21960
21968
 
21961
21969
  const ControlledCombobox = ({ name, control, rules, defaultValue, options, ...props }) => {
@@ -21964,7 +21972,21 @@ const ControlledCombobox = ({ name, control, rules, defaultValue, options, ...pr
21964
21972
  typeof option?.key === "string"
21965
21973
  ? onChange(option.key)
21966
21974
  : onChange(option?.text);
21967
- }, 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 }));
21968
21990
  } }));
21969
21991
  };
21970
21992
 
@@ -22076,13 +22098,13 @@ const FormComponentRenderer = ({ formModels, isRegistering, control, setValue, s
22076
22098
  };
22077
22099
  });
22078
22100
  };
22079
- const renderByType = (component, index) => {
22101
+ const renderByType = (component, key) => {
22080
22102
  const isValidating = validatingFields[component.name] || false;
22081
22103
  switch (component.type) {
22082
22104
  case FormType.Text:
22083
- 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 }));
22084
22106
  case FormType.AsyncText:
22085
- return (React__default.createElement("div", { key: index },
22107
+ return (React__default.createElement("div", { key: key },
22086
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: {
22087
22109
  required: translation.EmailError,
22088
22110
  }, required: component.rules?.required, description: !(component.name in errors) && !isValidating
@@ -22099,16 +22121,16 @@ const FormComponentRenderer = ({ formModels, isRegistering, control, setValue, s
22099
22121
  },
22100
22122
  } }))));
22101
22123
  case FormType.Dropdown:
22102
- 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) }));
22103
22125
  case FormType.ComboBox:
22104
- 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) }));
22105
22127
  case FormType.CheckBox:
22106
- 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 }));
22107
22129
  default:
22108
22130
  return null;
22109
22131
  }
22110
22132
  };
22111
- 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))));
22112
22134
  };
22113
22135
 
22114
22136
  /**
@@ -22291,7 +22313,7 @@ const SSASPrimaryButton = (props) => {
22291
22313
  if (noIcon)
22292
22314
  return React.createElement(PrimaryButton, { ...buttonProps, styles: modifiedStyles });
22293
22315
  return (!iconProps) ?
22294
- 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 }) :
22295
22317
  React.createElement(PrimaryButton, { ...buttonProps, styles: modifiedStyles, iconProps: { iconName: icon }, disabled: loadingIcon, onRenderIcon: () => loadingIcon ? renderSpinner() : null });
22296
22318
  };
22297
22319
 
@@ -22301,9 +22323,13 @@ const LowerFormSection = ({ setValue, isRegistering, errors, translation, config
22301
22323
  const [privacyAcceptance, setPrivacyAcceptance] = useState(false);
22302
22324
  const primaryColor = primaryColorProp || DEFAULT_PRIMARY_COLOR;
22303
22325
  const recaptchaSiteKey = RECAPTCHA_DEFAULT_SITE_KEY;
22304
- const termsUrl = config.termsAndConditionsUrl ||
22305
- (partnerData ? partnerData.domain + "/terms-and-conditions" : "");
22306
- 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;
22307
22333
  const onChangeTermCheckbox = (ev, checked) => {
22308
22334
  if (checked) {
22309
22335
  setTermAcceptance(true);
@@ -22359,11 +22385,11 @@ const LowerFormSection = ({ setValue, isRegistering, errors, translation, config
22359
22385
  React__default.createElement("span", null, submissionError))),
22360
22386
  React__default.createElement(SSASPrimaryButton, { text: translation.SubmitRequest, primaryColor: primaryColor, styles: {
22361
22387
  root: { display: "block", width: "100%" },
22362
- }, type: "submit", disabled: !(Object.keys(errors).length === 0 &&
22363
- !isRegistering &&
22364
- termAcceptance &&
22365
- privacyAcceptance &&
22366
- captcha), onRenderMenuIcon: renderLoadingIcon })));
22388
+ }, type: "submit", disabled: Object.keys(errors).length > 0 ||
22389
+ isRegistering ||
22390
+ !termAcceptance ||
22391
+ !privacyAcceptance ||
22392
+ !captcha, onRenderMenuIcon: renderLoadingIcon })));
22367
22393
  };
22368
22394
 
22369
22395
  const SettingKeys = {
@@ -22382,7 +22408,7 @@ const SSASRegistrationForm = ({ config, }) => {
22382
22408
  const mergedConfig = useFormConfig(config);
22383
22409
  // Stable service used only for partner lookup (works with relative URLs)
22384
22410
  const initCheckUrl = mergedConfig.apiBaseUrl || "https://portal.selfserviceassessment.com";
22385
- const partnerApiService = useMemo(() => new ApiService(initCheckUrl), []);
22411
+ const partnerApiService = useMemo(() => new ApiService(initCheckUrl), [initCheckUrl]);
22386
22412
  // Main service uses the partner's own domain once loaded
22387
22413
  const apiService = useMemo(() => new ApiService(partnerData?.domain ? new URL(`https://${partnerData?.domain}`).toString() : ""), [partnerData?.domain]);
22388
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]);
@@ -22441,7 +22467,7 @@ const SSASRegistrationForm = ({ config, }) => {
22441
22467
  useEffect(() => {
22442
22468
  setIsLoadingPartner(true);
22443
22469
  partnerApiService
22444
- .getPartnerByName(mergedConfig.partnerName)
22470
+ .getPartnerByGuid(mergedConfig.partnerGuid)
22445
22471
  .then((partner) => {
22446
22472
  partner ? setPartnerData(partner) : setPartnerLoadFailed(true);
22447
22473
  })
@@ -22452,7 +22478,7 @@ const SSASRegistrationForm = ({ config, }) => {
22452
22478
  .finally(() => {
22453
22479
  setIsLoadingPartner(false);
22454
22480
  });
22455
- }, [mergedConfig.partnerName]);
22481
+ }, [mergedConfig.partnerGuid, partnerApiService]);
22456
22482
  // Step 2: Load remaining data once partnerData is available
22457
22483
  useEffect(() => {
22458
22484
  if (!partnerData)