@ourlu/assistant-sdk 0.2.2 → 0.2.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/esm/index.js +1 -1
- package/dist/iife/audio.v1.95146620.js +179 -0
- package/dist/iife/audio.v1.js +1 -1
- package/dist/iife/engine.v1.2b5bb43b.js +735 -0
- package/dist/iife/engine.v1.3b09dc20.js +721 -0
- package/dist/iife/engine.v1.773fc15d.js +645 -0
- package/dist/iife/engine.v1.80d2230f.js +770 -0
- package/dist/iife/engine.v1.9ca6b7ec.js +756 -0
- package/dist/iife/engine.v1.c0c00bd0.js +721 -0
- package/dist/iife/engine.v1.c54c9a1a.js +770 -0
- package/dist/iife/engine.v1.d1052e81.js +770 -0
- package/dist/iife/engine.v1.js +770 -645
- package/dist/iife/loader.v1.js +22 -21
- package/dist/iife/ui.v1.41a99419.js +919 -0
- package/dist/iife/ui.v1.5d2d4504.js +942 -0
- package/dist/iife/ui.v1.6afac75f.js +944 -0
- package/dist/iife/ui.v1.7417819d.js +919 -0
- package/dist/iife/ui.v1.7fb4db0b.js +935 -0
- package/dist/iife/ui.v1.923a4e6d.js +937 -0
- package/dist/iife/ui.v1.9bfe2815.js +942 -0
- package/dist/iife/ui.v1.c58e1d58.js +959 -0
- package/dist/iife/ui.v1.cdfe9a45.js +919 -0
- package/dist/iife/ui.v1.js +121 -81
- package/dist/iife/widget-manifest.json +5 -0
- package/package.json +1 -1
package/dist/iife/ui.v1.js
CHANGED
|
@@ -61,33 +61,37 @@ function installMascotTheme(ui) {
|
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
ui.buildMascotDerivedPalette = function buildMascotDerivedPalette(config) {
|
|
64
|
-
var
|
|
65
|
-
var
|
|
66
|
-
var gold500 = ui.normalizeHexColor(config.mascotGoldColor, "#
|
|
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, "#
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
87
|
+
beak400: ui.adjustHexBrightness(beak300, 14),
|
|
88
|
+
beak500: ui.adjustHexBrightness(beak300, 8),
|
|
88
89
|
beak700: ui.adjustHexBrightness(beak300, -24),
|
|
89
|
-
|
|
90
|
-
claw400: ui.adjustHexBrightness(
|
|
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, ["#
|
|
102
|
-
ui.assignMascotTokenGroup(replacementMap, ["#
|
|
103
|
-
ui.assignMascotTokenGroup(replacementMap, ["#
|
|
104
|
-
ui.assignMascotTokenGroup(replacementMap, ["#
|
|
105
|
-
ui.assignMascotTokenGroup(replacementMap, ["#
|
|
106
|
-
ui.assignMascotTokenGroup(replacementMap, ["#
|
|
107
|
-
ui.assignMascotTokenGroup(replacementMap, ["#
|
|
108
|
-
ui.assignMascotTokenGroup(replacementMap, ["#
|
|
109
|
-
ui.assignMascotTokenGroup(replacementMap, ["#
|
|
110
|
-
ui.assignMascotTokenGroup(replacementMap, ["#
|
|
111
|
-
ui.assignMascotTokenGroup(replacementMap, ["#
|
|
112
|
-
ui.assignMascotTokenGroup(replacementMap, ["#
|
|
113
|
-
ui.assignMascotTokenGroup(replacementMap, ["#
|
|
114
|
-
ui.assignMascotTokenGroup(replacementMap, ["#
|
|
115
|
-
ui.assignMascotTokenGroup(replacementMap, ["#
|
|
116
|
-
ui.assignMascotTokenGroup(replacementMap, ["#
|
|
117
|
-
ui.assignMascotTokenGroup(replacementMap, ["#
|
|
118
|
-
ui.assignMascotTokenGroup(replacementMap, ["#
|
|
119
|
-
ui.assignMascotTokenGroup(replacementMap, ["#
|
|
120
|
-
ui.assignMascotTokenGroup(replacementMap, ["#
|
|
121
|
-
ui.assignMascotTokenGroup(replacementMap, ["#e6e6e6"
|
|
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;
|
|
@@ -135,7 +138,7 @@ function installMascotTheme(ui) {
|
|
|
135
138
|
if (/^https?:\/\//i.test(normalized)) return normalized;
|
|
136
139
|
var base = String(apiBaseUrl || "").trim().replace(/\/$/, "");
|
|
137
140
|
if (!base) {
|
|
138
|
-
throw new Error("[
|
|
141
|
+
throw new Error("[OurluMairie] mascot URL relative sans apiBaseUrl: " + normalized);
|
|
139
142
|
}
|
|
140
143
|
return normalized.startsWith("/") ? base + normalized : base + "/" + normalized;
|
|
141
144
|
};
|
|
@@ -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, "#
|
|
155
|
-
ui.normalizeHexColor((config || {}).mascotSecondaryDarkColor, "#
|
|
156
|
-
ui.normalizeHexColor((config || {}).mascotGoldColor, "#
|
|
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, "#
|
|
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]);
|
|
@@ -407,43 +412,53 @@ function installWidgetCssBuilder(ui) {
|
|
|
407
412
|
};
|
|
408
413
|
|
|
409
414
|
WidgetCssBuilder.prototype.buildResetAndBase = function() {
|
|
410
|
-
return
|
|
415
|
+
return [
|
|
416
|
+
":host *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,system-ui,sans-serif;-webkit-font-smoothing:antialiased}",
|
|
417
|
+
":host button{outline:none;-webkit-tap-highlight-color:transparent}",
|
|
418
|
+
":host button:focus{outline:none}",
|
|
419
|
+
":host button:focus-visible{outline:2px solid rgba(0,102,255,.4);outline-offset:2px}"
|
|
420
|
+
].join("\n");
|
|
411
421
|
};
|
|
412
422
|
|
|
413
423
|
WidgetCssBuilder.prototype.buildBubble = function(side, gradient, primaryColor) {
|
|
414
424
|
return [
|
|
415
|
-
"#cm-bubble{position:fixed;" + side + ":
|
|
425
|
+
"#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
426
|
"#cm-bubble:hover{transform:scale(1.1)}",
|
|
417
427
|
"#cm-bubble:active{transform:scale(0.95)}",
|
|
418
428
|
"#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
|
|
429
|
+
"#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
430
|
].join("\n");
|
|
421
431
|
};
|
|
422
432
|
|
|
423
433
|
WidgetCssBuilder.prototype.buildPanel = function(side, width, height, maxHeightVh, background, borderRadius) {
|
|
424
434
|
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}"
|
|
435
|
+
"#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)}",
|
|
436
|
+
"#cm-panel.open{display:flex;bottom:24px}",
|
|
437
|
+
"#cm-panel.maximized{width:840px !important;height:calc(100vh - 48px) !important;max-width:calc(100vw - 48px) !important;max-height:none !important}"
|
|
427
438
|
].join("\n");
|
|
428
439
|
};
|
|
429
440
|
|
|
430
441
|
WidgetCssBuilder.prototype.buildHeader = function(gradient, borderRadius) {
|
|
431
442
|
return [
|
|
432
|
-
"#cm-header{display:flex;align-items:center;justify-content:space-between;padding:
|
|
433
|
-
"#cm-header-mascot{width:
|
|
443
|
+
"#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}",
|
|
444
|
+
"#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
445
|
"#cm-title{margin:0;font-size:16px;font-weight:600;letter-spacing:-0.01em}",
|
|
435
|
-
"#cm-
|
|
436
|
-
"
|
|
446
|
+
"#cm-header-actions{display:flex;align-items:center;gap:4px}",
|
|
447
|
+
".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}",
|
|
448
|
+
".cm-header-btn:hover{background:rgba(255,255,255,.18)}",
|
|
449
|
+
".cm-header-btn:active{transform:scale(0.92)}",
|
|
450
|
+
".cm-header-btn svg{width:22px;height:22px}"
|
|
437
451
|
].join("\n");
|
|
438
452
|
};
|
|
439
453
|
|
|
440
454
|
WidgetCssBuilder.prototype.buildNotes = function() {
|
|
441
455
|
return [
|
|
442
|
-
"#cm-disclaimer,#cm-transparency{font-size:13px;display:flex;align-items:center;gap:8px;padding:8px 14px}",
|
|
443
|
-
"#cm-disclaimer{background:#
|
|
444
|
-
"#cm-transparency{color:#555;border-top:1px solid #eee}",
|
|
445
|
-
".cm-close-note{background:none;border:none;cursor:pointer;border-radius:
|
|
446
|
-
".cm-close-note:hover{opacity:1;background:rgba(0,0,0,.
|
|
456
|
+
"#cm-disclaimer,#cm-transparency{font-size:13px;display:flex;align-items:center;gap:8px;padding:8px 14px;flex-shrink:0}",
|
|
457
|
+
"#cm-disclaimer{background:#e8f4fd;color:#1a5276;border-bottom:1px solid #b3d9f2}",
|
|
458
|
+
"#cm-transparency{color:#555;border-top:1px solid #eee;background:#fff}",
|
|
459
|
+
".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}",
|
|
460
|
+
".cm-close-note:hover{opacity:1;background:rgba(0,0,0,.08)}",
|
|
461
|
+
".cm-close-note svg{width:16px;height:16px}"
|
|
447
462
|
].join("\n");
|
|
448
463
|
};
|
|
449
464
|
|
|
@@ -493,13 +508,13 @@ function installWidgetCssBuilder(ui) {
|
|
|
493
508
|
"#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
509
|
"#cm-input:focus{border-color:" + primaryColor + ";box-shadow:0 0 0 3px rgba(0,102,255,.15)}",
|
|
495
510
|
"#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}",
|
|
511
|
+
"#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
512
|
"#cm-send{background:" + primaryColor + ";color:#fff}",
|
|
498
513
|
"#cm-send:hover:not(:disabled){transform:scale(1.08)}",
|
|
499
514
|
"#cm-send:active:not(:disabled){transform:scale(0.94)}",
|
|
500
515
|
"#cm-send:disabled,#cm-mic:disabled{opacity:.4;cursor:not-allowed}",
|
|
501
|
-
"#cm-mic{background
|
|
502
|
-
"#cm-mic:hover:not(:disabled){
|
|
516
|
+
"#cm-mic{background:#f3f4f6;color:#667085;border:none}",
|
|
517
|
+
"#cm-mic:hover:not(:disabled){background:#e5e7eb}",
|
|
503
518
|
"#cm-mic.listening{background:#ef4444;color:#fff;border-color:#ef4444;animation:cm-mic-pulse 1.5s infinite}",
|
|
504
519
|
"@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
520
|
].join("\n");
|
|
@@ -519,20 +534,22 @@ function installWidgetCssBuilder(ui) {
|
|
|
519
534
|
WidgetCssBuilder.prototype.buildMobileOverrides = function() {
|
|
520
535
|
return [
|
|
521
536
|
"@media (max-width:600px){",
|
|
537
|
+
"#cm-bubble{width:56px;height:56px;bottom:16px;right:16px !important;left:auto !important}",
|
|
538
|
+
"#cm-bubble img{width:72px;height:72px;top:-12px}",
|
|
522
539
|
"#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:
|
|
524
|
-
"#cm-header-mascot{width:
|
|
525
|
-
"#cm-title{font-size:
|
|
526
|
-
"
|
|
527
|
-
"#cm-messages{padding:16px;gap:
|
|
528
|
-
".cm-msg{max-width:92%;padding:14px
|
|
529
|
-
"#cm-form{padding:12px
|
|
530
|
-
"#cm-input{min-height:
|
|
531
|
-
"#cm-send,#cm-mic{width:
|
|
532
|
-
"#cm-typing{padding:
|
|
533
|
-
"#cm-disclaimer,#cm-transparency{font-size:
|
|
540
|
+
"#cm-header{border-radius:0 !important;padding:14px 16px 14px 72px;min-height:52px}",
|
|
541
|
+
"#cm-header-mascot{width:68px;height:68px;left:-4px;top:-6px}",
|
|
542
|
+
"#cm-title{font-size:16px}",
|
|
543
|
+
".cm-header-btn-maximize{display:none !important}",
|
|
544
|
+
"#cm-messages{flex:1;padding:12px 16px;gap:12px;overflow-y:auto}",
|
|
545
|
+
".cm-msg{max-width:92%;padding:12px 14px;font-size:15px;border-radius:16px}",
|
|
546
|
+
"#cm-form{padding:10px 12px;padding-bottom:calc(10px + env(safe-area-inset-bottom,0px));border-radius:0 !important;gap:8px}",
|
|
547
|
+
"#cm-input{min-height:44px;font-size:16px;border-radius:14px;padding:10px 14px}",
|
|
548
|
+
"#cm-send,#cm-mic{width:44px;height:44px}",
|
|
549
|
+
"#cm-typing{padding:6px 16px;font-size:13px}",
|
|
550
|
+
"#cm-disclaimer,#cm-transparency{font-size:12px;padding:8px 12px}",
|
|
534
551
|
"#cm-resize-handle{display:none !important}",
|
|
535
|
-
"#cm-welcome{font-size:
|
|
552
|
+
"#cm-welcome{font-size:15px;padding:24px 16px}",
|
|
536
553
|
"}"
|
|
537
554
|
].join("\n");
|
|
538
555
|
};
|
|
@@ -584,13 +601,13 @@ function installWidgetUIManager(ui) {
|
|
|
584
601
|
"</button>",
|
|
585
602
|
'<div id="cm-panel" role="dialog" aria-modal="true" aria-label="Chat ' + escAttr(this.config.assistantName) + '">',
|
|
586
603
|
'<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"
|
|
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"
|
|
604
|
+
'<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-trash" type="button" aria-label="R\u00e9initialiser"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></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>',
|
|
605
|
+
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
606
|
'<div id="cm-messages" aria-live="polite" aria-relevant="additions"><p id="cm-welcome">' + esc(this.config.welcomeMessage) + "</p></div>",
|
|
590
607
|
'<div id="cm-typing">L\'assistant r\u00e9fl\u00e9chit\u2026</div>',
|
|
591
608
|
'<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"
|
|
593
|
-
'<form id="cm-form"><textarea id="cm-input" rows="1" aria-label="Votre message" placeholder="Posez votre question\u2026"></textarea><button id="cm-
|
|
609
|
+
'<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>',
|
|
610
|
+
'<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
611
|
"</div>"
|
|
595
612
|
].join("");
|
|
596
613
|
shadow.appendChild(root);
|
|
@@ -680,7 +697,7 @@ function installWidgetUIManager(ui) {
|
|
|
680
697
|
mascotNode.addEventListener("error", function() {
|
|
681
698
|
var failedUrl = mascotNode.getAttribute("src") || "";
|
|
682
699
|
var errorMessage = failedUrl ? "chargement échoué pour " + failedUrl : "chargement échoué";
|
|
683
|
-
console.error("[
|
|
700
|
+
console.error("[OurluMairie] mascot image error:", errorMessage);
|
|
684
701
|
self.showMascotLoadError(errorMessage);
|
|
685
702
|
});
|
|
686
703
|
});
|
|
@@ -709,6 +726,11 @@ function installWidgetUIManager(ui) {
|
|
|
709
726
|
var rootRef = this.root;
|
|
710
727
|
if (disclaimerClose) disclaimerClose.addEventListener("click", function() { var p = rootRef.querySelector("#cm-disclaimer"); if (p) p.style.display = "none"; });
|
|
711
728
|
if (transparencyClose) transparencyClose.addEventListener("click", function() { var p = rootRef.querySelector("#cm-transparency"); if (p) p.style.display = "none"; });
|
|
729
|
+
var maximizeBtn = this.root.querySelector("#cm-maximize");
|
|
730
|
+
var panelRef = this.panel;
|
|
731
|
+
if (maximizeBtn && panelRef) maximizeBtn.addEventListener("click", function() { panelRef.classList.toggle("maximized"); });
|
|
732
|
+
var trashBtn = this.root.querySelector("#cm-trash");
|
|
733
|
+
if (trashBtn && callbacks.onReset) trashBtn.addEventListener("click", callbacks.onReset);
|
|
712
734
|
};
|
|
713
735
|
|
|
714
736
|
WidgetUIManager.prototype.setMascotSource = function(sourceUrl) {
|
|
@@ -730,7 +752,7 @@ function installWidgetUIManager(ui) {
|
|
|
730
752
|
self.setMascotSource(themedMascotUrl);
|
|
731
753
|
}).catch(function(error) {
|
|
732
754
|
var message = (error && error.message) ? error.message : "Mascotte indisponible.";
|
|
733
|
-
console.error("[
|
|
755
|
+
console.error("[OurluMairie]", message, error);
|
|
734
756
|
self.showMascotLoadError(message);
|
|
735
757
|
});
|
|
736
758
|
};
|
|
@@ -834,6 +856,24 @@ function installWidgetUIManager(ui) {
|
|
|
834
856
|
WidgetUIManager.prototype.showError = function(message) {
|
|
835
857
|
this.error.textContent = message;
|
|
836
858
|
this.error.classList.toggle("visible", Boolean(message));
|
|
859
|
+
this._retryHandler = null;
|
|
860
|
+
};
|
|
861
|
+
|
|
862
|
+
WidgetUIManager.prototype.showRetryableError = function(message, onRetry) {
|
|
863
|
+
this.error.innerHTML = "";
|
|
864
|
+
var textNode = document.createTextNode(message + " ");
|
|
865
|
+
this.error.appendChild(textNode);
|
|
866
|
+
var retryButton = document.createElement("button");
|
|
867
|
+
retryButton.textContent = "Réessayer";
|
|
868
|
+
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;";
|
|
869
|
+
var self = this;
|
|
870
|
+
retryButton.addEventListener("click", function() {
|
|
871
|
+
self.showError("");
|
|
872
|
+
if (typeof onRetry === "function") onRetry();
|
|
873
|
+
});
|
|
874
|
+
this.error.appendChild(retryButton);
|
|
875
|
+
this.error.classList.add("visible");
|
|
876
|
+
this._retryHandler = onRetry;
|
|
837
877
|
};
|
|
838
878
|
|
|
839
879
|
WidgetUIManager.prototype.setAssistantDraftText = function(node, text) {
|
|
@@ -893,10 +933,10 @@ function installWidgetUIManager(ui) {
|
|
|
893
933
|
}
|
|
894
934
|
|
|
895
935
|
"use strict";
|
|
896
|
-
var runtime = window.
|
|
936
|
+
var runtime = window.__OurluWidgetRuntimeV1 || (window.__OurluWidgetRuntimeV1 = {});
|
|
897
937
|
var ui = {};
|
|
898
938
|
|
|
899
|
-
ui.CONTAINER_ID = "
|
|
939
|
+
ui.CONTAINER_ID = "ourlu-widget-root";
|
|
900
940
|
|
|
901
941
|
installColorUtils(ui);
|
|
902
942
|
installMascotTheme(ui);
|