ai12z 3.13.3 → 3.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ai12z-bot.cjs.entry.js +107 -19
- package/dist/cjs/ai12z-chat-message.cjs.entry.js +17 -46
- package/dist/cjs/ai12z-knowledge-box.cjs.entry.js +14 -60
- package/dist/cjs/index.cjs.js +1 -0
- package/dist/cjs/styleSheetRegistry-7aecMygn.js +175 -0
- package/dist/collection/components/ai12z-bot/ai12z-bot.js +32 -13
- package/dist/collection/components/ai12z-knowledge-box/ai12z-knowledge-box.js +15 -61
- package/dist/collection/components/ai12z-knowledge-box/components/ai12z-chat-message.js +16 -46
- package/dist/collection/utils/liveagents/providers/salesforce.js +75 -6
- package/dist/collection/utils/styleSheetRegistry.js +169 -0
- package/dist/components/ai12z-bot.js +1 -1
- package/dist/components/ai12z-chat-message.js +1 -1
- package/dist/components/ai12z-chat.js +1 -1
- package/dist/components/ai12z-container.js +1 -1
- package/dist/components/ai12z-cta.js +1 -1
- package/dist/components/ai12z-form.js +1 -1
- package/dist/components/ai12z-inline-search.js +1 -1
- package/dist/components/ai12z-input-form.js +1 -1
- package/dist/components/ai12z-knowledge-box.js +1 -1
- package/dist/components/ai12z-search-panel.js +1 -1
- package/dist/components/audio-recorder.js +1 -1
- package/dist/components/dynamic-form.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/interaction-buttons.js +1 -1
- package/dist/components/item-list.js +1 -1
- package/dist/components/{p-DKxaam7U.js → p-3j2aDKYq.js} +1 -1
- package/dist/components/{p-BP8ig03d.js → p-AQ1MS6Ps.js} +1 -1
- package/dist/components/p-B9IJbo4G.js +1 -0
- package/dist/components/{p-DsZWeAcM.js → p-BWMhH2R1.js} +1 -1
- package/dist/components/{p-5UYwpNzl.js → p-BaXs0IIw.js} +1 -1
- package/dist/components/{p-Gr6Q2s96.js → p-Bnj1LjUJ.js} +1 -1
- package/dist/components/p-BwpiW24r.js +1 -0
- package/dist/components/{p-Bo3Ig8oX.js → p-BwqXbNCx.js} +1 -1
- package/dist/components/{p-D2nUK4Pa.js → p-COqFEHJ7.js} +1 -1
- package/dist/components/{p-DA32xa7d.js → p-Ci85xHWQ.js} +1 -1
- package/dist/components/{p-DUaZgAhA.js → p-CrfXJRIo.js} +1 -1
- package/dist/components/{p-DJ68HDol.js → p-DkRAkHLI.js} +2 -2
- package/dist/components/{p-ha1wIlZ-.js → p-Dubjoiw6.js} +1 -1
- package/dist/components/{p-C2wKkcYa.js → p-DvtUY5FW.js} +1 -1
- package/dist/components/{p-J--erGbY.js → p-dQEvevXk.js} +1 -1
- package/dist/{library/p-DAGa-uHD.js → components/p-g36mIk7k.js} +1 -1
- package/dist/components/p-m0Ed3g6I.js +1 -0
- package/dist/components/p-mBjDeFh_.js +1 -0
- package/dist/components/{p-q7YWDP9B.js → p-pOVc-eI8.js} +1 -1
- package/dist/components/{p-BCJzelr9.js → p-qwKoi5kn.js} +1 -1
- package/dist/components/{p-CKAp10SJ.js → p-xTOLReQF.js} +1 -1
- package/dist/components/privacy-modal.js +1 -1
- package/dist/components/search-results-page.js +1 -1
- package/dist/esm/ai12z-bot.entry.js +115 -27
- package/dist/esm/ai12z-category_2.entry.js +3 -3
- package/dist/esm/ai12z-chat-message.entry.js +17 -46
- package/dist/esm/ai12z-chat_2.entry.js +8 -8
- package/dist/esm/ai12z-container.entry.js +3 -3
- package/dist/esm/ai12z-cta.entry.js +4 -4
- package/dist/esm/ai12z-form.entry.js +2 -2
- package/dist/esm/ai12z-inline-search.entry.js +2 -2
- package/dist/esm/ai12z-knowledge-box.entry.js +18 -64
- package/dist/esm/ai12z-search-panel.entry.js +1 -1
- package/dist/esm/chat-avatar_6.entry.js +1 -1
- package/dist/esm/{ctaHelpers-BhM8KbEY.js → ctaHelpers-DrH6S5iU.js} +1 -1
- package/dist/esm/dynamic-form.entry.js +1 -1
- package/dist/esm/{index-BQKLwW-C.js → index-VWr-8RG8.js} +1 -1
- package/dist/esm/index.js +10 -9
- package/dist/esm/item-list.entry.js +2 -2
- package/dist/esm/{keyboard-shortcuts-Bd3LDe9j.js → keyboard-shortcuts-BhKv64FZ.js} +2 -2
- package/dist/esm/{parseHelper-9rP0JS7J.js → parseHelper-kOGOndOe.js} +1 -1
- package/dist/esm/{processCarouselData-Bf2pDFsV.js → processCarouselData-DX152a4X.js} +1 -1
- package/dist/esm/{reCaptchaHelpers-CUcgfdqX.js → reCaptchaHelpers-DUpCzUFb.js} +1 -1
- package/dist/esm/search-results-page.entry.js +4 -4
- package/dist/esm/{socket-service-B1OMbkCM.js → socket-service-D_h5x8Gr.js} +1 -1
- package/dist/esm/styleSheetRegistry-Bfi9VkqK.js +172 -0
- package/dist/esm/{surveyHelpers-CvrZlir1.js → surveyHelpers-D-00eWjv.js} +1 -1
- package/dist/esm/{utils-BTLjNTwP.js → utils-DK_Yhmpx.js} +1 -1
- package/dist/library/index.esm.js +1 -1
- package/dist/library/library.esm.js +1 -1
- package/dist/library/{p-cd764f70.entry.js → p-11c1f91d.entry.js} +1 -1
- package/dist/library/{p-806bfb3d.entry.js → p-1d382046.entry.js} +1 -1
- package/dist/library/{p-0641ba91.entry.js → p-252bb713.entry.js} +2 -2
- package/dist/library/p-25a678ca.entry.js +1 -0
- package/dist/library/p-53edf210.entry.js +1 -0
- package/dist/library/p-646a7eae.entry.js +1 -0
- package/dist/library/p-675d0243.entry.js +1 -0
- package/dist/library/{p-60d5d99f.entry.js → p-6ea05db1.entry.js} +1 -1
- package/dist/library/{p-7f0e306c.entry.js → p-7154a204.entry.js} +1 -1
- package/dist/library/{p-07f11cb8.entry.js → p-72a5eaf2.entry.js} +1 -1
- package/dist/library/{p-2d262192.entry.js → p-8f238b3f.entry.js} +1 -1
- package/dist/library/p-9cffb6fa.entry.js +1 -0
- package/dist/library/{p-y3Go1NSi.js → p-BCkDiHIY.js} +1 -1
- package/dist/{components/p-BhV62IFF.js → library/p-By1gJKXA.js} +1 -1
- package/dist/library/{p-Bbow4UZX.js → p-C0wNDqKO.js} +1 -1
- package/dist/library/p-C3yxqbFh.js +1 -0
- package/dist/library/p-CwZwG6gL.js +1 -0
- package/dist/library/{p-D5m1leH0.js → p-D1IPrgJe.js} +3 -3
- package/dist/library/{p-NAKC5NP9.js → p-KSKiM1sy.js} +1 -1
- package/dist/library/{p-C1eU4fpM.js → p-TJuczvVq.js} +1 -1
- package/dist/library/{p-CnadO0kA.js → p-ZyOWOLs5.js} +1 -1
- package/dist/library/{p-94bf0c7f.entry.js → p-cbfc9f73.entry.js} +1 -1
- package/dist/library/{p-014d5664.entry.js → p-d8506e43.entry.js} +1 -1
- package/dist/library/{p-BZ_koFpE.js → p-n8ydBHE4.js} +1 -1
- package/dist/types/components/ai12z-bot/ai12z-bot.d.ts +1 -0
- package/dist/types/components/ai12z-knowledge-box/ai12z-knowledge-box.d.ts +0 -3
- package/dist/types/components/ai12z-knowledge-box/components/ai12z-chat-message.d.ts +0 -2
- package/dist/types/utils/liveagents/providers/salesforce.d.ts +2 -0
- package/dist/types/utils/styleSheetRegistry.d.ts +40 -0
- package/package.json +2 -2
- package/dist/components/p-B3lv_O-6.js +0 -1
- package/dist/components/p-CLdlCTTp.js +0 -1
- package/dist/components/p-DT0Uarfg.js +0 -1
- package/dist/components/p-zVXADzTq.js +0 -1
- package/dist/library/p-29cd4edc.entry.js +0 -1
- package/dist/library/p-6f3727d3.entry.js +0 -1
- package/dist/library/p-83a71da9.entry.js +0 -1
- package/dist/library/p-DoBD_KPG.js +0 -1
- package/dist/library/p-d3a2acee.entry.js +0 -1
- package/dist/library/p-dc131a5c.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{A as o,B as t,w as i}from"./p-CrfXJRIo.js";class r{constructor(o){this.honeypotFieldName="ai12z_control",this.config=o}initializeSurveyLibrary(){if(!window.Survey)throw new Error("Survey.js library not loaded");window.Survey.Serializer.addProperty("survey",{name:"keyName:string",visible:!1,category:"general",default:""})}prepareFormModel(o){var t,i,r,e,n,l;let s=null!==(r=null===(i=null===(t=o.controlData)||void 0===t?void 0:t.data)||void 0===i?void 0:i.source)&&void 0!==r?r:o.controlData?null===(e=o.controlData)||void 0===e?void 0:e.form_model:null;if("string"==typeof s)try{s=JSON.parse(s)}catch(o){throw new Error("Invalid JSON in form model")}if("object"==typeof s&&null!==s)return s.keyName=null!==(n=o.keyName)&&void 0!==n?n:null===(l=o.controlData)||void 0===l?void 0:l.key_name,this.injectHoneypotField(s),s;throw new Error("Invalid form model format")}injectHoneypotField(o){if(!o.pages||!Array.isArray(o.pages))return;if(this.hasField(o.pages,this.honeypotFieldName))return;const t=o.pages[0];t&&(Array.isArray(t.elements)||(t.elements=[]),t.elements.push({type:"text",name:this.honeypotFieldName,title:"Leave this field empty",visible:!0,isRequired:!1}))}hasField(o,t){return o.some((o=>{const i=null==o?void 0:o.elements;return!!Array.isArray(i)&&i.some((o=>(null==o?void 0:o.name)===t))}))}determineLocale(i){var r;const e=o(i);if((null===(r=this.config.dataAttributes)||void 0===r?void 0:r.lang)&&e.has(this.config.dataAttributes.lang))return this.config.dataAttributes.lang;const n=t();return e.has(n)?n:"default"}configureSurvey(o,t,i){var r,e,n,l;o.showCompletedPage=!1,o.completeText=null!==(r=null==t?void 0:t.completeText)&&void 0!==r?r:"",o.completedHTML=null!==(e=null==t?void 0:t.completedHtml)&&void 0!==e?e:"Thank You!";const s=null!==(n=i.theme)&&void 0!==n?n:null===(l=i.controlData)||void 0===l?void 0:l.theme;if(s)try{const t="string"==typeof s?JSON.parse(s):s;o.applyTheme(t)}catch(o){console.warn("Failed to apply survey theme:",o)}else console.warn("No theme data found in chat object");this.hideCompleteButtonForIframes(t,o),o.onAfterRenderQuestionInput.add(((o,t)=>{t.htmlElement.name=t.question.name})),o.onAfterRenderQuestion.add(((o,t)=>{"ai12z_control"===t.question.name&&t.htmlElement.classList.add("ai12z-form-honeypot")})),o.onUpdateQuestionCssClasses.add(((o,t)=>{"ai12z_control"===t.question.name&&(t.cssClasses.mainRoot+=" ai12z-form-honeypot")})),o.onComplete.add((async o=>{try{const t=await this.handleSurveyResults(o);this.config.formSubmitRenderCallback&&this.config.formSubmitRenderCallback(t)}catch(t){this.config.onSubmitError&&this.config.onSubmitError((null==t?void 0:t.message)||"Failed to submit form",{sender:o}),console.error("Error in survey completion handler:",t)}}))}hideCompleteButtonForIframes(o,i){(null==o?void 0:o.pages)&&o.pages.forEach((o=>{o.elements&&o.elements.forEach((o=>{var r,e;"html"===o.type&&("string"==typeof o.html?(null===(r=o.html)||void 0===r?void 0:r.includes("<iframe"))&&(i.showCompleteButton=!1):"object"==typeof o.html&&(null===(e=o.html[t()])||void 0===e?void 0:e.includes("<iframe"))&&(i.showCompleteButton=!1))}))}))}async handleSurveyResults(o){var t,r,e,n,l;try{const s=this.prepareResults(o);if(this.getHoneypotValue(o).length>0)throw new Error("Form submission blocked by validation");delete s[this.honeypotFieldName];const d=await i(this.config.dataKey,this.config.dataMode,o.keyName,s),a=o.processText(null===(t=o.jsonObj)||void 0===t?void 0:t.completedHtml);return{sender:o,results:s,response:d,completedHtml:this.resolveLocalized(a,"Thank You!"),completeText:this.resolveLocalized(null===(r=o.jsonObj)||void 0===r?void 0:r.completeText,"Submit"),domId:null!==(l=null===(n=null===(e=o.implementor)||void 0===e?void 0:e.renderedElement)||void 0===n?void 0:n.id)&&void 0!==l?l:o.domId,keyName:o.keyName,jsonData:`This JSON is from a form submission [${o.keyName}]: ${JSON.stringify(s,null,2)}. There is no need to show the form [${o.keyName}] again.`}}catch(o){throw console.error("Form submission error:",o),o}}getHoneypotValue(o){var t,i,r;const e=null!==(r=null!==(i=null===(t=null==o?void 0:o.data)||void 0===t?void 0:t[this.honeypotFieldName])&&void 0!==i?i:null==o?void 0:o[this.honeypotFieldName])&&void 0!==r?r:"";return"string"==typeof e?e.trim():null==e?"":String(e).trim()}prepareResults(o){const t=JSON.parse(JSON.stringify(o.data));return t.description=this.resolveLocalized(o.jsonObj.description,""),t}resolveLocalized(o,i=""){var r;return o?"string"==typeof o?o:"object"==typeof o&&(o[null===(r=this.config.dataAttributes)||void 0===r?void 0:r.lang]||o[t()]||o.default)||i:i}async renderSurvey(o){try{this.initializeSurveyLibrary();const t=this.prepareFormModel(o.chat),i=this.determineLocale(t);window.Survey.surveyLocalization.currentLocale=i;const r=new window.Survey.Model(t),e=o.shadowRoot.querySelector(`#${o.surveyDomId}`);if(!e)throw new Error(`Survey element with ID ${o.surveyDomId} not found`);return r.domId=o.surveyDomId,this.configureSurvey(r,t,o.chat),r.render(e),r}catch(t){throw console.error("Error rendering survey:",t),this.handleSurveyError(o.shadowRoot,o.surveyDomId,t.message),t}}handleSurveyError(o,t,i){const r=o.querySelector(`#${t}`);r&&(r.innerHTML=`\n <div class="survey-error">\n <p class="error-message">Failed to load survey: ${i}</p>\n <button onclick="location.reload()" class="retry-button">Retry</button>\n </div>\n `)}}async function e(o){const t=new r(o.config);return await t.renderSurvey(o)}export{e as r}
|