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.
Files changed (66) hide show
  1. package/dist/cjs/ai12z-bot-f357d89d.js +2613 -0
  2. package/dist/cjs/ai12z-bot-f357d89d.js.map +1 -0
  3. package/dist/cjs/ai12z-bot.cjs.entry.js +1 -1
  4. package/dist/cjs/ai12z-chat_3.cjs.entry.js +46 -36
  5. package/dist/cjs/ai12z-chat_3.cjs.entry.js.map +1 -1
  6. package/dist/cjs/ai12z-knowledge-box-005b5b85.js +384 -0
  7. package/dist/cjs/ai12z-knowledge-box-005b5b85.js.map +1 -0
  8. package/dist/cjs/ai12z-knowledge-box.cjs.entry.js +1 -1
  9. package/dist/cjs/dynamic-form.cjs.entry.js +35 -31
  10. package/dist/cjs/dynamic-form.cjs.entry.js.map +1 -1
  11. package/dist/cjs/index.cjs.js +2 -2
  12. package/dist/collection/components/ai12z-bot/ai12z-bot.js +51 -30
  13. package/dist/collection/components/ai12z-bot/ai12z-bot.js.map +1 -1
  14. package/dist/collection/components/ai12z-cta/components/Chat.js +46 -36
  15. package/dist/collection/components/ai12z-cta/components/Chat.js.map +1 -1
  16. package/dist/collection/components/ai12z-cta/components/DynamicForm.js +35 -31
  17. package/dist/collection/components/ai12z-cta/components/DynamicForm.js.map +1 -1
  18. package/dist/collection/components/ai12z-knowledge-box/ai12z-knowledge-box.js +45 -30
  19. package/dist/collection/components/ai12z-knowledge-box/ai12z-knowledge-box.js.map +1 -1
  20. package/dist/collection/global/survey-core.min.css +6 -0
  21. package/dist/esm/ai12z-bot-77e7fbec.js +2611 -0
  22. package/dist/esm/ai12z-bot-77e7fbec.js.map +1 -0
  23. package/dist/esm/ai12z-bot.entry.js +1 -1
  24. package/dist/esm/ai12z-chat_3.entry.js +46 -36
  25. package/dist/esm/ai12z-chat_3.entry.js.map +1 -1
  26. package/dist/esm/ai12z-knowledge-box-71a10937.js +382 -0
  27. package/dist/esm/ai12z-knowledge-box-71a10937.js.map +1 -0
  28. package/dist/esm/ai12z-knowledge-box.entry.js +1 -1
  29. package/dist/esm/dynamic-form.entry.js +35 -31
  30. package/dist/esm/dynamic-form.entry.js.map +1 -1
  31. package/dist/esm/index.js +2 -2
  32. package/dist/library/index.esm.js +1 -1
  33. package/dist/library/library.esm.js +1 -1
  34. package/dist/library/{p-3e968bf1.entry.js → p-03269530.entry.js} +2 -2
  35. package/dist/library/p-08bbb4b8.entry.js +2 -0
  36. package/dist/library/p-08bbb4b8.entry.js.map +1 -0
  37. package/dist/library/{p-af76a7c6.entry.js → p-32558909.entry.js} +2 -2
  38. package/dist/library/{p-d567093b.entry.js → p-706e3933.entry.js} +2 -2
  39. package/dist/library/p-706e3933.entry.js.map +1 -0
  40. package/dist/library/p-a8e4dffd.js +2 -0
  41. package/dist/library/p-a8e4dffd.js.map +1 -0
  42. package/dist/library/p-c5f0d025.js +2 -0
  43. package/dist/library/p-c5f0d025.js.map +1 -0
  44. package/dist/types/components/ai12z-bot/ai12z-bot.d.ts +4 -0
  45. package/dist/types/components/ai12z-cta/components/Chat.d.ts +3 -0
  46. package/dist/types/components/ai12z-cta/components/DynamicForm.d.ts +3 -5
  47. package/dist/types/components/ai12z-knowledge-box/ai12z-knowledge-box.d.ts +3 -1
  48. package/package.json +6 -6
  49. package/dist/cjs/ai12z-bot-74f5836f.js +0 -2592
  50. package/dist/cjs/ai12z-bot-74f5836f.js.map +0 -1
  51. package/dist/cjs/ai12z-knowledge-box-30117a83.js +0 -369
  52. package/dist/cjs/ai12z-knowledge-box-30117a83.js.map +0 -1
  53. package/dist/collection/global/survey.min.css +0 -6
  54. package/dist/esm/ai12z-bot-6f64c1b4.js +0 -2590
  55. package/dist/esm/ai12z-bot-6f64c1b4.js.map +0 -1
  56. package/dist/esm/ai12z-knowledge-box-f0962b9a.js +0 -367
  57. package/dist/esm/ai12z-knowledge-box-f0962b9a.js.map +0 -1
  58. package/dist/library/p-03ec5034.js +0 -2
  59. package/dist/library/p-03ec5034.js.map +0 -1
  60. package/dist/library/p-28892eb0.entry.js +0 -2
  61. package/dist/library/p-28892eb0.entry.js.map +0 -1
  62. package/dist/library/p-a6392d09.js +0 -2
  63. package/dist/library/p-a6392d09.js.map +0 -1
  64. package/dist/library/p-d567093b.entry.js.map +0 -1
  65. /package/dist/library/{p-3e968bf1.entry.js.map → p-03269530.entry.js.map} +0 -0
  66. /package/dist/library/{p-af76a7c6.entry.js.map → p-32558909.entry.js.map} +0 -0
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const ai12zKnowledgeBox = require('./ai12z-knowledge-box-30117a83.js');
5
+ const ai12zKnowledgeBox = require('./ai12z-knowledge-box-005b5b85.js');
6
6
  require('./index-171f7ecf.js');
