@bikdotai/bik-component-library 0.0.858-beta.1 → 0.0.858
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/README.md +4 -4
- package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditor.js +23 -23
- package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditor.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/bik-chatbot/components/ChatWindow.js +20 -20
- package/dist/cjs/components/bik-chatbot/components/ChatWindow.js.map +1 -1
- package/dist/cjs/components/feature-announcements/FeatureAnnouncementProvider.js +2 -2
- package/dist/cjs/components/feature-announcements/FeatureAnnouncementProvider.js.map +1 -1
- package/dist/cjs/components/feature-announcements/MajorUpdatePopup.js +2 -2
- package/dist/cjs/components/feature-announcements/MajorUpdatePopup.js.map +1 -1
- package/dist/cjs/components/feature-announcements/MinorUpdatePopup.js +1 -1
- package/dist/cjs/components/feature-announcements/MinorUpdatePopup.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/editor/extensions/htmlTagStrip/HtmlTagStripExtension.js +2 -0
- package/dist/cjs/editor/extensions/htmlTagStrip/HtmlTagStripExtension.js.map +1 -0
- package/dist/cjs/helpers/sanitize.js +2 -0
- package/dist/cjs/helpers/sanitize.js.map +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditor.js +144 -143
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditor.js.map +1 -1
- package/dist/esm/components/agent-builder/components/AiTextArea.js +24 -23
- package/dist/esm/components/agent-builder/components/AiTextArea.js.map +1 -1
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.js +38 -37
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.js.map +1 -1
- package/dist/esm/components/bik-chatbot/components/ChatWindow.js +54 -53
- package/dist/esm/components/bik-chatbot/components/ChatWindow.js.map +1 -1
- package/dist/esm/components/feature-announcements/FeatureAnnouncementProvider.js +346 -420
- package/dist/esm/components/feature-announcements/FeatureAnnouncementProvider.js.map +1 -1
- package/dist/esm/components/feature-announcements/MajorUpdatePopup.js +35 -33
- package/dist/esm/components/feature-announcements/MajorUpdatePopup.js.map +1 -1
- package/dist/esm/components/feature-announcements/MinorUpdatePopup.js +48 -47
- package/dist/esm/components/feature-announcements/MinorUpdatePopup.js.map +1 -1
- package/dist/esm/components/feature-announcements/types/props.types.d.ts +2 -2
- package/dist/esm/components/input/ChipInput.js +41 -40
- package/dist/esm/components/input/ChipInput.js.map +1 -1
- package/dist/esm/components/input/Input-helper.d.ts +7 -0
- package/dist/esm/components/input/Input-helper.js +16 -25
- package/dist/esm/components/input/Input-helper.js.map +1 -1
- package/dist/esm/components/input/Input.js +59 -57
- package/dist/esm/components/input/Input.js.map +1 -1
- package/dist/esm/components/input/Input.model.d.ts +1 -0
- package/dist/esm/components/plans/SubscriptionPlanSelector.js +42 -40
- package/dist/esm/components/plans/SubscriptionPlanSelector.js.map +1 -1
- package/dist/esm/editor/BikEditor.js +221 -217
- 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 +141 -140
- package/dist/esm/editor/BikEditor.utils.js.map +1 -1
- package/dist/esm/editor/extensions/buildExtensions.js +35 -25
- package/dist/esm/editor/extensions/buildExtensions.js.map +1 -1
- package/dist/esm/editor/extensions/htmlTagStrip/HtmlTagStripExtension.d.ts +13 -0
- package/dist/esm/editor/extensions/htmlTagStrip/HtmlTagStripExtension.js +64 -0
- package/dist/esm/editor/extensions/htmlTagStrip/HtmlTagStripExtension.js.map +1 -0
- package/dist/esm/helpers/index.d.ts +1 -0
- package/dist/esm/helpers/sanitize.d.ts +32 -0
- package/dist/esm/helpers/sanitize.js +207 -0
- package/dist/esm/helpers/sanitize.js.map +1 -0
- package/dist/esm/icons/index.d.ts +25 -25
- package/dist/esm/index.js +125 -115
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),A=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),A=require("../../../helpers/sanitize.js"),T=require("react"),o=require("../../TypographyStyle.js"),i=require("../../../constants/Theme.js"),t=require("../AgentBuilder.styled.js"),j=({label:l,value:r,onChange:c,maxLength:s,placeholder:a,minHeight:u,disabled:d,...x})=>{const[h,n]=T.useState(!1);return e.jsxs(t.FieldBlock,{children:[e.jsxs(t.FieldLabelRow,{children:[e.jsx(o.TitleSmall,{color:i.COLORS.content.primary,children:l}),e.jsxs(o.BodyCaption,{color:i.COLORS.content.secondary,children:[r.length,"/",s]})]}),e.jsx(t.AiTextAreaShell,{focused:h,minHeight:u,children:e.jsx(t.AiTextAreaInput,{"data-test":x["data-test"],value:r,placeholder:a,maxLength:s,disabled:d,onFocus:()=>n(!0),onBlur:()=>n(!1),onChange:y=>c(A.stripHtmlTags(y.target.value))})})]})};exports.AiTextArea=j;
|
|
2
2
|
//# sourceMappingURL=AiTextArea.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiTextArea.js","sources":["../../../../../src/components/agent-builder/components/AiTextArea.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { BodyCaption, TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tAiTextAreaInput,\n\tAiTextAreaShell,\n\tFieldBlock,\n\tFieldLabelRow,\n} from '../AgentBuilder.styled';\n\ninterface AiTextAreaProps {\n\tlabel: string;\n\tvalue: string;\n\tonChange: (value: string) => void;\n\tmaxLength: number;\n\tplaceholder?: string;\n\tminHeight?: string;\n\tdisabled?: boolean;\n\t'data-test'?: string;\n}\n\n/** Labelled textarea with a live character counter. */\nexport const AiTextArea: React.FC<AiTextAreaProps> = ({\n\tlabel,\n\tvalue,\n\tonChange,\n\tmaxLength,\n\tplaceholder,\n\tminHeight,\n\tdisabled,\n\t...rest\n}) => {\n\tconst [focused, setFocused] = useState(false);\n\n\treturn (\n\t\t<FieldBlock>\n\t\t\t<FieldLabelRow>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>{label}</TitleSmall>\n\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t{value.length}/{maxLength}\n\t\t\t\t</BodyCaption>\n\t\t\t</FieldLabelRow>\n\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\tdisabled={disabled}\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</AiTextAreaShell>\n\t\t</FieldBlock>\n\t);\n};\n"],"names":["AiTextArea","label","value","onChange","maxLength","placeholder","minHeight","disabled","rest","focused","setFocused","useState","FieldBlock","jsxs","FieldLabelRow","jsx","TitleSmall","COLORS","BodyCaption","AiTextAreaShell","AiTextAreaInput","e"],"mappings":"
|
|
1
|
+
{"version":3,"file":"AiTextArea.js","sources":["../../../../../src/components/agent-builder/components/AiTextArea.tsx"],"sourcesContent":["import { stripHtmlTags } from '@src/helpers/sanitize';\nimport React, { useState } from 'react';\nimport { BodyCaption, TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tAiTextAreaInput,\n\tAiTextAreaShell,\n\tFieldBlock,\n\tFieldLabelRow,\n} from '../AgentBuilder.styled';\n\ninterface AiTextAreaProps {\n\tlabel: string;\n\tvalue: string;\n\tonChange: (value: string) => void;\n\tmaxLength: number;\n\tplaceholder?: string;\n\tminHeight?: string;\n\tdisabled?: boolean;\n\t'data-test'?: string;\n}\n\n/** Labelled textarea with a live character counter. */\nexport const AiTextArea: React.FC<AiTextAreaProps> = ({\n\tlabel,\n\tvalue,\n\tonChange,\n\tmaxLength,\n\tplaceholder,\n\tminHeight,\n\tdisabled,\n\t...rest\n}) => {\n\tconst [focused, setFocused] = useState(false);\n\n\treturn (\n\t\t<FieldBlock>\n\t\t\t<FieldLabelRow>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>{label}</TitleSmall>\n\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t{value.length}/{maxLength}\n\t\t\t\t</BodyCaption>\n\t\t\t</FieldLabelRow>\n\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\tdisabled={disabled}\n\t\t\t\t\tonFocus={() => setFocused(true)}\n\t\t\t\t\tonBlur={() => setFocused(false)}\n\t\t\t\t\tonChange={(e) => onChange(stripHtmlTags(e.target.value))}\n\t\t\t\t/>\n\t\t\t</AiTextAreaShell>\n\t\t</FieldBlock>\n\t);\n};\n"],"names":["AiTextArea","label","value","onChange","maxLength","placeholder","minHeight","disabled","rest","focused","setFocused","useState","FieldBlock","jsxs","FieldLabelRow","jsx","TitleSmall","COLORS","BodyCaption","AiTextAreaShell","AiTextAreaInput","e","stripHtmlTags"],"mappings":"wSAuBaA,EAAwC,CAAC,CACrD,MAAAC,EACA,MAAAC,EACA,SAAAC,EACA,UAAAC,EACA,YAAAC,EACA,UAAAC,EACA,SAAAC,EACA,GAAGC,CACJ,IAAM,CACL,KAAM,CAACC,EAASC,CAAU,EAAIC,EAAAA,SAAS,EAAK,EAE5C,cACEC,aAAA,CACA,SAAA,CAAAC,OAACC,EAAAA,cAAA,CACA,SAAA,CAAAC,MAACC,EAAAA,WAAA,CAAW,MAAOC,EAAAA,OAAO,QAAQ,QAAU,SAAAhB,EAAM,EAClDY,EAAAA,KAACK,EAAAA,YAAA,CAAY,MAAOD,EAAAA,OAAO,QAAQ,UACjC,SAAA,CAAAf,EAAM,OAAO,IAAEE,CAAA,CAAA,CACjB,CAAA,EACD,EAEAW,EAAAA,IAACI,EAAAA,gBAAA,CAAgB,QAAAV,EAAkB,UAAAH,EAClC,SAAAS,EAAAA,IAACK,EAAAA,gBAAA,CACA,YAAWZ,EAAK,WAAW,EAC3B,MAAAN,EACA,YAAAG,EACA,UAAAD,EACA,SAAAG,EACA,QAAS,IAAMG,EAAW,EAAI,EAC9B,OAAQ,IAAMA,EAAW,EAAK,EAC9B,SAAWW,GAAMlB,EAASmB,EAAAA,cAAcD,EAAE,OAAO,KAAK,CAAC,CAAA,CAAA,CACxD,CACD,CAAA,EACD,CAEF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),S=require("../../../helpers/sanitize.js"),l=require("react"),I=require("styled-components"),A=require("../../TypographyStyle.js"),B=require("../../../constants/Theme.js"),c=require("../AgentBuilder.styled.js"),b=require("./MentionEditor.js"),v=require("../../button/Button.js"),E=require("../../../icons/BIK AI specific/WandSparkles.js"),F=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},w=F(I),R=({label:t,value:o,onChange:s,maxLength:d,placeholder:u,minHeight:p="120px",onImprove:i,variablesData:f,...n})=>{const[h,m]=l.useState(!1),[r,y]=l.useState(!1),[T,j]=l.useState(0),x=(f?.length??0)>0,q=async()=>{if(!(!i||r||o.trim().length===0)){y(!0);try{s(await i(o)),x&&j(a=>a+1)}finally{y(!1)}}},g=i?e.jsx(_,{children:e.jsx(v.Button,{"data-test":`${n["data-test"]??"tool"}-improve`,buttonType:"ai",size:"small",LeadingIcon:E.default,buttonText:"Improve with AI",isLoading:r,disabled:r||o.trim().length===0,onClick:q})}):void 0;return x?e.jsx(b.MentionEditor,{"data-test":n["data-test"],label:t,value:o,onChange:s,maxLength:d,placeholder:u,minHeight:p,resetKey:`improve-${T}`,mentionItems:[],tools:[],variablesData:f,addDataButton:!0,action:g}):e.jsxs(c.FieldBlock,{children:[e.jsx(A.TitleSmall,{color:B.COLORS.content.primary,children:t}),e.jsxs(c.AiTextAreaShell,{focused:h,minHeight:p,children:[e.jsx(c.AiTextAreaInput,{"data-test":n["data-test"],value:o,placeholder:u,maxLength:d,onFocus:()=>m(!0),onBlur:()=>m(!1),onChange:a=>s(S.stripHtmlTags(a.target.value))}),g]})]})},_=w.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
|
-
`;exports.ToolInstructionsField=
|
|
4
|
+
`;exports.ToolInstructionsField=R;
|
|
5
5
|
//# sourceMappingURL=ToolInstructionsField.js.map
|
|
@@ -1 +1 @@
|
|
|
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 type { VariableListInterfaceV3 } from '../../variable-picker-v3/model';\nimport {\n\tAiTextAreaInput,\n\tAiTextAreaShell,\n\tFieldBlock,\n} from '../AgentBuilder.styled';\nimport { MentionEditor } from './MentionEditor';\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/**\n\t * Variable catalog. When non-empty the field upgrades from a plain textarea\n\t * to a variables-only `@` mention editor: typing `@` opens the variable\n\t * categories directly (Variables is the sole category, so the picker skips\n\t * the Tools / Sub-agent root), and picks render as chips persisted as\n\t * `{{variable:<name>}}` tokens.\n\t */\n\tvariablesData?: VariableListInterfaceV3[];\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\tvariablesData,\n\t...rest\n}) => {\n\tconst [focused, setFocused] = useState(false);\n\tconst [improving, setImproving] = useState(false);\n\t// Bumped when \"Improve with AI\" replaces the text externally — the mention\n\t// editor only reads `value` on (re)mount, so it must be remounted.\n\tconst [editorEpoch, setEditorEpoch] = useState(0);\n\n\tconst withVariables = (variablesData?.length ?? 0) > 0;\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\tif (withVariables) {\n\t\t\t\tsetEditorEpoch((e) => e + 1);\n\t\t\t}\n\t\t} finally {\n\t\t\tsetImproving(false);\n\t\t}\n\t};\n\n\tconst improveAction = onImprove ? (\n\t\t<ImproveRow>\n\t\t\t<Button\n\t\t\t\tdata-test={`${rest['data-test'] ?? 'tool'}-improve`}\n\t\t\t\tbuttonType=\"ai\"\n\t\t\t\tsize=\"small\"\n\t\t\t\tLeadingIcon={WandSparkles}\n\t\t\t\tbuttonText=\"Improve with AI\"\n\t\t\t\tisLoading={improving}\n\t\t\t\tdisabled={improving || value.trim().length === 0}\n\t\t\t\tonClick={handleImprove}\n\t\t\t/>\n\t\t</ImproveRow>\n\t) : undefined;\n\n\t// Variables enabled → the mention-editor variant. `mentionItems` / tool\n\t// hooks stay empty so Variables is the picker's ONLY category and `@` lands\n\t// straight in the variable list.\n\tif (withVariables) {\n\t\treturn (\n\t\t\t<MentionEditor\n\t\t\t\tdata-test={rest['data-test']}\n\t\t\t\tlabel={label}\n\t\t\t\tvalue={value}\n\t\t\t\tonChange={onChange}\n\t\t\t\tmaxLength={maxLength}\n\t\t\t\tplaceholder={placeholder}\n\t\t\t\tminHeight={minHeight}\n\t\t\t\tresetKey={`improve-${editorEpoch}`}\n\t\t\t\tmentionItems={[]}\n\t\t\t\ttools={[]}\n\t\t\t\tvariablesData={variablesData}\n\t\t\t\t// Drawers get the same focused-field \"+ Add data\" affordance as the\n\t\t\t\t// main Step-3 editors.\n\t\t\t\taddDataButton\n\t\t\t\taction={improveAction}\n\t\t\t/>\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{improveAction}\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","variablesData","rest","focused","setFocused","useState","improving","setImproving","editorEpoch","setEditorEpoch","withVariables","handleImprove","e","improveAction","jsx","ImproveRow","Button","WandSparkles","MentionEditor","FieldBlock","TitleSmall","COLORS","jsxs","AiTextAreaShell","AiTextAreaInput","styled"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ToolInstructionsField.js","sources":["../../../../../src/components/agent-builder/components/ToolInstructionsField.tsx"],"sourcesContent":["import { stripHtmlTags } from '@src/helpers/sanitize';\nimport { 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 type { VariableListInterfaceV3 } from '../../variable-picker-v3/model';\nimport {\n\tAiTextAreaInput,\n\tAiTextAreaShell,\n\tFieldBlock,\n} from '../AgentBuilder.styled';\nimport { MentionEditor } from './MentionEditor';\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/**\n\t * Variable catalog. When non-empty the field upgrades from a plain textarea\n\t * to a variables-only `@` mention editor: typing `@` opens the variable\n\t * categories directly (Variables is the sole category, so the picker skips\n\t * the Tools / Sub-agent root), and picks render as chips persisted as\n\t * `{{variable:<name>}}` tokens.\n\t */\n\tvariablesData?: VariableListInterfaceV3[];\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\tvariablesData,\n\t...rest\n}) => {\n\tconst [focused, setFocused] = useState(false);\n\tconst [improving, setImproving] = useState(false);\n\t// Bumped when \"Improve with AI\" replaces the text externally — the mention\n\t// editor only reads `value` on (re)mount, so it must be remounted.\n\tconst [editorEpoch, setEditorEpoch] = useState(0);\n\n\tconst withVariables = (variablesData?.length ?? 0) > 0;\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\tif (withVariables) {\n\t\t\t\tsetEditorEpoch((e) => e + 1);\n\t\t\t}\n\t\t} finally {\n\t\t\tsetImproving(false);\n\t\t}\n\t};\n\n\tconst improveAction = onImprove ? (\n\t\t<ImproveRow>\n\t\t\t<Button\n\t\t\t\tdata-test={`${rest['data-test'] ?? 'tool'}-improve`}\n\t\t\t\tbuttonType=\"ai\"\n\t\t\t\tsize=\"small\"\n\t\t\t\tLeadingIcon={WandSparkles}\n\t\t\t\tbuttonText=\"Improve with AI\"\n\t\t\t\tisLoading={improving}\n\t\t\t\tdisabled={improving || value.trim().length === 0}\n\t\t\t\tonClick={handleImprove}\n\t\t\t/>\n\t\t</ImproveRow>\n\t) : undefined;\n\n\t// Variables enabled → the mention-editor variant. `mentionItems` / tool\n\t// hooks stay empty so Variables is the picker's ONLY category and `@` lands\n\t// straight in the variable list.\n\tif (withVariables) {\n\t\treturn (\n\t\t\t<MentionEditor\n\t\t\t\tdata-test={rest['data-test']}\n\t\t\t\tlabel={label}\n\t\t\t\tvalue={value}\n\t\t\t\tonChange={onChange}\n\t\t\t\tmaxLength={maxLength}\n\t\t\t\tplaceholder={placeholder}\n\t\t\t\tminHeight={minHeight}\n\t\t\t\tresetKey={`improve-${editorEpoch}`}\n\t\t\t\tmentionItems={[]}\n\t\t\t\ttools={[]}\n\t\t\t\tvariablesData={variablesData}\n\t\t\t\t// Drawers get the same focused-field \"+ Add data\" affordance as the\n\t\t\t\t// main Step-3 editors.\n\t\t\t\taddDataButton\n\t\t\t\taction={improveAction}\n\t\t\t/>\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(stripHtmlTags(e.target.value))}\n\t\t\t\t/>\n\t\t\t\t{improveAction}\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","variablesData","rest","focused","setFocused","useState","improving","setImproving","editorEpoch","setEditorEpoch","withVariables","handleImprove","e","improveAction","jsx","ImproveRow","Button","WandSparkles","MentionEditor","FieldBlock","TitleSmall","COLORS","jsxs","AiTextAreaShell","AiTextAreaInput","stripHtmlTags","styled"],"mappings":"sgBAwCaA,EAA8D,CAAC,CAC3E,MAAAC,EACA,MAAAC,EACA,SAAAC,EACA,UAAAC,EACA,YAAAC,EACA,UAAAC,EAAY,QACZ,UAAAC,EACA,cAAAC,EACA,GAAGC,CACJ,IAAM,CACL,KAAM,CAACC,EAASC,CAAU,EAAIC,EAAAA,SAAS,EAAK,EACtC,CAACC,EAAWC,CAAY,EAAIF,EAAAA,SAAS,EAAK,EAG1C,CAACG,EAAaC,CAAc,EAAIJ,EAAAA,SAAS,CAAC,EAE1CK,GAAiBT,GAAe,QAAU,GAAK,EAE/CU,EAAgB,SAAY,CACjC,GAAI,GAACX,GAAaM,GAAaX,EAAM,KAAA,EAAO,SAAW,GAGvD,CAAAY,EAAa,EAAI,EACjB,GAAI,CACHX,EAAS,MAAMI,EAAUL,CAAK,CAAC,EAC3Be,GACHD,EAAgBG,GAAMA,EAAI,CAAC,CAE7B,QAAA,CACCL,EAAa,EAAK,CACnB,EACD,EAEMM,EAAgBb,EACrBc,EAAAA,IAACC,EAAA,CACA,SAAAD,EAAAA,IAACE,EAAAA,OAAA,CACA,YAAW,GAAGd,EAAK,WAAW,GAAK,MAAM,WACzC,WAAW,KACX,KAAK,QACL,YAAae,EAAAA,QACb,WAAW,kBACX,UAAWX,EACX,SAAUA,GAAaX,EAAM,KAAA,EAAO,SAAW,EAC/C,QAASgB,CAAA,CAAA,EAEX,EACG,OAKJ,OAAID,EAEFI,EAAAA,IAACI,EAAAA,cAAA,CACA,YAAWhB,EAAK,WAAW,EAC3B,MAAAR,EACA,MAAAC,EACA,SAAAC,EACA,UAAAC,EACA,YAAAC,EACA,UAAAC,EACA,SAAU,WAAWS,CAAW,GAChC,aAAc,CAAA,EACd,MAAO,CAAA,EACP,cAAAP,EAGA,cAAa,GACb,OAAQY,CAAA,CAAA,SAMTM,aAAA,CACA,SAAA,CAAAL,MAACM,EAAAA,WAAA,CAAW,MAAOC,EAAAA,OAAO,QAAQ,QAAU,SAAA3B,EAAM,EAClD4B,EAAAA,KAACC,EAAAA,gBAAA,CAAgB,QAAApB,EAAkB,UAAAJ,EAClC,SAAA,CAAAe,EAAAA,IAACU,EAAAA,gBAAA,CACA,YAAWtB,EAAK,WAAW,EAC3B,MAAAP,EACA,YAAAG,EACA,UAAAD,EACA,QAAS,IAAMO,EAAW,EAAI,EAC9B,OAAQ,IAAMA,EAAW,EAAK,EAC9B,SAAWQ,GAAMhB,EAAS6B,EAAAA,cAAcb,EAAE,OAAO,KAAK,CAAC,CAAA,CAAA,EAEvDC,CAAA,CAAA,CACF,CAAA,EACD,CAEF,EAEME,EAAaW,EAAAA,QAAO;AAAA;AAAA;AAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),H=require("../../../assets/icons/Ai_event_generating.svg.js"),G=require("../../../helpers/sanitize.js"),o=require("react"),L=require("styled-components"),F=require("../../TypographyStyle.js"),V=require("../utils/markdown.js"),W=require("./ThinkingIndicator.js"),K=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},n=K(L),P=n.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
width: 100%;
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
`;default:return`
|
|
19
19
|
background: white;
|
|
20
20
|
`}}}
|
|
21
|
-
`,
|
|
21
|
+
`,E=n.default.div`
|
|
22
22
|
padding: 16px;
|
|
23
23
|
border-bottom: 1px solid #e5e7eb;
|
|
24
24
|
display: flex;
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
font-weight: 500;
|
|
33
33
|
color: #374151;
|
|
34
34
|
}
|
|
35
|
-
`,
|
|
35
|
+
`,N=n.default.div`
|
|
36
36
|
flex: 1;
|
|
37
37
|
display: flex;
|
|
38
38
|
flex-direction: column;
|
|
39
39
|
overflow: hidden;
|
|
40
40
|
min-height: 0;
|
|
41
|
-
`,
|
|
41
|
+
`,O=n.default.div`
|
|
42
42
|
flex: 1;
|
|
43
43
|
overflow-y: auto;
|
|
44
44
|
padding: 16px;
|
|
@@ -67,13 +67,13 @@
|
|
|
67
67
|
&::-webkit-scrollbar-thumb:hover {
|
|
68
68
|
background: #a8a8a8;
|
|
69
69
|
}
|
|
70
|
-
`,
|
|
70
|
+
`,J=n.default.div`
|
|
71
71
|
background: white;
|
|
72
72
|
border-radius: 12px;
|
|
73
73
|
padding: 16px;
|
|
74
74
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
75
75
|
border: 1px solid #e5e7eb;
|
|
76
|
-
`,
|
|
76
|
+
`,Q=n.default.div`
|
|
77
77
|
width: 100%;
|
|
78
78
|
height: 180px;
|
|
79
79
|
background: #f3f4f6;
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
justify-content: center;
|
|
84
84
|
position: relative;
|
|
85
85
|
margin-bottom: 12px;
|
|
86
|
-
`,
|
|
86
|
+
`,U=n.default.div`
|
|
87
87
|
width: 48px;
|
|
88
88
|
height: 48px;
|
|
89
89
|
background: rgba(0, 0, 0, 0.7);
|
|
@@ -105,11 +105,11 @@
|
|
|
105
105
|
fill: white;
|
|
106
106
|
margin-left: 2px;
|
|
107
107
|
}
|
|
108
|
-
`,
|
|
108
|
+
`,X=n.default.div`
|
|
109
109
|
font-size: 14px;
|
|
110
110
|
color: #374151;
|
|
111
111
|
line-height: 1.5;
|
|
112
|
-
`,
|
|
112
|
+
`,Y=n.default.div`
|
|
113
113
|
padding: 12px 16px;
|
|
114
114
|
border-radius: 16px;
|
|
115
115
|
font-size: 14px;
|
|
@@ -145,15 +145,15 @@
|
|
|
145
145
|
border-bottom-left-radius: 4px;
|
|
146
146
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
|
147
147
|
`}
|
|
148
|
-
`,
|
|
148
|
+
`,Z=n.default.div`
|
|
149
149
|
padding: 16px;
|
|
150
150
|
flex-shrink: 0;
|
|
151
|
-
`,
|
|
151
|
+
`,ee=n.default.div`
|
|
152
152
|
display: flex;
|
|
153
153
|
flex-direction: column;
|
|
154
154
|
gap: 8px;
|
|
155
155
|
align-items: flex-end;
|
|
156
|
-
`,
|
|
156
|
+
`,te=n.default.button`
|
|
157
157
|
border: 1px dotted #febad2;
|
|
158
158
|
background: linear-gradient(
|
|
159
159
|
92.69deg,
|
|
@@ -182,14 +182,14 @@
|
|
|
182
182
|
&:active:not(:disabled) {
|
|
183
183
|
transform: scale(0.98);
|
|
184
184
|
}
|
|
185
|
-
`,
|
|
185
|
+
`,ie=n.default.div`
|
|
186
186
|
padding: 16px;
|
|
187
187
|
background: white;
|
|
188
|
-
`,
|
|
188
|
+
`,ne=n.default.div`
|
|
189
189
|
display: flex;
|
|
190
190
|
flex-direction: column;
|
|
191
191
|
gap: 8px;
|
|
192
|
-
`,
|
|
192
|
+
`,re=n.default.button`
|
|
193
193
|
background: #fef2f2;
|
|
194
194
|
color: #dc2626;
|
|
195
195
|
padding: 12px 16px;
|
|
@@ -209,14 +209,14 @@
|
|
|
209
209
|
&:active:not(:disabled) {
|
|
210
210
|
transform: scale(0.98);
|
|
211
211
|
}
|
|
212
|
-
`,
|
|
212
|
+
`,ae=n.default.div`
|
|
213
213
|
padding: 16px;
|
|
214
214
|
flex-shrink: 0;
|
|
215
|
-
`,
|
|
215
|
+
`,oe=n.default.div`
|
|
216
216
|
position: relative;
|
|
217
217
|
display: flex;
|
|
218
218
|
width: 100%;
|
|
219
|
-
`,
|
|
219
|
+
`,de=n.default.textarea`
|
|
220
220
|
flex: 1;
|
|
221
221
|
border: 1px solid ${e=>e.hasText?"#3b82f6":"#d1d5db"};
|
|
222
222
|
border-radius: 12px;
|
|
@@ -243,7 +243,7 @@
|
|
|
243
243
|
&::placeholder {
|
|
244
244
|
color: #9ca3af;
|
|
245
245
|
}
|
|
246
|
-
`,
|
|
246
|
+
`,le=n.default.button`
|
|
247
247
|
position: absolute;
|
|
248
248
|
bottom: 10px;
|
|
249
249
|
right: 10px;
|
|
@@ -284,5 +284,5 @@
|
|
|
284
284
|
-webkit-text-fill-color: transparent;
|
|
285
285
|
background-clip: text;
|
|
286
286
|
display: inline-block;
|
|
287
|
-
`,
|
|
287
|
+
`,se=({messages:e,onSend:u,header:S="Create with AI",placeholder:T="Discover the right event & launch campaigns for better conversions...",suggestions:g=["Top festivals for marketing","Top events this week?","Top August festivals near you"],iceBreakers:h,videoStarter:l,disabled:I=!1,isThinking:s=!1,onIceBreakerClick:$,chatState:b,chatWindowHeight:z,inputDisabled:M=!1})=>{const[a,w]=o.useState(""),[c,k]=o.useState(!1),[B,_]=o.useState(!1),m=o.useRef(null),v=o.useRef(null),p=c||s,r=I||M,d=b||(c||s?"thinking":B&&a.trim().length>0?"typing":e.length===0?"conversation-starter":e.length>0?"conversation":"default"),y=()=>{!a.trim()||r||p||(u(a),w(""),k(!0),setTimeout(()=>k(!1),1500))},q=i=>{r||i.key==="Enter"&&!i.shiftKey&&(i.preventDefault(),!p&&a.trim()&&y())},A=i=>{if(r)return;const j=G.stripHtmlTags(i.target.value);w(j),_(j.trim().length>0);const x=v.current;x&&(x.style.height="auto",x.style.height=`${Math.min(x.scrollHeight,117)}px`)},f=a.trim().length>0,D=r||p||!f;o.useEffect(()=>{m.current?.scrollIntoView({behavior:"smooth"})},[e,c,s]);const R=z||"100%";return t.jsxs(P,{chatState:d,style:{height:R},children:[t.jsxs(E,{children:[t.jsx(H.default,{height:24,width:24}),t.jsx("div",{className:"header-text",children:S})]}),t.jsxs(N,{children:[t.jsxs(O,{children:[d==="conversation-starter"&&l&&t.jsxs(J,{children:[t.jsx(Q,{children:t.jsx(U,{onClick:l.onPlay,children:t.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:t.jsx("path",{d:"M8 5v14l11-7z"})})})}),t.jsxs(X,{children:[t.jsx(F.BodySecondary,{style:{fontWeight:500,marginBottom:"4px"},children:l.title}),t.jsx(F.BodyCaption,{children:l.description})]})]}),e.map(i=>t.jsx(Y,{role:i.role,children:i.role==="assistant"?t.jsx("div",{dangerouslySetInnerHTML:{__html:V.renderMarkdownLite(i.content)}}):t.jsx("div",{style:{whiteSpace:"pre-wrap"},children:i.content})},i.id)),(c||s)&&t.jsx(W.default,{}),t.jsx("div",{ref:m})]}),h&&d==="conversation-starter"&&t.jsx(Z,{children:t.jsx(ee,{children:h.map(i=>t.jsx(te,{disabled:r,onClick:()=>{r||($?.(i),u(i.text))},children:t.jsx(C,{children:i.text})},i.id))})}),!h&&g.length>0&&d==="default"&&t.jsx(ie,{children:t.jsx(ne,{children:g.map(i=>t.jsx(re,{disabled:r,onClick:()=>!r&&u(i),children:i},i))})}),t.jsx(ae,{children:t.jsxs(oe,{children:[t.jsx(de,{ref:v,value:a,onChange:A,placeholder:T,onKeyDown:q,disabled:r,hasText:f,chatState:d}),t.jsx(le,{onClick:y,disabled:D,hasText:f,"aria-label":"Send",children:t.jsxs("svg",{viewBox:"0 0 24 24",width:"20",height:"20",stroke:"white",strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M6 12h12"}),t.jsx("path",{d:"M12 6l6 6-6 6"})]})})]})})]})]})};exports.CustomGradientText=C;exports.default=se;
|
|
288
288
|
//# sourceMappingURL=ChatWindow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatWindow.js","sources":["../../../../../src/components/bik-chatbot/components/ChatWindow.tsx"],"sourcesContent":["import AiIcon from '@src/assets/icons/Ai_event_generating.svg';\nimport React, { useEffect, useRef, useState } from 'react';\nimport styled from 'styled-components';\nimport { BodyCaption, BodySecondary } from '@src/components/TypographyStyle';\nimport { ChatState, ChatWindowProps } from '../types';\nimport { renderMarkdownLite } from '../utils/markdown';\nimport ThinkingIndicator from './ThinkingIndicator';\n\n// Single-column layout container\nconst ChatContainer = styled.div<{ chatState: ChatState }>`\n\tdisplay: flex;\n\tflex-direction: column;\n\twidth: 100%;\n\tmin-width: 0;\n\tmin-height: 0;\n\theight: 100%;\n\tmax-height: 100%;\n\tbackground: white;\n\tborder-left: 1px solid #e5e7eb;\n\tposition: relative;\n\n\t/* State-based styling */\n\t${(props) => {\n\t\tswitch (props.chatState) {\n\t\t\tcase 'conversation-starter':\n\t\t\t\treturn `\n background: linear-gradient(180deg, #FFF6F9 0%, #FFFFFF 100%);\n `;\n\t\t\tcase 'thinking':\n\t\t\t\treturn `\n background: linear-gradient(180deg, #F8F9FA 0%, #FFFFFF 100%);\n `;\n\t\t\tdefault:\n\t\t\t\treturn `\n background: white;\n `;\n\t\t}\n\t}}\n`;\n\nconst Header = styled.div`\n\tpadding: 16px;\n\tborder-bottom: 1px solid #e5e7eb;\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tbackground: white;\n\tflex-shrink: 0;\n\n\t.header-text {\n\t\tfont-size: 14px;\n\t\tfont-weight: 500;\n\t\tcolor: #374151;\n\t}\n`;\n\n// Main content area - single column\nconst MainContent = styled.div`\n\tflex: 1;\n\tdisplay: flex;\n\tflex-direction: column;\n\toverflow: hidden;\n\tmin-height: 0;\n`;\n\nconst MessagesWrapper = styled.div`\n\tflex: 1;\n\toverflow-y: auto;\n\tpadding: 16px;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 16px;\n\tbackground: #fafafa;\n\tscroll-behavior: smooth;\n\tmin-height: 0;\n\n\t/* Custom scrollbar */\n\t&::-webkit-scrollbar {\n\t\twidth: 6px;\n\t}\n\n\t&::-webkit-scrollbar-track {\n\t\tbackground: #f1f1f1;\n\t\tborder-radius: 3px;\n\t}\n\n\t&::-webkit-scrollbar-thumb {\n\t\tbackground: #c1c1c1;\n\t\tborder-radius: 3px;\n\t}\n\n\t&::-webkit-scrollbar-thumb:hover {\n\t\tbackground: #a8a8a8;\n\t}\n`;\n\nconst VideoCard = styled.div`\n\tbackground: white;\n\tborder-radius: 12px;\n\tpadding: 16px;\n\tbox-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n\tborder: 1px solid #e5e7eb;\n`;\n\nconst VideoContainer = styled.div`\n\twidth: 100%;\n\theight: 180px;\n\tbackground: #f3f4f6;\n\tborder-radius: 8px;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tposition: relative;\n\tmargin-bottom: 12px;\n`;\n\nconst PlayButton = styled.div`\n\twidth: 48px;\n\theight: 48px;\n\tbackground: rgba(0, 0, 0, 0.7);\n\tborder-radius: 50%;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tcursor: pointer;\n\ttransition: all 0.2s ease;\n\n\t&:hover {\n\t\tbackground: rgba(0, 0, 0, 0.8);\n\t\ttransform: scale(1.05);\n\t}\n\n\tsvg {\n\t\twidth: 16px;\n\t\theight: 16px;\n\t\tfill: white;\n\t\tmargin-left: 2px;\n\t}\n`;\n\nconst VideoText = styled.div`\n\tfont-size: 14px;\n\tcolor: #374151;\n\tline-height: 1.5;\n`;\n\nconst Bubble = styled.div<{ role: 'user' | 'assistant' | 'system' }>`\n\tpadding: 12px 16px;\n\tborder-radius: 16px;\n\tfont-size: 14px;\n\tmax-width: 80%;\n\twhite-space: pre-line;\n\tword-wrap: break-word;\n\n\t${(props) =>\n\t\tprops.role === 'user'\n\t\t\t? `\n background: linear-gradient(92.69deg, rgba(255, 230, 238, 0.5) 0.37%, rgba(255, 240, 231, 0.5) 100%);\n margin-left: auto;\n border-bottom-right-radius: 4px;\n \n & > div {\n background: linear-gradient(92.69deg, #FF166A 0.37%, #FB5F08 100%);\n -webkit-background-clip: text;\n -webkit-text-fill-color: transparent;\n background-clip: text;\n display: inline-block;\n }\n `\n\t\t\t: props.role === 'system'\n\t\t\t? `\n background: #f3f4f6;\n color: #6b7280;\n font-size: 12px;\n font-style: italic;\n text-align: center;\n margin: 0 auto;\n max-width: 90%;\n `\n\t\t\t: `\n background: white;\n color: #111827;\n border: 1px solid #e5e7eb;\n margin-right: auto;\n border-bottom-left-radius: 4px;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);\n `}\n`;\n\n// Ice breakers section - at the bottom before input\nconst IceBreakersSection = styled.div`\n\tpadding: 16px;\n\tflex-shrink: 0;\n`;\n\nconst IceBreakersGrid = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\talign-items: flex-end;\n`;\n\nconst IceBreakerChip = styled.button<{ disabled?: boolean }>`\n\tborder: 1px dotted #febad2;\n\tbackground: linear-gradient(\n\t\t92.69deg,\n\t\trgba(255, 230, 238, 0.5) 0.37%,\n\t\trgba(255, 240, 231, 0.5) 100%\n\t);\n\tpadding: 8px 16px;\n\tborder-radius: 8px;\n\tfont-size: 13px;\n\tcursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};\n\ttransition: all 0.2s ease;\n\ttext-align: left;\n\tmax-width: 280px;\n\talign-self: flex-end;\n\topacity: ${(props) => (props.disabled ? 0.5 : 1)};\n\n\t&:hover:not(:disabled) {\n\t\tbackground: linear-gradient(\n\t\t\t92.69deg,\n\t\t\trgba(255, 230, 238, 0.7) 0.37%,\n\t\t\trgba(255, 240, 231, 0.7) 100%\n\t\t);\n\t\tborder-color: #f472b6;\n\t}\n\n\t&:active:not(:disabled) {\n\t\ttransform: scale(0.98);\n\t}\n`;\n\n// Suggestions section - styled like ice breakers but for regular suggestions\nconst SuggestionsSection = styled.div`\n\tpadding: 16px;\n\tbackground: white;\n`;\n\nconst SuggestionsGrid = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n`;\n\nconst SuggestionChip = styled.button<{ disabled?: boolean }>`\n\tbackground: #fef2f2;\n\tcolor: #dc2626;\n\tpadding: 12px 16px;\n\tborder-radius: 8px;\n\tfont-size: 13px;\n\tborder: 1px solid #fecaca;\n\tcursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};\n\ttransition: all 0.2s ease;\n\ttext-align: left;\n\topacity: ${(props) => (props.disabled ? 0.5 : 1)};\n\n\t&:hover:not(:disabled) {\n\t\tbackground: #fee2e2;\n\t\tborder-color: #fca5a5;\n\t}\n\n\t&:active:not(:disabled) {\n\t\ttransform: scale(0.98);\n\t}\n`;\n\nconst InputContainer = styled.div`\n\tpadding: 16px;\n\tflex-shrink: 0;\n`;\n\nconst InputBubble = styled.div`\n\tposition: relative;\n\tdisplay: flex;\n\twidth: 100%;\n`;\n\nconst TextInput = styled.textarea<{ hasText: boolean; chatState: ChatState }>`\n\tflex: 1;\n\tborder: 1px solid ${(props) => (props.hasText ? '#3b82f6' : '#d1d5db')};\n\tborder-radius: 12px;\n\tpadding: 12px;\n\tpadding-right: 48px;\n\tfont-size: 14px;\n\toutline: none;\n\tcolor: #374151;\n\tbackground: white;\n\tbox-shadow: 0px 2px 8px 0px #0000001f;\n\ttransition: all 0.2s ease;\n\tresize: none;\n\tmin-height: 44px;\n\tmax-height: 120px;\n\tfont-family: inherit;\n\twidth: 100%;\n\n\t&:focus {\n\t\tborder-color: #3b82f6;\n\t\tbackground: white;\n\t\tbox-shadow: 0px 2px 8px 0px #0000001f, 0 0 0 3px rgba(59, 130, 246, 0.1);\n\t}\n\n\t&::placeholder {\n\t\tcolor: #9ca3af;\n\t}\n`;\n\nconst SendButton = styled.button<{ disabled?: boolean; hasText: boolean }>`\n\tposition: absolute;\n\tbottom: 10px;\n\tright: 10px;\n\twidth: 36px;\n\theight: 36px;\n\tborder-radius: 50%;\n\tbackground: ${(props) =>\n\t\tprops.hasText\n\t\t\t? 'linear-gradient(135deg, #FF166A 0%, #FB5F08 100%)'\n\t\t\t: '#e5e7eb'};\n\tborder: none;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tcursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};\n\ttransition: all 0.2s ease;\n\tbox-shadow: 0 2px 8px 0px #fa709a1c;\n\tz-index: 2;\n\n\t&:hover:not(:disabled) {\n\t\tbackground: ${(props) =>\n\t\t\tprops.hasText && !props.disabled\n\t\t\t\t? 'linear-gradient(135deg, #F857A6 0%, #FF5858 100%)'\n\t\t\t\t: '#e5e7eb'};\n\t\ttransform: scale(1.05);\n\t}\n\n\t&:active:not(:disabled) {\n\t\ttransform: scale(0.95);\n\t}\n\n\tsvg {\n\t\twidth: 16px;\n\t\theight: 16px;\n\t\tfill: white;\n\t\tfont-weight: bold;\n\t}\n`;\n\n// Customizable gradient text component\nexport const CustomGradientText = styled.span<{\n\tcolors?: string;\n\tangle?: number;\n}>`\n\tbackground: linear-gradient(\n\t\t${(props) => props.angle || 92.69}deg,\n\t\t${(props) => props.colors || '#ff166a 0.37%, #fb5f08 100%'}\n\t);\n\t-webkit-background-clip: text;\n\t-webkit-text-fill-color: transparent;\n\tbackground-clip: text;\n\tdisplay: inline-block;\n`;\n\n// Export ChatState type for backward compatibility\nexport type { ChatState } from '../types';\n\ninterface ChatWindowWithHeightProps extends ChatWindowProps {\n\tchatWindowHeight?: string | number;\n}\n\nconst ChatWindow: React.FC<ChatWindowWithHeightProps> = ({\n\tmessages,\n\tonSend,\n\theader = 'Create with AI',\n\tplaceholder = 'Discover the right event & launch campaigns for better conversions...',\n\tsuggestions = [\n\t\t'Top festivals for marketing',\n\t\t'Top events this week?',\n\t\t'Top August festivals near you',\n\t],\n\ticeBreakers,\n\tvideoStarter,\n\tdisabled = false,\n\tisThinking = false,\n\tonIceBreakerClick,\n\tchatState,\n\tchatWindowHeight,\n\tinputDisabled = false,\n}) => {\n\tconst [input, setInput] = useState('');\n\tconst [thinking, setThinking] = useState(false);\n\tconst [isTyping, setIsTyping] = useState(false);\n\tconst bottomRef = useRef<HTMLDivElement>(null);\n\tconst textareaRef = useRef<HTMLTextAreaElement>(null);\n\tconst isThinkingState = thinking || isThinking;\n\tconst isInputDisabledState = disabled || inputDisabled;\n\n\t// Determine current chat state\n\tconst getCurrentChatState = (): ChatState => {\n\t\tif (chatState) return chatState; // Explicit state override\n\t\tif (thinking || isThinking) return 'thinking';\n\t\tif (isTyping && input.trim().length > 0) return 'typing';\n\t\tif (messages.length === 0) return 'conversation-starter';\n\t\tif (messages.length > 0) return 'conversation';\n\t\treturn 'default';\n\t};\n\n\tconst currentState = getCurrentChatState();\n\n\t// markdown renderer moved to ../utils/markdown\n\n\tconst handleSend = () => {\n\t\tif (!input.trim() || isInputDisabledState || isThinkingState) return;\n\t\tonSend(input);\n\t\tsetInput('');\n\t\tsetThinking(true);\n\t\tsetTimeout(() => setThinking(false), 1500);\n\t};\n\n\tconst handleKeyDown = (e: React.KeyboardEvent) => {\n\t\tif (isInputDisabledState) return;\n\t\tif (e.key === 'Enter' && !e.shiftKey) {\n\t\t\te.preventDefault();\n\t\t\tif (!isThinkingState && input.trim()) {\n\t\t\t\thandleSend();\n\t\t\t}\n\t\t}\n\t};\n\n\tconst handleInputChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n\t\tif (isInputDisabledState) return;\n\t\tconst value = e.target.value;\n\t\tsetInput(value);\n\t\tsetIsTyping(value.trim().length > 0);\n\n\t\t// Auto-resize textarea\n\t\tconst textarea = textareaRef.current;\n\t\tif (textarea) {\n\t\t\ttextarea.style.height = 'auto';\n\t\t\ttextarea.style.height = `${Math.min(textarea.scrollHeight, 117)}px`;\n\t\t}\n\t};\n\n\tconst hasText = input.trim().length > 0;\n\tconst isSendDisabled = isInputDisabledState || isThinkingState || !hasText;\n\n\tuseEffect(() => {\n\t\tbottomRef.current?.scrollIntoView({ behavior: 'smooth' });\n\t}, [messages, thinking, isThinking]);\n\n\t// Use chatWindowHeight if provided, otherwise use 100% if fullHeight is active\n\tconst containerHeight = chatWindowHeight || '100%';\n\n\treturn (\n\t\t<ChatContainer chatState={currentState} style={{ height: containerHeight }}>\n\t\t\t{/* Header */}\n\t\t\t<Header>\n\t\t\t\t<AiIcon height={24} width={24} />\n\t\t\t\t<div className=\"header-text\">{header}</div>\n\t\t\t</Header>\n\n\t\t\t{/* Main Content - Single Column Layout */}\n\t\t\t<MainContent>\n\t\t\t\t{/* Messages Section */}\n\t\t\t\t<MessagesWrapper>\n\t\t\t\t\t{/* Video starter card - only when no messages and videoStarter provided */}\n\t\t\t\t\t{currentState === 'conversation-starter' && videoStarter && (\n\t\t\t\t\t\t<VideoCard>\n\t\t\t\t\t\t\t<VideoContainer>\n\t\t\t\t\t\t\t\t<PlayButton onClick={videoStarter.onPlay}>\n\t\t\t\t\t\t\t\t\t<svg viewBox=\"0 0 24 24\" fill=\"currentColor\">\n\t\t\t\t\t\t\t\t\t\t<path d=\"M8 5v14l11-7z\" />\n\t\t\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t\t\t</PlayButton>\n\t\t\t\t\t\t\t</VideoContainer>\n\t\t\t\t\t\t\t<VideoText>\n\t\t\t\t\t\t\t\t<BodySecondary style={{ fontWeight: 500, marginBottom: '4px' }}>\n\t\t\t\t\t\t\t\t\t{videoStarter.title}\n\t\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t\t<BodyCaption>{videoStarter.description}</BodyCaption>\n\t\t\t\t\t\t\t</VideoText>\n\t\t\t\t\t\t</VideoCard>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{/* Render messages (assistant supports lite Markdown) */}\n\t\t\t\t\t{messages.map((m) => (\n\t\t\t\t\t\t<Bubble key={m.id} role={m.role}>\n\t\t\t\t\t\t\t{m.role === 'assistant' ? (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t\t\t\t\t\t\t__html: renderMarkdownLite(m.content),\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<div style={{ whiteSpace: 'pre-wrap' }}>{m.content}</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Bubble>\n\t\t\t\t\t))}\n\n\t\t\t\t\t{/* Thinking bubble */}\n\t\t\t\t\t{(thinking || isThinking) && <ThinkingIndicator />}\n\n\t\t\t\t\t<div ref={bottomRef} />\n\t\t\t\t</MessagesWrapper>\n\n\t\t\t\t{/* Ice Breakers Section - At bottom when no messages and ice breakers provided */}\n\t\t\t\t{iceBreakers && currentState === 'conversation-starter' && (\n\t\t\t\t\t<IceBreakersSection>\n\t\t\t\t\t\t<IceBreakersGrid>\n\t\t\t\t\t\t\t{iceBreakers.map((iceBreaker) => (\n\t\t\t\t\t\t\t\t<IceBreakerChip\n\t\t\t\t\t\t\t\t\tkey={iceBreaker.id}\n\t\t\t\t\t\t\t\t\tdisabled={isInputDisabledState}\n\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\tif (!isInputDisabledState) {\n\t\t\t\t\t\t\t\t\t\t\tonIceBreakerClick?.(iceBreaker);\n\t\t\t\t\t\t\t\t\t\t\tonSend(iceBreaker.text);\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\t\t<CustomGradientText>{iceBreaker.text}</CustomGradientText>\n\t\t\t\t\t\t\t\t</IceBreakerChip>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</IceBreakersGrid>\n\t\t\t\t\t</IceBreakersSection>\n\t\t\t\t)}\n\n\t\t\t\t{/* Regular Suggestions - Show when no ice breakers are provided */}\n\t\t\t\t{!iceBreakers &&\n\t\t\t\t\tsuggestions.length > 0 &&\n\t\t\t\t\tcurrentState === 'default' && (\n\t\t\t\t\t\t<SuggestionsSection>\n\t\t\t\t\t\t\t<SuggestionsGrid>\n\t\t\t\t\t\t\t\t{suggestions.map((s) => (\n\t\t\t\t\t\t\t\t\t<SuggestionChip\n\t\t\t\t\t\t\t\t\t\tkey={s}\n\t\t\t\t\t\t\t\t\t\tdisabled={isInputDisabledState}\n\t\t\t\t\t\t\t\t\t\tonClick={() => !isInputDisabledState && onSend(s)}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{s}\n\t\t\t\t\t\t\t\t\t</SuggestionChip>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</SuggestionsGrid>\n\t\t\t\t\t\t</SuggestionsSection>\n\t\t\t\t\t)}\n\n\t\t\t\t{/* Input Container - Always at bottom */}\n\t\t\t\t<InputContainer>\n\t\t\t\t\t<InputBubble>\n\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\tref={textareaRef}\n\t\t\t\t\t\t\tvalue={input}\n\t\t\t\t\t\t\tonChange={handleInputChange}\n\t\t\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\t\t\tdisabled={isInputDisabledState}\n\t\t\t\t\t\t\thasText={hasText}\n\t\t\t\t\t\t\tchatState={currentState}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<SendButton\n\t\t\t\t\t\t\tonClick={handleSend}\n\t\t\t\t\t\t\tdisabled={isSendDisabled}\n\t\t\t\t\t\t\thasText={hasText}\n\t\t\t\t\t\t\taria-label=\"Send\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\t\twidth=\"20\"\n\t\t\t\t\t\t\t\theight=\"20\"\n\t\t\t\t\t\t\t\tstroke=\"white\"\n\t\t\t\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<path d=\"M6 12h12\" />\n\t\t\t\t\t\t\t\t<path d=\"M12 6l6 6-6 6\" />\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t</SendButton>\n\t\t\t\t\t</InputBubble>\n\t\t\t\t</InputContainer>\n\t\t\t</MainContent>\n\t\t</ChatContainer>\n\t);\n};\n\nexport default ChatWindow;\n"],"names":["ChatContainer","styled","props","Header","MainContent","MessagesWrapper","VideoCard","VideoContainer","PlayButton","VideoText","Bubble","IceBreakersSection","IceBreakersGrid","IceBreakerChip","SuggestionsSection","SuggestionsGrid","SuggestionChip","InputContainer","InputBubble","TextInput","SendButton","CustomGradientText","ChatWindow","messages","onSend","header","placeholder","suggestions","iceBreakers","videoStarter","disabled","isThinking","onIceBreakerClick","chatState","chatWindowHeight","inputDisabled","input","setInput","useState","thinking","setThinking","isTyping","setIsTyping","bottomRef","useRef","textareaRef","isThinkingState","isInputDisabledState","currentState","handleSend","handleKeyDown","e","handleInputChange","value","textarea","hasText","isSendDisabled","useEffect","containerHeight","jsxs","jsx","AiIcon","BodySecondary","BodyCaption","m","renderMarkdownLite","ThinkingIndicator","iceBreaker","s"],"mappings":"4aASMA,EAAgBC,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAazBC,GAAU,CACZ,OAAQA,EAAM,UAAA,CACb,IAAK,uBACJ,MAAO;AAAA;AAAA,UAGR,IAAK,WACJ,MAAO;AAAA;AAAA,UAGR,QACC,MAAO;AAAA;AAAA,SAAA,CAIV,CAAC;AAAA,EAGIC,EAASF,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBhBG,EAAcH,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQrBI,EAAkBJ,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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A,CAAA,CACzB,CAAA,CACD,CAAA,CACD,CAAA,CACD,CAAA,CAAA,CACD,CAAA,EACD,CAEF"}
|
|
1
|
+
{"version":3,"file":"ChatWindow.js","sources":["../../../../../src/components/bik-chatbot/components/ChatWindow.tsx"],"sourcesContent":["import AiIcon from '@src/assets/icons/Ai_event_generating.svg';\nimport { stripHtmlTags } from '@src/helpers/sanitize';\nimport React, { useEffect, useRef, useState } from 'react';\nimport styled from 'styled-components';\nimport { BodyCaption, BodySecondary } from '@src/components/TypographyStyle';\nimport { ChatState, ChatWindowProps } from '../types';\nimport { renderMarkdownLite } from '../utils/markdown';\nimport ThinkingIndicator from './ThinkingIndicator';\n\n// Single-column layout container\nconst ChatContainer = styled.div<{ chatState: ChatState }>`\n\tdisplay: flex;\n\tflex-direction: column;\n\twidth: 100%;\n\tmin-width: 0;\n\tmin-height: 0;\n\theight: 100%;\n\tmax-height: 100%;\n\tbackground: white;\n\tborder-left: 1px solid #e5e7eb;\n\tposition: relative;\n\n\t/* State-based styling */\n\t${(props) => {\n\t\tswitch (props.chatState) {\n\t\t\tcase 'conversation-starter':\n\t\t\t\treturn `\n background: linear-gradient(180deg, #FFF6F9 0%, #FFFFFF 100%);\n `;\n\t\t\tcase 'thinking':\n\t\t\t\treturn `\n background: linear-gradient(180deg, #F8F9FA 0%, #FFFFFF 100%);\n `;\n\t\t\tdefault:\n\t\t\t\treturn `\n background: white;\n `;\n\t\t}\n\t}}\n`;\n\nconst Header = styled.div`\n\tpadding: 16px;\n\tborder-bottom: 1px solid #e5e7eb;\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tbackground: white;\n\tflex-shrink: 0;\n\n\t.header-text {\n\t\tfont-size: 14px;\n\t\tfont-weight: 500;\n\t\tcolor: #374151;\n\t}\n`;\n\n// Main content area - single column\nconst MainContent = styled.div`\n\tflex: 1;\n\tdisplay: flex;\n\tflex-direction: column;\n\toverflow: hidden;\n\tmin-height: 0;\n`;\n\nconst MessagesWrapper = styled.div`\n\tflex: 1;\n\toverflow-y: auto;\n\tpadding: 16px;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 16px;\n\tbackground: #fafafa;\n\tscroll-behavior: smooth;\n\tmin-height: 0;\n\n\t/* Custom scrollbar */\n\t&::-webkit-scrollbar {\n\t\twidth: 6px;\n\t}\n\n\t&::-webkit-scrollbar-track {\n\t\tbackground: #f1f1f1;\n\t\tborder-radius: 3px;\n\t}\n\n\t&::-webkit-scrollbar-thumb {\n\t\tbackground: #c1c1c1;\n\t\tborder-radius: 3px;\n\t}\n\n\t&::-webkit-scrollbar-thumb:hover {\n\t\tbackground: #a8a8a8;\n\t}\n`;\n\nconst VideoCard = styled.div`\n\tbackground: white;\n\tborder-radius: 12px;\n\tpadding: 16px;\n\tbox-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n\tborder: 1px solid #e5e7eb;\n`;\n\nconst VideoContainer = styled.div`\n\twidth: 100%;\n\theight: 180px;\n\tbackground: #f3f4f6;\n\tborder-radius: 8px;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tposition: relative;\n\tmargin-bottom: 12px;\n`;\n\nconst PlayButton = styled.div`\n\twidth: 48px;\n\theight: 48px;\n\tbackground: rgba(0, 0, 0, 0.7);\n\tborder-radius: 50%;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tcursor: pointer;\n\ttransition: all 0.2s ease;\n\n\t&:hover {\n\t\tbackground: rgba(0, 0, 0, 0.8);\n\t\ttransform: scale(1.05);\n\t}\n\n\tsvg {\n\t\twidth: 16px;\n\t\theight: 16px;\n\t\tfill: white;\n\t\tmargin-left: 2px;\n\t}\n`;\n\nconst VideoText = styled.div`\n\tfont-size: 14px;\n\tcolor: #374151;\n\tline-height: 1.5;\n`;\n\nconst Bubble = styled.div<{ role: 'user' | 'assistant' | 'system' }>`\n\tpadding: 12px 16px;\n\tborder-radius: 16px;\n\tfont-size: 14px;\n\tmax-width: 80%;\n\twhite-space: pre-line;\n\tword-wrap: break-word;\n\n\t${(props) =>\n\t\tprops.role === 'user'\n\t\t\t? `\n background: linear-gradient(92.69deg, rgba(255, 230, 238, 0.5) 0.37%, rgba(255, 240, 231, 0.5) 100%);\n margin-left: auto;\n border-bottom-right-radius: 4px;\n \n & > div {\n background: linear-gradient(92.69deg, #FF166A 0.37%, #FB5F08 100%);\n -webkit-background-clip: text;\n -webkit-text-fill-color: transparent;\n background-clip: text;\n display: inline-block;\n }\n `\n\t\t\t: props.role === 'system'\n\t\t\t? `\n background: #f3f4f6;\n color: #6b7280;\n font-size: 12px;\n font-style: italic;\n text-align: center;\n margin: 0 auto;\n max-width: 90%;\n `\n\t\t\t: `\n background: white;\n color: #111827;\n border: 1px solid #e5e7eb;\n margin-right: auto;\n border-bottom-left-radius: 4px;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);\n `}\n`;\n\n// Ice breakers section - at the bottom before input\nconst IceBreakersSection = styled.div`\n\tpadding: 16px;\n\tflex-shrink: 0;\n`;\n\nconst IceBreakersGrid = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\talign-items: flex-end;\n`;\n\nconst IceBreakerChip = styled.button<{ disabled?: boolean }>`\n\tborder: 1px dotted #febad2;\n\tbackground: linear-gradient(\n\t\t92.69deg,\n\t\trgba(255, 230, 238, 0.5) 0.37%,\n\t\trgba(255, 240, 231, 0.5) 100%\n\t);\n\tpadding: 8px 16px;\n\tborder-radius: 8px;\n\tfont-size: 13px;\n\tcursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};\n\ttransition: all 0.2s ease;\n\ttext-align: left;\n\tmax-width: 280px;\n\talign-self: flex-end;\n\topacity: ${(props) => (props.disabled ? 0.5 : 1)};\n\n\t&:hover:not(:disabled) {\n\t\tbackground: linear-gradient(\n\t\t\t92.69deg,\n\t\t\trgba(255, 230, 238, 0.7) 0.37%,\n\t\t\trgba(255, 240, 231, 0.7) 100%\n\t\t);\n\t\tborder-color: #f472b6;\n\t}\n\n\t&:active:not(:disabled) {\n\t\ttransform: scale(0.98);\n\t}\n`;\n\n// Suggestions section - styled like ice breakers but for regular suggestions\nconst SuggestionsSection = styled.div`\n\tpadding: 16px;\n\tbackground: white;\n`;\n\nconst SuggestionsGrid = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n`;\n\nconst SuggestionChip = styled.button<{ disabled?: boolean }>`\n\tbackground: #fef2f2;\n\tcolor: #dc2626;\n\tpadding: 12px 16px;\n\tborder-radius: 8px;\n\tfont-size: 13px;\n\tborder: 1px solid #fecaca;\n\tcursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};\n\ttransition: all 0.2s ease;\n\ttext-align: left;\n\topacity: ${(props) => (props.disabled ? 0.5 : 1)};\n\n\t&:hover:not(:disabled) {\n\t\tbackground: #fee2e2;\n\t\tborder-color: #fca5a5;\n\t}\n\n\t&:active:not(:disabled) {\n\t\ttransform: scale(0.98);\n\t}\n`;\n\nconst InputContainer = styled.div`\n\tpadding: 16px;\n\tflex-shrink: 0;\n`;\n\nconst InputBubble = styled.div`\n\tposition: relative;\n\tdisplay: flex;\n\twidth: 100%;\n`;\n\nconst TextInput = styled.textarea<{ hasText: boolean; chatState: ChatState }>`\n\tflex: 1;\n\tborder: 1px solid ${(props) => (props.hasText ? '#3b82f6' : '#d1d5db')};\n\tborder-radius: 12px;\n\tpadding: 12px;\n\tpadding-right: 48px;\n\tfont-size: 14px;\n\toutline: none;\n\tcolor: #374151;\n\tbackground: white;\n\tbox-shadow: 0px 2px 8px 0px #0000001f;\n\ttransition: all 0.2s ease;\n\tresize: none;\n\tmin-height: 44px;\n\tmax-height: 120px;\n\tfont-family: inherit;\n\twidth: 100%;\n\n\t&:focus {\n\t\tborder-color: #3b82f6;\n\t\tbackground: white;\n\t\tbox-shadow: 0px 2px 8px 0px #0000001f, 0 0 0 3px rgba(59, 130, 246, 0.1);\n\t}\n\n\t&::placeholder {\n\t\tcolor: #9ca3af;\n\t}\n`;\n\nconst SendButton = styled.button<{ disabled?: boolean; hasText: boolean }>`\n\tposition: absolute;\n\tbottom: 10px;\n\tright: 10px;\n\twidth: 36px;\n\theight: 36px;\n\tborder-radius: 50%;\n\tbackground: ${(props) =>\n\t\tprops.hasText\n\t\t\t? 'linear-gradient(135deg, #FF166A 0%, #FB5F08 100%)'\n\t\t\t: '#e5e7eb'};\n\tborder: none;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tcursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};\n\ttransition: all 0.2s ease;\n\tbox-shadow: 0 2px 8px 0px #fa709a1c;\n\tz-index: 2;\n\n\t&:hover:not(:disabled) {\n\t\tbackground: ${(props) =>\n\t\t\tprops.hasText && !props.disabled\n\t\t\t\t? 'linear-gradient(135deg, #F857A6 0%, #FF5858 100%)'\n\t\t\t\t: '#e5e7eb'};\n\t\ttransform: scale(1.05);\n\t}\n\n\t&:active:not(:disabled) {\n\t\ttransform: scale(0.95);\n\t}\n\n\tsvg {\n\t\twidth: 16px;\n\t\theight: 16px;\n\t\tfill: white;\n\t\tfont-weight: bold;\n\t}\n`;\n\n// Customizable gradient text component\nexport const CustomGradientText = styled.span<{\n\tcolors?: string;\n\tangle?: number;\n}>`\n\tbackground: linear-gradient(\n\t\t${(props) => props.angle || 92.69}deg,\n\t\t${(props) => props.colors || '#ff166a 0.37%, #fb5f08 100%'}\n\t);\n\t-webkit-background-clip: text;\n\t-webkit-text-fill-color: transparent;\n\tbackground-clip: text;\n\tdisplay: inline-block;\n`;\n\n// Export ChatState type for backward compatibility\nexport type { ChatState } from '../types';\n\ninterface ChatWindowWithHeightProps extends ChatWindowProps {\n\tchatWindowHeight?: string | number;\n}\n\nconst ChatWindow: React.FC<ChatWindowWithHeightProps> = ({\n\tmessages,\n\tonSend,\n\theader = 'Create with AI',\n\tplaceholder = 'Discover the right event & launch campaigns for better conversions...',\n\tsuggestions = [\n\t\t'Top festivals for marketing',\n\t\t'Top events this week?',\n\t\t'Top August festivals near you',\n\t],\n\ticeBreakers,\n\tvideoStarter,\n\tdisabled = false,\n\tisThinking = false,\n\tonIceBreakerClick,\n\tchatState,\n\tchatWindowHeight,\n\tinputDisabled = false,\n}) => {\n\tconst [input, setInput] = useState('');\n\tconst [thinking, setThinking] = useState(false);\n\tconst [isTyping, setIsTyping] = useState(false);\n\tconst bottomRef = useRef<HTMLDivElement>(null);\n\tconst textareaRef = useRef<HTMLTextAreaElement>(null);\n\tconst isThinkingState = thinking || isThinking;\n\tconst isInputDisabledState = disabled || inputDisabled;\n\n\t// Determine current chat state\n\tconst getCurrentChatState = (): ChatState => {\n\t\tif (chatState) return chatState; // Explicit state override\n\t\tif (thinking || isThinking) return 'thinking';\n\t\tif (isTyping && input.trim().length > 0) return 'typing';\n\t\tif (messages.length === 0) return 'conversation-starter';\n\t\tif (messages.length > 0) return 'conversation';\n\t\treturn 'default';\n\t};\n\n\tconst currentState = getCurrentChatState();\n\n\t// markdown renderer moved to ../utils/markdown\n\n\tconst handleSend = () => {\n\t\tif (!input.trim() || isInputDisabledState || isThinkingState) return;\n\t\tonSend(input);\n\t\tsetInput('');\n\t\tsetThinking(true);\n\t\tsetTimeout(() => setThinking(false), 1500);\n\t};\n\n\tconst handleKeyDown = (e: React.KeyboardEvent) => {\n\t\tif (isInputDisabledState) return;\n\t\tif (e.key === 'Enter' && !e.shiftKey) {\n\t\t\te.preventDefault();\n\t\t\tif (!isThinkingState && input.trim()) {\n\t\t\t\thandleSend();\n\t\t\t}\n\t\t}\n\t};\n\n\tconst handleInputChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n\t\tif (isInputDisabledState) return;\n\t\tconst value = stripHtmlTags(e.target.value);\n\t\tsetInput(value);\n\t\tsetIsTyping(value.trim().length > 0);\n\n\t\t// Auto-resize textarea\n\t\tconst textarea = textareaRef.current;\n\t\tif (textarea) {\n\t\t\ttextarea.style.height = 'auto';\n\t\t\ttextarea.style.height = `${Math.min(textarea.scrollHeight, 117)}px`;\n\t\t}\n\t};\n\n\tconst hasText = input.trim().length > 0;\n\tconst isSendDisabled = isInputDisabledState || isThinkingState || !hasText;\n\n\tuseEffect(() => {\n\t\tbottomRef.current?.scrollIntoView({ behavior: 'smooth' });\n\t}, [messages, thinking, isThinking]);\n\n\t// Use chatWindowHeight if provided, otherwise use 100% if fullHeight is active\n\tconst containerHeight = chatWindowHeight || '100%';\n\n\treturn (\n\t\t<ChatContainer chatState={currentState} style={{ height: containerHeight }}>\n\t\t\t{/* Header */}\n\t\t\t<Header>\n\t\t\t\t<AiIcon height={24} width={24} />\n\t\t\t\t<div className=\"header-text\">{header}</div>\n\t\t\t</Header>\n\n\t\t\t{/* Main Content - Single Column Layout */}\n\t\t\t<MainContent>\n\t\t\t\t{/* Messages Section */}\n\t\t\t\t<MessagesWrapper>\n\t\t\t\t\t{/* Video starter card - only when no messages and videoStarter provided */}\n\t\t\t\t\t{currentState === 'conversation-starter' && videoStarter && (\n\t\t\t\t\t\t<VideoCard>\n\t\t\t\t\t\t\t<VideoContainer>\n\t\t\t\t\t\t\t\t<PlayButton onClick={videoStarter.onPlay}>\n\t\t\t\t\t\t\t\t\t<svg viewBox=\"0 0 24 24\" fill=\"currentColor\">\n\t\t\t\t\t\t\t\t\t\t<path d=\"M8 5v14l11-7z\" />\n\t\t\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t\t\t</PlayButton>\n\t\t\t\t\t\t\t</VideoContainer>\n\t\t\t\t\t\t\t<VideoText>\n\t\t\t\t\t\t\t\t<BodySecondary style={{ fontWeight: 500, marginBottom: '4px' }}>\n\t\t\t\t\t\t\t\t\t{videoStarter.title}\n\t\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t\t<BodyCaption>{videoStarter.description}</BodyCaption>\n\t\t\t\t\t\t\t</VideoText>\n\t\t\t\t\t\t</VideoCard>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{/* Render messages (assistant supports lite Markdown) */}\n\t\t\t\t\t{messages.map((m) => (\n\t\t\t\t\t\t<Bubble key={m.id} role={m.role}>\n\t\t\t\t\t\t\t{m.role === 'assistant' ? (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t\t\t\t\t\t\t__html: renderMarkdownLite(m.content),\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<div style={{ whiteSpace: 'pre-wrap' }}>{m.content}</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Bubble>\n\t\t\t\t\t))}\n\n\t\t\t\t\t{/* Thinking bubble */}\n\t\t\t\t\t{(thinking || isThinking) && <ThinkingIndicator />}\n\n\t\t\t\t\t<div ref={bottomRef} />\n\t\t\t\t</MessagesWrapper>\n\n\t\t\t\t{/* Ice Breakers Section - At bottom when no messages and ice breakers provided */}\n\t\t\t\t{iceBreakers && currentState === 'conversation-starter' && (\n\t\t\t\t\t<IceBreakersSection>\n\t\t\t\t\t\t<IceBreakersGrid>\n\t\t\t\t\t\t\t{iceBreakers.map((iceBreaker) => (\n\t\t\t\t\t\t\t\t<IceBreakerChip\n\t\t\t\t\t\t\t\t\tkey={iceBreaker.id}\n\t\t\t\t\t\t\t\t\tdisabled={isInputDisabledState}\n\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\tif (!isInputDisabledState) {\n\t\t\t\t\t\t\t\t\t\t\tonIceBreakerClick?.(iceBreaker);\n\t\t\t\t\t\t\t\t\t\t\tonSend(iceBreaker.text);\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\t\t<CustomGradientText>{iceBreaker.text}</CustomGradientText>\n\t\t\t\t\t\t\t\t</IceBreakerChip>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</IceBreakersGrid>\n\t\t\t\t\t</IceBreakersSection>\n\t\t\t\t)}\n\n\t\t\t\t{/* Regular Suggestions - Show when no ice breakers are provided */}\n\t\t\t\t{!iceBreakers &&\n\t\t\t\t\tsuggestions.length > 0 &&\n\t\t\t\t\tcurrentState === 'default' && (\n\t\t\t\t\t\t<SuggestionsSection>\n\t\t\t\t\t\t\t<SuggestionsGrid>\n\t\t\t\t\t\t\t\t{suggestions.map((s) => (\n\t\t\t\t\t\t\t\t\t<SuggestionChip\n\t\t\t\t\t\t\t\t\t\tkey={s}\n\t\t\t\t\t\t\t\t\t\tdisabled={isInputDisabledState}\n\t\t\t\t\t\t\t\t\t\tonClick={() => !isInputDisabledState && onSend(s)}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{s}\n\t\t\t\t\t\t\t\t\t</SuggestionChip>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</SuggestionsGrid>\n\t\t\t\t\t\t</SuggestionsSection>\n\t\t\t\t\t)}\n\n\t\t\t\t{/* Input Container - Always at bottom */}\n\t\t\t\t<InputContainer>\n\t\t\t\t\t<InputBubble>\n\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\tref={textareaRef}\n\t\t\t\t\t\t\tvalue={input}\n\t\t\t\t\t\t\tonChange={handleInputChange}\n\t\t\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\t\t\tdisabled={isInputDisabledState}\n\t\t\t\t\t\t\thasText={hasText}\n\t\t\t\t\t\t\tchatState={currentState}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<SendButton\n\t\t\t\t\t\t\tonClick={handleSend}\n\t\t\t\t\t\t\tdisabled={isSendDisabled}\n\t\t\t\t\t\t\thasText={hasText}\n\t\t\t\t\t\t\taria-label=\"Send\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\t\twidth=\"20\"\n\t\t\t\t\t\t\t\theight=\"20\"\n\t\t\t\t\t\t\t\tstroke=\"white\"\n\t\t\t\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<path d=\"M6 12h12\" />\n\t\t\t\t\t\t\t\t<path d=\"M12 6l6 6-6 6\" />\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t</SendButton>\n\t\t\t\t\t</InputBubble>\n\t\t\t\t</InputContainer>\n\t\t\t</MainContent>\n\t\t</ChatContainer>\n\t);\n};\n\nexport default ChatWindow;\n"],"names":["ChatContainer","styled","props","Header","MainContent","MessagesWrapper","VideoCard","VideoContainer","PlayButton","VideoText","Bubble","IceBreakersSection","IceBreakersGrid","IceBreakerChip","SuggestionsSection","SuggestionsGrid","SuggestionChip","InputContainer","InputBubble","TextInput","SendButton","CustomGradientText","ChatWindow","messages","onSend","header","placeholder","suggestions","iceBreakers","videoStarter","disabled","isThinking","onIceBreakerClick","chatState","chatWindowHeight","inputDisabled","input","setInput","useState","thinking","setThinking","isTyping","setIsTyping","bottomRef","useRef","textareaRef","isThinkingState","isInputDisabledState","currentState","handleSend","handleKeyDown","e","handleInputChange","value","stripHtmlTags","textarea","hasText","isSendDisabled","useEffect","containerHeight","jsxs","jsx","AiIcon","BodySecondary","BodyCaption","m","renderMarkdownLite","ThinkingIndicator","iceBreaker","s"],"mappings":"sdAUMA,EAAgBC,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAazBC,GAAU,CACZ,OAAQA,EAAM,UAAA,CACb,IAAK,uBACJ,MAAO;AAAA;AAAA,UAGR,IAAK,WACJ,MAAO;AAAA;AAAA,UAGR,QACC,MAAO;AAAA;AAAA,SAAA,CAIV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OT,EACP,SAAUgB,EACV,YAAA1B,EACA,UAAWwB,EACX,SAAUH,EACV,QAAAS,EACA,UAAWR,CAAA,CAAA,EAEZa,EAAAA,IAACzC,GAAA,CACA,QAAS6B,EACT,SAAUQ,EACV,QAAAD,EACA,aAAW,OAEX,SAAAI,EAAAA,KAAC,MAAA,CACA,QAAQ,YACR,MAAM,KACN,OAAO,KACP,OAAO,QACP,YAAY,IACZ,KAAK,OACL,cAAc,QACd,eAAe,QAEf,SAAA,CAAAC,EAAAA,IAAC,OAAA,CAAK,EAAE,UAAA,CAAW,EACnBA,EAAAA,IAAC,OAAA,CAAK,EAAE,eAAA,CAAgB,CAAA,CAAA,CAAA,CACzB,CAAA,CACD,CAAA,CACD,CAAA,CACD,CAAA,CAAA,CACD,CAAA,EACD,CAEF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("react/jsx-runtime"),s=require("react"),ne=require("react-joyride"),te=require("./MajorUpdatePopup.js"),oe=require("./MinorUpdatePopup.js"),Be=require("./VideoModal.js"),je=require("./hooks/useFeatureAnnouncements.js"),Ee=require("./constants/selectors.js"),Ue=F=>F&&typeof F=="object"&&"default"in F?F:{default:F},ce=Ue(ne),Ne=({children:F,fetchVisibleFeatures:pe,getStoreFeatureProgress:fe,fetchFeatureById:be,markFeatureAsViewedForStore:ge,isFeatureApplicableToCurrentPage:he,module:me,router:P,storeId:U,onAnnouncementShown:ae,onAnnouncementInteracted:J})=>{const{majorUpdateFeatures:i,minorUpdateFeatures:I,isLoading:w,markFeatureAsViewed:p}=je.useFeatureAnnouncements({fetchVisibleFeatures:pe,getStoreFeatureProgress:fe,fetchFeatureById:be,markFeatureAsViewedForStore:ge,isFeatureApplicableToCurrentPage:he,module:me,router:P}),[b,v]=s.useState(null),[d,k]=s.useState(null),[q,B]=s.useState(!1),[se,C]=s.useState([]),[ye,W]=s.useState(!1),[re,j]=s.useState([]),[ie,T]=s.useState(!1),[m,y]=s.useState(!1),[u,V]=s.useState([]),[x,M]=s.useState(!1),[S,E]=s.useState(!1),[xe,A]=s.useState(!1),[Se,$]=s.useState(""),[L,z]=s.useState(!1),[ke,_]=s.useState(!1),[le,R]=s.useState(!1),[Ce,we]=s.useState(0),[Te,Me]=s.useState(0),[N,K]=s.useState(new Set);s.useEffect(()=>{const e="minor-spotlight-cutout-style";let o=document.getElementById(e);return o||(o=document.createElement("style"),o.id=e,document.head.appendChild(o)),o.textContent=`
|
|
2
2
|
.react-joyride__spotlight {
|
|
3
3
|
transition: box-shadow 0.3s ease-in-out !important;
|
|
4
4
|
will-change: box-shadow, transform;
|
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
right: 12px !important;
|
|
13
13
|
left: auto !important;
|
|
14
14
|
}
|
|
15
|
-
`,()=>{const n=document.getElementById(e);n&&n.remove()}},[]),i.useEffect(()=>{Me(e=>e+1),Be(e=>e+1),z(!1),K(!1),Q(new Set)},[W?.pathname]),i.useEffect(()=>{if(r.length>0&&!y&&!B&&!de&&!$){I(!1),U(!1),v(!1),k([]),x(null),A([]);let e=0;const o=10,n=()=>{e++,document.querySelector('[data-testid="whats-new-button"]')?ce(r[0]):e<o?setTimeout(n,1e3):I(!0)};n()}else r.length===0&&!B&&I(!0)},[r,y,B,de,$]),i.useEffect(()=>{const e=W?.query?.featureId;if(!e||B||P.length===0)return;const o=P.find(s=>s.id===e);if(!o||!o.featureTag)return;U(!0),h(!0);let n=0;const t=25,a=setInterval(()=>{n++;const s=o.featureTag.startsWith("#")||o.featureTag.startsWith(".")||o.featureTag.startsWith("[")?o.featureTag:`#${o.featureTag}`;if(document.querySelector(s)){const u=[o];A(u),q(o,u),clearInterval(a)}else n>=t&&(h(!1),clearInterval(a))},200);return()=>{clearInterval(a)}},[P,W?.query?.featureId,B]),i.useEffect(()=>{if(P.length>0&&!B&&!O&&!T&&!p&&!w&&M&&!$){let e=null,o=null,n=null,t=!1;const a=()=>{if(t||T||p||w||!M)return;const s=P.filter(d=>{if(!d.featureTag||d.featureTag.trim()===""||E.has(d.id))return!1;const u=d.featureTag.startsWith("#")||d.featureTag.startsWith(".")||d.featureTag.startsWith("[")?d.featureTag:`#${d.featureTag}`;return document.querySelector(u)!==null});s.length>0&&(A(s),q(s[0],s),e&&(e.disconnect(),e=null),o&&(window.removeEventListener("scroll",o),o=null),n&&(clearTimeout(n),n=null))};return e=new MutationObserver(s=>{let d=!1;for(const u of s){if(u.type==="childList"&&u.addedNodes.length>0)for(let f=0;f<u.addedNodes.length;f++){const b=u.addedNodes[f];if(b.nodeType===Node.ELEMENT_NODE){const pe=b;if(pe.id||pe.querySelector("[id]")){d=!0;break}}}if(d)break}!O&&!t&&!T&&!p&&!w&&M&&d&&(n&&clearTimeout(n),n=setTimeout(()=>{!t&&!T&&!p&&!w&&M&&a()},200))}),o=()=>{!O&&!t&&!T&&!p&&!w&&M&&(n&&clearTimeout(n),requestAnimationFrame(()=>{n=setTimeout(()=>{!t&&!T&&!p&&!w&&M&&a()},300)}))},e&&e.observe(document.body,{childList:!0,subtree:!0}),o&&window.addEventListener("scroll",o,{passive:!0}),a(),setTimeout(()=>{!t&&!T&&!p&&!w&&M&&a()},100),setTimeout(()=>{!t&&!T&&!p&&!w&&M&&a()},1e3),setTimeout(()=>{!t&&!T&&!p&&!w&&M&&a()},500),()=>{t=!0,e&&e.disconnect(),o&&window.removeEventListener("scroll",o),n&&clearTimeout(n)}}else(P.length===0||B)&&(W?.query?.featureId&&p||(v(!1),k([]),x(null),A([]),U(!1)))},[P,B,O,T,p,w,M,c,$]);const ce=e=>{F(e);const o=r.findIndex(a=>a.id===e.id),n=r.length,t=[{target:Ne.SELECTORS.WHATS_NEW_BUTTON,content:S.jsx(ae.default,{feature:e,currentIndex:o,totalFeatures:n,onSkip:()=>D(e),onExplore:a=>Z(e,a),onSecondaryAction:a=>H(e,a),onPrevious:()=>X(e),onNext:()=>G(e),setIsClosing:z}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:e,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];j(t),V(!0),R&&m&&R({storeId:m,announcementId:e.id,announcementTitle:e.title,imageUrl:e.displayImage||e.image,videoUrl:e.productVideo})},D=i.useCallback(async e=>{const o=e||y;o&&(C(!0),await Promise.all(r.map(n=>c(n.id))),V(!1),F(null),j([]),I(!0),g&&m&&g({storeId:m,announcementId:o.id,announcementTitle:o.title,imageUrl:o.displayImage||o.image,videoUrl:o.productVideo,buttonClicked:"Skip",buttonName:"Skip",buttonUrl:void 0}),setTimeout(()=>{C(!1)},500))},[y,r,c]),Z=i.useCallback(async(e,o)=>{C(!0),await c(e.id);const n=o??e.primaryButton?.action;if(n==="Play Video"&&e.productVideo&&(L(e.productVideo),J(!0),_(!0)),n==="Open link"){const s=e.primaryButton?.redirectionUrl||e.redirectUrl;s&&!s.startsWith("http")&&(window.location.href=s)}V(!1),F(null),j([]),r.findIndex(s=>s.id===e.id)===r.length-1&&I(!0),g&&m&&g({storeId:m,announcementId:e.id,announcementTitle:e.title,imageUrl:e.displayImage||e.image,videoUrl:e.productVideo,buttonClicked:"Primary",buttonName:e.primaryButton?.text||e.buttonText||"Explore",buttonUrl:e.primaryButton?.redirectionUrl||e.redirectUrl||e.productVideo}),setTimeout(()=>{C(!1)},500)},[r,c]),H=i.useCallback(async(e,o)=>{C(!0),await c(e.id),(o??e.secondaryButton?.action)==="Play Video"&&e.productVideo&&(L(e.productVideo),J(!0),_(!0)),V(!1),F(null),j([]),r.findIndex(s=>s.id===e.id)===r.length-1&&I(!0),g&&m&&g({storeId:m,announcementId:e.id,announcementTitle:e.title,imageUrl:e.displayImage||e.image,videoUrl:e.productVideo,buttonClicked:"Secondary",buttonName:e.secondaryButton?.text||"Secondary",buttonUrl:e.secondaryButton?.redirectionUrl}),setTimeout(()=>{C(!1)},500)},[r,c]),X=i.useCallback(e=>{const o=e||y;if(!o)return;const n=r.findIndex(t=>t.id===o.id);if(n>0){const t=r[n-1];F(t);const a=n-1,s=r.length,d=[{target:'[data-testid="whats-new-button"]',content:S.jsx(ae.default,{feature:t,currentIndex:a,totalFeatures:s,onSkip:()=>D(t),onExplore:u=>Z(t,u),onSecondaryAction:u=>H(t,u),onPrevious:()=>X(t),onNext:()=>G(t),setIsClosing:z}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];j(d)}},[y,r]),G=i.useCallback(e=>{const o=e||y;if(!o)return;const n=r.findIndex(t=>t.id===o.id);if(n<r.length-1){const t=r[n+1];F(t);const a=n+1,s=r.length,d=[{target:'[data-testid="whats-new-button"]',content:S.jsx(ae.default,{feature:t,currentIndex:a,totalFeatures:s,onSkip:()=>D(t),onExplore:u=>Z(t,u),onSecondaryAction:u=>H(t,u),onPrevious:()=>X(t),onNext:()=>G(t),setIsClosing:z}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];j(d)}else C(!0),c(o.id),V(!1),F(null),j([]),I(!0),setTimeout(()=>{C(!1)},500)},[y,r,c]),Fe=()=>{r.length>0&&!y&&document.querySelector('[data-testid="whats-new-button"]')&&ce(r[0])};i.useEffect(()=>(window.showMajorUpdatePopup=Fe,()=>{delete window.showMajorUpdatePopup}),[r,y]);const ve=i.useCallback(e=>{const{action:o}=e;o===se.ACTIONS.CLOSE&&(y&&(C(!0),r.forEach(n=>{c(n.id)}),I(!0),setTimeout(()=>{C(!1)},500)),V(!1),F(null),j([]))},[y,r,c]),je=i.useCallback(e=>{const{action:o}=e;o===se.ACTIONS.CLOSE&&(p&&(h(!0),c(p.id),l.findIndex(a=>a.id===p.id)===l.length-1&&U(!0),setTimeout(()=>{h(!1)},500)),v(!1),x(null),k([]))},[p,l,c]),q=async(e,o)=>{x(e);const n=o||l,t=n.findIndex(f=>f.id===e.id),a=n.length,s=e.featureTag.startsWith("#")||e.featureTag.startsWith(".")||e.featureTag.startsWith("[")?e.featureTag:`#${e.featureTag}`,d=document.querySelector(s);if(d)try{const{scrollToElementSmooth:f}=await Promise.resolve().then(()=>require("./utils/elementHelpers.js"));await f(d,120)}catch{}const u=[{target:s,content:S.jsx(ie.default,{feature:e,currentIndex:t,totalFeatures:a,onSkip:()=>Y(e),onExplore:f=>ee(e,f),onSecondaryAction:f=>te(e,f),onPrevious:()=>oe(e),onNext:()=>ne(e),setIsClosing:K}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:e,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];k(u),v(!0),R&&m&&R({storeId:m,announcementId:e.id,announcementTitle:e.title,imageUrl:e.displayImage||e.image,videoUrl:e.productVideo})},Y=i.useCallback(async e=>{const o=e||p;if(o){h(!0),await c(o.id),Q(t=>new Set(t).add(o.id)),v(!1),x(null),k([]);const n=l.find(t=>t.id!==o.id&&!E.has(t.id));g&&m&&g({storeId:m,announcementId:o.id,announcementTitle:o.title,imageUrl:o.displayImage||o.image,videoUrl:o.productVideo,buttonClicked:"Skip",buttonName:"Skip",buttonUrl:void 0}),setTimeout(()=>{h(!1),n?q(n,l):U(!0)},500)}},[p,l,c,E]),ee=i.useCallback(async(e,o)=>{h(!0),await c(e.id),Q(a=>new Set(a).add(e.id));const n=o??e.primaryButton?.action;if(n==="Play Video"&&e.productVideo&&(L(e.productVideo),J(!0),_(!0)),n==="Open link"){const a=e.primaryButton?.redirectionUrl||e.redirectUrl;a&&!a.startsWith("http")&&(window.location.href=a)}v(!1),x(null),k([]);const t=l.find(a=>a.id!==e.id&&!E.has(a.id));g&&m&&g({storeId:m,announcementId:e.id,announcementTitle:e.title,imageUrl:e.displayImage||e.image,videoUrl:e.productVideo,buttonClicked:"Primary",buttonName:e.primaryButton?.text||e.buttonText||"Explore",buttonUrl:e.primaryButton?.redirectionUrl||e.redirectUrl||e.productVideo}),setTimeout(()=>{h(!1),t&&n!=="Play Video"?q(t,l):t||U(!0)},500)},[l,c,E]),te=i.useCallback(async(e,o)=>{h(!0),await c(e.id),Q(a=>new Set(a).add(e.id));const n=o??e.secondaryButton?.action;n==="Play Video"&&e.productVideo&&(L(e.productVideo),J(!0),_(!0)),v(!1),x(null),k([]);const t=l.find(a=>a.id!==e.id&&!E.has(a.id));g&&m&&g({storeId:m,announcementId:e.id,announcementTitle:e.title,imageUrl:e.displayImage||e.image,videoUrl:e.productVideo,buttonClicked:"Secondary",buttonName:e.secondaryButton?.text||"Secondary",buttonUrl:e.secondaryButton?.redirectionUrl}),setTimeout(()=>{h(!1),t&&n!=="Play Video"?q(t,l):t||U(!0)},500)},[l,c,E]),oe=i.useCallback(async e=>{const o=e||p;if(!o)return;const n=l.findIndex(t=>t.id===o.id);if(n>0){const t=l[n-1];x(t);const a=t.featureTag.startsWith("#")||t.featureTag.startsWith(".")||t.featureTag.startsWith("[")?t.featureTag:`#${t.featureTag}`,s=document.querySelector(a);if(s)try{const{scrollToElementSmooth:b}=await Promise.resolve().then(()=>require("./utils/elementHelpers.js"));await b(s,120)}catch{}const d=n-1,u=l.length,f=[{target:a,content:S.jsx(ie.default,{feature:t,currentIndex:d,totalFeatures:u,onSkip:()=>Y(t),onExplore:b=>ee(t,b),onSecondaryAction:b=>te(t,b),onPrevious:()=>oe(t),onNext:()=>ne(t),setIsClosing:K}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];k(f)}},[p,l]),ne=i.useCallback(async e=>{const o=e||p;if(!o)return;const n=l.findIndex(t=>t.id===o.id);if(n<l.length-1){const t=l[n+1];x(t);const a=t.featureTag.startsWith("#")||t.featureTag.startsWith(".")||t.featureTag.startsWith("[")?t.featureTag:`#${t.featureTag}`,s=document.querySelector(a);if(s)try{const{scrollToElementSmooth:b}=await Promise.resolve().then(()=>require("./utils/elementHelpers.js"));await b(s,120)}catch{}const d=n+1,u=l.length,f=[{target:a,content:S.jsx(ie.default,{feature:t,currentIndex:d,totalFeatures:u,onSkip:()=>Y(t),onExplore:b=>ee(t,b),onSecondaryAction:b=>te(t,b),onPrevious:()=>oe(t),onNext:()=>ne(t),setIsClosing:K}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];k(f)}else h(!0),U(!0),c(o.id),v(!1),x(null),k([]),setTimeout(()=>{h(!1)},500)},[p,l,c]);return S.jsxs(S.Fragment,{children:[N,le.length>0&&S.jsx(fe.default,{steps:le,run:xe,continuous:!1,showProgress:!1,showSkipButton:!1,callback:ve,disableOverlayClose:!1,disableCloseOnEsc:!1,disableOverlay:!1,spotlightClicks:!1,styles:{options:{primaryColor:"#007bff",zIndex:1e4,width:"auto",arrowColor:Te?"transparent":"#212121"},overlay:{backgroundColor:"transparent"},spotlight:{backgroundColor:"transparent",border:"none",boxShadow:"none"},tooltip:{borderRadius:"16px",fontSize:"14px",padding:0,backgroundColor:"transparent",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}},locale:{back:"Back",close:"Close",last:"Close",next:"Next",skip:"Skip"}},`major-joyride-${we}`),re.length>0&&S.jsx(fe.default,{steps:re,run:O,continuous:!1,showProgress:!1,showSkipButton:!1,callback:je,disableOverlayClose:!1,disableCloseOnEsc:!1,disableOverlay:!1,scrollToFirstStep:!0,scrollOffset:120,disableScrolling:!1,styles:{options:{primaryColor:"#007bff",zIndex:1e4,width:"auto",arrowColor:ue?"transparent":"#ffffff"},overlay:{backgroundColor:"transparent"},spotlight:{backgroundColor:"transparent",borderRadius:"8px",boxShadow:ue?"none":"0 0 0 9999px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(255, 255, 255, 0.8), 0 0 20px 8px rgba(255, 255, 255, 0.4)"},tooltip:{borderRadius:"4px",fontSize:"14px",padding:0,backgroundColor:"transparent",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonSkip:{display:"none"},buttonClose:{display:"none"}},locale:{back:"Back",close:"Close",last:"Close",next:"Next",skip:"Skip"}},`minor-joyride-${Ue}`),S.jsx(Ie.VideoModal,{isOpen:ke,videoUrl:Ce,onClose:()=>{J(!1),L(""),_(!1);const e=l.find(o=>!E.has(o.id));e?setTimeout(()=>{q(e,l)},300):U(!0)}})]})};exports.default=Ve;
|
|
15
|
+
`,()=>{const n=document.getElementById(e);n&&n.remove()}},[]),s.useEffect(()=>{we(e=>e+1),Me(e=>e+1),_(!1),R(!1),K(new Set)},[P?.pathname]),s.useEffect(()=>{if(i.length>0&&!b&&!w&&!ie&&!L){E(!1),M(!1),B(!1),C([]),k(null),V([]);let e=0;const o=10,n=()=>{e++,document.querySelector('[data-testid="whats-new-button"]')?de(i[0]):e<o?setTimeout(n,1e3):E(!0)};n()}else i.length===0&&!w&&E(!0)},[i,b,w,ie,L]),s.useEffect(()=>{const e=P?.query?.featureId;if(!e||w||I.length===0)return;const o=I.find(r=>r.id===e);if(!o||!o.featureTag)return;M(!0),y(!0);let n=0;const t=25,a=setInterval(()=>{n++;const r=o.featureTag.startsWith("#")||o.featureTag.startsWith(".")||o.featureTag.startsWith("[")?o.featureTag:`#${o.featureTag}`;if(document.querySelector(r)){const c=[o];V(c),O(o,c),clearInterval(a)}else n>=t&&(y(!1),clearInterval(a))},200);return()=>{clearInterval(a)}},[I,P?.query?.featureId,w]),s.useEffect(()=>{if(I.length>0&&!w&&!q&&!m&&!d&&!x&&S&&!L){let e=null,o=null,n=null,t=!1;const a=()=>{if(t||m||d||x||!S)return;const r=I.filter(l=>{if(!l.featureTag||l.featureTag.trim()===""||N.has(l.id))return!1;const c=l.featureTag.startsWith("#")||l.featureTag.startsWith(".")||l.featureTag.startsWith("[")?l.featureTag:`#${l.featureTag}`;return document.querySelector(c)!==null});r.length>0&&(V(r),O(r[0],r),e&&(e.disconnect(),e=null),o&&(window.removeEventListener("scroll",o),o=null),n&&(clearTimeout(n),n=null))};return e=new MutationObserver(r=>{let l=!1;for(const c of r){if(c.type==="childList"&&c.addedNodes.length>0)for(let f=0;f<c.addedNodes.length;f++){const g=c.addedNodes[f];if(g.nodeType===Node.ELEMENT_NODE){const ue=g;if(ue.id||ue.querySelector("[id]")){l=!0;break}}}if(l)break}!q&&!t&&!m&&!d&&!x&&S&&l&&(n&&clearTimeout(n),n=setTimeout(()=>{!t&&!m&&!d&&!x&&S&&a()},200))}),o=()=>{!q&&!t&&!m&&!d&&!x&&S&&(n&&clearTimeout(n),requestAnimationFrame(()=>{n=setTimeout(()=>{!t&&!m&&!d&&!x&&S&&a()},300)}))},e&&e.observe(document.body,{childList:!0,subtree:!0}),o&&window.addEventListener("scroll",o,{passive:!0}),a(),setTimeout(()=>{!t&&!m&&!d&&!x&&S&&a()},100),setTimeout(()=>{!t&&!m&&!d&&!x&&S&&a()},1e3),setTimeout(()=>{!t&&!m&&!d&&!x&&S&&a()},500),()=>{t=!0,e&&e.disconnect(),o&&window.removeEventListener("scroll",o),n&&clearTimeout(n)}}else(I.length===0||w)&&(P?.query?.featureId&&d||(B(!1),C([]),k(null),V([]),M(!1)))},[I,w,q,m,d,x,S,p,L]);const de=e=>{v(e);const o=i.findIndex(a=>a.id===e.id),n=i.length,t=[{target:Ee.SELECTORS.WHATS_NEW_BUTTON,content:h.jsx(te.default,{feature:e,currentIndex:o,totalFeatures:n,onSkip:()=>Q(e),onExplore:a=>D(e,a),onPrevious:()=>Z(e),onNext:()=>H(e),setIsClosing:_}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:e,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];j(t),W(!0),ae&&U&&ae({storeId:U,announcementId:e.id,announcementTitle:e.title,imageUrl:e.displayImage||e.image,videoUrl:e.productVideo})},Q=s.useCallback(async e=>{const o=e||b;o&&(T(!0),await Promise.all(i.map(n=>p(n.id))),W(!1),v(null),j([]),E(!0),J&&U&&J({storeId:U,announcementId:o.id,announcementTitle:o.title,imageUrl:o.displayImage||o.image,videoUrl:o.productVideo,buttonClicked:"Skip",buttonName:"Skip",buttonUrl:void 0}),setTimeout(()=>{T(!1)},500))},[b,i,p]),D=s.useCallback(async(e,o)=>{T(!0),await p(e.id);const n=o??e.primaryButton?.action;if(n==="Play Video"&&e.productVideo&&($(e.productVideo),A(!0),z(!0)),n==="Open link"){const r=e.primaryButton?.redirectionUrl||e.redirectUrl;r&&!r.startsWith("http")&&(window.location.href=r)}W(!1),v(null),j([]),i.findIndex(r=>r.id===e.id)===i.length-1&&E(!0),J&&U&&J({storeId:U,announcementId:e.id,announcementTitle:e.title,imageUrl:e.displayImage||e.image,videoUrl:e.productVideo,buttonClicked:"Primary",buttonName:e.buttonText||"Explore",buttonUrl:e.redirectUrl||e.productVideo}),setTimeout(()=>{T(!1)},500)},[i,p]),Z=s.useCallback(e=>{const o=e||b;if(!o)return;const n=i.findIndex(t=>t.id===o.id);if(n>0){const t=i[n-1];v(t);const a=n-1,r=i.length,l=[{target:'[data-testid="whats-new-button"]',content:h.jsx(te.default,{feature:t,currentIndex:a,totalFeatures:r,onSkip:()=>Q(t),onExplore:c=>D(t,c),onPrevious:()=>Z(t),onNext:()=>H(t),setIsClosing:_}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];j(l)}},[b,i]),H=s.useCallback(e=>{const o=e||b;if(!o)return;const n=i.findIndex(t=>t.id===o.id);if(n<i.length-1){const t=i[n+1];v(t);const a=n+1,r=i.length,l=[{target:'[data-testid="whats-new-button"]',content:h.jsx(te.default,{feature:t,currentIndex:a,totalFeatures:r,onSkip:()=>Q(t),onExplore:c=>D(t,c),onPrevious:()=>Z(t),onNext:()=>H(t),setIsClosing:_}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];j(l)}else T(!0),p(o.id),W(!1),v(null),j([]),E(!0),setTimeout(()=>{T(!1)},500)},[b,i,p]),Fe=()=>{i.length>0&&!b&&document.querySelector('[data-testid="whats-new-button"]')&&de(i[0])};s.useEffect(()=>(window.showMajorUpdatePopup=Fe,()=>{delete window.showMajorUpdatePopup}),[i,b]);const Ie=s.useCallback(e=>{const{action:o}=e;o===ne.ACTIONS.CLOSE&&(b&&(T(!0),i.forEach(n=>{p(n.id)}),E(!0),setTimeout(()=>{T(!1)},500)),W(!1),v(null),j([]))},[b,i,p]),ve=s.useCallback(e=>{const{action:o}=e;o===ne.ACTIONS.CLOSE&&(d&&(y(!0),p(d.id),u.findIndex(a=>a.id===d.id)===u.length-1&&M(!0),setTimeout(()=>{y(!1)},500)),B(!1),k(null),C([]))},[d,u,p]),O=async(e,o)=>{k(e);const n=o||u,t=n.findIndex(f=>f.id===e.id),a=n.length,r=e.featureTag.startsWith("#")||e.featureTag.startsWith(".")||e.featureTag.startsWith("[")?e.featureTag:`#${e.featureTag}`,l=document.querySelector(r);if(l)try{const{scrollToElementSmooth:f}=await Promise.resolve().then(()=>require("./utils/elementHelpers.js"));await f(l,120)}catch{}const c=[{target:r,content:h.jsx(oe.default,{feature:e,currentIndex:t,totalFeatures:a,onSkip:()=>X(e),onExplore:f=>G(e,f),onPrevious:()=>Y(e),onNext:()=>ee(e),setIsClosing:R}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:e,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];C(c),B(!0)},X=s.useCallback(async e=>{const o=e||d;if(o){y(!0),await p(o.id),K(t=>new Set(t).add(o.id)),B(!1),k(null),C([]);const n=u.find(t=>t.id!==o.id&&!N.has(t.id));setTimeout(()=>{y(!1),n?O(n,u):M(!0)},500)}},[d,u,p,N]),G=s.useCallback(async(e,o)=>{y(!0),await p(e.id),K(a=>new Set(a).add(e.id));const n=o??e.primaryButton?.action;if(n==="Play Video"&&e.productVideo&&($(e.productVideo),A(!0),z(!0)),n==="Open link"){const a=e.primaryButton?.redirectionUrl||e.redirectUrl;a&&!a.startsWith("http")&&(window.location.href=a)}B(!1),k(null),C([]);const t=u.find(a=>a.id!==e.id&&!N.has(a.id));setTimeout(()=>{y(!1),t&&n!=="Play Video"?O(t,u):t||M(!0)},500)},[u,p,N]),Y=s.useCallback(async e=>{const o=e||d;if(!o)return;const n=u.findIndex(t=>t.id===o.id);if(n>0){const t=u[n-1];k(t);const a=t.featureTag.startsWith("#")||t.featureTag.startsWith(".")||t.featureTag.startsWith("[")?t.featureTag:`#${t.featureTag}`,r=document.querySelector(a);if(r)try{const{scrollToElementSmooth:g}=await Promise.resolve().then(()=>require("./utils/elementHelpers.js"));await g(r,120)}catch{}const l=n-1,c=u.length,f=[{target:a,content:h.jsx(oe.default,{feature:t,currentIndex:l,totalFeatures:c,onSkip:()=>X(t),onExplore:g=>G(t,g),onPrevious:()=>Y(t),onNext:()=>ee(t),setIsClosing:R}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];C(f)}},[d,u]),ee=s.useCallback(async e=>{const o=e||d;if(!o)return;const n=u.findIndex(t=>t.id===o.id);if(n<u.length-1){const t=u[n+1];k(t);const a=t.featureTag.startsWith("#")||t.featureTag.startsWith(".")||t.featureTag.startsWith("[")?t.featureTag:`#${t.featureTag}`,r=document.querySelector(a);if(r)try{const{scrollToElementSmooth:g}=await Promise.resolve().then(()=>require("./utils/elementHelpers.js"));await g(r,120)}catch{}const l=n+1,c=u.length,f=[{target:a,content:h.jsx(oe.default,{feature:t,currentIndex:l,totalFeatures:c,onSkip:()=>X(t),onExplore:g=>G(t,g),onPrevious:()=>Y(t),onNext:()=>ee(t),setIsClosing:R}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];C(f)}else y(!0),M(!0),p(o.id),B(!1),k(null),C([]),setTimeout(()=>{y(!1)},500)},[d,u,p]);return h.jsxs(h.Fragment,{children:[F,re.length>0&&h.jsx(ce.default,{steps:re,run:ye,continuous:!1,showProgress:!1,showSkipButton:!1,callback:Ie,disableOverlayClose:!1,disableCloseOnEsc:!1,disableOverlay:!1,spotlightClicks:!1,styles:{options:{primaryColor:"#007bff",zIndex:1e4,width:"auto",arrowColor:ke?"transparent":"#212121"},overlay:{backgroundColor:"transparent"},spotlight:{backgroundColor:"transparent",border:"none",boxShadow:"none"},tooltip:{borderRadius:"16px",fontSize:"14px",padding:0,backgroundColor:"transparent",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}},locale:{back:"Back",close:"Close",last:"Close",next:"Next",skip:"Skip"}},`major-joyride-${Ce}`),se.length>0&&h.jsx(ce.default,{steps:se,run:q,continuous:!1,showProgress:!1,showSkipButton:!1,callback:ve,disableOverlayClose:!1,disableCloseOnEsc:!1,disableOverlay:!1,scrollToFirstStep:!0,scrollOffset:120,disableScrolling:!1,styles:{options:{primaryColor:"#007bff",zIndex:1e4,width:"auto",arrowColor:le?"transparent":"#ffffff"},overlay:{backgroundColor:"transparent"},spotlight:{backgroundColor:"transparent",borderRadius:"8px",boxShadow:le?"none":"0 0 0 9999px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(255, 255, 255, 0.8), 0 0 20px 8px rgba(255, 255, 255, 0.4)"},tooltip:{borderRadius:"4px",fontSize:"14px",padding:0,backgroundColor:"transparent",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonSkip:{display:"none"},buttonClose:{display:"none"}},locale:{back:"Back",close:"Close",last:"Close",next:"Next",skip:"Skip"}},`minor-joyride-${Te}`),h.jsx(Be.VideoModal,{isOpen:xe,videoUrl:Se,onClose:()=>{A(!1),$(""),z(!1);const e=u.find(o=>!N.has(o.id));e?setTimeout(()=>{O(e,u)},300):M(!0)}})]})};exports.default=Ne;
|
|
16
16
|
//# sourceMappingURL=FeatureAnnouncementProvider.js.map
|