@staylift-tech/conv-widget 0.0.1

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 (49) hide show
  1. package/README.md +220 -0
  2. package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
  3. package/dist/cjs/index-BDscJkkF.js +1464 -0
  4. package/dist/cjs/index.cjs.js +10 -0
  5. package/dist/cjs/loader.cjs.js +13 -0
  6. package/dist/cjs/staylift-orb.cjs.entry.js +117 -0
  7. package/dist/cjs/staylift-widget.cjs.entry.js +26479 -0
  8. package/dist/cjs/staylift-widget.cjs.js +25 -0
  9. package/dist/collection/collection-manifest.json +13 -0
  10. package/dist/collection/components/staylift-orb/staylift-orb.css +15 -0
  11. package/dist/collection/components/staylift-orb/staylift-orb.js +229 -0
  12. package/dist/collection/components/staylift-widget/staylift-widget.css +578 -0
  13. package/dist/collection/components/staylift-widget/staylift-widget.js +898 -0
  14. package/dist/collection/index.js +3 -0
  15. package/dist/collection/types.js +1 -0
  16. package/dist/components/index.d.ts +35 -0
  17. package/dist/components/index.js +1 -0
  18. package/dist/components/p-DnOZjbwA.js +1 -0
  19. package/dist/components/staylift-orb.d.ts +11 -0
  20. package/dist/components/staylift-orb.js +1 -0
  21. package/dist/components/staylift-widget.d.ts +11 -0
  22. package/dist/components/staylift-widget.js +1 -0
  23. package/dist/esm/app-globals-DQuL1Twl.js +3 -0
  24. package/dist/esm/index-DAtfDq5B.js +1456 -0
  25. package/dist/esm/index.js +3 -0
  26. package/dist/esm/loader.js +11 -0
  27. package/dist/esm/staylift-orb.entry.js +115 -0
  28. package/dist/esm/staylift-widget.entry.js +26477 -0
  29. package/dist/esm/staylift-widget.js +21 -0
  30. package/dist/index.cjs.js +1 -0
  31. package/dist/index.js +1 -0
  32. package/dist/staylift-widget/index.esm.js +1 -0
  33. package/dist/staylift-widget/p-37510f2e.entry.js +1 -0
  34. package/dist/staylift-widget/p-94923740.entry.js +1 -0
  35. package/dist/staylift-widget/p-DAtfDq5B.js +2 -0
  36. package/dist/staylift-widget/p-DQuL1Twl.js +1 -0
  37. package/dist/staylift-widget/staylift-widget.esm.js +1 -0
  38. package/dist/types/components/staylift-orb/staylift-orb.d.ts +19 -0
  39. package/dist/types/components/staylift-widget/staylift-widget.d.ts +80 -0
  40. package/dist/types/components.d.ts +212 -0
  41. package/dist/types/index.d.ts +3 -0
  42. package/dist/types/stencil-public-runtime.d.ts +1839 -0
  43. package/dist/types/types.d.ts +1 -0
  44. package/loader/cdn.js +1 -0
  45. package/loader/index.cjs.js +1 -0
  46. package/loader/index.d.ts +24 -0
  47. package/loader/index.es2017.js +1 -0
  48. package/loader/index.js +2 -0
  49. package/package.json +58 -0
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ var stayliftWidget_entry = require('./staylift-widget.entry.cjs.js');
4
+ var stayliftOrb_entry = require('./staylift-orb.entry.cjs.js');
5
+ require('./index-BDscJkkF.js');
6
+
7
+
8
+
9
+ exports.StayliftWidget = stayliftWidget_entry.staylift_widget;
10
+ exports.StayliftOrb = stayliftOrb_entry.staylift_orb;
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-BDscJkkF.js');
4
+ var appGlobals = require('./app-globals-V2Kpy_OQ.js');
5
+
6
+ const defineCustomElements = async (win, options) => {
7
+ if (typeof window === 'undefined') return undefined;
8
+ await appGlobals.globalScripts();
9
+ return index.bootstrapLazy([["staylift-orb.cjs",[[1,"staylift-orb",{"inputVolume":[2,"input-volume"],"outputVolume":[2,"output-volume"],"isActive":[4,"is-active"],"primaryColor":[1,"primary-color"],"size":[8],"animationFrame":[32]}]]],["staylift-widget.cjs",[[1,"staylift-widget",{"agentId":[1,"agent-id"],"positionX":[1,"position-x"],"positionY":[1,"position-y"],"variant":[1],"mode":[1],"primaryColor":[1,"primary-color"],"brandName":[1,"brand-name"],"language":[1],"autoExpand":[4,"auto-expand"],"showBranding":[4,"show-branding"],"avatarUrl":[1,"avatar-url"],"fabPrompt":[1,"fab-prompt"],"fabButtonText":[1,"fab-button-text"],"status":[32],"isExpanded":[32],"termsAccepted":[32],"errorMessage":[32],"inputVolume":[32],"outputVolume":[32],"messages":[32],"inputText":[32],"copiedIndex":[32],"startConversation":[64],"endConversation":[64],"getStatus":[64],"sendMessage":[64]}]]]], options);
10
+ };
11
+
12
+ exports.setNonce = index.setNonce;
13
+ exports.defineCustomElements = defineCustomElements;
@@ -0,0 +1,117 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-BDscJkkF.js');
4
+
5
+ const stayliftOrbCss = () => `:host{display:block}.orb-container{position:relative;border-radius:50%;overflow:hidden;background:linear-gradient(145deg, #f8f9fa, #e9ecef)}canvas{display:block;border-radius:50%}`;
6
+
7
+ const StayliftOrb = class {
8
+ constructor(hostRef) {
9
+ index.registerInstance(this, hostRef);
10
+ this.inputVolume = 0;
11
+ this.outputVolume = 0;
12
+ this.isActive = false;
13
+ this.primaryColor = '#6366f1';
14
+ this.size = 'medium';
15
+ this.animationFrame = 0;
16
+ this.rafId = null;
17
+ this.ctx = null;
18
+ }
19
+ componentDidLoad() {
20
+ this.setupCanvas();
21
+ this.startAnimation();
22
+ }
23
+ disconnectedCallback() {
24
+ if (this.rafId)
25
+ cancelAnimationFrame(this.rafId);
26
+ }
27
+ setupCanvas() {
28
+ if (!this.canvasRef)
29
+ return;
30
+ const dpr = window.devicePixelRatio || 1;
31
+ const rect = this.canvasRef.getBoundingClientRect();
32
+ this.canvasRef.width = rect.width * dpr;
33
+ this.canvasRef.height = rect.height * dpr;
34
+ this.ctx = this.canvasRef.getContext('2d');
35
+ if (this.ctx)
36
+ this.ctx.scale(dpr, dpr);
37
+ }
38
+ startAnimation() {
39
+ const animate = () => {
40
+ this.drawOrb();
41
+ this.rafId = requestAnimationFrame(animate);
42
+ };
43
+ animate();
44
+ }
45
+ drawOrb() {
46
+ if (!this.ctx || !this.canvasRef)
47
+ return;
48
+ const width = this.canvasRef.clientWidth;
49
+ const height = this.canvasRef.clientHeight;
50
+ const centerX = width / 2;
51
+ const centerY = height / 2;
52
+ const baseRadius = Math.min(width, height) / 2 - 4;
53
+ this.ctx.clearRect(0, 0, width, height);
54
+ const combinedVolume = Math.max(this.inputVolume, this.outputVolume);
55
+ const pulse = this.isActive ? 1 + combinedVolume * 0.15 : 1;
56
+ const radius = baseRadius * pulse;
57
+ const color = this.hexToRgb(this.primaryColor || '#10b981');
58
+ if (this.isActive && combinedVolume > 0.1) {
59
+ const glowRadius = radius + 10 + combinedVolume * 20;
60
+ const gradient = this.ctx.createRadialGradient(centerX, centerY, radius, centerX, centerY, glowRadius);
61
+ gradient.addColorStop(0, `rgba(${color.r}, ${color.g}, ${color.b}, ${0.3 * combinedVolume})`);
62
+ gradient.addColorStop(1, `rgba(${color.r}, ${color.g}, ${color.b}, 0)`);
63
+ this.ctx.beginPath();
64
+ this.ctx.arc(centerX, centerY, glowRadius, 0, Math.PI * 2);
65
+ this.ctx.fillStyle = gradient;
66
+ this.ctx.fill();
67
+ }
68
+ const orbGradient = this.ctx.createRadialGradient(centerX - radius * 0.3, centerY - radius * 0.3, 0, centerX, centerY, radius);
69
+ if (this.isActive) {
70
+ orbGradient.addColorStop(0, `rgba(${color.r + 40}, ${color.g + 40}, ${color.b + 40}, 1)`);
71
+ orbGradient.addColorStop(0.5, `rgba(${color.r}, ${color.g}, ${color.b}, 1)`);
72
+ orbGradient.addColorStop(1, `rgba(${Math.max(0, color.r - 30)}, ${Math.max(0, color.g - 30)}, ${Math.max(0, color.b - 30)}, 1)`);
73
+ }
74
+ else {
75
+ orbGradient.addColorStop(0, '#6b7280');
76
+ orbGradient.addColorStop(0.5, '#4b5563');
77
+ orbGradient.addColorStop(1, '#374151');
78
+ }
79
+ this.ctx.beginPath();
80
+ this.ctx.arc(centerX, centerY, radius, 0, Math.PI * 2);
81
+ this.ctx.fillStyle = orbGradient;
82
+ this.ctx.fill();
83
+ const highlightGradient = this.ctx.createRadialGradient(centerX - radius * 0.3, centerY - radius * 0.3, 0, centerX - radius * 0.3, centerY - radius * 0.3, radius * 0.6);
84
+ highlightGradient.addColorStop(0, 'rgba(255, 255, 255, 0.4)');
85
+ highlightGradient.addColorStop(1, 'rgba(255, 255, 255, 0)');
86
+ this.ctx.beginPath();
87
+ this.ctx.arc(centerX, centerY, radius, 0, Math.PI * 2);
88
+ this.ctx.fillStyle = highlightGradient;
89
+ this.ctx.fill();
90
+ if (this.isActive) {
91
+ this.animationFrame++;
92
+ for (let i = 0; i < 3; i++) {
93
+ const phase = (this.animationFrame * 0.02 + i / 3) % 1;
94
+ const ringRadius = radius + phase * 30;
95
+ const alpha = (1 - phase) * 0.3 * combinedVolume;
96
+ this.ctx.beginPath();
97
+ this.ctx.arc(centerX, centerY, ringRadius, 0, Math.PI * 2);
98
+ this.ctx.strokeStyle = `rgba(${color.r}, ${color.g}, ${color.b}, ${alpha})`;
99
+ this.ctx.lineWidth = 2;
100
+ this.ctx.stroke();
101
+ }
102
+ }
103
+ }
104
+ hexToRgb(hex) {
105
+ const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
106
+ return result ? { r: parseInt(result[1], 16), g: parseInt(result[2], 16), b: parseInt(result[3], 16) } : { r: 16, g: 185, b: 129 };
107
+ }
108
+ render() {
109
+ const sizeClass = typeof this.size === 'number' ? '' : `orb--${this.size}`;
110
+ const customStyle = typeof this.size === 'number' ? { width: `${this.size}px`, height: `${this.size}px` } : {};
111
+ return (index.h("div", { key: '4ef2605968e04b6dc287db398f5ad730e63c08d3', class: `orb ${sizeClass} ${this.isActive ? 'orb--active' : ''}`, style: customStyle }, index.h("canvas", { key: '7875d17618d38a4ac0e693bb73d4502d6a66151b', ref: (el) => (this.canvasRef = el), class: "orb__canvas" })));
112
+ }
113
+ get el() { return index.getElement(this); }
114
+ };
115
+ StayliftOrb.style = stayliftOrbCss();
116
+
117
+ exports.staylift_orb = StayliftOrb;