@nyaruka/temba-components 0.105.1 → 0.106.0

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/CHANGELOG.md CHANGED
@@ -4,15 +4,26 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [v0.106.0](https://github.com/nyaruka/temba-components/compare/v0.105.1...v0.106.0)
8
+
9
+ - Handle empty contact searches more elegantly [`#451`](https://github.com/nyaruka/temba-components/pull/451)
10
+
7
11
  #### [v0.105.1](https://github.com/nyaruka/temba-components/compare/v0.105.0...v0.105.1)
8
12
 
13
+ > 6 September 2024
14
+
9
15
  - Remove debug [`2c3cd7f`](https://github.com/nyaruka/temba-components/commit/2c3cd7f61a7ee3418dbf52d1e4cfa1b57bc30a37)
10
16
 
11
- #### [v0.105.0](https://github.com/nyaruka/temba-components/compare/v0.104.0...v0.105.0)
17
+ #### [v0.105.0](https://github.com/nyaruka/temba-components/compare/v0.104.1...v0.105.0)
12
18
 
13
19
  > 6 September 2024
14
20
 
15
21
  - Add OutboxMonitor [`#450`](https://github.com/nyaruka/temba-components/pull/450)
22
+
23
+ #### [v0.104.1](https://github.com/nyaruka/temba-components/compare/v0.104.0...v0.104.1)
24
+
25
+ > 15 August 2024
26
+
16
27
  - Add user_token icon [`c4510b0`](https://github.com/nyaruka/temba-components/commit/c4510b03d9a00cc3f009788f0262e3535d4d25a9)
17
28
 
18
29
  #### [v0.104.0](https://github.com/nyaruka/temba-components/compare/v0.103.0...v0.104.0)
@@ -4,8 +4,8 @@
4
4
  /* eslint-disable @typescript-eslint/no-explicit-any */
5
5
  export const templates = {
6
6
  scf1453991c986b25: `Tab para completar, enter para seleccionar`,
7
- s638236250662c6b3: `Have sent a message in the last`,
8
7
  s8f02e3a18ffc083a: `Are not currently in a flow`,
8
+ s638236250662c6b3: `Have sent a message in the last`,
9
9
  s4788ee206c4570c7: `Have not started this flow in the last 90 days`
10
10
  };
11
11
  //# sourceMappingURL=es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"es.js","sourceRoot":"","sources":["../../../src/locales/es.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,gDAAgD;AAEhD,4CAA4C;AAC5C,uDAAuD;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,iBAAiB,EAAE,4CAA4C;IAC/D,iBAAiB,EAAE,iCAAiC;IACpD,iBAAiB,EAAE,6BAA6B;IAChD,iBAAiB,EAAE,gDAAgD;CACpE,CAAC","sourcesContent":["// Do not modify this file by hand!\n// Re-generate this file by running lit-localize\n\n/* eslint-disable no-irregular-whitespace */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nexport const templates = {\n scf1453991c986b25: `Tab para completar, enter para seleccionar`,\n s638236250662c6b3: `Have sent a message in the last`,\n s8f02e3a18ffc083a: `Are not currently in a flow`,\n s4788ee206c4570c7: `Have not started this flow in the last 90 days`\n};\n"]}
1
+ {"version":3,"file":"es.js","sourceRoot":"","sources":["../../../src/locales/es.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,gDAAgD;AAEhD,4CAA4C;AAC5C,uDAAuD;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,iBAAiB,EAAE,4CAA4C;IAC/D,iBAAiB,EAAE,6BAA6B;IAChD,iBAAiB,EAAE,iCAAiC;IACpD,iBAAiB,EAAE,gDAAgD;CACpE,CAAC","sourcesContent":["// Do not modify this file by hand!\n// Re-generate this file by running lit-localize\n\n/* eslint-disable no-irregular-whitespace */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nexport const templates = {\n scf1453991c986b25: `Tab para completar, enter para seleccionar`,\n s8f02e3a18ffc083a: `Are not currently in a flow`,\n s638236250662c6b3: `Have sent a message in the last`,\n s4788ee206c4570c7: `Have not started this flow in the last 90 days`\n};\n"]}
@@ -4,8 +4,8 @@
4
4
  /* eslint-disable @typescript-eslint/no-explicit-any */
5
5
  export const templates = {
6
6
  scf1453991c986b25: `Tab to complete, enter to select`,
7
- s638236250662c6b3: `Have sent a message in the last`,
8
7
  s8f02e3a18ffc083a: `Are not currently in a flow`,
8
+ s638236250662c6b3: `Have sent a message in the last`,
9
9
  s4788ee206c4570c7: `Have not started this flow in the last 90 days`
10
10
  };
11
11
  //# sourceMappingURL=fr.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fr.js","sourceRoot":"","sources":["../../../src/locales/fr.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,gDAAgD;AAEhD,4CAA4C;AAC5C,uDAAuD;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,iBAAiB,EAAE,kCAAkC;IACrD,iBAAiB,EAAE,iCAAiC;IACpD,iBAAiB,EAAE,6BAA6B;IAChD,iBAAiB,EAAE,gDAAgD;CACpE,CAAC","sourcesContent":["// Do not modify this file by hand!\n// Re-generate this file by running lit-localize\n\n/* eslint-disable no-irregular-whitespace */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nexport const templates = {\n scf1453991c986b25: `Tab to complete, enter to select`,\n s638236250662c6b3: `Have sent a message in the last`,\n s8f02e3a18ffc083a: `Are not currently in a flow`,\n s4788ee206c4570c7: `Have not started this flow in the last 90 days`\n};\n"]}
1
+ {"version":3,"file":"fr.js","sourceRoot":"","sources":["../../../src/locales/fr.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,gDAAgD;AAEhD,4CAA4C;AAC5C,uDAAuD;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,iBAAiB,EAAE,kCAAkC;IACrD,iBAAiB,EAAE,6BAA6B;IAChD,iBAAiB,EAAE,iCAAiC;IACpD,iBAAiB,EAAE,gDAAgD;CACpE,CAAC","sourcesContent":["// Do not modify this file by hand!\n// Re-generate this file by running lit-localize\n\n/* eslint-disable no-irregular-whitespace */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nexport const templates = {\n scf1453991c986b25: `Tab to complete, enter to select`,\n s8f02e3a18ffc083a: `Are not currently in a flow`,\n s638236250662c6b3: `Have sent a message in the last`,\n s4788ee206c4570c7: `Have not started this flow in the last 90 days`\n};\n"]}
@@ -4,8 +4,8 @@
4
4
  /* eslint-disable @typescript-eslint/no-explicit-any */
5
5
  export const templates = {
6
6
  scf1453991c986b25: `Tab to complete, enter to select`,
7
- s638236250662c6b3: `Have sent a message in the last`,
8
7
  s8f02e3a18ffc083a: `Are not currently in a flow`,
8
+ s638236250662c6b3: `Have sent a message in the last`,
9
9
  s4788ee206c4570c7: `Have not started this flow in the last 90 days`
10
10
  };
11
11
  //# sourceMappingURL=pt.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pt.js","sourceRoot":"","sources":["../../../src/locales/pt.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,gDAAgD;AAEhD,4CAA4C;AAC5C,uDAAuD;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,iBAAiB,EAAE,kCAAkC;IACrD,iBAAiB,EAAE,iCAAiC;IACpD,iBAAiB,EAAE,6BAA6B;IAChD,iBAAiB,EAAE,gDAAgD;CACpE,CAAC","sourcesContent":["// Do not modify this file by hand!\n// Re-generate this file by running lit-localize\n\n/* eslint-disable no-irregular-whitespace */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nexport const templates = {\n scf1453991c986b25: `Tab to complete, enter to select`,\n s638236250662c6b3: `Have sent a message in the last`,\n s8f02e3a18ffc083a: `Are not currently in a flow`,\n s4788ee206c4570c7: `Have not started this flow in the last 90 days`\n};\n"]}
1
+ {"version":3,"file":"pt.js","sourceRoot":"","sources":["../../../src/locales/pt.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,gDAAgD;AAEhD,4CAA4C;AAC5C,uDAAuD;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,iBAAiB,EAAE,kCAAkC;IACrD,iBAAiB,EAAE,6BAA6B;IAChD,iBAAiB,EAAE,iCAAiC;IACpD,iBAAiB,EAAE,gDAAgD;CACpE,CAAC","sourcesContent":["// Do not modify this file by hand!\n// Re-generate this file by running lit-localize\n\n/* eslint-disable no-irregular-whitespace */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nexport const templates = {\n scf1453991c986b25: `Tab to complete, enter to select`,\n s8f02e3a18ffc083a: `Are not currently in a flow`,\n s638236250662c6b3: `Have sent a message in the last`,\n s4788ee206c4570c7: `Have not started this flow in the last 90 days`\n};\n"]}
@@ -2760,6 +2760,7 @@ let ir=Ps,or=!1;const nr=["es","fr","pt"],{setLocale:sr}=(t=>(function(t){if(or)
2760
2760
  --temba-select-selected-line-height: 1em;
2761
2761
  --temba-select-selected-font-size: 1em;
2762
2762
  --search-input-height: 0px !important;
2763
+ --temba-select-min-height: 1.8em;
2763
2764
  min-width: 100px;
2764
2765
  }
2765
2766
 
@@ -2768,7 +2769,7 @@ let ir=Ps,or=!1;const nr=["es","fr","pt"],{setLocale:sr}=(t=>(function(t){if(or)
2768
2769
  border: 1px solid var(--color-borders);
2769
2770
  border-radius: var(--curvature);
2770
2771
  }
2771
- `}refresh(){this.refreshKey="requested_"+(new Date).getTime()}updated(t){super.updated(t),t.has("recipients")&&this.handleRecipientsChanged(),t.has("in_a_flow")&&!this.in_a_flow&&(delete this.exclusions.in_a_flow,this.requestUpdate("exclusions")),(t.has("query")&&this.advanced||t.has("refreshKey")&&"0"!==this.refreshKey)&&(this.summary=null,this.fireCustomEvent(Me.ContentChanged,{reset:!0}),this.lastQuery&&(window.clearTimeout(this.lastQuery),this.fetching=!1),(this.query.trim().length>0||this.recipients.length>0)&&(this.fetching=!0,this.lastQuery=window.setTimeout((()=>{this.fetchSummary()}),2e3)))}fetchSummary(){if(this.endpoint){const t=this.recipients.filter((t=>"group"===t.type)).map((t=>t.id)),e=this.recipients.filter((t=>"contact"===t.type)).map((t=>t.id));Kt(this.endpoint,{include:this.advanced?{query:this.query}:{contact_uuids:e,group_uuids:t},exclude:this.exclusions}).then((t=>{this.fetching=!1,this.initialized=!0,200===t.status?(this.summary=t.json,this.advanced||(this.query=this.summary.query),this.setValue({advanced:this.advanced,query:this.query,exclusions:this.exclusions,recipients:this.recipients}),this.summary.error?this.errors=[this.summary.error]:this.errors=[],this.requestUpdate("errors"),this.fireCustomEvent(Me.ContentChanged,this.summary)):(this.summary=t.json,this.summary.error&&(this.errors=[this.summary.error]),this.requestUpdate("errors"),this.fireCustomEvent(Me.ContentChanged,this.summary))}))}}handleAdvancedToggle(t){re(t),this.recipients=[],this.exclusions={},this.advanced&&(this.query="",this.value=null),this.advanced=!this.advanced,this.setValue({advanced:this.advanced,query:this.query,exclusions:this.exclusions,recipients:this.recipients})}handleQueryChange(t){const e=t.target;this.query=e.inputElement.value}handleRecipientsChanged(){this.endpoint&&(this.recipients&&("0"!==this.refreshKey||this.initialized)?this.refresh():this.initialized=!0)}handleActivityLevelChanged(t){const e=t.target.values[0];e&&this.exclusions.not_seen_since_days&&(this.exclusions.not_seen_since_days=parseInt(e.value),this.refresh())}handleActivityLabelClicked(t){if(t.target&&"TEMBA-CHECKBOX"!==t.target.tagName&&"TEMBA-SELECT"!==t.target.tagName&&!t.target.disabled){const e=t.currentTarget.querySelector("temba-checkbox");e.checked=!e.checked}}handleExclusionChanged(t){if("TEMBA-CHECKBOX"===t.target.tagName){const e=JSON.stringify(this.exclusions),i=t.target;let o=i.checked;if("not_seen_since_days"===i.name&&o){const t=i.parentElement.querySelector("temba-select");o=t.values[0]?parseInt(t.values[0].value):this.exclusions[i.name]}o?this.exclusions[i.name]=o:delete this.exclusions[i.name],e!==JSON.stringify(this.exclusions)&&this.refresh()}}render(){let t;if(this.summary&&!this.summary.error){const e=this.summary.total||0;t=Z`
2772
+ `}refresh(){this.advanced||this.recipients.length>0?this.refreshKey="requested_"+(new Date).getTime():(this.summary=null,this.fetching=!1,this.requestUpdate(),this.fireCustomEvent(Me.ContentChanged,{reset:!0}))}firstUpdated(t){super.firstUpdated(t)}updated(t){super.updated(t),t.has("recipients")&&this.handleRecipientsChanged(),t.has("in_a_flow")&&!this.in_a_flow&&(delete this.exclusions.in_a_flow,this.requestUpdate("exclusions")),(t.has("query")&&this.advanced||t.has("refreshKey")&&"0"!==this.refreshKey)&&(this.summary=null,this.fireCustomEvent(Me.ContentChanged,{reset:!0}),this.lastQuery&&(window.clearTimeout(this.lastQuery),this.fetching=!1),(this.query.trim().length>0||this.recipients.length>0)&&(this.fetching=!0,this.lastQuery=window.setTimeout((()=>{this.fetchSummary()}),2e3)))}fetchSummary(){if(this.endpoint){const t=this.recipients.filter((t=>"group"===t.type)).map((t=>t.id)),e=this.recipients.filter((t=>"contact"===t.type)).map((t=>t.id));Kt(this.endpoint,{include:this.advanced?{query:this.query}:{contact_uuids:e,group_uuids:t},exclude:this.exclusions}).then((t=>{this.fetching=!1,this.initialized=!0,(0!=this.recipients.length||this.advanced)&&(200===t.status?(this.summary=t.json,this.advanced||(this.query=this.summary.query),this.setValue({advanced:this.advanced,query:this.query,exclusions:this.exclusions,recipients:this.recipients}),this.summary.error?this.errors=[this.summary.error]:this.errors=[],this.requestUpdate("errors"),this.fireCustomEvent(Me.ContentChanged,this.summary)):(this.summary=t.json,this.summary.error&&(this.errors=[this.summary.error]),this.requestUpdate("errors"),this.fireCustomEvent(Me.ContentChanged,this.summary)))}))}}handleAdvancedToggle(t){re(t),this.recipients=[],this.exclusions={},this.advanced&&(this.query="",this.value=null),this.advanced=!this.advanced,this.setValue({advanced:this.advanced,query:this.query,exclusions:this.exclusions,recipients:this.recipients})}handleQueryChange(t){const e=t.target;this.query=e.inputElement.value}handleRecipientsChanged(){this.endpoint&&(this.recipients&&("0"!==this.refreshKey||this.initialized)?this.refresh():this.initialized=!0)}handleActivityLevelChanged(t){const e=t.target.values[0];e&&this.exclusions.not_seen_since_days&&(this.exclusions.not_seen_since_days=parseInt(e.value),this.refresh())}handleActivityLabelClicked(t){if(t.target&&"TEMBA-CHECKBOX"!==t.target.tagName&&"TEMBA-SELECT"!==t.target.tagName&&!t.target.disabled){const e=t.currentTarget.querySelector("temba-checkbox");e.checked=!e.checked}}handleExclusionChanged(t){if("TEMBA-CHECKBOX"===t.target.tagName){const e=JSON.stringify(this.exclusions),i=t.target;let o=i.checked;if("not_seen_since_days"===i.name&&o){const t=i.parentElement.querySelector("temba-select");o=t.values[0]?parseInt(t.values[0].value):this.exclusions[i.name]}o?this.exclusions[i.name]=o:delete this.exclusions[i.name],e!==JSON.stringify(this.exclusions)&&this.endpoint&&this.refresh()}}render(){let t;if(this.summary&&!this.summary.error){const e=this.summary.total||0;t=Z`
2772
2773
  <div class="result-count">
2773
2774
  Found
2774
2775
  <a
@@ -2801,7 +2802,7 @@ let ir=Ps,or=!1;const nr=["es","fr","pt"],{setLocale:sr}=(t=>(function(t){if(or)
2801
2802
  </div>
2802
2803
  </div>
2803
2804
  </temba-button>
2804
- `}const e=this.exclusions.not_seen_since_days;return this.summary&&this.summary.blockers&&this.summary.blockers.length>0?Z`${this.summary.blockers.map((t=>Z`<temba-alert level="error">${pr(t)}</temba-alert>`))}`:Z`
2805
+ `}const e=this.exclusions.not_seen_since_days;let i=null;return this.summary&&this.summary.blockers&&this.summary.blockers.length>0&&(i=Z`${this.summary.blockers.map((t=>Z`<temba-alert level="error">${pr(t)}</temba-alert>`))}`),Z`
2805
2806
  ${this.advanced?Z`<div class="query">
2806
2807
  <temba-textinput
2807
2808
  .label=${this.label}
@@ -2843,7 +2844,12 @@ let ir=Ps,or=!1;const nr=["es","fr","pt"],{setLocale:sr}=(t=>(function(t){if(or)
2843
2844
  Only include contacts who...
2844
2845
  </div>
2845
2846
  </div>
2846
-
2847
+ ${this.in_a_flow?Z`<temba-checkbox
2848
+ name="in_a_flow"
2849
+ label="${ir("Are not currently in a flow")}"
2850
+ ?checked=${this.exclusions.in_a_flow}
2851
+ @change=${this.handleExclusionChanged}
2852
+ ></temba-checkbox>`:null}
2847
2853
  ${this.not_seen_since_days?Z`
2848
2854
  <div
2849
2855
  class="activity-select"
@@ -2886,12 +2892,6 @@ let ir=Ps,or=!1;const nr=["es","fr","pt"],{setLocale:sr}=(t=>(function(t){if(or)
2886
2892
  <div></div>
2887
2893
  </div>
2888
2894
  `:null}
2889
- ${this.in_a_flow?Z`<temba-checkbox
2890
- name="in_a_flow"
2891
- label="${ir("Are not currently in a flow")}"
2892
- ?checked=${this.exclusions.in_a_flow}
2893
- @change=${this.handleExclusionChanged}
2894
- ></temba-checkbox>`:null}
2895
2895
  ${this.started_previously?Z`<temba-checkbox
2896
2896
  name="started_previously"
2897
2897
  label="${ir("Have not started this flow in the last 90 days")}"
@@ -2907,9 +2907,12 @@ let ir=Ps,or=!1;const nr=["es","fr","pt"],{setLocale:sr}=(t=>(function(t){if(or)
2907
2907
  <temba-loading units="6" size="8"></temba-loading>
2908
2908
  <div class="summary ${this.expanded?"expanded":""}">${t}</div>
2909
2909
  </div>
2910
- ${this.summary&&this.summary.warnings?this.summary.warnings.map((t=>Z`<temba-alert level="warning"
2910
+ ${i}
2911
+ ${!i&&this.summary&&this.summary.warnings?this.summary.warnings.map((t=>Z`<temba-alert level="warning"
2911
2912
  >${pr(t)}</temba-alert
2912
2913
  >`)):""}
2914
+
2915
+
2913
2916
  `}}t([ge({type:Boolean})],Yl.prototype,"in_a_flow",void 0),t([ge({type:Boolean})],Yl.prototype,"started_previously",void 0),t([ge({type:Boolean})],Yl.prototype,"not_seen_since_days",void 0),t([ge({type:Boolean})],Yl.prototype,"fetching",void 0),t([ge({type:Boolean})],Yl.prototype,"expanded",void 0),t([ge({type:String})],Yl.prototype,"endpoint",void 0),t([ge({type:String})],Yl.prototype,"placeholder",void 0),t([ge({type:String})],Yl.prototype,"name",void 0),t([ge({type:String})],Yl.prototype,"query",void 0),t([ge({type:Number})],Yl.prototype,"inactiveThreshold",void 0),t([ge({type:Number})],Yl.prototype,"inactiveDays",void 0),t([ge({type:Object,attribute:!1})],Yl.prototype,"summary",void 0),t([ge({type:Object,attribute:!1})],Yl.prototype,"flow",void 0),t([ge({type:Array})],Yl.prototype,"recipients",void 0),t([ge({type:Boolean})],Yl.prototype,"advanced",void 0),t([ge({type:String})],Yl.prototype,"refreshKey",void 0),t([ge({type:Object})],Yl.prototype,"exclusions",void 0);class Kl extends lt{static get styles(){return r`
2914
2917
  :host {
2915
2918
  align-items: center;