@nyaruka/temba-components 0.118.8 → 0.119.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.
@@ -1,5 +1,5 @@
1
1
  import { property } from 'lit/decorators.js';
2
- import { TemplateResult, html, css, PropertyValueMap } from 'lit';
2
+ import { TemplateResult, html, css } from 'lit';
3
3
  import { Button } from '../button/Button';
4
4
  import { CustomEventType } from '../interfaces';
5
5
  import { styleMap } from 'lit-html/directives/style-map.js';
@@ -258,10 +258,9 @@ export class Dialog extends ResizeElement {
258
258
  super();
259
259
  }
260
260
 
261
- protected firstUpdated(
262
- changes: PropertyValueMap<any> | Map<PropertyKey, unknown>
263
- ): void {
264
- if (changes.has('cancelButtonName') && this.cancelButtonName) {
261
+ private updateButtons() {
262
+ this.buttons = [];
263
+ if (this.cancelButtonName) {
265
264
  this.buttons.push({
266
265
  name: this.cancelButtonName,
267
266
  type: ButtonType.SECONDARY,
@@ -269,16 +268,23 @@ export class Dialog extends ResizeElement {
269
268
  });
270
269
  }
271
270
 
272
- if (changes.has('primaryButtonName') && this.primaryButtonName) {
271
+ if (this.primaryButtonName) {
273
272
  this.buttons.push({
274
273
  name: this.primaryButtonName,
275
274
  type: ButtonType.PRIMARY
276
275
  });
277
276
  }
277
+ this.requestUpdate();
278
278
  }
279
279
 
280
- public updated(changedProperties: Map<string, any>) {
281
- if (changedProperties.has('open')) {
280
+ public updated(changes: Map<string, any>) {
281
+ super.updated(changes);
282
+
283
+ if (changes.has('cancelButtonName') || changes.has('primaryButtonName')) {
284
+ this.updateButtons();
285
+ }
286
+
287
+ if (changes.has('open')) {
282
288
  const body = document.querySelector('body');
283
289
 
284
290
  if (this.open) {
@@ -304,7 +310,7 @@ export class Dialog extends ResizeElement {
304
310
  }
305
311
 
306
312
  // make sure our buttons aren't in progress on show
307
- if (this.open && !changedProperties.get('open')) {
313
+ if (this.open && !changes.get('open')) {
308
314
  this.shadowRoot
309
315
  .querySelectorAll('temba-button')
310
316
  .forEach((button: Button) => {
@@ -421,6 +421,7 @@ export class Store extends RapidElement {
421
421
  url: string,
422
422
  options?: {
423
423
  force?: boolean;
424
+ skipCache?: boolean;
424
425
  controller?: AbortController;
425
426
  headers?: { [key: string]: string };
426
427
  }
@@ -436,7 +437,9 @@ export class Store extends RapidElement {
436
437
  (response: WebResponse) => {
437
438
  return new Promise<WebResponse>((resolve, reject) => {
438
439
  if (response.status >= 200 && response.status <= 300) {
439
- this.cache.set(url, response);
440
+ if (!options.skipCache) {
441
+ this.cache.set(url, response);
442
+ }
440
443
  resolve(response);
441
444
  } else {
442
445
  reject('Status: ' + response.status);
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-duplicate-enum-values */
2
2
  // for cache busting we dynamically generate a fingerprint, use yarn svg to update
3
- export const SVG_FINGERPRINT = '46e3fb369b8069df3118c8f746df02f0';
3
+ export const SVG_FINGERPRINT = 'c15822ec97a689add7c149188f6d16c6';
4
4
 
5
5
  // only icons below are included in the sprite sheet
6
6
  export enum Icon {
@@ -256,6 +256,7 @@ export enum Icon {
256
256
 
257
257
  // ai
258
258
  openai = 'openai',
259
+ anthropic = 'anthropic',
259
260
 
260
261
  // demo
261
262
  default = 'list',