7
7
  require('./utils-e03d1710.js');
8
8
  require('./index-286c64af.js');
@@ -15,13 +15,7 @@ const DynamicForm = class {
15
15
  constructor(hostRef) {
16
16
  index.registerInstance(this, hostRef);
17
17
  this.formSubmitted = index.createEvent(this, "formComplete", 7);
18
- this.cdnPath = "https://cdn.ai12z.net/assets/bot";
19
- this.scripts = [`${this.cdnPath}/v1/survey.jquery.min.js`, `https://unpkg.com/survey-core/themes/plain-light-panelless.min.js`];
20
- this.styles = [
21
- `${this.cdnPath}/v1/survey.min.css`,
22
- `${this.cdnPath}/v1/survey-core.min.css`,
23
- // `https://unpkg.com/survey-core/defaultV2.min.css`
24
- ];
18
+ this.surveyCDNPath = "https://cdn.ai12z.net/pkg/surveyjs";
25
19
  this.form = undefined;
26
20
  this.formSettings = undefined;
27
21
  this.formsettings = undefined;
@@ -29,8 +23,7 @@ const DynamicForm = class {
29
23
  }
30
24
  componentWillLoad() {
31
25
  var _a;
32
- this.loadStyles();
33
- this.loadScripts();
26
+ this.loadScriptsSequentially();
34
27
  // console.log("form", this.form)
35
28
  let supportedLocales;
36
29
  if (this.form) {
@@ -71,6 +64,38 @@ const DynamicForm = class {
71
64
  options.htmlElement.name = options.question.name;
72
65
  });
73
66
  }
67
+ async loadScriptsSequentially() {
68
+ try {
69
+ // 2. Load Survey Core
70
+ await this.loadScript(`${this.surveyCDNPath}/survey-core@2.3.4/survey.core.min.js`);
71
+ // 3. Load Survey i18n
72
+ await this.loadScript(`${this.surveyCDNPath}/survey-core@2.3.4/survey.i18n.min.js`);
73
+ // 4. Load Survey themes
74
+ await this.loadScript(`${this.surveyCDNPath}/survey-core@2.3.4/themes/index.min.js`);
75
+ // 6. Load Survey UI
76
+ await this.loadScript(`${this.surveyCDNPath}/survey-js-ui@2.3.4/survey-js-ui.min.js`);
77
+ console.log("All Survey.js scripts loaded successfully");
78
+ }
79
+ catch (error) {
80
+ console.error("Failed to load Survey.js scripts:", error);
81
+ }
82
+ }
83
+ loadScript(src) {
84
+ return new Promise((resolve, reject) => {
85
+ if (document.querySelector(`script[src="${src}"]`)) {
86
+ resolve();
87
+ return;
88
+ }
89
+ const script = document.createElement("script");
90
+ script.src = src;
91
+ script.async = false;
92
+ script.onload = () => resolve();
93
+ script.onerror = () => reject(new Error(`Failed to load script: ${src}`));
94
+ // Load in document head for global access
95
+ // document.head.appendChild(script)
96
+ this.el.shadowRoot.appendChild(script);
97
+ });
98
+ }
74
99
  componentDidLoad() {
75
100
  var _a;
76
101
  // Render the SurveyJS survey
@@ -118,29 +143,8 @@ const DynamicForm = class {
118
143
  }
119
144
  return fallback;
120
145
  }
121
- loadScripts() {
122
- for (const script of this.scripts) {
123
- const loadScript = document.createElement("script");
124
- loadScript.src = script;
125
- loadScript.onerror = err => {
126
- console.error("Failed to load script:", err);
127
- };
128
- document.head.appendChild(loadScript);
129
- this.el.appendChild(loadScript);
130
- }
131
- }
132
- loadStyles() {
133
- for (const style of this.styles) {
134
- const loadStyle = document.createElement("link");
135
- loadStyle.rel = "stylesheet";
136
- loadStyle.href = style;
137
- loadStyle.onerror = err => {
138
- console.error("Failed to load style:", err);
139
- };
140
- }
141
- }
142
146
  render() {
143
- return index.h("div", { key: '3c8b59fdf14bc304cc5f3dda3cf84a649e87aae3', id: "surveyContainer" });
147
+ return index.h("div", { key: '053846c53d63188b20916b490ffedb31c2cfa9b1', id: "surveyContainer" });
144
148
  }
145
149
  get el() { return index.getElement(this); }
146
150
  };