@ourlu/assistant-sdk 0.2.3 → 0.2.5

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 (51) hide show
  1. package/dist/iife/audio.v1.028c93fe.js +160 -0
  2. package/dist/iife/audio.v1.051ececf.js +183 -0
  3. package/dist/iife/audio.v1.200db1a6.js +208 -0
  4. package/dist/iife/audio.v1.20858b08.js +191 -0
  5. package/dist/iife/audio.v1.2690e445.js +179 -0
  6. package/dist/iife/audio.v1.2742ff12.js +188 -0
  7. package/dist/iife/audio.v1.70af81b3.js +191 -0
  8. package/dist/iife/audio.v1.95146620.js +1 -1
  9. package/dist/iife/audio.v1.b330baaf.js +166 -0
  10. package/dist/iife/audio.v1.bb9c2d88.js +181 -0
  11. package/dist/iife/audio.v1.ea7571b2.js +182 -0
  12. package/dist/iife/audio.v1.fc0aa8af.js +191 -0
  13. package/dist/iife/audio.v1.js +107 -95
  14. package/dist/iife/engine.v1.2b5bb43b.js +735 -0
  15. package/dist/iife/engine.v1.3b09dc20.js +3 -3
  16. package/dist/iife/engine.v1.56074e5a.js +769 -0
  17. package/dist/iife/engine.v1.61c10e6c.js +770 -0
  18. package/dist/iife/engine.v1.773fc15d.js +2 -2
  19. package/dist/iife/engine.v1.80d2230f.js +770 -0
  20. package/dist/iife/engine.v1.940ba9ea.js +764 -0
  21. package/dist/iife/engine.v1.99a33ee2.js +767 -0
  22. package/dist/iife/engine.v1.9ca6b7ec.js +756 -0
  23. package/dist/iife/engine.v1.a1f7dea2.js +764 -0
  24. package/dist/iife/engine.v1.c0c00bd0.js +721 -0
  25. package/dist/iife/engine.v1.c127656e.js +820 -0
  26. package/dist/iife/engine.v1.c54c9a1a.js +770 -0
  27. package/dist/iife/engine.v1.d1052e81.js +770 -0
  28. package/dist/iife/engine.v1.f6d23a0f.js +770 -0
  29. package/dist/iife/engine.v1.js +135 -36
  30. package/dist/iife/loader.v1.js +5 -1
  31. package/dist/iife/signalement.v1.d321dfde.js +518 -0
  32. package/dist/iife/signalement.v1.js +518 -0
  33. package/dist/iife/ui.v1.00abf020.js +895 -0
  34. package/dist/iife/ui.v1.5d2d4504.js +942 -0
  35. package/dist/iife/ui.v1.6afac75f.js +944 -0
  36. package/dist/iife/ui.v1.6becaa84.js +895 -0
  37. package/dist/iife/ui.v1.6c9e4995.js +895 -0
  38. package/dist/iife/ui.v1.7fb4db0b.js +935 -0
  39. package/dist/iife/ui.v1.88bf5494.js +898 -0
  40. package/dist/iife/ui.v1.923a4e6d.js +937 -0
  41. package/dist/iife/ui.v1.9bfe2815.js +942 -0
  42. package/dist/iife/ui.v1.a8cfe724.js +900 -0
  43. package/dist/iife/ui.v1.c58e1d58.js +959 -0
  44. package/dist/iife/ui.v1.cdfe9a45.js +919 -0
  45. package/dist/iife/ui.v1.e007c7c4.js +926 -0
  46. package/dist/iife/ui.v1.e24ba2bd.js +903 -0
  47. package/dist/iife/ui.v1.f1d8e998.js +903 -0
  48. package/dist/iife/ui.v1.fc52b520.js +895 -0
  49. package/dist/iife/ui.v1.js +154 -147
  50. package/dist/iife/widget-manifest.json +4 -3
  51. package/package.json +2 -1
@@ -61,33 +61,37 @@ function installMascotTheme(ui) {
61
61
  };
62
62
 
