@meetelise/chat 1.20.152 → 1.20.153
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/public/dist/index.js
CHANGED
|
@@ -239,17 +239,22 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
|
|
|
239
239
|
opacity: 30%;
|
|
240
240
|
}
|
|
241
241
|
`,Wt([ue({attribute:"month",type:String})],Qt.prototype,"defaultMonth",void 0),Wt([ue({attribute:"year",type:Number})],Qt.prototype,"defaultYear",void 0),Wt([ue({attribute:!1})],Qt.prototype,"availabilities",void 0),Wt([ue({attribute:!1})],Qt.prototype,"selectedDate",null),Wt([le()],Qt.prototype,"monthShown",null),Wt([le()],Qt.prototype,"yearShown",void 0),Qt=Wt([ae("date-picker")],Qt);const Vt=(e,t)=>{const n=[];for(let i=0;i<t.length;i+=e)n.push(t.slice(i,i+e));return n};var Kt=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};const Xt=(e,t)=>e.reduce((function(e,t){return e[t.displayTime]=t,e}),{})[t];let Yt=class extends re{constructor(){super(...arguments),this.options=[],this.selectedDateExists=!1}get selectedTime(){return this.selected}render(){var e,t;return 1===(null===(e=this.options)||void 0===e?void 0:e.length)&&(this.selected=Xt(this.options,this.options[0].displayTime)),(null===(t=this.options)||void 0===t?void 0:t.length)?U`
|
|
242
|
-
<div
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
242
|
+
<div>
|
|
243
|
+
<div
|
|
244
|
+
id="optionContainer"
|
|
245
|
+
@click="${e=>{const t=e.target;(null==t?void 0:t.closest(".option:not(.selected)"))&&(this.selected=Xt(this.options,t.innerText)),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}}"
|
|
246
|
+
@keydown="${e=>{var t;const n=e.target;[" ","Enter"].includes(e.key)&&(null==n?void 0:n.closest(".option"))&&(e.preventDefault(),this.selected=n.innerText!==(null===(t=this.selected)||void 0===t?void 0:t.displayTime)?Xt(this.options,n.innerText):void 0,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}}"
|
|
247
|
+
>
|
|
248
|
+
${this.options.map((e=>{var t;return U`<div
|
|
249
|
+
class="option ${fe({selected:(null===(t=this.selected)||void 0===t?void 0:t.displayTime)===e.displayTime})}"
|
|
250
|
+
tabindex="0"
|
|
251
|
+
>
|
|
252
|
+
<span>${e.displayTime}</span>
|
|
253
|
+
</div>`}))}
|
|
254
|
+
</div>
|
|
255
|
+
<p class="timezone-display-text">
|
|
256
|
+
*All times displayed in ${(()=>{const e=new Date,t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=(e=>{const t=new Date(e.getFullYear(),0,1),n=new Date(e.getFullYear(),6,1),i=Math.max(t.getTimezoneOffset(),n.getTimezoneOffset());return e.getTimezoneOffset()<i})(e);switch(t){case"America/New_York":case"America/Indiana/Indianapolis":return n?"EDT":"EST";case"America/Chicago":case"America/Indiana/Knox":return n?"CDT":"CST";case"America/Denver":return n?"MDT":"MST";case"America/Los_Angeles":return n?"PDT":"PST";case"America/Anchorage":return n?"AKDT":"AKST";case"America/Honolulu":return"HST";case"America/Phoenix":return"MST";default:return"Unknown"}})()}
|
|
257
|
+
</p>
|
|
253
258
|
</div>
|
|
254
259
|
`:U` <div id="noAvailabilityText">
|
|
255
260
|
${this.selectedDateExists?U`<p>No available appointments for this day</p>`:U`<p>
|
|
@@ -265,6 +270,11 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
|
|
|
265
270
|
font-family: "Helvetica Neue", Arial;
|
|
266
271
|
}
|
|
267
272
|
|
|
273
|
+
.timezone-display-text {
|
|
274
|
+
font-size: 11px;
|
|
275
|
+
opacity: 0.5;
|
|
276
|
+
}
|
|
277
|
+
|
|
268
278
|
#optionContainer {
|
|
269
279
|
display: flex;
|
|
270
280
|
flex-wrap: wrap;
|
|
@@ -981,11 +991,13 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
981
991
|
.availabilities=${qn()(this.availabilitiesGroupedByDay,(e=>e.map((e=>new Date(e.offset)))))}
|
|
982
992
|
@change=${e=>{this.tourType===ai.Self&&this.sgtUrl?window.open(this.sgtUrl,"_blank"):this.tourType===ai.Guided&&this.escortedToursLink?window.open(this.escortedToursLink,"_blank"):this.tourType===ai.Virtual&&this.virtualToursLink?window.open(this.virtualToursLink,"_blank"):e.target instanceof Qt&&(this.selectedDate=e.target.selectedDate)}}
|
|
983
993
|
></date-picker>
|
|
984
|
-
<
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
994
|
+
<div>
|
|
995
|
+
<time-picker
|
|
996
|
+
?selecteddateexists=${!!this.selectedDate}
|
|
997
|
+
.options=${this.selectedDate?null===(e=this.availabilitiesGroupedByDay[Lt(this.selectedDate,"y-MM-dd")])||void 0===e?void 0:e.sort(((e,t)=>function(e,t){Ue(2,arguments);var n=qe(e),i=qe(t),r=n.getTime()-i.getTime();return r<0?-1:r>0?1:r}(yn(e.datetime),yn(t.datetime)))).map((e=>({dateWithTimeZoneOffset:e,displayTime:Lt(yn(`${e.datetime}${e.offset}`),"h:mmaaa")}))):[]}
|
|
998
|
+
@change=${e=>{if(e.target instanceof Yt){if(!this.selectedDate)return;const t=this.availabilitiesGroupedByDay[Lt(new Date(this.selectedDate),"y-MM-dd")],n=e.target.selectedTime?t.indexOf(e.target.selectedTime.dateWithTimeZoneOffset):null;this.selectedTime=null!==n?t[n]:null}}}
|
|
999
|
+
></time-picker>
|
|
1000
|
+
</div>
|
|
989
1001
|
</div>
|
|
990
1002
|
</div>`}closeButton(){return U`<button id="close-button" @click=${this.onCloseClicked}>
|
|
991
1003
|
<svg
|
|
@@ -2,6 +2,7 @@ import { LitElement, html, TemplateResult, css } from "lit";
|
|
|
2
2
|
import { customElement, property, state } from "lit/decorators.js";
|
|
3
3
|
import { classMap } from "lit/directives/class-map.js";
|
|
4
4
|
import { DateWithTimeZoneOffset } from "../../getAvailabilities";
|
|
5
|
+
import { getTimezoneAbbreviation } from "../../getTimezoneString";
|
|
5
6
|
|
|
6
7
|
export type TimePickerOption = {
|
|
7
8
|
displayTime: string;
|
|
@@ -44,6 +45,11 @@ export class TimePicker extends LitElement {
|
|
|
44
45
|
font-family: "Helvetica Neue", Arial;
|
|
45
46
|
}
|
|
46
47
|
|
|
48
|
+
.timezone-display-text {
|
|
49
|
+
font-size: 11px;
|
|
50
|
+
opacity: 0.5;
|
|
51
|
+
}
|
|
52
|
+
|
|
47
53
|
#optionContainer {
|
|
48
54
|
display: flex;
|
|
49
55
|
flex-wrap: wrap;
|
|
@@ -113,48 +119,57 @@ export class TimePicker extends LitElement {
|
|
|
113
119
|
}
|
|
114
120
|
return this.options?.length
|
|
115
121
|
? html`
|
|
116
|
-
<div
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
this.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
new Event("change", { bubbles: true, composed: true })
|
|
128
|
-
);
|
|
129
|
-
}}"
|
|
130
|
-
@keydown="${(e: KeyboardEvent) => {
|
|
131
|
-
const target = e.target as HTMLElement | undefined;
|
|
132
|
-
if (
|
|
133
|
-
[" ", "Enter"].includes(e.key) &&
|
|
134
|
-
target?.closest(".option")
|
|
135
|
-
) {
|
|
136
|
-
e.preventDefault();
|
|
137
|
-
this.selected =
|
|
138
|
-
target.innerText !== this.selected?.displayTime
|
|
139
|
-
? getDateWithTimezoneOffset(this.options, target.innerText)
|
|
140
|
-
: undefined;
|
|
122
|
+
<div>
|
|
123
|
+
<div
|
|
124
|
+
id="optionContainer"
|
|
125
|
+
@click="${(e: MouseEvent) => {
|
|
126
|
+
const target = e.target as HTMLElement | undefined;
|
|
127
|
+
|
|
128
|
+
if (target?.closest(".option:not(.selected)"))
|
|
129
|
+
this.selected = getDateWithTimezoneOffset(
|
|
130
|
+
this.options,
|
|
131
|
+
target.innerText
|
|
132
|
+
);
|
|
141
133
|
this.dispatchEvent(
|
|
142
134
|
new Event("change", { bubbles: true, composed: true })
|
|
143
135
|
);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
136
|
+
}}"
|
|
137
|
+
@keydown="${(e: KeyboardEvent) => {
|
|
138
|
+
const target = e.target as HTMLElement | undefined;
|
|
139
|
+
if (
|
|
140
|
+
[" ", "Enter"].includes(e.key) &&
|
|
141
|
+
target?.closest(".option")
|
|
142
|
+
) {
|
|
143
|
+
e.preventDefault();
|
|
144
|
+
this.selected =
|
|
145
|
+
target.innerText !== this.selected?.displayTime
|
|
146
|
+
? getDateWithTimezoneOffset(
|
|
147
|
+
this.options,
|
|
148
|
+
target.innerText
|
|
149
|
+
)
|
|
150
|
+
: undefined;
|
|
151
|
+
this.dispatchEvent(
|
|
152
|
+
new Event("change", { bubbles: true, composed: true })
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
}}"
|
|
156
|
+
>
|
|
157
|
+
${this.options.map(
|
|
158
|
+
(option) =>
|
|
159
|
+
html`<div
|
|
160
|
+
class="option ${classMap({
|
|
161
|
+
selected:
|
|
162
|
+
this.selected?.displayTime === option.displayTime,
|
|
163
|
+
})}"
|
|
164
|
+
tabindex="0"
|
|
165
|
+
>
|
|
166
|
+
<span>${option.displayTime}</span>
|
|
167
|
+
</div>`
|
|
168
|
+
)}
|
|
169
|
+
</div>
|
|
170
|
+
<p class="timezone-display-text">
|
|
171
|
+
*All times displayed in ${getTimezoneAbbreviation()}
|
|
172
|
+
</p>
|
|
158
173
|
</div>
|
|
159
174
|
`
|
|
160
175
|
: html` <div id="noAvailabilityText">
|
|
@@ -644,42 +644,44 @@ export class TourScheduler extends LitElement {
|
|
|
644
644
|
}
|
|
645
645
|
}}
|
|
646
646
|
></date-picker>
|
|
647
|
-
<
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
.map((date) => {
|
|
657
|
-
return {
|
|
658
|
-
dateWithTimeZoneOffset: date,
|
|
659
|
-
displayTime: format(
|
|
660
|
-
parseISO(`${date.datetime}${date.offset}`),
|
|
661
|
-
"h:mmaaa"
|
|
662
|
-
),
|
|
663
|
-
};
|
|
664
|
-
})
|
|
665
|
-
: []}
|
|
666
|
-
@change=${(e: Event) => {
|
|
667
|
-
if (e.target instanceof TimePicker) {
|
|
668
|
-
if (!this.selectedDate) return;
|
|
669
|
-
const daysAvailabilities =
|
|
670
|
-
this.availabilitiesGroupedByDay[
|
|
671
|
-
format(new Date(this.selectedDate), "y-MM-dd")
|
|
672
|
-
];
|
|
673
|
-
const index = e.target.selectedTime
|
|
674
|
-
? daysAvailabilities.indexOf(
|
|
675
|
-
e.target.selectedTime.dateWithTimeZoneOffset
|
|
647
|
+
<div>
|
|
648
|
+
<time-picker
|
|
649
|
+
?selecteddateexists=${!!this.selectedDate}
|
|
650
|
+
.options=${this.selectedDate
|
|
651
|
+
? this.availabilitiesGroupedByDay[
|
|
652
|
+
format(this.selectedDate, "y-MM-dd")
|
|
653
|
+
]
|
|
654
|
+
?.sort((a, b) =>
|
|
655
|
+
compareAsc(parseISO(a.datetime), parseISO(b.datetime))
|
|
676
656
|
)
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
657
|
+
.map((date) => {
|
|
658
|
+
return {
|
|
659
|
+
dateWithTimeZoneOffset: date,
|
|
660
|
+
displayTime: format(
|
|
661
|
+
parseISO(`${date.datetime}${date.offset}`),
|
|
662
|
+
"h:mmaaa"
|
|
663
|
+
),
|
|
664
|
+
};
|
|
665
|
+
})
|
|
666
|
+
: []}
|
|
667
|
+
@change=${(e: Event) => {
|
|
668
|
+
if (e.target instanceof TimePicker) {
|
|
669
|
+
if (!this.selectedDate) return;
|
|
670
|
+
const daysAvailabilities =
|
|
671
|
+
this.availabilitiesGroupedByDay[
|
|
672
|
+
format(new Date(this.selectedDate), "y-MM-dd")
|
|
673
|
+
];
|
|
674
|
+
const index = e.target.selectedTime
|
|
675
|
+
? daysAvailabilities.indexOf(
|
|
676
|
+
e.target.selectedTime.dateWithTimeZoneOffset
|
|
677
|
+
)
|
|
678
|
+
: null;
|
|
679
|
+
this.selectedTime =
|
|
680
|
+
index !== null ? daysAvailabilities[index] : null;
|
|
681
|
+
}
|
|
682
|
+
}}
|
|
683
|
+
></time-picker>
|
|
684
|
+
</div>
|
|
683
685
|
</div>
|
|
684
686
|
</div>`;
|
|
685
687
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const isDaylightSavingTime = (date: Date): boolean => {
|
|
2
|
+
const jan = new Date(date.getFullYear(), 0, 1);
|
|
3
|
+
const jul = new Date(date.getFullYear(), 6, 1);
|
|
4
|
+
const stdTimezoneOffset = Math.max(
|
|
5
|
+
jan.getTimezoneOffset(),
|
|
6
|
+
jul.getTimezoneOffset()
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
return date.getTimezoneOffset() < stdTimezoneOffset;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const getTimezoneAbbreviation = (): string => {
|
|
13
|
+
const date = new Date();
|
|
14
|
+
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
15
|
+
const isDST = isDaylightSavingTime(date);
|
|
16
|
+
|
|
17
|
+
switch (timeZone) {
|
|
18
|
+
case "America/New_York":
|
|
19
|
+
return isDST ? "EDT" : "EST";
|
|
20
|
+
case "America/Chicago":
|
|
21
|
+
return isDST ? "CDT" : "CST";
|
|
22
|
+
case "America/Denver":
|
|
23
|
+
return isDST ? "MDT" : "MST";
|
|
24
|
+
case "America/Los_Angeles":
|
|
25
|
+
return isDST ? "PDT" : "PST";
|
|
26
|
+
case "America/Anchorage":
|
|
27
|
+
return isDST ? "AKDT" : "AKST";
|
|
28
|
+
case "America/Honolulu":
|
|
29
|
+
return "HST";
|
|
30
|
+
case "America/Phoenix":
|
|
31
|
+
return "MST";
|
|
32
|
+
case "America/Indiana/Indianapolis":
|
|
33
|
+
return isDST ? "EDT" : "EST";
|
|
34
|
+
case "America/Indiana/Knox":
|
|
35
|
+
return isDST ? "CDT" : "CST";
|
|
36
|
+
default:
|
|
37
|
+
return "Unknown";
|
|
38
|
+
}
|
|
39
|
+
};
|