Skip to content

Commit 2797e73

Browse files
committed
Export all event types and apply patches
1 parent 42f5f13 commit 2797e73

File tree

18 files changed

+722
-595
lines changed

18 files changed

+722
-595
lines changed

.storybook/public/mockServiceWorker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* - Please do NOT modify this file.
88
*/
99

10-
const PACKAGE_VERSION = '2.12.3'
10+
const PACKAGE_VERSION = '2.12.4'
1111
const INTEGRITY_CHECKSUM = '4db4a41e972cec1b64cc569c66952d82'
1212
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
1313
const activeClientIds = new Set()

package-lock.json

Lines changed: 496 additions & 475 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@
7979
"@eslint/js": "9.39.1",
8080
"@rsbuild/plugin-node-polyfill": "1.4.2",
8181
"@rsbuild/plugin-stylus": "1.2.0",
82-
"@rsdoctor/rspack-plugin": "1.3.11",
83-
"@rslib/core": "0.18.2",
84-
"@storybook/addon-a11y": "10.1.2",
85-
"@storybook/addon-docs": "10.1.2",
86-
"@storybook/addon-links": "10.1.2",
87-
"@storybook/html": "10.1.2",
82+
"@rsdoctor/rspack-plugin": "1.3.12",
83+
"@rslib/core": "0.18.3",
84+
"@storybook/addon-a11y": "10.1.4",
85+
"@storybook/addon-docs": "10.1.4",
86+
"@storybook/addon-links": "10.1.4",
87+
"@storybook/html": "10.1.4",
8888
"@tsconfig/node22": "22.0.5",
8989
"@tsconfig/strictest": "2.0.8",
9090
"@types/defined": "1.0.2",
@@ -105,22 +105,22 @@
105105
"eslint-plugin-regexp": "2.10.0",
106106
"eslint-plugin-security": "3.0.1",
107107
"eslint-plugin-simple-import-sort": "12.1.1",
108-
"eslint-plugin-storybook": "10.1.2",
108+
"eslint-plugin-storybook": "10.1.4",
109109
"globals": "16.5.0",
110110
"jsdom": "27.2.0",
111-
"msw": "2.12.3",
111+
"msw": "2.12.4",
112112
"msw-storybook-addon": "2.0.6",
113-
"prettier": "3.7.3",
113+
"prettier": "3.7.4",
114114
"prettier-plugin-curly": "0.4.1",
115115
"prettier-plugin-packagejson": "2.5.20",
116116
"prettier-plugin-sh": "0.18.0",
117117
"release-it": "19.0.6",
118-
"storybook": "10.1.2",
119-
"storybook-html-rsbuild": "3.0.0",
120-
"type-fest": "5.2.0",
118+
"storybook": "10.1.4",
119+
"storybook-html-rsbuild": "3.1.0",
120+
"type-fest": "5.3.0",
121121
"typescript": "5.9.3",
122-
"typescript-eslint": "8.48.0",
123-
"vitest": "4.0.14"
122+
"typescript-eslint": "8.48.1",
123+
"vitest": "4.0.15"
124124
},
125125
"engines": {
126126
"node": "^24.11.0",

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ export type { VideomailCommandArgs } from "./types/command";
66
export type { DeliveryRecord } from "./types/Delivery";
77
export type { EmailAddress, EmailAddresses } from "./types/EmailAddress";
88
export type { FullVideomailErrorData, VideomailErrorData } from "./types/error";
9-
export type { VideomailEvents, VideomailPreviewParams } from "./types/events";
9+
export type { VideomailEvents } from "./types/events";
10+
export type * from "./types/events/params";
1011
export type { VideomailClientOptions } from "./types/options";
1112
export type { RecordingStats } from "./types/RecordingStats";
1213
export type { PartialVideomail, Videomail } from "./types/Videomail";

src/stories/Correct.stories.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import type { Meta, StoryObj } from "@storybook/html";
22

33
import { VideomailClient } from "../client";
44
import { PartialVideomailClientOptions } from "../types/options";
5-
import videomailExample from "./static/json/videomail";
6-
7-
// TODO Migrate more from Legacy
5+
import videomailExample from "./static/json/desktopVideomail";
86

97
const meta: Meta<PartialVideomailClientOptions> = {
108
title: "Correct",

src/stories/Form.stories.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import type { Meta, StoryObj } from "@storybook/html";
22
import { http, HttpResponse } from "msw";
33

4-
import { Videomail, VideomailClient } from "../index";
5-
import { SubmittedParams } from "../types/events";
4+
import { Videomail, VideomailClient, VideomailSubmittedParams } from "../index";
65
import { PartialVideomailClientOptions } from "../types/options";
76

87
const meta: Meta<PartialVideomailClientOptions> = {
@@ -54,7 +53,7 @@ export const DirectSubmission: Story = {
5453
play: ({ args }) => {
5554
const videomailClient = new VideomailClient(args);
5655

57-
const onSubmitted = ({ videomail }: SubmittedParams) => {
56+
const onSubmitted = ({ videomail }: VideomailSubmittedParams) => {
5857
videomailClient.replay(videomail, "viewVideo");
5958

6059
const startOverButton = document.getElementById("startOver");
@@ -200,7 +199,7 @@ export const ContactForm: Story = {
200199
};
201200
}
202201

203-
const onSubmitted = ({ videomail, response }: SubmittedParams) => {
202+
const onSubmitted = ({ videomail, response }: VideomailSubmittedParams) => {
204203
const statusHeader = document.querySelector<HTMLHeadElement>("h3.status");
205204

206205
if (statusHeader) {
@@ -285,7 +284,7 @@ export const VideoSubmissionOnly: Story = {
285284
}
286285
}
287286

288-
const onSubmitted = ({ videomail }: SubmittedParams) => {
287+
const onSubmitted = ({ videomail }: VideomailSubmittedParams) => {
289288
setAttribute(videomail, "url");
290289
setAttribute(videomail, "webm");
291290
setAttribute(videomail, "mp4");
@@ -359,7 +358,7 @@ export const Stretch: Story = {
359358
play: ({ args }) => {
360359
const videomailClient = new VideomailClient(args);
361360

362-
const onSubmitted = ({ videomail, response }: SubmittedParams) => {
361+
const onSubmitted = ({ videomail, response }: VideomailSubmittedParams) => {
363362
const statusHeader = document.querySelector("h3.status");
364363

365364
if (statusHeader) {
@@ -463,7 +462,7 @@ export const WithCCAndBCC: Story = {
463462
play: ({ args }) => {
464463
const videomailClient = new VideomailClient(args);
465464

466-
const onSubmitted = ({ videomail, response }: SubmittedParams) => {
465+
const onSubmitted = ({ videomail, response }: VideomailSubmittedParams) => {
467466
const statusHeader = document.querySelector("h3.status");
468467

469468
if (statusHeader) {

src/stories/Player.stories.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import type { Meta, StoryObj } from "@storybook/html";
22

33
import { VideomailClient } from "../client";
44
import { PartialVideomailClientOptions } from "../types/options";
5-
import videomailExample from "./static/json/videomail";
5+
import videomailDesktopExample from "./static/json/desktopVideomail";
6+
import videomailMobileExample from "./static/json/mobileVideomail";
67

78
const meta: Meta<PartialVideomailClientOptions> = {
89
title: "Player",
@@ -14,12 +15,21 @@ const meta: Meta<PartialVideomailClientOptions> = {
1415

1516
type Story = StoryObj<PartialVideomailClientOptions>;
1617

17-
// Play an existing videomail, nothing else
18-
export const PlayVideomail: Story = {
19-
name: "Play videomail",
18+
// Play an existing desktop videomail, nothing else
19+
export const PlayDesktopVideomail: Story = {
20+
name: "Play desktop videomail",
2021
render: (args) => {
2122
const videomailClient = new VideomailClient(args);
22-
return videomailClient.replay(videomailExample);
23+
return videomailClient.replay(videomailDesktopExample);
24+
},
25+
};
26+
27+
// Play an existing videomail recorded on mobile, nothing else
28+
export const PlayMobileVideomail: Story = {
29+
name: "Play mobile videomail",
30+
render: (args) => {
31+
const videomailClient = new VideomailClient(args);
32+
return videomailClient.replay(videomailMobileExample);
2333
},
2434
};
2535

@@ -71,7 +81,7 @@ export const PlayVideomailWithForm: Story = {
7181

7282
// just a copy paste of json of the videomail
7383
// you normally would get from a xhr get request
74-
videomailClient.replay(videomailExample, "videomail");
84+
videomailClient.replay(videomailDesktopExample, "videomail");
7585
},
7686
};
7787

src/stories/static/json/videomail.ts renamed to src/stories/static/json/desktopVideomail.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { Videomail } from "../../../types/Videomail";
44

5-
const videomailExample: Videomail = {
5+
const videomailDesktopExample: Videomail = {
66
subject: "Hamster on Speed",
77
88
@@ -57,4 +57,4 @@ const videomailExample: Videomail = {
5757
expiresAfterServerPretty: "14 Dec 2024, 12:10 pm",
5858
};
5959

60-
export default videomailExample;
60+
export default videomailDesktopExample;
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// Used for mocked MSW responses in storybook
2+
3+
import { Videomail } from "../../../types/Videomail";
4+
5+
const videomailMobileExample: Videomail = {
6+
alias: "re-test-furz-3-dec-2025-06-17-pm-144110111540",
7+
correctUrl:
8+
"https://videomail.io/videomail/alias/re-test-furz-3-dec-2025-06-17-pm-144110111540/correct",
9+
dateCreated: 1764739035953,
10+
dateCreatedServerPretty: "3 Dec 2025, 06:17 pm (NZDT)",
11+
dateUpdated: 1764739038454,
12+
dateUpdatedServerPretty: "3 Dec 2025, 06:17 pm (NZDT)",
13+
expiresAfter: 1769923035953,
14+
expiresAfterIso: "2026-02-01T05:17:15.953Z",
15+
expiresAfterServerPretty: "1 Feb 2026, 06:17 pm (NZDT)",
16+
format: {
17+
bit_rate: 516619,
18+
duration: 6.07,
19+
format_long_name: "Matroska / WebM",
20+
format_name: "matroska,webm",
21+
nb_programs: 0,
22+
nb_streams: 1,
23+
probe_score: 100,
24+
size: 391985,
25+
start_time: 0,
26+
tags: {
27+
ENCODER: "Lavf60.3.100",
28+
},
29+
},
30+
31+
height: 300,
32+
key: "1f0d0073-ca74-68f0-b34a-d7bf88d120e4",
33+
mp4: "https://videomail.io/api/videomail/key/1f0d0073-ca74-68f0-b34a-d7bf88d120e4/type/mp4/",
34+
poster:
35+
"https://videomail.io/api/videomail/key/1f0d0073-ca74-68f0-b34a-d7bf88d120e4/poster/",
36+
recordLocation: "https://videomail.io/",
37+
recordingStats: {
38+
avgFps: 20.148637489677952,
39+
avgInterval: 49.631147540983605,
40+
framesCount: 122,
41+
intervalSum: 6055,
42+
videoType: "mp4",
43+
waitingTime: 213,
44+
wantedFps: 18,
45+
wantedInterval: 55.55555555555556,
46+
},
47+
replyAllUrl:
48+
"https://videomail.io/videomail/alias/re-test-furz-3-dec-2025-06-17-pm-144110111540/replyAll",
49+
replyUrl:
50+
"https://videomail.io/videomail/alias/re-test-furz-3-dec-2025-06-17-pm-144110111540/reply",
51+
sending: false,
52+
sent: true,
53+
sentDate: 1764739038454,
54+
sentDateIso: "2025-12-03T05:17:18.454Z",
55+
sentDateServerPretty: "3 Dec 2025, 06:17 pm (NZDT)",
56+
sentTo: {
57+
58+
userKey: false,
59+
},
60+
},
61+
serverTimePretty: "4 Dec 2025, 06:42 pm",
62+
siteName: "videomail.io",
63+
subject: "RE: Test furz",
64+
url: "https://videomail.io/videomail/alias/re-test-furz-3-dec-2025-06-17-pm-144110111540",
65+
versions: {
66+
videomailClient: "13.5.3",
67+
},
68+
webm: "https://videomail.io/api/videomail/key/1f0d0073-ca74-68f0-b34a-d7bf88d120e4/type/webm/",
69+
width: 390,
70+
};
71+
72+
export default videomailMobileExample;

src/types/Videomail.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export interface Videomail {
4949
sentDate?: number;
5050
sentDateIso?: string;
5151
sentDateServerPretty?: string;
52+
serverTimePretty?: string;
5253

5354
siteName: string;
5455
siteTitle?: string;

0 commit comments

Comments
 (0)