@nyaruka/temba-components 0.35.0 → 0.35.2
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 +15 -0
- package/dist/{30636513.js → 41042aab.js} +89 -64
- package/dist/index.js +89 -64
- package/dist/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/dist/templates/components-body.html +1 -1
- package/dist/templates/components-head.html +1 -1
- package/out-tsc/src/contacts/ContactPending.js +30 -35
- package/out-tsc/src/contacts/ContactPending.js.map +1 -1
- package/out-tsc/src/contacts/events.js +24 -10
- package/out-tsc/src/contacts/events.js.map +1 -1
- package/out-tsc/src/date/TembaDate.js +37 -11
- package/out-tsc/src/date/TembaDate.js.map +1 -1
- package/out-tsc/src/dropdown/Dropdown.js +30 -5
- package/out-tsc/src/dropdown/Dropdown.js.map +1 -1
- package/out-tsc/src/list/RunList.js +17 -16
- package/out-tsc/src/list/RunList.js.map +1 -1
- package/out-tsc/src/store/Store.js +12 -26
- package/out-tsc/src/store/Store.js.map +1 -1
- package/out-tsc/src/vectoricon/index.js +3 -0
- package/out-tsc/src/vectoricon/index.js.map +1 -1
- package/out-tsc/test/temba-contact-history.test.js +5 -8
- package/out-tsc/test/temba-contact-history.test.js.map +1 -1
- package/out-tsc/test/temba-date.test.js +3 -9
- package/out-tsc/test/temba-date.test.js.map +1 -1
- package/out-tsc/test/utils.test.js +9 -0
- package/out-tsc/test/utils.test.js.map +1 -1
- package/package.json +1 -1
- package/screenshots/truth/contacts/contact-active-default.png +0 -0
- package/screenshots/truth/contacts/contact-active-show-chat-history.png +0 -0
- package/screenshots/truth/contacts/contact-active-show-chat-msg.png +0 -0
- package/screenshots/truth/contacts/contact-archived-hide-chat-msg.png +0 -0
- package/screenshots/truth/contacts/contact-archived-show-chat-history.png +0 -0
- package/screenshots/truth/contacts/contact-blocked-hide-chat-msg.png +0 -0
- package/screenshots/truth/contacts/contact-blocked-show-chat-history.png +0 -0
- package/screenshots/truth/contacts/contact-stopped-hide-chat-msg.png +0 -0
- package/screenshots/truth/contacts/contact-stopped-show-chat-history.png +0 -0
- package/screenshots/truth/contacts/fields-updated.png +0 -0
- package/screenshots/truth/contacts/history-expanded.png +0 -0
- package/screenshots/truth/contacts/history.png +0 -0
- package/screenshots/truth/date/duration.png +0 -0
- package/src/contacts/ContactPending.ts +38 -34
- package/src/contacts/events.ts +24 -10
- package/src/date/TembaDate.ts +40 -11
- package/src/dropdown/Dropdown.ts +29 -5
- package/src/list/RunList.ts +17 -28
- package/src/store/Store.ts +13 -37
- package/src/vectoricon/index.ts +3 -0
- package/test/temba-contact-history.test.ts +7 -7
- package/test/temba-date.test.ts +3 -8
- package/test/utils.test.ts +10 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TembaDate.js","sourceRoot":"","sources":["../../../src/date/TembaDate.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAoC,MAAM,KAAK,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE,QAAQ,CAAC,UAAU;IACzB,QAAQ,EAAE,QAAQ,CAAC,cAAc;IACjC,QAAQ,EAAE,UAAU;
|
|
1
|
+
{"version":3,"file":"TembaDate.js","sourceRoot":"","sources":["../../../src/date/TembaDate.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAoC,MAAM,KAAK,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,CAAC,MAAM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CAAC,CAAC;aACvD;iBAAM;gBACL,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;aACjE;YACD,OAAO,IAAI,CAAA,qBAAqB,SAAS,QAAQ,CAAC;SACnD;IACH,CAAC;CACF;AAjEC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCACb;AAGd;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CACV;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2CAC1B","sourcesContent":["import { css, html, PropertyValueMap, TemplateResult } from 'lit';\nimport { property } from 'lit/decorators';\nimport { RapidElement } from '../RapidElement';\nimport { Store } from '../store/Store';\nimport { DateTime } from 'luxon';\n\nexport const Display = {\n date: DateTime.DATE_SHORT,\n datetime: DateTime.DATETIME_SHORT,\n time: DateTime.TIME_SIMPLE,\n timedate: 'timedate',\n duration: 'duration',\n relative: 'relative',\n day: 'LLL d',\n};\n\nexport class TembaDate extends RapidElement {\n static get styles() {\n return css`\n .date {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n `;\n }\n\n @property({ type: String })\n value: string;\n\n @property({ type: String })\n display = 'date';\n\n @property({ type: Object, attribute: false })\n datetime: DateTime;\n\n store: Store;\n\n protected firstUpdated(\n changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>\n ): void {\n super.firstUpdated(changedProperties);\n if (changedProperties.has('value')) {\n this.datetime = DateTime.fromISO(this.value);\n this.store = document.querySelector('temba-store');\n }\n }\n\n public connectedCallback(): void {\n super.connectedCallback();\n }\n\n public render(): TemplateResult {\n if (this.datetime && this.store) {\n this.datetime.setLocale(this.store.getLocale());\n\n let formatted = '';\n if (this.display === Display.timedate) {\n const hours = Math.abs(\n this.datetime.diffNow().milliseconds / 1000 / 60 / 60\n );\n if (hours < 24) {\n formatted = this.datetime.toLocaleString(Display.time);\n } else if (hours < 24 * 365) {\n formatted = this.datetime.toFormat(Display.day);\n } else {\n formatted = this.datetime.toLocaleString(Display.date);\n }\n } else if (this.display === Display.relative) {\n const minutes = Math.abs(\n this.datetime.diffNow().milliseconds / 1000 / 60\n );\n if (minutes < 1) {\n return html`<div class=\"date\">just now</div>`;\n }\n\n formatted = this.store.getShortDuration(this.datetime);\n } else if (this.display === Display.duration) {\n const minutes = Math.abs(\n this.datetime.diffNow().milliseconds / 1000 / 60\n );\n if (minutes < 1) {\n return html`<div class=\"date\">just now</div>`;\n }\n formatted = this.store.getShortDuration(this.datetime);\n } else if (this.display === Display.day) {\n formatted = this.datetime.toLocaleString(Display.day);\n } else {\n formatted = this.datetime.toLocaleString(Display[this.display]);\n }\n return html`<div class=\"date\">${formatted}</div>`;\n }\n }\n}\n"]}
|
|
@@ -6,6 +6,7 @@ export class Dropdown extends RapidElement {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super(...arguments);
|
|
8
8
|
this.open = false;
|
|
9
|
+
this.dropAlign = 'left';
|
|
9
10
|
this.arrowSize = 6;
|
|
10
11
|
this.arrowOffset = this.arrowSize * 2;
|
|
11
12
|
this.offsetX = -10;
|
|
@@ -13,10 +14,19 @@ export class Dropdown extends RapidElement {
|
|
|
13
14
|
}
|
|
14
15
|
static get styles() {
|
|
15
16
|
return css `
|
|
17
|
+
.wrapper {
|
|
18
|
+
position: relative;
|
|
19
|
+
}
|
|
20
|
+
|
|
16
21
|
.toggle {
|
|
17
22
|
cursor: pointer;
|
|
18
23
|
}
|
|
19
24
|
|
|
25
|
+
.dropdown-wrapper {
|
|
26
|
+
position: relative;
|
|
27
|
+
overflow: auto;
|
|
28
|
+
}
|
|
29
|
+
|
|
20
30
|
.dropdown {
|
|
21
31
|
position: absolute;
|
|
22
32
|
opacity: 0;
|
|
@@ -82,6 +92,8 @@ export class Dropdown extends RapidElement {
|
|
|
82
92
|
// a better way to deal with this
|
|
83
93
|
window.setTimeout(() => {
|
|
84
94
|
this.open = false;
|
|
95
|
+
// blur our host element too
|
|
96
|
+
this.shadowRoot.host.blur();
|
|
85
97
|
}, 200);
|
|
86
98
|
});
|
|
87
99
|
}
|
|
@@ -96,7 +108,7 @@ export class Dropdown extends RapidElement {
|
|
|
96
108
|
}
|
|
97
109
|
}
|
|
98
110
|
}
|
|
99
|
-
|
|
111
|
+
handleToggleClicked() {
|
|
100
112
|
if (!this.open) {
|
|
101
113
|
this.open = true;
|
|
102
114
|
const dropdown = this.shadowRoot.querySelector('.dropdown');
|
|
@@ -105,11 +117,21 @@ export class Dropdown extends RapidElement {
|
|
|
105
117
|
}
|
|
106
118
|
render() {
|
|
107
119
|
return html `
|
|
108
|
-
<div class
|
|
109
|
-
<slot
|
|
110
|
-
|
|
120
|
+
<div class="wrapper ${this.open ? 'open' : ''}">
|
|
121
|
+
<slot
|
|
122
|
+
name="toggle"
|
|
123
|
+
class="toggle"
|
|
124
|
+
@click="${this.handleToggleClicked}"
|
|
125
|
+
></slot>
|
|
126
|
+
<div
|
|
127
|
+
class="dropdown"
|
|
128
|
+
tabindex="0"
|
|
129
|
+
style="${this.dropAlign == 'right' ? 'right:0' : ''}"
|
|
130
|
+
>
|
|
111
131
|
<div class="arrow"></div>
|
|
112
|
-
<
|
|
132
|
+
<div class="dropdown-wrapper">
|
|
133
|
+
<slot name="dropdown" tabindex="1"></slot>
|
|
134
|
+
</div>
|
|
113
135
|
</div>
|
|
114
136
|
</div>
|
|
115
137
|
`;
|
|
@@ -118,6 +140,9 @@ export class Dropdown extends RapidElement {
|
|
|
118
140
|
__decorate([
|
|
119
141
|
property({ type: Boolean })
|
|
120
142
|
], Dropdown.prototype, "open", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
property({ type: String, attribute: 'drop_align' })
|
|
145
|
+
], Dropdown.prototype, "dropAlign", void 0);
|
|
121
146
|
__decorate([
|
|
122
147
|
property({ type: Number })
|
|
123
148
|
], Dropdown.prototype, "arrowSize", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../../src/dropdown/Dropdown.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,OAAO,QAAS,SAAQ,YAAY;IAA1C;;
|
|
1
|
+
{"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../../src/dropdown/Dropdown.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,OAAO,QAAS,SAAQ,YAAY;IAA1C;;QAyDE,SAAI,GAAG,KAAK,CAAC;QAGb,cAAS,GAAG,MAAM,CAAC;QAGnB,cAAS,GAAG,CAAC,CAAC;QAGd,gBAAW,GAAG,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QAGjC,YAAO,GAAG,CAAC,EAAE,CAAC;QAGd,YAAO,GAAG,CAAC,CAAC;IAmFd,CAAC;IA1JC,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmDT,CAAC;IACJ,CAAC;IAoBM,YAAY,CAAC,KAAU;QAC5B,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QAE1B,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAC5C,WAAW,CACM,CAAC;QACpB,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,QAA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emplateResult } from 'lit';\nimport { property } from 'lit/decorators';\nimport { RapidElement } from '../RapidElement';\n\nexport class Dropdown extends RapidElement {\n static get styles() {\n return css`\n .wrapper {\n position: relative;\n }\n\n .toggle {\n cursor: pointer;\n }\n\n .dropdown-wrapper {\n position: relative;\n overflow: auto;\n }\n\n .dropdown {\n position: absolute;\n opacity: 0;\n z-index: 10;\n pointer-events: none;\n padding: 0;\n border-radius: var(--curvature);\n background: #fff;\n transform: translateY(-1em);\n transition: all calc(0.6 * var(--transition-speed)) linear;\n user-select: none;\n margin-top: 0px;\n margin-left: 0px;\n box-shadow: var(--dropdown-shadow);\n }\n\n .dropdown:focus {\n outline: none;\n }\n\n .arrow {\n content: '';\n width: 0px;\n height: 0;\n top: -6px;\n z-index: 10;\n position: absolute;\n border-left: 6px solid transparent;\n border-right: 6px solid transparent;\n border-bottom: 6px solid white;\n }\n\n .open .dropdown {\n opacity: 1;\n pointer-events: auto;\n transform: translateY(0.5em);\n }\n `;\n }\n\n @property({ type: Boolean })\n open = false;\n\n @property({ type: String, attribute: 'drop_align' })\n dropAlign = 'left';\n\n @property({ type: Number })\n arrowSize = 6;\n\n @property({ type: Number })\n arrowOffset = this.arrowSize * 2;\n\n @property({ type: Number })\n offsetX = -10;\n\n @property({ type: Number })\n offsetY = 0;\n\n public firstUpdated(props: any) {\n super.firstUpdated(props);\n\n const dropdown = this.shadowRoot.querySelector(\n '.dropdown'\n ) as HTMLDivElement;\n const arrow = this.shadowRoot.querySelector('.arrow') as HTMLDivElement;\n\n arrow.style.borderWidth = this.arrowSize + 'px';\n arrow.style.top = '-' + this.arrowSize + 'px';\n\n if (this.arrowOffset < 0) {\n arrow.style.right = Math.abs(this.arrowOffset) + 'px';\n } else {\n arrow.style.left = this.arrowOffset + 'px';\n }\n\n dropdown.style.marginTop = this.offsetY + 'px';\n\n if (dropdown.offsetLeft + dropdown.clientWidth > window.outerWidth) {\n dropdown.style.marginLeft =\n '-' + (dropdown.clientWidth - this.clientWidth - this.offsetX) + 'px';\n } else {\n dropdown.style.marginLeft = this.offsetX + 'px';\n }\n\n dropdown.addEventListener('blur', () => {\n // we nest this to deal with clicking the toggle to close\n // as we don't want it to toggle an immediate open, probably\n // a better way to deal with this\n window.setTimeout(() => {\n this.open = false;\n // blur our host element too\n (this.shadowRoot.host as HTMLDivElement).blur();\n }, 200);\n });\n }\n\n public updated(changedProperties: Map<string, any>) {\n super.updated(changedProperties);\n if (changedProperties.has('open')) {\n if (this.open) {\n this.classList.add('open');\n } else {\n this.classList.remove('open');\n }\n }\n }\n\n public handleToggleClicked(): void {\n if (!this.open) {\n this.open = true;\n\n const dropdown = this.shadowRoot.querySelector(\n '.dropdown'\n ) as HTMLDivElement;\n dropdown.focus();\n }\n }\n\n public render(): TemplateResult {\n return html`\n <div class=\"wrapper ${this.open ? 'open' : ''}\">\n <slot\n name=\"toggle\"\n class=\"toggle\"\n @click=\"${this.handleToggleClicked}\"\n ></slot>\n <div\n class=\"dropdown\"\n tabindex=\"0\"\n style=\"${this.dropAlign == 'right' ? 'right:0' : ''}\"\n >\n <div class=\"arrow\"></div>\n <div class=\"dropdown-wrapper\">\n <slot name=\"dropdown\" tabindex=\"1\"></slot>\n </div>\n </div>\n </div>\n `;\n }\n}\n"]}
|
|
@@ -120,7 +120,7 @@ export class RunList extends TembaList {
|
|
|
120
120
|
</div>
|
|
121
121
|
|
|
122
122
|
<div style="flex-shrink:1">
|
|
123
|
-
${
|
|
123
|
+
<temba-date value="${run.modified_on}" display="duration" />
|
|
124
124
|
</div>
|
|
125
125
|
${this.getIcon(run)}
|
|
126
126
|
</div>
|
|
@@ -197,7 +197,6 @@ export class RunList extends TembaList {
|
|
|
197
197
|
if (!this.selectedRun || !this.resultKeys) {
|
|
198
198
|
return null;
|
|
199
199
|
}
|
|
200
|
-
const exitType = this.selectedRun.exit_type;
|
|
201
200
|
const resultKeys = Object.keys(this.selectedRun.values);
|
|
202
201
|
return html ` <div
|
|
203
202
|
style="margin-top: 1.5em; margin-bottom:0.5em;flex-grow:1;border-radius:var(--curvature); border: 1px solid var(--color-widget-border);"
|
|
@@ -220,23 +219,25 @@ export class RunList extends TembaList {
|
|
|
220
219
|
>
|
|
221
220
|
${this.selectedRun.exit_type
|
|
222
221
|
? html `
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
: null}
|
|
222
|
+
<div style="margin-left:2em;flex-grow:1;display:flex">
|
|
223
|
+
${this.getIcon(this.selectedRun)}
|
|
224
|
+
<div style="margin-left:0.5em">
|
|
225
|
+
${capitalize(this.selectedRun.exit_type)}
|
|
226
|
+
</div>
|
|
227
|
+
<temba-date
|
|
228
|
+
value="${this.selectedRun.exited_on}"
|
|
229
|
+
compare="${this.selectedRun.created_on}"
|
|
230
|
+
display="duration"
|
|
231
|
+
/>
|
|
234
232
|
</div>
|
|
235
233
|
`
|
|
236
234
|
: html `${this.getIcon(this.selectedRun)}
|
|
237
|
-
<div style="margin-left:
|
|
238
|
-
|
|
239
|
-
|
|
235
|
+
<div style="margin-left:1.5em;flex-grow:1;display:flex">
|
|
236
|
+
<div>Started </div>
|
|
237
|
+
<temba-date
|
|
238
|
+
value="${this.selectedRun.created_on}"
|
|
239
|
+
display="duration"
|
|
240
|
+
/>
|
|
240
241
|
</div>`}
|
|
241
242
|
</div>
|
|
242
243
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RunList.js","sourceRoot":"","sources":["../../../src/list/RunList.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,UAAU,GAAG,mBAAmB,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M,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;gBAElC,8DAA8D;gBAC9D,IAAI,IAAI,EAAE;oBACR,OAAO,IAAI,CAAA;8BACH,MAAM,CAAC,IAAI;;4BAEb,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI;;8BAEjD,MAAM,CAAC,KAAK;4BACd,CAAC;iBACR;gBACD,OAAO,IAAI,CAAC;YACd,CAAC,CAAC;;;aAGP;YACH,CAAC,CAAC,IAAI;;WAEL,CAAC;IACV,CAAC;CASF;AAtVC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qCACd;AAGb;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;wCAC9B;AAGf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CACX;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CACR;AAGnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CACV","sourcesContent":["import { html, TemplateResult } from 'lit';\nimport { property } from 'lit/decorators';\nimport { Checkbox } from '../checkbox/Checkbox';\nimport { Select } from '../select/Select';\nimport { capitalize } from '../utils';\nimport { TembaList } from './TembaList';\n\nconst FLOW_COLOR = 'rgb(223, 65, 159)';\n\nexport class RunList extends TembaList {\n @property({ type: String })\n flow: string;\n\n @property({ type: Object, attribute: false })\n results: any[];\n\n @property({ type: Boolean })\n responses = true;\n\n @property({ type: Object })\n resultPreview: any;\n\n @property({ type: Object })\n selectedRun: any;\n\n private resultKeys = {};\n\n public firstUpdated(changedProperties: Map<string, any>) {\n super.firstUpdated(changedProperties);\n }\n\n public updated(changedProperties: Map<string, any>): void {\n super.updated(changedProperties);\n if (changedProperties.has('responses') || changedProperties.has('flow')) {\n if (this.flow) {\n this.endpoint = `/api/v2/runs.json?flow=${this.flow}${\n this.responses ? '&responded=1' : ''\n }`;\n }\n }\n\n if (changedProperties.has('resultPreview')) {\n this.createRenderOption();\n }\n\n if (changedProperties.has('results')) {\n if (this.results) {\n const select = this.shadowRoot.querySelector('temba-select') as Select;\n select.setOptions(this.results);\n this.resultKeys = this.results.reduce(\n (current, result) => ({ ...current, [result.key]: result }),\n {}\n );\n }\n }\n }\n\n public renderResultPreview(run: any) {\n if (this.resultPreview) {\n const runResult = run.values[this.resultPreview.key];\n if (runResult) {\n if (this.resultPreview.categories.length > 1) {\n if (runResult.category) {\n return runResult.category;\n }\n } else {\n return runResult.value;\n }\n }\n }\n return null;\n }\n\n public removeRun(id: number) {\n this.items = this.items.filter(run => run.id !== id);\n this.cursorIndex = Math.min(this.cursorIndex, this.items.length);\n this.requestUpdate('cursorIndex');\n }\n\n public getIcon(run: any): TemplateResult {\n let icon = null;\n if (run.exit_type == 'completed') {\n icon = html`<temba-icon\n name=\"check\"\n style=\"--icon-color:#666;margin-left:0.5em\"\n />`;\n } else if (run.exit_type == 'interrupted') {\n icon = html`<temba-icon\n name=\"x-octagon\"\n style=\"--icon-color:${FLOW_COLOR};margin-left:0.5em\"\n />`;\n } else if (run.exit_type == 'expired') {\n icon = html`<temba-icon\n name=\"clock\"\n style=\"--icon-color:${FLOW_COLOR};margin-left:0.5em\"\n />`;\n } else if (!run.exit_type) {\n if (run.responded) {\n icon = html`<temba-icon\n name=\"activity\"\n style=\"--icon-color:var(--color-primary-dark);margin-left:0.5em\"\n />`;\n } else {\n icon = html`<temba-icon\n name=\"hourglass\"\n style=\"--icon-color:var(--color-primary-dark);margin-left:0.5em\"\n />`;\n }\n }\n return icon;\n }\n\n public createRenderOption() {\n this.renderOption = (run: any): TemplateResult => {\n let statusStyle = '';\n\n if (!run.exited_on) {\n statusStyle = 'font-weight:400;';\n }\n\n if (!run.responded) {\n statusStyle += '';\n }\n\n return html`\n <div class=\"row\" style=\"${statusStyle}display:flex;align-items:center\">\n <div\n style=\"width: 12em;white-space:nowrap;overflow: hidden; text-overflow: ellipsis;\"\n >\n <temba-contact-name\n name=${run.contact.name || run.contact.anon_display}\n urn=${run.contact.urn}\n icon-size=\"15\"\n />\n </div>\n\n <div\n style=\"margin: 0em 1em;flex:1;white-space:nowrap; overflow:hidden; text-overflow: ellipsis;\"\n >\n ${this.renderResultPreview(run)}\n </div>\n\n <div style=\"flex-shrink:1\">\n ${this.store.getShortDurationFromIso(run.modified_on)}\n </div>\n ${this.getIcon(run)}\n </div>\n `;\n };\n }\n\n public getRefreshEndpoint() {\n if (this.items.length > 0) {\n const modifiedOn = this.items[0].modified_on;\n return this.endpoint + '&after=' + modifiedOn;\n }\n return this.endpoint;\n }\n\n public toggleResponded() {\n this.responses = (\n this.shadowRoot.querySelector('#responded') as Checkbox\n ).checked;\n }\n\n public handleColumnChanged(event: any) {\n if (event.target.values.length > 0) {\n this.resultPreview = event.target.values[0];\n } else {\n this.resultPreview = null;\n }\n }\n\n public handleSelected(selected: any) {\n this.selectedRun = selected;\n }\n\n public getListStyle(): string {\n return '';\n }\n\n public renderHeader(): TemplateResult {\n return html`\n <div style=\"display:flex;width:100%;margin-bottom: 1em;\">\n <div style=\"flex-grow:1\">\n ${this.results\n ? html`\n <temba-select\n clearable\n placeholder=\"Result Preview\"\n @change=${this.handleColumnChanged}\n />\n `\n : null}\n </div>\n <div style=\"margin-left:1em;\">\n <temba-checkbox\n id=\"responded\"\n label=\"Responses Only\"\n checked=\"true\"\n @click=${this.toggleResponded}\n />\n </div>\n </div>\n <div\n style=\"\n font-size:0.8em;\n color:rgba(0,0,0,.4);\n text-align:right;\n background:#f9f9f9;\n border: 1px solid var(--color-widget-border);\n margin-bottom:-0.5em; \n padding-bottom: 0.6em;\n padding-top: 0.3em;\n padding-right: 4.5em;\n border-top-right-radius: var(--curvature);\n border-top-left-radius: var(--curvature)\n \"\n >\n Last Updated\n </div>\n `;\n }\n\n public renderFooter(): TemplateResult {\n if (!this.selectedRun || !this.resultKeys) {\n return null;\n }\n\n const exitType = this.selectedRun.exit_type;\n const resultKeys = Object.keys(this.selectedRun.values);\n\n return html` <div\n style=\"margin-top: 1.5em; margin-bottom:0.5em;flex-grow:1;border-radius:var(--curvature); border: 1px solid var(--color-widget-border);\"\n >\n <div style=\"display:flex;flex-direction:column;\">\n <div\n style=\"font-size:1.5em;background:#f9f9f9;padding:.75em;padding-top:.35em;display:flex;align-items:center;border-top-right-radius:var(--curvature);border-top-left-radius:var(--curvature)\"\n >\n <div>\n <temba-contact-name\n style=\"cursor:pointer\"\n name=${this.selectedRun.contact.name ||\n this.selectedRun.contact.anon_display}\n urn=${this.selectedRun.contact.urn}\n onclick=\"goto(event, this)\"\n href=\"/contact/read/${this.selectedRun.contact.uuid}/\"\n ></temba-contact-name>\n <div\n style=\"display:flex;margin-left:-0.2em;margin-top:0.25em;font-size: 0.65em\"\n >\n ${this.selectedRun.exit_type\n ? html`\n ${this.getIcon(this.selectedRun)}\n <div style=\"margin-left:0.5em;flex-grow:1\">\n ${capitalize(this.selectedRun.exit_type)}\n ${exitType == 'completed'\n ? html` in\n ${this.store.getShortDurationFromIso(\n this.selectedRun.created_on,\n this.selectedRun.exited_on,\n true\n )}`\n : null}\n ${exitType == 'interrupted' || exitType == 'expired'\n ? html` after\n ${this.store.getShortDurationFromIso(\n this.selectedRun.created_on,\n this.selectedRun.exited_on,\n true\n )}`\n : null}\n </div>\n `\n : html`${this.getIcon(this.selectedRun)}\n <div style=\"margin-left:0.5em;flex-grow:1\">\n Active for\n ${this.store.getShortDurationFromIso(\n this.selectedRun.created_on,\n null,\n true\n )}\n </div>`}\n </div>\n </div>\n <div style=\"flex-grow:1\"></div>\n <div style=\"display:flex;flex-direction: column\">\n <div style=\"font-size:0.75em\">\n ${new Date(this.selectedRun.created_on).toLocaleString()}\n </div>\n <div\n style=\"font-size:0.6em;align-self:flex-end;color:#888;line-height:0.75em\"\n >\n Started\n </div>\n </div>\n <temba-icon\n clickable\n style=\"margin-left:0.75em;\"\n name=\"trash\"\n onclick=\"deleteRun(${this.selectedRun.id});\"\n ></temba-icon>\n </div>\n\n ${resultKeys.length > 0\n ? html`\n <div\n style=\"padding:1em;overflow-y:auto;overflow-x:hidden;max-height:15vh;\"\n >\n <div\n style=\"display:flex;font-size:1.2em;position:relative;right:0px\"\n >\n <div style=\"flex-grow:1\"></div>\n </div>\n\n <table width=\"100%\">\n <tr>\n <th style=\"text-align:left\" width=\"25%\">Result</th>\n <th style=\"text-align:left\" width=\"25%\">Category</th>\n <th style=\"text-align:left\">Value</th>\n </tr>\n\n ${Object.keys(this.selectedRun.values).map((key: string) => {\n const result = this.selectedRun.values[key];\n const meta = this.resultKeys[key];\n\n // if our result is no longer represented in the flow, skip it\n if (meta) {\n return html`<tr>\n <td>${result.name}</td>\n <td>\n ${meta.categories.length > 1 ? result.category : '--'}\n </td>\n <td>${result.value}</td>\n </tr>`;\n }\n return null;\n })}\n </table>\n </div>\n `\n : null}\n </div>\n </div>`;\n }\n\n constructor() {\n super();\n this.reverseRefresh = false;\n this.valueKey = 'uuid';\n this.hideShadow = true;\n this.createRenderOption();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"RunList.js","sourceRoot":"","sources":["../../../src/list/RunList.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,UAAU,GAAG,mBAAmB,CAAC;AAEvC,MAAM,OAAO,OAAQ,SAAQ,SAAS;IAsUpC;QACE,KAAK,EAAE,CAAC;QA/TV,cAAS,GAAG,IAAI,CAAC;QAQT,eAAU,GAAG,EAAE,CAAC;QAwTtB,IAAI,CAAC,cAAc,GAAG,KAAK,CA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,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CACV","sourcesContent":["import { html, TemplateResult } from 'lit';\nimport { property } from 'lit/decorators';\nimport { Checkbox } from '../checkbox/Checkbox';\nimport { Select } from '../select/Select';\nimport { capitalize } from '../utils';\nimport { TembaList } from './TembaList';\n\nconst FLOW_COLOR = 'rgb(223, 65, 159)';\n\nexport class RunList extends TembaList {\n @property({ type: String })\n flow: string;\n\n @property({ type: Object, attribute: false })\n results: any[];\n\n @property({ type: Boolean })\n responses = true;\n\n @property({ type: Object })\n resultPreview: any;\n\n @property({ type: Object })\n selectedRun: any;\n\n private resultKeys = {};\n\n public firstUpdated(changedProperties: Map<string, any>) {\n super.firstUpdated(changedProperties);\n }\n\n public updated(changedProperties: Map<string, any>): void {\n super.updated(changedProperties);\n if (changedProperties.has('responses') || changedProperties.has('flow')) {\n if (this.flow) {\n this.endpoint = `/api/v2/runs.json?flow=${this.flow}${\n this.responses ? '&responded=1' : ''\n }`;\n }\n }\n\n if (changedProperties.has('resultPreview')) {\n this.createRenderOption();\n }\n\n if (changedProperties.has('results')) {\n if (this.results) {\n const select = this.shadowRoot.querySelector('temba-select') as Select;\n select.setOptions(this.results);\n this.resultKeys = this.results.reduce(\n (current, result) => ({ ...current, [result.key]: result }),\n {}\n );\n }\n }\n }\n\n public renderResultPreview(run: any) {\n if (this.resultPreview) {\n const runResult = run.values[this.resultPreview.key];\n if (runResult) {\n if (this.resultPreview.categories.length > 1) {\n if (runResult.category) {\n return runResult.category;\n }\n } else {\n return runResult.value;\n }\n }\n }\n return null;\n }\n\n public removeRun(id: number) {\n this.items = this.items.filter(run => run.id !== id);\n this.cursorIndex = Math.min(this.cursorIndex, this.items.length);\n this.requestUpdate('cursorIndex');\n }\n\n public getIcon(run: any): TemplateResult {\n let icon = null;\n if (run.exit_type == 'completed') {\n icon = html`<temba-icon\n name=\"check\"\n style=\"--icon-color:#666;margin-left:0.5em\"\n />`;\n } else if (run.exit_type == 'interrupted') {\n icon = html`<temba-icon\n name=\"x-octagon\"\n style=\"--icon-color:${FLOW_COLOR};margin-left:0.5em\"\n />`;\n } else if (run.exit_type == 'expired') {\n icon = html`<temba-icon\n name=\"clock\"\n style=\"--icon-color:${FLOW_COLOR};margin-left:0.5em\"\n />`;\n } else if (!run.exit_type) {\n if (run.responded) {\n icon = html`<temba-icon\n name=\"activity\"\n style=\"--icon-color:var(--color-primary-dark);margin-left:0.5em\"\n />`;\n } else {\n icon = html`<temba-icon\n name=\"hourglass\"\n style=\"--icon-color:var(--color-primary-dark);margin-left:0.5em\"\n />`;\n }\n }\n return icon;\n }\n\n public createRenderOption() {\n this.renderOption = (run: any): TemplateResult => {\n let statusStyle = '';\n\n if (!run.exited_on) {\n statusStyle = 'font-weight:400;';\n }\n\n if (!run.responded) {\n statusStyle += '';\n }\n\n return html`\n <div class=\"row\" style=\"${statusStyle}display:flex;align-items:center\">\n <div\n style=\"width: 12em;white-space:nowrap;overflow: hidden; text-overflow: ellipsis;\"\n >\n <temba-contact-name\n name=${run.contact.name || run.contact.anon_display}\n urn=${run.contact.urn}\n icon-size=\"15\"\n />\n </div>\n\n <div\n style=\"margin: 0em 1em;flex:1;white-space:nowrap; overflow:hidden; text-overflow: ellipsis;\"\n >\n ${this.renderResultPreview(run)}\n </div>\n\n <div style=\"flex-shrink:1\">\n <temba-date value=\"${run.modified_on}\" display=\"duration\" />\n </div>\n ${this.getIcon(run)}\n </div>\n `;\n };\n }\n\n public getRefreshEndpoint() {\n if (this.items.length > 0) {\n const modifiedOn = this.items[0].modified_on;\n return this.endpoint + '&after=' + modifiedOn;\n }\n return this.endpoint;\n }\n\n public toggleResponded() {\n this.responses = (\n this.shadowRoot.querySelector('#responded') as Checkbox\n ).checked;\n }\n\n public handleColumnChanged(event: any) {\n if (event.target.values.length > 0) {\n this.resultPreview = event.target.values[0];\n } else {\n this.resultPreview = null;\n }\n }\n\n public handleSelected(selected: any) {\n this.selectedRun = selected;\n }\n\n public getListStyle(): string {\n return '';\n }\n\n public renderHeader(): TemplateResult {\n return html`\n <div style=\"display:flex;width:100%;margin-bottom: 1em;\">\n <div style=\"flex-grow:1\">\n ${this.results\n ? html`\n <temba-select\n clearable\n placeholder=\"Result Preview\"\n @change=${this.handleColumnChanged}\n />\n `\n : null}\n </div>\n <div style=\"margin-left:1em;\">\n <temba-checkbox\n id=\"responded\"\n label=\"Responses Only\"\n checked=\"true\"\n @click=${this.toggleResponded}\n />\n </div>\n </div>\n <div\n style=\"\n font-size:0.8em;\n color:rgba(0,0,0,.4);\n text-align:right;\n background:#f9f9f9;\n border: 1px solid var(--color-widget-border);\n margin-bottom:-0.5em; \n padding-bottom: 0.6em;\n padding-top: 0.3em;\n padding-right: 4.5em;\n border-top-right-radius: var(--curvature);\n border-top-left-radius: var(--curvature)\n \"\n >\n Last Updated\n </div>\n `;\n }\n\n public renderFooter(): TemplateResult {\n if (!this.selectedRun || !this.resultKeys) {\n return null;\n }\n\n const resultKeys = Object.keys(this.selectedRun.values);\n\n return html` <div\n style=\"margin-top: 1.5em; margin-bottom:0.5em;flex-grow:1;border-radius:var(--curvature); border: 1px solid var(--color-widget-border);\"\n >\n <div style=\"display:flex;flex-direction:column;\">\n <div\n style=\"font-size:1.5em;background:#f9f9f9;padding:.75em;padding-top:.35em;display:flex;align-items:center;border-top-right-radius:var(--curvature);border-top-left-radius:var(--curvature)\"\n >\n <div>\n <temba-contact-name\n style=\"cursor:pointer\"\n name=${this.selectedRun.contact.name ||\n this.selectedRun.contact.anon_display}\n urn=${this.selectedRun.contact.urn}\n onclick=\"goto(event, this)\"\n href=\"/contact/read/${this.selectedRun.contact.uuid}/\"\n ></temba-contact-name>\n <div\n style=\"display:flex;margin-left:-0.2em;margin-top:0.25em;font-size: 0.65em\"\n >\n ${this.selectedRun.exit_type\n ? html`\n <div style=\"margin-left:2em;flex-grow:1;display:flex\">\n ${this.getIcon(this.selectedRun)}\n <div style=\"margin-left:0.5em\">\n ${capitalize(this.selectedRun.exit_type)} \n </div>\n <temba-date\n value=\"${this.selectedRun.exited_on}\"\n compare=\"${this.selectedRun.created_on}\"\n display=\"duration\"\n />\n </div>\n `\n : html`${this.getIcon(this.selectedRun)}\n <div style=\"margin-left:1.5em;flex-grow:1;display:flex\">\n <div>Started </div>\n <temba-date\n value=\"${this.selectedRun.created_on}\"\n display=\"duration\"\n />\n </div>`}\n </div>\n </div>\n <div style=\"flex-grow:1\"></div>\n <div style=\"display:flex;flex-direction: column\">\n <div style=\"font-size:0.75em\">\n ${new Date(this.selectedRun.created_on).toLocaleString()}\n </div>\n <div\n style=\"font-size:0.6em;align-self:flex-end;color:#888;line-height:0.75em\"\n >\n Started\n </div>\n </div>\n <temba-icon\n clickable\n style=\"margin-left:0.75em;\"\n name=\"trash\"\n onclick=\"deleteRun(${this.selectedRun.id});\"\n ></temba-icon>\n </div>\n\n ${resultKeys.length > 0\n ? html`\n <div\n style=\"padding:1em;overflow-y:auto;overflow-x:hidden;max-height:15vh;\"\n >\n <div\n style=\"display:flex;font-size:1.2em;position:relative;right:0px\"\n >\n <div style=\"flex-grow:1\"></div>\n </div>\n\n <table width=\"100%\">\n <tr>\n <th style=\"text-align:left\" width=\"25%\">Result</th>\n <th style=\"text-align:left\" width=\"25%\">Category</th>\n <th style=\"text-align:left\">Value</th>\n </tr>\n\n ${Object.keys(this.selectedRun.values).map((key: string) => {\n const result = this.selectedRun.values[key];\n const meta = this.resultKeys[key];\n\n // if our result is no longer represented in the flow, skip it\n if (meta) {\n return html`<tr>\n <td>${result.name}</td>\n <td>\n ${meta.categories.length > 1 ? result.category : '--'}\n </td>\n <td>${result.value}</td>\n </tr>`;\n }\n return null;\n })}\n </table>\n </div>\n `\n : null}\n </div>\n </div>`;\n }\n\n constructor() {\n super();\n this.reverseRefresh = false;\n this.valueKey = 'uuid';\n this.hideShadow = true;\n this.createRenderOption();\n }\n}\n"]}
|
|
@@ -22,6 +22,9 @@ export class Store extends RapidElement {
|
|
|
22
22
|
this.pendingResolves = {};
|
|
23
23
|
this.fetching = {};
|
|
24
24
|
}
|
|
25
|
+
getLocale() {
|
|
26
|
+
return this.locale[0];
|
|
27
|
+
}
|
|
25
28
|
reset() {
|
|
26
29
|
this.cache = Lru(this.max, this.ttl);
|
|
27
30
|
/*
|
|
@@ -110,29 +113,16 @@ export class Store extends RapidElement {
|
|
|
110
113
|
});
|
|
111
114
|
});
|
|
112
115
|
}
|
|
113
|
-
getShortDuration(scheduled, compareDate = null
|
|
116
|
+
getShortDuration(scheduled, compareDate = null) {
|
|
114
117
|
const now = compareDate || DateTime.now();
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
language: this.getLanguageCode(),
|
|
119
|
-
largest: 1,
|
|
120
|
-
round: true,
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
if (Math.abs(duration) < 60000) {
|
|
124
|
-
return 'just now';
|
|
125
|
-
}
|
|
126
|
-
return this.humanizer.humanize(duration, {
|
|
127
|
-
language: this.getLanguageCode(),
|
|
128
|
-
largest: 1,
|
|
129
|
-
round: false,
|
|
130
|
-
});
|
|
118
|
+
return scheduled
|
|
119
|
+
.setLocale(this.locale[0])
|
|
120
|
+
.toRelative({ base: now, style: 'long' });
|
|
131
121
|
}
|
|
132
|
-
getShortDurationFromIso(isoDateA, isoDateB = null
|
|
122
|
+
getShortDurationFromIso(isoDateA, isoDateB = null) {
|
|
133
123
|
const scheduled = DateTime.fromISO(isoDateA);
|
|
134
124
|
const now = isoDateB ? DateTime.fromISO(isoDateB) : DateTime.now();
|
|
135
|
-
return this.getShortDuration(scheduled, now
|
|
125
|
+
return this.getShortDuration(scheduled, now);
|
|
136
126
|
}
|
|
137
127
|
setKeyedAssets(name, values) {
|
|
138
128
|
this.keyedAssets[name] = values;
|
|
@@ -172,13 +162,9 @@ export class Store extends RapidElement {
|
|
|
172
162
|
return this.workspace;
|
|
173
163
|
}
|
|
174
164
|
formatDate(dateString) {
|
|
175
|
-
return
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
day: 'numeric',
|
|
179
|
-
hour: 'numeric',
|
|
180
|
-
minute: 'numeric',
|
|
181
|
-
});
|
|
165
|
+
return DateTime.fromISO(dateString)
|
|
166
|
+
.setLocale(this.getLocale())
|
|
167
|
+
.toLocaleString(DateTime.DATETIME_SHORT);
|
|
182
168
|
}
|
|
183
169
|
postUrl(url, payload = '', headers = {}, contentType = null) {
|
|
184
170
|
return postUrl(url, payload, headers, contentType);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Store.js","sourceRoot":"","sources":["../../../src/store/Store.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,YAAY,EACZ,MAAM,EACN,SAAS,EAGT,OAAO,GACR,MAAM,UAAU,CAAC;AAClB,OAAO,EAML,eAAe,GAEhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EACL,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,OAAO,KAAM,SAAQ,YAAY;IAAvC;;QAEE,QAAG,GAAG,KAAK,CAAC;QAGZ,QAAG,GAAG,EAAE,CAAC;QA2BD,gBAAW,GAAgB,EAAE,CAAC;QAE9B,WAAM,GAAG,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;QAElC,WAAM,GAAoC,EAAE,CAAC;QAC7C,WAAM,GAAqC,EAAE,CAAC;QAC9C,cAAS,GAAQ,EAAE,CAAC;QAEpB,mBAAc,GAAmB,EAAE,CAAC;QAEpC,gBAAW,GAAG,IAAI,wBAAwB,EAAE,CAAC;QAC7C,cAAS,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAkQnD,oBAAe,GAAG,EAAE,CAAC;QAqCtB,a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AC;gDACzB;AAG1B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;gDACzB;AAG1B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;qCACZ;AAGjC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;wCACP;AAGtC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;0CACP","sourcesContent":["import { property } from 'lit/decorators';\nimport {\n fetchResults,\n getUrl,\n getAssets,\n Asset,\n WebResponse,\n postUrl,\n} from '../utils';\nimport {\n ContactField,\n ContactGroup,\n CompletionOption,\n CompletionSchema,\n KeyedAssets,\n CustomEventType,\n Workspace,\n} from '../interfaces';\nimport { RapidElement } from '../RapidElement';\nimport Lru from 'tiny-lru';\nimport {\n HumanizeDurationLanguage,\n HumanizeDuration,\n} from 'humanize-duration-ts';\nimport { DateTime } from 'luxon';\n\nexport class Store extends RapidElement {\n @property({ type: Number })\n ttl = 60000;\n\n @property({ type: Number })\n max = 20;\n\n @property({ type: String, attribute: 'completion' })\n completionEndpoint: string;\n\n @property({ type: String, attribute: 'fields' })\n fieldsEndpoint: string;\n\n @property({ type: String, attribute: 'groups' })\n groupsEndpoint: string;\n\n @property({ type: String, attribute: 'globals' })\n globalsEndpoint: string;\n\n @property({ type: String, attribute: 'languages' })\n languagesEndpoint: string;\n\n @property({ type: String, attribute: 'workspace' })\n workspaceEndpoint: string;\n\n @property({ type: Object, attribute: false })\n private schema: CompletionSchema;\n\n @property({ type: Object, attribute: false })\n private fnOptions: CompletionOption[];\n\n @property({ type: Object, attribute: false })\n private keyedAssets: KeyedAssets = {};\n\n private locale = [...navigator.languages];\n\n private fields: { [key: string]: ContactField } = {};\n private groups: { [uuid: string]: ContactGroup } = {};\n private languages: any = {};\n private workspace: Workspace;\n private featuredFields: ContactField[] = [];\n\n private langService = new HumanizeDurationLanguage();\n private humanizer = new HumanizeDuration(this.langService);\n\n // http promise to monitor for completeness\n public httpComplete: Promise<void | WebResponse[]>;\n\n private cache: any;\n\n public reset() {\n this.cache = Lru(this.max, this.ttl);\n\n /* \n // This will create a shorthand unit\n this.humanizer.addLanguage(\"en\", {\n y: () => \"y\",\n mo: () => \"mo\",\n w: () => \"w\",\n d: () => \"d\",\n h: () => \"h\",\n m: () => \"m\",\n s: () => \"s\",\n ms: () => \"ms\",\n decimal: \".\",\n });\n */\n\n const fetches = [];\n if (this.completionEndpoint) {\n fetches.push(\n getUrl(this.completionEndpoint).then(response => {\n this.schema = response.json['context'] as CompletionSchema;\n this.fnOptions = response.json['functions'] as CompletionOption[];\n })\n );\n }\n\n if (this.fieldsEndpoint) {\n fetches.push(this.refreshFields());\n }\n\n if (this.globalsEndpoint) {\n fetches.push(\n getAssets(this.globalsEndpoint).then((assets: Asset[]) => {\n this.keyedAssets['globals'] = assets.map((asset: Asset) => asset.key);\n })\n );\n }\n\n if (this.languagesEndpoint) {\n fetches.push(\n getAssets(this.languagesEndpoint).then((results: any[]) => {\n // convert array of objects to lookup\n this.languages = results.reduce(function (\n languages: any,\n result: any\n ) {\n languages[result.value] = result.name;\n return languages;\n },\n {});\n })\n );\n }\n\n if (this.groupsEndpoint) {\n fetches.push(\n getAssets(this.groupsEndpoint).then((groups: any[]) => {\n groups.forEach((group: any) => {\n this.groups[group.uuid] = group;\n });\n })\n );\n }\n\n if (this.workspaceEndpoint) {\n fetches.push(\n getUrl(this.workspaceEndpoint).then((response: WebResponse) => {\n this.workspace = response.json;\n const lang = response.headers.get('content-language');\n if (lang) {\n this.locale = [lang, ...this.locale];\n }\n })\n );\n }\n\n this.httpComplete = Promise.all(fetches);\n }\n\n public firstUpdated() {\n this.reset();\n }\n\n public getLanguageCode() {\n if (this.locale.length > 0) {\n return this.locale[0].split('-')[0];\n }\n return 'en';\n }\n\n public refreshFields() {\n return getAssets(this.fieldsEndpoint).then((assets: Asset[]) => {\n this.keyedAssets['fields'] = [];\n this.featuredFields = [];\n\n assets.forEach((field: ContactField) => {\n this.keyedAssets['fields'].push(field.key);\n this.fields[field.key] = field;\n if (field.featured) {\n this.featuredFields.push(field);\n }\n });\n\n this.featuredFields.sort((a, b) => {\n return b.priority - a.priority;\n });\n\n this.keyedAssets['fields'].sort();\n\n this.fireCustomEvent(CustomEventType.StoreUpdated, {\n url: this.fieldsEndpoint,\n data: this.keyedAssets['fields'],\n });\n });\n }\n\n public getShortDuration(\n scheduled: DateTime,\n compareDate: DateTime = null,\n showSeconds = false\n ) {\n const now = compareDate || DateTime.now();\n const duration = scheduled.diff(now).valueOf();\n\n if (showSeconds) {\n return this.humanizer.humanize(duration, {\n language: this.getLanguageCode(),\n largest: 1,\n round: true,\n });\n }\n\n if (Math.abs(duration) < 60000) {\n return 'just now';\n }\n\n return this.humanizer.humanize(duration, {\n language: this.getLanguageCode(),\n largest: 1,\n round: false,\n });\n }\n\n public getShortDurationFromIso(\n isoDateA: string,\n isoDateB: string = null,\n showSeconds = false\n ) {\n const scheduled = DateTime.fromISO(isoDateA);\n const now = isoDateB ? DateTime.fromISO(isoDateB) : DateTime.now();\n return this.getShortDuration(scheduled, now, showSeconds);\n }\n\n public setKeyedAssets(name: string, values: string[]): void {\n this.keyedAssets[name] = values;\n }\n\n public updated(changedProperties: Map<string, any>) {\n super.updated(changedProperties);\n }\n\n public getCompletionSchema(): CompletionSchema {\n return this.schema;\n }\n\n public getFunctions(): CompletionOption[] {\n return this.fnOptions;\n }\n\n public getKeyedAssets(): KeyedAssets {\n return this.keyedAssets;\n }\n\n public getFieldKeys(): string[] {\n return this.keyedAssets['fields'];\n }\n\n public getContactField(key: string): ContactField {\n return this.fields[key];\n }\n\n public getFeaturedFields(): ContactField[] {\n return this.featuredFields;\n }\n\n public getLanguageName(iso: string) {\n return this.languages[iso];\n }\n\n public isDynamicGroup(uuid: string): boolean {\n const group = this.groups[uuid];\n if (group && group.query) {\n return true;\n }\n return false;\n }\n\n public getWorkspace(): Workspace {\n return this.workspace;\n }\n\n public formatDate(dateString: string) {\n return new Date(dateString).toLocaleString(this.locale, {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n });\n }\n\n public postUrl(\n url: string,\n payload: any = '',\n headers: any = {},\n contentType = null\n ) {\n return postUrl(url, payload, headers, contentType);\n }\n\n public getUrl(\n url: string,\n options?: {\n force?: boolean;\n controller?: AbortController;\n headers?: { [key: string]: string };\n }\n ): Promise<WebResponse> {\n options = options || {};\n if (!options.force && this.cache.has(url)) {\n return new Promise<WebResponse>(resolve => {\n resolve(this.cache.get(url));\n });\n }\n\n return getUrl(url, options.controller, options.headers || {}).then(\n (response: WebResponse) => {\n return new Promise<WebResponse>((resolve, reject) => {\n if (response.status >= 200 && response.status <= 300) {\n this.cache.set(url, response);\n resolve(response);\n } else {\n reject('Status: ' + response.status);\n }\n });\n }\n );\n }\n\n private pendingResolves = {};\n\n /**\n * Fetches all of the results for a given API endpoint with caching\n * @param url\n */\n public getResults(\n url: string,\n options?: { force?: boolean }\n ): Promise<any[]> {\n options = options || {};\n const key = 'results_' + url;\n const results = this.cache.get(key);\n\n if (!options.force && results) {\n return new Promise<any[]>(resolve => {\n resolve(results);\n });\n }\n\n return new Promise<any[]>(resolve => {\n const pending = this.pendingResolves[url] || [];\n pending.push(resolve);\n this.pendingResolves[url] = pending;\n if (pending.length <= 1) {\n fetchResults(url).then((results: any[]) => {\n this.cache.set(key, results);\n const pending = this.pendingResolves[url] || [];\n while (pending.length > 0) {\n const resolve = pending.pop();\n resolve(results);\n }\n });\n }\n });\n }\n\n public fetching: { [url: string]: number } = {};\n\n public updateCache(url: string, data: any) {\n this.cache.set(url, data);\n this.fireCustomEvent(CustomEventType.StoreUpdated, { url, data });\n }\n\n public makeRequest(\n url: string,\n options?: { force?: boolean; prepareData?: (data: any) => any }\n ) {\n const previousRequest = this.fetching[url];\n const now = new Date().getTime();\n // if the request was recently made, don't do anything\n if (previousRequest && now - previousRequest < 500) {\n return;\n }\n\n this.fetching[url] = now;\n options = options || {};\n const cached = this.cache.get(url);\n if (cached && !options.force) {\n this.fireCustomEvent(CustomEventType.StoreUpdated, { url, data: cached });\n } else {\n fetchResults(url).then(data => {\n data = options.prepareData ? options.prepareData(data) : data;\n this.cache.set(url, data);\n this.fireCustomEvent(CustomEventType.StoreUpdated, { url, data });\n delete this.fetching[url];\n });\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Store.js","sourceRoot":"","sources":["../../../src/store/Store.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,YAAY,EACZ,MAAM,EACN,SAAS,EAGT,OAAO,GACR,MAAM,UAAU,CAAC;AAClB,OAAO,EAML,eAAe,GAEhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EACL,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,OAAO,KAAM,SAAQ,YAAY;IAAvC;;QAEE,QAAG,GAAG,KAAK,CAAC;QAGZ,QAAG,GAAG,EAAE,CAAC;QA2BD,gBAAW,GAAgB,EAAE,CAAC;QAE9B,WAAM,GAAG,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;QAElC,WAAM,GAAoC,EAAE,CAAC;QAC7C,WAAM,GAAqC,EAAE,CAAC;QAC9C,cAAS,GAAQ,EAAE,CAAC;QAEpB,mBAAc,GAAmB,EAAE,CAAC;QAEpC,gBAAW,GAAG,IAAI,wBAAwB,EAAE,CAAC;QAC7C,cAAS,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,WAAW,CA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 'lit/decorators';\nimport {\n fetchResults,\n getUrl,\n getAssets,\n Asset,\n WebResponse,\n postUrl,\n} from '../utils';\nimport {\n ContactField,\n ContactGroup,\n CompletionOption,\n CompletionSchema,\n KeyedAssets,\n CustomEventType,\n Workspace,\n} from '../interfaces';\nimport { RapidElement } from '../RapidElement';\nimport Lru from 'tiny-lru';\nimport {\n HumanizeDurationLanguage,\n HumanizeDuration,\n} from 'humanize-duration-ts';\nimport { DateTime } from 'luxon';\n\nexport class Store extends RapidElement {\n @property({ type: Number })\n ttl = 60000;\n\n @property({ type: Number })\n max = 20;\n\n @property({ type: String, attribute: 'completion' })\n completionEndpoint: string;\n\n @property({ type: String, attribute: 'fields' })\n fieldsEndpoint: string;\n\n @property({ type: String, attribute: 'groups' })\n groupsEndpoint: string;\n\n @property({ type: String, attribute: 'globals' })\n globalsEndpoint: string;\n\n @property({ type: String, attribute: 'languages' })\n languagesEndpoint: string;\n\n @property({ type: String, attribute: 'workspace' })\n workspaceEndpoint: string;\n\n @property({ type: Object, attribute: false })\n private schema: CompletionSchema;\n\n @property({ type: Object, attribute: false })\n private fnOptions: CompletionOption[];\n\n @property({ type: Object, attribute: false })\n private keyedAssets: KeyedAssets = {};\n\n private locale = [...navigator.languages];\n\n private fields: { [key: string]: ContactField } = {};\n private groups: { [uuid: string]: ContactGroup } = {};\n private languages: any = {};\n private workspace: Workspace;\n private featuredFields: ContactField[] = [];\n\n private langService = new HumanizeDurationLanguage();\n private humanizer = new HumanizeDuration(this.langService);\n\n // http promise to monitor for completeness\n public httpComplete: Promise<void | WebResponse[]>;\n\n private cache: any;\n\n public getLocale() {\n return this.locale[0];\n }\n\n public reset() {\n this.cache = Lru(this.max, this.ttl);\n\n /* \n // This will create a shorthand unit\n this.humanizer.addLanguage(\"en\", {\n y: () => \"y\",\n mo: () => \"mo\",\n w: () => \"w\",\n d: () => \"d\",\n h: () => \"h\",\n m: () => \"m\",\n s: () => \"s\",\n ms: () => \"ms\",\n decimal: \".\",\n });\n */\n\n const fetches = [];\n if (this.completionEndpoint) {\n fetches.push(\n getUrl(this.completionEndpoint).then(response => {\n this.schema = response.json['context'] as CompletionSchema;\n this.fnOptions = response.json['functions'] as CompletionOption[];\n })\n );\n }\n\n if (this.fieldsEndpoint) {\n fetches.push(this.refreshFields());\n }\n\n if (this.globalsEndpoint) {\n fetches.push(\n getAssets(this.globalsEndpoint).then((assets: Asset[]) => {\n this.keyedAssets['globals'] = assets.map((asset: Asset) => asset.key);\n })\n );\n }\n\n if (this.languagesEndpoint) {\n fetches.push(\n getAssets(this.languagesEndpoint).then((results: any[]) => {\n // convert array of objects to lookup\n this.languages = results.reduce(function (\n languages: any,\n result: any\n ) {\n languages[result.value] = result.name;\n return languages;\n },\n {});\n })\n );\n }\n\n if (this.groupsEndpoint) {\n fetches.push(\n getAssets(this.groupsEndpoint).then((groups: any[]) => {\n groups.forEach((group: any) => {\n this.groups[group.uuid] = group;\n });\n })\n );\n }\n\n if (this.workspaceEndpoint) {\n fetches.push(\n getUrl(this.workspaceEndpoint).then((response: WebResponse) => {\n this.workspace = response.json;\n const lang = response.headers.get('content-language');\n if (lang) {\n this.locale = [lang, ...this.locale];\n }\n })\n );\n }\n\n this.httpComplete = Promise.all(fetches);\n }\n\n public firstUpdated() {\n this.reset();\n }\n\n public getLanguageCode() {\n if (this.locale.length > 0) {\n return this.locale[0].split('-')[0];\n }\n return 'en';\n }\n\n public refreshFields() {\n return getAssets(this.fieldsEndpoint).then((assets: Asset[]) => {\n this.keyedAssets['fields'] = [];\n this.featuredFields = [];\n\n assets.forEach((field: ContactField) => {\n this.keyedAssets['fields'].push(field.key);\n this.fields[field.key] = field;\n if (field.featured) {\n this.featuredFields.push(field);\n }\n });\n\n this.featuredFields.sort((a, b) => {\n return b.priority - a.priority;\n });\n\n this.keyedAssets['fields'].sort();\n\n this.fireCustomEvent(CustomEventType.StoreUpdated, {\n url: this.fieldsEndpoint,\n data: this.keyedAssets['fields'],\n });\n });\n }\n\n public getShortDuration(scheduled: DateTime, compareDate: DateTime = null) {\n const now = compareDate || DateTime.now();\n return scheduled\n .setLocale(this.locale[0])\n .toRelative({ base: now, style: 'long' });\n }\n\n public getShortDurationFromIso(isoDateA: string, isoDateB: string = null) {\n const scheduled = DateTime.fromISO(isoDateA);\n const now = isoDateB ? DateTime.fromISO(isoDateB) : DateTime.now();\n return this.getShortDuration(scheduled, now);\n }\n\n public setKeyedAssets(name: string, values: string[]): void {\n this.keyedAssets[name] = values;\n }\n\n public updated(changedProperties: Map<string, any>) {\n super.updated(changedProperties);\n }\n\n public getCompletionSchema(): CompletionSchema {\n return this.schema;\n }\n\n public getFunctions(): CompletionOption[] {\n return this.fnOptions;\n }\n\n public getKeyedAssets(): KeyedAssets {\n return this.keyedAssets;\n }\n\n public getFieldKeys(): string[] {\n return this.keyedAssets['fields'];\n }\n\n public getContactField(key: string): ContactField {\n return this.fields[key];\n }\n\n public getFeaturedFields(): ContactField[] {\n return this.featuredFields;\n }\n\n public getLanguageName(iso: string) {\n return this.languages[iso];\n }\n\n public isDynamicGroup(uuid: string): boolean {\n const group = this.groups[uuid];\n if (group && group.query) {\n return true;\n }\n return false;\n }\n\n public getWorkspace(): Workspace {\n return this.workspace;\n }\n\n public formatDate(dateString: string) {\n return DateTime.fromISO(dateString)\n .setLocale(this.getLocale())\n .toLocaleString(DateTime.DATETIME_SHORT);\n }\n\n public postUrl(\n url: string,\n payload: any = '',\n headers: any = {},\n contentType = null\n ) {\n return postUrl(url, payload, headers, contentType);\n }\n\n public getUrl(\n url: string,\n options?: {\n force?: boolean;\n controller?: AbortController;\n headers?: { [key: string]: string };\n }\n ): Promise<WebResponse> {\n options = options || {};\n if (!options.force && this.cache.has(url)) {\n return new Promise<WebResponse>(resolve => {\n resolve(this.cache.get(url));\n });\n }\n\n return getUrl(url, options.controller, options.headers || {}).then(\n (response: WebResponse) => {\n return new Promise<WebResponse>((resolve, reject) => {\n if (response.status >= 200 && response.status <= 300) {\n this.cache.set(url, response);\n resolve(response);\n } else {\n reject('Status: ' + response.status);\n }\n });\n }\n );\n }\n\n private pendingResolves = {};\n\n /**\n * Fetches all of the results for a given API endpoint with caching\n * @param url\n */\n public getResults(\n url: string,\n options?: { force?: boolean }\n ): Promise<any[]> {\n options = options || {};\n const key = 'results_' + url;\n const results = this.cache.get(key);\n\n if (!options.force && results) {\n return new Promise<any[]>(resolve => {\n resolve(results);\n });\n }\n\n return new Promise<any[]>(resolve => {\n const pending = this.pendingResolves[url] || [];\n pending.push(resolve);\n this.pendingResolves[url] = pending;\n if (pending.length <= 1) {\n fetchResults(url).then((results: any[]) => {\n this.cache.set(key, results);\n const pending = this.pendingResolves[url] || [];\n while (pending.length > 0) {\n const resolve = pending.pop();\n resolve(results);\n }\n });\n }\n });\n }\n\n public fetching: { [url: string]: number } = {};\n\n public updateCache(url: string, data: any) {\n this.cache.set(url, data);\n this.fireCustomEvent(CustomEventType.StoreUpdated, { url, data });\n }\n\n public makeRequest(\n url: string,\n options?: { force?: boolean; prepareData?: (data: any) => any }\n ) {\n const previousRequest = this.fetching[url];\n const now = new Date().getTime();\n // if the request was recently made, don't do anything\n if (previousRequest && now - previousRequest < 500) {\n return;\n }\n\n this.fetching[url] = now;\n options = options || {};\n const cached = this.cache.get(url);\n if (cached && !options.force) {\n this.fireCustomEvent(CustomEventType.StoreUpdated, { url, data: cached });\n } else {\n fetchResults(url).then(data => {\n data = options.prepareData ? options.prepareData(data) : data;\n this.cache.set(url, data);\n this.fireCustomEvent(CustomEventType.StoreUpdated, { url, data });\n delete this.fetching[url];\n });\n }\n }\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export var Icon;
|
|
2
2
|
(function (Icon) {
|
|
3
|
+
Icon["analytics"] = "bar-chart-01";
|
|
3
4
|
Icon["account"] = "user-01";
|
|
4
5
|
Icon["active"] = "play";
|
|
5
6
|
Icon["add_note"] = "file-02";
|
|
@@ -56,9 +57,11 @@ export var Icon;
|
|
|
56
57
|
Icon["org_new"] = "stars-02";
|
|
57
58
|
Icon["org_suspended"] = "slash-circle-01";
|
|
58
59
|
Icon["org_verified"] = "check-verified-02";
|
|
60
|
+
Icon["overview"] = "pie-chart-01";
|
|
59
61
|
Icon["featured"] = "star-01";
|
|
60
62
|
Icon["resthooks"] = "share-07";
|
|
61
63
|
Icon["restore"] = "play";
|
|
64
|
+
Icon["runs"] = "rows-03";
|
|
62
65
|
Icon["search"] = "search-refraction";
|
|
63
66
|
Icon["select_open"] = "chevron-down";
|
|
64
67
|
Icon["select_clear"] = "x";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/vectoricon/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/vectoricon/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,IAyFX;AAzFD,WAAY,IAAI;IACd,kCAA0B,CAAA;IAC1B,2BAAmB,CAAA;IACnB,uBAAe,CAAA;IACf,4BAAoB,CAAA;IACpB,gCAAwB,CAAA;IACxB,2BAAmB,CAAA;IACnB,+BAAuB,CAAA;IACvB,mCAA2B,CAAA;IAC3B,mCAA2B,CAAA;IAC3B,qCAA6B,CAAA;IAC7B,gCAAwB,CAAA;IACxB,qCAA6B,CAAA;IAC7B,8BAAsB,CAAA;IACtB,qCAA6B,CAAA;IAC7B,kCAA0B,CAAA;IAC1B,mCAA2B,CAAA;IAC3B,uBAAe,CAAA;IACf,2BAAmB,CAAA;IACnB,yCAAiC,CAAA;IACjC,2BAAmB,CAAA;IACnB,4CAAoC,CAAA;IACpC,yCAAiC,CAAA;IACjC,qCAA6B,CAAA;IAC7B,4BAAoB,CAAA;IACpB,wBAAgB,CAAA;IAChB,2BAAmB,CAAA;IACnB,0BAAkB,CAAA;IAClB,gCAAwB,CAAA;IACxB,yBAAiB,CAAA;IACjB,8BAAsB,CAAA;IACtB,qBAAa,CAAA;IACb,4BAAoB,CAAA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art-01',\n account = 'user-01',\n active = 'play',\n add_note = 'file-02',\n airtime = 'bank-note-01',\n archive = 'archive',\n arrow_up = 'chevron-up',\n arrow_down = 'chevron-down',\n arrow_left = 'chevron-left',\n arrow_right = 'chevron-right',\n attachment = 'paperclip',\n broadcast = 'announcement-01',\n call = 'phone-call-01',\n call_missed = 'phone-call-02',\n campaign = 'clock-refresh',\n campaigns = 'clock-refresh',\n check = 'check',\n checkbox = 'square',\n checkbox_checked = 'check-square',\n contact = 'user-01',\n contact_blocked = 'message-x-square',\n contact_stopped = 'slash-octagon',\n contact_updated = 'user-edit',\n contacts = 'user-01',\n copy = 'copy-04',\n delete = 'trash-03',\n delete_small = 'x',\n download = 'download-01',\n email = 'mail-01',\n error = 'alert-circle',\n event = 'zap',\n fields = 'user-edit',\n flow = 'flow',\n flow_interrupted = 'x-close',\n flow_ivr = 'phone-call-01',\n flow_message = 'message-square-02',\n flow_user = 'activity',\n flows = 'flow',\n group = 'users-01',\n group_smart = 'atom-01',\n help = 'help-circle',\n inbox = 'inbox-01',\n label = 'tag-01',\n language = 'globe-01',\n link = 'link-external-01',\n log = 'file-02',\n menu = 'menu-01',\n menu_collapse = 'chevron-left-double',\n message = 'message-square-02',\n messages = 'message-square-02',\n org_active = 'credit-card-02',\n org_anonymous = 'glasses-01',\n org_bulk = 'credit-card-plus',\n org_flagged = 'flag-01',\n org_new = 'stars-02',\n org_suspended = 'slash-circle-01',\n org_verified = 'check-verified-02',\n overview = 'pie-chart-01',\n featured = 'star-01',\n resthooks = 'share-07',\n restore = 'play',\n runs = 'rows-03',\n search = 'search-refraction',\n select_open = 'chevron-down',\n select_clear = 'x',\n service = 'magic-wand-01',\n settings = 'settings-02',\n sort = 'chevron-selector-vertical',\n staff = 'hard-drive',\n tickets = 'agent',\n tickets_all = 'archive',\n tickets_closed = 'check',\n tickets_mine = 'coffee',\n tickets_open = 'inbox-01',\n tickets_unassigned = 'inbox-01',\n two_factor_enabled = 'shield-02',\n two_factor_disabled = 'shield-01',\n trigger = 'signal-01',\n triggers = 'signal-01',\n updated = 'edit-02',\n upload = 'upload-cloud-01',\n usages = 'link-04',\n user = 'users-01',\n users = 'users-01',\n user_beta = 'shield-zap',\n webhook = 'link-external-01',\n workspace = 'folder',\n zendesk = 'zendesk',\n}\n"]}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { fixture, assert, expect } from '@open-wc/testing';
|
|
2
|
-
import * as sinon from 'sinon';
|
|
3
2
|
import { ContactHistory } from '../src/contacts/ContactHistory';
|
|
4
|
-
import {
|
|
5
|
-
import { assertScreenshot, getClip, getHTML, mockGET, } from '../test/utils.test';
|
|
3
|
+
import { assertScreenshot, getClip, getHTML, loadStore, mockGET, mockNow, } from '../test/utils.test';
|
|
6
4
|
import './utils.test';
|
|
7
5
|
export const createHistory = async (def) => {
|
|
8
6
|
const parentNode = document.createElement('div');
|
|
@@ -26,13 +24,12 @@ const getHistoryClip = (ele) => {
|
|
|
26
24
|
return clip;
|
|
27
25
|
};
|
|
28
26
|
// stub our current date for consistent screenshots
|
|
29
|
-
|
|
30
|
-
return new Date('2021-03-31T00:00:00.000-00:00');
|
|
31
|
-
});
|
|
27
|
+
mockNow('2021-03-31T00:31:00.000-00:00');
|
|
32
28
|
describe('temba-contact-history', () => {
|
|
33
|
-
beforeEach(() => {
|
|
29
|
+
beforeEach(async () => {
|
|
34
30
|
mockGET(/\/contact\/history\/contact-dave-active\/.*/, '/test-assets/contacts/history.json');
|
|
35
31
|
mockGET(/\/api\/v2\/tickets\.json\?contact=contact-dave-active/, '/test-assets/api/tickets.json');
|
|
32
|
+
await loadStore();
|
|
36
33
|
});
|
|
37
34
|
it('can be created', async () => {
|
|
38
35
|
const history = await createHistory(getHistoryHTML());
|
|
@@ -46,7 +43,7 @@ describe('temba-contact-history', () => {
|
|
|
46
43
|
// we should have scrolled to the bottom
|
|
47
44
|
const events = history.shadowRoot.querySelector('.events');
|
|
48
45
|
const top = events.scrollHeight - events.getBoundingClientRect().height;
|
|
49
|
-
expect(top).to.equal(
|
|
46
|
+
expect(top).to.equal(549);
|
|
50
47
|
// make sure we actually scrolled to there
|
|
51
48
|
expect(events.scrollTop).to.equal(top);
|
|
52
49
|
await assertScreenshot('contacts/history', getHistoryClip(history));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"temba-contact-history.test.js","sourceRoot":"","sources":["../../test/temba-contact-history.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"temba-contact-history.test.js","sourceRoot":"","sources":["../../test/temba-contact-history.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EACL,gBAAgB,EAChB,OAAO,EACP,OAAO,EACP,SAAS,EACT,OAAO,EACP,OAAO,GACR,MAAM,oBAAoB,CAAC;AAC5B,OAAO,cAAc,CAAC;AAEtB,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,GAAW,EAAE,EAAE;IACjD,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACjD,UAAU,CAAC,YAAY,CACrB,OAAO,EACP,wFAAwF,CACzF,CAAC;IACF,MAAM,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE,CAAC,CAAmB,CAAC;IAEvE,0CAA0C;IAC1C,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;IACjB,MAAM,OAAO,CAAC,YAAY,CAAC;IAE3B,yBAAyB;IACzB,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;IACjB,MAAM,OAAO,CAAC,YAAY,CAAC;IAE3B,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,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MAAM,GAAG,GAAG,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC,qBAAqB,EAAE,CAAC,MAAM,CAAC;QAExE,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAE1B,0CAA0C;QAC1C,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEvC,MAAM,gBAAgB,CAAC,kBAAkB,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;QACpC,MAAM,OAAO,GAAG,MAAM,aAAa,CACjC,cAAc,CAAC;YACb,IAAI,EAAE,qBAAqB;SAC5B,CAAC,CACH,CAAC;QAEF,mCAAmC;QACnC,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACzB,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;YACxB,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CAC5C,kCAAkC,GAAG,IAAI,CACxB,CAAC;YACpB,KAAK,CAAC,KAAK,EAAE,CAAC;SACf;QAED,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;QAEnB,MAAM,gBAAgB,CACpB,2BAA2B,EAC3B,cAAc,CAAC,OAAO,CAAC,CACxB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { fixture, assert, expect } from '@open-wc/testing';\nimport { ContactHistory } from '../src/contacts/ContactHistory';\nimport {\n assertScreenshot,\n getClip,\n getHTML,\n loadStore,\n mockGET,\n mockNow,\n} from '../test/utils.test';\nimport './utils.test';\n\nexport const createHistory = async (def: string) => {\n const parentNode = document.createElement('div');\n parentNode.setAttribute(\n 'style',\n 'width: 500px;height:750px;display:flex;flex-direction:column;flex-grow:1;min-height:0;'\n );\n const history = (await fixture(def, { parentNode })) as ContactHistory;\n\n // let history fetch start and wait for it\n await waitFor(0);\n await history.httpComplete;\n\n // wait for scroll update\n await waitFor(0);\n await history.httpComplete;\n\n return history;\n};\n\nconst getHistoryHTML = (attrs: any = {} as any) =>\n // attrs = \"min-height:0;display:flex;flex-grow:1;flex-direction:column\";\n getHTML('temba-contact-history', attrs);\n\nconst getHistoryClip = (ele: ContactHistory) => {\n const clip = getClip(ele);\n clip.height = Math.min(clip.height, 750);\n clip.bottom = clip.top + clip.height;\n return clip;\n};\n\n// stub our current date for consistent screenshots\nmockNow('2021-03-31T00:31:00.000-00:00');\n\ndescribe('temba-contact-history', () => {\n beforeEach(async () => {\n mockGET(\n /\\/contact\\/history\\/contact-dave-active\\/.*/,\n '/test-assets/contacts/history.json'\n );\n\n mockGET(\n /\\/api\\/v2\\/tickets\\.json\\?contact=contact-dave-active/,\n '/test-assets/api/tickets.json'\n );\n\n await loadStore();\n });\n\n it('can be created', async () => {\n const history = await createHistory(getHistoryHTML());\n assert.instanceOf(history, ContactHistory);\n });\n\n it('renders history', async () => {\n const history = await createHistory(\n getHistoryHTML({\n uuid: 'contact-dave-active',\n })\n );\n\n await waitFor(500);\n\n // we should have scrolled to the bottom\n const events = history.shadowRoot.querySelector('.events');\n const top = events.scrollHeight - events.getBoundingClientRect().height;\n\n expect(top).to.equal(549);\n\n // make sure we actually scrolled to there\n expect(events.scrollTop).to.equal(top);\n\n await assertScreenshot('contacts/history', getHistoryClip(history));\n });\n\n it('expands event groups', async () => {\n const history = await createHistory(\n getHistoryHTML({\n uuid: 'contact-dave-active',\n })\n );\n\n // our groups with collapsed events\n const groups = [3, 5, 7];\n for (const idx of groups) {\n const group = history.shadowRoot.querySelector(\n `.event-count[data-group-index='${idx}']`\n ) as HTMLDivElement;\n group.click();\n }\n\n await waitFor(800);\n\n await assertScreenshot(\n 'contacts/history-expanded',\n getHistoryClip(history)\n );\n });\n});\n"]}
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { assertScreenshot, getClip, getComponent, loadStore, } from './utils.test';
|
|
3
|
-
import { DateTime } from 'luxon';
|
|
1
|
+
import { assertScreenshot, getClip, getComponent, loadStore, mockNow, } from './utils.test';
|
|
4
2
|
import { expect } from '@open-wc/testing';
|
|
5
3
|
const TAG = 'temba-date';
|
|
6
4
|
export const getDate = async (attrs = {}) => {
|
|
7
5
|
attrs['width'] = 100;
|
|
8
6
|
return (await getComponent(TAG, attrs));
|
|
9
7
|
};
|
|
10
|
-
|
|
11
|
-
const now = DateTime.fromISO('2022-12-02T21:00:00.000000-07:00');
|
|
12
|
-
sinon.replace(DateTime, 'now', () => {
|
|
13
|
-
return now;
|
|
14
|
-
});
|
|
8
|
+
mockNow('2022-12-02T21:00:00.000000-07:00');
|
|
15
9
|
describe('temba-date', () => {
|
|
16
10
|
beforeEach(() => {
|
|
17
11
|
loadStore();
|
|
@@ -29,7 +23,7 @@ describe('temba-date', () => {
|
|
|
29
23
|
});
|
|
30
24
|
const dateString = date.shadowRoot.querySelector('.date').innerText;
|
|
31
25
|
await assertScreenshot('date/duration', getClip(date));
|
|
32
|
-
expect(dateString).to.equal('44 years');
|
|
26
|
+
expect(dateString).to.equal('44 years ago');
|
|
33
27
|
});
|
|
34
28
|
it('renders datetime', async () => {
|
|
35
29
|
const date = await getDate({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"temba-date.test.js","sourceRoot":"","sources":["../../test/temba-date.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"temba-date.test.js","sourceRoot":"","sources":["../../test/temba-date.test.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,OAAO,EACP,YAAY,EACZ,SAAS,EACT,OAAO,GACR,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,MAAM,GAAG,GAAG,YAAY,CAAC;AAEzB,MAAM,CAAC,MAAM,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E;QAChC,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC;YACzB,KAAK,EAAE,kCAAkC;YACzC,OAAO,EAAE,UAAU;SACpB,CAAC,CAAC;QACH,MAAM,UAAU,GACd,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,CACtC,CAAC,SAAS,CAAC;QAEZ,MAAM,gBAAgB,CAAC,eAAe,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACvD,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { TembaDate } from '../src/date/TembaDate';\nimport {\n assertScreenshot,\n getClip,\n getComponent,\n loadStore,\n mockNow,\n} from './utils.test';\nimport { expect } from '@open-wc/testing';\n\nconst TAG = 'temba-date';\n\nexport const getDate = async (attrs: any = {}) => {\n attrs['width'] = 100;\n return (await getComponent(TAG, attrs)) as TembaDate;\n};\n\nmockNow('2022-12-02T21:00:00.000000-07:00');\n\ndescribe('temba-date', () => {\n beforeEach(() => {\n loadStore();\n });\n\n it('renders default', async () => {\n const date = await getDate({ value: '1978-11-18T02:22:00.000000-07:00' });\n const dateString = (\n date.shadowRoot.querySelector('.date') as HTMLDivElement\n ).innerText;\n\n await assertScreenshot('date/date', getClip(date));\n expect(dateString).to.equal('11/18/1978');\n });\n\n it('renders duration', async () => {\n const date = await getDate({\n value: '1978-11-18T02:22:00.000000-07:00',\n display: 'duration',\n });\n const dateString = (\n date.shadowRoot.querySelector('.date') as HTMLDivElement\n ).innerText;\n\n await assertScreenshot('date/duration', getClip(date));\n expect(dateString).to.equal('44 years ago');\n });\n\n it('renders datetime', async () => {\n const date = await getDate({\n value: '1978-11-18T02:22:00.000000-07:00',\n display: 'datetime',\n });\n const dateString = (\n date.shadowRoot.querySelector('.date') as HTMLDivElement\n ).innerText;\n\n await assertScreenshot('date/datetime', getClip(date));\n expect(dateString).to.equal('11/18/1978, 9:22 AM');\n });\n});\n"]}
|