@absolutejs/voice 0.0.22-beta.188 → 0.0.22-beta.189

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.
@@ -12,4 +12,3 @@ export { VoiceTraceTimelineService } from './voice-trace-timeline.service';
12
12
  export { VoiceTurnLatencyService } from './voice-turn-latency.service';
13
13
  export { VoiceTurnQualityService } from './voice-turn-quality.service';
14
14
  export { VoiceWorkflowStatusService } from './voice-workflow-status.service';
15
- export { VoiceDeliveryRuntimeComponent } from './voice-delivery-runtime.component';
@@ -3196,294 +3196,6 @@ VoiceWorkflowStatusService = __decorateElement(_init, 0, "VoiceWorkflowStatusSer
3196
3196
  __runInitializers(_init, 1, VoiceWorkflowStatusService);
3197
3197
  __decoratorMetadata(_init, VoiceWorkflowStatusService);
3198
3198
  let _VoiceWorkflowStatusService = VoiceWorkflowStatusService;
3199
- // src/angular/voice-delivery-runtime.component.ts
3200
- import { Component, Input, signal as signal15 } from "@angular/core";
3201
-
3202
- // src/client/deliveryRuntimeWidget.ts
3203
- var DEFAULT_TITLE = "Voice Delivery Runtime";
3204
- var DEFAULT_DESCRIPTION = "Audit and trace delivery worker health from your AbsoluteJS voice app.";
3205
- var escapeHtml = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
3206
- var createSurface = (id, summary) => {
3207
- if (!summary) {
3208
- return {
3209
- deadLettered: 0,
3210
- detail: "Worker disabled",
3211
- failed: 0,
3212
- id,
3213
- label: id === "audit" ? "Audit delivery" : "Trace delivery",
3214
- pending: 0,
3215
- status: "disabled",
3216
- total: 0
3217
- };
3218
- }
3219
- const blocked = summary.failed + summary.deadLettered;
3220
- return {
3221
- deadLettered: summary.deadLettered,
3222
- detail: `${summary.delivered}/${summary.total} delivered, ${summary.pending} pending`,
3223
- failed: summary.failed,
3224
- id,
3225
- label: id === "audit" ? "Audit delivery" : "Trace delivery",
3226
- pending: summary.pending,
3227
- status: blocked > 0 ? "warn" : "pass",
3228
- total: summary.total
3229
- };
3230
- };
3231
- var createVoiceDeliveryRuntimeViewModel = (snapshot, options = {}) => {
3232
- const report = snapshot.report;
3233
- const surfaces = [
3234
- createSurface("audit", report?.summary.audit),
3235
- createSurface("trace", report?.summary.trace)
3236
- ];
3237
- const hasWarnings = surfaces.some((surface) => surface.status === "warn");
3238
- return {
3239
- description: options.description ?? DEFAULT_DESCRIPTION,
3240
- error: snapshot.error,
3241
- actionError: snapshot.actionError,
3242
- actionStatus: snapshot.actionStatus,
3243
- isLoading: snapshot.isLoading,
3244
- isRunning: Boolean(report?.isRunning),
3245
- label: snapshot.error ? "Unavailable" : report ? report.isRunning ? "Running" : "Stopped" : "Checking",
3246
- status: snapshot.error ? "error" : report ? hasWarnings ? "warn" : "pass" : "loading",
3247
- surfaces,
3248
- title: options.title ?? DEFAULT_TITLE,
3249
- updatedAt: snapshot.updatedAt
3250
- };
3251
- };
3252
- var renderVoiceDeliveryRuntimeHTML = (snapshot, options = {}) => {
3253
- const model = createVoiceDeliveryRuntimeViewModel(snapshot, options);
3254
- const surfaces = model.surfaces.map((surface) => `<li class="absolute-voice-delivery-runtime__surface absolute-voice-delivery-runtime__surface--${escapeHtml(surface.status)}">
3255
- <span>${escapeHtml(surface.label)}</span>
3256
- <strong>${escapeHtml(surface.detail)}</strong>
3257
- <small>${String(surface.failed)} failed &middot; ${String(surface.deadLettered)} dead-lettered</small>
3258
- </li>`).join("");
3259
- const actions = options.includeActions === false ? "" : `<div class="absolute-voice-delivery-runtime__actions">
3260
- <button type="button" data-absolute-voice-delivery-runtime-action="tick">${model.actionStatus === "running" ? "Working..." : "Tick workers"}</button>
3261
- <button type="button" data-absolute-voice-delivery-runtime-action="requeue-dead-letters"${model.surfaces.some((surface) => surface.deadLettered > 0) ? "" : " disabled"}>Requeue dead letters</button>
3262
- </div>`;
3263
- const actionError = model.actionError ? `<p class="absolute-voice-delivery-runtime__error">${escapeHtml(model.actionError)}</p>` : "";
3264
- return `<section class="absolute-voice-delivery-runtime absolute-voice-delivery-runtime--${escapeHtml(model.status)}">
3265
- <header class="absolute-voice-delivery-runtime__header">
3266
- <span class="absolute-voice-delivery-runtime__eyebrow">${escapeHtml(model.title)}</span>
3267
- <strong class="absolute-voice-delivery-runtime__label">${escapeHtml(model.label)}</strong>
3268
- </header>
3269
- <p class="absolute-voice-delivery-runtime__description">${escapeHtml(model.description)}</p>
3270
- <ul class="absolute-voice-delivery-runtime__surfaces">${surfaces}</ul>
3271
- ${actions}
3272
- ${actionError}
3273
- ${model.error ? `<p class="absolute-voice-delivery-runtime__error">${escapeHtml(model.error)}</p>` : ""}
3274
- </section>`;
3275
- };
3276
- var getVoiceDeliveryRuntimeCSS = () => `.absolute-voice-delivery-runtime{border:1px solid #c9d8cf;border-radius:20px;background:#f6fff9;color:#0d1b12;padding:18px;box-shadow:0 18px 40px rgba(19,55,35,.12);font-family:inherit}.absolute-voice-delivery-runtime--warn,.absolute-voice-delivery-runtime--error{border-color:#f2b56b;background:#fff9ed}.absolute-voice-delivery-runtime__header{align-items:start;display:flex;gap:12px;justify-content:space-between}.absolute-voice-delivery-runtime__eyebrow{color:#4e6b59;font-size:12px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.absolute-voice-delivery-runtime__label{font-size:28px;line-height:1}.absolute-voice-delivery-runtime__description{color:#33483b;margin:12px 0 0}.absolute-voice-delivery-runtime__surfaces{display:grid;gap:8px;list-style:none;margin:16px 0 0;padding:0}.absolute-voice-delivery-runtime__surface{background:#fff;border:1px solid #d9eadf;border-radius:14px;display:grid;gap:4px;padding:10px 12px}.absolute-voice-delivery-runtime__surface--warn{border-color:#f2b56b}.absolute-voice-delivery-runtime__surface--disabled{opacity:.72}.absolute-voice-delivery-runtime__surface span,.absolute-voice-delivery-runtime__surface small{color:#587063}.absolute-voice-delivery-runtime__actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px}.absolute-voice-delivery-runtime__actions button{background:#134e2d;border:0;border-radius:999px;color:#f6fff9;cursor:pointer;font:inherit;font-weight:800;padding:8px 12px}.absolute-voice-delivery-runtime__actions button:disabled{cursor:not-allowed;opacity:.48}.absolute-voice-delivery-runtime__error{color:#9f1239;font-weight:700}`;
3277
- var mountVoiceDeliveryRuntime = (element, path = "/api/voice-delivery-runtime", options = {}) => {
3278
- const store = createVoiceDeliveryRuntimeStore(path, options);
3279
- const render = () => {
3280
- element.innerHTML = renderVoiceDeliveryRuntimeHTML(store.getSnapshot(), options);
3281
- };
3282
- const unsubscribe = store.subscribe(render);
3283
- const handleClick = (event) => {
3284
- const target = event.target;
3285
- if (!(target instanceof Element)) {
3286
- return;
3287
- }
3288
- const action = target.closest("[data-absolute-voice-delivery-runtime-action]");
3289
- const actionName = action?.getAttribute("data-absolute-voice-delivery-runtime-action");
3290
- if (actionName === "tick") {
3291
- store.tick().catch(() => {});
3292
- }
3293
- if (actionName === "requeue-dead-letters") {
3294
- store.requeueDeadLetters().catch(() => {});
3295
- }
3296
- };
3297
- element.addEventListener?.("click", handleClick);
3298
- render();
3299
- store.refresh().catch(() => {});
3300
- return {
3301
- close: () => {
3302
- element.removeEventListener?.("click", handleClick);
3303
- unsubscribe();
3304
- store.close();
3305
- },
3306
- refresh: store.refresh
3307
- };
3308
- };
3309
- var defineVoiceDeliveryRuntimeElement = (tagName = "absolute-voice-delivery-runtime") => {
3310
- if (typeof window === "undefined" || typeof customElements === "undefined" || customElements.get(tagName)) {
3311
- return;
3312
- }
3313
- customElements.define(tagName, class AbsoluteVoiceDeliveryRuntimeElement extends HTMLElement {
3314
- mounted;
3315
- connectedCallback() {
3316
- const intervalMs = Number(this.getAttribute("interval-ms") ?? 5000);
3317
- this.mounted = mountVoiceDeliveryRuntime(this, this.getAttribute("path") ?? "/api/voice-delivery-runtime", {
3318
- description: this.getAttribute("description") ?? undefined,
3319
- intervalMs: Number.isFinite(intervalMs) ? intervalMs : 5000,
3320
- title: this.getAttribute("title") ?? undefined
3321
- });
3322
- }
3323
- disconnectedCallback() {
3324
- this.mounted?.close();
3325
- this.mounted = undefined;
3326
- }
3327
- });
3328
- };
3329
-
3330
- // src/angular/voice-delivery-runtime.component.ts
3331
- var _dec = [
3332
- Component({
3333
- selector: "absolute-voice-delivery-runtime",
3334
- standalone: true,
3335
- template: `
3336
- <section
3337
- class="absolute-voice-delivery-runtime"
3338
- [class.absolute-voice-delivery-runtime--pass]="model().status === 'pass'"
3339
- [class.absolute-voice-delivery-runtime--warn]="model().status === 'warn'"
3340
- [class.absolute-voice-delivery-runtime--loading]="
3341
- model().status === 'loading'
3342
- "
3343
- [class.absolute-voice-delivery-runtime--error]="
3344
- model().status === 'error'
3345
- "
3346
- >
3347
- <header class="absolute-voice-delivery-runtime__header">
3348
- <span class="absolute-voice-delivery-runtime__eyebrow">{{
3349
- model().title
3350
- }}</span>
3351
- <strong class="absolute-voice-delivery-runtime__label">{{
3352
- model().label
3353
- }}</strong>
3354
- </header>
3355
- <p class="absolute-voice-delivery-runtime__description">
3356
- {{ model().description }}
3357
- </p>
3358
- <ul class="absolute-voice-delivery-runtime__surfaces">
3359
- @for (surface of model().surfaces; track surface.id) {
3360
- <li
3361
- class="absolute-voice-delivery-runtime__surface"
3362
- [class.absolute-voice-delivery-runtime__surface--pass]="
3363
- surface.status === 'pass'
3364
- "
3365
- [class.absolute-voice-delivery-runtime__surface--warn]="
3366
- surface.status === 'warn'
3367
- "
3368
- [class.absolute-voice-delivery-runtime__surface--disabled]="
3369
- surface.status === 'disabled'
3370
- "
3371
- >
3372
- <span>{{ surface.label }}</span>
3373
- <strong>{{ surface.detail }}</strong>
3374
- <small
3375
- >{{ surface.failed }} failed /
3376
- {{ surface.deadLettered }} dead-lettered</small
3377
- >
3378
- </li>
3379
- }
3380
- </ul>
3381
- <div class="absolute-voice-delivery-runtime__actions">
3382
- <button
3383
- type="button"
3384
- [disabled]="model().actionStatus === 'running'"
3385
- (click)="tick()"
3386
- >
3387
- {{ model().actionStatus === "running" ? "Working..." : "Tick workers" }}
3388
- </button>
3389
- <button
3390
- type="button"
3391
- [disabled]="
3392
- model().actionStatus === 'running' || deadLettered() === 0
3393
- "
3394
- (click)="requeueDeadLetters()"
3395
- >
3396
- Requeue dead letters
3397
- </button>
3398
- </div>
3399
- @if (model().actionError) {
3400
- <p class="absolute-voice-delivery-runtime__error">
3401
- {{ model().actionError }}
3402
- </p>
3403
- }
3404
- @if (model().error) {
3405
- <p class="absolute-voice-delivery-runtime__error">
3406
- {{ model().error }}
3407
- </p>
3408
- }
3409
- </section>
3410
- `
3411
- })
3412
- ];
3413
- var _dec2 = [
3414
- Input()
3415
- ];
3416
- var _dec3 = [
3417
- Input()
3418
- ];
3419
- var _dec4 = [
3420
- Input()
3421
- ];
3422
- var _dec5 = [
3423
- Input()
3424
- ];
3425
- var _init = __decoratorStart(undefined);
3426
-
3427
- class VoiceDeliveryRuntimeComponent {
3428
- constructor() {
3429
- this.description = __runInitializers(_init, 8, this);
3430
- __runInitializers(_init, 11, this);
3431
- this.intervalMs = __runInitializers(_init, 12, this);
3432
- __runInitializers(_init, 15, this);
3433
- this.path = __runInitializers(_init, 16, this, "/api/voice-delivery-runtime");
3434
- __runInitializers(_init, 19, this);
3435
- this.title = __runInitializers(_init, 20, this);
3436
- __runInitializers(_init, 23, this);
3437
- }
3438
- cleanup = () => {};
3439
- store;
3440
- model = signal15(createVoiceDeliveryRuntimeViewModel({
3441
- actionError: null,
3442
- actionStatus: "idle",
3443
- error: null,
3444
- isLoading: true
3445
- }));
3446
- ngOnInit() {
3447
- const options = this.options();
3448
- this.store = createVoiceDeliveryRuntimeStore(this.path, options);
3449
- const sync = () => {
3450
- this.model.set(createVoiceDeliveryRuntimeViewModel(this.store.getSnapshot(), options));
3451
- };
3452
- this.cleanup = this.store.subscribe(sync);
3453
- sync();
3454
- if (typeof window !== "undefined") {
3455
- this.store.refresh().catch(() => {});
3456
- }
3457
- }
3458
- ngOnDestroy() {
3459
- this.cleanup();
3460
- this.store?.close();
3461
- }
3462
- deadLettered() {
3463
- return this.model().surfaces.reduce((total, surface) => total + surface.deadLettered, 0);
3464
- }
3465
- tick() {
3466
- this.store?.tick().catch(() => {});
3467
- }
3468
- requeueDeadLetters() {
3469
- this.store?.requeueDeadLetters().catch(() => {});
3470
- }
3471
- options() {
3472
- return {
3473
- description: this.description,
3474
- intervalMs: this.intervalMs,
3475
- title: this.title
3476
- };
3477
- }
3478
- }
3479
- __decorateElement(_init, 5, "description", _dec2, VoiceDeliveryRuntimeComponent);
3480
- __decorateElement(_init, 5, "intervalMs", _dec3, VoiceDeliveryRuntimeComponent);
3481
- __decorateElement(_init, 5, "path", _dec4, VoiceDeliveryRuntimeComponent);
3482
- __decorateElement(_init, 5, "title", _dec5, VoiceDeliveryRuntimeComponent);
3483
- VoiceDeliveryRuntimeComponent = __decorateElement(_init, 0, "VoiceDeliveryRuntimeComponent", _dec, VoiceDeliveryRuntimeComponent);
3484
- __runInitializers(_init, 1, VoiceDeliveryRuntimeComponent);
3485
- __decoratorMetadata(_init, VoiceDeliveryRuntimeComponent);
3486
- let _VoiceDeliveryRuntimeComponent = VoiceDeliveryRuntimeComponent;
3487
3199
  export {
3488
3200
  VoiceWorkflowStatusService,
3489
3201
  VoiceTurnQualityService,
@@ -3497,7 +3209,6 @@ export {
3497
3209
  VoiceOpsStatusService,
3498
3210
  VoiceOpsActionCenterService,
3499
3211
  VoiceDeliveryRuntimeService,
3500
- VoiceDeliveryRuntimeComponent,
3501
3212
  VoiceControllerService,
3502
3213
  VoiceCampaignDialerProofService
3503
3214
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.188",
3
+ "version": "0.0.22-beta.189",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",