PageSourceSearch

https://cms.companion.guide/_next/static/chunks/pages/organization…/[langID]/[compID]-bf63c523dddf77c8.js

js companion.guide collected 2026-10-09 17:35:20 UTC 6,053 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2746],{28923:function(e,o,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/organizations/[organizationID]/objects/[objectID]/[langID]/[compID]",function(){return t(49121)}])},49121:function(e,o,t){"use strict";t.r(o);var i=t(85893),n=t(23508),a=t(67358),s=t(22797),r=t(38895),d=t(15861),c=t(99049),l=t(90801),u=t(41905),v=t(27507),m=t(4736),g=t(87896),p=t(80386),f=t(31262),w=t(34236),b=t(97670),h=t(8228),y=t(48583),j=t(11163),D=t(67294),I=t(70405),C=t(86501),Z=t(22120);function x(e,o){const t={};for(const i of o)if("description"===i){const o=null===e||void 0===e?void 0:e.description;(null===o||void 0===o?void 0:o.ops)&&Array.isArray(o.ops)?t.description=o.ops.map((e=>(null===e||void 0===e?void 0:e.insert)||"")).join(""):"string"===typeof o&&(t.description=o)}else void 0!==(null===e||void 0===e?void 0:e[i])&&(t[i]=e[i]);return t}function P(){var e;const o=(0,j.useRouter)(),{t:t}=(0,Z.$G)(),{organizationID:m,objectID:P,langID:E,compID:T}=o.query,_=(0,y.Dv)(c.L),[k,N]=(0,D.useState)(),[q,O]=(0,D.useState)(null),[S,z]=(0,D.useState)(0),{languages:F,loading:M}=(0,w.L)(),[L,R]=(0,D.useState)({view:!0,update:!0,delete:!0}),A=(0,D.useCallback)((async e=>{if(m&&P&&E&&T)try{const o=await(0,b.Z)({url:"/objects-stack/v2/object/info?customerID=".concat(m,"&objectID=").concat(P,"&langID=").concat(E,"&compID=").concat(T),method:"GET"});if(null===e||void 0===e?void 0:e())return;if(!o.success)throw new Error(o.message);N({...o.data,autoTranslateNow:!!o.data.isDefault}),R(o.data.permissionsCatalog)}catch(o){(null===e||void 0===e?void 0:e())||C.ZP.error((null===o||void 0===o?void 0:o.message)||f.c9)}}),[m,P,E,T]);(0,D.useEffect)((()=>{let e=!1;return A((()=>e)),()=>{e=!0}}),[A]);const G=(0,D.useCallback)((async e=>{try{if(!k)throw new Error("Object data is still loading");const o=(0,u.Dw)(e.questions,e.answers),i=(0,u.Nc)(e.questions,e.answers),n=Object.values(i).some((e=>e.length>0));if(o.trim().length<10&&!n)throw C.ZP.error(t("form.objectForm.aiInterview.needMoreAnswers")),new Error("Need more answers");const{languageCode:a}=null!==e&&void 0!==e?e:{},s="string"===typeof m?m:"";let r={};n&&s&&(r=await(0,h.w)(i,s));const d=(0,u.e2)(e.questions,e.answers,r);let c={};if(o.trim().length>=10){const{success:e,message:t,data:i}=await(0,b.Z)({url:"/objects-stack/v2/object/auto-fill?customerID=".concat(m),method:"POST",body:{userPrompt:o,languageCode:a,mode:"append-interview"}});if(!e)throw new Error(t);c=i||{}}const l={...c,storyCover:d.storyCover.upload.length||d.storyCover.name?d.storyCover:c.storyCover,storyMedia:d.storyMedia.length>0?d.storyMedia:c.storyMedia},v=(0,u.M9)(k,l);O(null),N(v),z((e=>e+1)),C.ZP.success(t("form.objectForm.aiInterview.editDraftReady"))}catch(i){var o;if("Need more answers"!==(null===i||void 0===i?void 0:i.message))C.ZP.error(null!==(o=null===i||void 0===i?void 0:i.message)&&void 0!==o?o:t("form.objectForm.aiInterview.generateFailed"));throw i}}),[k,m,t]),B=(0,D.useCallback)((async(e,o)=>{try{var t,i,n;const a=null!==(n=null===o||void 0===o?void 0:o.fieldsToUpdate)&&void 0!==n?n:["title","teaser","description"],s=(null===(t=null===(i=navigator.language)||void 0===i?void 0:i.split("-")[0])||void 0===t?void 0:t.toLowerCase())||"en",r=F.find((e=>e.awsTranslateCode===s))||void 0,d=(null===r||void 0===r?void 0:r.awsTranslateCode)||void 0,{success:c,message:l,data:u}=await(0,b.Z)({url:"/objects-stack/v2/object/auto-fill?customerID=".concat(m),method:"POST",body:{userPrompt:e.trim()||void 0,languageCode:d,mode:"improve",fieldsToUpdate:a,existingContent:x(k,a)}});if(!c)throw new Error(l);const v={_ts:Date.now()};void 0!==u.title&&(v.title=u.title),void 0!==u.teaser&&(v.teaser=u.teaser),void 0!==u.description&&(v.description=u.description),void 0!==u.voiceDescription&&(v.voiceDescription=u.voiceDescription),void 0!==u.additional&&(v.additional=u.additional),O(v),C.ZP.success("Content improved! Review and edit below, then save.")}catch(s){var a;throw C.ZP.error(null!==(a=null===s||void 0===s?void 0:s.message)&&void 0!==a?a:"Failed to improve content. Try again."),s}}),[m,F,k]),U=!1!==(null===L||void 0===L?void 0:L.update),X=(0,D.useMemo)((()=>(0,u.yf)(k)),[k]),K=X.some((e=>"Existing description"===e.title));return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(I.ql,{title:"Edit Object"}),(0,i.jsx)(g.Z,{title:t("common.edit-object"),breadCrumbs:[{name:t("common.dashboard"),href:{pathname:p.h1,query:{organizationID:m}}},{name:t("common.object",{count:2}
1),href:{pathname:p.tK,query:{organizationID:m}}},{name:t("common.language",{count:2}),href:{pathname:p.kB,query:{organizationID:m,objectID:P}}},{name:t("common.edit-object")}]}),k&&(0,i.jsx)(u.ZP,{variant:"edit",organizationID:"string"===typeof m?m:void 0,objectID:"string"===typeof P?P:void 0,languageID:"string"===typeof E?E:void 0,orgType:null===_||void 0===_||null===(e=_.customerType)||void 0===e?void 0:e.type,languages:F,languagesLoading:M,disabled:!U,hasExistingDescription:K,editReferenceAnswers:X,onComplete:G}),k&&(0,i.jsxs)(a.Z,{disableGutters:!0,elevation:0,sx:{mb:3,border:e=>"1px solid ".concat(e.palette.divider),borderRadius:2,"&:before":{display:"none"}},children:[(0,i.jsx)(r.Z,{expandIcon:(0,i.jsx)(n.Z,{}),children:(0,i.jsx)(d.Z,{sx:{fontWeight:500},children:t("form.objectForm.aiInterview.advancedNotes")})}),(0,i.jsx)(s.Z,{sx:{pt:0},children:(0,i.jsx)(l.Z,{mode:"improve",onGenerate:B,disabled:!U})})]}),k&&(0,i.jsx)(v.Z,{defaultValues:k,onSubmit:async e=>{try{const o={...e,customerID:m},{success:t,message:i}=await(0,b.Z)({url:"/objects-stack/v2/object/langs/update?customerID=".concat(m),method:"POST",body:o});if(!t)throw new Error(i);C.ZP.success(i),O(null),await A()}catch(o){const e=o.message||f.c9;C.ZP.error(e)}},submitButtonText:t("common.update-object"),mode:"edit",permissionsCatalog:L,aiPatch:q},S)]})}P.getLayout=function(e){return(0,i.jsx)(m.Z,{children:e})},o.default=P}},function(e){e.O(0,[1255,630,4581,6949,6878,6804,5675,1795,8948,2995,4736,5159,2333,9774,2888,179],(function(){return o=28923,e(e.s=o);var o}));var o=e.O();_N_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.