@nyaruka/temba-components 0.94.1 → 0.94.3
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 +12 -0
- package/dist/temba-components.js +7 -5
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/contactsearch/ContactSearch.js +26 -4
- package/out-tsc/src/contactsearch/ContactSearch.js.map +1 -1
- package/package.json +1 -1
- package/src/contactsearch/ContactSearch.ts +30 -6
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,20 @@ 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.94.3](https://github.com/nyaruka/temba-components/compare/v0.94.2...v0.94.3)
|
|
8
|
+
|
|
9
|
+
- Disallow search on empty recipients [`#439`](https://github.com/nyaruka/temba-components/pull/439)
|
|
10
|
+
|
|
11
|
+
#### [v0.94.2](https://github.com/nyaruka/temba-components/compare/v0.94.1...v0.94.2)
|
|
12
|
+
|
|
13
|
+
> 27 June 2024
|
|
14
|
+
|
|
15
|
+
- Fix init exclusions for contact search [`#438`](https://github.com/nyaruka/temba-components/pull/438)
|
|
16
|
+
|
|
7
17
|
#### [v0.94.1](https://github.com/nyaruka/temba-components/compare/v0.94.0...v0.94.1)
|
|
8
18
|
|
|
19
|
+
> 26 June 2024
|
|
20
|
+
|
|
9
21
|
- Don't show contact filter menu with no options [`1ced446`](https://github.com/nyaruka/temba-components/commit/1ced446f385c0cf4f5ccf864bfd4019c77ddd3cb)
|
|
10
22
|
|
|
11
23
|
#### [v0.94.0](https://github.com/nyaruka/temba-components/compare/v0.93.3...v0.94.0)
|
package/dist/temba-components.js
CHANGED
|
@@ -2762,7 +2762,7 @@ let ir=Is,or=!1;const nr=["es","fr","pt"],{setLocale:sr}=(t=>(function(t){if(or)
|
|
|
2762
2762
|
border: 1px solid var(--color-borders);
|
|
2763
2763
|
border-radius: var(--curvature);
|
|
2764
2764
|
}
|
|
2765
|
-
`}refresh(){this.refreshKey="requested_"+(new Date).getTime()}updated(t){super.updated(t),t.has("advanced")&&this.advanced||(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(Oe.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,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(Oe.ContentChanged,this.summary)):(this.summary=t.json,this.summary.error&&(this.errors=[this.summary.error]),this.requestUpdate("errors"),this.fireCustomEvent(Oe.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(){"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");t.values[0]
|
|
2765
|
+
`}refresh(){this.refreshKey="requested_"+(new Date).getTime()}updated(t){super.updated(t),t.has("recipients")&&this.handleRecipientsChanged(),t.has("advanced")&&this.advanced||(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(Oe.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));if(0===t.length&&0===e.length&&!this.query)return this.summary&&(this.summary.total=0),void(this.fetching=!1);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(Oe.ContentChanged,this.summary)):(this.summary=t.json,this.summary.error&&(this.errors=[this.summary.error]),this.requestUpdate("errors"),this.fireCustomEvent(Oe.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=j`
|
|
2766
2766
|
<div class="result-count">
|
|
2767
2767
|
Found
|
|
2768
2768
|
<a
|
|
@@ -2795,7 +2795,7 @@ let ir=Is,or=!1;const nr=["es","fr","pt"],{setLocale:sr}=(t=>(function(t){if(or)
|
|
|
2795
2795
|
</div>
|
|
2796
2796
|
</div>
|
|
2797
2797
|
</temba-button>
|
|
2798
|
-
`}return this.summary&&this.summary.blockers&&this.summary.blockers.length>0?j`${this.summary.blockers.map((t=>j`<temba-alert level="error">${pr(t)}</temba-alert>`))}`:j`
|
|
2798
|
+
`}const e=this.exclusions.not_seen_since_days;return this.summary&&this.summary.blockers&&this.summary.blockers.length>0?j`${this.summary.blockers.map((t=>j`<temba-alert level="error">${pr(t)}</temba-alert>`))}`:j`
|
|
2799
2799
|
${this.advanced?j`<div class="query">
|
|
2800
2800
|
<temba-textinput
|
|
2801
2801
|
.label=${this.label}
|
|
@@ -2846,6 +2846,7 @@ let ir=Is,or=!1;const nr=["es","fr","pt"],{setLocale:sr}=(t=>(function(t){if(or)
|
|
|
2846
2846
|
<temba-checkbox
|
|
2847
2847
|
style="display:inline;"
|
|
2848
2848
|
name="not_seen_since_days"
|
|
2849
|
+
?checked=${e}
|
|
2849
2850
|
@change=${this.handleExclusionChanged}
|
|
2850
2851
|
>
|
|
2851
2852
|
</temba-checkbox>
|
|
@@ -2858,19 +2859,22 @@ let ir=Is,or=!1;const nr=["es","fr","pt"],{setLocale:sr}=(t=>(function(t){if(or)
|
|
|
2858
2859
|
style="margin-left:0.5em"
|
|
2859
2860
|
class="small-select"
|
|
2860
2861
|
@change=${this.handleActivityLevelChanged}
|
|
2861
|
-
?disabled=${!
|
|
2862
|
+
?disabled=${!e}
|
|
2862
2863
|
>
|
|
2863
2864
|
<temba-option
|
|
2864
2865
|
name="90 days"
|
|
2865
2866
|
value="90"
|
|
2867
|
+
?selected=${90===e}
|
|
2866
2868
|
></temba-option>
|
|
2867
2869
|
<temba-option
|
|
2868
2870
|
name="180 days"
|
|
2869
2871
|
value="180"
|
|
2872
|
+
?selected=${180===e}
|
|
2870
2873
|
></temba-option>
|
|
2871
2874
|
<temba-option
|
|
2872
2875
|
name="Year"
|
|
2873
2876
|
value="365"
|
|
2877
|
+
?selected=${365===e}
|
|
2874
2878
|
></temba-option>
|
|
2875
2879
|
</temba-select>
|
|
2876
2880
|
<div></div>
|
|
@@ -2891,14 +2895,12 @@ let ir=Is,or=!1;const nr=["es","fr","pt"],{setLocale:sr}=(t=>(function(t){if(or)
|
|
|
2891
2895
|
</div>
|
|
2892
2896
|
`:null} `}
|
|
2893
2897
|
</div>
|
|
2894
|
-
|
|
2895
2898
|
<div
|
|
2896
2899
|
class="results ${Vt({fetching:this.fetching,initialized:this.initialized||this.fetching,empty:(this.summary&&this.summary.error||!this.summary)&&!this.fetching})}"
|
|
2897
2900
|
>
|
|
2898
2901
|
<temba-loading units="6" size="8"></temba-loading>
|
|
2899
2902
|
<div class="summary ${this.expanded?"expanded":""}">${t}</div>
|
|
2900
2903
|
</div>
|
|
2901
|
-
|
|
2902
2904
|
${this.summary&&this.summary.warnings?this.summary.warnings.map((t=>j`<temba-alert level="warning"
|
|
2903
2905
|
>${pr(t)}</temba-alert
|
|
2904
2906
|
>`)):""}
|