@bikdotai/bik-component-library 0.0.863-beta.6 → 0.0.863

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.
Files changed (78) hide show
  1. package/dist/cjs/components/agent-builder/AgentBuilder.js +1 -1
  2. package/dist/cjs/components/agent-builder/AgentBuilder.js.map +1 -1
  3. package/dist/cjs/components/agent-builder/AgentBuilder.styled.js +42 -174
  4. package/dist/cjs/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  5. package/dist/cjs/components/agent-builder/components/MentionPicker.js +1 -1
  6. package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
  7. package/dist/cjs/components/agent-builder/components/SelectableListSection.js +3 -3
  8. package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
  9. package/dist/cjs/components/agent-builder/constants/steps.js +1 -1
  10. package/dist/cjs/components/agent-builder/constants/steps.js.map +1 -1
  11. package/dist/cjs/components/agent-builder/constants/tools.js +1 -1
  12. package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -1
  13. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
  14. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  15. package/dist/cjs/components/agent-builder/steps/Step1About.js +1 -1
  16. package/dist/cjs/components/agent-builder/steps/Step1About.js.map +1 -1
  17. package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js +2 -2
  18. package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
  19. package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js +1 -1
  20. package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
  21. package/dist/cjs/components/agent-builder/utils/sourceIcons.js.map +1 -1
  22. package/dist/cjs/components/agent-listing/AgentTableRow.js +1 -1
  23. package/dist/cjs/components/agent-listing/AgentTableRow.js.map +1 -1
  24. package/dist/cjs/index.js +1 -1
  25. package/dist/esm/components/agent-builder/AgentBuilder.js +99 -105
  26. package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
  27. package/dist/esm/components/agent-builder/AgentBuilder.model.d.ts +0 -76
  28. package/dist/esm/components/agent-builder/AgentBuilder.styled.d.ts +0 -91
  29. package/dist/esm/components/agent-builder/AgentBuilder.styled.js +93 -271
  30. package/dist/esm/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  31. package/dist/esm/components/agent-builder/components/MentionPicker.js +27 -27
  32. package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
  33. package/dist/esm/components/agent-builder/components/SelectableListSection.js +42 -34
  34. package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
  35. package/dist/esm/components/agent-builder/constants/steps.d.ts +1 -31
  36. package/dist/esm/components/agent-builder/constants/steps.js +6 -15
  37. package/dist/esm/components/agent-builder/constants/steps.js.map +1 -1
  38. package/dist/esm/components/agent-builder/constants/tools.d.ts +6 -5
  39. package/dist/esm/components/agent-builder/constants/tools.js +24 -21
  40. package/dist/esm/components/agent-builder/constants/tools.js.map +1 -1
  41. package/dist/esm/components/agent-builder/context/AgentBuilderContext.d.ts +1 -13
  42. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +175 -192
  43. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  44. package/dist/esm/components/agent-builder/index.d.ts +2 -7
  45. package/dist/esm/components/agent-builder/steps/Step1About.js +13 -15
  46. package/dist/esm/components/agent-builder/steps/Step1About.js.map +1 -1
  47. package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js +49 -54
  48. package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
  49. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.d.ts +0 -11
  50. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js +23 -127
  51. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
  52. package/dist/esm/components/agent-builder/utils/sourceIcons.d.ts +4 -0
  53. package/dist/esm/components/agent-builder/utils/sourceIcons.js.map +1 -1
  54. package/dist/esm/components/agent-listing/AgentTableRow.js +38 -71
  55. package/dist/esm/components/agent-listing/AgentTableRow.js.map +1 -1
  56. package/dist/esm/index.js +634 -644
  57. package/dist/esm/index.js.map +1 -1
  58. package/package.json +4 -4
  59. package/dist/cjs/components/agent-builder/components/AgentStateModal.js +0 -2
  60. package/dist/cjs/components/agent-builder/components/AgentStateModal.js.map +0 -1
  61. package/dist/cjs/components/agent-builder/components/ChannelSelectModal.js +0 -2
  62. package/dist/cjs/components/agent-builder/components/ChannelSelectModal.js.map +0 -1
  63. package/dist/cjs/components/agent-builder/components/ChannelsSection.js +0 -2
  64. package/dist/cjs/components/agent-builder/components/ChannelsSection.js.map +0 -1
  65. package/dist/cjs/components/agent-builder/constants/channels.js +0 -2
  66. package/dist/cjs/components/agent-builder/constants/channels.js.map +0 -1
  67. package/dist/esm/components/agent-builder/components/AgentStateModal.d.ts +0 -47
  68. package/dist/esm/components/agent-builder/components/AgentStateModal.js +0 -82
  69. package/dist/esm/components/agent-builder/components/AgentStateModal.js.map +0 -1
  70. package/dist/esm/components/agent-builder/components/ChannelSelectModal.d.ts +0 -26
  71. package/dist/esm/components/agent-builder/components/ChannelSelectModal.js +0 -121
  72. package/dist/esm/components/agent-builder/components/ChannelSelectModal.js.map +0 -1
  73. package/dist/esm/components/agent-builder/components/ChannelsSection.d.ts +0 -10
  74. package/dist/esm/components/agent-builder/components/ChannelsSection.js +0 -183
  75. package/dist/esm/components/agent-builder/components/ChannelsSection.js.map +0 -1
  76. package/dist/esm/components/agent-builder/constants/channels.d.ts +0 -56
  77. package/dist/esm/components/agent-builder/constants/channels.js +0 -41
  78. package/dist/esm/components/agent-builder/constants/channels.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.863-beta.6",
3
+ "version": "0.0.863",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -67,7 +67,7 @@
67
67
  "not op_mini all"
68
68
  ],
