Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.setModeSwitcher("mailBody_label")
.setValue(template.body)
const editSegment = {name: lang.get("edit_action"), value: "edit"}
const previewSegment = {name: lang.get("preview_label"), value: "preview"}
const selectedTab = stream(editSegment)
const segmentControl = new SegmentControl([editSegment, previewSegment], selectedTab)
const sortedLanguages: {name: string, value: string}[] = languages.slice()
.sort((a, b) => lang.get(a.textId).localeCompare(lang.get(b.textId)))
.map(language => {
return {name: lang.get(language.textId), value: language.code}
})
const selectedLanguage = sortedLanguages.find(({value}) => value === template.language)
const selectedLanguageStream: Stream = stream(selectedLanguage && selectedLanguage.value)
const subject = stream(template.subject)
// Editor resets its value on re-attach so we keep it ourselves
let savedHtml = editor.getValue()
selectedTab.map((tab) => {
if (tab === editSegment) {
editor.setValue(savedHtml)
} else {
savedHtml = editor.getValue()
}
})
const editTabContent = () => [
m(".small.mt-s", lang.get("templateHelp_msg")),
existingTemplate
? m(TextFieldN, {
label: "notificationMailLanguage_label",
return loadUpgradePrices().then(prices => {
const signupData: UpgradeSubscriptionData = {
options: {
businessUse: stream(prices.business),
paymentInterval: stream(12),
},
invoiceData: {
invoiceAddress: "",
country: null,
vatNumber: "" // only for EU countries otherwise empty
},
paymentData: {
paymentMethod: PaymentMethod.CreditCard,
creditCardData: null,
},
price: "",
priceNextYear: null,
type: SubscriptionType.Free,
accountingInfo: null,
newAccountData: null,
campaign: getCampaign(),
.then((dataFiles) => {
const parsedEvents = dataFiles.map((file) => parseCalendarFile(file).contents)
const totalCount = parsedEvents.reduce((acc, eventsWithAlarms) => acc + eventsWithAlarms.length, 0)
const progress = stream(0)
const progressMonitor = new ProgressMonitor(totalCount, progress)
const importPromise =
loadAllEvents(calendarGroupRoot)
.then((events) => {
const uidToEvent = new Map()
events.forEach((event) => {
event.uid && uidToEvent.set(event.uid, event)
})
return Promise.each(parsedEvents, (events: Iterable<{event: CalendarEvent, alarms: Array}>) => {
return Promise.each(events, ({event, alarms}) => {
// Don't try to create event which we already have
if (event.uid && uidToEvent.has(event.uid)) {
return
}
const elementId = generateEventElementId(event.startTime.getTime())
export function show(mailAddress?: ?string, resetAction?: ResetAction): Dialog {
const selectedAction: Stream = stream(resetAction)
let passwordForm = new PasswordForm(false, true, true);
const passwordValueStream = stream("")
const emailAddressStream = stream(mailAddress || "")
const resetPasswordAction: ButtonAttrs = {
label: "recoverSetNewPassword_action",
click: () => {
selectedAction("password")
},
type: ButtonType.Dropdown
}
const resetSecondFactorAction: ButtonAttrs = {
label: "recoverResetFactors_action",
click: () => {
selectedAction("secondFactor")
},
type: ButtonType.Dropdown
constructor() {
this._groupInfoRestrictionListId = null
this.lastSelectedGroupInfoResult = stream()
this.lastSelectedWhitelabelChildrenInfoResult = stream()
this.focused = false
this.skipNextBlur = stream(false)
this.busy = false
this._state = stream({
query: "",
searchResult: null,
indexState: locator.search.indexState(),
entities: ([]: Entries),
selected: null
})
this._overlayContentComponent = {
view: () => {
return m(SearchBarOverlay, {
state: this._state(),
isQuickSearch: this._isQuickSearch(),
isFocused: this.focused,
isExpanded: this.expanded,
skipNextBlur: this.skipNextBlur,
selectResult: (selected) => this._selectResult(selected)
constructor() {
this._groupInfoRestrictionListId = null
this.lastSelectedGroupInfoResult = stream()
this.lastSelectedWhitelabelChildrenInfoResult = stream()
this.focused = false
this.skipNextBlur = stream(false)
this.busy = false
this._state = stream({
query: "",
searchResult: null,
indexState: locator.search.indexState(),
entities: ([]: Entries),
selected: null
})
this._overlayContentComponent = {
view: () => {
return m(SearchBarOverlay, {
state: this._state(),
isQuickSearch: this._isQuickSearch(),
isFocused: this.focused,
isExpanded: this.expanded,
export function showCalendarEventDialog(date: Date, calendars: Map, existingEvent ?: CalendarEvent) {
const summary = stream("")
let calendarArray = Array.from(calendars.values())
let readOnly = false
if (!existingEvent) {
calendarArray = calendarArray.filter(calendarInfo => hasCapabilityOnGroup(logins.getUserController().user, calendarInfo.group, ShareCapability.Write))
} else {
const calendarInfoForEvent = calendars.get(neverNull(existingEvent._ownerGroup))
if (calendarInfoForEvent) {
readOnly = !hasCapabilityOnGroup(logins.getUserController().user, calendarInfoForEvent.group, ShareCapability.Write)
}
}
const selectedCalendar = stream(calendarArray[0])
const startOfTheWeekOffset = getStartOfTheWeekOffsetForUser()
const startDatePicker = new DatePicker(startOfTheWeekOffset, "dateFrom_label", "emptyString_msg", true, readOnly)
startDatePicker.setDate(getStartOfDay(date))
const endDatePicker = new DatePicker(startOfTheWeekOffset, "dateTo_label", "emptyString_msg", true, readOnly)
const amPmFormat = logins.getUserController().userSettingsGroupRoot.timeFormat === TimeFormat.TWELVE_HOURS
help: "cancel_action"
})
}
dialog.addShortcut({
key: Keys.RETURN,
shift: false,
exec: doAction,
help: okActionTextId
})
if (title) {
if (title instanceof Function) {
actionBar.setMiddle(title)
} else {
actionBar.setMiddle(stream(title))
}
}
dialog.setCloseHandler(doCancel)
return dialog.show()
}
}, 230, 240)
if (!proUpgrade) {
buyOptionBox.selected = true
}
buyOptionBox.setValue(lang.get("emptyString_msg"))
buyOptionBox.setHelpLabel(lang.get("emptyString_msg"))
let paymentIntervalItems = [
{name: lang.get("yearly_label"), value: 12},
{name: lang.get("monthly_label"), value: 1}
]
let upgradeBox: UpgradeBox = {
buyOptionBox: buyOptionBox,
paymentInterval: stream(paymentIntervalItems[0])
}
let subscriptionControl = new SegmentControl(paymentIntervalItems, upgradeBox.paymentInterval).setSelectionChangedHandler(paymentIntervalItem => {
if (paymentIntervalItem.value === 12) {
this._yearlyPrice.getAsync()
.then(upgradePrice => buyOptionBox.setValue((proUpgrade ? upgradePrice.proPrice : upgradePrice.premiumPrice)
+ " €"))
.then(() => m.redraw())
} else {
this._monthlyPrice.getAsync()
.then(upgradePrice => buyOptionBox.setValue(formatPrice((proUpgrade ? upgradePrice.proPrice : upgradePrice.premiumPrice), false)
+ " €"))
.then(() => m.redraw())
}
upgradeBox.paymentInterval(paymentIntervalItem)
})
AddUserDialog.getAvailableDomains().then(availableDomains => {
let groupTypes = getAvailableGroupTypes()
let typeField = new DropDownSelector("groupType_label", null, groupTypes.map(t => {
return {name: getGroupTypeName(t), value: t}
}), stream(groupTypes[0]))
let nameField = new TextField("name_label")
let mailAddressForm = new SelectMailAddressForm(availableDomains)
let form = {
view: () => {
return [
m(typeField),
m(nameField),
(typeField.selectedValue() === GroupType.Mail) ? m(mailAddressForm) : m(""),
]
}
}
let addGroupOkAction = (dialog) => {
if (typeField.selectedValue() === GroupType.Mail) {
showProgressDialog("pleaseWait_msg", BuyDialog.show(BookingItemFeatureType.SharedMailGroup, 1, 0, false)
.then(accepted => {
if (accepted) {