feat(ScheduledEvent): add none option for callType (#3838)

This commit is contained in:
Jan Loewe 2025-11-20 12:28:32 +01:00 • committed by GitHub
commit 166dc73c73
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 5 deletions

2
index.d.ts vendored
View file

@ -1277,7 +1277,7 @@ declare namespace WAWebJS {
endTime?: Date, endTime?: Date,
/** The location of the event */ /** The location of the event */
location?: string, location?: string,
/** The type of a WhatsApp call link to generate, valid values are: `video` | `voice` */ /** The type of a WhatsApp call link to generate, valid values are: `video` | `voice` | `none` */
callType?: string, callType?: string,
/** /**
* Indicates if a scheduled event should be sent as an already canceled * Indicates if a scheduled event should be sent as an already canceled

View file

@ -6,7 +6,7 @@
* @property {?string} description The scheduled event description * @property {?string} description The scheduled event description
* @property {?Date} endTime The end time of the event * @property {?Date} endTime The end time of the event
* @property {?string} location The location of the event * @property {?string} location The location of the event
* @property {?string} callType The type of a WhatsApp call link to generate, valid values are: `video` | `voice` * @property {?string} callType The type of a WhatsApp call link to generate, valid values are: `video` | `voice` | `none`
* @property {boolean} [isEventCanceled = false] Indicates if a scheduled event should be sent as an already canceled * @property {boolean} [isEventCanceled = false] Indicates if a scheduled event should be sent as an already canceled
* @property {?Array<number>} messageSecret The custom message secret, can be used as an event ID. NOTE: it has to be a unique vector with a length of 32 * @property {?Array<number>} messageSecret The custom message secret, can be used as an event ID. NOTE: it has to be a unique vector with a length of 32
*/ */
@ -58,10 +58,10 @@ class ScheduledEvent {
}(`Empty '${propName}' parameter value is provided.`); }(`Empty '${propName}' parameter value is provided.`);
} }
if (propName === 'callType' && propValue && !['video', 'voice'].includes(propValue)) { if (propName === 'callType' && propValue && !['video', 'voice', 'none'].includes(propValue)) {
throw new class CreateScheduledEventError extends Error { throw new class CreateScheduledEventError extends Error {
constructor(m) { super(m); } constructor(m) { super(m); }
}(`Invalid '${propName}' parameter value is provided. Valid values are: 'voice' | 'video'.`); }(`Invalid '${propName}' parameter value is provided. Valid values are: 'voice' | 'video' | 'none'.`);
} }
return propValue; return propValue;

View file

@ -125,7 +125,7 @@ exports.LoadUtils = () => {
degreesLongitude: 0, degreesLongitude: 0,
name: eventSendOptions.location name: eventSendOptions.location
}, },
eventJoinLink: await window.Store.ScheduledEventMsgUtils.createEventCallLink( eventJoinLink: eventSendOptions.callType === 'none' ? null : await window.Store.ScheduledEventMsgUtils.createEventCallLink(
startTimeTs, startTimeTs,
eventSendOptions.callType eventSendOptions.callType
), ),