69
69
  "dependencies": {
70
- "@bikdotai/bik-models": "^11.43.1",
70
+ "@bikdotai/bik-models": "^11.53.3",
71
71
  "@hello-pangea/dnd": "^18.0.1",
72
72
  "@popperjs/core": "^2.11.7",
73
73
  "@tippyjs/react": "^4.2.6",
@@ -121,6 +121,8 @@
121
121
  "@storybook/addon-docs": "9.1.20",
122
122
  "@storybook/addon-links": "9.1.20",
123
123
  "@storybook/react-vite": "9.1.20",
124
+ "@swc/core": "^1.11.0",
125
+ "@swc/jest": "^0.2.37",
124
126
  "@testing-library/jest-dom": "^5.16.5",
125
127
  "@testing-library/react": "^13.4.0",
126
128
  "@testing-library/user-event": "^14.4.3",
@@ -159,8 +161,6 @@
159
161
  "redux": "^4.1.2",
160
162
  "storybook": "9.1.20",
161
163
  "styled-components": "^5.3.3",
162
- "@swc/core": "^1.11.0",
163
- "@swc/jest": "^0.2.37",
164
164
  "tslib": "^2.4.1",
165
165
  "typescript": "^4.9.4",
166
166
  "vite": "^7.3.5",
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("../../../assets/icons/errorIcon.svg.js"),j=require("../../spinner/Spinner.js"),r=require("../../TypographyStyle.js"),l=require("../../../constants/Theme.js"),n=require("../AgentBuilder.styled.js"),S=require("../../modals/styledModal.js"),d=require("../../button/Button.js"),m=({open:a,state:c,title:x,message:u,primaryButton:t,secondaryButton:i,loadingImageUrl:o,onClose:h,zIndex:g})=>{if(!a)return null;const s=c==="loading",y=s?null:i??t;return e.jsx(S.StyledModal,{"data-test":"agent-state-modal",open:!0,onClose:h,width:"520px",zIndex:g,hideCrossButton:s,closeOnOutsideClick:!s,closeOnEscapeKey:!s,children:e.jsxs(n.AgentStateModalBody,{style:{gap:"24px"},children:[e.jsxs(n.AgentStateModalHero,{children:[e.jsx(n.ModalIcon,{children:s?o?e.jsx("img",{src:o,alt:"",width:64,height:64}):e.jsx(j.Spinner,{size:"large",color:l.COLORS.stroke.brand}):e.jsx(p.default,{width:64,height:64})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[e.jsx(r.TitleMedium,{color:l.COLORS.content.primary,children:x}),e.jsx(r.BodyPrimary,{color:l.COLORS.content.secondary,style:{whiteSpace:"pre-line"},children:u})]})]}),y&&e.jsxs(n.ModalActions,{children:[i&&e.jsx("div",{style:{display:"flex"},children:e.jsx(d.Button,{"data-test":"agent-state-secondary",buttonType:"secondary",size:"medium",matchParentWidth:!0,buttonText:i.text,isLoading:i.isLoading,onClick:i.onClick})}),t&&e.jsx("div",{style:{display:"flex"},children:e.jsx(d.Button,{"data-test":"agent-state-primary",buttonType:"primary",size:"medium",matchParentWidth:!0,buttonText:t.text,isLoading:t.isLoading,onClick:t.onClick})})]})]})})};exports.AgentStateModal=m;
2
- //# sourceMappingURL=AgentStateModal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AgentStateModal.js","sources":["../../../../../src/components/agent-builder/components/AgentStateModal.tsx"],"sourcesContent":["import ErrorIcon from '@src/assets/icons/errorIcon.svg';\nimport React from 'react';\nimport { Button } from '@src/components/button';\nimport { StyledModal } from '@src/components/modals';\nimport { Spinner } from '@src/components/spinner/Spinner';\nimport { BodyPrimary, TitleMedium } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tAgentStateModalBody,\n\tAgentStateModalHero,\n\tModalActions,\n\tModalIcon,\n} from '../AgentBuilder.styled';\n\nexport type AgentModalState = 'loading' | 'error';\n\ninterface AgentStateAction {\n\ttext: string;\n\tonClick: () => void;\n\tisLoading?: boolean;\n}\n\ninterface AgentStateModalProps {\n\topen: boolean;\n\t/** `loading` while the write is in flight, `error` once it came back badly. */\n\tstate: AgentModalState;\n\t/** Heading, e.g. \"Agent couldn't go live\". Comes from the caller — on `error` the\n\t * server owns this copy, so the builder never composes it. */\n\ttitle: string;\n\t/** Body copy. Line breaks are preserved, so a caller can pass one line per reason\n\t * (e.g. per conflicting intent) without markup. */\n\tmessage: string;\n\t/** Right-hand action, e.g. \"Try again\", or the step to fix when the caller knows\n\t * one (\"Go to When it steps in\"). */\n\tprimaryButton?: AgentStateAction;\n\t/** Left-hand action, e.g. \"Go back to editing\". */\n\tsecondaryButton?: AgentStateAction;\n\t/** 64px image for the `loading` badge — pass the host's loader asset to match its\n\t * other dialogs. Falls back to `Spinner`, so the library needs no remote asset. */\n\tloadingImageUrl?: string;\n\t/** Cross button / outside click. Always available, so a message-only dialog is\n\t * still dismissible with no actions at all. Not offered while `loading`. */\n\tonClose: () => void;\n\tzIndex?: number;\n}\n\n/**\n * What's happening to a save or publish: in flight, or failed. Sibling of\n * `GoLiveModal` — same hero layout (badge, title, body, actions), and the actions sit\n * inside the body for the same reason (see GoLiveModal). Every state is pinned to\n * `AGENT_STATE_MODAL_MIN_HEIGHT`, the go-live success height, so the card doesn't\n * resize as one state replaces another.\n *\n * Deliberately copy-free: title, message and button labels all come from the caller,\n * because the server owns the wording of the failure it just reported.\n *\n * Both buttons are optional, so one component covers every shape — two actions, one,\n * or message-only. That last one is for a failure with nothing to offer: no step to\n * send the merchant to and nothing a retry would change. `loading` never renders\n * actions or a cross, since there is nothing to decide yet.\n */\nexport const AgentStateModal: React.FC<AgentStateModalProps> = ({\n\topen,\n\tstate,\n\ttitle,\n\tmessage,\n\tprimaryButton,\n\tsecondaryButton,\n\tloadingImageUrl,\n\tonClose,\n\tzIndex,\n}) => {\n\tif (!open) {\n\t\treturn null;\n\t}\n\n\tconst isLoading = state === 'loading';\n\tconst actions = isLoading ? null : secondaryButton ?? primaryButton;\n\n\treturn (\n\t\t<StyledModal\n\t\t\tdata-test=\"agent-state-modal\"\n\t\t\topen\n\t\t\tonClose={onClose}\n\t\t\twidth=\"520px\"\n\t\t\tzIndex={zIndex}\n\t\t\thideCrossButton={isLoading}\n\t\t\tcloseOnOutsideClick={!isLoading}\n\t\t\tcloseOnEscapeKey={!isLoading}\n\t\t>\n\t\t\t<AgentStateModalBody style={{ gap: '24px' }}>\n\t\t\t\t<AgentStateModalHero>\n\t\t\t\t\t<ModalIcon>\n\t\t\t\t\t\t{isLoading ? (\n\t\t\t\t\t\t\tloadingImageUrl ? (\n\t\t\t\t\t\t\t\t<img src={loadingImageUrl} alt=\"\" width={64} height={64} />\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Spinner size=\"large\" color={COLORS.stroke.brand} />\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ErrorIcon width={64} height={64} />\n\t\t\t\t\t\t)}\n\t\t\t\t\t</ModalIcon>\n\n\t\t\t\t\t<div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>\n\t\t\t\t\t\t<TitleMedium color={COLORS.content.primary}>{title}</TitleMedium>\n\t\t\t\t\t\t<BodyPrimary\n\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\tstyle={{ whiteSpace: 'pre-line' }}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{message}\n\t\t\t\t\t\t</BodyPrimary>\n\t\t\t\t\t</div>\n\t\t\t\t</AgentStateModalHero>\n\n\t\t\t\t{actions && (\n\t\t\t\t\t<ModalActions>\n\t\t\t\t\t\t{secondaryButton && (\n\t\t\t\t\t\t\t<div style={{ display: 'flex' }}>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tdata-test=\"agent-state-secondary\"\n\t\t\t\t\t\t\t\t\tbuttonType=\"secondary\"\n\t\t\t\t\t\t\t\t\tsize=\"medium\"\n\t\t\t\t\t\t\t\t\tmatchParentWidth\n\t\t\t\t\t\t\t\t\tbuttonText={secondaryButton.text}\n\t\t\t\t\t\t\t\t\tisLoading={secondaryButton.isLoading}\n\t\t\t\t\t\t\t\t\tonClick={secondaryButton.onClick}\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\t{primaryButton && (\n\t\t\t\t\t\t\t<div style={{ display: 'flex' }}>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tdata-test=\"agent-state-primary\"\n\t\t\t\t\t\t\t\t\tbuttonType=\"primary\"\n\t\t\t\t\t\t\t\t\tsize=\"medium\"\n\t\t\t\t\t\t\t\t\tmatchParentWidth\n\t\t\t\t\t\t\t\t\tbuttonText={primaryButton.text}\n\t\t\t\t\t\t\t\t\tisLoading={primaryButton.isLoading}\n\t\t\t\t\t\t\t\t\tonClick={primaryButton.onClick}\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</ModalActions>\n\t\t\t\t)}\n\t\t\t</AgentStateModalBody>\n\t\t</StyledModal>\n\t);\n};\n"],"names":["AgentStateModal","open","state","title","message","primaryButton","secondaryButton","loadingImageUrl","onClose","zIndex","isLoading","actions","jsx","StyledModal","AgentStateModalBody","jsxs","AgentStateModalHero","ModalIcon","Spinner","COLORS","ErrorIcon","TitleMedium","BodyPrimary","ModalActions","Button"],"mappings":"kZA6DaA,EAAkD,CAAC,CAC/D,KAAAC,EACA,MAAAC,EACA,MAAAC,EACA,QAAAC,EACA,cAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,QAAAC,EACA,OAAAC,CACD,IAAM,CACL,GAAI,CAACR,EACJ,OAAO,KAGR,MAAMS,EAAYR,IAAU,UACtBS,EAAUD,EAAY,KAAOJ,GAAmBD,EAEtD,OACCO,EAAAA,IAACC,EAAAA,YAAA,CACA,YAAU,oBACV,KAAI,GACJ,QAAAL,EACA,MAAM,QACN,OAAAC,EACA,gBAAiBC,EACjB,oBAAqB,CAACA,EACtB,iBAAkB,CAACA,EAEnB,gBAACI,EAAAA,oBAAA,CAAoB,MAAO,CAAE,IAAK,QAClC,SAAA,CAAAC,OAACC,EAAAA,oBAAA,CACA,SAAA,CAAAJ,EAAAA,IAACK,EAAAA,UAAA,CACC,SAAAP,EACAH,EACCK,EAAAA,IAAC,MAAA,CAAI,IAAKL,EAAiB,IAAI,GAAG,MAAO,GAAI,OAAQ,GAAI,EAEzDK,EAAAA,IAACM,EAAAA,QAAA,CAAQ,KAAK,QAAQ,MAAOC,EAAAA,OAAO,OAAO,KAAA,CAAO,EAGnDP,EAAAA,IAACQ,EAAAA,QAAA,CAAU,MAAO,GAAI,OAAQ,GAAI,EAEpC,EAEAL,EAAAA,KAAC,MAAA,CAAI,MAAO,CAAE,QAAS,OAAQ,cAAe,SAAU,IAAK,KAAA,EAC5D,SAAA,CAAAH,MAACS,EAAAA,YAAA,CAAY,MAAOF,EAAAA,OAAO,QAAQ,QAAU,SAAAhB,EAAM,EACnDS,EAAAA,IAACU,EAAAA,YAAA,CACA,MAAOH,EAAAA,OAAO,QAAQ,UACtB,MAAO,CAAE,WAAY,UAAA,EAEpB,SAAAf,CAAA,CAAA,CACF,CAAA,CACD,CAAA,EACD,EAECO,UACCY,eAAA,CACC,SAAA,CAAAjB,SACC,MAAA,CAAI,MAAO,CAAE,QAAS,QACtB,SAAAM,EAAAA,IAACY,EAAAA,OAAA,CACA,YAAU,wBACV,WAAW,YACX,KAAK,SACL,iBAAgB,GAChB,WAAYlB,EAAgB,KAC5B,UAAWA,EAAgB,UAC3B,QAASA,EAAgB,OAAA,CAAA,EAE3B,EAEAD,GACAO,EAAAA,IAAC,MAAA,CAAI,MAAO,CAAE,QAAS,QACtB,SAAAA,EAAAA,IAACY,EAAAA,OAAA,CACA,YAAU,sBACV,WAAW,UACX,KAAK,SACL,iBAAgB,GAChB,WAAYnB,EAAc,KAC1B,UAAWA,EAAc,UACzB,QAASA,EAAc,OAAA,CAAA,CACxB,CACD,CAAA,CAAA,CAEF,CAAA,CAAA,CAEF,CAAA,CAAA,CAGH"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),j=require("../../../assets/icons/RedirectToNew.svg.js"),x=require("react"),i=require("../../TypographyStyle.js"),r=require("../../../constants/Theme.js"),a=require("../AgentBuilder.styled.js"),g=require("../constants/channels.js"),f=require("../../modals/styledModal.js"),T=require("../../checkBox/CheckBox.js"),k=require("../../tag/Tag.js"),p=({channel:n,selectedIds:c,onClose:s,onApply:S,onManageChannels:d})=>{const[h,u]=x.useState(c);if(x.useEffect(()=>{n&&u(c)},[n]),!n)return null;const{Icon:y,tint:m,accountsNoun:o}=g.channelPresentation(n.type,n.label),C=t=>u(l=>l.includes(t)?l.filter(b=>b!==t):[...l,t]);return e.jsx(f.StyledModal,{"data-test":"agent-channel-select-modal",open:!0,onClose:s,width:"640px",headingTitle:"Select channels to activate",headingSubtitle:`Select the ${o} on which you need this agent enabled on.`,modalHeaderStyles:{padding:"24px",boxSizing:"border-box"},modalBodyStyles:{boxSizing:"border-box"},footerContainerStyle:{padding:"20px 24px",boxSizing:"border-box"},footerLeftCustomElement:d?e.jsxs(a.ChannelsLink,{"data-test":"agent-channel-management-link",type:"button",onClick:d,style:{fontSize:14,lineHeight:"20px",fontWeight:600},children:["Channel management",e.jsx(j.default,{width:16,height:16})]}):void 0,secondaryButton:{"data-test":"agent-channel-cancel",buttonType:"tertiaryGray",size:"small",buttonText:"Cancel",onClick:s},primaryButton:{"data-test":"agent-channel-apply",buttonType:"primary",size:"small",buttonText:"Apply",onClick:()=>S(h)},children:e.jsxs(a.ChannelPickerBody,{children:[e.jsx(i.BodySecondary,{color:r.COLORS.content.secondary,children:`Select from available ${o}`}),e.jsxs(a.ChannelPickerList,{children:[n.accounts.map(t=>{const l=g.isAccountDisconnected(t);return e.jsxs(a.ChannelPickerRow,{"data-test":`agent-channel-account-${t.channelId}`,children:[e.jsx(T.CheckBox,{isChecked:h.includes(t.channelId),ariaLabel:t.channelName,value:t.channelId,onValueChange:()=>C(t.channelId),style:a.CHECKBOX_SLOT}),e.jsxs(a.ChannelPickerAccount,{children:[e.jsx(a.ChannelGlyph,{tint:m,children:y&&e.jsx(y,{size:16})}),e.jsx(i.TitleSmall,{color:r.COLORS.content.primary,children:t.channelName}),l&&e.jsx(k.Tag,{tagText:"Disconnected",type:"negative",variant:"regular",height:20,padding:"2px 8px"})]})]},t.channelId)}),n.accounts.length===0&&e.jsx(i.BodySecondary,{color:r.COLORS.content.placeholder,children:`No ${o} are connected to this store yet.`})]})]})})};p.displayName="ChannelSelectModal";exports.ChannelSelectModal=p;
2
- //# sourceMappingURL=ChannelSelectModal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChannelSelectModal.js","sources":["../../../../../src/components/agent-builder/components/ChannelSelectModal.tsx"],"sourcesContent":["import RedirectIcon from '@src/assets/icons/RedirectToNew.svg';\nimport React, { useEffect, useState } from 'react';\nimport { CheckBox } from '@src/components/checkBox';\nimport { StyledModal } from '@src/components/modals';\nimport { Tag } from '@src/components/tag';\nimport { BodySecondary, TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport type { AgentChannel } from '../AgentBuilder.model';\nimport {\n\tChannelGlyph,\n\tChannelPickerAccount,\n\tChannelPickerBody,\n\tChannelPickerList,\n\tChannelPickerRow,\n\tChannelsLink,\n\tCHECKBOX_SLOT,\n} from '../AgentBuilder.styled';\nimport {\n\tchannelPresentation,\n\tisAccountDisconnected,\n} from '../constants/channels';\n\ninterface ChannelSelectModalProps {\n\t/** The channel being edited. `null` closes the modal. */\n\tchannel: AgentChannel | null;\n\t/** Currently activated backend channel ids for this channel. */\n\tselectedIds: string[];\n\tonClose: () => void;\n\t/** Apply — commits the draft selection as backend channel ids. */\n\tonApply: (channelIds: string[]) => void;\n\t/** Footer \"Channel management\" link. Omit to hide it. */\n\tonManageChannels?: () => void;\n}\n\n/**\n * Per-channel account picker, opened from a channel row's edit button.\n *\n * The selection is a LOCAL draft until Apply — the design gives the merchant a\n * Cancel, so toggling here must not reach the agent value until they commit.\n *\n * A disconnected account stays selectable and stays selected: the merchant may\n * be mid-reconnect, and quietly removing it from their agent would hide the\n * problem rather than surface it. It's labelled instead, and the row it came\n * from carries the alert.\n */\nexport const ChannelSelectModal: React.FC<ChannelSelectModalProps> = ({\n\tchannel,\n\tselectedIds,\n\tonClose,\n\tonApply,\n\tonManageChannels,\n}) => {\n\tconst [draft, setDraft] = useState<string[]>(selectedIds);\n\n\t// Re-seed whenever the modal opens (or reopens for a different channel), so a\n\t// cancelled edit doesn't leak into the next one.\n\tuseEffect(() => {\n\t\tif (channel) {\n\t\t\tsetDraft(selectedIds);\n\t\t}\n\t\t// `selectedIds` is intentionally read only at open time — the draft owns it\n\t\t// from then until Apply.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [channel]);\n\n\tif (!channel) {\n\t\treturn null;\n\t}\n\n\tconst { Icon, tint, accountsNoun } = channelPresentation(\n\t\tchannel.type,\n\t\tchannel.label,\n\t);\n\n\tconst toggle = (channelId: string) =>\n\t\tsetDraft((prev) =>\n\t\t\tprev.includes(channelId)\n\t\t\t\t? prev.filter((id) => id !== channelId)\n\t\t\t\t: [...prev, channelId],\n\t\t);\n\n\treturn (\n\t\t<StyledModal\n\t\t\tdata-test=\"agent-channel-select-modal\"\n\t\t\topen\n\t\t\tonClose={onClose}\n\t\t\twidth=\"640px\"\n\t\t\theadingTitle=\"Select channels to activate\"\n\t\t\theadingSubtitle={`Select the ${accountsNoun} on which you need this agent enabled on.`}\n\t\t\t// This repo has no global `box-sizing: border-box`, so StyledModal's\n\t\t\t// `width: 100%` + 24px side padding resolves to 688px inside its 640px\n\t\t\t// `overflow: hidden` wrapper — clipping the right 48px, and with it the\n\t\t\t// primary button. Border-box on each section is the fix that doesn't\n\t\t\t// touch the shared modal.\n\t\t\tmodalHeaderStyles={{ padding: '24px', boxSizing: 'border-box' }}\n\t\t\tmodalBodyStyles={{ boxSizing: 'border-box' }}\n\t\t\tfooterContainerStyle={{ padding: '20px 24px', boxSizing: 'border-box' }}\n\t\t\tfooterLeftCustomElement={\n\t\t\t\tonManageChannels ? (\n\t\t\t\t\t<ChannelsLink\n\t\t\t\t\t\tdata-test=\"agent-channel-management-link\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonClick={onManageChannels}\n\t\t\t\t\t\tstyle={{ fontSize: 14, lineHeight: '20px', fontWeight: 600 }}\n\t\t\t\t\t>\n\t\t\t\t\t\tChannel management\n\t\t\t\t\t\t<RedirectIcon width={16} height={16} />\n\t\t\t\t\t</ChannelsLink>\n\t\t\t\t) : undefined\n\t\t\t}\n\t\t\tsecondaryButton={{\n\t\t\t\t'data-test': 'agent-channel-cancel',\n\t\t\t\tbuttonType: 'tertiaryGray',\n\t\t\t\tsize: 'small',\n\t\t\t\tbuttonText: 'Cancel',\n\t\t\t\tonClick: onClose,\n\t\t\t}}\n\t\t\tprimaryButton={{\n\t\t\t\t'data-test': 'agent-channel-apply',\n\t\t\t\tbuttonType: 'primary',\n\t\t\t\tsize: 'small',\n\t\t\t\tbuttonText: 'Apply',\n\t\t\t\tonClick: () => onApply(draft),\n\t\t\t}}\n\t\t>\n\t\t\t<ChannelPickerBody>\n\t\t\t\t<BodySecondary color={COLORS.content.secondary}>\n\t\t\t\t\t{`Select from available ${accountsNoun}`}\n\t\t\t\t</BodySecondary>\n\n\t\t\t\t<ChannelPickerList>\n\t\t\t\t\t{channel.accounts.map((account) => {\n\t\t\t\t\t\tconst disconnected = isAccountDisconnected(account);\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<ChannelPickerRow\n\t\t\t\t\t\t\t\tkey={account.channelId}\n\t\t\t\t\t\t\t\tdata-test={`agent-channel-account-${account.channelId}`}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<CheckBox\n\t\t\t\t\t\t\t\t\tisChecked={draft.includes(account.channelId)}\n\t\t\t\t\t\t\t\t\tariaLabel={account.channelName}\n\t\t\t\t\t\t\t\t\tvalue={account.channelId}\n\t\t\t\t\t\t\t\t\tonValueChange={() => toggle(account.channelId)}\n\t\t\t\t\t\t\t\t\tstyle={CHECKBOX_SLOT}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<ChannelPickerAccount>\n\t\t\t\t\t\t\t\t\t<ChannelGlyph tint={tint}>\n\t\t\t\t\t\t\t\t\t\t{Icon && <Icon size={16} />}\n\t\t\t\t\t\t\t\t\t</ChannelGlyph>\n\t\t\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t\t\t{account.channelName}\n\t\t\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t\t\t{disconnected && (\n\t\t\t\t\t\t\t\t\t\t// NOT `size=\"small\"`: that renders through BodyTiny, which\n\t\t\t\t\t\t\t\t\t\t// is 10px AND has no font-family, so it falls back to the\n\t\t\t\t\t\t\t\t\t\t// browser serif. The default reads as 12px Inter — Figma's\n\t\t\t\t\t\t\t\t\t\t// body-caption, same as every other chip.\n\t\t\t\t\t\t\t\t\t\t<Tag\n\t\t\t\t\t\t\t\t\t\t\ttagText=\"Disconnected\"\n\t\t\t\t\t\t\t\t\t\t\ttype=\"negative\"\n\t\t\t\t\t\t\t\t\t\t\tvariant=\"regular\"\n\t\t\t\t\t\t\t\t\t\t\theight={20}\n\t\t\t\t\t\t\t\t\t\t\tpadding=\"2px 8px\"\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</ChannelPickerAccount>\n\t\t\t\t\t\t\t</ChannelPickerRow>\n\t\t\t\t\t\t);\n\t\t\t\t\t})}\n\n\t\t\t\t\t{channel.accounts.length === 0 && (\n\t\t\t\t\t\t<BodySecondary color={COLORS.content.placeholder}>\n\t\t\t\t\t\t\t{`No ${accountsNoun} are connected to this store yet.`}\n\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t)}\n\t\t\t\t</ChannelPickerList>\n\t\t\t</ChannelPickerBody>\n\t\t</StyledModal>\n\t);\n};\n\nChannelSelectModal.displayName = 'ChannelSelectModal';\n\nexport type { ChannelSelectModalProps };\n"],"names":["ChannelSelectModal","channel","selectedIds","onClose","onApply","onManageChannels","draft","setDraft","useState","useEffect","Icon","tint","accountsNoun","channelPresentation","toggle","channelId","prev","id","jsx","StyledModal","jsxs","ChannelsLink","RedirectIcon","ChannelPickerBody","BodySecondary","COLORS","ChannelPickerList","account","disconnected","isAccountDisconnected","ChannelPickerRow","CheckBox","CHECKBOX_SLOT","ChannelPickerAccount","ChannelGlyph","TitleSmall","Tag"],"mappings":"2cA6CaA,EAAwD,CAAC,CACrE,QAAAC,EACA,YAAAC,EACA,QAAAC,EACA,QAAAC,EACA,iBAAAC,CACD,IAAM,CACL,KAAM,CAACC,EAAOC,CAAQ,EAAIC,EAAAA,SAAmBN,CAAW,EAaxD,GATAO,EAAAA,UAAU,IAAM,CACXR,GACHM,EAASL,CAAW,CAKtB,EAAG,CAACD,CAAO,CAAC,EAER,CAACA,EACJ,OAAO,KAGR,KAAM,CAAE,KAAAS,EAAM,KAAAC,EAAM,aAAAC,CAAA,EAAiBC,EAAAA,oBACpCZ,EAAQ,KACRA,EAAQ,KAAA,EAGHa,EAAUC,GACfR,EAAUS,GACTA,EAAK,SAASD,CAAS,EACpBC,EAAK,OAAQC,GAAOA,IAAOF,CAAS,EACpC,CAAC,GAAGC,EAAMD,CAAS,CAAA,EAGxB,OACCG,EAAAA,IAACC,EAAAA,YAAA,CACA,YAAU,6BACV,KAAI,GACJ,QAAAhB,EACA,MAAM,QACN,aAAa,8BACb,gBAAiB,cAAcS,CAAY,4CAM3C,kBAAmB,CAAE,QAAS,OAAQ,UAAW,YAAA,EACjD,gBAAiB,CAAE,UAAW,YAAA,EAC9B,qBAAsB,CAAE,QAAS,YAAa,UAAW,YAAA,EACzD,wBACCP,EACCe,EAAAA,KAACC,EAAAA,aAAA,CACA,YAAU,gCACV,KAAK,SACL,QAAShB,EACT,MAAO,CAAE,SAAU,GAAI,WAAY,OAAQ,WAAY,GAAA,EACvD,SAAA,CAAA,qBAEAa,EAAAA,IAACI,EAAAA,QAAA,CAAa,MAAO,GAAI,OAAQ,EAAA,CAAI,CAAA,CAAA,CAAA,EAEnC,OAEL,gB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A,CACD,CAAA,CAAA,CAGH,EAEAZ,EAAmB,YAAc"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),A=require("../../../assets/icons/edit.svg.js"),B=require("../../../assets/icons/errorInfo.svg.js"),T=require("react"),f=require("../../TypographyStyle.js"),b=require("../../../constants/Theme.js"),a=require("../AgentBuilder.styled.js"),u=require("../constants/channels.js"),M=require("../context/AgentBuilderContext.js"),$=require("./ChannelSelectModal.js"),O=require("../../checkBox/CheckBox.js"),m=require("../../tooltips/Tooltip.js"),x=require("../../tag/Tag.js"),R=require("../../icon-button/IconButton.js"),S=3,w=n=>[...n.filter(u.isAccountDisconnected),...n.filter(i=>!u.isAccountDisconnected(i))],I=()=>{const{value:n,updateField:i,availableChannels:c,onManageChannels:g}=M.useAgentBuilderContext(),[s,r]=T.useState(null),p=T.useMemo(()=>{const t=new Map;return(n.channels??[]).forEach(o=>t.set(o.type,o.channelIds)),t},[n.channels]);if(!c||c.length===0)return null;const C=(t,o)=>{const d=(n.channels??[]).filter(y=>y.type!==t);i("channels",o.length>0?[...d,{type:t,channelIds:o}]:d)},l=c.find(t=>t.type===s)??null;return e.jsxs(a.ChannelsSectionRoot,{children:[e.jsx(f.TitleSmall,{color:b.COLORS.content.primary,children:"Channels to activate it on"}),c.map(t=>e.jsx(L,{channel:t,selectedIds:p.get(t.type)??[],onSelectionChange:o=>C(t.type,o),onEdit:()=>r(t.type)},String(t.type))),e.jsx($.ChannelSelectModal,{channel:l,selectedIds:l?p.get(l.type)??[]:[],onClose:()=>r(null),onApply:t=>{l&&C(l.type,t),r(null)},onManageChannels:g&&l?()=>g(l.type):void 0})]})};I.displayName="ChannelsSection";const L=({channel:n,selectedIds:i,onSelectionChange:c,onEdit:g})=>{const{label:s,Icon:r,tint:p,accountsNoun:C}=u.channelPresentation(n.type,n.label),l=n.accounts.length===0,t=u.selectedAccounts(n,i),o=!l&&t.length===n.accounts.length,d=t.length>0&&!o,y=w(t.length>0?t:n.accounts),q=y.slice(0,S),j=y.slice(S),v=()=>c(o?[]:n.accounts.map(h=>h.channelId));return e.jsx(a.ChannelCard,{"data-test":`agent-channel-${n.type}`,role:"group","aria-label":s,children:e.jsxs(a.ChannelRow,{children:[e.jsxs(a.ChannelRowMain,{children:[e.jsx(O.CheckBox,{isChecked:o||d,isPartiallyChecked:d,isDisabled:l,ariaLabel:s,onValueChange:v,style:a.CHECKBOX_SLOT}),e.jsxs(a.ChannelIdentity,{children:[e.jsx(a.ChannelGlyph,{tint:p,children:r&&e.jsx(r,{size:16})}),e.jsx(f.TitleSmall,{color:b.COLORS.content.primary,children:s})]}),e.jsx(a.ChannelChips,{children:l?e.jsx(m.Tooltip,{body:`No ${C} are connected to this store yet. Connect one from channel management to activate this agent on ${s}.`,placement:"top",children:e.jsx(a.ChipTooltipTarget,{children:e.jsx(x.Tag,{tagText:"Disabled",type:"neutral",variant:"regular",height:24,cursor:"default"})})}):e.jsxs(e.Fragment,{children:[q.map(h=>e.jsx(N,{account:h,channelLabel:s},h.channelId)),j.length>0&&e.jsx(m.Tooltip,{body:j.map(h=>h.channelName).join(", "),placement:"top",children:e.jsx(a.ChipTooltipTarget,{children:e.jsx(x.Tag,{tagText:`+${j.length}`,type:"purple",variant:"regular",height:24,cursor:"default"})})})]})})]}),e.jsx(R.IconButton,{"data-test":`agent-channel-${n.type}-edit`,"aria-label":`Edit ${s} channels`,Icon:A.default,size:"xs",iconPadding:4,disabled:l,onClick:g})]})})},N=({account:n,channelLabel:i})=>u.isAccountDisconnected(n)?e.jsx(m.Tooltip,{body:`${n.channelName} is disconnected. This agent won't run on it until you reconnect it from ${i} channel management.`,placement:"top",children:e.jsx(a.ChipTooltipTarget,{children:e.jsx(x.Tag,{tagText:n.channelName,type:"negative",variant:"regular",height:24,LeadingIcon:B.default,leadingIconId:`channel-error-${n.channelId}`,cursor:"default"})})}):e.jsx(x.Tag,{tagText:n.channelName,type:"purple",variant:"regular",height:24});exports.ChannelsSection=I;
2
- //# sourceMappingURL=ChannelsSection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChannelsSection.js","sources":["../../../../../src/components/agent-builder/components/ChannelsSection.tsx"],"sourcesContent":["import EditIcon from '@src/assets/icons/edit.svg';\nimport ErrorInfoIcon from '@src/assets/icons/errorInfo.svg';\nimport React, { useMemo, useState } from 'react';\nimport { CheckBox } from '@src/components/checkBox';\nimport { IconButton } from '@src/components/icon-button';\nimport { Tag } from '@src/components/tag';\nimport { Tooltip } from '@src/components/tooltips';\nimport { TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport type {\n\tAgentChannel,\n\tAgentChannelAccount,\n\tAgentChannelType,\n} from '../AgentBuilder.model';\nimport {\n\tChannelCard,\n\tChannelChips,\n\tChannelGlyph,\n\tChannelIdentity,\n\tChannelRow,\n\tChannelRowMain,\n\tChannelsSectionRoot,\n\tCHECKBOX_SLOT,\n\tChipTooltipTarget,\n} from '../AgentBuilder.styled';\nimport {\n\tchannelPresentation,\n\tisAccountDisconnected,\n\tselectedAccounts,\n} from '../constants/channels';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\nimport { ChannelSelectModal } from './ChannelSelectModal';\n\n/**\n * How many account chips a row shows before collapsing the rest into \"+N\". The\n * design draws three; without a cap a store with a dozen numbers pushes the row\n * well past its 48px height.\n */\nconst MAX_VISIBLE_CHIPS = 3;\n\n/**\n * Chips for a row: disconnected accounts first so a cap can never hide the very\n * thing the merchant needs to act on, then the rest in their original order.\n */\nconst chipOrder = (accounts: AgentChannelAccount[]): AgentChannelAccount[] => [\n\t...accounts.filter(isAccountDisconnected),\n\t...accounts.filter((a) => !isAccountDisconnected(a)),\n];\n\n/**\n * Step 1's \"Channels to activate it on\" — one card per connected channel, each\n * with a select-all checkbox, the accounts it covers as chips, and an edit\n * button that opens the per-account picker.\n *\n * Renders nothing when the consumer passes no `availableChannels`, so a host\n * that hasn't wired channels up yet sees the step exactly as it was.\n */\nexport const ChannelsSection: React.FC = () => {\n\tconst { value, updateField, availableChannels, onManageChannels } =\n\t\tuseAgentBuilderContext();\n\n\t// Which channel's picker is open (by type); null = closed.\n\tconst [editingType, setEditingType] = useState<AgentChannelType | null>(null);\n\n\t// Selection is stored as a list; index it once so each row is a lookup.\n\tconst selectionByType = useMemo(() => {\n\t\tconst map = new Map<AgentChannelType, string[]>();\n\t\t(value.channels ?? []).forEach((c) => map.set(c.type, c.channelIds));\n\t\treturn map;\n\t}, [value.channels]);\n\n\tif (!availableChannels || availableChannels.length === 0) {\n\t\treturn null;\n\t}\n\n\tconst setSelection = (type: AgentChannelType, channelIds: string[]) => {\n\t\tconst rest = (value.channels ?? []).filter((c) => c.type !== type);\n\t\t// An empty selection drops the channel entirely rather than persisting a\n\t\t// `{ type, channelIds: [] }` no-op the backend would have to filter out.\n\t\tupdateField(\n\t\t\t'channels',\n\t\t\tchannelIds.length > 0 ? [...rest, { type, channelIds }] : rest,\n\t\t);\n\t};\n\n\tconst editingChannel =\n\t\tavailableChannels.find((c) => c.type === editingType) ?? null;\n\n\treturn (\n\t\t<ChannelsSectionRoot>\n\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\tChannels to activate it on\n\t\t\t</TitleSmall>\n\n\t\t\t{availableChannels.map((channel) => (\n\t\t\t\t<ChannelCardRow\n\t\t\t\t\tkey={String(channel.type)}\n\t\t\t\t\tchannel={channel}\n\t\t\t\t\tselectedIds={selectionByType.get(channel.type) ?? []}\n\t\t\t\t\tonSelectionChange={(ids) => setSelection(channel.type, ids)}\n\t\t\t\t\tonEdit={() => setEditingType(channel.type)}\n\t\t\t\t/>\n\t\t\t))}\n\n\t\t\t<ChannelSelectModal\n\t\t\t\tchannel={editingChannel}\n\t\t\t\tselectedIds={\n\t\t\t\t\teditingChannel ? selectionByType.get(editingChannel.type) ?? [] : []\n\t\t\t\t}\n\t\t\t\tonClose={() => setEditingType(null)}\n\t\t\t\tonApply={(ids) => {\n\t\t\t\t\tif (editingChannel) {\n\t\t\t\t\t\tsetSelection(editingChannel.type, ids);\n\t\t\t\t\t}\n\t\t\t\t\tsetEditingType(null);\n\t\t\t\t}}\n\t\t\t\tonManageChannels={\n\t\t\t\t\tonManageChannels && editingChannel\n\t\t\t\t\t\t? () => onManageChannels(editingChannel.type)\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t/>\n\t\t</ChannelsSectionRoot>\n\t);\n};\n\nChannelsSection.displayName = 'ChannelsSection';\n\ninterface ChannelCardRowProps {\n\tchannel: AgentChannel;\n\tselectedIds: string[];\n\tonSelectionChange: (channelIds: string[]) => void;\n\tonEdit: () => void;\n}\n\nconst ChannelCardRow: React.FC<ChannelCardRowProps> = ({\n\tchannel,\n\tselectedIds,\n\tonSelectionChange,\n\tonEdit,\n}) => {\n\tconst { label, Icon, tint, accountsNoun } = channelPresentation(\n\t\tchannel.type,\n\t\tchannel.label,\n\t);\n\n\t/**\n\t * Zero state — the store supports this channel but has nothing connected\n\t * under it. Nothing on the row is actionable, so the checkbox and the edit\n\t * button are both inert and a \"Disabled\" chip stands in for the accounts.\n\t */\n\tconst isUnavailable = channel.accounts.length === 0;\n\n\tconst selected = selectedAccounts(channel, selectedIds);\n\tconst allSelected =\n\t\t!isUnavailable && selected.length === channel.accounts.length;\n\tconst someSelected = selected.length > 0 && !allSelected;\n\n\t// With nothing picked yet the row shows the store's inventory — that's the\n\t// state the design draws, and it tells the merchant what's on offer. Once\n\t// they've picked, the chips narrow to what the agent actually runs on.\n\tconst shown = chipOrder(selected.length > 0 ? selected : channel.accounts);\n\tconst visible = shown.slice(0, MAX_VISIBLE_CHIPS);\n\tconst overflow = shown.slice(MAX_VISIBLE_CHIPS);\n\n\tconst toggleAll = () =>\n\t\tonSelectionChange(\n\t\t\tallSelected ? [] : channel.accounts.map((a) => a.channelId),\n\t\t);\n\n\treturn (\n\t\t<ChannelCard\n\t\t\tdata-test={`agent-channel-${channel.type}`}\n\t\t\t// A card groups a channel's checkbox, chips and edit button; naming the\n\t\t\t// group lets assistive tech (and tests) address one channel at a time.\n\t\t\trole=\"group\"\n\t\t\taria-label={label}\n\t\t>\n\t\t\t<ChannelRow>\n\t\t\t\t<ChannelRowMain>\n\t\t\t\t\t<CheckBox\n\t\t\t\t\t\tisChecked={allSelected || someSelected}\n\t\t\t\t\t\tisPartiallyChecked={someSelected}\n\t\t\t\t\t\tisDisabled={isUnavailable}\n\t\t\t\t\t\tariaLabel={label}\n\t\t\t\t\t\tonValueChange={toggleAll}\n\t\t\t\t\t\tstyle={CHECKBOX_SLOT}\n\t\t\t\t\t/>\n\t\t\t\t\t<ChannelIdentity>\n\t\t\t\t\t\t<ChannelGlyph tint={tint}>\n\t\t\t\t\t\t\t{Icon && <Icon size={16} />}\n\t\t\t\t\t\t</ChannelGlyph>\n\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>{label}</TitleSmall>\n\t\t\t\t\t</ChannelIdentity>\n\n\t\t\t\t\t<ChannelChips>\n\t\t\t\t\t\t{isUnavailable ? (\n\t\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\t\tbody={`No ${accountsNoun} are connected to this store yet. Connect one from channel management to activate this agent on ${label}.`}\n\t\t\t\t\t\t\t\tplacement=\"top\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ChipTooltipTarget>\n\t\t\t\t\t\t\t\t\t<Tag\n\t\t\t\t\t\t\t\t\t\ttagText=\"Disabled\"\n\t\t\t\t\t\t\t\t\t\ttype=\"neutral\"\n\t\t\t\t\t\t\t\t\t\tvariant=\"regular\"\n\t\t\t\t\t\t\t\t\t\theight={24}\n\t\t\t\t\t\t\t\t\t\tcursor=\"default\"\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ChipTooltipTarget>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{visible.map((account) => (\n\t\t\t\t\t\t\t\t\t<AccountChip\n\t\t\t\t\t\t\t\t\t\tkey={account.channelId}\n\t\t\t\t\t\t\t\t\t\taccount={account}\n\t\t\t\t\t\t\t\t\t\tchannelLabel={label}\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{overflow.length > 0 && (\n\t\t\t\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\t\t\t\tbody={overflow.map((a) => a.channelName).join(', ')}\n\t\t\t\t\t\t\t\t\t\tplacement=\"top\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<ChipTooltipTarget>\n\t\t\t\t\t\t\t\t\t\t\t<Tag\n\t\t\t\t\t\t\t\t\t\t\t\ttagText={`+${overflow.length}`}\n\t\t\t\t\t\t\t\t\t\t\t\ttype=\"purple\"\n\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"regular\"\n\t\t\t\t\t\t\t\t\t\t\t\theight={24}\n\t\t\t\t\t\t\t\t\t\t\t\tcursor=\"default\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</ChipTooltipTarget>\n\t\t\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</ChannelChips>\n\t\t\t\t</ChannelRowMain>\n\n\t\t\t\t<IconButton\n\t\t\t\t\tdata-test={`agent-channel-${channel.type}-edit`}\n\t\t\t\t\taria-label={`Edit ${label} channels`}\n\t\t\t\t\tIcon={EditIcon}\n\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\ticonPadding={4}\n\t\t\t\t\tdisabled={isUnavailable}\n\t\t\t\t\tonClick={onEdit}\n\t\t\t\t/>\n\t\t\t</ChannelRow>\n\t\t</ChannelCard>\n\t);\n};\n\n/**\n * One account chip. A healthy account reads as a brand chip; a disconnected one\n * turns negative and gains the error glyph.\n *\n * The tooltip is NOT in the design — but a bare red chip tells the merchant\n * something is broken and nothing about what to do, so it names the account and\n * the fix.\n */\nconst AccountChip: React.FC<{\n\taccount: AgentChannelAccount;\n\tchannelLabel: string;\n}> = ({ account, channelLabel }) => {\n\tif (!isAccountDisconnected(account)) {\n\t\treturn (\n\t\t\t<Tag\n\t\t\t\ttagText={account.channelName}\n\t\t\t\ttype=\"purple\"\n\t\t\t\tvariant=\"regular\"\n\t\t\t\theight={24}\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Tooltip\n\t\t\tbody={`${account.channelName} is disconnected. This agent won't run on it until you reconnect it from ${channelLabel} channel management.`}\n\t\t\tplacement=\"top\"\n\t\t>\n\t\t\t<ChipTooltipTarget>\n\t\t\t\t<Tag\n\t\t\t\t\ttagText={account.channelName}\n\t\t\t\t\ttype=\"negative\"\n\t\t\t\t\tvariant=\"regular\"\n\t\t\t\t\theight={24}\n\t\t\t\t\tLeadingIcon={ErrorInfoIcon}\n\t\t\t\t\t// Tag doesn't spread rest props, so `data-test` would be dropped —\n\t\t\t\t\t// `leadingIconId` is the one hook it does put on the DOM, which gives\n\t\t\t\t\t// the error glyph a stable handle for tests and e2e.\n\t\t\t\t\tleadingIconId={`channel-error-${account.channelId}`}\n\t\t\t\t\tcursor=\"default\"\n\t\t\t\t/>\n\t\t\t</ChipTooltipTarget>\n\t\t</Tooltip>\n\t);\n};\n"],"names":["MAX_VISIBLE_CHIPS","chipOrder","accounts","isAccountDisconnected","a","ChannelsSection","value","updateField","availableChannels","onManageChannels","useAgentBuilderContext","editingType","setEditingType","useState","selectionByType","useMemo","map","c","setSelection","type","channelIds","rest","editingChannel","ChannelsSectionRoot","jsx","TitleSmall","COLORS","channel","ChannelCardRow","ids","ChannelSelectModal","selectedIds","onSelectionChange","onEdit","label","Icon","tint","accountsNoun","channelPresentation","isUnavailable","selected","selectedAccounts","allSelected","someSelected","shown","visible","overflow","toggleAll","ChannelCard","ChannelRow","jsxs","ChannelRowMain","CheckBox","CHECKBOX_SLOT","ChannelIdentity","ChannelGlyph","ChannelChips","Tooltip","ChipTooltipTarget","Tag","Fragment","account","AccountChip","IconButton","EditIcon","channelLabel","ErrorInfoIcon"],"mappings":"qnBAsCMA,EAAoB,EAMpBC,EAAaC,GAA2D,CAC7E,GAAGA,EAAS,OAAOC,uBAAqB,EACxC,GAAGD,EAAS,OAAQE,GAAM,CAACD,EAAAA,sBAAsBC,CAAC,CAAC,CACpD,EAUaC,EAA4B,IAAM,CAC9C,KAAM,CAAE,MAAAC,EAAO,YAAAC,EAAa,kBAAAC,EAAmB,iBAAAC,CAAA,EAC9CC,EAAAA,uBAAA,EAGK,CAACC,EAAaC,CAAc,EAAIC,EAAAA,SAAkC,IAAI,EAGtEC,EAAkBC,EAAAA,QAAQ,IAAM,CACrC,MAAMC,MAAU,IAChB,OAACV,EAAM,UAAY,IAAI,QAASW,GAAMD,EAAI,IAAIC,EAAE,KAAMA,EAAE,UAAU,CAAC,EAC5DD,CACR,EAAG,CAACV,EAAM,QAAQ,CAAC,EAEnB,GAAI,CAACE,GAAqBA,EAAkB,SAAW,EACtD,OAAO,KAGR,MAAMU,EAAe,CAACC,EAAwBC,IAAyB,CACtE,MAAMC,GAAQf,EAAM,UAAY,CAAA,GAAI,OAAQW,GAAMA,EAAE,OAASE,CAAI,EAGjEZ,EACC,WACAa,EAAW,OAAS,EAAI,CAAC,GAAGC,EAAM,CAAE,KAAAF,EAAM,WAAAC,CAAA,CAAY,EAAIC,CAAA,CAE5D,EAEMC,EACLd,EAAkB,KAAMS,GAAMA,EAAE,OAASN,CAAW,GAAK,KAE1D,cACEY,sBAAA,CACA,SAAA,CAAAC,MAACC,EAAAA,WAAA,CAAW,MAAOC,EAAAA,OAAO,QAAQ,QAAS,SAAA,6BAE3C,EAEClB,EAAkB,IAAKmB,GACvBH,EAAAA,IAACI,EAAA,CAEA,QAAAD,EACA,YAAab,EAAgB,IAAIa,EAAQ,IAAI,GAAK,CAAA,EAClD,kBAAoBE,GAAQX,EAAaS,EA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QACxC,aAAY,QAAQO,CAAK,YACzB,KAAM8B,EAAAA,QACN,KAAK,KACL,YAAa,EACb,SAAUzB,EACV,QAASN,CAAA,CAAA,CACV,CAAA,CACD,CAAA,CAAA,CAGH,EAUM6B,EAGD,CAAC,CAAE,QAAAD,EAAS,aAAAI,KACX9D,EAAAA,sBAAsB0D,CAAO,EAYjCrC,EAAAA,IAACiC,EAAAA,QAAA,CACA,KAAM,GAAGI,EAAQ,WAAW,4EAA4EI,CAAY,uBACpH,UAAU,MAEV,eAACP,oBAAA,CACA,SAAAlC,EAAAA,IAACmC,EAAAA,IAAA,CACA,QAASE,EAAQ,YACjB,KAAK,WACL,QAAQ,UACR,OAAQ,GACR,YAAaK,EAAAA,QAIb,cAAe,iBAAiBL,EAAQ,SAAS,GACjD,OAAO,SAAA,CAAA,CACR,CACD,CAAA,CAAA,EA3BArC,EAAAA,IAACmC,EAAAA,IAAA,CACA,QAASE,EAAQ,YACjB,KAAK,SACL,QAAQ,UACR,OAAQ,EAAA,CAAA"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@bikdotai/bik-models/campaigns/models/Channel"),s=require("../../../constants/Theme.js"),u=require("../../../icons/Social/Channels/InstagramV2.js"),i=require("../../../icons/Social/Channels/EmailV2.js"),l=require("../../../icons/Social/Channels/WhatsAppV2.js"),r="#FFEAF7",N=s.COLORS.surface.subdued,o={[c.Channels.WHATSAPP]:{label:"WhatsApp",Icon:l.default,tint:s.COLORS.background.positive.light,accountsNoun:"WhatsApp numbers"},[c.Channels.EMAIL]:{label:"Email",Icon:i.default,tint:s.COLORS.background.negative.light,accountsNoun:"email addresses"},[c.Channels.INSTAGRAM]:{label:"Instagram",Icon:u.default,tint:r,accountsNoun:"Instagram accounts"}},A=Object.keys(o),d=(n,t)=>{const e=o[String(n).toLowerCase()];if(e)return t?{...e,label:t}:e;const a=t||String(n);return{label:a,tint:N,accountsNoun:`${a} channels`}},T=n=>n.status==="disconnected",E=(n,t)=>n.accounts.filter(e=>t.includes(e.channelId));exports.AGENT_CHANNEL_TYPES=A;exports.CHANNEL_PRESENTATION=o;exports.channelPresentation=d;exports.isAccountDisconnected=T;exports.selectedAccounts=E;
2
- //# sourceMappingURL=channels.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"channels.js","sources":["../../../../../src/components/agent-builder/constants/channels.ts"],"sourcesContent":["import { Channels } from '@bikdotai/bik-models/campaigns/models/Channel';\nimport { EmailV2, InstagramV2, WhatsAppV2 } from '@src/icons/Social/Channels';\nimport type React from 'react';\nimport { COLORS } from '@src/constants/Theme';\nimport type {\n\tAgentChannel,\n\tAgentChannelAccount,\n\tAgentChannelType,\n} from '../AgentBuilder.model';\n\n/** How one channel type renders: its label, brand glyph, tint and copy noun. */\nexport interface ChannelPresentation {\n\t/** Row label (\"WhatsApp\", \"Email\", …). */\n\tlabel: string;\n\t/** Brand glyph. Undefined for an unknown type — the row renders label-only. */\n\tIcon?: React.FC<React.SVGProps<SVGSVGElement> & { size?: number | string }>;\n\t/** Tint behind the glyph. */\n\ttint: string;\n\t/**\n\t * What an account IS on this channel, plural — drives the picker's copy\n\t * (\"Select from available WhatsApp numbers\"). Kept per-channel because the\n\t * design's WhatsApp-only wording has to generalise once the same picker opens\n\t * for Email and Instagram.\n\t */\n\taccountsNoun: string;\n}\n\n/**\n * Instagram's tint has no theme token (Figma ships it as a one-off pink under\n * \"Intent Colors\"); the other two map onto the standard positive / negative\n * light backgrounds.\n */\nconst INSTAGRAM_TINT = '#FFEAF7';\n\n/** Tint used for an unknown channel type, whose glyph we don't have. */\nconst UNKNOWN_TINT = COLORS.surface.subdued;\n\n/**\n * Keyed by the shared `Channels` enum, so a channel key can never drift from the\n * platform's spelling.\n *\n * Typed `Record<AgentChannelType, …>` rather than `Record<string, …>`: that makes\n * the map EXHAUSTIVE, so widening {@link AgentChannelType} without adding the\n * matching presentation here is a compile error rather than a channel that\n * silently renders with no glyph.\n */\nexport const CHANNEL_PRESENTATION: Record<\n\tAgentChannelType,\n\tChannelPresentation\n> = {\n\t[Channels.WHATSAPP]: {\n\t\tlabel: 'WhatsApp',\n\t\tIcon: WhatsAppV2,\n\t\ttint: COLORS.background.positive.light,\n\t\taccountsNoun: 'WhatsApp numbers',\n\t},\n\t[Channels.EMAIL]: {\n\t\tlabel: 'Email',\n\t\tIcon: EmailV2,\n\t\ttint: COLORS.background.negative.light,\n\t\taccountsNoun: 'email addresses',\n\t},\n\t[Channels.INSTAGRAM]: {\n\t\tlabel: 'Instagram',\n\t\tIcon: InstagramV2,\n\t\ttint: INSTAGRAM_TINT,\n\t\taccountsNoun: 'Instagram accounts',\n\t},\n};\n\n/** The channel types the builder supports, in display order. */\nexport const AGENT_CHANNEL_TYPES = Object.keys(\n\tCHANNEL_PRESENTATION,\n) as AgentChannelType[];\n\n/**\n * Presentation for a channel.\n *\n * `AgentChannelType` makes the registry hit total at compile time, but the\n * `availableChannels` a consumer passes come off a backend response — so an\n * unrecognised `type` is still handled defensively (the consumer's `label`, then\n * the raw value, with no glyph) rather than rendering `undefined`.\n */\nexport const channelPresentation = (\n\ttype: AgentChannelType,\n\tlabelOverride?: string,\n): ChannelPresentation => {\n\tconst known = CHANNEL_PRESENTATION[\n\t\tString(type).toLowerCase() as AgentChannelType\n\t] as ChannelPresentation | undefined;\n\tif (known) {\n\t\treturn labelOverride ? { ...known, label: labelOverride } : known;\n\t}\n\tconst label = labelOverride || String(type);\n\treturn { label, tint: UNKNOWN_TINT, accountsNoun: `${label} channels` };\n};\n\n/** True when the store hasn't got a healthy connection to this account. */\nexport const isAccountDisconnected = (account: AgentChannelAccount): boolean =>\n\taccount.status === 'disconnected';\n\n/**\n * The accounts the agent is actually activated on, in the channel's own order.\n * Selection is stored as backend ids, so an id that no longer exists on the\n * store (channel removed since the agent was saved) simply drops out here.\n */\nexport const selectedAccounts = (\n\tchannel: AgentChannel,\n\tselectedIds: string[],\n): AgentChannelAccount[] =>\n\tchannel.accounts.filter((a) => selectedIds.includes(a.channelId));\n\n/**\n * Selected accounts the store can no longer reach. Drives the row alert and the\n * chips' negative styling. A disconnected account is deliberately NOT dropped\n * from the selection — silently editing a merchant's saved config would hide the\n * very problem they need to go fix.\n */\nexport const disconnectedSelectedAccounts = (\n\tchannel: AgentChannel,\n\tselectedIds: string[],\n): AgentChannelAccount[] =>\n\tselectedAccounts(channel, selectedIds).filter(isAccountDisconnected);\n"],"names":["INSTAGRAM_TINT","UNKNOWN_TINT","COLORS","CHANNEL_PRESENTATION","Channels","WhatsAppV2","EmailV2","InstagramV2","AGENT_CHANNEL_TYPES","channelPresentation","type","labelOverride","known","label","isAccountDisconnected","account","selectedAccounts","channel","selectedIds","a"],"mappings":"sWAgCMA,EAAiB,UAGjBC,EAAeC,EAAAA,OAAO,QAAQ,QAWvBC,EAGT,CACH,CAACC,EAAAA,SAAS,QAAQ,EAAG,CACpB,MAAO,WACP,KAAMC,EAAAA,QACN,KAAMH,EAAAA,OAAO,WAAW,SAAS,MACjC,aAAc,kBAAA,EAEf,CAACE,EAAAA,SAAS,KAAK,EAAG,CACjB,MAAO,QACP,KAAME,EAAAA,QACN,KAAMJ,EAAAA,OAAO,WAAW,SAAS,MACjC,aAAc,iBAAA,EAEf,CAACE,EAAAA,SAAS,SAAS,EAAG,CACrB,MAAO,YACP,KAAMG,EAAAA,QACN,KAAMP,EACN,aAAc,oBAAA,CAEhB,EAGaQ,EAAsB,OAAO,KACzCL,CACD,EAUaM,EAAsB,CAClCC,EACAC,IACyB,CACzB,MAAMC,EAAQT,EACb,OAAOO,CAAI,EAAE,aACd,EACA,GAAIE,EACH,OAAOD,EAAgB,CAAE,GAAGC,EAAO,MAAOD,GAAkBC,EAE7D,MAAMC,EAAQF,GAAiB,OAAOD,CAAI,EAC1C,MAAO,CAAE,MAAAG,EAAO,KAAMZ,EAAc,aAAc,GAAGY,CAAK,WAAA,CAC3D,EAGaC,EAAyBC,GACrCA,EAAQ,SAAW,eAOPC,EAAmB,CAC/BC,EACAC,IAEAD,EAAQ,SAAS,OAAQE,GAAMD,EAAY,SAASC,EAAE,SAAS,CAAC"}
@@ -1,47 +0,0 @@
1
- import { default as React } from 'react';
2
- export type AgentModalState = 'loading' | 'error';
3
- interface AgentStateAction {
4
- text: string;
5
- onClick: () => void;
6
- isLoading?: boolean;
7
- }
8
- interface AgentStateModalProps {
9
- open: boolean;
10
- /** `loading` while the write is in flight, `error` once it came back badly. */
11
- state: AgentModalState;
12
- /** Heading, e.g. "Agent couldn't go live". Comes from the caller — on `error` the
13
- * server owns this copy, so the builder never composes it. */
14
- title: string;
15
- /** Body copy. Line breaks are preserved, so a caller can pass one line per reason
16
- * (e.g. per conflicting intent) without markup. */
17
- message: string;
18
- /** Right-hand action, e.g. "Try again", or the step to fix when the caller knows
19
- * one ("Go to When it steps in"). */
20
- primaryButton?: AgentStateAction;
21
- /** Left-hand action, e.g. "Go back to editing". */
22
- secondaryButton?: AgentStateAction;
23
- /** 64px image for the `loading` badge — pass the host's loader asset to match its
24
- * other dialogs. Falls back to `Spinner`, so the library needs no remote asset. */
25
- loadingImageUrl?: string;
26
- /** Cross button / outside click. Always available, so a message-only dialog is
27
- * still dismissible with no actions at all. Not offered while `loading`. */
28
- onClose: () => void;
29
- zIndex?: number;
30
- }
31
- /**
32
- * What's happening to a save or publish: in flight, or failed. Sibling of
33
- * `GoLiveModal` — same hero layout (badge, title, body, actions), and the actions sit
34
- * inside the body for the same reason (see GoLiveModal). Every state is pinned to
35
- * `AGENT_STATE_MODAL_MIN_HEIGHT`, the go-live success height, so the card doesn't
36
- * resize as one state replaces another.
37
- *
38
- * Deliberately copy-free: title, message and button labels all come from the caller,
39
- * because the server owns the wording of the failure it just reported.
40
- *
41
- * Both buttons are optional, so one component covers every shape — two actions, one,
42
- * or message-only. That last one is for a failure with nothing to offer: no step to
43
- * send the merchant to and nothing a retry would change. `loading` never renders
44
- * actions or a cross, since there is nothing to decide yet.
45
- */
46
- export declare const AgentStateModal: React.FC<AgentStateModalProps>;
47
- export {};
@@ -1,82 +0,0 @@
1
- import { jsx as t, jsxs as r } from "react/jsx-runtime";
2
- import x from "../../../assets/icons/errorIcon.svg.js";
3
- import { Spinner as f } from "../../spinner/Spinner.js";
4
- import { TitleMedium as y, BodyPrimary as u } from "../../TypographyStyle.js";
5
- import { COLORS as l } from "../../../constants/Theme.js";
6
- import { AgentStateModalBody as S, AgentStateModalHero as C, ModalIcon as M, ModalActions as k } from "../AgentBuilder.styled.js";
7
- import { StyledModal as L } from "../../modals/styledModal.js";
8
- import { Button as d } from "../../button/Button.js";
9
- const j = ({
10
- open: a,
11
- state: s,
12
- title: c,
13
- message: m,
14
- primaryButton: e,
15
- secondaryButton: i,
16
- loadingImageUrl: n,
17
- onClose: h,
18
- zIndex: p
19
- }) => {
20
- if (!a)
21
- return null;
22
- const o = s === "loading", g = o ? null : i ?? e;
23
- return /* @__PURE__ */ t(
24
- L,
25
- {
26
- "data-test": "agent-state-modal",
27
- open: !0,
28
- onClose: h,
29
- width: "520px",
30
- zIndex: p,
31
- hideCrossButton: o,
32
- closeOnOutsideClick: !o,
33
- closeOnEscapeKey: !o,
34
- children: /* @__PURE__ */ r(S, { style: { gap: "24px" }, children: [
35
- /* @__PURE__ */ r(C, { children: [
36
- /* @__PURE__ */ t(M, { children: o ? n ? /* @__PURE__ */ t("img", { src: n, alt: "", width: 64, height: 64 }) : /* @__PURE__ */ t(f, { size: "large", color: l.stroke.brand }) : /* @__PURE__ */ t(x, { width: 64, height: 64 }) }),
37
- /* @__PURE__ */ r("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
38
- /* @__PURE__ */ t(y, { color: l.content.primary, children: c }),
39
- /* @__PURE__ */ t(
40
- u,
41
- {
42
- color: l.content.secondary,
43
- style: { whiteSpace: "pre-line" },
44
- children: m
45
- }
46
- )
47
- ] })
48
- ] }),
49
- g && /* @__PURE__ */ r(k, { children: [
50
- i && /* @__PURE__ */ t("div", { style: { display: "flex" }, children: /* @__PURE__ */ t(
51
- d,
52
- {
53
- "data-test": "agent-state-secondary",
54
- buttonType: "secondary",
55
- size: "medium",
56
- matchParentWidth: !0,
57
- buttonText: i.text,
58
- isLoading: i.isLoading,
59
- onClick: i.onClick
60
- }
61
- ) }),
62
- e && /* @__PURE__ */ t("div", { style: { display: "flex" }, children: /* @__PURE__ */ t(
63
- d,
64
- {
65
- "data-test": "agent-state-primary",
66
- buttonType: "primary",
67
- size: "medium",
68
- matchParentWidth: !0,
69
- buttonText: e.text,
70
- isLoading: e.isLoading,
71
- onClick: e.onClick
72
- }
73
- ) })
74
- ] })
75
- ] })
76
- }
77
- );
78
- };
79
- export {
80
- j as AgentStateModal
81
- };
82
- //# sourceMappingURL=AgentStateModal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AgentStateModal.js","sources":["../../../../../src/components/agent-builder/components/AgentStateModal.tsx"],"sourcesContent":["import ErrorIcon from '@src/assets/icons/errorIcon.svg';\nimport React from 'react';\nimport { Button } from '@src/components/button';\nimport { StyledModal } from '@src/components/modals';\nimport { Spinner } from '@src/components/spinner/Spinner';\nimport { BodyPrimary, TitleMedium } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tAgentStateModalBody,\n\tAgentStateModalHero,\n\tModalActions,\n\tModalIcon,\n} from '../AgentBuilder.styled';\n\nexport type AgentModalState = 'loading' | 'error';\n\ninterface AgentStateAction {\n\ttext: string;\n\tonClick: () => void;\n\tisLoading?: boolean;\n}\n\ninterface AgentStateModalProps {\n\topen: boolean;\n\t/** `loading` while the write is in flight, `error` once it came back badly. */\n\tstate: AgentModalState;\n\t/** Heading, e.g. \"Agent couldn't go live\". Comes from the caller — on `error` the\n\t * server owns this copy, so the builder never composes it. */\n\ttitle: string;\n\t/** Body copy. Line breaks are preserved, so a caller can pass one line per reason\n\t * (e.g. per conflicting intent) without markup. */\n\tmessage: string;\n\t/** Right-hand action, e.g. \"Try again\", or the step to fix when the caller knows\n\t * one (\"Go to When it steps in\"). */\n\tprimaryButton?: AgentStateAction;\n\t/** Left-hand action, e.g. \"Go back to editing\". */\n\tsecondaryButton?: AgentStateAction;\n\t/** 64px image for the `loading` badge — pass the host's loader asset to match its\n\t * other dialogs. Falls back to `Spinner`, so the library needs no remote asset. */\n\tloadingImageUrl?: string;\n\t/** Cross button / outside click. Always available, so a message-only dialog is\n\t * still dismissible with no actions at all. Not offered while `loading`. */\n\tonClose: () => void;\n\tzIndex?: number;\n}\n\n/**\n * What's happening to a save or publish: in flight, or failed. Sibling of\n * `GoLiveModal` — same hero layout (badge, title, body, actions), and the actions sit\n * inside the body for the same reason (see GoLiveModal). Every state is pinned to\n * `AGENT_STATE_MODAL_MIN_HEIGHT`, the go-live success height, so the card doesn't\n * resize as one state replaces another.\n *\n * Deliberately copy-free: title, message and button labels all come from the caller,\n * because the server owns the wording of the failure it just reported.\n *\n * Both buttons are optional, so one component covers every shape — two actions, one,\n * or message-only. That last one is for a failure with nothing to offer: no step to\n * send the merchant to and nothing a retry would change. `loading` never renders\n * actions or a cross, since there is nothing to decide yet.\n */\nexport const AgentStateModal: React.FC<AgentStateModalProps> = ({\n\topen,\n\tstate,\n\ttitle,\n\tmessage,\n\tprimaryButton,\n\tsecondaryButton,\n\tloadingImageUrl,\n\tonClose,\n\tzIndex,\n}) => {\n\tif (!open) {\n\t\treturn null;\n\t}\n\n\tconst isLoading = state === 'loading';\n\tconst actions = isLoading ? null : secondaryButton ?? primaryButton;\n\n\treturn (\n\t\t<StyledModal\n\t\t\tdata-test=\"agent-state-modal\"\n\t\t\topen\n\t\t\tonClose={onClose}\n\t\t\twidth=\"520px\"\n\t\t\tzIndex={zIndex}\n\t\t\thideCrossButton={isLoading}\n\t\t\tcloseOnOutsideClick={!isLoading}\n\t\t\tcloseOnEscapeKey={!isLoading}\n\t\t>\n\t\t\t<AgentStateModalBody style={{ gap: '24px' }}>\n\t\t\t\t<AgentStateModalHero>\n\t\t\t\t\t<ModalIcon>\n\t\t\t\t\t\t{isLoading ? (\n\t\t\t\t\t\t\tloadingImageUrl ? (\n\t\t\t\t\t\t\t\t<img src={loadingImageUrl} alt=\"\" width={64} height={64} />\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Spinner size=\"large\" color={COLORS.stroke.brand} />\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ErrorIcon width={64} height={64} />\n\t\t\t\t\t\t)}\n\t\t\t\t\t</ModalIcon>\n\n\t\t\t\t\t<div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>\n\t\t\t\t\t\t<TitleMedium color={COLORS.content.primary}>{title}</TitleMedium>\n\t\t\t\t\t\t<BodyPrimary\n\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\tstyle={{ whiteSpace: 'pre-line' }}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{message}\n\t\t\t\t\t\t</BodyPrimary>\n\t\t\t\t\t</div>\n\t\t\t\t</AgentStateModalHero>\n\n\t\t\t\t{actions && (\n\t\t\t\t\t<ModalActions>\n\t\t\t\t\t\t{secondaryButton && (\n\t\t\t\t\t\t\t<div style={{ display: 'flex' }}>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tdata-test=\"agent-state-secondary\"\n\t\t\t\t\t\t\t\t\tbuttonType=\"secondary\"\n\t\t\t\t\t\t\t\t\tsize=\"medium\"\n\t\t\t\t\t\t\t\t\tmatchParentWidth\n\t\t\t\t\t\t\t\t\tbuttonText={secondaryButton.text}\n\t\t\t\t\t\t\t\t\tisLoading={secondaryButton.isLoading}\n\t\t\t\t\t\t\t\t\tonClick={secondaryButton.onClick}\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\t{primaryButton && (\n\t\t\t\t\t\t\t<div style={{ display: 'flex' }}>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tdata-test=\"agent-state-primary\"\n\t\t\t\t\t\t\t\t\tbuttonType=\"primary\"\n\t\t\t\t\t\t\t\t\tsize=\"medium\"\n\t\t\t\t\t\t\t\t\tmatchParentWidth\n\t\t\t\t\t\t\t\t\tbuttonText={primaryButton.text}\n\t\t\t\t\t\t\t\t\tisLoading={primaryButton.isLoading}\n\t\t\t\t\t\t\t\t\tonClick={primaryButton.onClick}\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</ModalActions>\n\t\t\t\t)}\n\t\t\t</AgentStateModalBody>\n\t\t</StyledModal>\n\t);\n};\n"],"names":["AgentStateModal","open","state","title","message","primaryButton","secondaryButton","loadingImageUrl","onClose","zIndex","isLoading","actions","jsx","StyledModal","AgentStateModalBody","jsxs","AgentStateModalHero","ModalIcon","Spinner","COLORS","ErrorIcon","TitleMedium","BodyPrimary","ModalActions","Button"],"mappings":";;;;;;;;AA6DO,MAAMA,IAAkD,CAAC;AAAA,EAC/D,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,eAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC;AACD,MAAM;AACL,MAAI,CAACR;AACJ,WAAO;AAGR,QAAMS,IAAYR,MAAU,WACtBS,IAAUD,IAAY,OAAOJ,KAAmBD;AAEtD,SACC,gBAAAO;AAAA,IAACC;AAAA,IAAA;AAAA,MACA,aAAU;AAAA,MACV,MAAI;AAAA,MACJ,SAAAL;AAAA,MACA,OAAM;AAAA,MACN,QAAAC;AAAA,MACA,iBAAiBC;AAAA,MACjB,qBAAqB,CAACA;AAAA,MACtB,kBAAkB,CAACA;AAAA,MAEnB,4BAACI,GAAA,EAAoB,OAAO,EAAE,KAAK,UAClC,UAAA;AAAA,QAAA,gBAAAC,EAACC,GAAA,EACA,UAAA;AAAA,UAAA,gBAAAJ,EAACK,GAAA,EACC,UAAAP,IACAH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AEF;AAAA,MAAA,EAAA,CAEF;AAAA,IAAA;AAAA,EAAA;AAGH;"}
@@ -1,26 +0,0 @@
1
- import { default as React } from 'react';
2
- import { AgentChannel } from '../AgentBuilder.model';
3
- interface ChannelSelectModalProps {
4
- /** The channel being edited. `null` closes the modal. */
5
- channel: AgentChannel | null;
6
- /** Currently activated backend channel ids for this channel. */
7
- selectedIds: string[];
8
- onClose: () => void;
9
- /** Apply — commits the draft selection as backend channel ids. */
10
- onApply: (channelIds: string[]) => void;
11
- /** Footer "Channel management" link. Omit to hide it. */
12
- onManageChannels?: () => void;
13
- }
14
- /**
15
- * Per-channel account picker, opened from a channel row's edit button.
16
- *
17
- * The selection is a LOCAL draft until Apply — the design gives the merchant a
18
- * Cancel, so toggling here must not reach the agent value until they commit.
19
- *
20
- * A disconnected account stays selectable and stays selected: the merchant may
21
- * be mid-reconnect, and quietly removing it from their agent would hide the
22
- * problem rather than surface it. It's labelled instead, and the row it came
23
- * from carries the alert.
24
- */
25
- export declare const ChannelSelectModal: React.FC<ChannelSelectModalProps>;
26
- export type { ChannelSelectModalProps };
@@ -1,121 +0,0 @@
1
- import { jsx as t, jsxs as a } from "react/jsx-runtime";
2
- import x from "../../../assets/icons/RedirectToNew.svg.js";
3
- import { useState as S, useEffect as b } from "react";
4
- import { BodySecondary as p, TitleSmall as C } from "../../TypographyStyle.js";
5
- import { COLORS as l } from "../../../constants/Theme.js";
6
- import { ChannelPickerBody as k, ChannelPickerList as T, ChannelPickerRow as z, CHECKBOX_SLOT as B, ChannelPickerAccount as L, ChannelGlyph as N, ChannelsLink as v } from "../AgentBuilder.styled.js";
7
- import { channelPresentation as w, isAccountDisconnected as P } from "../constants/channels.js";
8
- import { StyledModal as O } from "../../modals/styledModal.js";
9
- import { CheckBox as $ } from "../../checkBox/CheckBox.js";
10
- import { Tag as A } from "../../tag/Tag.js";
11
- const D = ({
12
- channel: n,
13
- selectedIds: r,
14
- onClose: c,
15
- onApply: g,
16
- onManageChannels: d
17
- }) => {
18
- const [h, s] = S(r);
19
- if (b(() => {
20
- n && s(r);
21
- }, [n]), !n)
22
- return null;
23
- const { Icon: m, tint: y, accountsNoun: i } = w(
24
- n.type,
25
- n.label
26
- ), f = (e) => s(
27
- (o) => o.includes(e) ? o.filter((u) => u !== e) : [...o, e]
28
- );
29
- return /* @__PURE__ */ t(
30
- O,
31
- {
32
- "data-test": "agent-channel-select-modal",
33
- open: !0,
34
- onClose: c,
35
- width: "640px",
36
- headingTitle: "Select channels to activate",
37
- headingSubtitle: `Select the ${i} on which you need this agent enabled on.`,
38
- modalHeaderStyles: { padding: "24px", boxSizing: "border-box" },
39
- modalBodyStyles: { boxSizing: "border-box" },
40
- footerContainerStyle: { padding: "20px 24px", boxSizing: "border-box" },
41
- footerLeftCustomElement: d ? /* @__PURE__ */ a(
42
- v,
43
- {
44
- "data-test": "agent-channel-management-link",
45
- type: "button",
46
- onClick: d,
47
- style: { fontSize: 14, lineHeight: "20px", fontWeight: 600 },
48
- children: [
49
- "Channel management",
50
- /* @__PURE__ */ t(x, { width: 16, height: 16 })
51
- ]
52
- }
53
- ) : void 0,
54
- secondaryButton: {
55
- "data-test": "agent-channel-cancel",
56
- buttonType: "tertiaryGray",
57
- size: "small",
58
- buttonText: "Cancel",
59
- onClick: c
60
- },
61
- primaryButton: {
62
- "data-test": "agent-channel-apply",
63
- buttonType: "primary",
64
- size: "small",
65
- buttonText: "Apply",
66
- onClick: () => g(h)
67
- },
68
- children: /* @__PURE__ */ a(k, { children: [
69
- /* @__PURE__ */ t(p, { color: l.content.secondary, children: `Select from available ${i}` }),
70
- /* @__PURE__ */ a(T, { children: [
71
- n.accounts.map((e) => {
72
- const o = P(e);
73
- return /* @__PURE__ */ a(
74
- z,
75
- {
76
- "data-test": `agent-channel-account-${e.channelId}`,
77
- children: [
78
- /* @__PURE__ */ t(
79
- $,
80
- {
81
- isChecked: h.includes(e.channelId),
82
- ariaLabel: e.channelName,
83
- value: e.channelId,
84
- onValueChange: () => f(e.channelId),
85
- style: B
86
- }
87
- ),
88
- /* @__PURE__ */ a(L, { children: [
89
- /* @__PURE__ */ t(N, { tint: y, children: m && /* @__PURE__ */ t(m, { size: 16 }) }),
90
- /* @__PURE__ */ t(C, { color: l.content.primary, children: e.channelName }),
91
- o && // NOT `size="small"`: that renders through BodyTiny, which
92
- // is 10px AND has no font-family, so it falls back to the
93
- // browser serif. The default reads as 12px Inter — Figma's
94
- // body-caption, same as every other chip.
95
- /* @__PURE__ */ t(
96
- A,
97
- {
98
- tagText: "Disconnected",
99
- type: "negative",
100
- variant: "regular",
101
- height: 20,
102
- padding: "2px 8px"
103
- }
104
- )
105
- ] })
106
- ]
107
- },
108
- e.channelId
109
- );
110
- }),
111
- n.accounts.length === 0 && /* @__PURE__ */ t(p, { color: l.content.placeholder, children: `No ${i} are connected to this store yet.` })
112
- ] })
113
- ] })
114
- }
115
- );
116
- };
117
- D.displayName = "ChannelSelectModal";
118
- export {
119
- D as ChannelSelectModal
120
- };
121
- //# sourceMappingURL=ChannelSelectModal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChannelSelectModal.js","sources":["../../../../../src/components/agent-builder/components/ChannelSelectModal.tsx"],"sourcesContent":["import RedirectIcon from '@src/assets/icons/RedirectToNew.svg';\nimport React, { useEffect, useState } from 'react';\nimport { CheckBox } from '@src/components/checkBox';\nimport { StyledModal } from '@src/components/modals';\nimport { Tag } from '@src/components/tag';\nimport { BodySecondary, TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport type { AgentChannel } from '../AgentBuilder.model';\nimport {\n\tChannelGlyph,\n\tChannelPickerAccount,\n\tChannelPickerBody,\n\tChannelPickerList,\n\tChannelPickerRow,\n\tChannelsLink,\n\tCHECKBOX_SLOT,\n} from '../AgentBuilder.styled';\nimport {\n\tchannelPresentation,\n\tisAccountDisconnected,\n} from '../constants/channels';\n\ninterface ChannelSelectModalProps {\n\t/** The channel being edited. `null` closes the modal. */\n\tchannel: AgentChannel | null;\n\t/** Currently activated backend channel ids for this channel. */\n\tselectedIds: string[];\n\tonClose: () => void;\n\t/** Apply — commits the draft selection as backend channel ids. */\n\tonApply: (channelIds: string[]) => void;\n\t/** Footer \"Channel management\" link. Omit to hide it. */\n\tonManageChannels?: () => void;\n}\n\n/**\n * Per-channel account picker, opened from a channel row's edit button.\n *\n * The selection is a LOCAL draft until Apply — the design gives the merchant a\n * Cancel, so toggling here must not reach the agent value until they commit.\n *\n * A disconnected account stays selectable and stays selected: the merchant may\n * be mid-reconnect, and quietly removing it from their agent would hide the\n * problem rather than surface it. It's labelled instead, and the row it came\n * from carries the alert.\n */\nexport const ChannelSelectModal: React.FC<ChannelSelectModalProps> = ({\n\tchannel,\n\tselectedIds,\n\tonClose,\n\tonApply,\n\tonManageChannels,\n}) => {\n\tconst [draft, setDraft] = useState<string[]>(selectedIds);\n\n\t// Re-seed whenever the modal opens (or reopens for a different channel), so a\n\t// cancelled edit doesn't leak into the next one.\n\tuseEffect(() => {\n\t\tif (channel) {\n\t\t\tsetDraft(selectedIds);\n\t\t}\n\t\t// `selectedIds` is intentionally read only at open time — the draft owns it\n\t\t// from then until Apply.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [channel]);\n\n\tif (!channel) {\n\t\treturn null;\n\t}\n\n\tconst { Icon, tint, accountsNoun } = channelPresentation(\n\t\tchannel.type,\n\t\tchannel.label,\n\t);\n\n\tconst toggle = (channelId: string) =>\n\t\tsetDraft((prev) =>\n\t\t\tprev.includes(channelId)\n\t\t\t\t? prev.filter((id) => id !== channelId)\n\t\t\t\t: [...prev, channelId],\n\t\t);\n\n\treturn (\n\t\t<StyledModal\n\t\t\tdata-test=\"agent-channel-select-modal\"\n\t\t\topen\n\t\t\tonClose={onClose}\n\t\t\twidth=\"640px\"\n\t\t\theadingTitle=\"Select channels to activate\"\n\t\t\theadingSubtitle={`Select the ${accountsNoun} on which you need this agent enabled on.`}\n\t\t\t// This repo has no global `box-sizing: border-box`, so StyledModal's\n\t\t\t// `width: 100%` + 24px side padding resolves to 688px inside its 640px\n\t\t\t// `overflow: hidden` wrapper — clipping the right 48px, and with it the\n\t\t\t// primary button. Border-box on each section is the fix that doesn't\n\t\t\t// touch the shared modal.\n\t\t\tmodalHeaderStyles={{ padding: '24px', boxSizing: 'border-box' }}\n\t\t\tmodalBodyStyles={{ boxSizing: 'border-box' }}\n\t\t\tfooterContainerStyle={{ padding: '20px 24px', boxSizing: 'border-box' }}\n\t\t\tfooterLeftCustomElement={\n\t\t\t\tonManageChannels ? (\n\t\t\t\t\t<ChannelsLink\n\t\t\t\t\t\tdata-test=\"agent-channel-management-link\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonClick={onManageChannels}\n\t\t\t\t\t\tstyle={{ fontSize: 14, lineHeight: '20px', fontWeight: 600 }}\n\t\t\t\t\t>\n\t\t\t\t\t\tChannel management\n\t\t\t\t\t\t<RedirectIcon width={16} height={16} />\n\t\t\t\t\t</ChannelsLink>\n\t\t\t\t) : undefined\n\t\t\t}\n\t\t\tsecondaryButton={{\n\t\t\t\t'data-test': 'agent-channel-cancel',\n\t\t\t\tbuttonType: 'tertiaryGray',\n\t\t\t\tsize: 'small',\n\t\t\t\tbuttonText: 'Cancel',\n\t\t\t\tonClick: onClose,\n\t\t\t}}\n\t\t\tprimaryButton={{\n\t\t\t\t'data-test': 'agent-channel-apply',\n\t\t\t\tbuttonType: 'primary',\n\t\t\t\tsize: 'small',\n\t\t\t\tbuttonText: 'Apply',\n\t\t\t\tonClick: () => onApply(draft),\n\t\t\t}}\n\t\t>\n\t\t\t<ChannelPickerBody>\n\t\t\t\t<BodySecondary color={COLORS.content.secondary}>\n\t\t\t\t\t{`Select from available ${accountsNoun}`}\n\t\t\t\t</BodySecondary>\n\n\t\t\t\t<ChannelPickerList>\n\t\t\t\t\t{channel.accounts.map((account) => {\n\t\t\t\t\t\tconst disconnected = isAccountDisconnected(account);\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<ChannelPickerRow\n\t\t\t\t\t\t\t\tkey={account.channelId}\n\t\t\t\t\t\t\t\tdata-test={`agent-channel-account-${account.channelId}`}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<CheckBox\n\t\t\t\t\t\t\t\t\tisChecked={draft.includes(account.channelId)}\n\t\t\t\t\t\t\t\t\tariaLabel={account.channelName}\n\t\t\t\t\t\t\t\t\tvalue={account.channelId}\n\t\t\t\t\t\t\t\t\tonValueChange={() => toggle(account.channelId)}\n\t\t\t\t\t\t\t\t\tstyle={CHECKBOX_SLOT}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<ChannelPickerAccount>\n\t\t\t\t\t\t\t\t\t<ChannelGlyph tint={tint}>\n\t\t\t\t\t\t\t\t\t\t{Icon && <Icon size={16} />}\n\t\t\t\t\t\t\t\t\t</ChannelGlyph>\n\t\t\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t\t\t{account.channelName}\n\t\t\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t\t\t{disconnected && (\n\t\t\t\t\t\t\t\t\t\t// NOT `size=\"small\"`: that renders through BodyTiny, which\n\t\t\t\t\t\t\t\t\t\t// is 10px AND has no font-family, so it falls back to the\n\t\t\t\t\t\t\t\t\t\t// browser serif. The default reads as 12px Inter — Figma's\n\t\t\t\t\t\t\t\t\t\t// body-caption, same as every other chip.\n\t\t\t\t\t\t\t\t\t\t<Tag\n\t\t\t\t\t\t\t\t\t\t\ttagText=\"Disconnected\"\n\t\t\t\t\t\t\t\t\t\t\ttype=\"negative\"\n\t\t\t\t\t\t\t\t\t\t\tvariant=\"regular\"\n\t\t\t\t\t\t\t\t\t\t\theight={20}\n\t\t\t\t\t\t\t\t\t\t\tpadding=\"2px 8px\"\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</ChannelPickerAccount>\n\t\t\t\t\t\t\t</ChannelPickerRow>\n\t\t\t\t\t\t);\n\t\t\t\t\t})}\n\n\t\t\t\t\t{channel.accounts.length === 0 && (\n\t\t\t\t\t\t<BodySecondary color={COLORS.content.placeholder}>\n\t\t\t\t\t\t\t{`No ${accountsNoun} are connected to this store yet.`}\n\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t)}\n\t\t\t\t</ChannelPickerList>\n\t\t\t</ChannelPickerBody>\n\t\t</StyledModal>\n\t);\n};\n\nChannelSelectModal.displayName = 'ChannelSelectModal';\n\nexport type { ChannelSelectModalProps };\n"],"names":["ChannelSelectModal","channel","selectedIds","onClose","onApply","onManageChannels","draft","setDraft","useState","useEffect","Icon","tint","accountsNoun","channelPresentation","toggle","channelId","prev","id","jsx","StyledModal","jsxs","ChannelsLink","RedirectIcon","ChannelPickerBody","BodySecondary","COLORS","ChannelPickerList","account","disconnected","isAccountDisconnected","ChannelPickerRow","CheckBox","CHECKBOX_SLOT","ChannelPickerAccount","ChannelGlyph","TitleSmall","Tag"],"mappings":";;;;;;;;;;AA6CO,MAAMA,IAAwD,CAAC;AAAA,EACrE,SAAAC;AAAA,EACA,aAAAC;AAAA,EACA,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,kBAAAC;AACD,MAAM;AACL,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAmBN,CAAW;AAaxD,MATAO,EAAU,MAAM;AACf,IAAIR,KACHM,EAASL,CAAW;AAAA,EAKtB,GAAG,CAACD,CAAO,CAAC,GAER,CAACA;AACJ,WAAO;AAGR,QAAM,EAAE,MAAAS,GAAM,MAAAC,GAAM,cAAAC,EAAA,IAAiBC;AAAA,IACpCZ,EAAQ;AAAA,IACRA,EAAQ;AAAA,EAAA,GAGHa,IAAS,CAACC,MACfR;AAAA,IAAS,CAACS,MACTA,EAAK,SAASD,CAAS,IACpBC,EAAK,OAAO,CAACC,MAAOA,MAAOF,CAAS,IACpC,CAAC,GAAGC,GAAMD,CAAS;AAAA,EAAA;AAGxB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AAA,gBAAAT;AAAA,oBAACa;AAAA,oBAAA;AAAA,sBACA,WAAWzB,EAAM,SAASqB,EAAQ,SAAS;AAAA,sBAC3C,WAAWA,EAAQ;AAAA,sBACnB,OAAOA,EAAQ;AAAA,sBACf,eAAe,MAAMb,EAAOa,EAAQ,SAAS;AAAA,sBAC7C,OAAOK;AAAA,oBAAA;AAAA,kBAAA;AAAA,oCAEPC,GAAA,EACA,UAAA;AAAA,oBAAA,gBAAAf,EAACgB,KAAa,MAAAvB,GACZ,UAAAD,uBAASA,GAAA,EAAK,MAAM,IAAI,EAAA,CAC1B;AAAA,sCACCyB,GAAA,EAAW,OAAOV,EAAO,QAAQ,SAChC,YAAQ,aACV;AAAA,oBACCG;AAAA;AAAA;AAAA;AAAA,oBAKA,gBAAAV;AAAA,sBAACkB;AAAA,sBAAA;AAAA,wBACA,SAAQ;AAAA,wBACR,MAAK;AAAA,wBACL,SAAQ;AAAA,wBACR,QAAQ;AAAA,wBACR,SAAQ;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACT,EAAA,CAEF;AAAA,gBAAA;AAAA,cAAA;AAAA,cA9BKT,EAAQ;AAAA,YAAA;AAAA,UAiChB,CAAC;AAAA,UAEA1B,EAAQ,SAAS,WAAW,KAC5B,gBAAAiB,EAACM,GAAA,EAAc,OAAOC,EAAO,QAAQ,aACnC,UAAA,MAAMb,CAAY,oCAAA,CACpB;AAAA,QAAA,EAAA,CAEF;AAAA,MAAA,EAAA,CACD;AAAA,IAAA;AAAA,EAAA;AAGH;AAEAZ,EAAmB,cAAc;"}
@@ -1,10 +0,0 @@
1
- import { default as React } from 'react';
2
- /**
3
- * Step 1's "Channels to activate it on" — one card per connected channel, each
4
- * with a select-all checkbox, the accounts it covers as chips, and an edit
5
- * button that opens the per-account picker.
6
- *
7
- * Renders nothing when the consumer passes no `availableChannels`, so a host
8
- * that hasn't wired channels up yet sees the step exactly as it was.
9
- */
10
- export declare const ChannelsSection: React.FC;