@nyaruka/temba-components 0.156.2 → 0.156.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nyaruka/temba-components",
3
- "version": "0.156.2",
3
+ "version": "0.156.4",
4
4
  "description": "Web components to support rapidpro and related projects",
5
5
  "author": "Nyaruka <code@nyaruka.coim>",
6
6
  "main": "dist/index.js",
@@ -583,34 +583,36 @@ export class Chat extends RapidElement {
583
583
  text-align: center;
584
584
  font-size: 11px;
585
585
  color: #8e8e93;
586
+ max-width: 100%;
587
+ overflow: hidden;
586
588
  }
587
589
 
588
590
  .event .webhook-event {
589
591
  display: inline-flex;
590
- align-items: center;
592
+ align-items: flex-start;
591
593
  gap: 6px;
594
+ max-width: 100%;
595
+ min-width: 0;
592
596
  }
593
597
 
594
- .event .webhook-event-log-link {
595
- all: unset;
596
- display: inline-flex;
597
- align-items: center;
598
- justify-content: center;
599
- color: #9ca3af;
600
- cursor: pointer;
601
- line-height: 1;
602
- border-radius: 4px;
603
- transition: color var(--animation-time, 200ms) ease;
598
+ .event .webhook-event-text {
599
+ overflow: hidden;
600
+ display: -webkit-box;
601
+ -webkit-line-clamp: 2;
602
+ -webkit-box-orient: vertical;
603
+ word-break: break-all;
604
+ min-width: 0;
605
+ padding: 4px 0;
604
606
  }
605
607
 
606
- .event .webhook-event-log-link:hover,
607
- .event .webhook-event-log-link:focus-visible {
608
- color: var(--color-primary-dark, #007aff);
608
+ .event .webhook-event-url {
609
+ color: inherit;
610
+ text-decoration: underline;
611
+ cursor: pointer;
609
612
  }
610
613
 
611
- .event .webhook-event-log-link:focus-visible {
612
- outline: 1px solid currentColor;
613
- outline-offset: 2px;
614
+ .event .webhook-event-url:hover {
615
+ text-decoration: none;
614
616
  }
615
617
 
616
618
  .event p {
@@ -389,7 +389,12 @@ export const renderResthookCalled = (event: any): TemplateResult | null => {
389
389
  };
390
390
 
391
391
  export const renderWebhookCalled = (event: any): TemplateResult | null => {
392
- return html`<div>Called <strong>${event.url}</strong></div>`;
392
+ const maxLen = 50;
393
+ const displayUrl =
394
+ event.url && event.url.length > maxLen
395
+ ? event.url.slice(0, maxLen) + '...'
396
+ : event.url;
397
+ return html`<div>Called <strong>${displayUrl}</strong></div>`;
393
398
  };
394
399
 
395
400
  export const renderServiceCalled = (event: any): TemplateResult | null => {
@@ -107,6 +107,26 @@ export class CanvasNode extends RapidElement {
107
107
  user-select: none;
108
108
  }
109
109
 
110
+ .shift-held > temba-flow-node,
111
+ .shift-held > temba-flow-node * {
112
+ cursor: copy !important;
113
+ }
114
+
115
+ .shift-held > temba-flow-node .exit,
116
+ .shift-held > temba-flow-node .exit *,
117
+ .shift-held > temba-flow-node .linked-name,
118
+ .shift-held > temba-flow-node .linked-name *,
119
+ .shift-held > temba-flow-node .remove-button,
120
+ .shift-held > temba-flow-node .remove-button * {
121
+ cursor: pointer !important;
122
+ }
123
+
124
+ temba-flow-node.drag-copy .node {
125
+ outline: 3px dashed var(--color-primary, #3b82f6);
126
+ outline-offset: 2px;
127
+ opacity: 0.7;
128
+ }
129
+
110
130
  /* Flow start indicator */
111
131
  temba-flow-node.flow-start .node::before {
112
132
  content: 'FLOW START';
@@ -361,6 +381,9 @@ export class CanvasNode extends RapidElement {
361
381
 
362
382
  .router .body {
363
383
  padding: 0.75em;
384
+ }
385
+
386
+ .router .body > div {
364
387
  max-width: 180px;
365
388
  }
366
389
 
@@ -368,7 +391,32 @@ export class CanvasNode extends RapidElement {
368
391
  font-weight: 500;
369
392
  display: inline-block;
370
393
  }
371
-
394
+
395
+ .router {
396
+ display: flex;
397
+ flex-direction: column;
398
+ }
399
+
400
+ .rules-count {
401
+ position: absolute;
402
+ right: 4px;
403
+ top: 50%;
404
+ transform: translateY(-50%);
405
+ background: #fff8dc;
406
+ border-radius: 10px;
407
+ min-width: 18px;
408
+ height: 18px;
409
+ padding: 0 5px;
410
+ font-size: 11px;
411
+ font-weight: 600;
412
+ color: #333;
413
+ display: flex;
414
+ align-items: center;
415
+ justify-content: center;
416
+ line-height: 1;
417
+ box-sizing: border-box;
418
+ }
419
+
372
420
  .exit-wrapper {
373
421
  display: flex;
374
422
  justify-content: center;
@@ -1611,9 +1659,10 @@ export class CanvasNode extends RapidElement {
1611
1659
  ? ACTION_GROUP_METADATA[config.group]?.color ||
1612
1660
  SPLIT_GROUP_METADATA[config.group]?.color
1613
1661
  : '#aaaaaa';
1662
+ const untranslatedRules = this.getUntranslatedRulesCount();
1614
1663
  return html`<div
1615
1664
  class="cn-title ${isRemoving ? 'removing' : ''}"
1616
- style="background:${color}"
1665
+ style="background:${color}; position: relative;"
1617
1666
  >
1618
1667
  <div class="title-spacer"></div>
1619
1668
  <div class="name">
@@ -1630,6 +1679,9 @@ export class CanvasNode extends RapidElement {
1630
1679
  >
1631
1680
 
1632
1681
  </div>
1682
+ ${untranslatedRules > 0
1683
+ ? html`<div class="rules-count">${untranslatedRules}</div>`
1684
+ : null}
1633
1685
  </div>`;
1634
1686
  }
1635
1687
 
@@ -1752,6 +1804,21 @@ export class CanvasNode extends RapidElement {
1752
1804
  return result;
1753
1805
  }
1754
1806
 
1807
+ private getUntranslatedRulesCount(): number {
1808
+ if (!this.isTranslating || !this.ui?.config?.localizeRules) return 0;
1809
+ const cases = this.node?.router?.cases;
1810
+ if (!cases?.length) return 0;
1811
+
1812
+ const langLocalization =
1813
+ this.flowDefinition?.localization?.[this.languageCode] || {};
1814
+
1815
+ return cases.filter((c) => {
1816
+ if (!c.arguments?.length || !c.arguments.some((a) => a)) return false;
1817
+ const localized = langLocalization[c.uuid]?.arguments;
1818
+ return !Array.isArray(localized) || !localized.some((a: string) => a);
1819
+ }).length;
1820
+ }
1821
+
1755
1822
  private renderRouter(router: Router, ui: NodeUI) {
1756
1823
  const nodeConfig = NODE_CONFIG[ui.type];
1757
1824
  if (nodeConfig) {