@bikdotai/bik-component-library 0.0.839-beta.2 → 0.0.839-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/BikGiftedChat/GiftedChat/GiftedChat.js +1 -1
- package/dist/cjs/components/BikGiftedChat/GiftedChat/GiftedChat.js.map +1 -1
- package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditor.js +23 -23
- package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditor.js.map +1 -1
- package/dist/cjs/components/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/button/themes.js +11 -11
- package/dist/cjs/components/button/themes.js.map +1 -1
- package/dist/cjs/components/input/ChipInput.js +1 -1
- package/dist/cjs/components/input/ChipInput.js.map +1 -1
- package/dist/cjs/components/input/Input-helper.js +1 -1
- package/dist/cjs/components/input/Input-helper.js.map +1 -1
- package/dist/cjs/components/input/Input.js +1 -1
- package/dist/cjs/components/input/Input.js.map +1 -1
- package/dist/cjs/components/plans/SubscriptionPlanSelector.js +5 -5
- package/dist/cjs/components/plans/SubscriptionPlanSelector.js.map +1 -1
- package/dist/cjs/editor/BikEditor.js +1 -1
- package/dist/cjs/editor/BikEditor.js.map +1 -1
- package/dist/cjs/editor/BikEditor.utils.js +3 -3
- package/dist/cjs/editor/BikEditor.utils.js.map +1 -1
- package/dist/cjs/editor/extensions/buildExtensions.js +2 -2
- package/dist/cjs/editor/extensions/buildExtensions.js.map +1 -1
- package/dist/cjs/icons/Media/Visual/FormkitNeutral.js +2 -0
- package/dist/cjs/icons/Media/Visual/FormkitNeutral.js.map +1 -0
- package/dist/cjs/icons/index.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/BikGiftedChat/GiftedChat/GiftedChat.js +66 -61
- package/dist/esm/components/BikGiftedChat/GiftedChat/GiftedChat.js.map +1 -1
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditor.js +143 -144
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditor.js.map +1 -1
- package/dist/esm/components/agent-builder/components/AiTextArea.js +23 -24
- package/dist/esm/components/agent-builder/components/AiTextArea.js.map +1 -1
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.js +30 -31
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.js.map +1 -1
- package/dist/esm/components/bik-chatbot/components/ChatWindow.js +53 -54
- package/dist/esm/components/bik-chatbot/components/ChatWindow.js.map +1 -1
- package/dist/esm/components/button/themes.d.ts +1 -0
- package/dist/esm/components/button/themes.js +61 -51
- package/dist/esm/components/button/themes.js.map +1 -1
- package/dist/esm/components/input/ChipInput.js +40 -41
- package/dist/esm/components/input/ChipInput.js.map +1 -1
- package/dist/esm/components/input/Input-helper.d.ts +0 -7
- package/dist/esm/components/input/Input-helper.js +25 -16
- package/dist/esm/components/input/Input-helper.js.map +1 -1
- package/dist/esm/components/input/Input.js +58 -60
- package/dist/esm/components/input/Input.js.map +1 -1
- package/dist/esm/components/input/Input.model.d.ts +0 -1
- package/dist/esm/components/plans/SubscriptionPlanSelector.js +40 -42
- package/dist/esm/components/plans/SubscriptionPlanSelector.js.map +1 -1
- package/dist/esm/editor/BikEditor.js +118 -122
- package/dist/esm/editor/BikEditor.js.map +1 -1
- package/dist/esm/editor/BikEditor.utils.d.ts +1 -1
- package/dist/esm/editor/BikEditor.utils.js +140 -141
- package/dist/esm/editor/BikEditor.utils.js.map +1 -1
- package/dist/esm/editor/extensions/buildExtensions.js +39 -49
- package/dist/esm/editor/extensions/buildExtensions.js.map +1 -1
- package/dist/esm/helpers/index.d.ts +0 -1
- package/dist/esm/icons/Media/Visual/FormkitNeutral.js +58 -0
- package/dist/esm/icons/Media/Visual/FormkitNeutral.js.map +1 -0
- package/dist/esm/icons/Media/Visual/index.d.ts +1 -0
- package/dist/esm/icons/index.d.ts +1 -1
- package/dist/esm/icons/index.js +404 -402
- package/dist/esm/icons/index.js.map +1 -1
- package/dist/esm/index.js +114 -124
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -2
- package/dist/cjs/editor/extensions/htmlTagStrip/HtmlTagStripExtension.js +0 -2
- package/dist/cjs/editor/extensions/htmlTagStrip/HtmlTagStripExtension.js.map +0 -1
- package/dist/cjs/helpers/sanitize.js +0 -2
- package/dist/cjs/helpers/sanitize.js.map +0 -1
- package/dist/esm/editor/extensions/htmlTagStrip/HtmlTagStripExtension.d.ts +0 -13
- package/dist/esm/editor/extensions/htmlTagStrip/HtmlTagStripExtension.js +0 -64
- package/dist/esm/editor/extensions/htmlTagStrip/HtmlTagStripExtension.js.map +0 -1
- package/dist/esm/helpers/sanitize.d.ts +0 -32
- package/dist/esm/helpers/sanitize.js +0 -204
- package/dist/esm/helpers/sanitize.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubscriptionPlanSelector.js","sources":["../../../../src/components/plans/SubscriptionPlanSelector.tsx"],"sourcesContent":["import Check from '@src/assets/icons/check.svg';\nimport Info from '@src/assets/icons/info.svg';\nimport PhoneIcon from '@src/assets/icons/phone.svg';\nimport { stripHtmlTags } from '@src/helpers/sanitize';\nimport { FunctionComponent, useState } from 'react';\nimport styled from 'styled-components';\nimport { StyledModal } from '@src/components/modals';\nimport {\n\tSubscriptionPlan,\n\tSubscriptionPlanProps,\n} from '@src/components/plans/SubscriptionPlan';\nimport { COLORS } from '@src/constants/Theme';\nimport { Button } from '../button';\nimport { Tabs } from '../tabs';\nimport { TabViewHeaderProps } from '../tabs/Tabs.model';\nimport { BodyCaption, BodyPrimary, TitleMedium } from '../TypographyStyle';\n\ntype Props = {\n\tplans: SubscriptionPlanProps[];\n\tonPlanSelect: (code: string) => void;\n\tonClose: () => void;\n\tsubHeader?: string;\n\twarningDescription?: string;\n\tshowTrialOptions?: boolean;\n\theader?: string;\n\tshowMonthlyOptions?: boolean;\n\tshowMonthlyTabs?: boolean;\n\tstaticWidthMultiplier?: number;\n\ttabProperties?: TabViewHeaderProps;\n\tshowCouponApplicationCode?: boolean;\n\tdiscountInputProperties?: {\n\t\terrorMessage?: string;\n\t\tsuccessText?: string;\n\t\tdefaultValue?: string;\n\t\tshowRemoveCoupon?: boolean;\n\t\tonChangeText: (text: string) => void;\n\t\tremoveCoupon?: () => void;\n\t\tonCouponApply?: () => void;\n\t\tisLoading?: boolean;\n\t};\n\tshowBookAdemo?: boolean;\n\tdemoLink?: string;\n\tonClickingBookADemo?: () => void;\n};\n\nconst PlanWrapper = styled.div`\n\tdisplay: flex;\n\tcolumn-gap: 22px;\n\talign-items: stretch;\n\tpadding: 24px;\n`;\n\nconst Warning = styled.div`\n\tcolor: ${COLORS.content.negative};\n\tpadding: 0px 24px;\n`;\nexport const HeaderWrapper = styled.div`\n\tpadding: 24px 24px 0px 24px;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\t.sub--header {\n\t\tmargin-top: 8px;\n\t\tcolor: ${COLORS.content.secondary} !important;\n\t}\n`;\nexport const BottomWrapper = styled.div`\n\tpadding: 0px 24px 24px 24px;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tflex-wrap: wrap;\n\tgap: 8px;\n\t.coupon-code {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: flex-start;\n\t\tgap: 8px;\n\t}\n\t.coupon--success--chip {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\tpadding: 4px 8px;\n\t\tborder-radius: 4px;\n\t\tborder: 1px solid #c3e4c4;\n\t\tbackground: #e6f4e7;\n\t}\n\t.coupon-input {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: 8px;\n\t}\n\t.dotted--border {\n\t\tborder: 1px dotted #e0e0e0;\n\t\tpadding: 8px 8px 8px 16px;\n\t\tmin-width: 10%;\n\t\tborder-radius: 4px;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: space-between;\n\t}\n\t.error--border {\n\t\tborder: 1px dotted ${COLORS.content.negative} !important;\n\t}\n\t.input--class {\n\t\tborder: none;\n\t\t:active,\n\t\t:focus {\n\t\t\tborder: none;\n\t\t\toutline: none;\n\t\t}\n\t}\n\t.success--inside--chip {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: space-between;\n\t\tpadding: 4px 8px;\n\t\talign-items: center;\n\t\tgap: 6px;\n\t\tborder-radius: 4px;\n\t\tbackground: ${COLORS.background.positive.vibrant};\n\t}\n\t.demo--wrapper {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: space-between;\n\t\tgap: 8px;\n\t}\n\t.demo--input {\n\t\tcolor: ${COLORS.background.brand};\n\t\tborder-bottom: 1px solid ${COLORS.background.brand};\n\t\twidth: fit-content;\n\t\tcursor: pointer;\n\t}\n\t.demo--phone {\n\t\tdisplay: flex;\n\t\tpadding: 8px;\n\t\talign-items: center;\n\t\tgap: 10px;\n\t\tborder-radius: 50%;\n\t\tbackground-color: ${COLORS.background.brandLight};\n\t}\n\t.button--wrapper {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: flex-start;\n\t\tgap: 8px;\n\t}\n`;\n\nexport const defaultTabs = [\n\t{ key: 'Monthly', title: 'Monthly' },\n\t{ key: 'yearly', title: 'Yearly' },\n];\n\n// Selected plan to have chosen plan not selectable\n\nexport const SubscriptionPlanSelector: FunctionComponent<Props> = (props) => {\n\tconst [inputValue, setInputValue] = useState(\n\t\tprops.discountInputProperties?.defaultValue,\n\t);\n\tconst eachCardWidth = props.staticWidthMultiplier\n\t\t? props.staticWidthMultiplier\n\t\t: 275;\n\treturn (\n\t\t<StyledModal\n\t\t\tcentralContainerStyles={{\n\t\t\t\twidth: props.plans.length * eachCardWidth,\n\t\t\t}}\n\t\t\topen={true}\n\t\t\tcloseOnOutsideClick={true}\n\t\t\tonClose={props.onClose}\n\t\t>\n\t\t\t<HeaderWrapper>\n\t\t\t\t<div>\n\t\t\t\t\t<TitleMedium>\n\t\t\t\t\t\t{props.header || 'Select a plan to proceed'}\n\t\t\t\t\t</TitleMedium>\n\t\t\t\t\t<BodyPrimary className=\"sub--header\">\n\t\t\t\t\t\t{props.subHeader || ''}\n\t\t\t\t\t</BodyPrimary>\n\t\t\t\t</div>\n\t\t\t\t{props.showMonthlyTabs ? (\n\t\t\t\t\t<Tabs\n\t\t\t\t\t\ttabs={\n\t\t\t\t\t\t\tprops.tabProperties && props.tabProperties.tabs\n\t\t\t\t\t\t\t\t? props.tabProperties.tabs\n\t\t\t\t\t\t\t\t: defaultTabs\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonTabSelected={(selectedTab) =>\n\t\t\t\t\t\t\tprops.tabProperties?.onTabSelected\n\t\t\t\t\t\t\t\t? props.tabProperties?.onTabSelected(selectedTab)\n\t\t\t\t\t\t\t\t: ''\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisSquared\n\t\t\t\t\t></Tabs>\n\t\t\t\t) : (\n\t\t\t\t\t<></>\n\t\t\t\t)}\n\t\t\t</HeaderWrapper>\n\t\t\t{props.warningDescription && (\n\t\t\t\t<Warning>{props.warningDescription}</Warning>\n\t\t\t)}\n\t\t\t{/*<DurationSelector*/}\n\t\t\t{/*\tisMonthlySelected={monthly}*/}\n\t\t\t{/*\tyearlyDiscount={\"20\"}*/}\n\t\t\t{/*\tonToggle={setIsMonthly}*/}\n\t\t\t{/*/>*/}\n\t\t\t<PlanWrapper>\n\t\t\t\t{props.plans.map((prop) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<SubscriptionPlan\n\t\t\t\t\t\t\t{...prop}\n\t\t\t\t\t\t\tshowMonthly={true}\n\t\t\t\t\t\t\tshowMonthlyOptions={props.showMonthlyOptions || false}\n\t\t\t\t\t\t\tshowTrialOptions={props.showTrialOptions || false}\n\t\t\t\t\t\t\tonPlanSelect={props.onPlanSelect}\n\t\t\t\t\t\t\tkey={prop.planName}\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</PlanWrapper>\n\t\t\t{(props.showCouponApplicationCode || props.showBookAdemo) && (\n\t\t\t\t<BottomWrapper>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t{props.showCouponApplicationCode && (\n\t\t\t\t\t\t\t<div className=\"coupon-code\">\n\t\t\t\t\t\t\t\t<div className=\"coupon-input\">\n\t\t\t\t\t\t\t\t\t<BodyPrimary\n\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\tcolor: props.discountInputProperties?.errorMessage\n\t\t\t\t\t\t\t\t\t\t\t\t? COLORS.content.negative\n\t\t\t\t\t\t\t\t\t\t\t\t: '',\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\tApply coupon code\n\t\t\t\t\t\t\t\t\t</BodyPrimary>\n\t\t\t\t\t\t\t\t\t<div className=\"button--wrapper\">\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t\t\tprops.discountInputProperties?.errorMessage\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'error--border dotted--border'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'dotted--border'\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"input--class\"\n\t\t\t\t\t\t\t\t\t\t\t\tonChange={(text) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst sanitized = stripHtmlTags(text.target.value);\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetInputValue(sanitized);\n\t\t\t\t\t\t\t\t\t\t\t\t\tprops.discountInputProperties?.onChangeText(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsanitized,\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\tvalue={inputValue}\n\t\t\t\t\t\t\t\t\t\t\t\tplaceholder=\"eg:PLAN20\"\n\t\t\t\t\t\t\t\t\t\t\t\tdisabled={props.discountInputProperties?.isLoading}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{props.discountInputProperties?.successText && (\n\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"success--inside--chip\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Check\n\t\t\t\t\t\t\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolor={COLORS.content.primaryInverse}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<BodyCaption\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstyle={{ color: COLORS.content.primaryInverse }}\n\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tCoupon applied\n\t\t\t\t\t\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t{!props.discountInputProperties?.successText && (\n\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\tbuttonText=\"Apply\"\n\t\t\t\t\t\t\t\t\t\t\t\tbuttonType=\"primary\"\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={props?.discountInputProperties?.onCouponApply}\n\t\t\t\t\t\t\t\t\t\t\t\tisLoading={props.discountInputProperties?.isLoading}\n\t\t\t\t\t\t\t\t\t\t\t></Button>\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t{props.discountInputProperties?.errorMessage && (\n\t\t\t\t\t\t\t\t\t\t<div className=\"d-flex\" style={{ gap: 8 }}>\n\t\t\t\t\t\t\t\t\t\t\t<Info\n\t\t\t\t\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\t\t\t\t\tcolor={COLORS.content.negative}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t<BodyCaption style={{ color: COLORS.content.negative }}>\n\t\t\t\t\t\t\t\t\t\t\t\t{props.discountInputProperties?.errorMessage ??\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Enter a valid code'}\n\t\t\t\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t{props.discountInputProperties?.showRemoveCoupon && (\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"demo--input\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\t\t\tsetInputValue('');\n\t\t\t\t\t\t\t\t\t\t\t\tprops.discountInputProperties?.removeCoupon\n\t\t\t\t\t\t\t\t\t\t\t\t\t? props.discountInputProperties?.removeCoupon()\n\t\t\t\t\t\t\t\t\t\t\t\t\t: '';\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\tRemove coupon\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t{props.discountInputProperties?.successText && (\n\t\t\t\t\t\t\t\t\t<div className=\"coupon--success--chip\">\n\t\t\t\t\t\t\t\t\t\t<BodyCaption style={{ color: '#00580E', maxWidth: 180 }}>\n\t\t\t\t\t\t\t\t\t\t\t{props.discountInputProperties?.successText}\n\t\t\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t\t{props.showBookAdemo && (\n\t\t\t\t\t\t<div className=\"demo--wrapper\">\n\t\t\t\t\t\t\t<div className=\"demo--phone\">\n\t\t\t\t\t\t\t\t<PhoneIcon\n\t\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\t\tcolor={COLORS.background.brand}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<BodyPrimary\n\t\t\t\t\t\t\t\tclassName=\"demo--input\"\n\t\t\t\t\t\t\t\tonClick={() =>\n\t\t\t\t\t\t\t\t\tprops.demoLink\n\t\t\t\t\t\t\t\t\t\t? window.open(props.demoLink, '_blank')\n\t\t\t\t\t\t\t\t\t\t: props.onClickingBookADemo\n\t\t\t\t\t\t\t\t\t\t? props.onClickingBookADemo()\n\t\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\tBook a demo with the team\n\t\t\t\t\t\t\t</BodyPrimary>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</BottomWrapper>\n\t\t\t)}\n\t\t</StyledModal>\n\t);\n};\n"],"names":["PlanWrapper","styled","Warning","COLORS","HeaderWrapper","BottomWrapper","defaultTabs","SubscriptionPlanSelector","props","inputValue","setInputValue","useState","eachCardWidth","jsxs","StyledModal","jsx","TitleMedium","BodyPrimary","Tabs","selectedTab","Fragment","prop","createElement","SubscriptionPlan","text","sanitized","stripHtmlTags","Check","BodyCaption","Button","Info","PhoneIcon"],"mappings":";;;;;;;;;;;;;AA6CA,MAAMA,IAAcC,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAOrBC,IAAUD,EAAO;AAAA,UACbE,EAAO,QAAQ,QAAQ;AAAA;AAAA,GAGpBC,IAAgBH,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAOzBE,EAAO,QAAQ,SAAS;AAAA;AAAA,GAGtBE,IAAgBJ,EAAO;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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAqCbE,EAAO,QAAQ,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAkB9BA,EAAO,WAAW,SAAS,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WASvCA,EAAO,WAAW,KAAK;AAAA,6BACLA,EAAO,WAAW,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAU9BA,EAAO,WAAW,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAUrCG,IAAc;AAAA,EAC1B,EAAE,KAAK,WAAW,OAAO,UAAA;AAAA,EACzB,EAAE,KAAK,UAAU,OAAO,SAAA;AACzB,GAIaC,IAAqD,CAACC,MAAU;AAC5E,QAAM,CAACC,GAAYC,CAAa,IAAIC;AAAA,IACnCH,EAAM,yBAAyB;AAA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AAU,eACd,UAAA,gBAAAA;AAAA,cAACgB;AAAAA,cAAA;AAAA,gBACA,QAAQ;AAAA,gBACR,OAAO;AAAA,gBACP,OAAO5B,EAAO,WAAW;AAAA,cAAA;AAAA,YAAA,GAE3B;AAAA,YACA,gBAAAY;AAAA,cAACE;AAAA,cAAA;AAAA,gBACA,WAAU;AAAA,gBACV,SAAS,MACRT,EAAM,WACH,OAAO,KAAKA,EAAM,UAAU,QAAQ,IACpCA,EAAM,sBACNA,EAAM,wBACN;AAAA,gBAEJ,UAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UAED,EAAA,CACD;AAAA,QAAA,EAAA,CAEF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIJ;"}
|
|
1
|
+
{"version":3,"file":"SubscriptionPlanSelector.js","sources":["../../../../src/components/plans/SubscriptionPlanSelector.tsx"],"sourcesContent":["import Check from '@src/assets/icons/check.svg';\nimport Info from '@src/assets/icons/info.svg';\nimport PhoneIcon from '@src/assets/icons/phone.svg';\nimport { FunctionComponent, useState } from 'react';\nimport styled from 'styled-components';\nimport { StyledModal } from '@src/components/modals';\nimport {\n\tSubscriptionPlan,\n\tSubscriptionPlanProps,\n} from '@src/components/plans/SubscriptionPlan';\nimport { COLORS } from '@src/constants/Theme';\nimport { Button } from '../button';\nimport { Tabs } from '../tabs';\nimport { TabViewHeaderProps } from '../tabs/Tabs.model';\nimport { BodyCaption, BodyPrimary, TitleMedium } from '../TypographyStyle';\n\ntype Props = {\n\tplans: SubscriptionPlanProps[];\n\tonPlanSelect: (code: string) => void;\n\tonClose: () => void;\n\tsubHeader?: string;\n\twarningDescription?: string;\n\tshowTrialOptions?: boolean;\n\theader?: string;\n\tshowMonthlyOptions?: boolean;\n\tshowMonthlyTabs?: boolean;\n\tstaticWidthMultiplier?: number;\n\ttabProperties?: TabViewHeaderProps;\n\tshowCouponApplicationCode?: boolean;\n\tdiscountInputProperties?: {\n\t\terrorMessage?: string;\n\t\tsuccessText?: string;\n\t\tdefaultValue?: string;\n\t\tshowRemoveCoupon?: boolean;\n\t\tonChangeText: (text: string) => void;\n\t\tremoveCoupon?: () => void;\n\t\tonCouponApply?: () => void;\n\t\tisLoading?: boolean;\n\t};\n\tshowBookAdemo?: boolean;\n\tdemoLink?: string;\n\tonClickingBookADemo?: () => void;\n};\n\nconst PlanWrapper = styled.div`\n\tdisplay: flex;\n\tcolumn-gap: 22px;\n\talign-items: stretch;\n\tpadding: 24px;\n`;\n\nconst Warning = styled.div`\n\tcolor: ${COLORS.content.negative};\n\tpadding: 0px 24px;\n`;\nexport const HeaderWrapper = styled.div`\n\tpadding: 24px 24px 0px 24px;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\t.sub--header {\n\t\tmargin-top: 8px;\n\t\tcolor: ${COLORS.content.secondary} !important;\n\t}\n`;\nexport const BottomWrapper = styled.div`\n\tpadding: 0px 24px 24px 24px;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tflex-wrap: wrap;\n\tgap: 8px;\n\t.coupon-code {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: flex-start;\n\t\tgap: 8px;\n\t}\n\t.coupon--success--chip {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\tpadding: 4px 8px;\n\t\tborder-radius: 4px;\n\t\tborder: 1px solid #c3e4c4;\n\t\tbackground: #e6f4e7;\n\t}\n\t.coupon-input {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: 8px;\n\t}\n\t.dotted--border {\n\t\tborder: 1px dotted #e0e0e0;\n\t\tpadding: 8px 8px 8px 16px;\n\t\tmin-width: 10%;\n\t\tborder-radius: 4px;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: space-between;\n\t}\n\t.error--border {\n\t\tborder: 1px dotted ${COLORS.content.negative} !important;\n\t}\n\t.input--class {\n\t\tborder: none;\n\t\t:active,\n\t\t:focus {\n\t\t\tborder: none;\n\t\t\toutline: none;\n\t\t}\n\t}\n\t.success--inside--chip {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: space-between;\n\t\tpadding: 4px 8px;\n\t\talign-items: center;\n\t\tgap: 6px;\n\t\tborder-radius: 4px;\n\t\tbackground: ${COLORS.background.positive.vibrant};\n\t}\n\t.demo--wrapper {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: space-between;\n\t\tgap: 8px;\n\t}\n\t.demo--input {\n\t\tcolor: ${COLORS.background.brand};\n\t\tborder-bottom: 1px solid ${COLORS.background.brand};\n\t\twidth: fit-content;\n\t\tcursor: pointer;\n\t}\n\t.demo--phone {\n\t\tdisplay: flex;\n\t\tpadding: 8px;\n\t\talign-items: center;\n\t\tgap: 10px;\n\t\tborder-radius: 50%;\n\t\tbackground-color: ${COLORS.background.brandLight};\n\t}\n\t.button--wrapper {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: flex-start;\n\t\tgap: 8px;\n\t}\n`;\n\nexport const defaultTabs = [\n\t{ key: 'Monthly', title: 'Monthly' },\n\t{ key: 'yearly', title: 'Yearly' },\n];\n\n// Selected plan to have chosen plan not selectable\n\nexport const SubscriptionPlanSelector: FunctionComponent<Props> = (props) => {\n\tconst [inputValue, setInputValue] = useState(\n\t\tprops.discountInputProperties?.defaultValue,\n\t);\n\tconst eachCardWidth = props.staticWidthMultiplier\n\t\t? props.staticWidthMultiplier\n\t\t: 275;\n\treturn (\n\t\t<StyledModal\n\t\t\tcentralContainerStyles={{\n\t\t\t\twidth: props.plans.length * eachCardWidth,\n\t\t\t}}\n\t\t\topen={true}\n\t\t\tcloseOnOutsideClick={true}\n\t\t\tonClose={props.onClose}\n\t\t>\n\t\t\t<HeaderWrapper>\n\t\t\t\t<div>\n\t\t\t\t\t<TitleMedium>\n\t\t\t\t\t\t{props.header || 'Select a plan to proceed'}\n\t\t\t\t\t</TitleMedium>\n\t\t\t\t\t<BodyPrimary className=\"sub--header\">\n\t\t\t\t\t\t{props.subHeader || ''}\n\t\t\t\t\t</BodyPrimary>\n\t\t\t\t</div>\n\t\t\t\t{props.showMonthlyTabs ? (\n\t\t\t\t\t<Tabs\n\t\t\t\t\t\ttabs={\n\t\t\t\t\t\t\tprops.tabProperties && props.tabProperties.tabs\n\t\t\t\t\t\t\t\t? props.tabProperties.tabs\n\t\t\t\t\t\t\t\t: defaultTabs\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonTabSelected={(selectedTab) =>\n\t\t\t\t\t\t\tprops.tabProperties?.onTabSelected\n\t\t\t\t\t\t\t\t? props.tabProperties?.onTabSelected(selectedTab)\n\t\t\t\t\t\t\t\t: ''\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisSquared\n\t\t\t\t\t></Tabs>\n\t\t\t\t) : (\n\t\t\t\t\t<></>\n\t\t\t\t)}\n\t\t\t</HeaderWrapper>\n\t\t\t{props.warningDescription && (\n\t\t\t\t<Warning>{props.warningDescription}</Warning>\n\t\t\t)}\n\t\t\t{/*<DurationSelector*/}\n\t\t\t{/*\tisMonthlySelected={monthly}*/}\n\t\t\t{/*\tyearlyDiscount={\"20\"}*/}\n\t\t\t{/*\tonToggle={setIsMonthly}*/}\n\t\t\t{/*/>*/}\n\t\t\t<PlanWrapper>\n\t\t\t\t{props.plans.map((prop) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<SubscriptionPlan\n\t\t\t\t\t\t\t{...prop}\n\t\t\t\t\t\t\tshowMonthly={true}\n\t\t\t\t\t\t\tshowMonthlyOptions={props.showMonthlyOptions || false}\n\t\t\t\t\t\t\tshowTrialOptions={props.showTrialOptions || false}\n\t\t\t\t\t\t\tonPlanSelect={props.onPlanSelect}\n\t\t\t\t\t\t\tkey={prop.planName}\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</PlanWrapper>\n\t\t\t{(props.showCouponApplicationCode || props.showBookAdemo) && (\n\t\t\t\t<BottomWrapper>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t{props.showCouponApplicationCode && (\n\t\t\t\t\t\t\t<div className=\"coupon-code\">\n\t\t\t\t\t\t\t\t<div className=\"coupon-input\">\n\t\t\t\t\t\t\t\t\t<BodyPrimary\n\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\tcolor: props.discountInputProperties?.errorMessage\n\t\t\t\t\t\t\t\t\t\t\t\t? COLORS.content.negative\n\t\t\t\t\t\t\t\t\t\t\t\t: '',\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\tApply coupon code\n\t\t\t\t\t\t\t\t\t</BodyPrimary>\n\t\t\t\t\t\t\t\t\t<div className=\"button--wrapper\">\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t\t\tprops.discountInputProperties?.errorMessage\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'error--border dotted--border'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'dotted--border'\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"input--class\"\n\t\t\t\t\t\t\t\t\t\t\t\tonChange={(text) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetInputValue(text.target.value);\n\t\t\t\t\t\t\t\t\t\t\t\t\tprops.discountInputProperties?.onChangeText(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttext.target.value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\tvalue={inputValue}\n\t\t\t\t\t\t\t\t\t\t\t\tplaceholder=\"eg:PLAN20\"\n\t\t\t\t\t\t\t\t\t\t\t\tdisabled={props.discountInputProperties?.isLoading}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{props.discountInputProperties?.successText && (\n\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"success--inside--chip\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Check\n\t\t\t\t\t\t\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolor={COLORS.content.primaryInverse}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<BodyCaption\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstyle={{ color: COLORS.content.primaryInverse }}\n\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tCoupon applied\n\t\t\t\t\t\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t{!props.discountInputProperties?.successText && (\n\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\tbuttonText=\"Apply\"\n\t\t\t\t\t\t\t\t\t\t\t\tbuttonType=\"primary\"\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={props?.discountInputProperties?.onCouponApply}\n\t\t\t\t\t\t\t\t\t\t\t\tisLoading={props.discountInputProperties?.isLoading}\n\t\t\t\t\t\t\t\t\t\t\t></Button>\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t{props.discountInputProperties?.errorMessage && (\n\t\t\t\t\t\t\t\t\t\t<div className=\"d-flex\" style={{ gap: 8 }}>\n\t\t\t\t\t\t\t\t\t\t\t<Info\n\t\t\t\t\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\t\t\t\t\tcolor={COLORS.content.negative}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t<BodyCaption style={{ color: COLORS.content.negative }}>\n\t\t\t\t\t\t\t\t\t\t\t\t{props.discountInputProperties?.errorMessage ??\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Enter a valid code'}\n\t\t\t\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t{props.discountInputProperties?.showRemoveCoupon && (\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"demo--input\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\t\t\tsetInputValue('');\n\t\t\t\t\t\t\t\t\t\t\t\tprops.discountInputProperties?.removeCoupon\n\t\t\t\t\t\t\t\t\t\t\t\t\t? props.discountInputProperties?.removeCoupon()\n\t\t\t\t\t\t\t\t\t\t\t\t\t: '';\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\tRemove coupon\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t{props.discountInputProperties?.successText && (\n\t\t\t\t\t\t\t\t\t<div className=\"coupon--success--chip\">\n\t\t\t\t\t\t\t\t\t\t<BodyCaption style={{ color: '#00580E', maxWidth: 180 }}>\n\t\t\t\t\t\t\t\t\t\t\t{props.discountInputProperties?.successText}\n\t\t\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t\t{props.showBookAdemo && (\n\t\t\t\t\t\t<div className=\"demo--wrapper\">\n\t\t\t\t\t\t\t<div className=\"demo--phone\">\n\t\t\t\t\t\t\t\t<PhoneIcon\n\t\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\t\tcolor={COLORS.background.brand}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<BodyPrimary\n\t\t\t\t\t\t\t\tclassName=\"demo--input\"\n\t\t\t\t\t\t\t\tonClick={() =>\n\t\t\t\t\t\t\t\t\tprops.demoLink\n\t\t\t\t\t\t\t\t\t\t? window.open(props.demoLink, '_blank')\n\t\t\t\t\t\t\t\t\t\t: props.onClickingBookADemo\n\t\t\t\t\t\t\t\t\t\t? props.onClickingBookADemo()\n\t\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\tBook a demo with the team\n\t\t\t\t\t\t\t</BodyPrimary>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</BottomWrapper>\n\t\t\t)}\n\t\t</StyledModal>\n\t);\n};\n"],"names":["PlanWrapper","styled","Warning","COLORS","HeaderWrapper","BottomWrapper","defaultTabs","SubscriptionPlanSelector","props","inputValue","setInputValue","useState","eachCardWidth","jsxs","StyledModal","jsx","TitleMedium","BodyPrimary","Tabs","selectedTab","Fragment","prop","createElement","SubscriptionPlan","text","Check","BodyCaption","Button","Info","PhoneIcon"],"mappings":";;;;;;;;;;;;AA4CA,MAAMA,IAAcC,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAOrBC,IAAUD,EAAO;AAAA,UACbE,EAAO,QAAQ,QAAQ;AAAA;AAAA,GAGpBC,IAAgBH,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAOzBE,EAAO,QAAQ,SAAS;AAAA;AAAA,GAGtBE,IAAgBJ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F;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIJ;"}
|
|
@@ -1,88 +1,84 @@
|
|
|
1
1
|
import { jsxs as g, jsx as h } from "react/jsx-runtime";
|
|
2
|
-
import { getMarkRange as
|
|
3
|
-
import { useEditor as
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import { BodyCaption as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return Object.entries(B).map(
|
|
2
|
+
import { getMarkRange as kt } from "../node_modules/@tiptap/core/dist/index.js";
|
|
3
|
+
import { useEditor as yt, EditorContent as Bt } from "@tiptap/react";
|
|
4
|
+
import { forwardRef as bt, useState as G, useRef as a, useEffect as xt, useImperativeHandle as vt } from "react";
|
|
5
|
+
import { BodyCaption as K } from "../components/TypographyStyle.js";
|
|
6
|
+
import { BikEditorShell as At, BikJsonHeader as Tt, BikJsonError as Et } from "./BikEditor.styles.js";
|
|
7
|
+
import { DEFAULT_FORMAT_STATE as X } from "./BikEditor.types.js";
|
|
8
|
+
import { buildJsonCodeBlockHtml as Rt, buildSectionedContent as Y, normalizeHtml as i, extractActiveFormats as tt, extractContent as et, parseJson as p, getCodeBlockText as d, extractBodyContent as It, extractSectionContent as Lt, setCodeBlockText as b, findSectionEndPos as nt, findSectionStartPos as Mt, setSectionContentInEditor as T, insertInlineHtml as Ot } from "./BikEditor.utils.js";
|
|
9
|
+
import { buildExtensions as Jt } from "./extensions/buildExtensions.js";
|
|
10
|
+
import { LinkBubbleMenu as Ft } from "./floating/LinkBubbleMenu.js";
|
|
11
|
+
import Nt from "../icons/BIK AI specific/WandSparkles.js";
|
|
12
|
+
import jt from "../icons/Actions/Formatting/Copy.js";
|
|
13
|
+
function zt(y) {
|
|
14
|
+
return Object.entries(y).map(
|
|
16
15
|
([x, S]) => `${x.replace(/([A-Z])/g, (k) => `-${k.toLowerCase()}`)}:${S}`
|
|
17
16
|
).join(";");
|
|
18
17
|
}
|
|
19
|
-
const
|
|
18
|
+
const Ht = (y, x) => {
|
|
20
19
|
const {
|
|
21
20
|
initialContent: S,
|
|
22
21
|
sections: k,
|
|
23
|
-
features:
|
|
24
|
-
disabled:
|
|
25
|
-
maxCharacters:
|
|
26
|
-
characterLimit:
|
|
27
|
-
shortcuts:
|
|
28
|
-
sendShortcut:
|
|
22
|
+
features: B,
|
|
23
|
+
disabled: ot,
|
|
24
|
+
maxCharacters: E,
|
|
25
|
+
characterLimit: rt,
|
|
26
|
+
shortcuts: st,
|
|
27
|
+
sendShortcut: it,
|
|
29
28
|
mentions: l,
|
|
30
29
|
slashCommands: C,
|
|
31
|
-
link:
|
|
32
|
-
onPaste:
|
|
33
|
-
onReady:
|
|
30
|
+
link: ct,
|
|
31
|
+
onPaste: at,
|
|
32
|
+
onReady: R,
|
|
34
33
|
onChange: I,
|
|
35
34
|
onSend: v,
|
|
36
35
|
onFocus: L,
|
|
37
36
|
onBlur: M,
|
|
38
37
|
onSelectionChange: O,
|
|
39
|
-
minHeight:
|
|
40
|
-
maxHeight:
|
|
41
|
-
style:
|
|
42
|
-
className:
|
|
38
|
+
minHeight: lt,
|
|
39
|
+
maxHeight: dt,
|
|
40
|
+
style: ut,
|
|
41
|
+
className: mt,
|
|
43
42
|
editorClassName: J,
|
|
44
|
-
editorStyle:
|
|
45
|
-
renderJsonError:
|
|
46
|
-
} =
|
|
47
|
-
(t) => Ot(t, H),
|
|
48
|
-
[H]
|
|
49
|
-
), [u, N] = K(null), [gt, j] = K(!1), ht = m ? Jt(S ?? "") : k?.length ? tt(
|
|
43
|
+
editorStyle: F,
|
|
44
|
+
renderJsonError: N
|
|
45
|
+
} = y, m = !!B?.jsonMode, [u, j] = G(null), [ft, z] = G(!1), gt = m ? Rt(S ?? "") : k?.length ? Y(
|
|
50
46
|
i(S ?? ""),
|
|
51
47
|
k.map((t) => ({ ...t, content: i(t.content) }))
|
|
52
|
-
) : i(S ?? ""), A = a([]),
|
|
53
|
-
w.current =
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
const n =
|
|
71
|
-
extensions:
|
|
72
|
-
features:
|
|
73
|
-
placeholder:
|
|
74
|
-
maxCharacters:
|
|
75
|
-
characterLimit:
|
|
48
|
+
) : i(S ?? ""), A = a([]), H = a(!1), w = a(R);
|
|
49
|
+
w.current = R;
|
|
50
|
+
const P = a(I);
|
|
51
|
+
P.current = I;
|
|
52
|
+
const D = a(O);
|
|
53
|
+
D.current = O;
|
|
54
|
+
const q = a(X), U = a(L);
|
|
55
|
+
U.current = L;
|
|
56
|
+
const W = a(M);
|
|
57
|
+
W.current = M;
|
|
58
|
+
const $ = a(v);
|
|
59
|
+
$.current = v;
|
|
60
|
+
const V = a(l?.agents ?? []);
|
|
61
|
+
V.current = l?.agents ?? [];
|
|
62
|
+
const _ = a(l?.teams ?? []);
|
|
63
|
+
_.current = l?.teams ?? [];
|
|
64
|
+
const Q = a(C?.items ?? []);
|
|
65
|
+
Q.current = C?.items ?? [];
|
|
66
|
+
const n = yt({
|
|
67
|
+
extensions: Jt({
|
|
68
|
+
features: B,
|
|
69
|
+
placeholder: y.placeholder,
|
|
70
|
+
maxCharacters: E,
|
|
71
|
+
characterLimit: rt,
|
|
76
72
|
hasSections: (k?.length ?? 0) > 0,
|
|
77
73
|
mentions: {
|
|
78
|
-
agents: l ?
|
|
79
|
-
teams: l ?
|
|
74
|
+
agents: l ? V : void 0,
|
|
75
|
+
teams: l ? _ : void 0
|
|
80
76
|
},
|
|
81
|
-
slashCommands: C ?
|
|
82
|
-
onPaste:
|
|
83
|
-
onSend: v ? (t) =>
|
|
84
|
-
sendShortcut:
|
|
85
|
-
shortcuts:
|
|
77
|
+
slashCommands: C ? Q : void 0,
|
|
78
|
+
onPaste: at,
|
|
79
|
+
onSend: v ? (t) => $.current?.(t) : void 0,
|
|
80
|
+
sendShortcut: it,
|
|
81
|
+
shortcuts: st,
|
|
86
82
|
onMentionSelected: l?.onSelect,
|
|
87
83
|
onSlashCommandSelected: C?.onSelect,
|
|
88
84
|
renderMentionItem: l?.renderItem,
|
|
@@ -91,38 +87,38 @@ const Ut = (B, x) => {
|
|
|
91
87
|
renderSlashCommandItem: C?.renderItem,
|
|
92
88
|
renderSlashCommandDropdown: C?.renderDropdown
|
|
93
89
|
}),
|
|
94
|
-
content:
|
|
95
|
-
editable: !
|
|
90
|
+
content: gt,
|
|
91
|
+
editable: !ot,
|
|
96
92
|
immediatelyRender: !1,
|
|
97
93
|
// SSR-safe — NEVER remove this
|
|
98
94
|
editorProps: {
|
|
99
95
|
attributes: {
|
|
100
96
|
...J ? { class: J } : {},
|
|
101
|
-
...
|
|
97
|
+
...F ? { style: zt(F) } : {}
|
|
102
98
|
}
|
|
103
99
|
},
|
|
104
100
|
onUpdate: ({ editor: t }) => {
|
|
105
|
-
if (
|
|
101
|
+
if (P.current?.(et(t)), m) {
|
|
106
102
|
const e = p(d(t));
|
|
107
|
-
|
|
103
|
+
j(e.valid ? null : e);
|
|
108
104
|
}
|
|
109
105
|
},
|
|
110
106
|
onTransaction: ({ editor: t }) => {
|
|
111
|
-
const e =
|
|
112
|
-
(o.bold !== e.bold || o.italic !== e.italic || o.underline !== e.underline || o.strike !== e.strike || o.bulletList !== e.bulletList || o.orderedList !== e.orderedList || o.blockquote !== e.blockquote || o.codeBlock !== e.codeBlock || o.superscript !== e.superscript || o.subscript !== e.subscript || o.textAlign !== e.textAlign || o.fontFamily !== e.fontFamily || o.fontSize !== e.fontSize || o.color !== e.color || o.highlight !== e.highlight || o.link?.href !== e.link?.href) && (
|
|
107
|
+
const e = tt(t), o = q.current;
|
|
108
|
+
(o.bold !== e.bold || o.italic !== e.italic || o.underline !== e.underline || o.strike !== e.strike || o.bulletList !== e.bulletList || o.orderedList !== e.orderedList || o.blockquote !== e.blockquote || o.codeBlock !== e.codeBlock || o.superscript !== e.superscript || o.subscript !== e.subscript || o.textAlign !== e.textAlign || o.fontFamily !== e.fontFamily || o.fontSize !== e.fontSize || o.color !== e.color || o.highlight !== e.highlight || o.link?.href !== e.link?.href) && (q.current = e, D.current?.(e));
|
|
113
109
|
},
|
|
114
|
-
onFocus: () =>
|
|
115
|
-
onBlur: () =>
|
|
110
|
+
onFocus: () => U.current?.(),
|
|
111
|
+
onBlur: () => W.current?.()
|
|
116
112
|
});
|
|
117
113
|
function s(t) {
|
|
118
114
|
n ? t(n) : A.current.push(t);
|
|
119
115
|
}
|
|
120
|
-
|
|
121
|
-
if (n && (A.current.length > 0 && A.current.splice(0).forEach((e) => e(n)),
|
|
116
|
+
xt(() => {
|
|
117
|
+
if (n && (A.current.length > 0 && A.current.splice(0).forEach((e) => e(n)), H.current || (H.current = !0, w.current?.()), m)) {
|
|
122
118
|
const t = p(d(n));
|
|
123
|
-
|
|
119
|
+
j(t.valid ? null : t);
|
|
124
120
|
}
|
|
125
|
-
}, [n, m]),
|
|
121
|
+
}, [n, m]), vt(
|
|
126
122
|
x,
|
|
127
123
|
() => ({
|
|
128
124
|
// ── Focus ────────────────────────────────────────────────────────
|
|
@@ -139,7 +135,7 @@ const Ut = (B, x) => {
|
|
|
139
135
|
s((o) => o.commands.insertContent(e));
|
|
140
136
|
},
|
|
141
137
|
insertInlineContent: (t) => {
|
|
142
|
-
s((e) =>
|
|
138
|
+
s((e) => Ot(e, t));
|
|
143
139
|
},
|
|
144
140
|
insertAtStart: (t) => {
|
|
145
141
|
const e = i(t);
|
|
@@ -164,7 +160,7 @@ const Ut = (B, x) => {
|
|
|
164
160
|
appendContent(t) {
|
|
165
161
|
this.appendInline(t);
|
|
166
162
|
},
|
|
167
|
-
getContent: () => n ?
|
|
163
|
+
getContent: () => n ? et(n) : { html: "", text: "", isEmpty: !0, characterCount: 0 },
|
|
168
164
|
getJSON: () => n?.getJSON() ?? null,
|
|
169
165
|
getMentions: () => {
|
|
170
166
|
const t = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Set();
|
|
@@ -189,7 +185,7 @@ const Ut = (B, x) => {
|
|
|
189
185
|
return t.doc.textBetween(e, o, " ");
|
|
190
186
|
const c = t.schema.marks.link;
|
|
191
187
|
if (c) {
|
|
192
|
-
const f =
|
|
188
|
+
const f = kt(t.doc.resolve(e), c);
|
|
193
189
|
if (f)
|
|
194
190
|
return t.doc.textBetween(f.from, f.to, " ");
|
|
195
191
|
}
|
|
@@ -198,13 +194,13 @@ const Ut = (B, x) => {
|
|
|
198
194
|
// ── Character count ───────────────────────────────────────────────
|
|
199
195
|
getCharacterCount: () => ({
|
|
200
196
|
count: n?.storage.characterCount?.characters?.() ?? n?.getText().length ?? 0,
|
|
201
|
-
limit:
|
|
197
|
+
limit: E ?? null
|
|
202
198
|
}),
|
|
203
199
|
// ── Sections ─────────────────────────────────────────────────────
|
|
204
|
-
getSectionContent: (t) => n ?
|
|
200
|
+
getSectionContent: (t) => n ? Lt(n, t) : { html: "", text: "", isEmpty: !0, characterCount: 0 },
|
|
205
201
|
setSectionContent: (t, e) => {
|
|
206
202
|
const o = i(e);
|
|
207
|
-
s((r) =>
|
|
203
|
+
s((r) => T(r, t, o));
|
|
208
204
|
},
|
|
209
205
|
focusSection: (t) => {
|
|
210
206
|
s((e) => {
|
|
@@ -221,16 +217,16 @@ const Ut = (B, x) => {
|
|
|
221
217
|
});
|
|
222
218
|
},
|
|
223
219
|
clearSection: (t) => {
|
|
224
|
-
s((e) =>
|
|
220
|
+
s((e) => T(e, t, "<p></p>"));
|
|
225
221
|
},
|
|
226
222
|
// ── Convenience body shorthands ───────────────────────────────────
|
|
227
|
-
getBodyContent: () => n ?
|
|
223
|
+
getBodyContent: () => n ? It(n) : { html: "", text: "", isEmpty: !0, characterCount: 0 },
|
|
228
224
|
setBodyContent: (t) => {
|
|
229
225
|
const e = i(t);
|
|
230
|
-
s((o) =>
|
|
226
|
+
s((o) => T(o, "body", e));
|
|
231
227
|
},
|
|
232
228
|
setBodyAndSections: (t, e) => {
|
|
233
|
-
const o =
|
|
229
|
+
const o = Y(
|
|
234
230
|
i(t),
|
|
235
231
|
e.map((r) => ({
|
|
236
232
|
id: r.id,
|
|
@@ -242,7 +238,7 @@ const Ut = (B, x) => {
|
|
|
242
238
|
appendBodyContent: (t) => {
|
|
243
239
|
const e = i(t);
|
|
244
240
|
s((o) => {
|
|
245
|
-
const r =
|
|
241
|
+
const r = nt(o, "body");
|
|
246
242
|
o.commands.insertContentAt(r - 1, e, {
|
|
247
243
|
parseOptions: { preserveWhitespace: !0 }
|
|
248
244
|
});
|
|
@@ -251,7 +247,7 @@ const Ut = (B, x) => {
|
|
|
251
247
|
insertAtSectionStart: (t, e) => {
|
|
252
248
|
const o = i(e);
|
|
253
249
|
s((r) => {
|
|
254
|
-
const c =
|
|
250
|
+
const c = Mt(r, t);
|
|
255
251
|
c !== -1 && r.commands.insertContentAt(c, o, {
|
|
256
252
|
parseOptions: { preserveWhitespace: !0 }
|
|
257
253
|
});
|
|
@@ -260,14 +256,14 @@ const Ut = (B, x) => {
|
|
|
260
256
|
insertAtSectionEnd: (t, e) => {
|
|
261
257
|
const o = i(e);
|
|
262
258
|
s((r) => {
|
|
263
|
-
const c =
|
|
259
|
+
const c = nt(r, t);
|
|
264
260
|
r.commands.insertContentAt(c, o, {
|
|
265
261
|
parseOptions: { preserveWhitespace: !0 }
|
|
266
262
|
});
|
|
267
263
|
});
|
|
268
264
|
},
|
|
269
265
|
// ── Formats & actions ─────────────────────────────────────────────
|
|
270
|
-
getActiveFormats: () => n ?
|
|
266
|
+
getActiveFormats: () => n ? tt(n) : X,
|
|
271
267
|
actions: {
|
|
272
268
|
toggleBold: () => n?.chain().focus().toggleBold().run(),
|
|
273
269
|
toggleItalic: () => n?.chain().focus().toggleItalic().run(),
|
|
@@ -286,12 +282,12 @@ const Ut = (B, x) => {
|
|
|
286
282
|
unsetHighlight: () => n?.chain().focus().unsetHighlight().run(),
|
|
287
283
|
setLink: (t, e) => {
|
|
288
284
|
n && (e !== void 0 ? n.chain().focus().extendMarkRange("link").command(({ tr: o, state: r }) => {
|
|
289
|
-
const { from: c, to: f } = o.selection,
|
|
290
|
-
if (!
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
]),
|
|
294
|
-
return o.replaceWith(c, f, [
|
|
285
|
+
const { from: c, to: f } = o.selection, Z = r.schema.marks.link;
|
|
286
|
+
if (!Z) return !1;
|
|
287
|
+
const Ct = r.schema.text(e, [
|
|
288
|
+
Z.create({ href: t })
|
|
289
|
+
]), St = r.schema.text(" ");
|
|
290
|
+
return o.replaceWith(c, f, [Ct, St]), !0;
|
|
295
291
|
}).run() : n.chain().focus().extendMarkRange("link").setLink({ href: t }).insertContent(" ").run());
|
|
296
292
|
},
|
|
297
293
|
updateLink: (t) => n?.chain().focus().extendMarkRange("link").setLink({ href: t }).run(),
|
|
@@ -308,7 +304,7 @@ const Ut = (B, x) => {
|
|
|
308
304
|
insertImage: (t) => n?.chain().focus().setImage({ src: t }).run()
|
|
309
305
|
},
|
|
310
306
|
// ── JSON body ─────────────────────────────────────────────────────
|
|
311
|
-
json:
|
|
307
|
+
json: B?.jsonMode ? {
|
|
312
308
|
getText: () => n ? d(n) : "",
|
|
313
309
|
setText: (t) => s((e) => b(e, t)),
|
|
314
310
|
parse: () => p(n ? d(n) : ""),
|
|
@@ -326,48 +322,48 @@ const Ut = (B, x) => {
|
|
|
326
322
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
327
323
|
[n]
|
|
328
324
|
);
|
|
329
|
-
const
|
|
325
|
+
const ht = () => {
|
|
330
326
|
if (!n) return;
|
|
331
327
|
const { valid: t, value: e } = p(d(n));
|
|
332
328
|
!t || e === null || b(n, JSON.stringify(e, null, 2));
|
|
333
|
-
},
|
|
334
|
-
n && (navigator.clipboard?.writeText(d(n)),
|
|
329
|
+
}, pt = () => {
|
|
330
|
+
n && (navigator.clipboard?.writeText(d(n)), z(!0), setTimeout(() => z(!1), 1500));
|
|
335
331
|
};
|
|
336
332
|
return n ? /* @__PURE__ */ g(
|
|
337
|
-
|
|
333
|
+
At,
|
|
338
334
|
{
|
|
339
|
-
minHeight:
|
|
340
|
-
maxHeight:
|
|
341
|
-
tightParagraphs: !
|
|
335
|
+
minHeight: lt,
|
|
336
|
+
maxHeight: dt,
|
|
337
|
+
tightParagraphs: !B?.richPaste,
|
|
342
338
|
jsonMode: m,
|
|
343
|
-
style:
|
|
344
|
-
className:
|
|
339
|
+
style: ut,
|
|
340
|
+
className: mt,
|
|
345
341
|
children: [
|
|
346
|
-
m && /* @__PURE__ */ g(
|
|
342
|
+
m && /* @__PURE__ */ g(Tt, { children: [
|
|
347
343
|
/* @__PURE__ */ h("span", { className: "bik-json-header-label", children: "JSON" }),
|
|
348
344
|
/* @__PURE__ */ g("div", { className: "bik-json-header-actions", children: [
|
|
349
345
|
/* @__PURE__ */ g(
|
|
350
346
|
"button",
|
|
351
347
|
{
|
|
352
348
|
type: "button",
|
|
353
|
-
onClick:
|
|
349
|
+
onClick: ht,
|
|
354
350
|
disabled: !!u,
|
|
355
351
|
title: "Format JSON",
|
|
356
352
|
children: [
|
|
357
|
-
/* @__PURE__ */ h(
|
|
358
|
-
/* @__PURE__ */ h(
|
|
353
|
+
/* @__PURE__ */ h(Nt, { size: 16 }),
|
|
354
|
+
/* @__PURE__ */ h(K, { children: "Beautify" })
|
|
359
355
|
]
|
|
360
356
|
}
|
|
361
357
|
),
|
|
362
|
-
/* @__PURE__ */ g("button", { type: "button", onClick:
|
|
363
|
-
/* @__PURE__ */ h(
|
|
364
|
-
|
|
358
|
+
/* @__PURE__ */ g("button", { type: "button", onClick: pt, title: "Copy JSON", children: [
|
|
359
|
+
/* @__PURE__ */ h(jt, { size: 16 }),
|
|
360
|
+
ft && /* @__PURE__ */ h(K, { children: "Copied" })
|
|
365
361
|
] })
|
|
366
362
|
] })
|
|
367
363
|
] }),
|
|
368
|
-
/* @__PURE__ */ h(
|
|
369
|
-
/* @__PURE__ */ h(
|
|
370
|
-
m && u ?
|
|
364
|
+
/* @__PURE__ */ h(Bt, { editor: n }),
|
|
365
|
+
/* @__PURE__ */ h(Ft, { editor: n, renderLinkTooltip: ct?.renderTooltip }),
|
|
366
|
+
m && u ? N ? N(u) : /* @__PURE__ */ g(Et, { children: [
|
|
371
367
|
u.line != null && /* @__PURE__ */ g("strong", { children: [
|
|
372
368
|
"Line ",
|
|
373
369
|
u.line,
|
|
@@ -380,11 +376,11 @@ const Ut = (B, x) => {
|
|
|
380
376
|
]
|
|
381
377
|
}
|
|
382
378
|
) : null;
|
|
383
|
-
},
|
|
384
|
-
|
|
379
|
+
}, wt = bt(
|
|
380
|
+
Ht
|
|
385
381
|
);
|
|
386
|
-
|
|
382
|
+
wt.displayName = "BikEditor";
|
|
387
383
|
export {
|
|
388
|
-
|
|
384
|
+
wt as BikEditor
|
|
389
385
|
};
|
|
390
386
|
//# sourceMappingURL=BikEditor.js.map
|