@nylas/web-elements 0.0.0-canary-20241015194719 → 0.0.0-canary-20241017202051
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/dist/cdn/input-image-url/input-image-url.es.js +365 -365
- package/dist/cdn/nylas-additional-participants/nylas-additional-participants.es.js +46 -48
- package/dist/cdn/nylas-confirmation-email/nylas-confirmation-email.es.js +86 -82
- package/dist/cdn/nylas-custom-booking-flow/nylas-custom-booking-flow.es.js +1 -1
- package/dist/cdn/nylas-editor-tabs/nylas-editor-tabs.es.js +4710 -4700
- package/dist/cdn/nylas-event-duration/nylas-event-duration.es.js +228 -228
- package/dist/cdn/nylas-event-info/nylas-event-info.es.js +2 -2
- package/dist/cdn/nylas-event-limits/nylas-event-limits.es.js +2 -2
- package/dist/cdn/nylas-form-card/nylas-form-card.es.js +1 -1
- package/dist/cdn/nylas-reminder-emails/nylas-reminder-emails.es.js +2289 -2281
- package/dist/cdn/nylas-reminder-time/nylas-reminder-time.es.js +2253 -2245
- package/dist/cdn/nylas-scheduler-editor/nylas-scheduler-editor.es.js +53 -43
- package/dist/cdn/nylas-scheduling/nylas-scheduling.es.js +4 -3
- package/dist/cdn/nylas-timeslot-picker/nylas-timeslot-picker.es.js +4 -3
- package/dist/cjs/calendar-agenda-fill-icon_54.cjs.entry.js +60 -54
- package/dist/cjs/calendar-agenda-fill-icon_54.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/nylas-booked-event-card_12.cjs.entry.js +2 -2
- package/dist/cjs/nylas-booked-event-card_12.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-form-card.cjs.entry.js +1 -1
- package/dist/cjs/nylas-web-elements.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/design-system/input-image-url/input-image-url.js +20 -2
- package/dist/collection/components/design-system/input-image-url/input-image-url.js.map +1 -1
- package/dist/collection/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.js +2 -2
- package/dist/collection/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-additional-participants/nylas-additional-participants.js +12 -16
- package/dist/collection/components/scheduler-editor/nylas-additional-participants/nylas-additional-participants.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-additional-participants/test/nylas-additional-participants.spec.js +106 -0
- package/dist/collection/components/scheduler-editor/nylas-additional-participants/test/nylas-additional-participants.spec.js.map +1 -0
- package/dist/collection/components/scheduler-editor/nylas-confirmation-email/nylas-confirmation-email.js +52 -28
- package/dist/collection/components/scheduler-editor/nylas-confirmation-email/nylas-confirmation-email.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-confirmation-email/test/nylas-confirmation-email.spec.js +33 -0
- package/dist/collection/components/scheduler-editor/nylas-confirmation-email/test/nylas-confirmation-email.spec.js.map +1 -0
- package/dist/collection/components/scheduler-editor/nylas-event-duration/nylas-event-duration.js +5 -3
- package/dist/collection/components/scheduler-editor/nylas-event-duration/nylas-event-duration.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-event-duration/test/nylas-event-duration.spec.js +55 -0
- package/dist/collection/components/scheduler-editor/nylas-event-duration/test/nylas-event-duration.spec.js.map +1 -0
- package/dist/collection/components/scheduler-editor/nylas-event-info/nylas-event-info.js +1 -1
- package/dist/collection/components/scheduler-editor/nylas-event-limits/nylas-event-limits.js +1 -1
- package/dist/collection/components/scheduler-editor/nylas-form-card/nylas-form-card.js +1 -1
- package/dist/collection/components/scheduler-editor/nylas-reminder-time/nylas-reminder-time.js +23 -30
- package/dist/collection/components/scheduler-editor/nylas-reminder-time/nylas-reminder-time.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-reminder-time/test/nylas-reminder-time.spec.js +37 -0
- package/dist/collection/components/scheduler-editor/nylas-reminder-time/test/nylas-reminder-time.spec.js.map +1 -0
- package/dist/components/input-image-url2.js +6 -2
- package/dist/components/input-image-url2.js.map +1 -1
- package/dist/components/nylas-additional-participants2.js +12 -16
- package/dist/components/nylas-additional-participants2.js.map +1 -1
- package/dist/components/nylas-confirmation-email2.js +14 -5
- package/dist/components/nylas-confirmation-email2.js.map +1 -1
- package/dist/components/nylas-event-duration2.js +5 -3
- package/dist/components/nylas-event-duration2.js.map +1 -1
- package/dist/components/nylas-event-info2.js +1 -1
- package/dist/components/nylas-event-limits2.js +1 -1
- package/dist/components/nylas-form-card2.js +1 -1
- package/dist/components/nylas-reminder-time2.js +23 -29
- package/dist/components/nylas-reminder-time2.js.map +1 -1
- package/dist/components/nylas-timeslot-picker2.js +2 -2
- package/dist/components/nylas-timeslot-picker2.js.map +1 -1
- package/dist/esm/calendar-agenda-fill-icon_54.entry.js +60 -54
- package/dist/esm/calendar-agenda-fill-icon_54.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/nylas-booked-event-card_12.entry.js +2 -2
- package/dist/esm/nylas-booked-event-card_12.entry.js.map +1 -1
- package/dist/esm/nylas-form-card.entry.js +1 -1
- package/dist/esm/nylas-web-elements.js +1 -1
- package/dist/nylas-web-elements/nylas-web-elements.esm.js +1 -1
- package/dist/nylas-web-elements/nylas-web-elements.esm.js.map +1 -1
- package/dist/nylas-web-elements/p-1ce8b1c3.entry.js +8 -0
- package/dist/nylas-web-elements/p-1ce8b1c3.entry.js.map +1 -0
- package/dist/nylas-web-elements/{p-698d229c.entry.js → p-7a1d51ab.entry.js} +2 -2
- package/dist/nylas-web-elements/{p-698d229c.entry.js.map → p-7a1d51ab.entry.js.map} +1 -1
- package/dist/nylas-web-elements/p-bbf86b8c.entry.js +2 -0
- package/dist/types/components/design-system/input-image-url/input-image-url.d.ts +4 -0
- package/dist/types/components/scheduler-editor/nylas-additional-participants/nylas-additional-participants.d.ts +1 -1
- package/dist/types/components/scheduler-editor/nylas-confirmation-email/nylas-confirmation-email.d.ts +5 -1
- package/dist/types/components/scheduler-editor/nylas-reminder-time/nylas-reminder-time.d.ts +1 -1
- package/dist/types/components.d.ts +18 -6
- package/package.json +3 -3
- package/dist/nylas-web-elements/p-b9a8d404.entry.js +0 -8
- package/dist/nylas-web-elements/p-b9a8d404.entry.js.map +0 -1
- package/dist/nylas-web-elements/p-f4334e3a.entry.js +0 -2
- /package/dist/nylas-web-elements/{p-f4334e3a.entry.js.map → p-bbf86b8c.entry.js.map} +0 -0
|
@@ -24,22 +24,29 @@ var __metadata = (undefined && undefined.__metadata) || function (k, v) {
|
|
|
24
24
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
25
25
|
return Reflect.metadata(k, v);
|
|
26
26
|
};
|
|
27
|
+
const reminderTimeOptions = [
|
|
28
|
+
{ value: 60 * 24, label: 'day' },
|
|
29
|
+
{ value: 60, label: 'hour' },
|
|
30
|
+
{ value: 1, label: 'minute' },
|
|
31
|
+
];
|
|
27
32
|
function getInitialTimeValue(timeInMinutes) {
|
|
28
33
|
if (!timeInMinutes)
|
|
29
34
|
return 30;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
for (const option of reminderTimeOptions) {
|
|
36
|
+
if (timeInMinutes % option.value === 0) {
|
|
37
|
+
return timeInMinutes / option.value;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
34
40
|
return timeInMinutes;
|
|
35
41
|
}
|
|
36
42
|
function getInitialTimeIncrement(timeInMinutes) {
|
|
37
43
|
if (!timeInMinutes)
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
return 1;
|
|
45
|
+
for (const option of reminderTimeOptions) {
|
|
46
|
+
if (timeInMinutes % option.value === 0) {
|
|
47
|
+
return option.value;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
43
50
|
return 1;
|
|
44
51
|
}
|
|
45
52
|
const NylasReminderTime = proxyCustomElement(class NylasReminderTime extends HTMLElement {
|
|
@@ -60,15 +67,6 @@ const NylasReminderTime = proxyCustomElement(class NylasReminderTime extends HTM
|
|
|
60
67
|
debug('nylas-reminder-time', 'elementNameChangedHandler', newValue);
|
|
61
68
|
this.host.setAttribute('name', newValue);
|
|
62
69
|
}
|
|
63
|
-
eventReminderTimeMinutesChangedHandler(newValue, oldValue) {
|
|
64
|
-
debug('nylas-reminder-time', 'eventReminderTimeMinutesChangedHandler', newValue);
|
|
65
|
-
if (newValue === oldValue) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
this.reminderTime = getInitialTimeValue(newValue);
|
|
69
|
-
this.reminderTimeincrement = getInitialTimeIncrement(newValue);
|
|
70
|
-
this.reminderTimeMinutes = newValue;
|
|
71
|
-
}
|
|
72
70
|
reminderTimeMinutesChangedHandler(newValue, oldValue) {
|
|
73
71
|
debug('nylas-reminder-time', 'reminderTimeMinutesChangedHandler', newValue);
|
|
74
72
|
if (newValue === oldValue) {
|
|
@@ -82,14 +80,17 @@ const NylasReminderTime = proxyCustomElement(class NylasReminderTime extends HTM
|
|
|
82
80
|
componentWillLoad() {
|
|
83
81
|
debug('nylas-reminder-time', 'componentWillLoad');
|
|
84
82
|
this.host.setAttribute('name', this.name);
|
|
85
|
-
this.setReminderTimeMinuteOptions();
|
|
86
83
|
}
|
|
87
84
|
componentDidLoad() {
|
|
88
85
|
debug('nylas-reminder-time', 'componentDidLoad');
|
|
86
|
+
this.setReminderTimeMinuteOptions();
|
|
89
87
|
}
|
|
90
88
|
disconnectedCallback() {
|
|
91
89
|
debug('nylas-reminder-time', 'disconnectedCallback');
|
|
92
90
|
}
|
|
91
|
+
get isInternalsAvailable() {
|
|
92
|
+
return this.internals !== undefined && typeof this.internals.setFormValue === 'function';
|
|
93
|
+
}
|
|
93
94
|
setReminderTimeMinuteOptions() {
|
|
94
95
|
if (this.reminderTimeincrement === 1) {
|
|
95
96
|
this.reminderTimeMinutesOptions = REMINDER_MINUTE_OPTIONS;
|
|
@@ -113,28 +114,22 @@ const NylasReminderTime = proxyCustomElement(class NylasReminderTime extends HTM
|
|
|
113
114
|
}
|
|
114
115
|
this.setReminderTimeMinuteOptions();
|
|
115
116
|
this.reminderTimeMinutes = this.reminderTime * this.reminderTimeincrement;
|
|
116
|
-
this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);
|
|
117
|
+
this.isInternalsAvailable && this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);
|
|
117
118
|
}
|
|
118
119
|
inputOptionChangedHandler(event) {
|
|
119
120
|
debug('nylas-calendar-picker', 'inputOptionChangedHandler', event.detail);
|
|
120
121
|
const { value } = event.detail;
|
|
121
122
|
this.reminderTime = value;
|
|
122
123
|
this.reminderTimeMinutes = this.reminderTime * this.reminderTimeincrement;
|
|
123
|
-
this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);
|
|
124
|
+
this.isInternalsAvailable && this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);
|
|
124
125
|
}
|
|
125
126
|
render() {
|
|
126
|
-
|
|
127
|
-
{ value: 1, label: 'minute' },
|
|
128
|
-
{ value: 60, label: 'hour' },
|
|
129
|
-
{ value: 60 * 24, label: 'day' },
|
|
130
|
-
];
|
|
131
|
-
return (h(Host, { key: 'd5f118391bdd7e4779f6eca15335285047fdb350' }, h("div", { key: '2dd8d3ba52d4f95480c9cf1fdaf5d0f1f7c1e523', class: "nylas-reminder-time", part: "nrt" }, h("div", { key: '3799c4b266f4078e22ad78b86225ef9abdc5fa49', class: "nylas-reminder-time__wrapper" }, h("input-dropdown", { key: '004b6336c041660e1424ac44f16e82c8a5a2ca53', name: 'reminder-time', options: this.reminderTimeMinutesOptions, inputValue: this.reminderTime.toString(), exportparts: "id_dropdown: nrt__input_dropdown, id_dropdown-input: nrt__input_dropdown-input, id_dropdown-content: nrt__input_dropdown-content", defaultInputOption: this.reminderTimeMinutesOptions.find(i => i.value == this.reminderTime) ?? reminderTimeOptions[0] }), h("select-dropdown", { key: '6a42c7f4633d89dd9a94d3c2f119e151613667ec', name: 'reminder-time-unit', options: reminderTimeOptions, pluralizedLabel: this.reminderTime > 1 ? 's' : '', exportparts: "sd_dropdown: nrt__dropdown, sd_dropdown-button: nrt__dropdown-button, sd_dropdown-content: nrt__dropdown-content", defaultSelectedOption: reminderTimeOptions.find(i => i.value == this.reminderTimeincrement) ?? reminderTimeOptions[0], withSearch: false })))));
|
|
127
|
+
return (h(Host, { key: 'b089eb10d76d001112d867a61889a685b8908355' }, h("div", { key: '13b8479fb822135c00ff8f97974c8269731b2a84', class: "nylas-reminder-time", part: "nrt" }, h("div", { key: '728e90c61077b1037aa285329f11a09a296b33b4', class: "nylas-reminder-time__wrapper" }, h("input-dropdown", { key: '40a22b75424d4b3b552a2dc1b60e79a8cb595032', name: 'reminder-time', options: this.reminderTimeMinutesOptions, inputValue: this.reminderTime.toString(), exportparts: "id_dropdown: nrt__input_dropdown, id_dropdown-input: nrt__input_dropdown-input, id_dropdown-content: nrt__input_dropdown-content", defaultInputOption: this.reminderTimeMinutesOptions.find(i => i.value == this.reminderTime) ?? reminderTimeOptions[0] }), h("select-dropdown", { key: '6128bb953b883be5341ba005438ab353b0016c48', name: 'reminder-time-unit', options: [...reminderTimeOptions].sort((a, b) => a.value - b.value), pluralizedLabel: this.reminderTime > 1 ? 's' : '', exportparts: "sd_dropdown: nrt__dropdown, sd_dropdown-button: nrt__dropdown-button, sd_dropdown-content: nrt__dropdown-content", defaultSelectedOption: reminderTimeOptions.find(i => i.value == this.reminderTimeincrement) ?? reminderTimeOptions[0], withSearch: false })))));
|
|
132
128
|
}
|
|
133
129
|
static get formAssociated() { return true; }
|
|
134
130
|
get host() { return this; }
|
|
135
131
|
static get watchers() { return {
|
|
136
132
|
"name": ["elementNameChangedHandler"],
|
|
137
|
-
"eventReminderTimeMinutes": ["eventReminderTimeMinutesChangedHandler"],
|
|
138
133
|
"reminderTimeMinutes": ["reminderTimeMinutesChangedHandler"]
|
|
139
134
|
}; }
|
|
140
135
|
static get style() { return NylasReminderTimeStyle0; }
|
|
@@ -147,7 +142,6 @@ const NylasReminderTime = proxyCustomElement(class NylasReminderTime extends HTM
|
|
|
147
142
|
"reminderTimeMinutesOptions": [32]
|
|
148
143
|
}, [[0, "nylasFormDropdownChanged", "nylasFormDropdownChangedHandler"], [0, "inputOptionChanged", "inputOptionChangedHandler"]], {
|
|
149
144
|
"name": ["elementNameChangedHandler"],
|
|
150
|
-
"eventReminderTimeMinutes": ["eventReminderTimeMinutesChangedHandler"],
|
|
151
145
|
"reminderTimeMinutes": ["reminderTimeMinutesChangedHandler"]
|
|
152
146
|
}]);
|
|
153
147
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"nylas-reminder-time2.js","mappings":";;;;;;;;;AAAA,MAAM,oBAAoB,GAAG,g2DAAg2D,CAAC;AAC93D,gCAAe,oBAAoB;;;;;;;;;;;;;;;;ACMnC,SAAS,mBAAmB,CAAC,aAAiC;IAC5D,IAAI,CAAC,aAAa;QAAE,OAAO,EAAE,CAAC;IAC9B,IAAI,aAAa,IAAI,EAAE,GAAG,EAAE;QAAE,OAAO,aAAa,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;IAC/D,IAAI,aAAa,IAAI,EAAE,IAAI,aAAa,KAAK,EAAE;QAAE,OAAO,aAAa,GAAG,EAAE,CAAC;IAC3E,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,SAAS,uBAAuB,CAAC,aAAiC;IAChE,IAAI,CAAC,aAAa;QAAE,OAAO,EAAE,CAAC;IAC9B,IAAI,aAAa,IAAI,EAAE,GAAG,EAAE;QAAE,OAAO,EAAE,GAAG,EAAE,CAAC;IAC7C,IAAI,aAAa,IAAI,EAAE,IAAI,aAAa,KAAK,EAAE;QAAE,OAAO,EAAE,CAAC;IAC3D,OAAO,CAAC,CAAC;AACX,CAAC;MAmBY,iBAAiB;;;;;;;oBAQL,eAAe;;4BAQN,mBAAmB,CAAC,IAAI,CAAC,wBAAwB,CAAC;mCAI3C,IAAI,CAAC,wBAAwB,IAAI,EAAE;qCAIjC,uBAAuB,CAAC,IAAI,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;AA9BD;IALC,iBAAiB,CAAuG;QACvH,IAAI,EAAE,qBAAqB;QAC3B,YAAY,EAAE,EAAE;QAChB,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;+CA+BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/scheduler-editor/nylas-reminder-time/nylas-reminder-time.scss?tag=nylas-reminder-time&encapsulation=shadow","src/components/scheduler-editor/nylas-reminder-time/nylas-reminder-time.tsx"],"sourcesContent":["@import '../../../common/styles/variables.scss';\n\n:host {\n display: block;\n @include default-css-variables;\n}\n\n.nylas-reminder-time {\n display: flex;\n flex-direction: column;\n gap: 4px;\n\n label {\n display: flex;\n align-items: center;\n color: var(--nylas-base-800);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 150%;\n\n /* 21px */\n span.required {\n color: var(--nylas-error, #cc4841);\n }\n\n span.label-icon {\n margin-left: 4px;\n\n tooltip-component {\n display: flex;\n }\n }\n }\n}\n\n.nylas-reminder-time__wrapper {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n\n input {\n padding: 12px 16px;\n border-width: 1;\n border-radius: 8px;\n border: 1px solid var(--nylas-base-200);\n font-family: var(--nylas-font-family);\n font-size: 16px;\n line-height: 24px;\n width: 48px;\n }\n\n input-dropdown::part(id_dropdown-input) {\n border: 1px solid var(--nylas-base-200);\n border-radius: var(--nylas-border-radius-2x);\n padding: 14px 16px;\n width: 50px;\n }\n\n input-dropdown::part(id_dropdown-content) {\n width: 100%;\n min-width: unset;\n height: 160px;\n }\n\n select-dropdown {\n width: 120px;\n\n @media #{$mobile} {\n width: 100%;\n }\n }\n\n select-dropdown::part(sd_dropdown-button) {\n border: 1px solid var(--nylas-base-200);\n }\n}\n","import { RegisterComponent } from '@/common/register-component';\nimport { REMINDER_MINUTE_OPTIONS, REMINDER_HOUR_OPTIONS, REMINDER_DAY_OPTIONS } from '@/common/constants';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { debug } from '@/utils/utils';\nimport { AttachInternals, Component, Host, Listen, State, h, Element, Prop, Watch, Event, EventEmitter } from '@stencil/core';\nimport { NylasSchedulerEditor } from '../nylas-scheduler-editor/nylas-scheduler-editor';\n\nfunction getInitialTimeValue(timeInMinutes: number | undefined) {\n if (!timeInMinutes) return 30;\n if (timeInMinutes >= 60 * 24) return timeInMinutes / (60 * 24);\n if (timeInMinutes >= 90 || timeInMinutes === 60) return timeInMinutes / 60;\n return timeInMinutes;\n}\n\nfunction getInitialTimeIncrement(timeInMinutes: number | undefined) {\n if (!timeInMinutes) return 30;\n if (timeInMinutes >= 60 * 24) return 60 * 24;\n if (timeInMinutes >= 90 || timeInMinutes === 60) return 60;\n return 1;\n}\n\n/**\n * The `nylas-reminder-time` component is a form input for the reminder time before an event.\n *\n * @part nrt - The event reminder container\n * @part nrt - The dropdown container for the reminder time increment\n * @part nrt__dropdown-button - The dropdown button for the reminder time increment\n * @part nrt__dropdown-content - The dropdown content for the reminder time increment\n * @part nrt__input_dropdown - The input dropdown container for the reminder time minutes\n * @part nrt__input_dropdown-input - The input for the reminder time minutes\n * @part nrt__input_dropdown-content - The dropdown content for the input reminder time minutes\n */\n@Component({\n tag: 'nylas-reminder-time',\n styleUrl: 'nylas-reminder-time.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasReminderTime {\n /**\n * The host element <nylas-reminder-time>\n */\n @Element() host!: HTMLElement;\n /**\n * The name of the reminder time. Default is 'reminder time'.\n */\n @Prop() name: string = 'reminder-time';\n /**\n * The event reminder time in minutes as set in the configuration.\n */\n @Prop() eventReminderTimeMinutes?: number;\n /**\n * The selected event reminder time state. This defaults to the reminder time from the configuration or 30 minutes.\n */\n @State() reminderTime: number = getInitialTimeValue(this.eventReminderTimeMinutes);\n /**\n * The reminder time in minutes. This defaults to the reminder time from the configuration or 30 minutes.\n */\n @State() reminderTimeMinutes: number = this.eventReminderTimeMinutes ?? 30;\n /**\n * The reminder time increment. This defaults to minute(s).\n */\n @State() reminderTimeincrement: number = getInitialTimeIncrement(this.eventReminderTimeMinutes);\n /**\n * The reminderTimeMinutesOptions for the dropdown.\n */\n @State() reminderTimeMinutesOptions = REMINDER_MINUTE_OPTIONS;\n\n /**\n * The element internals.\n */\n @AttachInternals() internals!: ElementInternals;\n\n /**\n * When a name prop is passed, stencil does not automatically set the name attribute on the host element.\n * Since this component is form-associated, the name attribute is required for form submission.\n * This is a workaround to ensure that the name attribute is set on the host element.\n */\n @Watch('name')\n elementNameChangedHandler(newValue: string) {\n debug('nylas-reminder-time', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Watch('eventReminderTimeMinutes')\n eventReminderTimeMinutesChangedHandler(newValue: number, oldValue: number) {\n debug('nylas-reminder-time', 'eventReminderTimeMinutesChangedHandler', newValue);\n if (newValue === oldValue) {\n return;\n }\n this.reminderTime = getInitialTimeValue(newValue);\n this.reminderTimeincrement = getInitialTimeIncrement(newValue);\n this.reminderTimeMinutes = newValue;\n }\n\n @Watch('reminderTimeMinutes')\n reminderTimeMinutesChangedHandler(newValue: number, oldValue: number) {\n debug('nylas-reminder-time', 'reminderTimeMinutesChangedHandler', newValue);\n if (newValue === oldValue) {\n return;\n }\n this.valueChanged.emit({ value: newValue.toString(), name: this.name });\n }\n\n /**\n * Event emitted when the event reminder time changes.\n */\n @Event() valueChanged!: EventEmitter<{\n value: string;\n name: string;\n }>;\n\n connectedCallback() {\n debug('nylas-reminder-time', 'connectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-reminder-time', 'componentWillLoad');\n this.host.setAttribute('name', this.name);\n this.setReminderTimeMinuteOptions();\n }\n\n componentDidLoad() {\n debug('nylas-reminder-time', 'componentDidLoad');\n }\n\n disconnectedCallback() {\n debug('nylas-reminder-time', 'disconnectedCallback');\n }\n\n setReminderTimeMinuteOptions() {\n if (this.reminderTimeincrement === 1) {\n this.reminderTimeMinutesOptions = REMINDER_MINUTE_OPTIONS;\n } else if (this.reminderTimeincrement === 60) {\n this.reminderTimeMinutesOptions = REMINDER_HOUR_OPTIONS;\n } else this.reminderTimeMinutesOptions = REMINDER_DAY_OPTIONS;\n return this.reminderTimeMinutesOptions;\n }\n\n @Listen('nylasFormDropdownChanged')\n nylasFormDropdownChangedHandler(event: CustomEvent<{ value: string; name: string }>) {\n debug('nylas-calendar-picker', 'nylasFormDropdownChangedHandler', event.detail);\n const { value } = event.detail;\n this.reminderTimeincrement = parseInt(value);\n\n if (this.reminderTimeincrement === 1) {\n this.reminderTime = 60;\n } else {\n this.reminderTime = 1;\n }\n\n this.setReminderTimeMinuteOptions();\n this.reminderTimeMinutes = this.reminderTime * this.reminderTimeincrement;\n this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);\n }\n\n @Listen('inputOptionChanged')\n inputOptionChangedHandler(event: CustomEvent<{ value: number; name: string }>) {\n debug('nylas-calendar-picker', 'inputOptionChangedHandler', event.detail);\n const { value } = event.detail;\n this.reminderTime = value;\n this.reminderTimeMinutes = this.reminderTime * this.reminderTimeincrement;\n this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);\n }\n\n @RegisterComponent<NylasReminderTime, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-reminder-time',\n eventToProps: {},\n fireRegisterEvent: true,\n })\n render() {\n const reminderTimeOptions = [\n { value: 1, label: 'minute' },\n { value: 60, label: 'hour' },\n { value: 60 * 24, label: 'day' },\n ];\n\n return (\n <Host>\n <div class=\"nylas-reminder-time\" part=\"nrt\">\n <div class=\"nylas-reminder-time__wrapper\">\n <input-dropdown\n name={'reminder-time'}\n options={this.reminderTimeMinutesOptions}\n inputValue={this.reminderTime.toString()}\n exportparts=\"id_dropdown: nrt__input_dropdown, id_dropdown-input: nrt__input_dropdown-input, id_dropdown-content: nrt__input_dropdown-content\"\n defaultInputOption={this.reminderTimeMinutesOptions.find(i => i.value == this.reminderTime) ?? reminderTimeOptions[0]}\n />\n <select-dropdown\n name={'reminder-time-unit'}\n options={reminderTimeOptions}\n pluralizedLabel={this.reminderTime > 1 ? 's' : ''}\n exportparts=\"sd_dropdown: nrt__dropdown, sd_dropdown-button: nrt__dropdown-button, sd_dropdown-content: nrt__dropdown-content\"\n defaultSelectedOption={reminderTimeOptions.find(i => i.value == this.reminderTimeincrement) ?? reminderTimeOptions[0]}\n withSearch={false}\n />\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"nylas-reminder-time2.js","mappings":";;;;;;;;;AAAA,MAAM,oBAAoB,GAAG,g2DAAg2D,CAAC;AAC93D,gCAAe,oBAAoB;;;;;;;;;;;;;;;;ACMnC,MAAM,mBAAmB,GAAG;IAC1B,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE;IAChC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;IAC5B,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE;CAC9B,CAAC;AAEF,SAAS,mBAAmB,CAAC,aAAiC;IAC5D,IAAI,CAAC,aAAa;QAAE,OAAO,EAAE,CAAC;IAG9B,KAAK,MAAM,MAAM,IAAI,mBAAmB,EAAE;QACxC,IAAI,aAAa,GAAG,MAAM,CAAC,KAAK,KAAK,CAAC,EAAE;YACtC,OAAO,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC;SACrC;KACF;IAGD,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,SAAS,uBAAuB,CAAC,aAAiC;IAChE,IAAI,CAAC,aAAa;QAAE,OAAO,CAAC,CAAC;IAG7B,KAAK,MAAM,MAAM,IAAI,mBAAmB,EAAE;QACxC,IAAI,aAAa,GAAG,MAAM,CAAC,KAAK,KAAK,CAAC,EAAE;YACtC,OAAO,MAAM,CAAC,KAAK,CAAC;SACrB;KACF;IAGD,OAAO,CAAC,CAAC;AACX,CAAC;MAmBY,iBAAiB;;;;;;;oBAQL,eAA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;;;;;;;;","names":[],"sources":["src/components/scheduler-editor/nylas-reminder-time/nylas-reminder-time.scss?tag=nylas-reminder-time&encapsulation=shadow","src/components/scheduler-editor/nylas-reminder-time/nylas-reminder-time.tsx"],"sourcesContent":["@import '../../../common/styles/variables.scss';\n\n:host {\n display: block;\n @include default-css-variables;\n}\n\n.nylas-reminder-time {\n display: flex;\n flex-direction: column;\n gap: 4px;\n\n label {\n display: flex;\n align-items: center;\n color: var(--nylas-base-800);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 150%;\n\n /* 21px */\n span.required {\n color: var(--nylas-error, #cc4841);\n }\n\n span.label-icon {\n margin-left: 4px;\n\n tooltip-component {\n display: flex;\n }\n }\n }\n}\n\n.nylas-reminder-time__wrapper {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n\n input {\n padding: 12px 16px;\n border-width: 1;\n border-radius: 8px;\n border: 1px solid var(--nylas-base-200);\n font-family: var(--nylas-font-family);\n font-size: 16px;\n line-height: 24px;\n width: 48px;\n }\n\n input-dropdown::part(id_dropdown-input) {\n border: 1px solid var(--nylas-base-200);\n border-radius: var(--nylas-border-radius-2x);\n padding: 14px 16px;\n width: 50px;\n }\n\n input-dropdown::part(id_dropdown-content) {\n width: 100%;\n min-width: unset;\n height: 160px;\n }\n\n select-dropdown {\n width: 120px;\n\n @media #{$mobile} {\n width: 100%;\n }\n }\n\n select-dropdown::part(sd_dropdown-button) {\n border: 1px solid var(--nylas-base-200);\n }\n}\n","import { RegisterComponent } from '@/common/register-component';\nimport { REMINDER_MINUTE_OPTIONS, REMINDER_HOUR_OPTIONS, REMINDER_DAY_OPTIONS } from '@/common/constants';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { debug } from '@/utils/utils';\nimport { AttachInternals, Component, Host, Listen, State, h, Element, Prop, Watch, Event, EventEmitter } from '@stencil/core';\nimport { NylasSchedulerEditor } from '../nylas-scheduler-editor/nylas-scheduler-editor';\n\nconst reminderTimeOptions = [\n { value: 60 * 24, label: 'day' },\n { value: 60, label: 'hour' },\n { value: 1, label: 'minute' },\n];\n\nfunction getInitialTimeValue(timeInMinutes: number | undefined) {\n if (!timeInMinutes) return 30; // Default to 30 minutes if undefined\n\n // Loop through the reminderTimeOptions to find the appropriate division\n for (const option of reminderTimeOptions) {\n if (timeInMinutes % option.value === 0) {\n return timeInMinutes / option.value; // Return the divided value\n }\n }\n\n // If no exact division is found, return the time in minutes\n return timeInMinutes;\n}\n\nfunction getInitialTimeIncrement(timeInMinutes: number | undefined) {\n if (!timeInMinutes) return 1; // Default to minutes if undefined\n\n // Loop through the reminderTimeOptions and check divisibility\n for (const option of reminderTimeOptions) {\n if (timeInMinutes % option.value === 0) {\n return option.value;\n }\n }\n\n // If no suitable option is found, default to minutes\n return 1;\n}\n\n/**\n * The `nylas-reminder-time` component is a form input for the reminder time before an event.\n *\n * @part nrt - The event reminder container\n * @part nrt - The dropdown container for the reminder time increment\n * @part nrt__dropdown-button - The dropdown button for the reminder time increment\n * @part nrt__dropdown-content - The dropdown content for the reminder time increment\n * @part nrt__input_dropdown - The input dropdown container for the reminder time minutes\n * @part nrt__input_dropdown-input - The input for the reminder time minutes\n * @part nrt__input_dropdown-content - The dropdown content for the input reminder time minutes\n */\n@Component({\n tag: 'nylas-reminder-time',\n styleUrl: 'nylas-reminder-time.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasReminderTime {\n /**\n * The host element <nylas-reminder-time>\n */\n @Element() host!: HTMLElement;\n /**\n * The name of the reminder time. Default is 'reminder time'.\n */\n @Prop() name: string = 'reminder-time';\n /**\n * The event reminder time in minutes as set in the configuration.\n */\n @Prop() eventReminderTimeMinutes?: number;\n /**\n * The selected event reminder time state. This defaults to the reminder time from the configuration or 30 minutes.\n */\n @State() reminderTime: number = getInitialTimeValue(this.eventReminderTimeMinutes);\n /**\n * The reminder time in minutes. This defaults to the reminder time from the configuration or 30 minutes.\n */\n @State() reminderTimeMinutes: number = this.eventReminderTimeMinutes ?? 30;\n /**\n * The reminder time increment. This defaults to minute(s).\n */\n @State() reminderTimeincrement: number = getInitialTimeIncrement(this.eventReminderTimeMinutes);\n /**\n * The reminderTimeMinutesOptions for the dropdown.\n */\n @State() reminderTimeMinutesOptions = REMINDER_MINUTE_OPTIONS;\n\n /**\n * The element internals.\n */\n @AttachInternals() internals!: ElementInternals;\n\n /**\n * When a name prop is passed, stencil does not automatically set the name attribute on the host element.\n * Since this component is form-associated, the name attribute is required for form submission.\n * This is a workaround to ensure that the name attribute is set on the host element.\n */\n @Watch('name')\n elementNameChangedHandler(newValue: string) {\n debug('nylas-reminder-time', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Watch('reminderTimeMinutes')\n reminderTimeMinutesChangedHandler(newValue: number, oldValue: number) {\n debug('nylas-reminder-time', 'reminderTimeMinutesChangedHandler', newValue);\n if (newValue === oldValue) {\n return;\n }\n this.valueChanged.emit({ value: newValue.toString(), name: this.name });\n }\n\n /**\n * Event emitted when the event reminder time changes.\n */\n @Event() valueChanged!: EventEmitter<{\n value: string;\n name: string;\n }>;\n\n connectedCallback() {\n debug('nylas-reminder-time', 'connectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-reminder-time', 'componentWillLoad');\n this.host.setAttribute('name', this.name);\n }\n\n componentDidLoad() {\n debug('nylas-reminder-time', 'componentDidLoad');\n this.setReminderTimeMinuteOptions();\n }\n\n disconnectedCallback() {\n debug('nylas-reminder-time', 'disconnectedCallback');\n }\n\n /**\n * The unit tests in stencil does not support the internals API.\n * This method checks if the internals API is available.\n * @returns boolean\n */\n get isInternalsAvailable() {\n return this.internals !== undefined && typeof this.internals.setFormValue === 'function';\n }\n\n setReminderTimeMinuteOptions() {\n if (this.reminderTimeincrement === 1) {\n this.reminderTimeMinutesOptions = REMINDER_MINUTE_OPTIONS;\n } else if (this.reminderTimeincrement === 60) {\n this.reminderTimeMinutesOptions = REMINDER_HOUR_OPTIONS;\n } else this.reminderTimeMinutesOptions = REMINDER_DAY_OPTIONS;\n return this.reminderTimeMinutesOptions;\n }\n\n @Listen('nylasFormDropdownChanged')\n nylasFormDropdownChangedHandler(event: CustomEvent<{ value: string; name: string }>) {\n debug('nylas-calendar-picker', 'nylasFormDropdownChangedHandler', event.detail);\n const { value } = event.detail;\n this.reminderTimeincrement = parseInt(value);\n\n if (this.reminderTimeincrement === 1) {\n this.reminderTime = 60;\n } else {\n this.reminderTime = 1;\n }\n\n this.setReminderTimeMinuteOptions();\n this.reminderTimeMinutes = this.reminderTime * this.reminderTimeincrement;\n this.isInternalsAvailable && this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);\n }\n\n @Listen('inputOptionChanged')\n inputOptionChangedHandler(event: CustomEvent<{ value: number; name: string }>) {\n debug('nylas-calendar-picker', 'inputOptionChangedHandler', event.detail);\n const { value } = event.detail;\n this.reminderTime = value;\n this.reminderTimeMinutes = this.reminderTime * this.reminderTimeincrement;\n this.isInternalsAvailable && this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);\n }\n\n @RegisterComponent<NylasReminderTime, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-reminder-time',\n eventToProps: {},\n fireRegisterEvent: true,\n })\n render() {\n return (\n <Host>\n <div class=\"nylas-reminder-time\" part=\"nrt\">\n <div class=\"nylas-reminder-time__wrapper\">\n <input-dropdown\n name={'reminder-time'}\n options={this.reminderTimeMinutesOptions}\n inputValue={this.reminderTime.toString()}\n exportparts=\"id_dropdown: nrt__input_dropdown, id_dropdown-input: nrt__input_dropdown-input, id_dropdown-content: nrt__input_dropdown-content\"\n defaultInputOption={this.reminderTimeMinutesOptions.find(i => i.value == this.reminderTime) ?? reminderTimeOptions[0]}\n />\n <select-dropdown\n name={'reminder-time-unit'}\n options={[...reminderTimeOptions].sort((a, b) => a.value - b.value)}\n pluralizedLabel={this.reminderTime > 1 ? 's' : ''}\n exportparts=\"sd_dropdown: nrt__dropdown, sd_dropdown-button: nrt__dropdown-button, sd_dropdown-content: nrt__dropdown-content\"\n defaultSelectedOption={reminderTimeOptions.find(i => i.value == this.reminderTimeincrement) ?? reminderTimeOptions[0]}\n withSearch={false}\n />\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -72,12 +72,12 @@ const NylasTimeslotPicker = proxyCustomElement(class NylasTimeslotPicker extends
|
|
|
72
72
|
connectedCallback() { }
|
|
73
73
|
disconnectedCallback() { }
|
|
74
74
|
async componentWillLoad() {
|
|
75
|
-
const availableTimes = this.availability?.filter(timeslot => this.selectedDate && isSameDay(timeslot.start_time, this.selectedDate)).map(timeslot => timeslot);
|
|
76
|
-
this.times = availableTimes || [];
|
|
77
75
|
debug(`[nylas-timeslot-picker] Component will load`, { selectedDate: this.selectedDate, availability: this.availability, times: this.times });
|
|
78
76
|
}
|
|
79
77
|
async componentDidLoad() {
|
|
80
78
|
debug(`[nylas-timeslot-picker] Component did load`);
|
|
79
|
+
const availableTimes = this.availability?.filter(timeslot => this.selectedDate && isSameDay(timeslot.start_time, this.selectedDate)).map(timeslot => timeslot);
|
|
80
|
+
this.times = availableTimes || [];
|
|
81
81
|
}
|
|
82
82
|
getTimeslotId(date, index) {
|
|
83
83
|
return `${date.toLocaleDateString()}-${index}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"nylas-timeslot-picker2.js","mappings":";;;;;;AAAA,MAAM,sBAAsB,GAAG,2oEAA2oE,CAAC;AAC3qE,kCAAe,sBAAsB;;;;;;;;;;;;;;;;MCsBxB,mBAAmB;;;;;;;QAiGtB,4BAAuB,GAAG,OAAO,KAAY,EAAE,QAA8B;YACnF,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,KAAK,CAAC,0CAA0C,EAAE,QAAQ,CAAC,CAAC;YAC5D,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACvC,CAAC;QAEM,qBAAgB,GAAG,CAAC,KAAa;YACvC,IAAI,CAAC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F;QAC9G,IAAI,EAAE,uBAAuB;QAC7B,YAAY,EAAE,IAAI,GAAG,CAAC;YACpB,CAAC,wBAAwB,EAAE,cAAc,CAAC;YAC1C,CAAC,wBAAwB,EAAE,cAAc,CAAC;YAC1C,CAAC,4BAA4B,EAAE,kBAAkB,CAAC;YAClD,CAAC,4BAA4B,EAAE,kBAAkB,CAAC;YAClD,CAAC,4BAA4B,EAAE,kBAAkB,CAAC;YAClD,CAAC,qBAAqB,EAAE,WAAW,CAAC;SACrC,CAAC;QACF,YAAY,EAAE;YACZ,gBAAgB,EAAE,OAAO,KAA4B,EAAE,uBAAgD;gBACrG,KAAK,CAAC,uBAAuB,EAAE,kBAAkB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;gBACjE,uBAAuB,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;aAC5D;YACD,iBAAiB,EAAE,OAAO,KAA4B,EAAE,uBAAgD;gBACtG,KAAK,CAAC,uBAAuB,EAAE,mBAAmB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;gBAClE,IAAI,KAAK,CAAC,MAAM,EAAE;oBAChB,uBAAuB,CAAC,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;iBAC9D;aACF;SACF;QACD,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;iDAoED;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["i18next"],"sources":["src/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.scss?tag=nylas-timeslot-picker&encapsulation=shadow","src/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.tsx"],"sourcesContent":["@import '../../../common/styles/variables.scss';\n\n:host {\n display: block;\n height: calc(100% - 48px); //48px is the height of the header\n @include default-css-variables;\n}\n\n.time-picker-wrapper {\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n\n.timeslots {\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 0.75rem;\n align-items: center;\n overflow-y: scroll;\n padding: 0.5rem 1.5rem 1.5rem;\n flex: 1;\n}\n\n.time {\n /* Frame 12 */\n box-sizing: border-box;\n\n /* Auto layout */\n\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n padding: 4px 12px;\n gap: 0.5rem;\n font-size: 16px;\n font-weight: 500;\n font-family: inherit;\n\n width: 100%;\n height: 48px;\n\n color: var(--nylas-base-800);\n background: var(--nylas-base-0);\n border: none;\n outline: 1.5px solid var(--nylas-base-200);\n border-radius: var(--nylas-border-radius-2x);\n\n flex: none;\n order: 4;\n align-self: stretch;\n flex-grow: 0;\n\n cursor: pointer;\n\n &:hover,\n &:focus {\n color: var(--nylas-primary);\n outline-color: var(--nylas-primary);\n }\n\n &.selected {\n font-weight: 600;\n color: var(--nylas-primary);\n outline: 2px solid var(--nylas-primary);\n border-color: transparent;\n box-shadow: 0 0 0 2px var(--nylas-primary);\n }\n}\n\n.empty {\n text-align: center;\n padding: 0 1.5rem;\n color: var(--nylas-base-600);\n font-size: min(max(12px, 2vw), 14px);\n height: 450px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n@keyframes pulsate {\n 0% {\n background-color: var(--nylas-base-50);\n }\n\n 50% {\n background-color: var(--nylas-base-100);\n }\n\n 100% {\n background-color: var(--nylas-base-50);\n }\n}\n\n.loading {\n padding: 0 1.5rem;\n\n .timeslot-skeleton {\n width: 100%;\n height: 4rem;\n background-color: var(--nylas-base-50);\n margin-bottom: 0.5rem;\n border-radius: var(--nylas-border-radius-2x);\n animation: pulsate 1.5s infinite ease-in-out;\n }\n}\n\n.footer {\n width: 100%;\n padding: 14px;\n box-sizing: border-box;\n border-top: 1px solid var(--nylas-base-200);\n}\n","import { RegisterComponent } from '@/common/register-component';\nimport { debug, isSameDay } from '@/utils/utils';\nimport { Component, Event, EventEmitter, Host, Prop, State, Watch, h } from '@stencil/core';\nimport { NylasSchedulerConnector } from '../../..';\nimport { NylasScheduling } from '../nylas-scheduling/nylas-scheduling';\nimport { AvailabilityTimeslot } from '@/stores/scheduler-store';\nimport type { Timeslot } from '@nylas/core';\nimport i18next from '@/utils/i18n';\n\n/**\n * The `nylas-timeslot-picker` component is a UI component that allows users to select a timeslot from a list of available timeslots.\n *\n * @slot timeslot-picker-cta-label - The label for the timeslot picker CTA. Default is \"Next\".\n * @part ntp - The timeslot picker component.\n * @part ntp__timeslot - The timeslot button.\n * @part ntp__timeslot--selected - The selected timeslot button.\n * @part ntp__button-primary - The timeslot picker CTA.\n */\n@Component({\n tag: 'nylas-timeslot-picker',\n styleUrl: 'nylas-timeslot-picker.scss',\n shadow: true,\n})\nexport class NylasTimeslotPicker {\n /**\n * @standalone\n * The available timeslots.\n */\n @Prop({ attribute: 'availability' }) readonly availability?: AvailabilityTimeslot[];\n /**\n * @standalone\n * The loading state prop. Used to display loading state when fetching availability.\n */\n @Prop({ attribute: 'loading-state' }) readonly isLoading?: boolean;\n /**\n * The selected timeslot.\n */\n @Prop({ attribute: 'selected-timeslot' }) readonly selectedTimeslot?: Timeslot;\n /**\n * The selected timezone.\n */\n @Prop({ attribute: 'selected-timezone' }) readonly selectedTimezone: string = Intl.DateTimeFormat().resolvedOptions().timeZone;\n /**\n * The selected date.\n */\n @Prop({ attribute: 'selected-date' }) readonly selectedDate?: Date = new Date();\n /**\n * The selected language.\n */\n @Prop() selectedLanguage?: string;\n\n /**\n * This event is fired when a timeslot is selected.\n */\n @Event() readonly timeslotSelected!: EventEmitter<Timeslot>;\n /**\n * This event is fired when a timeslot is confirmed. By default, this will proceed to the booking form page.\n */\n @Event() readonly timeslotConfirmed!: EventEmitter<Timeslot>;\n\n @State() times: AvailabilityTimeslot[] = [];\n @State() hoveredTimeslotIndex?: number;\n @State() selectedTimeslotIndex?: string;\n\n @Watch('selectedLanguage')\n selectedLanguageChanged(newLanguage: string) {\n i18next.changeLanguage(newLanguage);\n }\n\n @Watch('selectedDate')\n selectedDateChanged(newVal: Date | null | undefined) {\n debug(`[nylas-timeslot-picker] Selected date changed`, { newVal });\n\n if (newVal) {\n this.selectedTimeslotIndex = '';\n if (typeof newVal !== 'undefined') {\n const availableTimes = this.availability?.filter(timeslot => isSameDay(timeslot.start_time, newVal)).map(timeslot => timeslot);\n this.times = availableTimes || [];\n }\n }\n }\n\n @Watch('availability')\n availabilityChanged(newVal: AvailabilityTimeslot[] | undefined) {\n debug(`[nylas-timeslot-picker] Available times changed`, { newVal, selectedDate: this.selectedDate });\n\n if (typeof newVal !== 'undefined') {\n const availableTimes = newVal?.filter(timeslot => this.selectedDate && isSameDay(timeslot.start_time, this.selectedDate)).map(timeslot => timeslot);\n this.times = availableTimes || [];\n }\n }\n\n connectedCallback() {}\n\n disconnectedCallback() {}\n\n async componentWillLoad() {\n const availableTimes = this.availability?.filter(timeslot => this.selectedDate && isSameDay(timeslot.start_time, this.selectedDate)).map(timeslot => timeslot);\n this.times = availableTimes || [];\n debug(`[nylas-timeslot-picker] Component will load`, { selectedDate: this.selectedDate, availability: this.availability, times: this.times });\n }\n\n async componentDidLoad() {\n debug(`[nylas-timeslot-picker] Component did load`);\n }\n\n private getTimeslotId(date: Date, index: number) {\n return `${date.toLocaleDateString()}-${index}`;\n }\n\n private onClickSelectTime(timeslot: Timeslot, index: number) {\n debug(`[nylas-timeslot-picker] Time selected`, timeslot, index);\n this.selectedTimeslotIndex = this.getTimeslotId(timeslot.start_time, index);\n this.timeslotSelected.emit({\n start_time: timeslot.start_time,\n end_time: timeslot.end_time,\n emails: timeslot.emails,\n });\n }\n\n private handleConfirmedTimeslot = async (event: Event, timeslot: Timeslot | undefined) => {\n event.preventDefault();\n debug(`[nylas-timeslot-picker] Confirm timeslot`, timeslot);\n this.timeslotConfirmed.emit(timeslot);\n };\n\n private handleMouseEnter = (index: number) => {\n this.hoveredTimeslotIndex = index;\n };\n\n private handleMouseLeave = () => {\n this.hoveredTimeslotIndex = -1;\n };\n\n private getTimeSlotLabel(timeslot: Timeslot) {\n const timeFormat = new Intl.DateTimeFormat('en-US', {\n hour: '2-digit',\n minute: '2-digit',\n timeZone: this.selectedTimezone,\n });\n return `${timeFormat.format(timeslot.start_time)} - ${timeFormat.format(timeslot.end_time)}`;\n }\n\n @RegisterComponent<NylasTimeslotPicker, NylasSchedulerConnector, Exclude<NylasScheduling['stores'], undefined>>({\n name: 'nylas-timeslot-picker',\n stateToProps: new Map([\n ['scheduler.selectedDate', 'selectedDate'],\n ['scheduler.availability', 'availability'],\n ['scheduler.selectedTimeslot', 'selectedTimeslot'],\n ['scheduler.selectedTimezone', 'selectedTimezone'],\n ['scheduler.selectedLanguage', 'selectedLanguage'],\n ['scheduler.isLoading', 'isLoading'],\n ]),\n eventToProps: {\n timeslotSelected: async (event: CustomEvent<Timeslot>, nylasSchedulerConnector: NylasSchedulerConnector) => {\n debug('nylas-timeslot-picker', 'timeslotSelected', event.detail);\n nylasSchedulerConnector.scheduler.selectTime(event.detail);\n },\n timeslotConfirmed: async (event: CustomEvent<Timeslot>, nylasSchedulerConnector: NylasSchedulerConnector) => {\n debug('nylas-timeslot-picker', 'timeslotConfirmed', event.detail);\n if (event.detail) {\n nylasSchedulerConnector.scheduler.toggleAdditionalData(true);\n }\n },\n },\n fireRegisterEvent: true,\n })\n render() {\n if (this.isLoading) {\n return (\n <Host>\n <div class={'loading'}>\n {new Array(6).fill(0).map((_, i) => (\n <div class={'timeslot-skeleton'} style={{ animationDelay: `${i * 20}ms` }} />\n ))}\n </div>\n </Host>\n );\n }\n\n if (this.availability && this.availability.length === 0) {\n return (\n <Host>\n <div class={'empty'}>\n <span>No dates available</span>\n </div>\n </Host>\n );\n }\n\n if ((!this.times || this.times.length === 0) && !!this.selectedDate) {\n return (\n <Host>\n <div class={'empty'}>\n <span>No time slots available for selected date</span>\n </div>\n </Host>\n );\n }\n\n if (!this.selectedDate) return <Host></Host>;\n\n return (\n <Host part=\"ntp\">\n <div class={'time-picker-wrapper'}>\n <div class={'timeslots'}>\n {this.times.map((timeslot, index) => (\n <button\n part={`ntp__timeslot ${this.selectedTimeslot?.start_time?.getTime() === timeslot.start_time.getTime() ? 'ntp__timeslot--selected' : ''}`}\n aria-role=\"button\"\n class={{\n time: true,\n selected: typeof this.selectedTimeslot !== 'undefined' && this.selectedTimeslot?.start_time?.getTime() === timeslot.start_time.getTime(),\n }}\n onClick={() => this.onClickSelectTime(timeslot, index)}\n onMouseEnter={() => this.handleMouseEnter(index)}\n onMouseLeave={() => this.handleMouseLeave()}\n >\n {this.hoveredTimeslotIndex == index || this.selectedTimeslotIndex == this.getTimeslotId(timeslot.start_time, index)\n ? this.getTimeSlotLabel(timeslot)\n : timeslot.start_time.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', timeZone: this.selectedTimezone })}\n </button>\n ))}\n </div>\n {this.selectedTimeslot && (\n <div class={'footer'}>\n <button-component variant={'primary'} onClick={(event: Event) => this.handleConfirmedTimeslot(event, this.selectedTimeslot)} part=\"ntp__button-primary\">\n <slot name=\"timeslot-picker-cta-label\">{i18next.t('nextButton')}</slot>\n </button-component>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"nylas-timeslot-picker2.js","mappings":";;;;;;AAAA,MAAM,sBAAsB,GAAG,2oEAA2oE,CAAC;AAC3qE,kCAAe,sBAAsB;;;;;;;;;;;;;;;;MCsBxB,mBAAmB;;;;;;;QAiGtB,4BAAuB,GAAG,OAAO,KAAY,EAAE,QAA8B;YACnF,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,KAAK,CAAC,0CAA0C,EAAE,QAAQ,CAAC,CAAC;YAC5D,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACvC,CAAC;QAEM,qBAAgB,GAAG,CAAC,KAAa;YACvC,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;SACnC,CAAC;QAEM,qBAAgB,GAAG;YACzB,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC,CAAC;SAChC,CAAC;;;;gCA3F4E,IAAI,CAAC,cAAc,EAAE,CAAC,eAAe,EA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BAAkB,CAAC;YAClD,CAAC,4BAA4B,EAAE,kBAAkB,CAAC;YAClD,CAAC,4BAA4B,EAAE,kBAAkB,CAAC;YAClD,CAAC,qBAAqB,EAAE,WAAW,CAAC;SACrC,CAAC;QACF,YAAY,EAAE;YACZ,gBAAgB,EAAE,OAAO,KAA4B,EAAE,uBAAgD;gBACrG,KAAK,CAAC,uBAAuB,EAAE,kBAAkB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;gBACjE,uBAAuB,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;aAC5D;YACD,iBAAiB,EAAE,OAAO,KAA4B,EAAE,uBAAgD;gBACtG,KAAK,CAAC,uBAAuB,EAAE,mBAAmB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;gBAClE,IAAI,KAAK,CAAC,MAAM,EAAE;oBAChB,uBAAuB,CAAC,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;iBAC9D;aACF;SACF;QACD,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;iDAoED;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["i18next"],"sources":["src/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.scss?tag=nylas-timeslot-picker&encapsulation=shadow","src/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.tsx"],"sourcesContent":["@import '../../../common/styles/variables.scss';\n\n:host {\n display: block;\n height: calc(100% - 48px); //48px is the height of the header\n @include default-css-variables;\n}\n\n.time-picker-wrapper {\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n\n.timeslots {\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 0.75rem;\n align-items: center;\n overflow-y: scroll;\n padding: 0.5rem 1.5rem 1.5rem;\n flex: 1;\n}\n\n.time {\n /* Frame 12 */\n box-sizing: border-box;\n\n /* Auto layout */\n\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n padding: 4px 12px;\n gap: 0.5rem;\n font-size: 16px;\n font-weight: 500;\n font-family: inherit;\n\n width: 100%;\n height: 48px;\n\n color: var(--nylas-base-800);\n background: var(--nylas-base-0);\n border: none;\n outline: 1.5px solid var(--nylas-base-200);\n border-radius: var(--nylas-border-radius-2x);\n\n flex: none;\n order: 4;\n align-self: stretch;\n flex-grow: 0;\n\n cursor: pointer;\n\n &:hover,\n &:focus {\n color: var(--nylas-primary);\n outline-color: var(--nylas-primary);\n }\n\n &.selected {\n font-weight: 600;\n color: var(--nylas-primary);\n outline: 2px solid var(--nylas-primary);\n border-color: transparent;\n box-shadow: 0 0 0 2px var(--nylas-primary);\n }\n}\n\n.empty {\n text-align: center;\n padding: 0 1.5rem;\n color: var(--nylas-base-600);\n font-size: min(max(12px, 2vw), 14px);\n height: 450px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n@keyframes pulsate {\n 0% {\n background-color: var(--nylas-base-50);\n }\n\n 50% {\n background-color: var(--nylas-base-100);\n }\n\n 100% {\n background-color: var(--nylas-base-50);\n }\n}\n\n.loading {\n padding: 0 1.5rem;\n\n .timeslot-skeleton {\n width: 100%;\n height: 4rem;\n background-color: var(--nylas-base-50);\n margin-bottom: 0.5rem;\n border-radius: var(--nylas-border-radius-2x);\n animation: pulsate 1.5s infinite ease-in-out;\n }\n}\n\n.footer {\n width: 100%;\n padding: 14px;\n box-sizing: border-box;\n border-top: 1px solid var(--nylas-base-200);\n}\n","import { RegisterComponent } from '@/common/register-component';\nimport { debug, isSameDay } from '@/utils/utils';\nimport { Component, Event, EventEmitter, Host, Prop, State, Watch, h } from '@stencil/core';\nimport { NylasSchedulerConnector } from '../../..';\nimport { NylasScheduling } from '../nylas-scheduling/nylas-scheduling';\nimport { AvailabilityTimeslot } from '@/stores/scheduler-store';\nimport type { Timeslot } from '@nylas/core';\nimport i18next from '@/utils/i18n';\n\n/**\n * The `nylas-timeslot-picker` component is a UI component that allows users to select a timeslot from a list of available timeslots.\n *\n * @slot timeslot-picker-cta-label - The label for the timeslot picker CTA. Default is \"Next\".\n * @part ntp - The timeslot picker component.\n * @part ntp__timeslot - The timeslot button.\n * @part ntp__timeslot--selected - The selected timeslot button.\n * @part ntp__button-primary - The timeslot picker CTA.\n */\n@Component({\n tag: 'nylas-timeslot-picker',\n styleUrl: 'nylas-timeslot-picker.scss',\n shadow: true,\n})\nexport class NylasTimeslotPicker {\n /**\n * @standalone\n * The available timeslots.\n */\n @Prop({ attribute: 'availability' }) readonly availability?: AvailabilityTimeslot[];\n /**\n * @standalone\n * The loading state prop. Used to display loading state when fetching availability.\n */\n @Prop({ attribute: 'loading-state' }) readonly isLoading?: boolean;\n /**\n * The selected timeslot.\n */\n @Prop({ attribute: 'selected-timeslot' }) readonly selectedTimeslot?: Timeslot;\n /**\n * The selected timezone.\n */\n @Prop({ attribute: 'selected-timezone' }) readonly selectedTimezone: string = Intl.DateTimeFormat().resolvedOptions().timeZone;\n /**\n * The selected date.\n */\n @Prop({ attribute: 'selected-date' }) readonly selectedDate?: Date = new Date();\n /**\n * The selected language.\n */\n @Prop() selectedLanguage?: string;\n\n /**\n * This event is fired when a timeslot is selected.\n */\n @Event() readonly timeslotSelected!: EventEmitter<Timeslot>;\n /**\n * This event is fired when a timeslot is confirmed. By default, this will proceed to the booking form page.\n */\n @Event() readonly timeslotConfirmed!: EventEmitter<Timeslot>;\n\n @State() times: AvailabilityTimeslot[] = [];\n @State() hoveredTimeslotIndex?: number;\n @State() selectedTimeslotIndex?: string;\n\n @Watch('selectedLanguage')\n selectedLanguageChanged(newLanguage: string) {\n i18next.changeLanguage(newLanguage);\n }\n\n @Watch('selectedDate')\n selectedDateChanged(newVal: Date | null | undefined) {\n debug(`[nylas-timeslot-picker] Selected date changed`, { newVal });\n\n if (newVal) {\n this.selectedTimeslotIndex = '';\n if (typeof newVal !== 'undefined') {\n const availableTimes = this.availability?.filter(timeslot => isSameDay(timeslot.start_time, newVal)).map(timeslot => timeslot);\n this.times = availableTimes || [];\n }\n }\n }\n\n @Watch('availability')\n availabilityChanged(newVal: AvailabilityTimeslot[] | undefined) {\n debug(`[nylas-timeslot-picker] Available times changed`, { newVal, selectedDate: this.selectedDate });\n\n if (typeof newVal !== 'undefined') {\n const availableTimes = newVal?.filter(timeslot => this.selectedDate && isSameDay(timeslot.start_time, this.selectedDate)).map(timeslot => timeslot);\n this.times = availableTimes || [];\n }\n }\n\n connectedCallback() {}\n\n disconnectedCallback() {}\n\n async componentWillLoad() {\n debug(`[nylas-timeslot-picker] Component will load`, { selectedDate: this.selectedDate, availability: this.availability, times: this.times });\n }\n\n async componentDidLoad() {\n debug(`[nylas-timeslot-picker] Component did load`);\n const availableTimes = this.availability?.filter(timeslot => this.selectedDate && isSameDay(timeslot.start_time, this.selectedDate)).map(timeslot => timeslot);\n this.times = availableTimes || [];\n }\n\n private getTimeslotId(date: Date, index: number) {\n return `${date.toLocaleDateString()}-${index}`;\n }\n\n private onClickSelectTime(timeslot: Timeslot, index: number) {\n debug(`[nylas-timeslot-picker] Time selected`, timeslot, index);\n this.selectedTimeslotIndex = this.getTimeslotId(timeslot.start_time, index);\n this.timeslotSelected.emit({\n start_time: timeslot.start_time,\n end_time: timeslot.end_time,\n emails: timeslot.emails,\n });\n }\n\n private handleConfirmedTimeslot = async (event: Event, timeslot: Timeslot | undefined) => {\n event.preventDefault();\n debug(`[nylas-timeslot-picker] Confirm timeslot`, timeslot);\n this.timeslotConfirmed.emit(timeslot);\n };\n\n private handleMouseEnter = (index: number) => {\n this.hoveredTimeslotIndex = index;\n };\n\n private handleMouseLeave = () => {\n this.hoveredTimeslotIndex = -1;\n };\n\n private getTimeSlotLabel(timeslot: Timeslot) {\n const timeFormat = new Intl.DateTimeFormat('en-US', {\n hour: '2-digit',\n minute: '2-digit',\n timeZone: this.selectedTimezone,\n });\n return `${timeFormat.format(timeslot.start_time)} - ${timeFormat.format(timeslot.end_time)}`;\n }\n\n @RegisterComponent<NylasTimeslotPicker, NylasSchedulerConnector, Exclude<NylasScheduling['stores'], undefined>>({\n name: 'nylas-timeslot-picker',\n stateToProps: new Map([\n ['scheduler.selectedDate', 'selectedDate'],\n ['scheduler.availability', 'availability'],\n ['scheduler.selectedTimeslot', 'selectedTimeslot'],\n ['scheduler.selectedTimezone', 'selectedTimezone'],\n ['scheduler.selectedLanguage', 'selectedLanguage'],\n ['scheduler.isLoading', 'isLoading'],\n ]),\n eventToProps: {\n timeslotSelected: async (event: CustomEvent<Timeslot>, nylasSchedulerConnector: NylasSchedulerConnector) => {\n debug('nylas-timeslot-picker', 'timeslotSelected', event.detail);\n nylasSchedulerConnector.scheduler.selectTime(event.detail);\n },\n timeslotConfirmed: async (event: CustomEvent<Timeslot>, nylasSchedulerConnector: NylasSchedulerConnector) => {\n debug('nylas-timeslot-picker', 'timeslotConfirmed', event.detail);\n if (event.detail) {\n nylasSchedulerConnector.scheduler.toggleAdditionalData(true);\n }\n },\n },\n fireRegisterEvent: true,\n })\n render() {\n if (this.isLoading) {\n return (\n <Host>\n <div class={'loading'}>\n {new Array(6).fill(0).map((_, i) => (\n <div class={'timeslot-skeleton'} style={{ animationDelay: `${i * 20}ms` }} />\n ))}\n </div>\n </Host>\n );\n }\n\n if (this.availability && this.availability.length === 0) {\n return (\n <Host>\n <div class={'empty'}>\n <span>No dates available</span>\n </div>\n </Host>\n );\n }\n\n if ((!this.times || this.times.length === 0) && !!this.selectedDate) {\n return (\n <Host>\n <div class={'empty'}>\n <span>No time slots available for selected date</span>\n </div>\n </Host>\n );\n }\n\n if (!this.selectedDate) return <Host></Host>;\n\n return (\n <Host part=\"ntp\">\n <div class={'time-picker-wrapper'}>\n <div class={'timeslots'}>\n {this.times.map((timeslot, index) => (\n <button\n part={`ntp__timeslot ${this.selectedTimeslot?.start_time?.getTime() === timeslot.start_time.getTime() ? 'ntp__timeslot--selected' : ''}`}\n aria-role=\"button\"\n class={{\n time: true,\n selected: typeof this.selectedTimeslot !== 'undefined' && this.selectedTimeslot?.start_time?.getTime() === timeslot.start_time.getTime(),\n }}\n onClick={() => this.onClickSelectTime(timeslot, index)}\n onMouseEnter={() => this.handleMouseEnter(index)}\n onMouseLeave={() => this.handleMouseLeave()}\n >\n {this.hoveredTimeslotIndex == index || this.selectedTimeslotIndex == this.getTimeslotId(timeslot.start_time, index)\n ? this.getTimeSlotLabel(timeslot)\n : timeslot.start_time.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', timeZone: this.selectedTimezone })}\n </button>\n ))}\n </div>\n {this.selectedTimeslot && (\n <div class={'footer'}>\n <button-component variant={'primary'} onClick={(event: Event) => this.handleConfirmedTimeslot(event, this.selectedTimeslot)} part=\"ntp__button-primary\">\n <slot name=\"timeslot-picker-cta-label\">{i18next.t('nextButton')}</slot>\n </button-component>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -203,6 +203,7 @@ var __metadata$w = (undefined && undefined.__metadata) || function (k, v) {
|
|
|
203
203
|
const InputImageUrl = class {
|
|
204
204
|
constructor(hostRef) {
|
|
205
205
|
registerInstance(this, hostRef);
|
|
206
|
+
this.nylasFormInputImageUrlInvalid = createEvent(this, "nylasFormInputImageUrlInvalid", 7);
|
|
206
207
|
this.valueChanged = createEvent(this, "valueChanged", 7);
|
|
207
208
|
if (hostRef.$hostElement$["s-ei"]) {
|
|
208
209
|
this.internals = hostRef.$hostElement$["s-ei"];
|
|
@@ -271,12 +272,15 @@ const InputImageUrl = class {
|
|
|
271
272
|
this.valueChanged.emit({ value: this.currentImageUrl, name: this.name });
|
|
272
273
|
})
|
|
273
274
|
.catch(() => {
|
|
274
|
-
this.internals.setValidity({ customError: true }, 'Invalid image URL.');
|
|
275
275
|
this.errorMessage = 'Invalid image URL.';
|
|
276
|
+
this.nylasFormInputImageUrlInvalid.emit({ value: 'Invalid image URL.', name: this.name });
|
|
277
|
+
if (typeof this.internals.setValidity === 'function') {
|
|
278
|
+
this.internals.setValidity({ customError: true }, 'Invalid image URL.');
|
|
279
|
+
}
|
|
276
280
|
});
|
|
277
281
|
}
|
|
278
282
|
render() {
|
|
279
|
-
return (h(Host, { key: '
|
|
283
|
+
return (h(Host, { key: '27db94b782ae96518852a8486821a7f6544492a2' }, h("div", { key: '3923ce12503dd454e716e002b693b8e5f7e7e991', class: "logo-container" }, h("div", { key: '004c0dfb0e5ec721e356b4915fbdd75f84a67301', class: "input-container" }, h("input-component", { key: 'f06812996be4fd6384fffc2c095e62ba7067881d', name: this.name, id: this.name, type: "text", required: false, exportparts: "ic_input: iiu__logo-input-textfield", defaultValue: this.imageUrl ?? '' }), this.errorMessage && h("span", { class: "error-message" }, this.errorMessage)), this.currentImageUrl && !this.errorMessage && (h("div", { class: "logo" }, h("img", { src: this.currentImageUrl, alt: "Logo" }))))));
|
|
280
284
|
}
|
|
281
285
|
static get formAssociated() { return true; }
|
|
282
286
|
get host() { return getElement(this); }
|
|
@@ -417,20 +421,23 @@ const NylasAdditionalParticipants = class {
|
|
|
417
421
|
disconnectedCallback() {
|
|
418
422
|
debug('nylas-additional-participants', 'disconnectedCallback');
|
|
419
423
|
}
|
|
424
|
+
get isInternalsAvailable() {
|
|
425
|
+
return this.internals !== undefined && typeof this.internals.setFormValue === 'function' && typeof this.internals.setValidity === 'function';
|
|
426
|
+
}
|
|
420
427
|
onInputOptionChanged(event) {
|
|
421
428
|
debug('nylas-additional-participants', 'onInputOptionChanged');
|
|
422
|
-
const EMAIL_REGEX = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,
|
|
429
|
+
const EMAIL_REGEX = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
423
430
|
const index = event.detail.name;
|
|
424
431
|
const participant = this.participantOptions?.find(participant => participant.email === event.detail.value);
|
|
425
432
|
if (!participant && this.isRoundRobinConfig) {
|
|
426
|
-
this.internals.setValidity({ customError: true }, 'For round robin configuration, participant should be selected from the dropdown.');
|
|
433
|
+
this.isInternalsAvailable && this.internals.setValidity({ customError: true }, 'For round robin configuration, participant should be selected from the dropdown.');
|
|
427
434
|
this.participantErrors[index] = 'For round robin page, participant should be selected from the dropdown.';
|
|
428
435
|
this.participants[index].is_valid = false;
|
|
429
436
|
this.participants = [...this.participants];
|
|
430
437
|
return;
|
|
431
438
|
}
|
|
432
439
|
else if (!participant && !EMAIL_REGEX.test(event.detail.value)) {
|
|
433
|
-
this.internals.setValidity({ customError: true }, 'Please enter a valid email address');
|
|
440
|
+
this.isInternalsAvailable && this.internals.setValidity({ customError: true }, 'Please enter a valid email address');
|
|
434
441
|
this.participantErrors[index] = 'Please enter a valid email address';
|
|
435
442
|
this.participants[index].is_valid = false;
|
|
436
443
|
this.participants = [...this.participants];
|
|
@@ -439,7 +446,7 @@ const NylasAdditionalParticipants = class {
|
|
|
439
446
|
else {
|
|
440
447
|
this.participantErrors[index] = '';
|
|
441
448
|
this.participants[index].is_valid = true;
|
|
442
|
-
this.internals.setValidity({});
|
|
449
|
+
this.isInternalsAvailable && this.internals.setValidity({});
|
|
443
450
|
}
|
|
444
451
|
this.participants[index].email = event.detail.value;
|
|
445
452
|
this.participants[index].availability = participant ? { calendar_ids: ['primary'] } : undefined;
|
|
@@ -478,24 +485,17 @@ const NylasAdditionalParticipants = class {
|
|
|
478
485
|
this.participants = this.participants.filter((_, i) => i !== index);
|
|
479
486
|
this.updateFormValue();
|
|
480
487
|
}
|
|
481
|
-
validate(email, index) {
|
|
482
|
-
debug('nylas-additional-participants', 'validate');
|
|
483
|
-
const regex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
484
|
-
const valid = regex.test(String(email).toLowerCase());
|
|
485
|
-
this.participants[index].is_valid = valid;
|
|
486
|
-
this.updateFormValue();
|
|
487
|
-
}
|
|
488
488
|
updateFormValue() {
|
|
489
489
|
debug('nylas-additional-participants', 'updateFormValue');
|
|
490
490
|
const participants = this.isRoundRobinConfig ? (this.includeOrganizerAsParticipant ? this.participants : this.participants.filter(p => !p.is_organizer)) : this.participants;
|
|
491
491
|
if (participants.length === 0) {
|
|
492
|
-
this.internals.setValidity({ customError: true }, 'Please add at least one participant');
|
|
492
|
+
this.isInternalsAvailable && this.internals.setValidity({ customError: true }, 'Please add at least one participant');
|
|
493
493
|
this.error = 'Please add at least one participant';
|
|
494
494
|
}
|
|
495
495
|
else {
|
|
496
|
-
this.internals.setValidity({});
|
|
496
|
+
this.isInternalsAvailable && this.internals.setValidity({});
|
|
497
497
|
this.error = '';
|
|
498
|
-
this.internals.setFormValue(JSON.stringify(participants), this.name);
|
|
498
|
+
this.isInternalsAvailable && this.internals.setFormValue(JSON.stringify(participants), this.name);
|
|
499
499
|
this.valueChanged.emit({ value: JSON.stringify(participants), name: this.name });
|
|
500
500
|
}
|
|
501
501
|
}
|
|
@@ -506,7 +506,7 @@ const NylasAdditionalParticipants = class {
|
|
|
506
506
|
});
|
|
507
507
|
}
|
|
508
508
|
render() {
|
|
509
|
-
return (h(Host, { key: '
|
|
509
|
+
return (h(Host, { key: '16a28d7d8ee91b685a22472d8a90721a5074d798', part: "nap" }, h("nylas-form-card", { key: '9fde59eadfcdf05c3b4add30a5c35f9b21d00c30' }, h("h3", { key: '82e3c3ad537ef4c60d19695f11e481bac2ed31ae', slot: "header-title", class: "nylas-additional-participants__title", part: "nap__title" }, "Participants"), h("p", { key: '4df3d661d2c6801ba8e88d82853ae562ed3be8e8', slot: "header-subtitle", class: "nylas-additional-participants__subtitle", part: "nap__subtitle" }, "Add people in your team or organization to join the event."), h("div", { key: '3ccb34354c025b52760433683812acf37b480e77', slot: "content", class: "nylas-additional-participants__content" }, h("div", { key: '007cf8396921637cf230cc26d73de147169cd250' }, this.participants.map((participant, index) => {
|
|
510
510
|
return (h("div", { class: 'nylas-additional-participants__input_group', part: "nap__input_group" }, !participant.is_organizer && h("label", null, `Participant ${index}`), h("div", { part: "nap__input_wrapper", class: {
|
|
511
511
|
'nylas-additional-participants__input_wrapper': true,
|
|
512
512
|
'nylas-additional-participants__input_wrapper_organizer': participant?.is_organizer === true,
|
|
@@ -516,7 +516,7 @@ const NylasAdditionalParticipants = class {
|
|
|
516
516
|
this.includeOrganizerAsParticipant = !this.includeOrganizerAsParticipant;
|
|
517
517
|
this.updateFormValue();
|
|
518
518
|
}, checked: this.includeOrganizerAsParticipant }), h("label", { htmlFor: `organizer_participant`, "aria-label": "Include as participant" }, "Participant", h("tooltip-component", { id: "organizer_participant_tooltip" }, h("info-icon", { slot: "tooltip-icon" }), h("span", { slot: "tooltip-content" }, h("strong", null, "Include Organizer:"), " The organizer (you) will be included in the round-robin rotation. ", h("br", null), h("strong", null, "Exclude Organizer:"), " The organizer (you) will not be included in the round-robin rotation."))))))) : (h("input-dropdown", { id: `${index}`, name: `${index}`, filterable: true, inputValue: participant.email, options: this.getArrayDifference(this.participantOptions || [], this.participants) })), !participant.is_organizer && (h("button", { onClick: () => this.removeParticipant(index), part: "nap__remove-participant" }, h("close-icon", null))))), !participant.is_valid && (h("p", { class: "nylas-additional-participants__error", part: "nap__error" }, this.participantErrors[index]))));
|
|
519
|
-
}), h("p", { key: '
|
|
519
|
+
}), h("p", { key: 'f1dd954c137093fa9e474f3886e4b5320aeb5e2e', class: "nylas-additional-participants__error", part: "nap__error" }, this.error)), h("button", { key: '859585010fc9fce314b856f5e7e07ac8b8c47b88', class: "nylas-additional-participants__add", part: "nap__add-participant", onClick: () => this.addParticipant() }, h("add-circle-icon", { key: 'aec7eb5de30e66bca29b73962f356109471c2e9e' }), " ", h("span", { key: 'f07ecfaa4db46f7954d734314c46f2d773158730' }, "Add ", this.participants.length > 1 ? 'another' : 'a', " participant"))))));
|
|
520
520
|
}
|
|
521
521
|
static get formAssociated() { return true; }
|
|
522
522
|
get host() { return getElement(this); }
|
|
@@ -5378,9 +5378,9 @@ const NylasConfirmationEmail = class {
|
|
|
5378
5378
|
}
|
|
5379
5379
|
this.selectedConfiguration = undefined;
|
|
5380
5380
|
this.confirmationEmailTemplate = {};
|
|
5381
|
-
this.isOpen = false;
|
|
5382
5381
|
this.participants = [];
|
|
5383
5382
|
this.name = 'confirmation-email-template';
|
|
5383
|
+
this.isOpen = false;
|
|
5384
5384
|
this.confirmationEmail = undefined;
|
|
5385
5385
|
this.isConfirmationEmailOpen = this.isOpen;
|
|
5386
5386
|
this.participantsState = this.participants;
|
|
@@ -5433,8 +5433,17 @@ const NylasConfirmationEmail = class {
|
|
|
5433
5433
|
const { value, name } = event.detail;
|
|
5434
5434
|
if (name === 'confirmation-email-logo') {
|
|
5435
5435
|
this.confirmationEmail = { ...this.confirmationEmail, logo: value };
|
|
5436
|
-
this.internals.setFormValue(JSON.stringify(this.confirmationEmail), this.name);
|
|
5437
5436
|
this.valueChanged.emit({ value: JSON.stringify(this.confirmationEmail), name: this.name });
|
|
5437
|
+
if (typeof this.internals.setValidity === 'function' && typeof this.internals.setFormValue === 'function') {
|
|
5438
|
+
this.internals.setFormValue(JSON.stringify(this.confirmationEmail), this.name);
|
|
5439
|
+
this.internals.setValidity({});
|
|
5440
|
+
}
|
|
5441
|
+
}
|
|
5442
|
+
}
|
|
5443
|
+
async nylasFormInputImageUrlInvalidHandler(event) {
|
|
5444
|
+
const { value, name } = event.detail;
|
|
5445
|
+
if (name === 'confirmation-email-logo' && typeof this.internals.setValidity === 'function') {
|
|
5446
|
+
this.internals.setValidity({ customError: true }, value || 'Invalid image URL.');
|
|
5438
5447
|
}
|
|
5439
5448
|
}
|
|
5440
5449
|
updateConfirmationFormValue() {
|
|
@@ -5454,7 +5463,7 @@ const NylasConfirmationEmail = class {
|
|
|
5454
5463
|
render() {
|
|
5455
5464
|
const organizer = this.participantsState.find(p => p.is_organizer);
|
|
5456
5465
|
const organizerName = organizer?.name || organizer?.email;
|
|
5457
|
-
return (h(Host, { key: '
|
|
5466
|
+
return (h(Host, { key: 'bc4803b94f914d083bd33cf4cecd0cac70b0658c' }, h("div", { key: '6445d38b903bffd19b4db004e850f6488ed4c27f', class: "nylas-confirmation-email", part: "nce" }, h("div", { key: '7ce1ccd72ef83717aec42fe0b533902e3a254796', class: "header", part: "nce__header" }, h("div", { key: 'cbceb816c30deebc4e053a7abd1da1c82c171ebe' }, h("h3", { key: '36f5b00d5a98d325341ff06b2bb3ba3cf951e94f' }, this.confirmationEmail?.booking_confirmed?.title ?? `Booking confirmed with ${organizerName ? ` ${organizerName}` : ''}`), h("p", { key: '6f72022d71e5f4e3c03d0f6d07d7f0f5bc0f9686' }, "Booking confirmation email")), this.isConfirmationEmailOpen ? (h("div", { class: "confirmation-email-toggle", part: "nce__confirmation-email-toggle--container" }, h("span", { class: `chevron ${this.isConfirmationEmailOpen ? 'open' : 'closed'} `, onClick: () => this.toggleConfirmationEmail() }, h("chevron-icon", { width: "24", height: "24" })))) : (h("button-component", { variant: 'basic', clickHandler: event => {
|
|
5458
5467
|
event.preventDefault();
|
|
5459
5468
|
this.toggleConfirmationEmail();
|
|
5460
5469
|
} }, h("edit-icon", { width: "16", height: "16" }), "Edit"))), this.isConfirmationEmailOpen ? (h("div", { class: "nylas-confirmation-email__body", part: "nce__body" }, h("div", { class: "nylas-confirmation-email__section" }, h("div", { class: "nylas-confirmation-email__row" }, h("label", null, "Send confirmation email", h("span", { class: "label-icon" }, h("tooltip-component", null, h("info-icon", { slot: "tooltip-icon" }), h("span", { slot: "tooltip-content" }, "You and your guests will receive a confirmation email immediately upon booking.")))), h("span", { class: "selected-value" }, "Immediately upon booking")), h("div", { class: "nylas-confirmation-email__row" }, h("div", { class: "subsection" }, h("div", { class: "input-container" }, h("label", null, "Company logo URL", h("span", { class: "label-icon" }, h("tooltip-component", null, h("info-icon", { slot: "tooltip-icon" }), h("span", { slot: "tooltip-content" }, "This logo appears in the booking confirmation email. The URL must be publicly accessible. The image will be scaled down to a max size of 200px x 100px.")))), this.confirmationEmail && (h("input-image-url", { name: "confirmation-email-logo", exportparts: "iiu__logo-input-textfield: nce__input-image-url", imageUrl: this.confirmationEmail?.logo ?? '' }))))), h("div", { class: "nylas-confirmation-email__row full-width-col" }, h("div", { class: "subsection" }, h("h3", null, "Email message"), h("div", { class: "input-container" }, h("label", { htmlFor: "title" }, "Custom email title", h("span", { class: "label-icon" }, h("tooltip-component", null, h("info-icon", { slot: "tooltip-icon" }), h("span", { slot: "tooltip-content" }, "An email title is a headline within the body of the email. This doesn't change the subject line.")))), h("input-component", { name: "confirmation-email-title", maxLength: 60, placeholder: `Booking confirmed ${organizerName ? `with ${organizerName}` : ''}`, defaultValue: this.confirmationEmail?.booking_confirmed?.title ?? '' })), h("div", { class: "input-container" }, h("textarea-component", { label: "Additional info", name: "confirmation-email-body", id: "confirmation-email-body", placeholder: "Default body", tooltip: "Scheduler adds the content of the box to the email body.", maxLength: 500, defaultValue: this.confirmationEmail?.booking_confirmed?.body ?? '' }))))))) : (h("div", { class: "nylas-confirmation-email__summary", part: "nce__summary" }, h("p", null, h("span", { class: "summary-icon" }, h("person-clipboard-icon", null)), "All host & guests"), h("p", null, h("span", { class: "summary-icon" }, h("clock-icon", null)), "Immediately on booking"))))));
|
|
@@ -6188,7 +6197,6 @@ const NylasEventDuration = class {
|
|
|
6188
6197
|
componentWillLoad() {
|
|
6189
6198
|
debug('nylas-event-duration', 'componentWillLoad');
|
|
6190
6199
|
this.host.setAttribute('name', this.name);
|
|
6191
|
-
this.setDurationMintueOptions();
|
|
6192
6200
|
}
|
|
6193
6201
|
componentDidLoad() {
|
|
6194
6202
|
debug('nylas-event-duration', 'componentDidLoad');
|
|
@@ -6198,7 +6206,10 @@ const NylasEventDuration = class {
|
|
|
6198
6206
|
this.duration = this.duration ? this.duration : this.eventDurationMinutes ? (this.eventDurationMinutes >= 60 ? this.eventDurationMinutes / 60 : this.eventDurationMinutes) : 30;
|
|
6199
6207
|
this.durationMinutes = this.durationMinutes ? this.durationMinutes : this.duration ? this.duration : 30;
|
|
6200
6208
|
this.durationIncrement = this.durationIncrement ? this.durationIncrement : this.duration >= 60 ? 60 : 1;
|
|
6201
|
-
this.
|
|
6209
|
+
this.setDurationMintueOptions();
|
|
6210
|
+
if (typeof this.internals.setFormValue === 'function') {
|
|
6211
|
+
this.internals.setFormValue(this.durationMinutes.toString(), 'duration');
|
|
6212
|
+
}
|
|
6202
6213
|
}
|
|
6203
6214
|
disconnectedCallback() {
|
|
6204
6215
|
debug('nylas-event-duration', 'disconnectedCallback');
|
|
@@ -6248,7 +6259,7 @@ const NylasEventDuration = class {
|
|
|
6248
6259
|
{ value: 1, label: 'minute' },
|
|
6249
6260
|
{ value: 60, label: 'hour' },
|
|
6250
6261
|
];
|
|
6251
|
-
return (h(Host, { key: '
|
|
6262
|
+
return (h(Host, { key: 'f6b60528b9c3f2978ac12beae9bf049a9b90fec5' }, h("div", { key: 'f7c778d981fa1d33ceed820d500e6820a4f1223c', class: "nylas-event-duration", part: "ned" }, h("label", { key: 'f461dcfeda616f50820d6cdacb5dfded22ec7aff', htmlFor: "duration" }, "Event duration", h("span", { key: '086d2458ad14f00f718fb9106c45d63576c9f734', class: "required" }, "*")), h("div", { key: 'cf27800dec77fbe74c9428de92fa042a419ddb25', class: "nylas-event-duration__wrapper" }, h("input-dropdown", { key: '06ed64927a69ca96bb9f9cc5cfede6d55c310598', name: 'event-duration', options: this.durationMinutesOptions, inputValue: this.duration.toString(), exportparts: "id_dropdown: ned__input_dropdown, id_dropdown-input: ned__input_dropdown-input, id_dropdown-content: ned__input_dropdown-content", defaultInputOption: this.durationMinutesOptions.find(i => i.value == this.duration) }), this.durationIncrement && (h("select-dropdown", { name: 'event-duration', options: durationOptions, pluralizedLabel: this.duration > 1 ? 's' : '', exportparts: "sd_dropdown: ned__dropdown, sd_dropdown-button: ned__dropdown-button, sd_dropdown-content: ned__dropdown-content", defaultSelectedOption: durationOptions.find(i => i.value == this.durationIncrement), withSearch: false }))))));
|
|
6252
6263
|
}
|
|
6253
6264
|
static get formAssociated() { return true; }
|
|
6254
6265
|
get host() { return getElement(this); }
|
|
@@ -6313,7 +6324,7 @@ const NylasEventInfo = class {
|
|
|
6313
6324
|
debug('nylas-event-info', 'disconnectedCallback');
|
|
6314
6325
|
}
|
|
6315
6326
|
render() {
|
|
6316
|
-
return (h(Host, { key: '
|
|
6327
|
+
return (h(Host, { key: 'be80a4e687ce223a8e52bbabc2e8acadcb194b11' }, h("nylas-form-card", { key: 'c96b77795ec2516889acf0f78c5eb723b26dd89c', exportparts: "nfc__header: nei__header" }, h("h1", { key: '890113187adcd6be1ab1d1beb489fe3a80124617', slot: "header-title", class: "nylas-event-info__title", part: "nei__title" }, "Event information"), h("div", { key: '44eaaae3833654530706dc93077b43a7597acc2c', slot: "content", class: "nylas-event-info__content" }, h("slot", { key: '7af737a67cb007c0ede7db5aa075828311d98da3', name: "inputs" })))));
|
|
6317
6328
|
}
|
|
6318
6329
|
static get formAssociated() { return true; }
|
|
6319
6330
|
get el() { return getElement(this); }
|
|
@@ -6372,7 +6383,7 @@ const NylasEventLimits = class {
|
|
|
6372
6383
|
debug('nylas-event-limits', 'disconnectedCallback');
|
|
6373
6384
|
}
|
|
6374
6385
|
render() {
|
|
6375
|
-
return (h(Host, { key: '
|
|
6386
|
+
return (h(Host, { key: '6a28113e3b403869e77cc3a2c9c3a1bea217dc52' }, h("nylas-form-card", { key: 'cf9004d044222d796ae59df58737ad9719a20576', exportparts: "nfc__header: nel__header" }, h("h1", { key: 'ffeeb7a5741c9f07fb4f9bd84016b1707e2b55b7', slot: "header-title", class: "nylas-event-limits__title" }, "Event limits"), h("div", { key: '7b51592d95736f860ec805950275a18e9d914c32', slot: "content", class: "nylas-event-limits__content" }, h("slot", { key: '53e9098d736eedf5b22e1b8ae712ec22c8ca865e', name: "inputs" })))));
|
|
6376
6387
|
}
|
|
6377
6388
|
static get formAssociated() { return true; }
|
|
6378
6389
|
get el() { return getElement(this); }
|
|
@@ -8439,22 +8450,29 @@ var __metadata$2 = (undefined && undefined.__metadata) || function (k, v) {
|
|
|
8439
8450
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
8440
8451
|
return Reflect.metadata(k, v);
|
|
8441
8452
|
};
|
|
8453
|
+
const reminderTimeOptions = [
|
|
8454
|
+
{ value: 60 * 24, label: 'day' },
|
|
8455
|
+
{ value: 60, label: 'hour' },
|
|
8456
|
+
{ value: 1, label: 'minute' },
|
|
8457
|
+
];
|
|
8442
8458
|
function getInitialTimeValue(timeInMinutes) {
|
|
8443
8459
|
if (!timeInMinutes)
|
|
8444
8460
|
return 30;
|
|
8445
|
-
|
|
8446
|
-
|
|
8447
|
-
|
|
8448
|
-
|
|
8461
|
+
for (const option of reminderTimeOptions) {
|
|
8462
|
+
if (timeInMinutes % option.value === 0) {
|
|
8463
|
+
return timeInMinutes / option.value;
|
|
8464
|
+
}
|
|
8465
|
+
}
|
|
8449
8466
|
return timeInMinutes;
|
|
8450
8467
|
}
|
|
8451
8468
|
function getInitialTimeIncrement(timeInMinutes) {
|
|
8452
8469
|
if (!timeInMinutes)
|
|
8453
|
-
return
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
8470
|
+
return 1;
|
|
8471
|
+
for (const option of reminderTimeOptions) {
|
|
8472
|
+
if (timeInMinutes % option.value === 0) {
|
|
8473
|
+
return option.value;
|
|
8474
|
+
}
|
|
8475
|
+
}
|
|
8458
8476
|
return 1;
|
|
8459
8477
|
}
|
|
8460
8478
|
const NylasReminderTime = class {
|
|
@@ -8479,15 +8497,6 @@ const NylasReminderTime = class {
|
|
|
8479
8497
|
debug('nylas-reminder-time', 'elementNameChangedHandler', newValue);
|
|
8480
8498
|
this.host.setAttribute('name', newValue);
|
|
8481
8499
|
}
|
|
8482
|
-
eventReminderTimeMinutesChangedHandler(newValue, oldValue) {
|
|
8483
|
-
debug('nylas-reminder-time', 'eventReminderTimeMinutesChangedHandler', newValue);
|
|
8484
|
-
if (newValue === oldValue) {
|
|
8485
|
-
return;
|
|
8486
|
-
}
|
|
8487
|
-
this.reminderTime = getInitialTimeValue(newValue);
|
|
8488
|
-
this.reminderTimeincrement = getInitialTimeIncrement(newValue);
|
|
8489
|
-
this.reminderTimeMinutes = newValue;
|
|
8490
|
-
}
|
|
8491
8500
|
reminderTimeMinutesChangedHandler(newValue, oldValue) {
|
|
8492
8501
|
debug('nylas-reminder-time', 'reminderTimeMinutesChangedHandler', newValue);
|
|
8493
8502
|
if (newValue === oldValue) {
|
|
@@ -8501,14 +8510,17 @@ const NylasReminderTime = class {
|
|
|
8501
8510
|
componentWillLoad() {
|
|
8502
8511
|
debug('nylas-reminder-time', 'componentWillLoad');
|
|
8503
8512
|
this.host.setAttribute('name', this.name);
|
|
8504
|
-
this.setReminderTimeMinuteOptions();
|
|
8505
8513
|
}
|
|
8506
8514
|
componentDidLoad() {
|
|
8507
8515
|
debug('nylas-reminder-time', 'componentDidLoad');
|
|
8516
|
+
this.setReminderTimeMinuteOptions();
|
|
8508
8517
|
}
|
|
8509
8518
|
disconnectedCallback() {
|
|
8510
8519
|
debug('nylas-reminder-time', 'disconnectedCallback');
|
|
8511
8520
|
}
|
|
8521
|
+
get isInternalsAvailable() {
|
|
8522
|
+
return this.internals !== undefined && typeof this.internals.setFormValue === 'function';
|
|
8523
|
+
}
|
|
8512
8524
|
setReminderTimeMinuteOptions() {
|
|
8513
8525
|
if (this.reminderTimeincrement === 1) {
|
|
8514
8526
|
this.reminderTimeMinutesOptions = REMINDER_MINUTE_OPTIONS;
|
|
@@ -8532,28 +8544,22 @@ const NylasReminderTime = class {
|
|
|
8532
8544
|
}
|
|
8533
8545
|
this.setReminderTimeMinuteOptions();
|
|
8534
8546
|
this.reminderTimeMinutes = this.reminderTime * this.reminderTimeincrement;
|
|
8535
|
-
this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);
|
|
8547
|
+
this.isInternalsAvailable && this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);
|
|
8536
8548
|
}
|
|
8537
8549
|
inputOptionChangedHandler(event) {
|
|
8538
8550
|
debug('nylas-calendar-picker', 'inputOptionChangedHandler', event.detail);
|
|
8539
8551
|
const { value } = event.detail;
|
|
8540
8552
|
this.reminderTime = value;
|
|
8541
8553
|
this.reminderTimeMinutes = this.reminderTime * this.reminderTimeincrement;
|
|
8542
|
-
this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);
|
|
8554
|
+
this.isInternalsAvailable && this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);
|
|
8543
8555
|
}
|
|
8544
8556
|
render() {
|
|
8545
|
-
|
|
8546
|
-
{ value: 1, label: 'minute' },
|
|
8547
|
-
{ value: 60, label: 'hour' },
|
|
8548
|
-
{ value: 60 * 24, label: 'day' },
|
|
8549
|
-
];
|
|
8550
|
-
return (h(Host, { key: 'd5f118391bdd7e4779f6eca15335285047fdb350' }, h("div", { key: '2dd8d3ba52d4f95480c9cf1fdaf5d0f1f7c1e523', class: "nylas-reminder-time", part: "nrt" }, h("div", { key: '3799c4b266f4078e22ad78b86225ef9abdc5fa49', class: "nylas-reminder-time__wrapper" }, h("input-dropdown", { key: '004b6336c041660e1424ac44f16e82c8a5a2ca53', name: 'reminder-time', options: this.reminderTimeMinutesOptions, inputValue: this.reminderTime.toString(), exportparts: "id_dropdown: nrt__input_dropdown, id_dropdown-input: nrt__input_dropdown-input, id_dropdown-content: nrt__input_dropdown-content", defaultInputOption: this.reminderTimeMinutesOptions.find(i => i.value == this.reminderTime) ?? reminderTimeOptions[0] }), h("select-dropdown", { key: '6a42c7f4633d89dd9a94d3c2f119e151613667ec', name: 'reminder-time-unit', options: reminderTimeOptions, pluralizedLabel: this.reminderTime > 1 ? 's' : '', exportparts: "sd_dropdown: nrt__dropdown, sd_dropdown-button: nrt__dropdown-button, sd_dropdown-content: nrt__dropdown-content", defaultSelectedOption: reminderTimeOptions.find(i => i.value == this.reminderTimeincrement) ?? reminderTimeOptions[0], withSearch: false })))));
|
|
8557
|
+
return (h(Host, { key: 'b089eb10d76d001112d867a61889a685b8908355' }, h("div", { key: '13b8479fb822135c00ff8f97974c8269731b2a84', class: "nylas-reminder-time", part: "nrt" }, h("div", { key: '728e90c61077b1037aa285329f11a09a296b33b4', class: "nylas-reminder-time__wrapper" }, h("input-dropdown", { key: '40a22b75424d4b3b552a2dc1b60e79a8cb595032', name: 'reminder-time', options: this.reminderTimeMinutesOptions, inputValue: this.reminderTime.toString(), exportparts: "id_dropdown: nrt__input_dropdown, id_dropdown-input: nrt__input_dropdown-input, id_dropdown-content: nrt__input_dropdown-content", defaultInputOption: this.reminderTimeMinutesOptions.find(i => i.value == this.reminderTime) ?? reminderTimeOptions[0] }), h("select-dropdown", { key: '6128bb953b883be5341ba005438ab353b0016c48', name: 'reminder-time-unit', options: [...reminderTimeOptions].sort((a, b) => a.value - b.value), pluralizedLabel: this.reminderTime > 1 ? 's' : '', exportparts: "sd_dropdown: nrt__dropdown, sd_dropdown-button: nrt__dropdown-button, sd_dropdown-content: nrt__dropdown-content", defaultSelectedOption: reminderTimeOptions.find(i => i.value == this.reminderTimeincrement) ?? reminderTimeOptions[0], withSearch: false })))));
|
|
8551
8558
|
}
|
|
8552
8559
|
static get formAssociated() { return true; }
|
|
8553
8560
|
get host() { return getElement(this); }
|
|
8554
8561
|
static get watchers() { return {
|
|
8555
8562
|
"name": ["elementNameChangedHandler"],
|
|
8556
|
-
"eventReminderTimeMinutes": ["eventReminderTimeMinutesChangedHandler"],
|
|
8557
8563
|
"reminderTimeMinutes": ["reminderTimeMinutesChangedHandler"]
|
|
8558
8564
|
}; }
|
|
8559
8565
|
};
|