PageSourceSearch

https://app.wattfootprint.com/_next/static/chunks/pages/insights_texts/insight-text-new-e90108f1cf852ba3.js

js wattfootprint.com collected 2026-10-09 04:46:59 UTC 8,338 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7405],{4231:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/insights_texts/insight-text-new",function(){return n(94538)}])},58773:function(e,t,n){"use strict";n.d(t,{Z:function(){return DropDown}});var s=n(85893),l=n(67294),i=n(31237),a=n(20518),r=n(61840);function DropDown(e){var t;let{label:n,options:o,value:c,onChange:d,placeholder:u="Select...",error:x,disabled:p=!1,multi:m=!1,searchable:f=!1,className:h=""}=e,[v,g]=(0,l.useState)(!1),[y,b]=(0,l.useState)(""),j=(0,l.useRef)(null),N=(0,l.useRef)(null),w=m?Array.isArray(c)?c:[]:c&&!Array.isArray(c)?[c]:[],C=w.length>0,_="string"==typeof x?x:void 0,T=v||C;(0,l.useEffect)(()=>{v||b("")},[v]);let Z=x?"border-error":v?"border-focused":"border-inputBorder",S=w.map(e=>{var t,n;return null!==(n=null===(t=o.find(t=>t.value===e))||void 0===t?void 0:t.label)&&void 0!==n?n:e});return(0,s.jsxs)("div",{ref:j,className:"flex flex-col gap-1 w-full relative ".concat(h),children:[(0,s.jsxs)("div",{ref:N,className:"relative w-full min-h-[48px] ".concat(p?"opacity-50 pointer-events-none":"cursor-pointer"),onClick:()=>!p&&g(e=>!e),children:[(0,s.jsx)("fieldset",{className:"absolute inset-0 rounded-2xl border pointer-events-none transition-colors duration-150 ".concat(Z),children:(0,s.jsx)("legend",{className:"ml-3 text-xs h-0 overflow-hidden transition-all duration-150",style:{maxWidth:T&&n?"999px":"0.01px",padding:T&&n?"0 4px":"0"},children:(0,s.jsx)("span",{className:"text-xs opacity-0",children:n})})}),n&&(0,s.jsx)("label",{className:["absolute left-4 pointer-events-none select-none transition-all duration-150 font-semibold",T?"top-0 -translate-y-1/2 text-xs text-text1":"top-1/2 -translate-y-1/2 text-sm text-text1"].join(" "),children:n}),(0,s.jsxs)("div",{className:"flex min-h-[48px] items-center px-4 gap-2 select-none",children:[(0,s.jsx)("div",{className:"flex-1 min-w-0 flex flex-wrap gap-1 items-center py-2",children:m&&C?(0,s.jsxs)(s.Fragment,{children:[S.map((e,t)=>(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 bg-activeTabAndTextButton/15 text-activeTabAndTextButton text-xs font-medium px-2 py-0.5 rounded-full",children:[e,(0,s.jsx)("button",{type:"button",className:"flex items-center hover:opacity-70",onClick:e=>(function(e,t){t.stopPropagation();let n=w.filter(t=>t!==e);null==d||d(n)})(w[t],e),children:(0,s.jsx)(a.Z,{sx:{fontSize:12}})})]},w[t])),(0,s.jsx)("span",{className:"text-xs text-activeTabAndTextButton font-medium cursor-pointer hover:opacity-70 ml-1",children:"+ add"})]}):!m&&C?(0,s.jsx)("span",{className:"text-sm font-semibold text-labelText truncate",children:null===(t=o.find(e=>e.value===w[0]))||void 0===t?void 0:t.label}):n?null:(0,s.jsx)("span",{className:"text-sm text-labelText/40",children:u})}),(0,s.jsx)("div",{className:"w-px h-5 bg-divider shrink-0"}),(0,s.jsx)(i.Z,{sx:{fontSize:18},className:"shrink-0 text-labelText transition-transform duration-200 ".concat(v?"rotate-180":"")})]})]}),(0,s.jsx)(r.Z,{open:v,triggerRef:N,onClose:()=>g(!1),options:o,onSelect:function(e){if(m){let t=w.includes(e)?w.filter(t=>t!==e):[...w,e];null==d||d(t)}else null==d||d(e),g(!1)},selectedValues:w,searchable:f,searchValue:y,onSearchChange:b,showSelectedCheck:m}),_&&(0,s.jsx)("span",{className:"text-xs text-error",children:_})]})}},73834:function(e,t,n){"use strict";n.d(t,{Z:function(){return BaseDivider}});var s=n(85893);function BaseDivider(e){let{navBar:t=!1}=e;return(0,s.jsx)("hr",{className:"".concat(t?"hidden lg:block lg:my-0.5 dark:border-slate-700":"my-[20px] -mx-6 dark:border-slate-800"," border-t border-divider")})}n(67294)},13106:function(e,t,n){"use strict";n.d(t,{Z:function(){return CardBox}});var s=n(85893),l=n(67294);function CardBoxComponentBody(e){let{noPadding:t=!1,className:n,children:l}=e;return(0,s.jsx)("div",{className:"flex-1 ".concat(t?"":"p-6"," ").concat(n),children:l})}function CardBoxComponentFooter(e){let{className:t,children:n}=e;return(0,s.jsx)("footer",{className:"p-6 ".concat(t),children:n})}function CardBox(e){let{rounded:t="rounded-2xl",flex:n="flex-col",className:i="",bodyClassName:a="",bgcolor:r="bg-globalBg2",hasComponentLayout:o=!1,hasTable:c=!1,isHoverable:d=!1,isModal:u=!1,children:x,footer:p,onClick:m}=e,f=[c?"overflow-hidden min-h-0":"overflow-auto","".concat(r," flex"),i,t,n];return d&&f.push("hover:shadow-lg transition-shadow duration-500"),l.createElement("div",{className:f.join(" "),onClick:m},o?x:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(CardBoxComponentBody,{noPadding:c,className:a,children:x}),p&&(0,s.jsx)(CardBoxComponentFooter,{children:p})]}))}},95311:function(e,t,n){"use strict";n.d(t,{Z:function(){return AsyncSelectField}});var s=n(85893),l=n(67294),i=n(47024),a=n(58773);let AsyncSelectField=e=>{let{value:t,onChange:n,itemRef:r,company:o,location:c,companyChanged:d,locationChanged:u,error:x,initialOptions:p=[],disabled:m,label:f,placeholder:h,className:v=""}=e,[g,y]=(0,l.useState)(p),[b,j]=(0,l.useState)(!1),N="string"!=typeof t?(null==t?void 0:t.value)||(null==t?void 0:t.id)||"":t;(0,l.useEffect)(()=>{loadOptions()},[o,c,d,u]);let loadOptions=async()=>{try{j(!0);let e="string"!=typeof o?(null==o?void 0:o.value)||(null==o?void 0:o.id):o,t="string"!=typeof c?(null==c?void 0:c.value)||(null==c?void 0:c.id):c,n="/".concat(r,"/autocomplete?limit=100&company=").concat(e||"");"gateways"===r&&(n+="&location=".concat(t||""));let s=await (0,i.Z)(n),l=s.data.map(e=>({value:e.id,label:e.label})),a=new Map([...p,...l].filter(e=>null==e?void 0:e.value).map(e=>[e.value,e]));
1y(Array.from(a.values()))}catch(e){y(p)}finally{j(!1)}};return(0,s.jsx)(a.Z,{className:v,label:f,placeholder:b?"Loading...":h,options:g,value:null!=N?N:"",onChange:e=>{null==n||n(Array.isArray(e)?e[0]:e)},error:x,disabled:m||b})}},94538:function(e,t,n){"use strict";n.r(t);var s=n(85893),l=n(9008),i=n.n(l);n(67294),n(51431),n(35890);var a=n(13106),r=n(62260),o=n(90228),c=n(28552),d=n(17931),u=n(82175),x=n(1870),p=n(73834),m=n(36815),f=n(83102),h=n(74154),v=n(11163),g=n(27420),y=n(93368),b=n(95311);let NewInsightText=()=>{let e=(0,v.useRouter)(),{currentUser:t}=(0,h.C)(e=>e.auth),n=(0,h.T)(),handleSubmit=async t=>{await n((0,f.Ue)(t)),await e.push("/insights_texts/insights-texts-list")};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i(),{children:(0,s.jsx)("title",{children:(0,d.pz)("Create Insight Text")})}),(0,s.jsxs)(o.Z,{children:[(0,s.jsx)(c.Z,{title:"Create Insight Text",main:!0}),(0,s.jsx)(a.Z,{children:(0,s.jsx)(u.J9,{enableReinitialize:!0,initialValues:{industry:"",sensor_type:"",text:""},validationSchema:(0,g.toFormikValidationSchema)(y.Z),onSubmit:e=>handleSubmit(e),children:n=>{var l,i;let{errors:a,touched:r,values:o,setFieldValue:c}=n;return(0,s.jsxs)(u.l0,{children:[(0,s.jsx)(b.Z,{label:"Industry",itemRef:"industries",value:o.industry,onChange:e=>c("industry",e),error:r.industry&&a.industry,className:"mb-[20px]"}),(0,s.jsx)(b.Z,{label:"Sensor Types",itemRef:"sensor_types",value:o.sensor_type,onChange:e=>c("sensor_type",e),error:r.sensor_type&&a.sensor_type,className:"mb-[20px]"}),(0,s.jsx)(x.Z,{className:"mb-[20px]",type:"text",label:"Text",error:r.text&&a.text,placeholder:"Your Text",value:o.text,onChange:e=>c("text",e),disabled:!(null==t?void 0:null===(l=t.app_role)||void 0===l?void 0:l.multitenant)}),(0,s.jsx)(p.Z,{}),(null==t?void 0:null===(i=t.app_role)||void 0===i?void 0:i.multitenant)&&(0,s.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,s.jsx)(m.Z,{type:"submit",label:"Submit"}),(0,s.jsx)(m.Z,{type:"reset",variant:"secondary",label:"Cancel",onClick:()=>e.push("/insights_texts/insights-texts-list")})]})]})}})})]})]})};NewInsightText.getLayout=function(e){return(0,s.jsx)(r.Z,{permission:"CREATE_INSIGHT_TEXT",children:e})},t.default=NewInsightText},93368:function(e,t,n){"use strict";var s=n(1604);let l=s.z.object({industry:s.z.string().transform(e=>e.replace(/\s+/g,"")).pipe(s.z.string().min(1,{message:"Required"})),sensor_type:s.z.string().transform(e=>e.replace(/\s+/g,"")).pipe(s.z.string().min(1,{message:"Required"})),text:s.z.string().transform(e=>e.replace(/\s+/g,"")).pipe(s.z.string().min(1,{message:"Required"}))});t.Z=l},35890:function(){},51431:function(){}},function(e){e.O(0,[7702,518,8792,1664,7724,5892,2175,3510,2321,6865,2260,545,9774,2888,179],function(){return e(e.s=4231)}),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.