@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.
- package/README.md +220 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/index-BDscJkkF.js +1464 -0
- package/dist/cjs/index.cjs.js +10 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/cjs/staylift-orb.cjs.entry.js +117 -0
- package/dist/cjs/staylift-widget.cjs.entry.js +26479 -0
- package/dist/cjs/staylift-widget.cjs.js +25 -0
- package/dist/collection/collection-manifest.json +13 -0
- package/dist/collection/components/staylift-orb/staylift-orb.css +15 -0
- package/dist/collection/components/staylift-orb/staylift-orb.js +229 -0
- package/dist/collection/components/staylift-widget/staylift-widget.css +578 -0
- package/dist/collection/components/staylift-widget/staylift-widget.js +898 -0
- package/dist/collection/index.js +3 -0
- package/dist/collection/types.js +1 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/components/p-DnOZjbwA.js +1 -0
- package/dist/components/staylift-orb.d.ts +11 -0
- package/dist/components/staylift-orb.js +1 -0
- package/dist/components/staylift-widget.d.ts +11 -0
- package/dist/components/staylift-widget.js +1 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/index-DAtfDq5B.js +1456 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/staylift-orb.entry.js +115 -0
- package/dist/esm/staylift-widget.entry.js +26477 -0
- package/dist/esm/staylift-widget.js +21 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/staylift-widget/index.esm.js +1 -0
- package/dist/staylift-widget/p-37510f2e.entry.js +1 -0
- package/dist/staylift-widget/p-94923740.entry.js +1 -0
- package/dist/staylift-widget/p-DAtfDq5B.js +2 -0
- package/dist/staylift-widget/p-DQuL1Twl.js +1 -0
- package/dist/staylift-widget/staylift-widget.esm.js +1 -0
- package/dist/types/components/staylift-orb/staylift-orb.d.ts +19 -0
- package/dist/types/components/staylift-widget/staylift-widget.d.ts +80 -0
- package/dist/types/components.d.ts +212 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/stencil-public-runtime.d.ts +1839 -0
- package/dist/types/types.d.ts +1 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +58 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-BDscJkkF.js');
|
|
4
|
+
var appGlobals = require('./app-globals-V2Kpy_OQ.js');
|
|
5
|
+
|
|
6
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
7
|
+
/*
|
|
8
|
+
Stencil Client Patch Browser v4.41.2 | MIT Licensed | https://stenciljs.com
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
var patchBrowser = () => {
|
|
12
|
+
const importMeta = (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('staylift-widget.cjs.js', document.baseURI).href));
|
|
13
|
+
const opts = {};
|
|
14
|
+
if (importMeta !== "") {
|
|
15
|
+
opts.resourcesUrl = new URL(".", importMeta).href;
|
|
16
|
+
}
|
|
17
|
+
return index.promiseResolve(opts);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
patchBrowser().then(async (options) => {
|
|
21
|
+
await appGlobals.globalScripts();
|
|
22
|
+
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);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
exports.setNonce = index.setNonce;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"entries": [
|
|
3
|
+
"components/staylift-widget/staylift-widget.js",
|
|
4
|
+
"components/staylift-orb/staylift-orb.js"
|
|
5
|
+
],
|
|
6
|
+
"compiler": {
|
|
7
|
+
"name": "@stencil/core",
|
|
8
|
+
"version": "4.41.2",
|
|
9
|
+
"typescriptVersion": "5.8.3"
|
|
10
|
+
},
|
|
11
|
+
"collections": [],
|
|
12
|
+
"bundles": []
|
|
13
|
+
}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
export class StayliftOrb {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.inputVolume = 0;
|
|
5
|
+
this.outputVolume = 0;
|
|
6
|
+
this.isActive = false;
|
|
7
|
+
this.primaryColor = '#6366f1';
|
|
8
|
+
this.size = 'medium';
|
|
9
|
+
this.animationFrame = 0;
|
|
10
|
+
this.rafId = null;
|
|
11
|
+
this.ctx = null;
|
|
12
|
+
}
|
|
13
|
+
componentDidLoad() {
|
|
14
|
+
this.setupCanvas();
|
|
15
|
+
this.startAnimation();
|
|
16
|
+
}
|
|
17
|
+
disconnectedCallback() {
|
|
18
|
+
if (this.rafId)
|
|
19
|
+
cancelAnimationFrame(this.rafId);
|
|
20
|
+
}
|
|
21
|
+
setupCanvas() {
|
|
22
|
+
if (!this.canvasRef)
|
|
23
|
+
return;
|
|
24
|
+
const dpr = window.devicePixelRatio || 1;
|
|
25
|
+
const rect = this.canvasRef.getBoundingClientRect();
|
|
26
|
+
this.canvasRef.width = rect.width * dpr;
|
|
27
|
+
this.canvasRef.height = rect.height * dpr;
|
|
28
|
+
this.ctx = this.canvasRef.getContext('2d');
|
|
29
|
+
if (this.ctx)
|
|
30
|
+
this.ctx.scale(dpr, dpr);
|
|
31
|
+
}
|
|
32
|
+
startAnimation() {
|
|
33
|
+
const animate = () => {
|
|
34
|
+
this.drawOrb();
|
|
35
|
+
this.rafId = requestAnimationFrame(animate);
|
|
36
|
+
};
|
|
37
|
+
animate();
|
|
38
|
+
}
|
|
39
|
+
drawOrb() {
|
|
40
|
+
if (!this.ctx || !this.canvasRef)
|
|
41
|
+
return;
|
|
42
|
+
const width = this.canvasRef.clientWidth;
|
|
43
|
+
const height = this.canvasRef.clientHeight;
|
|
44
|
+
const centerX = width / 2;
|
|
45
|
+
const centerY = height / 2;
|
|
46
|
+
const baseRadius = Math.min(width, height) / 2 - 4;
|
|
47
|
+
this.ctx.clearRect(0, 0, width, height);
|
|
48
|
+
const combinedVolume = Math.max(this.inputVolume, this.outputVolume);
|
|
49
|
+
const pulse = this.isActive ? 1 + combinedVolume * 0.15 : 1;
|
|
50
|
+
const radius = baseRadius * pulse;
|
|
51
|
+
const color = this.hexToRgb(this.primaryColor || '#10b981');
|
|
52
|
+
if (this.isActive && combinedVolume > 0.1) {
|
|
53
|
+
const glowRadius = radius + 10 + combinedVolume * 20;
|
|
54
|
+
const gradient = this.ctx.createRadialGradient(centerX, centerY, radius, centerX, centerY, glowRadius);
|
|
55
|
+
gradient.addColorStop(0, `rgba(${color.r}, ${color.g}, ${color.b}, ${0.3 * combinedVolume})`);
|
|
56
|
+
gradient.addColorStop(1, `rgba(${color.r}, ${color.g}, ${color.b}, 0)`);
|
|
57
|
+
this.ctx.beginPath();
|
|
58
|
+
this.ctx.arc(centerX, centerY, glowRadius, 0, Math.PI * 2);
|
|
59
|
+
this.ctx.fillStyle = gradient;
|
|
60
|
+
this.ctx.fill();
|
|
61
|
+
}
|
|
62
|
+
const orbGradient = this.ctx.createRadialGradient(centerX - radius * 0.3, centerY - radius * 0.3, 0, centerX, centerY, radius);
|
|
63
|
+
if (this.isActive) {
|
|
64
|
+
orbGradient.addColorStop(0, `rgba(${color.r + 40}, ${color.g + 40}, ${color.b + 40}, 1)`);
|
|
65
|
+
orbGradient.addColorStop(0.5, `rgba(${color.r}, ${color.g}, ${color.b}, 1)`);
|
|
66
|
+
orbGradient.addColorStop(1, `rgba(${Math.max(0, color.r - 30)}, ${Math.max(0, color.g - 30)}, ${Math.max(0, color.b - 30)}, 1)`);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
orbGradient.addColorStop(0, '#6b7280');
|
|
70
|
+
orbGradient.addColorStop(0.5, '#4b5563');
|
|
71
|
+
orbGradient.addColorStop(1, '#374151');
|
|
72
|
+
}
|
|
73
|
+
this.ctx.beginPath();
|
|
74
|
+
this.ctx.arc(centerX, centerY, radius, 0, Math.PI * 2);
|
|
75
|
+
this.ctx.fillStyle = orbGradient;
|
|
76
|
+
this.ctx.fill();
|
|
77
|
+
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);
|
|
78
|
+
highlightGradient.addColorStop(0, 'rgba(255, 255, 255, 0.4)');
|
|
79
|
+
highlightGradient.addColorStop(1, 'rgba(255, 255, 255, 0)');
|
|
80
|
+
this.ctx.beginPath();
|
|
81
|
+
this.ctx.arc(centerX, centerY, radius, 0, Math.PI * 2);
|
|
82
|
+
this.ctx.fillStyle = highlightGradient;
|
|
83
|
+
this.ctx.fill();
|
|
84
|
+
if (this.isActive) {
|
|
85
|
+
this.animationFrame++;
|
|
86
|
+
for (let i = 0; i < 3; i++) {
|
|
87
|
+
const phase = (this.animationFrame * 0.02 + i / 3) % 1;
|
|
88
|
+
const ringRadius = radius + phase * 30;
|
|
89
|
+
const alpha = (1 - phase) * 0.3 * combinedVolume;
|
|
90
|
+
this.ctx.beginPath();
|
|
91
|
+
this.ctx.arc(centerX, centerY, ringRadius, 0, Math.PI * 2);
|
|
92
|
+
this.ctx.strokeStyle = `rgba(${color.r}, ${color.g}, ${color.b}, ${alpha})`;
|
|
93
|
+
this.ctx.lineWidth = 2;
|
|
94
|
+
this.ctx.stroke();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
hexToRgb(hex) {
|
|
99
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
100
|
+
return result ? { r: parseInt(result[1], 16), g: parseInt(result[2], 16), b: parseInt(result[3], 16) } : { r: 16, g: 185, b: 129 };
|
|
101
|
+
}
|
|
102
|
+
render() {
|
|
103
|
+
const sizeClass = typeof this.size === 'number' ? '' : `orb--${this.size}`;
|
|
104
|
+
const customStyle = typeof this.size === 'number' ? { width: `${this.size}px`, height: `${this.size}px` } : {};
|
|
105
|
+
return (h("div", { key: '4ef2605968e04b6dc287db398f5ad730e63c08d3', class: `orb ${sizeClass} ${this.isActive ? 'orb--active' : ''}`, style: customStyle }, h("canvas", { key: '7875d17618d38a4ac0e693bb73d4502d6a66151b', ref: (el) => (this.canvasRef = el), class: "orb__canvas" })));
|
|
106
|
+
}
|
|
107
|
+
static get is() { return "staylift-orb"; }
|
|
108
|
+
static get encapsulation() { return "shadow"; }
|
|
109
|
+
static get originalStyleUrls() {
|
|
110
|
+
return {
|
|
111
|
+
"$": ["staylift-orb.css"]
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
static get styleUrls() {
|
|
115
|
+
return {
|
|
116
|
+
"$": ["staylift-orb.css"]
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
static get properties() {
|
|
120
|
+
return {
|
|
121
|
+
"inputVolume": {
|
|
122
|
+
"type": "number",
|
|
123
|
+
"mutable": false,
|
|
124
|
+
"complexType": {
|
|
125
|
+
"original": "number",
|
|
126
|
+
"resolved": "number",
|
|
127
|
+
"references": {}
|
|
128
|
+
},
|
|
129
|
+
"required": false,
|
|
130
|
+
"optional": false,
|
|
131
|
+
"docs": {
|
|
132
|
+
"tags": [],
|
|
133
|
+
"text": ""
|
|
134
|
+
},
|
|
135
|
+
"getter": false,
|
|
136
|
+
"setter": false,
|
|
137
|
+
"reflect": false,
|
|
138
|
+
"attribute": "input-volume",
|
|
139
|
+
"defaultValue": "0"
|
|
140
|
+
},
|
|
141
|
+
"outputVolume": {
|
|
142
|
+
"type": "number",
|
|
143
|
+
"mutable": false,
|
|
144
|
+
"complexType": {
|
|
145
|
+
"original": "number",
|
|
146
|
+
"resolved": "number",
|
|
147
|
+
"references": {}
|
|
148
|
+
},
|
|
149
|
+
"required": false,
|
|
150
|
+
"optional": false,
|
|
151
|
+
"docs": {
|
|
152
|
+
"tags": [],
|
|
153
|
+
"text": ""
|
|
154
|
+
},
|
|
155
|
+
"getter": false,
|
|
156
|
+
"setter": false,
|
|
157
|
+
"reflect": false,
|
|
158
|
+
"attribute": "output-volume",
|
|
159
|
+
"defaultValue": "0"
|
|
160
|
+
},
|
|
161
|
+
"isActive": {
|
|
162
|
+
"type": "boolean",
|
|
163
|
+
"mutable": false,
|
|
164
|
+
"complexType": {
|
|
165
|
+
"original": "boolean",
|
|
166
|
+
"resolved": "boolean",
|
|
167
|
+
"references": {}
|
|
168
|
+
},
|
|
169
|
+
"required": false,
|
|
170
|
+
"optional": false,
|
|
171
|
+
"docs": {
|
|
172
|
+
"tags": [],
|
|
173
|
+
"text": ""
|
|
174
|
+
},
|
|
175
|
+
"getter": false,
|
|
176
|
+
"setter": false,
|
|
177
|
+
"reflect": false,
|
|
178
|
+
"attribute": "is-active",
|
|
179
|
+
"defaultValue": "false"
|
|
180
|
+
},
|
|
181
|
+
"primaryColor": {
|
|
182
|
+
"type": "string",
|
|
183
|
+
"mutable": false,
|
|
184
|
+
"complexType": {
|
|
185
|
+
"original": "string",
|
|
186
|
+
"resolved": "string | undefined",
|
|
187
|
+
"references": {}
|
|
188
|
+
},
|
|
189
|
+
"required": false,
|
|
190
|
+
"optional": true,
|
|
191
|
+
"docs": {
|
|
192
|
+
"tags": [],
|
|
193
|
+
"text": ""
|
|
194
|
+
},
|
|
195
|
+
"getter": false,
|
|
196
|
+
"setter": false,
|
|
197
|
+
"reflect": false,
|
|
198
|
+
"attribute": "primary-color",
|
|
199
|
+
"defaultValue": "'#6366f1'"
|
|
200
|
+
},
|
|
201
|
+
"size": {
|
|
202
|
+
"type": "any",
|
|
203
|
+
"mutable": false,
|
|
204
|
+
"complexType": {
|
|
205
|
+
"original": "'small' | 'medium' | 'large' | number",
|
|
206
|
+
"resolved": "\"large\" | \"medium\" | \"small\" | number | undefined",
|
|
207
|
+
"references": {}
|
|
208
|
+
},
|
|
209
|
+
"required": false,
|
|
210
|
+
"optional": true,
|
|
211
|
+
"docs": {
|
|
212
|
+
"tags": [],
|
|
213
|
+
"text": ""
|
|
214
|
+
},
|
|
215
|
+
"getter": false,
|
|
216
|
+
"setter": false,
|
|
217
|
+
"reflect": false,
|
|
218
|
+
"attribute": "size",
|
|
219
|
+
"defaultValue": "'medium'"
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
static get states() {
|
|
224
|
+
return {
|
|
225
|
+
"animationFrame": {}
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
static get elementRef() { return "el"; }
|
|
229
|
+
}
|