63
63
  ui.buildMascotDerivedPalette = function buildMascotDerivedPalette(config) {
64
- var teal600 = ui.normalizeHexColor(config.mascotSecondaryColor, "#58878d");
65
- var teal700 = ui.normalizeHexColor(config.mascotSecondaryDarkColor, "#355c62");
66
- var gold500 = ui.normalizeHexColor(config.mascotGoldColor, "#f4c934");
64
+ var blue500 = ui.normalizeHexColor(config.mascotSecondaryColor, "#68b1d6");
65
+ var blue700 = ui.normalizeHexColor(config.mascotSecondaryDarkColor, "#1472a8");
66
+ var gold500 = ui.normalizeHexColor(config.mascotGoldColor, "#ffd22e");
67
67
  var eye500 = ui.normalizeHexColor(config.mascotEyeColor, "#040402");
68
- var beak300 = ui.normalizeHexColor(config.mascotBeakColor, "#ab6d46");
68
+ var beak300 = ui.normalizeHexColor(config.mascotBeakColor, "#ab5f30");
69
+ var claw300 = ui.normalizeHexColor(config.mascotClawColor, "#ab5f30");
69
70
  var neutral200 = ui.normalizeHexColor(config.mascotNeutralColor, "#e6e6e6");
71
+ var brow500 = ui.normalizeHexColor(config.mascotBrowColor, "#3e3e3e");
70
72
  return {
71
- teal900: ui.adjustHexBrightness(teal700, -18),
72
- teal700: teal700,
73
- teal600: teal600,
74
- teal500: ui.adjustHexBrightness(teal600, 10),
75
- teal400: ui.adjustHexBrightness(teal600, 22),
76
- wing500: teal700,
77
- wing700: ui.adjustHexBrightness(teal700, -10),
78
- wing900: ui.adjustHexBrightness(teal700, -26),
73
+ blue400: ui.adjustHexBrightness(blue500, 8),
74
+ blue500: blue500,
75
+ blue550: ui.adjustHexBrightness(blue500, -6),
76
+ blue580: ui.adjustHexBrightness(blue500, -24),
77
+ blue600: ui.adjustHexBrightness(blue700, 12),
78
+ blue700: blue700,
79
+ blue800: ui.adjustHexBrightness(blue700, -10),
79
80
  gold500: gold500,
80
81
  gold450: ui.adjustHexBrightness(gold500, -6),
81
82
  gold700: ui.adjustHexBrightness(gold500, -24),
82
83
  gold900: ui.adjustHexBrightness(gold500, -42),
83
- eyeOutline: ui.adjustHexBrightness(eye500, -8),
84
84
  eye500: eye500,
85
85
  eye900: ui.adjustHexBrightness(eye500, -26),
86
86
  beak300: beak300,
87
- beak500: ui.adjustHexBrightness(beak300, 12),
87
+ beak400: ui.adjustHexBrightness(beak300, 14),
88
+ beak500: ui.adjustHexBrightness(beak300, 8),
88
89
  beak700: ui.adjustHexBrightness(beak300, -24),
89
- claw700: ui.adjustHexBrightness(beak300, -30),
90
- claw400: ui.adjustHexBrightness(beak300, 18),
90
+ claw300: claw300,
91
+ claw400: ui.adjustHexBrightness(claw300, 18),
92
+ claw700: ui.adjustHexBrightness(claw300, -30),
93
+ brow500: brow500,
94
+ brow400: ui.adjustHexBrightness(brow500, 4),
91
95
  neutral200: neutral200,
92
96
  neutral300: ui.adjustHexBrightness(neutral200, -18),
93
97
  black: ui.adjustHexBrightness(eye500, -40),
@@ -98,28 +102,27 @@ function installMascotTheme(ui) {
98
102
  ui.buildMascotColorReplacementMap = function buildMascotColorReplacementMap(config) {
99
103
  var palette = ui.buildMascotDerivedPalette(config || {});
100
104
  var replacementMap = {};
101
- ui.assignMascotTokenGroup(replacementMap, ["#355c62", "#355b62"], palette.teal900);
102
- ui.assignMascotTokenGroup(replacementMap, ["#5a898f", "#396769"], palette.teal700);
103
- ui.assignMascotTokenGroup(replacementMap, ["#58878d", "#57868c", "#5d898f", "#4c8187", "#457d86", "#35696e"], palette.teal600);
104
- ui.assignMascotTokenGroup(replacementMap, ["#669ca0", "#669b9f", "#619498", "#709092", "#55898b", "#63989c", "#53878c"], palette.teal500);
105
- ui.assignMascotTokenGroup(replacementMap, ["#85b8bb"], palette.teal400);
106
- ui.assignMascotTokenGroup(replacementMap, ["#548389", "#548085"], palette.wing500);
107
- ui.assignMascotTokenGroup(replacementMap, ["#537577", "#41656a", "#406d74"], palette.wing700);
108
- ui.assignMascotTokenGroup(replacementMap, ["#1b3b3c", "#1f464c", "#203d41", "#223f42", "#131f20", "#1a2729", "#295055"], palette.wing900);
109
- ui.assignMascotTokenGroup(replacementMap, ["#f4c934", "#ffd166"], palette.gold500);
110
- ui.assignMascotTokenGroup(replacementMap, ["#ebc132", "#efc433"], palette.gold450);
111
- ui.assignMascotTokenGroup(replacementMap, ["#caa62b", "#a68823"], palette.gold700);
112
- ui.assignMascotTokenGroup(replacementMap, ["#58470b", "#8e751e"], palette.gold900);
113
- ui.assignMascotTokenGroup(replacementMap, ["#1f4d52", "#225b61"], palette.eyeOutline);
114
- ui.assignMascotTokenGroup(replacementMap, ["#254147"], palette.eye500);
115
- ui.assignMascotTokenGroup(replacementMap, ["#152326", "#0a2d2a", "#595331", "#040402", "#000000"], palette.eye900);
116
- ui.assignMascotTokenGroup(replacementMap, ["#ab6d46"], palette.beak300);
117
- ui.assignMascotTokenGroup(replacementMap, ["#be9f5f", "#b18835", "#d7b353", "#bca134"], palette.beak500);
118
- ui.assignMascotTokenGroup(replacementMap, ["#2b4a4d", "#695a39", "#574c34", "#565249", "#ac9149", "#5b4518", "#514523"], palette.beak700);
119
- ui.assignMascotTokenGroup(replacementMap, ["#7d6026", "#7d6025"], palette.claw700);
120
- ui.assignMascotTokenGroup(replacementMap, ["#e3af46", "#dcaa44"], palette.claw400);
121
- ui.assignMascotTokenGroup(replacementMap, ["#e6e6e6", "#e5e5e5", "#e8e8e8", "#e8e4e4"], palette.neutral200);
122
- ui.assignMascotTokenGroup(replacementMap, ["#a2aaaa", "#b0baba"], palette.neutral300);
105
+ ui.assignMascotTokenGroup(replacementMap, ["#70c1ea"], palette.blue400);
106
+ ui.assignMascotTokenGroup(replacementMap, ["#68b1d6"], palette.blue500);
107
+ ui.assignMascotTokenGroup(replacementMap, ["#44aade"], palette.blue550);
108
+ ui.assignMascotTokenGroup(replacementMap, ["#4a9ac3"], palette.blue580);
109
+ ui.assignMascotTokenGroup(replacementMap, ["#2f97cc"], palette.blue600);
110
+ ui.assignMascotTokenGroup(replacementMap, ["#1472a8"], palette.blue700);
111
+ ui.assignMascotTokenGroup(replacementMap, ["#156696"], palette.blue800);
112
+ ui.assignMascotTokenGroup(replacementMap, ["#ffd22e"], palette.gold500);
113
+ ui.assignMascotTokenGroup(replacementMap, ["#f0c31f"], palette.gold450);
114
+ ui.assignMascotTokenGroup(replacementMap, ["#c29500"], palette.gold700);
115
+ ui.assignMascotTokenGroup(replacementMap, ["#946700"], palette.gold900);
116
+ ui.assignMascotTokenGroup(replacementMap, ["#040402", "#00193b"], palette.eye900);
117
+ ui.assignMascotTokenGroup(replacementMap, ["#ab5f30"], palette.beak300);
118
+ ui.assignMascotTokenGroup(replacementMap, ["#dd8e5d", "#dd9060", "#ca7e4f"], palette.beak400);
119
+ ui.assignMascotTokenGroup(replacementMap, ["#d98d5e"], palette.beak500);
120
+ ui.assignMascotTokenGroup(replacementMap, ["#6e2200"], palette.beak700);
121
+ ui.assignMascotTokenGroup(replacementMap, ["#6f2301"], palette.claw700);
122
+ ui.assignMascotTokenGroup(replacementMap, ["#da8e5f"], palette.claw400);
123
+ ui.assignMascotTokenGroup(replacementMap, ["#3e3e3e"], palette.brow500);
124
+ ui.assignMascotTokenGroup(replacementMap, ["#434343"], palette.brow400);
125
+ ui.assignMascotTokenGroup(replacementMap, ["#e6e6e6"], palette.neutral200);
123
126
  replacementMap.white = palette.white;
124
127
  replacementMap.black = palette.black;
125
128
  return replacementMap;
@@ -151,12 +154,14 @@ function installMascotTheme(ui) {
151
154
  }
152
155
  var replacementMap = ui.buildMascotColorReplacementMap(config || {});
153
156
  var cacheKey = normalizedMascotUrl + "::" + [
154
- ui.normalizeHexColor((config || {}).mascotSecondaryColor, "#58878d"),
155
- ui.normalizeHexColor((config || {}).mascotSecondaryDarkColor, "#355c62"),
156
- ui.normalizeHexColor((config || {}).mascotGoldColor, "#f4c934"),
157
+ ui.normalizeHexColor((config || {}).mascotSecondaryColor, "#68b1d6"),
158
+ ui.normalizeHexColor((config || {}).mascotSecondaryDarkColor, "#1472a8"),
159
+ ui.normalizeHexColor((config || {}).mascotGoldColor, "#ffd22e"),
157
160
  ui.normalizeHexColor((config || {}).mascotEyeColor, "#040402"),
158
- ui.normalizeHexColor((config || {}).mascotBeakColor, "#ab6d46"),
159
- ui.normalizeHexColor((config || {}).mascotNeutralColor, "#e6e6e6")
161
+ ui.normalizeHexColor((config || {}).mascotBeakColor, "#ab5f30"),
162
+ ui.normalizeHexColor((config || {}).mascotNeutralColor, "#e6e6e6"),
163
+ ui.normalizeHexColor((config || {}).mascotBrowColor, "#3e3e3e"),
164
+ ui.normalizeHexColor((config || {}).mascotClawColor, "#ab5f30")
160
165
  ].join("::");
161
166
  if (ui.mascotSvgSourceCache[cacheKey]) {
162
167
  return Promise.resolve(ui.mascotSvgSourceCache[cacheKey]);
@@ -164,13 +169,13 @@ function installMascotTheme(ui) {
164
169
  return fetch(normalizedMascotUrl, { method: "GET", credentials: "omit" })
165
170
  .then(function(response) {
166
171
  if (!response.ok) {
167
- throw new Error("mascot fetch failed");
172
+ throw new Error("Impossible de charger la mascotte.");
168
173
  }
169
174
  return response.text();
170
175
  })
171
176
  .then(function(rawSvgMarkup) {
172
177
  if (!rawSvgMarkup || rawSvgMarkup.indexOf("<svg") === -1) {
173
- throw new Error("mascot SVG invalide ou reponse non-SVG pour " + normalizedMascotUrl);
178
+ throw new Error("Mascotte SVG invalide ou réponse non-SVG pour " + normalizedMascotUrl);
174
179
  }
175
180
  var themedSvgMarkup = ui.replaceSvgColorTokens(rawSvgMarkup, replacementMap);
176
181
  var themedDataUrl = ui.encodeSvgToDataUrl(themedSvgMarkup);
@@ -382,7 +387,6 @@ function installWidgetCssBuilder(ui) {
382
387
  WidgetCssBuilder.prototype.build = function() {
383
388
  var cfg = this.config;
384
389
  var side = cfg.position === "bottom-left" ? "left" : "right";
385
- var resizeCorner = cfg.position === "bottom-left" ? "right" : "left";
386
390
  var gradient = "linear-gradient(135deg," + cfg.primaryColor + " 0%,#0047b3 100%)";
387
391
  var panelBg = ui.hexToRgba(cfg.panelBackgroundColor, cfg.panelBackgroundAlpha);
388
392
  var layout = this.resolveLayout();
@@ -401,49 +405,58 @@ function installWidgetCssBuilder(ui) {
401
405
  this.buildMessageBubbles(cfg.primaryColor),
402
406
  this.buildTypingAndError(),
403
407
  this.buildComposer(cfg.primaryColor, br),
404
- this.buildResizeHandle(resizeCorner),
405
408
  this.buildMobileOverrides()
406
409
  ].join("\n");
407
410
  };
408
411
 
409
412
  WidgetCssBuilder.prototype.buildResetAndBase = function() {
410
- return ":host *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,system-ui,sans-serif;-webkit-font-smoothing:antialiased}";
413
+ return [
414
+ ":host *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,system-ui,sans-serif;-webkit-font-smoothing:antialiased}",
415
+ ":host button{outline:none;-webkit-tap-highlight-color:transparent}",
416
+ ":host button:focus{outline:none}",
417
+ ":host button:focus-visible{outline:2px solid rgba(0,102,255,.4);outline-offset:2px}"
418
+ ].join("\n");
411
419
  };
412
420
 
413
421
  WidgetCssBuilder.prototype.buildBubble = function(side, gradient, primaryColor) {
414
422
  return [
415
- "#cm-bubble{position:fixed;" + side + ":24px;bottom:24px;width:64px;height:64px;border-radius:50%;background:" + gradient + ";border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;z-index:2147483000;box-shadow:0 8px 24px rgba(0,0,0,.28),0 2px 8px rgba(0,0,0,.12);transition:transform .2s cubic-bezier(.4,0,.2,1)}",
423
+ "#cm-bubble{position:fixed;" + side + ":20px;bottom:20px;width:64px;height:64px;border-radius:50%;background:" + gradient + ";border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;z-index:2147483000;box-shadow:0 8px 24px rgba(0,0,0,.28),0 2px 8px rgba(0,0,0,.12);transition:transform .2s cubic-bezier(.4,0,.2,1)}",
416
424
  "#cm-bubble:hover{transform:scale(1.1)}",
417
425
  "#cm-bubble:active{transform:scale(0.95)}",
418
426
  "#cm-bubble:focus-visible{outline:3px solid " + primaryColor + ";outline-offset:3px}",
419
- "#cm-bubble img{width:84px;height:84px;object-fit:contain;position:absolute;top:-14px;filter:drop-shadow(0 4px 8px rgba(0,0,0,.25))}"
427
+ "#cm-bubble img{width:84px;height:84px;object-fit:contain;position:absolute;top:-14px;filter:drop-shadow(0 2px 4px rgba(0,0,0,.15))}"
420
428
  ].join("\n");
421
429
  };
422
430
 
423
431
  WidgetCssBuilder.prototype.buildPanel = function(side, width, height, maxHeightVh, background, borderRadius) {
424
432
  return [
425
- "#cm-panel{position:fixed;" + side + ":24px;bottom:100px;width:" + width + ";max-width:calc(100vw - 32px);height:" + height + ";max-height:" + maxHeightVh + ";background:" + background + ";border-radius:" + borderRadius + ";box-shadow:0 16px 48px rgba(0,0,0,.22),0 4px 16px rgba(0,0,0,.1);display:none;flex-direction:column;overflow:visible;z-index:2147483000;transition:box-shadow .2s}",
426
- "#cm-panel.open{display:flex}"
433
+ "#cm-panel{position:fixed;" + side + ":24px;bottom:100px;width:" + width + ";max-width:calc(100vw - 32px);height:" + height + ";max-height:" + maxHeightVh + ";background:" + background + ";border-radius:" + borderRadius + ";box-shadow:0 16px 48px rgba(0,0,0,.22),0 4px 16px rgba(0,0,0,.1);display:none;flex-direction:column;overflow:visible;z-index:2147483000;transition:box-shadow .2s,bottom .25s cubic-bezier(.4,0,.2,1)}",
434
+ "#cm-panel.open{display:flex;bottom:24px}",
435
+ "#cm-panel.maximized{width:840px !important;height:calc(100vh - 48px) !important;max-width:calc(100vw - 48px) !important;max-height:none !important}"
427
436
  ].join("\n");
428
437
  };
429
438
 
430
439
  WidgetCssBuilder.prototype.buildHeader = function(gradient, borderRadius) {
431
440
  return [
432
- "#cm-header{display:flex;align-items:center;justify-content:space-between;padding:14px 16px 14px 80px;background:" + gradient + ";color:#fff;position:relative;border-radius:" + borderRadius + " " + borderRadius + " 0 0;min-height:52px}",
433
- "#cm-header-mascot{width:72px;height:72px;position:absolute;left:4px;top:-12px;filter:drop-shadow(0 3px 6px rgba(0,0,0,.25));pointer-events:none}",
441
+ "#cm-header{display:flex;align-items:center;justify-content:space-between;padding:10px 12px 10px 80px;background:" + gradient + ";color:#fff;position:relative;border-radius:" + borderRadius + " " + borderRadius + " 0 0;min-height:44px;flex-shrink:0}",
442
+ "#cm-header-mascot{width:83px;height:83px;position:absolute;left:-6px;top:-16px;filter:drop-shadow(0 2px 3px rgba(0,0,0,.12));pointer-events:none}",
434
443
  "#cm-title{margin:0;font-size:16px;font-weight:600;letter-spacing:-0.01em}",
435
- "#cm-close{background:none;border:none;color:#fff;cursor:pointer;font-size:22px;line-height:1;padding:6px 10px;border-radius:6px;transition:background .15s}",
436
- "#cm-close:hover{background:rgba(255,255,255,.18)}"
444
+ "#cm-header-actions{display:flex;align-items:center;gap:4px}",
445
+ ".cm-header-btn{background:none;border:none;color:#fff;cursor:pointer;padding:6px;border-radius:8px;transition:background .15s;display:flex;align-items:center;justify-content:center;-webkit-user-select:none;user-select:none}",
446
+ ".cm-header-btn:hover{background:rgba(255,255,255,.18)}",
447
+ ".cm-header-btn:active{transform:scale(0.92)}",
448
+ ".cm-header-btn svg{width:22px;height:22px}"
437
449
  ].join("\n");
438
450
  };
439
451
 
440
452
  WidgetCssBuilder.prototype.buildNotes = function() {
441
453
  return [
442
- "#cm-disclaimer,#cm-transparency{font-size:13px;display:flex;align-items:center;gap:8px;padding:8px 14px}",
443
- "#cm-disclaimer{background:#fff3cd;color:#6b5900;border-bottom:1px solid #ffc107}",
444
- "#cm-transparency{color:#555;border-top:1px solid #eee}",
445
- ".cm-close-note{background:none;border:none;cursor:pointer;border-radius:4px;padding:2px 6px;opacity:.7;transition:opacity .15s}",
446
- ".cm-close-note:hover{opacity:1;background:rgba(0,0,0,.06)}"
454
+ "#cm-disclaimer,#cm-transparency{font-size:13px;display:flex;align-items:center;gap:8px;padding:8px 14px;flex-shrink:0}",
455
+ "#cm-disclaimer{background:#e8f4fd;color:#1a5276;border-bottom:1px solid #b3d9f2}",
456
+ "#cm-transparency{color:#555;border-top:1px solid #eee;background:#fff;display:none}",
457
+ ".cm-close-note{background:none;border:none;cursor:pointer;border-radius:6px;padding:4px 8px;min-width:32px;min-height:32px;width:32px;opacity:.6;transition:opacity .15s,background .15s;flex-shrink:0;display:flex;align-items:center;justify-content:center;margin-left:auto}",
458
+ ".cm-close-note:hover{opacity:1;background:rgba(0,0,0,.08)}",
459
+ ".cm-close-note svg{width:16px;height:16px}"
447
460
  ].join("\n");
448
461
  };
449
462
 
@@ -489,50 +502,40 @@ function installWidgetCssBuilder(ui) {
489
502
 
490
503
  WidgetCssBuilder.prototype.buildComposer = function(primaryColor, borderRadius) {
491
504
  return [
492
- "#cm-form{display:flex;align-items:flex-end;gap:8px;padding:12px 16px;border-top:1px solid #eee;background:#fff;border-radius:0 0 " + borderRadius + " " + borderRadius + "}",
505
+ "#cm-form{display:flex;align-items:flex-end;gap:8px;padding:12px 16px;border-top:1px solid #eee;background:#fff;border-radius:0 0 " + borderRadius + " " + borderRadius + ";flex-shrink:0}",
493
506
  "#cm-input{flex:1;border:1.5px solid #d1d5db;border-radius:14px;padding:12px 16px;min-height:48px;max-height:200px;resize:none;outline:none;line-height:1.5;font-size:15px;transition:border-color .2s,box-shadow .2s;overflow-y:auto}",
494
507
  "#cm-input:focus{border-color:" + primaryColor + ";box-shadow:0 0 0 3px rgba(0,102,255,.15)}",
495
508
  "#cm-input::placeholder{color:#9ca3af}",
496
- "#cm-send,#cm-mic{width:48px;height:48px;border-radius:50%;display:flex;align-items:center;justify-content:center;border:none;cursor:pointer;flex-shrink:0;transition:transform .15s,opacity .15s;font-size:18px}",
509
+ "#cm-send,#cm-mic{width:48px;height:48px;border-radius:50%;display:flex;align-items:center;justify-content:center;border:none;cursor:pointer;flex-shrink:0;transition:transform .15s,opacity .15s;font-size:18px;-webkit-user-select:none;user-select:none;-webkit-user-drag:none}",
497
510
  "#cm-send{background:" + primaryColor + ";color:#fff}",
498
511
  "#cm-send:hover:not(:disabled){transform:scale(1.08)}",
499
512
  "#cm-send:active:not(:disabled){transform:scale(0.94)}",
500
513
  "#cm-send:disabled,#cm-mic:disabled{opacity:.4;cursor:not-allowed}",
501
- "#cm-mic{background:transparent;color:#667085;border:1.5px solid #d1d5db}",
502
- "#cm-mic:hover:not(:disabled){border-color:#9ca3af;background:rgba(0,0,0,.02)}",
514
+ "#cm-mic{background:#f3f4f6;color:#667085;border:none}",
515
+ "#cm-mic:hover:not(:disabled){background:#e5e7eb}",
503
516
  "#cm-mic.listening{background:#ef4444;color:#fff;border-color:#ef4444;animation:cm-mic-pulse 1.5s infinite}",
504
517
  "@keyframes cm-mic-pulse{0%,100%{box-shadow:0 0 0 0 rgba(239,68,68,.35)}50%{box-shadow:0 0 0 8px rgba(239,68,68,0)}}"
505
518
  ].join("\n");
506
519
  };
507
520
 
508
- WidgetCssBuilder.prototype.buildResizeHandle = function(corner) {
509
- var posX = corner === "left" ? "left:0" : "right:0";
510
- var cursorType = corner === "left" ? "ne-resize" : "nw-resize";
511
- return [
512
- "#cm-resize-handle{position:absolute;top:0;" + posX + ";width:28px;height:28px;cursor:" + cursorType + ";z-index:10;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .2s}",
513
- "#cm-panel:hover #cm-resize-handle{opacity:.5}",
514
- "#cm-resize-handle:hover{opacity:1 !important}",
515
- "#cm-resize-handle svg{width:14px;height:14px;pointer-events:none}"
516
- ].join("\n");
517
- };
518
-
519
521
  WidgetCssBuilder.prototype.buildMobileOverrides = function() {
520
522
  return [
521
523
  "@media (max-width:600px){",
522
- "#cm-panel{left:0 !important;right:0 !important;bottom:0 !important;top:0 !important;width:100% !important;max-width:none !important;height:100dvh !important;height:100vh !important;max-height:none !important;border-radius:0 !important}",
523
- "#cm-header{border-radius:0 !important;padding:16px 16px 16px 80px;min-height:56px}",
524
- "#cm-header-mascot{width:64px;height:64px;left:8px;top:-4px}",
525
- "#cm-title{font-size:17px}",
526
- "#cm-close{font-size:24px;padding:8px 12px}",
527
- "#cm-messages{padding:16px;gap:14px}",
528
- ".cm-msg{max-width:92%;padding:14px 16px;font-size:16px;border-radius:18px}",
529
- "#cm-form{padding:12px 16px;padding-bottom:calc(12px + env(safe-area-inset-bottom,0px));border-radius:0 !important;gap:10px}",
530
- "#cm-input{min-height:48px;font-size:16px;border-radius:16px;padding:12px 16px}",
531
- "#cm-send,#cm-mic{width:48px;height:48px}",
532
- "#cm-typing{padding:8px 16px;font-size:14px}",
533
- "#cm-disclaimer,#cm-transparency{font-size:13px;padding:10px 16px}",
534
- "#cm-resize-handle{display:none !important}",
535
- "#cm-welcome{font-size:16px;padding:32px 20px}",
524
+ "#cm-bubble{width:56px;height:56px;bottom:16px;right:16px !important;left:auto !important}",
525
+ "#cm-bubble img{width:72px;height:72px;top:-12px}",
526
+ "#cm-panel{left:8px !important;right:8px !important;bottom:8px !important;top:8px !important;width:auto !important;max-width:none !important;height:auto !important;max-height:none !important}",
527
+ "#cm-header{padding:10px 12px 10px 76px}",
528
+ "#cm-header-mascot{width:68px;height:68px;left:-4px;top:-6px}",
529
+ "#cm-title{font-size:16px}",
530
+ ".cm-header-btn-maximize{display:none !important}",
531
+ "#cm-messages{flex:1;padding:12px 16px;gap:12px;overflow-y:auto}",
532
+ ".cm-msg{max-width:92%;padding:12px 14px;font-size:15px;border-radius:16px}",
533
+ "#cm-form{padding:10px 12px;padding-bottom:calc(10px + env(safe-area-inset-bottom,0px));gap:8px}",
534
+ "#cm-input{min-height:44px;font-size:16px;border-radius:14px;padding:10px 14px}",
535
+ "#cm-send,#cm-mic{width:44px;height:44px}",
536
+ "#cm-typing{padding:6px 16px;font-size:13px}",
537
+ "#cm-disclaimer,#cm-transparency{font-size:12px;padding:8px 12px}",
538
+ "#cm-welcome{font-size:15px;padding:24px 16px}",
536
539
  "}"
537
540
  ].join("\n");
538
541
  };
@@ -558,7 +561,6 @@ function installWidgetUIManager(ui) {
558
561
  this.streamingAssistantElement = null;
559
562
  this.streamingAssistantBuffer = "";
560
563
  this.themeOverrideStyle = null;
561
- this._resizeDragState = null;
562
564
  }
563
565
 
564
566
  WidgetUIManager.prototype.mount = function() {
@@ -567,10 +569,6 @@ function installWidgetUIManager(ui) {
567
569
  var css = cssBuilder.build();
568
570
  var esc = ui.escapeHtml;
569
571
  var escAttr = ui.escapeHtmlAttribute;
570
- var resizeCorner = this.config.position === "bottom-left" ? "right" : "left";
571
- var resizeSvg = resizeCorner === "left"
572
- ? '<svg viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><line x1="2" y1="12" x2="12" y2="2"/><line x1="2" y1="7" x2="7" y2="2"/></svg>'
573
- : '<svg viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><line x1="12" y1="12" x2="2" y2="2"/><line x1="12" y1="7" x2="7" y2="2"/></svg>';
574
572
 
575
573
  var host = document.createElement("div");
576
574
  host.id = ui.CONTAINER_ID;
@@ -583,14 +581,13 @@ function installWidgetUIManager(ui) {
583
581
  '<img id="cm-bubble-mascot" src="' + escAttr(this.config.mascotUrl) + '" alt="Mascotte assistant" />',
584
582
  "</button>",
585
583
  '<div id="cm-panel" role="dialog" aria-modal="true" aria-label="Chat ' + escAttr(this.config.assistantName) + '">',
586
- '<div id="cm-resize-handle" aria-hidden="true">' + resizeSvg + '</div>',
587
- '<div id="cm-header"><img id="cm-header-mascot" src="' + escAttr(this.config.mascotUrl) + '" alt="" /><h3 id="cm-title">' + esc(this.config.assistantName) + '</h3><button id="cm-close" type="button" aria-label="Fermer l\'assistant">\u00d7</button></div>',
588
- this.config.disclaimer ? '<div id="cm-disclaimer"><span>' + esc(this.config.disclaimerText) + '</span><button class="cm-close-note" id="cm-disclaimer-close" type="button" aria-label="Fermer l\'avertissement">\u00d7</button></div>' : "",
584
+ '<div id="cm-header"><img id="cm-header-mascot" src="' + escAttr(this.config.mascotUrl) + '" alt="" /><h3 id="cm-title">' + esc(this.config.assistantName) + '</h3><div id="cm-header-actions"><button class="cm-header-btn cm-header-btn-maximize" id="cm-maximize" type="button" aria-label="Agrandir"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h6v6"/><path d="M9 21H3v-6"/><path d="M21 3l-7 7"/><path d="M3 21l7-7"/></svg></button><button class="cm-header-btn" id="cm-close" type="button" aria-label="Fermer l\'assistant"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg></button></div></div>',
585
+ this.config.disclaimer ? '<div id="cm-disclaimer"><span>' + esc(this.config.disclaimerText) + '</span><button class="cm-close-note" id="cm-disclaimer-close" type="button" aria-label="Fermer l\'avertissement"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg></button></div>' : "",
589
586
  '<div id="cm-messages" aria-live="polite" aria-relevant="additions"><p id="cm-welcome">' + esc(this.config.welcomeMessage) + "</p></div>",
590
587
  '<div id="cm-typing">L\'assistant r\u00e9fl\u00e9chit\u2026</div>',
591
588
  '<div id="cm-error"></div>',
592
- '<div id="cm-transparency"><span>' + esc(this.config.transparencyText) + '</span><button class="cm-close-note" id="cm-transparency-close" type="button" aria-label="Fermer le message de transparence">\u00d7</button></div>',
593
- '<form id="cm-form"><button id="cm-mic" type="button" aria-label="Dicter un message">\ud83c\udfa4</button><textarea id="cm-input" rows="1" aria-label="Votre message" placeholder="Posez votre question\u2026"></textarea><button id="cm-send" type="submit" aria-label="Envoyer">\u27a4</button></form>',
589
+ '<div id="cm-transparency"><span>' + esc(this.config.transparencyText) + '</span><button class="cm-close-note" id="cm-transparency-close" type="button" aria-label="Fermer le message de transparence"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg></button></div>',
590
+ '<form id="cm-form"><button id="cm-mic" type="button" aria-label="Dicter un message"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" y1="19" x2="12" y2="23"/><line x1="8" y1="23" x2="16" y2="23"/></svg></button><textarea id="cm-input" rows="1" aria-label="Votre message" placeholder="Posez votre question\u2026"></textarea><button id="cm-send" type="submit" aria-label="Envoyer"><svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/></svg></button></form>',
594
591
  "</div>"
595
592
  ].join("");
596
593
  shadow.appendChild(root);
@@ -612,7 +609,6 @@ function installWidgetUIManager(ui) {
612
609
  root.appendChild(this.themeOverrideStyle);
613
610
  this.bindMascotImageErrorHandlers();
614
611
  this.bindAutoGrowInput();
615
- this.bindResizeHandle();
616
612
  this.applyThemeOverrides();
617
613
  this.applyMascotTheme();
618
614
  return true;
@@ -632,47 +628,6 @@ function installWidgetUIManager(ui) {
632
628
  inputEl.style.overflowY = "hidden";
633
629
  };
634
630
 
635
- WidgetUIManager.prototype.bindResizeHandle = function() {
636
- var handle = this.root ? this.root.querySelector("#cm-resize-handle") : null;
637
- var panel = this.panel;
638
- if (!handle || !panel) return;
639
- var self = this;
640
- var isLeftCorner = this.config.position !== "bottom-left";
641
-
642
- handle.addEventListener("mousedown", function(startEvt) {
643
- startEvt.preventDefault();
644
- startEvt.stopPropagation();
645
- var rect = panel.getBoundingClientRect();
646
- self._resizeDragState = {
647
- startX: startEvt.clientX,
648
- startY: startEvt.clientY,
649
- startW: rect.width,
650
- startH: rect.height
651
- };
652
- document.addEventListener("mousemove", onMouseMove);
653
- document.addEventListener("mouseup", onMouseUp);
654
- });
655
-
656
- function onMouseMove(evt) {
657
- var st = self._resizeDragState;
658
- if (!st) return;
659
- var dx = evt.clientX - st.startX;
660
- var dy = evt.clientY - st.startY;
661
- var newW = isLeftCorner ? st.startW - dx : st.startW + dx;
662
- var newH = st.startH - dy;
663
- newW = Math.max(360, Math.min(960, newW));
664
- newH = Math.max(480, Math.min(window.innerHeight - 40, newH));
665
- panel.style.width = newW + "px";
666
- panel.style.height = newH + "px";
667
- }
668
-
669
- function onMouseUp() {
670
- self._resizeDragState = null;
671
- document.removeEventListener("mousemove", onMouseMove);
672
- document.removeEventListener("mouseup", onMouseUp);
673
- }
674
- };
675
-
676
631
  WidgetUIManager.prototype.bindMascotImageErrorHandlers = function() {
677
632
  var self = this;
678
633
  [this.bubbleMascot, this.headerMascot].forEach(function(mascotNode) {
@@ -709,6 +664,9 @@ function installWidgetUIManager(ui) {
709
664
  var rootRef = this.root;
710
665
  if (disclaimerClose) disclaimerClose.addEventListener("click", function() { var p = rootRef.querySelector("#cm-disclaimer"); if (p) p.style.display = "none"; });
711
666
  if (transparencyClose) transparencyClose.addEventListener("click", function() { var p = rootRef.querySelector("#cm-transparency"); if (p) p.style.display = "none"; });
667
+ var maximizeBtn = this.root.querySelector("#cm-maximize");
668
+ var panelRef = this.panel;
669
+ if (maximizeBtn && panelRef) maximizeBtn.addEventListener("click", function() { panelRef.classList.toggle("maximized"); });
712
670
  };
713
671
 
714
672
  WidgetUIManager.prototype.setMascotSource = function(sourceUrl) {
@@ -811,18 +769,24 @@ function installWidgetUIManager(ui) {
811
769
  WidgetUIManager.prototype.setOpen = function(opened) {
812
770
  this.panel.classList.toggle("open", opened);
813
771
  this.bubble.style.display = opened ? "none" : "flex";
814
- if (opened) this.input.focus();
772
+ if (opened && !("ontouchstart" in window)) this.input.focus();
815
773
  };
816
774
 
817
775
  WidgetUIManager.prototype.pullInput = function() {
818
776
  var value = this.input.value.trim();
819
777
  this.input.value = "";
820
- this.input.style.height = "auto";
778
+ this.input.dispatchEvent(new Event("input", { bubbles: true }));
821
779
  return value;
822
780
  };
823
781
 
824
- WidgetUIManager.prototype.setInput = function(value) { this.input.value = String(value || ""); };
782
+ WidgetUIManager.prototype.setInput = function(value) {
783
+ this.input.value = String(value || "");
784
+ this.input.dispatchEvent(new Event("input", { bubbles: true }));
785
+ };
825
786
  WidgetUIManager.prototype.inputValue = function() { return this.input.value; };
787
+ WidgetUIManager.prototype.setInputPlaceholder = function(text) {
788
+ this.input.placeholder = text || "Posez votre question\u2026";
789
+ };
826
790
  WidgetUIManager.prototype.showTyping = function(visible) { this.typing.classList.toggle("visible", Boolean(visible)); };
827
791
 
828
792
  WidgetUIManager.prototype.setComposerDisabled = function(disabled) {
@@ -834,6 +798,24 @@ function installWidgetUIManager(ui) {
834
798
  WidgetUIManager.prototype.showError = function(message) {
835
799
  this.error.textContent = message;
836
800
  this.error.classList.toggle("visible", Boolean(message));
801
+ this._retryHandler = null;
802
+ };
803
+
804
+ WidgetUIManager.prototype.showRetryableError = function(message, onRetry) {
805
+ this.error.innerHTML = "";
806
+ var textNode = document.createTextNode(message + " ");
807
+ this.error.appendChild(textNode);
808
+ var retryButton = document.createElement("button");
809
+ retryButton.textContent = "Réessayer";
810
+ retryButton.style.cssText = "background:none;border:1px solid #58151c;border-radius:6px;color:#58151c;cursor:pointer;padding:4px 12px;font-size:13px;margin-left:8px;";
811
+ var self = this;
812
+ retryButton.addEventListener("click", function() {
813
+ self.showError("");
814
+ if (typeof onRetry === "function") onRetry();
815
+ });
816
+ this.error.appendChild(retryButton);
817
+ this.error.classList.add("visible");
818
+ this._retryHandler = onRetry;
837
819
  };
838
820
 
839
821
  WidgetUIManager.prototype.setAssistantDraftText = function(node, text) {
@@ -884,11 +866,36 @@ function installWidgetUIManager(ui) {
884
866
 
885
867
  WidgetUIManager.prototype.setMicListening = function(isListening) {
886
868
  this.micButton.classList.toggle("listening", isListening);
887
- this.micButton.textContent = isListening ? "\u23f9" : "\ud83c\udfa4";
888
- this.micButton.setAttribute("aria-label", isListening ? "Arrêter la dictée vocale" : "Dicter un message");
869
+ this.micButton.innerHTML = isListening
870
+ ? '<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><rect x="6" y="6" width="12" height="12" rx="2"/></svg>'
871
+ : '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" y1="19" x2="12" y2="23"/><line x1="8" y1="23" x2="16" y2="23"/></svg>';
872
+ this.micButton.setAttribute("aria-label", isListening ? "Arr\u00eater la dict\u00e9e vocale" : "Dicter un message");
889
873
  this.input.placeholder = isListening ? "Transcription en cours\u2026" : "Posez votre question\u2026";
890
874
  };
891
875
 
876
+ WidgetUIManager.prototype.getHeader = function() {
877
+ return this.root ? this.root.querySelector("#cm-header") : null;
878
+ };
879
+
880
+ WidgetUIManager.prototype.getPanel = function() {
881
+ return this.panel;
882
+ };
883
+
884
+ WidgetUIManager.prototype.getRoot = function() {
885
+ return this.root;
886
+ };
887
+
888
+ WidgetUIManager.prototype.injectSignalementButton = function(messageNode, onOpen) {
889
+ if (!messageNode) return null;
890
+ var btn = document.createElement("button");
891
+ btn.className = "cm-sig-open-btn";
892
+ btn.type = "button";
893
+ btn.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 9v4"/><path d="M12 17h.01"/><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/></svg>Mon signalement';
894
+ btn.addEventListener("click", function() { if (typeof onOpen === "function") onOpen(); });
895
+ messageNode.appendChild(btn);
896
+ return btn;
897
+ };
898
+
892
899
  ui.WidgetUIManager = WidgetUIManager;
893
900
  }
894
901
 
@@ -1,5 +1,6 @@
1
1
  {
2
- "ui.v1.js": "ui.v1.41a99419.js",
3
- "audio.v1.js": "audio.v1.95146620.js",
4
- "engine.v1.js": "engine.v1.3b09dc20.js"
2
+ "ui.v1.js": "ui.v1.e007c7c4.js",
3
+ "audio.v1.js": "audio.v1.20858b08.js",
4
+ "signalement.v1.js": "signalement.v1.d321dfde.js",
5
+ "engine.v1.js": "engine.v1.c127656e.js"
5
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ourlu/assistant-sdk",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "SDK JavaScript pour l'assistant conversationnel Ourlu — widget intégrable pour les mairies.",
5
5
  "type": "module",
6
6
  "private": false,
@@ -10,6 +10,7 @@
10
10
  "./loader.v1.js": "./dist/iife/loader.v1.js",
11
11
  "./ui.v1.js": "./dist/iife/ui.v1.js",
12
12
  "./audio.v1.js": "./dist/iife/audio.v1.js",
13
+ "./signalement.v1.js": "./dist/iife/signalement.v1.js",
13
14
  "./engine.v1.js": "./dist/iife/engine.v1.js"
14
15
  },
15
16
  "files": [