@bikdotai/bik-component-library 0.0.838-beta.6 → 0.0.839-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/components/BikGiftedChat/GiftedChat/GiftedChat.js +1 -1
- package/dist/cjs/components/BikGiftedChat/GiftedChat/GiftedChat.js.map +1 -1
- package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditor.js +23 -23
- package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditor.js.map +1 -1
- package/dist/cjs/components/accordion/Accordion.js +1 -1
- package/dist/cjs/components/accordion/Accordion.js.map +1 -1
- package/dist/cjs/components/add-variableV2/AddVariableV2.js +1 -1
- package/dist/cjs/components/add-variableV2/AddVariableV2.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/AiTextArea.js +1 -1
- package/dist/cjs/components/agent-builder/components/AiTextArea.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js +2 -2
- package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js.map +1 -1
- package/dist/cjs/components/alerts/Alert.js +1 -1
- package/dist/cjs/components/alerts/Alert.js.map +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsTrend.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsTrend.js.map +1 -1
- package/dist/cjs/components/avatar/Avatar.js +1 -1
- package/dist/cjs/components/avatar/Avatar.js.map +1 -1
- package/dist/cjs/components/bik-chatbot/components/ChatWindow.js +20 -20
- package/dist/cjs/components/bik-chatbot/components/ChatWindow.js.map +1 -1
- package/dist/cjs/components/input/ChipInput.js +1 -1
- package/dist/cjs/components/input/ChipInput.js.map +1 -1
- package/dist/cjs/components/input/Input-helper.js +1 -1
- package/dist/cjs/components/input/Input-helper.js.map +1 -1
- package/dist/cjs/components/input/Input.js +1 -1
- package/dist/cjs/components/input/Input.js.map +1 -1
- package/dist/cjs/components/plans/SubscriptionPlanSelector.js +5 -5
- package/dist/cjs/components/plans/SubscriptionPlanSelector.js.map +1 -1
- package/dist/cjs/editor/BikEditor.js +1 -1
- package/dist/cjs/editor/BikEditor.js.map +1 -1
- package/dist/cjs/editor/BikEditor.utils.js +3 -3
- package/dist/cjs/editor/BikEditor.utils.js.map +1 -1
- package/dist/cjs/editor/extensions/buildExtensions.js +2 -2
- package/dist/cjs/editor/extensions/buildExtensions.js.map +1 -1
- package/dist/cjs/icons/Informational/General/HourglassFilled.js +2 -0
- package/dist/cjs/icons/Informational/General/HourglassFilled.js.map +1 -0
- package/dist/cjs/icons/index.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/BikGiftedChat/GiftedChat/GiftedChat.js +66 -61
- package/dist/esm/components/BikGiftedChat/GiftedChat/GiftedChat.js.map +1 -1
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditor.js +143 -144
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditor.js.map +1 -1
- package/dist/esm/components/accordion/Accordion.js +5 -4
- package/dist/esm/components/accordion/Accordion.js.map +1 -1
- package/dist/esm/components/add-variableV2/AddVariableV2.js +41 -39
- package/dist/esm/components/add-variableV2/AddVariableV2.js.map +1 -1
- package/dist/esm/components/agent-builder/components/AiTextArea.js +23 -24
- package/dist/esm/components/agent-builder/components/AiTextArea.js.map +1 -1
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.js +30 -31
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.js.map +1 -1
- package/dist/esm/components/alerts/Alert.js +1 -0
- package/dist/esm/components/alerts/Alert.js.map +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.js +51 -43
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.js.map +1 -1
- package/dist/esm/components/avatar/Avatar.js +19 -17
- package/dist/esm/components/avatar/Avatar.js.map +1 -1
- package/dist/esm/components/bik-chatbot/components/ChatWindow.js +53 -54
- package/dist/esm/components/bik-chatbot/components/ChatWindow.js.map +1 -1
- package/dist/esm/components/input/ChipInput.js +40 -41
- package/dist/esm/components/input/ChipInput.js.map +1 -1
- package/dist/esm/components/input/Input-helper.d.ts +0 -7
- package/dist/esm/components/input/Input-helper.js +25 -16
- package/dist/esm/components/input/Input-helper.js.map +1 -1
- package/dist/esm/components/input/Input.js +58 -60
- package/dist/esm/components/input/Input.js.map +1 -1
- package/dist/esm/components/input/Input.model.d.ts +0 -1
- package/dist/esm/components/plans/SubscriptionPlanSelector.js +40 -42
- package/dist/esm/components/plans/SubscriptionPlanSelector.js.map +1 -1
- package/dist/esm/editor/BikEditor.js +118 -122
- package/dist/esm/editor/BikEditor.js.map +1 -1
- package/dist/esm/editor/BikEditor.utils.d.ts +1 -1
- package/dist/esm/editor/BikEditor.utils.js +140 -141
- package/dist/esm/editor/BikEditor.utils.js.map +1 -1
- package/dist/esm/editor/extensions/buildExtensions.js +39 -49
- package/dist/esm/editor/extensions/buildExtensions.js.map +1 -1
- package/dist/esm/helpers/index.d.ts +0 -1
- package/dist/esm/icons/Informational/General/HourglassFilled.d.ts +7 -0
- package/dist/esm/icons/Informational/General/HourglassFilled.js +33 -0
- package/dist/esm/icons/Informational/General/HourglassFilled.js.map +1 -0
- package/dist/esm/icons/Informational/General/index.d.ts +1 -0
- package/dist/esm/icons/Media/Visual/index.d.ts +0 -2
- package/dist/esm/icons/index.d.ts +25 -25
- package/dist/esm/icons/index.js +416 -418
- package/dist/esm/icons/index.js.map +1 -1
- package/dist/esm/index.js +114 -124
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -2
- package/dist/cjs/editor/extensions/htmlTagStrip/HtmlTagStripExtension.js +0 -2
- package/dist/cjs/editor/extensions/htmlTagStrip/HtmlTagStripExtension.js.map +0 -1
- package/dist/cjs/helpers/sanitize.js +0 -2
- package/dist/cjs/helpers/sanitize.js.map +0 -1
- package/dist/cjs/icons/Media/Visual/FormkitNeutral.js +0 -2
- package/dist/cjs/icons/Media/Visual/FormkitNeutral.js.map +0 -1
- package/dist/cjs/icons/Media/Visual/FormkitSad.js +0 -2
- package/dist/cjs/icons/Media/Visual/FormkitSad.js.map +0 -1
- package/dist/esm/editor/extensions/htmlTagStrip/HtmlTagStripExtension.d.ts +0 -13
- package/dist/esm/editor/extensions/htmlTagStrip/HtmlTagStripExtension.js +0 -64
- package/dist/esm/editor/extensions/htmlTagStrip/HtmlTagStripExtension.js.map +0 -1
- package/dist/esm/helpers/sanitize.d.ts +0 -32
- package/dist/esm/helpers/sanitize.js +0 -204
- package/dist/esm/helpers/sanitize.js.map +0 -1
- package/dist/esm/icons/Media/Visual/FormkitNeutral.js +0 -58
- package/dist/esm/icons/Media/Visual/FormkitNeutral.js.map +0 -1
- package/dist/esm/icons/Media/Visual/FormkitSad.js +0 -61
- package/dist/esm/icons/Media/Visual/FormkitSad.js.map +0 -1
|
@@ -1,54 +1,53 @@
|
|
|
1
|
-
import { jsxs as a, jsx as
|
|
2
|
-
import { stripHtmlTags as x } from "../../../helpers/sanitize.js";
|
|
1
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
3
2
|
import { useState as m } from "react";
|
|
4
|
-
import
|
|
5
|
-
import { TitleSmall as
|
|
3
|
+
import x from "styled-components";
|
|
4
|
+
import { TitleSmall as y } from "../../TypographyStyle.js";
|
|
6
5
|
import { COLORS as I } from "../../../constants/Theme.js";
|
|
7
|
-
import { FieldBlock as S, AiTextAreaShell as
|
|
8
|
-
import { Button as
|
|
9
|
-
import
|
|
10
|
-
const
|
|
6
|
+
import { FieldBlock as S, AiTextAreaShell as T, AiTextAreaInput as A } from "../AgentBuilder.styled.js";
|
|
7
|
+
import { Button as v } from "../../button/Button.js";
|
|
8
|
+
import F from "../../../icons/BIK AI specific/WandSparkles.js";
|
|
9
|
+
const z = ({
|
|
11
10
|
label: d,
|
|
12
11
|
value: t,
|
|
13
12
|
onChange: i,
|
|
14
|
-
maxLength:
|
|
15
|
-
placeholder:
|
|
13
|
+
maxLength: c,
|
|
14
|
+
placeholder: p,
|
|
16
15
|
minHeight: f = "120px",
|
|
17
|
-
onImprove:
|
|
18
|
-
...
|
|
16
|
+
onImprove: o,
|
|
17
|
+
...n
|
|
19
18
|
}) => {
|
|
20
|
-
const [u, l] = m(!1), [r,
|
|
21
|
-
if (!(!
|
|
22
|
-
|
|
19
|
+
const [u, l] = m(!1), [r, s] = m(!1), g = async () => {
|
|
20
|
+
if (!(!o || r || t.trim().length === 0)) {
|
|
21
|
+
s(!0);
|
|
23
22
|
try {
|
|
24
|
-
i(await
|
|
23
|
+
i(await o(t));
|
|
25
24
|
} finally {
|
|
26
|
-
|
|
25
|
+
s(!1);
|
|
27
26
|
}
|
|
28
27
|
}
|
|
29
28
|
};
|
|
30
29
|
return /* @__PURE__ */ a(S, { children: [
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */ a(
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
|
|
30
|
+
/* @__PURE__ */ e(y, { color: I.content.primary, children: d }),
|
|
31
|
+
/* @__PURE__ */ a(T, { focused: u, minHeight: f, children: [
|
|
32
|
+
/* @__PURE__ */ e(
|
|
33
|
+
A,
|
|
35
34
|
{
|
|
36
|
-
"data-test":
|
|
35
|
+
"data-test": n["data-test"],
|
|
37
36
|
value: t,
|
|
38
|
-
placeholder:
|
|
39
|
-
maxLength:
|
|
37
|
+
placeholder: p,
|
|
38
|
+
maxLength: c,
|
|
40
39
|
onFocus: () => l(!0),
|
|
41
40
|
onBlur: () => l(!1),
|
|
42
|
-
onChange: (h) => i(
|
|
41
|
+
onChange: (h) => i(h.target.value)
|
|
43
42
|
}
|
|
44
43
|
),
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
o && /* @__PURE__ */ e(b, { children: /* @__PURE__ */ e(
|
|
45
|
+
v,
|
|
47
46
|
{
|
|
48
|
-
"data-test": `${
|
|
47
|
+
"data-test": `${n["data-test"] ?? "tool"}-improve`,
|
|
49
48
|
buttonType: "ai",
|
|
50
49
|
size: "small",
|
|
51
|
-
LeadingIcon:
|
|
50
|
+
LeadingIcon: F,
|
|
52
51
|
buttonText: "Improve with AI",
|
|
53
52
|
isLoading: r,
|
|
54
53
|
disabled: r || t.trim().length === 0,
|
|
@@ -57,11 +56,11 @@ const W = ({
|
|
|
57
56
|
) })
|
|
58
57
|
] })
|
|
59
58
|
] });
|
|
60
|
-
},
|
|
59
|
+
}, b = x.div`
|
|
61
60
|
display: flex;
|
|
62
61
|
align-items: center;
|
|
63
62
|
`;
|
|
64
63
|
export {
|
|
65
|
-
|
|
64
|
+
z as ToolInstructionsField
|
|
66
65
|
};
|
|
67
66
|
//# sourceMappingURL=ToolInstructionsField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolInstructionsField.js","sources":["../../../../../src/components/agent-builder/components/ToolInstructionsField.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"ToolInstructionsField.js","sources":["../../../../../src/components/agent-builder/components/ToolInstructionsField.tsx"],"sourcesContent":["import { WandSparkles } from '@src/icons';\nimport React, { useState } from 'react';\nimport styled from 'styled-components';\nimport { Button } from '@src/components/button';\nimport { TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tAiTextAreaInput,\n\tAiTextAreaShell,\n\tFieldBlock,\n} from '../AgentBuilder.styled';\n\ninterface ToolInstructionsFieldProps {\n\tlabel: string;\n\tvalue: string;\n\tonChange: (value: string) => void;\n\tmaxLength: number;\n\tplaceholder?: string;\n\tminHeight?: string;\n\t/** \"Improve with AI\" — resolves with rewritten text. Omit to hide the button. */\n\tonImprove?: (text: string) => Promise<string>;\n\t'data-test'?: string;\n}\n\n/**\n * A labelled multiline field with an inline \"Improve with AI\" action pinned to\n * the bottom-left of the box (Figma: Rest API / Handover-to-email drawers). The\n * button is hidden when `onImprove` is omitted.\n */\nexport const ToolInstructionsField: React.FC<ToolInstructionsFieldProps> = ({\n\tlabel,\n\tvalue,\n\tonChange,\n\tmaxLength,\n\tplaceholder,\n\tminHeight = '120px',\n\tonImprove,\n\t...rest\n}) => {\n\tconst [focused, setFocused] = useState(false);\n\tconst [improving, setImproving] = useState(false);\n\n\tconst handleImprove = async () => {\n\t\tif (!onImprove || improving || value.trim().length === 0) {\n\t\t\treturn;\n\t\t}\n\t\tsetImproving(true);\n\t\ttry {\n\t\t\tonChange(await onImprove(value));\n\t\t} finally {\n\t\t\tsetImproving(false);\n\t\t}\n\t};\n\n\treturn (\n\t\t<FieldBlock>\n\t\t\t<TitleSmall color={COLORS.content.primary}>{label}</TitleSmall>\n\t\t\t<AiTextAreaShell focused={focused} minHeight={minHeight}>\n\t\t\t\t<AiTextAreaInput\n\t\t\t\t\tdata-test={rest['data-test']}\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\tmaxLength={maxLength}\n\t\t\t\t\tonFocus={() => setFocused(true)}\n\t\t\t\t\tonBlur={() => setFocused(false)}\n\t\t\t\t\tonChange={(e) => onChange(e.target.value)}\n\t\t\t\t/>\n\t\t\t\t{onImprove && (\n\t\t\t\t\t<ImproveRow>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tdata-test={`${rest['data-test'] ?? 'tool'}-improve`}\n\t\t\t\t\t\t\tbuttonType=\"ai\"\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\tLeadingIcon={WandSparkles}\n\t\t\t\t\t\t\tbuttonText=\"Improve with AI\"\n\t\t\t\t\t\t\tisLoading={improving}\n\t\t\t\t\t\t\tdisabled={improving || value.trim().length === 0}\n\t\t\t\t\t\t\tonClick={handleImprove}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ImproveRow>\n\t\t\t\t)}\n\t\t\t</AiTextAreaShell>\n\t\t</FieldBlock>\n\t);\n};\n\nconst ImproveRow = styled.div`\n\tdisplay: flex;\n\talign-items: center;\n`;\n"],"names":["ToolInstructionsField","label","value","onChange","maxLength","placeholder","minHeight","onImprove","rest","focused","setFocused","useState","improving","setImproving","handleImprove","FieldBlock","jsx","TitleSmall","COLORS","jsxs","AiTextAreaShell","AiTextAreaInput","e","ImproveRow","Button","WandSparkles","styled"],"mappings":";;;;;;;;AA6BO,MAAMA,IAA8D,CAAC;AAAA,EAC3E,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,WAAAC;AAAA,EACA,GAAGC;AACJ,MAAM;AACL,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAS,EAAK,GACtC,CAACC,GAAWC,CAAY,IAAIF,EAAS,EAAK,GAE1CG,IAAgB,YAAY;AACjC,QAAI,GAACP,KAAaK,KAAaV,EAAM,KAAA,EAAO,WAAW,IAGvD;AAAA,MAAAW,EAAa,EAAI;AACjB,UAAI;AACH,QAAAV,EAAS,MAAMI,EAAUL,CAAK,CAAC;AAAA,MAChC,UAAA;AACC,QAAAW,EAAa,EAAK;AAAA,MACnB;AAAA;AAAA,EACD;AAEA,2BACEE,GAAA,EACA,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAA,EAAW,OAAOC,EAAO,QAAQ,SAAU,UAAAjB,GAAM;AAAA,IAClD,gBAAAkB,EAACC,GAAA,EAAgB,SAAAX,GAAkB,WAAAH,GAClC,UAAA;AAAA,MAAA,gBAAAU;AAAA,QAACK;AAAA,QAAA;AAAA,UACA,aAAWb,EAAK,WAAW;AAAA,UAC3B,OAAAN;AAAA,UACA,aAAAG;AAAA,UACA,WAAAD;AAAA,UACA,SAAS,MAAMM,EAAW,EAAI;AAAA,UAC9B,QAAQ,MAAMA,EAAW,EAAK;AAAA,UAC9B,UAAU,CAACY,MAAMnB,EAASmB,EAAE,OAAO,KAAK;AAAA,QAAA;AAAA,MAAA;AAAA,MAExCf,uBACCgB,GAAA,EACA,UAAA,gBAAAP;AAAA,QAACQ;AAAA,QAAA;AAAA,UACA,aAAW,GAAGhB,EAAK,WAAW,KAAK,MAAM;AAAA,UACzC,YAAW;AAAA,UACX,MAAK;AAAA,UACL,aAAaiB;AAAAA,UACb,YAAW;AAAA,UACX,WAAWb;AAAA,UACX,UAAUA,KAAaV,EAAM,KAAA,EAAO,WAAW;AAAA,UAC/C,SAASY;AAAA,QAAA;AAAA,MAAA,EACV,CACD;AAAA,IAAA,EAAA,CAEF;AAAA,EAAA,GACD;AAEF,GAEMS,IAAaG,EAAO;AAAA;AAAA;AAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","sources":["../../../../src/components/alerts/Alert.tsx"],"sourcesContent":["import CloseIcon from '@src/assets/icons/cross.svg';\nimport React from 'react';\nimport {\n\tAlertContentWrapper,\n\tAlertStyle,\n\tCloseIconWrapper,\n} from '@src/components/alerts/Alert.styled';\nimport {\n\tALERT_TYPES,\n\tCOLOR_CONFIG_MAP,\n\tCONTENT_POSITION,\n} from '@src/components/alerts/AlertHelper';\nimport { BodyCaption } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\n\nexport type AlertProps = {\n\ttype: ALERT_TYPES;\n\ttext: string | React.ReactNode;\n\ticon?: React.FC<{ width: number; height: number; color: string }>;\n\ttextColor?: string;\n\tcontentPosition?: CONTENT_POSITION;\n\tcontainerStyle?: React.CSSProperties;\n\tredirectTo?: string;\n\tredirectToText?: string;\n\ticonStyle?: React.CSSProperties;\n\thandleRedirectButtonClick?: () => void;\n\tshowCrossButton?: boolean;\n\thandleCrossIconClick?: () => void;\n};\n\nexport const Alert: React.FC<AlertProps> = (props) => {\n\tconst handleRedirection = () => {\n\t\tif (props.redirectTo) {\n\t\t\twindow.open(props.redirectTo, '_blank');\n\t\t}\n\t};\n\n\treturn (\n\t\t<AlertStyle\n\t\t\ttype={props.type}\n\t\t\tcontentPosition={props.contentPosition}\n\t\t\tstyle={props.containerStyle}\n\t\t>\n\t\t\t<AlertContentWrapper contentPosition={props.contentPosition}>\n\t\t\t\t{props.icon && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t...props?.iconStyle,\n\t\t\t\t\t\t\tdisplay: props?.iconStyle?.display || 'flex',\n\t\t\t\t\t\t\talignSelf: props?.iconStyle?.alignSelf || 'flex-start',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<props.icon\n\t\t\t\t\t\t\tcolor={COLOR_CONFIG_MAP[props.type].textColor}\n\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t<BodyCaption\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tcolor: props.textColor || COLOR_CONFIG_MAP[props.type].textColor,\n\t\t\t\t\t\tmarginLeft: 8,\n\t\t\t\t\t\tmarginRight: 4,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{props.text}\n\t\t\t\t</BodyCaption>\n\t\t\t\t{props.redirectToText && props.redirectTo && (\n\t\t\t\t\t<BodyCaption\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tcolor: COLORS.text.brand,\n\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\ttextDecoration: 'underline',\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tprops.redirectTo === 'INTERNAL' &&\n\t\t\t\t\t\t\t\tprops.handleRedirectButtonClick\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tprops.handleRedirectButtonClick();\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\thandleRedirection();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{props.redirectToText}\n\t\t\t\t\t</BodyCaption>\n\t\t\t\t)}\n\t\t\t</AlertContentWrapper>\n\t\t\t{props.showCrossButton && (\n\t\t\t\t<CloseIconWrapper>\n\t\t\t\t\t<CloseIcon\n\t\t\t\t\t\twidth={20}\n\t\t\t\t\t\theight={20}\n\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tif (props?.handleCrossIconClick) {\n\t\t\t\t\t\t\t\tprops.handleCrossIconClick();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t</CloseIconWrapper>\n\t\t\t)}\n\t\t</AlertStyle>\n\t);\n};\n"],"names":["Alert","props","handleRedirection","jsxs","AlertStyle","AlertContentWrapper","jsx","COLOR_CONFIG_MAP","BodyCaption","COLORS","CloseIconWrapper","CloseIcon"],"mappings":";;;;;;AA8BO,MAAMA,IAA8B,CAACC,MAAU;AACrD,QAAMC,IAAoB,MAAM;AAC/B,IAAID,EAAM,cACT,OAAO,KAAKA,EAAM,YAAY,QAAQ;AAAA,EAExC;AAEA,SACC,gBAAAE;AAAA,IAACC;AAAA,IAAA;AAAA,MACA,MAAMH,EAAM;AAAA,MACZ,iBAAiBA,EAAM;AAAA,MACvB,OAAOA,EAAM;AAAA,MAEb,UAAA;AAAA,QAAA,gBAAAE,EAACE,GAAA,EAAoB,iBAAiBJ,EAAM,iBAC1C,UAAA;AAAA,UAAAA,EAAM,QACN,gBAAAK;AAAA,YAAC;AAAA,YAAA;AAAA,cACA,OAAO;AAAA,gBACN,GAAGL,GAAO;AAAA,gBACV,SAASA,GAAO,WAAW,WAAW;AAAA,gBACtC,WAAWA,GAAO,WAAW,aAAa;AAAA,cAAA;AAAA,cAG3C,UAAA,gBAAAK;AAAA,gBAACL,EAAM;AAAA,gBAAN;AAAA,kBACA,OAAOM,EAAiBN,EAAM,IAAI,EAAE;AAAA,kBACpC,QAAQ;AAAA,kBACR,OAAO;AAAA,gBAAA;AAAA,cAAA;AAAA,YACR;AAAA,UAAA;AAAA,UAGF,gBAAAK;AAAA,YAACE;AAAA,YAAA;AAAA,cACA,OAAO;AAAA,gBACN,OAAOP,EAAM,aAAaM,EAAiBN,EAAM,IAAI,EAAE;AAAA,gBACvD,YAAY;AAAA,gBACZ,aAAa;AAAA,cAAA;AAAA,cAGb,UAAAA,EAAM;AAAA,YAAA;AAAA,UAAA;AAAA,UAEPA,EAAM,kBAAkBA,EAAM,cAC9B,gBAAAK;AAAA,YAACE;AAAA,YAAA;AAAA,cACA,OAAO;AAAA,gBACN,OAAOC,EAAO,KAAK;AAAA,gBACnB,QAAQ;AAAA,gBACR,gBAAgB;AAAA,cAAA;AAAA,cAEjB,SAAS,MAAM;AACd,gBACCR,EAAM,eAAe,cACrBA,EAAM,4BAENA,EAAM,0BAAA,IAENC,EAAA;AAAA,cAEF;AAAA,cAEC,UAAAD,EAAM;AAAA,YAAA;AAAA,UAAA;AAAA,QACR,GAEF;AAAA,QACCA,EAAM,mBACN,gBAAAK,EAACI,GAAA,EACA,UAAA,gBAAAJ;AAAA,UAACK;AAAAA,UAAA;AAAA,YACA,OAAO;AAAA,YACP,QAAQ;AAAA,YACR,OAAOF,EAAO,QAAQ;AAAA,YACtB,SAAS,MAAM;AACd,cAAIR,GAAO,wBACVA,EAAM,qBAAA;AAAA,YAER;AAAA,UAAA;AAAA,QAAA,EACD,CACD;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIJ;"}
|
|
1
|
+
{"version":3,"file":"Alert.js","sources":["../../../../src/components/alerts/Alert.tsx"],"sourcesContent":["import CloseIcon from '@src/assets/icons/cross.svg';\nimport React from 'react';\nimport {\n\tAlertContentWrapper,\n\tAlertStyle,\n\tCloseIconWrapper,\n} from '@src/components/alerts/Alert.styled';\nimport {\n\tALERT_TYPES,\n\tCOLOR_CONFIG_MAP,\n\tCONTENT_POSITION,\n} from '@src/components/alerts/AlertHelper';\nimport { BodyCaption } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\n\nexport type AlertProps = {\n\ttype: ALERT_TYPES;\n\ttext: string | React.ReactNode;\n\ticon?: React.FC<{ width: number; height: number; color: string }>;\n\ttextColor?: string;\n\tcontentPosition?: CONTENT_POSITION;\n\tcontainerStyle?: React.CSSProperties;\n\tredirectTo?: string;\n\tredirectToText?: string;\n\ticonStyle?: React.CSSProperties;\n\thandleRedirectButtonClick?: () => void;\n\tshowCrossButton?: boolean;\n\thandleCrossIconClick?: () => void;\n};\n\nexport const Alert: React.FC<AlertProps> = (props) => {\n\tconst handleRedirection = () => {\n\t\tif (props.redirectTo) {\n\t\t\twindow.open(props.redirectTo, '_blank');\n\t\t}\n\t};\n\n\treturn (\n\t\t<AlertStyle\n\t\t\ttype={props.type}\n\t\t\tcontentPosition={props.contentPosition}\n\t\t\tstyle={props.containerStyle}\n\t\t>\n\t\t\t<AlertContentWrapper contentPosition={props.contentPosition}>\n\t\t\t\t{props.icon && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t...props?.iconStyle,\n\t\t\t\t\t\t\tdisplay: props?.iconStyle?.display || 'flex',\n\t\t\t\t\t\t\talignSelf: props?.iconStyle?.alignSelf || 'flex-start',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<props.icon\n\t\t\t\t\t\t\tcolor={COLOR_CONFIG_MAP[props.type].textColor}\n\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t<BodyCaption\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tcolor: props.textColor || COLOR_CONFIG_MAP[props.type].textColor,\n\t\t\t\t\t\tmarginLeft: 8,\n\t\t\t\t\t\tmarginRight: 4,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{props.text}\n\t\t\t\t</BodyCaption>\n\t\t\t\t{props.redirectToText && props.redirectTo && (\n\t\t\t\t\t<BodyCaption\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tcolor: COLORS.text.brand,\n\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\ttextDecoration: 'underline',\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tprops.redirectTo === 'INTERNAL' &&\n\t\t\t\t\t\t\t\tprops.handleRedirectButtonClick\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tprops.handleRedirectButtonClick();\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\thandleRedirection();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{props.redirectToText}\n\t\t\t\t\t</BodyCaption>\n\t\t\t\t)}\n\t\t\t</AlertContentWrapper>\n\t\t\t{props.showCrossButton && (\n\t\t\t\t<CloseIconWrapper>\n\t\t\t\t\t<CloseIcon\n\t\t\t\t\t\tdata-test=\"alert-close-button\"\n\t\t\t\t\t\twidth={20}\n\t\t\t\t\t\theight={20}\n\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tif (props?.handleCrossIconClick) {\n\t\t\t\t\t\t\t\tprops.handleCrossIconClick();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t</CloseIconWrapper>\n\t\t\t)}\n\t\t</AlertStyle>\n\t);\n};\n"],"names":["Alert","props","handleRedirection","jsxs","AlertStyle","AlertContentWrapper","jsx","COLOR_CONFIG_MAP","BodyCaption","COLORS","CloseIconWrapper","CloseIcon"],"mappings":";;;;;;AA8BO,MAAMA,IAA8B,CAACC,MAAU;AACrD,QAAMC,IAAoB,MAAM;AAC/B,IAAID,EAAM,cACT,OAAO,KAAKA,EAAM,YAAY,QAAQ;AAAA,EAExC;AAEA,SACC,gBAAAE;AAAA,IAACC;AAAA,IAAA;AAAA,MACA,MAAMH,EAAM;AAAA,MACZ,iBAAiBA,EAAM;AAAA,MACvB,OAAOA,E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MAAM;AACd,cAAIR,GAAO,wBACVA,EAAM,qBAAA;AAAA,YAER;AAAA,UAAA;AAAA,QAAA,EACD,CACD;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIJ;"}
|
|
@@ -6,23 +6,23 @@ import { COLORS as l } from "../../constants/Theme.js";
|
|
|
6
6
|
import tt from "../../assets/icons/arrow_down.svg.js";
|
|
7
7
|
import et from "../../assets/icons/arrow_up.svg.js";
|
|
8
8
|
import rt from "../../assets/icons/info.svg.js";
|
|
9
|
-
import { BodyCaption as
|
|
9
|
+
import { BodyCaption as nt, TitleLarge as ot, TitleMedium as it, Caption as u } from "../TypographyStyle.js";
|
|
10
10
|
import { truncateValueForInternationalStore as q, truncateValueForIndianStore as B } from "./chart/utils/calcPercentage.js";
|
|
11
11
|
import { AnalyticsTrendContainer as lt, IconContainer as at } from "./CommonStyles.js";
|
|
12
12
|
import { Tooltip as V } from "../tooltips/Tooltip.js";
|
|
13
13
|
import { Tag as C } from "../tag/Tag.js";
|
|
14
14
|
const wt = ({
|
|
15
|
-
title:
|
|
15
|
+
title: h,
|
|
16
16
|
value: r,
|
|
17
17
|
trendPercent: e,
|
|
18
18
|
type: a = "horizontal",
|
|
19
|
-
timeline:
|
|
19
|
+
timeline: n,
|
|
20
20
|
customRange: f,
|
|
21
21
|
tooltip: b,
|
|
22
22
|
card: y = !0,
|
|
23
23
|
rightSeparator: D = !1,
|
|
24
24
|
size: $ = "big",
|
|
25
|
-
share:
|
|
25
|
+
share: o = !1,
|
|
26
26
|
formatVal: A,
|
|
27
27
|
prefixSymbol: d,
|
|
28
28
|
trailingIcon: v,
|
|
@@ -31,7 +31,7 @@ const wt = ({
|
|
|
31
31
|
funnelPercent: w,
|
|
32
32
|
isLoading: i,
|
|
33
33
|
trendRaw: g,
|
|
34
|
-
trendRawString:
|
|
34
|
+
trendRawString: c,
|
|
35
35
|
suffixText: m,
|
|
36
36
|
trendStyle: G,
|
|
37
37
|
trendContainerStyle: H,
|
|
@@ -45,7 +45,7 @@ const wt = ({
|
|
|
45
45
|
tooltipTimelineText: S,
|
|
46
46
|
customTimelineText: W
|
|
47
47
|
}) => {
|
|
48
|
-
const L = $ === "big" ?
|
|
48
|
+
const L = $ === "big" ? ot : it, E = typeof e < "u" ? e < 0 ? "negative" : e === 0 ? "neutral" : "positive" : void 0, T = typeof e < "u" ? o ? Math.round(e) : Math.abs(Math.round(e)) : void 0, Q = () => typeof r > "u" ? "--" : typeof r == "number" && A ? r > 999 ? I ? `${d ?? ""}${q(
|
|
49
49
|
r
|
|
50
50
|
)} ${m ?? ""}` : `${d ?? ""}${B(
|
|
51
51
|
r
|
|
@@ -103,12 +103,12 @@ const wt = ({
|
|
|
103
103
|
},
|
|
104
104
|
children: [
|
|
105
105
|
/* @__PURE__ */ t(
|
|
106
|
-
|
|
106
|
+
nt,
|
|
107
107
|
{
|
|
108
108
|
style: {
|
|
109
109
|
color: l.content.secondary
|
|
110
110
|
},
|
|
111
|
-
children:
|
|
111
|
+
children: h
|
|
112
112
|
}
|
|
113
113
|
),
|
|
114
114
|
b && /* @__PURE__ */ t(V, { body: b, placement: "right", width: 300, children: /* @__PURE__ */ t(
|
|
@@ -140,7 +140,7 @@ const wt = ({
|
|
|
140
140
|
flexDirection: "row",
|
|
141
141
|
gap: 12,
|
|
142
142
|
alignItems: "center",
|
|
143
|
-
...
|
|
143
|
+
...o ? { justifyContent: "space-between" } : {}
|
|
144
144
|
},
|
|
145
145
|
children: [
|
|
146
146
|
i && /* @__PURE__ */ t(k, { width: 108, height: 26 }),
|
|
@@ -161,15 +161,15 @@ const wt = ({
|
|
|
161
161
|
type: "neutral"
|
|
162
162
|
}
|
|
163
163
|
),
|
|
164
|
-
a === "horizontal" && !i && !
|
|
164
|
+
a === "horizontal" && !i && !o && /* @__PURE__ */ t(
|
|
165
165
|
_,
|
|
166
166
|
{
|
|
167
|
-
timeline:
|
|
167
|
+
timeline: n,
|
|
168
168
|
customRange: f,
|
|
169
169
|
percent: T,
|
|
170
170
|
direction: E,
|
|
171
171
|
trendRaw: g,
|
|
172
|
-
trendRawString:
|
|
172
|
+
trendRawString: c,
|
|
173
173
|
prefixSymbol: d,
|
|
174
174
|
trendIconStyle: z,
|
|
175
175
|
isInternationalStore: I,
|
|
@@ -177,7 +177,7 @@ const wt = ({
|
|
|
177
177
|
customTimelineText: W
|
|
178
178
|
}
|
|
179
179
|
),
|
|
180
|
-
i && !
|
|
180
|
+
i && !o && a === "horizontal" && /* @__PURE__ */ t(k, { height: 20, width: 141, marginTop: 6 }),
|
|
181
181
|
a === "vertical" && !i && typeof w < "u" && /* @__PURE__ */ t(
|
|
182
182
|
C,
|
|
183
183
|
{
|
|
@@ -186,8 +186,8 @@ const wt = ({
|
|
|
186
186
|
type: "neutral"
|
|
187
187
|
}
|
|
188
188
|
),
|
|
189
|
-
|
|
190
|
-
!
|
|
189
|
+
o && !i && typeof T < "u" && /* @__PURE__ */ t(C, { tagText: `${T} %`, theme: "light", type: "neutral" }),
|
|
190
|
+
!o && !i && F && F != 0 ? /* @__PURE__ */ t(
|
|
191
191
|
C,
|
|
192
192
|
{
|
|
193
193
|
tagText: R(F),
|
|
@@ -198,15 +198,15 @@ const wt = ({
|
|
|
198
198
|
]
|
|
199
199
|
}
|
|
200
200
|
),
|
|
201
|
-
a === "vertical" && !i && !
|
|
201
|
+
a === "vertical" && !i && !o && /* @__PURE__ */ t("div", { style: { marginTop: 10 }, children: /* @__PURE__ */ t(
|
|
202
202
|
_,
|
|
203
203
|
{
|
|
204
|
-
timeline:
|
|
204
|
+
timeline: n,
|
|
205
205
|
customRange: f,
|
|
206
206
|
percent: T,
|
|
207
207
|
direction: E,
|
|
208
208
|
trendRaw: g,
|
|
209
|
-
trendRawString:
|
|
209
|
+
trendRawString: c,
|
|
210
210
|
prefixSymbol: d,
|
|
211
211
|
trendIconStyle: z,
|
|
212
212
|
isInternationalStore: I,
|
|
@@ -218,50 +218,58 @@ const wt = ({
|
|
|
218
218
|
]
|
|
219
219
|
}
|
|
220
220
|
),
|
|
221
|
-
p && !i && /* @__PURE__ */ t(V, { body: p, placement: "right", children: v && /* @__PURE__ */ t(
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
221
|
+
p && !i && /* @__PURE__ */ t(V, { body: p, placement: "right", children: v && /* @__PURE__ */ t(
|
|
222
|
+
"div",
|
|
223
|
+
{
|
|
224
|
+
"data-test": "analytics-trend-trailing-icon",
|
|
225
|
+
className: "icon--holder",
|
|
226
|
+
onClick: M,
|
|
227
|
+
children: Z.createElement(v, {
|
|
228
|
+
height: 20,
|
|
229
|
+
width: 20,
|
|
230
|
+
color: l.content.secondary
|
|
231
|
+
})
|
|
232
|
+
}
|
|
233
|
+
) })
|
|
226
234
|
]
|
|
227
235
|
}
|
|
228
236
|
)
|
|
229
237
|
}
|
|
230
238
|
);
|
|
231
239
|
}, _ = ({
|
|
232
|
-
percent:
|
|
240
|
+
percent: h,
|
|
233
241
|
direction: r,
|
|
234
242
|
timeline: e,
|
|
235
243
|
customRange: a,
|
|
236
|
-
trendRaw:
|
|
244
|
+
trendRaw: n,
|
|
237
245
|
trendRawString: f,
|
|
238
246
|
prefixSymbol: b,
|
|
239
247
|
trendIconStyle: y,
|
|
240
248
|
isInternationalStore: D,
|
|
241
249
|
tooltipTimelineText: $,
|
|
242
|
-
customTimelineText:
|
|
250
|
+
customTimelineText: o
|
|
243
251
|
}) => {
|
|
244
252
|
const A = () => {
|
|
245
|
-
let
|
|
246
|
-
if (
|
|
247
|
-
return D ?
|
|
248
|
-
q(Math.abs(
|
|
249
|
-
) :
|
|
253
|
+
let c = "--";
|
|
254
|
+
if (n)
|
|
255
|
+
return D ? c = String(
|
|
256
|
+
q(Math.abs(n))
|
|
257
|
+
) : c = String(B(Math.abs(n))), n < 0 ? "-" + c : c;
|
|
250
258
|
}, d = () => {
|
|
251
|
-
const
|
|
252
|
-
return typeof
|
|
259
|
+
const c = ((n ?? 0) > 0 ? "+" : "") + (b ?? "");
|
|
260
|
+
return typeof n > "u" ? "--" : `${c ?? ""}${A()}`;
|
|
253
261
|
}, [v, M] = O(
|
|
254
262
|
d()
|
|
255
263
|
), [p, w] = O(
|
|
256
|
-
|
|
264
|
+
o || ""
|
|
257
265
|
);
|
|
258
266
|
U(() => {
|
|
259
|
-
|
|
267
|
+
o || w(
|
|
260
268
|
e === "today" ? "vs yesterday" : e === "yesterday" ? "vs 1 day before" : e === "7 days" ? "vs last 7 days" : e === "30 days" ? "vs last 30 days" : e === "custom" && a ? P.getAnalyticsCustomDateTimelineText(a) : ""
|
|
261
269
|
);
|
|
262
270
|
}, [e, a]), U(() => {
|
|
263
271
|
M(d());
|
|
264
|
-
}, [
|
|
272
|
+
}, [n]);
|
|
265
273
|
const i = r === "negative" ? tt : et, g = r === "negative" ? l.background.negative.vibrant : r === "positive" ? l.background.positive.vibrant : l.content.placeholder;
|
|
266
274
|
return /* @__PURE__ */ s(
|
|
267
275
|
"div",
|
|
@@ -273,7 +281,7 @@ const wt = ({
|
|
|
273
281
|
flexWrap: "wrap"
|
|
274
282
|
},
|
|
275
283
|
children: [
|
|
276
|
-
typeof
|
|
284
|
+
typeof h == "number" && /* @__PURE__ */ t(
|
|
277
285
|
i,
|
|
278
286
|
{
|
|
279
287
|
color: g,
|
|
@@ -282,19 +290,19 @@ const wt = ({
|
|
|
282
290
|
style: { marginRight: 2, ...y ?? {} }
|
|
283
291
|
}
|
|
284
292
|
),
|
|
285
|
-
typeof
|
|
286
|
-
r === "neutral" ? 0 :
|
|
293
|
+
typeof h == "number" && r && /* @__PURE__ */ s(u, { style: { color: g }, children: [
|
|
294
|
+
r === "neutral" ? 0 : h < 1e3 ? h : ">999",
|
|
287
295
|
"%"
|
|
288
296
|
] }),
|
|
289
|
-
!!
|
|
290
|
-
!
|
|
297
|
+
!!n && /* @__PURE__ */ t(u, { style: { marginLeft: 4, color: l.content.placeholder }, children: `(${v})` }),
|
|
298
|
+
!n && (f?.length || 0) > 0 && /* @__PURE__ */ t(u, { style: { marginLeft: 4, color: l.content.placeholder }, children: `${f}` }),
|
|
291
299
|
e && ($ ? /* @__PURE__ */ t(V, { body: $, placement: "bottom", children: /* @__PURE__ */ t(
|
|
292
300
|
u,
|
|
293
301
|
{
|
|
294
302
|
style: { marginLeft: 4, color: l.content.placeholder },
|
|
295
|
-
children:
|
|
303
|
+
children: o || p
|
|
296
304
|
}
|
|
297
|
-
) }) : /* @__PURE__ */ t(u, { style: { marginLeft: 4, color: l.content.placeholder }, children:
|
|
305
|
+
) }) : /* @__PURE__ */ t(u, { style: { marginLeft: 4, color: l.content.placeholder }, children: o || p }))
|
|
298
306
|
]
|
|
299
307
|
}
|
|
300
308
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyticsTrend.js","sources":["../../../../src/components/analytics-chips-and-dropdowns/AnalyticsTrend.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { ShimmerComponentStyled } from '@src/components/shimmer/ShimmerComponent/ShimmerStyled';\nimport DateUtils from '@src/utils/DateUtils';\nimport { COLORS } from '@src/constants/Theme';\nimport DownArrowIcon from '../../assets/icons/arrow_down.svg';\nimport UpArrowIcon from '../../assets/icons/arrow_up.svg';\nimport InfoIcon from '../../assets/icons/info.svg';\nimport { Tag } from '../tag';\nimport { Tooltip } from '../tooltips';\nimport {\n\tBodyCaption,\n\tCaption,\n\tTitleLarge,\n\tTitleMedium,\n} from '../TypographyStyle';\nimport {\n\ttruncateValueForIndianStore,\n\ttruncateValueForInternationalStore,\n} from './chart/utils/calcPercentage';\nimport { AnalyticsTrendContainer, IconContainer } from './CommonStyles';\n\nexport interface AnalyticsTrendInterface {\n\ttitle: string;\n\tvalue?: number | string;\n\ttrendPercent?: number;\n\ttrendRaw?: number;\n\ttrendRawString?: string;\n\tformatVal?: boolean;\n\ttimeline?: 'today' | 'yesterday' | '7 days' | '30 days' | 'custom';\n\tcustomRange?: Date[];\n\ttype?: 'vertical' | 'horizontal';\n\ttooltip?: string;\n\tcard?: boolean;\n\trightSeparator?: boolean;\n\tsize?: 'big' | 'small';\n\tshare?: boolean;\n\tprefixSymbol?: string;\n\ttrailingIcon?: React.FunctionComponent<React.SVGAttributes<SVGElement>>;\n\tonTrailIconClick?: () => void;\n\ticonTooltipBody?: string;\n\tfunnelPercent?: number;\n\tisLoading?: boolean;\n\tsuffixText?: string;\n\ttrendStyle?: React.CSSProperties;\n\ticonContainerStyle?: React.CSSProperties;\n\ttrendContainerStyle?: React.CSSProperties;\n\ttrendIconStyle?: React.CSSProperties;\n\tcontainerStyle?: React.CSSProperties;\n\tprevTrendDiff?: number;\n\trelativePercentageDiff?: number;\n\tisInternationalStore?: boolean;\n\tIcon?: React.FunctionComponent<React.SVGAttributes<SVGElement>>;\n\ttooltipTimelineText?: string;\n\tcustomTimelineText?: string;\n}\nexport const AnalyticsTrend: React.FC<AnalyticsTrendInterface> = ({\n\ttitle,\n\tvalue,\n\ttrendPercent,\n\ttype = 'horizontal',\n\ttimeline,\n\tcustomRange,\n\ttooltip,\n\tcard = true,\n\trightSeparator = false,\n\tsize = 'big',\n\tshare = false,\n\tformatVal,\n\tprefixSymbol,\n\ttrailingIcon,\n\tonTrailIconClick,\n\ticonTooltipBody,\n\tfunnelPercent,\n\tisLoading,\n\ttrendRaw,\n\ttrendRawString,\n\tsuffixText,\n\ttrendStyle,\n\ttrendContainerStyle,\n\ttrendIconStyle,\n\tcontainerStyle,\n\tprevTrendDiff,\n\trelativePercentageDiff,\n\tisInternationalStore,\n\tIcon,\n\ticonContainerStyle,\n\ttooltipTimelineText,\n\tcustomTimelineText,\n}) => {\n\tconst ValueTypo = size === 'big' ? TitleLarge : TitleMedium;\n\tconst trendDirection =\n\t\ttypeof trendPercent !== 'undefined'\n\t\t\t? trendPercent < 0\n\t\t\t\t? 'negative'\n\t\t\t\t: trendPercent === 0\n\t\t\t\t? 'neutral'\n\t\t\t\t: 'positive'\n\t\t\t: undefined;\n\n\tconst percent =\n\t\ttypeof trendPercent !== 'undefined'\n\t\t\t? share\n\t\t\t\t? Math.round(trendPercent)\n\t\t\t\t: Math.abs(Math.round(trendPercent))\n\t\t\t: undefined;\n\n\tconst getDisplayValue = () => {\n\t\tif (typeof value === 'undefined') {\n\t\t\treturn '--';\n\t\t}\n\n\t\tif (typeof value === 'number') {\n\t\t\tif (formatVal) {\n\t\t\t\tif (value > 999) {\n\t\t\t\t\tif (isInternationalStore) {\n\t\t\t\t\t\treturn `${prefixSymbol ?? ''}${truncateValueForInternationalStore(\n\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t)} ${suffixText ?? ''}`;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn `${prefixSymbol ?? ''}${truncateValueForIndianStore(\n\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t)} ${suffixText ?? ''}`;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn `${prefixSymbol ?? ''}${new Intl.NumberFormat('en-IN', {\n\t\t\t\t\t\tmaximumFractionDigits: 2,\n\t\t\t\t\t}).format(value)} ${suffixText ?? ''}`;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn `${prefixSymbol ?? ''}${value} ${suffixText ?? ''}`;\n\t};\n\n\tconst formatTrendDiff = (trendDiff: number) => {\n\t\tconst diff = Math.abs(trendDiff);\n\t\tif (diff % 1 !== 0) {\n\t\t\treturn `${diff.toFixed(1)} %`;\n\t\t}\n\t\treturn `${diff} %`;\n\t};\n\n\treturn (\n\t\t<AnalyticsTrendContainer\n\t\t\tcard={card}\n\t\t\tstyle={{\n\t\t\t\t...containerStyle,\n\t\t\t}}\n\t\t>\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tflexDirection: 'row',\n\t\t\t\t\tgap: Icon ? 12 : 4,\n\t\t\t\t\tborderRightWidth: rightSeparator ? 1 : 0,\n\t\t\t\t\tborderRightColor: COLORS.stroke.primary,\n\t\t\t\t\tborderRightStyle: 'solid',\n\t\t\t\t\tpaddingLeft: !card ? 24 : 0,\n\t\t\t\t\tpaddingRight: !card ? 24 : 0,\n\t\t\t\t\theight: '100%',\n\t\t\t\t\tjustifyContent: Icon ? 'flex-start' : 'space-between',\n\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t...(trendContainerStyle ?? {}),\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{!!Icon && (\n\t\t\t\t\t<IconContainer style={{ ...iconContainerStyle }}>\n\t\t\t\t\t\t<Icon />\n\t\t\t\t\t</IconContainer>\n\t\t\t\t)}\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\tflexDirection: 'column',\n\t\t\t\t\t\tgap: 4,\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t...(trendStyle ?? {}),\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\tflexDirection: 'row',\n\t\t\t\t\t\t\tgap: 4,\n\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<BodyCaption\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tcolor: COLORS.content.secondary,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{title}\n\t\t\t\t\t\t</BodyCaption>\n\n\t\t\t\t\t\t{tooltip && (\n\t\t\t\t\t\t\t<Tooltip body={tooltip} placement={'right'} width={300}>\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\t\t\t\theight: '100%',\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\t\t<InfoIcon\n\t\t\t\t\t\t\t\t\t\tcolor={COLORS.content.primary}\n\t\t\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\tflexDirection: 'row',\n\t\t\t\t\t\t\tgap: 12,\n\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t\t...(share ? { justifyContent: 'space-between' } : {}),\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{isLoading && <ShimmerComponentStyled width={108} height={26} />}\n\t\t\t\t\t\t{!isLoading && (\n\t\t\t\t\t\t\t<ValueTypo\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tcolor: COLORS.content.primary,\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{getDisplayValue()}\n\t\t\t\t\t\t\t</ValueTypo>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{typeof relativePercentageDiff === 'number' && (\n\t\t\t\t\t\t\t<Tag\n\t\t\t\t\t\t\t\ttagText={`${relativePercentageDiff}%`}\n\t\t\t\t\t\t\t\ttheme=\"light\"\n\t\t\t\t\t\t\t\ttype=\"neutral\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{type === 'horizontal' && !isLoading && !share && (\n\t\t\t\t\t\t\t<Trend\n\t\t\t\t\t\t\t\ttimeline={timeline}\n\t\t\t\t\t\t\t\tcustomRange={customRange}\n\t\t\t\t\t\t\t\tpercent={percent}\n\t\t\t\t\t\t\t\tdirection={trendDirection}\n\t\t\t\t\t\t\t\ttrendRaw={trendRaw}\n\t\t\t\t\t\t\t\ttrendRawString={trendRawString}\n\t\t\t\t\t\t\t\tprefixSymbol={prefixSymbol}\n\t\t\t\t\t\t\t\ttrendIconStyle={trendIconStyle}\n\t\t\t\t\t\t\t\tisInternationalStore={isInternationalStore}\n\t\t\t\t\t\t\t\ttooltipTimelineText={tooltipTimelineText}\n\t\t\t\t\t\t\t\tcustomTimelineText={customTimelineText}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{isLoading && !share && type === 'horizontal' && (\n\t\t\t\t\t\t\t<ShimmerComponentStyled height={20} width={141} marginTop={6} />\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{type === 'vertical' &&\n\t\t\t\t\t\t\t!isLoading &&\n\t\t\t\t\t\t\ttypeof funnelPercent !== 'undefined' && (\n\t\t\t\t\t\t\t\t<Tag\n\t\t\t\t\t\t\t\t\ttagText={`${funnelPercent} %`}\n\t\t\t\t\t\t\t\t\ttheme=\"light\"\n\t\t\t\t\t\t\t\t\ttype=\"neutral\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t{share && !isLoading && typeof percent !== 'undefined' && (\n\t\t\t\t\t\t\t<Tag tagText={`${percent} %`} theme=\"light\" type=\"neutral\" />\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{!share && !isLoading && prevTrendDiff && prevTrendDiff != 0 ? (\n\t\t\t\t\t\t\t<Tag\n\t\t\t\t\t\t\t\ttagText={formatTrendDiff(prevTrendDiff)}\n\t\t\t\t\t\t\t\ttheme=\"light\"\n\t\t\t\t\t\t\t\ttype=\"neutral\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<></>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t\t{type === 'vertical' && !isLoading && !share && (\n\t\t\t\t\t\t<div style={{ marginTop: 10 }}>\n\t\t\t\t\t\t\t<Trend\n\t\t\t\t\t\t\t\ttimeline={timeline}\n\t\t\t\t\t\t\t\tcustomRange={customRange}\n\t\t\t\t\t\t\t\tpercent={percent}\n\t\t\t\t\t\t\t\tdirection={trendDirection}\n\t\t\t\t\t\t\t\ttrendRaw={trendRaw}\n\t\t\t\t\t\t\t\ttrendRawString={trendRawString}\n\t\t\t\t\t\t\t\tprefixSymbol={prefixSymbol}\n\t\t\t\t\t\t\t\ttrendIconStyle={trendIconStyle}\n\t\t\t\t\t\t\t\tisInternationalStore={isInternationalStore}\n\t\t\t\t\t\t\t\ttooltipTimelineText={tooltipTimelineText}\n\t\t\t\t\t\t\t\tcustomTimelineText={customTimelineText}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t\t{isLoading && type === 'vertical' && (\n\t\t\t\t\t\t<ShimmerComponentStyled height={20} width={141} marginTop={6} />\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t\t{iconTooltipBody && !isLoading && (\n\t\t\t\t\t<Tooltip body={iconTooltipBody} placement={'right'}>\n\t\t\t\t\t\t{trailingIcon && (\n\t\t\t\t\t\t\t<div className={'icon--holder'} onClick={onTrailIconClick}>\n\t\t\t\t\t\t\t\t{React.createElement(trailingIcon, {\n\t\t\t\t\t\t\t\t\theight: 20,\n\t\t\t\t\t\t\t\t\twidth: 20,\n\t\t\t\t\t\t\t\t\tcolor: COLORS.content.secondary,\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)}\n\t\t\t\t\t</Tooltip>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</AnalyticsTrendContainer>\n\t);\n};\n\nconst Trend: React.FC<{\n\tpercent?: number;\n\tdirection?: 'positive' | 'negative' | 'neutral';\n\ttimeline?: AnalyticsTrendInterface['timeline'];\n\tcustomRange?: AnalyticsTrendInterface['customRange'];\n\ttrendRaw?: number;\n\ttrendRawString?: string;\n\tprefixSymbol?: string;\n\ttrendIconStyle?: React.CSSProperties;\n\tisInternationalStore?: boolean;\n\ttooltipTimelineText?: string;\n\tcustomTimelineText?: string;\n}> = ({\n\tpercent,\n\tdirection,\n\ttimeline,\n\tcustomRange,\n\ttrendRaw,\n\ttrendRawString,\n\tprefixSymbol,\n\ttrendIconStyle,\n\tisInternationalStore,\n\ttooltipTimelineText,\n\tcustomTimelineText,\n}) => {\n\tconst getTrendRawAbs = () => {\n\t\tlet trendRawAbs = '--';\n\t\tif (trendRaw) {\n\t\t\tif (isInternationalStore) {\n\t\t\t\ttrendRawAbs = String(\n\t\t\t\t\ttruncateValueForInternationalStore(Math.abs(trendRaw)),\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\ttrendRawAbs = String(truncateValueForIndianStore(Math.abs(trendRaw)));\n\t\t\t}\n\t\t\tif (trendRaw < 0) {\n\t\t\t\treturn '-' + trendRawAbs;\n\t\t\t} else {\n\t\t\t\treturn trendRawAbs;\n\t\t\t}\n\t\t}\n\t};\n\n\tconst generateTrendRawText = () => {\n\t\tconst prefixWithSign =\n\t\t\t((trendRaw ?? 0) > 0 ? '+' : '') + (prefixSymbol ?? '');\n\t\tconst trendRawTextInitial =\n\t\t\ttypeof trendRaw === 'undefined'\n\t\t\t\t? '--'\n\t\t\t\t: `${prefixWithSign ?? ''}${getTrendRawAbs()}`;\n\t\treturn trendRawTextInitial;\n\t};\n\n\tconst [trendRawText, setTrendRawText] = useState<string>(\n\t\tgenerateTrendRawText(),\n\t);\n\tconst [timeLineText, setTimeLineText] = useState<string>(\n\t\tcustomTimelineText || '',\n\t);\n\n\tuseEffect(() => {\n\t\tif (customTimelineText) {\n\t\t\treturn;\n\t\t}\n\t\tsetTimeLineText(\n\t\t\ttimeline === 'today'\n\t\t\t\t? 'vs yesterday'\n\t\t\t\t: timeline === 'yesterday'\n\t\t\t\t? 'vs 1 day before'\n\t\t\t\t: timeline === '7 days'\n\t\t\t\t? 'vs last 7 days'\n\t\t\t\t: timeline === '30 days'\n\t\t\t\t? 'vs last 30 days'\n\t\t\t\t: timeline === 'custom' && customRange\n\t\t\t\t? DateUtils.getAnalyticsCustomDateTimelineText(customRange)\n\t\t\t\t: '',\n\t\t);\n\t}, [timeline, customRange]);\n\n\tuseEffect(() => {\n\t\tsetTrendRawText(generateTrendRawText());\n\t}, [trendRaw]);\n\n\tconst TrendIcon = direction === 'negative' ? DownArrowIcon : UpArrowIcon;\n\n\tconst color =\n\t\tdirection === 'negative'\n\t\t\t? COLORS.background.negative.vibrant\n\t\t\t: direction === 'positive'\n\t\t\t? COLORS.background.positive.vibrant\n\t\t\t: COLORS.content.placeholder;\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\tdisplay: 'flex',\n\t\t\t\talignItems: 'center',\n\t\t\t\tflexDirection: 'row',\n\t\t\t\tflexWrap: 'wrap',\n\t\t\t}}\n\t\t>\n\t\t\t{typeof percent === 'number' && (\n\t\t\t\t<TrendIcon\n\t\t\t\t\tcolor={color}\n\t\t\t\t\theight={16}\n\t\t\t\t\twidth={16}\n\t\t\t\t\tstyle={{ marginRight: 2, ...(trendIconStyle ?? {}) }}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{typeof percent === 'number' && direction && (\n\t\t\t\t<Caption style={{ color }}>\n\t\t\t\t\t{direction === 'neutral' ? 0 : percent < 1000 ? percent : '>999'}\n\t\t\t\t\t{'%'}\n\t\t\t\t</Caption>\n\t\t\t)}\n\t\t\t{!!trendRaw && (\n\t\t\t\t<Caption style={{ marginLeft: 4, color: COLORS.content.placeholder }}>\n\t\t\t\t\t{`(${trendRawText})`}\n\t\t\t\t</Caption>\n\t\t\t)}\n\t\t\t{!trendRaw && (trendRawString?.length || 0) > 0 && (\n\t\t\t\t<Caption style={{ marginLeft: 4, color: COLORS.content.placeholder }}>\n\t\t\t\t\t{`${trendRawString}`}\n\t\t\t\t</Caption>\n\t\t\t)}\n\n\t\t\t{timeline &&\n\t\t\t\t(tooltipTimelineText ? (\n\t\t\t\t\t<Tooltip body={tooltipTimelineText} placement=\"bottom\">\n\t\t\t\t\t\t<Caption\n\t\t\t\t\t\t\tstyle={{ marginLeft: 4, color: COLORS.content.placeholder }}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{customTimelineText || timeLineText}\n\t\t\t\t\t\t</Caption>\n\t\t\t\t\t</Tooltip>\n\t\t\t\t) : (\n\t\t\t\t\t<Caption style={{ marginLeft: 4, color: COLORS.content.placeholder }}>\n\t\t\t\t\t\t{customTimelineText || timeLineText}\n\t\t\t\t\t</Caption>\n\t\t\t\t))}\n\t\t</div>\n\t);\n};\n"],"names":["AnalyticsTrend","title","value","trendPercent","type","timeline","customRange","tooltip","card","rightSeparator","size","share","formatVal","prefixSymbol","trailingIcon","onTrailIconClick","iconTooltipBody","funnelPercent","isLoading","trendRaw","trendRawString","suffixText","trendStyle","trendContainerStyle","trendIconStyle","containerStyle","prevTrendDiff","relativePercentageDiff","isInternationalStore","Icon","iconContainerStyle","tooltipTimelineText","customTimelineText","ValueTypo","TitleLarge","TitleMedium","trendDirection","percent","getDisplayValue","truncateValueForInternationalStore","truncateValueForIndianStore","formatTrendDiff","trendDiff","diff","jsx","AnalyticsTrendContainer","jsxs","COLORS","IconContainer","BodyCaption","Tooltip","InfoIcon","ShimmerComponentStyled","Tag","Trend","Fragment","React","direction","getTrendRawAbs","trendRawAbs","generateTrendRawText","prefixWithSign","trendRawText","setTrendRawText","useState","timeLineText","setTimeLineText","useEffect","DateUtils","TrendIcon","DownArrowIcon","UpArrowIcon","color","Caption"],"mappings":";;;;;;;;;;;;;AAuDO,MAAMA,KAAoD,CAAC;AAAA,EACjE,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,gBAAAC,IAAiB;AAAA,EACjB,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,WAAAC;AAAA,EACA,cAAAC;A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AAA,GACrD,UAAA,IAAIe,CAAY,KAClB;AAAA,QAEA,CAAC3C,MAAaC,GAAgB,UAAU,KAAK,uBAC5CqD,GAAA,EAAQ,OAAO,EAAE,YAAY,GAAG,OAAO1B,EAAO,QAAQ,eACrD,UAAA,GAAG3B,CAAc,IACnB;AAAA,QAGAf,MACC0B,IACA,gBAAAa,EAACM,KAAQ,MAAMnB,GAAqB,WAAU,UAC7C,UAAA,gBAAAa;AAAA,UAAC6B;AAAA,UAAA;AAAA,YACA,OAAO,EAAE,YAAY,GAAG,OAAO1B,EAAO,QAAQ,YAAA;AAAA,YAE7C,UAAAf,KAAsBiC;AAAA,UAAA;AAAA,QAAA,EACxB,CACD,IAEA,gBAAArB,EAAC6B,GAAA,EAAQ,OAAO,EAAE,YAAY,GAAG,OAAO1B,EAAO,QAAQ,YAAA,GACrD,eAAsBkB,GACxB;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIL;"}
|
|
1
|
+
{"version":3,"file":"AnalyticsTrend.js","sources":["../../../../src/components/analytics-chips-and-dropdowns/AnalyticsTrend.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { ShimmerComponentStyled } from '@src/components/shimmer/ShimmerComponent/ShimmerStyled';\nimport DateUtils from '@src/utils/DateUtils';\nimport { COLORS } from '@src/constants/Theme';\nimport DownArrowIcon from '../../assets/icons/arrow_down.svg';\nimport UpArrowIcon from '../../assets/icons/arrow_up.svg';\nimport InfoIcon from '../../assets/icons/info.svg';\nimport { Tag } from '../tag';\nimport { Tooltip } from '../tooltips';\nimport {\n\tBodyCaption,\n\tCaption,\n\tTitleLarge,\n\tTitleMedium,\n} from '../TypographyStyle';\nimport {\n\ttruncateValueForIndianStore,\n\ttruncateValueForInternationalStore,\n} from './chart/utils/calcPercentage';\nimport { AnalyticsTrendContainer, IconContainer } from './CommonStyles';\n\nexport interface AnalyticsTrendInterface {\n\ttitle: string;\n\tvalue?: number | string;\n\ttrendPercent?: number;\n\ttrendRaw?: number;\n\ttrendRawString?: string;\n\tformatVal?: boolean;\n\ttimeline?: 'today' | 'yesterday' | '7 days' | '30 days' | 'custom';\n\tcustomRange?: Date[];\n\ttype?: 'vertical' | 'horizontal';\n\ttooltip?: string;\n\tcard?: boolean;\n\trightSeparator?: boolean;\n\tsize?: 'big' | 'small';\n\tshare?: boolean;\n\tprefixSymbol?: string;\n\ttrailingIcon?: React.FunctionComponent<React.SVGAttributes<SVGElement>>;\n\tonTrailIconClick?: () => void;\n\ticonTooltipBody?: string;\n\tfunnelPercent?: number;\n\tisLoading?: boolean;\n\tsuffixText?: string;\n\ttrendStyle?: React.CSSProperties;\n\ticonContainerStyle?: React.CSSProperties;\n\ttrendContainerStyle?: React.CSSProperties;\n\ttrendIconStyle?: React.CSSProperties;\n\tcontainerStyle?: React.CSSProperties;\n\tprevTrendDiff?: number;\n\trelativePercentageDiff?: number;\n\tisInternationalStore?: boolean;\n\tIcon?: React.FunctionComponent<React.SVGAttributes<SVGElement>>;\n\ttooltipTimelineText?: string;\n\tcustomTimelineText?: string;\n}\nexport const AnalyticsTrend: React.FC<AnalyticsTrendInterface> = ({\n\ttitle,\n\tvalue,\n\ttrendPercent,\n\ttype = 'horizontal',\n\ttimeline,\n\tcustomRange,\n\ttooltip,\n\tcard = true,\n\trightSeparator = false,\n\tsize = 'big',\n\tshare = false,\n\tformatVal,\n\tprefixSymbol,\n\ttrailingIcon,\n\tonTrailIconClick,\n\ticonTooltipBody,\n\tfunnelPercent,\n\tisLoading,\n\ttrendRaw,\n\ttrendRawString,\n\tsuffixText,\n\ttrendStyle,\n\ttrendContainerStyle,\n\ttrendIconStyle,\n\tcontainerStyle,\n\tprevTrendDiff,\n\trelativePercentageDiff,\n\tisInternationalStore,\n\tIcon,\n\ticonContainerStyle,\n\ttooltipTimelineText,\n\tcustomTimelineText,\n}) => {\n\tconst ValueTypo = size === 'big' ? TitleLarge : TitleMedium;\n\tconst trendDirection =\n\t\ttypeof trendPercent !== 'undefined'\n\t\t\t? trendPercent < 0\n\t\t\t\t? 'negative'\n\t\t\t\t: trendPercent === 0\n\t\t\t\t? 'neutral'\n\t\t\t\t: 'positive'\n\t\t\t: undefined;\n\n\tconst percent =\n\t\ttypeof trendPercent !== 'undefined'\n\t\t\t? share\n\t\t\t\t? Math.round(trendPercent)\n\t\t\t\t: Math.abs(Math.round(trendPercent))\n\t\t\t: undefined;\n\n\tconst getDisplayValue = () => {\n\t\tif (typeof value === 'undefined') {\n\t\t\treturn '--';\n\t\t}\n\n\t\tif (typeof value === 'number') {\n\t\t\tif (formatVal) {\n\t\t\t\tif (value > 999) {\n\t\t\t\t\tif (isInternationalStore) {\n\t\t\t\t\t\treturn `${prefixSymbol ?? ''}${truncateValueForInternationalStore(\n\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t)} ${suffixText ?? ''}`;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn `${prefixSymbol ?? ''}${truncateValueForIndianStore(\n\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t)} ${suffixText ?? ''}`;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn `${prefixSymbol ?? ''}${new Intl.NumberFormat('en-IN', {\n\t\t\t\t\t\tmaximumFractionDigits: 2,\n\t\t\t\t\t}).format(value)} ${suffixText ?? ''}`;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn `${prefixSymbol ?? ''}${value} ${suffixText ?? ''}`;\n\t};\n\n\tconst formatTrendDiff = (trendDiff: number) => {\n\t\tconst diff = Math.abs(trendDiff);\n\t\tif (diff % 1 !== 0) {\n\t\t\treturn `${diff.toFixed(1)} %`;\n\t\t}\n\t\treturn `${diff} %`;\n\t};\n\n\treturn (\n\t\t<AnalyticsTrendContainer\n\t\t\tcard={card}\n\t\t\tstyle={{\n\t\t\t\t...containerStyle,\n\t\t\t}}\n\t\t>\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tflexDirection: 'row',\n\t\t\t\t\tgap: Icon ? 12 : 4,\n\t\t\t\t\tborderRightWidth: rightSeparator ? 1 : 0,\n\t\t\t\t\tborderRightColor: COLORS.stroke.primary,\n\t\t\t\t\tborderRightStyle: 'solid',\n\t\t\t\t\tpaddingLeft: !card ? 24 : 0,\n\t\t\t\t\tpaddingRight: !card ? 24 : 0,\n\t\t\t\t\theight: '100%',\n\t\t\t\t\tjustifyContent: Icon ? 'flex-start' : 'space-between',\n\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t...(trendContainerStyle ?? {}),\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{!!Icon && (\n\t\t\t\t\t<IconContainer style={{ ...iconContainerStyle }}>\n\t\t\t\t\t\t<Icon />\n\t\t\t\t\t</IconContainer>\n\t\t\t\t)}\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\tflexDirection: 'column',\n\t\t\t\t\t\tgap: 4,\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t...(trendStyle ?? {}),\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\tflexDirection: 'row',\n\t\t\t\t\t\t\tgap: 4,\n\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<BodyCaption\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tcolor: COLORS.content.secondary,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{title}\n\t\t\t\t\t\t</BodyCaption>\n\n\t\t\t\t\t\t{tooltip && (\n\t\t\t\t\t\t\t<Tooltip body={tooltip} placement={'right'} width={300}>\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\t\t\t\theight: '100%',\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\t\t<InfoIcon\n\t\t\t\t\t\t\t\t\t\tcolor={COLORS.content.primary}\n\t\t\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\tflexDirection: 'row',\n\t\t\t\t\t\t\tgap: 12,\n\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t\t...(share ? { justifyContent: 'space-between' } : {}),\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{isLoading && <ShimmerComponentStyled width={108} height={26} />}\n\t\t\t\t\t\t{!isLoading && (\n\t\t\t\t\t\t\t<ValueTypo\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tcolor: COLORS.content.primary,\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{getDisplayValue()}\n\t\t\t\t\t\t\t</ValueTypo>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{typeof relativePercentageDiff === 'number' && (\n\t\t\t\t\t\t\t<Tag\n\t\t\t\t\t\t\t\ttagText={`${relativePercentageDiff}%`}\n\t\t\t\t\t\t\t\ttheme=\"light\"\n\t\t\t\t\t\t\t\ttype=\"neutral\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{type === 'horizontal' && !isLoading && !share && (\n\t\t\t\t\t\t\t<Trend\n\t\t\t\t\t\t\t\ttimeline={timeline}\n\t\t\t\t\t\t\t\tcustomRange={customRange}\n\t\t\t\t\t\t\t\tpercent={percent}\n\t\t\t\t\t\t\t\tdirection={trendDirection}\n\t\t\t\t\t\t\t\ttrendRaw={trendRaw}\n\t\t\t\t\t\t\t\ttrendRawString={trendRawString}\n\t\t\t\t\t\t\t\tprefixSymbol={prefixSymbol}\n\t\t\t\t\t\t\t\ttrendIconStyle={trendIconStyle}\n\t\t\t\t\t\t\t\tisInternationalStore={isInternationalStore}\n\t\t\t\t\t\t\t\ttooltipTimelineText={tooltipTimelineText}\n\t\t\t\t\t\t\t\tcustomTimelineText={customTimelineText}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{isLoading && !share && type === 'horizontal' && (\n\t\t\t\t\t\t\t<ShimmerComponentStyled height={20} width={141} marginTop={6} />\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{type === 'vertical' &&\n\t\t\t\t\t\t\t!isLoading &&\n\t\t\t\t\t\t\ttypeof funnelPercent !== 'undefined' && (\n\t\t\t\t\t\t\t\t<Tag\n\t\t\t\t\t\t\t\t\ttagText={`${funnelPercent} %`}\n\t\t\t\t\t\t\t\t\ttheme=\"light\"\n\t\t\t\t\t\t\t\t\ttype=\"neutral\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t{share && !isLoading && typeof percent !== 'undefined' && (\n\t\t\t\t\t\t\t<Tag tagText={`${percent} %`} theme=\"light\" type=\"neutral\" />\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{!share && !isLoading && prevTrendDiff && prevTrendDiff != 0 ? (\n\t\t\t\t\t\t\t<Tag\n\t\t\t\t\t\t\t\ttagText={formatTrendDiff(prevTrendDiff)}\n\t\t\t\t\t\t\t\ttheme=\"light\"\n\t\t\t\t\t\t\t\ttype=\"neutral\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<></>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t\t{type === 'vertical' && !isLoading && !share && (\n\t\t\t\t\t\t<div style={{ marginTop: 10 }}>\n\t\t\t\t\t\t\t<Trend\n\t\t\t\t\t\t\t\ttimeline={timeline}\n\t\t\t\t\t\t\t\tcustomRange={customRange}\n\t\t\t\t\t\t\t\tpercent={percent}\n\t\t\t\t\t\t\t\tdirection={trendDirection}\n\t\t\t\t\t\t\t\ttrendRaw={trendRaw}\n\t\t\t\t\t\t\t\ttrendRawString={trendRawString}\n\t\t\t\t\t\t\t\tprefixSymbol={prefixSymbol}\n\t\t\t\t\t\t\t\ttrendIconStyle={trendIconStyle}\n\t\t\t\t\t\t\t\tisInternationalStore={isInternationalStore}\n\t\t\t\t\t\t\t\ttooltipTimelineText={tooltipTimelineText}\n\t\t\t\t\t\t\t\tcustomTimelineText={customTimelineText}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t\t{isLoading && type === 'vertical' && (\n\t\t\t\t\t\t<ShimmerComponentStyled height={20} width={141} marginTop={6} />\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t\t{iconTooltipBody && !isLoading && (\n\t\t\t\t\t<Tooltip body={iconTooltipBody} placement={'right'}>\n\t\t\t\t\t\t{trailingIcon && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tdata-test=\"analytics-trend-trailing-icon\"\n\t\t\t\t\t\t\t\tclassName={'icon--holder'}\n\t\t\t\t\t\t\t\tonClick={onTrailIconClick}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{React.createElement(trailingIcon, {\n\t\t\t\t\t\t\t\t\theight: 20,\n\t\t\t\t\t\t\t\t\twidth: 20,\n\t\t\t\t\t\t\t\t\tcolor: COLORS.content.secondary,\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)}\n\t\t\t\t\t</Tooltip>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</AnalyticsTrendContainer>\n\t);\n};\n\nconst Trend: React.FC<{\n\tpercent?: number;\n\tdirection?: 'positive' | 'negative' | 'neutral';\n\ttimeline?: AnalyticsTrendInterface['timeline'];\n\tcustomRange?: AnalyticsTrendInterface['customRange'];\n\ttrendRaw?: number;\n\ttrendRawString?: string;\n\tprefixSymbol?: string;\n\ttrendIconStyle?: React.CSSProperties;\n\tisInternationalStore?: boolean;\n\ttooltipTimelineText?: string;\n\tcustomTimelineText?: string;\n}> = ({\n\tpercent,\n\tdirection,\n\ttimeline,\n\tcustomRange,\n\ttrendRaw,\n\ttrendRawString,\n\tprefixSymbol,\n\ttrendIconStyle,\n\tisInternationalStore,\n\ttooltipTimelineText,\n\tcustomTimelineText,\n}) => {\n\tconst getTrendRawAbs = () => {\n\t\tlet trendRawAbs = '--';\n\t\tif (trendRaw) {\n\t\t\tif (isInternationalStore) {\n\t\t\t\ttrendRawAbs = String(\n\t\t\t\t\ttruncateValueForInternationalStore(Math.abs(trendRaw)),\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\ttrendRawAbs = String(truncateValueForIndianStore(Math.abs(trendRaw)));\n\t\t\t}\n\t\t\tif (trendRaw < 0) {\n\t\t\t\treturn '-' + trendRawAbs;\n\t\t\t} else {\n\t\t\t\treturn trendRawAbs;\n\t\t\t}\n\t\t}\n\t};\n\n\tconst generateTrendRawText = () => {\n\t\tconst prefixWithSign =\n\t\t\t((trendRaw ?? 0) > 0 ? '+' : '') + (prefixSymbol ?? '');\n\t\tconst trendRawTextInitial =\n\t\t\ttypeof trendRaw === 'undefined'\n\t\t\t\t? '--'\n\t\t\t\t: `${prefixWithSign ?? ''}${getTrendRawAbs()}`;\n\t\treturn trendRawTextInitial;\n\t};\n\n\tconst [trendRawText, setTrendRawText] = useState<string>(\n\t\tgenerateTrendRawText(),\n\t);\n\tconst [timeLineText, setTimeLineText] = useState<string>(\n\t\tcustomTimelineText || '',\n\t);\n\n\tuseEffect(() => {\n\t\tif (customTimelineText) {\n\t\t\treturn;\n\t\t}\n\t\tsetTimeLineText(\n\t\t\ttimeline === 'today'\n\t\t\t\t? 'vs yesterday'\n\t\t\t\t: timeline === 'yesterday'\n\t\t\t\t? 'vs 1 day before'\n\t\t\t\t: timeline === '7 days'\n\t\t\t\t? 'vs last 7 days'\n\t\t\t\t: timeline === '30 days'\n\t\t\t\t? 'vs last 30 days'\n\t\t\t\t: timeline === 'custom' && customRange\n\t\t\t\t? DateUtils.getAnalyticsCustomDateTimelineText(customRange)\n\t\t\t\t: '',\n\t\t);\n\t}, [timeline, customRange]);\n\n\tuseEffect(() => {\n\t\tsetTrendRawText(generateTrendRawText());\n\t}, [trendRaw]);\n\n\tconst TrendIcon = direction === 'negative' ? DownArrowIcon : UpArrowIcon;\n\n\tconst color =\n\t\tdirection === 'negative'\n\t\t\t? COLORS.background.negative.vibrant\n\t\t\t: direction === 'positive'\n\t\t\t? COLORS.background.positive.vibrant\n\t\t\t: COLORS.content.placeholder;\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\tdisplay: 'flex',\n\t\t\t\talignItems: 'center',\n\t\t\t\tflexDirection: 'row',\n\t\t\t\tflexWrap: 'wrap',\n\t\t\t}}\n\t\t>\n\t\t\t{typeof percent === 'number' && (\n\t\t\t\t<TrendIcon\n\t\t\t\t\tcolor={color}\n\t\t\t\t\theight={16}\n\t\t\t\t\twidth={16}\n\t\t\t\t\tstyle={{ marginRight: 2, ...(trendIconStyle ?? {}) }}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{typeof percent === 'number' && direction && (\n\t\t\t\t<Caption style={{ color }}>\n\t\t\t\t\t{direction === 'neutral' ? 0 : percent < 1000 ? percent : '>999'}\n\t\t\t\t\t{'%'}\n\t\t\t\t</Caption>\n\t\t\t)}\n\t\t\t{!!trendRaw && (\n\t\t\t\t<Caption style={{ marginLeft: 4, color: COLORS.content.placeholder }}>\n\t\t\t\t\t{`(${trendRawText})`}\n\t\t\t\t</Caption>\n\t\t\t)}\n\t\t\t{!trendRaw && (trendRawString?.length || 0) > 0 && (\n\t\t\t\t<Caption style={{ marginLeft: 4, color: COLORS.content.placeholder }}>\n\t\t\t\t\t{`${trendRawString}`}\n\t\t\t\t</Caption>\n\t\t\t)}\n\n\t\t\t{timeline &&\n\t\t\t\t(tooltipTimelineText ? (\n\t\t\t\t\t<Tooltip body={tooltipTimelineText} placement=\"bottom\">\n\t\t\t\t\t\t<Caption\n\t\t\t\t\t\t\tstyle={{ marginLeft: 4, color: COLORS.content.placeholder }}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{customTimelineText || timeLineText}\n\t\t\t\t\t\t</Caption>\n\t\t\t\t\t</Tooltip>\n\t\t\t\t) : (\n\t\t\t\t\t<Caption style={{ marginLeft: 4, color: COLORS.content.placeholder }}>\n\t\t\t\t\t\t{customTimelineText || timeLineText}\n\t\t\t\t\t</Caption>\n\t\t\t\t))}\n\t\t</div>\n\t);\n};\n"],"names":["AnalyticsTrend","title","value","trendPercent","type","timeline","customRange","tooltip","card","rightSeparator","size","share","formatVal","prefixSymbol","trailingIcon","onTrailIconClick","iconTooltipBody","funnelPercent","isLoading","trendRaw","trendRawString","suffixText","trendStyle","trendContainerStyle","trendIconStyle","containerStyle","prevTrendDiff","relativePercentageDiff","isInternationalStore","Icon","iconContainerStyle","tooltipTimelineText","customTimelineText","ValueTypo","TitleLarge","TitleMedium","trendDirection","percent","getDisplayValue","truncateValueForInternationalStore","truncateValueForIndianStore","formatTrendDiff","trendDiff","diff","jsx","AnalyticsTrendContainer","jsxs","COLORS","IconContainer","BodyCaption","Tooltip","InfoIcon","ShimmerComponentStyled","Tag","Trend","Fragment","React","direction","getTrendRawAbs","trendRawAbs","generateTrendRawText","prefixWithSign","trendRawText","setTrendRawText","useState","timeLineText","setTimeLineText","useEffect","DateUtils","TrendIcon","DownArrowIcon","UpArrowIcon","color","Caption"],"mappings":";;;;;;;;;;;;;AAuDO,MAAMA,KAAoD,CAAC;AAAA,EAC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GAAG,GAAIhD,KAAkB,CAAA,EAAC;AAAA,UAAG;AAAA,QAAA;AAAA,QAGpD,OAAOa,KAAY,YAAYoB,uBAC9BgB,GAAA,EAAQ,OAAO,EAAE,OAAAD,EAAA,GAChB,UAAA;AAAA,UAAAf,MAAc,YAAY,IAAIpB,IAAU,MAAOA,IAAU;AAAA,UACzD;AAAA,QAAA,GACF;AAAA,QAEA,CAAC,CAAClB,KACF,gBAAAyB,EAAC6B,GAAA,EAAQ,OAAO,EAAE,YAAY,GAAG,OAAO1B,EAAO,QAAQ,YAAA,GACrD,UAAA,IAAIe,CAAY,KAClB;AAAA,QAEA,CAAC3C,MAAaC,GAAgB,UAAU,KAAK,uBAC5CqD,GAAA,EAAQ,OAAO,EAAE,YAAY,GAAG,OAAO1B,EAAO,QAAQ,eACrD,UAAA,GAAG3B,CAAc,IACnB;AAAA,QAGAf,MACC0B,IACA,gBAAAa,EAACM,KAAQ,MAAMnB,GAAqB,WAAU,UAC7C,UAAA,gBAAAa;AAAA,UAAC6B;AAAA,UAAA;AAAA,YACA,OAAO,EAAE,YAAY,GAAG,OAAO1B,EAAO,QAAQ,YAAA;AAAA,YAE7C,UAAAf,KAAsBiC;AAAA,UAAA;AAAA,QAAA,EACxB,CACD,IAEA,gBAAArB,EAAC6B,GAAA,EAAQ,OAAO,EAAE,YAAY,GAAG,OAAO1B,EAAO,QAAQ,YAAA,GACrD,eAAsBkB,GACxB;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIL;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as m, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { useState as R } from "react";
|
|
3
|
-
import { TitleMedium as k, TitleSmall as A, SubHeading as w, BodyTiny as
|
|
3
|
+
import { TitleMedium as k, TitleSmall as A, SubHeading as w, BodyTiny as x } from "../TypographyStyle.js";
|
|
4
4
|
import { COLORS as i } from "../../constants/Theme.js";
|
|
5
|
-
import
|
|
5
|
+
import O from "../../assets/icons/bik_livechat.svg.js";
|
|
6
6
|
import u from "../../assets/icons/email-channel.svg.js";
|
|
7
7
|
import d from "../../assets/icons/facebook_channel.svg.js";
|
|
8
8
|
import z from "../../assets/icons/gmail.svg.js";
|
|
@@ -10,12 +10,12 @@ import C from "../../assets/icons/instagram-channel.svg.js";
|
|
|
10
10
|
import L from "../../assets/icons/task.svg.js";
|
|
11
11
|
import U from "../../assets/icons/whatsapp_color.svg.js";
|
|
12
12
|
import { AvatarStyle as B } from "./Avatar.styled.js";
|
|
13
|
-
import { SIZE as
|
|
14
|
-
const
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
13
|
+
import { SIZE as a, AVATAR_TYPES as r, AVATAR_BACKGROUND as s, AVATAR_SIZE_MAP as l } from "./AvatarHelper.js";
|
|
14
|
+
const n = {
|
|
15
|
+
[a.EXTRA_SMALL]: 10,
|
|
16
|
+
[a.SMALL]: 16,
|
|
17
|
+
[a.MEDIUM]: 20,
|
|
18
|
+
[a.LARGE]: 32
|
|
19
19
|
}, b = {
|
|
20
20
|
[s.LIGHT]: i.content.secondary,
|
|
21
21
|
[s.WHITE]: i.content.secondary,
|
|
@@ -26,7 +26,7 @@ var P = /* @__PURE__ */ ((t) => (t.INSTAGRAM = "instagram", t.MESSENGER = "messe
|
|
|
26
26
|
const J = (t) => {
|
|
27
27
|
const [h, f] = R(!1), g = () => {
|
|
28
28
|
const o = (t.name || "").split(".").join(" ").split(" ").map((v) => v.charAt(0).toUpperCase()).slice(0, 2).join(""), c = b[t.background];
|
|
29
|
-
return t.size ===
|
|
29
|
+
return t.size === a.LARGE ? /* @__PURE__ */ e(k, { style: { color: c }, children: o }) : t.size === a.MEDIUM ? /* @__PURE__ */ e(A, { style: { color: c }, children: o }) : t.size === a.SMALL ? /* @__PURE__ */ e(w, { style: { color: c }, children: o }) : /* @__PURE__ */ e(x, { style: { color: c, fontSize: "6.667px", lineHeight: "8px" }, children: o });
|
|
30
30
|
}, I = () => t.useNameFallback && (!t.photoUrl || h) && t.name ? /* @__PURE__ */ e("div", { children: g() }) : t.useNameFallback && t.photoUrl && !h ? /* @__PURE__ */ e(
|
|
31
31
|
"img",
|
|
32
32
|
{
|
|
@@ -75,7 +75,7 @@ const J = (t) => {
|
|
|
75
75
|
case "tasks":
|
|
76
76
|
return /* @__PURE__ */ e(L, { width: 11, height: 11 });
|
|
77
77
|
case "livechat":
|
|
78
|
-
return /* @__PURE__ */ e(
|
|
78
|
+
return /* @__PURE__ */ e(O, { width: 11, height: 11 });
|
|
79
79
|
}
|
|
80
80
|
}, T = () => t.status ? /* @__PURE__ */ e(
|
|
81
81
|
"div",
|
|
@@ -107,8 +107,8 @@ const J = (t) => {
|
|
|
107
107
|
t.type === r.ICON && t.icon && /* @__PURE__ */ e(
|
|
108
108
|
t.icon,
|
|
109
109
|
{
|
|
110
|
-
width:
|
|
111
|
-
height:
|
|
110
|
+
width: n[t.size],
|
|
111
|
+
height: n[t.size],
|
|
112
112
|
color: b[t.background]
|
|
113
113
|
}
|
|
114
114
|
)
|
|
@@ -118,10 +118,11 @@ const J = (t) => {
|
|
|
118
118
|
t.inboxSettings && /* @__PURE__ */ e(
|
|
119
119
|
"div",
|
|
120
120
|
{
|
|
121
|
+
"data-test": "avatar-inbox-badge",
|
|
121
122
|
style: {
|
|
122
123
|
position: "absolute",
|
|
123
|
-
left:
|
|
124
|
-
top:
|
|
124
|
+
left: n[t.size] + "px",
|
|
125
|
+
top: n[t.size] + "px",
|
|
125
126
|
width: 14,
|
|
126
127
|
height: 14,
|
|
127
128
|
borderRadius: t?.borderRadius || "50%",
|
|
@@ -136,10 +137,11 @@ const J = (t) => {
|
|
|
136
137
|
t.status && /* @__PURE__ */ e(
|
|
137
138
|
"div",
|
|
138
139
|
{
|
|
140
|
+
"data-test": "avatar-status-indicator",
|
|
139
141
|
style: {
|
|
140
142
|
position: "absolute",
|
|
141
|
-
left:
|
|
142
|
-
top:
|
|
143
|
+
left: n[t.size] + "px",
|
|
144
|
+
top: n[t.size] + "px",
|
|
143
145
|
width: 11,
|
|
144
146
|
height: 11,
|
|
145
147
|
borderRadius: "50%",
|
|
@@ -156,7 +158,7 @@ const J = (t) => {
|
|
|
156
158
|
);
|
|
157
159
|
};
|
|
158
160
|
export {
|
|
159
|
-
|
|
161
|
+
n as AVATAR_SIZE_VS_ICON_SIZE_MAP,
|
|
160
162
|
J as Avatar,
|
|
161
163
|
b as BACKGROUND_VS_TEXT_COLOR_MAP,
|
|
162
164
|
P as MESSAGE_CHANNELS
|