@bikdotai/bik-component-library 0.0.817 → 0.0.819
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/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js.map +1 -1
- package/dist/cjs/components/template-preview/RCS/RCSChatPreview.js +1 -1
- package/dist/cjs/components/template-preview/RCS/RCSChatPreview.js.map +1 -1
- package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
- package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.js.map +1 -1
- package/dist/cjs/components/template-preview/models/RCSTemplate.js.map +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.d.ts +1 -0
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +88 -87
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js.map +1 -1
- package/dist/esm/components/template-preview/RCS/RCSChatPreview.js +68 -72
- package/dist/esm/components/template-preview/RCS/RCSChatPreview.js.map +1 -1
- package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.d.ts +8 -0
- package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.js +79 -61
- package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.js.map +1 -1
- package/dist/esm/components/template-preview/models/RCSTemplate.d.ts +7 -0
- package/dist/esm/components/template-preview/models/RCSTemplate.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Dropdown as
|
|
4
|
-
import
|
|
5
|
-
import { DEFAULT_THEME as _, BASE_COLORS as
|
|
6
|
-
import { Caption as
|
|
7
|
-
import { MainDropdown as U, ItemMenuContainer as
|
|
8
|
-
import { DatePicker as
|
|
9
|
-
const
|
|
1
|
+
import { jsx as a, Fragment as Y, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { useState as R, useRef as K, useEffect as C } from "react";
|
|
3
|
+
import { Dropdown as L } from "react-bootstrap";
|
|
4
|
+
import O from "react-dom";
|
|
5
|
+
import { DEFAULT_THEME as _, BASE_COLORS as $ } from "../../constants/Theme.js";
|
|
6
|
+
import { Caption as Q, BodySecondary as q, BodyCaption as H } from "../TypographyStyle.js";
|
|
7
|
+
import { MainDropdown as U, ItemMenuContainer as W } from "./CommonStyles.js";
|
|
8
|
+
import { DatePicker as X } from "../datePicker/DatePicker.js";
|
|
9
|
+
const se = ({
|
|
10
10
|
options: t,
|
|
11
11
|
placeholder: r = "Select an option",
|
|
12
|
-
selected:
|
|
12
|
+
selected: n,
|
|
13
13
|
onOptionSelected: i,
|
|
14
|
-
resetDropdown:
|
|
14
|
+
resetDropdown: S,
|
|
15
15
|
maxHeight: D,
|
|
16
|
-
backgroundcolor:
|
|
17
|
-
calendarPopperConfig:
|
|
18
|
-
variant:
|
|
16
|
+
backgroundcolor: k,
|
|
17
|
+
calendarPopperConfig: g,
|
|
18
|
+
variant: v = "default",
|
|
19
19
|
datePickerPlacement: z,
|
|
20
20
|
closeDropdown: G,
|
|
21
21
|
labelColor: A,
|
|
22
22
|
styleProps: F,
|
|
23
23
|
showTimePicker: c = !1
|
|
24
24
|
}) => {
|
|
25
|
-
const [b, f] =
|
|
25
|
+
const [b, f] = R(!1), [o, w] = R(n), [l, y] = R(), [p, u] = R(!1), [M, x] = R(n), E = K(null), J = v === "small" ? Q : q;
|
|
26
26
|
C(() => {
|
|
27
|
-
|
|
28
|
-
}, [
|
|
29
|
-
|
|
30
|
-
}, [
|
|
31
|
-
|
|
27
|
+
S && w(void 0);
|
|
28
|
+
}, [S]), C(() => {
|
|
29
|
+
n?.isCustom && n.dateRangeSelectionOptions?.selectedDates ? y(n.dateRangeSelectionOptions.selectedDates) : y(void 0), w(n);
|
|
30
|
+
}, [n]), C(() => {
|
|
31
|
+
u(!1), f(!1);
|
|
32
32
|
}, [G]);
|
|
33
|
-
const
|
|
34
|
-
e !== void 0 ? (
|
|
33
|
+
const I = (e) => {
|
|
34
|
+
e !== void 0 ? (u(e), b && f(!1)) : u((d) => !d);
|
|
35
35
|
}, B = (e) => {
|
|
36
|
-
|
|
36
|
+
E.current && !E.current.contains(e.target) && (b && f(!1), I(!1));
|
|
37
37
|
};
|
|
38
38
|
return C(() => (p && document.addEventListener("mousedown", B), () => {
|
|
39
39
|
document.removeEventListener("mousedown", B);
|
|
40
|
-
}), [p]), /* @__PURE__ */
|
|
40
|
+
}), [p]), /* @__PURE__ */ a(Y, { children: /* @__PURE__ */ h(
|
|
41
41
|
U,
|
|
42
42
|
{
|
|
43
43
|
drop: "down",
|
|
44
44
|
show: p,
|
|
45
|
-
onToggle:
|
|
46
|
-
bgColor:
|
|
45
|
+
onToggle: I,
|
|
46
|
+
bgColor: k,
|
|
47
47
|
id: "analytic-dropdown",
|
|
48
48
|
children: [
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
|
|
49
|
+
/* @__PURE__ */ a(
|
|
50
|
+
L.Toggle,
|
|
51
51
|
{
|
|
52
52
|
id: "dropdown-autoclose-outside",
|
|
53
53
|
className: "main--dropdown",
|
|
54
|
-
style:
|
|
54
|
+
style: v === "small" ? {
|
|
55
55
|
display: "flex",
|
|
56
56
|
alignItems: "center",
|
|
57
57
|
gap: 6,
|
|
@@ -60,76 +60,76 @@ const ae = ({
|
|
|
60
60
|
borderRadius: 4,
|
|
61
61
|
border: `1px solid ${_.colorsV2.stroke.primary}`
|
|
62
62
|
} : F || void 0,
|
|
63
|
-
children: /* @__PURE__ */
|
|
63
|
+
children: /* @__PURE__ */ a(
|
|
64
64
|
J,
|
|
65
65
|
{
|
|
66
|
-
style:
|
|
66
|
+
style: v === "small" || A ? {
|
|
67
67
|
color: A || _.colorsV2.content.secondary
|
|
68
68
|
} : void 0,
|
|
69
|
-
children:
|
|
69
|
+
children: o?.isCustom ? l ? m(l[0], c) === m(l[1], c) ? `${m(l[0], c)}` : `${m(
|
|
70
70
|
l[0],
|
|
71
71
|
c
|
|
72
|
-
)} to ${m(l[1], c)}` : M?.label ? M?.label : r :
|
|
72
|
+
)} to ${m(l[1], c)}` : M?.label ? M?.label : r : o ? o?.label : r
|
|
73
73
|
}
|
|
74
74
|
)
|
|
75
75
|
}
|
|
76
76
|
),
|
|
77
|
-
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
|
|
77
|
+
O.createPortal(
|
|
78
|
+
/* @__PURE__ */ a(
|
|
79
|
+
L.Menu,
|
|
80
80
|
{
|
|
81
81
|
className: "main--dropdown",
|
|
82
82
|
style: { padding: 0 },
|
|
83
|
-
ref:
|
|
84
|
-
children: /* @__PURE__ */
|
|
83
|
+
ref: E,
|
|
84
|
+
children: /* @__PURE__ */ h(
|
|
85
85
|
U,
|
|
86
86
|
{
|
|
87
87
|
drop: z ?? "end",
|
|
88
88
|
id: "sub--dropdown",
|
|
89
89
|
show: b,
|
|
90
90
|
onToggle: (e) => {
|
|
91
|
-
!e &&
|
|
91
|
+
!e && u(!1), f(!b);
|
|
92
92
|
},
|
|
93
93
|
children: [
|
|
94
|
-
/* @__PURE__ */
|
|
94
|
+
/* @__PURE__ */ a(
|
|
95
95
|
"div",
|
|
96
96
|
{
|
|
97
97
|
style: {
|
|
98
98
|
maxHeight: D || "auto",
|
|
99
99
|
overflowY: "scroll"
|
|
100
100
|
},
|
|
101
|
-
children: t.map((e, d) => /* @__PURE__ */
|
|
101
|
+
children: t.map((e, d) => /* @__PURE__ */ a("div", { children: e?.isCustom ? /* @__PURE__ */ a(L.Toggle, { className: "sub--dropdown", children: /* @__PURE__ */ a(
|
|
102
102
|
V,
|
|
103
103
|
{
|
|
104
104
|
isFirstItem: d === 0,
|
|
105
105
|
isLastItem: d === t.length - 1,
|
|
106
106
|
eachOption: e,
|
|
107
|
-
selectedOption:
|
|
107
|
+
selectedOption: o,
|
|
108
108
|
selectedDate: l,
|
|
109
|
-
onClickingEachItem: (
|
|
110
|
-
w(
|
|
109
|
+
onClickingEachItem: (s) => {
|
|
110
|
+
w(s), f(!0);
|
|
111
111
|
},
|
|
112
112
|
rangeSelection: !!e?.dateRangeSelectionOptions?.selectRange,
|
|
113
113
|
showTimePicker: c
|
|
114
114
|
}
|
|
115
|
-
) }) : /* @__PURE__ */
|
|
115
|
+
) }) : /* @__PURE__ */ a(
|
|
116
116
|
V,
|
|
117
117
|
{
|
|
118
118
|
isFirstItem: d === 0,
|
|
119
119
|
isLastItem: d === t.length - 1,
|
|
120
120
|
eachOption: e,
|
|
121
|
-
selectedOption:
|
|
121
|
+
selectedOption: o,
|
|
122
122
|
selectedDate: l,
|
|
123
|
-
onClickingEachItem: (
|
|
124
|
-
if (y(void 0), w(
|
|
125
|
-
i(
|
|
123
|
+
onClickingEachItem: (s) => {
|
|
124
|
+
if (y(void 0), w(s), x(s), I(), !s.noOfDays) {
|
|
125
|
+
i(s);
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
128
|
const N = /* @__PURE__ */ new Date(), j = /* @__PURE__ */ new Date();
|
|
129
129
|
j.setDate(
|
|
130
|
-
N.getDate() -
|
|
130
|
+
N.getDate() - s.noOfDays
|
|
131
131
|
), i({
|
|
132
|
-
...
|
|
132
|
+
...s,
|
|
133
133
|
selectedRange: [j, N]
|
|
134
134
|
});
|
|
135
135
|
},
|
|
@@ -138,8 +138,8 @@ const ae = ({
|
|
|
138
138
|
) }, e?.key))
|
|
139
139
|
}
|
|
140
140
|
),
|
|
141
|
-
/* @__PURE__ */
|
|
142
|
-
|
|
141
|
+
/* @__PURE__ */ a(
|
|
142
|
+
L.Menu,
|
|
143
143
|
{
|
|
144
144
|
className: "sub--dropdown",
|
|
145
145
|
popperConfig: {
|
|
@@ -148,36 +148,37 @@ const ae = ({
|
|
|
148
148
|
name: "offset",
|
|
149
149
|
options: {
|
|
150
150
|
offset: [
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
g?.offsetSkid || 0,
|
|
152
|
+
g?.offsetDistance || 0
|
|
153
153
|
]
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
]
|
|
157
157
|
},
|
|
158
|
-
children: /* @__PURE__ */
|
|
159
|
-
|
|
158
|
+
children: /* @__PURE__ */ a(
|
|
159
|
+
X,
|
|
160
160
|
{
|
|
161
|
-
selectRange:
|
|
161
|
+
selectRange: o?.dateRangeSelectionOptions?.selectRange || !1,
|
|
162
162
|
showTimePicker: c,
|
|
163
|
-
maxDate:
|
|
164
|
-
minDate:
|
|
163
|
+
maxDate: o?.dateRangeSelectionOptions?.maxDate,
|
|
164
|
+
minDate: o?.dateRangeSelectionOptions?.minDate,
|
|
165
|
+
maxRangeLimit: o?.dateRangeSelectionOptions?.maxRangeLimit,
|
|
165
166
|
selectedDates: l,
|
|
166
167
|
onSelectRange: (e, d) => {
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
...
|
|
168
|
+
const s = [e, d];
|
|
169
|
+
o?.dateRangeSelectionOptions && (o.dateRangeSelectionOptions.selectedDates = s, i({
|
|
170
|
+
...o,
|
|
170
171
|
selectedRange: [e, d]
|
|
171
|
-
})),
|
|
172
|
+
})), x(o), f(!1), y(s), u(!p);
|
|
172
173
|
},
|
|
173
174
|
onSelectDate: (e) => {
|
|
174
|
-
|
|
175
|
+
o?.dateRangeSelectionOptions && (o.dateRangeSelectionOptions.selectedDates = [
|
|
175
176
|
e,
|
|
176
177
|
e
|
|
177
178
|
], i({
|
|
178
|
-
...
|
|
179
|
+
...o,
|
|
179
180
|
selectedRange: [e, e]
|
|
180
|
-
})),
|
|
181
|
+
})), x(o), f(!1), y([e, e]), u(!p);
|
|
181
182
|
}
|
|
182
183
|
}
|
|
183
184
|
)
|
|
@@ -196,29 +197,29 @@ const ae = ({
|
|
|
196
197
|
}, V = ({
|
|
197
198
|
eachOption: t,
|
|
198
199
|
selectedOption: r,
|
|
199
|
-
selectedDate:
|
|
200
|
+
selectedDate: n,
|
|
200
201
|
onClickingEachItem: i,
|
|
201
|
-
rangeSelection:
|
|
202
|
+
rangeSelection: S,
|
|
202
203
|
isLastItem: D,
|
|
203
|
-
isFirstItem:
|
|
204
|
-
showTimePicker:
|
|
205
|
-
}) => /* @__PURE__ */
|
|
206
|
-
|
|
204
|
+
isFirstItem: k,
|
|
205
|
+
showTimePicker: g
|
|
206
|
+
}) => /* @__PURE__ */ h(
|
|
207
|
+
W,
|
|
207
208
|
{
|
|
208
|
-
isFirstItem:
|
|
209
|
+
isFirstItem: k,
|
|
209
210
|
isLastItem: D,
|
|
210
211
|
onClick: () => i(t),
|
|
211
|
-
isSelected: t.isCustom ? t.key == r?.key && !!
|
|
212
|
+
isSelected: t.isCustom ? t.key == r?.key && !!n : t.key == r?.key,
|
|
212
213
|
children: [
|
|
213
|
-
/* @__PURE__ */
|
|
214
|
+
/* @__PURE__ */ a(
|
|
214
215
|
q,
|
|
215
216
|
{
|
|
216
|
-
color: t.key == r?.key ?
|
|
217
|
+
color: t.key == r?.key ? $.positive[900] : $.grayscale[900],
|
|
217
218
|
children: t.label
|
|
218
219
|
}
|
|
219
220
|
),
|
|
220
|
-
t.subLabel ? /* @__PURE__ */
|
|
221
|
-
|
|
221
|
+
t.subLabel ? /* @__PURE__ */ a(H, { style: { color: $.grayscale[700] }, children: t.subLabel }) : /* @__PURE__ */ a(Y, {}),
|
|
222
|
+
n && r?.isCustom && t.key == r?.key && /* @__PURE__ */ a(
|
|
222
223
|
H,
|
|
223
224
|
{
|
|
224
225
|
style: {
|
|
@@ -226,17 +227,17 @@ const ae = ({
|
|
|
226
227
|
wordBreak: "break-word",
|
|
227
228
|
textAlign: "left"
|
|
228
229
|
},
|
|
229
|
-
children:
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
)}` : `${m(
|
|
230
|
+
children: S ? `${m(n[0], g)} to ${m(
|
|
231
|
+
n[1],
|
|
232
|
+
g
|
|
233
|
+
)}` : `${m(n[0], g)}`
|
|
233
234
|
}
|
|
234
235
|
)
|
|
235
236
|
]
|
|
236
237
|
},
|
|
237
238
|
t.key
|
|
238
239
|
), m = (t, r) => {
|
|
239
|
-
const
|
|
240
|
+
const n = t.toLocaleString("default", {
|
|
240
241
|
day: "numeric",
|
|
241
242
|
month: "short",
|
|
242
243
|
year: "numeric"
|
|
@@ -247,12 +248,12 @@ const ae = ({
|
|
|
247
248
|
minute: "2-digit",
|
|
248
249
|
hour12: !0
|
|
249
250
|
});
|
|
250
|
-
return `${
|
|
251
|
+
return `${n} (${i})`;
|
|
251
252
|
}
|
|
252
|
-
return
|
|
253
|
+
return n;
|
|
253
254
|
};
|
|
254
255
|
export {
|
|
255
|
-
|
|
256
|
+
se as AnalyticsDropdown,
|
|
256
257
|
V as EachItem,
|
|
257
258
|
m as formatDate
|
|
258
259
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyticsDropdown.js","sources":["../../../../src/components/analytics-chips-and-dropdowns/AnalyticsDropdown.tsx"],"sourcesContent":["import 'bootstrap/dist/css/bootstrap.min.css';\nimport React, { useEffect, useRef, useState } from 'react';\nimport { Dropdown } from 'react-bootstrap';\nimport { DropDirection } from 'react-bootstrap/esm/DropdownContext';\nimport ReactDOM from 'react-dom';\nimport { BASE_COLORS, DEFAULT_THEME } from '@src/constants/Theme';\nimport { DatePicker } from '../datePicker';\nimport { BodyCaption, BodySecondary, Caption } from '../TypographyStyle';\nimport { ItemMenuContainer, MainDropdown } from './CommonStyles';\n\nexport interface DropdownOptions {\n\tlabel: string;\n\tsubLabel?: string;\n\tvalue: string;\n\tkey: string | number;\n\tnoOfDays?: number;\n\tisCustom?: boolean;\n\tdateRangeSelectionOptions?: {\n\t\tselectRange: boolean;\n\t\tselectedDates?: Date[];\n\t\tselectedDate?: Date;\n\t\tminDate?: Date;\n\t\tmaxDate?: Date;\n\t};\n}\n\nexport interface AnalyticsDropdownInterface {\n\toptions: DropdownOptions[];\n\tselected?: DropdownOptions;\n\tplaceholder?: string;\n\tresetDropdown?: boolean;\n\tonOptionSelected: (\n\t\tchosen: DropdownOptions & {\n\t\t\tselectedRange?: [Date, Date];\n\t\t},\n\t) => void;\n\tmaxHeight?: string;\n\tbackgroundcolor?: string;\n\tcalendarPopperConfig?: {\n\t\toffsetSkid?: number;\n\t\toffsetDistance?: number;\n\t};\n\tvariant?: 'small' | 'default';\n\tdatePickerPlacement?: DropDirection;\n\tcloseDropdown?: boolean;\n\tlabelColor?: string;\n\tstyleProps?: React.CSSProperties;\n\tshowTimePicker?: boolean;\n}\n\nexport const AnalyticsDropdown: React.FC<AnalyticsDropdownInterface> = ({\n\toptions,\n\tplaceholder = 'Select an option',\n\tselected,\n\tonOptionSelected,\n\tresetDropdown,\n\tmaxHeight,\n\tbackgroundcolor,\n\tcalendarPopperConfig,\n\tvariant = 'default',\n\tdatePickerPlacement,\n\tcloseDropdown,\n\tlabelColor,\n\tstyleProps,\n\tshowTimePicker = false,\n}) => {\n\tconst [openCalender, setCalender] = useState(false);\n\tconst [selectedOption, setSelectedOption] = useState(selected);\n\tconst [selectedDate, setSelectedDate] = useState<Date[]>();\n\tconst [showDropdown, setShowDropdown] = useState(false);\n\tconst [optionPlaceholder, setOptionPlaceholder] = useState(selected);\n\tconst dropdownRef = useRef<HTMLDivElement | null>(null);\n\tconst LabelText = variant === 'small' ? Caption : BodySecondary;\n\n\tuseEffect(() => {\n\t\tresetDropdown && setSelectedOption(undefined);\n\t}, [resetDropdown]);\n\n\tuseEffect(() => {\n\t\tif (\n\t\t\tselected?.isCustom &&\n\t\t\tselected.dateRangeSelectionOptions?.selectedDates\n\t\t) {\n\t\t\tsetSelectedDate(selected.dateRangeSelectionOptions.selectedDates);\n\t\t} else {\n\t\t\tsetSelectedDate(undefined);\n\t\t}\n\t\tsetSelectedOption(selected);\n\t}, [selected]);\n\n\tuseEffect(() => {\n\t\tsetShowDropdown(false);\n\t\tsetCalender(false);\n\t}, [closeDropdown]);\n\n\tconst setDropdown = (forceState?: boolean) => {\n\t\tif (forceState !== undefined) {\n\t\t\tsetShowDropdown(forceState);\n\t\t\topenCalender && setCalender(false);\n\t\t} else {\n\t\t\tsetShowDropdown((prevState) => !prevState);\n\t\t}\n\t};\n\n\tconst handleClickOutside = (event: MouseEvent) => {\n\t\tif (\n\t\t\tdropdownRef.current &&\n\t\t\t!dropdownRef.current.contains(event.target as Node)\n\t\t) {\n\t\t\tif (openCalender) {\n\t\t\t\tsetCalender(false);\n\t\t\t}\n\t\t\tsetDropdown(false);\n\t\t}\n\t};\n\n\tuseEffect(() => {\n\t\tif (showDropdown) {\n\t\t\tdocument.addEventListener('mousedown', handleClickOutside);\n\t\t}\n\t\treturn () => {\n\t\t\tdocument.removeEventListener('mousedown', handleClickOutside);\n\t\t};\n\t}, [showDropdown]);\n\n\treturn (\n\t\t<>\n\t\t\t<MainDropdown\n\t\t\t\tdrop={'down'}\n\t\t\t\tshow={showDropdown}\n\t\t\t\tonToggle={setDropdown}\n\t\t\t\tbgColor={backgroundcolor}\n\t\t\t\tid=\"analytic-dropdown\"\n\t\t\t>\n\t\t\t\t<Dropdown.Toggle\n\t\t\t\t\tid=\"dropdown-autoclose-outside\"\n\t\t\t\t\tclassName=\"main--dropdown\"\n\t\t\t\t\tstyle={\n\t\t\t\t\t\tvariant === 'small'\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t\t\t\tgap: 6,\n\t\t\t\t\t\t\t\t\tpadding: '4px 8px',\n\t\t\t\t\t\t\t\t\tbackgroundColor: '#FAFAFA',\n\t\t\t\t\t\t\t\t\tborderRadius: 4,\n\t\t\t\t\t\t\t\t\tborder: `1px solid ${DEFAULT_THEME.colorsV2.stroke.primary}`,\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: styleProps\n\t\t\t\t\t\t\t? styleProps\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<LabelText\n\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\tvariant === 'small' || labelColor\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\tcolor:\n\t\t\t\t\t\t\t\t\t\t\tlabelColor || DEFAULT_THEME.colorsV2.content.secondary,\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{selectedOption?.isCustom\n\t\t\t\t\t\t\t? selectedDate\n\t\t\t\t\t\t\t\t? formatDate(selectedDate[0], showTimePicker) ===\n\t\t\t\t\t\t\t\t formatDate(selectedDate[1], showTimePicker)\n\t\t\t\t\t\t\t\t\t? `${formatDate(selectedDate[0], showTimePicker)}`\n\t\t\t\t\t\t\t\t\t: `${formatDate(\n\t\t\t\t\t\t\t\t\t\t\tselectedDate[0],\n\t\t\t\t\t\t\t\t\t\t\tshowTimePicker,\n\t\t\t\t\t\t\t\t\t )} to ${formatDate(selectedDate[1], showTimePicker)}`\n\t\t\t\t\t\t\t\t: optionPlaceholder?.label\n\t\t\t\t\t\t\t\t? optionPlaceholder?.label\n\t\t\t\t\t\t\t\t: placeholder\n\t\t\t\t\t\t\t: selectedOption\n\t\t\t\t\t\t\t? selectedOption?.label\n\t\t\t\t\t\t\t: placeholder}\n\t\t\t\t\t</LabelText>\n\t\t\t\t</Dropdown.Toggle>\n\t\t\t\t{ReactDOM.createPortal(\n\t\t\t\t\t<Dropdown.Menu\n\t\t\t\t\t\tclassName=\"main--dropdown\"\n\t\t\t\t\t\tstyle={{ padding: 0 }}\n\t\t\t\t\t\tref={dropdownRef}\n\t\t\t\t\t>\n\t\t\t\t\t\t<MainDropdown\n\t\t\t\t\t\t\tdrop={datePickerPlacement ?? 'end'}\n\t\t\t\t\t\t\tid=\"sub--dropdown\"\n\t\t\t\t\t\t\tshow={openCalender}\n\t\t\t\t\t\t\tonToggle={(toggleCalender) => {\n\t\t\t\t\t\t\t\t!toggleCalender && setShowDropdown(false);\n\t\t\t\t\t\t\t\tsetCalender(!openCalender);\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tmaxHeight: maxHeight ? maxHeight : 'auto',\n\t\t\t\t\t\t\t\t\toverflowY: 'scroll',\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{options.map((eachOption, index) => (\n\t\t\t\t\t\t\t\t\t<div key={eachOption?.key}>\n\t\t\t\t\t\t\t\t\t\t{eachOption?.isCustom ? (\n\t\t\t\t\t\t\t\t\t\t\t<Dropdown.Toggle className=\"sub--dropdown\">\n\t\t\t\t\t\t\t\t\t\t\t\t<EachItem\n\t\t\t\t\t\t\t\t\t\t\t\t\tisFirstItem={index === 0}\n\t\t\t\t\t\t\t\t\t\t\t\t\tisLastItem={index === options.length - 1}\n\t\t\t\t\t\t\t\t\t\t\t\t\teachOption={eachOption}\n\t\t\t\t\t\t\t\t\t\t\t\t\tselectedOption={selectedOption}\n\t\t\t\t\t\t\t\t\t\t\t\t\tselectedDate={selectedDate}\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClickingEachItem={(option) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetSelectedOption(option);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetCalender(true);\n\t\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\t\trangeSelection={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\teachOption?.dateRangeSelectionOptions?.selectRange\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: false\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tshowTimePicker={showTimePicker}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t</Dropdown.Toggle>\n\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t<EachItem\n\t\t\t\t\t\t\t\t\t\t\t\tisFirstItem={index === 0}\n\t\t\t\t\t\t\t\t\t\t\t\tisLastItem={index === options.length - 1}\n\t\t\t\t\t\t\t\t\t\t\t\teachOption={eachOption}\n\t\t\t\t\t\t\t\t\t\t\t\tselectedOption={selectedOption}\n\t\t\t\t\t\t\t\t\t\t\t\tselectedDate={selectedDate}\n\t\t\t\t\t\t\t\t\t\t\t\tonClickingEachItem={(option) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetSelectedDate(undefined);\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetSelectedOption(option);\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetOptionPlaceholder(option);\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetDropdown();\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (!option.noOfDays) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonOptionSelected(option);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst endDate = new Date();\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst startDate = new Date();\n\t\t\t\t\t\t\t\t\t\t\t\t\tstartDate.setDate(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tendDate.getDate() - option.noOfDays,\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\tonOptionSelected({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t...option,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tselectedRange: [startDate, endDate],\n\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\tshowTimePicker={showTimePicker}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<Dropdown.Menu\n\t\t\t\t\t\t\t\tclassName=\"sub--dropdown\"\n\t\t\t\t\t\t\t\tpopperConfig={{\n\t\t\t\t\t\t\t\t\tmodifiers: [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tname: 'offset',\n\t\t\t\t\t\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\t\t\t\t\t\toffset: [\n\t\t\t\t\t\t\t\t\t\t\t\t\tcalendarPopperConfig?.offsetSkid || 0,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcalendarPopperConfig?.offsetDistance || 0,\n\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<DatePicker\n\t\t\t\t\t\t\t\t\tselectRange={\n\t\t\t\t\t\t\t\t\t\tselectedOption?.dateRangeSelectionOptions?.selectRange ||\n\t\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tshowTimePicker={showTimePicker}\n\t\t\t\t\t\t\t\t\tmaxDate={selectedOption?.dateRangeSelectionOptions?.maxDate}\n\t\t\t\t\t\t\t\t\tminDate={selectedOption?.dateRangeSelectionOptions?.minDate}\n\t\t\t\t\t\t\t\t\tselectedDates={selectedDate}\n\t\t\t\t\t\t\t\t\tonSelectRange={(selectedStartDate, selectedEndDate) => {\n\t\t\t\t\t\t\t\t\t\tconst updatedDates = [selectedStartDate, selectedEndDate];\n\n\t\t\t\t\t\t\t\t\t\tif (selectedOption?.dateRangeSelectionOptions) {\n\t\t\t\t\t\t\t\t\t\t\tselectedOption.dateRangeSelectionOptions.selectedDates =\n\t\t\t\t\t\t\t\t\t\t\t\tupdatedDates;\n\t\t\t\t\t\t\t\t\t\t\tonOptionSelected({\n\t\t\t\t\t\t\t\t\t\t\t\t...selectedOption,\n\t\t\t\t\t\t\t\t\t\t\t\tselectedRange: [selectedStartDate, selectedEndDate],\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tsetOptionPlaceholder(selectedOption);\n\t\t\t\t\t\t\t\t\t\tsetCalender(false);\n\t\t\t\t\t\t\t\t\t\tsetSelectedDate(updatedDates);\n\t\t\t\t\t\t\t\t\t\tsetShowDropdown(!showDropdown);\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tonSelectDate={(selectedDate) => {\n\t\t\t\t\t\t\t\t\t\tif (selectedOption?.dateRangeSelectionOptions) {\n\t\t\t\t\t\t\t\t\t\t\tselectedOption.dateRangeSelectionOptions.selectedDates = [\n\t\t\t\t\t\t\t\t\t\t\t\tselectedDate,\n\t\t\t\t\t\t\t\t\t\t\t\tselectedDate,\n\t\t\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t\t\t\tonOptionSelected({\n\t\t\t\t\t\t\t\t\t\t\t\t...selectedOption,\n\t\t\t\t\t\t\t\t\t\t\t\tselectedRange: [selectedDate, selectedDate],\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tsetOptionPlaceholder(selectedOption);\n\t\t\t\t\t\t\t\t\t\tsetCalender(false);\n\t\t\t\t\t\t\t\t\t\tsetSelectedDate([selectedDate, selectedDate]);\n\t\t\t\t\t\t\t\t\t\tsetShowDropdown(!showDropdown);\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</Dropdown.Menu>\n\t\t\t\t\t\t</MainDropdown>\n\t\t\t\t\t</Dropdown.Menu>,\n\t\t\t\t\tdocument.body,\n\t\t\t\t)}\n\t\t\t</MainDropdown>\n\t\t</>\n\t);\n};\n\nexport const EachItem: React.FC<{\n\teachOption: DropdownOptions;\n\tselectedOption: DropdownOptions | undefined;\n\tselectedDate: Date[] | undefined;\n\tonClickingEachItem: (optionSelected: DropdownOptions) => void;\n\trangeSelection?: boolean;\n\tisLastItem?: boolean;\n\tisFirstItem?: boolean;\n\tshowTimePicker?: boolean;\n}> = ({\n\teachOption,\n\tselectedOption,\n\tselectedDate,\n\tonClickingEachItem,\n\trangeSelection,\n\tisLastItem,\n\tisFirstItem,\n\tshowTimePicker,\n}) => {\n\treturn (\n\t\t<ItemMenuContainer\n\t\t\tisFirstItem={isFirstItem}\n\t\t\tisLastItem={isLastItem}\n\t\t\tkey={eachOption.key}\n\t\t\tonClick={() => onClickingEachItem(eachOption)}\n\t\t\tisSelected={\n\t\t\t\teachOption.isCustom\n\t\t\t\t\t? eachOption.key == selectedOption?.key && !!selectedDate\n\t\t\t\t\t: eachOption.key == selectedOption?.key\n\t\t\t}\n\t\t>\n\t\t\t<BodySecondary\n\t\t\t\tcolor={\n\t\t\t\t\teachOption.key == selectedOption?.key\n\t\t\t\t\t\t? BASE_COLORS.positive[900]\n\t\t\t\t\t\t: BASE_COLORS.grayscale[900]\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{eachOption.label}\n\t\t\t</BodySecondary>\n\t\t\t{eachOption.subLabel ? (\n\t\t\t\t<BodyCaption style={{ color: BASE_COLORS.grayscale[700] }}>\n\t\t\t\t\t{eachOption.subLabel}\n\t\t\t\t</BodyCaption>\n\t\t\t) : (\n\t\t\t\t<></>\n\t\t\t)}\n\t\t\t{selectedDate &&\n\t\t\t\tselectedOption?.isCustom &&\n\t\t\t\teachOption.key == selectedOption?.key && (\n\t\t\t\t\t<BodyCaption\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\twhiteSpace: 'normal',\n\t\t\t\t\t\t\twordBreak: 'break-word',\n\t\t\t\t\t\t\ttextAlign: 'left',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{rangeSelection\n\t\t\t\t\t\t\t? `${formatDate(selectedDate[0], showTimePicker)} to ${formatDate(\n\t\t\t\t\t\t\t\t\tselectedDate[1],\n\t\t\t\t\t\t\t\t\tshowTimePicker,\n\t\t\t\t\t\t\t )}`\n\t\t\t\t\t\t\t: `${formatDate(selectedDate[0], showTimePicker)}`}\n\t\t\t\t\t</BodyCaption>\n\t\t\t\t)}\n\t\t</ItemMenuContainer>\n\t);\n};\n\nexport const formatDate = (dateVal: Date, includeTime?: boolean) => {\n\tconst dateString = dateVal.toLocaleString('default', {\n\t\tday: 'numeric',\n\t\tmonth: 'short',\n\t\tyear: 'numeric',\n\t});\n\n\tif (includeTime) {\n\t\tconst timeString = dateVal.toLocaleString('default', {\n\t\t\thour: 'numeric',\n\t\t\tminute: '2-digit',\n\t\t\thour12: true,\n\t\t});\n\t\treturn `${dateString} (${timeString})`;\n\t}\n\n\treturn dateString;\n};\n"],"names":["AnalyticsDropdown","options","placeholder","selected","onOptionSelected","resetDropdown","maxHeight","backgroundcolor","calendarPopperConfig","variant","datePickerPlacement","closeDropdown","labelColor","styleProps","showTimePicker","openCalender","setCalender","useState","selectedOption","setSelectedOption","selectedDate","setSelectedDate","showDropdown","setShowDropdown","optionPlaceholder","setOptionPlaceholder","dropdownRef","useRef","LabelText","Caption","BodySecondary","useEffect","setDropdown","forceState","prevState","handleClickOutside","event","jsx","Fragment","jsxs","MainDropdown","Dropdown","DEFAULT_THEME","formatDate","ReactDOM","toggleCalender","eachOption","index","EachItem","option","endDate","startDate","DatePicker","selectedStartDate","selectedEndDate","updatedDates","onClickingEachItem","rangeSelection","isLastItem","isFirstItem","ItemMenuContainer","BASE_COLORS","BodyCaption","dateVal","includeTime","dateString","timeString"],"mappings":";;;;;;;;AAkDO,MAAMA,KAA0D,CAAC;AAAA,EACvE,SAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,UAAAC;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AAAT,EAACyB,GAAA,EAAY,OAAO,EAAE,OAAOD,EAAY,UAAU,GAAG,EAAA,GACpD,UAAAf,EAAW,SAAA,CACb,IAEA,gBAAAT,EAAAC,GAAA,EAAE;AAAA,MAEFlB,KACAF,GAAgB,YAChB4B,EAAW,OAAO5B,GAAgB,OACjC,gBAAAmB;AAAA,QAACyB;AAAA,QAAA;AAAA,UACA,OAAO;AAAA,YACN,YAAY;AAAA,YACZ,WAAW;AAAA,YACX,WAAW;AAAA,UAAA;AAAA,UAGX,UAAAL,IACE,GAAGd,EAAWvB,EAAa,CAAC,GAAGN,CAAc,CAAC,OAAO6B;AAAA,YACrDvB,EAAa,CAAC;AAAA,YACdN;AAAA,UAAA,CACC,KACD,GAAG6B,EAAWvB,EAAa,CAAC,GAAGN,CAAc,CAAC;AAAA,QAAA;AAAA,MAAA;AAAA,IAClD;AAAA,EAAA;AAAA,EAxCGgC,EAAW;AAAA,GA8CNH,IAAa,CAACoB,GAAeC,MAA0B;AACnE,QAAMC,IAAaF,EAAQ,eAAe,WAAW;AAAA,IACpD,KAAK;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,EAAA,CACN;AAED,MAAIC,GAAa;AAChB,UAAME,IAAaH,EAAQ,eAAe,WAAW;AAAA,MACpD,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,QAAQ;AAAA,IAAA,CACR;AACD,WAAO,GAAGE,CAAU,KAAKC,CAAU;AAAA,EACpC;AAEA,SAAOD;AACR;"}
|
|
1
|
+
{"version":3,"file":"AnalyticsDropdown.js","sources":["../../../../src/components/analytics-chips-and-dropdowns/AnalyticsDropdown.tsx"],"sourcesContent":["import 'bootstrap/dist/css/bootstrap.min.css';\nimport React, { useEffect, useRef, useState } from 'react';\nimport { Dropdown } from 'react-bootstrap';\nimport { DropDirection } from 'react-bootstrap/esm/DropdownContext';\nimport ReactDOM from 'react-dom';\nimport { BASE_COLORS, DEFAULT_THEME } from '@src/constants/Theme';\nimport { DatePicker } from '../datePicker';\nimport { BodyCaption, BodySecondary, Caption } from '../TypographyStyle';\nimport { ItemMenuContainer, MainDropdown } from './CommonStyles';\n\nexport interface DropdownOptions {\n\tlabel: string;\n\tsubLabel?: string;\n\tvalue: string;\n\tkey: string | number;\n\tnoOfDays?: number;\n\tisCustom?: boolean;\n\tdateRangeSelectionOptions?: {\n\t\tselectRange: boolean;\n\t\tselectedDates?: Date[];\n\t\tselectedDate?: Date;\n\t\tminDate?: Date;\n\t\tmaxDate?: Date;\n\t\tmaxRangeLimit?: number | null;\n\t};\n}\n\nexport interface AnalyticsDropdownInterface {\n\toptions: DropdownOptions[];\n\tselected?: DropdownOptions;\n\tplaceholder?: string;\n\tresetDropdown?: boolean;\n\tonOptionSelected: (\n\t\tchosen: DropdownOptions & {\n\t\t\tselectedRange?: [Date, Date];\n\t\t},\n\t) => void;\n\tmaxHeight?: string;\n\tbackgroundcolor?: string;\n\tcalendarPopperConfig?: {\n\t\toffsetSkid?: number;\n\t\toffsetDistance?: number;\n\t};\n\tvariant?: 'small' | 'default';\n\tdatePickerPlacement?: DropDirection;\n\tcloseDropdown?: boolean;\n\tlabelColor?: string;\n\tstyleProps?: React.CSSProperties;\n\tshowTimePicker?: boolean;\n}\n\nexport const AnalyticsDropdown: React.FC<AnalyticsDropdownInterface> = ({\n\toptions,\n\tplaceholder = 'Select an option',\n\tselected,\n\tonOptionSelected,\n\tresetDropdown,\n\tmaxHeight,\n\tbackgroundcolor,\n\tcalendarPopperConfig,\n\tvariant = 'default',\n\tdatePickerPlacement,\n\tcloseDropdown,\n\tlabelColor,\n\tstyleProps,\n\tshowTimePicker = false,\n}) => {\n\tconst [openCalender, setCalender] = useState(false);\n\tconst [selectedOption, setSelectedOption] = useState(selected);\n\tconst [selectedDate, setSelectedDate] = useState<Date[]>();\n\tconst [showDropdown, setShowDropdown] = useState(false);\n\tconst [optionPlaceholder, setOptionPlaceholder] = useState(selected);\n\tconst dropdownRef = useRef<HTMLDivElement | null>(null);\n\tconst LabelText = variant === 'small' ? Caption : BodySecondary;\n\n\tuseEffect(() => {\n\t\tresetDropdown && setSelectedOption(undefined);\n\t}, [resetDropdown]);\n\n\tuseEffect(() => {\n\t\tif (\n\t\t\tselected?.isCustom &&\n\t\t\tselected.dateRangeSelectionOptions?.selectedDates\n\t\t) {\n\t\t\tsetSelectedDate(selected.dateRangeSelectionOptions.selectedDates);\n\t\t} else {\n\t\t\tsetSelectedDate(undefined);\n\t\t}\n\t\tsetSelectedOption(selected);\n\t}, [selected]);\n\n\tuseEffect(() => {\n\t\tsetShowDropdown(false);\n\t\tsetCalender(false);\n\t}, [closeDropdown]);\n\n\tconst setDropdown = (forceState?: boolean) => {\n\t\tif (forceState !== undefined) {\n\t\t\tsetShowDropdown(forceState);\n\t\t\topenCalender && setCalender(false);\n\t\t} else {\n\t\t\tsetShowDropdown((prevState) => !prevState);\n\t\t}\n\t};\n\n\tconst handleClickOutside = (event: MouseEvent) => {\n\t\tif (\n\t\t\tdropdownRef.current &&\n\t\t\t!dropdownRef.current.contains(event.target as Node)\n\t\t) {\n\t\t\tif (openCalender) {\n\t\t\t\tsetCalender(false);\n\t\t\t}\n\t\t\tsetDropdown(false);\n\t\t}\n\t};\n\n\tuseEffect(() => {\n\t\tif (showDropdown) {\n\t\t\tdocument.addEventListener('mousedown', handleClickOutside);\n\t\t}\n\t\treturn () => {\n\t\t\tdocument.removeEventListener('mousedown', handleClickOutside);\n\t\t};\n\t}, [showDropdown]);\n\n\treturn (\n\t\t<>\n\t\t\t<MainDropdown\n\t\t\t\tdrop={'down'}\n\t\t\t\tshow={showDropdown}\n\t\t\t\tonToggle={setDropdown}\n\t\t\t\tbgColor={backgroundcolor}\n\t\t\t\tid=\"analytic-dropdown\"\n\t\t\t>\n\t\t\t\t<Dropdown.Toggle\n\t\t\t\t\tid=\"dropdown-autoclose-outside\"\n\t\t\t\t\tclassName=\"main--dropdown\"\n\t\t\t\t\tstyle={\n\t\t\t\t\t\tvariant === 'small'\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t\t\t\tgap: 6,\n\t\t\t\t\t\t\t\t\tpadding: '4px 8px',\n\t\t\t\t\t\t\t\t\tbackgroundColor: '#FAFAFA',\n\t\t\t\t\t\t\t\t\tborderRadius: 4,\n\t\t\t\t\t\t\t\t\tborder: `1px solid ${DEFAULT_THEME.colorsV2.stroke.primary}`,\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: styleProps\n\t\t\t\t\t\t\t? styleProps\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<LabelText\n\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\tvariant === 'small' || labelColor\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\tcolor:\n\t\t\t\t\t\t\t\t\t\t\tlabelColor || DEFAULT_THEME.colorsV2.content.secondary,\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{selectedOption?.isCustom\n\t\t\t\t\t\t\t? selectedDate\n\t\t\t\t\t\t\t\t? formatDate(selectedDate[0], showTimePicker) ===\n\t\t\t\t\t\t\t\t formatDate(selectedDate[1], showTimePicker)\n\t\t\t\t\t\t\t\t\t? `${formatDate(selectedDate[0], showTimePicker)}`\n\t\t\t\t\t\t\t\t\t: `${formatDate(\n\t\t\t\t\t\t\t\t\t\t\tselectedDate[0],\n\t\t\t\t\t\t\t\t\t\t\tshowTimePicker,\n\t\t\t\t\t\t\t\t\t )} to ${formatDate(selectedDate[1], showTimePicker)}`\n\t\t\t\t\t\t\t\t: optionPlaceholder?.label\n\t\t\t\t\t\t\t\t? optionPlaceholder?.label\n\t\t\t\t\t\t\t\t: placeholder\n\t\t\t\t\t\t\t: selectedOption\n\t\t\t\t\t\t\t? selectedOption?.label\n\t\t\t\t\t\t\t: placeholder}\n\t\t\t\t\t</LabelText>\n\t\t\t\t</Dropdown.Toggle>\n\t\t\t\t{ReactDOM.createPortal(\n\t\t\t\t\t<Dropdown.Menu\n\t\t\t\t\t\tclassName=\"main--dropdown\"\n\t\t\t\t\t\tstyle={{ padding: 0 }}\n\t\t\t\t\t\tref={dropdownRef}\n\t\t\t\t\t>\n\t\t\t\t\t\t<MainDropdown\n\t\t\t\t\t\t\tdrop={datePickerPlacement ?? 'end'}\n\t\t\t\t\t\t\tid=\"sub--dropdown\"\n\t\t\t\t\t\t\tshow={openCalender}\n\t\t\t\t\t\t\tonToggle={(toggleCalender) => {\n\t\t\t\t\t\t\t\t!toggleCalender && setShowDropdown(false);\n\t\t\t\t\t\t\t\tsetCalender(!openCalender);\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tmaxHeight: maxHeight ? maxHeight : 'auto',\n\t\t\t\t\t\t\t\t\toverflowY: 'scroll',\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{options.map((eachOption, index) => (\n\t\t\t\t\t\t\t\t\t<div key={eachOption?.key}>\n\t\t\t\t\t\t\t\t\t\t{eachOption?.isCustom ? (\n\t\t\t\t\t\t\t\t\t\t\t<Dropdown.Toggle className=\"sub--dropdown\">\n\t\t\t\t\t\t\t\t\t\t\t\t<EachItem\n\t\t\t\t\t\t\t\t\t\t\t\t\tisFirstItem={index === 0}\n\t\t\t\t\t\t\t\t\t\t\t\t\tisLastItem={index === options.length - 1}\n\t\t\t\t\t\t\t\t\t\t\t\t\teachOption={eachOption}\n\t\t\t\t\t\t\t\t\t\t\t\t\tselectedOption={selectedOption}\n\t\t\t\t\t\t\t\t\t\t\t\t\tselectedDate={selectedDate}\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClickingEachItem={(option) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetSelectedOption(option);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetCalender(true);\n\t\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\t\trangeSelection={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\teachOption?.dateRangeSelectionOptions?.selectRange\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: false\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tshowTimePicker={showTimePicker}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t</Dropdown.Toggle>\n\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t<EachItem\n\t\t\t\t\t\t\t\t\t\t\t\tisFirstItem={index === 0}\n\t\t\t\t\t\t\t\t\t\t\t\tisLastItem={index === options.length - 1}\n\t\t\t\t\t\t\t\t\t\t\t\teachOption={eachOption}\n\t\t\t\t\t\t\t\t\t\t\t\tselectedOption={selectedOption}\n\t\t\t\t\t\t\t\t\t\t\t\tselectedDate={selectedDate}\n\t\t\t\t\t\t\t\t\t\t\t\tonClickingEachItem={(option) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetSelectedDate(undefined);\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetSelectedOption(option);\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetOptionPlaceholder(option);\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetDropdown();\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (!option.noOfDays) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonOptionSelected(option);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst endDate = new Date();\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst startDate = new Date();\n\t\t\t\t\t\t\t\t\t\t\t\t\tstartDate.setDate(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tendDate.getDate() - option.noOfDays,\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\tonOptionSelected({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t...option,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tselectedRange: [startDate, endDate],\n\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\tshowTimePicker={showTimePicker}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<Dropdown.Menu\n\t\t\t\t\t\t\t\tclassName=\"sub--dropdown\"\n\t\t\t\t\t\t\t\tpopperConfig={{\n\t\t\t\t\t\t\t\t\tmodifiers: [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tname: 'offset',\n\t\t\t\t\t\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\t\t\t\t\t\toffset: [\n\t\t\t\t\t\t\t\t\t\t\t\t\tcalendarPopperConfig?.offsetSkid || 0,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcalendarPopperConfig?.offsetDistance || 0,\n\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<DatePicker\n\t\t\t\t\t\t\t\t\tselectRange={\n\t\t\t\t\t\t\t\t\t\tselectedOption?.dateRangeSelectionOptions?.selectRange ||\n\t\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tshowTimePicker={showTimePicker}\n\t\t\t\t\t\t\t\t\tmaxDate={selectedOption?.dateRangeSelectionOptions?.maxDate}\n\t\t\t\t\t\t\t\t\tminDate={selectedOption?.dateRangeSelectionOptions?.minDate}\n\t\t\t\t\t\t\t\t\tmaxRangeLimit={\n\t\t\t\t\t\t\t\t\t\tselectedOption?.dateRangeSelectionOptions?.maxRangeLimit\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tselectedDates={selectedDate}\n\t\t\t\t\t\t\t\t\tonSelectRange={(selectedStartDate, selectedEndDate) => {\n\t\t\t\t\t\t\t\t\t\tconst updatedDates = [selectedStartDate, selectedEndDate];\n\n\t\t\t\t\t\t\t\t\t\tif (selectedOption?.dateRangeSelectionOptions) {\n\t\t\t\t\t\t\t\t\t\t\tselectedOption.dateRangeSelectionOptions.selectedDates =\n\t\t\t\t\t\t\t\t\t\t\t\tupdatedDates;\n\t\t\t\t\t\t\t\t\t\t\tonOptionSelected({\n\t\t\t\t\t\t\t\t\t\t\t\t...selectedOption,\n\t\t\t\t\t\t\t\t\t\t\t\tselectedRange: [selectedStartDate, selectedEndDate],\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tsetOptionPlaceholder(selectedOption);\n\t\t\t\t\t\t\t\t\t\tsetCalender(false);\n\t\t\t\t\t\t\t\t\t\tsetSelectedDate(updatedDates);\n\t\t\t\t\t\t\t\t\t\tsetShowDropdown(!showDropdown);\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tonSelectDate={(selectedDate) => {\n\t\t\t\t\t\t\t\t\t\tif (selectedOption?.dateRangeSelectionOptions) {\n\t\t\t\t\t\t\t\t\t\t\tselectedOption.dateRangeSelectionOptions.selectedDates = [\n\t\t\t\t\t\t\t\t\t\t\t\tselectedDate,\n\t\t\t\t\t\t\t\t\t\t\t\tselectedDate,\n\t\t\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t\t\t\tonOptionSelected({\n\t\t\t\t\t\t\t\t\t\t\t\t...selectedOption,\n\t\t\t\t\t\t\t\t\t\t\t\tselectedRange: [selectedDate, selectedDate],\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tsetOptionPlaceholder(selectedOption);\n\t\t\t\t\t\t\t\t\t\tsetCalender(false);\n\t\t\t\t\t\t\t\t\t\tsetSelectedDate([selectedDate, selectedDate]);\n\t\t\t\t\t\t\t\t\t\tsetShowDropdown(!showDropdown);\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</Dropdown.Menu>\n\t\t\t\t\t\t</MainDropdown>\n\t\t\t\t\t</Dropdown.Menu>,\n\t\t\t\t\tdocument.body,\n\t\t\t\t)}\n\t\t\t</MainDropdown>\n\t\t</>\n\t);\n};\n\nexport const EachItem: React.FC<{\n\teachOption: DropdownOptions;\n\tselectedOption: DropdownOptions | undefined;\n\tselectedDate: Date[] | undefined;\n\tonClickingEachItem: (optionSelected: DropdownOptions) => void;\n\trangeSelection?: boolean;\n\tisLastItem?: boolean;\n\tisFirstItem?: boolean;\n\tshowTimePicker?: boolean;\n}> = ({\n\teachOption,\n\tselectedOption,\n\tselectedDate,\n\tonClickingEachItem,\n\trangeSelection,\n\tisLastItem,\n\tisFirstItem,\n\tshowTimePicker,\n}) => {\n\treturn (\n\t\t<ItemMenuContainer\n\t\t\tisFirstItem={isFirstItem}\n\t\t\tisLastItem={isLastItem}\n\t\t\tkey={eachOption.key}\n\t\t\tonClick={() => onClickingEachItem(eachOption)}\n\t\t\tisSelected={\n\t\t\t\teachOption.isCustom\n\t\t\t\t\t? eachOption.key == selectedOption?.key && !!selectedDate\n\t\t\t\t\t: eachOption.key == selectedOption?.key\n\t\t\t}\n\t\t>\n\t\t\t<BodySecondary\n\t\t\t\tcolor={\n\t\t\t\t\teachOption.key == selectedOption?.key\n\t\t\t\t\t\t? BASE_COLORS.positive[900]\n\t\t\t\t\t\t: BASE_COLORS.grayscale[900]\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{eachOption.label}\n\t\t\t</BodySecondary>\n\t\t\t{eachOption.subLabel ? (\n\t\t\t\t<BodyCaption style={{ color: BASE_COLORS.grayscale[700] }}>\n\t\t\t\t\t{eachOption.subLabel}\n\t\t\t\t</BodyCaption>\n\t\t\t) : (\n\t\t\t\t<></>\n\t\t\t)}\n\t\t\t{selectedDate &&\n\t\t\t\tselectedOption?.isCustom &&\n\t\t\t\teachOption.key == selectedOption?.key && (\n\t\t\t\t\t<BodyCaption\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\twhiteSpace: 'normal',\n\t\t\t\t\t\t\twordBreak: 'break-word',\n\t\t\t\t\t\t\ttextAlign: 'left',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{rangeSelection\n\t\t\t\t\t\t\t? `${formatDate(selectedDate[0], showTimePicker)} to ${formatDate(\n\t\t\t\t\t\t\t\t\tselectedDate[1],\n\t\t\t\t\t\t\t\t\tshowTimePicker,\n\t\t\t\t\t\t\t )}`\n\t\t\t\t\t\t\t: `${formatDate(selectedDate[0], showTimePicker)}`}\n\t\t\t\t\t</BodyCaption>\n\t\t\t\t)}\n\t\t</ItemMenuContainer>\n\t);\n};\n\nexport const formatDate = (dateVal: Date, includeTime?: boolean) => {\n\tconst dateString = dateVal.toLocaleString('default', {\n\t\tday: 'numeric',\n\t\tmonth: 'short',\n\t\tyear: 'numeric',\n\t});\n\n\tif (includeTime) {\n\t\tconst timeString = dateVal.toLocaleString('default', {\n\t\t\thour: 'numeric',\n\t\t\tminute: '2-digit',\n\t\t\thour12: true,\n\t\t});\n\t\treturn `${dateString} (${timeString})`;\n\t}\n\n\treturn dateString;\n};\n"],"names":["AnalyticsDropdown","options","placeholder","selected","onOptionSelected","resetDropdown","maxHeight","backgroundcolor","calendarPopperConfig","variant","datePickerPlacement","closeDropdown","labelColor","styleProps","showTimePicker","openCalender","setCalender","useState","selectedOption","setSelectedOption","selectedDate","setSelectedDate","showDropdown","setShowDropdown","optionPlaceholder","setOptionPlaceholder","dropdownRef","useRef","LabelText","Caption","BodySecondary","useEffect","setDropdown","forceState","prevState","handleClickOutside","event","jsx","Fragment","jsxs","MainDropdown","Dropdown","DEFAULT_THEME","formatDate","ReactDOM","toggleCalender","eachOption","index","EachItem","option","endDate","startDate","DatePicker","selectedStartDate","selectedEndDate","updatedDates","onClickingEachItem","rangeSelection","isLastItem","isFirstItem","ItemMenuContainer","BASE_COLORS","BodyCaption","dateVal","includeTime","dateString","timeString"],"mappings":";;;;;;;;AAmDO,MAAMA,KAA0D,CAAC;AAAA,EACvE,SAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,UAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,WAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,sBAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,qBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,gBAAAC,IAAiB;AAClB,MAAM;AACL,QAAM,CAACC,GAAcC,CAAW,IAAIC,EAAS,EAAK,GAC5C,CAACC,GAAgBC,CAAiB,IAAIF,EAASd,CAAQ,GACvD,CAACiB,GAAcC,CAAe,IAAIJ,EAAA,GAClC,CAACK,GAAcC,CAAe,IAAIN,EAAS,EAAK,GAChD,CAACO,GAAmBC,CAAoB,IAAIR,EAASd,CAAQ,GAC7DuB,IAAcC,EAA8B,IAAI,GAChDC,IAAYnB,MAAY,UAAUoB,IAAUC;AAElD,EAAAC,EAAU,MAAM;AACf,IAAA1B,KAAiBc,EAAkB,MAAS;AAAA,EAC7C,GAAG,CAACd,CAAa,CAAC,GAElB0B,EAAU,MAAM;AACf,IAC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AAMC,IAAaF,EAAQ,eAAe,WAAW;AAAA,IACpD,KAAK;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,EAAA,CACN;AAED,MAAIC,GAAa;AAChB,UAAME,IAAaH,EAAQ,eAAe,WAAW;AAAA,MACpD,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,QAAQ;AAAA,IAAA,CACR;AACD,WAAO,GAAGE,CAAU,KAAKC,CAAU;AAAA,EACpC;AAEA,SAAOD;AACR;"}
|
|
@@ -1,107 +1,103 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { useTemplateModalContext as
|
|
4
|
-
import { isRichAndCarouselCards as
|
|
5
|
-
import { VariableEditorHelper as
|
|
6
|
-
import { HEADER_TYPES as
|
|
7
|
-
import { ChatBtn as
|
|
8
|
-
import { RCSButtons as
|
|
9
|
-
import { RCSMediaCard as
|
|
10
|
-
import {
|
|
11
|
-
const
|
|
1
|
+
import { jsx as e, jsxs as h, Fragment as d } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as T } from "react";
|
|
3
|
+
import { useTemplateModalContext as V } from "../../template-context-mapper/context/templateModalContext.js";
|
|
4
|
+
import { isRichAndCarouselCards as E } from "../helpers/templateMiscHelper.js";
|
|
5
|
+
import { VariableEditorHelper as z } from "../helpers/VariableEditorHelper.js";
|
|
6
|
+
import { HEADER_TYPES as i } from "../models/TemplateMeta.js";
|
|
7
|
+
import { ChatBtn as U } from "../WhatsApp/ChatBtn.js";
|
|
8
|
+
import { RCSButtons as j } from "./RCSButtons.js";
|
|
9
|
+
import { RCSMediaCard as S, PdfMediaCard as G } from "./RCSMediaCard.js";
|
|
10
|
+
import { HeaderTextContainer as k, RCSPreviewContainer as F, TitleTextContainer as W, RcsHtmlContainer as X, RCSChatBtnContainer as Y } from "./RCSPreview.styled.js";
|
|
11
|
+
const u = new z(), ie = (w) => {
|
|
12
12
|
const {
|
|
13
|
-
bodyText:
|
|
13
|
+
bodyText: y,
|
|
14
14
|
titleText: m,
|
|
15
15
|
headerMediaType: t,
|
|
16
|
-
headerText:
|
|
17
|
-
headerAssetLink:
|
|
16
|
+
headerText: N,
|
|
17
|
+
headerAssetLink: l,
|
|
18
18
|
headerAssetName: p,
|
|
19
19
|
imagePreviewStyles: g,
|
|
20
|
-
size:
|
|
21
|
-
bodyVariableList:
|
|
22
|
-
headerVariableList:
|
|
23
|
-
buttons:
|
|
20
|
+
size: f,
|
|
21
|
+
bodyVariableList: R,
|
|
22
|
+
headerVariableList: b,
|
|
23
|
+
buttons: n,
|
|
24
24
|
carouselCardIndex: r,
|
|
25
|
-
isWhatsappCarousel:
|
|
26
|
-
isPreview:
|
|
27
|
-
titleVariableList:
|
|
25
|
+
isWhatsappCarousel: A,
|
|
26
|
+
isPreview: I,
|
|
27
|
+
titleVariableList: L,
|
|
28
28
|
templateConfiguration: o
|
|
29
|
-
} =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
), O =
|
|
29
|
+
} = w, P = u.format(
|
|
30
|
+
y?.replace(/</g, "<").replace(/>/g, ">"),
|
|
31
|
+
R
|
|
32
|
+
), B = u.format(
|
|
33
|
+
N?.replace(/</g, "<").replace(/>/g, ">"),
|
|
34
|
+
b
|
|
35
|
+
), O = u.format(
|
|
36
36
|
m?.replace(/</g, "<").replace(/>/g, ">"),
|
|
37
|
-
|
|
37
|
+
L
|
|
38
38
|
), {
|
|
39
|
-
selectedCarouselIndex:
|
|
39
|
+
selectedCarouselIndex: s,
|
|
40
40
|
isProductCarouselType: x,
|
|
41
|
-
errorIndexes:
|
|
42
|
-
isCarouselHovered:
|
|
43
|
-
} =
|
|
41
|
+
errorIndexes: _,
|
|
42
|
+
isCarouselHovered: D
|
|
43
|
+
} = V(), M = T(() => E(
|
|
44
44
|
o?.templateType
|
|
45
|
-
), [o?.templateType]),
|
|
45
|
+
), [o?.templateType]), a = T(() => o?.orientation == "HORIZONTAL", [o]), H = T(() => !a && !!o?.isMediaAfterBody, [a, o]), v = t === i.TEXT ? /* @__PURE__ */ e(k, { dangerouslySetInnerHTML: { __html: B } }) : t !== i.NONE && l && t !== i.DOCUMENT ? /* @__PURE__ */ e(
|
|
46
|
+
S,
|
|
47
|
+
{
|
|
48
|
+
headerAssetLink: l,
|
|
49
|
+
headerAssetName: p,
|
|
50
|
+
mediaType: t,
|
|
51
|
+
imagePreviewStyles: t === i.IMAGE ? g : {}
|
|
52
|
+
}
|
|
53
|
+
) : null;
|
|
46
54
|
return /* @__PURE__ */ h(
|
|
47
|
-
|
|
55
|
+
F,
|
|
48
56
|
{
|
|
49
57
|
isCarouselCard: r != null && r > -1,
|
|
50
|
-
showBorder: r != null && r ===
|
|
51
|
-
hasError:
|
|
52
|
-
isWhatsappCarousel:
|
|
53
|
-
isPreview:
|
|
54
|
-
showDashedBorder: x &&
|
|
55
|
-
needBorder:
|
|
56
|
-
isHorizontalOrientation:
|
|
58
|
+
showBorder: r != null && r === s || x && r != null && r > -1 && s != null && s > -1,
|
|
59
|
+
hasError: _?.includes(r ?? -2),
|
|
60
|
+
isWhatsappCarousel: A,
|
|
61
|
+
isPreview: I,
|
|
62
|
+
showDashedBorder: x && D && (s ?? -1) < 0 && (r ?? -1) > -1,
|
|
63
|
+
needBorder: M,
|
|
64
|
+
isHorizontalOrientation: a,
|
|
57
65
|
children: [
|
|
58
|
-
!
|
|
59
|
-
|
|
60
|
-
{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
) : t !== a.NONE && i && t !== a.DOCUMENT ? /* @__PURE__ */ e(
|
|
64
|
-
E,
|
|
65
|
-
{
|
|
66
|
-
headerAssetLink: i,
|
|
67
|
-
headerAssetName: p,
|
|
68
|
-
mediaType: t,
|
|
69
|
-
imagePreviewStyles: t === a.IMAGE ? g : {}
|
|
70
|
-
}
|
|
71
|
-
) : null }),
|
|
72
|
-
/* @__PURE__ */ h("div", { style: { width: l ? "50%" : "" }, children: [
|
|
73
|
-
/* @__PURE__ */ h("div", { className: f ? "" : "text--template", children: [
|
|
74
|
-
!!m && /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(
|
|
75
|
-
k,
|
|
66
|
+
!a && !H && v,
|
|
67
|
+
/* @__PURE__ */ h("div", { style: { width: a ? "50%" : "" }, children: [
|
|
68
|
+
/* @__PURE__ */ h("div", { className: M ? "" : "text--template", children: [
|
|
69
|
+
!!m && /* @__PURE__ */ e(d, { children: /* @__PURE__ */ e(
|
|
70
|
+
W,
|
|
76
71
|
{
|
|
77
72
|
dangerouslySetInnerHTML: {
|
|
78
73
|
__html: O
|
|
79
74
|
}
|
|
80
75
|
}
|
|
81
76
|
) }),
|
|
82
|
-
!!
|
|
83
|
-
|
|
77
|
+
!!y && /* @__PURE__ */ e(d, { children: /* @__PURE__ */ e(
|
|
78
|
+
X,
|
|
84
79
|
{
|
|
85
80
|
dangerouslySetInnerHTML: {
|
|
86
|
-
__html:
|
|
81
|
+
__html: P
|
|
87
82
|
},
|
|
88
83
|
style: { paddingTop: m ? 0 : 12 }
|
|
89
84
|
}
|
|
90
85
|
) }),
|
|
91
|
-
t ===
|
|
86
|
+
t === i.DOCUMENT ? /* @__PURE__ */ e(G, { headerAssetLink: l, headerAssetName: p }) : /* @__PURE__ */ e(d, {})
|
|
92
87
|
] }),
|
|
93
|
-
|
|
88
|
+
!a && H && v,
|
|
89
|
+
n && n.length > 0 ? E(
|
|
94
90
|
o?.templateType
|
|
95
|
-
) ? /* @__PURE__ */ e(
|
|
91
|
+
) ? /* @__PURE__ */ e(d, { children: n.map((c, C) => /* @__PURE__ */ e(U, { text: c.text, size: f }, C)) }) : /* @__PURE__ */ e(Y, { children: n.map((c, C) => /* @__PURE__ */ e(j, { text: c.text, size: f }, C)) }) : null
|
|
96
92
|
] }),
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
a && t !== i.NONE && l && t !== i.DOCUMENT && /* @__PURE__ */ e(
|
|
94
|
+
S,
|
|
99
95
|
{
|
|
100
|
-
headerAssetLink:
|
|
96
|
+
headerAssetLink: l,
|
|
101
97
|
headerAssetName: p,
|
|
102
98
|
mediaType: t,
|
|
103
|
-
imagePreviewStyles: t ===
|
|
104
|
-
isHorizontal:
|
|
99
|
+
imagePreviewStyles: t === i.IMAGE ? g : {},
|
|
100
|
+
isHorizontal: a
|
|
105
101
|
}
|
|
106
102
|
)
|
|
107
103
|
]
|
|
@@ -109,6 +105,6 @@ const T = new D(), re = (M) => {
|
|
|
109
105
|
);
|
|
110
106
|
};
|
|
111
107
|
export {
|
|
112
|
-
|
|
108
|
+
ie as RCSChatPreview
|
|
113
109
|
};
|
|
114
110
|
//# sourceMappingURL=RCSChatPreview.js.map
|