@bigbinary/neeto-molecules 1.1.16 → 1.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AutoSaveInput.js +658 -0
- package/dist/AutoSaveInput.js.map +1 -0
- package/dist/Breadcrumbs.js +38 -0
- package/dist/Breadcrumbs.js.map +1 -0
- package/dist/BrowserSupport.js +418 -0
- package/dist/BrowserSupport.js.map +1 -0
- package/dist/Builder.js +662 -0
- package/dist/Builder.js.map +1 -0
- package/dist/CalendarView.js +538 -0
- package/dist/CalendarView.js.map +1 -0
- package/dist/Codeblock.js +236 -0
- package/dist/Codeblock.js.map +1 -0
- package/dist/{Columns/index.js → Columns.js} +130 -13
- package/dist/Columns.js.map +1 -0
- package/dist/{ConfirmationModal/index.js → ConfirmationModal.js} +20 -8
- package/dist/ConfirmationModal.js.map +1 -0
- package/dist/Container.js +1211 -0
- package/dist/Container.js.map +1 -0
- package/dist/CopyToClipboardButton.js +209 -0
- package/dist/CopyToClipboardButton.js.map +1 -0
- package/dist/CustomDomain.js +688 -0
- package/dist/CustomDomain.js.map +1 -0
- package/dist/CustomDomainDashboard.js +2283 -0
- package/dist/CustomDomainDashboard.js.map +1 -0
- package/dist/{DateFormat/index.js → DateFormat.js} +25 -8
- package/dist/DateFormat.js.map +1 -0
- package/dist/DateRangeFilter.js +229 -0
- package/dist/DateRangeFilter.js.map +1 -0
- package/dist/DynamicVariables.js +183 -0
- package/dist/DynamicVariables.js.map +1 -0
- package/dist/EmailForm.js +2292 -0
- package/dist/EmailForm.js.map +1 -0
- package/dist/EmailPreview.js +1353 -0
- package/dist/EmailPreview.js.map +1 -0
- package/dist/{ErrorPage/constants.js → ErrorPage.js} +137 -36
- package/dist/ErrorPage.js.map +1 -0
- package/dist/Header.js +122 -0
- package/dist/Header.js.map +1 -0
- package/dist/IconPicker.js +313 -0
- package/dist/IconPicker.js.map +1 -0
- package/dist/ImageWithFallback.js +181 -0
- package/dist/ImageWithFallback.js.map +1 -0
- package/dist/IntegrationCard.js +343 -0
- package/dist/IntegrationCard.js.map +1 -0
- package/dist/IntegrationDisconnectAlert.js +80 -0
- package/dist/IntegrationDisconnectAlert.js.map +1 -0
- package/dist/{IntegrationWalkthroughModal/index.js → IntegrationWalkthroughModal.js} +8 -6
- package/dist/IntegrationWalkthroughModal.js.map +1 -0
- package/dist/IpRestriction.js +857 -0
- package/dist/IpRestriction.js.map +1 -0
- package/dist/KeyboardShortcuts.js +359 -0
- package/dist/KeyboardShortcuts.js.map +1 -0
- package/dist/LoginPage.js +593 -0
- package/dist/LoginPage.js.map +1 -0
- package/dist/MenuBar.js +1461 -0
- package/dist/MenuBar.js.map +1 -0
- package/dist/Metadata.js +206 -0
- package/dist/Metadata.js.map +1 -0
- package/dist/{MoreDropdown/index.js → MoreDropdown.js} +102 -9
- package/dist/MoreDropdown.js.map +1 -0
- package/dist/NavigationHeader.js +690 -0
- package/dist/NavigationHeader.js.map +1 -0
- package/dist/NeetoWidget.js +1333 -0
- package/dist/NeetoWidget.js.map +1 -0
- package/dist/PageLoader.js +134 -0
- package/dist/PageLoader.js.map +1 -0
- package/dist/PhoneNumber.js +365 -0
- package/dist/PhoneNumber.js.map +1 -0
- package/dist/PublishBlock.js +158 -0
- package/dist/PublishBlock.js.map +1 -0
- package/dist/Rename.js +450 -0
- package/dist/Rename.js.map +1 -0
- package/dist/ResponsiveDevicePicker.js +194 -0
- package/dist/ResponsiveDevicePicker.js.map +1 -0
- package/dist/Schedule.js +1046 -0
- package/dist/Schedule.js.map +1 -0
- package/dist/Scrollable.js +122 -0
- package/dist/Scrollable.js.map +1 -0
- package/dist/Search.js +151 -0
- package/dist/Search.js.map +1 -0
- package/dist/Security.js +1835 -0
- package/dist/Security.js.map +1 -0
- package/dist/SendToFields.js +601 -0
- package/dist/SendToFields.js.map +1 -0
- package/dist/Settings.js +435 -0
- package/dist/Settings.js.map +1 -0
- package/dist/ShareViaEmail.js +2277 -0
- package/dist/ShareViaEmail.js.map +1 -0
- package/dist/ShareViaLink.js +628 -0
- package/dist/ShareViaLink.js.map +1 -0
- package/dist/Sidebar.js +972 -0
- package/dist/Sidebar.js.map +1 -0
- package/dist/SubHeader.js +216 -0
- package/dist/SubHeader.js.map +1 -0
- package/dist/{TableWrapper/index.js → TableWrapper.js} +6 -3
- package/dist/TableWrapper.js.map +1 -0
- package/dist/ThemeSidebar.js +1984 -0
- package/dist/ThemeSidebar.js.map +1 -0
- package/dist/TimeFormat.js +47 -0
- package/dist/TimeFormat.js.map +1 -0
- package/dist/TimezoneMismatchModal.js +168 -0
- package/dist/TimezoneMismatchModal.js.map +1 -0
- package/dist/ToggleFeatureCard.js +323 -0
- package/dist/ToggleFeatureCard.js.map +1 -0
- package/package.json +22 -13
- package/dist/AutoSaveInput/autosaveinput.scss +0 -15
- package/dist/AutoSaveInput/constants.js +0 -13
- package/dist/AutoSaveInput/index.js +0 -124
- package/dist/AutoSaveInput/utils.js +0 -10
- package/dist/Breadcrumbs/breadcrumbs.scss +0 -33
- package/dist/Breadcrumbs/index.js +0 -31
- package/dist/BrowserSupport/Callout.js +0 -15
- package/dist/BrowserSupport/ContactUs.js +0 -21
- package/dist/BrowserSupport/DownloadLink.js +0 -17
- package/dist/BrowserSupport/PartialSupportedBrowserVersion.js +0 -17
- package/dist/BrowserSupport/UnknownBrowser.js +0 -13
- package/dist/BrowserSupport/UnsupportedBrowser.js +0 -24
- package/dist/BrowserSupport/UnsupportedBrowserMessage.js +0 -22
- package/dist/BrowserSupport/UnsupportedBrowserVersion.js +0 -27
- package/dist/BrowserSupport/UnsupportedVersionMessage.js +0 -30
- package/dist/BrowserSupport/browsersupport.scss +0 -71
- package/dist/BrowserSupport/constants.js +0 -63
- package/dist/BrowserSupport/index.js +0 -58
- package/dist/BrowserSupport/utils.js +0 -32
- package/dist/Builder/Body.js +0 -9
- package/dist/Builder/ElementsPanel/ElementsList/Element.js +0 -27
- package/dist/Builder/ElementsPanel/ElementsList/Section.js +0 -28
- package/dist/Builder/ElementsPanel/ElementsList/TitleBar.js +0 -28
- package/dist/Builder/ElementsPanel/ElementsList/index.js +0 -63
- package/dist/Builder/ElementsPanel/SelectedElementsList/SelectedElement.js +0 -73
- package/dist/Builder/ElementsPanel/SelectedElementsList/TitleBar.js +0 -50
- package/dist/Builder/ElementsPanel/SelectedElementsList/index.js +0 -91
- package/dist/Builder/ElementsPanel/index.js +0 -70
- package/dist/Builder/PropertiesPanel/EmptyProperty.js +0 -21
- package/dist/Builder/PropertiesPanel/Skeleton.js +0 -24
- package/dist/Builder/PropertiesPanel/index.js +0 -12
- package/dist/Builder/index.js +0 -3
- package/dist/Builder/styles.scss +0 -84
- package/dist/CalendarView/CustomDatePicker.js +0 -87
- package/dist/CalendarView/Header.js +0 -53
- package/dist/CalendarView/constants.js +0 -19
- package/dist/CalendarView/index.js +0 -83
- package/dist/CalendarView/utils.js +0 -50
- package/dist/Codeblock/index.js +0 -30
- package/dist/Columns/utils.js +0 -20
- package/dist/ConfirmationModal/constants.js +0 -3
- package/dist/ConfirmationModal/utils.js +0 -6
- package/dist/Container/container.scss +0 -21
- package/dist/Container/index.js +0 -23
- package/dist/CopyToClipboardButton/constants.js +0 -13
- package/dist/CopyToClipboardButton/copyToClipboard.scss +0 -22
- package/dist/CopyToClipboardButton/index.js +0 -59
- package/dist/CustomDomain/index.js +0 -98
- package/dist/CustomDomainDashboard/DeleteAlert.js +0 -28
- package/dist/CustomDomainDashboard/Header.js +0 -32
- package/dist/CustomDomainDashboard/Manage/Record.js +0 -42
- package/dist/CustomDomainDashboard/Manage/StatusInfo.js +0 -21
- package/dist/CustomDomainDashboard/Manage/TagBlock.js +0 -36
- package/dist/CustomDomainDashboard/Manage/constants.js +0 -4
- package/dist/CustomDomainDashboard/Manage/index.js +0 -125
- package/dist/CustomDomainDashboard/Manage/utils.js +0 -8
- package/dist/CustomDomainDashboard/api.js +0 -35
- package/dist/CustomDomainDashboard/constants.js +0 -2
- package/dist/CustomDomainDashboard/index.js +0 -118
- package/dist/CustomDomainDashboard/useCustomDomainApi.js +0 -71
- package/dist/CustomDomainDashboard/utils.js +0 -84
- package/dist/DateRangeFilter/index.js +0 -60
- package/dist/DateRangeFilter/utils.js +0 -113
- package/dist/DynamicVariables/dynamic-variables.scss +0 -34
- package/dist/DynamicVariables/index.js +0 -59
- package/dist/DynamicVariables/utils.js +0 -37
- package/dist/EmailForm/EmailForm.js +0 -98
- package/dist/EmailForm/EmailFormProvider.js +0 -45
- package/dist/EmailForm/EmailPreview.js +0 -129
- package/dist/EmailForm/ReplyToField.js +0 -55
- package/dist/EmailForm/SendToField.js +0 -28
- package/dist/EmailForm/SubjectField.js +0 -64
- package/dist/EmailForm/constants.js +0 -33
- package/dist/EmailForm/contexts/EmailForm.js +0 -7
- package/dist/EmailForm/index.js +0 -4
- package/dist/EmailForm/utils.js +0 -10
- package/dist/EmailPreview/index.js +0 -2
- package/dist/ErrorPage/index.js +0 -78
- package/dist/Header/Breadcrumbs.js +0 -31
- package/dist/Header/Dropdown.js +0 -12
- package/dist/Header/constants.js +0 -6
- package/dist/Header/header.scss +0 -121
- package/dist/Header/index.js +0 -61
- package/dist/IconPicker/Icon.js +0 -34
- package/dist/IconPicker/NoResults.js +0 -12
- package/dist/IconPicker/constants.js +0 -8
- package/dist/IconPicker/icon-picker.scss +0 -1
- package/dist/IconPicker/index.js +0 -164
- package/dist/ImageWithFallback/ImagePlaceholder.js +0 -16
- package/dist/ImageWithFallback/index.js +0 -31
- package/dist/IntegrationCard/Dropdown.js +0 -45
- package/dist/IntegrationCard/Status.js +0 -25
- package/dist/IntegrationCard/index.js +0 -128
- package/dist/IntegrationDisconnectAlert/index.js +0 -36
- package/dist/IpRestriction/AllowedIpRanges.js +0 -75
- package/dist/IpRestriction/CurrentIp.js +0 -26
- package/dist/IpRestriction/FormRow.js +0 -84
- package/dist/IpRestriction/Row.js +0 -91
- package/dist/IpRestriction/apis/allowed_ip_ranges.js +0 -28
- package/dist/IpRestriction/apis/current_ip.js +0 -11
- package/dist/IpRestriction/apis/ip_restriction.js +0 -16
- package/dist/IpRestriction/constants.js +0 -20
- package/dist/IpRestriction/hooks/reactQuery/useAllowedIpRanges.js +0 -34
- package/dist/IpRestriction/hooks/reactQuery/useCurrentIp.js +0 -10
- package/dist/IpRestriction/hooks/reactQuery/useIpRestrictions.js +0 -18
- package/dist/IpRestriction/index.js +0 -102
- package/dist/IpRestriction/utils.js +0 -85
- package/dist/KeyboardShortcuts/Pane/HotKey.js +0 -44
- package/dist/KeyboardShortcuts/Pane/HotKeyList.js +0 -42
- package/dist/KeyboardShortcuts/Pane/constants.js +0 -25
- package/dist/KeyboardShortcuts/Pane/index.js +0 -61
- package/dist/KeyboardShortcuts/Pane/keyboard-shortcuts.scss +0 -5
- package/dist/KeyboardShortcuts/Pane/utils.js +0 -66
- package/dist/KeyboardShortcuts/hooks/useKeyboardShortcutsPaneState.js +0 -31
- package/dist/KeyboardShortcuts/index.js +0 -9
- package/dist/LoginPage/Form.js +0 -57
- package/dist/LoginPage/constants.js +0 -12
- package/dist/LoginPage/index.js +0 -103
- package/dist/MenuBar/AddNew.js +0 -25
- package/dist/MenuBar/Block.js +0 -60
- package/dist/MenuBar/Item.js +0 -32
- package/dist/MenuBar/Search.js +0 -39
- package/dist/MenuBar/SubTitle.js +0 -23
- package/dist/MenuBar/index.js +0 -46
- package/dist/MenuBar/menubar.scss +0 -154
- package/dist/Metadata/Block.js +0 -30
- package/dist/Metadata/DetailsBlock.js +0 -86
- package/dist/Metadata/constants.js +0 -9
- package/dist/Metadata/index.js +0 -29
- package/dist/Metadata/metadata.scss +0 -15
- package/dist/MoreDropdown/constants.js +0 -25
- package/dist/NavigationHeader/LeftBlock.js +0 -32
- package/dist/NavigationHeader/Navigation.js +0 -24
- package/dist/NavigationHeader/RightBlock.js +0 -68
- package/dist/NavigationHeader/constants.js +0 -11
- package/dist/NavigationHeader/index.js +0 -19
- package/dist/NavigationHeader/navigation-header.scss +0 -3
- package/dist/NeetoWidget/CodeBlock.js +0 -57
- package/dist/NeetoWidget/CodeSnippet.js +0 -119
- package/dist/NeetoWidget/EmbedCode.js +0 -281
- package/dist/NeetoWidget/Main.js +0 -19
- package/dist/NeetoWidget/SelectionSwitches/TooltipSwitch.js +0 -25
- package/dist/NeetoWidget/SelectionSwitches/index.js +0 -44
- package/dist/NeetoWidget/SyntaxHighlighter.js +0 -17
- package/dist/NeetoWidget/api.js +0 -20
- package/dist/NeetoWidget/constants.js +0 -62
- package/dist/NeetoWidget/hooks/useForceUpdate.js +0 -14
- package/dist/NeetoWidget/index.js +0 -7
- package/dist/NeetoWidget/mutations.js +0 -9
- package/dist/NeetoWidget/queries.js +0 -32
- package/dist/NeetoWidget/utils.js +0 -83
- package/dist/PageLoader/index.js +0 -81
- package/dist/PageLoader/page-loader.scss +0 -95
- package/dist/PhoneNumber/CountryPicker/SingleValue.js +0 -21
- package/dist/PhoneNumber/CountryPicker/constants.js +0 -26
- package/dist/PhoneNumber/CountryPicker/index.js +0 -59
- package/dist/PhoneNumber/FormikPhoneNumberInput.js +0 -21
- package/dist/PhoneNumber/PhoneNumber.js +0 -30
- package/dist/PhoneNumber/PhoneNumberInput.js +0 -79
- package/dist/PhoneNumber/index.js +0 -5
- package/dist/PhoneNumber/utils.js +0 -55
- package/dist/PublishBlock/AlertBlock.js +0 -14
- package/dist/PublishBlock/index.js +0 -100
- package/dist/PublishBlock/publish-block.scss +0 -25
- package/dist/Rename/DummySpan.js +0 -21
- package/dist/Rename/constants.js +0 -1
- package/dist/Rename/index.js +0 -191
- package/dist/Rename/rename.scss +0 -69
- package/dist/Rename/utils.js +0 -10
- package/dist/ResponsiveDevicePicker/constants.js +0 -19
- package/dist/ResponsiveDevicePicker/index.js +0 -36
- package/dist/Schedule/DisplayAvailability.js +0 -58
- package/dist/Schedule/Fields.js +0 -43
- package/dist/Schedule/Form/ScheduleRow.js +0 -125
- package/dist/Schedule/Form/constants.js +0 -20
- package/dist/Schedule/Form/index.js +0 -144
- package/dist/Schedule/Form/utils.js +0 -63
- package/dist/Schedule/Header.js +0 -76
- package/dist/Schedule/ScheduleContext.js +0 -8
- package/dist/Schedule/constants.js +0 -8
- package/dist/Schedule/dayjsExtended/constants.js +0 -1
- package/dist/Schedule/dayjsExtended/index.js +0 -14
- package/dist/Schedule/dayjsExtended/range.js +0 -73
- package/dist/Schedule/index.js +0 -80
- package/dist/Schedule/utils.js +0 -152
- package/dist/Scrollable/constants.js +0 -8
- package/dist/Scrollable/index.js +0 -26
- package/dist/Scrollable/scrollable.scss +0 -32
- package/dist/Search/index.js +0 -52
- package/dist/Security/AllowedKeywords/Add.js +0 -38
- package/dist/Security/AllowedKeywords/index.js +0 -38
- package/dist/Security/PasswordBlock.js +0 -31
- package/dist/Security/RadioBlock.js +0 -38
- package/dist/Security/api.js +0 -12
- package/dist/Security/constants.js +0 -58
- package/dist/Security/index.js +0 -68
- package/dist/Security/useSecurityApi.js +0 -22
- package/dist/Security/utils.js +0 -31
- package/dist/SendToFields/FilePicker.js +0 -34
- package/dist/SendToFields/constants.js +0 -6
- package/dist/SendToFields/index.js +0 -102
- package/dist/SendToFields/utils.js +0 -54
- package/dist/Settings/Category.js +0 -30
- package/dist/Settings/Item.js +0 -38
- package/dist/Settings/index.js +0 -37
- package/dist/Settings/utils.js +0 -4
- package/dist/ShareViaEmail/EmailBodyEditor.js +0 -22
- package/dist/ShareViaEmail/FilePicker.js +0 -43
- package/dist/ShareViaEmail/Form.js +0 -105
- package/dist/ShareViaEmail/FormikDatePicker.js +0 -24
- package/dist/ShareViaEmail/constants.js +0 -14
- package/dist/ShareViaEmail/index.js +0 -92
- package/dist/ShareViaEmail/utils.js +0 -72
- package/dist/ShareViaLink/EditURL.js +0 -74
- package/dist/ShareViaLink/Link.js +0 -105
- package/dist/ShareViaLink/QRCode.js +0 -41
- package/dist/ShareViaLink/RegenerateURL.js +0 -47
- package/dist/ShareViaLink/SocialMedia.js +0 -52
- package/dist/ShareViaLink/constants.js +0 -25
- package/dist/ShareViaLink/edit-url.scss +0 -8
- package/dist/ShareViaLink/index.js +0 -46
- package/dist/ShareViaLink/utils.js +0 -47
- package/dist/Sidebar/AppSwitcher/AppLink.js +0 -45
- package/dist/Sidebar/AppSwitcher/Backdrop.js +0 -13
- package/dist/Sidebar/AppSwitcher/Body.js +0 -65
- package/dist/Sidebar/AppSwitcher/Portal.js +0 -27
- package/dist/Sidebar/AppSwitcher/appswitcher.scss +0 -164
- package/dist/Sidebar/AppSwitcher/index.js +0 -47
- package/dist/Sidebar/AppSwitcher/utils.js +0 -25
- package/dist/Sidebar/Chevron.js +0 -14
- package/dist/Sidebar/FeaturedTooltip.js +0 -19
- package/dist/Sidebar/Footer/AppSwitcherButton.js +0 -48
- package/dist/Sidebar/Footer/ProfileButton.js +0 -30
- package/dist/Sidebar/Footer/index.js +0 -56
- package/dist/Sidebar/Footer/utils.js +0 -39
- package/dist/Sidebar/Header.js +0 -33
- package/dist/Sidebar/HelpSection/HelpSectionMenu.js +0 -52
- package/dist/Sidebar/HelpSection/index.js +0 -32
- package/dist/Sidebar/Links.js +0 -112
- package/dist/Sidebar/NavIconWrapper.js +0 -20
- package/dist/Sidebar/ProfileSection/LinkSection.js +0 -36
- package/dist/Sidebar/ProfileSection/ProfileMenu.js +0 -48
- package/dist/Sidebar/ProfileSection/index.js +0 -42
- package/dist/Sidebar/constants.js +0 -40
- package/dist/Sidebar/index.js +0 -94
- package/dist/Sidebar/sidebar.scss +0 -379
- package/dist/Sidebar/utils.js +0 -18
- package/dist/SubHeader/RightBlock/Columns.js +0 -35
- package/dist/SubHeader/RightBlock/Download.js +0 -28
- package/dist/SubHeader/RightBlock/Filter.js +0 -31
- package/dist/SubHeader/RightBlock/index.js +0 -21
- package/dist/SubHeader/RightBlock/utils.js +0 -13
- package/dist/SubHeader/index.js +0 -28
- package/dist/SubHeader/subheader.scss +0 -78
- package/dist/ThemeSidebar/Customize/Logo.js +0 -39
- package/dist/ThemeSidebar/Customize/Properties.js +0 -170
- package/dist/ThemeSidebar/Customize/index.js +0 -66
- package/dist/ThemeSidebar/Themes/ThemeCard.js +0 -135
- package/dist/ThemeSidebar/Themes/index.js +0 -110
- package/dist/ThemeSidebar/TitleBar.js +0 -62
- package/dist/ThemeSidebar/constants.js +0 -127
- package/dist/ThemeSidebar/fields/AlignmentBlock.js +0 -50
- package/dist/ThemeSidebar/fields/Card.js +0 -19
- package/dist/ThemeSidebar/fields/ColorBlock.js +0 -19
- package/dist/ThemeSidebar/fields/FontPickerBlock.js +0 -35
- package/dist/ThemeSidebar/fields/ImageBlock/ImageUploader.js +0 -67
- package/dist/ThemeSidebar/fields/ImageBlock/ProgressBar.js +0 -22
- package/dist/ThemeSidebar/fields/ImageBlock/index.js +0 -55
- package/dist/ThemeSidebar/fields/SelectBlock.js +0 -24
- package/dist/ThemeSidebar/fields/SliderBlock.js +0 -30
- package/dist/ThemeSidebar/fields/SwitchBlock.js +0 -17
- package/dist/ThemeSidebar/fields/TextBlock.js +0 -13
- package/dist/ThemeSidebar/fields/slider.scss +0 -199
- package/dist/ThemeSidebar/hooks/useDirectUploadDropzone.js +0 -149
- package/dist/ThemeSidebar/index.js +0 -118
- package/dist/ThemeSidebar/themeSidebar.scss +0 -45
- package/dist/ThemeSidebar/utils.js +0 -169
- package/dist/TimeFormat/index.js +0 -3
- package/dist/TimezoneMismatchModal/apis/time_zone.js +0 -9
- package/dist/TimezoneMismatchModal/index.js +0 -83
- package/dist/TimezoneMismatchModal/useTimeZoneApi.js +0 -10
- package/dist/TimezoneMismatchModal/utils.js +0 -12
- package/dist/ToggleFeatureCard/ToolTipSwitch.js +0 -31
- package/dist/ToggleFeatureCard/constants.js +0 -5
- package/dist/ToggleFeatureCard/hooks/useScrollIntoView.js +0 -11
- package/dist/ToggleFeatureCard/index.js +0 -148
- package/dist/ToggleFeatureCard/toggleFeatureCard.scss +0 -4
|
@@ -0,0 +1,1333 @@
|
|
|
1
|
+
import { values, last, identity, assoc, pluck, any, prop, fromPairs, isEmpty } from 'ramda';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import React__default, { useEffect, useState, useRef } from 'react';
|
|
4
|
+
import { Info } from '@bigbinary/neeto-icons';
|
|
5
|
+
import { Typography, Select, Button, Pane, Toastr, Tooltip, Switch, Label, Callout } from '@bigbinary/neetoui';
|
|
6
|
+
import { useTranslation, Trans } from 'react-i18next';
|
|
7
|
+
import { useMutation, useQuery, useQueryClient, QueryClient, QueryClientProvider } from 'react-query';
|
|
8
|
+
import classnames from 'classnames';
|
|
9
|
+
import { capitalize, noop, isNotEmpty } from '@bigbinary/neeto-commons-frontend/pure';
|
|
10
|
+
import { withT, usePrevious } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
11
|
+
import CopyToClipboardButton from '@bigbinary/neeto-molecules/CopyToClipboardButton';
|
|
12
|
+
import Prism from 'prismjs';
|
|
13
|
+
import 'prismjs/themes/prism-tomorrow.css';
|
|
14
|
+
import { Formik, Form } from 'formik';
|
|
15
|
+
import { MultiEmailInput, Input } from '@bigbinary/neetoui/formik';
|
|
16
|
+
import i18next from 'i18next';
|
|
17
|
+
import * as yup from 'yup';
|
|
18
|
+
|
|
19
|
+
function _typeof$1(obj) {
|
|
20
|
+
"@babel/helpers - typeof";
|
|
21
|
+
|
|
22
|
+
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
23
|
+
return typeof obj;
|
|
24
|
+
} : function (obj) {
|
|
25
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
26
|
+
}, _typeof$1(obj);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function _toPrimitive(input, hint) {
|
|
30
|
+
if (_typeof$1(input) !== "object" || input === null) return input;
|
|
31
|
+
var prim = input[Symbol.toPrimitive];
|
|
32
|
+
if (prim !== undefined) {
|
|
33
|
+
var res = prim.call(input, hint || "default");
|
|
34
|
+
if (_typeof$1(res) !== "object") return res;
|
|
35
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
36
|
+
}
|
|
37
|
+
return (hint === "string" ? String : Number)(input);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function _toPropertyKey(arg) {
|
|
41
|
+
var key = _toPrimitive(arg, "string");
|
|
42
|
+
return _typeof$1(key) === "symbol" ? key : String(key);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function _defineProperty(obj, key, value) {
|
|
46
|
+
key = _toPropertyKey(key);
|
|
47
|
+
if (key in obj) {
|
|
48
|
+
Object.defineProperty(obj, key, {
|
|
49
|
+
value: value,
|
|
50
|
+
enumerable: true,
|
|
51
|
+
configurable: true,
|
|
52
|
+
writable: true
|
|
53
|
+
});
|
|
54
|
+
} else {
|
|
55
|
+
obj[key] = value;
|
|
56
|
+
}
|
|
57
|
+
return obj;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var _SAMPLE_USER_IDENTITY;
|
|
61
|
+
var NEETO_WIDGET_USER_IDENTITY_KEY = "NeetoWidgetUserIdentity";
|
|
62
|
+
var SESSION_CONTEXT_KEY = "NeetoReplayWidgetSessionContext";
|
|
63
|
+
var INSTALLATION_HELP_EMAIL = "support@neeto.com";
|
|
64
|
+
var SAMPLE_CONTEXT_CODE_STRING = "window.".concat(SESSION_CONTEXT_KEY, " = {\n key1: \"value\",\n key2: [\"array\", \"of\", \"values\"],\n /* More key-value pairs */\n}");
|
|
65
|
+
var WIDGET_TYPES = {
|
|
66
|
+
changelog: "changelog",
|
|
67
|
+
chat: "chat",
|
|
68
|
+
replay: "replay"
|
|
69
|
+
};
|
|
70
|
+
var WIDGET_TYPES_VALUES = values(WIDGET_TYPES);
|
|
71
|
+
var QUERY_KEYS = {
|
|
72
|
+
apiKey: "neetoWidgetApiKey",
|
|
73
|
+
configuration: "neetoWidgetConfiguration"
|
|
74
|
+
};
|
|
75
|
+
var DEFAULT_QUERY_STALE_TIME = 60 * 60 * 1000; // 1 hour in milliseconds
|
|
76
|
+
|
|
77
|
+
var EMAIL_TYPES = {
|
|
78
|
+
embedCode: "embedCode",
|
|
79
|
+
userIdentity: "userIdentity",
|
|
80
|
+
sessionContext: "sessionContext",
|
|
81
|
+
"null": ""
|
|
82
|
+
};
|
|
83
|
+
var RAILS_ENV = {
|
|
84
|
+
production: "production",
|
|
85
|
+
staging: "staging",
|
|
86
|
+
development: "development"
|
|
87
|
+
};
|
|
88
|
+
var NEETO_WIDGET_SCRIPT_URL = {
|
|
89
|
+
staging: "https://d13nryxs46eypn.cloudfront.net/neeto-widget-staging.js",
|
|
90
|
+
production: "https://d13nryxs46eypn.cloudfront.net/neeto-widget.js"
|
|
91
|
+
};
|
|
92
|
+
var AVAILABLE_FRAMEWORK_OPTIONS = Object.freeze({
|
|
93
|
+
rails: "rails",
|
|
94
|
+
django: "django",
|
|
95
|
+
php: "php"
|
|
96
|
+
});
|
|
97
|
+
var FRAMEWORK_SELECT_OPTIONS = [{
|
|
98
|
+
label: "Ruby(Rails)",
|
|
99
|
+
value: AVAILABLE_FRAMEWORK_OPTIONS.rails
|
|
100
|
+
}, {
|
|
101
|
+
label: "Python(Django)",
|
|
102
|
+
value: AVAILABLE_FRAMEWORK_OPTIONS.django
|
|
103
|
+
}, {
|
|
104
|
+
label: "PHP",
|
|
105
|
+
value: AVAILABLE_FRAMEWORK_OPTIONS.php
|
|
106
|
+
}];
|
|
107
|
+
var SAMPLE_USER_IDENTITY_CODE_STRING = (_SAMPLE_USER_IDENTITY = {}, _defineProperty(_SAMPLE_USER_IDENTITY, AVAILABLE_FRAMEWORK_OPTIONS.rails, "window.".concat(NEETO_WIDGET_USER_IDENTITY_KEY, " = {\n user_identifier: \"<%= current_user.id %>\", // User identifier\"\n name: \"<%= current_user.name %>\", // Full name\n email: \"<%= current_user.email %>\", // Email address\n started_at: \"<%= current_user.created_at.to_i %>\" // Signup date as a Unix timestamp ,\n}")), _defineProperty(_SAMPLE_USER_IDENTITY, AVAILABLE_FRAMEWORK_OPTIONS.django, "window.".concat(NEETO_WIDGET_USER_IDENTITY_KEY, " = {\n user_identifier: \"{{ request.user.id|escapejs }}\", // User identifier\n name: \"{{ request.user.name|escapejs }}\", // Full name\n email: \"{{ request.user.email|escapejs }}\", // Email address\n started_at: \"{{ request.user.created_at|date:'U' }}\" // Signup date as a Unix timestamp\"\n}")), _defineProperty(_SAMPLE_USER_IDENTITY, AVAILABLE_FRAMEWORK_OPTIONS.php, "window.".concat(NEETO_WIDGET_USER_IDENTITY_KEY, " = {\n user_identifier: <?php echo json_encode($current_user->id) ?>, // User identifier\n name: <?php echo json_encode($current_user->name) ?>, // Full name\n email: <?php echo json_encode($current_user->email) ?>, // Email address\n started_at: <?php echo strtotime($current_user->created_at) ?> // Signup date as a Unix timestamp\" ,\n}")), _SAMPLE_USER_IDENTITY);
|
|
108
|
+
var WIDGET_CONFIG_URL = "api/widget/v1/neeto_widget_tokens";
|
|
109
|
+
var EMBED_CODE_EMAIL_URL = "api/widget/v1/email_snippets";
|
|
110
|
+
var CHAT_WIDGET_KB_BASE_URL = "https://help.neetochat.com";
|
|
111
|
+
var CHANGELOG_WIDGET_KB_BASE_URL = "https://help.neetochangelog.com";
|
|
112
|
+
var REPLAY_WIDGET_KB_BASE_URL = "https://help.neetoreplay.com";
|
|
113
|
+
var NEETO_REPLAY_CONFIGURE_URL = "".concat(REPLAY_WIDGET_KB_BASE_URL, "/articles/configure-widget");
|
|
114
|
+
var NEETO_CHAT_USER_IDENTITY_URL = "".concat(CHAT_WIDGET_KB_BASE_URL, "/articles/info-about-logged-in-users");
|
|
115
|
+
var WIDGET_KB_HELP_URL = {
|
|
116
|
+
changelog: "".concat(CHANGELOG_WIDGET_KB_BASE_URL, "/categories/widget-installation-usage"),
|
|
117
|
+
chat: "".concat(CHAT_WIDGET_KB_BASE_URL, "/categories/installation"),
|
|
118
|
+
replay: "".concat(REPLAY_WIDGET_KB_BASE_URL, "/categories/widget-installation-usage")
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
function _extends$1() {
|
|
122
|
+
_extends$1 = Object.assign ? Object.assign.bind() : function (target) {
|
|
123
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
124
|
+
var source = arguments[i];
|
|
125
|
+
for (var key in source) {
|
|
126
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
127
|
+
target[key] = source[key];
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return target;
|
|
132
|
+
};
|
|
133
|
+
return _extends$1.apply(this, arguments);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function _arrayWithHoles(arr) {
|
|
137
|
+
if (Array.isArray(arr)) return arr;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function _iterableToArrayLimit(arr, i) {
|
|
141
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
142
|
+
if (null != _i) {
|
|
143
|
+
var _s,
|
|
144
|
+
_e,
|
|
145
|
+
_x,
|
|
146
|
+
_r,
|
|
147
|
+
_arr = [],
|
|
148
|
+
_n = !0,
|
|
149
|
+
_d = !1;
|
|
150
|
+
try {
|
|
151
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
152
|
+
if (Object(_i) !== _i) return;
|
|
153
|
+
_n = !1;
|
|
154
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
155
|
+
} catch (err) {
|
|
156
|
+
_d = !0, _e = err;
|
|
157
|
+
} finally {
|
|
158
|
+
try {
|
|
159
|
+
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
|
|
160
|
+
} finally {
|
|
161
|
+
if (_d) throw _e;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return _arr;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function _arrayLikeToArray(arr, len) {
|
|
169
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
170
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
171
|
+
return arr2;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
175
|
+
if (!o) return;
|
|
176
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
177
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
178
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
179
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
180
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function _nonIterableRest() {
|
|
184
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function _slicedToArray(arr, i) {
|
|
188
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
192
|
+
if (source == null) return {};
|
|
193
|
+
var target = {};
|
|
194
|
+
var sourceKeys = Object.keys(source);
|
|
195
|
+
var key, i;
|
|
196
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
197
|
+
key = sourceKeys[i];
|
|
198
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
199
|
+
target[key] = source[key];
|
|
200
|
+
}
|
|
201
|
+
return target;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function _objectWithoutProperties(source, excluded) {
|
|
205
|
+
if (source == null) return {};
|
|
206
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
207
|
+
var key, i;
|
|
208
|
+
if (Object.getOwnPropertySymbols) {
|
|
209
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
210
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
211
|
+
key = sourceSymbolKeys[i];
|
|
212
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
213
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
214
|
+
target[key] = source[key];
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return target;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
var _path, _path2, _g, _defs;
|
|
221
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
222
|
+
var SvgNeeto = function SvgNeeto(props) {
|
|
223
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
224
|
+
width: 50,
|
|
225
|
+
height: 50,
|
|
226
|
+
viewBox: "0 0 415 415",
|
|
227
|
+
fill: "none",
|
|
228
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
229
|
+
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
230
|
+
d: "M414.989 207.495C414.989 92.899 322.091 0 207.495 0H0v414.989h414.989V207.495Z",
|
|
231
|
+
fill: "#0043AC"
|
|
232
|
+
})), /*#__PURE__*/React.createElement("mask", {
|
|
233
|
+
id: "neeto_svg__a",
|
|
234
|
+
style: {
|
|
235
|
+
maskType: "alpha"
|
|
236
|
+
},
|
|
237
|
+
maskUnits: "userSpaceOnUse",
|
|
238
|
+
x: 0,
|
|
239
|
+
y: 0,
|
|
240
|
+
width: 415,
|
|
241
|
+
height: 415
|
|
242
|
+
}, _path2 || (_path2 = /*#__PURE__*/React.createElement("path", {
|
|
243
|
+
d: "M414.989 207.495C414.989 92.899 322.091 0 207.495 0H0v414.989h414.989V207.495Z",
|
|
244
|
+
fill: "#0043AC"
|
|
245
|
+
}))), _g || (_g = /*#__PURE__*/React.createElement("g", {
|
|
246
|
+
mask: "url(#neeto_svg__a)"
|
|
247
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
248
|
+
d: "M233.747 348.74c88.579 101.145 172.015 116.411 202.661 111.401v32.491H-8.032V230.487c43.685-2.726 153.2 17.108 241.779 118.253Z",
|
|
249
|
+
fill: "url(#neeto_svg__b)"
|
|
250
|
+
}))), _defs || (_defs = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("radialGradient", {
|
|
251
|
+
id: "neeto_svg__b",
|
|
252
|
+
cx: 0,
|
|
253
|
+
cy: 0,
|
|
254
|
+
r: 1,
|
|
255
|
+
gradientUnits: "userSpaceOnUse",
|
|
256
|
+
gradientTransform: "rotate(47.118 -220.556 214.818) scale(427.964 725.049)"
|
|
257
|
+
}, /*#__PURE__*/React.createElement("stop", {
|
|
258
|
+
stopColor: "#0043AC"
|
|
259
|
+
}), /*#__PURE__*/React.createElement("stop", {
|
|
260
|
+
offset: 1,
|
|
261
|
+
stopColor: "#3DB1CA",
|
|
262
|
+
stopOpacity: 0.8
|
|
263
|
+
})))));
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
267
|
+
|
|
268
|
+
var css = ".neeto-molecules-pageloader__wrapper{height:100%;position:relative;width:100%}.neeto-molecules-pageloader__wrapper .neeto-molecules-pageloader{height:100%;left:0;position:absolute;top:0;width:100%}.neeto-molecules-pageloader__wrapper .neeto-molecules-pageloader__content{height:66px;margin-bottom:16px;overflow:hidden;padding:8px;position:relative;width:66px}.neeto-molecules-pageloader__wrapper .neeto-molecules-pageloader__text{color:rgb(var(--neeto-ui-gray-800));font-size:1.25rem;line-height:1.75rem;margin-bottom:4rem;text-align:center}.neeto-molecules-pageloader__spinner{display:flex;gap:2px;height:25px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}.neeto-molecules-pageloader__spinner>div{animation:neeto-ui-stretch-delay 1.2s ease-in-out infinite;background-color:#fff;border-radius:2px;display:inline-flex;height:100%;width:2px}.neeto-molecules-pageloader__spinner .neeto-molecules-pageloader__rect2{animation-delay:-1.1s}.neeto-molecules-pageloader__spinner .neeto-molecules-pageloader__rect3{animation-delay:-1s}.neeto-molecules-pageloader__spinner .neeto-molecules-pageloader__rect4{animation-delay:-.9s}.neeto-molecules-pageloader__spinner .neeto-molecules-pageloader__rect5{animation-delay:-.8s}@keyframes neeto-ui-stretch-delay{0%,40%,to{transform:scaleY(.4);-webkit-transform:scaleY(.4)}20%{transform:scaleY(1);-webkit-transform:scaleY(1)}}";
|
|
269
|
+
n(css,{});
|
|
270
|
+
|
|
271
|
+
var _excluded = ["text"];
|
|
272
|
+
var PageLoader = function PageLoader(_ref) {
|
|
273
|
+
var _ref$text = _ref.text,
|
|
274
|
+
text = _ref$text === void 0 ? "" : _ref$text,
|
|
275
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
276
|
+
return /*#__PURE__*/React__default.createElement("div", _extends$1({
|
|
277
|
+
className: "neeto-molecules-pageloader__wrapper"
|
|
278
|
+
}, otherProps), /*#__PURE__*/React__default.createElement("div", {
|
|
279
|
+
className: "neeto-molecules-pageloader neeto-ui-flex neeto-ui-flex-col neeto-ui-items-center neeto-ui-justify-center"
|
|
280
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
281
|
+
className: "neeto-molecules-pageloader__content neeto-ui-flex neeto-ui-flex-shrink-0 neeto-ui-items-center neeto-ui-justify-center"
|
|
282
|
+
}, /*#__PURE__*/React__default.createElement(SvgNeeto, {
|
|
283
|
+
className: "neeto-molecules-pageloader__logo",
|
|
284
|
+
size: 50
|
|
285
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
286
|
+
className: "neeto-molecules-pageloader__spinner"
|
|
287
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
288
|
+
className: "neeto-molecules-pageloader__rect1"
|
|
289
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
290
|
+
className: "neeto-molecules-pageloader__rect2"
|
|
291
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
292
|
+
className: "neeto-molecules-pageloader__rect3"
|
|
293
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
294
|
+
className: "neeto-molecules-pageloader__rect4"
|
|
295
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
296
|
+
className: "neeto-molecules-pageloader__rect5"
|
|
297
|
+
}))), text && /*#__PURE__*/React__default.createElement(Typography, {
|
|
298
|
+
style: "h5",
|
|
299
|
+
weight: "semibold"
|
|
300
|
+
}, text)));
|
|
301
|
+
};
|
|
302
|
+
var PageLoader$1 = /*#__PURE__*/React__default.memo(PageLoader);
|
|
303
|
+
|
|
304
|
+
var SyntaxHighlighter = function SyntaxHighlighter(_ref) {
|
|
305
|
+
var className = _ref.className,
|
|
306
|
+
code = _ref.code,
|
|
307
|
+
language = _ref.language;
|
|
308
|
+
useEffect(function () {
|
|
309
|
+
Prism.highlightAll();
|
|
310
|
+
}, [code]);
|
|
311
|
+
return /*#__PURE__*/React__default.createElement("pre", {
|
|
312
|
+
className: className
|
|
313
|
+
}, /*#__PURE__*/React__default.createElement("code", {
|
|
314
|
+
className: "language-".concat(language)
|
|
315
|
+
}, code));
|
|
316
|
+
};
|
|
317
|
+
var SyntaxHighlighter$1 = /*#__PURE__*/React__default.memo(SyntaxHighlighter);
|
|
318
|
+
|
|
319
|
+
var CodeBlock = function CodeBlock(_ref) {
|
|
320
|
+
var _ref$title = _ref.title,
|
|
321
|
+
title = _ref$title === void 0 ? /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Trans, {
|
|
322
|
+
i18nKey: "neetoMolecules.codeblock.codeSnippet"
|
|
323
|
+
})) : _ref$title,
|
|
324
|
+
codeString = _ref.codeString,
|
|
325
|
+
_ref$showCopyButton = _ref.showCopyButton,
|
|
326
|
+
showCopyButton = _ref$showCopyButton === void 0 ? true : _ref$showCopyButton,
|
|
327
|
+
_ref$className = _ref.className,
|
|
328
|
+
className = _ref$className === void 0 ? "" : _ref$className,
|
|
329
|
+
_ref$sendViaEmail = _ref.sendViaEmail,
|
|
330
|
+
sendViaEmail = _ref$sendViaEmail === void 0 ? undefined : _ref$sendViaEmail,
|
|
331
|
+
_ref$frameworkProps = _ref.frameworkProps,
|
|
332
|
+
frameworkProps = _ref$frameworkProps === void 0 ? {} : _ref$frameworkProps;
|
|
333
|
+
var _useTranslation = useTranslation(),
|
|
334
|
+
t = _useTranslation.t;
|
|
335
|
+
var _ref2 = frameworkProps !== null && frameworkProps !== void 0 ? frameworkProps : {},
|
|
336
|
+
selectedFramework = _ref2.selectedFramework,
|
|
337
|
+
setSelectedFramework = _ref2.setSelectedFramework;
|
|
338
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
339
|
+
className: classnames(["relative", className])
|
|
340
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
341
|
+
className: "neeto-ui-bg-primary-100 neeto-ui-rounded-lg flex w-full flex-wrap items-center justify-between gap-2 rounded-b-none p-3"
|
|
342
|
+
}, title && /*#__PURE__*/React__default.createElement(Typography, {
|
|
343
|
+
className: "m-0 flex-shrink-0",
|
|
344
|
+
"data-cy": "code-block-title-text",
|
|
345
|
+
style: "h4"
|
|
346
|
+
}, title), selectedFramework && /*#__PURE__*/React__default.createElement(Select, {
|
|
347
|
+
className: "w-40",
|
|
348
|
+
"data-testid": "framework-select",
|
|
349
|
+
options: FRAMEWORK_SELECT_OPTIONS,
|
|
350
|
+
value: selectedFramework,
|
|
351
|
+
onChange: setSelectedFramework
|
|
352
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
353
|
+
className: "ml-auto flex flex-shrink-0 items-center justify-end gap-2"
|
|
354
|
+
}, sendViaEmail ? /*#__PURE__*/React__default.createElement(Button, {
|
|
355
|
+
style: "text",
|
|
356
|
+
label: t("neetoMolecules.widget.installation.snippet.sendViaEmail"),
|
|
357
|
+
onClick: sendViaEmail
|
|
358
|
+
}) : null, showCopyButton && /*#__PURE__*/React__default.createElement(CopyToClipboardButton, {
|
|
359
|
+
label: t("neetoMolecules.widget.installation.snippet.copy"),
|
|
360
|
+
style: "primary",
|
|
361
|
+
value: codeString
|
|
362
|
+
}))), /*#__PURE__*/React__default.createElement(SyntaxHighlighter$1, {
|
|
363
|
+
className: "neeto-ui-bg-gray-800 neeto-ui-rounded-lg m-0 rounded-t-none",
|
|
364
|
+
code: codeString,
|
|
365
|
+
language: "javascript"
|
|
366
|
+
}));
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
370
|
+
try {
|
|
371
|
+
var info = gen[key](arg);
|
|
372
|
+
var value = info.value;
|
|
373
|
+
} catch (error) {
|
|
374
|
+
reject(error);
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
if (info.done) {
|
|
378
|
+
resolve(value);
|
|
379
|
+
} else {
|
|
380
|
+
Promise.resolve(value).then(_next, _throw);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
function _asyncToGenerator(fn) {
|
|
384
|
+
return function () {
|
|
385
|
+
var self = this,
|
|
386
|
+
args = arguments;
|
|
387
|
+
return new Promise(function (resolve, reject) {
|
|
388
|
+
var gen = fn.apply(self, args);
|
|
389
|
+
function _next(value) {
|
|
390
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
391
|
+
}
|
|
392
|
+
function _throw(err) {
|
|
393
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
394
|
+
}
|
|
395
|
+
_next(undefined);
|
|
396
|
+
});
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
var regeneratorRuntime$1 = {exports: {}};
|
|
401
|
+
|
|
402
|
+
var _typeof = {exports: {}};
|
|
403
|
+
|
|
404
|
+
(function (module) {
|
|
405
|
+
function _typeof(obj) {
|
|
406
|
+
"@babel/helpers - typeof";
|
|
407
|
+
|
|
408
|
+
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
409
|
+
return typeof obj;
|
|
410
|
+
} : function (obj) {
|
|
411
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
412
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
|
|
413
|
+
}
|
|
414
|
+
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
415
|
+
} (_typeof));
|
|
416
|
+
|
|
417
|
+
(function (module) {
|
|
418
|
+
var _typeof$1 = _typeof.exports["default"];
|
|
419
|
+
function _regeneratorRuntime() {
|
|
420
|
+
module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
|
|
421
|
+
return exports;
|
|
422
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
423
|
+
var exports = {},
|
|
424
|
+
Op = Object.prototype,
|
|
425
|
+
hasOwn = Op.hasOwnProperty,
|
|
426
|
+
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
427
|
+
obj[key] = desc.value;
|
|
428
|
+
},
|
|
429
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
430
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
431
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
432
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
433
|
+
function define(obj, key, value) {
|
|
434
|
+
return Object.defineProperty(obj, key, {
|
|
435
|
+
value: value,
|
|
436
|
+
enumerable: !0,
|
|
437
|
+
configurable: !0,
|
|
438
|
+
writable: !0
|
|
439
|
+
}), obj[key];
|
|
440
|
+
}
|
|
441
|
+
try {
|
|
442
|
+
define({}, "");
|
|
443
|
+
} catch (err) {
|
|
444
|
+
define = function define(obj, key, value) {
|
|
445
|
+
return obj[key] = value;
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
449
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
450
|
+
generator = Object.create(protoGenerator.prototype),
|
|
451
|
+
context = new Context(tryLocsList || []);
|
|
452
|
+
return defineProperty(generator, "_invoke", {
|
|
453
|
+
value: makeInvokeMethod(innerFn, self, context)
|
|
454
|
+
}), generator;
|
|
455
|
+
}
|
|
456
|
+
function tryCatch(fn, obj, arg) {
|
|
457
|
+
try {
|
|
458
|
+
return {
|
|
459
|
+
type: "normal",
|
|
460
|
+
arg: fn.call(obj, arg)
|
|
461
|
+
};
|
|
462
|
+
} catch (err) {
|
|
463
|
+
return {
|
|
464
|
+
type: "throw",
|
|
465
|
+
arg: err
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
exports.wrap = wrap;
|
|
470
|
+
var ContinueSentinel = {};
|
|
471
|
+
function Generator() {}
|
|
472
|
+
function GeneratorFunction() {}
|
|
473
|
+
function GeneratorFunctionPrototype() {}
|
|
474
|
+
var IteratorPrototype = {};
|
|
475
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
476
|
+
return this;
|
|
477
|
+
});
|
|
478
|
+
var getProto = Object.getPrototypeOf,
|
|
479
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
480
|
+
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
481
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
482
|
+
function defineIteratorMethods(prototype) {
|
|
483
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
484
|
+
define(prototype, method, function (arg) {
|
|
485
|
+
return this._invoke(method, arg);
|
|
486
|
+
});
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
490
|
+
function invoke(method, arg, resolve, reject) {
|
|
491
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
492
|
+
if ("throw" !== record.type) {
|
|
493
|
+
var result = record.arg,
|
|
494
|
+
value = result.value;
|
|
495
|
+
return value && "object" == _typeof$1(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
496
|
+
invoke("next", value, resolve, reject);
|
|
497
|
+
}, function (err) {
|
|
498
|
+
invoke("throw", err, resolve, reject);
|
|
499
|
+
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
500
|
+
result.value = unwrapped, resolve(result);
|
|
501
|
+
}, function (error) {
|
|
502
|
+
return invoke("throw", error, resolve, reject);
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
reject(record.arg);
|
|
506
|
+
}
|
|
507
|
+
var previousPromise;
|
|
508
|
+
defineProperty(this, "_invoke", {
|
|
509
|
+
value: function value(method, arg) {
|
|
510
|
+
function callInvokeWithMethodAndArg() {
|
|
511
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
512
|
+
invoke(method, arg, resolve, reject);
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
520
|
+
var state = "suspendedStart";
|
|
521
|
+
return function (method, arg) {
|
|
522
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
523
|
+
if ("completed" === state) {
|
|
524
|
+
if ("throw" === method) throw arg;
|
|
525
|
+
return doneResult();
|
|
526
|
+
}
|
|
527
|
+
for (context.method = method, context.arg = arg;;) {
|
|
528
|
+
var delegate = context.delegate;
|
|
529
|
+
if (delegate) {
|
|
530
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
531
|
+
if (delegateResult) {
|
|
532
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
533
|
+
return delegateResult;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
537
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
538
|
+
context.dispatchException(context.arg);
|
|
539
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
540
|
+
state = "executing";
|
|
541
|
+
var record = tryCatch(innerFn, self, context);
|
|
542
|
+
if ("normal" === record.type) {
|
|
543
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
544
|
+
return {
|
|
545
|
+
value: record.arg,
|
|
546
|
+
done: context.done
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
554
|
+
var methodName = context.method,
|
|
555
|
+
method = delegate.iterator[methodName];
|
|
556
|
+
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
|
|
557
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
558
|
+
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
559
|
+
var info = record.arg;
|
|
560
|
+
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
561
|
+
}
|
|
562
|
+
function pushTryEntry(locs) {
|
|
563
|
+
var entry = {
|
|
564
|
+
tryLoc: locs[0]
|
|
565
|
+
};
|
|
566
|
+
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
567
|
+
}
|
|
568
|
+
function resetTryEntry(entry) {
|
|
569
|
+
var record = entry.completion || {};
|
|
570
|
+
record.type = "normal", delete record.arg, entry.completion = record;
|
|
571
|
+
}
|
|
572
|
+
function Context(tryLocsList) {
|
|
573
|
+
this.tryEntries = [{
|
|
574
|
+
tryLoc: "root"
|
|
575
|
+
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
576
|
+
}
|
|
577
|
+
function values(iterable) {
|
|
578
|
+
if (iterable) {
|
|
579
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
580
|
+
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
581
|
+
if ("function" == typeof iterable.next) return iterable;
|
|
582
|
+
if (!isNaN(iterable.length)) {
|
|
583
|
+
var i = -1,
|
|
584
|
+
next = function next() {
|
|
585
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
586
|
+
return next.value = undefined, next.done = !0, next;
|
|
587
|
+
};
|
|
588
|
+
return next.next = next;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
return {
|
|
592
|
+
next: doneResult
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
function doneResult() {
|
|
596
|
+
return {
|
|
597
|
+
value: undefined,
|
|
598
|
+
done: !0
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
602
|
+
value: GeneratorFunctionPrototype,
|
|
603
|
+
configurable: !0
|
|
604
|
+
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
605
|
+
value: GeneratorFunction,
|
|
606
|
+
configurable: !0
|
|
607
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
608
|
+
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
609
|
+
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
610
|
+
}, exports.mark = function (genFun) {
|
|
611
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
612
|
+
}, exports.awrap = function (arg) {
|
|
613
|
+
return {
|
|
614
|
+
__await: arg
|
|
615
|
+
};
|
|
616
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
617
|
+
return this;
|
|
618
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
619
|
+
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
620
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
621
|
+
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
622
|
+
return result.done ? result.value : iter.next();
|
|
623
|
+
});
|
|
624
|
+
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
625
|
+
return this;
|
|
626
|
+
}), define(Gp, "toString", function () {
|
|
627
|
+
return "[object Generator]";
|
|
628
|
+
}), exports.keys = function (val) {
|
|
629
|
+
var object = Object(val),
|
|
630
|
+
keys = [];
|
|
631
|
+
for (var key in object) keys.push(key);
|
|
632
|
+
return keys.reverse(), function next() {
|
|
633
|
+
for (; keys.length;) {
|
|
634
|
+
var key = keys.pop();
|
|
635
|
+
if (key in object) return next.value = key, next.done = !1, next;
|
|
636
|
+
}
|
|
637
|
+
return next.done = !0, next;
|
|
638
|
+
};
|
|
639
|
+
}, exports.values = values, Context.prototype = {
|
|
640
|
+
constructor: Context,
|
|
641
|
+
reset: function reset(skipTempReset) {
|
|
642
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
643
|
+
},
|
|
644
|
+
stop: function stop() {
|
|
645
|
+
this.done = !0;
|
|
646
|
+
var rootRecord = this.tryEntries[0].completion;
|
|
647
|
+
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
648
|
+
return this.rval;
|
|
649
|
+
},
|
|
650
|
+
dispatchException: function dispatchException(exception) {
|
|
651
|
+
if (this.done) throw exception;
|
|
652
|
+
var context = this;
|
|
653
|
+
function handle(loc, caught) {
|
|
654
|
+
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
655
|
+
}
|
|
656
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
657
|
+
var entry = this.tryEntries[i],
|
|
658
|
+
record = entry.completion;
|
|
659
|
+
if ("root" === entry.tryLoc) return handle("end");
|
|
660
|
+
if (entry.tryLoc <= this.prev) {
|
|
661
|
+
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
662
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
663
|
+
if (hasCatch && hasFinally) {
|
|
664
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
665
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
666
|
+
} else if (hasCatch) {
|
|
667
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
668
|
+
} else {
|
|
669
|
+
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
670
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
},
|
|
675
|
+
abrupt: function abrupt(type, arg) {
|
|
676
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
677
|
+
var entry = this.tryEntries[i];
|
|
678
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
679
|
+
var finallyEntry = entry;
|
|
680
|
+
break;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
684
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
685
|
+
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
686
|
+
},
|
|
687
|
+
complete: function complete(record, afterLoc) {
|
|
688
|
+
if ("throw" === record.type) throw record.arg;
|
|
689
|
+
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
690
|
+
},
|
|
691
|
+
finish: function finish(finallyLoc) {
|
|
692
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
693
|
+
var entry = this.tryEntries[i];
|
|
694
|
+
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
695
|
+
}
|
|
696
|
+
},
|
|
697
|
+
"catch": function _catch(tryLoc) {
|
|
698
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
699
|
+
var entry = this.tryEntries[i];
|
|
700
|
+
if (entry.tryLoc === tryLoc) {
|
|
701
|
+
var record = entry.completion;
|
|
702
|
+
if ("throw" === record.type) {
|
|
703
|
+
var thrown = record.arg;
|
|
704
|
+
resetTryEntry(entry);
|
|
705
|
+
}
|
|
706
|
+
return thrown;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
throw new Error("illegal catch attempt");
|
|
710
|
+
},
|
|
711
|
+
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
712
|
+
return this.delegate = {
|
|
713
|
+
iterator: values(iterable),
|
|
714
|
+
resultName: resultName,
|
|
715
|
+
nextLoc: nextLoc
|
|
716
|
+
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
717
|
+
}
|
|
718
|
+
}, exports;
|
|
719
|
+
}
|
|
720
|
+
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
721
|
+
} (regeneratorRuntime$1));
|
|
722
|
+
|
|
723
|
+
// TODO(Babel 8): Remove this file.
|
|
724
|
+
|
|
725
|
+
var runtime = regeneratorRuntime$1.exports();
|
|
726
|
+
var regenerator = runtime;
|
|
727
|
+
|
|
728
|
+
// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
|
|
729
|
+
try {
|
|
730
|
+
regeneratorRuntime = runtime;
|
|
731
|
+
} catch (accidentalStrictMode) {
|
|
732
|
+
if (typeof globalThis === "object") {
|
|
733
|
+
globalThis.regeneratorRuntime = runtime;
|
|
734
|
+
} else {
|
|
735
|
+
Function("r", "regeneratorRuntime = r")(runtime);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
var buildEmbedWidgetScript = function buildEmbedWidgetScript() {
|
|
740
|
+
var widgetScriptUrl = window.globalProps.railsEnv === RAILS_ENV.production ? NEETO_WIDGET_SCRIPT_URL.production : NEETO_WIDGET_SCRIPT_URL.staging;
|
|
741
|
+
return "<script src=\"".concat(widgetScriptUrl, "\"></script>");
|
|
742
|
+
};
|
|
743
|
+
var indentAndFormat = function indentAndFormat(str) {
|
|
744
|
+
var formatter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : identity;
|
|
745
|
+
return str.split("\n").map(formatter).join("\n ");
|
|
746
|
+
};
|
|
747
|
+
var getCommentedCommand = function getCommentedCommand(command, isEnabled) {
|
|
748
|
+
return isEnabled ? command : "/// ".concat(command);
|
|
749
|
+
};
|
|
750
|
+
var embedWidgetEnvironment = function embedWidgetEnvironment() {
|
|
751
|
+
switch (window.globalProps.railsEnv) {
|
|
752
|
+
case RAILS_ENV.production:
|
|
753
|
+
return "";
|
|
754
|
+
case RAILS_ENV.development:
|
|
755
|
+
return "environment: \"".concat(RAILS_ENV.development, "\",");
|
|
756
|
+
case RAILS_ENV.staging:
|
|
757
|
+
return "environment: \"".concat(RAILS_ENV.staging, "\",");
|
|
758
|
+
default:
|
|
759
|
+
return "/* Unidentified RAILS_ENV, */";
|
|
760
|
+
}
|
|
761
|
+
};
|
|
762
|
+
var embedWidgetApiKey = function embedWidgetApiKey(apiKey) {
|
|
763
|
+
return "apiKey: \"".concat(apiKey, "\",");
|
|
764
|
+
};
|
|
765
|
+
var addChangelogOptions = function addChangelogOptions() {
|
|
766
|
+
return "neetoChangelogOptions: {\n elementId: \"neetochangelog-trigger\",\n},";
|
|
767
|
+
};
|
|
768
|
+
var wrapBlockInOnLoad = function wrapBlockInOnLoad(codeBlock) {
|
|
769
|
+
return "window.addEventListener(\"load\", () => ".concat(codeBlock, ");");
|
|
770
|
+
};
|
|
771
|
+
var embedWidgetFunctionCall = function embedWidgetFunctionCall(enabledWidgets, apiKey) {
|
|
772
|
+
return "embedNeetoWidget({\n ".concat(embedWidgetEnvironment(), "\n ").concat(indentAndFormat(embedWidgetApiKey(apiKey)), "\n ").concat(indentAndFormat(addChangelogOptions(), function (cmd) {
|
|
773
|
+
return getCommentedCommand(cmd, enabledWidgets.changelog);
|
|
774
|
+
}), "\n})");
|
|
775
|
+
};
|
|
776
|
+
var filterMarkedCommands = function filterMarkedCommands(queryString) {
|
|
777
|
+
return queryString.split("\n").filter(function (line) {
|
|
778
|
+
return !line.includes("///") && line.trim();
|
|
779
|
+
}).join("\n");
|
|
780
|
+
};
|
|
781
|
+
var getSampleUserIdentity = function getSampleUserIdentity(enabledWidgets, selectedFramework) {
|
|
782
|
+
var splitCodeLines = SAMPLE_USER_IDENTITY_CODE_STRING[selectedFramework].split("\n");
|
|
783
|
+
return filterMarkedCommands(splitCodeLines.map(function (cmd) {
|
|
784
|
+
var isEmailKey = cmd.includes("email");
|
|
785
|
+
var isObjectStartLine = cmd === splitCodeLines[0];
|
|
786
|
+
var isObjectEndLine = cmd === last(splitCodeLines);
|
|
787
|
+
var isLineHidden = !isEmailKey && !isObjectStartLine && !isObjectEndLine;
|
|
788
|
+
if (!enabledWidgets.chat && isLineHidden || !enabledWidgets.chat && !enabledWidgets.replay) {
|
|
789
|
+
return null;
|
|
790
|
+
}
|
|
791
|
+
return cmd;
|
|
792
|
+
}).join("\n"));
|
|
793
|
+
};
|
|
794
|
+
var sampleConsolidatedCodeString = function sampleConsolidatedCodeString(enabledWidgets, apiKey) {
|
|
795
|
+
return filterMarkedCommands("".concat(buildEmbedWidgetScript(), "\n<script>\n ").concat(enabledWidgets.chat || enabledWidgets.replay ? "window.".concat(NEETO_WIDGET_USER_IDENTITY_KEY, " = {};") : "", "\n ").concat(enabledWidgets.replay ? "window.".concat(SESSION_CONTEXT_KEY, " = {};") : "", "\n\n ").concat(indentAndFormat(wrapBlockInOnLoad(embedWidgetFunctionCall(enabledWidgets, apiKey))), "\n</script>"));
|
|
796
|
+
};
|
|
797
|
+
var getEmailWidgetSnippetFormInitialValues = function getEmailWidgetSnippetFormInitialValues(subject) {
|
|
798
|
+
return {
|
|
799
|
+
emails: "",
|
|
800
|
+
subject: subject
|
|
801
|
+
};
|
|
802
|
+
};
|
|
803
|
+
var getSortedPrefixedWidgets = function getSortedPrefixedWidgets(widgets) {
|
|
804
|
+
return widgets.sort().map(function (widget) {
|
|
805
|
+
return "neeto".concat(capitalize(widget));
|
|
806
|
+
});
|
|
807
|
+
};
|
|
808
|
+
var getEmailWidgetSnippetValidationSchema = function getEmailWidgetSnippetValidationSchema() {
|
|
809
|
+
return yup.object({
|
|
810
|
+
emails: yup.array().required().label(i18next.t("neetoMolecules.widget.email.fields.emails.label")),
|
|
811
|
+
subject: yup.string().required().label(i18next.t("neetoMolecules.widget.email.fields.subject.label"))
|
|
812
|
+
});
|
|
813
|
+
};
|
|
814
|
+
var getWidgetApiKeyUrl = function getWidgetApiKeyUrl() {
|
|
815
|
+
return "api/widget/v1/api_keys/".concat(window.globalProps.organization.subdomain);
|
|
816
|
+
};
|
|
817
|
+
|
|
818
|
+
var _require = require("axios"),
|
|
819
|
+
axios = _require["default"];
|
|
820
|
+
var queryWidgetApiKey = function queryWidgetApiKey() {
|
|
821
|
+
return axios.get(getWidgetApiKeyUrl(), {
|
|
822
|
+
showToastr: false
|
|
823
|
+
});
|
|
824
|
+
};
|
|
825
|
+
var emailWidgetSnippet = function emailWidgetSnippet(data) {
|
|
826
|
+
return axios.post(EMBED_CODE_EMAIL_URL, data);
|
|
827
|
+
};
|
|
828
|
+
var fetchWidgetConfiguration = function fetchWidgetConfiguration() {
|
|
829
|
+
return axios.get(WIDGET_CONFIG_URL);
|
|
830
|
+
};
|
|
831
|
+
var updateWidgetConfiguration = function updateWidgetConfiguration(_ref) {
|
|
832
|
+
var id = _ref.id,
|
|
833
|
+
payload = _ref.payload;
|
|
834
|
+
return axios.put("".concat(WIDGET_CONFIG_URL, "/").concat(id), payload);
|
|
835
|
+
};
|
|
836
|
+
|
|
837
|
+
var useEmailEmbedCode = function useEmailEmbedCode(onSuccess) {
|
|
838
|
+
return useMutation(function (emailData) {
|
|
839
|
+
return emailWidgetSnippet(emailData);
|
|
840
|
+
}, {
|
|
841
|
+
onSuccess: onSuccess
|
|
842
|
+
});
|
|
843
|
+
};
|
|
844
|
+
|
|
845
|
+
var CodeSnippet = function CodeSnippet(_ref) {
|
|
846
|
+
var isPaneOpen = _ref.isPaneOpen,
|
|
847
|
+
onClose = _ref.onClose,
|
|
848
|
+
_ref$onSent = _ref.onSent,
|
|
849
|
+
onSent = _ref$onSent === void 0 ? noop : _ref$onSent,
|
|
850
|
+
codeString = _ref.codeString,
|
|
851
|
+
_ref$subject = _ref.subject,
|
|
852
|
+
subject = _ref$subject === void 0 ? "" : _ref$subject,
|
|
853
|
+
_ref$body = _ref.body,
|
|
854
|
+
body = _ref$body === void 0 ? "" : _ref$body,
|
|
855
|
+
_ref$emailType = _ref.emailType,
|
|
856
|
+
emailType = _ref$emailType === void 0 ? EMAIL_TYPES.embedCode : _ref$emailType,
|
|
857
|
+
_ref$enabledWidgets = _ref.enabledWidgets,
|
|
858
|
+
enabledWidgets = _ref$enabledWidgets === void 0 ? {} : _ref$enabledWidgets;
|
|
859
|
+
var _useTranslation = useTranslation(),
|
|
860
|
+
t = _useTranslation.t;
|
|
861
|
+
var _useState = useState(FRAMEWORK_SELECT_OPTIONS[0]),
|
|
862
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
863
|
+
selectedFramework = _useState2[0],
|
|
864
|
+
setSelectedFramework = _useState2[1];
|
|
865
|
+
var emailMutation = useEmailEmbedCode(onSent);
|
|
866
|
+
var codeToDisplay = emailType === EMAIL_TYPES.userIdentity ? getSampleUserIdentity(enabledWidgets, selectedFramework.value) : codeString;
|
|
867
|
+
var handleSubmit = /*#__PURE__*/function () {
|
|
868
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(formData) {
|
|
869
|
+
var _body$ref$current$inn, _body$ref;
|
|
870
|
+
return regenerator.wrap(function _callee$(_context) {
|
|
871
|
+
while (1) switch (_context.prev = _context.next) {
|
|
872
|
+
case 0:
|
|
873
|
+
if (!any(function (_ref3) {
|
|
874
|
+
var valid = _ref3.valid;
|
|
875
|
+
return !valid;
|
|
876
|
+
}, formData.emails)) {
|
|
877
|
+
_context.next = 3;
|
|
878
|
+
break;
|
|
879
|
+
}
|
|
880
|
+
Toastr.error(t("neetoMolecules.widget.email.fields.emails.invalidError"));
|
|
881
|
+
return _context.abrupt("return");
|
|
882
|
+
case 3:
|
|
883
|
+
emailMutation.mutate({
|
|
884
|
+
subject: formData.subject,
|
|
885
|
+
emails: pluck("value", formData.emails),
|
|
886
|
+
message: (_body$ref$current$inn = (_body$ref = body.ref) === null || _body$ref === void 0 ? void 0 : _body$ref.current.innerHTML) !== null && _body$ref$current$inn !== void 0 ? _body$ref$current$inn : body,
|
|
887
|
+
snippet: codeToDisplay
|
|
888
|
+
});
|
|
889
|
+
case 4:
|
|
890
|
+
case "end":
|
|
891
|
+
return _context.stop();
|
|
892
|
+
}
|
|
893
|
+
}, _callee);
|
|
894
|
+
}));
|
|
895
|
+
return function handleSubmit(_x) {
|
|
896
|
+
return _ref2.apply(this, arguments);
|
|
897
|
+
};
|
|
898
|
+
}();
|
|
899
|
+
var renderCodeBlockProps = function renderCodeBlockProps() {
|
|
900
|
+
var props = {
|
|
901
|
+
codeString: codeToDisplay,
|
|
902
|
+
showCopyButton: false,
|
|
903
|
+
className: "neeto-ui-bg-primary-100 neeto-ui-rounded-lg"
|
|
904
|
+
};
|
|
905
|
+
if (emailType === EMAIL_TYPES.userIdentity) {
|
|
906
|
+
props = assoc("frameworkProps", {
|
|
907
|
+
selectedFramework: selectedFramework,
|
|
908
|
+
setSelectedFramework: setSelectedFramework
|
|
909
|
+
}, props);
|
|
910
|
+
}
|
|
911
|
+
return props;
|
|
912
|
+
};
|
|
913
|
+
return /*#__PURE__*/React__default.createElement(Pane, {
|
|
914
|
+
isOpen: isPaneOpen,
|
|
915
|
+
onClose: onClose
|
|
916
|
+
}, /*#__PURE__*/React__default.createElement(Formik, {
|
|
917
|
+
initialValues: getEmailWidgetSnippetFormInitialValues(subject),
|
|
918
|
+
validationSchema: getEmailWidgetSnippetValidationSchema(),
|
|
919
|
+
onSubmit: handleSubmit
|
|
920
|
+
}, /*#__PURE__*/React__default.createElement(Form, null, /*#__PURE__*/React__default.createElement(Pane.Header, null, /*#__PURE__*/React__default.createElement(Typography, {
|
|
921
|
+
style: "h2"
|
|
922
|
+
}, t("neetoMolecules.widget.email.title"))), /*#__PURE__*/React__default.createElement(Pane.Body, null, /*#__PURE__*/React__default.createElement("div", {
|
|
923
|
+
className: "w-full space-y-4"
|
|
924
|
+
}, /*#__PURE__*/React__default.createElement(MultiEmailInput, {
|
|
925
|
+
required: true,
|
|
926
|
+
label: t("neetoMolecules.widget.email.fields.emails.label"),
|
|
927
|
+
name: "emails",
|
|
928
|
+
placeholder: t("neetoMolecules.widget.email.fields.emails.placeholder")
|
|
929
|
+
}), /*#__PURE__*/React__default.createElement(Input, {
|
|
930
|
+
required: true,
|
|
931
|
+
label: t("neetoMolecules.widget.email.fields.subject.label"),
|
|
932
|
+
name: "subject",
|
|
933
|
+
type: "text"
|
|
934
|
+
}), /*#__PURE__*/React__default.createElement(Typography, {
|
|
935
|
+
style: "body2"
|
|
936
|
+
}, body), /*#__PURE__*/React__default.createElement(CodeBlock, renderCodeBlockProps()))), /*#__PURE__*/React__default.createElement(Pane.Footer, {
|
|
937
|
+
className: "gap-x-2"
|
|
938
|
+
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
939
|
+
disabled: emailMutation.isLoading,
|
|
940
|
+
label: t("neetoMolecules.widget.email.actions.send"),
|
|
941
|
+
loading: emailMutation.isLoading,
|
|
942
|
+
type: "submit"
|
|
943
|
+
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
944
|
+
label: t("neetoMolecules.widget.email.actions.cancel"),
|
|
945
|
+
style: "text",
|
|
946
|
+
onClick: onClose
|
|
947
|
+
})))));
|
|
948
|
+
};
|
|
949
|
+
|
|
950
|
+
var useForceUpdate = function useForceUpdate() {
|
|
951
|
+
// eslint-disable-next-line react/hook-use-state
|
|
952
|
+
var _useState = useState(0),
|
|
953
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
954
|
+
setValue = _useState2[1];
|
|
955
|
+
return function () {
|
|
956
|
+
return setValue(function (value) {
|
|
957
|
+
return value + 1;
|
|
958
|
+
});
|
|
959
|
+
};
|
|
960
|
+
};
|
|
961
|
+
|
|
962
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
963
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
964
|
+
var useFetchApiKey = function useFetchApiKey() {
|
|
965
|
+
return useQuery(QUERY_KEYS.apiKey, function () {
|
|
966
|
+
if (window.globalProps.railsEnv === "heroku" || !process.env.ENABLE_SSO) {
|
|
967
|
+
return Promise.resolve({
|
|
968
|
+
widgetApiKey: "placeholder-api-key"
|
|
969
|
+
});
|
|
970
|
+
}
|
|
971
|
+
return queryWidgetApiKey();
|
|
972
|
+
}, {
|
|
973
|
+
staleTime: DEFAULT_QUERY_STALE_TIME
|
|
974
|
+
});
|
|
975
|
+
};
|
|
976
|
+
var useFetchConfigurations = function useFetchConfigurations() {
|
|
977
|
+
return useQuery(QUERY_KEYS.configuration, fetchWidgetConfiguration, {
|
|
978
|
+
staleTime: DEFAULT_QUERY_STALE_TIME
|
|
979
|
+
});
|
|
980
|
+
};
|
|
981
|
+
var useUpdateConfigurations = function useUpdateConfigurations() {
|
|
982
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
983
|
+
var queryClient = useQueryClient();
|
|
984
|
+
return useMutation(updateWidgetConfiguration, _objectSpread(_objectSpread({}, options), {}, {
|
|
985
|
+
onSuccess: function onSuccess() {
|
|
986
|
+
return queryClient.invalidateQueries(QUERY_KEYS.configuration);
|
|
987
|
+
}
|
|
988
|
+
}));
|
|
989
|
+
};
|
|
990
|
+
|
|
991
|
+
var TooltipSwitch = withT(function (_ref) {
|
|
992
|
+
var t = _ref.t,
|
|
993
|
+
enabledClientApps = _ref.enabledClientApps,
|
|
994
|
+
widget = _ref.widget,
|
|
995
|
+
selectedWidgets = _ref.selectedWidgets,
|
|
996
|
+
updateSelectedWidgets = _ref.updateSelectedWidgets;
|
|
997
|
+
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
998
|
+
disabled: enabledClientApps.includes(widget),
|
|
999
|
+
placement: "right",
|
|
1000
|
+
content: t("neetoMolecules.widget.tooltips.productIsDisabled", {
|
|
1001
|
+
productName: "neeto".concat(capitalize(widget))
|
|
1002
|
+
})
|
|
1003
|
+
}, /*#__PURE__*/React__default.createElement(Switch, {
|
|
1004
|
+
checked: selectedWidgets.includes(widget),
|
|
1005
|
+
disabled: !enabledClientApps.includes(widget),
|
|
1006
|
+
onChange: function onChange() {
|
|
1007
|
+
return updateSelectedWidgets(widget);
|
|
1008
|
+
}
|
|
1009
|
+
}));
|
|
1010
|
+
});
|
|
1011
|
+
|
|
1012
|
+
var SelectionSwitches = function SelectionSwitches(_ref) {
|
|
1013
|
+
var selectedWidgets = _ref.selectedWidgets,
|
|
1014
|
+
updateSelectedWidgets = _ref.updateSelectedWidgets,
|
|
1015
|
+
primaryApp = _ref.primaryApp,
|
|
1016
|
+
enabledClientApps = _ref.enabledClientApps;
|
|
1017
|
+
var primaryWidget = WIDGET_TYPES_VALUES.includes(primaryApp) ? primaryApp : "";
|
|
1018
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
1019
|
+
className: "mb-4 flex w-full items-center justify-between gap-2"
|
|
1020
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1021
|
+
className: "flex items-center space-x-2"
|
|
1022
|
+
}, isNotEmpty(primaryWidget) && /*#__PURE__*/React__default.createElement(TooltipSwitch, {
|
|
1023
|
+
enabledClientApps: enabledClientApps,
|
|
1024
|
+
selectedWidgets: selectedWidgets,
|
|
1025
|
+
updateSelectedWidgets: updateSelectedWidgets,
|
|
1026
|
+
widget: primaryWidget
|
|
1027
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
1028
|
+
className: "flex items-center space-x-1"
|
|
1029
|
+
}, /*#__PURE__*/React__default.createElement(Label, null, "neeto", capitalize(primaryWidget)), /*#__PURE__*/React__default.createElement("a", {
|
|
1030
|
+
href: WIDGET_KB_HELP_URL[primaryApp],
|
|
1031
|
+
rel: "noreferrer",
|
|
1032
|
+
target: "_blank"
|
|
1033
|
+
}, /*#__PURE__*/React__default.createElement(Info, {
|
|
1034
|
+
size: 16
|
|
1035
|
+
})))), /*#__PURE__*/React__default.createElement("div", {
|
|
1036
|
+
className: "flex items-center justify-end gap-6"
|
|
1037
|
+
}, WIDGET_TYPES_VALUES.map(function (widget, index) {
|
|
1038
|
+
return primaryApp !== widget && /*#__PURE__*/React__default.createElement("div", {
|
|
1039
|
+
className: "flex items-center space-x-2",
|
|
1040
|
+
key: index
|
|
1041
|
+
}, /*#__PURE__*/React__default.createElement(TooltipSwitch, {
|
|
1042
|
+
enabledClientApps: enabledClientApps,
|
|
1043
|
+
selectedWidgets: selectedWidgets,
|
|
1044
|
+
updateSelectedWidgets: updateSelectedWidgets,
|
|
1045
|
+
widget: widget
|
|
1046
|
+
}), /*#__PURE__*/React__default.createElement(Label, null, "neeto", capitalize(widget)));
|
|
1047
|
+
})));
|
|
1048
|
+
};
|
|
1049
|
+
|
|
1050
|
+
var EmbedCode = function EmbedCode(_ref) {
|
|
1051
|
+
var showSessionContext = _ref.showSessionContext,
|
|
1052
|
+
showUserIdentity = _ref.showUserIdentity,
|
|
1053
|
+
_ref$primaryApp = _ref.primaryApp,
|
|
1054
|
+
primaryApp = _ref$primaryApp === void 0 ? "" : _ref$primaryApp,
|
|
1055
|
+
_ref$maxWidth = _ref.maxWidth,
|
|
1056
|
+
maxWidth = _ref$maxWidth === void 0 ? "max-w-3xl" : _ref$maxWidth;
|
|
1057
|
+
var _useState = useState(EMAIL_TYPES["null"]),
|
|
1058
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1059
|
+
emailType = _useState2[0],
|
|
1060
|
+
setEmailType = _useState2[1];
|
|
1061
|
+
var _useState3 = useState(FRAMEWORK_SELECT_OPTIONS[0]),
|
|
1062
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
1063
|
+
selectedFramework = _useState4[0],
|
|
1064
|
+
setSelectedFramework = _useState4[1];
|
|
1065
|
+
var _useTranslation = useTranslation(),
|
|
1066
|
+
t = _useTranslation.t;
|
|
1067
|
+
var bodyRef = useRef();
|
|
1068
|
+
var forceUpdate = useForceUpdate();
|
|
1069
|
+
useEffect(function () {
|
|
1070
|
+
forceUpdate();
|
|
1071
|
+
}, []);
|
|
1072
|
+
var _useFetchApiKey = useFetchApiKey(),
|
|
1073
|
+
_useFetchApiKey$data = _useFetchApiKey.data,
|
|
1074
|
+
_useFetchApiKey$data2 = _useFetchApiKey$data === void 0 ? {} : _useFetchApiKey$data,
|
|
1075
|
+
_useFetchApiKey$data3 = _useFetchApiKey$data2.widgetApiKey,
|
|
1076
|
+
widgetApiKey = _useFetchApiKey$data3 === void 0 ? "" : _useFetchApiKey$data3,
|
|
1077
|
+
isLoadingApiKey = _useFetchApiKey.isLoading;
|
|
1078
|
+
var _useFetchConfiguratio = useFetchConfigurations(),
|
|
1079
|
+
_useFetchConfiguratio2 = _useFetchConfiguratio.data,
|
|
1080
|
+
_useFetchConfiguratio3 = _useFetchConfiguratio2 === void 0 ? {} : _useFetchConfiguratio2,
|
|
1081
|
+
_useFetchConfiguratio4 = _useFetchConfiguratio3.neetoWidgetTokens,
|
|
1082
|
+
neetoWidgetTokens = _useFetchConfiguratio4 === void 0 ? [] : _useFetchConfiguratio4,
|
|
1083
|
+
isLoadingConfigurations = _useFetchConfiguratio.isLoading;
|
|
1084
|
+
var _useUpdateConfigurati = useUpdateConfigurations(),
|
|
1085
|
+
updateWidgetConfiguration = _useUpdateConfigurati.mutate;
|
|
1086
|
+
var previousEmailType = usePrevious(emailType);
|
|
1087
|
+
var selectedWidgets = neetoWidgetTokens.filter(prop("enabled")).map(function (item) {
|
|
1088
|
+
return item.clientApplicationName.toLowerCase();
|
|
1089
|
+
});
|
|
1090
|
+
var enabledClientApps = neetoWidgetTokens.filter(prop("clientApplicationEnabled")).map(function (item) {
|
|
1091
|
+
return item.clientApplicationName.toLowerCase();
|
|
1092
|
+
});
|
|
1093
|
+
var enabledWidgets = fromPairs(selectedWidgets.map(function (widget) {
|
|
1094
|
+
return [widget, true];
|
|
1095
|
+
}));
|
|
1096
|
+
var shouldShowUserIdentity = showUserIdentity !== null && showUserIdentity !== void 0 ? showUserIdentity : enabledWidgets.chat || enabledWidgets.replay;
|
|
1097
|
+
var shouldShowSessionContext = showSessionContext !== null && showSessionContext !== void 0 ? showSessionContext : enabledWidgets.replay;
|
|
1098
|
+
var updateSelectedWidgets = function updateSelectedWidgets(widget) {
|
|
1099
|
+
var widgetId = neetoWidgetTokens.find(function (item) {
|
|
1100
|
+
return item.clientApplicationName.toLowerCase() === widget;
|
|
1101
|
+
}).id;
|
|
1102
|
+
var isEnabled = !selectedWidgets.includes(widget);
|
|
1103
|
+
updateWidgetConfiguration({
|
|
1104
|
+
id: widgetId,
|
|
1105
|
+
payload: {
|
|
1106
|
+
enabled: isEnabled
|
|
1107
|
+
}
|
|
1108
|
+
}, {
|
|
1109
|
+
onSuccess: function onSuccess() {
|
|
1110
|
+
var productName = "neeto".concat(capitalize(widget));
|
|
1111
|
+
var response = isEnabled ? "neetoMolecules.widget.installation.enabled" : "neetoMolecules.widget.installation.disabled";
|
|
1112
|
+
Toastr.success(t(response, {
|
|
1113
|
+
productName: productName
|
|
1114
|
+
}));
|
|
1115
|
+
}
|
|
1116
|
+
});
|
|
1117
|
+
};
|
|
1118
|
+
var getEmbedCodeString = function getEmbedCodeString() {
|
|
1119
|
+
return isNotEmpty(widgetApiKey) ? sampleConsolidatedCodeString(enabledWidgets, widgetApiKey) : "";
|
|
1120
|
+
};
|
|
1121
|
+
var getSnippetProps = function getSnippetProps(selectedEmailType) {
|
|
1122
|
+
switch (selectedEmailType) {
|
|
1123
|
+
case EMAIL_TYPES.embedCode:
|
|
1124
|
+
return {
|
|
1125
|
+
codeString: getEmbedCodeString(),
|
|
1126
|
+
subject: t("neetoMolecules.widget.email.fields.subject.values.embedCode"),
|
|
1127
|
+
body: /*#__PURE__*/React__default.createElement("div", {
|
|
1128
|
+
ref: bodyRef
|
|
1129
|
+
}, /*#__PURE__*/React__default.createElement(Trans, {
|
|
1130
|
+
i18nKey: "neetoMolecules.widget.email.body.values.embedCode",
|
|
1131
|
+
components: {
|
|
1132
|
+
p: /*#__PURE__*/React__default.createElement("p", {
|
|
1133
|
+
style: {
|
|
1134
|
+
marginBottom: "8px"
|
|
1135
|
+
}
|
|
1136
|
+
}),
|
|
1137
|
+
mail: /*#__PURE__*/React__default.createElement("a", {
|
|
1138
|
+
className: "neeto-ui-text-primary-800",
|
|
1139
|
+
href: "mailto:".concat(INSTALLATION_HELP_EMAIL),
|
|
1140
|
+
rel: "noreferrer",
|
|
1141
|
+
target: "_blank"
|
|
1142
|
+
})
|
|
1143
|
+
},
|
|
1144
|
+
values: {
|
|
1145
|
+
val: getSortedPrefixedWidgets(selectedWidgets),
|
|
1146
|
+
helpEmail: INSTALLATION_HELP_EMAIL
|
|
1147
|
+
}
|
|
1148
|
+
}))
|
|
1149
|
+
};
|
|
1150
|
+
case EMAIL_TYPES.userIdentity:
|
|
1151
|
+
return {
|
|
1152
|
+
emailType: EMAIL_TYPES.userIdentity,
|
|
1153
|
+
enabledWidgets: enabledWidgets,
|
|
1154
|
+
subject: t("neetoMolecules.widget.email.fields.subject.values.userIdentity"),
|
|
1155
|
+
body: /*#__PURE__*/React__default.createElement("div", {
|
|
1156
|
+
ref: bodyRef
|
|
1157
|
+
}, /*#__PURE__*/React__default.createElement(Trans, {
|
|
1158
|
+
i18nKey: "neetoMolecules.widget.email.body.values.userIdentity",
|
|
1159
|
+
components: {
|
|
1160
|
+
p: /*#__PURE__*/React__default.createElement("p", {
|
|
1161
|
+
style: {
|
|
1162
|
+
marginBottom: "8px"
|
|
1163
|
+
}
|
|
1164
|
+
}),
|
|
1165
|
+
configureLink: /*#__PURE__*/React__default.createElement("a", {
|
|
1166
|
+
className: "neeto-ui-text-primary-800",
|
|
1167
|
+
rel: "noreferrer",
|
|
1168
|
+
target: "_blank",
|
|
1169
|
+
href: enabledWidgets.chat ? NEETO_CHAT_USER_IDENTITY_URL : NEETO_REPLAY_CONFIGURE_URL
|
|
1170
|
+
})
|
|
1171
|
+
},
|
|
1172
|
+
values: {
|
|
1173
|
+
userIdentityKbUrl: enabledWidgets.chat ? NEETO_CHAT_USER_IDENTITY_URL : NEETO_REPLAY_CONFIGURE_URL
|
|
1174
|
+
}
|
|
1175
|
+
}))
|
|
1176
|
+
};
|
|
1177
|
+
case EMAIL_TYPES.sessionContext:
|
|
1178
|
+
return {
|
|
1179
|
+
codeString: SAMPLE_CONTEXT_CODE_STRING,
|
|
1180
|
+
subject: t("neetoMolecules.widget.email.fields.subject.values.sessionContext"),
|
|
1181
|
+
body: /*#__PURE__*/React__default.createElement("div", {
|
|
1182
|
+
ref: bodyRef
|
|
1183
|
+
}, /*#__PURE__*/React__default.createElement(Trans, {
|
|
1184
|
+
i18nKey: "neetoMolecules.widget.email.body.values.sessionContext",
|
|
1185
|
+
values: {
|
|
1186
|
+
sessionContextKbUrl: NEETO_REPLAY_CONFIGURE_URL
|
|
1187
|
+
},
|
|
1188
|
+
components: {
|
|
1189
|
+
p: /*#__PURE__*/React__default.createElement("p", {
|
|
1190
|
+
style: {
|
|
1191
|
+
marginBottom: "8px"
|
|
1192
|
+
}
|
|
1193
|
+
}),
|
|
1194
|
+
configureLink: /*#__PURE__*/React__default.createElement("a", {
|
|
1195
|
+
className: "neeto-ui-text-primary-800",
|
|
1196
|
+
href: NEETO_REPLAY_CONFIGURE_URL,
|
|
1197
|
+
rel: "noreferrer",
|
|
1198
|
+
target: "_blank"
|
|
1199
|
+
})
|
|
1200
|
+
}
|
|
1201
|
+
}))
|
|
1202
|
+
};
|
|
1203
|
+
case EMAIL_TYPES["null"]:
|
|
1204
|
+
return previousEmailType !== EMAIL_TYPES["null"] ? getSnippetProps(previousEmailType) : {};
|
|
1205
|
+
default:
|
|
1206
|
+
throw new Error(t("neetoMolecules.widget.email.invalidType"));
|
|
1207
|
+
}
|
|
1208
|
+
};
|
|
1209
|
+
var handleSendViaEmail = function handleSendViaEmail(selectedEmail) {
|
|
1210
|
+
if (isEmpty(selectedWidgets)) {
|
|
1211
|
+
Toastr.error(t("neetoMolecules.widget.installation.snippet.disabledError"));
|
|
1212
|
+
return;
|
|
1213
|
+
}
|
|
1214
|
+
setEmailType(selectedEmail);
|
|
1215
|
+
};
|
|
1216
|
+
if (isLoadingApiKey || isLoadingConfigurations) {
|
|
1217
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
1218
|
+
className: "h-full w-full"
|
|
1219
|
+
}, /*#__PURE__*/React__default.createElement(PageLoader$1, null));
|
|
1220
|
+
}
|
|
1221
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
1222
|
+
className: "mx-auto mb-10 w-full flex-col items-center justify-start"
|
|
1223
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1224
|
+
className: classnames("mx-auto", maxWidth)
|
|
1225
|
+
}, /*#__PURE__*/React__default.createElement(SelectionSwitches, {
|
|
1226
|
+
enabledClientApps: enabledClientApps,
|
|
1227
|
+
primaryApp: primaryApp,
|
|
1228
|
+
selectedWidgets: selectedWidgets,
|
|
1229
|
+
updateSelectedWidgets: updateSelectedWidgets
|
|
1230
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
1231
|
+
className: "mb-8 w-full flex-grow flex-col items-center justify-start"
|
|
1232
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1233
|
+
className: "mx-auto mb-2 w-full",
|
|
1234
|
+
"data-testid": "embed-code-block"
|
|
1235
|
+
}, /*#__PURE__*/React__default.createElement(CodeBlock, {
|
|
1236
|
+
className: "neeto-ui-bg-primary-100 neeto-ui-rounded-lg",
|
|
1237
|
+
codeString: getEmbedCodeString(),
|
|
1238
|
+
sendViaEmail: function sendViaEmail() {
|
|
1239
|
+
return handleSendViaEmail(EMAIL_TYPES.embedCode);
|
|
1240
|
+
},
|
|
1241
|
+
title: /*#__PURE__*/React__default.createElement("div", null, t("neetoMolecules.widget.title.embedCode"))
|
|
1242
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
1243
|
+
className: "w-full"
|
|
1244
|
+
}, /*#__PURE__*/React__default.createElement(Trans, {
|
|
1245
|
+
values: {
|
|
1246
|
+
val: getSortedPrefixedWidgets(selectedWidgets)
|
|
1247
|
+
},
|
|
1248
|
+
components: {
|
|
1249
|
+
fontBold: /*#__PURE__*/React__default.createElement("span", {
|
|
1250
|
+
className: "font-semibold"
|
|
1251
|
+
}),
|
|
1252
|
+
fontNormal: /*#__PURE__*/React__default.createElement("span", {
|
|
1253
|
+
className: "font-normal"
|
|
1254
|
+
})
|
|
1255
|
+
},
|
|
1256
|
+
i18nKey: isNotEmpty(selectedWidgets) ? "neetoMolecules.widget.installation.instructions.placement.selectedWidgets" : "neetoMolecules.widget.installation.instructions.placement.noneOfThese"
|
|
1257
|
+
}))), shouldShowUserIdentity ? /*#__PURE__*/React__default.createElement("div", {
|
|
1258
|
+
className: "mb-8 w-full flex-grow flex-col items-center justify-start"
|
|
1259
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1260
|
+
className: "mx-auto mb-2 w-full"
|
|
1261
|
+
}, /*#__PURE__*/React__default.createElement(CodeBlock, {
|
|
1262
|
+
className: "neeto-ui-bg-primary-100 neeto-ui-rounded-lg",
|
|
1263
|
+
frameworkProps: {
|
|
1264
|
+
selectedFramework: selectedFramework,
|
|
1265
|
+
setSelectedFramework: setSelectedFramework
|
|
1266
|
+
},
|
|
1267
|
+
codeString: getSampleUserIdentity(enabledWidgets, selectedFramework.value),
|
|
1268
|
+
sendViaEmail: function sendViaEmail() {
|
|
1269
|
+
return handleSendViaEmail(EMAIL_TYPES.userIdentity);
|
|
1270
|
+
},
|
|
1271
|
+
title: /*#__PURE__*/React__default.createElement("div", {
|
|
1272
|
+
className: "flex items-center justify-start"
|
|
1273
|
+
}, /*#__PURE__*/React__default.createElement("div", null, t("neetoMolecules.widget.title.userIdentity")), /*#__PURE__*/React__default.createElement("a", {
|
|
1274
|
+
className: "ml-1",
|
|
1275
|
+
rel: "noreferrer",
|
|
1276
|
+
target: "_blank",
|
|
1277
|
+
href: enabledWidgets.chat ? NEETO_CHAT_USER_IDENTITY_URL : NEETO_REPLAY_CONFIGURE_URL
|
|
1278
|
+
}, /*#__PURE__*/React__default.createElement(Info, {
|
|
1279
|
+
size: 16
|
|
1280
|
+
})))
|
|
1281
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
1282
|
+
className: "w-full"
|
|
1283
|
+
}, t("neetoMolecules.widget.installation.instructions.userIdentity"))) : null, shouldShowSessionContext ? /*#__PURE__*/React__default.createElement("div", {
|
|
1284
|
+
className: "w-full flex-grow flex-col items-center justify-start"
|
|
1285
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1286
|
+
className: "mx-auto mb-2 w-full"
|
|
1287
|
+
}, /*#__PURE__*/React__default.createElement(CodeBlock, {
|
|
1288
|
+
className: "neeto-ui-bg-primary-100 neeto-ui-rounded-lg",
|
|
1289
|
+
codeString: SAMPLE_CONTEXT_CODE_STRING,
|
|
1290
|
+
sendViaEmail: function sendViaEmail() {
|
|
1291
|
+
return handleSendViaEmail(EMAIL_TYPES.sessionContext);
|
|
1292
|
+
},
|
|
1293
|
+
title: /*#__PURE__*/React__default.createElement("div", {
|
|
1294
|
+
className: "flex items-center justify-start"
|
|
1295
|
+
}, /*#__PURE__*/React__default.createElement("div", null, t("neetoMolecules.widget.title.sessionContext")), /*#__PURE__*/React__default.createElement("a", {
|
|
1296
|
+
className: "ml-1",
|
|
1297
|
+
href: NEETO_REPLAY_CONFIGURE_URL,
|
|
1298
|
+
rel: "noreferrer",
|
|
1299
|
+
target: "_blank"
|
|
1300
|
+
}, /*#__PURE__*/React__default.createElement(Info, {
|
|
1301
|
+
size: 16
|
|
1302
|
+
})))
|
|
1303
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
1304
|
+
className: "w-full"
|
|
1305
|
+
}, t("neetoMolecules.widget.installation.instructions.sessionContext"))) : null), /*#__PURE__*/React__default.createElement(CodeSnippet, _extends$1({
|
|
1306
|
+
isPaneOpen: !!emailType && isNotEmpty(selectedWidgets),
|
|
1307
|
+
onClose: function onClose() {
|
|
1308
|
+
return setEmailType(EMAIL_TYPES["null"]);
|
|
1309
|
+
}
|
|
1310
|
+
}, getSnippetProps(emailType))));
|
|
1311
|
+
};
|
|
1312
|
+
var EmbedCode$1 = /*#__PURE__*/React__default.memo(EmbedCode);
|
|
1313
|
+
|
|
1314
|
+
var queryClient = new QueryClient();
|
|
1315
|
+
var Main = function Main(props) {
|
|
1316
|
+
var _useTranslation = useTranslation(),
|
|
1317
|
+
t = _useTranslation.t;
|
|
1318
|
+
var shouldRenderEmbedCode = window.globalProps.ssoEnabled;
|
|
1319
|
+
return shouldRenderEmbedCode ? /*#__PURE__*/React__default.createElement(QueryClientProvider, {
|
|
1320
|
+
client: queryClient
|
|
1321
|
+
}, /*#__PURE__*/React__default.createElement(EmbedCode$1, props)) : /*#__PURE__*/React__default.createElement(Callout, {
|
|
1322
|
+
icon: Info,
|
|
1323
|
+
style: "info"
|
|
1324
|
+
}, t("neetoMolecules.widget.developmentInfo"));
|
|
1325
|
+
};
|
|
1326
|
+
|
|
1327
|
+
var NeetoWidget = {
|
|
1328
|
+
EmbedCode: Main,
|
|
1329
|
+
WIDGET_TYPES: WIDGET_TYPES
|
|
1330
|
+
};
|
|
1331
|
+
|
|
1332
|
+
export { NeetoWidget as default };
|
|
1333
|
+
//# sourceMappingURL=NeetoWidget.js.map
|