@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 +8 -11
- package/dist/components/LowerFormSection.d.ts.map +1 -1
- package/dist/components/common/SSASPrimaryButton.d.ts.map +1 -1
- package/dist/components/form-fields/ControlledComboBox.d.ts.map +1 -1
- package/dist/components/form-fields/ControlledDropdown.d.ts.map +1 -1
- package/dist/index.esm.js +51 -25
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +51 -25
- package/dist/index.js.map +1 -1
- package/dist/models/config.d.ts +1 -3
- package/dist/models/config.d.ts.map +1 -1
- package/dist/services/ApiService.d.ts +1 -1
- package/dist/utils/constants.d.ts +1 -1
- package/dist/web-component.js +51 -25
- package/dist/web-component.js.map +1 -1
- package/dist/web-component.min.js +1 -1
- package/dist/web-component.min.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21303,7 +21303,7 @@ const API_ENDPOINTS = {
|
|
|
21303
21303
|
GET_ORG_SIZES: '/common/orgsizing-list',
|
|
21304
21304
|
GET_INDUSTRIES: '/common/industry-list',
|
|
21305
21305
|
GET_PARTNER: '/partner/get',
|
|
21306
|
-
|
|
21306
|
+
GET_PARTNER_BY_GUID: '/partner/get-by-guid',
|
|
21307
21307
|
GET_LOCALIZATION: '/localization/get',
|
|
21308
21308
|
};
|
|
21309
21309
|
|
|
@@ -21497,10 +21497,10 @@ class ApiService {
|
|
|
21497
21497
|
* Get partner by name
|
|
21498
21498
|
* Extracts name from the baseUrl automatically and cleans it
|
|
21499
21499
|
*/
|
|
21500
|
-
async
|
|
21500
|
+
async getPartnerByGuid(partnerGuid) {
|
|
21501
21501
|
try {
|
|
21502
|
-
const response = await axios$1.get(this.getUrl(API_ENDPOINTS.
|
|
21503
|
-
params: {
|
|
21502
|
+
const response = await axios$1.get(this.getUrl(API_ENDPOINTS.GET_PARTNER_BY_GUID), {
|
|
21503
|
+
params: { guid: partnerGuid },
|
|
21504
21504
|
});
|
|
21505
21505
|
if (response.data.isSuccess) {
|
|
21506
21506
|
return response.data.data;
|
|
@@ -21975,7 +21975,15 @@ const ControlledDropdown = ({ name, control, rules, defaultValue, options, ...pr
|
|
|
21975
21975
|
typeof option?.key === "string" || name == exports.FormModel.CompanySize || name == exports.FormModel.OrgIndustryId
|
|
21976
21976
|
? onChange(option?.key)
|
|
21977
21977
|
: onChange(option?.text);
|
|
21978
|
-
}, onBlur: onBlur, errorMessage: error && error.message
|
|
21978
|
+
}, onBlur: onBlur, errorMessage: error && error.message, styles: error
|
|
21979
|
+
? {
|
|
21980
|
+
...props.styles,
|
|
21981
|
+
title: {
|
|
21982
|
+
...(props.styles?.title),
|
|
21983
|
+
border: "solid 1px #a4262c",
|
|
21984
|
+
},
|
|
21985
|
+
}
|
|
21986
|
+
: props.styles })) }));
|
|
21979
21987
|
};
|
|
21980
21988
|
|
|
21981
21989
|
const ControlledCombobox = ({ name, control, rules, defaultValue, options, ...props }) => {
|
|
@@ -21984,7 +21992,21 @@ const ControlledCombobox = ({ name, control, rules, defaultValue, options, ...pr
|
|
|
21984
21992
|
typeof option?.key === "string"
|
|
21985
21993
|
? onChange(option.key)
|
|
21986
21994
|
: onChange(option?.text);
|
|
21987
|
-
}, onBlur: onBlur, errorMessage: error && error.message, defaultValue: undefined, allowFreeInput: true, autoComplete: "on"
|
|
21995
|
+
}, onBlur: onBlur, errorMessage: error && error.message, defaultValue: undefined, allowFreeInput: true, autoComplete: "on", styles: error
|
|
21996
|
+
? {
|
|
21997
|
+
...props.styles,
|
|
21998
|
+
root: {
|
|
21999
|
+
...(props.styles?.root),
|
|
22000
|
+
selectors: {
|
|
22001
|
+
...(props.styles?.root?.selectors),
|
|
22002
|
+
":after": {
|
|
22003
|
+
...(props.styles?.root?.selectors?.[":after"]),
|
|
22004
|
+
border: "solid 1px #a4262c",
|
|
22005
|
+
},
|
|
22006
|
+
},
|
|
22007
|
+
},
|
|
22008
|
+
}
|
|
22009
|
+
: props.styles }));
|
|
21988
22010
|
} }));
|
|
21989
22011
|
};
|
|
21990
22012
|
|
|
@@ -22096,13 +22118,13 @@ const FormComponentRenderer = ({ formModels, isRegistering, control, setValue, s
|
|
|
22096
22118
|
};
|
|
22097
22119
|
});
|
|
22098
22120
|
};
|
|
22099
|
-
const renderByType = (component,
|
|
22121
|
+
const renderByType = (component, key) => {
|
|
22100
22122
|
const isValidating = validatingFields[component.name] || false;
|
|
22101
22123
|
switch (component.type) {
|
|
22102
22124
|
case exports.FormType.Text:
|
|
22103
|
-
return (React.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:
|
|
22125
|
+
return (React.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 }));
|
|
22104
22126
|
case exports.FormType.AsyncText:
|
|
22105
|
-
return (React.createElement("div", { key:
|
|
22127
|
+
return (React.createElement("div", { key: key },
|
|
22106
22128
|
React.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: {
|
|
22107
22129
|
required: translation.EmailError,
|
|
22108
22130
|
}, required: component.rules?.required, description: !(component.name in errors) && !isValidating
|
|
@@ -22119,16 +22141,16 @@ const FormComponentRenderer = ({ formModels, isRegistering, control, setValue, s
|
|
|
22119
22141
|
},
|
|
22120
22142
|
} }))));
|
|
22121
22143
|
case exports.FormType.Dropdown:
|
|
22122
|
-
return (React.createElement(ControlledDropdown, { key:
|
|
22144
|
+
return (React.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) }));
|
|
22123
22145
|
case exports.FormType.ComboBox:
|
|
22124
|
-
return (React.createElement(ControlledCombobox, { key:
|
|
22146
|
+
return (React.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) }));
|
|
22125
22147
|
case exports.FormType.CheckBox:
|
|
22126
|
-
return (React.createElement(ControlledCheckbox, { key:
|
|
22148
|
+
return (React.createElement(ControlledCheckbox, { key: key, name: component.name, label: component.label, rules: component.rules, disabled: isRegistering, control: control, primaryColor: primaryColor, className: styles.checkboxIsSharedMail }));
|
|
22127
22149
|
default:
|
|
22128
22150
|
return null;
|
|
22129
22151
|
}
|
|
22130
22152
|
};
|
|
22131
|
-
return (React.createElement(React.Fragment, null, renderList.map((component
|
|
22153
|
+
return (React.createElement(React.Fragment, null, renderList.map((component) => renderByType(component, component.name))));
|
|
22132
22154
|
};
|
|
22133
22155
|
|
|
22134
22156
|
/**
|
|
@@ -22311,7 +22333,7 @@ const SSASPrimaryButton = (props) => {
|
|
|
22311
22333
|
if (noIcon)
|
|
22312
22334
|
return React__namespace.createElement(react.PrimaryButton, { ...buttonProps, styles: modifiedStyles });
|
|
22313
22335
|
return (!iconProps) ?
|
|
22314
|
-
React__namespace.createElement(react.PrimaryButton, { ...buttonProps, styles: modifiedStyles, menuIconProps: { iconName: icon },
|
|
22336
|
+
React__namespace.createElement(react.PrimaryButton, { ...buttonProps, styles: modifiedStyles, menuIconProps: { iconName: icon }, onRenderIcon: () => loadingIcon ? renderSpinner() : null }) :
|
|
22315
22337
|
React__namespace.createElement(react.PrimaryButton, { ...buttonProps, styles: modifiedStyles, iconProps: { iconName: icon }, disabled: loadingIcon, onRenderIcon: () => loadingIcon ? renderSpinner() : null });
|
|
22316
22338
|
};
|
|
22317
22339
|
|
|
@@ -22321,9 +22343,13 @@ const LowerFormSection = ({ setValue, isRegistering, errors, translation, config
|
|
|
22321
22343
|
const [privacyAcceptance, setPrivacyAcceptance] = React.useState(false);
|
|
22322
22344
|
const primaryColor = primaryColorProp || DEFAULT_PRIMARY_COLOR;
|
|
22323
22345
|
const recaptchaSiteKey = RECAPTCHA_DEFAULT_SITE_KEY;
|
|
22324
|
-
const termsUrl =
|
|
22325
|
-
|
|
22326
|
-
|
|
22346
|
+
const termsUrl = partnerData
|
|
22347
|
+
? `https://${partnerData.domain}/terms-and-conditions`
|
|
22348
|
+
: "";
|
|
22349
|
+
const rawPrivacyUrl = translation.PrivacyStatementLink;
|
|
22350
|
+
const privacyUrl = rawPrivacyUrl && !/^https?:\/\//.test(rawPrivacyUrl) && partnerData
|
|
22351
|
+
? `https://${partnerData.domain}${rawPrivacyUrl}`
|
|
22352
|
+
: rawPrivacyUrl;
|
|
22327
22353
|
const onChangeTermCheckbox = (ev, checked) => {
|
|
22328
22354
|
if (checked) {
|
|
22329
22355
|
setTermAcceptance(true);
|
|
@@ -22379,11 +22405,11 @@ const LowerFormSection = ({ setValue, isRegistering, errors, translation, config
|
|
|
22379
22405
|
React.createElement("span", null, submissionError))),
|
|
22380
22406
|
React.createElement(SSASPrimaryButton, { text: translation.SubmitRequest, primaryColor: primaryColor, styles: {
|
|
22381
22407
|
root: { display: "block", width: "100%" },
|
|
22382
|
-
}, type: "submit", disabled:
|
|
22383
|
-
|
|
22384
|
-
termAcceptance
|
|
22385
|
-
privacyAcceptance
|
|
22386
|
-
captcha
|
|
22408
|
+
}, type: "submit", disabled: Object.keys(errors).length > 0 ||
|
|
22409
|
+
isRegistering ||
|
|
22410
|
+
!termAcceptance ||
|
|
22411
|
+
!privacyAcceptance ||
|
|
22412
|
+
!captcha, onRenderMenuIcon: renderLoadingIcon })));
|
|
22387
22413
|
};
|
|
22388
22414
|
|
|
22389
22415
|
const SettingKeys = {
|
|
@@ -22402,7 +22428,7 @@ const SSASRegistrationForm = ({ config, }) => {
|
|
|
22402
22428
|
const mergedConfig = useFormConfig(config);
|
|
22403
22429
|
// Stable service used only for partner lookup (works with relative URLs)
|
|
22404
22430
|
const initCheckUrl = mergedConfig.apiBaseUrl || "https://portal.selfserviceassessment.com";
|
|
22405
|
-
const partnerApiService = React.useMemo(() => new ApiService(initCheckUrl), []);
|
|
22431
|
+
const partnerApiService = React.useMemo(() => new ApiService(initCheckUrl), [initCheckUrl]);
|
|
22406
22432
|
// Main service uses the partner's own domain once loaded
|
|
22407
22433
|
const apiService = React.useMemo(() => new ApiService(partnerData?.domain ? new URL(`https://${partnerData?.domain}`).toString() : ""), [partnerData?.domain]);
|
|
22408
22434
|
const styles = React.useMemo(() => createFormStyles(mergedConfig.theme?.primaryColor || colorWidget?.column1, mergedConfig.theme?.fonts, mergedConfig.theme?.backgroundColor), [mergedConfig.theme?.primaryColor, mergedConfig.theme?.fonts, mergedConfig.theme?.backgroundColor, colorWidget?.column1]);
|
|
@@ -22461,7 +22487,7 @@ const SSASRegistrationForm = ({ config, }) => {
|
|
|
22461
22487
|
React.useEffect(() => {
|
|
22462
22488
|
setIsLoadingPartner(true);
|
|
22463
22489
|
partnerApiService
|
|
22464
|
-
.
|
|
22490
|
+
.getPartnerByGuid(mergedConfig.partnerGuid)
|
|
22465
22491
|
.then((partner) => {
|
|
22466
22492
|
partner ? setPartnerData(partner) : setPartnerLoadFailed(true);
|
|
22467
22493
|
})
|
|
@@ -22472,7 +22498,7 @@ const SSASRegistrationForm = ({ config, }) => {
|
|
|
22472
22498
|
.finally(() => {
|
|
22473
22499
|
setIsLoadingPartner(false);
|
|
22474
22500
|
});
|
|
22475
|
-
}, [mergedConfig.
|
|
22501
|
+
}, [mergedConfig.partnerGuid, partnerApiService]);
|
|
22476
22502
|
// Step 2: Load remaining data once partnerData is available
|
|
22477
22503
|
React.useEffect(() => {
|
|
22478
22504
|
if (!partnerData)
|