{"version":3,"sources":["webpack:///./ClientApp/services/Localizer.tsx","webpack:///./ClientApp/styles/node-modules/react-toggle/style.css?5a6e","webpack:///./ClientApp/styles/node-modules/react-toggle/style.css","webpack:///./ClientApp/shared/edit/fields/ReCaptchaDisclaimer.tsx","webpack:///./ClientApp/shared/hooks/useInViewOnce.ts","webpack:///./ClientApp/shared/assets/LazyImage.tsx","webpack:///./ClientApp/util/StringUtil.ts","webpack:///./ClientApp/services/ServerData.ts","webpack:///./ClientApp/shared/edit/fields/SimpleCheckbox.tsx","webpack:///./ClientApp/shared/components/Spinner.tsx","webpack:///./ClientApp/services/AxiosHelper.ts","webpack:///./ClientApp/shared/edit/fields/FieldInputErrorWrapper.tsx","webpack:///./ClientApp/features/hcl/Wysiwyg.tsx","webpack:///./ClientApp/shared/edit/fields/FieldLabel.tsx","webpack:///./ClientApp/shared/edit/fields/CheckBoxField.tsx","webpack:///./ClientApp/shared/edit/fields/DropdownField.tsx","webpack:///./ClientApp/shared/edit/fields/StarRatingField.tsx","webpack:///./ClientApp/shared/edit/fields/TextAreaField.tsx","webpack:///./ClientApp/shared/edit/fields/InputField.tsx","webpack:///./ClientApp/shared/edit/fields/TextBoxField.tsx","webpack:///./ClientApp/shared/edit/InlineAlert.tsx","webpack:///./ClientApp/shared/components/svg/XSVG.tsx","webpack:///./ClientApp/services/UserData.ts","webpack:///../Roc.SharedClientApp/types/model-status.ts","webpack:///./ClientApp/shared/util/ErrorBoundary.tsx","webpack:///./ClientApp/shared/util/AccountUrls.ts","webpack:///./ClientApp/shared/edit/OptionalFieldMarker.tsx","webpack:///./ClientApp/shared/polyfills/getAttributeNames.js","webpack:///./ClientApp/shared/util/ApplicationInit.tsx","webpack:///./ClientApp/shared/edit/fields/ValidationMessages.tsx","webpack:///./ClientApp/shared/hooks/useDelayedDisplay.tsx","webpack:///./ClientApp/shared/components/svg/CheckCircleSVG.tsx","webpack:///./ClientApp/shared/util/Misc.ts","webpack:///./ClientApp/shared/components/svg/StarEmptySVG.tsx","webpack:///./ClientApp/shared/components/hawksearch/components/svg/DashCircleSVG.tsx","webpack:///./ClientApp/shared/components/svg/PencilSVG.tsx","webpack:///./ClientApp/shared/components/svg/CircleExclamationSVG.tsx","webpack:///./ClientApp/features/setup/recaptcha.ts","webpack:///./ClientApp/shared/components/CircleButton.tsx","webpack:///./ClientApp/shared/edit/fields/CheckboxInputField.tsx","webpack:///./ClientApp/shared/components/svg/StarSVG.tsx","webpack:///./ClientApp/shared/components/star-rating/StarRating.tsx","webpack:///./ClientApp/shared/components/star-rating/useStarRating.ts","webpack:///./ClientApp/shared/edit/RocForm.tsx","webpack:///./ClientApp/features/hcl/product-catalogs/ProductCatalogs.tsx","webpack:///./ClientApp/features/hcl/product-catalogs/index.tsx","webpack:///./ClientApp/shared/hooks/useLoader.ts","webpack:///./ClientApp/shared/components/svg/FolderSVG.tsx","webpack:///./ClientApp/shared/components/svg/GarbageCanCircleSVG.tsx","webpack:///./ClientApp/shared/components/StatusDisplay.tsx","webpack:///./ClientApp/shared/hooks/useInterval.tsx","webpack:///./ClientApp/shared/hooks/useReCaptchaToken.tsx","webpack:///./ClientApp/shared/hooks/useRocReCaptchaToken.tsx","webpack:///./ClientApp/shared/hooks/useBaseAxiosFormSubmitter.ts","webpack:///./ClientApp/shared/hooks/useBaseAxiosSubmitter.ts"],"names":["LocalizerResources","isAlreadyLogged","initializeLocalizerResources","windowWithResources","window","__ROC_LOCALIZER_RESOURCES__","Array","isArray","forEach","obj","Object","keys","key","Localizer","replaceStrings","length","console","warn","resource","replace","match","index","LocalizedSpan","props","resourceKey","args","localizedString","data-testid","toKebabCase","dangerouslySetInnerHTML","__html","api","content","__esModule","default","module","i","options","exports","locals","___CSS_LOADER_API_IMPORT___","push","ReCaptchaDisclaimer","reCaptchaKey","ServerData","ReCaptchaV3Key","isReCaptchaEnabled","IsReCaptchaEnabled","className","useInViewOnce","makeIterator","inViewHookResponse","useInView","useState","viewed","setViewed","useEffect","inView","newResponse","Symbol","iterator","LazyImage","placeholderImg","src","alt","backgroundImg","delay","inactiveClassName","loadedClassName","rest","threshold","ref","loadedClassDisplayed","setLoadedClassDisplayed","setTimeout","imageSrc","classes","classnames","style","backgroundImage","value","trim","toLocaleLowerCase","toCamelCase","word","toLowerCase","toUpperCase","stripHtml","html","tmp","document","createElement","innerHTML","textContent","innerText","addEllipsis","text","cutoff","substring","trimString","windowWithServerData","__ROC_SERVER_DATA__","initializeServerData","SimpleCheckbox","id","checked","onChange","name","testId","light","label","wrapperClass","isRequired","htmlFor","type","required","defaultProps","Spinner","waitMs","align","block","parentCentered","useDelayedDisplay","spinner","AxiosHelper","axios","create","defaults","headers","common","interceptors","request","use","config","method","getCsrfToken","csrfToken","RequestVerificationToken","addUnauthorizedAccessInterceptor","history","response","error","status","location","AccountUrls","Login","encodeURIComponent","pathname","Promise","reject","FieldInputErrorWrapper","hideIcon","children","inline","meta","useField","invalid","submitError","dirtySinceLastSubmit","submitting","touched","Wysiwyg","setContent","isLoading","setIsLoading","getContent","requestToken","Axios","CancelToken","source","post","code","cancelToken","token","result","data","isCancel","FieldLabel","CheckBoxField","readOnly","disabled","afterSubmit","allowNull","beforeSubmit","formatOnBlur","initialValue","isEqual","subscription","defaultValue","input","CheckboxInputField","DropdownField","addSelectOption","validateFields","onFocus","onBlur","dirty","aria-describedby","map","option","ValidationMessages","StarRatingField","maxRating","OptionalFieldMarker","StarRating","readonly","TextAreaField","placeholder","rows","validate","component","format","parse","render","maxLength","InputField","React","forwardRef","step","TextBoxField","InlineAlert","title","theme","isTitleOnOwnRow","isCollapsed","onCollapse","message","axiosError","isAxiosError","onClick","XSVG","viewBox","focusable","aria-hidden","d","userDataPromise","getUserData","get","getUserDataNoCache","userData","ModelStatus","ErrorBoundary","lastRefreshedTimestamp","Date","parseInt","localStorage","getItem","getTime","setItem","toString","reload","this","setState","state","renderError","Component","renderProps","BaseUrl","ACCOUNT_URL_BASE","ACCOUNT_LOGIN_URL","Login2fa","ACCOUNT_LOGIN_WITH_2FA_URL","Register","ACCOUNT_REGISTER_URL","ForgotPassword","ACCOUNT_FORGOT_PASSWORD_URL","LoginWithRecoveryCode","ACCOUNT_LOGIN_WITH_RECOVERY_CODE_URL","Logout","ACCOUNT_LOGOUT_URL","OrganizationReview","ACCOUNT_ORGANIZATION_REVIEW_URL","OrganizationSelector","ACCOUNT_ORGANIZATION_SELECTOR_URL","ExternalLogout","memo","undefined","Element","prototype","getAttributeNames","attributes","getDataPropsFromAttributes","element","filter","s","startsWith","attributeName","getAttribute","initReactApp","getReactElement","elementId","getElementById","ReactDOM","Suspense","fallback","initReactAppByAttribute","attribute","elements","querySelectorAll","getErrorArray","errorOrSubmitError","errors","concat","role","Fragment","display","setDisplay","timeout","clearTimeout","CheckCircleSVG","ms","resolve","sleep","handleAxiosErrorWithValidation","errorMessage","validationErrorCallback","genericErrorCallback","globalErrors","errorsWithModifiedArrayIndex","reduce","acc","newValidationState","unflatten","FORM_ERROR","getQueryParam","paramName","decodeParam","urlParams","URLSearchParams","search","paramValue","decodeURIComponent","StarEmptySVG","DashCircleSVG","class","fill","PencilSVG","CircleExclamationSVG","reCaptchaCallbackPromise","setupReCaptcha","windowWithReCaptchaCallbacks","onReCaptchaLoadCallback","CircleButton","icon","otherProps","defaultChecked","StarSVG","params","ratingStars","setRatingStars","ratingHovered","setRatingHovered","newState","isFull","isPending","isHighlighted","isChecked","ratingValue","useStarRating","Error","onInputChange","e","currentTarget","modifierClasses","onMouseEnter","onMouseLeave","focusOnError","createDecorator","RocForm","onSubmit","debug","destroyOnUnregister","form","initialValues","initialValuesEqual","keepDirtyOnReinitialize","validateOnBlur","decorators","mutators","AddressType","AddressTypeOption","ProductCatalogs","isEmailList","setIsEmailList","catalogNames","fullName","email","phone","addressType","Business","facilityName","address1","address2","city","postalCode","catalogs","productCatalogsFormSubmitter","useAxiosFormSubmitter","url","states","setStates","allCatalogs","setAllCatalogs","err","productCatalogs","submitted","formValues","submitValues","handleSubmit","catalog","href","imageUrl","catalogName","find","indexOf","splice","updateCatalogNames","ariaLabel","useLoader","loading","setLoading","setError","setResponse","FolderSVG","GarbageCanCircleSVG","StatusDisplay","Published","Inactive","Deleted","Draft","Archived","useInterval","callback","enabled","savedCallback","useRef","intervalId","current","setInterval","clearInterval","ReCaptchaKeyWarning","useReCaptchaToken","action","initialEnabled","reCaptchaWindow","tokenPromise","tokenPromiseIsResolved","initPromise","setEnabled","useLayoutEffect","grecaptcha","ready","getToken","invalidateToken","force","execute","useRocReCaptchaToken","useRocFormSubmitter","axiosParams","reCaptchaActionName","csrfEnabled","stateful","invalidateTokenOnSuccess","useBaseAxiosFormSubmitter","responseCallback","submitterCallback","formValidationState","submitter","useBaseAxiosSubmitter","submit","submitResult","responseData","getRecaptchaToken","payload","promises","all","reCaptchaToken","serverResponse"],"mappings":"y/BA0JA,IAAMA,EAAwC,GAKxCC,EAA2C,GAKjD,SAASC,IACR,IAAMC,EAAsBC,OAG3BD,GACAA,EAAoBE,6BACpBC,MAAMC,QAAQJ,EAAoBE,8BAElCF,EAAoBE,4BAA4BG,SAAQ,SAACC,GACxD,cAAkBC,OAAOC,KAAKF,GAA9B,eAAoC,CAA/B,IAAMG,EAAG,KACbZ,EAAmBY,GAAOH,EAAIG,OAc3B,SAASC,EACfD,GAEC,2BADEE,EACF,iCADEA,EACF,kBAKD,GAJ+C,IAA3CJ,OAAOC,KAAKX,GAAoBe,QACnCb,KAGIF,IAAuBA,EAAmBY,GAQ9C,OALMX,EAAgBW,KACpBI,QAAQC,KAAKL,EAAK,2DAClBX,EAAgBW,IAAO,GAGlBA,EAGR,IAAMM,EAAWlB,EAAmBY,GAEpC,OAAKE,EAIEI,EAASC,QAAQ,YAAY,SAACC,EAAeC,GACnD,OAAOP,EAAeO,GAASP,EAAeO,GAAS,MAJhDH,EAqBF,SAASI,EAAcC,GAA2B,IAChDC,EAA2BD,EAA3BC,YADgD,EACrBD,EAAdE,YADmC,MAC5B,GAD4B,EAElDC,EAAkBb,EAAS,WAAT,GAAUW,GAAV,SAA0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ogs.8def53c9.js","sourcesContent":["import { AddressResourceKeys } from 'features/address-book/resources';\r\nimport { ContactFormResourceKeys } from 'features/contact-form/resources';\r\nimport { CreatePasswordResourceKeys } from 'features/create-password/resources';\r\nimport { LoginWith2faResourceKeys } from 'features/login-with-2fa/resources';\r\nimport { LoginWithRecoveryCodeResourceKeys } from 'features/login-with-recovery-code/resources';\r\nimport { LoginResourceKeys } from 'features/login/resources';\r\nimport { MyAccountResourceKeys } from 'features/my-account/resources';\r\nimport { ResetPasswordResourceKeys } from 'features/reset-password/resources';\r\nimport { SubmitQuestionResourceKeys } from 'features/submit-question/resources';\r\nimport * as React from 'react';\r\nimport { toKebabCase } from 'util/StringUtil';\r\n\r\n// #region Commerce\r\nimport { CommerceResourceKeys } from 'features/commerce/CommerceResourceKeys';\r\n// #endregion\r\n\r\n// #region HCL\r\nimport { QuickBagsResourceKeys } from 'features/hcl/quick-bags/resources';\r\nimport { QuickLabelsResourceKeys } from 'features/hcl/quick-labels/resources';\r\nimport { ProductCatalogsResourceKeys } from 'features/hcl/product-catalogs/resources';\r\nimport { FileUploadResourceKeys } from 'features/hcl/file-upload/resources';\r\nimport { NewsletterKeys } from 'features/hcl/newsletter-signup/resources';\r\n// #endregion\r\n\r\n/**\r\n * Type that will hold all the global localization keys\r\n */\r\ntype LocalizerGlobalResourceKeys =\r\n\t| 'Success'\r\n\t| 'OfTotalPages'\r\n\t| 'Cancel'\r\n\t| 'Confirm'\r\n\t| 'FirstName'\r\n\t| 'LastName'\r\n\t| 'Email'\r\n\t| 'Username'\r\n\t| 'Amount'\r\n\t| 'NameOnCard'\r\n\t| 'CardNumber'\r\n\t| 'ExpDate'\r\n\t| 'ExpMonth'\r\n\t| 'ExpYear'\r\n\t| 'Expires'\r\n\t| 'Expired'\r\n\t| 'SecurityCode'\r\n\t| 'Submit'\r\n\t| 'Save'\r\n\t| 'ZipCode'\r\n\t| 'Remove'\r\n\t| 'Removed'\r\n\t| 'Update'\r\n\t| 'Undo'\r\n\t| 'Cancel'\r\n\t| 'Enter'\r\n\t| 'Close'\r\n\t| 'SortBy'\r\n\t| 'PleaseWait'\r\n\t| 'Unknown'\r\n\t| 'Yes'\r\n\t| 'No'\r\n\t| 'Delete'\r\n\t| 'Update'\r\n\t| 'SaveAndContinueButtonText'\r\n\t| 'SaveAndContinue'\r\n\t| 'Continue'\r\n\t| 'SaveErrorMessage'\r\n\t| 'Edit'\r\n\t| 'ErrorMessageGenericTitle'\r\n\t| 'CheckEnteredValues'\r\n\t| 'ErrorMessageForbidden'\r\n\t| 'ErrorMessageNetwork'\r\n\t| 'ErrorOccurredSubmittingTheForm'\r\n\t| 'UnexpectedErrorOccurred'\r\n\t| 'Login'\r\n\t| 'ReturnToShipping'\r\n\t| 'BreadcrumbsLabel'\r\n\t| 'Other'\r\n\t| 'RememberMe'\r\n\t| 'ForgotYourPassword'\r\n\t| 'RegisterNewUserLinkText'\r\n\t| 'LoginPageTitleText'\r\n\t| 'ForgotPasswordPageTitle'\r\n\t| 'ForgotPasswordConfirmationPageTitle'\r\n\t| 'ForgotPasswordConfirmation'\r\n\t| 'Optional'\r\n\t| 'SearchBoxPlaceholder'\r\n\t| 'XOutOfYStars'\r\n\t| 'XToYOfZ'\r\n\t| 'ModalLabel'\r\n\t| 'RequiredFields'\r\n\t| 'Status'\r\n\t| 'Version'\r\n\t| 'CreatedOn'\r\n\t| 'CreatedBy'\r\n\t| 'ModifiedOn'\r\n\t| 'ModifiedBy'\r\n\t| 'OpenStatusInformation'\r\n\t| 'CloseStatusInformation'\r\n\t| 'SearchFilter'\r\n\t| 'Pagination'\r\n\t| 'Previous'\r\n\t| 'Next'\r\n\t| 'ClearFilter';\r\n\r\n/**\r\n * Type that will hold all the localization keys\r\n */\r\nexport type LocalizerResourceKey =\r\n\t| LocalizerGlobalResourceKeys\r\n\t| LoginResourceKeys\r\n\t| ContactFormResourceKeys\r\n\t// #region Commerce\r\n\t| CommerceResourceKeys\r\n\t// #endregion\r\n\t| ResetPasswordResourceKeys\r\n\t| CreatePasswordResourceKeys\r\n\t| SubmitQuestionResourceKeys\r\n\t| ResetPasswordResourceKeys\r\n\t| CreatePasswordResourceKeys\r\n\t| MyAccountResourceKeys\r\n\t| LoginWith2faResourceKeys\r\n\t| LoginWithRecoveryCodeResourceKeys\r\n\t| AddressResourceKeys\r\n\t// #region HCL\r\n\t| QuickBagsResourceKeys\r\n\t| QuickLabelsResourceKeys\r\n\t| ProductCatalogsResourceKeys\r\n\t| NewsletterKeys\r\n\t| FileUploadResourceKeys;\r\n// #endregion\r\n\r\n/**\r\n * Interface for the resources\r\n *\r\n * @export\r\n * @interface LocalizerResource\r\n */\r\ninterface LocalizerResource {\r\n\t[id: string]: string;\r\n}\r\n\r\n/**\r\n * Extends Window with a property that will hold the localizer resources\r\n *\r\n * @interface WindowWithResources\r\n * @extends {Window}\r\n */\r\nexport interface WindowWithResources extends Window {\r\n\t__ROC_LOCALIZER_RESOURCES__?: LocalizerResource[];\r\n}\r\n\r\n/**\r\n * Main object that will hold all the localized resources\r\n */\r\nconst LocalizerResources: LocalizerResource = {};\r\n\r\n/**\r\n * To prevent redundant logging\r\n */\r\nconst isAlreadyLogged: Record = {};\r\n\r\n/**\r\n * Initializer function that will populate the main localized resources object\r\n */\r\nfunction initializeLocalizerResources() {\r\n\tconst windowWithResources = window as WindowWithResources;\r\n\r\n\tif (\r\n\t\twindowWithResources &&\r\n\t\twindowWithResources.__ROC_LOCALIZER_RESOURCES__ &&\r\n\t\tArray.isArray(windowWithResources.__ROC_LOCALIZER_RESOURCES__)\r\n\t) {\r\n\t\twindowWithResources.__ROC_LOCALIZER_RESOURCES__.forEach((obj) => {\r\n\t\t\tfor (const key of Object.keys(obj)) {\r\n\t\t\t\tLocalizerResources[key] = obj[key];\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n}\r\n\r\n/**\r\n * Function that can be used to load the localized strings with support to parameter replacements\r\n *\r\n * @export\r\n * @param {string} key\r\n * @param {...string[]} replaceStrings\r\n * @returns\r\n */\r\nexport function Localizer(\r\n\tkey: TResourceKey,\r\n\t...replaceStrings: string[]\r\n) {\r\n\tif (Object.keys(LocalizerResources).length === 0) {\r\n\t\tinitializeLocalizerResources();\r\n\t}\r\n\r\n\tif (!LocalizerResources || !LocalizerResources[key]) {\r\n\t\t// if running in a test environment, just skip any warnings.\r\n\t\tif (process.env.NODE_ENV !== 'test') {\r\n\t\t\tif (!isAlreadyLogged[key]) {\r\n\t\t\t\tconsole.warn(key, 'Localizer Resource not found. Key will be used instead.');\r\n\t\t\t\tisAlreadyLogged[key] = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn key;\r\n\t}\r\n\r\n\tconst resource = LocalizerResources[key];\r\n\r\n\tif (!replaceStrings) {\r\n\t\treturn resource;\r\n\t}\r\n\r\n\treturn resource.replace(/{(\\d+)}/g, (match: string, index: number) => {\r\n\t\treturn replaceStrings[index] ? replaceStrings[index] : '';\r\n\t});\r\n}\r\n\r\n/**\r\n * Interface for the LocalizedSpan component\r\n *\r\n * @interface LocalizedSpanProps\r\n */\r\ninterface LocalizedSpanProps {\r\n\tresourceKey: LocalizerResourceKey;\r\n\targs?: string[];\r\n}\r\n\r\n/**\r\n * Component responsible for the initialization of the react app\r\n */\r\nexport function LocalizedSpan(props: LocalizedSpanProps) {\r\n\tconst { resourceKey, args = [] } = props;\r\n\tconst localizedString = Localizer(resourceKey, ...args);\r\n\r\n\treturn (\r\n\t\t\r\n\t);\r\n}\r\n","var api = require(\"!../../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\");\n var content = require(\"!!../../../../node_modules/css-loader/dist/cjs.js!./style.css\");\n\n content = content.__esModule ? content.default : content;\n\n if (typeof content === 'string') {\n content = [[module.id, content, '']];\n }\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nmodule.exports = content.locals || {};","// Imports\nvar ___CSS_LOADER_API_IMPORT___ = require(\"../../../../node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \".react-toggle {\\n touch-action: pan-x;\\n\\n display: inline-block;\\n position: relative;\\n cursor: pointer;\\n background-color: transparent;\\n border: 0;\\n padding: 0;\\n\\n -webkit-touch-callout: none;\\n -webkit-user-select: none;\\n -khtml-user-select: none;\\n -moz-user-select: none;\\n -ms-user-select: none;\\n user-select: none;\\n\\n -webkit-tap-highlight-color: rgba(0,0,0,0);\\n -webkit-tap-highlight-color: transparent;\\n}\\n\\n.react-toggle-screenreader-only {\\n border: 0;\\n clip: rect(0 0 0 0);\\n height: 1px;\\n margin: -1px;\\n overflow: hidden;\\n padding: 0;\\n position: absolute;\\n width: 1px;\\n}\\n\\n.react-toggle--disabled {\\n cursor: not-allowed;\\n opacity: 0.5;\\n -webkit-transition: opacity 0.25s;\\n transition: opacity 0.25s;\\n}\\n\\n.react-toggle-track {\\n width: 50px;\\n height: 24px;\\n padding: 0;\\n border-radius: 30px;\\n background-color: #4D4D4D;\\n -webkit-transition: all 0.2s ease;\\n -moz-transition: all 0.2s ease;\\n transition: all 0.2s ease;\\n}\\n\\n.react-toggle:hover:not(.react-toggle--disabled) .react-toggle-track {\\n background-color: #000000;\\n}\\n\\n.react-toggle--checked .react-toggle-track {\\n background-color: #19AB27;\\n}\\n\\n.react-toggle--checked:hover:not(.react-toggle--disabled) .react-toggle-track {\\n background-color: #128D15;\\n}\\n\\n.react-toggle-track-check {\\n position: absolute;\\n width: 14px;\\n height: 10px;\\n top: 0px;\\n bottom: 0px;\\n margin-top: auto;\\n margin-bottom: auto;\\n line-height: 0;\\n left: 8px;\\n opacity: 0;\\n -webkit-transition: opacity 0.25s ease;\\n -moz-transition: opacity 0.25s ease;\\n transition: opacity 0.25s ease;\\n}\\n\\n.react-toggle--checked .react-toggle-track-check {\\n opacity: 1;\\n -webkit-transition: opacity 0.25s ease;\\n -moz-transition: opacity 0.25s ease;\\n transition: opacity 0.25s ease;\\n}\\n\\n.react-toggle-track-x {\\n position: absolute;\\n width: 10px;\\n height: 10px;\\n top: 0px;\\n bottom: 0px;\\n margin-top: auto;\\n margin-bottom: auto;\\n line-height: 0;\\n right: 10px;\\n opacity: 1;\\n -webkit-transition: opacity 0.25s ease;\\n -moz-transition: opacity 0.25s ease;\\n transition: opacity 0.25s ease;\\n}\\n\\n.react-toggle--checked .react-toggle-track-x {\\n opacity: 0;\\n}\\n\\n.react-toggle-thumb {\\n transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1) 0ms;\\n position: absolute;\\n top: 1px;\\n left: 1px;\\n width: 22px;\\n height: 22px;\\n border: 1px solid #4D4D4D;\\n border-radius: 50%;\\n background-color: #FAFAFA;\\n\\n -webkit-box-sizing: border-box;\\n -moz-box-sizing: border-box;\\n box-sizing: border-box;\\n\\n -webkit-transition: all 0.25s ease;\\n -moz-transition: all 0.25s ease;\\n transition: all 0.25s ease;\\n}\\n\\n.react-toggle--checked .react-toggle-thumb {\\n left: 27px;\\n border-color: #19AB27;\\n}\\n\\n.react-toggle--focus .react-toggle-thumb {\\n -webkit-box-shadow: 0px 0px 3px 2px #0099E0;\\n -moz-box-shadow: 0px 0px 3px 2px #0099E0;\\n box-shadow: 0px 0px 2px 3px #0099E0;\\n}\\n\\n.react-toggle:active:not(.react-toggle--disabled) .react-toggle-thumb {\\n -webkit-box-shadow: 0px 0px 5px 5px #0099E0;\\n -moz-box-shadow: 0px 0px 5px 5px #0099E0;\\n box-shadow: 0px 0px 5px 5px #0099E0;\\n}\\n\", \"\"]);\n// Exports\nmodule.exports = exports;\n","import React from 'react';\r\nimport { LocalizedSpan } from 'services/Localizer';\r\nimport { ServerData } from 'services/ServerData';\r\n\r\n/**\r\n * Recaptcha usage disclaimer\r\n */\r\nexport default function ReCaptchaDisclaimer() {\r\n\tconst reCaptchaKey = ServerData.ReCaptchaV3Key;\r\n\tconst isReCaptchaEnabled = ServerData.IsReCaptchaEnabled;\r\n\treturn reCaptchaKey && isReCaptchaEnabled ? (\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t\r\n\t\t\t
\r\n\t\t
\r\n\t) : null;\r\n}\r\n","import { useInView, IntersectionOptions, InViewHookResponse } from 'react-intersection-observer';\r\nimport { useEffect, useState } from 'react';\r\n\r\n/**\r\n * Wrapper hook to useInView so that it only triggers once. Useful for lazy-loaded content that\r\n * doesn't need to change once it's out of view.\r\n */\r\nexport function useInViewOnce(options: IntersectionOptions = {}): InViewHookResponse {\r\n\tconst inViewHookResponse = useInView(options);\r\n\tconst [viewed, setViewed] = useState(false);\r\n\r\n\tuseEffect(() => {\r\n\t\tif (inViewHookResponse.inView) {\r\n\t\t\tsetViewed(true);\r\n\t\t}\r\n\t}, [inViewHookResponse.inView]);\r\n\r\n\tconst newResponse: InViewHookResponse = {\r\n\t\t...inViewHookResponse,\r\n\t\tinView: viewed,\r\n\t\t[0]: inViewHookResponse[0],\r\n\t\t[1]: viewed,\r\n\t\t[2]: inViewHookResponse[2],\r\n\t};\r\n\r\n\tfunction* makeIterator() {\r\n\t\tyield newResponse[0];\r\n\t\tyield newResponse[1];\r\n\t\tyield newResponse[2];\r\n\t}\r\n\r\n\tnewResponse[Symbol.iterator] = makeIterator;\r\n\r\n\treturn newResponse;\r\n}\r\n","import classnames from 'classnames';\r\nimport React, { ImgHTMLAttributes, useEffect, useState } from 'react';\r\nimport { useInViewOnce } from 'shared/hooks/useInViewOnce';\r\n\r\ninterface LazyImageProps extends ImgHTMLAttributes {\r\n\tplaceholderImg?: string;\r\n\tbackgroundImg?: boolean;\r\n\tclassName?: string;\r\n\tinactiveClassName?: string;\r\n\tloadedClassName?: string;\r\n\tdelay?: number;\r\n\talt: string;\r\n\tsrc: string;\r\n}\r\n\r\n/**\r\n * Component that will render an tag that will have its source image lazily loaded only once\r\n * the element is visible in the viewport.\r\n * @param props\r\n */\r\nexport default function LazyImage({\r\n\tplaceholderImg = '/images/placeholder/placeholder-image.png',\r\n\tsrc,\r\n\talt,\r\n\tbackgroundImg = false,\r\n\tdelay = 0,\r\n\tclassName,\r\n\tinactiveClassName = 'roc-lazy-image--inactive',\r\n\tloadedClassName = 'roc-lazy-image--loaded',\r\n\t...rest\r\n}: LazyImageProps) {\r\n\tconst [ref, viewed] = useInViewOnce({\r\n\t\tthreshold: 0,\r\n\t});\r\n\r\n\tconst [loadedClassDisplayed, setLoadedClassDisplayed] = useState(false);\r\n\r\n\tuseEffect(() => {\r\n\t\tif (viewed) {\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tsetLoadedClassDisplayed(true);\r\n\t\t\t}, delay);\r\n\t\t}\r\n\t}, [viewed, delay]);\r\n\r\n\tconst imageSrc = viewed ? src : placeholderImg;\r\n\r\n\tconst classes = classnames(className, {\r\n\t\t[inactiveClassName]: !viewed,\r\n\t\t[loadedClassName]: loadedClassDisplayed,\r\n\t});\r\n\r\n\tif (backgroundImg) {\r\n\t\treturn
;\r\n\t} else {\r\n\t\treturn {alt};\r\n\t}\r\n}\r\n","// These functions may be potentially innaccurate in certain locales that use differing amounts of characters in different cases\r\n\r\n/**\r\n * Tests if a string includes another if casing is ignored\r\n * @param thisString The string to test\r\n * @param otherString The potentially included string being tested for\r\n */\r\nexport function stringWeaklyIncludes(thisString: string, otherString: string) {\r\n\treturn thisString.toLocaleLowerCase().includes(otherString.toLocaleLowerCase());\r\n}\r\n\r\n/**\r\n * Tests if a string starts with another if casing is ignored\r\n * @param thisString The string to test\r\n * @param otherString The potentially included string being tested for\r\n */\r\nexport function stringWeaklyStartsWith(thisString: string, otherString: string) {\r\n\treturn thisString.toLocaleLowerCase().startsWith(otherString.toLocaleLowerCase());\r\n}\r\n\r\n/**\r\n * Tests if a string ends with another if casing is ignored\r\n * @param thisString The string to test\r\n * @param otherString The potentially included string being tested for\r\n */\r\nexport function stringWeaklyEndsWith(thisString: string, otherString: string) {\r\n\treturn thisString.toLocaleLowerCase().endsWith(otherString.toLocaleLowerCase());\r\n}\r\n\r\n/**\r\n * Converts the first character in a string to upper-case. Will not work for all languages (for example Dutch).\r\n *\r\n * @export\r\n * @param {string} thisString\r\n * @returns\r\n */\r\nexport function firstCharacterToUpper(thisString: string) {\r\n\tif (!thisString) {\r\n\t\treturn '';\r\n\t}\r\n\r\n\tlet newString = thisString.substring(0, 1).toLocaleUpperCase();\r\n\r\n\tif (thisString.length > 1) {\r\n\t\tnewString += thisString.substring(1);\r\n\t}\r\n\r\n\treturn newString;\r\n}\r\n\r\n/**\r\n * Converts the first character in a string to upper-case. Will not work for all languages (for example Dutch).\r\n *\r\n * @export\r\n * @param {string} thisString\r\n * @returns\r\n */\r\nexport function firstCharacterToLower(thisString: string) {\r\n\tif (!thisString) {\r\n\t\treturn '';\r\n\t}\r\n\r\n\tlet newString = thisString.substring(0, 1).toLocaleLowerCase();\r\n\r\n\tif (thisString.length > 1) {\r\n\t\tnewString += thisString.substring(1);\r\n\t}\r\n\r\n\treturn newString;\r\n}\r\n\r\n// https://github.com/uxitten/polyfill/blob/master/string.polyfill.js\r\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart\r\nexport function padStart(value, targetLength, padString) {\r\n\t// tslint:disable-next-line:no-bitwise\r\n\ttargetLength = targetLength >> 0; // truncate if number, or convert non-number to 0;\r\n\tpadString = String(typeof padString !== 'undefined' ? padString : ' ');\r\n\tif (value.length >= targetLength) {\r\n\t\treturn String(value);\r\n\t} else {\r\n\t\ttargetLength = targetLength - value.length;\r\n\t\tif (targetLength > padString.length) {\r\n\t\t\tpadString += padString.repeat(targetLength / padString.length); // append to original to ensure we are longer than needed\r\n\t\t}\r\n\t\treturn padString.slice(0, targetLength) + String(value);\r\n\t}\r\n}\r\n\r\n/**\r\n * Converts a string from \" Something Like This\" to \"something-like-this\"\r\n * @param value The string to convert\r\n */\r\nexport function toKebabCase(value: string) {\r\n\tif (!value || !value.trim()) {\r\n\t\treturn '';\r\n\t}\r\n\r\n\treturn value\r\n\t\t.trim()\r\n\t\t.replace(/[^a-zA-Z0-9]+/g, '-')\r\n\t\t.replace(/([a-z0-9])([A-Z])/g, '$1-$2')\r\n\t\t.replace(/([A-Z])([A-Z])(?=[a-z])/g, '$1-$2')\r\n\t\t.replace(/-$/, '')\r\n\t\t.toLocaleLowerCase();\r\n}\r\n\r\n/**\r\n * Converts a string from PascalCase, camelCase, snake_case, or space separated to camelCase. Beginning and trailing whitespace are trimmed.\r\n * @param value The string to convert\r\n */\r\nexport function toCamelCase(value: string) {\r\n\treturn value\r\n\t\t.replace(/(?:^\\w|[A-Z]|\\b\\w)/g, function (word, index) {\r\n\t\t\treturn index === 0 ? word.toLowerCase() : word.toUpperCase();\r\n\t\t})\r\n\t\t.replace(/(?:\\s+|[-_])/g, '');\r\n}\r\n\r\n/**\r\n * Removes html characters\r\n *\r\n * @export\r\n * @param {*} html\r\n * @returns\r\n */\r\nexport function stripHtml(html) {\r\n\tconst tmp = document.createElement('div');\r\n\ttmp.innerHTML = html;\r\n\treturn tmp.textContent || tmp.innerText || '';\r\n}\r\n\r\n/**\r\n * Cuts of text and adds ellipsis (...) after a certain number of characters\r\n * @param text The text to format\r\n * @param cutoff The number of characters to add the ellipsis after\r\n */\r\nexport function addEllipsis(text: string, cutoff: number = 20) {\r\n\tif (!text || text.length < cutoff) {\r\n\t\treturn text;\r\n\t}\r\n\r\n\treturn text.substring(0, cutoff) + '...';\r\n}\r\n\r\n/**\r\n * Trims a string value\r\n */\r\nexport function trimString(value: string) {\r\n\treturn value ? value.trim() : '';\r\n}\r\n","import { ExternalLoginProvider } from 'features/login/ExternalLogins';\r\n\r\n/**\r\n * Extends Window with a property that will hold the client data\r\n *\r\n * @interface WindowWithClientData\r\n * @extends {Window}\r\n */\r\ninterface WindowWithServerData extends Window {\r\n\t__ROC_SERVER_DATA__?: Array<{\r\n\t\t[name: string]: string;\r\n\t}>;\r\n}\r\n\r\n/**\r\n * This type will hold all the keys that are used by ServerData\r\n */\r\ninterface ServerData {\r\n\tIsReCaptchaEnabled?: boolean;\r\n\tReCaptchaV3Key?: string;\r\n\tTimeZone?: string;\r\n\tUSE_EMAIL_AS_USERNAME?: boolean;\r\n\tRegistrationThankYouTitle?: string;\r\n\tRegistrationThankYouMessage?: string;\r\n\tForgotPasswordConfirmationTitle?: string;\r\n\tForgotPasswordConfirmationMessage?: string;\r\n\tPageTitleSuffix?: string;\r\n\tRequireConfirmEmail?: boolean;\r\n\tACCOUNT_URL_BASE?: string;\r\n\tACCOUNT_LOGIN_URL?: string;\r\n\tACCOUNT_LOGOUT_URL?: string;\r\n\tACCOUNT_REGISTER_URL?: string;\r\n\tACCOUNT_LOGIN_WITH_2FA_URL?: string;\r\n\tACCOUNT_FORGOT_PASSWORD_URL?: string;\r\n\tACCOUNT_LOGIN_WITH_RECOVERY_CODE_URL?: string;\r\n\tEXTERNAL_LOGIN_PROVIDERS?: ExternalLoginProvider[];\r\n\t// #region Commerce\r\n\tACCOUNT_ORGANIZATION_REVIEW_URL?: string;\r\n\tACCOUNT_ORGANIZATION_SELECTOR_URL?: string;\r\n\tGoogleMapsApiKey?: string; // used in Store Locator\r\n\tMinimumTimeBeforeRecentlyViewedProductsAreValidated?: number;\r\n\tQuickOrderItemMinumumSearchCharacters?: number;\r\n\tMaxAllowedQuickOrderItems?: number;\r\n\tMaxNumberForQuantityDropdown?: number;\r\n\tOrderDetailsUIComponent?: string;\r\n\tGuestCheckoutEnabled?: boolean;\r\n\t// #endregion\r\n}\r\n\r\n/**\r\n * Main object that will hold all the client data\r\n */\r\nexport const ServerData: ServerData = {};\r\n\r\n/**\r\n * Initializer function that will populate the main settings object\r\n */\r\nfunction initializeServerData() {\r\n\tconst windowWithServerData = window as WindowWithServerData;\r\n\r\n\tif (\r\n\t\twindowWithServerData &&\r\n\t\twindowWithServerData.__ROC_SERVER_DATA__ &&\r\n\t\tArray.isArray(windowWithServerData.__ROC_SERVER_DATA__)\r\n\t) {\r\n\t\tfor (const obj of windowWithServerData.__ROC_SERVER_DATA__) {\r\n\t\t\tfor (const key of Object.keys(obj)) {\r\n\t\t\t\tServerData[key] = obj[key];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\ninitializeServerData();\r\n","import React from 'react';\r\nimport { WithTestIdOptional } from 'shared-client/types/test';\r\nimport { toKebabCase } from 'util/StringUtil';\r\nimport OptionalFieldMarker from '../OptionalFieldMarker';\r\n\r\ninterface SimpleCheckboxProps extends WithTestIdOptional {\r\n\tlabel: string;\r\n\tchecked: boolean;\r\n\tonChange: (e: React.ChangeEvent) => void;\r\n\tariaLabel?: string;\r\n\tid: string;\r\n\tname: string;\r\n\tlight?: boolean;\r\n\twrapperClass?: string;\r\n\t// #region HCL\r\n\tisRequired?: boolean;\r\n\t// //#endregion\r\n}\r\n\r\n/**\r\n * Component that renders an input with form field.\r\n */\r\nexport default function SimpleCheckbox({\r\n\tid,\r\n\tchecked,\r\n\tonChange,\r\n\tname,\r\n\ttestId,\r\n\tlight,\r\n\tlabel,\r\n\twrapperClass,\r\n\t// #region HCL\r\n\tisRequired = false,\r\n}: // #endRegion\r\nSimpleCheckboxProps) {\r\n\treturn (\r\n\t\t
\r\n\t\t\t\r\n\t\t
\r\n\t);\r\n}\r\n\r\nSimpleCheckbox.defaultProps = {\r\n\tlight: false,\r\n};\r\n","import React from 'react';\r\nimport useDelayedDisplay from 'shared/hooks/useDelayedDisplay';\r\nimport classnames from 'classnames';\r\n\r\ntype SpinnerAlignment = 'left' | 'right' | 'none';\r\n\r\ninterface SpinnerProps {\r\n\tlight?: boolean;\r\n\twaitMs?: number;\r\n\talign?: SpinnerAlignment;\r\n\tblock?: boolean;\r\n\tparentCentered?: boolean;\r\n}\r\n\r\n/**\r\n * Reusable roc-spinner component with color, alignment and wait time props.\r\n *\r\n * @export\r\n * @param {SpinnerProps} { light = false, waitMs = 200, align = 'right', block }\r\n * @returns\r\n */\r\nexport default function Spinner({\r\n\tlight = false,\r\n\twaitMs = 200,\r\n\talign = 'right',\r\n\tblock,\r\n\tparentCentered = false,\r\n}: SpinnerProps) {\r\n\tconst display = useDelayedDisplay(waitMs);\r\n\r\n\tif (!display) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tconst spinner = (\r\n\t\t\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t);\r\n\r\n\tif (parentCentered) {\r\n\t\treturn
{spinner}
;\r\n\t}\r\n\r\n\treturn spinner;\r\n}\r\n","import axios, { AxiosInstance, AxiosResponse, AxiosError } from 'axios';\r\nimport AccountUrls from 'shared/util/AccountUrls';\r\nimport { getCsrfToken } from './UserData';\r\n\r\n/**\r\n * Helper that creates an instance of Axios to be used throughout the client application\r\n * and adds a default X-Requested-With header to all requests.\r\n *\r\n */\r\nconst AxiosHelper: AxiosInstance = axios.create();\r\nAxiosHelper.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';\r\n\r\n// Add CSRF tokens to all commands that are not GET, HEAD, or OPTIONS\r\nAxiosHelper.interceptors.request.use(async (config) => {\r\n\tif (\r\n\t\tconfig.method?.toLowerCase() !== 'get' &&\r\n\t\tconfig.method?.toLowerCase() !== 'head' &&\r\n\t\tconfig.method?.toLowerCase() !== 'options'\r\n\t) {\r\n\t\tconst csrfToken = await getCsrfToken();\r\n\t\tconfig.headers = { RequestVerificationToken: csrfToken, ...config.headers };\r\n\t}\r\n\treturn config;\r\n});\r\n\r\nexport default AxiosHelper;\r\n\r\n// eslint-disable-next-line no-unused-vars\r\nexport const addUnauthorizedAccessInterceptor = (history) => {\r\n\t// this allows us to act when any request going through axios succeeds or fails.\r\n\tAxiosHelper.interceptors.response.use(\r\n\t\t(response: AxiosResponse) => {\r\n\t\t\treturn response;\r\n\t\t},\r\n\t\t(error: AxiosError) => {\r\n\t\t\tif (error.response && error.response.status === 401) {\r\n\t\t\t\twindow.location.replace(\r\n\t\t\t\t\t`${AccountUrls.Login}?ReturnUrl=${encodeURIComponent(window.location.pathname)}`,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\treturn Promise.reject(error);\r\n\t\t},\r\n\t);\r\n};\r\n","import React from 'react';\r\nimport classnames from 'classnames';\r\nimport CircleExclamationSVG from 'shared/components/svg/CircleExclamationSVG';\r\nimport { useField } from 'react-final-form';\r\n\r\ninterface FieldInputErrorWrapperProps {\r\n\thideIcon?: boolean;\r\n\tchildren: React.ReactNode;\r\n\tinline?: boolean;\r\n\tname: string;\r\n}\r\n\r\n/**\r\n * Component for handling the invalid styles for inputs.\r\n *\r\n * @export\r\n * @param {FieldInputErrorWrapperProps} props\r\n * @returns\r\n */\r\nexport default function FieldInputErrorWrapper(props: FieldInputErrorWrapperProps) {\r\n\tconst { hideIcon = false, children, inline = false, name } = props;\r\n\tconst { meta } = useField(name);\r\n\tconst invalid =\r\n\t\t(meta.error || (meta.submitError && !meta.dirtySinceLastSubmit && !meta.submitting)) &&\r\n\t\tmeta.touched &&\r\n\t\tmeta.invalid\r\n\t\t\t? meta.invalid\r\n\t\t\t: false;\r\n\r\n\treturn (\r\n\t\t\r\n\t\t\t{children}\r\n\t\t\t{invalid && !hideIcon ? : null}\r\n\t\t
\r\n\t);\r\n}\r\n","import Axios, { CancelTokenSource } from 'axios';\r\nimport React, { useEffect, useState } from 'react';\r\nimport AxiosHelper from 'services/AxiosHelper';\r\nimport Spinner from 'shared/components/Spinner';\r\n\r\ninterface WysiwygResponse {\r\n\tname: string | null;\r\n\tcode: string | null;\r\n\tcontent: string | null;\r\n}\r\n\r\ninterface WysiwygProps {\r\n\tcode: string | null;\r\n}\r\n\r\nexport default function Wysiwyg(props: WysiwygProps) {\r\n\tconst [content, setContent] = useState(null);\r\n\tconst [isLoading, setIsLoading] = useState(false);\r\n\r\n\tconst getContent = async () => {\r\n\t\tsetIsLoading(true);\r\n\t\tconst requestToken: CancelTokenSource = Axios.CancelToken.source();\r\n\r\n\t\ttry {\r\n\t\t\tconst result = await AxiosHelper.post('/ajax/wysiwyg', {\r\n\t\t\t\tcode: props.code,\r\n\t\t\t\tcancelToken: requestToken.token,\r\n\t\t\t});\r\n\r\n\t\t\tsetContent(result.data?.content);\r\n\t\t} catch (error) {\r\n\t\t\tif (Axios.isCancel(error)) {\r\n\t\t\t\t// if the component was unmounted, there's nothing to do\r\n\t\t\t\tsetIsLoading(false);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t\tsetIsLoading(false);\r\n\t\treturn;\r\n\t};\r\n\r\n\tuseEffect(() => {\r\n\t\tgetContent();\r\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\r\n\t}, []);\r\n\r\n\treturn (\r\n\t\t<>\r\n\t\t\t{isLoading ? : null}\r\n\t\t\t{content ?
: null}\r\n\t\t\r\n\t);\r\n}\r\n","/* eslint-disable jsx-a11y/label-has-for */\r\nimport React from 'react';\r\nimport { WithTestIdOptional } from 'shared-client/types/test';\r\nimport { toKebabCase } from 'util/StringUtil';\r\nimport OptionalFieldMarker from '../OptionalFieldMarker';\r\n\r\nexport interface FieldLabelProps extends WithTestIdOptional {\r\n\tlabel: string;\r\n\tname: string;\r\n\tid?: string;\r\n\tisRequired: boolean;\r\n\thtmlFor?: string;\r\n\tchildren?: React.ReactNode;\r\n}\r\n\r\n/**\r\n * Wrapper component for all field labels for ease of use.\r\n */\r\nexport default function FieldLabel(props: FieldLabelProps) {\r\n\tconst { label, id, isRequired, htmlFor, children, testId } = props;\r\n\r\n\tif (!label || !label.trim()) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\treturn (\r\n\t\t\r\n\t\t\t{label}\r\n\t\t\t{!isRequired ? : null}\r\n\t\t\t{children ? children : null}\r\n\t\t\r\n\t);\r\n}\r\n","import React from 'react';\r\nimport { Field, FieldProps, FieldRenderProps } from 'react-final-form';\r\nimport CheckboxInputField from './CheckboxInputField';\r\nimport { BaseInputProps } from './InputField';\r\n\r\nexport type InputFieldProps = FieldProps> & BaseInputProps;\r\n\r\n/**\r\n * Component that renders a checkbox field\r\n */\r\nexport default function CheckBoxField({\r\n\tname,\r\n\treadOnly = false,\r\n\tdisabled = false,\r\n\tlabel = '',\r\n\tafterSubmit,\r\n\tallowNull,\r\n\tbeforeSubmit,\r\n\tformatOnBlur,\r\n\tinitialValue,\r\n\tisEqual,\r\n\tsubscription,\r\n\tdefaultValue,\r\n}: InputFieldProps) {\r\n\treturn (\r\n\t\t\r\n\t\t\t{({ input, meta }) => (\r\n\t\t\t\t\r\n\t\t\t)}\r\n\t\t\r\n\t);\r\n}\r\n","import React from 'react';\r\nimport { Field, FieldProps, FieldRenderProps } from 'react-final-form';\r\nimport { DropdownOption } from 'shared-client/types/fields';\r\nimport { toKebabCase } from 'util/StringUtil';\r\nimport { FormFieldProps, ValidationMessages } from '.';\r\nimport FieldInputErrorWrapper from './FieldInputErrorWrapper';\r\nimport FieldLabel from './FieldLabel';\r\nexport type DropdownProps = FormFieldProps & {\r\n\taddSelectOption?: boolean;\r\n\toptions: DropdownOption[];\r\n\t// #region HCL\r\n\tdefaultValue?: any;\r\n\t// #endregion\r\n};\r\n\r\nexport type DropdownFieldProps = DropdownProps &\r\n\tFieldProps>;\r\n\r\n/**\r\n * Component that renders a Dropdown field component\r\n */\r\nexport default function DropdownField({\r\n\tname,\r\n\tisRequired = true,\r\n\treadOnly = false,\r\n\tdisabled = false,\r\n\taddSelectOption = true,\r\n\toptions,\r\n\tlabel = '',\r\n\tafterSubmit,\r\n\tallowNull,\r\n\tbeforeSubmit,\r\n\tformatOnBlur,\r\n\tisEqual,\r\n\tsubscription,\r\n\tvalidateFields,\r\n\ttestId,\r\n\t// #region HCL\r\n\tdefaultValue\r\n\t// #endregion\r\n}: DropdownFieldProps) {\r\n\treturn (\r\n\t\t\r\n\t\t\t{({ input: { value, onChange, onFocus, onBlur }, meta }) => (\r\n\t\t\t\t
\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t{addSelectOption ? \r\n\t\t\t\t\t\t\t))}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t
\r\n\t\t\t)}\r\n\t\t\r\n\t);\r\n}\r\n","import React from 'react';\r\nimport StarRating from '~/shared/components/star-rating/StarRating';\r\nimport { Field } from 'react-final-form';\r\nimport OptionalFieldMarker from '../OptionalFieldMarker';\r\nimport ValidationMessages from './ValidationMessages';\r\nimport { FormFieldProps } from '.';\r\nimport FieldInputErrorWrapper from './FieldInputErrorWrapper';\r\nimport { LocalizedSpan } from 'services/Localizer';\r\nimport { toKebabCase } from 'util/StringUtil';\r\n\r\nexport interface StarRatingFieldProps extends FormFieldProps {\r\n\t/**\r\n\t * The maximum number of stars to display (default is 5)\r\n\t */\r\n\tmaxRating?: number;\r\n}\r\n\r\n/**\r\n * Reusable RFF-compatible field that displays a star rating input\r\n * @param props\r\n */\r\nexport default function StarRatingField({\r\n\tname,\r\n\tlabel = '',\r\n\treadOnly = false,\r\n\tdisabled = false,\r\n\tmaxRating = 5,\r\n\tisRequired = true,\r\n\ttestId,\r\n}: StarRatingFieldProps) {\r\n\treturn (\r\n\t\t\r\n\t\t\t{({ input: { value, onChange }, meta }) => (\r\n\t\t\t\t\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t{label} {!isRequired ? : null}\r\n\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t
\r\n\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t${value}\r\n\t\t\t\t\t\t\t`,\r\n\t\t\t\t\t\t\t\t\t`${maxRating}\r\n\t\t\t\t\t\t\t`,\r\n\t\t\t\t\t\t\t\t]}\r\n\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t
\r\n\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t)}\r\n\t\t
\r\n\t);\r\n}\r\n","import * as React from 'react';\r\nimport { ValidationMessages, FormFieldProps } from '.';\r\nimport { FieldProps, Field, FieldRenderProps } from 'react-final-form';\r\nimport FieldLabel from './FieldLabel';\r\nimport FieldInputErrorWrapper from './FieldInputErrorWrapper';\r\nimport { toKebabCase } from 'util/StringUtil';\r\nimport classnames from 'classnames';\r\n\r\nexport type TextAreaFieldProps = FieldProps> &\r\n\tFormFieldProps & {\r\n\t\trows?: number;\r\n\t\tplaceholder?: string;\r\n\t\tmaxLength?: number;\r\n\t};\r\n\r\n/**\r\n * Component that renders a textarea input component.\r\n */\r\nexport default function TextAreaField({\r\n\tname,\r\n\tisRequired = true,\r\n\treadOnly = false,\r\n\tdisabled = false,\r\n\tplaceholder = '',\r\n\tlabel = '',\r\n\trows = 5,\r\n\tvalidate,\r\n\tafterSubmit,\r\n\tallowNull,\r\n\tbeforeSubmit,\r\n\tcomponent,\r\n\tdefaultValue,\r\n\tformat,\r\n\tformatOnBlur,\r\n\tinitialValue,\r\n\tisEqual,\r\n\tparse,\r\n\trender,\r\n\tsubscription,\r\n\tvalue,\r\n\ttestId,\r\n\tmaxLength,\r\n}: TextAreaFieldProps) {\r\n\treturn (\r\n\t\t\r\n\t\t\t{({ input, meta }) => (\r\n\t\t\t\t
\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t
\r\n\t\t\t)}\r\n\t\t\r\n\t);\r\n}\r\n","import React from 'react';\r\nimport { FieldRenderProps } from 'react-final-form';\r\nimport { toKebabCase } from 'util/StringUtil';\r\nimport { FormFieldProps, ValidationMessages } from '.';\r\nimport FieldInputErrorWrapper from './FieldInputErrorWrapper';\r\nimport FieldLabel from './FieldLabel';\r\n\r\nexport interface BaseInputProps extends FormFieldProps {\r\n\ttype?: string;\r\n\tstep?: string;\r\n}\r\n\r\nexport type InputFieldProps = FieldRenderProps &\r\n\tBaseInputProps & {\r\n\t\tplaceholder?: string;\r\n\t};\r\n\r\nexport type HTMLInputRef = React.MutableRefObject;\r\n/**\r\n * Component that renders an input with form field.\r\n */\r\nconst InputField = React.forwardRef((props: InputFieldProps, ref: HTMLInputRef) => {\r\n\tconst {\r\n\t\tinput: { name, onChange, value },\r\n\t\tmeta,\r\n\t\ttype,\r\n\t\tlabel = '',\r\n\t\tisRequired = true,\r\n\t\tdisabled = false,\r\n\t\treadOnly = false,\r\n\t\tplaceholder = '',\r\n\t\tstep,\r\n\t\ttestId,\r\n\t\t// #region HCL\r\n\t\tmaxLength,\r\n\t\t// #endregion\r\n\t} = props;\r\n\r\n\treturn (\r\n\t\t
\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t
\r\n\t);\r\n});\r\n\r\nexport default InputField;\r\n","import React from 'react';\r\nimport { Field, FieldProps, FieldRenderProps } from 'react-final-form';\r\nimport InputField, { BaseInputProps, HTMLInputRef } from './InputField';\r\n\r\nexport type InputFieldProps = FieldProps> & BaseInputProps;\r\n\r\n/**\r\n * Component that renders a text box component, of the specified type\r\n */\r\nconst TextBoxField = React.forwardRef((props: InputFieldProps, ref: HTMLInputRef) => {\r\n\tconst {\r\n\t\tname,\r\n\t\ttype = 'text',\r\n\t\tisRequired = true,\r\n\t\treadOnly = false,\r\n\t\tdisabled = false,\r\n\t\tplaceholder = '',\r\n\t\tlabel = '',\r\n\t\tvalidate,\r\n\t\tafterSubmit,\r\n\t\tallowNull,\r\n\t\tbeforeSubmit,\r\n\t\tcomponent,\r\n\t\tdefaultValue,\r\n\t\tformat,\r\n\t\tformatOnBlur,\r\n\t\tinitialValue,\r\n\t\tisEqual,\r\n\t\tparse,\r\n\t\trender,\r\n\t\tsubscription,\r\n\t\tvalue,\r\n\t\ttestId,\r\n\t\t// #region HCL\r\n\t\tmaxLength,\r\n\t\t// # endregion\r\n\t} = props;\r\n\r\n\treturn (\r\n\t\t\r\n\t\t\t{({ input, meta }) => (\r\n\t\t\t\t\r\n\t\t\t)}\r\n\t\t\r\n\t);\r\n});\r\n\r\nexport default TextBoxField;\r\n","import React from 'react';\r\nimport classnames from 'classnames';\r\nimport { Localizer } from 'services/Localizer';\r\nimport { AxiosError } from 'axios';\r\nimport XSVG from 'shared/components/svg/XSVG';\r\n\r\ntype Theme = 'danger' | 'warning' | 'info' | 'success';\r\n\r\nexport interface ErrorAlertProps {\r\n\t/**\r\n\t * The title of the error message such as \"Uh Oh!\" or \"An Unexpected Error has Occurred!\"\r\n\t */\r\n\ttitle: string;\r\n\r\n\t/**\r\n\t * The error message to display if an error object doesn't have a more appropriate message.\r\n\t */\r\n\tmessage: React.ReactNode | string;\r\n\r\n\tchildren?: any;\r\n\r\n\ttheme?: Theme;\r\n\r\n\tisTitleOnOwnRow?: boolean;\r\n\r\n\t/** The error responsible for this message. */\r\n\terror: AxiosError | Error | null;\r\n\r\n\t/**\r\n\t * Method from parent that handles collapse state.\r\n\t */\r\n\tonCollapse?: (collased: boolean) => void;\r\n\r\n\t/**\r\n\t * Controlled collapse state from parent.\r\n\t */\r\n\tisCollapsed?: boolean;\r\n}\r\n\r\n/**\r\n * Reusable Error Alert Component.\r\n */\r\nexport default function InlineAlert(props: ErrorAlertProps) {\r\n\tconst {\r\n\t\ttitle = InlineAlert.defaultProps.title,\r\n\t\tchildren,\r\n\t\ttheme = 'danger',\r\n\t\tisTitleOnOwnRow = false,\r\n\t\terror = InlineAlert.defaultProps.error,\r\n\t\tisCollapsed = false,\r\n\t\tonCollapse,\r\n\t} = props;\r\n\r\n\tlet { message = InlineAlert.defaultProps.message } = props;\r\n\r\n\tconst axiosError = error as AxiosError | null;\r\n\tif (axiosError?.isAxiosError && axiosError != null && axiosError.response == null && axiosError.request != null) {\r\n\t\tmessage = Localizer('ErrorMessageNetwork');\r\n\t}\r\n\r\n\tif (axiosError?.isAxiosError && (axiosError?.response?.status === 401 || axiosError?.response?.status === 403)) {\r\n\t\tmessage = Localizer('ErrorMessageForbidden');\r\n\t}\r\n\r\n\tif (axiosError?.response?.data?.message) {\r\n\t\tmessage = axiosError.response.data.message;\r\n\t}\r\n\r\n\tif (isCollapsed) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\treturn (\r\n\t\t\r\n\t\t\t{onCollapse ? (\r\n\t\t\t\t\r\n\t\t\t) : null}\r\n\r\n\t\t\t{title ? (\r\n\t\t\t\t\r\n\t\t\t\t\t{title}\r\n\t\t\t\t\r\n\t\t\t) : null}\r\n\r\n\t\t\t{message ? {message} : null}\r\n\r\n\t\t\t{children ? <> {children} : null}\r\n\t\t
\r\n\t);\r\n}\r\n\r\n/**\r\n * Error Alert Default Props\r\n */\r\nInlineAlert.defaultProps = {\r\n\ttitle: Localizer('ErrorMessageGenericTitle'),\r\n\tmessage: Localizer('UnexpectedErrorOccurred'),\r\n\terror: null,\r\n};\r\n","import React from 'react';\r\nimport { SVGProps } from './SVGProps';\r\nimport classnames from 'classnames';\r\n\r\n/**\r\n * X SVG\r\n *\r\n * @returns\r\n */\r\nfunction XSVG({ className, ...rest }: SVGProps) {\r\n\treturn (\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t);\r\n}\r\n\r\nexport default XSVG;\r\n","import AxiosHelper from 'services/AxiosHelper';\r\nimport { AxiosResponse } from 'axios';\r\n\r\nexport interface UserSummary {\r\n\tisSignedIn: boolean;\r\n\tuserName: string | null;\r\n\tfirstName: string | null;\r\n\tlastName: string | null;\r\n\temail: string | null;\r\n\tphoneNumber: string | null;\r\n\ttwoFactorEnabled: boolean;\r\n\thasRecoveryCodes: boolean;\r\n\tisMachineRemembered: boolean;\r\n\tannouncements: UserAnnouncement[];\r\n\tisExternalLoginUser: boolean;\r\n\t// #region HCL\r\n\tversaPayEnabled: boolean;\r\n\tversaPayRedirectUrl: string | null;\r\n\tazureUserId: string | null;\r\n\t// #endregion\r\n}\r\n\r\n/** Represents the details about an admin impersonation session of the logged in user. */\r\nexport interface Impersonation {\r\n\t/** The id of the admin impersonating the front end user. */\r\n\timpersonatorId: string;\r\n\r\n\t/** The name of the admin impersonating the front end user. */\r\n\timpersonatorName: string;\r\n\r\n\t/** The id of the active user impersonation session. */\r\n\tsessionId: string;\r\n}\r\n\r\nexport interface UserData {\r\n\t/**\r\n\t * Summary of user-specific details\r\n\t */\r\n\tsummary?: UserSummary;\r\n\r\n\t/**\r\n\t * CSRF validation token generated by the server\r\n\t */\r\n\trequestToken?: string;\r\n\r\n\t/**\r\n\t * The information on an impersonation session if one is active.\r\n\t * If an impersonation session isn't active this field will be undefined.\r\n\t */\r\n\timpersonation?: Impersonation;\r\n}\r\n\r\nexport interface UserAnnouncement {\r\n\t/** The id used as the primary key for the announcement in the database */\r\n\tid: string;\r\n\r\n\t/** An announcement to be displayed to the user */\r\n\tmessage: string;\r\n\r\n\t/** A list of pages where the announcement will be displayed. This will be an empty array if it is to be displayed on all pages. */\r\n\tpages: string[];\r\n}\r\n\r\nlet userDataPromise: Promise> | null = null;\r\n\r\n/**\r\n * Returns details related to the current user. By default, this is primarily their first/last name\r\n * and whether they are logged in or not. This can customized to include more details if necessary.\r\n */\r\nexport const getUserData = () => {\r\n\tif (userDataPromise === null) {\r\n\t\tuserDataPromise = AxiosHelper.get('/ajax/user');\r\n\t}\r\n\r\n\treturn userDataPromise;\r\n};\r\n\r\n/**\r\n * Returns non-cached details related to the current user. By default, this is primarily their first/last name\r\n * and whether they are logged in or not. This can customized to include more details if necessary.\r\n */\r\nexport const getUserDataNoCache = () => {\r\n\treturn AxiosHelper.get('/ajax/user');\r\n};\r\n\r\n/**\r\n * Returns a promise that will contain the CSRF token generated on the server to be used to validate\r\n * forms being posted via AJAX.\r\n */\r\nexport async function getCsrfToken() {\r\n\ttry {\r\n\t\tconst userData = await getUserData();\r\n\t\treturn userData.data.requestToken;\r\n\t} catch (error) {\r\n\t\tconsole.warn('Unable to load CSRF token.');\r\n\t\treturn '';\r\n\t}\r\n}\r\n\r\n// #region Commerce\r\nimport { CartSummary } from './UserData.Commerce';\r\nimport { LocationDto } from 'features/commerce/store-locator/types';\r\nimport { OrganizationInvite, OrganizationShipTo } from 'shared-client/types/commerce/organization';\r\nimport { AutoSuggestOption } from '../../../Roc.SharedClientApp/types/fields';\r\n\r\n// Commerce extensions to the UserData interface\r\nexport interface UserData {\r\n\t// #region HCL - allows null\r\n\tcartSummary?: CartSummary | null;\r\n\t// #endregion\r\n\r\n\t/***\r\n\t * The customer's default store location or null if not set\r\n\t */\r\n\tdefaultStoreLocation?: LocationDto | null;\r\n\r\n\t/**\r\n\t * If store is enabled for this site\r\n\t */\r\n\tenableStoreLocation?: boolean;\r\n}\r\n\r\n/***\r\n * Organization data and permissions\r\n */\r\nexport interface Organization {\r\n\tid: string;\r\n\tpurchaseOrderNumberRequired: boolean;\r\n\tcreditCardAllowed: boolean;\r\n\tgiftCardAllowed: boolean;\r\n\torganizationName: string;\r\n\tcorpAccountAllowed: boolean;\r\n}\r\n\r\n/***\r\n * Organization dto data\r\n */\r\nexport interface OrganizationDto extends AutoSuggestOption {}\r\n\r\n/***\r\n * User's organization and permissions data\r\n */\r\nexport interface UserSummary {\r\n\t/***\r\n\t * User's current default organization\r\n\t */\r\n\torganization: Organization | null;\r\n\r\n\t/***\r\n\t * The list of organizations the user is part of\r\n\t */\r\n\tuserOrganizations?: OrganizationDto[] | null;\r\n\r\n\t/***\r\n\t * The selected organization ship to\r\n\t */\r\n\tselectedShipTo: OrganizationShipTo | null;\r\n\r\n\t/***\r\n\t * Defines if the user has multiple shiptos to select from\r\n\t */\r\n\thasMultipleShipTos: boolean | null;\r\n\r\n\t/***\r\n\t * Defines if the user has saved payment methods\r\n\t */\r\n\thasSavedPaymentMethods: boolean | null;\r\n\r\n\t/***\r\n\t * The list of user permissions\r\n\t */\r\n\tpermissions?: UserPermissions;\r\n\r\n\t/***\r\n\t * The list of organizations the user is invited to join\r\n\t */\r\n\torganizationInvites?: OrganizationInvite[];\r\n\r\n\t/***\r\n\t * The user organization removal notification\r\n\t * Used to notify the user if he is no more part of his default organization\r\n\t */\r\n\tuserOrganizationRemovalNotification?: string;\r\n}\r\n\r\n/***\r\n * User's permissions\r\n */\r\nexport interface UserPermissions {\r\n\t/***\r\n\t * Defines if the current user can see organization users\r\n\t */\r\n\tcanSeeOrganizationUsers?: boolean;\r\n\r\n\t/***\r\n\t * Defines if the current user can assign roles to organization users\r\n\t */\r\n\tcanAssignRolesToOrganizationUsers?: boolean;\r\n\r\n\t/***\r\n\t * Defines if the current user can remove users from an organization\r\n\t */\r\n\tremoveUserFromOrganization?: boolean;\r\n\r\n\t/***\r\n\t * Defines if the current user can create organization users\r\n\t */\r\n\tcreateOrganizationUser?: boolean;\r\n\r\n\t/***\r\n\t * Defines if the current user can enable/disable ShipTos for organization users\r\n\t */\r\n\tmanageShipTosAssociation?: boolean;\r\n\r\n\t/***\r\n\t * Defines if the current user can see status of the organization users\r\n\t */\r\n\tcanSeePendingOrganizationUsers?: boolean;\r\n}\r\n// #endregion\r\n","export enum ModelStatus {\r\n\tPublished = 'Published',\r\n\tInactive = 'Inactive',\r\n\tDeleted = 'Deleted',\r\n\tDraft = 'Draft',\r\n\tArchived = 'Archived',\r\n}\r\n","import React from 'react';\r\nimport InlineAlert from 'shared/edit/InlineAlert';\r\n\r\n// eslint-disable-next-line\r\n// tslint:disable-next-line\r\nexport interface ErrorBoundaryRenderProps extends ErrorBoundaryState {}\r\n\r\nexport interface ErrorBoundaryProps {\r\n\tchildren: React.ReactNode;\r\n\trenderError?: (renderProps: ErrorBoundaryRenderProps) => React.ReactNode;\r\n}\r\n\r\nexport interface ErrorBoundaryState {\r\n\terror?: Error;\r\n}\r\n\r\n/**\r\n * Default Error Boundary component for frontend components, so that in case a JS error occurs, we show\r\n * something instead of nothing.\r\n */\r\nexport default class ErrorBoundary extends React.Component {\r\n\tpublic static defaultProps = {\r\n\t\trenderError: (renderProps: ErrorBoundaryRenderProps) => ,\r\n\t};\r\n\r\n\tpublic state: ErrorBoundaryState = {};\r\n\r\n\tpublic componentDidCatch(error: Error) {\r\n\t\tif (error.name === 'ChunkLoadError') {\r\n\t\t\tconst lastRefreshedTimestamp = new Date(\r\n\t\t\t\tparseInt(window.localStorage.getItem('force-refresh-timestamp') || '0'),\r\n\t\t\t);\r\n\t\t\tconst pageAlreadyRefreshedLessThan30SecondsAgo =\r\n\t\t\t\tnew Date(lastRefreshedTimestamp.getTime() + 30 * 1000) > new Date();\r\n\r\n\t\t\tif (!pageAlreadyRefreshedLessThan30SecondsAgo) {\r\n\t\t\t\t// Assuming that the user is not on the latest version of the application. Refresh the page immediately.\r\n\t\t\t\twindow.localStorage.setItem('force-refresh-timestamp', new Date().getTime().toString());\r\n\t\t\t\treturn window.location.reload();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis.setState({\r\n\t\t\terror,\r\n\t\t});\r\n\t}\r\n\r\n\tpublic render() {\r\n\t\tif (this.state.error) {\r\n\t\t\treturn this.props.renderError!(this.state);\r\n\t\t}\r\n\r\n\t\treturn this.props.children;\r\n\t}\r\n}\r\n","import { ServerData } from 'services/ServerData';\r\n\r\nexport default {\r\n\tBaseUrl: ServerData.ACCOUNT_URL_BASE ?? '/my-account',\r\n\tLogin: ServerData.ACCOUNT_LOGIN_URL ?? '/my-account/login',\r\n\tLogin2fa: ServerData.ACCOUNT_LOGIN_WITH_2FA_URL ?? '/my-account/login-with-2fa',\r\n\tRegister: ServerData.ACCOUNT_REGISTER_URL ?? '/my-account/register',\r\n\tForgotPassword: ServerData.ACCOUNT_FORGOT_PASSWORD_URL ?? '/my-account/forgot-password',\r\n\tLoginWithRecoveryCode: ServerData.ACCOUNT_LOGIN_WITH_RECOVERY_CODE_URL ?? '/my-account/login-with-recovery-code',\r\n\tLogout: ServerData.ACCOUNT_LOGOUT_URL ?? '/my-account/logout',\r\n\t// #region Commerce\r\n\tOrganizationReview: ServerData.ACCOUNT_ORGANIZATION_REVIEW_URL ?? '/my-account/organization-review',\r\n\tOrganizationSelector: ServerData.ACCOUNT_ORGANIZATION_SELECTOR_URL ?? '/my-account/organization-selector',\r\n\t// #endregion\r\n\t// #region HCL - hardcoded same way as external login is\r\n\tExternalLogout: '/my-account/external-logout',\r\n\t// #endregion\r\n};\r\n","import React from 'react';\r\nimport { Localizer } from 'services/Localizer';\r\n\r\n/**\r\n * Reusable component for the optional field marker\r\n */\r\nfunction OptionalFieldMarker() {\r\n\treturn ({Localizer('Optional')});\r\n}\r\n\r\nexport default React.memo(OptionalFieldMarker);\r\n","// source: https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNames\r\n/* eslint-disable no-var */\r\n(function () {\r\n\tif (Element.prototype.getAttributeNames == undefined) {\r\n\t\tElement.prototype.getAttributeNames = function () {\r\n\t\t\tvar attributes = this.attributes;\r\n\t\t\tvar length = attributes.length;\r\n\t\t\tvar result = new Array(length);\r\n\t\t\tfor (var i = 0; i < length; i++) {\r\n\t\t\t\tresult[i] = attributes[i].name;\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t};\r\n\t}\r\n})();\r\n","import React from 'react';\r\nimport ReactDOM from 'react-dom';\r\nimport ErrorBoundary from './ErrorBoundary';\r\nimport { toCamelCase } from 'util/StringUtil';\r\nimport 'shared/polyfills/getAttributeNames';\r\nimport Spinner from 'shared/components/Spinner';\r\n\r\ninterface AttributeProps {\r\n\t[index: string]: string;\r\n}\r\n\r\nfunction getDataPropsFromAttributes(element: Element): AttributeProps {\r\n\tconst props: AttributeProps = {};\r\n\r\n\tconst dataAttributePrefix = 'data-';\r\n\r\n\tconst attributeNames = element.getAttributeNames().filter((s) => s.startsWith(dataAttributePrefix));\r\n\tfor (const attributeName of attributeNames) {\r\n\t\tconst strippedName = toCamelCase(attributeName.substring(dataAttributePrefix.length));\r\n\t\tprops[strippedName] = element.getAttribute(attributeName) ?? '';\r\n\t}\r\n\r\n\treturn props;\r\n}\r\n\r\n/**\r\n * A helper function to facilitate initializing react applications on top of server-side rendered elements.\r\n * @param getReactElement Function that returns the react component to render.\r\n * @param elementId The ID of the DOM element being targeted.\r\n */\r\nexport const initReactApp = (getReactElement: (props: unknown) => React.ReactElement, elementId: string) => {\r\n\tif (typeof getReactElement !== 'function' || !elementId) {\r\n\t\treturn () => {\r\n\t\t\tconsole.warn('A react element generator function and element ID are required.');\r\n\t\t};\r\n\t}\r\n\r\n\tconst element = document.getElementById(elementId);\r\n\r\n\tif (!element) {\r\n\t\treturn () => {\r\n\t\t\tconsole.warn(\r\n\t\t\t\t`Element with ID '${elementId}' was not found. Did you forget to render it on the server or is this entry point not supposed to run?`,\r\n\t\t\t);\r\n\t\t};\r\n\t}\r\n\r\n\treturn () => {\r\n\t\tconst props = getDataPropsFromAttributes(element);\r\n\t\tconsole.debug(`Rendering application inside element with ID ${elementId}.`);\r\n\t\tReactDOM.render(\r\n\t\t\t}>\r\n\t\t\t\t{getReactElement(props)}\r\n\t\t\t,\r\n\t\t\telement,\r\n\t\t);\r\n\t};\r\n};\r\n\r\nexport const initReactAppByAttribute = (\r\n\tgetReactElement: (props: unknown, domElement: Element) => React.ReactElement,\r\n\tattribute: string,\r\n) => {\r\n\tif (typeof getReactElement !== 'function' || !attribute) {\r\n\t\treturn () => {\r\n\t\t\tconsole.warn('A react element generator function and element ID are required.');\r\n\t\t};\r\n\t}\r\n\r\n\tconst elements = document.querySelectorAll(`[${attribute}]`);\r\n\r\n\tif (!elements || elements.length == 0) {\r\n\t\treturn () => {\r\n\t\t\tconsole.warn(\r\n\t\t\t\t`No elements with data attribute '${attribute}' were found. Did you forget to render it on the server or is this entry point not supposed to run?`,\r\n\t\t\t);\r\n\t\t};\r\n\t}\r\n\r\n\treturn () => {\r\n\t\tfor (let i = 0; i < elements.length; ++i) {\r\n\t\t\tconst element = elements[i];\r\n\t\t\tconst props = getDataPropsFromAttributes(element);\r\n\t\t\tconsole.debug(`Rendering application inside element with attribute ${attribute}.`);\r\n\t\t\tReactDOM.render(\r\n\t\t\t\t}>\r\n\t\t\t\t\t{getReactElement(props, element)}\r\n\t\t\t\t,\r\n\t\t\t\telement,\r\n\t\t\t);\r\n\t\t}\r\n\t};\r\n};\r\n","import React from 'react';\r\nimport { FieldRenderProps } from 'react-final-form';\r\n\r\ntype ValidationMessagesProps = Pick, 'meta'> & {\r\n\tid: string;\r\n};\r\n\r\nfunction getErrorArray(errorOrSubmitError) {\r\n\tlet errors: string[] = [];\r\n\tif (typeof errorOrSubmitError === 'string') {\r\n\t\terrors.push(errorOrSubmitError);\r\n\t} else if (Array.isArray(errorOrSubmitError)) {\r\n\t\terrors = errorOrSubmitError.filter((error) => !Array.isArray(error) && typeof error === 'string');\r\n\t}\r\n\r\n\treturn errors;\r\n}\r\n\r\n/**\r\n * Displays validation errors for fields\r\n *\r\n * @class ValidationMessages\r\n * @extends {React.Component}\r\n */\r\nfunction ValidationMessages(props: ValidationMessagesProps) {\r\n\tconst { meta } = props;\r\n\r\n\tif (!meta) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tlet errors: string[] = [];\r\n\r\n\t/* \r\n\t almost all validation comes from the server, so we only need to check `submitError` despite there being `error`\r\n\t there are 3 kinds of values for submitError, string, string[] and [string|[]|object]\r\n\t the third type happens when you're using FieldArray, so we're going to filter those out and only\r\n\t take the strings if submitError is an array. this is due to a bug (possibly feature?) of final form\r\n\t where the submit errors for field array fields bubble up into the parent field.\r\n\t */\r\n\tif (meta.submitError) {\r\n\t\terrors = errors.concat(getErrorArray(meta.submitError));\r\n\r\n\t\t// for server-side validation, we need to stop showing these after any changes are made.\r\n\t\tif (meta.dirtySinceLastSubmit || meta.submitting) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\t} else if (meta.error) {\r\n\t\t// sometimes we validate on the client, so we need to support these as well.\r\n\t\terrors = errors.concat(getErrorArray(meta.error));\r\n\t}\r\n\r\n\treturn (\r\n\t\t\r\n\t\t\t{(meta.submitError || meta.error) &&\r\n\t\t\t\tmeta.touched &&\r\n\t\t\t\terrors.length > 0 &&\r\n\t\t\t\terrors.map((error, index) => (\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t{error}\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t))}\r\n\t\t
\r\n\t);\r\n}\r\n\r\nexport default ValidationMessages;\r\n","import { useState, useEffect } from 'react';\r\n\r\n/**\r\n * Reusable hook that returns true after a certain amount of time has passed. Useful to delay\r\n * displaying components in render functions.\r\n *\r\n * @export\r\n * @param {number} [waitMs=200]\r\n * @returns\r\n */\r\nexport default function useDelayedDisplay(waitMs: number = 200) {\r\n\tconst [display, setDisplay] = useState(false);\r\n\r\n\tuseEffect(() => {\r\n\t\t// after a set amount of time, show the spinner\r\n\t\tconst timeout = setTimeout(() => {\r\n\t\t\tsetDisplay(true);\r\n\t\t}, waitMs);\r\n\r\n\t\treturn () => {\r\n\t\t\tclearTimeout(timeout);\r\n\t\t};\r\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\r\n\t}, []);\r\n\r\n\treturn display;\r\n}\r\n","import React from 'react';\r\nimport { SVGProps } from './SVGProps';\r\nimport classnames from 'classnames';\r\n\r\n/**\r\n * Check circle SVG\r\n *\r\n * @returns\r\n */\r\nfunction CheckCircleSVG({ className, ...rest }: SVGProps) {\r\n\treturn (\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t);\r\n}\r\n\r\nexport default CheckCircleSVG;\r\n","import { AxiosError } from 'axios';\r\nimport { FORM_ERROR } from 'final-form';\r\nimport { unflatten } from 'flat';\r\n\r\nexport const getFormattedPageTitle = (subTitle: string = ''): string => {\r\n\t// load from config?\r\n\tconst siteName = 'ROC';\r\n\r\n\tif (!subTitle || !subTitle.trim()) {\r\n\t\treturn siteName;\r\n\t}\r\n\r\n\treturn `${subTitle.trim()} - ${siteName}`;\r\n};\r\n\r\n/**\r\n * Promise version of setTimeout.\r\n * @param ms The number of milliseconds to wait for.\r\n */\r\nexport const timeout = (ms) => {\r\n\treturn new Promise((resolve) => setTimeout(resolve, ms));\r\n};\r\n\r\n/**\r\n * Allows you to await on a timeout, useful for avoiding setTimeout callbacks and for troubleshooting.\r\n * @param ms The number of milliseconds to wait for.\r\n */\r\nexport const sleep = async (ms: number = 0) => {\r\n\tawait timeout(ms);\r\n};\r\n\r\n/**\r\n * Handles Axios error for React Final Form. If the error is a validation error, the error is transformed into React\r\n * Final Form field validation object. If the error is a generic error, the error is rethrown instead.\r\n *\r\n * @param error - The Axios Error object to handle errors for.\r\n * @param errorMessage - The form error message to provide back to React Final Form.\r\n * @param validationErrorCallback - Optional callback that is triggered right before the validation object is returned\r\n * to Final Form, so that you can run logic that should occur during validation errors.\r\n * @param genericErrorCallback - Optional callback that is triggered right before the generic error is rethrown, so that\r\n * you can run logic that should occur during generic errors.\r\n */\r\nexport const handleAxiosErrorWithValidation = (\r\n\terror: AxiosError,\r\n\terrorMessage: string | null = 'An error occurred while saving.',\r\n\tvalidationErrorCallback?: () => void,\r\n\tgenericErrorCallback?: () => void,\r\n): { [index: string]: string } => {\r\n\tif (error?.response?.status === 400 && error.response.data) {\r\n\t\tlet globalErrors;\r\n\r\n\t\tconst errors = error.response.data;\r\n\r\n\t\tconst errorsWithModifiedArrayIndex = Object.keys(errors).reduce((acc, value) => {\r\n\t\t\tif (value === '') {\r\n\t\t\t\t// in case we are getting back a non field specific error store it in the global errors\r\n\t\t\t\tglobalErrors = errors[value];\r\n\t\t\t} else {\r\n\t\t\t\tconst newKey = value.replace(/\\[([0-9]+)\\]/g, '.$1');\r\n\t\t\t\tacc[newKey] = errors[value];\r\n\t\t\t}\r\n\r\n\t\t\treturn acc;\r\n\t\t}, {});\r\n\r\n\t\tconst newValidationState = { ...unflatten(errorsWithModifiedArrayIndex) };\r\n\r\n\t\tconsole.debug('newValidationState:', newValidationState);\r\n\r\n\t\tif (validationErrorCallback) {\r\n\t\t\tvalidationErrorCallback();\r\n\t\t}\r\n\r\n\t\treturn { ...newValidationState, [FORM_ERROR]: globalErrors ? globalErrors : errorMessage };\r\n\t} else {\r\n\t\t// generic error.\r\n\t\tif (genericErrorCallback) {\r\n\t\t\tgenericErrorCallback();\r\n\t\t}\r\n\r\n\t\tif (error?.response?.data?.message) {\r\n\t\t\treturn { [FORM_ERROR]: error.response.data.message };\r\n\t\t}\r\n\r\n\t\tif (errorMessage) {\r\n\t\t\treturn { [FORM_ERROR]: errorMessage };\r\n\t\t} else {\r\n\t\t\treturn {};\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * Get an html class or ID safe string from provided string.\r\n *\r\n * @function getHtmlSafeName\r\n */\r\nexport const getHtmlSafeName = (name: string = ''): string => {\r\n\treturn name.replace(/[^a-z0-9]/g, (s) => {\r\n\t\tconst c = s.charCodeAt(0);\r\n\t\tif (c === 32) {\r\n\t\t\treturn '-';\r\n\t\t}\r\n\t\tif (c >= 65 && c <= 90) {\r\n\t\t\treturn '_' + s.toLowerCase();\r\n\t\t}\r\n\t\treturn '__' + ('000' + c.toString(16)).slice(-4);\r\n\t});\r\n};\r\n\r\n/**\r\n * Gets the specified param value from the querystring\r\n *\r\n * @param paramName the name of the query string parameter\r\n * @param decodeParam specifies if the param value should be decoded before returning it\r\n */\r\nexport const getQueryParam = (paramName: string = '', decodeParam: boolean = false): string | null => {\r\n\tconst urlParams = new URLSearchParams(window.location.search);\r\n\tconst paramValue = urlParams.get(paramName);\r\n\r\n\tif (!paramValue) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tif (decodeParam) {\r\n\t\treturn decodeURIComponent(paramValue);\r\n\t} else {\r\n\t\treturn paramValue;\r\n\t}\r\n};\r\n","import React from 'react';\r\nimport { SVGProps } from './SVGProps';\r\nimport classnames from 'classnames';\r\n\r\n/**\r\n * Star Empty SVG\r\n *\r\n * @returns\r\n */\r\nfunction StarEmptySVG({ className, ...rest }: SVGProps) {\r\n\treturn (\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t);\r\n}\r\n\r\nexport default StarEmptySVG;\r\n","import * as React from 'react';\r\n\r\ninterface DashCircleSVGProps {\r\n\tclass?: string;\r\n}\r\n\r\n/**\r\n * Dash circle SVG\r\n *\r\n * @returns\r\n */\r\nfunction DashCircleSVG(props: DashCircleSVGProps) {\r\n\treturn (\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t);\r\n}\r\n\r\nexport default DashCircleSVG;\r\n","import React from 'react';\r\nimport { SVGProps } from './SVGProps';\r\nimport classnames from 'classnames';\r\n\r\n/**\r\n * Pencil SVG\r\n *\r\n * @returns\r\n */\r\nfunction PencilSVG({ className, ...rest }: SVGProps) {\r\n\treturn (\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t);\r\n}\r\n\r\nexport default PencilSVG;\r\n","import React from 'react';\r\nimport { SVGProps } from './SVGProps';\r\nimport classnames from 'classnames';\r\n\r\n/**\r\n * Circle Exclaimation SVG component\r\n *\r\n * @returns\r\n */\r\nfunction CircleExclamationSVG({ className, ...rest }: SVGProps) {\r\n\treturn (\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t);\r\n}\r\n\r\nexport default CircleExclamationSVG;\r\n","/**\r\n * Extends Window with recaptcha callback fields\r\n */\r\ninterface WindowWithReCaptchaCallbacks extends Window {\r\n\t/**\r\n\t * Executes the methods in the rocReCaptchaCallbacks array\r\n\t */\r\n\tonReCaptchaLoadCallback: () => void;\r\n\t/**\r\n\t * List of recaptcha callbacks\r\n\t */\r\n\trocReCaptchaCallbacks: Array<() => void>;\r\n}\r\n\r\nexport let reCaptchaCallbackPromise: Promise | null = null;\r\n\r\n/**\r\n * Setup function for recaptcha.\r\n * The window.onReCaptchaLoadCallback() gets called when the recaptcha script is loaded.\r\n * Then this method calls the recaptcha instances init functions, stored in window.rocReCaptchaCallbacks\r\n *\r\n * @export\r\n */\r\nexport default function setupReCaptcha() {\r\n\tconst windowWithReCaptchaCallbacks = (window as unknown) as WindowWithReCaptchaCallbacks;\r\n\r\n\treCaptchaCallbackPromise = new Promise((resolve) => {\r\n\t\twindowWithReCaptchaCallbacks.onReCaptchaLoadCallback = resolve;\r\n\t});\r\n}\r\n","import React from 'react';\r\nimport XSVG from './svg/XSVG';\r\nimport { Localizer } from 'services/Localizer';\r\nimport { WithTestIdOptional } from '../../../../Roc.SharedClientApp/types/test';\r\n\r\ninterface CircleButtonProps extends WithTestIdOptional {\r\n\ticon?: React.ReactNode;\r\n}\r\n\r\nfunction CircleButton(props: React.HTMLProps & CircleButtonProps) {\r\n\tconst { icon, testId, ...otherProps } = props;\r\n\r\n\treturn (\r\n\t\t\r\n\t);\r\n}\r\n\r\nexport default CircleButton;\r\n","import React from 'react';\r\nimport { FieldRenderProps } from 'react-final-form';\r\nimport { ValidationMessages } from '.';\r\nimport FieldInputErrorWrapper from './FieldInputErrorWrapper';\r\nimport { BaseInputProps } from './InputField';\r\nimport { toKebabCase } from 'util/StringUtil';\r\n\r\nexport type InputFieldProps = FieldRenderProps &\r\n\tBaseInputProps & {\r\n\t\tplaceholder?: string;\r\n\t};\r\n\r\n/**\r\n * Component that renders a checkbox input with form field.\r\n */\r\nexport default function CheckboxInputField({\r\n\tinput: { name, onChange, value },\r\n\tmeta,\r\n\ttype,\r\n\tlabel = '',\r\n\tdisabled = false,\r\n\treadOnly = false,\r\n\tplaceholder = '',\r\n\tstep,\r\n\ttestId,\r\n\tdefaultValue = false,\r\n}: InputFieldProps) {\r\n\treturn (\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t
\r\n\t\t\t\r\n\t\t
\r\n\t);\r\n}\r\n","import React from 'react';\r\nimport { SVGProps } from './SVGProps';\r\nimport classnames from 'classnames';\r\n\r\n/**\r\n * Star SVG\r\n *\r\n * @returns\r\n */\r\nfunction StarSVG({ className, ...rest }: SVGProps) {\r\n\treturn (\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t);\r\n}\r\n\r\nexport default StarSVG;\r\n","/* eslint-disable jsx-a11y/label-has-for */\r\n/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\r\nimport classnames from 'classnames';\r\nimport React from 'react';\r\nimport { WithTestId } from 'shared-client/types/test';\r\nimport StarEmptySVG from 'shared/components/svg/StarEmptySVG';\r\nimport StarSVG from 'shared/components/svg/StarSVG';\r\nimport useStarRating from './useStarRating';\r\n\r\n/**\r\n * Product Rating Props\r\n */\r\ninterface RatingProps extends WithTestId {\r\n\tvalue: number | null;\r\n\tname: string;\r\n\treadonly?: boolean;\r\n\tonChange?: (rating: number) => void;\r\n\tmaxRating?: number;\r\n}\r\n\r\n/**\r\n * If readonly, displays the rating with blank and filled stars (1-maxRating)\r\n * If not readonly, displays the rating picker with blank and filled stars (1-maxRating)\r\n * @param props\r\n */\r\nexport default function StarRating(props: RatingProps) {\r\n\tconst { value, name, readonly = false, onChange, maxRating = 5, testId } = props;\r\n\r\n\tconst { ratingStars, setRatingHovered } = useStarRating({\r\n\t\tvalue,\r\n\t\tname,\r\n\t\tmaxRating,\r\n\t});\r\n\r\n\tif (!readonly && !onChange) {\r\n\t\tthrow new Error('Rating component is set to non-readonly, yet onChange is not defined.');\r\n\t}\r\n\r\n\t/**\r\n\t * Handle changes to the radio button that backs the star rating selection\r\n\t *\r\n\t * @param {*} e\r\n\t */\r\n\tconst onInputChange = (e) => {\r\n\t\tif (onChange) {\r\n\t\t\tonChange(parseInt(e.currentTarget.value));\r\n\t\t}\r\n\t};\r\n\r\n\tif (readonly) {\r\n\t\treturn (\r\n\t\t\t<>\r\n\t\t\t\t{ratingStars.map(({ id, isFull }) => (\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t{isFull ? (\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t) : (\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t)}\r\n\t\t\t\t\t\r\n\t\t\t\t))}\r\n\t\t\t\r\n\t\t);\r\n\t}\r\n\r\n\treturn (\r\n\t\t<>\r\n\t\t\t{ratingStars.map(({ id, isFull, isChecked, isPending, isHighlighted, ratingValue }) => {\r\n\t\t\t\tconst modifierClasses = classnames({\r\n\t\t\t\t\t'roc-rating__input--full': isFull,\r\n\t\t\t\t\t'roc-rating__input--pending': isPending,\r\n\t\t\t\t\t'roc-rating__label--highlighted': isHighlighted,\r\n\t\t\t\t});\r\n\r\n\t\t\t\treturn (\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t setRatingHovered(ratingValue)}\r\n\t\t\t\t\t\t\tonMouseLeave={() => setRatingHovered(null)}\r\n\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t{isFull ? (\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t) : (\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t)}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t);\r\n\t\t\t})}\r\n\t\t\r\n\t);\r\n}\r\n","import { useEffect, useState } from 'react';\r\n\r\n/**\r\n * The state of all of the stars being displayed, these change together frequently\r\n * so lets store them together. This is also slightly better than calculating\r\n * on every single render. Makes it easier to reuse as well.\r\n */\r\ninterface RatingStarState {\r\n\tid: string;\r\n\tisFull: boolean;\r\n\tisPending: boolean;\r\n\tisHighlighted: boolean;\r\n\tisChecked: boolean;\r\n\tratingValue: number;\r\n}\r\n\r\n/**\r\n * The params for the useStarRating hook.\r\n */\r\ninterface UseStarRatingParams {\r\n\tvalue: number | null;\r\n\tname: string;\r\n\tmaxRating?: number;\r\n}\r\n\r\n/**\r\n * The values returned by the custom star rating hook\r\n */\r\ninterface UseStarRatingResult {\r\n\tratingStars: RatingStarState[];\r\n\tsetRatingHovered: (value: number | null) => void;\r\n}\r\n\r\n/**\r\n * Custom hook that manages state for simple star rating implementations\r\n * @param params\r\n */\r\nexport default function useStarRating(params: UseStarRatingParams): UseStarRatingResult {\r\n\tconst { value, name, maxRating = 5 } = params;\r\n\tconst [ratingStars, setRatingStars] = useState([]);\r\n\tconst [ratingHovered, setRatingHovered] = useState(null);\r\n\r\n\tuseEffect(() => {\r\n\t\tconst newState: RatingStarState[] = [];\r\n\r\n\t\tfor (let i = 1; i <= maxRating; i++) {\r\n\t\t\tconst id = 'rating-group-' + name + '-' + i;\r\n\t\t\tconst isFull = value !== null && value >= i;\r\n\t\t\tconst isPending = ratingHovered ? i > ratingHovered && isFull : false;\r\n\t\t\tconst isHighlighted = ratingHovered ? i <= ratingHovered : false;\r\n\t\t\tconst isChecked = value === i;\r\n\r\n\t\t\tnewState.push({\r\n\t\t\t\tid,\r\n\t\t\t\tisFull,\r\n\t\t\t\tisPending,\r\n\t\t\t\tisHighlighted,\r\n\t\t\t\tisChecked,\r\n\t\t\t\tratingValue: i,\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tsetRatingStars(newState);\r\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\r\n\t}, [value, ratingHovered]);\r\n\r\n\treturn { ratingStars, setRatingHovered };\r\n}\r\n","import React from 'react';\r\nimport { FormProps, Form } from 'react-final-form';\r\nimport createDecorator from 'final-form-focus';\r\nimport { AnyObject } from 'final-form';\r\n\r\ntype RocFormProps = FormProps;\r\n\r\nconst focusOnError = createDecorator();\r\n\r\n/**\r\n * Wrapper component for react-final-form so that we can add useful defaults across the board.\r\n * @param props props\r\n */\r\nexport default function RocForm({\r\n\tonSubmit,\r\n\trender,\r\n\tdebug,\r\n\tdestroyOnUnregister,\r\n\tform,\r\n\tcomponent,\r\n\tinitialValues,\r\n\tinitialValuesEqual,\r\n\tkeepDirtyOnReinitialize,\r\n\tvalidate,\r\n\tvalidateOnBlur,\r\n\tdecorators = [focusOnError],\r\n\tmutators,\r\n\tsubscription,\r\n}: RocFormProps) {\r\n\treturn (\r\n\t\t\r\n\t\t\tonSubmit={onSubmit}\r\n\t\t\tdecorators={decorators}\r\n\t\t\trender={render}\r\n\t\t\tdebug={debug}\r\n\t\t\tdestroyOnUnregister={destroyOnUnregister}\r\n\t\t\tform={form}\r\n\t\t\tcomponent={component}\r\n\t\t\tinitialValues={initialValues}\r\n\t\t\tinitialValuesEqual={initialValuesEqual}\r\n\t\t\tkeepDirtyOnReinitialize={keepDirtyOnReinitialize}\r\n\t\t\tmutators={mutators}\r\n\t\t\tsubscription={subscription}\r\n\t\t\tvalidate={validate}\r\n\t\t\tvalidateOnBlur={validateOnBlur}\r\n\t\t/>\r\n\t);\r\n}\r\n","import React, { useEffect, useState } from 'react';\r\nimport { Localizer } from 'services/Localizer';\r\nimport Spinner from 'shared/components/Spinner';\r\nimport InlineAlert from 'shared/edit/InlineAlert';\r\nimport { DropdownField, TextBoxField, ValidationMessages } from 'shared/edit/fields';\r\nimport ReCaptchaDisclaimer from 'shared/edit/fields/ReCaptchaDisclaimer';\r\nimport { useAxiosFormSubmitter } from 'shared/hooks/useBaseAxiosFormSubmitter';\r\nimport RocForm from 'shared/edit/RocForm';\r\nimport SimpleCheckbox from 'shared/edit/fields/SimpleCheckbox';\r\nimport Axios, { AxiosError } from 'axios';\r\nimport AxiosHelper from 'services/AxiosHelper';\r\nimport { error } from 'util';\r\nimport LazyImage from 'shared/assets/LazyImage';\r\nimport { DropdownOption } from '../../../../../Roc.SharedClientApp/types/fields';\r\nimport { Field } from 'react-final-form';\r\nimport { State } from '../../../../../Roc.SharedClientApp/types/address';\r\nimport Wysiwyg from 'features/hcl/Wysiwyg';\r\n\r\ninterface ProductCatalogsValues {\r\n\tfullName: string;\r\n\temail: string;\r\n\tphone: string;\r\n\taddressType: AddressType;\r\n\tfacilityName: string;\r\n\taddress1: string;\r\n\taddress2: string;\r\n\tcity: string;\r\n\tstate: string;\r\n\tpostalCode: string;\r\n\tisEmailList: boolean;\r\n\tcatalogs: string[];\r\n}\r\n\r\nexport interface UseStatesResults {\r\n\tstates: State[] | null;\r\n}\r\n\r\nexport interface UseCatalogsResults {\r\n\tproductCatalogs: ProductCatalog[] | null;\r\n}\r\n\r\nexport interface ProductCatalog {\r\n\tname: string;\r\n\ttext: string;\r\n\turl: string;\r\n\timageUrl: string;\r\n}\r\n\r\nexport enum AddressType {\r\n\tBusiness = 'Business',\r\n\tResidential = 'Residential',\r\n}\r\n\r\nexport const AddressTypeOption = Object.keys(AddressType).map(\r\n\t(key) => ({ value: key, text: AddressType[key] } as DropdownOption),\r\n);\r\n\r\n/**\r\n * Product Catalogs component\r\n */\r\nfunction ProductCatalogs() {\r\n\tconst [isEmailList, setIsEmailList] = useState(false);\r\n\tconst [catalogNames] = useState([]);\r\n\tconst [initialValues] = useState({\r\n\t\tfullName: '',\r\n\t\temail: '',\r\n\t\tphone: '',\r\n\t\taddressType: AddressType.Business,\r\n\t\tfacilityName: '',\r\n\t\taddress1: '',\r\n\t\taddress2: '',\r\n\t\tcity: '',\r\n\t\tstate: '',\r\n\t\tpostalCode: '',\r\n\t\tisEmailList: false,\r\n\t\tcatalogs: [],\r\n\t});\r\n\r\n\tconst productCatalogsFormSubmitter = useAxiosFormSubmitter(\r\n\t\t{\r\n\t\t\turl: '/ajax/product-catalogs',\r\n\t\t},\r\n\t\t'ProductCatalogs',\r\n\t);\r\n\r\n\tconst [states, setStates] = useState(null);\r\n\tconst [allCatalogs, setAllCatalogs] = useState(null);\r\n\r\n\tuseEffect(() => {\r\n\t\ttry {\r\n\t\t\tif (!states) {\r\n\t\t\t\t(async () => {\r\n\t\t\t\t\tconst response = await AxiosHelper.get('/ajax/product-catalogs/states');\r\n\t\t\t\t\tsetStates(response.data.states);\r\n\t\t\t\t})();\r\n\t\t\t}\r\n\t\t} catch (err) {\r\n\t\t\tif (Axios.isCancel(err)) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tconst axiosError = err as AxiosError;\r\n\t\t\terror(`An error occurred while loading states: ${axiosError.message}`);\r\n\t\t}\r\n\r\n\t\ttry {\r\n\t\t\tif (!allCatalogs) {\r\n\t\t\t\t(async () => {\r\n\t\t\t\t\tconst response = await AxiosHelper.get('/ajax/product-catalogs/catalogs');\r\n\t\t\t\t\tsetAllCatalogs(response.data.productCatalogs);\r\n\t\t\t\t})();\r\n\t\t\t}\r\n\t\t} catch (err) {\r\n\t\t\tif (Axios.isCancel(err)) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tconst axiosError = err as AxiosError;\r\n\t\t\terror(`An error occurred while loading catalogs: ${axiosError.message}`);\r\n\t\t}\r\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\r\n\t}, []);\r\n\r\n\tfunction updateCatalogNames(catalogName: string) {\r\n\t\tconst match = catalogNames.find((e) => e === catalogName);\r\n\r\n\t\tif (match) {\r\n\t\t\tconst index = catalogNames.indexOf(catalogName, 0);\r\n\r\n\t\t\tcatalogNames.splice(index, 1);\r\n\t\t} else {\r\n\t\t\tcatalogNames.push(catalogName);\r\n\t\t}\r\n\t}\r\n\r\n\treturn (\r\n\t\t
\r\n\t\t\t{!productCatalogsFormSubmitter.submitted ? (\r\n\t\t\t\t\r\n\t\t\t\t\tonSubmit={(formValues) => {\r\n\t\t\t\t\t\tconst submitValues = { ...formValues };\r\n\r\n\t\t\t\t\t\tsubmitValues.isEmailList = isEmailList;\r\n\t\t\t\t\t\tsubmitValues.catalogs = catalogNames;\r\n\t\t\t\t\t\treturn productCatalogsFormSubmitter.handleSubmit(submitValues);\r\n\t\t\t\t\t}}\r\n\t\t\t\t\tinitialValues={initialValues}\r\n\t\t\t\t\trender={({ handleSubmit, submitError, submitting }) => {\r\n\t\t\t\t\t\treturn (\r\n\t\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\t

\r\n\t\t\t\t\t\t\t\t\t{Localizer('ProductCatalogsTitle')}\r\n\t\t\t\t\t\t\t\t

\r\n\r\n\t\t\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t{({ input, meta }) => (\r\n\t\t\t\t\t\t\t\t\t\t\t\t<>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t{allCatalogs ? (\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t
    \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{allCatalogs.map((catalog, index) => (\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t
  • \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t
    \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r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\n\t\t\t\t\t\t\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t{states ? (\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t) : (\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t)}\r\n\t\t\t\t\t\t\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\t\t\t\t
\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsEmailList(e.currentTarget.checked);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tid=\"isEmailList\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tariaLabel={Localizer('IsEmailListSignup')}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tname=\"isEmailList\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tisRequired={false}\r\n\t\t\t\t\t\t\t\t\t\t\t\t/>\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t{submitError ? (\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t) : null}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t{Localizer('Submit')} {submitting ? : null}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t
\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}}\r\n\t\t\t\t/>\r\n\t\t\t) : (\r\n\t\t\t\t\r\n\t\t\t)}\r\n\t\t
\r\n\t);\r\n}\r\n\r\nexport default ProductCatalogs;\r\n","import React from 'react';\r\nimport ProductCatalogs from './ProductCatalogs';\r\nimport { initReactApp } from 'shared/util/ApplicationInit';\r\n\r\nconst render = initReactApp(() => , 'product-catalogs');\r\n\r\nrender();\r\n\r\n// optional, use this to enable hot reloading\r\nif ((module as any).hot) {\r\n\t(module as any).hot.accept('./ProductCatalogs', () => {\r\n\t\trender();\r\n\t});\r\n}\r\n","import { useState } from 'react';\r\n\r\n/**\r\n * Custom hook for commonly used loading states.\r\n */\r\nexport function useLoader() {\r\n\tconst [loading, setLoading] = useState(false);\r\n\tconst [error, setError] = useState(undefined);\r\n\tconst [response, setResponse] = useState(null);\r\n\r\n\treturn {\r\n\t\tloading,\r\n\t\tsetLoading,\r\n\t\terror,\r\n\t\tsetError,\r\n\t\tresponse,\r\n\t\tsetResponse,\r\n\t};\r\n}\r\n","import React from 'react';\r\nimport { SVGProps } from './SVGProps';\r\nimport classnames from 'classnames';\r\n\r\n/**\r\n * Folder SVG\r\n *\r\n * @returns\r\n */\r\nfunction FolderSVG({ className, ...rest }: SVGProps) {\r\n\treturn (\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t);\r\n}\r\n\r\nexport default FolderSVG;\r\n","import React from 'react';\r\nimport { SVGProps } from './SVGProps';\r\nimport classnames from 'classnames';\r\n\r\n/**\r\n * Garbage Can SVG\r\n *\r\n * @returns\r\n */\r\nfunction GarbageCanCircleSVG({ className, ...rest }: SVGProps) {\r\n\treturn (\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t);\r\n}\r\n\r\nexport default GarbageCanCircleSVG;\r\n","import React from 'react';\r\nimport { ModelStatus } from '../../../../Roc.SharedClientApp/types/model-status';\r\nimport DashCircleSVG from './hawksearch/components/svg/DashCircleSVG';\r\nimport CheckCircleSVG from './svg/CheckCircleSVG';\r\nimport FolderSVG from './svg/FolderSVG';\r\nimport GarbageCanCircleSVG from './svg/GarbageCanCircleSVG';\r\nimport PencilSVG from './svg/PencilSVG';\r\n\r\ninterface PageEditorStatusDisplayProps {\r\n\tstatus: ModelStatus;\r\n}\r\n\r\nexport function StatusDisplay(props: PageEditorStatusDisplayProps) {\r\n\tconst { status } = props;\r\n\r\n\treturn (\r\n\t\t
\r\n\t\t\t{status === ModelStatus.Published ? (\r\n\t\t\t\t\r\n\t\t\t) : status === ModelStatus.Inactive ? (\r\n\t\t\t\t\r\n\t\t\t) : status === ModelStatus.Deleted ? (\r\n\t\t\t\t\r\n\t\t\t) : status === ModelStatus.Draft ? (\r\n\t\t\t\t\r\n\t\t\t) : status === ModelStatus.Archived ? (\r\n\t\t\t\t\r\n\t\t\t) : null}\r\n\t\t
\r\n\t);\r\n}\r\n","import { useEffect, useRef } from 'react';\r\n\r\n/**\r\n * Reusable hook that can be used where setInterval is needed.\r\n *\r\n * @export\r\n * @param {() => void} callback\r\n * @param {(number | null)} delay\r\n */\r\nexport default function useInterval(callback: () => void, delay: number, enabled: boolean = true) {\r\n\tconst savedCallback = useRef<(() => void) | null>(null);\r\n\t// eslint-disable-next-line no-undef\r\n\tconst intervalId = useRef(null);\r\n\r\n\t// Remember the latest callback.\r\n\tuseEffect(() => {\r\n\t\tsavedCallback.current = callback;\r\n\t}, [callback]);\r\n\r\n\t// Set up the interval.\r\n\tuseEffect(() => {\r\n\t\tfunction tick() {\r\n\t\t\tsavedCallback.current!();\r\n\t\t}\r\n\r\n\t\tif (delay === null || !enabled) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tintervalId.current = setInterval(tick, delay);\r\n\t\treturn () => {\r\n\t\t\tif (intervalId.current) {\r\n\t\t\t\tclearInterval(intervalId.current);\r\n\t\t\t}\r\n\t\t};\r\n\t}, [delay, enabled]);\r\n}\r\n","import { reCaptchaCallbackPromise } from 'features/setup/recaptcha';\r\nimport { useLayoutEffect, useRef, useState } from 'react';\r\nimport useInterval from './useInterval';\r\n\r\n/**\r\n * Window extended with recaptcha specific fields\r\n */\r\ninterface ReCaptchaWindow extends Window {\r\n\trocReCaptchaCallbacks: Array<() => void>;\r\n\tgrecaptcha: GoogleRecaptcha;\r\n}\r\n\r\n/**\r\n * Google ReCaptcha Interface\r\n */\r\ninterface GoogleRecaptcha {\r\n\tready(callback: () => void): void;\r\n\texecute: (key: string, config: { action: string }) => Promise;\r\n}\r\n\r\nexport interface UseReCaptchaToken {\r\n\tgetToken: () => Promise;\r\n\tinvalidateToken: () => void;\r\n\tenabled: boolean;\r\n\tsetEnabled: (enabled: boolean) => void;\r\n}\r\n\r\nlet ReCaptchaKeyWarning = false;\r\n\r\n/**\r\n * Reusable hook that generates a recaptcha token from google and generates fresh tokens\r\n * frequently as these will expire every 2 minutes\r\n *\r\n * @export\r\n * @param {string} reCaptchaKey\r\n * @param {string} action\r\n * @returns\r\n */\r\nexport default function useReCaptchaToken(\r\n\treCaptchaKey: string,\r\n\taction: string,\r\n\tinitialEnabled: boolean = !!action,\r\n): UseReCaptchaToken {\r\n\tconst reCaptchaWindow = (window as unknown) as ReCaptchaWindow;\r\n\r\n\t// keeps track of the promise that is getting the token across renders. using a ref ensures it updates immediately\r\n\t// state updates are async and therefore we cannot read the state value immediately after.\r\n\t// there is no longer a callback after setting state with hooks 💣\r\n\tconst tokenPromise = useRef | null>(null);\r\n\r\n\t// store whether the promise is resolved in a ref. same reasoning as above.\r\n\tconst tokenPromiseIsResolved = useRef(false);\r\n\r\n\t// this is the promise that will handle waiting on recaptcha initialization\r\n\tconst initPromise = useRef | null>(null);\r\n\r\n\t// this will allow for the recaptcha to be disabled on demand or by an invalid token\r\n\tconst [enabled, setEnabled] = useState(initialEnabled);\r\n\r\n\t// need to use LayoutEffect because we have to make sure this code runs before google's recaptcha handlers\r\n\t// when the dom becomes ready.\r\n\tuseLayoutEffect(() => {\r\n\t\t(async () => {\r\n\t\t\tinitPromise.current = new Promise(async (resolve) => {\r\n\t\t\t\t// wait until google calls this callback.\r\n\t\t\t\tif (reCaptchaCallbackPromise) {\r\n\t\t\t\t\tawait reCaptchaCallbackPromise;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// also wait for recaptcha to be ready for us\r\n\t\t\t\treCaptchaWindow.grecaptcha.ready(() => {\r\n\t\t\t\t\tresolve();\r\n\t\t\t\t\tgetToken();\r\n\t\t\t\t});\r\n\t\t\t});\r\n\r\n\t\t\tif (!reCaptchaKey && !ReCaptchaKeyWarning) {\r\n\t\t\t\tReCaptchaKeyWarning = true;\r\n\t\t\t\tconsole.warn('No ReCaptchaKey has been set.');\r\n\t\t\t}\r\n\t\t})();\r\n\r\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\r\n\t}, []);\r\n\r\n\t/**\r\n\t * Invalidates the current token promise as long as it isn't currently unresolved\r\n\t */\r\n\tconst invalidateToken = async () => {\r\n\t\t// scenario 1: not initialized\r\n\t\tawait initPromise.current;\r\n\r\n\t\t// if we are working on getting a token, do nothing\r\n\t\tif (!tokenPromiseIsResolved) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\ttokenPromise.current = getToken(true);\r\n\t};\r\n\r\n\t// tokens expire in 2 minutes, so let's invalidate the token a little more frequently to avoid having a stale one\r\n\tuseInterval(invalidateToken, 2 * 60 * 1000 - 5000, enabled);\r\n\r\n\t/**\r\n\t * Returns a promise that will eventually resolve to a fresh recaptcha token\r\n\t */\r\n\tconst getToken = async (force: boolean = false): Promise => {\r\n\t\tif (!reCaptchaKey || !enabled) {\r\n\t\t\t// if there's no recaptcha key, we'll simple return an empty string. the server will not validate recaptcha\r\n\t\t\t// because the key is missing.\r\n\t\t\treturn Promise.resolve('');\r\n\t\t}\r\n\r\n\t\t// wait for the callback to fire\r\n\t\tawait initPromise.current;\r\n\r\n\t\t// first time or if we need a new one\r\n\t\tif (tokenPromise.current === null || force) {\r\n\t\t\ttokenPromiseIsResolved.current = false;\r\n\r\n\t\t\ttokenPromise.current = new Promise(async (resolve) => {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tconst result = await reCaptchaWindow.grecaptcha.execute(reCaptchaKey, { action });\r\n\t\t\t\t\tresolve(result);\r\n\t\t\t\t} catch (error) {\r\n\t\t\t\t\tconsole.warn(\r\n\t\t\t\t\t\t'ReCaptcha warning:',\r\n\t\t\t\t\t\terror?.message || 'An unexpected ReCaptcha error occurred. Ensure you have a valid key.',\r\n\t\t\t\t\t);\r\n\t\t\t\t\tsetEnabled(false);\r\n\t\t\t\t\tresolve('');\r\n\t\t\t\t}\r\n\t\t\t\ttokenPromiseIsResolved.current = true;\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\t// in some cases this is the existing promise because it not resolved yet, so we don't want to\r\n\t\t// start another request separately.\r\n\t\treturn tokenPromise.current;\r\n\t};\r\n\r\n\treturn { getToken: () => getToken(), invalidateToken, enabled, setEnabled };\r\n}\r\n","import { ServerData } from 'services/ServerData';\r\nimport useReCaptchaToken, { UseReCaptchaToken } from './useReCaptchaToken';\r\n\r\n/**\r\n * Reusable hook that calls the generic useReCaptchaToken with key loaded from ServerData\r\n *\r\n * @export\r\n * @param {string} action\r\n * @returns\r\n */\r\nexport default function useRocReCaptchaToken(action: string, initialEnabled: boolean = true): UseReCaptchaToken {\r\n\tconst reCaptchaKey = ServerData.ReCaptchaV3Key;\r\n\tconst isReCaptchaEnabled = initialEnabled && ServerData.IsReCaptchaEnabled;\r\n\r\n\t// the server will not render anything if the keys aren't set, which means we could get null\r\n\t// or even undefined here, so let's just do a truthy check and return an empty string if there\r\n\t// is nothing from the server.\r\n\treturn useReCaptchaToken(reCaptchaKey || '', action, isReCaptchaEnabled);\r\n}\r\n","import { AxiosError, AxiosRequestConfig } from 'axios';\r\nimport { handleAxiosErrorWithValidation } from 'shared/util/Misc';\r\nimport { useBaseAxiosSubmitter } from './useBaseAxiosSubmitter';\r\nimport { Localizer } from 'services/Localizer';\r\n\r\nexport interface UseAxiosFormSubmitterPostResult {\r\n\tformValidationState?: { [index: string]: string };\r\n\terror?: Error | AxiosError;\r\n}\r\n\r\nexport type RocFormSubmitterParams = {\r\n\taxiosParams: AxiosRequestConfig;\r\n\treCaptchaActionName?: string;\r\n\tcsrfEnabled?: boolean;\r\n\tstateful?: boolean;\r\n\tinvalidateTokenOnSuccess?: boolean;\r\n\tresponseCallback?: (response?: TResponse, error?: Error) => void;\r\n};\r\n\r\nexport type ResponseCallback = (response?: TResponse, error?: Error, invalidateToken?: () => void) => void;\r\n\r\n/**\r\n * A custom hook that can be used to facilitate posting forms. It handles processing server-side validation automatically.\r\n * @param axiosParams The parameters for the request being passed into axios. This includes the method, url, data, etc.\r\n * @param reCaptchaActionName An optional action name for the ReCaptcha request sent to Google. If left empty, no ReCaptcha token will be sent to the server.\r\n * @param csrfEnabled Specifies whether CSRF protection should be enabled or not.\r\n * @param stateful A flag for setting the form submitter to store submitting and error state. Not recommended to be true when dealing with react-final-form.\r\n * @param invalidateTokenOnSuccess A flag for invalidating ReCaptcha token on success. This can be helpful for resetting a form with ReCaptcha.\r\n * @param responseCallback An optional callback that can be executed on the response or error that is returned.\r\n */\r\nexport function useRocFormSubmitter({\r\n\taxiosParams,\r\n\treCaptchaActionName,\r\n\tcsrfEnabled = true,\r\n\tstateful = false,\r\n\tinvalidateTokenOnSuccess = false,\r\n\tresponseCallback,\r\n}: RocFormSubmitterParams) {\r\n\treturn useBaseAxiosFormSubmitter(\r\n\t\taxiosParams,\r\n\t\treCaptchaActionName,\r\n\t\tcsrfEnabled,\r\n\t\tstateful,\r\n\t\tinvalidateTokenOnSuccess,\r\n\t\tresponseCallback,\r\n\t);\r\n}\r\n\r\n/**\r\n * Form submitter that only stores the last response in state. Ideal when dealing with react-final-form.\r\n */\r\nexport function useAxiosFormSubmitter(\r\n\taxiosParams: AxiosRequestConfig,\r\n\treCaptchaActionName?: string,\r\n\tcsrfEnabled = true,\r\n\tresponseCallback?: ResponseCallback,\r\n\tinvalidateTokenOnSuccess = false,\r\n) {\r\n\treturn useBaseAxiosFormSubmitter(\r\n\t\taxiosParams,\r\n\t\treCaptchaActionName,\r\n\t\tcsrfEnabled,\r\n\t\tfalse,\r\n\t\tinvalidateTokenOnSuccess,\r\n\t\tresponseCallback,\r\n\t);\r\n}\r\n\r\n/**\r\n * Form submitter that stores submitting and error state. Not recommended when dealing with react-final-form.\r\n */\r\nexport function useStatefulAxiosFormSubmitter(\r\n\taxiosParams: AxiosRequestConfig,\r\n\treCaptchaActionName?: string,\r\n\tcsrfEnabled = true,\r\n\tresponseCallback?: ResponseCallback,\r\n\tinvalidateTokenOnSuccess = false,\r\n) {\r\n\treturn useBaseAxiosFormSubmitter(\r\n\t\taxiosParams,\r\n\t\treCaptchaActionName,\r\n\t\tcsrfEnabled,\r\n\t\ttrue,\r\n\t\tinvalidateTokenOnSuccess,\r\n\t\tresponseCallback,\r\n\t);\r\n}\r\n\r\n/**\r\n * A custom hook that can be used to facilitate posting forms. It handles processing server-side validation automatically.\r\n * Do not use this hook directly unless you know what you're doing. Prefer useAxiosFormSubmitter, useAxiosStatefulFormSubmitter, or useRocFormSubmitter instead.\r\n * @param axiosParams The parameters for the request being passed into axios. This includes the method, url, data, etc.\r\n * @param reCaptchaActionName An optional action name for the ReCaptcha request sent to Google. If left empty, no ReCaptcha token will be sent to the server.\r\n * @param csrfEnabled Specifies whether CSRF protection should be enabled or not.\r\n * @param stateful A flag for setting the form submitter to store submitting and error state. Not recommended to be true when dealing with react-final-form.\r\n * @param invalidateTokenOnSuccess A flag for invalidating ReCaptcha token on success. This can be helpful for resetting a form with ReCaptcha.\r\n * @param responseCallback An optional callback that can be executed on the response or error that is returned.\r\n */\r\nexport function useBaseAxiosFormSubmitter(\r\n\taxiosParams: AxiosRequestConfig,\r\n\treCaptchaActionName?: string,\r\n\tcsrfEnabled = true,\r\n\tstateful = false,\r\n\tinvalidateTokenOnSuccess = false,\r\n\tresponseCallback?: ResponseCallback,\r\n) {\r\n\tif (axiosParams.method === undefined) {\r\n\t\taxiosParams.method = 'POST';\r\n\t}\r\n\r\n\t/**\r\n\t * Callback to be executed after a form submission has taken place.\r\n\t */\r\n\tconst submitterCallback = (response?: R, error?: Error, invalidateToken?: () => void) => {\r\n\t\tif (error) {\r\n\t\t\tconsole.error(error);\r\n\r\n\t\t\tconst axiosError = error as AxiosError;\r\n\t\t\tif (invalidateToken) {\r\n\t\t\t\tinvalidateToken();\r\n\t\t\t}\r\n\r\n\t\t\tif (responseCallback !== undefined) {\r\n\t\t\t\tresponseCallback(response, error);\r\n\t\t\t}\r\n\r\n\t\t\treturn Promise.resolve({\r\n\t\t\t\tformValidationState: handleAxiosErrorWithValidation(\r\n\t\t\t\t\taxiosError,\r\n\t\t\t\t\tLocalizer('ErrorOccurredSubmittingTheForm'),\r\n\t\t\t\t),\r\n\t\t\t\terror,\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (responseCallback !== undefined) {\r\n\t\t\tresponseCallback(response);\r\n\t\t}\r\n\r\n\t\tif (invalidateToken && invalidateTokenOnSuccess) {\r\n\t\t\tinvalidateToken();\r\n\t\t}\r\n\r\n\t\treturn Promise.resolve({});\r\n\t};\r\n\r\n\tconst submitter = useBaseAxiosSubmitter(\r\n\t\taxiosParams,\r\n\t\tsubmitterCallback,\r\n\t\treCaptchaActionName,\r\n\t\tcsrfEnabled,\r\n\t\tstateful,\r\n\t);\r\n\r\n\tlet result = {\r\n\t\thandleSubmit: async (formValues: T) => {\r\n\t\t\tconst submitResult = await submitter.submit(formValues);\r\n\t\t\treturn submitResult && submitResult.formValidationState;\r\n\t\t},\r\n\t\tsubmitted: submitter.response !== null && submitter.response.status === 200,\r\n\t\tresponseData: submitter.response !== null ? submitter.response.data : null,\r\n\t};\r\n\r\n\tif (stateful) {\r\n\t\tresult = {\r\n\t\t\t...submitter,\r\n\t\t\t...result,\r\n\t\t};\r\n\t}\r\n\r\n\treturn result;\r\n}\r\n","import Axios, { AxiosRequestConfig, AxiosError, AxiosResponse, CancelTokenSource } from 'axios';\r\nimport useRocReCaptchaToken from './useRocReCaptchaToken';\r\nimport { useLoader } from './useLoader';\r\nimport { useRef } from 'react';\r\nimport { getCsrfToken } from 'services/UserData';\r\nimport AxiosHelper from 'services/AxiosHelper';\r\n\r\n/**\r\n * A reusable hook to be used to submit data via Axios. Handles CSRF and ReCaptcha tokens.\r\n * Do not call this directly, use useAxiosFormSubmitter or useAxiosStatefulFormSubmitter instead.\r\n * @param axiosParams The parameters for the request being passed into axios. This includes the method, url, data, etc.\r\n * @param submitterCallback An optional callback that will be called after a request is submitted. The error and the function to invalidate the used ReCaptcha token will be passed if something goes wrong.\r\n * @param reCaptchaActionName An optional action name for the ReCaptcha request sent to Google. If left empty, no ReCaptcha token will be sent to the server.\r\n * @param csrfEnabled Specifies whether CSRF protection should be enabled or not.\r\n * @param stateful An optional value to determine whether this component should use all useLoader state.\r\n */\r\nexport function useBaseAxiosSubmitter(\r\n\taxiosParams: AxiosRequestConfig,\r\n\tsubmitterCallback?: (response: R, error?: Error | AxiosError, invalidateRecaptchaToken?: () => void) => Promise,\r\n\treCaptchaActionName?: string,\r\n\tcsrfEnabled = true,\r\n\tstateful = false,\r\n) {\r\n\tif (axiosParams.method === undefined) {\r\n\t\taxiosParams.method = 'POST';\r\n\t}\r\n\r\n\tconst { getToken: getRecaptchaToken, invalidateToken } = useRocReCaptchaToken(reCaptchaActionName || '');\r\n\tconst { loading, setLoading, error, setError, response, setResponse } = useLoader>();\r\n\tconst cancelToken = useRef();\r\n\r\n\t/**\r\n\t * The main method that allows imperative posting of data\r\n\t * @param payload The data that should be posted in the body of the request\r\n\t */\r\n\tasync function submit(payload: T): Promise {\r\n\t\ttry {\r\n\t\t\t// avoid duplicate requests if there's a pending one\r\n\t\t\tif (cancelToken.current) {\r\n\t\t\t\tconsole.warn('Already posting... Did you forget to disable your submit button while this was saving?');\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tcancelToken.current = Axios.CancelToken.source();\r\n\r\n\t\t\tconst promises: Array | undefined> = [];\r\n\r\n\t\t\tpromises.push(csrfEnabled ? getCsrfToken() : undefined);\r\n\t\t\tpromises.push(reCaptchaActionName ? getRecaptchaToken() : undefined);\r\n\r\n\t\t\tconst [csrfToken, reCaptchaToken] = await Promise.all(promises);\r\n\r\n\t\t\tif (stateful) {\r\n\t\t\t\tsetLoading(true);\r\n\t\t\t\tsetError(undefined);\r\n\t\t\t}\r\n\r\n\t\t\t// eslint-disable-next-line no-unused-vars\r\n\t\t\tconst { data, ...rest } = axiosParams;\r\n\t\t\tconst request = {\r\n\t\t\t\t...rest,\r\n\t\t\t\tdata: {\r\n\t\t\t\t\t...payload,\r\n\t\t\t\t\treCaptchaToken: reCaptchaToken || undefined,\r\n\t\t\t\t},\r\n\t\t\t};\r\n\r\n\t\t\tif (csrfToken) {\r\n\t\t\t\tif (!request.headers) {\r\n\t\t\t\t\trequest.headers = {};\r\n\t\t\t\t}\r\n\r\n\t\t\t\trequest.headers.RequestVerificationToken = csrfToken;\r\n\t\t\t}\r\n\r\n\t\t\tconst serverResponse = (await AxiosHelper(request)) as AxiosResponse;\r\n\r\n\t\t\t// reset cancellation token ref to allow new requests.\r\n\t\t\tcancelToken.current = undefined;\r\n\r\n\t\t\tsetResponse(serverResponse);\r\n\r\n\t\t\tif (submitterCallback !== undefined) {\r\n\t\t\t\treturn await submitterCallback(serverResponse.data);\r\n\t\t\t}\r\n\r\n\t\t\treturn;\r\n\t\t} catch (error) {\r\n\t\t\t// reset cancellation token ref to allow new requests.\r\n\t\t\tcancelToken.current = undefined;\r\n\r\n\t\t\tif (Axios.isCancel(error)) {\r\n\t\t\t\t// if the component was unmounted, there's nothing to do\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif (stateful) {\r\n\t\t\t\tsetError(error);\r\n\t\t\t}\r\n\r\n\t\t\tif (submitterCallback !== undefined) {\r\n\t\t\t\treturn await submitterCallback(error.data, error, invalidateToken);\r\n\t\t\t}\r\n\r\n\t\t\treturn;\r\n\t\t} finally {\r\n\t\t\tif (stateful) {\r\n\t\t\t\tsetLoading(false);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn {\r\n\t\tsubmitting: loading,\r\n\t\terror,\r\n\t\tresponse,\r\n\t\tcancelToken: cancelToken.current,\r\n\t\tsubmit,\r\n\t};\r\n}\r\n"],"sourceRoot":""}