ai12z 3.3.2 → 3.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ai12z-bot-f357d89d.js +2613 -0
- package/dist/cjs/ai12z-bot-f357d89d.js.map +1 -0
- package/dist/cjs/ai12z-bot.cjs.entry.js +1 -1
- package/dist/cjs/ai12z-chat_3.cjs.entry.js +46 -36
- package/dist/cjs/ai12z-chat_3.cjs.entry.js.map +1 -1
- package/dist/cjs/ai12z-knowledge-box-005b5b85.js +384 -0
- package/dist/cjs/ai12z-knowledge-box-005b5b85.js.map +1 -0
- package/dist/cjs/ai12z-knowledge-box.cjs.entry.js +1 -1
- package/dist/cjs/dynamic-form.cjs.entry.js +35 -31
- package/dist/cjs/dynamic-form.cjs.entry.js.map +1 -1
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/collection/components/ai12z-bot/ai12z-bot.js +51 -30
- package/dist/collection/components/ai12z-bot/ai12z-bot.js.map +1 -1
- package/dist/collection/components/ai12z-cta/components/Chat.js +46 -36
- package/dist/collection/components/ai12z-cta/components/Chat.js.map +1 -1
- package/dist/collection/components/ai12z-cta/components/DynamicForm.js +35 -31
- package/dist/collection/components/ai12z-cta/components/DynamicForm.js.map +1 -1
- package/dist/collection/components/ai12z-knowledge-box/ai12z-knowledge-box.js +45 -30
- package/dist/collection/components/ai12z-knowledge-box/ai12z-knowledge-box.js.map +1 -1
- package/dist/collection/global/survey-core.min.css +6 -0
- package/dist/esm/ai12z-bot-77e7fbec.js +2611 -0
- package/dist/esm/ai12z-bot-77e7fbec.js.map +1 -0
- package/dist/esm/ai12z-bot.entry.js +1 -1
- package/dist/esm/ai12z-chat_3.entry.js +46 -36
- package/dist/esm/ai12z-chat_3.entry.js.map +1 -1
- package/dist/esm/ai12z-knowledge-box-71a10937.js +382 -0
- package/dist/esm/ai12z-knowledge-box-71a10937.js.map +1 -0
- package/dist/esm/ai12z-knowledge-box.entry.js +1 -1
- package/dist/esm/dynamic-form.entry.js +35 -31
- package/dist/esm/dynamic-form.entry.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/library/index.esm.js +1 -1
- package/dist/library/library.esm.js +1 -1
- package/dist/library/{p-3e968bf1.entry.js → p-03269530.entry.js} +2 -2
- package/dist/library/p-08bbb4b8.entry.js +2 -0
- package/dist/library/p-08bbb4b8.entry.js.map +1 -0
- package/dist/library/{p-af76a7c6.entry.js → p-32558909.entry.js} +2 -2
- package/dist/library/{p-d567093b.entry.js → p-706e3933.entry.js} +2 -2
- package/dist/library/p-706e3933.entry.js.map +1 -0
- package/dist/library/p-a8e4dffd.js +2 -0
- package/dist/library/p-a8e4dffd.js.map +1 -0
- package/dist/library/p-c5f0d025.js +2 -0
- package/dist/library/p-c5f0d025.js.map +1 -0
- package/dist/types/components/ai12z-bot/ai12z-bot.d.ts +4 -0
- package/dist/types/components/ai12z-cta/components/Chat.d.ts +3 -0
- package/dist/types/components/ai12z-cta/components/DynamicForm.d.ts +3 -5
- package/dist/types/components/ai12z-knowledge-box/ai12z-knowledge-box.d.ts +3 -1
- package/package.json +6 -6
- package/dist/cjs/ai12z-bot-74f5836f.js +0 -2592
- package/dist/cjs/ai12z-bot-74f5836f.js.map +0 -1
- package/dist/cjs/ai12z-knowledge-box-30117a83.js +0 -369
- package/dist/cjs/ai12z-knowledge-box-30117a83.js.map +0 -1
- package/dist/collection/global/survey.min.css +0 -6
- package/dist/esm/ai12z-bot-6f64c1b4.js +0 -2590
- package/dist/esm/ai12z-bot-6f64c1b4.js.map +0 -1
- package/dist/esm/ai12z-knowledge-box-f0962b9a.js +0 -367
- package/dist/esm/ai12z-knowledge-box-f0962b9a.js.map +0 -1
- package/dist/library/p-03ec5034.js +0 -2
- package/dist/library/p-03ec5034.js.map +0 -1
- package/dist/library/p-28892eb0.entry.js +0 -2
- package/dist/library/p-28892eb0.entry.js.map +0 -1
- package/dist/library/p-a6392d09.js +0 -2
- package/dist/library/p-a6392d09.js.map +0 -1
- package/dist/library/p-d567093b.entry.js.map +0 -1
- /package/dist/library/{p-3e968bf1.entry.js.map → p-03269530.entry.js.map} +0 -0
- /package/dist/library/{p-af76a7c6.entry.js.map → p-32558909.entry.js.map} +0 -0
|
@@ -11,13 +11,7 @@ const DynamicForm = class {
|
|
|
11
11
|
constructor(hostRef) {
|
|
12
12
|
registerInstance(this, hostRef);
|
|
13
13
|
this.formSubmitted = createEvent(this, "formComplete", 7);
|
|
14
|
-
this.
|
|
15
|
-
this.scripts = [`${this.cdnPath}/v1/survey.jquery.min.js`, `https://unpkg.com/survey-core/themes/plain-light-panelless.min.js`];
|
|
16
|
-
this.styles = [
|
|
17
|
-
`${this.cdnPath}/v1/survey.min.css`,
|
|
18
|
-
`${this.cdnPath}/v1/survey-core.min.css`,
|
|
19
|
-
// `https://unpkg.com/survey-core/defaultV2.min.css`
|
|
20
|
-
];
|
|
14
|
+
this.surveyCDNPath = "https://cdn.ai12z.net/pkg/surveyjs";
|
|
21
15
|
this.form = undefined;
|
|
22
16
|
this.formSettings = undefined;
|
|
23
17
|
this.formsettings = undefined;
|
|
@@ -25,8 +19,7 @@ const DynamicForm = class {
|
|
|
25
19
|
}
|
|
26
20
|
componentWillLoad() {
|
|
27
21
|
var _a;
|
|
28
|
-
this.
|
|
29
|
-
this.loadScripts();
|
|
22
|
+
this.loadScriptsSequentially();
|
|
30
23
|
// console.log("form", this.form)
|
|
31
24
|
let supportedLocales;
|
|
32
25
|
if (this.form) {
|
|
@@ -67,6 +60,38 @@ const DynamicForm = class {
|
|
|
67
60
|
options.htmlElement.name = options.question.name;
|
|
68
61
|
});
|
|
69
62
|
}
|
|
63
|
+
async loadScriptsSequentially() {
|
|
64
|
+
try {
|
|
65
|
+
// 2. Load Survey Core
|
|
66
|
+
await this.loadScript(`${this.surveyCDNPath}/survey-core@2.3.4/survey.core.min.js`);
|
|
67
|
+
// 3. Load Survey i18n
|
|
68
|
+
await this.loadScript(`${this.surveyCDNPath}/survey-core@2.3.4/survey.i18n.min.js`);
|
|
69
|
+
// 4. Load Survey themes
|
|
70
|
+
await this.loadScript(`${this.surveyCDNPath}/survey-core@2.3.4/themes/index.min.js`);
|
|
71
|
+
// 6. Load Survey UI
|
|
72
|
+
await this.loadScript(`${this.surveyCDNPath}/survey-js-ui@2.3.4/survey-js-ui.min.js`);
|
|
73
|
+
console.log("All Survey.js scripts loaded successfully");
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
console.error("Failed to load Survey.js scripts:", error);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
loadScript(src) {
|
|
80
|
+
return new Promise((resolve, reject) => {
|
|
81
|
+
if (document.querySelector(`script[src="${src}"]`)) {
|
|
82
|
+
resolve();
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const script = document.createElement("script");
|
|
86
|
+
script.src = src;
|
|
87
|
+
script.async = false;
|
|
88
|
+
script.onload = () => resolve();
|
|
89
|
+
script.onerror = () => reject(new Error(`Failed to load script: ${src}`));
|
|
90
|
+
// Load in document head for global access
|
|
91
|
+
// document.head.appendChild(script)
|
|
92
|
+
this.el.shadowRoot.appendChild(script);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
70
95
|
componentDidLoad() {
|
|
71
96
|
var _a;
|
|
72
97
|
// Render the SurveyJS survey
|
|
@@ -114,29 +139,8 @@ const DynamicForm = class {
|
|
|
114
139
|
}
|
|
115
140
|
return fallback;
|
|
116
141
|
}
|
|
117
|
-
loadScripts() {
|
|
118
|
-
for (const script of this.scripts) {
|
|
119
|
-
const loadScript = document.createElement("script");
|
|
120
|
-
loadScript.src = script;
|
|
121
|
-
loadScript.onerror = err => {
|
|
122
|
-
console.error("Failed to load script:", err);
|
|
123
|
-
};
|
|
124
|
-
document.head.appendChild(loadScript);
|
|
125
|
-
this.el.appendChild(loadScript);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
loadStyles() {
|
|
129
|
-
for (const style of this.styles) {
|
|
130
|
-
const loadStyle = document.createElement("link");
|
|
131
|
-
loadStyle.rel = "stylesheet";
|
|
132
|
-
loadStyle.href = style;
|
|
133
|
-
loadStyle.onerror = err => {
|
|
134
|
-
console.error("Failed to load style:", err);
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
142
|
render() {
|
|
139
|
-
return h("div", { key: '
|
|
143
|
+
return h("div", { key: '053846c53d63188b20916b490ffedb31c2cfa9b1', id: "surveyContainer" });
|
|
140
144
|
}
|
|
141
145
|
get el() { return getElement(this); }
|
|
142
146
|
};
|