@scalemule/nextjs 0.1.66 → 0.1.68
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/audio.d.mts +2 -0
- package/dist/audio.d.ts +2 -0
- package/dist/audio.js +150 -7
- package/dist/audio.mjs +150 -7
- package/dist/client.d.mts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/{index-CEi5Nd4L.d.mts → index-BOPHR50i.d.mts} +7 -1
- package/dist/{index-CEi5Nd4L.d.ts → index-BOPHR50i.d.ts} +7 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -3
- package/dist/index.mjs +4 -3
- package/dist/server/auth.js +20 -6
- package/dist/server/auth.mjs +20 -6
- package/dist/server/index.d.mts +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +20 -6
- package/dist/server/index.mjs +20 -6
- package/dist/server/webhook-handler.d.mts +2 -2
- package/dist/server/webhook-handler.d.ts +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/{webhook-handler-CJm0sIZG.d.mts → webhook-handler-C7XK0Tjs.d.ts} +4 -2
- package/dist/{webhook-handler-CnQe9hm5.d.ts → webhook-handler-CoASZNi5.d.mts} +4 -2
- package/package.json +1 -1
package/dist/audio.d.mts
CHANGED
|
@@ -202,6 +202,7 @@ declare class NetworkAudioController {
|
|
|
202
202
|
constructor(resolve: ResolveNetworkAudio);
|
|
203
203
|
setResolver(resolve: ResolveNetworkAudio): void;
|
|
204
204
|
getSnapshot: () => NetworkAudioSnapshot;
|
|
205
|
+
getPosition: () => number;
|
|
205
206
|
subscribe: (listener: () => void) => () => void;
|
|
206
207
|
private patch;
|
|
207
208
|
attach(audio: HTMLAudioElement): void;
|
|
@@ -292,6 +293,7 @@ interface NetworkAudioContextValue {
|
|
|
292
293
|
notice: string | null;
|
|
293
294
|
command: (command: NetworkAudioCommand) => void;
|
|
294
295
|
openNetworkPlayer?: () => void;
|
|
296
|
+
getPosition?: () => number;
|
|
295
297
|
highlightAvailable: boolean;
|
|
296
298
|
highlightEnabled: boolean;
|
|
297
299
|
setHighlightEnabled: (enabled: boolean) => void;
|
package/dist/audio.d.ts
CHANGED
|
@@ -202,6 +202,7 @@ declare class NetworkAudioController {
|
|
|
202
202
|
constructor(resolve: ResolveNetworkAudio);
|
|
203
203
|
setResolver(resolve: ResolveNetworkAudio): void;
|
|
204
204
|
getSnapshot: () => NetworkAudioSnapshot;
|
|
205
|
+
getPosition: () => number;
|
|
205
206
|
subscribe: (listener: () => void) => () => void;
|
|
206
207
|
private patch;
|
|
207
208
|
attach(audio: HTMLAudioElement): void;
|
|
@@ -292,6 +293,7 @@ interface NetworkAudioContextValue {
|
|
|
292
293
|
notice: string | null;
|
|
293
294
|
command: (command: NetworkAudioCommand) => void;
|
|
294
295
|
openNetworkPlayer?: () => void;
|
|
296
|
+
getPosition?: () => number;
|
|
295
297
|
highlightAvailable: boolean;
|
|
296
298
|
highlightEnabled: boolean;
|
|
297
299
|
setHighlightEnabled: (enabled: boolean) => void;
|
package/dist/audio.js
CHANGED
|
@@ -129,6 +129,131 @@ function wordIndexAt(words, timeMs) {
|
|
|
129
129
|
}
|
|
130
130
|
return ans;
|
|
131
131
|
}
|
|
132
|
+
var UNSTRESSED_FUNCTION_WORDS = /* @__PURE__ */ new Set([
|
|
133
|
+
"a",
|
|
134
|
+
"an",
|
|
135
|
+
"the",
|
|
136
|
+
"of",
|
|
137
|
+
"to",
|
|
138
|
+
"in",
|
|
139
|
+
"on",
|
|
140
|
+
"at",
|
|
141
|
+
"for",
|
|
142
|
+
"and",
|
|
143
|
+
"or",
|
|
144
|
+
"by",
|
|
145
|
+
"as",
|
|
146
|
+
"is",
|
|
147
|
+
"was",
|
|
148
|
+
"were",
|
|
149
|
+
"be",
|
|
150
|
+
"are",
|
|
151
|
+
"with",
|
|
152
|
+
"from",
|
|
153
|
+
"that",
|
|
154
|
+
"this"
|
|
155
|
+
]);
|
|
156
|
+
var DASH_TOKENS = /* @__PURE__ */ new Set(["\u2014", "\u2013", "--"]);
|
|
157
|
+
function isClauseEnd(sent, i) {
|
|
158
|
+
const n = sent.length;
|
|
159
|
+
if (i === n - 1) return true;
|
|
160
|
+
const stripped = sent[i][0].replace(/["'\u201d\u2019)\]}]+$/u, "");
|
|
161
|
+
if (DASH_TOKENS.has(stripped)) return true;
|
|
162
|
+
if (/[,;:\u2014\u2013]$/u.test(stripped)) {
|
|
163
|
+
if (i + 1 < n && DASH_TOKENS.has(sent[i + 1][0])) return false;
|
|
164
|
+
if (i + 2 < n && DASH_TOKENS.has(sent[i + 2][0])) return false;
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
function rebalanceLegacySentence(sent) {
|
|
170
|
+
const n = sent.length;
|
|
171
|
+
const sStart = sent[0][1];
|
|
172
|
+
const sEnd = sent[n - 1][2];
|
|
173
|
+
const sDur = sEnd - sStart;
|
|
174
|
+
if (n <= 1 || sDur < 600) return sent;
|
|
175
|
+
const clauses = [];
|
|
176
|
+
let startIdx = 0;
|
|
177
|
+
for (let i = 0; i < n; i++) {
|
|
178
|
+
if (isClauseEnd(sent, i)) {
|
|
179
|
+
clauses.push([startIdx, i]);
|
|
180
|
+
startIdx = i + 1;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
const clauseBounds = clauses.map(([i0, i1]) => [sent[i0][1], sent[i1][2]]);
|
|
184
|
+
if (clauses.length >= 2) {
|
|
185
|
+
const [, i1] = clauses[0];
|
|
186
|
+
if (DASH_TOKENS.has(sent[i1][0]) && i1 <= 5) {
|
|
187
|
+
const c0Dur = clauseBounds[0][1] - clauseBounds[0][0];
|
|
188
|
+
const shift = Math.min(450, c0Dur * 0.24);
|
|
189
|
+
clauseBounds[0][1] -= shift;
|
|
190
|
+
clauseBounds[1][0] -= shift;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
const out = [];
|
|
194
|
+
for (let c = 0; c < clauses.length; c++) {
|
|
195
|
+
const [i0, i1] = clauses[c];
|
|
196
|
+
const [cStart, cEnd] = clauseBounds[c];
|
|
197
|
+
const cDur = cEnd - cStart;
|
|
198
|
+
const cLen = i1 - i0 + 1;
|
|
199
|
+
const pauseMs = cLen >= 2 && cDur > 450 ? Math.min(340, cDur * 0.24) : cDur > 300 ? Math.min(180, cDur * 0.18) : 0;
|
|
200
|
+
const speechDur = Math.max(cDur - pauseMs, cDur * 0.72);
|
|
201
|
+
const weights = [];
|
|
202
|
+
for (let idx = i0; idx <= i1; idx++) {
|
|
203
|
+
const [w, st, en] = sent[idx];
|
|
204
|
+
const oldD = Math.max(en - st, 40);
|
|
205
|
+
const stripped = w.replace(/["'\u201d\u2019)\]}]+$/u, "");
|
|
206
|
+
const clean = stripped.replace(/^["'\u201c\u2018([{]+/u, "").replace(/[.,;:!?\u2014\u2013-]+$/u, "").toLowerCase();
|
|
207
|
+
if (DASH_TOKENS.has(w)) {
|
|
208
|
+
weights.push(30);
|
|
209
|
+
} else {
|
|
210
|
+
let weight = Math.pow(oldD, 0.85);
|
|
211
|
+
if (UNSTRESSED_FUNCTION_WORDS.has(clean) && stripped.toLowerCase() === clean) {
|
|
212
|
+
weight *= 0.58;
|
|
213
|
+
}
|
|
214
|
+
weights.push(weight);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
const totW = weights.reduce((a, b) => a + b, 0) || 1;
|
|
218
|
+
let cur = cStart;
|
|
219
|
+
for (let k = 0; k < cLen; k++) {
|
|
220
|
+
const idx = i0 + k;
|
|
221
|
+
const [w, , , si] = sent[idx];
|
|
222
|
+
const wDur = speechDur * (weights[k] / totW);
|
|
223
|
+
const lead = idx > 0 ? Math.min(45, wDur * 0.22) : 0;
|
|
224
|
+
const wSt = Math.max(sStart, cur - lead);
|
|
225
|
+
const wEn = cur + wDur;
|
|
226
|
+
out.push([w, Math.round(wSt), Math.round(Math.max(wSt, wEn)), si]);
|
|
227
|
+
cur = wEn;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return out;
|
|
231
|
+
}
|
|
232
|
+
function rebalanceSentenceTimings(words) {
|
|
233
|
+
if (words.length <= 1) return words;
|
|
234
|
+
const out = [];
|
|
235
|
+
let i = 0;
|
|
236
|
+
while (i < words.length) {
|
|
237
|
+
let j = i + 1;
|
|
238
|
+
const sIdx = words[i][3];
|
|
239
|
+
while (j < words.length && words[j][3] === sIdx) j++;
|
|
240
|
+
const sent = words.slice(i, j);
|
|
241
|
+
let hasExplicitGaps = false;
|
|
242
|
+
for (let k = 0; k < sent.length - 1; k++) {
|
|
243
|
+
if (sent[k + 1][1] - sent[k][2] >= 25) {
|
|
244
|
+
hasExplicitGaps = true;
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (!hasExplicitGaps && j < words.length && words[j][1] - sent[sent.length - 1][2] >= 25) {
|
|
249
|
+
hasExplicitGaps = true;
|
|
250
|
+
}
|
|
251
|
+
const processed = hasExplicitGaps ? sent : rebalanceLegacySentence(sent);
|
|
252
|
+
for (const row of processed) out.push(row);
|
|
253
|
+
i = j;
|
|
254
|
+
}
|
|
255
|
+
return out;
|
|
256
|
+
}
|
|
132
257
|
function mergeLineBoxes(rects) {
|
|
133
258
|
const lines = [];
|
|
134
259
|
const sorted = rects.filter((r) => r.width > 0 && r.height > 0).sort((a, b) => a.top - b.top || a.left - b.left);
|
|
@@ -173,7 +298,7 @@ var NarrationHighlighter = class {
|
|
|
173
298
|
this.resizeObserver = null;
|
|
174
299
|
this.onWindowResize = null;
|
|
175
300
|
this.root = root;
|
|
176
|
-
this.words = timings.words;
|
|
301
|
+
this.words = rebalanceSentenceTimings(timings.words);
|
|
177
302
|
const domWords = collectDomWords(root);
|
|
178
303
|
const matches = alignWords(
|
|
179
304
|
this.words.map((w) => normalizeWord(w[0])),
|
|
@@ -922,6 +1047,12 @@ var NetworkAudioController = class {
|
|
|
922
1047
|
this.resumePosition = null;
|
|
923
1048
|
this.candidates = [];
|
|
924
1049
|
this.getSnapshot = () => this.snapshot;
|
|
1050
|
+
this.getPosition = () => {
|
|
1051
|
+
if (this.audio && this.source && this.resumePosition === null && finite(this.audio.currentTime)) {
|
|
1052
|
+
if (this.audio.currentTime > 0 || this.snapshot.position === 0) return this.audio.currentTime;
|
|
1053
|
+
}
|
|
1054
|
+
return this.snapshot.position;
|
|
1055
|
+
};
|
|
925
1056
|
this.subscribe = (listener) => {
|
|
926
1057
|
this.listeners.add(listener);
|
|
927
1058
|
return () => {
|
|
@@ -1747,6 +1878,7 @@ function NetworkAudioProvider({ children, resolveAudio, connection, host, checkp
|
|
|
1747
1878
|
notice,
|
|
1748
1879
|
command,
|
|
1749
1880
|
openNetworkPlayer: connection ? openNetworkPlayer : void 0,
|
|
1881
|
+
getPosition: remoteSnapshot !== null ? void 0 : controller.getPosition,
|
|
1750
1882
|
highlightAvailable,
|
|
1751
1883
|
highlightEnabled,
|
|
1752
1884
|
setHighlightEnabled,
|
|
@@ -1812,7 +1944,7 @@ function NetworkMediaSession() {
|
|
|
1812
1944
|
var subscribeCapabilities = () => () => {
|
|
1813
1945
|
};
|
|
1814
1946
|
function useArticleNarration(track, narration) {
|
|
1815
|
-
const { snapshot, highlightEnabled, setHighlightEnabled } = useNetworkAudio();
|
|
1947
|
+
const { snapshot, remote, getPosition, highlightEnabled, setHighlightEnabled } = useNetworkAudio();
|
|
1816
1948
|
const supported = (0, import_react2.useSyncExternalStore)(subscribeCapabilities, narrationHighlightSupported, () => false);
|
|
1817
1949
|
const registerNarration = (0, import_react2.useContext)(NarrationRegistration);
|
|
1818
1950
|
const narrationKey = trackKey(track);
|
|
@@ -1822,9 +1954,16 @@ function useArticleNarration(track, narration) {
|
|
|
1822
1954
|
}, [available, narrationKey, registerNarration]);
|
|
1823
1955
|
const active = snapshot.queue[snapshot.index];
|
|
1824
1956
|
const matching = !!active && trackKey(active) === trackKey(track);
|
|
1825
|
-
const clock = (0, import_react2.useRef)({ snapshot, received: 0 });
|
|
1957
|
+
const clock = (0, import_react2.useRef)({ snapshot, received: 0, lastPosition: -1, lastStatus: "" });
|
|
1826
1958
|
(0, import_react2.useEffect)(() => {
|
|
1827
|
-
|
|
1959
|
+
const prev = clock.current;
|
|
1960
|
+
const changed = snapshot.position !== prev.lastPosition || snapshot.status !== prev.lastStatus;
|
|
1961
|
+
clock.current = {
|
|
1962
|
+
snapshot,
|
|
1963
|
+
received: changed ? performance.now() : prev.received,
|
|
1964
|
+
lastPosition: snapshot.position,
|
|
1965
|
+
lastStatus: snapshot.status
|
|
1966
|
+
};
|
|
1828
1967
|
}, [snapshot]);
|
|
1829
1968
|
(0, import_react2.useEffect)(() => {
|
|
1830
1969
|
if (!narration || !matching || !highlightEnabled || !supported || snapshot.hidden) return;
|
|
@@ -1832,9 +1971,13 @@ function useArticleNarration(track, narration) {
|
|
|
1832
1971
|
let highlighter = null;
|
|
1833
1972
|
let frame = 0;
|
|
1834
1973
|
const render = () => {
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1974
|
+
if (!remote && getPosition) {
|
|
1975
|
+
highlighter?.update(getPosition() * 1e3);
|
|
1976
|
+
} else {
|
|
1977
|
+
const { snapshot: current, received } = clock.current;
|
|
1978
|
+
const elapsed = current.status === "playing" ? Math.min((performance.now() - received) / 1e3, 0.5) * current.rate : 0;
|
|
1979
|
+
highlighter?.update((current.position + elapsed) * 1e3);
|
|
1980
|
+
}
|
|
1838
1981
|
frame = requestAnimationFrame(render);
|
|
1839
1982
|
};
|
|
1840
1983
|
const visibility = () => {
|
package/dist/audio.mjs
CHANGED
|
@@ -99,6 +99,131 @@ function wordIndexAt(words, timeMs) {
|
|
|
99
99
|
}
|
|
100
100
|
return ans;
|
|
101
101
|
}
|
|
102
|
+
var UNSTRESSED_FUNCTION_WORDS = /* @__PURE__ */ new Set([
|
|
103
|
+
"a",
|
|
104
|
+
"an",
|
|
105
|
+
"the",
|
|
106
|
+
"of",
|
|
107
|
+
"to",
|
|
108
|
+
"in",
|
|
109
|
+
"on",
|
|
110
|
+
"at",
|
|
111
|
+
"for",
|
|
112
|
+
"and",
|
|
113
|
+
"or",
|
|
114
|
+
"by",
|
|
115
|
+
"as",
|
|
116
|
+
"is",
|
|
117
|
+
"was",
|
|
118
|
+
"were",
|
|
119
|
+
"be",
|
|
120
|
+
"are",
|
|
121
|
+
"with",
|
|
122
|
+
"from",
|
|
123
|
+
"that",
|
|
124
|
+
"this"
|
|
125
|
+
]);
|
|
126
|
+
var DASH_TOKENS = /* @__PURE__ */ new Set(["\u2014", "\u2013", "--"]);
|
|
127
|
+
function isClauseEnd(sent, i) {
|
|
128
|
+
const n = sent.length;
|
|
129
|
+
if (i === n - 1) return true;
|
|
130
|
+
const stripped = sent[i][0].replace(/["'\u201d\u2019)\]}]+$/u, "");
|
|
131
|
+
if (DASH_TOKENS.has(stripped)) return true;
|
|
132
|
+
if (/[,;:\u2014\u2013]$/u.test(stripped)) {
|
|
133
|
+
if (i + 1 < n && DASH_TOKENS.has(sent[i + 1][0])) return false;
|
|
134
|
+
if (i + 2 < n && DASH_TOKENS.has(sent[i + 2][0])) return false;
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
function rebalanceLegacySentence(sent) {
|
|
140
|
+
const n = sent.length;
|
|
141
|
+
const sStart = sent[0][1];
|
|
142
|
+
const sEnd = sent[n - 1][2];
|
|
143
|
+
const sDur = sEnd - sStart;
|
|
144
|
+
if (n <= 1 || sDur < 600) return sent;
|
|
145
|
+
const clauses = [];
|
|
146
|
+
let startIdx = 0;
|
|
147
|
+
for (let i = 0; i < n; i++) {
|
|
148
|
+
if (isClauseEnd(sent, i)) {
|
|
149
|
+
clauses.push([startIdx, i]);
|
|
150
|
+
startIdx = i + 1;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const clauseBounds = clauses.map(([i0, i1]) => [sent[i0][1], sent[i1][2]]);
|
|
154
|
+
if (clauses.length >= 2) {
|
|
155
|
+
const [, i1] = clauses[0];
|
|
156
|
+
if (DASH_TOKENS.has(sent[i1][0]) && i1 <= 5) {
|
|
157
|
+
const c0Dur = clauseBounds[0][1] - clauseBounds[0][0];
|
|
158
|
+
const shift = Math.min(450, c0Dur * 0.24);
|
|
159
|
+
clauseBounds[0][1] -= shift;
|
|
160
|
+
clauseBounds[1][0] -= shift;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const out = [];
|
|
164
|
+
for (let c = 0; c < clauses.length; c++) {
|
|
165
|
+
const [i0, i1] = clauses[c];
|
|
166
|
+
const [cStart, cEnd] = clauseBounds[c];
|
|
167
|
+
const cDur = cEnd - cStart;
|
|
168
|
+
const cLen = i1 - i0 + 1;
|
|
169
|
+
const pauseMs = cLen >= 2 && cDur > 450 ? Math.min(340, cDur * 0.24) : cDur > 300 ? Math.min(180, cDur * 0.18) : 0;
|
|
170
|
+
const speechDur = Math.max(cDur - pauseMs, cDur * 0.72);
|
|
171
|
+
const weights = [];
|
|
172
|
+
for (let idx = i0; idx <= i1; idx++) {
|
|
173
|
+
const [w, st, en] = sent[idx];
|
|
174
|
+
const oldD = Math.max(en - st, 40);
|
|
175
|
+
const stripped = w.replace(/["'\u201d\u2019)\]}]+$/u, "");
|
|
176
|
+
const clean = stripped.replace(/^["'\u201c\u2018([{]+/u, "").replace(/[.,;:!?\u2014\u2013-]+$/u, "").toLowerCase();
|
|
177
|
+
if (DASH_TOKENS.has(w)) {
|
|
178
|
+
weights.push(30);
|
|
179
|
+
} else {
|
|
180
|
+
let weight = Math.pow(oldD, 0.85);
|
|
181
|
+
if (UNSTRESSED_FUNCTION_WORDS.has(clean) && stripped.toLowerCase() === clean) {
|
|
182
|
+
weight *= 0.58;
|
|
183
|
+
}
|
|
184
|
+
weights.push(weight);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
const totW = weights.reduce((a, b) => a + b, 0) || 1;
|
|
188
|
+
let cur = cStart;
|
|
189
|
+
for (let k = 0; k < cLen; k++) {
|
|
190
|
+
const idx = i0 + k;
|
|
191
|
+
const [w, , , si] = sent[idx];
|
|
192
|
+
const wDur = speechDur * (weights[k] / totW);
|
|
193
|
+
const lead = idx > 0 ? Math.min(45, wDur * 0.22) : 0;
|
|
194
|
+
const wSt = Math.max(sStart, cur - lead);
|
|
195
|
+
const wEn = cur + wDur;
|
|
196
|
+
out.push([w, Math.round(wSt), Math.round(Math.max(wSt, wEn)), si]);
|
|
197
|
+
cur = wEn;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return out;
|
|
201
|
+
}
|
|
202
|
+
function rebalanceSentenceTimings(words) {
|
|
203
|
+
if (words.length <= 1) return words;
|
|
204
|
+
const out = [];
|
|
205
|
+
let i = 0;
|
|
206
|
+
while (i < words.length) {
|
|
207
|
+
let j = i + 1;
|
|
208
|
+
const sIdx = words[i][3];
|
|
209
|
+
while (j < words.length && words[j][3] === sIdx) j++;
|
|
210
|
+
const sent = words.slice(i, j);
|
|
211
|
+
let hasExplicitGaps = false;
|
|
212
|
+
for (let k = 0; k < sent.length - 1; k++) {
|
|
213
|
+
if (sent[k + 1][1] - sent[k][2] >= 25) {
|
|
214
|
+
hasExplicitGaps = true;
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
if (!hasExplicitGaps && j < words.length && words[j][1] - sent[sent.length - 1][2] >= 25) {
|
|
219
|
+
hasExplicitGaps = true;
|
|
220
|
+
}
|
|
221
|
+
const processed = hasExplicitGaps ? sent : rebalanceLegacySentence(sent);
|
|
222
|
+
for (const row of processed) out.push(row);
|
|
223
|
+
i = j;
|
|
224
|
+
}
|
|
225
|
+
return out;
|
|
226
|
+
}
|
|
102
227
|
function mergeLineBoxes(rects) {
|
|
103
228
|
const lines = [];
|
|
104
229
|
const sorted = rects.filter((r) => r.width > 0 && r.height > 0).sort((a, b) => a.top - b.top || a.left - b.left);
|
|
@@ -143,7 +268,7 @@ var NarrationHighlighter = class {
|
|
|
143
268
|
this.resizeObserver = null;
|
|
144
269
|
this.onWindowResize = null;
|
|
145
270
|
this.root = root;
|
|
146
|
-
this.words = timings.words;
|
|
271
|
+
this.words = rebalanceSentenceTimings(timings.words);
|
|
147
272
|
const domWords = collectDomWords(root);
|
|
148
273
|
const matches = alignWords(
|
|
149
274
|
this.words.map((w) => normalizeWord(w[0])),
|
|
@@ -901,6 +1026,12 @@ var NetworkAudioController = class {
|
|
|
901
1026
|
this.resumePosition = null;
|
|
902
1027
|
this.candidates = [];
|
|
903
1028
|
this.getSnapshot = () => this.snapshot;
|
|
1029
|
+
this.getPosition = () => {
|
|
1030
|
+
if (this.audio && this.source && this.resumePosition === null && finite(this.audio.currentTime)) {
|
|
1031
|
+
if (this.audio.currentTime > 0 || this.snapshot.position === 0) return this.audio.currentTime;
|
|
1032
|
+
}
|
|
1033
|
+
return this.snapshot.position;
|
|
1034
|
+
};
|
|
904
1035
|
this.subscribe = (listener) => {
|
|
905
1036
|
this.listeners.add(listener);
|
|
906
1037
|
return () => {
|
|
@@ -1726,6 +1857,7 @@ function NetworkAudioProvider({ children, resolveAudio, connection, host, checkp
|
|
|
1726
1857
|
notice,
|
|
1727
1858
|
command,
|
|
1728
1859
|
openNetworkPlayer: connection ? openNetworkPlayer : void 0,
|
|
1860
|
+
getPosition: remoteSnapshot !== null ? void 0 : controller.getPosition,
|
|
1729
1861
|
highlightAvailable,
|
|
1730
1862
|
highlightEnabled,
|
|
1731
1863
|
setHighlightEnabled,
|
|
@@ -1791,7 +1923,7 @@ function NetworkMediaSession() {
|
|
|
1791
1923
|
var subscribeCapabilities = () => () => {
|
|
1792
1924
|
};
|
|
1793
1925
|
function useArticleNarration(track, narration) {
|
|
1794
|
-
const { snapshot, highlightEnabled, setHighlightEnabled } = useNetworkAudio();
|
|
1926
|
+
const { snapshot, remote, getPosition, highlightEnabled, setHighlightEnabled } = useNetworkAudio();
|
|
1795
1927
|
const supported = useSyncExternalStore2(subscribeCapabilities, narrationHighlightSupported, () => false);
|
|
1796
1928
|
const registerNarration = useContext(NarrationRegistration);
|
|
1797
1929
|
const narrationKey = trackKey(track);
|
|
@@ -1801,9 +1933,16 @@ function useArticleNarration(track, narration) {
|
|
|
1801
1933
|
}, [available, narrationKey, registerNarration]);
|
|
1802
1934
|
const active = snapshot.queue[snapshot.index];
|
|
1803
1935
|
const matching = !!active && trackKey(active) === trackKey(track);
|
|
1804
|
-
const clock = useRef2({ snapshot, received: 0 });
|
|
1936
|
+
const clock = useRef2({ snapshot, received: 0, lastPosition: -1, lastStatus: "" });
|
|
1805
1937
|
useEffect2(() => {
|
|
1806
|
-
|
|
1938
|
+
const prev = clock.current;
|
|
1939
|
+
const changed = snapshot.position !== prev.lastPosition || snapshot.status !== prev.lastStatus;
|
|
1940
|
+
clock.current = {
|
|
1941
|
+
snapshot,
|
|
1942
|
+
received: changed ? performance.now() : prev.received,
|
|
1943
|
+
lastPosition: snapshot.position,
|
|
1944
|
+
lastStatus: snapshot.status
|
|
1945
|
+
};
|
|
1807
1946
|
}, [snapshot]);
|
|
1808
1947
|
useEffect2(() => {
|
|
1809
1948
|
if (!narration || !matching || !highlightEnabled || !supported || snapshot.hidden) return;
|
|
@@ -1811,9 +1950,13 @@ function useArticleNarration(track, narration) {
|
|
|
1811
1950
|
let highlighter = null;
|
|
1812
1951
|
let frame = 0;
|
|
1813
1952
|
const render = () => {
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1953
|
+
if (!remote && getPosition) {
|
|
1954
|
+
highlighter?.update(getPosition() * 1e3);
|
|
1955
|
+
} else {
|
|
1956
|
+
const { snapshot: current, received } = clock.current;
|
|
1957
|
+
const elapsed = current.status === "playing" ? Math.min((performance.now() - received) / 1e3, 0.5) * current.rate : 0;
|
|
1958
|
+
highlighter?.update((current.position + elapsed) * 1e3);
|
|
1959
|
+
}
|
|
1817
1960
|
frame = requestAnimationFrame(render);
|
|
1818
1961
|
};
|
|
1819
1962
|
const visibility = () => {
|
package/dist/client.d.mts
CHANGED
package/dist/client.d.ts
CHANGED
|
@@ -178,6 +178,12 @@ interface RegisterRequest {
|
|
|
178
178
|
website?: string;
|
|
179
179
|
company?: string;
|
|
180
180
|
hp_field?: string;
|
|
181
|
+
/**
|
|
182
|
+
* Token from an account invitation link. When ScaleMule challenges a sign-up
|
|
183
|
+
* (for example a first-time browser), a pending invitation addressed to this
|
|
184
|
+
* email lets the registration through. It does not accept the invitation.
|
|
185
|
+
*/
|
|
186
|
+
invitation_token?: string;
|
|
181
187
|
}
|
|
182
188
|
interface LoginRequest {
|
|
183
189
|
challenge_token?: string;
|
|
@@ -508,7 +514,7 @@ interface UseAuthReturn {
|
|
|
508
514
|
/** Reset password with token */
|
|
509
515
|
resetPassword: (token: string, newPassword: string) => Promise<void>;
|
|
510
516
|
/** Verify email with token */
|
|
511
|
-
verifyEmail: (token: string) => Promise<void>;
|
|
517
|
+
verifyEmail: (token: string, email?: string) => Promise<void>;
|
|
512
518
|
/** Resend verification email (optional email for unauthenticated resend) */
|
|
513
519
|
resendVerification: (email?: string) => Promise<void>;
|
|
514
520
|
/** Refresh session token */
|
|
@@ -178,6 +178,12 @@ interface RegisterRequest {
|
|
|
178
178
|
website?: string;
|
|
179
179
|
company?: string;
|
|
180
180
|
hp_field?: string;
|
|
181
|
+
/**
|
|
182
|
+
* Token from an account invitation link. When ScaleMule challenges a sign-up
|
|
183
|
+
* (for example a first-time browser), a pending invitation addressed to this
|
|
184
|
+
* email lets the registration through. It does not accept the invitation.
|
|
185
|
+
*/
|
|
186
|
+
invitation_token?: string;
|
|
181
187
|
}
|
|
182
188
|
interface LoginRequest {
|
|
183
189
|
challenge_token?: string;
|
|
@@ -508,7 +514,7 @@ interface UseAuthReturn {
|
|
|
508
514
|
/** Reset password with token */
|
|
509
515
|
resetPassword: (token: string, newPassword: string) => Promise<void>;
|
|
510
516
|
/** Verify email with token */
|
|
511
|
-
verifyEmail: (token: string) => Promise<void>;
|
|
517
|
+
verifyEmail: (token: string, email?: string) => Promise<void>;
|
|
512
518
|
/** Resend verification email (optional email for unauthenticated resend) */
|
|
513
519
|
resendVerification: (email?: string) => Promise<void>;
|
|
514
520
|
/** Refresh session token */
|
package/dist/index.d.mts
CHANGED
|
@@ -6,8 +6,8 @@ import { MoneyClient } from '@scalemule/money';
|
|
|
6
6
|
export { MoneyClient, MoneyClientConfig, createMoneyClient } from '@scalemule/money';
|
|
7
7
|
import { ScaleMuleClient } from './client.mjs';
|
|
8
8
|
export { ClientConfig, RequestOptions, createClient } from './client.mjs';
|
|
9
|
-
import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError$1, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-
|
|
10
|
-
export { h as AccountBalance, i as AnalyticsEvent, j as ApiResponse, k as AuthLoginResponse, B as BatchTrackRequest, l as BillingPayment, m as BillingPayout, n as BillingRefund, o as BillingTransaction, C as ChangeEmailRequest, p as ChangePasswordRequest, q as ClientContext, r as ConnectedAccount, s as CookieLoginResponse, t as CookieOAuthCallbackResponse, D as DeviceFingerprint, u as DeviceInfo, E as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, K as KnownAccountInfo, v as LinkedAccount, w as ListFilesResponse, x as LoginDeviceInfo, y as LoginRequest, z as LoginResponseWithMFA, G as LoginRiskInfo, M as MFAChallengeResponse, H as MFAMethod, I as MFASMSSetupResponse, J as MFASetupRequest, N as MFAStatus, O as MFATOTPSetupResponse, P as MFAVerifyRequest, Q as OAuthCallbackRequest, R as OAuthCallbackResponse, T as OAuthConfig, V as OAuthProvider, W as OAuthStartResponse, X as PageViewData, Y as PayoutSchedule, Z as PhoneLoginRequest, _ as PhoneSendCodeRequest, $ as PhoneVerifyRequest, a0 as Profile, a1 as ProxyBearerLoginResponse, a2 as RefreshResponse, a3 as RegisterRequest, a4 as ResetPasswordRequest, a5 as ScaleMuleApiError, a6 as ScaleMuleEnvironment, a7 as Session, a8 as SignedUploadCompleteRequest, a9 as SignedUploadRequest, aa as SignedUploadResponse, ab as SignedUploadUrl, ac as StorageAdapter, ad as StorageFile, ae as TrackEventResponse, af as TransactionSummary, ag as UTMParams, ah as UpdateProfileRequest, ai as UploadOptions, aj as UploadResponse, ak as VerifyEmailRequest } from './index-
|
|
9
|
+
import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError$1, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-BOPHR50i.mjs';
|
|
10
|
+
export { h as AccountBalance, i as AnalyticsEvent, j as ApiResponse, k as AuthLoginResponse, B as BatchTrackRequest, l as BillingPayment, m as BillingPayout, n as BillingRefund, o as BillingTransaction, C as ChangeEmailRequest, p as ChangePasswordRequest, q as ClientContext, r as ConnectedAccount, s as CookieLoginResponse, t as CookieOAuthCallbackResponse, D as DeviceFingerprint, u as DeviceInfo, E as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, K as KnownAccountInfo, v as LinkedAccount, w as ListFilesResponse, x as LoginDeviceInfo, y as LoginRequest, z as LoginResponseWithMFA, G as LoginRiskInfo, M as MFAChallengeResponse, H as MFAMethod, I as MFASMSSetupResponse, J as MFASetupRequest, N as MFAStatus, O as MFATOTPSetupResponse, P as MFAVerifyRequest, Q as OAuthCallbackRequest, R as OAuthCallbackResponse, T as OAuthConfig, V as OAuthProvider, W as OAuthStartResponse, X as PageViewData, Y as PayoutSchedule, Z as PhoneLoginRequest, _ as PhoneSendCodeRequest, $ as PhoneVerifyRequest, a0 as Profile, a1 as ProxyBearerLoginResponse, a2 as RefreshResponse, a3 as RegisterRequest, a4 as ResetPasswordRequest, a5 as ScaleMuleApiError, a6 as ScaleMuleEnvironment, a7 as Session, a8 as SignedUploadCompleteRequest, a9 as SignedUploadRequest, aa as SignedUploadResponse, ab as SignedUploadUrl, ac as StorageAdapter, ad as StorageFile, ae as TrackEventResponse, af as TransactionSummary, ag as UTMParams, ah as UpdateProfileRequest, ai as UploadOptions, aj as UploadResponse, ak as VerifyEmailRequest } from './index-BOPHR50i.mjs';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Tri-state file visibility — `'private' | 'app_public' | 'anonymous_visible'`.
|
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ import { MoneyClient } from '@scalemule/money';
|
|
|
6
6
|
export { MoneyClient, MoneyClientConfig, createMoneyClient } from '@scalemule/money';
|
|
7
7
|
import { ScaleMuleClient } from './client.js';
|
|
8
8
|
export { ClientConfig, RequestOptions, createClient } from './client.js';
|
|
9
|
-
import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError$1, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-
|
|
10
|
-
export { h as AccountBalance, i as AnalyticsEvent, j as ApiResponse, k as AuthLoginResponse, B as BatchTrackRequest, l as BillingPayment, m as BillingPayout, n as BillingRefund, o as BillingTransaction, C as ChangeEmailRequest, p as ChangePasswordRequest, q as ClientContext, r as ConnectedAccount, s as CookieLoginResponse, t as CookieOAuthCallbackResponse, D as DeviceFingerprint, u as DeviceInfo, E as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, K as KnownAccountInfo, v as LinkedAccount, w as ListFilesResponse, x as LoginDeviceInfo, y as LoginRequest, z as LoginResponseWithMFA, G as LoginRiskInfo, M as MFAChallengeResponse, H as MFAMethod, I as MFASMSSetupResponse, J as MFASetupRequest, N as MFAStatus, O as MFATOTPSetupResponse, P as MFAVerifyRequest, Q as OAuthCallbackRequest, R as OAuthCallbackResponse, T as OAuthConfig, V as OAuthProvider, W as OAuthStartResponse, X as PageViewData, Y as PayoutSchedule, Z as PhoneLoginRequest, _ as PhoneSendCodeRequest, $ as PhoneVerifyRequest, a0 as Profile, a1 as ProxyBearerLoginResponse, a2 as RefreshResponse, a3 as RegisterRequest, a4 as ResetPasswordRequest, a5 as ScaleMuleApiError, a6 as ScaleMuleEnvironment, a7 as Session, a8 as SignedUploadCompleteRequest, a9 as SignedUploadRequest, aa as SignedUploadResponse, ab as SignedUploadUrl, ac as StorageAdapter, ad as StorageFile, ae as TrackEventResponse, af as TransactionSummary, ag as UTMParams, ah as UpdateProfileRequest, ai as UploadOptions, aj as UploadResponse, ak as VerifyEmailRequest } from './index-
|
|
9
|
+
import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError$1, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-BOPHR50i.js';
|
|
10
|
+
export { h as AccountBalance, i as AnalyticsEvent, j as ApiResponse, k as AuthLoginResponse, B as BatchTrackRequest, l as BillingPayment, m as BillingPayout, n as BillingRefund, o as BillingTransaction, C as ChangeEmailRequest, p as ChangePasswordRequest, q as ClientContext, r as ConnectedAccount, s as CookieLoginResponse, t as CookieOAuthCallbackResponse, D as DeviceFingerprint, u as DeviceInfo, E as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, K as KnownAccountInfo, v as LinkedAccount, w as ListFilesResponse, x as LoginDeviceInfo, y as LoginRequest, z as LoginResponseWithMFA, G as LoginRiskInfo, M as MFAChallengeResponse, H as MFAMethod, I as MFASMSSetupResponse, J as MFASetupRequest, N as MFAStatus, O as MFATOTPSetupResponse, P as MFAVerifyRequest, Q as OAuthCallbackRequest, R as OAuthCallbackResponse, T as OAuthConfig, V as OAuthProvider, W as OAuthStartResponse, X as PageViewData, Y as PayoutSchedule, Z as PhoneLoginRequest, _ as PhoneSendCodeRequest, $ as PhoneVerifyRequest, a0 as Profile, a1 as ProxyBearerLoginResponse, a2 as RefreshResponse, a3 as RegisterRequest, a4 as ResetPasswordRequest, a5 as ScaleMuleApiError, a6 as ScaleMuleEnvironment, a7 as Session, a8 as SignedUploadCompleteRequest, a9 as SignedUploadRequest, aa as SignedUploadResponse, ab as SignedUploadUrl, ac as StorageAdapter, ad as StorageFile, ae as TrackEventResponse, af as TransactionSummary, ag as UTMParams, ah as UpdateProfileRequest, ai as UploadOptions, aj as UploadResponse, ak as VerifyEmailRequest } from './index-BOPHR50i.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Tri-state file visibility — `'private' | 'app_public' | 'anonymous_visible'`.
|
package/dist/index.js
CHANGED
|
@@ -1818,10 +1818,11 @@ function useAuth() {
|
|
|
1818
1818
|
[client, setUser, setError, authProxyUrl]
|
|
1819
1819
|
);
|
|
1820
1820
|
const verifyEmail = React.useCallback(
|
|
1821
|
-
async (token) => {
|
|
1821
|
+
async (token, email) => {
|
|
1822
1822
|
setError(null);
|
|
1823
|
+
const body = email ? { token, email } : { token };
|
|
1823
1824
|
if (authProxyUrl) {
|
|
1824
|
-
const response = await proxyFetch(authProxyUrl, "verify-email", { body
|
|
1825
|
+
const response = await proxyFetch(authProxyUrl, "verify-email", { body });
|
|
1825
1826
|
if (!response.success) {
|
|
1826
1827
|
const err = response.error || {
|
|
1827
1828
|
code: "VERIFY_EMAIL_FAILED",
|
|
@@ -1832,7 +1833,7 @@ function useAuth() {
|
|
|
1832
1833
|
}
|
|
1833
1834
|
} else {
|
|
1834
1835
|
try {
|
|
1835
|
-
const result = await client.post("/v1/auth/verify-email",
|
|
1836
|
+
const result = await client.post("/v1/auth/verify-email", body);
|
|
1836
1837
|
if (result?.session_token && result?.user) {
|
|
1837
1838
|
await client.setSession(result.session_token, result.user.id);
|
|
1838
1839
|
setUser(result.user);
|
package/dist/index.mjs
CHANGED
|
@@ -1798,10 +1798,11 @@ function useAuth() {
|
|
|
1798
1798
|
[client, setUser, setError, authProxyUrl]
|
|
1799
1799
|
);
|
|
1800
1800
|
const verifyEmail = useCallback(
|
|
1801
|
-
async (token) => {
|
|
1801
|
+
async (token, email) => {
|
|
1802
1802
|
setError(null);
|
|
1803
|
+
const body = email ? { token, email } : { token };
|
|
1803
1804
|
if (authProxyUrl) {
|
|
1804
|
-
const response = await proxyFetch(authProxyUrl, "verify-email", { body
|
|
1805
|
+
const response = await proxyFetch(authProxyUrl, "verify-email", { body });
|
|
1805
1806
|
if (!response.success) {
|
|
1806
1807
|
const err = response.error || {
|
|
1807
1808
|
code: "VERIFY_EMAIL_FAILED",
|
|
@@ -1812,7 +1813,7 @@ function useAuth() {
|
|
|
1812
1813
|
}
|
|
1813
1814
|
} else {
|
|
1814
1815
|
try {
|
|
1815
|
-
const result = await client.post("/v1/auth/verify-email",
|
|
1816
|
+
const result = await client.post("/v1/auth/verify-email", body);
|
|
1816
1817
|
if (result?.session_token && result?.user) {
|
|
1817
1818
|
await client.setSession(result.session_token, result.user.id);
|
|
1818
1819
|
setUser(result.user);
|
package/dist/server/auth.js
CHANGED
|
@@ -257,8 +257,11 @@ var ScaleMuleServer = class {
|
|
|
257
257
|
/**
|
|
258
258
|
* Verify email with token
|
|
259
259
|
*/
|
|
260
|
-
verifyEmail: async (token) => {
|
|
261
|
-
return this.request("POST", "/v1/auth/verify-email", {
|
|
260
|
+
verifyEmail: async (token, email, options) => {
|
|
261
|
+
return this.request("POST", "/v1/auth/verify-email", {
|
|
262
|
+
body: email ? { token, email } : { token },
|
|
263
|
+
clientContext: options?.clientContext
|
|
264
|
+
});
|
|
262
265
|
},
|
|
263
266
|
/**
|
|
264
267
|
* Resend verification email.
|
|
@@ -1440,7 +1443,7 @@ function createAuthRoutes(config = {}) {
|
|
|
1440
1443
|
switch (path) {
|
|
1441
1444
|
// ==================== Register ====================
|
|
1442
1445
|
case "register": {
|
|
1443
|
-
const { email, password, full_name, username, phone, publication_code, website, company, hp_field } = body;
|
|
1446
|
+
const { email, password, full_name, username, phone, publication_code, website, company, hp_field, invitation_token } = body;
|
|
1444
1447
|
if (!email || !password) {
|
|
1445
1448
|
return errorResponse("VALIDATION_ERROR", "Email and password required", 400);
|
|
1446
1449
|
}
|
|
@@ -1460,7 +1463,18 @@ function createAuthRoutes(config = {}) {
|
|
|
1460
1463
|
}
|
|
1461
1464
|
let registeredUser;
|
|
1462
1465
|
try {
|
|
1463
|
-
registeredUser = await sm.auth.register(
|
|
1466
|
+
registeredUser = await sm.auth.register(
|
|
1467
|
+
{
|
|
1468
|
+
email,
|
|
1469
|
+
password,
|
|
1470
|
+
full_name,
|
|
1471
|
+
username,
|
|
1472
|
+
phone,
|
|
1473
|
+
// Lets an invited person through a first-visit trust challenge.
|
|
1474
|
+
...typeof invitation_token === "string" && invitation_token ? { invitation_token } : {}
|
|
1475
|
+
},
|
|
1476
|
+
{ clientContext }
|
|
1477
|
+
);
|
|
1464
1478
|
} catch (err) {
|
|
1465
1479
|
const apiErr = err instanceof ScaleMuleApiError ? err : null;
|
|
1466
1480
|
return errorResponse(
|
|
@@ -1626,13 +1640,13 @@ function createAuthRoutes(config = {}) {
|
|
|
1626
1640
|
}
|
|
1627
1641
|
// ==================== Verify Email ====================
|
|
1628
1642
|
case "verify-email": {
|
|
1629
|
-
const { token } = body;
|
|
1643
|
+
const { token, email } = body;
|
|
1630
1644
|
if (!token) {
|
|
1631
1645
|
return errorResponse("VALIDATION_ERROR", "Token required", 400);
|
|
1632
1646
|
}
|
|
1633
1647
|
let verifyData;
|
|
1634
1648
|
try {
|
|
1635
|
-
verifyData = await sm.auth.verifyEmail(token);
|
|
1649
|
+
verifyData = await sm.auth.verifyEmail(token, typeof email === "string" && email ? email : void 0, { clientContext });
|
|
1636
1650
|
} catch (err) {
|
|
1637
1651
|
const apiErr = err instanceof ScaleMuleApiError ? err : null;
|
|
1638
1652
|
return errorResponse(
|
package/dist/server/auth.mjs
CHANGED
|
@@ -255,8 +255,11 @@ var ScaleMuleServer = class {
|
|
|
255
255
|
/**
|
|
256
256
|
* Verify email with token
|
|
257
257
|
*/
|
|
258
|
-
verifyEmail: async (token) => {
|
|
259
|
-
return this.request("POST", "/v1/auth/verify-email", {
|
|
258
|
+
verifyEmail: async (token, email, options) => {
|
|
259
|
+
return this.request("POST", "/v1/auth/verify-email", {
|
|
260
|
+
body: email ? { token, email } : { token },
|
|
261
|
+
clientContext: options?.clientContext
|
|
262
|
+
});
|
|
260
263
|
},
|
|
261
264
|
/**
|
|
262
265
|
* Resend verification email.
|
|
@@ -1438,7 +1441,7 @@ function createAuthRoutes(config = {}) {
|
|
|
1438
1441
|
switch (path) {
|
|
1439
1442
|
// ==================== Register ====================
|
|
1440
1443
|
case "register": {
|
|
1441
|
-
const { email, password, full_name, username, phone, publication_code, website, company, hp_field } = body;
|
|
1444
|
+
const { email, password, full_name, username, phone, publication_code, website, company, hp_field, invitation_token } = body;
|
|
1442
1445
|
if (!email || !password) {
|
|
1443
1446
|
return errorResponse("VALIDATION_ERROR", "Email and password required", 400);
|
|
1444
1447
|
}
|
|
@@ -1458,7 +1461,18 @@ function createAuthRoutes(config = {}) {
|
|
|
1458
1461
|
}
|
|
1459
1462
|
let registeredUser;
|
|
1460
1463
|
try {
|
|
1461
|
-
registeredUser = await sm.auth.register(
|
|
1464
|
+
registeredUser = await sm.auth.register(
|
|
1465
|
+
{
|
|
1466
|
+
email,
|
|
1467
|
+
password,
|
|
1468
|
+
full_name,
|
|
1469
|
+
username,
|
|
1470
|
+
phone,
|
|
1471
|
+
// Lets an invited person through a first-visit trust challenge.
|
|
1472
|
+
...typeof invitation_token === "string" && invitation_token ? { invitation_token } : {}
|
|
1473
|
+
},
|
|
1474
|
+
{ clientContext }
|
|
1475
|
+
);
|
|
1462
1476
|
} catch (err) {
|
|
1463
1477
|
const apiErr = err instanceof ScaleMuleApiError ? err : null;
|
|
1464
1478
|
return errorResponse(
|
|
@@ -1624,13 +1638,13 @@ function createAuthRoutes(config = {}) {
|
|
|
1624
1638
|
}
|
|
1625
1639
|
// ==================== Verify Email ====================
|
|
1626
1640
|
case "verify-email": {
|
|
1627
|
-
const { token } = body;
|
|
1641
|
+
const { token, email } = body;
|
|
1628
1642
|
if (!token) {
|
|
1629
1643
|
return errorResponse("VALIDATION_ERROR", "Token required", 400);
|
|
1630
1644
|
}
|
|
1631
1645
|
let verifyData;
|
|
1632
1646
|
try {
|
|
1633
|
-
verifyData = await sm.auth.verifyEmail(token);
|
|
1647
|
+
verifyData = await sm.auth.verifyEmail(token, typeof email === "string" && email ? email : void 0, { clientContext });
|
|
1634
1648
|
} catch (err) {
|
|
1635
1649
|
const apiErr = err instanceof ScaleMuleApiError ? err : null;
|
|
1636
1650
|
return errorResponse(
|
package/dist/server/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as ServerConfig } from '../webhook-handler-
|
|
2
|
-
export { a as ScaleMuleServer, V as VideoFailedEvent, b as VideoReadyEvent, c as VideoTranscodedEvent, d as VideoUploadedEvent, W as WebhookEvent, e as WebhookRoutesConfig, f as createServerClient, g as createWebhookHandler, h as createWebhookRoutes, p as parseWebhookEvent, r as registerVideoWebhook, i as resolveGatewayUrl, v as verifyWebhookSignature } from '../webhook-handler-
|
|
3
|
-
import { q as ClientContext, A as ApiError } from '../index-
|
|
1
|
+
import { S as ServerConfig } from '../webhook-handler-CoASZNi5.mjs';
|
|
2
|
+
export { a as ScaleMuleServer, V as VideoFailedEvent, b as VideoReadyEvent, c as VideoTranscodedEvent, d as VideoUploadedEvent, W as WebhookEvent, e as WebhookRoutesConfig, f as createServerClient, g as createWebhookHandler, h as createWebhookRoutes, p as parseWebhookEvent, r as registerVideoWebhook, i as resolveGatewayUrl, v as verifyWebhookSignature } from '../webhook-handler-CoASZNi5.mjs';
|
|
3
|
+
import { q as ClientContext, A as ApiError } from '../index-BOPHR50i.mjs';
|
|
4
4
|
export { L as LedveryRoutesConfig, a as LedverySessionData, S as SM_LEDVERY_ACCESS_TOKEN_COOKIE, b as SM_LEDVERY_ID_TOKEN_COOKIE, c as SM_LEDVERY_NONCE_COOKIE, d as SM_LEDVERY_PKCE_VERIFIER_COOKIE, e as SM_LEDVERY_STATE_COOKIE, f as createLedveryRoutes, g as getLedverySession } from '../ledvery-CxPzZpxP.mjs';
|
|
5
5
|
import { NextRequest, NextResponse } from 'next/server';
|
|
6
6
|
import '@scalemule/sdk';
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as ServerConfig } from '../webhook-handler-
|
|
2
|
-
export { a as ScaleMuleServer, V as VideoFailedEvent, b as VideoReadyEvent, c as VideoTranscodedEvent, d as VideoUploadedEvent, W as WebhookEvent, e as WebhookRoutesConfig, f as createServerClient, g as createWebhookHandler, h as createWebhookRoutes, p as parseWebhookEvent, r as registerVideoWebhook, i as resolveGatewayUrl, v as verifyWebhookSignature } from '../webhook-handler-
|
|
3
|
-
import { q as ClientContext, A as ApiError } from '../index-
|
|
1
|
+
import { S as ServerConfig } from '../webhook-handler-C7XK0Tjs.js';
|
|
2
|
+
export { a as ScaleMuleServer, V as VideoFailedEvent, b as VideoReadyEvent, c as VideoTranscodedEvent, d as VideoUploadedEvent, W as WebhookEvent, e as WebhookRoutesConfig, f as createServerClient, g as createWebhookHandler, h as createWebhookRoutes, p as parseWebhookEvent, r as registerVideoWebhook, i as resolveGatewayUrl, v as verifyWebhookSignature } from '../webhook-handler-C7XK0Tjs.js';
|
|
3
|
+
import { q as ClientContext, A as ApiError } from '../index-BOPHR50i.js';
|
|
4
4
|
export { L as LedveryRoutesConfig, a as LedverySessionData, S as SM_LEDVERY_ACCESS_TOKEN_COOKIE, b as SM_LEDVERY_ID_TOKEN_COOKIE, c as SM_LEDVERY_NONCE_COOKIE, d as SM_LEDVERY_PKCE_VERIFIER_COOKIE, e as SM_LEDVERY_STATE_COOKIE, f as createLedveryRoutes, g as getLedverySession } from '../ledvery-CxPzZpxP.js';
|
|
5
5
|
import { NextRequest, NextResponse } from 'next/server';
|
|
6
6
|
import '@scalemule/sdk';
|
package/dist/server/index.js
CHANGED
|
@@ -331,8 +331,11 @@ var ScaleMuleServer = class {
|
|
|
331
331
|
/**
|
|
332
332
|
* Verify email with token
|
|
333
333
|
*/
|
|
334
|
-
verifyEmail: async (token) => {
|
|
335
|
-
return this.request("POST", "/v1/auth/verify-email", {
|
|
334
|
+
verifyEmail: async (token, email, options) => {
|
|
335
|
+
return this.request("POST", "/v1/auth/verify-email", {
|
|
336
|
+
body: email ? { token, email } : { token },
|
|
337
|
+
clientContext: options?.clientContext
|
|
338
|
+
});
|
|
336
339
|
},
|
|
337
340
|
/**
|
|
338
341
|
* Resend verification email.
|
|
@@ -1611,7 +1614,7 @@ function createAuthRoutes(config = {}) {
|
|
|
1611
1614
|
switch (path) {
|
|
1612
1615
|
// ==================== Register ====================
|
|
1613
1616
|
case "register": {
|
|
1614
|
-
const { email, password, full_name, username, phone, publication_code, website, company, hp_field } = body;
|
|
1617
|
+
const { email, password, full_name, username, phone, publication_code, website, company, hp_field, invitation_token } = body;
|
|
1615
1618
|
if (!email || !password) {
|
|
1616
1619
|
return errorResponse("VALIDATION_ERROR", "Email and password required", 400);
|
|
1617
1620
|
}
|
|
@@ -1631,7 +1634,18 @@ function createAuthRoutes(config = {}) {
|
|
|
1631
1634
|
}
|
|
1632
1635
|
let registeredUser;
|
|
1633
1636
|
try {
|
|
1634
|
-
registeredUser = await sm.auth.register(
|
|
1637
|
+
registeredUser = await sm.auth.register(
|
|
1638
|
+
{
|
|
1639
|
+
email,
|
|
1640
|
+
password,
|
|
1641
|
+
full_name,
|
|
1642
|
+
username,
|
|
1643
|
+
phone,
|
|
1644
|
+
// Lets an invited person through a first-visit trust challenge.
|
|
1645
|
+
...typeof invitation_token === "string" && invitation_token ? { invitation_token } : {}
|
|
1646
|
+
},
|
|
1647
|
+
{ clientContext }
|
|
1648
|
+
);
|
|
1635
1649
|
} catch (err) {
|
|
1636
1650
|
const apiErr = err instanceof ScaleMuleApiError ? err : null;
|
|
1637
1651
|
return errorResponse(
|
|
@@ -1797,13 +1811,13 @@ function createAuthRoutes(config = {}) {
|
|
|
1797
1811
|
}
|
|
1798
1812
|
// ==================== Verify Email ====================
|
|
1799
1813
|
case "verify-email": {
|
|
1800
|
-
const { token } = body;
|
|
1814
|
+
const { token, email } = body;
|
|
1801
1815
|
if (!token) {
|
|
1802
1816
|
return errorResponse("VALIDATION_ERROR", "Token required", 400);
|
|
1803
1817
|
}
|
|
1804
1818
|
let verifyData;
|
|
1805
1819
|
try {
|
|
1806
|
-
verifyData = await sm.auth.verifyEmail(token);
|
|
1820
|
+
verifyData = await sm.auth.verifyEmail(token, typeof email === "string" && email ? email : void 0, { clientContext });
|
|
1807
1821
|
} catch (err) {
|
|
1808
1822
|
const apiErr = err instanceof ScaleMuleApiError ? err : null;
|
|
1809
1823
|
return errorResponse(
|
package/dist/server/index.mjs
CHANGED
|
@@ -329,8 +329,11 @@ var ScaleMuleServer = class {
|
|
|
329
329
|
/**
|
|
330
330
|
* Verify email with token
|
|
331
331
|
*/
|
|
332
|
-
verifyEmail: async (token) => {
|
|
333
|
-
return this.request("POST", "/v1/auth/verify-email", {
|
|
332
|
+
verifyEmail: async (token, email, options) => {
|
|
333
|
+
return this.request("POST", "/v1/auth/verify-email", {
|
|
334
|
+
body: email ? { token, email } : { token },
|
|
335
|
+
clientContext: options?.clientContext
|
|
336
|
+
});
|
|
334
337
|
},
|
|
335
338
|
/**
|
|
336
339
|
* Resend verification email.
|
|
@@ -1609,7 +1612,7 @@ function createAuthRoutes(config = {}) {
|
|
|
1609
1612
|
switch (path) {
|
|
1610
1613
|
// ==================== Register ====================
|
|
1611
1614
|
case "register": {
|
|
1612
|
-
const { email, password, full_name, username, phone, publication_code, website, company, hp_field } = body;
|
|
1615
|
+
const { email, password, full_name, username, phone, publication_code, website, company, hp_field, invitation_token } = body;
|
|
1613
1616
|
if (!email || !password) {
|
|
1614
1617
|
return errorResponse("VALIDATION_ERROR", "Email and password required", 400);
|
|
1615
1618
|
}
|
|
@@ -1629,7 +1632,18 @@ function createAuthRoutes(config = {}) {
|
|
|
1629
1632
|
}
|
|
1630
1633
|
let registeredUser;
|
|
1631
1634
|
try {
|
|
1632
|
-
registeredUser = await sm.auth.register(
|
|
1635
|
+
registeredUser = await sm.auth.register(
|
|
1636
|
+
{
|
|
1637
|
+
email,
|
|
1638
|
+
password,
|
|
1639
|
+
full_name,
|
|
1640
|
+
username,
|
|
1641
|
+
phone,
|
|
1642
|
+
// Lets an invited person through a first-visit trust challenge.
|
|
1643
|
+
...typeof invitation_token === "string" && invitation_token ? { invitation_token } : {}
|
|
1644
|
+
},
|
|
1645
|
+
{ clientContext }
|
|
1646
|
+
);
|
|
1633
1647
|
} catch (err) {
|
|
1634
1648
|
const apiErr = err instanceof ScaleMuleApiError ? err : null;
|
|
1635
1649
|
return errorResponse(
|
|
@@ -1795,13 +1809,13 @@ function createAuthRoutes(config = {}) {
|
|
|
1795
1809
|
}
|
|
1796
1810
|
// ==================== Verify Email ====================
|
|
1797
1811
|
case "verify-email": {
|
|
1798
|
-
const { token } = body;
|
|
1812
|
+
const { token, email } = body;
|
|
1799
1813
|
if (!token) {
|
|
1800
1814
|
return errorResponse("VALIDATION_ERROR", "Token required", 400);
|
|
1801
1815
|
}
|
|
1802
1816
|
let verifyData;
|
|
1803
1817
|
try {
|
|
1804
|
-
verifyData = await sm.auth.verifyEmail(token);
|
|
1818
|
+
verifyData = await sm.auth.verifyEmail(token, typeof email === "string" && email ? email : void 0, { clientContext });
|
|
1805
1819
|
} catch (err) {
|
|
1806
1820
|
const apiErr = err instanceof ScaleMuleApiError ? err : null;
|
|
1807
1821
|
return errorResponse(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { g as createWebhookHandler } from '../webhook-handler-
|
|
1
|
+
export { g as createWebhookHandler } from '../webhook-handler-CoASZNi5.mjs';
|
|
2
2
|
import '@scalemule/sdk';
|
|
3
3
|
import '@scalemule/money';
|
|
4
|
-
import '../index-
|
|
4
|
+
import '../index-BOPHR50i.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { g as createWebhookHandler } from '../webhook-handler-
|
|
1
|
+
export { g as createWebhookHandler } from '../webhook-handler-C7XK0Tjs.js';
|
|
2
2
|
import '@scalemule/sdk';
|
|
3
3
|
import '@scalemule/money';
|
|
4
|
-
import '../index-
|
|
4
|
+
import '../index-BOPHR50i.js';
|
package/dist/testing.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { U as User, A as ApiError, ad as StorageFile } from './index-
|
|
3
|
+
import { U as User, A as ApiError, ad as StorageFile } from './index-BOPHR50i.mjs';
|
|
4
4
|
|
|
5
5
|
interface MockUserOptions {
|
|
6
6
|
id?: string;
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { U as User, A as ApiError, ad as StorageFile } from './index-
|
|
3
|
+
import { U as User, A as ApiError, ad as StorageFile } from './index-BOPHR50i.js';
|
|
4
4
|
|
|
5
5
|
interface MockUserOptions {
|
|
6
6
|
id?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExperimentAssignment } from '@scalemule/sdk';
|
|
2
2
|
import { MoneyClient } from '@scalemule/money';
|
|
3
|
-
import { A as ApiError, a3 as RegisterRequest, q as ClientContext, U as User, L as LoginResponse, y as LoginRequest, c as ListFilesParams, w as ListFilesResponse, ad as StorageFile, aj as UploadResponse } from './index-
|
|
3
|
+
import { A as ApiError, a3 as RegisterRequest, q as ClientContext, U as User, L as LoginResponse, y as LoginRequest, c as ListFilesParams, w as ListFilesResponse, ad as StorageFile, aj as UploadResponse } from './index-BOPHR50i.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Server-Side ScaleMule Client
|
|
@@ -122,7 +122,9 @@ declare class ScaleMuleServer {
|
|
|
122
122
|
/**
|
|
123
123
|
* Verify email with token
|
|
124
124
|
*/
|
|
125
|
-
verifyEmail: (token: string
|
|
125
|
+
verifyEmail: (token: string, email?: string, options?: {
|
|
126
|
+
clientContext?: ClientContext;
|
|
127
|
+
}) => Promise<{
|
|
126
128
|
message?: string;
|
|
127
129
|
verified?: boolean;
|
|
128
130
|
session_token?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExperimentAssignment } from '@scalemule/sdk';
|
|
2
2
|
import { MoneyClient } from '@scalemule/money';
|
|
3
|
-
import { A as ApiError, a3 as RegisterRequest, q as ClientContext, U as User, L as LoginResponse, y as LoginRequest, c as ListFilesParams, w as ListFilesResponse, ad as StorageFile, aj as UploadResponse } from './index-
|
|
3
|
+
import { A as ApiError, a3 as RegisterRequest, q as ClientContext, U as User, L as LoginResponse, y as LoginRequest, c as ListFilesParams, w as ListFilesResponse, ad as StorageFile, aj as UploadResponse } from './index-BOPHR50i.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Server-Side ScaleMule Client
|
|
@@ -122,7 +122,9 @@ declare class ScaleMuleServer {
|
|
|
122
122
|
/**
|
|
123
123
|
* Verify email with token
|
|
124
124
|
*/
|
|
125
|
-
verifyEmail: (token: string
|
|
125
|
+
verifyEmail: (token: string, email?: string, options?: {
|
|
126
|
+
clientContext?: ClientContext;
|
|
127
|
+
}) => Promise<{
|
|
126
128
|
message?: string;
|
|
127
129
|
verified?: boolean;
|
|
128
130
|
session_token?: string;
|
package/package.json
CHANGED