@bigbinary/neeto-molecules 3.7.27 → 3.7.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/Builder.js.map +1 -1
  2. package/dist/CustomDomain.js +1 -4
  3. package/dist/CustomDomain.js.map +1 -1
  4. package/dist/CustomDomainDashboard.js +3 -6
  5. package/dist/CustomDomainDashboard.js.map +1 -1
  6. package/dist/EmailForm.js +1 -1
  7. package/dist/EmailForm.js.map +1 -1
  8. package/dist/FloatingActionMenu.js +137 -27
  9. package/dist/FloatingActionMenu.js.map +1 -1
  10. package/dist/IpRestriction.js +1 -1
  11. package/dist/IpRestriction.js.map +1 -1
  12. package/dist/MoreDropdown.js +1 -1
  13. package/dist/MoreDropdown.js.map +1 -1
  14. package/dist/Onboarding.js.map +1 -1
  15. package/dist/PublishBlock.js +15 -13
  16. package/dist/PublishBlock.js.map +1 -1
  17. package/dist/ToggleFeatureCard.js +7 -3
  18. package/dist/ToggleFeatureCard.js.map +1 -1
  19. package/dist/cjs/Builder.js.map +1 -1
  20. package/dist/cjs/CustomDomain.js +1 -4
  21. package/dist/cjs/CustomDomain.js.map +1 -1
  22. package/dist/cjs/CustomDomainDashboard.js +3 -6
  23. package/dist/cjs/CustomDomainDashboard.js.map +1 -1
  24. package/dist/cjs/EmailForm.js +1 -1
  25. package/dist/cjs/EmailForm.js.map +1 -1
  26. package/dist/cjs/FloatingActionMenu.js +138 -28
  27. package/dist/cjs/FloatingActionMenu.js.map +1 -1
  28. package/dist/cjs/IpRestriction.js +1 -1
  29. package/dist/cjs/IpRestriction.js.map +1 -1
  30. package/dist/cjs/MoreDropdown.js +1 -1
  31. package/dist/cjs/MoreDropdown.js.map +1 -1
  32. package/dist/cjs/Onboarding.js.map +1 -1
  33. package/dist/cjs/PublishBlock.js +12 -10
  34. package/dist/cjs/PublishBlock.js.map +1 -1
  35. package/dist/cjs/ToggleFeatureCard.js +7 -3
  36. package/dist/cjs/ToggleFeatureCard.js.map +1 -1
  37. package/dist/cjs/{index-Dfq9GJPm.js → index-C4nGx1kT.js} +6 -5
  38. package/dist/cjs/index-C4nGx1kT.js.map +1 -0
  39. package/dist/{index-YZ7vuBmP.js → index-BXT7Ma5O.js} +6 -5
  40. package/dist/index-BXT7Ma5O.js.map +1 -0
  41. package/package.json +5 -3
  42. package/src/translations/en.json +4 -0
  43. package/types/FloatingActionMenu.d.ts +1 -0
  44. package/types/Onboarding.d.ts +1 -1
  45. package/dist/cjs/index-Dfq9GJPm.js.map +0 -1
  46. package/dist/index-YZ7vuBmP.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"EmailForm.js","sources":["../src/components/EmailForm/constants.js","../src/components/EmailForm/contexts/EmailForm.js","../src/components/EmailForm/utils.js","../src/components/EmailForm/ReplyToField.jsx","../src/components/EmailForm/SendToField.jsx","../src/components/EmailForm/SubjectField.jsx","../src/components/EmailForm/EmailForm.jsx","../src/components/EmailForm/EmailFormProvider.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport { isEditorEmpty } from \"neetoeditor\";\nimport { prop } from \"ramda\";\nimport * as yup from \"yup\";\n\nexport const INITIAL_FORM_VALUES = {\n sendTo: [],\n sendToId: \"\",\n sendToCc: [],\n sendToBcc: [],\n replyTo: \"\",\n showCopyEmails: false,\n subject: \"\",\n message: \"\",\n};\n\nexport const EMAIL_FORM_VALIDATION_SCHEMA = yup.object({\n subject: yup\n .string()\n .required(t(\"neetoMolecules.emailForm.errors.subjectRequired\")),\n message: yup\n .string()\n .test(\n \"message\",\n t(\"neetoMolecules.emailForm.errors.messageRequired\"),\n value => !isEditorEmpty(value)\n ),\n});\n\nexport const sendToFieldValidation = maxEmails => {\n const validation = yup\n .array()\n .test(\n \"all-emails-valid\",\n t(\"neetoMolecules.emailForm.errors.invalidEmailAddress\"),\n emails => emails?.every(prop(\"valid\"))\n )\n .test(\n \"max-email-count\",\n t(\"neetoMolecules.emailForm.errors.maxEmails\", { count: maxEmails }),\n emails => emails?.length <= maxEmails\n );\n\n return yup.object({\n sendTo: validation\n .min(\n 1,\n t(\"neetoMolecules.emailForm.errors.required\", {\n entity: t(\"neetoMolecules.emailForm.fields.sendToEmailAddress\"),\n })\n )\n .nullable(),\n sendToCc: validation,\n sendToBcc: validation,\n });\n};\n\nexport const SEND_TO_ID_FIELD_VALIDATION = yup.object({\n sendToId: yup.string().required(\n t(\"neetoMolecules.emailForm.errors.required\", {\n entity: t(\"neetoMolecules.emailForm.labels.sendTo\"),\n })\n ),\n});\n\nexport const REPLY_TO_FIELD_VALIDATION = yup.object({\n replyTo: yup\n .string()\n .nullable()\n .email(t(\"neetoMolecules.emailForm.errors.invalidEmailAddress\"))\n .required(\n t(\"neetoMolecules.emailForm.errors.required\", {\n entity: t(\"neetoMolecules.emailForm.fields.replyToEmailAddress\"),\n })\n ),\n});\n\nexport const EDITOR_ADDONS = [\n \"highlight\",\n \"emoji\",\n \"code-block\",\n \"block-quote\",\n \"image-upload\",\n \"divider\",\n \"video-embed\",\n];\n\nexport const ALLOWED_FILE_PICKER_TYPES = [\".csv\"];\n","/* eslint-disable @bigbinary/neeto/use-zustand-for-global-state-management */\nimport { createContext } from \"react\";\n\nconst EmailFormContext = createContext({\n showSendToField: false,\n showSendToAsRadio: false,\n showReplyToField: false,\n});\n\nexport { EmailFormContext };\n","import { t } from \"i18next\";\nimport { isPresent } from \"neetocist\";\n\nimport {\n EMAIL_FORM_VALIDATION_SCHEMA,\n REPLY_TO_FIELD_VALIDATION,\n sendToFieldValidation,\n SEND_TO_ID_FIELD_VALIDATION,\n} from \"./constants\";\n\nexport const getValidationSchema = ({\n showSendToField,\n showReplyToField,\n showSendToAsRadio,\n customValidations,\n maxEmails,\n}) => {\n let schema = EMAIL_FORM_VALIDATION_SCHEMA.clone();\n\n if (showSendToField) {\n schema = schema.concat(\n showSendToAsRadio\n ? SEND_TO_ID_FIELD_VALIDATION\n : sendToFieldValidation(maxEmails)\n );\n }\n\n if (showReplyToField) schema = schema.concat(REPLY_TO_FIELD_VALIDATION);\n\n return schema.shape(customValidations);\n};\n\nexport const getReplyToFieldLabelProps = ({ popoverProps }) => ({\n helpIconProps: {\n [\"data-testid\"]: \"reply-to-tooltip\",\n tooltipProps: !isPresent(popoverProps) && {\n content: t(\"neetoMolecules.emailForm.tooltips.replyTo\"),\n touch: [\"hold\", 500],\n },\n popoverProps: isPresent(popoverProps) && {\n ...popoverProps,\n description:\n popoverProps.description ||\n t(\"neetoMolecules.emailForm.tooltips.replyTo\"),\n },\n },\n});\n","import { useFormikContext } from \"formik\";\nimport { isNotEmpty } from \"neetocist\";\nimport { Select, Input } from \"neetoui/formik\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { getReplyToFieldLabelProps } from \"./utils\";\n\nconst ReplyToField = ({ options = [], popoverProps = {} }) => {\n const { t } = useTranslation();\n const { setFieldValue } = useFormikContext();\n\n const isDropdownField = isNotEmpty(options);\n const labelProps = getReplyToFieldLabelProps({ popoverProps });\n\n if (isDropdownField) {\n return (\n <Select\n {...{ labelProps, options }}\n isClearable\n className=\"w-full\"\n data-testid=\"replyToOptions\"\n label={t(\"neetoMolecules.emailForm.labels.replyTo\")}\n name=\"replyTo\"\n onChange={data => setFieldValue(\"replyTo\", data?.value ?? \"\")}\n />\n );\n }\n\n return (\n <Input\n {...{ labelProps }}\n autoFocus\n required\n className=\"w-full\"\n data-testid=\"replyToInput\"\n label={t(\"neetoMolecules.emailForm.labels.replyTo\")}\n name=\"replyTo\"\n placeholder={t(\"neetoMolecules.emailForm.placeholders.emailPlaceholder\")}\n size=\"large\"\n onChange={event =>\n setFieldValue(\"replyTo\", event.target.value?.toLowerCase())\n }\n />\n );\n};\n\nexport default ReplyToField;\n","import { useTranslation } from \"react-i18next\";\n\nimport SendToFields from \"components/SendToFields\";\n\nconst SendToField = ({ showBccField, showCcField, showSendToTextField }) => {\n const { t } = useTranslation();\n\n if (!showSendToTextField && !showBccField && !showCcField) return null;\n\n return (\n <SendToFields\n showCcBccButton\n showBccField={showSendToTextField ? false : showBccField}\n showCcField={showSendToTextField ? false : showCcField}\n showSendToField={showSendToTextField}\n bccInputProps={{\n label: t(\"neetoMolecules.emailForm.labels.bCc\"),\n name: \"sendToBcc\",\n placeholder: t(\n \"neetoMolecules.emailForm.placeholders.commaSeparatedEmails\"\n ),\n }}\n ccInputProps={{\n label: t(\"neetoMolecules.emailForm.labels.cc\"),\n name: \"sendToCc\",\n placeholder: t(\n \"neetoMolecules.emailForm.placeholders.commaSeparatedEmails\"\n ),\n }}\n emailInputProps={{\n id: \"sendTo\",\n name: \"sendTo\",\n label: t(\"neetoMolecules.emailForm.labels.sendTo\"),\n placeholder: t(\n \"neetoMolecules.emailForm.placeholders.commaSeparatedEmails\"\n ),\n required: true,\n }}\n />\n );\n};\n\nexport default SendToField;\n","import { useState } from \"react\";\n\nimport { withEventTargetValue } from \"neetocommons/utils/general\";\nimport { Input, Typography } from \"neetoui\";\nimport { Trans, useTranslation } from \"react-i18next\";\n\nimport DynamicVariables from \"components/DynamicVariables\";\n\nconst SubjectField = ({\n name,\n text,\n updateText,\n subjectVariables = [],\n error,\n required = false,\n}) => {\n const [isFieldFocusedOnce, setIsFieldFocusedOnce] = useState(false);\n\n const { t } = useTranslation();\n\n const tagClickHandler = ({ key: slug }) => {\n const textAreaElement = document.querySelector(`textarea[name=${name}]`);\n const splitIndex =\n isFieldFocusedOnce && textAreaElement\n ? textAreaElement.selectionEnd\n : text.length;\n\n const updatedSubject = [\n text.slice(0, splitIndex),\n ` {{${slug}}}`,\n text.slice(splitIndex),\n ].join(\"\");\n updateText(updatedSubject);\n };\n\n return (\n <>\n <Input\n {...{ error, name, required }}\n label={t(\"neetoMolecules.emailForm.labels.subject\")}\n size=\"large\"\n value={text}\n suffix={\n <DynamicVariables\n variables={subjectVariables}\n dropdownProps={{\n className: \"neeto-ui-dropdown__popup overflow-y-auto\",\n buttonSize: \"small\",\n }}\n onVariableClick={tagClickHandler}\n />\n }\n onChange={withEventTargetValue(updateText)}\n onFocus={() => setIsFieldFocusedOnce(true)}\n />\n <Typography\n className=\"neeto-ui-text-gray-600 mt-2\"\n data-cy=\"subject-input-variable-label\"\n style=\"body3\"\n >\n <Trans\n components={{ span: <span className=\"font-semibold\" /> }}\n i18nKey=\"neetoMolecules.emailForm.helpText\"\n values={{ type: \"subject\" }}\n />\n </Typography>\n </>\n );\n};\n\nexport default SubjectField;\n","import { useContext } from \"react\";\n\nimport classnames from \"classnames\";\nimport { Field, useFormikContext } from \"formik\";\nimport { isNotEmpty } from \"neetocist\";\nimport { FormikEditor } from \"neetoeditor\";\nimport { Typography } from \"neetoui\";\nimport { ActionBlock, Radio } from \"neetoui/formik\";\nimport PropTypes from \"prop-types\";\nimport { Trans, useTranslation } from \"react-i18next\";\n\nimport { EDITOR_ADDONS } from \"./constants\";\nimport { EmailFormContext } from \"./contexts/EmailForm\";\nimport ReplyToField from \"./ReplyToField\";\nimport SendToField from \"./SendToField\";\nimport SubjectField from \"./SubjectField\";\n\nconst EmailForm = ({\n messageVariables = [],\n subjectVariables = [],\n handleCancel,\n isLoading,\n replyToFieldProps,\n sendToFieldProps,\n replyToOptions,\n sendToOptions = [],\n isUpdating = false,\n showFields = true,\n className = \"\",\n}) => {\n const { t } = useTranslation();\n\n const {\n showSendToField,\n showSendToAsRadio,\n showReplyToField,\n showCcField,\n showBccField,\n } = useContext(EmailFormContext);\n\n const { setFieldValue } = useFormikContext();\n\n const sendToFieldOptions = sendToFieldProps?.options || sendToOptions;\n const showSendToRadioField =\n showSendToField && showSendToAsRadio && isNotEmpty(sendToFieldOptions);\n\n const showSendToTextField = showSendToField && !showSendToRadioField;\n\n return (\n <div\n data-cy=\"email-form\"\n data-testid=\"email-form\"\n className={classnames(\"flex flex-1 flex-col items-start gap-2 !pb-0\", {\n [className]: className,\n })}\n >\n {showFields && (\n <div className=\"flex w-full flex-col items-start justify-start gap-6\">\n <Field name=\"subject\">\n {({ field: { value }, meta: { error } }) => (\n <div className=\"w-full\">\n <SubjectField\n {...{ subjectVariables }}\n required\n error={t(error)}\n name=\"subject\"\n text={value}\n updateText={text => setFieldValue(\"subject\", text)}\n />\n </div>\n )}\n </Field>\n {showSendToRadioField && (\n <Radio\n data-testid=\"send-to-id\"\n label={t(\"neetoMolecules.emailForm.labels.sendTo\")}\n labelProps={{ required: true }}\n name=\"sendToId\"\n >\n {sendToFieldOptions.map(({ label, value }) => (\n <Radio.Item {...{ label, value }} key={value} />\n ))}\n </Radio>\n )}\n <SendToField\n {...{ showBccField, showCcField, showSendToTextField }}\n />\n {showReplyToField && (\n <ReplyToField options={replyToOptions} {...replyToFieldProps} />\n )}\n <div className=\"w-full\">\n <FormikEditor\n isMenuCollapsible\n required\n addons={EDITOR_ADDONS}\n data-cy=\"message-input-field\"\n id=\"form_message\"\n label={t(\"neetoMolecules.emailForm.labels.message\")}\n name=\"message\"\n variables={messageVariables}\n />\n <Typography\n className=\"neeto-ui-text-gray-500 mt-2\"\n data-cy=\"message-input-variable-label\"\n style=\"body3\"\n >\n <Trans\n i18nKey=\"neetoMolecules.emailForm.helpText\"\n values={{ type: \"message\" }}\n components={{\n span: <span className=\"font-semibold\" />,\n }}\n />\n </Typography>\n </div>\n </div>\n )}\n <ActionBlock\n cancelButtonProps={{ onClick: handleCancel }}\n className=\"neeto-ui-bg-white z-10 w-full justify-start py-6 lg:sticky lg:bottom-0\"\n isSubmitting={isLoading || isUpdating}\n />\n </div>\n );\n};\n\nEmailForm.propTypes = {\n /**\n * This is an array of objects used for templating within the message field. Each object in the array has a **label** and a **key**.\n */\n messageVariables: PropTypes.array,\n /**\n * This is an array of objects used for templating within the subject field. Each object in the array has a **label** and a **key**.\n */\n subjectVariables: PropTypes.array,\n /**\n * This function that gets triggered when the 'Cancel' button is clicked.\n */\n handleCancel: PropTypes.func,\n /**\n * This Boolean value, when set to true, triggers the display of a loading indicator on the 'Save changes' button.\"\n */\n isLoading: PropTypes.bool,\n /**\n * An array of objects, with each object having **label** and **value** properties. This prop transforms the 'Reply To' field into a dropdown menu with given options. Without this prop, 'Reply To' will be a text input field.\n */\n replyToOptions: PropTypes.array,\n /**\n * An array of objects, with each object having **label** and **value** properties. This prop transforms the 'Send To' field into a radio group with given options. Without this prop, 'Send To' will be a multi email input field.\n */\n sendToOptions: PropTypes.array,\n /**\n * A Boolean flag indicating whether an update operation is currently in progress. When set to `true`, the 'Save changes' button is disabled.\n */\n isUpdating: PropTypes.bool,\n /**\n * To provide additional classnames to the button.\n */\n className: PropTypes.string,\n /**\n * To provide props to the replyToField. Supports options that will\n * be rendered as the reply to options and popover props.\n */\n replyToFieldProps: PropTypes.object,\n /**\n * To provide props to the sendToField. Supports sendTo options.\n */\n sendToFieldProps: PropTypes.object,\n};\n\nexport default EmailForm;\n","import { noop } from \"neetocist\";\nimport { Form } from \"neetoui/formik\";\nimport PropTypes from \"prop-types\";\n\nimport { INITIAL_FORM_VALUES } from \"./constants\";\nimport { EmailFormContext } from \"./contexts/EmailForm\";\nimport { getValidationSchema } from \"./utils\";\n\nconst EmailFormProvider = ({\n onSubmit = noop,\n initialValues = INITIAL_FORM_VALUES,\n children,\n formikProps,\n validationSchema: customValidations = {},\n showSendToField = false,\n showReplyToField = false,\n showSendToAsRadio = false,\n showCcField = false,\n showBccField = false,\n maxEmails = 10,\n}) => (\n <div data-testid=\"email-form-provider\">\n <EmailFormContext.Provider\n value={{\n showSendToField,\n showSendToAsRadio,\n showReplyToField,\n showCcField,\n showBccField,\n }}\n >\n <Form\n formikProps={{\n enableReinitialize: true,\n validationSchema: getValidationSchema({\n showSendToField,\n showReplyToField,\n showSendToAsRadio,\n customValidations,\n maxEmails,\n }),\n initialValues: {\n ...initialValues,\n replyTo: initialValues.replyTo || globalProps.user.email,\n },\n onSubmit,\n ...formikProps,\n }}\n >\n {children}\n </Form>\n </EmailFormContext.Provider>\n </div>\n);\n\nEmailFormProvider.propTypes = {\n /**\n * A Boolean value that determines whether the '**sendTo**' field should be displayed or not.\n */\n showSendToField: PropTypes.bool,\n /**\n * A Boolean value that determines whether the '**replyTo**' field should be displayed or not.\n */\n showReplyToField: PropTypes.bool,\n /**\n * A Boolean value that determines whether the '**sendTo**' field should be radio type or not.\n */\n showSendToAsRadio: PropTypes.bool,\n /**\n * A function that will be triggered with input values when the 'Save changes' button is clicked.\n */\n onSubmit: PropTypes.func,\n /**\n * These are the predefined values that populate the form fields when the form is first rendered.\n */\n initialValues: PropTypes.shape({\n sendTo: PropTypes.array,\n sendToId: PropTypes.string,\n sendToCc: PropTypes.array,\n sendToBcc: PropTypes.array,\n replyTo: PropTypes.string,\n showCopyEmails: PropTypes.bool,\n subject: PropTypes.string,\n message: PropTypes.string,\n }),\n /**\n * A prop used for rendering either standard React element or a render prop function.\n */\n children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),\n /**\n * A prop that can be used to override the default Formik properties that are set within the component, providing customization flexibility.\n */\n formikProps: PropTypes.object,\n /**\n * A Yup object defining custom form validation rules, which will be merged with the default rules using the concat method.\n */\n validationSchema: PropTypes.object,\n /**\n * A prop to limit number of send to emails\n */\n maxEmails: PropTypes.number,\n /**\n * A Boolean value that determines whether the '**Cc**' field should be displayed or not when showSendToField is false.\n * This prop has no effect when showSendToField is true.\n */\n showCcField: PropTypes.bool,\n /**\n * A Boolean value that determines whether the '**Bcc**' field should be displayed or not when showSendToField is false.\n * This prop has no effect when showSendToField is true.\n */\n showBccField: PropTypes.bool,\n};\n\nexport default EmailFormProvider;\n"],"names":["INITIAL_FORM_VALUES","sendTo","sendToId","sendToCc","sendToBcc","replyTo","showCopyEmails","subject","message","EMAIL_FORM_VALIDATION_SCHEMA","yup","object","string","required","t","test","value","isEditorEmpty","sendToFieldValidation","maxEmails","validation","array","emails","every","prop","count","length","min","entity","nullable","SEND_TO_ID_FIELD_VALIDATION","REPLY_TO_FIELD_VALIDATION","email","EDITOR_ADDONS","EmailFormContext","createContext","showSendToField","showSendToAsRadio","showReplyToField","getValidationSchema","_ref","customValidations","schema","clone","concat","shape","getReplyToFieldLabelProps","_ref2","popoverProps","helpIconProps","_defineProperty","isPresent","content","touch","_objectSpread","description","ReplyToField","_ref$options","options","_ref$popoverProps","_useTranslation","useTranslation","_useFormikContext","useFormikContext","setFieldValue","isDropdownField","isNotEmpty","labelProps","_jsx","Select","isClearable","className","label","name","onChange","data","_data$value","Input","autoFocus","placeholder","size","event","_event$target$value","target","toLowerCase","SendToField","showBccField","showCcField","showSendToTextField","SendToFields","showCcBccButton","bccInputProps","ccInputProps","emailInputProps","id","SubjectField","text","updateText","_ref$subjectVariables","subjectVariables","error","_ref$required","_useState","useState","_useState2","_slicedToArray","isFieldFocusedOnce","setIsFieldFocusedOnce","tagClickHandler","slug","key","textAreaElement","document","querySelector","splitIndex","selectionEnd","updatedSubject","slice","join","_jsxs","_Fragment","children","suffix","DynamicVariables","variables","dropdownProps","buttonSize","onVariableClick","withEventTargetValue","onFocus","Typography","style","Trans","components","span","i18nKey","values","type","EmailForm","_ref$messageVariables","messageVariables","handleCancel","isLoading","replyToFieldProps","sendToFieldProps","replyToOptions","_ref$sendToOptions","sendToOptions","_ref$isUpdating","isUpdating","_ref$showFields","showFields","_ref$className","_useContext","useContext","sendToFieldOptions","showSendToRadioField","classnames","Field","field","meta","Radio","map","_ref3","_createElement","Item","FormikEditor","isMenuCollapsible","addons","ActionBlock","cancelButtonProps","onClick","isSubmitting","EmailFormProvider","_ref$onSubmit","onSubmit","noop","_ref$initialValues","initialValues","formikProps","_ref$validationSchema","validationSchema","_ref$showSendToField","_ref$showReplyToField","_ref$showSendToAsRadi","_ref$showCcField","_ref$showBccField","_ref$maxEmails","Provider","Form","enableReinitialize","globalProps","user"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,IAAMA,mBAAmB,GAAG;AACjCC,EAAAA,MAAM,EAAE,EAAE;AACVC,EAAAA,QAAQ,EAAE,EAAE;AACZC,EAAAA,QAAQ,EAAE,EAAE;AACZC,EAAAA,SAAS,EAAE,EAAE;AACbC,EAAAA,O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H,GAAA,CAAA,KAAA,EAAA;AAAK,IAAA,aAAA,EAAY,qBAAqB;AAAAqD,IAAAA,QAAA,eACpCrD,GAAA,CAAClC,gBAAgB,CAAC0J,QAAQ,EAAA;AACxB5K,MAAAA,KAAK,EAAE;AACLoB,QAAAA,eAAe,EAAfA,eAAe;AACfC,QAAAA,iBAAiB,EAAjBA,iBAAiB;AACjBC,QAAAA,gBAAgB,EAAhBA,gBAAgB;AAChBiD,QAAAA,WAAW,EAAXA,WAAW;AACXD,QAAAA,YAAY,EAAZA,YAAAA;OACA;MAAAmC,QAAA,eAEFrD,GAAA,CAACyH,IAAI,EAAA;AACHV,QAAAA,WAAW,EAAA7H,aAAA,CAAA;AACTwI,UAAAA,kBAAkB,EAAE,IAAI;UACxBT,gBAAgB,EAAE9I,mBAAmB,CAAC;AACpCH,YAAAA,eAAe,EAAfA,eAAe;AACfE,YAAAA,gBAAgB,EAAhBA,gBAAgB;AAChBD,YAAAA,iBAAiB,EAAjBA,iBAAiB;AACjBI,YAAAA,iBAAiB,EAAjBA,iBAAiB;AACjBtB,YAAAA,SAAS,EAATA,SAAAA;AACF,WAAC,CAAC;AACF+J,UAAAA,aAAa,EAAA5H,aAAA,CAAAA,aAAA,KACR4H,aAAa,CAAA,EAAA,EAAA,EAAA;YAChB7K,OAAO,EAAE6K,aAAa,CAAC7K,OAAO,IAAI0L,WAAW,CAACC,IAAI,CAAChK,KAAAA;WACpD,CAAA;AACD+I,UAAAA,QAAQ,EAARA,QAAAA;AAAQ,SAAA,EACLI,WAAW,CACd;AAAA1D,QAAAA,QAAA,EAEDA,QAAAA;OACG,CAAA;KACmB,CAAA;AAAC,GACzB,CAAC,CAAA;AAAA;;;;"}
1
+ {"version":3,"file":"EmailForm.js","sources":["../src/components/EmailForm/constants.js","../src/components/EmailForm/contexts/EmailForm.js","../src/components/EmailForm/utils.js","../src/components/EmailForm/ReplyToField.jsx","../src/components/EmailForm/SendToField.jsx","../src/components/EmailForm/SubjectField.jsx","../src/components/EmailForm/EmailForm.jsx","../src/components/EmailForm/EmailFormProvider.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport { isEditorEmpty } from \"neetoeditor\";\nimport { prop } from \"ramda\";\nimport * as yup from \"yup\";\n\nexport const INITIAL_FORM_VALUES = {\n sendTo: [],\n sendToId: \"\",\n sendToCc: [],\n sendToBcc: [],\n replyTo: \"\",\n showCopyEmails: false,\n subject: \"\",\n message: \"\",\n};\n\nexport const EMAIL_FORM_VALIDATION_SCHEMA = yup.object({\n subject: yup\n .string()\n .required(t(\"neetoMolecules.emailForm.errors.subjectRequired\")),\n message: yup\n .string()\n .test(\n \"message\",\n t(\"neetoMolecules.emailForm.errors.messageRequired\"),\n value => !isEditorEmpty(value)\n ),\n});\n\nexport const sendToFieldValidation = maxEmails => {\n const validation = yup\n .array()\n .test(\n \"all-emails-valid\",\n t(\"neetoMolecules.emailForm.errors.invalidEmailAddress\"),\n emails => emails?.every(prop(\"valid\"))\n )\n .test(\n \"max-email-count\",\n t(\"neetoMolecules.emailForm.errors.maxEmails\", { count: maxEmails }),\n emails => emails?.length <= maxEmails\n );\n\n return yup.object({\n sendTo: validation\n .min(\n 1,\n t(\"neetoMolecules.emailForm.errors.required\", {\n entity: t(\"neetoMolecules.emailForm.fields.sendToEmailAddress\"),\n })\n )\n .nullable(),\n sendToCc: validation,\n sendToBcc: validation,\n });\n};\n\nexport const SEND_TO_ID_FIELD_VALIDATION = yup.object({\n sendToId: yup.string().required(\n t(\"neetoMolecules.emailForm.errors.required\", {\n entity: t(\"neetoMolecules.emailForm.labels.sendTo\"),\n })\n ),\n});\n\nexport const REPLY_TO_FIELD_VALIDATION = yup.object({\n replyTo: yup\n .string()\n .nullable()\n .email(t(\"neetoMolecules.emailForm.errors.invalidEmailAddress\"))\n .required(\n t(\"neetoMolecules.emailForm.errors.required\", {\n entity: t(\"neetoMolecules.emailForm.fields.replyToEmailAddress\"),\n })\n ),\n});\n\nexport const EDITOR_ADDONS = [\n \"highlight\",\n \"emoji\",\n \"code-block\",\n \"block-quote\",\n \"image-upload\",\n \"divider\",\n \"video-embed\",\n];\n\nexport const ALLOWED_FILE_PICKER_TYPES = [\".csv\"];\n","/* eslint-disable @bigbinary/neeto/use-zustand-for-global-state-management */\nimport { createContext } from \"react\";\n\nconst EmailFormContext = createContext({\n showSendToField: false,\n showSendToAsRadio: false,\n showReplyToField: false,\n});\n\nexport { EmailFormContext };\n","import { t } from \"i18next\";\nimport { isPresent } from \"neetocist\";\n\nimport {\n EMAIL_FORM_VALIDATION_SCHEMA,\n REPLY_TO_FIELD_VALIDATION,\n sendToFieldValidation,\n SEND_TO_ID_FIELD_VALIDATION,\n} from \"./constants\";\n\nexport const getValidationSchema = ({\n showSendToField,\n showReplyToField,\n showSendToAsRadio,\n customValidations,\n maxEmails,\n}) => {\n let schema = EMAIL_FORM_VALIDATION_SCHEMA.clone();\n\n if (showSendToField) {\n schema = schema.concat(\n showSendToAsRadio\n ? SEND_TO_ID_FIELD_VALIDATION\n : sendToFieldValidation(maxEmails)\n );\n }\n\n if (showReplyToField) schema = schema.concat(REPLY_TO_FIELD_VALIDATION);\n\n return schema.shape(customValidations);\n};\n\nexport const getReplyToFieldLabelProps = ({ popoverProps }) => ({\n helpIconProps: {\n [\"data-testid\"]: \"reply-to-tooltip\",\n tooltipProps: !isPresent(popoverProps) && {\n content: t(\"neetoMolecules.emailForm.tooltips.replyTo\"),\n touch: [\"hold\", 500],\n },\n popoverProps: isPresent(popoverProps) && {\n ...popoverProps,\n appendTo: \"parent\",\n description:\n popoverProps.description ||\n t(\"neetoMolecules.emailForm.tooltips.replyTo\"),\n },\n },\n});\n","import { useFormikContext } from \"formik\";\nimport { isNotEmpty } from \"neetocist\";\nimport { Select, Input } from \"neetoui/formik\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { getReplyToFieldLabelProps } from \"./utils\";\n\nconst ReplyToField = ({ options = [], popoverProps = {} }) => {\n const { t } = useTranslation();\n const { setFieldValue } = useFormikContext();\n\n const isDropdownField = isNotEmpty(options);\n const labelProps = getReplyToFieldLabelProps({ popoverProps });\n\n if (isDropdownField) {\n return (\n <Select\n {...{ labelProps, options }}\n isClearable\n className=\"w-full\"\n data-testid=\"replyToOptions\"\n label={t(\"neetoMolecules.emailForm.labels.replyTo\")}\n name=\"replyTo\"\n onChange={data => setFieldValue(\"replyTo\", data?.value ?? \"\")}\n />\n );\n }\n\n return (\n <Input\n {...{ labelProps }}\n autoFocus\n required\n className=\"w-full\"\n data-testid=\"replyToInput\"\n label={t(\"neetoMolecules.emailForm.labels.replyTo\")}\n name=\"replyTo\"\n placeholder={t(\"neetoMolecules.emailForm.placeholders.emailPlaceholder\")}\n size=\"large\"\n onChange={event =>\n setFieldValue(\"replyTo\", event.target.value?.toLowerCase())\n }\n />\n );\n};\n\nexport default ReplyToField;\n","import { useTranslation } from \"react-i18next\";\n\nimport SendToFields from \"components/SendToFields\";\n\nconst SendToField = ({ showBccField, showCcField, showSendToTextField }) => {\n const { t } = useTranslation();\n\n if (!showSendToTextField && !showBccField && !showCcField) return null;\n\n return (\n <SendToFields\n showCcBccButton\n showBccField={showSendToTextField ? false : showBccField}\n showCcField={showSendToTextField ? false : showCcField}\n showSendToField={showSendToTextField}\n bccInputProps={{\n label: t(\"neetoMolecules.emailForm.labels.bCc\"),\n name: \"sendToBcc\",\n placeholder: t(\n \"neetoMolecules.emailForm.placeholders.commaSeparatedEmails\"\n ),\n }}\n ccInputProps={{\n label: t(\"neetoMolecules.emailForm.labels.cc\"),\n name: \"sendToCc\",\n placeholder: t(\n \"neetoMolecules.emailForm.placeholders.commaSeparatedEmails\"\n ),\n }}\n emailInputProps={{\n id: \"sendTo\",\n name: \"sendTo\",\n label: t(\"neetoMolecules.emailForm.labels.sendTo\"),\n placeholder: t(\n \"neetoMolecules.emailForm.placeholders.commaSeparatedEmails\"\n ),\n required: true,\n }}\n />\n );\n};\n\nexport default SendToField;\n","import { useState } from \"react\";\n\nimport { withEventTargetValue } from \"neetocommons/utils/general\";\nimport { Input, Typography } from \"neetoui\";\nimport { Trans, useTranslation } from \"react-i18next\";\n\nimport DynamicVariables from \"components/DynamicVariables\";\n\nconst SubjectField = ({\n name,\n text,\n updateText,\n subjectVariables = [],\n error,\n required = false,\n}) => {\n const [isFieldFocusedOnce, setIsFieldFocusedOnce] = useState(false);\n\n const { t } = useTranslation();\n\n const tagClickHandler = ({ key: slug }) => {\n const textAreaElement = document.querySelector(`textarea[name=${name}]`);\n const splitIndex =\n isFieldFocusedOnce && textAreaElement\n ? textAreaElement.selectionEnd\n : text.length;\n\n const updatedSubject = [\n text.slice(0, splitIndex),\n ` {{${slug}}}`,\n text.slice(splitIndex),\n ].join(\"\");\n updateText(updatedSubject);\n };\n\n return (\n <>\n <Input\n {...{ error, name, required }}\n label={t(\"neetoMolecules.emailForm.labels.subject\")}\n size=\"large\"\n value={text}\n suffix={\n <DynamicVariables\n variables={subjectVariables}\n dropdownProps={{\n className: \"neeto-ui-dropdown__popup overflow-y-auto\",\n buttonSize: \"small\",\n }}\n onVariableClick={tagClickHandler}\n />\n }\n onChange={withEventTargetValue(updateText)}\n onFocus={() => setIsFieldFocusedOnce(true)}\n />\n <Typography\n className=\"neeto-ui-text-gray-600 mt-2\"\n data-cy=\"subject-input-variable-label\"\n style=\"body3\"\n >\n <Trans\n components={{ span: <span className=\"font-semibold\" /> }}\n i18nKey=\"neetoMolecules.emailForm.helpText\"\n values={{ type: \"subject\" }}\n />\n </Typography>\n </>\n );\n};\n\nexport default SubjectField;\n","import { useContext } from \"react\";\n\nimport classnames from \"classnames\";\nimport { Field, useFormikContext } from \"formik\";\nimport { isNotEmpty } from \"neetocist\";\nimport { FormikEditor } from \"neetoeditor\";\nimport { Typography } from \"neetoui\";\nimport { ActionBlock, Radio } from \"neetoui/formik\";\nimport PropTypes from \"prop-types\";\nimport { Trans, useTranslation } from \"react-i18next\";\n\nimport { EDITOR_ADDONS } from \"./constants\";\nimport { EmailFormContext } from \"./contexts/EmailForm\";\nimport ReplyToField from \"./ReplyToField\";\nimport SendToField from \"./SendToField\";\nimport SubjectField from \"./SubjectField\";\n\nconst EmailForm = ({\n messageVariables = [],\n subjectVariables = [],\n handleCancel,\n isLoading,\n replyToFieldProps,\n sendToFieldProps,\n replyToOptions,\n sendToOptions = [],\n isUpdating = false,\n showFields = true,\n className = \"\",\n}) => {\n const { t } = useTranslation();\n\n const {\n showSendToField,\n showSendToAsRadio,\n showReplyToField,\n showCcField,\n showBccField,\n } = useContext(EmailFormContext);\n\n const { setFieldValue } = useFormikContext();\n\n const sendToFieldOptions = sendToFieldProps?.options || sendToOptions;\n const showSendToRadioField =\n showSendToField && showSendToAsRadio && isNotEmpty(sendToFieldOptions);\n\n const showSendToTextField = showSendToField && !showSendToRadioField;\n\n return (\n <div\n data-cy=\"email-form\"\n data-testid=\"email-form\"\n className={classnames(\"flex flex-1 flex-col items-start gap-2 !pb-0\", {\n [className]: className,\n })}\n >\n {showFields && (\n <div className=\"flex w-full flex-col items-start justify-start gap-6\">\n <Field name=\"subject\">\n {({ field: { value }, meta: { error } }) => (\n <div className=\"w-full\">\n <SubjectField\n {...{ subjectVariables }}\n required\n error={t(error)}\n name=\"subject\"\n text={value}\n updateText={text => setFieldValue(\"subject\", text)}\n />\n </div>\n )}\n </Field>\n {showSendToRadioField && (\n <Radio\n data-testid=\"send-to-id\"\n label={t(\"neetoMolecules.emailForm.labels.sendTo\")}\n labelProps={{ required: true }}\n name=\"sendToId\"\n >\n {sendToFieldOptions.map(({ label, value }) => (\n <Radio.Item {...{ label, value }} key={value} />\n ))}\n </Radio>\n )}\n <SendToField\n {...{ showBccField, showCcField, showSendToTextField }}\n />\n {showReplyToField && (\n <ReplyToField options={replyToOptions} {...replyToFieldProps} />\n )}\n <div className=\"w-full\">\n <FormikEditor\n required\n addons={EDITOR_ADDONS}\n data-cy=\"message-input-field\"\n id=\"form_message\"\n label={t(\"neetoMolecules.emailForm.labels.message\")}\n name=\"message\"\n variables={messageVariables}\n />\n <Typography\n className=\"neeto-ui-text-gray-500 mt-2\"\n data-cy=\"message-input-variable-label\"\n style=\"body3\"\n >\n <Trans\n i18nKey=\"neetoMolecules.emailForm.helpText\"\n values={{ type: \"message\" }}\n components={{\n span: <span className=\"font-semibold\" />,\n }}\n />\n </Typography>\n </div>\n </div>\n )}\n <ActionBlock\n cancelButtonProps={{ onClick: handleCancel }}\n className=\"neeto-ui-bg-white z-10 w-full justify-start py-6 lg:sticky lg:bottom-0\"\n isSubmitting={isLoading || isUpdating}\n />\n </div>\n );\n};\n\nEmailForm.propTypes = {\n /**\n * This is an array of objects used for templating within the message field. Each object in the array has a **label** and a **key**.\n */\n messageVariables: PropTypes.array,\n /**\n * This is an array of objects used for templating within the subject field. Each object in the array has a **label** and a **key**.\n */\n subjectVariables: PropTypes.array,\n /**\n * This function that gets triggered when the 'Cancel' button is clicked.\n */\n handleCancel: PropTypes.func,\n /**\n * This Boolean value, when set to true, triggers the display of a loading indicator on the 'Save changes' button.\"\n */\n isLoading: PropTypes.bool,\n /**\n * An array of objects, with each object having **label** and **value** properties. This prop transforms the 'Reply To' field into a dropdown menu with given options. Without this prop, 'Reply To' will be a text input field.\n */\n replyToOptions: PropTypes.array,\n /**\n * An array of objects, with each object having **label** and **value** properties. This prop transforms the 'Send To' field into a radio group with given options. Without this prop, 'Send To' will be a multi email input field.\n */\n sendToOptions: PropTypes.array,\n /**\n * A Boolean flag indicating whether an update operation is currently in progress. When set to `true`, the 'Save changes' button is disabled.\n */\n isUpdating: PropTypes.bool,\n /**\n * To provide additional classnames to the button.\n */\n className: PropTypes.string,\n /**\n * To provide props to the replyToField. Supports options that will\n * be rendered as the reply to options and popover props.\n */\n replyToFieldProps: PropTypes.object,\n /**\n * To provide props to the sendToField. Supports sendTo options.\n */\n sendToFieldProps: PropTypes.object,\n};\n\nexport default EmailForm;\n","import { noop } from \"neetocist\";\nimport { Form } from \"neetoui/formik\";\nimport PropTypes from \"prop-types\";\n\nimport { INITIAL_FORM_VALUES } from \"./constants\";\nimport { EmailFormContext } from \"./contexts/EmailForm\";\nimport { getValidationSchema } from \"./utils\";\n\nconst EmailFormProvider = ({\n onSubmit = noop,\n initialValues = INITIAL_FORM_VALUES,\n children,\n formikProps,\n validationSchema: customValidations = {},\n showSendToField = false,\n showReplyToField = false,\n showSendToAsRadio = false,\n showCcField = false,\n showBccField = false,\n maxEmails = 10,\n}) => (\n <div data-testid=\"email-form-provider\">\n <EmailFormContext.Provider\n value={{\n showSendToField,\n showSendToAsRadio,\n showReplyToField,\n showCcField,\n showBccField,\n }}\n >\n <Form\n formikProps={{\n enableReinitialize: true,\n validationSchema: getValidationSchema({\n showSendToField,\n showReplyToField,\n showSendToAsRadio,\n customValidations,\n maxEmails,\n }),\n initialValues: {\n ...initialValues,\n replyTo: initialValues.replyTo || globalProps.user.email,\n },\n onSubmit,\n ...formikProps,\n }}\n >\n {children}\n </Form>\n </EmailFormContext.Provider>\n </div>\n);\n\nEmailFormProvider.propTypes = {\n /**\n * A Boolean value that determines whether the '**sendTo**' field should be displayed or not.\n */\n showSendToField: PropTypes.bool,\n /**\n * A Boolean value that determines whether the '**replyTo**' field should be displayed or not.\n */\n showReplyToField: PropTypes.bool,\n /**\n * A Boolean value that determines whether the '**sendTo**' field should be radio type or not.\n */\n showSendToAsRadio: PropTypes.bool,\n /**\n * A function that will be triggered with input values when the 'Save changes' button is clicked.\n */\n onSubmit: PropTypes.func,\n /**\n * These are the predefined values that populate the form fields when the form is first rendered.\n */\n initialValues: PropTypes.shape({\n sendTo: PropTypes.array,\n sendToId: PropTypes.string,\n sendToCc: PropTypes.array,\n sendToBcc: PropTypes.array,\n replyTo: PropTypes.string,\n showCopyEmails: PropTypes.bool,\n subject: PropTypes.string,\n message: PropTypes.string,\n }),\n /**\n * A prop used for rendering either standard React element or a render prop function.\n */\n children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),\n /**\n * A prop that can be used to override the default Formik properties that are set within the component, providing customization flexibility.\n */\n formikProps: PropTypes.object,\n /**\n * A Yup object defining custom form validation rules, which will be merged with the default rules using the concat method.\n */\n validationSchema: PropTypes.object,\n /**\n * A prop to limit number of send to emails\n */\n maxEmails: PropTypes.number,\n /**\n * A Boolean value that determines whether the '**Cc**' field should be displayed or not when showSendToField is false.\n * This prop has no effect when showSendToField is true.\n */\n showCcField: PropTypes.bool,\n /**\n * A Boolean value that determines whether the '**Bcc**' field should be displayed or not when showSendToField is false.\n * This prop has no effect when showSendToField is true.\n */\n showBccField: PropTypes.bool,\n};\n\nexport default EmailFormProvider;\n"],"names":["INITIAL_FORM_VALUES","sendTo","sendToId","sendToCc","sendToBcc","replyTo","showCopyEmails","subject","message","EMAIL_FORM_VALIDATION_SCHEMA","yup","object","string","required","t","test","value","isEditorEmpty","sendToFieldValidation","maxEmails","validation","array","emails","every","prop","count","length","min","entity","nullable","SEND_TO_ID_FIELD_VALIDATION","REPLY_TO_FIELD_VALIDATION","email","EDITOR_ADDONS","EmailFormContext","createContext","showSendToField","showSendToAsRadio","showReplyToField","getValidationSchema","_ref","customValidations","schema","clone","concat","shape","getReplyToFieldLabelProps","_ref2","popoverProps","helpIconProps","_defineProperty","isPresent","content","touch","_objectSpread","appendTo","description","ReplyToField","_ref$options","options","_ref$popoverProps","_useTranslation","useTranslation","_useFormikContext","useFormikContext","setFieldValue","isDropdownField","isNotEmpty","labelProps","_jsx","Select","isClearable","className","label","name","onChange","data","_data$value","Input","autoFocus","placeholder","size","event","_event$target$value","target","toLowerCase","SendToField","showBccField","showCcField","showSendToTextField","SendToFields","showCcBccButton","bccInputProps","ccInputProps","emailInputProps","id","SubjectField","text","updateText","_ref$subjectVariables","subjectVariables","error","_ref$required","_useState","useState","_useState2","_slicedToArray","isFieldFocusedOnce","setIsFieldFocusedOnce","tagClickHandler","slug","key","textAreaElement","document","querySelector","splitIndex","selectionEnd","updatedSubject","slice","join","_jsxs","_Fragment","children","suffix","DynamicVariables","variables","dropdownProps","buttonSize","onVariableClick","withEventTargetValue","onFocus","Typography","style","Trans","components","span","i18nKey","values","type","EmailForm","_ref$messageVariables","messageVariables","handleCancel","isLoading","replyToFieldProps","sendToFieldProps","replyToOptions","_ref$sendToOptions","sendToOptions","_ref$isUpdating","isUpdating","_ref$showFields","showFields","_ref$className","_useContext","useContext","sendToFieldOptions","showSendToRadioField","classnames","Field","field","meta","Radio","map","_ref3","_createElement","Item","FormikEditor","addons","ActionBlock","cancelButtonProps","onClick","isSubmitting","EmailFormProvider","_ref$onSubmit","onSubmit","noop","_ref$initialValues","initialValues","formikProps","_ref$validationSchema","validationSchema","_ref$showSendToField","_ref$showReplyToField","_ref$showSendToAsRadi","_ref$showCcField","_ref$showBccField","_ref$maxEmails","Provider","Form","enableReinitialize","globalProps","user"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,IAAMA,mBAAmB,GAAG;AACjCC,EAAAA,MAAM,EAAE,EAAE;AACVC,EAAAA,QAAQ,EAAE,EAAE;AACZC,EAAAA,QAAQ,EAAE,EAAE;AACZC,EAAAA,SAAS,EAAE,EAAE;AACbC,EAAAA,OAAO,EAAE,EAAE;AACXC,EAAAA,cAAc,EAAE,KAAK;AACrBC,EAAAA,OAAO,EAAE,EAAE;AACXC,EAAAA,OAAO,EAAE,EAAA;AACX,CAAC,CAAA;AAEM,IAAMC,4BAA4B,GAAGC,GAAG,CAACC,MAAM,CAAC;AACrDJ,EAAAA,OAAO,EAAEG,GAAG,CACTE,MAAM,EAAE,CACRC,QAAQ,CAACC,CAAC,CAAC,iDAAiD,CAAC,CAAC;AACjEN,EAAAA,OAAO,EAAEE,GAAG,CACTE,MAAM,EAAE,CACRG,IAAI,CACH,SAAS,EACTD,CAAC,CAAC,iDAAiD,CAAC,EACpD,UAAAE,KAAK,EAAA;AAAA,IAAA,OAAI,CAACC,aAAa,CAACD,KAAK,CAAC,CAAA;GAChC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEK,IAAME,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAGC,SAAS,EAAI;AAChD,EA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B;AAChBD,YAAAA,iBAAiB,EAAjBA,iBAAiB;AACjBI,YAAAA,iBAAiB,EAAjBA,iBAAiB;AACjBtB,YAAAA,SAAS,EAATA,SAAAA;AACF,WAAC,CAAC;AACF+J,UAAAA,aAAa,EAAA5H,aAAA,CAAAA,aAAA,KACR4H,aAAa,CAAA,EAAA,EAAA,EAAA;YAChB7K,OAAO,EAAE6K,aAAa,CAAC7K,OAAO,IAAI0L,WAAW,CAACC,IAAI,CAAChK,KAAAA;WACpD,CAAA;AACD+I,UAAAA,QAAQ,EAARA,QAAAA;AAAQ,SAAA,EACLI,WAAW,CACd;AAAAzD,QAAAA,QAAA,EAEDA,QAAAA;OACG,CAAA;KACmB,CAAA;AAAC,GACzB,CAAC,CAAA;AAAA;;;;"}
@@ -21,10 +21,14 @@ import { n } from './inject-css-DmrvuTKK.js';
21
21
  import Neeto from '@bigbinary/neeto-icons/typeface-logos/Neeto';
22
22
  import * as AppIcons from '@bigbinary/neeto-icons/typeface-logos';
23
23
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
24
- import { toLower, omit, prop, mergeDeepLeft } from 'ramda';
24
+ import { toLower, omit, mergeDeepLeft } from 'ramda';
25
25
  import { t } from 'i18next';
26
26
  import Book from '@bigbinary/neeto-icons/Book';
27
+ import { globalProps as globalProps$1 } from '@bigbinary/neeto-commons-frontend/initializers';
27
28
  import useBreakpoints from '@bigbinary/neeto-commons-frontend/react-utils/useBreakpoints';
29
+ import ExternalLink from '@bigbinary/neeto-icons/ExternalLink';
30
+ import { useQuery } from '@tanstack/react-query';
31
+ import axios from 'axios';
28
32
  import Right from '@bigbinary/neeto-icons/Right';
29
33
  import Spinner from '@bigbinary/neetoui/Spinner';
30
34
  import useLocalStorage from '@bigbinary/neeto-commons-frontend/react-utils/useLocalStorage';
@@ -83,7 +87,7 @@ var ProductLink$1 = /*#__PURE__*/memo(ProductLink);
83
87
 
84
88
  function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
85
89
  function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
86
- var Menu$1 = function Menu(_ref) {
90
+ var Menu$3 = function Menu(_ref) {
87
91
  var _ref$isMobile = _ref.isMobile,
88
92
  isMobile = _ref$isMobile === void 0 ? false : _ref$isMobile;
89
93
  var _useTranslation = useTranslation(),
@@ -163,7 +167,7 @@ var Modal = withT(function (_ref) {
163
167
  children: /*#__PURE__*/jsx("div", {
164
168
  className: "neeto-molecules-product-switcher_modal-container",
165
169
  "data-testid": "product-switcher-modal",
166
- children: /*#__PURE__*/jsx(Menu$1, {
170
+ children: /*#__PURE__*/jsx(Menu$3, {
167
171
  isMobile: true
168
172
  })
169
173
  })
@@ -253,6 +257,104 @@ var LinkSection = function LinkSection(_ref) {
253
257
  });
254
258
  };
255
259
 
260
+ var fetch = function fetch(email) {
261
+ return axios.get("/logged_in_organizations", {
262
+ params: {
263
+ email: email
264
+ }
265
+ });
266
+ };
267
+ var loggedInOrganizationsApi = {
268
+ fetch: fetch
269
+ };
270
+
271
+ var QUERY_KEYS = {
272
+ LOGGED_IN_ORGANIZATIONS_LIST: "logged-in-organizations-list"
273
+ };
274
+
275
+ var LOGGED_IN_ORGANIZATIONS_LIST = QUERY_KEYS.LOGGED_IN_ORGANIZATIONS_LIST;
276
+ var useFetchLoggedInOrganizations = function useFetchLoggedInOrganizations(email) {
277
+ return useQuery({
278
+ queryKey: [LOGGED_IN_ORGANIZATIONS_LIST],
279
+ queryFn: function queryFn() {
280
+ return loggedInOrganizationsApi.fetch(email);
281
+ }
282
+ });
283
+ };
284
+
285
+ var MenuItem$4 = Dropdown$1.MenuItem;
286
+ var MenuButton$2 = withT(function (_ref) {
287
+ var t = _ref.t;
288
+ return /*#__PURE__*/jsx(MenuItem$4.Button, {
289
+ className: "neeto-molecules-menu-sublist__item-btn",
290
+ "data-cy": "organization-switcher-button",
291
+ "data-testid": "organization-switcher-button",
292
+ style: "text",
293
+ suffix: /*#__PURE__*/jsx(Right, {
294
+ size: 18
295
+ }),
296
+ children: t("neetoMolecules.sidebar.organizationSwitcher.label")
297
+ });
298
+ });
299
+
300
+ var Menu$2 = Dropdown$1.Menu,
301
+ MenuItem$3 = Dropdown$1.MenuItem;
302
+ var OrganizationSwitcher = function OrganizationSwitcher() {
303
+ var _globalProps$user;
304
+ var _useTranslation = useTranslation(),
305
+ t = _useTranslation.t;
306
+ var _useBreakpoints = useBreakpoints(),
307
+ isSize = _useBreakpoints.isSize;
308
+ var _useFetchLoggedInOrga = useFetchLoggedInOrganizations(globalProps$1 === null || globalProps$1 === void 0 ? void 0 : (_globalProps$user = globalProps$1.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.email),
309
+ _useFetchLoggedInOrga2 = _useFetchLoggedInOrga.data,
310
+ _useFetchLoggedInOrga3 = _useFetchLoggedInOrga2 === void 0 ? {} : _useFetchLoggedInOrga2,
311
+ organizations = _useFetchLoggedInOrga3.organizations,
312
+ authAppUrl = _useFetchLoggedInOrga3.authAppUrl;
313
+ var isMobile = isSize("mobile");
314
+ var isCurrentSubdomain = function isCurrentSubdomain(link) {
315
+ var currentSubdomain = window.location.hostname.split(".")[0];
316
+ var linkSubdomain = new URL(link).hostname.split(".")[0];
317
+ return currentSubdomain === linkSubdomain;
318
+ };
319
+ return /*#__PURE__*/jsx(Dropdown$1, {
320
+ className: "neeto-molecules-theme-switcher-menu-popup-wrapper",
321
+ closeOnSelect: false,
322
+ customTarget: /*#__PURE__*/jsx(MenuButton$2, {}),
323
+ interactiveDebounce: 30,
324
+ offset: [0, 5],
325
+ position: isMobile ? "bottom" : "right",
326
+ trigger: "all",
327
+ zIndex: 99999,
328
+ children: /*#__PURE__*/jsxs(Menu$2, {
329
+ children: [organizations === null || organizations === void 0 ? void 0 : organizations.map(function (organization) {
330
+ return /*#__PURE__*/jsxs(MenuItem$3.Button, {
331
+ href: organization.organizationUrl,
332
+ rel: "noreferrer",
333
+ style: "text",
334
+ suffix: /*#__PURE__*/jsx(ExternalLink, {
335
+ size: 18
336
+ }),
337
+ target: "_blank",
338
+ className: classnames({
339
+ "neeto-molecules-organization-switcher-active-button": isCurrentSubdomain(organization.organizationUrl)
340
+ }),
341
+ children: [/*#__PURE__*/jsx(Avatar, {
342
+ user: {
343
+ name: organization.userName,
344
+ imageUrl: organization.userImageUrl
345
+ }
346
+ }), organization.orgName]
347
+ }, organization.userId);
348
+ }), /*#__PURE__*/jsx(MenuItem$3.Button, {
349
+ href: authAppUrl,
350
+ rel: "noreferrer",
351
+ target: "_blank",
352
+ children: t("neetoMolecules.sidebar.organizationSwitcher.addAccount")
353
+ })]
354
+ })
355
+ });
356
+ };
357
+
256
358
  var _excluded$1 = ["isLoading", "onMouseEnter"];
257
359
  function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
258
360
  function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -278,9 +380,9 @@ var MenuButton$1 = function MenuButton(_ref) {
278
380
  }));
279
381
  };
280
382
 
383
+ var Menu$1 = Dropdown$1.Menu,
384
+ MenuItem$2 = Dropdown$1.MenuItem;
281
385
  var Dropdown = function Dropdown() {
282
- var Menu = Dropdown$1.Menu,
283
- MenuItem = Dropdown$1.MenuItem;
284
386
  var _useFetchNeetoApps = useFetchNeetoApps(),
285
387
  data = _useFetchNeetoApps.data,
286
388
  isLoading = _useFetchNeetoApps.isLoading,
@@ -291,6 +393,7 @@ var Dropdown = function Dropdown() {
291
393
  refetchNeetoApps();
292
394
  };
293
395
  return /*#__PURE__*/jsx(Dropdown$1, {
396
+ appendTo: "parent",
294
397
  className: "neeto-molecules-product-switcher-menu-popup-wrapper",
295
398
  closeOnSelect: false,
296
399
  customTarget: /*#__PURE__*/jsx(MenuButton$1, {
@@ -307,9 +410,9 @@ var Dropdown = function Dropdown() {
307
410
  dropdownProps: {
308
411
  classNames: "neeto-molecules-product-switcher-menu-popup__dropdown"
309
412
  },
310
- children: /*#__PURE__*/jsx(Menu, {
311
- children: /*#__PURE__*/jsx(MenuItem, {
312
- children: /*#__PURE__*/jsx(Menu$1, {})
413
+ children: /*#__PURE__*/jsx(Menu$1, {
414
+ children: /*#__PURE__*/jsx(MenuItem$2, {
415
+ children: /*#__PURE__*/jsx(Menu$3, {})
313
416
  })
314
417
  })
315
418
  });
@@ -369,22 +472,25 @@ var getSidebarStateLocalStorageKey = function getSidebarStateLocalStorageKey() {
369
472
  return "sidebarState-".concat(user);
370
473
  };
371
474
  var getDefaultTopLinks = function getDefaultTopLinks(isOwner, setIsProfilePaneOpen, isAuthenticated) {
372
- return [{
475
+ if (!isAuthenticated) return [];
476
+ var topLinks = [{
373
477
  label: t("neetoMolecules.sidebar.myProfile"),
374
478
  onClick: function onClick() {
375
479
  return setIsProfilePaneOpen(true);
376
480
  },
377
481
  "data-cy": "my-profile-button",
378
- "data-testid": "my-profile-button",
379
- isEnabled: isAuthenticated
380
- }, {
381
- label: t("neetoMolecules.sidebar.myWorkspace"),
382
- onClick: function onClick() {
383
- return window.open(MY_ORGANIZATION_URL, "_self");
384
- },
385
- "data-cy": "profile-organization-settings-button",
386
- isEnabled: isAuthenticated && isOwner
387
- }].filter(prop("isEnabled"));
482
+ "data-testid": "my-profile-button"
483
+ }];
484
+ if (isOwner) {
485
+ topLinks.push({
486
+ label: t("neetoMolecules.sidebar.myWorkspace"),
487
+ onClick: function onClick() {
488
+ return window.open(MY_ORGANIZATION_URL, "_self");
489
+ },
490
+ "data-cy": "profile-organization-settings-button"
491
+ });
492
+ }
493
+ return topLinks;
388
494
  };
389
495
  var getDefaultBottomLinks = function getDefaultBottomLinks(isAuthenticated) {
390
496
  return [isAuthenticated ? {
@@ -466,6 +572,7 @@ var ThemeSwitcher = function ThemeSwitcher() {
466
572
  setAppTheme(theme);
467
573
  };
468
574
  return /*#__PURE__*/jsx(Dropdown$1, {
575
+ appendTo: "parent",
469
576
  className: "neeto-molecules-theme-switcher-menu-popup-wrapper",
470
577
  closeOnSelect: false,
471
578
  customTarget: /*#__PURE__*/jsx(MenuButton, {
@@ -513,7 +620,8 @@ var ProfileMenu = function ProfileMenu(_ref) {
513
620
  bottomLinks = _ref.bottomLinks,
514
621
  customContent = _ref.customContent,
515
622
  toggleModal = _ref.toggleModal,
516
- isThemeSwitcherEnabled = _ref.isThemeSwitcherEnabled;
623
+ isThemeSwitcherEnabled = _ref.isThemeSwitcherEnabled,
624
+ isOrganizationSwitcherEnabled = _ref.isOrganizationSwitcherEnabled;
517
625
  var Menu = Dropdown$1.Menu,
518
626
  MenuItem = Dropdown$1.MenuItem,
519
627
  Divider = Dropdown$1.Divider;
@@ -529,7 +637,7 @@ var ProfileMenu = function ProfileMenu(_ref) {
529
637
  })
530
638
  }), showProductSwitcher && /*#__PURE__*/jsx(ProductSwitcher, {
531
639
  toggleModal: toggleModal
532
- }), isThemeSwitcherEnabled && /*#__PURE__*/jsx(ThemeSwitcher, {}), isNotEmpty(topLinks) && /*#__PURE__*/jsxs(Fragment, {
640
+ }), isOrganizationSwitcherEnabled && /*#__PURE__*/jsx(OrganizationSwitcher, {}), isThemeSwitcherEnabled && /*#__PURE__*/jsx(ThemeSwitcher, {}), isNotEmpty(topLinks) && /*#__PURE__*/jsxs(Fragment, {
533
641
  children: [/*#__PURE__*/jsx(Divider, {}), /*#__PURE__*/jsx(LinkSection, {
534
642
  links: topLinks
535
643
  })]
@@ -557,7 +665,8 @@ var ProfileButton = function ProfileButton(_ref) {
557
665
  bottomLinks = _ref.bottomLinks,
558
666
  topLinks = _ref.topLinks,
559
667
  customContent = _ref.customContent,
560
- isThemeSwitcherEnabled = _ref.isThemeSwitcherEnabled;
668
+ isThemeSwitcherEnabled = _ref.isThemeSwitcherEnabled,
669
+ isOrganizationSwitcherEnabled = _ref.isOrganizationSwitcherEnabled;
561
670
  var _useState = useState(false),
562
671
  _useState2 = _slicedToArray(_useState, 2),
563
672
  isModalOpen = _useState2[0],
@@ -620,14 +729,11 @@ var ProfileButton = function ProfileButton(_ref) {
620
729
  });
621
730
  return /*#__PURE__*/jsxs(Fragment, {
622
731
  children: [/*#__PURE__*/jsx(Profile.Pane, {}), /*#__PURE__*/jsx(Dropdown$1, {
623
- isMultiLevel: true,
624
732
  appendTo: function appendTo() {
625
733
  return document.body;
626
734
  },
627
735
  buttonStyle: "link",
628
736
  closeOnSelect: false,
629
- "data-cy": "floating-action-button",
630
- "data-testid": "floating-action-button",
631
737
  icon: noop,
632
738
  interactiveDebounce: 30,
633
739
  offset: [15, 10],
@@ -659,6 +765,7 @@ var ProfileButton = function ProfileButton(_ref) {
659
765
  customContent: customContent,
660
766
  defaultLinks: defaultLinks,
661
767
  helpLinks: helpLinks,
768
+ isOrganizationSwitcherEnabled: isOrganizationSwitcherEnabled,
662
769
  isThemeSwitcherEnabled: isThemeSwitcherEnabled,
663
770
  profileInfo: profileInfo,
664
771
  showProductSwitcher: showProductSwitcher,
@@ -680,10 +787,10 @@ var ProfileButton = function ProfileButton(_ref) {
680
787
  });
681
788
  };
682
789
 
683
- var css = ":root{--neeto-molecules-floating-menu-z-index:99999}.neeto-molecules-floating-action-menu__container{background-color:rgb(var(--neeto-ui-white));border:1px solid rgb(var(--neeto-ui-white));border-bottom-right-radius:17px;border-left:none;border-top-right-radius:17px;bottom:16px;left:0;position:fixed;z-index:99999;z-index:var(--neeto-molecules-floating-menu-z-index)}.neeto-molecules-floating-action-button{align-items:center;background-color:rgb(var(--neeto-ui-primary-500));border-bottom-right-radius:16px;border-color:rgb(var(--neeto-ui-primary-500));border-top-right-radius:16px;display:flex;flex-direction:column;gap:6px;justify-content:center;padding:4px}.neeto-molecules-floating-action-button__help-icon{align-items:center;background-color:#fff;border-radius:100px;display:flex;height:26px;justify-content:center;width:26px}.neeto-molecules-floating-action-button__profile-avatar{--neeto-ui-avatar-container-width:26px;--neeto-ui-avatar-container-height:26px;border:2px solid #fff;border-radius:100px}.neeto-molecules-floating-action-button__profile-avatar>div{height:100%;width:100%}.neeto-molecules-floating-action-button__profile-avatar .neeto-ui-avatar{height:100%!important;width:100%!important}.neeto-molecules-floating-action-button__dropdown{flex-shrink:0;max-height:none!important;max-width:none;width:256px;z-index:99999;z-index:var(--neeto-molecules-floating-menu-z-index)}.neeto-molecules-floating-action-button__dropdown ul{padding-top:0!important}.neeto-molecules-product-switcher-menu-popup__dropdown{max-height:none!important;max-width:none}.neeto-molecules-menu__notif-count{border:1px solid #fff;height:15px;min-width:15px;pointer-events:none;position:absolute;right:0;top:0;z-index:3}.neeto-molecules-menu-list__item-btn-count,.neeto-molecules-menu__notif-count{align-items:center;background-color:rgb(var(--neeto-ui-accent-500));border-radius:var(--neeto-ui-rounded-full);color:rgb(var(--neeto-ui-white));display:flex;flex-shrink:0;font-size:var(--neeto-ui-text-xxs);justify-content:center;padding-left:4px;padding-right:4px;-webkit-user-select:none;-moz-user-select:none;user-select:none}.neeto-molecules-menu-list__item-btn-count{height:18px;min-width:18px}.neeto-ui-dropdown__popup .neeto-molecules-product-switcher-menu-popup-wrapper{border:1px solid rgb(var(--neeto-ui-gray-400));border-radius:var(--neeto-ui-rounded)!important;min-width:240px}.neeto-ui-dropdown__popup .neeto-molecules-product-switcher-menu-popup-wrapper .tippy-content{padding:0}.neeto-ui-dropdown__popup .neeto-molecules-product-switcher-menu-popup-wrapper .tippy-svg-arrow{display:none!important}.neeto-molecules-profile-popup__top-section{border-top-left-radius:var(--neeto-ui-rounded);border-top-right-radius:var(--neeto-ui-rounded)}.neeto-molecules-menu-sublist__item-btn{font-weight:500!important;height:40px}.neeto-molecules-menu-sublist__item-btn[data-btn-weight=bold]{font-weight:700!important}.neeto-molecules-menu-sublist__item-btn.active{background-color:rgb(var(--neeto-ui-gray-800));color:rgb(var(--neeto-ui-white))}.neeto-molecules-menu-sublist__item-btn-icon svg path{vector-effect:non-scaling-stroke}.neeto-molecules-menu-sublist__item-btn span{align-items:center;display:flex;gap:8px}.neeto-molecules-product-switcher-menu-popup-wrapper{height:95vh;overflow-y:auto;width:calc(100vw - 400px)}.neeto-molecules-floating-action-button__profile-wrapper-custom-content:hover{background-color:rgb(var(--neeto-ui-white))!important}.neeto-molecules-theme-switcher-menu-popup-wrapper .neeto-ui-dropdown__popup-menu{padding-top:4px!important}.neeto-molecules-theme-switcher-active-button{color:rgb(var(--neeto-ui-success-600))!important}";
790
+ var css = ":root{--neeto-molecules-floating-menu-z-index:99999}.neeto-molecules-floating-action-menu__container{background-color:rgb(var(--neeto-ui-white));border:1px solid rgb(var(--neeto-ui-white));border-bottom-right-radius:17px;border-left:none;border-top-right-radius:17px;bottom:16px;left:0;position:fixed;z-index:99999;z-index:var(--neeto-molecules-floating-menu-z-index)}.neeto-molecules-floating-action-button{align-items:center;background-color:rgb(var(--neeto-ui-primary-500));border-bottom-right-radius:16px;border-color:rgb(var(--neeto-ui-primary-500));border-top-right-radius:16px;display:flex;flex-direction:column;gap:6px;justify-content:center;padding:4px}.neeto-molecules-floating-action-button__help-icon{align-items:center;background-color:#fff;border-radius:100px;display:flex;height:26px;justify-content:center;width:26px}.neeto-molecules-floating-action-button__profile-avatar{--neeto-ui-avatar-container-width:26px;--neeto-ui-avatar-container-height:26px;border:2px solid #fff;border-radius:100px}.neeto-molecules-floating-action-button__profile-avatar>div{height:100%;width:100%}.neeto-molecules-floating-action-button__profile-avatar .neeto-ui-avatar{height:100%!important;width:100%!important}.neeto-molecules-floating-action-button__dropdown{flex-shrink:0;max-height:none!important;max-width:none;width:256px;z-index:99999;z-index:var(--neeto-molecules-floating-menu-z-index)}.neeto-molecules-floating-action-button__dropdown ul{padding-top:0!important}.neeto-molecules-product-switcher-menu-popup__dropdown{max-height:none!important;max-width:none}.neeto-molecules-menu__notif-count{border:1px solid #fff;height:15px;min-width:15px;pointer-events:none;position:absolute;right:0;top:0;z-index:3}.neeto-molecules-menu-list__item-btn-count,.neeto-molecules-menu__notif-count{align-items:center;background-color:rgb(var(--neeto-ui-accent-500));border-radius:var(--neeto-ui-rounded-full);color:rgb(var(--neeto-ui-white));display:flex;flex-shrink:0;font-size:var(--neeto-ui-text-xxs);justify-content:center;padding-left:4px;padding-right:4px;-webkit-user-select:none;-moz-user-select:none;user-select:none}.neeto-molecules-menu-list__item-btn-count{height:18px;min-width:18px}.neeto-ui-dropdown__popup .neeto-molecules-product-switcher-menu-popup-wrapper{border:1px solid rgb(var(--neeto-ui-gray-400));border-radius:var(--neeto-ui-rounded)!important;min-width:240px}.neeto-ui-dropdown__popup .neeto-molecules-product-switcher-menu-popup-wrapper .tippy-content{padding:0}.neeto-ui-dropdown__popup .neeto-molecules-product-switcher-menu-popup-wrapper .tippy-svg-arrow{display:none!important}.neeto-molecules-profile-popup__top-section{border-top-left-radius:var(--neeto-ui-rounded);border-top-right-radius:var(--neeto-ui-rounded)}.neeto-molecules-menu-sublist__item-btn{font-weight:500!important;height:40px}.neeto-molecules-menu-sublist__item-btn[data-btn-weight=bold]{font-weight:700!important}.neeto-molecules-menu-sublist__item-btn.active{background-color:rgb(var(--neeto-ui-gray-800));color:rgb(var(--neeto-ui-white))}.neeto-molecules-menu-sublist__item-btn-icon svg path{vector-effect:non-scaling-stroke}.neeto-molecules-menu-sublist__item-btn span{align-items:center;display:flex;gap:8px}.neeto-molecules-product-switcher-menu-popup-wrapper{height:95vh;overflow-y:auto;width:calc(100vw - 400px)}.neeto-molecules-floating-action-button__profile-wrapper-custom-content:hover{background-color:rgb(var(--neeto-ui-white))!important}.neeto-molecules-theme-switcher-menu-popup-wrapper .neeto-ui-dropdown__popup-menu{padding-top:4px!important}.neeto-molecules-organization-switcher-active-button,.neeto-molecules-theme-switcher-active-button{color:rgb(var(--neeto-ui-success-600))!important}";
684
791
  n(css,{});
685
792
 
686
- var _excluded = ["profileInfoOverrides", "helpLinkOverrides", "topLinks", "bottomLinks", "showProductSwitcher", "isThemeSwitcherEnabled", "customContent"];
793
+ var _excluded = ["profileInfoOverrides", "helpLinkOverrides", "topLinks", "bottomLinks", "showProductSwitcher", "isThemeSwitcherEnabled", "isOrganizationSwitcherEnabled", "customContent"];
687
794
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
688
795
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
689
796
  var FloatingActionMenu = /*#__PURE__*/forwardRef(function (_ref, ref) {
@@ -699,6 +806,8 @@ var FloatingActionMenu = /*#__PURE__*/forwardRef(function (_ref, ref) {
699
806
  showProductSwitcher = _ref$showProductSwitc === void 0 ? true : _ref$showProductSwitc,
700
807
  _ref$isThemeSwitcherE = _ref.isThemeSwitcherEnabled,
701
808
  isThemeSwitcherEnabled = _ref$isThemeSwitcherE === void 0 ? false : _ref$isThemeSwitcherE,
809
+ _ref$isOrganizationSw = _ref.isOrganizationSwitcherEnabled,
810
+ isOrganizationSwitcherEnabled = _ref$isOrganizationSw === void 0 ? false : _ref$isOrganizationSw,
702
811
  customContent = _ref.customContent,
703
812
  otherProps = _objectWithoutProperties(_ref, _excluded);
704
813
  useEffect(function () {
@@ -714,6 +823,7 @@ var FloatingActionMenu = /*#__PURE__*/forwardRef(function (_ref, ref) {
714
823
  bottomLinks: bottomLinks,
715
824
  customContent: customContent,
716
825
  helpLinkOverrides: helpLinkOverrides,
826
+ isOrganizationSwitcherEnabled: isOrganizationSwitcherEnabled,
717
827
  isThemeSwitcherEnabled: isThemeSwitcherEnabled,
718
828
  profileInfoOverrides: profileInfoOverrides,
719
829
  showProductSwitcher: showProductSwitcher,