videomail-client 11.4.3 → 11.4.4
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/cjs/index.cjs +32 -27
- package/dist/esm/index.d.ts +2 -9
- package/dist/esm/index.js +32 -27
- package/dist/esm/types/VideoType.d.ts +5 -4
- package/dist/esm/util/Browser.d.ts +3 -4
- package/dist/esm/util/html/media/canPlayType.d.ts +2 -2
- package/dist/esm/wrappers/container.d.ts +2 -2
- package/dist/esm/wrappers/form.d.ts +6 -5
- package/dist/esm/wrappers/visuals/replay.d.ts +1 -2
- package/dist/umd/index.js +32 -27
- package/package.json +5 -5
package/dist/cjs/index.cjs
CHANGED
|
@@ -10479,7 +10479,7 @@ var __webpack_exports__ = {};
|
|
|
10479
10479
|
__webpack_require__.r(__webpack_exports__);
|
|
10480
10480
|
__webpack_require__.d(__webpack_exports__, {
|
|
10481
10481
|
VideomailClient: ()=>src_client,
|
|
10482
|
-
VideoType: ()=>
|
|
10482
|
+
VideoType: ()=>VideoType
|
|
10483
10483
|
});
|
|
10484
10484
|
const constants = {
|
|
10485
10485
|
SITE_NAME_LABEL: "x-videomail-site-name",
|
|
@@ -10642,7 +10642,7 @@ var __webpack_exports__ = {};
|
|
|
10642
10642
|
var client = __webpack_require__("./node_modules/superagent/lib/client.js");
|
|
10643
10643
|
var client_default = /*#__PURE__*/ __webpack_require__.n(client);
|
|
10644
10644
|
var package_namespaceObject = {
|
|
10645
|
-
rE: "11.4.
|
|
10645
|
+
rE: "11.4.4"
|
|
10646
10646
|
};
|
|
10647
10647
|
var defined = __webpack_require__("./node_modules/defined/index.js");
|
|
10648
10648
|
var defined_default = /*#__PURE__*/ __webpack_require__.n(defined);
|
|
@@ -13778,11 +13778,10 @@ var __webpack_exports__ = {};
|
|
|
13778
13778
|
NAME,
|
|
13779
13779
|
VERSION
|
|
13780
13780
|
]);
|
|
13781
|
-
|
|
13782
|
-
|
|
13783
|
-
|
|
13784
|
-
|
|
13785
|
-
}({});
|
|
13781
|
+
const VideoType = {
|
|
13782
|
+
WebM: "webm",
|
|
13783
|
+
MP4: "mp4"
|
|
13784
|
+
};
|
|
13786
13785
|
function canPlayType_canPlayType(video, type) {
|
|
13787
13786
|
const canPlayType = video.canPlayType(`video/${type}`);
|
|
13788
13787
|
if ("" === canPlayType) return false;
|
|
@@ -13799,7 +13798,7 @@ var __webpack_exports__ = {};
|
|
|
13799
13798
|
else obj[key] = value;
|
|
13800
13799
|
return obj;
|
|
13801
13800
|
}
|
|
13802
|
-
const FALLBACK_VIDEO_TYPE =
|
|
13801
|
+
const FALLBACK_VIDEO_TYPE = VideoType.MP4;
|
|
13803
13802
|
class Browser_Browser {
|
|
13804
13803
|
isIOS() {
|
|
13805
13804
|
return "iOS" === this.result.os.name;
|
|
@@ -13837,10 +13836,10 @@ var __webpack_exports__ = {};
|
|
|
13837
13836
|
}
|
|
13838
13837
|
getVideoType(video) {
|
|
13839
13838
|
if (!this.videoType) {
|
|
13840
|
-
if (media_canPlayType(video,
|
|
13841
|
-
else if (media_canPlayType(video,
|
|
13839
|
+
if (media_canPlayType(video, VideoType.MP4)) this.videoType = VideoType.MP4;
|
|
13840
|
+
else if (media_canPlayType(video, VideoType.WebM)) this.videoType = VideoType.WebM;
|
|
13842
13841
|
}
|
|
13843
|
-
if (this.videoType !==
|
|
13842
|
+
if (this.videoType !== VideoType.WebM && this.videoType !== VideoType.MP4) this.videoType = FALLBACK_VIDEO_TYPE;
|
|
13844
13843
|
if ("" === this.videoType.trim()) this.videoType = FALLBACK_VIDEO_TYPE;
|
|
13845
13844
|
return this.videoType;
|
|
13846
13845
|
}
|
|
@@ -14331,6 +14330,11 @@ var __webpack_exports__ = {};
|
|
|
14331
14330
|
else obj[key] = value;
|
|
14332
14331
|
return obj;
|
|
14333
14332
|
}
|
|
14333
|
+
const FormMethod = {
|
|
14334
|
+
POST: "post",
|
|
14335
|
+
PUT: "put",
|
|
14336
|
+
GET: "get"
|
|
14337
|
+
};
|
|
14334
14338
|
class Form extends util_Despot {
|
|
14335
14339
|
getData() {
|
|
14336
14340
|
return getFormData(this.formElement, {
|
|
@@ -14398,7 +14402,7 @@ var __webpack_exports__ = {};
|
|
|
14398
14402
|
if (name === this.options.selectors.toInputName || name === this.options.selectors.subjectInputName || name === this.options.selectors.bodyInputName) formControl.setAttribute("disabled", "disabled");
|
|
14399
14403
|
}
|
|
14400
14404
|
}
|
|
14401
|
-
this.formElement.setAttribute("method",
|
|
14405
|
+
this.formElement.setAttribute("method", FormMethod.PUT);
|
|
14402
14406
|
}
|
|
14403
14407
|
setDisabled(disabled, buttonsToo) {
|
|
14404
14408
|
for (const formControl of this.formElement.elements)if (buttonsToo || html_isNotButton(formControl)) if (disabled) formControl.setAttribute("disabled", "disabled");
|
|
@@ -14528,14 +14532,14 @@ var __webpack_exports__ = {};
|
|
|
14528
14532
|
const method = this.formElement.getAttribute("method");
|
|
14529
14533
|
let chosenMethod;
|
|
14530
14534
|
switch(method){
|
|
14531
|
-
case
|
|
14532
|
-
chosenMethod =
|
|
14535
|
+
case FormMethod.POST:
|
|
14536
|
+
chosenMethod = FormMethod.POST;
|
|
14533
14537
|
break;
|
|
14534
|
-
case
|
|
14535
|
-
chosenMethod =
|
|
14538
|
+
case FormMethod.PUT:
|
|
14539
|
+
chosenMethod = FormMethod.PUT;
|
|
14536
14540
|
break;
|
|
14537
14541
|
default:
|
|
14538
|
-
chosenMethod =
|
|
14542
|
+
chosenMethod = FormMethod.POST;
|
|
14539
14543
|
}
|
|
14540
14544
|
if (this.container.hasElement()) await this.container.submitAll(this.getData(), chosenMethod, url);
|
|
14541
14545
|
return false;
|
|
@@ -14640,7 +14644,7 @@ var __webpack_exports__ = {};
|
|
|
14640
14644
|
[constants.SITE_NAME_LABEL]: this.options.siteName
|
|
14641
14645
|
};
|
|
14642
14646
|
let url = `${this.options.baseUrl}/videomail/`;
|
|
14643
|
-
if (
|
|
14647
|
+
if (method === FormMethod.PUT && videomail.key) url += videomail.key;
|
|
14644
14648
|
try {
|
|
14645
14649
|
const request = await client_default()(method, url).query(queryParams).set("Timezone-Id", this.timezoneId).withCredentials().send(videomail).timeout(this.options.timeouts.connection);
|
|
14646
14650
|
return request;
|
|
@@ -14688,7 +14692,7 @@ var __webpack_exports__ = {};
|
|
|
14688
14692
|
videomailNinjaFormPlugin: null == (_this_options_versions = this.options.versions) ? void 0 : _this_options_versions.videomailNinjaFormPlugin
|
|
14689
14693
|
}
|
|
14690
14694
|
};
|
|
14691
|
-
await client_default()(
|
|
14695
|
+
await client_default()(FormMethod.POST, url).query(queryParams).set("Timezone-Id", this.timezoneId).withCredentials().send(fullVideomailErrorData).timeout(this.options.timeouts.connection);
|
|
14692
14696
|
} catch (exc) {
|
|
14693
14697
|
console.error(exc);
|
|
14694
14698
|
}
|
|
@@ -14700,8 +14704,8 @@ var __webpack_exports__ = {};
|
|
|
14700
14704
|
let res;
|
|
14701
14705
|
if (this.options.callbacks.adjustFormDataBeforePosting) {
|
|
14702
14706
|
const adjustedVideomail = this.options.callbacks.adjustFormDataBeforePosting(newVideomail);
|
|
14703
|
-
res = await this.write(
|
|
14704
|
-
} else res = await this.write(
|
|
14707
|
+
res = await this.write(FormMethod.POST, adjustedVideomail);
|
|
14708
|
+
} else res = await this.write(FormMethod.POST, newVideomail);
|
|
14705
14709
|
return res;
|
|
14706
14710
|
} catch (exc) {
|
|
14707
14711
|
throw error_createError({
|
|
@@ -14711,7 +14715,7 @@ var __webpack_exports__ = {};
|
|
|
14711
14715
|
}
|
|
14712
14716
|
}
|
|
14713
14717
|
async put(videomail) {
|
|
14714
|
-
return await this.write(
|
|
14718
|
+
return await this.write(FormMethod.PUT, videomail);
|
|
14715
14719
|
}
|
|
14716
14720
|
async form(formData, url) {
|
|
14717
14721
|
let formType;
|
|
@@ -17895,10 +17899,10 @@ var __webpack_exports__ = {};
|
|
|
17895
17899
|
}
|
|
17896
17900
|
}
|
|
17897
17901
|
setMp4Source(src, bustCache) {
|
|
17898
|
-
this.setVideoSource(
|
|
17902
|
+
this.setVideoSource(VideoType.MP4, src, bustCache);
|
|
17899
17903
|
}
|
|
17900
17904
|
setWebMSource(src, bustCache) {
|
|
17901
|
-
this.setVideoSource(
|
|
17905
|
+
this.setVideoSource(VideoType.WebM, src, bustCache);
|
|
17902
17906
|
}
|
|
17903
17907
|
getVideoType() {
|
|
17904
17908
|
if (!this.replayElement) return;
|
|
@@ -18249,7 +18253,8 @@ var __webpack_exports__ = {};
|
|
|
18249
18253
|
class Container extends util_Despot {
|
|
18250
18254
|
buildChildren() {
|
|
18251
18255
|
let playerOnly = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : false, parentElement = arguments.length > 1 ? arguments[1] : void 0;
|
|
18252
|
-
|
|
18256
|
+
const parentElementInfo = parentElement ? `, parentElement="${util_pretty(parentElement)}"` : "";
|
|
18257
|
+
this.options.logger.debug(`Container: buildChildren (playerOnly = ${playerOnly}${parentElementInfo})`);
|
|
18253
18258
|
if (this.containerElement) this.containerElement.classList.add(this.options.selectors.containerClass);
|
|
18254
18259
|
if (!playerOnly) this.buttons.build();
|
|
18255
18260
|
this.visuals.build(playerOnly, parentElement);
|
|
@@ -18393,13 +18398,13 @@ var __webpack_exports__ = {};
|
|
|
18393
18398
|
var _this_form;
|
|
18394
18399
|
const videomailFormData = null == (_this_form = this.form) ? void 0 : _this_form.transformFormData(formInputs);
|
|
18395
18400
|
if (!videomailFormData) throw new Error("No videomail form data defined");
|
|
18396
|
-
if (
|
|
18401
|
+
if (method === FormMethod.POST) {
|
|
18397
18402
|
videomailFormData.recordingStats = this.visuals.getRecordingStats();
|
|
18398
18403
|
videomailFormData.width = this.visuals.getRecorderWidth(true);
|
|
18399
18404
|
videomailFormData.height = this.visuals.getRecorderHeight(true);
|
|
18400
18405
|
return await this.resource.post(videomailFormData);
|
|
18401
18406
|
}
|
|
18402
|
-
if (
|
|
18407
|
+
if (method === FormMethod.PUT) return await this.resource.put(videomailFormData);
|
|
18403
18408
|
throw error_createError({
|
|
18404
18409
|
message: `Unsupported form method ${method}, unable to submit videomail.`,
|
|
18405
18410
|
options: this.options
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -7,13 +7,6 @@ import VideomailEvents from "./types/events";
|
|
|
7
7
|
import { VideomailClientOptions } from "./types/options";
|
|
8
8
|
import RecordingStats from "./types/RecordingStats";
|
|
9
9
|
import Videomail, { PartialVideomail } from "./types/Videomail";
|
|
10
|
-
import { VideoType } from "./types/VideoType";
|
|
11
|
-
export type { Videomail };
|
|
12
|
-
export type { VideomailEvents };
|
|
13
|
-
export type { RecordingStats };
|
|
14
|
-
export type { VideomailClientOptions };
|
|
10
|
+
import { VideoType, VideoTypeType } from "./types/VideoType";
|
|
11
|
+
export type { Command, CommandArgs, DeliveryRecord, EmailAddress, EmailAddresses, FullVideomailErrorData, PartialVideomail, RecordingStats, Videomail, VideomailClientOptions, VideomailErrorData, VideomailEvents, VideoTypeType, };
|
|
15
12
|
export { VideomailClient, VideoType };
|
|
16
|
-
export type { FullVideomailErrorData, PartialVideomail, VideomailErrorData };
|
|
17
|
-
export type { Command, CommandArgs };
|
|
18
|
-
export type { DeliveryRecord };
|
|
19
|
-
export type { EmailAddress, EmailAddresses };
|
package/dist/esm/index.js
CHANGED
|
@@ -3607,20 +3607,19 @@ const constants = {
|
|
|
3607
3607
|
}
|
|
3608
3608
|
};
|
|
3609
3609
|
var package_namespaceObject = {
|
|
3610
|
-
rE: "11.4.
|
|
3610
|
+
rE: "11.4.4"
|
|
3611
|
+
};
|
|
3612
|
+
const VideoType = {
|
|
3613
|
+
WebM: "webm",
|
|
3614
|
+
MP4: "mp4"
|
|
3611
3615
|
};
|
|
3612
|
-
var VideoType_VideoType = /*#__PURE__*/ function(VideoType) {
|
|
3613
|
-
VideoType["WebM"] = "webm";
|
|
3614
|
-
VideoType["MP4"] = "mp4";
|
|
3615
|
-
return VideoType;
|
|
3616
|
-
}({});
|
|
3617
3616
|
function canPlayType_canPlayType(video, type) {
|
|
3618
3617
|
const canPlayType = video.canPlayType(`video/${type}`);
|
|
3619
3618
|
if ("" === canPlayType) return false;
|
|
3620
3619
|
return canPlayType;
|
|
3621
3620
|
}
|
|
3622
3621
|
const media_canPlayType = canPlayType_canPlayType;
|
|
3623
|
-
const FALLBACK_VIDEO_TYPE =
|
|
3622
|
+
const FALLBACK_VIDEO_TYPE = VideoType.MP4;
|
|
3624
3623
|
class Browser {
|
|
3625
3624
|
options;
|
|
3626
3625
|
result;
|
|
@@ -3667,10 +3666,10 @@ class Browser {
|
|
|
3667
3666
|
}
|
|
3668
3667
|
getVideoType(video) {
|
|
3669
3668
|
if (!this.videoType) {
|
|
3670
|
-
if (media_canPlayType(video,
|
|
3671
|
-
else if (media_canPlayType(video,
|
|
3669
|
+
if (media_canPlayType(video, VideoType.MP4)) this.videoType = VideoType.MP4;
|
|
3670
|
+
else if (media_canPlayType(video, VideoType.WebM)) this.videoType = VideoType.WebM;
|
|
3672
3671
|
}
|
|
3673
|
-
if (this.videoType !==
|
|
3672
|
+
if (this.videoType !== VideoType.WebM && this.videoType !== VideoType.MP4) this.videoType = FALLBACK_VIDEO_TYPE;
|
|
3674
3673
|
if ("" === this.videoType.trim()) this.videoType = FALLBACK_VIDEO_TYPE;
|
|
3675
3674
|
return this.videoType;
|
|
3676
3675
|
}
|
|
@@ -4009,6 +4008,11 @@ function trimEmails(emails) {
|
|
|
4009
4008
|
const trimmedEmails = emails.split(REGEX).map((item)=>item.trim()).filter(Boolean);
|
|
4010
4009
|
return trimmedEmails;
|
|
4011
4010
|
}
|
|
4011
|
+
const FormMethod = {
|
|
4012
|
+
POST: "post",
|
|
4013
|
+
PUT: "put",
|
|
4014
|
+
GET: "get"
|
|
4015
|
+
};
|
|
4012
4016
|
class Form extends util_Despot {
|
|
4013
4017
|
container;
|
|
4014
4018
|
formElement;
|
|
@@ -4096,7 +4100,7 @@ class Form extends util_Despot {
|
|
|
4096
4100
|
if (name === this.options.selectors.toInputName || name === this.options.selectors.subjectInputName || name === this.options.selectors.bodyInputName) formControl.setAttribute("disabled", "disabled");
|
|
4097
4101
|
}
|
|
4098
4102
|
}
|
|
4099
|
-
this.formElement.setAttribute("method",
|
|
4103
|
+
this.formElement.setAttribute("method", FormMethod.PUT);
|
|
4100
4104
|
}
|
|
4101
4105
|
setDisabled(disabled, buttonsToo) {
|
|
4102
4106
|
for (const formControl of this.formElement.elements)if (buttonsToo || html_isNotButton(formControl)) if (disabled) formControl.setAttribute("disabled", "disabled");
|
|
@@ -4223,14 +4227,14 @@ class Form extends util_Despot {
|
|
|
4223
4227
|
const method = this.formElement.getAttribute("method");
|
|
4224
4228
|
let chosenMethod;
|
|
4225
4229
|
switch(method){
|
|
4226
|
-
case
|
|
4227
|
-
chosenMethod =
|
|
4230
|
+
case FormMethod.POST:
|
|
4231
|
+
chosenMethod = FormMethod.POST;
|
|
4228
4232
|
break;
|
|
4229
|
-
case
|
|
4230
|
-
chosenMethod =
|
|
4233
|
+
case FormMethod.PUT:
|
|
4234
|
+
chosenMethod = FormMethod.PUT;
|
|
4231
4235
|
break;
|
|
4232
4236
|
default:
|
|
4233
|
-
chosenMethod =
|
|
4237
|
+
chosenMethod = FormMethod.POST;
|
|
4234
4238
|
}
|
|
4235
4239
|
if (this.container.hasElement()) await this.container.submitAll(this.getData(), chosenMethod, url);
|
|
4236
4240
|
return false;
|
|
@@ -4315,7 +4319,7 @@ class Resource {
|
|
|
4315
4319
|
[constants.SITE_NAME_LABEL]: this.options.siteName
|
|
4316
4320
|
};
|
|
4317
4321
|
let url = `${this.options.baseUrl}/videomail/`;
|
|
4318
|
-
if (
|
|
4322
|
+
if (method === FormMethod.PUT && videomail.key) url += videomail.key;
|
|
4319
4323
|
try {
|
|
4320
4324
|
const request = await superagent(method, url).query(queryParams).set("Timezone-Id", this.timezoneId).withCredentials().send(videomail).timeout(this.options.timeouts.connection);
|
|
4321
4325
|
return request;
|
|
@@ -4362,7 +4366,7 @@ class Resource {
|
|
|
4362
4366
|
videomailNinjaFormPlugin: this.options.versions?.videomailNinjaFormPlugin
|
|
4363
4367
|
}
|
|
4364
4368
|
};
|
|
4365
|
-
await superagent(
|
|
4369
|
+
await superagent(FormMethod.POST, url).query(queryParams).set("Timezone-Id", this.timezoneId).withCredentials().send(fullVideomailErrorData).timeout(this.options.timeouts.connection);
|
|
4366
4370
|
} catch (exc) {
|
|
4367
4371
|
console.error(exc);
|
|
4368
4372
|
}
|
|
@@ -4374,8 +4378,8 @@ class Resource {
|
|
|
4374
4378
|
let res;
|
|
4375
4379
|
if (this.options.callbacks.adjustFormDataBeforePosting) {
|
|
4376
4380
|
const adjustedVideomail = this.options.callbacks.adjustFormDataBeforePosting(newVideomail);
|
|
4377
|
-
res = await this.write(
|
|
4378
|
-
} else res = await this.write(
|
|
4381
|
+
res = await this.write(FormMethod.POST, adjustedVideomail);
|
|
4382
|
+
} else res = await this.write(FormMethod.POST, newVideomail);
|
|
4379
4383
|
return res;
|
|
4380
4384
|
} catch (exc) {
|
|
4381
4385
|
throw error_createError({
|
|
@@ -4385,7 +4389,7 @@ class Resource {
|
|
|
4385
4389
|
}
|
|
4386
4390
|
}
|
|
4387
4391
|
async put(videomail) {
|
|
4388
|
-
return await this.write(
|
|
4392
|
+
return await this.write(FormMethod.PUT, videomail);
|
|
4389
4393
|
}
|
|
4390
4394
|
async form(formData, url) {
|
|
4391
4395
|
let formType;
|
|
@@ -7315,10 +7319,10 @@ class Replay extends util_Despot {
|
|
|
7315
7319
|
}
|
|
7316
7320
|
}
|
|
7317
7321
|
setMp4Source(src, bustCache) {
|
|
7318
|
-
this.setVideoSource(
|
|
7322
|
+
this.setVideoSource(VideoType.MP4, src, bustCache);
|
|
7319
7323
|
}
|
|
7320
7324
|
setWebMSource(src, bustCache) {
|
|
7321
|
-
this.setVideoSource(
|
|
7325
|
+
this.setVideoSource(VideoType.WebM, src, bustCache);
|
|
7322
7326
|
}
|
|
7323
7327
|
getVideoType() {
|
|
7324
7328
|
if (!this.replayElement) return;
|
|
@@ -7658,7 +7662,8 @@ class Container extends util_Despot {
|
|
|
7658
7662
|
this.resource = new src_resource(options);
|
|
7659
7663
|
}
|
|
7660
7664
|
buildChildren(playerOnly = false, parentElement) {
|
|
7661
|
-
|
|
7665
|
+
const parentElementInfo = parentElement ? `, parentElement="${util_pretty(parentElement)}"` : "";
|
|
7666
|
+
this.options.logger.debug(`Container: buildChildren (playerOnly = ${playerOnly}${parentElementInfo})`);
|
|
7662
7667
|
if (this.containerElement) this.containerElement.classList.add(this.options.selectors.containerClass);
|
|
7663
7668
|
if (!playerOnly) this.buttons.build();
|
|
7664
7669
|
this.visuals.build(playerOnly, parentElement);
|
|
@@ -7798,13 +7803,13 @@ class Container extends util_Despot {
|
|
|
7798
7803
|
async submitVideomail(formInputs, method) {
|
|
7799
7804
|
const videomailFormData = this.form?.transformFormData(formInputs);
|
|
7800
7805
|
if (!videomailFormData) throw new Error("No videomail form data defined");
|
|
7801
|
-
if (
|
|
7806
|
+
if (method === FormMethod.POST) {
|
|
7802
7807
|
videomailFormData.recordingStats = this.visuals.getRecordingStats();
|
|
7803
7808
|
videomailFormData.width = this.visuals.getRecorderWidth(true);
|
|
7804
7809
|
videomailFormData.height = this.visuals.getRecorderHeight(true);
|
|
7805
7810
|
return await this.resource.post(videomailFormData);
|
|
7806
7811
|
}
|
|
7807
|
-
if (
|
|
7812
|
+
if (method === FormMethod.PUT) return await this.resource.put(videomailFormData);
|
|
7808
7813
|
throw error_createError({
|
|
7809
7814
|
message: `Unsupported form method ${method}, unable to submit videomail.`,
|
|
7810
7815
|
options: this.options
|
|
@@ -8206,4 +8211,4 @@ class VideomailClient extends util_Despot {
|
|
|
8206
8211
|
}
|
|
8207
8212
|
}
|
|
8208
8213
|
const client = VideomailClient;
|
|
8209
|
-
export {
|
|
8214
|
+
export { VideoType, client as VideomailClient };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
WebM
|
|
3
|
-
MP4
|
|
4
|
-
}
|
|
1
|
+
export declare const VideoType: {
|
|
2
|
+
readonly WebM: "webm";
|
|
3
|
+
readonly MP4: "mp4";
|
|
4
|
+
};
|
|
5
|
+
export type VideoTypeType = (typeof VideoType)[keyof typeof VideoType];
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { VideomailClientOptions } from "../types/options";
|
|
2
|
-
import { VideoType } from "../types/VideoType";
|
|
3
2
|
declare class Browser {
|
|
4
|
-
private options;
|
|
5
|
-
private result;
|
|
3
|
+
private readonly options;
|
|
4
|
+
private readonly result;
|
|
6
5
|
private videoType;
|
|
7
6
|
constructor(options: VideomailClientOptions);
|
|
8
7
|
isIOS(): boolean;
|
|
@@ -15,7 +14,7 @@ declare class Browser {
|
|
|
15
14
|
isChromeBased(): boolean;
|
|
16
15
|
isMobile(): boolean;
|
|
17
16
|
isOkSafari(): boolean;
|
|
18
|
-
getVideoType(video: HTMLVideoElement):
|
|
17
|
+
getVideoType(video: HTMLVideoElement): "mp4" | "webm";
|
|
19
18
|
getNoAccessIssue(): import("./error/VideomailError").default;
|
|
20
19
|
getUsefulData(): {
|
|
21
20
|
ua: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare function canPlayType(video: HTMLVideoElement, type:
|
|
1
|
+
import { VideoTypeType } from "./../../../types/VideoType";
|
|
2
|
+
declare function canPlayType(video: HTMLVideoElement, type: VideoTypeType): false | "maybe" | "probably";
|
|
3
3
|
export default canPlayType;
|
|
@@ -3,7 +3,7 @@ import { ShowParams, StartOverParams } from "../client";
|
|
|
3
3
|
import { VideomailClientOptions } from "../types/options";
|
|
4
4
|
import Videomail from "../types/Videomail";
|
|
5
5
|
import Despot from "../util/Despot";
|
|
6
|
-
import { FormInputs,
|
|
6
|
+
import { FormInputs, FormMethodType } from "./form";
|
|
7
7
|
interface BuildOptions {
|
|
8
8
|
playerOnly?: boolean;
|
|
9
9
|
replayParentElementId?: string | undefined;
|
|
@@ -66,7 +66,7 @@ declare class Container extends Despot {
|
|
|
66
66
|
enableForm(buttonsToo: boolean): void;
|
|
67
67
|
hasForm(): boolean;
|
|
68
68
|
private buttonsAreReady;
|
|
69
|
-
submitAll(formData: FormInputs, method:
|
|
69
|
+
submitAll(formData: FormInputs, method: FormMethodType, url: string): Promise<void>;
|
|
70
70
|
isBuilt(): boolean;
|
|
71
71
|
isReplayShown(): boolean;
|
|
72
72
|
isDirty(): boolean;
|
|
@@ -3,11 +3,12 @@ import Videomail from "../types/Videomail";
|
|
|
3
3
|
import Despot from "../util/Despot";
|
|
4
4
|
import Container from "./container";
|
|
5
5
|
export type FormInputs = Record<string, string>;
|
|
6
|
-
export declare
|
|
7
|
-
POST
|
|
8
|
-
PUT
|
|
9
|
-
GET
|
|
10
|
-
}
|
|
6
|
+
export declare const FormMethod: {
|
|
7
|
+
readonly POST: "post";
|
|
8
|
+
readonly PUT: "put";
|
|
9
|
+
readonly GET: "get";
|
|
10
|
+
};
|
|
11
|
+
export type FormMethodType = (typeof FormMethod)[keyof typeof FormMethod];
|
|
11
12
|
declare class Form extends Despot {
|
|
12
13
|
private readonly container;
|
|
13
14
|
private readonly formElement;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { VideomailClientOptions } from "../../types/options";
|
|
2
2
|
import Videomail from "../../types/Videomail";
|
|
3
|
-
import { VideoType } from "../../types/VideoType";
|
|
4
3
|
import Despot from "../../util/Despot";
|
|
5
4
|
import { UnloadParams } from "../container";
|
|
6
5
|
import Visuals from "../visuals";
|
|
@@ -23,7 +22,7 @@ declare class Replay extends Despot {
|
|
|
23
22
|
private setVideoSource;
|
|
24
23
|
setMp4Source(src?: string, bustCache?: boolean): void;
|
|
25
24
|
setWebMSource(src?: string, bustCache?: boolean): void;
|
|
26
|
-
getVideoType():
|
|
25
|
+
getVideoType(): "mp4" | "webm" | undefined;
|
|
27
26
|
private pause;
|
|
28
27
|
reset(cb?: any): void;
|
|
29
28
|
hide(): void;
|
package/dist/umd/index.js
CHANGED
|
@@ -10485,7 +10485,7 @@
|
|
|
10485
10485
|
__webpack_require__.r(__webpack_exports__);
|
|
10486
10486
|
__webpack_require__.d(__webpack_exports__, {
|
|
10487
10487
|
VideomailClient: ()=>src_client,
|
|
10488
|
-
VideoType: ()=>
|
|
10488
|
+
VideoType: ()=>VideoType
|
|
10489
10489
|
});
|
|
10490
10490
|
const constants = {
|
|
10491
10491
|
SITE_NAME_LABEL: "x-videomail-site-name",
|
|
@@ -10648,7 +10648,7 @@
|
|
|
10648
10648
|
var client = __webpack_require__("./node_modules/superagent/lib/client.js");
|
|
10649
10649
|
var client_default = /*#__PURE__*/ __webpack_require__.n(client);
|
|
10650
10650
|
var package_namespaceObject = {
|
|
10651
|
-
rE: "11.4.
|
|
10651
|
+
rE: "11.4.4"
|
|
10652
10652
|
};
|
|
10653
10653
|
var defined = __webpack_require__("./node_modules/defined/index.js");
|
|
10654
10654
|
var defined_default = /*#__PURE__*/ __webpack_require__.n(defined);
|
|
@@ -13784,18 +13784,17 @@
|
|
|
13784
13784
|
NAME,
|
|
13785
13785
|
VERSION
|
|
13786
13786
|
]);
|
|
13787
|
-
|
|
13788
|
-
|
|
13789
|
-
|
|
13790
|
-
|
|
13791
|
-
}({});
|
|
13787
|
+
const VideoType = {
|
|
13788
|
+
WebM: "webm",
|
|
13789
|
+
MP4: "mp4"
|
|
13790
|
+
};
|
|
13792
13791
|
function canPlayType_canPlayType(video, type) {
|
|
13793
13792
|
const canPlayType = video.canPlayType(`video/${type}`);
|
|
13794
13793
|
if ("" === canPlayType) return false;
|
|
13795
13794
|
return canPlayType;
|
|
13796
13795
|
}
|
|
13797
13796
|
const media_canPlayType = canPlayType_canPlayType;
|
|
13798
|
-
const FALLBACK_VIDEO_TYPE =
|
|
13797
|
+
const FALLBACK_VIDEO_TYPE = VideoType.MP4;
|
|
13799
13798
|
class Browser {
|
|
13800
13799
|
options;
|
|
13801
13800
|
result;
|
|
@@ -13842,10 +13841,10 @@
|
|
|
13842
13841
|
}
|
|
13843
13842
|
getVideoType(video) {
|
|
13844
13843
|
if (!this.videoType) {
|
|
13845
|
-
if (media_canPlayType(video,
|
|
13846
|
-
else if (media_canPlayType(video,
|
|
13844
|
+
if (media_canPlayType(video, VideoType.MP4)) this.videoType = VideoType.MP4;
|
|
13845
|
+
else if (media_canPlayType(video, VideoType.WebM)) this.videoType = VideoType.WebM;
|
|
13847
13846
|
}
|
|
13848
|
-
if (this.videoType !==
|
|
13847
|
+
if (this.videoType !== VideoType.WebM && this.videoType !== VideoType.MP4) this.videoType = FALLBACK_VIDEO_TYPE;
|
|
13849
13848
|
if ("" === this.videoType.trim()) this.videoType = FALLBACK_VIDEO_TYPE;
|
|
13850
13849
|
return this.videoType;
|
|
13851
13850
|
}
|
|
@@ -14297,6 +14296,11 @@
|
|
|
14297
14296
|
const trimmedEmails = emails.split(REGEX).map((item)=>item.trim()).filter(Boolean);
|
|
14298
14297
|
return trimmedEmails;
|
|
14299
14298
|
}
|
|
14299
|
+
const FormMethod = {
|
|
14300
|
+
POST: "post",
|
|
14301
|
+
PUT: "put",
|
|
14302
|
+
GET: "get"
|
|
14303
|
+
};
|
|
14300
14304
|
class Form extends util_Despot {
|
|
14301
14305
|
container;
|
|
14302
14306
|
formElement;
|
|
@@ -14384,7 +14388,7 @@
|
|
|
14384
14388
|
if (name === this.options.selectors.toInputName || name === this.options.selectors.subjectInputName || name === this.options.selectors.bodyInputName) formControl.setAttribute("disabled", "disabled");
|
|
14385
14389
|
}
|
|
14386
14390
|
}
|
|
14387
|
-
this.formElement.setAttribute("method",
|
|
14391
|
+
this.formElement.setAttribute("method", FormMethod.PUT);
|
|
14388
14392
|
}
|
|
14389
14393
|
setDisabled(disabled, buttonsToo) {
|
|
14390
14394
|
for (const formControl of this.formElement.elements)if (buttonsToo || html_isNotButton(formControl)) if (disabled) formControl.setAttribute("disabled", "disabled");
|
|
@@ -14511,14 +14515,14 @@
|
|
|
14511
14515
|
const method = this.formElement.getAttribute("method");
|
|
14512
14516
|
let chosenMethod;
|
|
14513
14517
|
switch(method){
|
|
14514
|
-
case
|
|
14515
|
-
chosenMethod =
|
|
14518
|
+
case FormMethod.POST:
|
|
14519
|
+
chosenMethod = FormMethod.POST;
|
|
14516
14520
|
break;
|
|
14517
|
-
case
|
|
14518
|
-
chosenMethod =
|
|
14521
|
+
case FormMethod.PUT:
|
|
14522
|
+
chosenMethod = FormMethod.PUT;
|
|
14519
14523
|
break;
|
|
14520
14524
|
default:
|
|
14521
|
-
chosenMethod =
|
|
14525
|
+
chosenMethod = FormMethod.POST;
|
|
14522
14526
|
}
|
|
14523
14527
|
if (this.container.hasElement()) await this.container.submitAll(this.getData(), chosenMethod, url);
|
|
14524
14528
|
return false;
|
|
@@ -14603,7 +14607,7 @@
|
|
|
14603
14607
|
[constants.SITE_NAME_LABEL]: this.options.siteName
|
|
14604
14608
|
};
|
|
14605
14609
|
let url = `${this.options.baseUrl}/videomail/`;
|
|
14606
|
-
if (
|
|
14610
|
+
if (method === FormMethod.PUT && videomail.key) url += videomail.key;
|
|
14607
14611
|
try {
|
|
14608
14612
|
const request = await client_default()(method, url).query(queryParams).set("Timezone-Id", this.timezoneId).withCredentials().send(videomail).timeout(this.options.timeouts.connection);
|
|
14609
14613
|
return request;
|
|
@@ -14650,7 +14654,7 @@
|
|
|
14650
14654
|
videomailNinjaFormPlugin: this.options.versions?.videomailNinjaFormPlugin
|
|
14651
14655
|
}
|
|
14652
14656
|
};
|
|
14653
|
-
await client_default()(
|
|
14657
|
+
await client_default()(FormMethod.POST, url).query(queryParams).set("Timezone-Id", this.timezoneId).withCredentials().send(fullVideomailErrorData).timeout(this.options.timeouts.connection);
|
|
14654
14658
|
} catch (exc) {
|
|
14655
14659
|
console.error(exc);
|
|
14656
14660
|
}
|
|
@@ -14662,8 +14666,8 @@
|
|
|
14662
14666
|
let res;
|
|
14663
14667
|
if (this.options.callbacks.adjustFormDataBeforePosting) {
|
|
14664
14668
|
const adjustedVideomail = this.options.callbacks.adjustFormDataBeforePosting(newVideomail);
|
|
14665
|
-
res = await this.write(
|
|
14666
|
-
} else res = await this.write(
|
|
14669
|
+
res = await this.write(FormMethod.POST, adjustedVideomail);
|
|
14670
|
+
} else res = await this.write(FormMethod.POST, newVideomail);
|
|
14667
14671
|
return res;
|
|
14668
14672
|
} catch (exc) {
|
|
14669
14673
|
throw error_createError({
|
|
@@ -14673,7 +14677,7 @@
|
|
|
14673
14677
|
}
|
|
14674
14678
|
}
|
|
14675
14679
|
async put(videomail) {
|
|
14676
|
-
return await this.write(
|
|
14680
|
+
return await this.write(FormMethod.PUT, videomail);
|
|
14677
14681
|
}
|
|
14678
14682
|
async form(formData, url) {
|
|
14679
14683
|
let formType;
|
|
@@ -17683,10 +17687,10 @@
|
|
|
17683
17687
|
}
|
|
17684
17688
|
}
|
|
17685
17689
|
setMp4Source(src, bustCache) {
|
|
17686
|
-
this.setVideoSource(
|
|
17690
|
+
this.setVideoSource(VideoType.MP4, src, bustCache);
|
|
17687
17691
|
}
|
|
17688
17692
|
setWebMSource(src, bustCache) {
|
|
17689
|
-
this.setVideoSource(
|
|
17693
|
+
this.setVideoSource(VideoType.WebM, src, bustCache);
|
|
17690
17694
|
}
|
|
17691
17695
|
getVideoType() {
|
|
17692
17696
|
if (!this.replayElement) return;
|
|
@@ -18026,7 +18030,8 @@
|
|
|
18026
18030
|
this.resource = new src_resource(options);
|
|
18027
18031
|
}
|
|
18028
18032
|
buildChildren(playerOnly = false, parentElement) {
|
|
18029
|
-
|
|
18033
|
+
const parentElementInfo = parentElement ? `, parentElement="${util_pretty(parentElement)}"` : "";
|
|
18034
|
+
this.options.logger.debug(`Container: buildChildren (playerOnly = ${playerOnly}${parentElementInfo})`);
|
|
18030
18035
|
if (this.containerElement) this.containerElement.classList.add(this.options.selectors.containerClass);
|
|
18031
18036
|
if (!playerOnly) this.buttons.build();
|
|
18032
18037
|
this.visuals.build(playerOnly, parentElement);
|
|
@@ -18166,13 +18171,13 @@
|
|
|
18166
18171
|
async submitVideomail(formInputs, method) {
|
|
18167
18172
|
const videomailFormData = this.form?.transformFormData(formInputs);
|
|
18168
18173
|
if (!videomailFormData) throw new Error("No videomail form data defined");
|
|
18169
|
-
if (
|
|
18174
|
+
if (method === FormMethod.POST) {
|
|
18170
18175
|
videomailFormData.recordingStats = this.visuals.getRecordingStats();
|
|
18171
18176
|
videomailFormData.width = this.visuals.getRecorderWidth(true);
|
|
18172
18177
|
videomailFormData.height = this.visuals.getRecorderHeight(true);
|
|
18173
18178
|
return await this.resource.post(videomailFormData);
|
|
18174
18179
|
}
|
|
18175
|
-
if (
|
|
18180
|
+
if (method === FormMethod.PUT) return await this.resource.put(videomailFormData);
|
|
18176
18181
|
throw error_createError({
|
|
18177
18182
|
message: `Unsupported form method ${method}, unable to submit videomail.`,
|
|
18178
18183
|
options: this.options
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "videomail-client",
|
|
3
|
-
"version": "11.4.
|
|
3
|
+
"version": "11.4.4",
|
|
4
4
|
"description": "A wicked npm package to record videos directly in the browser, wohooo!",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webcam",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"types": "tsc --noEmit",
|
|
56
56
|
"types:config": "tsc --showConfig"
|
|
57
57
|
},
|
|
58
|
-
"prettier": "./prettier.config.
|
|
58
|
+
"prettier": "./prettier.config.js",
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"animitter": "3.0.0",
|
|
61
61
|
"audio-sample": "5.0.0",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@chromatic-com/storybook": "4.1.1",
|
|
77
77
|
"@eslint/config-inspector": "1.3.0",
|
|
78
|
-
"@eslint/js": "9.
|
|
78
|
+
"@eslint/js": "9.36.0",
|
|
79
79
|
"@rsbuild/plugin-node-polyfill": "1.4.2",
|
|
80
80
|
"@rsbuild/plugin-stylus": "1.2.0",
|
|
81
81
|
"@rsdoctor/rspack-plugin": "1.2.3",
|
|
@@ -90,11 +90,11 @@
|
|
|
90
90
|
"@types/node": "22.15.30",
|
|
91
91
|
"@types/superagent": "8.1.9",
|
|
92
92
|
"@types/ua-parser-js": "0.7.39",
|
|
93
|
-
"@vitest/eslint-plugin": "1.3.
|
|
93
|
+
"@vitest/eslint-plugin": "1.3.13",
|
|
94
94
|
"audit-ci": "7.1.0",
|
|
95
95
|
"chromatic": "13.2.0",
|
|
96
96
|
"cross-env": "10.0.0",
|
|
97
|
-
"eslint": "9.
|
|
97
|
+
"eslint": "9.36.0",
|
|
98
98
|
"eslint-import-resolver-typescript": "4.4.4",
|
|
99
99
|
"eslint-plugin-de-morgan": "1.3.1",
|
|
100
100
|
"eslint-plugin-depend": "1.3.1",
|