@bikdotai/bik-component-library 0.0.519 → 0.0.520-beta.0
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/cjs/assets/icons/emoji.svg.js +1 -1
- package/dist/cjs/assets/icons/halfRectangle.svg.js +1 -1
- package/dist/cjs/assets/icons/strikeThrough.svg.js +1 -1
- package/dist/cjs/assets/icons/sub_category.svg.js +1 -0
- package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/SingleDate.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/TwoDate.js +1 -1
- package/dist/cjs/components/SearchFilter/components/DatePickerButton.js +1 -1
- package/dist/cjs/components/SearchFilter/components/DateRangeOnlyButton.js +1 -1
- package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.d.ts +0 -4
- package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.d.ts +0 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsMetric.d.ts +0 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsMetric.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsTrend.d.ts +0 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsTrend.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/CommonStyles.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.d.ts +0 -2
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.styled.d.ts +0 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.styled.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/heatmap/HeatMapVertical.js +1 -1
- package/dist/cjs/components/bik-layout/BikSidebar.js +1 -1
- package/dist/cjs/components/bik-layout/MockMenus.d.ts +1 -20
- package/dist/cjs/components/bik-layout/SidebarStyles.js +1 -1
- package/dist/cjs/components/card-selector/CardSelector.d.ts +0 -1
- package/dist/cjs/components/card-selector/CardSelector.js +1 -1
- package/dist/cjs/components/card-selector/CardSelectorGroup.js +1 -1
- package/dist/cjs/components/carousel-preview/CarouselPreviewCard.js +1 -1
- package/dist/cjs/components/checkBox/CheckBox.d.ts +0 -4
- package/dist/cjs/components/checkBox/CheckBox.js +1 -1
- package/dist/cjs/components/checkBox/CheckBox.styled.d.ts +0 -1
- package/dist/cjs/components/checkBox/CheckBox.styled.js +3 -4
- package/dist/cjs/components/checkList/CheckList.d.ts +0 -1
- package/dist/cjs/components/checkList/CheckList.js +1 -1
- package/dist/cjs/components/custom-date-time/DateSelector/DateSelector.js +1 -1
- package/dist/cjs/components/datePicker/DatePickerWrapper.d.ts +2 -1
- package/dist/cjs/components/datePicker/DatePickerWrapper.js +1 -1
- package/dist/cjs/components/datePicker/index.d.ts +0 -1
- package/dist/cjs/components/dropdown/Dropdown.js +1 -1
- package/dist/cjs/components/dropdown/DropdownPopover/index.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.d.ts +0 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js +1 -1
- package/dist/cjs/components/dropdown/type.d.ts +0 -3
- package/dist/cjs/components/floater/floater.d.ts +1 -2
- package/dist/cjs/components/floater/floater.js +1 -1
- package/dist/cjs/components/input/Input.d.ts +0 -1
- package/dist/cjs/components/input/Input.js +1 -1
- package/dist/cjs/components/input/Input.styled.js +1 -1
- package/dist/cjs/components/input-with-vars/InputWithVariables.d.ts +0 -1
- package/dist/cjs/components/input-with-vars/InputWithVariables.js +2 -2
- package/dist/cjs/components/list-item/ListItem.d.ts +1 -0
- package/dist/cjs/components/list-item/ListItem.js +1 -1
- package/dist/cjs/components/radioButton/RadioButton.d.ts +0 -3
- package/dist/cjs/components/radioButton/RadioButton.js +1 -1
- package/dist/cjs/components/radioList/RadioList.d.ts +0 -1
- package/dist/cjs/components/radioList/RadioList.js +1 -1
- package/dist/cjs/components/side-modal/SideModal.d.ts +1 -0
- package/dist/cjs/components/side-modal/SideModal.js +1 -1
- package/dist/cjs/components/spinner/Spinner.d.ts +0 -6
- package/dist/cjs/components/spinner/Spinner.js +1 -18
- package/dist/cjs/components/states/StateComponent.d.ts +0 -2
- package/dist/cjs/components/states/StateComponent.js +1 -1
- package/dist/cjs/components/states/StateComponent.styled.d.ts +1 -4
- package/dist/cjs/components/states/StateComponent.styled.js +6 -6
- package/dist/cjs/components/states-modal/StateModalComponent.d.ts +0 -2
- package/dist/cjs/components/states-modal/StateModalComponent.js +1 -1
- package/dist/cjs/components/stepper/Stepper.d.ts +0 -2
- package/dist/cjs/components/stepper/Stepper.js +1 -1
- package/dist/cjs/components/stepper/Stepper.styled.d.ts +0 -1
- package/dist/cjs/components/stepper/Stepper.styled.js +7 -7
- package/dist/cjs/components/tabs/Tabs.js +1 -1
- package/dist/cjs/components/tabs/Tabs.model.d.ts +0 -1
- package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
- package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +8 -0
- package/dist/cjs/components/template-context-mapper/context/templateModalContext.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/Body.js +9 -12
- package/dist/cjs/components/template-context-mapper/modalElements/DesktopPreview.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/DiscountCodeComponent.d.ts +0 -2
- package/dist/cjs/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditMediaModal.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditMediaV2.style.js +1 -0
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/MobilePreview.js +3 -5
- package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.js +4 -4
- package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorsPanel.js +3 -3
- package/dist/cjs/components/template-context-mapper/modalElements/useEditWhtasappTemplateMedia.js +1 -1
- package/dist/cjs/components/template-preview/EmailTemplatePreview.styled.js +14 -16
- package/dist/cjs/components/template-preview/WhatsApp/ChatUI.js +1 -1
- package/dist/cjs/components/template-preview/WhatsApp/ChatUI.style.d.ts +0 -4
- package/dist/cjs/components/template-preview/WhatsApp/ChatUI.style.js +6 -8
- package/dist/cjs/components/template-preview/WhatsApp/ChatUiV2.js +1 -1
- package/dist/cjs/components/template-preview/WhatsApp/WhatsAppLikePreviewV2.js +4 -4
- package/dist/cjs/components/template-preview/helpers/VariableEditorHelper.js +1 -1
- package/dist/cjs/components/variable-picker-v3/Content.d.ts +6 -0
- package/dist/cjs/components/variable-picker-v3/Content.js +1 -0
- package/dist/cjs/components/variable-picker-v3/NoResult.d.ts +6 -0
- package/dist/cjs/components/variable-picker-v3/NoResult.js +17 -0
- package/dist/cjs/components/variable-picker-v3/SubHeaderItems.d.ts +14 -0
- package/dist/cjs/components/variable-picker-v3/SubHeaderItems.js +1 -0
- package/dist/cjs/components/variable-picker-v3/VariablePicker.d.ts +5 -0
- package/dist/cjs/components/variable-picker-v3/VariablePicker.js +1 -0
- package/dist/cjs/components/variable-picker-v3/context.d.ts +21 -0
- package/dist/cjs/components/variable-picker-v3/context.js +1 -0
- package/dist/cjs/components/variable-picker-v3/index.d.ts +1 -0
- package/dist/cjs/components/variable-picker-v3/model.d.ts +56 -0
- package/dist/cjs/components/variable-picker-v3/model.js +1 -0
- package/dist/cjs/components/variable-picker-v3/recommendVaribles.d.ts +1 -0
- package/dist/cjs/components/variable-picker-v3/recommendVaribles.js +1 -0
- package/dist/cjs/components/variable-picker-v3/searchVariables.d.ts +2 -0
- package/dist/cjs/components/variable-picker-v3/searchVariables.js +1 -0
- package/dist/cjs/components/variable-picker-v3/styles.d.ts +6 -0
- package/dist/cjs/components/variable-picker-v3/styles.js +40 -0
- package/dist/cjs/helpers/index.d.ts +1 -0
- package/dist/cjs/hooks/useOutside.d.ts +1 -1
- package/dist/cjs/hooks/useOutside.js +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/assets/icons/emoji.svg.js +1 -1
- package/dist/esm/assets/icons/halfRectangle.svg.js +1 -1
- package/dist/esm/assets/icons/strikeThrough.svg.js +1 -1
- package/dist/esm/assets/icons/sub_category.svg.js +1 -0
- package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/SingleDate.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/TwoDate.js +1 -1
- package/dist/esm/components/SearchFilter/components/DatePickerButton.js +1 -1
- package/dist/esm/components/SearchFilter/components/DateRangeOnlyButton.js +1 -1
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.d.ts +0 -4
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.d.ts +0 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsMetric.d.ts +0 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsMetric.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.d.ts +0 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/CommonStyles.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.d.ts +0 -2
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.styled.d.ts +0 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.styled.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/heatmap/HeatMapVertical.js +1 -1
- package/dist/esm/components/bik-layout/BikSidebar.js +1 -1
- package/dist/esm/components/bik-layout/MockMenus.d.ts +1 -20
- package/dist/esm/components/bik-layout/SidebarStyles.js +1 -1
- package/dist/esm/components/card-selector/CardSelector.d.ts +0 -1
- package/dist/esm/components/card-selector/CardSelector.js +1 -1
- package/dist/esm/components/card-selector/CardSelectorGroup.js +1 -1
- package/dist/esm/components/carousel-preview/CarouselPreviewCard.js +1 -1
- package/dist/esm/components/checkBox/CheckBox.d.ts +0 -4
- package/dist/esm/components/checkBox/CheckBox.js +1 -1
- package/dist/esm/components/checkBox/CheckBox.styled.d.ts +0 -1
- package/dist/esm/components/checkBox/CheckBox.styled.js +5 -6
- package/dist/esm/components/checkList/CheckList.d.ts +0 -1
- package/dist/esm/components/checkList/CheckList.js +1 -1
- package/dist/esm/components/custom-date-time/DateSelector/DateSelector.js +1 -1
- package/dist/esm/components/datePicker/DatePickerWrapper.d.ts +2 -1
- package/dist/esm/components/datePicker/DatePickerWrapper.js +1 -1
- package/dist/esm/components/datePicker/index.d.ts +0 -1
- package/dist/esm/components/dropdown/Dropdown.js +1 -1
- package/dist/esm/components/dropdown/DropdownPopover/index.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.d.ts +0 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js +1 -1
- package/dist/esm/components/dropdown/type.d.ts +0 -3
- package/dist/esm/components/floater/floater.d.ts +1 -2
- package/dist/esm/components/floater/floater.js +1 -1
- package/dist/esm/components/input/Input.d.ts +0 -1
- package/dist/esm/components/input/Input.js +1 -1
- package/dist/esm/components/input/Input.styled.js +1 -1
- package/dist/esm/components/input-with-vars/InputWithVariables.d.ts +0 -1
- package/dist/esm/components/input-with-vars/InputWithVariables.js +3 -3
- package/dist/esm/components/list-item/ListItem.d.ts +1 -0
- package/dist/esm/components/list-item/ListItem.js +1 -1
- package/dist/esm/components/radioButton/RadioButton.d.ts +0 -3
- package/dist/esm/components/radioButton/RadioButton.js +1 -1
- package/dist/esm/components/radioList/RadioList.d.ts +0 -1
- package/dist/esm/components/radioList/RadioList.js +1 -1
- package/dist/esm/components/side-modal/SideModal.d.ts +1 -0
- package/dist/esm/components/side-modal/SideModal.js +1 -1
- package/dist/esm/components/spinner/Spinner.d.ts +0 -6
- package/dist/esm/components/spinner/Spinner.js +1 -18
- package/dist/esm/components/states/StateComponent.d.ts +0 -2
- package/dist/esm/components/states/StateComponent.js +1 -1
- package/dist/esm/components/states/StateComponent.styled.d.ts +1 -4
- package/dist/esm/components/states/StateComponent.styled.js +6 -6
- package/dist/esm/components/states-modal/StateModalComponent.d.ts +0 -2
- package/dist/esm/components/states-modal/StateModalComponent.js +1 -1
- package/dist/esm/components/stepper/Stepper.d.ts +0 -2
- package/dist/esm/components/stepper/Stepper.js +1 -1
- package/dist/esm/components/stepper/Stepper.styled.d.ts +0 -1
- package/dist/esm/components/stepper/Stepper.styled.js +6 -6
- package/dist/esm/components/tabs/Tabs.js +1 -1
- package/dist/esm/components/tabs/Tabs.model.d.ts +0 -1
- package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
- package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +8 -0
- package/dist/esm/components/template-context-mapper/context/templateModalContext.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/Body.js +9 -12
- package/dist/esm/components/template-context-mapper/modalElements/DesktopPreview.js +2 -2
- package/dist/esm/components/template-context-mapper/modalElements/DiscountCodeComponent.d.ts +0 -2
- package/dist/esm/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditMediaModal.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditMediaV2.style.js +1 -0
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/MobilePreview.js +3 -5
- package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.js +4 -4
- package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorsPanel.js +3 -3
- package/dist/esm/components/template-context-mapper/modalElements/useEditWhtasappTemplateMedia.js +1 -1
- package/dist/esm/components/template-preview/EmailTemplatePreview.styled.js +0 -2
- package/dist/esm/components/template-preview/WhatsApp/ChatUI.js +2 -2
- package/dist/esm/components/template-preview/WhatsApp/ChatUI.style.d.ts +0 -4
- package/dist/esm/components/template-preview/WhatsApp/ChatUI.style.js +18 -20
- package/dist/esm/components/template-preview/WhatsApp/ChatUiV2.js +4 -4
- package/dist/esm/components/template-preview/WhatsApp/WhatsAppLikePreviewV2.js +5 -5
- package/dist/esm/components/template-preview/helpers/VariableEditorHelper.js +1 -1
- package/dist/esm/components/variable-picker-v3/Content.d.ts +6 -0
- package/dist/esm/components/variable-picker-v3/Content.js +1 -0
- package/dist/esm/components/variable-picker-v3/NoResult.d.ts +6 -0
- package/dist/esm/components/variable-picker-v3/NoResult.js +17 -0
- package/dist/esm/components/variable-picker-v3/SubHeaderItems.d.ts +14 -0
- package/dist/esm/components/variable-picker-v3/SubHeaderItems.js +1 -0
- package/dist/esm/components/variable-picker-v3/VariablePicker.d.ts +5 -0
- package/dist/esm/components/variable-picker-v3/VariablePicker.js +1 -0
- package/dist/esm/components/variable-picker-v3/context.d.ts +21 -0
- package/dist/esm/components/variable-picker-v3/context.js +1 -0
- package/dist/esm/components/variable-picker-v3/index.d.ts +1 -0
- package/dist/esm/components/variable-picker-v3/model.d.ts +56 -0
- package/dist/esm/components/variable-picker-v3/model.js +1 -0
- package/dist/esm/components/variable-picker-v3/recommendVaribles.d.ts +1 -0
- package/dist/esm/components/variable-picker-v3/recommendVaribles.js +1 -0
- package/dist/esm/components/variable-picker-v3/searchVariables.d.ts +2 -0
- package/dist/esm/components/variable-picker-v3/searchVariables.js +1 -0
- package/dist/esm/components/variable-picker-v3/styles.d.ts +6 -0
- package/dist/esm/components/variable-picker-v3/styles.js +40 -0
- package/dist/esm/helpers/index.d.ts +1 -0
- package/dist/esm/hooks/useOutside.d.ts +1 -1
- package/dist/esm/hooks/useOutside.js +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/assets/icons/similar.svg.js +0 -1
- package/dist/cjs/components/action-button/ActionButton.styled.d.ts +0 -7
- package/dist/cjs/components/action-button/ActionButton.styled.js +0 -23
- package/dist/cjs/components/action-button/ActionButtons.d.ts +0 -10
- package/dist/cjs/components/action-button/ActionButtons.js +0 -1
- package/dist/cjs/components/action-button/index.d.ts +0 -1
- package/dist/cjs/components/template-context-mapper/utils/constants.d.ts +0 -1
- package/dist/cjs/components/template-context-mapper/utils/constants.js +0 -1
- package/dist/esm/assets/icons/similar.svg.js +0 -1
- package/dist/esm/components/action-button/ActionButton.styled.d.ts +0 -7
- package/dist/esm/components/action-button/ActionButton.styled.js +0 -23
- package/dist/esm/components/action-button/ActionButtons.d.ts +0 -10
- package/dist/esm/components/action-button/ActionButtons.js +0 -1
- package/dist/esm/components/action-button/index.d.ts +0 -1
- package/dist/esm/components/template-context-mapper/utils/constants.d.ts +0 -1
- package/dist/esm/components/template-context-mapper/utils/constants.js +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import a from"../../../assets/icons/edit.svg.js";import{format as n}from"date-fns";import{cloneDeep as i}from"lodash";import{useState as o,useEffect as s}from"react";import u from"styled-components";import{
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import a from"../../../assets/icons/edit.svg.js";import{format as n}from"date-fns";import{cloneDeep as i}from"lodash";import{useState as o,useEffect as s}from"react";import u from"styled-components";import{CustomDateTime as d}from"../../custom-date-time/CustomDateTime.js";import{Dropdown as c}from"../../dropdown/Dropdown.js";import{Input as r}from"../../input/Input.js";import{truncate as p}from"../../product-picker-v2/collectionScreen.js";import{placeHolderNamePattern as m}from"../../template-preview/constants/regexPatterns.js";import{CHANNEL_TYPE as v}from"../../template-preview/models/Channels.js";import{POD as b}from"../../template-preview/models/WhatsAppTemplate.js";import{BodySecondary as g,BodyPrimary as O}from"../../TypographyStyle.js";import j from"../../../utils/StringUtils.js";import{COLORS as h}from"../../../constants/Theme.js";import{useTemplateModalContext as y}from"../context/templateModalContext.js";import{getVariableNameForEmailByIndex as x}from"../utils/getVariableNameEmail.js";const f=u.div`
|
|
2
2
|
/* surface/$color-background-warning-light */
|
|
3
3
|
|
|
4
|
-
background: ${e=>e.focused&&e.channel===
|
|
4
|
+
background: ${e=>e.focused&&e.channel===v.EMAIL?h.background.warning.light:"transparent"};
|
|
5
5
|
border-radius: 4px;
|
|
6
6
|
padding: 8px 10px;
|
|
7
|
-
`,
|
|
7
|
+
`,_=u.div`
|
|
8
8
|
position: absolute;
|
|
9
9
|
top: 0;
|
|
10
10
|
left: 0;
|
|
@@ -13,4 +13,4 @@ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import a from"..
|
|
|
13
13
|
background-color: rgba(0, 0, 0, 0.1);
|
|
14
14
|
z-index: 1000;
|
|
15
15
|
cursor: not-allowed;
|
|
16
|
-
`,E={value:"custom_link",label:"Custom URL"},k={value:"custom_text",label:"Custom text"},V={value:"static_expiry",label:"Static Expiry"},S=u=>{let{onFocus:S,variable:A,index:C,showVariableModal:B,variableList:P,setShowDiscountCheckBox:w,componentType:D,CTAoptions:N}=u;var L,U,H,R,M;const[W,I]=o(!1),[$,Y]=o(""),[z,Z]=o([]),[G,q]=o(),[F,K]=o(!1),[J,Q]=o(!1),{device:X,channel:ee,isError:te,originalVariableList:le,template:ae,templateSelectionTriggered:ne,setTemplate:ie,setDisplayContent:oe,setOriginalVariableList:se,globalNormalizedPlaceholders:ue,enabledCustomText:de,pod:ce,selectedCarouselIndex:re,isProductCarouselType:pe,disableEditVariable:me,disableEditExpiry:ve,templateErrorIndexes:be}=y();function ge(){var e,t;const l=[];let a=[];if(ee!==b.MESSAGE||de){"link"===(null==A?void 0:A.type)?(l.push({label:"",options:[E,k]}),q(E)):"date_time"===(null==A?void 0:A.type)?(l.push({label:"",options:[E,k]}),q(V)):(l.push({label:"",options:[E,k,V]}),q(k));const e=null!=ue?ue:[];Z([...l,...e.map((e=>{var t,l;return Object.assign(Object.assign({},e),{label:h.toCapitilize(null===(l=null===(t=e.label)||void 0===t?void 0:t.replace(/([A-Z])/g," $1"))||void 0===l?void 0:l.toLowerCase())})}))]),a=[...l,...e]}else{const e=null!=ue?ue:[];Z([{label:"",options:[k,E]},...e]),a=[{label:"",options:[k,E]},...e]}if((ee===b.WHATSAPP||ee===b.EMAIL||ee===b.MESSAGE)&&A.updatedValue)if(v.test(A.updatedValue)&&ee===b.WHATSAPP||A.updatedValue.startsWith("{{")&&ee!==b.WHATSAPP){const e=function(e,t,l){var a;let n={label:"",value:""};const i=l===b.WHATSAPP?e.updatedValue.replace("[[","").replace("]]",""):e.updatedValue.replace("{{","").replace("}}","");if(B){let t=e.updatedValue;if(ce===g.CHATBOT&&"BUTTONS"===D){const l=null==N?void 0:N.filter((t=>t.placeHolder===e.updatedValue));l&&l.length>0&&(t=l[0].label)}n={label:t?t.replace("{{","").replace("}}","").trim().replace("."," "):"",value:null!==(a=e.updatedValue)&&void 0!==a?a:""}}else t.map((e=>{e.options.map((e=>{var t;(null===(t=e.value)||void 0===t?void 0:t.replace("{{","").replace("}}","").trim())===i.trim()&&(n=e)}))}));return n}(A,a,ee);e.value&&q(e)}else"date_time"===A.type?(q(V),Y(A.updatedValue),xe(null!==(e=A.index)&&void 0!==e?e:0,A.updatedValue)):(null===(t=A.updatedValue)||void 0===t?void 0:t.startsWith("https"))?(q(E),Y(A.updatedValue.split("https://")[1])):(q(k),Y(A.updatedValue))}function Oe(e,t){var l,a,n;const i=e;Y(""),q(i),ee===b.WHATSAPP?"custom_text"!==i.value&&"custom_link"!==i.value&&"static_expiry"!==i.value?(he(null!==(l=i.value)&&void 0!==l?l:"","string"),null==xe||xe(null!==(a=A.index)&&void 0!==a?a:0,i.value,!0)):(null==xe||xe(null!==(n=A.index)&&void 0!==n?n:0,"",!0,i.value),he("","url"===i.bikPlaceholderType?"link":"string")):"custom_text"!==i.value&&"custom_link"!==i.value?he(i.value,"url"===i.bikPlaceholderType?"link":"string"):(Y(""),he("",i.value))}function je(e,t){var l;Y(t);const a="custom_link"===(null==G?void 0:G.value)&&t?t.includes("https")?t:`https://${t}`:t;he(a,"static_expiry"===e?"string":e),ee===b.WHATSAPP&&(null==xe||xe(null!==(l=A.index)&&void 0!==l?l:0,a,"custom_link"===e,e))}function he(e,t){var l,a,n,o;const s="custom_link"===t?"link":"custom_text"===t?"string":t;if(ee!==b.WHATSAPP){const a=f(C+1),n=null===document||void 0===document?void 0:document.getElementById("mobile"===X?"template_html_mobile":"template_html_desktop"),i=ee===b.EMAIL?null===(l=null==n?void 0:n.contentWindow)||void 0===l?void 0:l.document.getElementById(a):document.getElementById(a);i&&(i.textContent="custom_text"!==t&&"custom_link"!==t||e?e:A.variableName);const o=le.map(((t,l)=>l===C?Object.assign(Object.assign({},t),{type:s,updatedValue:e}):t));null==se||se(o)}if(ee===b.WHATSAPP){if(null!=re&&re>-1&&pe){const l=Object.assign({},le).cards.map(((l,a)=>{var n,i;return"BODY"===D?Object.assign(Object.assign({},l),{body:null===(n=l.body)||void 0===n?void 0:n.map(((t,l)=>C===l?Object.assign(Object.assign({},t),{type:s,updatedValue:e}):t))}):"BUTTONS"===D?Object.assign(Object.assign({},l),{buttons:null===(i=l.buttons)||void 0===i?void 0:i.map(((l,a)=>a===C?Object.assign(Object.assign({},l),{buttonVariable:"custom_link"===t?"((customPlaceholderName))":e,example:"COPY_CODE"===l.type?e:[e]}):l))}):l}));return void(null==se||se((e=>Object.assign(Object.assign({},e),{cards:l}))))}const l=null!=re&&re>-1?le.cards[re]:le;let u=l.body,d=l.header,c=l.buttons;if("BODY"===D?u=null===(a=l.body)||void 0===a?void 0:a.map(((t,l)=>l===C?Object.assign(Object.assign({},t),{type:s,updatedValue:e}):t)):"HEADER"===D?d=null===(n=l.header)||void 0===n?void 0:n.map(((t,l)=>l===C?Object.assign(Object.assign({},t),{type:s,updatedValue:e}):t)):"BUTTONS"===D&&(c=null===(o=l.buttons)||void 0===o?void 0:o.map(((l,a)=>a===C?Object.assign(Object.assign({},l),{buttonVariable:"custom_link"===t?"((customPlaceholderName))":e,example:"COPY_CODE"===l.type?e:[e]}):l))),null!=re&&re>-1){const e=i(le.cards);e[re]={header:d,body:u,buttons:c},null==se||se((t=>Object.assign(Object.assign({},t),{cards:e})))}else null==se||se((e=>Object.assign(Object.assign({},e),{header:d,body:u,buttons:c})))}}function xe(e,t,l,a){var n,o,s,u,d,c,r;if(null!=re&&re>-1&&pe){const o=Object.assign({},ae).components.map((l=>{var a;return"CAROUSEL"===l.type?Object.assign(Object.assign({},l),{cards:null===(a=l.cards)||void 0===a?void 0:a.map((l=>Object.assign(Object.assign({},l),{components:l.components.map((l=>{var a,n,i,o,s,u;if("BODY"===l.type&&"BODY"===D){if(null===(n=null===(a=l.example)||void 0===a?void 0:a.body_text)||void 0===n?void 0:n[0]){const a=[...null!==(s=null===(o=null===(i=l.example)||void 0===i?void 0:i.body_text)||void 0===o?void 0:o[0])&&void 0!==s?s:[]];a[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const n=Object.assign(Object.assign({},l.example),{body_text:[a]});return Object.assign(Object.assign({},l),{example:n})}return l}if("BUTTONS"===l.type&&"BUTTONS"===D){const a=null===(u=l.buttons)||void 0===u?void 0:u.map(((l,a)=>a===e?Object.assign(Object.assign({},l),{example:[t]}):l));return a?Object.assign(Object.assign({},l),{buttons:a}):l}return l}))})))}):l})),s=i(ae);if(l){const l=null===(n=Object.assign({},ae).mapping.cards)||void 0===n?void 0:n.map(((l,n)=>{var i,o,s;if("BODY"===D)return Object.assign(Object.assign({},l),{body:null===(i=l.body)||void 0===i?void 0:i.map(((l,n)=>e===n?"custom_text"===a?`((editableVariable${n+10}))`:t:l))});if("BUTTONS"===D&&(null==l?void 0:l.buttons)){let i=-1,u=-1;return null===(o=ae.components[1].cards)||void 0===o||o[n].components.forEach((t=>{var l;"BUTTONS"===t.type&&(null===(l=t.buttons)||void 0===l||l.forEach(((t,l)=>{"URL"===t.type&&(i++,l===e&&"URL"==t.type&&(u=i))})))})),Object.assign(Object.assign({},l),{buttons:null===(s=l.buttons)||void 0===s?void 0:s.map(((e,l)=>l===u?"custom_link"===a?"((customPlaceholderName))":t:e))})}return l}));s.mapping.cards=l}return s.components=o,void(null==ie||ie(s))}const p=null!=re&&re>-1?{components:null===(o=Object.assign({},ae).components[1].cards)||void 0===o?void 0:o[re].components,mapping:null===(s=Object.assign({},ae).mapping.cards)||void 0===s?void 0:s[re]}:Object.assign({},ae),m=null===(u=null==p?void 0:p.components)||void 0===u?void 0:u.map((l=>{var a,n,i,o,s,u,d,c,r;const p=Object.assign({},l);if("BODY"===l.type&&"BODY"===D){if(null===(n=null===(a=l.example)||void 0===a?void 0:a.body_text)||void 0===n?void 0:n[0]){const l=[...null!==(s=null===(o=null===(i=p.example)||void 0===i?void 0:i.body_text)||void 0===o?void 0:o[0])&&void 0!==s?s:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},p.example),{body_text:[l]});return Object.assign(Object.assign({},p),{example:a})}}else if("HEADER"===l.type&&"HEADER"===D){if(null===(u=l.example)||void 0===u?void 0:u.header_text){const l=[...null!==(c=null===(d=p.example)||void 0===d?void 0:d.header_text)&&void 0!==c?c:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},p.example),{header_text:l});return Object.assign(Object.assign({},p),{example:a})}}else{if("BUTTONS"===l.type&&"BUTTONS"===D){const a=null===(r=l.buttons)||void 0===r?void 0:r.map(((l,a)=>a===e?Object.assign(Object.assign({},l),{example:"COPY_CODE"===l.type?t:[t]}):l));return a?Object.assign(Object.assign({},p),{buttons:a}):p}if("limited_time_offer"===l.type&&"limited_time_offer"===D)return Object.assign(Object.assign({},p),{example:Object.assign(Object.assign({},p.example),{limited_time_offer:t})})}return l}));if(p.components=m,l)if("BODY"===D&&(null===(d=null==p?void 0:p.mapping)||void 0===d?void 0:d.body))p.mapping=Object.assign(Object.assign({},p.mapping),{body:p.mapping.body.map(((l,n)=>e===n?"custom_text"===a?`((editableVariable${n+10}))`:t:l))});else if("HEADER"===D&&(null===(c=null==p?void 0:p.mapping)||void 0===c?void 0:c.header))p.mapping=Object.assign(Object.assign({},p.mapping),{header:p.mapping.header.map(((l,n)=>e===n?"custom_text"===a?`((editableVariable${n+20}))`:t:l))});else if("BUTTONS"===D&&(null===(r=null==p?void 0:p.mapping)||void 0===r?void 0:r.buttons)){let l=-1,n=-1;m.forEach((t=>{var a;"BUTTONS"===t.type&&(null===(a=t.buttons)||void 0===a||a.forEach(((t,a)=>{"URL"===t.type&&(l++,a===e&&"URL"==t.type&&(n=l))})))})),p.mapping=Object.assign(Object.assign({},p.mapping),{buttons:p.mapping.buttons.map(((e,l)=>l===n?"custom_link"===a?"((customPlaceholderName))":t:e))})}if(null!=re&&re>-1&&ae){const e=i(ae);e.components[1].cards[re].components=p.components,e.mapping.cards[re]=p.mapping,null==ie||ie(e)}else null==ie||ie(Object.assign({},p))}return s((()=>{W&&(null==S||S())}),[W]),s((()=>{!function(){var e,t,l,a,n;const i="mobile"===X?"template_html_mobile":"template_html_desktop",o=document.getElementById(i),s=(null!==(a=null===(l=null===(t=null===(e=null==o?void 0:o.contentWindow)||void 0===e?void 0:e.document)||void 0===t?void 0:t.body)||void 0===l?void 0:l.innerHTML)&&void 0!==a?a:"")+(null===(n=null==o?void 0:o.contentWindow)||void 0===n?void 0:n.document.head.innerHTML);ee===b.EMAIL&&(null==oe||oe(s))}()}),[ne]),s((()=>{ge()}),[]),s((()=>{ge()}),[re]),s((()=>{X&&G&&$&&setTimeout((()=>{he("custom_link"===(null==G?void 0:G.value)&&$?$.includes("https")?$:`https://${$}`:$,G.value)}),100)}),[X]),s((()=>{!J&&G&&A.updatedValue&&setTimeout((()=>{he("custom_link"===(null==G?void 0:G.value)&&A.updatedValue?A.updatedValue.includes("https")?A.updatedValue:`https://${A.updatedValue}`:A.updatedValue,G.value),Q(!0)}),100)}),[G]),e(_,Object.assign({channel:ee,focused:W,onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!1)},{children:[t("div",Object.assign({style:{marginBottom:8}},{children:e(O,Object.assign({style:{color:te&&!G?x.content.negative:x.content.primary}},{children:[null===(L=A.variableName)||void 0===L?void 0:L.replace("{{","").replace("}}","")," ","link"===(null==A?void 0:A.type)?"link":"variable"]}))})),t("div",Object.assign({style:{marginBottom:12}},{children:B?e("div",Object.assign({style:{display:"flex",border:"#E0E0E0 1px solid",borderRadius:4,padding:10,justifyContent:(null==G?void 0:G.label)?"space-between":"flex-end"}},{children:[t(j,Object.assign({numberOfLines:1},{children:ce===g.CHATBOT?["static_expiry","custom_text","custom_link"].includes(null!==(U=null==G?void 0:G.value)&&void 0!==U?U:"")?null==G?void 0:G.label:null==G?void 0:G.value:m(null!==(H=null==G?void 0:G.label)&&void 0!==H?H:"",20,!0)})),me||"date_time"===(null==A?void 0:A.type)&&ve?t(l,{}):t(a,{onClick:()=>{K(!F)},width:24,height:24,color:x.content.primary})]})):t(r,{disabled:me,options:z,isSearchable:!1,onSelect:Oe,defaultOptions:G?[Object.assign(Object.assign({},G),{selected:!0})]:[]})})),("custom_text"===(null==G?void 0:G.value)||"custom_link"===(null==G?void 0:G.value))&&t(p,{state:me?"disabled":"none",labelText:"custom_text"===(null==G?void 0:G.value)?"Custom text value":"custom_link"===(null==G?void 0:G.value)?"Custom URL value":"",id:`variable-value-${null==G?void 0:G.value}-${C}`,value:$,errorMessage:te&&(null===(R=null==be?void 0:be.buttons)||void 0===R?void 0:R.includes(null!==(M=null==A?void 0:A.index)&&void 0!==M?M:-1))?$&&0!==$.trim().length?"custom_link"!==G.value||/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/.test(`https://${$.trim()}`)&&0!==$.trim().length?"custom_link"!==G.value&&$.length>30?"Length cannot be more than 30":"BUTTONS"===D&&"custom_link"!==G.value?"Enter valid alpha numeric code":"":"Enter valid URL":"Required field":"",maxCharLimit:"custom_link"===(null==G?void 0:G.value)?2e3:"BUTTONS"===D?15:30,noKeyDownChange:!0,prefixText:"custom_link"===(null==G?void 0:G.value)?"https://":"",placeholder:"link"===A.type||"custom_link"===G.value?"Enter custom URL here":"Enter custom text here",onChangeText:e=>{je(G.value,e)}}),"static_expiry"===(null==G?void 0:G.value)&&e("div",Object.assign({style:{position:"relative"}},{children:[me&&t(T,{onClick:e=>e.preventDefault()}),t(c,{placement:"auto",time:n($?new Date($):new Date,"hh:mm a"),date:$?new Date($):new Date,minDate:new Date,error:"",setError:()=>{},onChange:e=>{je("static_expiry",e.toISOString())}})]})),F&&t(d,{zIndex:2e3,data:null!=P?P:[],showVariable:F,setShowVariable:K,placeholder:"Add a variable",customTrigger:e=>{null==w||w(!1),"{{custom.url}}"===e.actualValue?Oe({label:e.displayName,selected:!0,value:"custom_link"}):"{{custom.text}}"==e.actualValue?Oe({label:e.displayName,selected:!0,value:"custom_text"}):"{{static.expiry}}"==e.actualValue?Oe({label:e.displayName,selected:!0,value:"static_expiry"}):Oe({label:e.displayName.replace("{{","").replace("}}","").trim().replace("."," "),selected:!0,value:e.actualValue,bikPlaceholderType:"string"})}})]}))};export{_ as Container,S as default};
|
|
16
|
+
`,T={value:"custom_link",label:"Custom URL"},k={value:"custom_text",label:"Custom text"},E={value:"static_expiry",label:"Static Expiry"},V=u=>{let{onFocus:V,variable:S,index:A,showVariableModal:C,setShowDiscountCheckBox:B,componentType:P,CTAoptions:w}=u;var D,N,U,L,H;const[R,W]=o(!1),[M,$]=o(""),[I,Y]=o([]),[z,Z]=o(),[G,q]=o(!1),{setVariableCallback:F,setShowVariablePicker:K,device:J,channel:Q,isError:X,originalVariableList:ee,template:te,templateSelectionTriggered:le,setTemplate:ae,setDisplayContent:ne,setOriginalVariableList:ie,globalNormalizedPlaceholders:oe,enabledCustomText:se,pod:ue,selectedCarouselIndex:de,isProductCarouselType:ce,disableEditVariable:re,disableEditExpiry:pe,templateErrorIndexes:me}=y();function ve(e,t){var l,a,n;const i=e;$(""),Z(i),Q===v.WHATSAPP?"custom_text"!==i.value&&"custom_link"!==i.value&&"static_expiry"!==i.value?(ge(null!==(l=i.value)&&void 0!==l?l:"","string"),null==Oe||Oe(null!==(a=S.index)&&void 0!==a?a:0,i.value,!0)):(null==Oe||Oe(null!==(n=S.index)&&void 0!==n?n:0,"",!0,i.value),ge("","url"===i.bikPlaceholderType?"link":"string")):"custom_text"!==i.value&&"custom_link"!==i.value?ge(i.value,"url"===i.bikPlaceholderType?"link":"string"):($(""),ge("",i.value))}function be(e,t){var l;$(t);const a="custom_link"===(null==z?void 0:z.value)&&t?t.includes("https")?t:`https://${t}`:t;ge(a,"static_expiry"===e?"string":e),Q===v.WHATSAPP&&(null==Oe||Oe(null!==(l=S.index)&&void 0!==l?l:0,a,"custom_link"===e,e))}function ge(e,t){var l,a,n,o;const s="custom_link"===t?"link":"custom_text"===t?"string":t;if(Q!==v.WHATSAPP){const a=x(A+1),n=null===document||void 0===document?void 0:document.getElementById("mobile"===J?"template_html_mobile":"template_html_desktop"),i=Q===v.EMAIL?null===(l=null==n?void 0:n.contentWindow)||void 0===l?void 0:l.document.getElementById(a):document.getElementById(a);i&&(i.textContent="custom_text"!==t&&"custom_link"!==t||e?e:S.variableName);const o=ee.map(((t,l)=>l===A?Object.assign(Object.assign({},t),{type:s,updatedValue:e}):t));null==ie||ie(o)}if(Q===v.WHATSAPP){if(null!=de&&de>-1&&ce){const l=Object.assign({},ee).cards.map(((l,a)=>{var n,i;return"BODY"===P?Object.assign(Object.assign({},l),{body:null===(n=l.body)||void 0===n?void 0:n.map(((t,l)=>A===l?Object.assign(Object.assign({},t),{type:s,updatedValue:e}):t))}):"BUTTONS"===P?Object.assign(Object.assign({},l),{buttons:null===(i=l.buttons)||void 0===i?void 0:i.map(((l,a)=>a===A?Object.assign(Object.assign({},l),{buttonVariable:"custom_link"===t?"((customPlaceholderName))":e,example:"COPY_CODE"===l.type?e:[e]}):l))}):l}));return void(null==ie||ie((e=>Object.assign(Object.assign({},e),{cards:l}))))}const l=null!=de&&de>-1?ee.cards[de]:ee;let u=l.body,d=l.header,c=l.buttons;if("BODY"===P?u=null===(a=l.body)||void 0===a?void 0:a.map(((t,l)=>l===A?Object.assign(Object.assign({},t),{type:s,updatedValue:e}):t)):"HEADER"===P?d=null===(n=l.header)||void 0===n?void 0:n.map(((t,l)=>l===A?Object.assign(Object.assign({},t),{type:s,updatedValue:e}):t)):"BUTTONS"===P&&(c=null===(o=l.buttons)||void 0===o?void 0:o.map(((l,a)=>a===A?Object.assign(Object.assign({},l),{buttonVariable:"custom_link"===t?"((customPlaceholderName))":e,example:"COPY_CODE"===l.type?e:[e]}):l))),null!=de&&de>-1){const e=i(ee.cards);e[de]={header:d,body:u,buttons:c},null==ie||ie((t=>Object.assign(Object.assign({},t),{cards:e})))}else null==ie||ie((e=>Object.assign(Object.assign({},e),{header:d,body:u,buttons:c})))}}function Oe(e,t,l,a){var n,o,s,u,d,c,r;if(null!=de&&de>-1&&ce){const o=Object.assign({},te).components.map((l=>{var a;return"CAROUSEL"===l.type?Object.assign(Object.assign({},l),{cards:null===(a=l.cards)||void 0===a?void 0:a.map((l=>Object.assign(Object.assign({},l),{components:l.components.map((l=>{var a,n,i,o,s,u;if("BODY"===l.type&&"BODY"===P){if(null===(n=null===(a=l.example)||void 0===a?void 0:a.body_text)||void 0===n?void 0:n[0]){const a=[...null!==(s=null===(o=null===(i=l.example)||void 0===i?void 0:i.body_text)||void 0===o?void 0:o[0])&&void 0!==s?s:[]];a[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const n=Object.assign(Object.assign({},l.example),{body_text:[a]});return Object.assign(Object.assign({},l),{example:n})}return l}if("BUTTONS"===l.type&&"BUTTONS"===P){const a=null===(u=l.buttons)||void 0===u?void 0:u.map(((l,a)=>a===e?Object.assign(Object.assign({},l),{example:[t]}):l));return a?Object.assign(Object.assign({},l),{buttons:a}):l}return l}))})))}):l})),s=i(te);if(l){const l=null===(n=Object.assign({},te).mapping.cards)||void 0===n?void 0:n.map(((l,n)=>{var i,o,s;if("BODY"===P)return Object.assign(Object.assign({},l),{body:null===(i=l.body)||void 0===i?void 0:i.map(((l,n)=>e===n?"custom_text"===a?`((editableVariable${n+10}))`:t:l))});if("BUTTONS"===P&&(null==l?void 0:l.buttons)){let i=-1,u=-1;return null===(o=te.components[1].cards)||void 0===o||o[n].components.forEach((t=>{var l;"BUTTONS"===t.type&&(null===(l=t.buttons)||void 0===l||l.forEach(((t,l)=>{"URL"===t.type&&(i++,l===e&&"URL"==t.type&&(u=i))})))})),Object.assign(Object.assign({},l),{buttons:null===(s=l.buttons)||void 0===s?void 0:s.map(((e,l)=>l===u?"custom_link"===a?"((customPlaceholderName))":t:e))})}return l}));s.mapping.cards=l}return s.components=o,void(null==ae||ae(s))}const p=null!=de&&de>-1?{components:null===(o=Object.assign({},te).components[1].cards)||void 0===o?void 0:o[de].components,mapping:null===(s=Object.assign({},te).mapping.cards)||void 0===s?void 0:s[de]}:Object.assign({},te),m=null===(u=null==p?void 0:p.components)||void 0===u?void 0:u.map((l=>{var a,n,i,o,s,u,d,c,r;const p=Object.assign({},l);if("BODY"===l.type&&"BODY"===P){if(null===(n=null===(a=l.example)||void 0===a?void 0:a.body_text)||void 0===n?void 0:n[0]){const l=[...null!==(s=null===(o=null===(i=p.example)||void 0===i?void 0:i.body_text)||void 0===o?void 0:o[0])&&void 0!==s?s:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},p.example),{body_text:[l]});return Object.assign(Object.assign({},p),{example:a})}}else if("HEADER"===l.type&&"HEADER"===P){if(null===(u=l.example)||void 0===u?void 0:u.header_text){const l=[...null!==(c=null===(d=p.example)||void 0===d?void 0:d.header_text)&&void 0!==c?c:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},p.example),{header_text:l});return Object.assign(Object.assign({},p),{example:a})}}else{if("BUTTONS"===l.type&&"BUTTONS"===P){const a=null===(r=l.buttons)||void 0===r?void 0:r.map(((l,a)=>a===e?Object.assign(Object.assign({},l),{example:"COPY_CODE"===l.type?t:[t]}):l));return a?Object.assign(Object.assign({},p),{buttons:a}):p}if("limited_time_offer"===l.type&&"limited_time_offer"===P)return Object.assign(Object.assign({},p),{example:Object.assign(Object.assign({},p.example),{limited_time_offer:t})})}return l}));if(p.components=m,l)if("BODY"===P&&(null===(d=null==p?void 0:p.mapping)||void 0===d?void 0:d.body))p.mapping=Object.assign(Object.assign({},p.mapping),{body:p.mapping.body.map(((l,n)=>e===n?"custom_text"===a?`((editableVariable${n+10}))`:t:l))});else if("HEADER"===P&&(null===(c=null==p?void 0:p.mapping)||void 0===c?void 0:c.header))p.mapping=Object.assign(Object.assign({},p.mapping),{header:p.mapping.header.map(((l,n)=>e===n?"custom_text"===a?`((editableVariable${n+20}))`:t:l))});else if("BUTTONS"===P&&(null===(r=null==p?void 0:p.mapping)||void 0===r?void 0:r.buttons)){let l=-1,n=-1;m.forEach((t=>{var a;"BUTTONS"===t.type&&(null===(a=t.buttons)||void 0===a||a.forEach(((t,a)=>{"URL"===t.type&&(l++,a===e&&"URL"==t.type&&(n=l))})))})),p.mapping=Object.assign(Object.assign({},p.mapping),{buttons:p.mapping.buttons.map(((e,l)=>l===n?"custom_link"===a?"((customPlaceholderName))":t:e))})}if(null!=de&&de>-1&&te){const e=i(te);e.components[1].cards[de].components=p.components,e.mapping.cards[de]=p.mapping,null==ae||ae(e)}else null==ae||ae(Object.assign({},p))}s((()=>{R&&(null==V||V())}),[R]),s((()=>{!function(){var e,t,l,a,n;const i="mobile"===J?"template_html_mobile":"template_html_desktop",o=document.getElementById(i),s=(null!==(a=null===(l=null===(t=null===(e=null==o?void 0:o.contentWindow)||void 0===e?void 0:e.document)||void 0===t?void 0:t.body)||void 0===l?void 0:l.innerHTML)&&void 0!==a?a:"")+(null===(n=null==o?void 0:o.contentWindow)||void 0===n?void 0:n.document.head.innerHTML);Q===v.EMAIL&&(null==ne||ne(s))}()}),[le]),s((()=>{!function(){var e,t;const l=[];let a=[];if(Q!==v.MESSAGE||se){"link"===(null==S?void 0:S.type)?(l.push({label:"",options:[T,k]}),Z(T)):"date_time"===(null==S?void 0:S.type)?(l.push({label:"",options:[T,k]}),Z(E)):(l.push({label:"",options:[T,k,E]}),Z(k));const e=null!=oe?oe:[];Y([...l,...e.map((e=>{var t,l;return Object.assign(Object.assign({},e),{label:j.toCapitilize(null===(l=null===(t=e.label)||void 0===t?void 0:t.replace(/([A-Z])/g," $1"))||void 0===l?void 0:l.toLowerCase())})}))]),a=[...l,...e]}else{const e=null!=oe?oe:[];Y([{label:"",options:[k,T]},...e]),a=[{label:"",options:[k,T]},...e]}if((Q===v.WHATSAPP||Q===v.EMAIL||Q===v.MESSAGE)&&S.updatedValue)if(m.test(S.updatedValue)&&Q===v.WHATSAPP||S.updatedValue.startsWith("{{")&&Q!==v.WHATSAPP){const e=function(e,t,l){var a;let n={label:"",value:""};const i=l===v.WHATSAPP?e.updatedValue.replace("[[","").replace("]]",""):e.updatedValue.replace("{{","").replace("}}","");if(C){let t=e.updatedValue;if(ue===b.CHATBOT&&"BUTTONS"===P){const l=null==w?void 0:w.filter((t=>t.placeHolder===e.updatedValue));l&&l.length>0&&(t=l[0].label)}n={label:t?t.replace("{{","").replace("}}","").trim().replace("."," "):"",value:null!==(a=e.updatedValue)&&void 0!==a?a:""}}else t.map((e=>{e.options.map((e=>{var t;(null===(t=e.value)||void 0===t?void 0:t.replace("{{","").replace("}}","").trim())===i.trim()&&(n=e)}))}));return n}(S,a,Q);e.value&&Z(e)}else"date_time"===S.type?(Z(E),$(S.updatedValue),Oe(null!==(e=S.index)&&void 0!==e?e:0,S.updatedValue)):(null===(t=S.updatedValue)||void 0===t?void 0:t.startsWith("https"))?(Z(T),$(S.updatedValue.split("https://")[1])):(Z(k),$(S.updatedValue))}()}),[de]),s((()=>{J&&z&&M&&setTimeout((()=>{ge("custom_link"===(null==z?void 0:z.value)&&M?M.includes("https")?M:`https://${M}`:M,z.value)}),100)}),[J]),s((()=>{!G&&z&&S.updatedValue&&setTimeout((()=>{ge("custom_link"===(null==z?void 0:z.value)&&S.updatedValue?S.updatedValue.includes("https")?S.updatedValue:`https://${S.updatedValue}`:S.updatedValue,z.value),q(!0)}),100)}),[z]);const je=e=>{null==B||B(!1),"{{custom.url}}"===e.actualValue?(console.log("var",e),ve({label:e.displayName,selected:!0,value:"custom_link"})):"{{custom.text}}"==e.actualValue?ve({label:e.displayName,selected:!0,value:"custom_text"}):"{{static.expiry}}"==e.actualValue?ve({label:e.displayName,selected:!0,value:"static_expiry"}):ve({label:e.displayName.replace("{{","").replace("}}","").trim().replace("."," "),selected:!0,value:e.actualValue,bikPlaceholderType:"string"})};return e(f,Object.assign({channel:Q,focused:R,onMouseEnter:()=>W(!0),onMouseLeave:()=>W(!1)},{children:[t("div",Object.assign({style:{marginBottom:8}},{children:e(g,Object.assign({style:{color:X&&!z?h.content.negative:h.content.primary}},{children:[null===(D=S.variableName)||void 0===D?void 0:D.replace("{{","").replace("}}","")," ","link"===(null==S?void 0:S.type)?"link":"variable"]}))})),t("div",Object.assign({style:{marginBottom:12}},{children:C?e("div",Object.assign({style:{display:"flex",border:"#E0E0E0 1px solid",borderRadius:4,padding:10,justifyContent:(null==z?void 0:z.label)?"space-between":"flex-end"}},{children:[t(O,Object.assign({numberOfLines:1},{children:ue===b.CHATBOT?["static_expiry","custom_text","custom_link"].includes(null!==(N=null==z?void 0:z.value)&&void 0!==N?N:"")?null==z?void 0:z.label:null==z?void 0:z.value:p(null!==(U=null==z?void 0:z.label)&&void 0!==U?U:"",20,!0)})),re||"date_time"===(null==S?void 0:S.type)&&pe?t(l,{}):t(a,{onClick:()=>{F((()=>je)),K(!0)},width:24,height:24,color:h.content.primary})]})):t(c,{disabled:re,options:I,isSearchable:!1,onSelect:ve,defaultOptions:z?[Object.assign(Object.assign({},z),{selected:!0})]:[]})})),("custom_text"===(null==z?void 0:z.value)||"custom_link"===(null==z?void 0:z.value))&&t(r,{state:re?"disabled":"none",labelText:"custom_text"===(null==z?void 0:z.value)?"Custom text value":"custom_link"===(null==z?void 0:z.value)?"Custom URL value":"",id:`variable-value-${null==z?void 0:z.value}-${A}`,value:M,errorMessage:X&&(null===(L=null==me?void 0:me.buttons)||void 0===L?void 0:L.includes(null!==(H=null==S?void 0:S.index)&&void 0!==H?H:-1))?M&&0!==M.trim().length?"custom_link"!==z.value||/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/.test(`https://${M.trim()}`)&&0!==M.trim().length?"custom_link"!==z.value&&M.length>30?"Length cannot be more than 30":"BUTTONS"===P&&"custom_link"!==z.value?"Enter valid alpha numeric code":"":"Enter valid URL":"Required field":"",maxCharLimit:"custom_link"===(null==z?void 0:z.value)?2e3:"BUTTONS"===P?15:30,noKeyDownChange:!0,prefixText:"custom_link"===(null==z?void 0:z.value)?"https://":"",placeholder:"link"===S.type||"custom_link"===z.value?"Enter custom URL here":"Enter custom text here",onChangeText:e=>{be(z.value,e)}}),"static_expiry"===(null==z?void 0:z.value)&&e("div",Object.assign({style:{position:"relative"}},{children:[re&&t(_,{onClick:e=>e.preventDefault()}),t(d,{placement:"auto",time:n(M?new Date(M):new Date,"hh:mm a"),date:M?new Date(M):new Date,minDate:new Date,error:"",setError:()=>{},onChange:e=>{be("static_expiry",e.toISOString())}})]}))]}))};export{f as Container,V as default};
|
package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorsPanel.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{jsxs as e,jsx as i}from"react/jsx-runtime";import t from"../../../assets/icons/info.svg.js";import{useState as a,useRef as o,useEffect as r}from"react";import
|
|
1
|
+
import{jsxs as e,jsx as i}from"react/jsx-runtime";import t from"../../../assets/icons/info.svg.js";import{useState as a,useRef as o,useEffect as r}from"react";import n from"styled-components";import{CheckBox as l}from"../../checkBox/CheckBox.js";import{Input as s}from"../../input/Input.js";import{Tooltip as c}from"../../tooltips/Tooltip.js";import{TitleRegular as d,BodySecondary as p,TitleSmall as h}from"../../TypographyStyle.js";import{COLORS as m}from"../../../constants/Theme.js";import g from"../../../assets/icons/plus.svg.js";import{useTemplateModalContext as b}from"../context/templateModalContext.js";import u from"./VariableConnector.js";const f=n.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
height: 100%;
|
|
5
|
-
`,
|
|
5
|
+
`,x=n=>{let{onFocus:x,showVariableModal:y,variableList:j,discountCode:O,setDiscountCode:k}=n;const{originalVariableList:w,disableEditVariable:V,setVariableCallback:C,setShowVariablePicker:T}=b(),[E,L]=a(!1),[B,D]=a(!1),[F,I]=a(""),[M,N]=a(!1),S=o(),A=o();r((()=>{k&&k(O+F)}),[F]),r((()=>{w.forEach((e=>{"checkout.checkoutUrl"===e.updatedValue.replace("{{","").replace("}}","")&&(L(!0),O&&N&&N(!0))}))}),[w]);const P=e=>{I(e.actualValue)};return e(f,{children:[e("div",Object.assign({style:{padding:8}},{children:[e("div",Object.assign({style:{display:"flex",gap:8,alignItems:"center",marginBottom:4}},{children:[i(d,Object.assign({style:{color:m.content.primary}},{children:"Edit variables and links"})),i(c,Object.assign({body:"Variables are placeholder texts which can either be filled by data, eg: customer name or can have any custom text within them"},{children:i("div",Object.assign({style:{display:"flex"}},{children:i(t,{width:20,height:20,color:m.content.placeholder})}))}))]})),i(p,Object.assign({style:{color:m.content.secondary}},{children:"You can view variables and links on the left underlined in purple colour."}))]})),null==w?void 0:w.map(((t,a)=>!t.isEditableVariable||V?e("div",Object.assign({style:{margin:"16px 8px"}},{children:[e(p,Object.assign({style:{color:m.content.primary}},{children:["Locked variable ",a+1]})),i(s,{state:"disabled",placeholder:t.variableName,onChangeText:()=>{}})]}),a):i("div",Object.assign({style:{marginTop:16}},{children:i(u,{index:a,variable:t,onFocus:()=>null==x?void 0:x(a),showVariableModal:y,variableList:j,setShowDiscountCheckBox:L})}),a))),(E||O)&&e("div",Object.assign({style:{display:"flex",flexDirection:"row",marginLeft:10,marginTop:8}},{children:[i(l,{isChecked:M,onValueChange:()=>{M&&k&&k(""),N(!M)}}),i(h,Object.assign({style:{marginLeft:8}},{children:"Add discount code"}))]})),M&&e("div",Object.assign({ref:S,style:{margin:10}},{children:[i(s,{placeholder:"Enter your discount code",onChangeText:e=>{k&&k(e)},value:O,onFocus:()=>{D(!0)},onBlur:e=>{var i;"addVar"===(null===(i=e.relatedTarget)||void 0===i?void 0:i.id)?(S.current&&S.current.focus(),D(!0)):D(!1)},noErrorHint:!0,validate:e=>[!0,""]}),B&&i(v,Object.assign({ref:A,id:"addVar",onClick:e=>{e.stopPropagation(),C((()=>P)),T(!0)}},{children:e("div",Object.assign({className:"add"},{children:[i(g,{width:20,height:20,color:"white"}),i("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))]}))]})},v=n.button`
|
|
6
6
|
padding: 2px 8px;
|
|
7
7
|
cursor: pointer;
|
|
8
8
|
color: white;
|
|
@@ -25,4 +25,4 @@ import{jsxs as e,jsx as i}from"react/jsx-runtime";import t from"../../../assets/
|
|
|
25
25
|
align-items: center;
|
|
26
26
|
gap: 5px;
|
|
27
27
|
}
|
|
28
|
-
`;export{
|
|
28
|
+
`;export{v as AddVariableStyled,f as Container,x as default};
|
package/dist/esm/components/template-context-mapper/modalElements/useEditWhtasappTemplateMedia.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e}from"../../../_virtual/_tslib.js";import{cloneDeep as o}from"lodash";import{useState as n,useRef as i,useEffect as
|
|
1
|
+
import{__awaiter as e}from"../../../_virtual/_tslib.js";import{cloneDeep as o}from"lodash";import{useState as n,useRef as i,useEffect as l}from"react";import{FileUploaderHelper as t}from"../../helpers/FileUploaderHelper.js";import{HEADER_TYPES as a}from"../../template-preview/models/TemplateMeta.js";import{useTemplateModalContext as s}from"../context/templateModalContext.js";import{isVariable as r}from"../utils/validateIsUrl.js";const d=d=>{const{uploadMediaLink:c,updateTemplateImageUrl:p,mediaComponent:u,uploadMediaFiles:m,fileRef:f}=d,{template:v,selectedCarouselIndex:g,setTemplate:h}=s(),[b,I]=n(void 0),[y,M]=n(),[j,C]=n(!1),[E,O]=n(""),[U,k]=n(!1),[w,A]=n(),N=i(null);function T(o){var n;return e(this,void 0,void 0,(function*(){const e=new t;if(o instanceof Blob){const i=e.validate({file:o});if(i)O(i),k(!1),C(!1);else{const e=u.format===a.IMAGE,i=yield m({file:o,fileName:b,isImage:e});if(i.success){const[e]=o.type.split("/");p(null!==(n=i.url)&&void 0!==n?n:"","application"===e?a.DOCUMENT:a[e.toUpperCase()])}else O("An unknown technical error occurred");k(!1),C(!1)}}else O("An unknown technical error occurred"),k(!1)}))}function x(){var e;console.log("handleImageChange",f,null==f?void 0:f.current),(null===(e=null==f?void 0:f.current)||void 0===e?void 0:e.click)&&f.current.click()}return l((()=>{I(void 0),A(void 0),M(void 0),C(!1),k(!1),O("")}),[g]),{uploadMedia:function(n){var i,l,s,d,m,b;return e(this,void 0,void 0,(function*(){if(O(""),M(""),console.log("uef uploadMedia",f,null==f?void 0:f.current),n)if(n.startsWith("https"))try{if(k(!0),console.log("uploadMediaLink",c),c){const e=yield c(n),{type:o,size:l,success:s}=e;if(s){const n=(new t).validate({linkData:{type:o,size:l}});if(n)return O(n),void k(!1);const[s]=o.split("/");p(null!==(i=e.url)&&void 0!==i?i:"",s.includes("application")?a.DOCUMENT:a[s.toUpperCase()])}else O("An unknown technical error occurred");k(!1)}else{const e=yield fetch(n),o=yield e.blob();yield T(o)}}catch(e){O("An unknown technical error occurred")}else if(r(n)){let e;if(M(n),e=null!=g&&g>-1?{components:null===(s=null===(l=v.components[1])||void 0===l?void 0:l.cards)||void 0===s?void 0:s[g].components,mapping:null===(m=null===(d=null==v?void 0:v.mapping)||void 0===d?void 0:d.cards)||void 0===m?void 0:m[g]}:Object.assign({},v),e.components){const o=null===(b=null==e?void 0:e.components)||void 0===b?void 0:b.findIndex((e=>{if("HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format)return!0}));if(void 0!==o&&o>-1&&(null==e?void 0:e.components[o])){const i=Object.assign(Object.assign({},e.components[o]),{format:u.format,example:{header_handle:[n]}}),l=[...e.components];l[o]=i,e.components=l}}if(e.mapping&&(e.mapping=Object.assign(Object.assign({},e.mapping),{header:[n]})),k(!1),null!=g&&g>-1){const n=o(v);n.components[1].cards[g].components=e.components,n.mapping.cards[g]=e.mapping,null==h||h(Object.assign({},n))}else null==h||h(Object.assign({},e))}else k(!1),O("Invalid URL or variable");else x()}))},processImageUpload:T,handleImageUpload:function(e){var o;O(""),k(!0);const n=null===(o=e.target.files)||void 0===o?void 0:o[0];if(u.format===a.IMAGE){const e=new FileReader;A(""),I(""),e.onload=()=>{A(e.result),I(null==n?void 0:n.name)},n&&e.readAsDataURL(n)}else T(n)},handleImageChange:x,onCropComplete:function(o){return e(this,void 0,void 0,(function*(){k(!1),O("");const e=yield fetch(o),n=yield e.blob();yield T(n),A(void 0),C(!1)}))},editIconRef:N,fileName:b,setFileName:I,selectedVariable:y,setSelectedVariable:M,openEditMedia:j,setOpenEditMedia:C,selectedImage:w,setSelectedImage:A,loading:U,setLoading:k,error:E,setError:O}};export{d as useEditWhatsappTemplateMedia};
|
|
@@ -26,8 +26,6 @@ import r from"styled-components";import{COLORS as e,BASE_COLORS as o}from"../../
|
|
|
26
26
|
justify-content: center;
|
|
27
27
|
flex-grow: 1;
|
|
28
28
|
min-height: 180px;
|
|
29
|
-
border-left: 1px solid ${e.stroke.primary};
|
|
30
|
-
border-right: 1px solid ${e.stroke.primary};
|
|
31
29
|
`,p=r.div`
|
|
32
30
|
display: flex;
|
|
33
31
|
justify-content: center;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import o from"../../../assets/icons/halfRectangle.svg.js";import i from"../../../assets/icons/phone.svg.js";import s from"../../../assets/icons/RedirectToNew.svg.js";import{useMemo as a}from"react";import n from"styled-components";import{Tooltip as m}from"../../tooltips/Tooltip.js";import{BodySecondary as p,Caption as d}from"../../TypographyStyle.js";import{COLORS as l,FONTS as h}from"../../../constants/Theme.js";import{WhatsAppFormatToHTML as c}from"../helpers/WhatsAppFormatToHTML.js";import{HEADER_TYPES as f,ACTIONS_TYPES as y}from"../models/TemplateMeta.js";import{ChatBtn as T}from"./ChatBtn.js";import{Container as x,FooterWrapper as g,
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import o from"../../../assets/icons/halfRectangle.svg.js";import i from"../../../assets/icons/phone.svg.js";import s from"../../../assets/icons/RedirectToNew.svg.js";import{useMemo as a}from"react";import n from"styled-components";import{Tooltip as m}from"../../tooltips/Tooltip.js";import{BodySecondary as p,Caption as d}from"../../TypographyStyle.js";import{COLORS as l,FONTS as h}from"../../../constants/Theme.js";import{WhatsAppFormatToHTML as c}from"../helpers/WhatsAppFormatToHTML.js";import{HEADER_TYPES as f,ACTIONS_TYPES as y}from"../models/TemplateMeta.js";import{ChatBtn as T}from"./ChatBtn.js";import{Container as x,FooterWrapper as g,TimeStamp as j}from"./ChatUI.style.js";import{MediaCard as v}from"./MediaCard.js";import w from"./RenderTemplateWithVariable.js";const b=n.div`
|
|
2
2
|
position: absolute;
|
|
3
3
|
width: 8px;
|
|
4
4
|
height: 8px;
|
|
5
5
|
left: -8px;
|
|
6
6
|
top: -9px;
|
|
7
|
-
`,
|
|
7
|
+
`,u=n=>{const{bodyText:u,footerText:S,headerMediaType:N,headerText:A,headerAssetLink:M,headerAssetName:C,quickReplybtn:L,ctaBtn:k,actionTypes:z,textType:B,extras:E,showHeader:I,imagePreviewStyles:P,size:R,children:W,isPreview:H}=n,O=new c,_=a((()=>({color:l.content.primary,margin:12,fontSize:I?h.caption.fontSize:h.bodySecondary.fontSize,fontWeight:h.bodySecondary.fontWeight,maxWidth:"100%",whiteSpace:"pre-wrap",marginBottom:0,marginTop:8,wordBreak:"break-word"})),[]);return e(x,Object.assign({isPreview:H},{children:[t(b,{children:t(o,{color:"white",height:8,width:8})}),N===f.TEXT?t(w,{bold:!0,text:A}):N!==f.NONE?t(v,{headerAssetLink:M,headerAssetName:C,mediaType:N,imagePreviewStyles:N===f.IMAGE?P:{}}):t(r,{}),!!u&&t(r,{children:t(r,W?{children:W}:{children:"html"===B?t("div",{className:"richTextEditor",style:_,dangerouslySetInnerHTML:{__html:O.convertToHTML(u)}}):t(p,{children:u})})}),e(g,{children:[t(m,Object.assign({body:null!=S?S:"",placement:"top"},{children:t(j,Object.assign({style:{flex:1}},{children:S}))})),t(j,{children:"16:48"})]}),z===y.QUICK_REPLY?t("div",{children:null==L?void 0:L.map(((e,r)=>t(T,{text:e.text},r)))}):z===y.CTA_BTN?t("div",{children:null==k?void 0:k.map(((e,r)=>t(T,{textTypography:I?d:p,extraContent:E?e.extra:void 0,placeholder:e.placeholder,text:e.text,Icon:"phoneNumber"===e.type?i:s,size:R},r)))}):t(r,{})]}))};export{u as default};
|
|
@@ -9,10 +9,6 @@ export declare const TimeStamp: import("styled-components").StyledComponent<"div
|
|
|
9
9
|
numberOfLines?: number | undefined;
|
|
10
10
|
color?: string | undefined;
|
|
11
11
|
}, never>;
|
|
12
|
-
export declare const FooterText: import("styled-components").StyledComponent<"div", any, {
|
|
13
|
-
numberOfLines?: number | undefined;
|
|
14
|
-
color?: string | undefined;
|
|
15
|
-
}, never>;
|
|
16
12
|
export declare const MediaContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
17
13
|
export declare const ChatBtnContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
18
14
|
export declare const FooterWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
background: ${
|
|
3
|
-
|
|
1
|
+
import e from"styled-components";import{Caption as r}from"../../TypographyStyle.js";import{COLORS as t}from"../../../constants/Theme.js";const o=e.div`
|
|
2
|
+
background: ${t.surface.standard};
|
|
3
|
+
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.12);
|
|
4
|
+
border-top-left-radius: ${e=>e.isCarouselCard?"12px":"0px"};
|
|
4
5
|
border-top-right-radius: 12px;
|
|
5
6
|
border-bottom-right-radius: 12px;
|
|
6
7
|
border-bottom-left-radius: 12px;
|
|
7
8
|
position: relative;
|
|
8
9
|
padding: 8px 0px;
|
|
9
|
-
border:
|
|
10
|
-
${
|
|
10
|
+
border: 2px solid
|
|
11
|
+
${e=>e.hasError?`${t.content.negative}`:e.showBorder?`${t.stroke.brand}`:`${t.text.white}`};
|
|
11
12
|
:hover {
|
|
12
13
|
border: 2px
|
|
13
|
-
${
|
|
14
|
-
${
|
|
15
|
-
box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.25);
|
|
14
|
+
${e=>e.isPreview?"unset":e.isWhatsappCarousel?e.hasError?"dashed":e.showBorder?"solid":"dashed":"solid"}
|
|
15
|
+
${t.stroke.brand};
|
|
16
16
|
}
|
|
17
|
-
`,i=r
|
|
18
|
-
color: ${
|
|
17
|
+
`,i=e(r)`
|
|
18
|
+
color: ${t.content.secondary};
|
|
19
19
|
max-width: 80px;
|
|
20
20
|
text-overflow: ellipsis;
|
|
21
21
|
white-space: nowrap;
|
|
22
22
|
overflow: hidden;
|
|
23
23
|
text-wrap: wrap;
|
|
24
|
-
`,d=
|
|
25
|
-
max-width: 200px;
|
|
26
|
-
`,s=r.div`
|
|
24
|
+
`,d=e.div`
|
|
27
25
|
border-radius: 8px;
|
|
28
26
|
display: flex;
|
|
29
27
|
flex-direction: column;
|
|
@@ -32,19 +30,19 @@ import r from"styled-components";import{Caption as e}from"../../TypographyStyle.
|
|
|
32
30
|
min-height: 152px;
|
|
33
31
|
margin-bottom: 4px;
|
|
34
32
|
margin: 0px 8px;
|
|
35
|
-
`,
|
|
33
|
+
`,s=e.div`
|
|
36
34
|
padding: 12px;
|
|
37
35
|
display: flex;
|
|
38
36
|
flex-direction: row;
|
|
39
37
|
justify-content: center;
|
|
40
38
|
align-items: center;
|
|
41
|
-
border-top: 1px solid ${
|
|
42
|
-
`,
|
|
39
|
+
border-top: 1px solid ${t.stroke.primary};
|
|
40
|
+
`,p=e.div`
|
|
43
41
|
display: flex;
|
|
44
42
|
flex-direction: row;
|
|
45
43
|
justify-content: space-between;
|
|
46
44
|
margin: 8px 12px;
|
|
47
|
-
`;
|
|
45
|
+
`;e.div`
|
|
48
46
|
position: absolute;
|
|
49
47
|
bottom: -1px;
|
|
50
48
|
left: 0;
|
|
@@ -55,11 +53,11 @@ import r from"styled-components";import{Caption as e}from"../../TypographyStyle.
|
|
|
55
53
|
display: flex;
|
|
56
54
|
flex-direction: row;
|
|
57
55
|
justify-content: start;
|
|
58
|
-
background: ${
|
|
56
|
+
background: ${t.surface.hovered};
|
|
59
57
|
border-bottom-right-radius: 8px;
|
|
60
58
|
border-bottom-left-radius: 8px;
|
|
61
|
-
`,
|
|
59
|
+
`,e.div`
|
|
62
60
|
position: absolute;
|
|
63
61
|
top: 16px;
|
|
64
62
|
right: 16px;
|
|
65
|
-
`;export{
|
|
63
|
+
`;export{s as ChatBtnContainer,o as Container,p as FooterWrapper,d as MediaContainer,i as TimeStamp};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import r from"../../../assets/icons/copy-code-icon.svg.js";import i from"../../../assets/icons/halfRectangle.svg.js";import s from"../../../assets/icons/phone.svg.js";import a from"../../../assets/icons/qrb.svg.js";import n from"../../../assets/icons/RedirectToNew.svg.js";import l from"styled-components";import{useTemplateModalContext as m}from"../../template-context-mapper/context/templateModalContext.js";import{Tooltip as p}from"../../tooltips/Tooltip.js";import{Caption as d,BodySecondary as c}from"../../TypographyStyle.js";import{COLORS as h}from"../../../constants/Theme.js";import{VariableEditorHelper as f}from"../helpers/VariableEditorHelper.js";import{HEADER_TYPES as x,ACTIONS_TYPES as y}from"../models/TemplateMeta.js";import{ChatBtn as u}from"./ChatBtn.js";import{Container as T,FooterWrapper as g,
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import r from"../../../assets/icons/copy-code-icon.svg.js";import i from"../../../assets/icons/halfRectangle.svg.js";import s from"../../../assets/icons/phone.svg.js";import a from"../../../assets/icons/qrb.svg.js";import n from"../../../assets/icons/RedirectToNew.svg.js";import l from"styled-components";import{useTemplateModalContext as m}from"../../template-context-mapper/context/templateModalContext.js";import{Tooltip as p}from"../../tooltips/Tooltip.js";import{Caption as d,BodySecondary as c}from"../../TypographyStyle.js";import{COLORS as h}from"../../../constants/Theme.js";import{VariableEditorHelper as f}from"../helpers/VariableEditorHelper.js";import{HEADER_TYPES as x,ACTIONS_TYPES as y}from"../models/TemplateMeta.js";import{ChatBtn as u}from"./ChatBtn.js";import{Container as T,FooterWrapper as g,TimeStamp as C}from"./ChatUI.style.js";import{LimitedTimeOffer as j}from"./LimitedTimeOffer/LimitedTimeOffer.index.js";import{MediaCard as v}from"./MediaCard.js";const b=l.div`
|
|
2
2
|
position: absolute;
|
|
3
3
|
width: 8px;
|
|
4
4
|
height: 8px;
|
|
5
5
|
left: -8px;
|
|
6
6
|
top: -9px;
|
|
7
|
-
`,
|
|
7
|
+
`,w=l.div`
|
|
8
8
|
font-family: 'Inter';
|
|
9
9
|
font-style: normal;
|
|
10
10
|
font-weight: 400;
|
|
@@ -13,7 +13,7 @@ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import r from"..
|
|
|
13
13
|
padding: 8px 12px 0px;
|
|
14
14
|
color: ${h.content.primary};
|
|
15
15
|
word-wrap: break-word;
|
|
16
|
-
`,
|
|
16
|
+
`,I=l(w)`
|
|
17
17
|
font-weight: 600;
|
|
18
18
|
margin-bottom: 8px;
|
|
19
|
-
`,
|
|
19
|
+
`,O=new f,E=l=>{const{bodyText:h,footerText:f,headerMediaType:E,headerText:L,headerAssetLink:P,headerAssetName:_,quickReplybtn:N,ctaBtn:M,actionTypes:R,extras:A,showHeader:B,imagePreviewStyles:H,size:S,bodyVariableList:U,headerVariableList:k,buttons:z,limitedTimeOfferComponent:Y,carouselCardIndex:V,isWhatsappCarousel:q,isPreview:D}=l,K=O.format(h,U),Q=O.format(L,k),{selectedCarouselIndex:W,isProductCarouselType:G,errorIndexes:X}=m(),$={COPY_CODE:r,PHONE_NUMBER:s,URL:n,QUICK_REPLY:a};return e(T,Object.assign({isCarouselCard:null!=V&&V>-1,showBorder:null!=V&&V===W||G&&null!=V&&V>-1&&null!=W&&W>-1,hasError:null==X?void 0:X.includes(null!=V?V:-2),isWhatsappCarousel:q,isPreview:D},{children:[!q&&t(b,{children:t(i,{color:"white",height:8,width:8})}),E===x.TEXT?t(I,{dangerouslySetInnerHTML:{__html:Q}}):E!==x.NONE?t(v,{headerAssetLink:P,headerAssetName:_,mediaType:E,imagePreviewStyles:E===x.IMAGE?H:{}}):t(o,{}),(null==Y?void 0:Y.dateTime)?t(j,{text:Y.text,dateTime:Y.dateTime,code:Y.code}):t(o,{}),!!h&&t(o,{children:t(w,{dangerouslySetInnerHTML:{__html:K}})}),e(g,{children:[t(p,Object.assign({body:null!=f?f:"",placement:"top"},{children:t(C,Object.assign({style:{flex:1}},{children:f}))})),t(C,{children:"16:48"})]}),z&&z.length>0?z.map(((e,o)=>t(u,{text:"COPY_CODE"===e.type?"Copy code":e.text,Icon:$[e.type],size:S},o))):R===y.QUICK_REPLY?t("div",{children:null==N?void 0:N.map(((e,o)=>t(u,{text:e.text},o)))}):R===y.CTA_BTN?t("div",{children:null==M?void 0:M.map(((e,o)=>t(u,{textTypography:B?d:c,extraContent:A?e.extra:void 0,placeholder:e.placeholder,text:e.text,Icon:"phoneNumber"===e.type?s:n,size:S},o)))}):t(o,{})]}))};export{E as ChatUIV2};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{jsx as e,Fragment as
|
|
2
|
-
background-image: ${e=>e.isWhatsappCarousel?"none"
|
|
1
|
+
import{jsx as e,Fragment as o,jsxs as t}from"react/jsx-runtime";import r from"styled-components";import{useTemplateModalContext as a}from"../../template-context-mapper/context/templateModalContext.js";import{TitleRegular as s}from"../../TypographyStyle.js";import{COLORS as i}from"../../../constants/Theme.js";import{getPreviewPropLen as p}from"../utils/getPreviewPropLen.js";import n from"./ChatHeader.js";import{ChatUIV2 as d}from"./ChatUiV2.js";const m=r.div`
|
|
2
|
+
background-image: ${e=>e.isWhatsappCarousel?"none":"url('https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F341dba50-e84e-4457-b5b5-d9d8a0b95a73?alt=media&token=6fd32f23-8bb2-4980-bbee-bef39b38fd9f')"};
|
|
3
3
|
border-radius: 4px;
|
|
4
4
|
background-repeat: no-repeat;
|
|
5
5
|
background-position: center;
|
|
6
6
|
background-size: cover;
|
|
7
7
|
position: relative;
|
|
8
|
-
`,
|
|
9
|
-
color: ${
|
|
10
|
-
`,
|
|
8
|
+
`,c=r(s)`
|
|
9
|
+
color: ${i.content.primary};
|
|
10
|
+
`,l=r=>{const{hideDeviceContainerInPreview:s}=a();return 3===p(r)?e(o,{children:r.zeroStateComponent}):s?e(d,Object.assign({showHeader:r.showHeader},r)):e(o,{children:t(m,Object.assign({style:r.containerStyle,showHeader:r.showHeader,isWhatsappCarousel:r.isWhatsappCarousel},{children:[r.showHeader&&e(n,{}),t("div",Object.assign({style:{padding:"small"===r.size?"12px 32px 12px 12px":`16px ${r.isWhatsappCarousel?"0px":"56px"} ${r.isWhatsappCarousel?"2px":"16px"} 16px`}},{children:[!r.hidePreviewText&&e("div",Object.assign({style:{marginBottom:16}},{children:e(c,{children:"Preview"})})),e(d,Object.assign({showHeader:r.showHeader},r))]}))]}))})};export{l as WhatsappLikePreviewV2};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BaseWhatsappContentLangHelper as e}from"../../../helpers/BaseWhatsappContentLang.helper.js";import"../../curtain/CurtainHelper.js";import{variablePattern as r}from"../constants/regexPatterns.js";const l=new e;class a{format(e,a){var t;if(!e)return"";const
|
|
1
|
+
import{BaseWhatsappContentLangHelper as e}from"../../../helpers/BaseWhatsappContentLang.helper.js";import"../../curtain/CurtainHelper.js";import"../../variable-picker-v3/model.js";import{variablePattern as r}from"../constants/regexPatterns.js";const l=new e;class a{format(e,a){var t;if(!e)return"";const p=new RegExp(r,"g"),n=e.match(p),o=null!==(t=null==a?void 0:a.map((e=>{let{placeholder:r}=e;return r})))&&void 0!==t?t:[],c=e.split(r).map(((e,r)=>{var l;const t=null==n?void 0:n[r];if(t){const r=t.replace("{{","").replace("}}","").replace("[[","").replace("]]","").replace("((","").replace("))",""),p=o.findIndex((e=>e.replace("{{","").replace("}}","").replace("[[","").replace("]]","").replace("((","").replace("))","")===r));return p>-1?e+'<code style="color: #731DCF">'+(null===(l=null==a?void 0:a[p])||void 0===l?void 0:l.value)+"</code>":e+t}return e})).join("");return l.getHTML(c)}}export{a as VariableEditorHelper};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { VariablePickerV3Props } from './model';
|
|
3
|
+
type Props = VariablePickerV3Props;
|
|
4
|
+
export declare const highlightSearchText: (text: string, searchText: string) => string | import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const VariablePickerContent: React.FC<Props>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__awaiter as e}from"../../_virtual/_tslib.js";import{jsx as t,jsxs as s,Fragment as i}from"react/jsx-runtime";import o from"../../assets/icons/arrow_back.svg.js";import l from"../../assets/icons/cross.svg.js";import a from"../../assets/icons/plus.svg.js";import n from"../../assets/icons/triangle_error.svg.js";import{useState as r,useEffect as c}from"react";import{COLORS as d}from"../../constants/Theme.js";import{BikAccordion as h}from"../accordion/Accordion.js";import{IconButton as m}from"../icon-button/IconButton.js";import{Input as p}from"../input/Input.js";import{ListItem as g}from"../list-item/ListItem.js";import{Switch as b}from"../switch/Switch.js";import{Tooltip as u}from"../tooltips/Tooltip.js";import{TitleRegular as f,BodySecondary as v,BodyCaption as y,TitleSmall as j}from"../TypographyStyle.js";import{VariablePickerContext as O}from"./context.js";import x from"./NoResult.js";import{showOnlyRecommendedVariables as w}from"./recommendVaribles.js";import{searchVariables as k}from"./searchVariables.js";import{HeaderWrapper as C,RecommendWrapper as S,BackHeader as I,Container as V}from"./styles.js";import N,{renderTooltipBody as B}from"./SubHeaderItems.js";const T=(e,i)=>{if(0===i.length)return e;const o=e.toLowerCase().indexOf(i.toLowerCase());if(-1===o)return e;const l=e.slice(0,o),a=e.slice(o,o+i.length),n=e.slice(o+i.length);return s("span",{children:[l,t("b",Object.assign({style:{color:d.content.primary}},{children:a})),n]})},H=/.*\..*/,L=e=>{if(e.actualValue.match(H)){const t=e.actualValue.replace("{{","").replace("}}","").split(".");let s=t[0];return t.forEach(((e,t)=>{if(0===t)return;const i=(e=>/\w+\[\d+\]/g.test(e))(e);if(i){const t=e.match(/(\w+)\[(\d+)\]/);if(t){const e=t[1],i=t[2];s+=`['${e}'][${i}]`}}else s+=`['${e}']`})),s}return e.actualValueEval?e.actualValueEval:e.actualValue},R=H=>{const{data:R,onSelect:$,showHeader:E,showBackButton:P,hideHeaderCross:_,onBackButtonClick:A,isEvaluationList:z,autoOpenFirst:D}=H,[F,K]=r(R),[q,G]=r(""),[J,M]=r([]),[Q,U]=r(""),[W,X]=r(!1),[Y,Z]=r([]);c((()=>{ee(!0)}),[]),c((()=>{J.length>0?Z([J[J.length-1]]):Z(R)}),[J]);const ee=t=>e(void 0,void 0,void 0,(function*(){if(X(t),t){const e=w(F,J);K(e)}else if(J.length>0){const e=Q==J[J.length-1].displayName;if(q.length>0&&e){const e=k(q,Y,J);K(e)}else K([J[J.length-1].variables])}else if(q.length>0){const e=k(q,Y,J);K(e)}else K(R)})),te=()=>{let e=123;return J.length>0&&(e+=32),(H.showHeader||H.showBackButton)&&(e+=40),`calc(100% - ${e}px)`};return t(O.Provider,Object.assign({value:{variables:F,searchText:q,subHeaderStack:J,showRecommended:W,setSubHeaderStack:M,setSearchText:G,setVariables:K,setShowRecommended:X}},{children:s("div",Object.assign({tabIndex:-1,id:"variable-picker-v3",style:{backgroundColor:"white",borderRadius:4,height:"100%"},onClick:e=>e.stopPropagation()},{children:[(E||P)&&s(C,{children:[s("div",Object.assign({style:{display:"flex",alignItems:"center",gap:8}},{children:[P&&t(m,{Icon:()=>t(o,{width:16,height:16,style:{display:"flex",color:d.content.primary}}),onClick:A}),E&&t(f,{children:"Select Variable"})]})),!_&&t(m,{style:{color:"#212121"},Icon:l,onClick:()=>H.onClose&&H.onClose()})]}),t("div",Object.assign({style:{padding:"0 16px",paddingTop:12,backgroundColor:d.surface.subdued}},{children:t(p,{id:"search-bar-v3-picker",onBlur:e=>{H.onSearchBlur&&H.onSearchBlur(e)},value:q,noKeyDownChange:!0,placeholder:"Search",onChangeText:e=>{e||U("");const t=k(e,Y,J);if(W){const e=w(t,J);K(e)}else K(t);G(e);const s=J.length>0?J[J.length-1].displayName:"home";U(s)}})})),s(S,{children:[t(v,Object.assign({style:{color:d.content.secondary}},{children:"Only Recommended"})),t(b,{value:W,onValueChange:t=>e(void 0,void 0,void 0,(function*(){yield ee(t)}))})]}),J.length>0&&s(I,{children:[t("div",Object.assign({style:{position:"absolute",left:16}},{children:t(m,{id:"back-btn-v3",style:{display:"flex"},Icon:()=>t(o,{width:12,height:12,style:{color:d.content.secondary}}),onClick:e=>{e.stopPropagation();let t=q;const s=[...J],i=s.pop();if(M(s),i.displayName===Q&&(G(""),t=""),t.length>0){const e=s.length>0?[s[s.length-1]]:R,i=k(t,e,s);if(W){const e=w(i,s);K(e)}else K(i)}else if(s.length>0)if(W){const e=w([s[s.length-1].variables],s);K(e)}else K([s[s.length-1].variables]);else if(W){const e=w(R,J);K(e)}else K(R)}})})),t(y,Object.assign({style:{color:d.content.secondary}},{children:J[J.length-1].displayName}))]}),t(i,{children:F.length>0?t(V,Object.assign({height:te()},{children:F.map(((e,o)=>{var l,r;return e.displayName&&void 0!==e.variables?t("div",Object.assign({style:{borderBottom:`1px solid ${d.stroke.primary}`}},{children:t(h,Object.assign({autoOpen:D&&0===o,headerPadding:"12px 16px",header:t(j,Object.assign({style:{color:d.content.secondary}},{children:T(e.displayName,q)}))},{children:t(N,{parentVariable:e,disabled:null!==(l=H.disabled)&&void 0!==l&&l,searchText:q,variable:e.variables,onSelect:$})}))}),o):e.displayName?t(u,Object.assign({body:B(e),placement:"bottom"},{children:t(g,{variant:H.disabled?"inactive":(null==e?void 0:e.selected)?"selected":"default",version:"2.0",leadingIcon:(null==e?void 0:e.selected)?t(i,{}):t(a,{width:14,height:14}),customListItemLabel:s("div",Object.assign({style:{display:"flex",alignItems:"center",gap:4}},{children:[t(v,Object.assign({style:{fontSize:"14px",color:H.disabled?d.content.inactive:d.text.primary}},{children:T(e.displayName,q)})),!e.isAvailable&&t(u,Object.assign({body:"Not Recommended"},{children:t("div",Object.assign({style:{display:"flex"}},{children:t(n,{width:16,height:16,color:d.content.secondary})}))}))]})),listItem:{label:e.displayName,value:e.displayName},subText:e.description||"",onClick:()=>{if(!H.disabled)if(z){const t=L(e);$(Object.assign(Object.assign({},e),{actualValue:t}))}else $(e)}},o)}),o):t(N,{disabled:null!==(r=H.disabled)&&void 0!==r&&r,searchText:q,variable:e,onSelect:e=>{if(!H.disabled)if(z){const t=L(e);$(Object.assign(Object.assign({},e),{actualValue:t}))}else $(e)}},o)}))})):t(x,{height:te(),searchText:q})})]}))}))};export{R as VariablePickerContent,T as highlightSearchText};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import r from"../../assets/icons/search.svg.js";import n from"styled-components";import{COLORS as o}from"../../constants/Theme.js";import{TitleMedium as i,BodySecondary as s}from"../TypographyStyle.js";const c=n=>e(a,Object.assign({height:n.height},{children:[t(d,{children:t(r,{width:24,height:24,color:o.background.brand})}),e("div",Object.assign({style:{textAlign:"center"}},{children:[t(i,{children:"No results found"}),n.searchText?t(s,Object.assign({style:{color:o.content.secondary,marginTop:8}},{children:`Sorry we could not find any results for "${n.searchText}"`})):t(s,Object.assign({style:{color:o.content.secondary,marginTop:8}},{children:"Sorry we could not find any variables"}))]}))]})),a=n.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
gap: 16px;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
padding: 0 16px;
|
|
8
|
+
height: ${e=>e.height};
|
|
9
|
+
`,d=n.div`
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
background-color: ${o.background.brandLight};
|
|
14
|
+
width: 48px;
|
|
15
|
+
height: 48px;
|
|
16
|
+
border-radius: 24px;
|
|
17
|
+
`;export{c as default};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SubHeader, VariableListInterfaceV3, VariableV3 } from './model';
|
|
3
|
+
type SubHeaderProps = {
|
|
4
|
+
parentVariable?: VariableListInterfaceV3;
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
searchText: string;
|
|
7
|
+
onSelect: (variable: VariableV3) => void;
|
|
8
|
+
variable: {
|
|
9
|
+
[key: string]: SubHeader | VariableV3;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare const renderTooltipBody: (variable: VariableV3) => string;
|
|
13
|
+
declare const SubHeaderItem: React.FC<SubHeaderProps>;
|
|
14
|
+
export default SubHeaderItem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,Fragment as t,jsxs as i}from"react/jsx-runtime";import s from"../../assets/icons/chevronRight.svg.js";import o from"../../assets/icons/plus.svg.js";import a from"../../assets/icons/sub_category.svg.js";import l from"../../assets/icons/triangle_error.svg.js";import{cloneDeep as n}from"lodash";import{COLORS as r}from"../../constants/Theme.js";import{ListItem as c}from"../list-item/ListItem.js";import{Tooltip as m}from"../tooltips/Tooltip.js";import{BodySecondary as d}from"../TypographyStyle.js";import{highlightSearchText as p}from"./Content.js";import{useVariablePickerContext as b}from"./context.js";import{showOnlyRecommendedVariables as v}from"./recommendVaribles.js";const g=e=>{var t;return(null===(t=e.contextQ)||void 0===t?void 0:t.join(" > "))||""},h=h=>{const{onSelect:y,variable:f,searchText:j,disabled:u,parentVariable:x}=h,{subHeaderStack:I,setSubHeaderStack:O,setVariables:N,showRecommended:S}=b();return e("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:4}},{children:Object.keys(f).map(((b,h)=>{if(void 0===f[b].variables){const s=f[b];return e(m,Object.assign({body:g(s),placement:"bottom"},{children:e(c,{variant:u?"inactive":(null==s?void 0:s.selected)?"selected":"default",version:"2.0",leadingIcon:(null==s?void 0:s.selected)?e(t,{}):e(o,{width:14,height:14}),customListItemLabel:i("div",Object.assign({style:{display:"flex",alignItems:"center",gap:4}},{children:[e(d,Object.assign({style:{fontSize:"14px",color:u?r.content.inactive:r.text.primary}},{children:p(s.displayName,j)})),!s.isAvailable&&e(m,Object.assign({body:"Not Recommended"},{children:e("div",Object.assign({style:{display:"flex"}},{children:e(l,{width:16,height:16,color:r.content.secondary})}))}))]})),listItem:{label:s.displayName,value:s.displayName},subText:s.description||"",onClick:()=>{y(s)}})}),h)}return e(m,Object.assign({body:g(f[b]),placement:"bottom"},{children:e(c,{variant:u?"inactive":"default",version:"2.0",listItem:{label:f[b].displayName,value:f[b].displayName},customListItemLabel:e("div",Object.assign({style:{display:"flex",alignItems:"center"}},{children:e(d,Object.assign({style:{fontSize:"14px",color:u?r.content.inactive:r.text.primary}},{children:p(f[b].displayName,j)}))})),leadingIcon:e(a,{width:14,height:14}),subText:f[b].description||"",trailingIcon:e(s,{width:10,height:10,color:"#212121"}),onClick:()=>{const e=n(f[b]);void 0!==x&&(e.contextQ=[x.displayName]);const t=[...I,e];if(O(t),S){const i=v([e.variables],t);N(i)}else N([e.variables])}})}),h)}))}))};export{h as default,g as renderTooltipBody};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as t,jsx as s}from"react/jsx-runtime";import o from"../../assets/icons/cross.svg.js";import{COLORS as e}from"../../constants/Theme.js";import{CloseButtonContainer as i}from"../modals/modal.styled.js";import{VariablePickerContent as r}from"./Content.js";import{PickerType as n}from"./model.js";const d=d=>{var c;const{type:h}=d;return h==n.FLOATER?t("div",Object.assign({style:{boxShadow:"0px 2px 8px 0px #0000001F",width:d.width?d.width:344,borderRadius:4,height:"100%"}},{children:[s(r,Object.assign({},d)),s(i,Object.assign({onClick:()=>{d.onClose&&d.onClose()}},{children:s(o,{height:20,width:20,color:e.content.secondary})}))]})):s("div",Object.assign({style:{width:null!==(c=d.width)&&void 0!==c?c:"100%",height:"100%"}},{children:s(r,Object.assign({},d))}))};export{d as VariablePicker,d as default};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const VariablePickerContext: React.Context<{
|
|
3
|
+
searchText: string;
|
|
4
|
+
setSearchText: React.Dispatch<React.SetStateAction<string>>;
|
|
5
|
+
subHeaderStack: any[];
|
|
6
|
+
setSubHeaderStack: React.Dispatch<React.SetStateAction<any[]>>;
|
|
7
|
+
variables: any[];
|
|
8
|
+
setVariables: React.Dispatch<React.SetStateAction<any[]>>;
|
|
9
|
+
showRecommended: boolean;
|
|
10
|
+
setShowRecommended: React.Dispatch<React.SetStateAction<boolean>>;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const useVariablePickerContext: () => {
|
|
13
|
+
searchText: string;
|
|
14
|
+
setSearchText: React.Dispatch<React.SetStateAction<string>>;
|
|
15
|
+
subHeaderStack: any[];
|
|
16
|
+
setSubHeaderStack: React.Dispatch<React.SetStateAction<any[]>>;
|
|
17
|
+
variables: any[];
|
|
18
|
+
setVariables: React.Dispatch<React.SetStateAction<any[]>>;
|
|
19
|
+
showRecommended: boolean;
|
|
20
|
+
setShowRecommended: React.Dispatch<React.SetStateAction<boolean>>;
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e,{useContext as t}from"react";const a=e.createContext({searchText:"",setSearchText:()=>{},subHeaderStack:[],setSubHeaderStack:()=>{},variables:[],setVariables:()=>{},showRecommended:!1,setShowRecommended:()=>{}}),r=()=>t(a);export{a as VariablePickerContext,r as useVariablePickerContext};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './VariablePicker';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare enum PickerType {
|
|
2
|
+
FLOATER = "floater",
|
|
3
|
+
EMBEDDED = "embedded"
|
|
4
|
+
}
|
|
5
|
+
export interface VariablePickerV3Props {
|
|
6
|
+
type: PickerType;
|
|
7
|
+
data: VariableListInterfaceV3[];
|
|
8
|
+
onSelect: (variable: VariableV3) => void;
|
|
9
|
+
width?: string;
|
|
10
|
+
onClose?: () => void;
|
|
11
|
+
showHeader?: boolean;
|
|
12
|
+
showBackButton?: boolean;
|
|
13
|
+
onBackButtonClick?: () => void;
|
|
14
|
+
onSearchBlur?: (e: any) => void;
|
|
15
|
+
isEvaluationList?: boolean;
|
|
16
|
+
hideHeaderCross?: boolean;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
autoOpenFirst?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface VariableListInterfaceV3 {
|
|
21
|
+
isSubHeader?: boolean;
|
|
22
|
+
displayName: string;
|
|
23
|
+
description: string;
|
|
24
|
+
orderId?: number;
|
|
25
|
+
isAvailable?: boolean;
|
|
26
|
+
contextQ?: string[];
|
|
27
|
+
variables?: {
|
|
28
|
+
[key: string]: SubHeader | VariableV3;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface SubHeader {
|
|
32
|
+
isSubHeader: boolean;
|
|
33
|
+
isAvailable: boolean;
|
|
34
|
+
displayName: string;
|
|
35
|
+
description: string;
|
|
36
|
+
contextQ?: string[];
|
|
37
|
+
variables?: {
|
|
38
|
+
[key: string]: SubHeader | VariableV3;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export interface VariableV3 {
|
|
42
|
+
contextQ?: string[];
|
|
43
|
+
selected?: boolean;
|
|
44
|
+
description?: string;
|
|
45
|
+
defaultValue?: string;
|
|
46
|
+
displayName: string;
|
|
47
|
+
actualValue: string;
|
|
48
|
+
variableType: string;
|
|
49
|
+
isAvailable: boolean;
|
|
50
|
+
actualValueEval?: string;
|
|
51
|
+
isSubHeader?: boolean;
|
|
52
|
+
variables?: {
|
|
53
|
+
[key: string]: VariableV3;
|
|
54
|
+
};
|
|
55
|
+
needsFetching?: boolean;
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e;!function(e){e.FLOATER="floater",e.EMBEDDED="embedded"}(e||(e={}));export{e as PickerType};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const showOnlyRecommendedVariables: (data: any, stack: any[]) => any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=(e,i)=>e.map((e=>{if(e.isAvailable&&void 0===e.variables)return e;if(void 0===e.isAvailable&&void 0!==e.variables){const i=a(e.variables);return 0===Object.keys(i).length?{}:Object.assign(Object.assign({},e),{variables:i})}if(void 0===e.variables){return a(e)}{const s=a(e.variables);return i.length?s:Object.assign(Object.assign({},e),{variables:s})}})).filter((e=>Object.keys(e).length>0)),a=e=>Object.keys(e).reduce(((a,i)=>(e[i]&&e[i].isAvailable&&(a[i]=e[i]),a)),{});export{e as showOnlyRecommendedVariables};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=(e,s,t)=>{if(!e)return t.length>0?[t[t.length-1].variables]:s;const i=[];return s.forEach((s=>{if(t.length>0)if(s.displayName&&void 0!==s.variables)a(e,s.variables,i,[...s.contextQ||[],s.displayName]);else{if(s.displayName.toLowerCase().includes(e.toLowerCase())&&i.push(s),!s.variables||!Object.keys(s.variables).length)return;a(e,s.variables,i,[...s.contextQ||[],s.displayName])}else{if(s.displayName.toLowerCase().includes(e.toLowerCase())&&i.push(s),!s.variables||!Object.keys(s.variables).length)return;a(e,s.variables,i,[s.displayName])}})),i},a=function(e,s,t){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];Object.keys(s).forEach((l=>{s[l].displayName.toLowerCase().includes(e.toLowerCase())&&t.push(s[l].isSubHeader?{[l]:Object.assign(Object.assign({},s[l]),{contextQ:i})}:Object.assign(Object.assign({},s[l]),{contextQ:i})),s[l].variables&&Object.keys(s[l].variables).length&&a(e,s[l].variables,t,[...i,s[l].displayName])}))};export{e as searchVariables};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const HeaderWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const RecommendWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
+
export declare const BackHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
+
export declare const Container: import("styled-components").StyledComponent<"div", any, {
|
|
5
|
+
height: string;
|
|
6
|
+
}, never>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import e from"styled-components";import{COLORS as t}from"../../constants/Theme.js";const o=e.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
padding: 12px 16px 0px 16px;
|
|
5
|
+
background-color: ${t.surface.subdued};
|
|
6
|
+
justify-content: space-between;
|
|
7
|
+
`,i=e.div`
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
align-items: center;
|
|
11
|
+
padding: 12px 16px;
|
|
12
|
+
background-color: ${t.surface.subdued};
|
|
13
|
+
border-bottom: 1px solid ${t.stroke.primary};
|
|
14
|
+
`,r=e.div`
|
|
15
|
+
position: relative;
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
height: 32px;
|
|
20
|
+
background-color: ${t.background.base};
|
|
21
|
+
`,n=e.div`
|
|
22
|
+
margin: 8px;
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
gap: 4px;
|
|
26
|
+
height: ${e=>e.height};
|
|
27
|
+
overflow: scroll;
|
|
28
|
+
&::-webkit-scrollbar-thumb {
|
|
29
|
+
background-color: #e0e0e0 !important;
|
|
30
|
+
border-radius: 8px;
|
|
31
|
+
}
|
|
32
|
+
&::-webkit-scrollbar {
|
|
33
|
+
height: 5px;
|
|
34
|
+
display: block;
|
|
35
|
+
width: 8px;
|
|
36
|
+
}
|
|
37
|
+
&::-webkit-scrollbar-thumb:horizontal {
|
|
38
|
+
width: 8px;
|
|
39
|
+
}
|
|
40
|
+
`;export{r as BackHeader,n as Container,o as HeaderWrapper,i as RecommendWrapper};
|