@vocalstack/sanity 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +125 -2
- package/dist/action.d.ts +13 -0
- package/dist/action.js +86 -0
- package/dist/api.d.ts +78 -0
- package/dist/api.js +74 -0
- package/dist/components/Brand.d.ts +12 -0
- package/dist/components/Brand.js +21 -0
- package/dist/components/TranscriptInput.d.ts +7 -0
- package/dist/components/TranscriptInput.js +173 -0
- package/dist/components/brandAssets.d.ts +11 -0
- package/dist/components/brandAssets.js +6 -0
- package/dist/core.d.ts +13 -0
- package/dist/core.js +36 -0
- package/dist/handler.d.ts +20 -0
- package/dist/handler.js +115 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +22 -0
- package/dist/schema.d.ts +12 -0
- package/dist/schema.js +51 -0
- package/dist/server/index.d.ts +41 -0
- package/dist/server/index.js +154 -0
- package/dist/server/jobs.d.ts +10 -0
- package/dist/server/jobs.js +53 -0
- package/dist/text.d.ts +22 -0
- package/dist/text.js +52 -0
- package/dist/types.d.ts +55 -0
- package/dist/types.js +1 -0
- package/dist/wire.d.ts +52 -0
- package/dist/wire.js +10 -0
- package/package.json +55 -4
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const LOGO_LIGHT = "<svg aria-hidden=\"true\" focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1051.6906 155.30641\"><g transform=\"matrix(0.88734771,0,0,0.89118682,-42.71663,-123.85388)\"><path style=\"fill:#245B8F;fill-opacity:1;stroke-width:0.372962\" d=\"m 165.74369,312.34514 c -3.65904,-0.95861 -6.89131,-3.35348 -9.21494,-6.82759 -1.91226,-2.85908 -2.39705,-4.56971 -2.39705,-8.45836 0,-3.99254 0.0824,-4.2757 4.23012,-14.54553 4.00923,-9.92681 11.74597,-29.60804 14.17254,-36.05302 1.0555,-2.80344 4.63579,-12.0902 7.95619,-20.63725 3.3204,-8.54706 9.47265,-24.4912 13.67168,-35.43143 9.41163,-24.52125 12.15124,-31.39614 14.19222,-35.61455 1.33229,-2.75364 1.87867,-3.59258 3.34546,-5.13672 1.96822,-2.07203 4.0984,-3.56253 6.46687,-4.52493 1.27138,-0.5166 2.25763,-0.69302 4.82679,-0.8634 5.2183,-0.34607 24.57462,-0.55458 24.98508,-0.26914 0.43797,0.30456 1.13131,-1.50021 -15.15412,39.44678 -20.68842,52.01757 -28.96185,72.98265 -36.75181,93.13004 -8.40356,21.73434 -9.39495,24.20764 -10.76316,26.85165 -2.3545,4.55 -6.3824,7.78331 -11.27661,9.05207 -2.07259,0.53729 -6.00015,0.48109 -8.28926,-0.11862 z\"/><path style=\"fill:#245B8F;fill-opacity:1;stroke-width:0.372962\" d=\"m 122.4922,312.58916 c -4.07956,-0.73258 -8.65123,-3.9341 -11.23258,-7.86616 -0.73004,-1.11203 -1.85459,-3.48326 -2.84309,-5.99496 -0.89943,-2.2854 -4.76287,-12.1553 -8.585409,-21.93313 -3.82254,-9.77783 -8.479072,-21.63803 -10.347852,-26.35601 -1.86878,-4.71797 -7.404968,-18.81595 -12.302646,-31.32884 -4.897681,-12.51288 -10.861923,-27.72975 -13.253876,-33.81525 -2.391953,-6.0855 -5.665216,-14.47715 -7.273918,-18.64811 -1.608698,-4.17097 -4.23595,-10.84826 -5.838334,-14.83843 -2.072779,-5.16153 -2.836509,-7.33177 -2.646869,-7.5214 0.347903,-0.34791 20.828887,-0.35917 24.732874,-0.0136 4.649256,0.41154 7.012848,1.52811 10.517546,4.96852 1.450819,1.42421 2.398,2.60213 2.904375,3.6119 1.798693,3.58678 8.418103,20.02869 18.666279,46.36506 3.69839,9.50432 11.16067,28.41351 16.58285,42.02042 14.63433,36.72467 18.74753,47.13765 19.53975,49.46687 2.22981,6.55589 1.05533,12.70214 -3.30426,17.29176 -3.10359,3.26736 -6.22043,4.60845 -11.02178,4.7424 -1.64331,0.0458 -3.57518,-0.0221 -4.29306,-0.15103 z\"/><rect style=\"fill:#ec634d\" width=\"11.26954\" height=\"42.097622\" x=\"164.88014\" y=\"176.25909\" ry=\"5.610496\"/><rect style=\"fill:#ec634d\" width=\"11.62156\" height=\"87.038605\" x=\"142.15868\" y=\"153.7886\" ry=\"5.610496\"/><rect style=\"fill:#ec634d\" width=\"11.26954\" height=\"42.097622\" x=\"119.78924\" y=\"176.25909\" ry=\"5.610496\"/></g><path style=\"fill:#ec634d\" d=\"m 222.25132,68.479897 q -12.79998,0 -21.75997,8.959986 -8.95998,8.959986 -8.95998,21.759965 0,12.586642 8.95998,21.546632 4.26666,4.47999 9.81332,6.82666 5.75999,2.13333 11.94665,2.13333 6.18666,0 11.73331,-2.13333 5.54666,-2.34667 10.02665,-6.82666 8.95999,-8.95999 8.95999,-21.546632 0,-12.799979 -8.95999,-21.759965 -9.38665,-8.959986 -21.75996,-8.959986 z m 0,-25.599959 q 11.73331,0 21.9733,4.479993 10.23998,4.26666 17.91997,11.946648 7.67999,7.679987 11.94665,17.919971 4.47999,10.239984 4.47999,21.973298 0,11.519982 -4.47999,21.759962 -4.26666,10.23999 -11.94665,17.91997 -7.67999,7.67999 -17.91997,12.15999 -10.23999,4.26666 -21.9733,4.26666 -11.73332,0 -21.9733,-4.26666 -10.23998,-4.48 -17.91997,-12.15999 -7.67999,-7.67998 -12.15998,-17.91997 -4.26666,-10.23998 -4.26666,-21.759962 0,-11.733314 4.26666,-21.973298 4.47999,-10.239984 12.15998,-17.919971 7.67999,-7.679988 17.91997,-11.946648 10.23998,-4.479993 21.9733,-4.479993 z M 383.3179,138.87978 q -7.67999,7.67999 -17.91997,12.15999 -10.23999,4.26666 -21.9733,4.26666 -11.73332,0 -21.9733,-4.26666 -10.23998,-4.48 -17.91997,-12.15999 -7.67999,-7.67998 -12.15998,-17.91997 -4.26666,-10.23998 -4.26666,-21.759962 0,-11.733314 4.26666,-21.973298 4.47999,-10.239984 12.15998,-17.919971 7.67999,-7.679988 17.91997,-11.946648 10.23998,-4.479993 21.9733,-4.479993 11.73331,0 21.9733,4.479993 10.23998,4.26666 17.91997,11.946648 l -18.13331,18.133304 q -8.95998,-8.959986 -21.75996,-8.959986 -12.37332,0 -21.75997,8.959986 -8.95998,8.959986 -8.95998,21.759965 0,12.586642 8.95998,21.546632 4.48,4.47999 10.02665,6.82666 5.54666,2.13333 11.73332,2.13333 13.01331,0 21.75996,-8.95999 z M 498.09114,45.653267 V 152.5331 H 472.49118 V 99.199848 q 0,-12.799979 -8.95998,-21.759965 -8.95999,-8.959986 -21.75997,-8.959986 -6.18666,0 -11.94665,2.346663 -5.54665,2.346663 -9.81331,6.613323 -8.95999,8.959986 -8.95999,21.759965 0,12.586642 8.95999,21.546632 4.26666,4.47999 9.81331,6.82666 5.75999,2.13333 11.94665,2.13333 6.39999,0 11.51998,-2.13333 l 9.17332,22.82663 q -9.81332,4.90666 -22.82663,4.90666 -11.73331,0 -21.75996,-4.26666 -9.81332,-4.48 -17.06664,-12.15999 -7.25332,-7.67998 -11.30665,-17.91997 -4.05333,-10.23998 -4.05333,-21.759962 0,-11.733314 4.05333,-21.973298 4.05333,-10.239984 11.30665,-17.919971 7.25332,-7.679988 17.06664,-11.946648 10.02665,-4.479993 21.75996,-4.479993 10.45332,0 18.55997,3.199995 8.10666,3.199995 14.29331,8.106654 v -8.53332 z M 538.62446,152.5331 H 513.0245 V 3.2000015 h 25.59996 V 152.5331 Z m 120.10659,-42.6666 q 0,10.45331 -3.41333,18.98663 -3.41332,8.31999 -9.81331,14.29331 -6.18666,5.76 -15.14665,8.95999 -8.95998,3.2 -20.0533,3.2 -17.70664,0 -31.57328,-5.54666 -13.86664,-5.75999 -22.82663,-13.01332 l 17.70664,-17.70663 q 7.03999,6.39999 15.78664,9.81331 5.33332,2.13333 10.02665,2.77333 4.69333,0.64 7.67999,0.64 5.54666,0 10.02665,-1.28 4.69332,-1.49333 8.10665,-3.83999 7.25332,-5.33332 7.25332,-14.07998 0,-5.33332 -3.83999,-9.59998 -2.98666,-3.41333 -7.67999,-5.54666 -3.83999,-2.13333 -8.10665,-3.413328 -4.26666,-1.279998 -7.67999,-2.346663 -1.06666,-0.426666 -1.92,-0.426666 -0.85333,-0.213333 -1.49333,-0.639999 -0.42666,0 -1.27999,-0.426666 -4.48,-1.279997 -13.01332,-4.479992 -8.31998,-3.199995 -16.63997,-8.746653 -19.4133,-13.013313 -19.4133,-31.999949 0,-12.586647 4.26666,-21.119966 4.47999,-8.746653 11.51998,-14.079978 7.03999,-5.5466575 15.57331,-7.8933204 Q 591.53116,6.6375733e-6 599.85115,6.6375733e-6 q 15.35997,0 25.81329,3.6266608624267 10.45332,3.6266609 16.63997,7.2533215 3.2,1.919997 5.33333,3.839994 2.34666,1.706664 4.05332,3.199995 l -18.1333,18.346637 q -5.75999,-5.75999 -11.73332,-8.746652 -8.95998,-4.26666 -18.7733,-4.26666 -4.26666,0 -8.53332,1.066665 -4.26666,1.066665 -7.46665,2.773329 -9.38665,5.75999 -9.38665,15.146642 0,5.759991 3.83999,9.813318 2.77333,3.199995 7.67999,5.759991 4.05332,2.13333 8.53332,3.413328 4.47999,1.279997 8.31998,2.346662 l 2.56,0.639999 q 1.06666,0.426666 4.05333,1.279998 2.98666,0.853332 7.03998,2.559996 4.05333,1.706664 8.74666,4.053327 4.90666,2.346663 9.59998,5.546658 20.6933,13.653311 20.6933,32.213284 z m 69.11977,42.6666 h -23.46663 q -7.25332,0 -13.65331,-2.77333 -6.39999,-2.77333 -11.09332,-7.46666 -4.69332,-4.90666 -7.46665,-11.30665 -2.77333,-6.39999 -2.77333,-13.65331 V 24.319968 l 25.59996,-6.39999 V 58.66658 h 14.93331 l 6.39999,25.599959 h -21.3333 v 33.066611 q 0,4.05333 2.77333,6.82666 2.77333,2.77333 6.61332,2.77333 h 17.06664 z m 111.36,-106.879833 V 152.5331 H 813.61086 V 99.199848 q 0,-12.799979 -8.95999,-21.759965 -8.95998,-8.959986 -21.75996,-8.959986 -6.18666,0 -11.94665,2.346663 -5.54666,2.346663 -9.81332,6.613323 -8.95998,8.959986 -8.95998,21.759965 0,12.586642 8.95998,21.546632 4.26666,4.47999 9.81332,6.82666 5.75999,2.13333 11.94665,2.13333 6.39999,0 11.51998,-2.13333 l 9.17332,22.82663 q -9.81332,4.90666 -22.82663,4.90666 -11.73332,0 -21.75997,-4.26666 -9.81332,-4.48 -17.06664,-12.15999 -7.25332,-7.67998 -11.30665,-17.91997 -4.05332,-10.23998 -4.05332,-21.759962 0,-11.733314 4.05332,-21.973298 4.05333,-10.239984 11.30665,-17.919971 7.25332,-7.679988 17.06664,-11.946648 10.02665,-4.479993 21.75997,-4.479993 10.45331,0 18.55997,3.199995 8.10665,3.199995 14.29331,8.106654 v -8.53332 z m 107.94652,93.226513 q -7.67998,7.67999 -17.91997,12.15999 -10.23998,4.26666 -21.97329,4.26666 -11.73332,0 -21.9733,-4.26666 -10.23999,-4.48 -17.91997,-12.15999 -7.67999,-7.67998 -12.15998,-17.91997 -4.26666,-10.23998 -4.26666,-21.759962 0,-11.733314 4.26666,-21.973298 4.47999,-10.239984 12.15998,-17.919971 7.67998,-7.679988 17.91997,-11.946648 10.23998,-4.479993 21.9733,-4.479993 11.73331,0 21.97329,4.479993 10.23999,4.26666 17.91997,11.946648 l -18.1333,18.133304 q -8.95999,-8.959986 -21.75996,-8.959986 -12.37332,0 -21.75997,8.959986 -8.95999,8.959986 -8.95999,21.759965 0,12.586642 8.95999,21.546632 4.47999,4.47999 10.02665,6.82666 5.54666,2.13333 11.73332,2.13333 13.01331,0 21.75996,-8.95999 z M 1051.6907,45.8666 998.3574,99.199848 1051.6907,152.5331 h -36.0533 L 980.2241,117.11982 V 152.5331 H 954.62414 V 3.2000015 H 980.2241 V 81.066544 L 1015.424,45.8666 h 36.2667 z\"/></svg>";
|
|
2
|
+
export declare const LOGO_DARK = "<svg aria-hidden=\"true\" focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1051.6906 155.30641\"><g transform=\"matrix(0.88734771,0,0,0.89118682,-42.71663,-123.85388)\"><path style=\"fill:#55abe5;fill-opacity:1;stroke-width:0.372962\" d=\"m 165.74369,312.34514 c -3.65904,-0.95861 -6.89131,-3.35348 -9.21494,-6.82759 -1.91226,-2.85908 -2.39705,-4.56971 -2.39705,-8.45836 0,-3.99254 0.0824,-4.2757 4.23012,-14.54553 4.00923,-9.92681 11.74597,-29.60804 14.17254,-36.05302 1.0555,-2.80344 4.63579,-12.0902 7.95619,-20.63725 3.3204,-8.54706 9.47265,-24.4912 13.67168,-35.43143 9.41163,-24.52125 12.15124,-31.39614 14.19222,-35.61455 1.33229,-2.75364 1.87867,-3.59258 3.34546,-5.13672 1.96822,-2.07203 4.0984,-3.56253 6.46687,-4.52493 1.27138,-0.5166 2.25763,-0.69302 4.82679,-0.8634 5.2183,-0.34607 24.57462,-0.55458 24.98508,-0.26914 0.43797,0.30456 1.13131,-1.50021 -15.15412,39.44678 -20.68842,52.01757 -28.96185,72.98265 -36.75181,93.13004 -8.40356,21.73434 -9.39495,24.20764 -10.76316,26.85165 -2.3545,4.55 -6.3824,7.78331 -11.27661,9.05207 -2.07259,0.53729 -6.00015,0.48109 -8.28926,-0.11862 z\"/><path style=\"fill:#55abe5;fill-opacity:1;stroke-width:0.372962\" d=\"m 122.4922,312.58916 c -4.07956,-0.73258 -8.65123,-3.9341 -11.23258,-7.86616 -0.73004,-1.11203 -1.85459,-3.48326 -2.84309,-5.99496 -0.89943,-2.2854 -4.76287,-12.1553 -8.585409,-21.93313 -3.82254,-9.77783 -8.479072,-21.63803 -10.347852,-26.35601 -1.86878,-4.71797 -7.404968,-18.81595 -12.302646,-31.32884 -4.897681,-12.51288 -10.861923,-27.72975 -13.253876,-33.81525 -2.391953,-6.0855 -5.665216,-14.47715 -7.273918,-18.64811 -1.608698,-4.17097 -4.23595,-10.84826 -5.838334,-14.83843 -2.072779,-5.16153 -2.836509,-7.33177 -2.646869,-7.5214 0.347903,-0.34791 20.828887,-0.35917 24.732874,-0.0136 4.649256,0.41154 7.012848,1.52811 10.517546,4.96852 1.450819,1.42421 2.398,2.60213 2.904375,3.6119 1.798693,3.58678 8.418103,20.02869 18.666279,46.36506 3.69839,9.50432 11.16067,28.41351 16.58285,42.02042 14.63433,36.72467 18.74753,47.13765 19.53975,49.46687 2.22981,6.55589 1.05533,12.70214 -3.30426,17.29176 -3.10359,3.26736 -6.22043,4.60845 -11.02178,4.7424 -1.64331,0.0458 -3.57518,-0.0221 -4.29306,-0.15103 z\"/><rect style=\"fill:#ec634d\" width=\"11.26954\" height=\"42.097622\" x=\"164.88014\" y=\"176.25909\" ry=\"5.610496\"/><rect style=\"fill:#ec634d\" width=\"11.62156\" height=\"87.038605\" x=\"142.15868\" y=\"153.7886\" ry=\"5.610496\"/><rect style=\"fill:#ec634d\" width=\"11.26954\" height=\"42.097622\" x=\"119.78924\" y=\"176.25909\" ry=\"5.610496\"/></g><path style=\"fill:#ffffff\" d=\"m 222.25132,68.479897 q -12.79998,0 -21.75997,8.959986 -8.95998,8.959986 -8.95998,21.759965 0,12.586642 8.95998,21.546632 4.26666,4.47999 9.81332,6.82666 5.75999,2.13333 11.94665,2.13333 6.18666,0 11.73331,-2.13333 5.54666,-2.34667 10.02665,-6.82666 8.95999,-8.95999 8.95999,-21.546632 0,-12.799979 -8.95999,-21.759965 -9.38665,-8.959986 -21.75996,-8.959986 z m 0,-25.599959 q 11.73331,0 21.9733,4.479993 10.23998,4.26666 17.91997,11.946648 7.67999,7.679987 11.94665,17.919971 4.47999,10.239984 4.47999,21.973298 0,11.519982 -4.47999,21.759962 -4.26666,10.23999 -11.94665,17.91997 -7.67999,7.67999 -17.91997,12.15999 -10.23999,4.26666 -21.9733,4.26666 -11.73332,0 -21.9733,-4.26666 -10.23998,-4.48 -17.91997,-12.15999 -7.67999,-7.67998 -12.15998,-17.91997 -4.26666,-10.23998 -4.26666,-21.759962 0,-11.733314 4.26666,-21.973298 4.47999,-10.239984 12.15998,-17.919971 7.67999,-7.679988 17.91997,-11.946648 10.23998,-4.479993 21.9733,-4.479993 z M 383.3179,138.87978 q -7.67999,7.67999 -17.91997,12.15999 -10.23999,4.26666 -21.9733,4.26666 -11.73332,0 -21.9733,-4.26666 -10.23998,-4.48 -17.91997,-12.15999 -7.67999,-7.67998 -12.15998,-17.91997 -4.26666,-10.23998 -4.26666,-21.759962 0,-11.733314 4.26666,-21.973298 4.47999,-10.239984 12.15998,-17.919971 7.67999,-7.679988 17.91997,-11.946648 10.23998,-4.479993 21.9733,-4.479993 11.73331,0 21.9733,4.479993 10.23998,4.26666 17.91997,11.946648 l -18.13331,18.133304 q -8.95998,-8.959986 -21.75996,-8.959986 -12.37332,0 -21.75997,8.959986 -8.95998,8.959986 -8.95998,21.759965 0,12.586642 8.95998,21.546632 4.48,4.47999 10.02665,6.82666 5.54666,2.13333 11.73332,2.13333 13.01331,0 21.75996,-8.95999 z M 498.09114,45.653267 V 152.5331 H 472.49118 V 99.199848 q 0,-12.799979 -8.95998,-21.759965 -8.95999,-8.959986 -21.75997,-8.959986 -6.18666,0 -11.94665,2.346663 -5.54665,2.346663 -9.81331,6.613323 -8.95999,8.959986 -8.95999,21.759965 0,12.586642 8.95999,21.546632 4.26666,4.47999 9.81331,6.82666 5.75999,2.13333 11.94665,2.13333 6.39999,0 11.51998,-2.13333 l 9.17332,22.82663 q -9.81332,4.90666 -22.82663,4.90666 -11.73331,0 -21.75996,-4.26666 -9.81332,-4.48 -17.06664,-12.15999 -7.25332,-7.67998 -11.30665,-17.91997 -4.05333,-10.23998 -4.05333,-21.759962 0,-11.733314 4.05333,-21.973298 4.05333,-10.239984 11.30665,-17.919971 7.25332,-7.679988 17.06664,-11.946648 10.02665,-4.479993 21.75996,-4.479993 10.45332,0 18.55997,3.199995 8.10666,3.199995 14.29331,8.106654 v -8.53332 z M 538.62446,152.5331 H 513.0245 V 3.2000015 h 25.59996 V 152.5331 Z m 120.10659,-42.6666 q 0,10.45331 -3.41333,18.98663 -3.41332,8.31999 -9.81331,14.29331 -6.18666,5.76 -15.14665,8.95999 -8.95998,3.2 -20.0533,3.2 -17.70664,0 -31.57328,-5.54666 -13.86664,-5.75999 -22.82663,-13.01332 l 17.70664,-17.70663 q 7.03999,6.39999 15.78664,9.81331 5.33332,2.13333 10.02665,2.77333 4.69333,0.64 7.67999,0.64 5.54666,0 10.02665,-1.28 4.69332,-1.49333 8.10665,-3.83999 7.25332,-5.33332 7.25332,-14.07998 0,-5.33332 -3.83999,-9.59998 -2.98666,-3.41333 -7.67999,-5.54666 -3.83999,-2.13333 -8.10665,-3.413328 -4.26666,-1.279998 -7.67999,-2.346663 -1.06666,-0.426666 -1.92,-0.426666 -0.85333,-0.213333 -1.49333,-0.639999 -0.42666,0 -1.27999,-0.426666 -4.48,-1.279997 -13.01332,-4.479992 -8.31998,-3.199995 -16.63997,-8.746653 -19.4133,-13.013313 -19.4133,-31.999949 0,-12.586647 4.26666,-21.119966 4.47999,-8.746653 11.51998,-14.079978 7.03999,-5.5466575 15.57331,-7.8933204 Q 591.53116,6.6375733e-6 599.85115,6.6375733e-6 q 15.35997,0 25.81329,3.6266608624267 10.45332,3.6266609 16.63997,7.2533215 3.2,1.919997 5.33333,3.839994 2.34666,1.706664 4.05332,3.199995 l -18.1333,18.346637 q -5.75999,-5.75999 -11.73332,-8.746652 -8.95998,-4.26666 -18.7733,-4.26666 -4.26666,0 -8.53332,1.066665 -4.26666,1.066665 -7.46665,2.773329 -9.38665,5.75999 -9.38665,15.146642 0,5.759991 3.83999,9.813318 2.77333,3.199995 7.67999,5.759991 4.05332,2.13333 8.53332,3.413328 4.47999,1.279997 8.31998,2.346662 l 2.56,0.639999 q 1.06666,0.426666 4.05333,1.279998 2.98666,0.853332 7.03998,2.559996 4.05333,1.706664 8.74666,4.053327 4.90666,2.346663 9.59998,5.546658 20.6933,13.653311 20.6933,32.213284 z m 69.11977,42.6666 h -23.46663 q -7.25332,0 -13.65331,-2.77333 -6.39999,-2.77333 -11.09332,-7.46666 -4.69332,-4.90666 -7.46665,-11.30665 -2.77333,-6.39999 -2.77333,-13.65331 V 24.319968 l 25.59996,-6.39999 V 58.66658 h 14.93331 l 6.39999,25.599959 h -21.3333 v 33.066611 q 0,4.05333 2.77333,6.82666 2.77333,2.77333 6.61332,2.77333 h 17.06664 z m 111.36,-106.879833 V 152.5331 H 813.61086 V 99.199848 q 0,-12.799979 -8.95999,-21.759965 -8.95998,-8.959986 -21.75996,-8.959986 -6.18666,0 -11.94665,2.346663 -5.54666,2.346663 -9.81332,6.613323 -8.95998,8.959986 -8.95998,21.759965 0,12.586642 8.95998,21.546632 4.26666,4.47999 9.81332,6.82666 5.75999,2.13333 11.94665,2.13333 6.39999,0 11.51998,-2.13333 l 9.17332,22.82663 q -9.81332,4.90666 -22.82663,4.90666 -11.73332,0 -21.75997,-4.26666 -9.81332,-4.48 -17.06664,-12.15999 -7.25332,-7.67998 -11.30665,-17.91997 -4.05332,-10.23998 -4.05332,-21.759962 0,-11.733314 4.05332,-21.973298 4.05333,-10.239984 11.30665,-17.919971 7.25332,-7.679988 17.06664,-11.946648 10.02665,-4.479993 21.75997,-4.479993 10.45331,0 18.55997,3.199995 8.10665,3.199995 14.29331,8.106654 v -8.53332 z m 107.94652,93.226513 q -7.67998,7.67999 -17.91997,12.15999 -10.23998,4.26666 -21.97329,4.26666 -11.73332,0 -21.9733,-4.26666 -10.23999,-4.48 -17.91997,-12.15999 -7.67999,-7.67998 -12.15998,-17.91997 -4.26666,-10.23998 -4.26666,-21.759962 0,-11.733314 4.26666,-21.973298 4.47999,-10.239984 12.15998,-17.919971 7.67998,-7.679988 17.91997,-11.946648 10.23998,-4.479993 21.9733,-4.479993 11.73331,0 21.97329,4.479993 10.23999,4.26666 17.91997,11.946648 l -18.1333,18.133304 q -8.95999,-8.959986 -21.75996,-8.959986 -12.37332,0 -21.75997,8.959986 -8.95999,8.959986 -8.95999,21.759965 0,12.586642 8.95999,21.546632 4.47999,4.47999 10.02665,6.82666 5.54666,2.13333 11.73332,2.13333 13.01331,0 21.75996,-8.95999 z M 1051.6907,45.8666 998.3574,99.199848 1051.6907,152.5331 h -36.0533 L 980.2241,117.11982 V 152.5331 H 954.62414 V 3.2000015 H 980.2241 V 81.066544 L 1015.424,45.8666 h 36.2667 z\"/></svg>";
|
|
3
|
+
export declare const MARK_LIGHT = "<svg aria-hidden=\"true\" focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 46.955482 39.84531\"><g transform=\"translate(-80.9625,-128.5875)\"><g transform=\"matrix(0.23477741,0,0,0.23579318,69.660392,94.668838)\"><path style=\"fill:#245b8f;fill-opacity:1;stroke-width:0.372962\" d=\"m 165.74369,312.34514 c -3.65904,-0.95861 -6.89131,-3.35348 -9.21494,-6.82759 -1.91226,-2.85908 -2.39705,-4.56971 -2.39705,-8.45836 0,-3.99254 0.0824,-4.2757 4.23012,-14.54553 4.00923,-9.92681 11.74597,-29.60804 14.17254,-36.05302 1.0555,-2.80344 4.63579,-12.0902 7.95619,-20.63725 3.3204,-8.54706 9.47265,-24.4912 13.67168,-35.43143 9.41163,-24.52125 12.15124,-31.39614 14.19222,-35.61455 1.33229,-2.75364 1.87867,-3.59258 3.34546,-5.13672 1.96822,-2.07203 4.0984,-3.56253 6.46687,-4.52493 1.27138,-0.5166 2.25763,-0.69302 4.82679,-0.8634 5.2183,-0.34607 24.57462,-0.55458 24.98508,-0.26914 0.43797,0.30456 1.13131,-1.50021 -15.15412,39.44678 -20.68842,52.01757 -28.96185,72.98265 -36.75181,93.13004 -8.40356,21.73434 -9.39495,24.20764 -10.76316,26.85165 -2.3545,4.55 -6.3824,7.78331 -11.27661,9.05207 -2.07259,0.53729 -6.00015,0.48109 -8.28926,-0.11862 z\"/><path style=\"fill:#245b8f;fill-opacity:1;stroke-width:0.372962\" d=\"m 122.4922,312.58916 c -4.07956,-0.73258 -8.65123,-3.9341 -11.23258,-7.86616 -0.73004,-1.11203 -1.85459,-3.48326 -2.84309,-5.99496 -0.89943,-2.2854 -4.76287,-12.1553 -8.585409,-21.93313 -3.82254,-9.77783 -8.479072,-21.63803 -10.347852,-26.35601 -1.86878,-4.71797 -7.404968,-18.81595 -12.302646,-31.32884 -4.897681,-12.51288 -10.861923,-27.72975 -13.253876,-33.81525 -2.391953,-6.0855 -5.665216,-14.47715 -7.273918,-18.64811 -1.608698,-4.17097 -4.23595,-10.84826 -5.838334,-14.83843 -2.072779,-5.16153 -2.836509,-7.33177 -2.646869,-7.5214 0.347903,-0.34791 20.828887,-0.35917 24.732874,-0.0136 4.649256,0.41154 7.012848,1.52811 10.517546,4.96852 1.450819,1.42421 2.398,2.60213 2.904375,3.6119 1.798693,3.58678 8.418103,20.02869 18.666279,46.36506 3.69839,9.50432 11.16067,28.41351 16.58285,42.02042 14.63433,36.72467 18.74753,47.13765 19.53975,49.46687 2.22981,6.55589 1.05533,12.70214 -3.30426,17.29176 -3.10359,3.26736 -6.22043,4.60845 -11.02178,4.7424 -1.64331,0.0458 -3.57518,-0.0221 -4.29306,-0.15103 z\"/><rect style=\"fill:#ec634d\" width=\"11.26954\" height=\"42.097622\" x=\"164.88014\" y=\"176.25909\" ry=\"5.610496\"/><rect style=\"fill:#ec634d\" width=\"11.62156\" height=\"87.038605\" x=\"142.15868\" y=\"153.7886\" ry=\"5.610496\"/><rect style=\"fill:#ec634d\" width=\"11.26954\" height=\"42.097622\" x=\"119.78924\" y=\"176.25909\" ry=\"5.610496\"/></g></g></svg>";
|
|
4
|
+
export declare const MARK_DARK = "<svg aria-hidden=\"true\" focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 46.955482 39.84531\"><g transform=\"translate(-80.9625,-128.5875)\"><g transform=\"matrix(0.23477741,0,0,0.23579318,69.660392,94.668838)\"><path style=\"fill:#55abe5;fill-opacity:1;stroke-width:0.372962\" d=\"m 165.74369,312.34514 c -3.65904,-0.95861 -6.89131,-3.35348 -9.21494,-6.82759 -1.91226,-2.85908 -2.39705,-4.56971 -2.39705,-8.45836 0,-3.99254 0.0824,-4.2757 4.23012,-14.54553 4.00923,-9.92681 11.74597,-29.60804 14.17254,-36.05302 1.0555,-2.80344 4.63579,-12.0902 7.95619,-20.63725 3.3204,-8.54706 9.47265,-24.4912 13.67168,-35.43143 9.41163,-24.52125 12.15124,-31.39614 14.19222,-35.61455 1.33229,-2.75364 1.87867,-3.59258 3.34546,-5.13672 1.96822,-2.07203 4.0984,-3.56253 6.46687,-4.52493 1.27138,-0.5166 2.25763,-0.69302 4.82679,-0.8634 5.2183,-0.34607 24.57462,-0.55458 24.98508,-0.26914 0.43797,0.30456 1.13131,-1.50021 -15.15412,39.44678 -20.68842,52.01757 -28.96185,72.98265 -36.75181,93.13004 -8.40356,21.73434 -9.39495,24.20764 -10.76316,26.85165 -2.3545,4.55 -6.3824,7.78331 -11.27661,9.05207 -2.07259,0.53729 -6.00015,0.48109 -8.28926,-0.11862 z\"/><path style=\"fill:#55abe5;fill-opacity:1;stroke-width:0.372962\" d=\"m 122.4922,312.58916 c -4.07956,-0.73258 -8.65123,-3.9341 -11.23258,-7.86616 -0.73004,-1.11203 -1.85459,-3.48326 -2.84309,-5.99496 -0.89943,-2.2854 -4.76287,-12.1553 -8.585409,-21.93313 -3.82254,-9.77783 -8.479072,-21.63803 -10.347852,-26.35601 -1.86878,-4.71797 -7.404968,-18.81595 -12.302646,-31.32884 -4.897681,-12.51288 -10.861923,-27.72975 -13.253876,-33.81525 -2.391953,-6.0855 -5.665216,-14.47715 -7.273918,-18.64811 -1.608698,-4.17097 -4.23595,-10.84826 -5.838334,-14.83843 -2.072779,-5.16153 -2.836509,-7.33177 -2.646869,-7.5214 0.347903,-0.34791 20.828887,-0.35917 24.732874,-0.0136 4.649256,0.41154 7.012848,1.52811 10.517546,4.96852 1.450819,1.42421 2.398,2.60213 2.904375,3.6119 1.798693,3.58678 8.418103,20.02869 18.666279,46.36506 3.69839,9.50432 11.16067,28.41351 16.58285,42.02042 14.63433,36.72467 18.74753,47.13765 19.53975,49.46687 2.22981,6.55589 1.05533,12.70214 -3.30426,17.29176 -3.10359,3.26736 -6.22043,4.60845 -11.02178,4.7424 -1.64331,0.0458 -3.57518,-0.0221 -4.29306,-0.15103 z\"/><rect style=\"fill:#f78472\" width=\"11.26954\" height=\"42.097622\" x=\"164.88014\" y=\"176.25909\" ry=\"5.610496\"/><rect style=\"fill:#f78472\" width=\"11.62156\" height=\"87.038605\" x=\"142.15868\" y=\"153.7886\" ry=\"5.610496\"/><rect style=\"fill:#f78472\" width=\"11.26954\" height=\"42.097622\" x=\"119.78924\" y=\"176.25909\" ry=\"5.610496\"/></g></g></svg>";
|
|
5
|
+
export declare const BRAND: {
|
|
6
|
+
readonly blue: "#245B8F";
|
|
7
|
+
readonly coral: "#EC634D";
|
|
8
|
+
readonly lightBlue: "#55ABE5";
|
|
9
|
+
readonly lightCoral: "#F78472";
|
|
10
|
+
readonly night: "#131326";
|
|
11
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// From https://vocalstack.com/branding/ (logo-*.svg, mark-*.svg). Regenerate rather than edit.
|
|
2
|
+
export const LOGO_LIGHT = '<svg aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1051.6906 155.30641"><g transform="matrix(0.88734771,0,0,0.89118682,-42.71663,-123.85388)"><path style="fill:#245B8F;fill-opacity:1;stroke-width:0.372962" d="m 165.74369,312.34514 c -3.65904,-0.95861 -6.89131,-3.35348 -9.21494,-6.82759 -1.91226,-2.85908 -2.39705,-4.56971 -2.39705,-8.45836 0,-3.99254 0.0824,-4.2757 4.23012,-14.54553 4.00923,-9.92681 11.74597,-29.60804 14.17254,-36.05302 1.0555,-2.80344 4.63579,-12.0902 7.95619,-20.63725 3.3204,-8.54706 9.47265,-24.4912 13.67168,-35.43143 9.41163,-24.52125 12.15124,-31.39614 14.19222,-35.61455 1.33229,-2.75364 1.87867,-3.59258 3.34546,-5.13672 1.96822,-2.07203 4.0984,-3.56253 6.46687,-4.52493 1.27138,-0.5166 2.25763,-0.69302 4.82679,-0.8634 5.2183,-0.34607 24.57462,-0.55458 24.98508,-0.26914 0.43797,0.30456 1.13131,-1.50021 -15.15412,39.44678 -20.68842,52.01757 -28.96185,72.98265 -36.75181,93.13004 -8.40356,21.73434 -9.39495,24.20764 -10.76316,26.85165 -2.3545,4.55 -6.3824,7.78331 -11.27661,9.05207 -2.07259,0.53729 -6.00015,0.48109 -8.28926,-0.11862 z"/><path style="fill:#245B8F;fill-opacity:1;stroke-width:0.372962" d="m 122.4922,312.58916 c -4.07956,-0.73258 -8.65123,-3.9341 -11.23258,-7.86616 -0.73004,-1.11203 -1.85459,-3.48326 -2.84309,-5.99496 -0.89943,-2.2854 -4.76287,-12.1553 -8.585409,-21.93313 -3.82254,-9.77783 -8.479072,-21.63803 -10.347852,-26.35601 -1.86878,-4.71797 -7.404968,-18.81595 -12.302646,-31.32884 -4.897681,-12.51288 -10.861923,-27.72975 -13.253876,-33.81525 -2.391953,-6.0855 -5.665216,-14.47715 -7.273918,-18.64811 -1.608698,-4.17097 -4.23595,-10.84826 -5.838334,-14.83843 -2.072779,-5.16153 -2.836509,-7.33177 -2.646869,-7.5214 0.347903,-0.34791 20.828887,-0.35917 24.732874,-0.0136 4.649256,0.41154 7.012848,1.52811 10.517546,4.96852 1.450819,1.42421 2.398,2.60213 2.904375,3.6119 1.798693,3.58678 8.418103,20.02869 18.666279,46.36506 3.69839,9.50432 11.16067,28.41351 16.58285,42.02042 14.63433,36.72467 18.74753,47.13765 19.53975,49.46687 2.22981,6.55589 1.05533,12.70214 -3.30426,17.29176 -3.10359,3.26736 -6.22043,4.60845 -11.02178,4.7424 -1.64331,0.0458 -3.57518,-0.0221 -4.29306,-0.15103 z"/><rect style="fill:#ec634d" width="11.26954" height="42.097622" x="164.88014" y="176.25909" ry="5.610496"/><rect style="fill:#ec634d" width="11.62156" height="87.038605" x="142.15868" y="153.7886" ry="5.610496"/><rect style="fill:#ec634d" width="11.26954" height="42.097622" x="119.78924" y="176.25909" ry="5.610496"/></g><path style="fill:#ec634d" d="m 222.25132,68.479897 q -12.79998,0 -21.75997,8.959986 -8.95998,8.959986 -8.95998,21.759965 0,12.586642 8.95998,21.546632 4.26666,4.47999 9.81332,6.82666 5.75999,2.13333 11.94665,2.13333 6.18666,0 11.73331,-2.13333 5.54666,-2.34667 10.02665,-6.82666 8.95999,-8.95999 8.95999,-21.546632 0,-12.799979 -8.95999,-21.759965 -9.38665,-8.959986 -21.75996,-8.959986 z m 0,-25.599959 q 11.73331,0 21.9733,4.479993 10.23998,4.26666 17.91997,11.946648 7.67999,7.679987 11.94665,17.919971 4.47999,10.239984 4.47999,21.973298 0,11.519982 -4.47999,21.759962 -4.26666,10.23999 -11.94665,17.91997 -7.67999,7.67999 -17.91997,12.15999 -10.23999,4.26666 -21.9733,4.26666 -11.73332,0 -21.9733,-4.26666 -10.23998,-4.48 -17.91997,-12.15999 -7.67999,-7.67998 -12.15998,-17.91997 -4.26666,-10.23998 -4.26666,-21.759962 0,-11.733314 4.26666,-21.973298 4.47999,-10.239984 12.15998,-17.919971 7.67999,-7.679988 17.91997,-11.946648 10.23998,-4.479993 21.9733,-4.479993 z M 383.3179,138.87978 q -7.67999,7.67999 -17.91997,12.15999 -10.23999,4.26666 -21.9733,4.26666 -11.73332,0 -21.9733,-4.26666 -10.23998,-4.48 -17.91997,-12.15999 -7.67999,-7.67998 -12.15998,-17.91997 -4.26666,-10.23998 -4.26666,-21.759962 0,-11.733314 4.26666,-21.973298 4.47999,-10.239984 12.15998,-17.919971 7.67999,-7.679988 17.91997,-11.946648 10.23998,-4.479993 21.9733,-4.479993 11.73331,0 21.9733,4.479993 10.23998,4.26666 17.91997,11.946648 l -18.13331,18.133304 q -8.95998,-8.959986 -21.75996,-8.959986 -12.37332,0 -21.75997,8.959986 -8.95998,8.959986 -8.95998,21.759965 0,12.586642 8.95998,21.546632 4.48,4.47999 10.02665,6.82666 5.54666,2.13333 11.73332,2.13333 13.01331,0 21.75996,-8.95999 z M 498.09114,45.653267 V 152.5331 H 472.49118 V 99.199848 q 0,-12.799979 -8.95998,-21.759965 -8.95999,-8.959986 -21.75997,-8.959986 -6.18666,0 -11.94665,2.346663 -5.54665,2.346663 -9.81331,6.613323 -8.95999,8.959986 -8.95999,21.759965 0,12.586642 8.95999,21.546632 4.26666,4.47999 9.81331,6.82666 5.75999,2.13333 11.94665,2.13333 6.39999,0 11.51998,-2.13333 l 9.17332,22.82663 q -9.81332,4.90666 -22.82663,4.90666 -11.73331,0 -21.75996,-4.26666 -9.81332,-4.48 -17.06664,-12.15999 -7.25332,-7.67998 -11.30665,-17.91997 -4.05333,-10.23998 -4.05333,-21.759962 0,-11.733314 4.05333,-21.973298 4.05333,-10.239984 11.30665,-17.919971 7.25332,-7.679988 17.06664,-11.946648 10.02665,-4.479993 21.75996,-4.479993 10.45332,0 18.55997,3.199995 8.10666,3.199995 14.29331,8.106654 v -8.53332 z M 538.62446,152.5331 H 513.0245 V 3.2000015 h 25.59996 V 152.5331 Z m 120.10659,-42.6666 q 0,10.45331 -3.41333,18.98663 -3.41332,8.31999 -9.81331,14.29331 -6.18666,5.76 -15.14665,8.95999 -8.95998,3.2 -20.0533,3.2 -17.70664,0 -31.57328,-5.54666 -13.86664,-5.75999 -22.82663,-13.01332 l 17.70664,-17.70663 q 7.03999,6.39999 15.78664,9.81331 5.33332,2.13333 10.02665,2.77333 4.69333,0.64 7.67999,0.64 5.54666,0 10.02665,-1.28 4.69332,-1.49333 8.10665,-3.83999 7.25332,-5.33332 7.25332,-14.07998 0,-5.33332 -3.83999,-9.59998 -2.98666,-3.41333 -7.67999,-5.54666 -3.83999,-2.13333 -8.10665,-3.413328 -4.26666,-1.279998 -7.67999,-2.346663 -1.06666,-0.426666 -1.92,-0.426666 -0.85333,-0.213333 -1.49333,-0.639999 -0.42666,0 -1.27999,-0.426666 -4.48,-1.279997 -13.01332,-4.479992 -8.31998,-3.199995 -16.63997,-8.746653 -19.4133,-13.013313 -19.4133,-31.999949 0,-12.586647 4.26666,-21.119966 4.47999,-8.746653 11.51998,-14.079978 7.03999,-5.5466575 15.57331,-7.8933204 Q 591.53116,6.6375733e-6 599.85115,6.6375733e-6 q 15.35997,0 25.81329,3.6266608624267 10.45332,3.6266609 16.63997,7.2533215 3.2,1.919997 5.33333,3.839994 2.34666,1.706664 4.05332,3.199995 l -18.1333,18.346637 q -5.75999,-5.75999 -11.73332,-8.746652 -8.95998,-4.26666 -18.7733,-4.26666 -4.26666,0 -8.53332,1.066665 -4.26666,1.066665 -7.46665,2.773329 -9.38665,5.75999 -9.38665,15.146642 0,5.759991 3.83999,9.813318 2.77333,3.199995 7.67999,5.759991 4.05332,2.13333 8.53332,3.413328 4.47999,1.279997 8.31998,2.346662 l 2.56,0.639999 q 1.06666,0.426666 4.05333,1.279998 2.98666,0.853332 7.03998,2.559996 4.05333,1.706664 8.74666,4.053327 4.90666,2.346663 9.59998,5.546658 20.6933,13.653311 20.6933,32.213284 z m 69.11977,42.6666 h -23.46663 q -7.25332,0 -13.65331,-2.77333 -6.39999,-2.77333 -11.09332,-7.46666 -4.69332,-4.90666 -7.46665,-11.30665 -2.77333,-6.39999 -2.77333,-13.65331 V 24.319968 l 25.59996,-6.39999 V 58.66658 h 14.93331 l 6.39999,25.599959 h -21.3333 v 33.066611 q 0,4.05333 2.77333,6.82666 2.77333,2.77333 6.61332,2.77333 h 17.06664 z m 111.36,-106.879833 V 152.5331 H 813.61086 V 99.199848 q 0,-12.799979 -8.95999,-21.759965 -8.95998,-8.959986 -21.75996,-8.959986 -6.18666,0 -11.94665,2.346663 -5.54666,2.346663 -9.81332,6.613323 -8.95998,8.959986 -8.95998,21.759965 0,12.586642 8.95998,21.546632 4.26666,4.47999 9.81332,6.82666 5.75999,2.13333 11.94665,2.13333 6.39999,0 11.51998,-2.13333 l 9.17332,22.82663 q -9.81332,4.90666 -22.82663,4.90666 -11.73332,0 -21.75997,-4.26666 -9.81332,-4.48 -17.06664,-12.15999 -7.25332,-7.67998 -11.30665,-17.91997 -4.05332,-10.23998 -4.05332,-21.759962 0,-11.733314 4.05332,-21.973298 4.05333,-10.239984 11.30665,-17.919971 7.25332,-7.679988 17.06664,-11.946648 10.02665,-4.479993 21.75997,-4.479993 10.45331,0 18.55997,3.199995 8.10665,3.199995 14.29331,8.106654 v -8.53332 z m 107.94652,93.226513 q -7.67998,7.67999 -17.91997,12.15999 -10.23998,4.26666 -21.97329,4.26666 -11.73332,0 -21.9733,-4.26666 -10.23999,-4.48 -17.91997,-12.15999 -7.67999,-7.67998 -12.15998,-17.91997 -4.26666,-10.23998 -4.26666,-21.759962 0,-11.733314 4.26666,-21.973298 4.47999,-10.239984 12.15998,-17.919971 7.67998,-7.679988 17.91997,-11.946648 10.23998,-4.479993 21.9733,-4.479993 11.73331,0 21.97329,4.479993 10.23999,4.26666 17.91997,11.946648 l -18.1333,18.133304 q -8.95999,-8.959986 -21.75996,-8.959986 -12.37332,0 -21.75997,8.959986 -8.95999,8.959986 -8.95999,21.759965 0,12.586642 8.95999,21.546632 4.47999,4.47999 10.02665,6.82666 5.54666,2.13333 11.73332,2.13333 13.01331,0 21.75996,-8.95999 z M 1051.6907,45.8666 998.3574,99.199848 1051.6907,152.5331 h -36.0533 L 980.2241,117.11982 V 152.5331 H 954.62414 V 3.2000015 H 980.2241 V 81.066544 L 1015.424,45.8666 h 36.2667 z"/></svg>';
|
|
3
|
+
export const LOGO_DARK = '<svg aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1051.6906 155.30641"><g transform="matrix(0.88734771,0,0,0.89118682,-42.71663,-123.85388)"><path style="fill:#55abe5;fill-opacity:1;stroke-width:0.372962" d="m 165.74369,312.34514 c -3.65904,-0.95861 -6.89131,-3.35348 -9.21494,-6.82759 -1.91226,-2.85908 -2.39705,-4.56971 -2.39705,-8.45836 0,-3.99254 0.0824,-4.2757 4.23012,-14.54553 4.00923,-9.92681 11.74597,-29.60804 14.17254,-36.05302 1.0555,-2.80344 4.63579,-12.0902 7.95619,-20.63725 3.3204,-8.54706 9.47265,-24.4912 13.67168,-35.43143 9.41163,-24.52125 12.15124,-31.39614 14.19222,-35.61455 1.33229,-2.75364 1.87867,-3.59258 3.34546,-5.13672 1.96822,-2.07203 4.0984,-3.56253 6.46687,-4.52493 1.27138,-0.5166 2.25763,-0.69302 4.82679,-0.8634 5.2183,-0.34607 24.57462,-0.55458 24.98508,-0.26914 0.43797,0.30456 1.13131,-1.50021 -15.15412,39.44678 -20.68842,52.01757 -28.96185,72.98265 -36.75181,93.13004 -8.40356,21.73434 -9.39495,24.20764 -10.76316,26.85165 -2.3545,4.55 -6.3824,7.78331 -11.27661,9.05207 -2.07259,0.53729 -6.00015,0.48109 -8.28926,-0.11862 z"/><path style="fill:#55abe5;fill-opacity:1;stroke-width:0.372962" d="m 122.4922,312.58916 c -4.07956,-0.73258 -8.65123,-3.9341 -11.23258,-7.86616 -0.73004,-1.11203 -1.85459,-3.48326 -2.84309,-5.99496 -0.89943,-2.2854 -4.76287,-12.1553 -8.585409,-21.93313 -3.82254,-9.77783 -8.479072,-21.63803 -10.347852,-26.35601 -1.86878,-4.71797 -7.404968,-18.81595 -12.302646,-31.32884 -4.897681,-12.51288 -10.861923,-27.72975 -13.253876,-33.81525 -2.391953,-6.0855 -5.665216,-14.47715 -7.273918,-18.64811 -1.608698,-4.17097 -4.23595,-10.84826 -5.838334,-14.83843 -2.072779,-5.16153 -2.836509,-7.33177 -2.646869,-7.5214 0.347903,-0.34791 20.828887,-0.35917 24.732874,-0.0136 4.649256,0.41154 7.012848,1.52811 10.517546,4.96852 1.450819,1.42421 2.398,2.60213 2.904375,3.6119 1.798693,3.58678 8.418103,20.02869 18.666279,46.36506 3.69839,9.50432 11.16067,28.41351 16.58285,42.02042 14.63433,36.72467 18.74753,47.13765 19.53975,49.46687 2.22981,6.55589 1.05533,12.70214 -3.30426,17.29176 -3.10359,3.26736 -6.22043,4.60845 -11.02178,4.7424 -1.64331,0.0458 -3.57518,-0.0221 -4.29306,-0.15103 z"/><rect style="fill:#ec634d" width="11.26954" height="42.097622" x="164.88014" y="176.25909" ry="5.610496"/><rect style="fill:#ec634d" width="11.62156" height="87.038605" x="142.15868" y="153.7886" ry="5.610496"/><rect style="fill:#ec634d" width="11.26954" height="42.097622" x="119.78924" y="176.25909" ry="5.610496"/></g><path style="fill:#ffffff" d="m 222.25132,68.479897 q -12.79998,0 -21.75997,8.959986 -8.95998,8.959986 -8.95998,21.759965 0,12.586642 8.95998,21.546632 4.26666,4.47999 9.81332,6.82666 5.75999,2.13333 11.94665,2.13333 6.18666,0 11.73331,-2.13333 5.54666,-2.34667 10.02665,-6.82666 8.95999,-8.95999 8.95999,-21.546632 0,-12.799979 -8.95999,-21.759965 -9.38665,-8.959986 -21.75996,-8.959986 z m 0,-25.599959 q 11.73331,0 21.9733,4.479993 10.23998,4.26666 17.91997,11.946648 7.67999,7.679987 11.94665,17.919971 4.47999,10.239984 4.47999,21.973298 0,11.519982 -4.47999,21.759962 -4.26666,10.23999 -11.94665,17.91997 -7.67999,7.67999 -17.91997,12.15999 -10.23999,4.26666 -21.9733,4.26666 -11.73332,0 -21.9733,-4.26666 -10.23998,-4.48 -17.91997,-12.15999 -7.67999,-7.67998 -12.15998,-17.91997 -4.26666,-10.23998 -4.26666,-21.759962 0,-11.733314 4.26666,-21.973298 4.47999,-10.239984 12.15998,-17.919971 7.67999,-7.679988 17.91997,-11.946648 10.23998,-4.479993 21.9733,-4.479993 z M 383.3179,138.87978 q -7.67999,7.67999 -17.91997,12.15999 -10.23999,4.26666 -21.9733,4.26666 -11.73332,0 -21.9733,-4.26666 -10.23998,-4.48 -17.91997,-12.15999 -7.67999,-7.67998 -12.15998,-17.91997 -4.26666,-10.23998 -4.26666,-21.759962 0,-11.733314 4.26666,-21.973298 4.47999,-10.239984 12.15998,-17.919971 7.67999,-7.679988 17.91997,-11.946648 10.23998,-4.479993 21.9733,-4.479993 11.73331,0 21.9733,4.479993 10.23998,4.26666 17.91997,11.946648 l -18.13331,18.133304 q -8.95998,-8.959986 -21.75996,-8.959986 -12.37332,0 -21.75997,8.959986 -8.95998,8.959986 -8.95998,21.759965 0,12.586642 8.95998,21.546632 4.48,4.47999 10.02665,6.82666 5.54666,2.13333 11.73332,2.13333 13.01331,0 21.75996,-8.95999 z M 498.09114,45.653267 V 152.5331 H 472.49118 V 99.199848 q 0,-12.799979 -8.95998,-21.759965 -8.95999,-8.959986 -21.75997,-8.959986 -6.18666,0 -11.94665,2.346663 -5.54665,2.346663 -9.81331,6.613323 -8.95999,8.959986 -8.95999,21.759965 0,12.586642 8.95999,21.546632 4.26666,4.47999 9.81331,6.82666 5.75999,2.13333 11.94665,2.13333 6.39999,0 11.51998,-2.13333 l 9.17332,22.82663 q -9.81332,4.90666 -22.82663,4.90666 -11.73331,0 -21.75996,-4.26666 -9.81332,-4.48 -17.06664,-12.15999 -7.25332,-7.67998 -11.30665,-17.91997 -4.05333,-10.23998 -4.05333,-21.759962 0,-11.733314 4.05333,-21.973298 4.05333,-10.239984 11.30665,-17.919971 7.25332,-7.679988 17.06664,-11.946648 10.02665,-4.479993 21.75996,-4.479993 10.45332,0 18.55997,3.199995 8.10666,3.199995 14.29331,8.106654 v -8.53332 z M 538.62446,152.5331 H 513.0245 V 3.2000015 h 25.59996 V 152.5331 Z m 120.10659,-42.6666 q 0,10.45331 -3.41333,18.98663 -3.41332,8.31999 -9.81331,14.29331 -6.18666,5.76 -15.14665,8.95999 -8.95998,3.2 -20.0533,3.2 -17.70664,0 -31.57328,-5.54666 -13.86664,-5.75999 -22.82663,-13.01332 l 17.70664,-17.70663 q 7.03999,6.39999 15.78664,9.81331 5.33332,2.13333 10.02665,2.77333 4.69333,0.64 7.67999,0.64 5.54666,0 10.02665,-1.28 4.69332,-1.49333 8.10665,-3.83999 7.25332,-5.33332 7.25332,-14.07998 0,-5.33332 -3.83999,-9.59998 -2.98666,-3.41333 -7.67999,-5.54666 -3.83999,-2.13333 -8.10665,-3.413328 -4.26666,-1.279998 -7.67999,-2.346663 -1.06666,-0.426666 -1.92,-0.426666 -0.85333,-0.213333 -1.49333,-0.639999 -0.42666,0 -1.27999,-0.426666 -4.48,-1.279997 -13.01332,-4.479992 -8.31998,-3.199995 -16.63997,-8.746653 -19.4133,-13.013313 -19.4133,-31.999949 0,-12.586647 4.26666,-21.119966 4.47999,-8.746653 11.51998,-14.079978 7.03999,-5.5466575 15.57331,-7.8933204 Q 591.53116,6.6375733e-6 599.85115,6.6375733e-6 q 15.35997,0 25.81329,3.6266608624267 10.45332,3.6266609 16.63997,7.2533215 3.2,1.919997 5.33333,3.839994 2.34666,1.706664 4.05332,3.199995 l -18.1333,18.346637 q -5.75999,-5.75999 -11.73332,-8.746652 -8.95998,-4.26666 -18.7733,-4.26666 -4.26666,0 -8.53332,1.066665 -4.26666,1.066665 -7.46665,2.773329 -9.38665,5.75999 -9.38665,15.146642 0,5.759991 3.83999,9.813318 2.77333,3.199995 7.67999,5.759991 4.05332,2.13333 8.53332,3.413328 4.47999,1.279997 8.31998,2.346662 l 2.56,0.639999 q 1.06666,0.426666 4.05333,1.279998 2.98666,0.853332 7.03998,2.559996 4.05333,1.706664 8.74666,4.053327 4.90666,2.346663 9.59998,5.546658 20.6933,13.653311 20.6933,32.213284 z m 69.11977,42.6666 h -23.46663 q -7.25332,0 -13.65331,-2.77333 -6.39999,-2.77333 -11.09332,-7.46666 -4.69332,-4.90666 -7.46665,-11.30665 -2.77333,-6.39999 -2.77333,-13.65331 V 24.319968 l 25.59996,-6.39999 V 58.66658 h 14.93331 l 6.39999,25.599959 h -21.3333 v 33.066611 q 0,4.05333 2.77333,6.82666 2.77333,2.77333 6.61332,2.77333 h 17.06664 z m 111.36,-106.879833 V 152.5331 H 813.61086 V 99.199848 q 0,-12.799979 -8.95999,-21.759965 -8.95998,-8.959986 -21.75996,-8.959986 -6.18666,0 -11.94665,2.346663 -5.54666,2.346663 -9.81332,6.613323 -8.95998,8.959986 -8.95998,21.759965 0,12.586642 8.95998,21.546632 4.26666,4.47999 9.81332,6.82666 5.75999,2.13333 11.94665,2.13333 6.39999,0 11.51998,-2.13333 l 9.17332,22.82663 q -9.81332,4.90666 -22.82663,4.90666 -11.73332,0 -21.75997,-4.26666 -9.81332,-4.48 -17.06664,-12.15999 -7.25332,-7.67998 -11.30665,-17.91997 -4.05332,-10.23998 -4.05332,-21.759962 0,-11.733314 4.05332,-21.973298 4.05333,-10.239984 11.30665,-17.919971 7.25332,-7.679988 17.06664,-11.946648 10.02665,-4.479993 21.75997,-4.479993 10.45331,0 18.55997,3.199995 8.10665,3.199995 14.29331,8.106654 v -8.53332 z m 107.94652,93.226513 q -7.67998,7.67999 -17.91997,12.15999 -10.23998,4.26666 -21.97329,4.26666 -11.73332,0 -21.9733,-4.26666 -10.23999,-4.48 -17.91997,-12.15999 -7.67999,-7.67998 -12.15998,-17.91997 -4.26666,-10.23998 -4.26666,-21.759962 0,-11.733314 4.26666,-21.973298 4.47999,-10.239984 12.15998,-17.919971 7.67998,-7.679988 17.91997,-11.946648 10.23998,-4.479993 21.9733,-4.479993 11.73331,0 21.97329,4.479993 10.23999,4.26666 17.91997,11.946648 l -18.1333,18.133304 q -8.95999,-8.959986 -21.75996,-8.959986 -12.37332,0 -21.75997,8.959986 -8.95999,8.959986 -8.95999,21.759965 0,12.586642 8.95999,21.546632 4.47999,4.47999 10.02665,6.82666 5.54666,2.13333 11.73332,2.13333 13.01331,0 21.75996,-8.95999 z M 1051.6907,45.8666 998.3574,99.199848 1051.6907,152.5331 h -36.0533 L 980.2241,117.11982 V 152.5331 H 954.62414 V 3.2000015 H 980.2241 V 81.066544 L 1015.424,45.8666 h 36.2667 z"/></svg>';
|
|
4
|
+
export const MARK_LIGHT = '<svg aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 46.955482 39.84531"><g transform="translate(-80.9625,-128.5875)"><g transform="matrix(0.23477741,0,0,0.23579318,69.660392,94.668838)"><path style="fill:#245b8f;fill-opacity:1;stroke-width:0.372962" d="m 165.74369,312.34514 c -3.65904,-0.95861 -6.89131,-3.35348 -9.21494,-6.82759 -1.91226,-2.85908 -2.39705,-4.56971 -2.39705,-8.45836 0,-3.99254 0.0824,-4.2757 4.23012,-14.54553 4.00923,-9.92681 11.74597,-29.60804 14.17254,-36.05302 1.0555,-2.80344 4.63579,-12.0902 7.95619,-20.63725 3.3204,-8.54706 9.47265,-24.4912 13.67168,-35.43143 9.41163,-24.52125 12.15124,-31.39614 14.19222,-35.61455 1.33229,-2.75364 1.87867,-3.59258 3.34546,-5.13672 1.96822,-2.07203 4.0984,-3.56253 6.46687,-4.52493 1.27138,-0.5166 2.25763,-0.69302 4.82679,-0.8634 5.2183,-0.34607 24.57462,-0.55458 24.98508,-0.26914 0.43797,0.30456 1.13131,-1.50021 -15.15412,39.44678 -20.68842,52.01757 -28.96185,72.98265 -36.75181,93.13004 -8.40356,21.73434 -9.39495,24.20764 -10.76316,26.85165 -2.3545,4.55 -6.3824,7.78331 -11.27661,9.05207 -2.07259,0.53729 -6.00015,0.48109 -8.28926,-0.11862 z"/><path style="fill:#245b8f;fill-opacity:1;stroke-width:0.372962" d="m 122.4922,312.58916 c -4.07956,-0.73258 -8.65123,-3.9341 -11.23258,-7.86616 -0.73004,-1.11203 -1.85459,-3.48326 -2.84309,-5.99496 -0.89943,-2.2854 -4.76287,-12.1553 -8.585409,-21.93313 -3.82254,-9.77783 -8.479072,-21.63803 -10.347852,-26.35601 -1.86878,-4.71797 -7.404968,-18.81595 -12.302646,-31.32884 -4.897681,-12.51288 -10.861923,-27.72975 -13.253876,-33.81525 -2.391953,-6.0855 -5.665216,-14.47715 -7.273918,-18.64811 -1.608698,-4.17097 -4.23595,-10.84826 -5.838334,-14.83843 -2.072779,-5.16153 -2.836509,-7.33177 -2.646869,-7.5214 0.347903,-0.34791 20.828887,-0.35917 24.732874,-0.0136 4.649256,0.41154 7.012848,1.52811 10.517546,4.96852 1.450819,1.42421 2.398,2.60213 2.904375,3.6119 1.798693,3.58678 8.418103,20.02869 18.666279,46.36506 3.69839,9.50432 11.16067,28.41351 16.58285,42.02042 14.63433,36.72467 18.74753,47.13765 19.53975,49.46687 2.22981,6.55589 1.05533,12.70214 -3.30426,17.29176 -3.10359,3.26736 -6.22043,4.60845 -11.02178,4.7424 -1.64331,0.0458 -3.57518,-0.0221 -4.29306,-0.15103 z"/><rect style="fill:#ec634d" width="11.26954" height="42.097622" x="164.88014" y="176.25909" ry="5.610496"/><rect style="fill:#ec634d" width="11.62156" height="87.038605" x="142.15868" y="153.7886" ry="5.610496"/><rect style="fill:#ec634d" width="11.26954" height="42.097622" x="119.78924" y="176.25909" ry="5.610496"/></g></g></svg>';
|
|
5
|
+
export const MARK_DARK = '<svg aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 46.955482 39.84531"><g transform="translate(-80.9625,-128.5875)"><g transform="matrix(0.23477741,0,0,0.23579318,69.660392,94.668838)"><path style="fill:#55abe5;fill-opacity:1;stroke-width:0.372962" d="m 165.74369,312.34514 c -3.65904,-0.95861 -6.89131,-3.35348 -9.21494,-6.82759 -1.91226,-2.85908 -2.39705,-4.56971 -2.39705,-8.45836 0,-3.99254 0.0824,-4.2757 4.23012,-14.54553 4.00923,-9.92681 11.74597,-29.60804 14.17254,-36.05302 1.0555,-2.80344 4.63579,-12.0902 7.95619,-20.63725 3.3204,-8.54706 9.47265,-24.4912 13.67168,-35.43143 9.41163,-24.52125 12.15124,-31.39614 14.19222,-35.61455 1.33229,-2.75364 1.87867,-3.59258 3.34546,-5.13672 1.96822,-2.07203 4.0984,-3.56253 6.46687,-4.52493 1.27138,-0.5166 2.25763,-0.69302 4.82679,-0.8634 5.2183,-0.34607 24.57462,-0.55458 24.98508,-0.26914 0.43797,0.30456 1.13131,-1.50021 -15.15412,39.44678 -20.68842,52.01757 -28.96185,72.98265 -36.75181,93.13004 -8.40356,21.73434 -9.39495,24.20764 -10.76316,26.85165 -2.3545,4.55 -6.3824,7.78331 -11.27661,9.05207 -2.07259,0.53729 -6.00015,0.48109 -8.28926,-0.11862 z"/><path style="fill:#55abe5;fill-opacity:1;stroke-width:0.372962" d="m 122.4922,312.58916 c -4.07956,-0.73258 -8.65123,-3.9341 -11.23258,-7.86616 -0.73004,-1.11203 -1.85459,-3.48326 -2.84309,-5.99496 -0.89943,-2.2854 -4.76287,-12.1553 -8.585409,-21.93313 -3.82254,-9.77783 -8.479072,-21.63803 -10.347852,-26.35601 -1.86878,-4.71797 -7.404968,-18.81595 -12.302646,-31.32884 -4.897681,-12.51288 -10.861923,-27.72975 -13.253876,-33.81525 -2.391953,-6.0855 -5.665216,-14.47715 -7.273918,-18.64811 -1.608698,-4.17097 -4.23595,-10.84826 -5.838334,-14.83843 -2.072779,-5.16153 -2.836509,-7.33177 -2.646869,-7.5214 0.347903,-0.34791 20.828887,-0.35917 24.732874,-0.0136 4.649256,0.41154 7.012848,1.52811 10.517546,4.96852 1.450819,1.42421 2.398,2.60213 2.904375,3.6119 1.798693,3.58678 8.418103,20.02869 18.666279,46.36506 3.69839,9.50432 11.16067,28.41351 16.58285,42.02042 14.63433,36.72467 18.74753,47.13765 19.53975,49.46687 2.22981,6.55589 1.05533,12.70214 -3.30426,17.29176 -3.10359,3.26736 -6.22043,4.60845 -11.02178,4.7424 -1.64331,0.0458 -3.57518,-0.0221 -4.29306,-0.15103 z"/><rect style="fill:#f78472" width="11.26954" height="42.097622" x="164.88014" y="176.25909" ry="5.610496"/><rect style="fill:#f78472" width="11.62156" height="87.038605" x="142.15868" y="153.7886" ry="5.610496"/><rect style="fill:#f78472" width="11.26954" height="42.097622" x="119.78924" y="176.25909" ry="5.610496"/></g></g></svg>';
|
|
6
|
+
export const BRAND = { blue: '#245B8F', coral: '#EC634D', lightBlue: '#55ABE5', lightCoral: '#F78472', night: '#131326' };
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SanityClient, SanityDocument } from 'sanity';
|
|
2
|
+
import type { AudioAsset, VocalStackTranscript } from './types.js';
|
|
3
|
+
export declare const TRANSCRIPT_TYPE = "vocalstack.transcript";
|
|
4
|
+
export declare const POLL_MS = 3000;
|
|
5
|
+
export declare const API_VERSION = "2024-01-01";
|
|
6
|
+
/** The file asset ids next to a transcript: the one in `audioField`, or every sibling file. */
|
|
7
|
+
export declare function siblingFileRefs(siblings: Record<string, unknown> | undefined, audioField?: string): string[];
|
|
8
|
+
/** The first of these assets that is audio (in the order given). */
|
|
9
|
+
export declare function findAudio(client: SanityClient, refs: string[]): Promise<AudioAsset | undefined>;
|
|
10
|
+
/** The transcription's name in VocalStack: the document's title, else the file's name. */
|
|
11
|
+
export declare function jobName(document: SanityDocument, asset: AudioAsset): string;
|
|
12
|
+
/** A stopped job leaves the field as it was before Transcribe: the earlier transcript, if any. */
|
|
13
|
+
export declare const restored: (value: VocalStackTranscript | undefined) => VocalStackTranscript;
|
package/dist/core.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export const TRANSCRIPT_TYPE = 'vocalstack.transcript';
|
|
2
|
+
export const POLL_MS = 3000;
|
|
3
|
+
export const API_VERSION = '2024-01-01';
|
|
4
|
+
const fileRef = (v) => {
|
|
5
|
+
const ref = v?.asset?._ref;
|
|
6
|
+
return typeof ref === 'string' && ref.startsWith('file-') ? ref : undefined;
|
|
7
|
+
};
|
|
8
|
+
/** The file asset ids next to a transcript: the one in `audioField`, or every sibling file. */
|
|
9
|
+
export function siblingFileRefs(siblings, audioField) {
|
|
10
|
+
if (!siblings)
|
|
11
|
+
return [];
|
|
12
|
+
if (audioField)
|
|
13
|
+
return [fileRef(siblings[audioField])].filter((r) => Boolean(r));
|
|
14
|
+
return Object.values(siblings).map(fileRef).filter((r) => Boolean(r));
|
|
15
|
+
}
|
|
16
|
+
/** The first of these assets that is audio (in the order given). */
|
|
17
|
+
export async function findAudio(client, refs) {
|
|
18
|
+
if (!refs.length)
|
|
19
|
+
return undefined;
|
|
20
|
+
const assets = await client.fetch('*[_id in $ids]{ _id, url, mimeType, originalFilename }', { ids: refs });
|
|
21
|
+
return refs.map((id) => assets.find((a) => a._id === id)).find((a) => a?.mimeType?.startsWith('audio/'));
|
|
22
|
+
}
|
|
23
|
+
/** The transcription's name in VocalStack: the document's title, else the file's name. */
|
|
24
|
+
export function jobName(document, asset) {
|
|
25
|
+
for (const key of ['title', 'name', 'heading']) {
|
|
26
|
+
const v = document[key];
|
|
27
|
+
if (typeof v === 'string' && v.trim())
|
|
28
|
+
return v.trim();
|
|
29
|
+
}
|
|
30
|
+
return asset.originalFilename ?? `${document._type} ${document._id.replace(/^drafts\./, '')}`;
|
|
31
|
+
}
|
|
32
|
+
/** A stopped job leaves the field as it was before Transcribe: the earlier transcript, if any. */
|
|
33
|
+
export const restored = (value) => ({
|
|
34
|
+
error: null,
|
|
35
|
+
status: (value?.transcript ? 'done' : 'idle'),
|
|
36
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SanityClient } from 'sanity';
|
|
2
|
+
import type { VocalStackPluginOptions } from './types.js';
|
|
3
|
+
import type { ConnectionResponse } from './wire.js';
|
|
4
|
+
export declare class HandlerError extends Error {
|
|
5
|
+
code?: string;
|
|
6
|
+
status: number;
|
|
7
|
+
constructor(status: number, message: string, code?: string);
|
|
8
|
+
}
|
|
9
|
+
/** Calls to the server handler, signed with the Studio session. */
|
|
10
|
+
export declare function useHandler(options: VocalStackPluginOptions): {
|
|
11
|
+
call: <T>(path: string, init?: {
|
|
12
|
+
body?: unknown;
|
|
13
|
+
method?: "GET" | "POST";
|
|
14
|
+
}) => Promise<T>;
|
|
15
|
+
client: SanityClient;
|
|
16
|
+
};
|
|
17
|
+
/** Whether the handler is up and has a VocalStack key. */
|
|
18
|
+
export declare function useConnection(call: ReturnType<typeof useHandler>['call']): (ConnectionResponse & {
|
|
19
|
+
error?: string;
|
|
20
|
+
}) | undefined;
|
package/dist/handler.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import { useClient } from 'sanity';
|
|
3
|
+
import { API_VERSION } from './core.js';
|
|
4
|
+
import { SESSION_MAX_AGE_MS, SESSION_PREFIX, SESSION_TYPE, sha256Hex } from './wire.js';
|
|
5
|
+
export class HandlerError extends Error {
|
|
6
|
+
code;
|
|
7
|
+
status;
|
|
8
|
+
constructor(status, message, code) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.code = code;
|
|
11
|
+
this.status = status;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const memory = new Map();
|
|
15
|
+
const pending = new Map();
|
|
16
|
+
const base64url = (bytes) => btoa(String.fromCharCode(...bytes)).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
|
|
17
|
+
function load(key) {
|
|
18
|
+
try {
|
|
19
|
+
const raw = localStorage.getItem(key);
|
|
20
|
+
if (raw)
|
|
21
|
+
return JSON.parse(raw);
|
|
22
|
+
}
|
|
23
|
+
catch { }
|
|
24
|
+
return memory.get(key);
|
|
25
|
+
}
|
|
26
|
+
function keep(key, value) {
|
|
27
|
+
if (value)
|
|
28
|
+
memory.set(key, value);
|
|
29
|
+
else
|
|
30
|
+
memory.delete(key);
|
|
31
|
+
try {
|
|
32
|
+
if (value)
|
|
33
|
+
localStorage.setItem(key, JSON.stringify(value));
|
|
34
|
+
else
|
|
35
|
+
localStorage.removeItem(key);
|
|
36
|
+
}
|
|
37
|
+
catch { }
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Prove to the handler that this browser is signed in to the Studio: write a session
|
|
41
|
+
* document `vocalstack-session.<sha256(secret)>` with the editor's own Sanity login,
|
|
42
|
+
* and send the secret. The handler looks the hash up with its own token. The dotted id
|
|
43
|
+
* keeps the document out of a public dataset's API; readers see the hash, not the secret.
|
|
44
|
+
*/
|
|
45
|
+
async function session(client, fresh) {
|
|
46
|
+
const { dataset, projectId } = client.config();
|
|
47
|
+
const key = `vocalstack:session:${projectId}:${dataset}`;
|
|
48
|
+
const stored = load(key);
|
|
49
|
+
// An hour's margin, so a session never runs out between two polls.
|
|
50
|
+
if (!fresh && stored && stored.createdAt + SESSION_MAX_AGE_MS - 3600_000 > Date.now())
|
|
51
|
+
return stored.secret;
|
|
52
|
+
let creating = pending.get(key);
|
|
53
|
+
if (!creating) {
|
|
54
|
+
creating = (async () => {
|
|
55
|
+
const secret = base64url(crypto.getRandomValues(new Uint8Array(32)));
|
|
56
|
+
await client.createOrReplace({ _id: SESSION_PREFIX + (await sha256Hex(secret)), _type: SESSION_TYPE });
|
|
57
|
+
if (stored)
|
|
58
|
+
void client.delete(SESSION_PREFIX + (await sha256Hex(stored.secret))).catch(() => undefined);
|
|
59
|
+
// Sweep sessions that ran out, anyone's.
|
|
60
|
+
void client
|
|
61
|
+
.delete({ query: '*[_type == $type && _updatedAt < $before]', params: { before: new Date(Date.now() - SESSION_MAX_AGE_MS).toISOString(), type: SESSION_TYPE } })
|
|
62
|
+
.catch(() => undefined);
|
|
63
|
+
keep(key, { createdAt: Date.now(), secret });
|
|
64
|
+
return secret;
|
|
65
|
+
})().finally(() => pending.delete(key));
|
|
66
|
+
pending.set(key, creating);
|
|
67
|
+
}
|
|
68
|
+
return creating.catch((err) => {
|
|
69
|
+
if (err?.statusCode === 403 || err?.statusCode === 401)
|
|
70
|
+
throw new HandlerError(403, 'Transcribing needs permission to edit this dataset.', 'forbidden');
|
|
71
|
+
throw err;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/** Calls to the server handler, signed with the Studio session. */
|
|
75
|
+
export function useHandler(options) {
|
|
76
|
+
const client = useClient({ apiVersion: API_VERSION });
|
|
77
|
+
const base = options.handlerURL.replace(/\/+$/, '');
|
|
78
|
+
const call = useCallback(async (path, init = {}) => {
|
|
79
|
+
for (let attempt = 0;; attempt++) {
|
|
80
|
+
const secret = await session(client, attempt > 0);
|
|
81
|
+
let res;
|
|
82
|
+
try {
|
|
83
|
+
res = await fetch(`${base}${path}`, {
|
|
84
|
+
body: init.body === undefined ? undefined : JSON.stringify(init.body),
|
|
85
|
+
headers: { accept: 'application/json', authorization: `Bearer ${secret}`, ...(init.body === undefined ? {} : { 'content-type': 'application/json' }) },
|
|
86
|
+
method: init.method ?? 'GET',
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
// No status: the handler is down or its CORS refuses this Studio. Callers retry these.
|
|
91
|
+
throw new HandlerError(0, `Could not reach the VocalStack handler at ${base}.`);
|
|
92
|
+
}
|
|
93
|
+
const body = (await res.json().catch(() => ({})));
|
|
94
|
+
if (res.ok)
|
|
95
|
+
return body;
|
|
96
|
+
// A session that ran out or was swept: make a new one, once.
|
|
97
|
+
if (res.status === 401 && body.code === 'session' && attempt === 0)
|
|
98
|
+
continue;
|
|
99
|
+
throw new HandlerError(res.status, body.error ?? `The VocalStack handler answered ${res.status}.`, body.code);
|
|
100
|
+
}
|
|
101
|
+
}, [base, client]);
|
|
102
|
+
return { call, client };
|
|
103
|
+
}
|
|
104
|
+
/** Whether the handler is up and has a VocalStack key. */
|
|
105
|
+
export function useConnection(call) {
|
|
106
|
+
const [connection, setConnection] = useState();
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
let live = true;
|
|
109
|
+
call('/connection').then((c) => live && setConnection(c), (err) => live && setConnection({ connected: false, error: err.message }));
|
|
110
|
+
return () => {
|
|
111
|
+
live = false;
|
|
112
|
+
};
|
|
113
|
+
}, [call]);
|
|
114
|
+
return connection;
|
|
115
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { VocalStackPluginOptions } from './types.js';
|
|
2
|
+
export type * from './types.js';
|
|
3
|
+
export { timedTokens, transcriptText } from './text.js';
|
|
4
|
+
export { TRANSCRIPT_TYPE } from './core.js';
|
|
5
|
+
/**
|
|
6
|
+
* VocalStack for Sanity: a `vocalstack.transcript` field with a Transcribe button and
|
|
7
|
+
* a "Transcribe audio" document action. Both call the server handler at `handlerURL`
|
|
8
|
+
* (`@vocalstack/sanity/server`), which holds the VocalStack API key.
|
|
9
|
+
*/
|
|
10
|
+
export declare const vocalstack: import("sanity").Plugin<VocalStackPluginOptions>;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { definePlugin } from 'sanity';
|
|
2
|
+
import { transcribeAction, transcriptFields } from './action.js';
|
|
3
|
+
import { transcriptType } from './schema.js';
|
|
4
|
+
export { timedTokens, transcriptText } from './text.js';
|
|
5
|
+
export { TRANSCRIPT_TYPE } from './core.js';
|
|
6
|
+
/**
|
|
7
|
+
* VocalStack for Sanity: a `vocalstack.transcript` field with a Transcribe button and
|
|
8
|
+
* a "Transcribe audio" document action. Both call the server handler at `handlerURL`
|
|
9
|
+
* (`@vocalstack/sanity/server`), which holds the VocalStack API key.
|
|
10
|
+
*/
|
|
11
|
+
export const vocalstack = definePlugin((options) => {
|
|
12
|
+
if (!options?.handlerURL)
|
|
13
|
+
throw new Error('vocalstack(): set handlerURL to where the @vocalstack/sanity/server handler is mounted.');
|
|
14
|
+
const action = transcribeAction(options);
|
|
15
|
+
return {
|
|
16
|
+
name: '@vocalstack/sanity',
|
|
17
|
+
schema: { types: [transcriptType(options)] },
|
|
18
|
+
document: {
|
|
19
|
+
actions: (prev, ctx) => (transcriptFields(ctx.schema.get(ctx.schemaType)).length ? [...prev, action] : prev),
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
});
|
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { VocalStackPluginOptions } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* `vocalstack.transcript`: an object field to put next to a `file` field. Its input
|
|
4
|
+
* renders the Transcribe button, the progress and the editable transcript; the rest
|
|
5
|
+
* is written by the plugin and readable with GROQ like any field.
|
|
6
|
+
*/
|
|
7
|
+
export declare const transcriptType: (options: VocalStackPluginOptions) => {
|
|
8
|
+
type: "object";
|
|
9
|
+
name: "vocalstack.transcript";
|
|
10
|
+
} & Omit<import("sanity").ObjectDefinition, "preview"> & {
|
|
11
|
+
preview?: import("sanity").PreviewConfig<Record<string, string>, Record<never, any>> | undefined;
|
|
12
|
+
};
|
package/dist/schema.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { defineField, defineType } from 'sanity';
|
|
3
|
+
import { TranscriptInput } from './components/TranscriptInput.js';
|
|
4
|
+
import { TRANSCRIPT_TYPE } from './core.js';
|
|
5
|
+
/**
|
|
6
|
+
* `vocalstack.transcript`: an object field to put next to a `file` field. Its input
|
|
7
|
+
* renders the Transcribe button, the progress and the editable transcript; the rest
|
|
8
|
+
* is written by the plugin and readable with GROQ like any field.
|
|
9
|
+
*/
|
|
10
|
+
export const transcriptType = (options) => defineType({
|
|
11
|
+
name: TRANSCRIPT_TYPE,
|
|
12
|
+
title: 'Transcript',
|
|
13
|
+
type: 'object',
|
|
14
|
+
fields: [
|
|
15
|
+
defineField({ name: 'transcript', title: 'Transcript', type: 'text', description: 'Paragraphs break on a speaker change or a pause.' }),
|
|
16
|
+
defineField({
|
|
17
|
+
name: 'sentences',
|
|
18
|
+
title: 'Sentences',
|
|
19
|
+
description: 'Timed sentences, in seconds, for captions or a synced player.',
|
|
20
|
+
type: 'array',
|
|
21
|
+
readOnly: true,
|
|
22
|
+
of: [
|
|
23
|
+
{
|
|
24
|
+
name: 'sentence',
|
|
25
|
+
type: 'object',
|
|
26
|
+
fields: [
|
|
27
|
+
defineField({ name: 'start', type: 'number' }),
|
|
28
|
+
defineField({ name: 'end', type: 'number' }),
|
|
29
|
+
defineField({ name: 'speaker', type: 'number' }),
|
|
30
|
+
defineField({ name: 'text', type: 'string' }),
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
}),
|
|
35
|
+
defineField({
|
|
36
|
+
name: 'status',
|
|
37
|
+
type: 'string',
|
|
38
|
+
initialValue: 'idle',
|
|
39
|
+
readOnly: true,
|
|
40
|
+
options: { list: ['idle', 'processing', 'done', 'failed'] },
|
|
41
|
+
}),
|
|
42
|
+
defineField({ name: 'language', type: 'string', readOnly: true }),
|
|
43
|
+
defineField({ name: 'error', type: 'string', readOnly: true }),
|
|
44
|
+
defineField({ name: 'recordingId', title: 'Recording ID', type: 'string', readOnly: true }),
|
|
45
|
+
defineField({ name: 'transcriptionId', title: 'Transcription ID', type: 'string', readOnly: true }),
|
|
46
|
+
defineField({ name: 'transcribedAt', type: 'datetime', readOnly: true }),
|
|
47
|
+
],
|
|
48
|
+
components: {
|
|
49
|
+
input: (props) => _jsx(TranscriptInput, { ...props, pluginOptions: options }),
|
|
50
|
+
},
|
|
51
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type { ConnectionResponse, JobOutcome, StartRequest, StartResponse } from '../wire.js';
|
|
2
|
+
export type VocalStackHandlerOptions = {
|
|
3
|
+
/** A VocalStack API key (`vs_key_…`, Read + Write). Default: `process.env.VOCALSTACK_API_KEY`. */
|
|
4
|
+
apiKey?: string;
|
|
5
|
+
/**
|
|
6
|
+
* The dataset the Studio edits, and a token that can read it (a Viewer token is enough).
|
|
7
|
+
* `apiHost` and `useProjectHostname` work as in `@sanity/client`: requests go to
|
|
8
|
+
* `https://<projectId>.api.sanity.io` unless you use a custom API domain.
|
|
9
|
+
*/
|
|
10
|
+
sanity: {
|
|
11
|
+
apiHost?: string;
|
|
12
|
+
apiVersion?: string;
|
|
13
|
+
dataset: string;
|
|
14
|
+
projectId: string;
|
|
15
|
+
token: string;
|
|
16
|
+
useProjectHostname?: boolean;
|
|
17
|
+
};
|
|
18
|
+
/** A Whisper language code (`en`, `ro`, …). Leave out to auto-detect. */
|
|
19
|
+
spokenLanguage?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The URL of the audio. Default: the asset's URL on Sanity's CDN. Return a signed URL
|
|
22
|
+
* here if your assets are private. VocalStack fetches a public URL itself; for one it
|
|
23
|
+
* cannot reach (localhost, a private network) the handler reads the file and uploads it.
|
|
24
|
+
*/
|
|
25
|
+
fileURL?: (asset: SanityFileAsset) => Promise<string | undefined> | string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Origins allowed to call the handler (the Studio's), e.g. `['https://my.sanity.studio']`.
|
|
28
|
+
* Default: any. Callers prove themselves with a Studio session, not a cookie, so any origin is safe.
|
|
29
|
+
*/
|
|
30
|
+
allowedOrigins?: string[];
|
|
31
|
+
/** Default https://api.vocalstack.com */
|
|
32
|
+
apiURL?: string;
|
|
33
|
+
};
|
|
34
|
+
export type SanityFileAsset = {
|
|
35
|
+
_id: string;
|
|
36
|
+
mimeType?: string;
|
|
37
|
+
originalFilename?: string;
|
|
38
|
+
url?: string;
|
|
39
|
+
};
|
|
40
|
+
type Handler = (request: Request) => Promise<Response>;
|
|
41
|
+
export declare function createVocalStackHandler(options: VocalStackHandlerOptions): Handler;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { accountLabel, DEFAULT_API_URL, VocalStackAPI, VocalStackAPIError } from '../api.js';
|
|
2
|
+
import { SESSION_MAX_AGE_MS, SESSION_PREFIX, SESSION_TYPE, sha256Hex } from '../wire.js';
|
|
3
|
+
import { checkJob, stopJob } from './jobs.js';
|
|
4
|
+
/** `https://<projectId>.api.sanity.io`, or the custom API host, as `@sanity/client` builds it. */
|
|
5
|
+
function sanityHost({ apiHost = 'https://api.sanity.io', projectId, useProjectHostname = true }) {
|
|
6
|
+
const host = new URL(apiHost);
|
|
7
|
+
if (useProjectHostname)
|
|
8
|
+
host.hostname = `${projectId}.${host.hostname}`;
|
|
9
|
+
return host.origin;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Whether VocalStack can fetch this address itself. The API refuses loopback,
|
|
13
|
+
* private and link-local hosts, so for those the handler sends the bytes instead.
|
|
14
|
+
*/
|
|
15
|
+
function isPublicURL(url) {
|
|
16
|
+
const { hostname, protocol } = new URL(url);
|
|
17
|
+
if (protocol !== 'https:' && protocol !== 'http:')
|
|
18
|
+
return false;
|
|
19
|
+
const host = hostname.replace(/^\[|\]$/g, '').toLowerCase();
|
|
20
|
+
if (host === 'localhost' || host.endsWith('.localhost') || host.endsWith('.local') || host.endsWith('.internal'))
|
|
21
|
+
return false;
|
|
22
|
+
const v4 = host.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/);
|
|
23
|
+
if (v4) {
|
|
24
|
+
const [a, b] = [Number(v4[1]), Number(v4[2])];
|
|
25
|
+
return !(a === 10 || a === 127 || a === 0 || (a === 169 && b === 254) || (a === 172 && b >= 16 && b <= 31) || (a === 192 && b === 168) || (a === 100 && b >= 64 && b <= 127));
|
|
26
|
+
}
|
|
27
|
+
if (host.includes(':'))
|
|
28
|
+
return !(host === '::1' || host.startsWith('fc') || host.startsWith('fd') || host.startsWith('fe80'));
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
async function fetchFile(url) {
|
|
32
|
+
const res = await fetch(url);
|
|
33
|
+
if (!res.ok)
|
|
34
|
+
throw new Error(`Could not read the audio file (${res.status} from ${url}).`);
|
|
35
|
+
return res.blob();
|
|
36
|
+
}
|
|
37
|
+
/** Verified sessions, briefly, so a poll every 3 s is not a Sanity query every 3 s. */
|
|
38
|
+
const SESSION_CACHE_MS = 60_000;
|
|
39
|
+
export function createVocalStackHandler(options) {
|
|
40
|
+
const apiKey = options.apiKey ?? globalThis.process?.env?.VOCALSTACK_API_KEY;
|
|
41
|
+
const { dataset, projectId, token } = options.sanity;
|
|
42
|
+
const sanityBase = `${sanityHost(options.sanity)}/v${(options.sanity.apiVersion ?? '2024-01-01').replace(/^v/, '')}`;
|
|
43
|
+
const sessions = new Map();
|
|
44
|
+
let account;
|
|
45
|
+
async function query(groq, params) {
|
|
46
|
+
const url = new URL(`${sanityBase}/data/query/${encodeURIComponent(dataset)}`);
|
|
47
|
+
url.searchParams.set('query', groq);
|
|
48
|
+
for (const [k, v] of Object.entries(params))
|
|
49
|
+
url.searchParams.set(`$${k}`, JSON.stringify(v));
|
|
50
|
+
const res = await fetch(url, { headers: { authorization: `Bearer ${token}` } });
|
|
51
|
+
if (!res.ok)
|
|
52
|
+
throw new Error(`Sanity answered ${res.status} to the handler's query. Check its projectId, dataset and token.`);
|
|
53
|
+
return (await res.json()).result;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Is the caller signed in to the Studio? The Studio creates a session document whose id
|
|
57
|
+
* is the hash of a random secret and sends the secret. Only someone who may write to the
|
|
58
|
+
* dataset can create one; readers see the hash, never the secret.
|
|
59
|
+
*/
|
|
60
|
+
async function signedIn(request) {
|
|
61
|
+
const secret = request.headers.get('authorization')?.match(/^Bearer\s+(\S{32,})$/)?.[1];
|
|
62
|
+
if (!secret)
|
|
63
|
+
return false;
|
|
64
|
+
const id = SESSION_PREFIX + (await sha256Hex(secret));
|
|
65
|
+
const cached = sessions.get(id);
|
|
66
|
+
if (cached && cached > Date.now())
|
|
67
|
+
return true;
|
|
68
|
+
const updatedAt = await query('*[_id == $id && _type == $type][0]._updatedAt', { id, type: SESSION_TYPE });
|
|
69
|
+
const expires = updatedAt ? Date.parse(updatedAt) + SESSION_MAX_AGE_MS : 0;
|
|
70
|
+
if (expires <= Date.now())
|
|
71
|
+
return false;
|
|
72
|
+
sessions.set(id, Math.min(expires, Date.now() + SESSION_CACHE_MS));
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
const cors = (request) => {
|
|
76
|
+
const origin = request.headers.get('origin');
|
|
77
|
+
const allowed = !options.allowedOrigins || (origin !== null && options.allowedOrigins.includes(origin));
|
|
78
|
+
return allowed
|
|
79
|
+
? {
|
|
80
|
+
'access-control-allow-headers': 'authorization, content-type',
|
|
81
|
+
'access-control-allow-methods': 'GET, POST, OPTIONS',
|
|
82
|
+
'access-control-allow-origin': options.allowedOrigins ? (origin ?? '') : '*',
|
|
83
|
+
'access-control-max-age': '86400',
|
|
84
|
+
vary: 'origin',
|
|
85
|
+
}
|
|
86
|
+
: {};
|
|
87
|
+
};
|
|
88
|
+
return async (request) => {
|
|
89
|
+
const headers = { ...cors(request), 'cache-control': 'no-store' };
|
|
90
|
+
const json = (body, status = 200) => new Response(JSON.stringify(body), { headers: { ...headers, 'content-type': 'application/json' }, status });
|
|
91
|
+
const fail = (status, error, code) => json({ code, error }, status);
|
|
92
|
+
if (request.method === 'OPTIONS')
|
|
93
|
+
return new Response(null, { headers, status: 204 });
|
|
94
|
+
// The route's tail, wherever the handler is mounted: …/connection, …/transcriptions,
|
|
95
|
+
// …/recordings/:id/job, …/recordings/:id/stop.
|
|
96
|
+
const path = new URL(request.url).pathname.replace(/\/+$/, '');
|
|
97
|
+
const route = path.match(/\/(connection|transcriptions)$/)?.[1] ?? path.match(/\/recordings\/([^/]+)\/(job|stop)$/)?.slice(1).join(' ');
|
|
98
|
+
if (!route)
|
|
99
|
+
return fail(404, 'Not a VocalStack route.');
|
|
100
|
+
try {
|
|
101
|
+
if (!(await signedIn(request)))
|
|
102
|
+
return fail(401, 'Sign in to the Studio again.', 'session');
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
return fail(502, err.message, 'sanity');
|
|
106
|
+
}
|
|
107
|
+
if (!apiKey)
|
|
108
|
+
return fail(503, 'VOCALSTACK_API_KEY is not set where the VocalStack handler runs.', 'not_connected');
|
|
109
|
+
const api = new VocalStackAPI(apiKey, options.apiURL ?? DEFAULT_API_URL);
|
|
110
|
+
try {
|
|
111
|
+
if (route === 'connection' && request.method === 'GET') {
|
|
112
|
+
account ??= accountLabel(await api.me());
|
|
113
|
+
return json({ account, connected: true });
|
|
114
|
+
}
|
|
115
|
+
if (route === 'transcriptions' && request.method === 'POST') {
|
|
116
|
+
const body = (await request.json().catch(() => ({})));
|
|
117
|
+
if (typeof body.assetId !== 'string' || !body.assetId.startsWith('file-') || typeof body.documentId !== 'string')
|
|
118
|
+
return fail(400, 'Send assetId and documentId.');
|
|
119
|
+
const asset = await query('*[_id == $id][0]{ _id, url, mimeType, originalFilename }', { id: body.assetId });
|
|
120
|
+
if (!asset)
|
|
121
|
+
return fail(404, 'There is no such file in the dataset.');
|
|
122
|
+
if (!asset.mimeType?.startsWith('audio/'))
|
|
123
|
+
return fail(400, 'Only audio files can be transcribed.');
|
|
124
|
+
const url = (await options.fileURL?.(asset)) ?? asset.url;
|
|
125
|
+
if (!url)
|
|
126
|
+
return fail(400, 'There is no audio file here.');
|
|
127
|
+
const job = {
|
|
128
|
+
idempotencyKey: `sanity:${body.documentId.replace(/^drafts\./, '')}:${body.fieldPath ?? ''}:${crypto.randomUUID()}`,
|
|
129
|
+
name: (typeof body.name === 'string' && body.name.trim()) || asset.originalFilename || 'Sanity audio',
|
|
130
|
+
spokenLanguage: options.spokenLanguage,
|
|
131
|
+
};
|
|
132
|
+
// VocalStack refuses links to loopback and private addresses: send those files' bytes.
|
|
133
|
+
const tx = isPublicURL(url) ? await api.transcribeURL(url, job) : await api.transcribeFile(await fetchFile(url), asset.originalFilename || 'audio', job);
|
|
134
|
+
if (!tx.job)
|
|
135
|
+
return fail(502, 'VocalStack did not start a job for this file.');
|
|
136
|
+
return json({ recordingId: tx.job.recordingId, status: 'processing', transcriptionId: tx.id }, 202);
|
|
137
|
+
}
|
|
138
|
+
const [recordingId, action] = route.split(' ');
|
|
139
|
+
if (action === 'job' && request.method === 'GET')
|
|
140
|
+
return json(await checkJob(api, decodeURIComponent(recordingId)));
|
|
141
|
+
if (action === 'stop' && request.method === 'POST')
|
|
142
|
+
return json(await stopJob(api, decodeURIComponent(recordingId)));
|
|
143
|
+
return fail(405, 'Method not allowed.');
|
|
144
|
+
}
|
|
145
|
+
catch (err) {
|
|
146
|
+
if (err instanceof VocalStackAPIError) {
|
|
147
|
+
if (err.status === 401)
|
|
148
|
+
return fail(502, 'VocalStack refused the API key in VOCALSTACK_API_KEY.', 'not_connected');
|
|
149
|
+
return fail(err.status >= 500 ? 502 : err.status, err.message, err.code);
|
|
150
|
+
}
|
|
151
|
+
return fail(500, err instanceof Error ? err.message : String(err));
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TranscriptSentence, SavedSentence } from '../types.js';
|
|
2
|
+
import type { JobOutcome } from '../wire.js';
|
|
3
|
+
import { type Transcript, type VocalStackAPI } from '../api.js';
|
|
4
|
+
/** A transcript's sentences: seconds, speaker, text. */
|
|
5
|
+
export declare function toSentences(t: Pick<Transcript, 'sentences'>): TranscriptSentence[];
|
|
6
|
+
/** As stored on the document: an array item needs a `_key`. */
|
|
7
|
+
export declare const toSaved: (sentences: TranscriptSentence[]) => SavedSentence[];
|
|
8
|
+
export declare function checkJob(api: VocalStackAPI, recordingId: string): Promise<JobOutcome>;
|
|
9
|
+
/** Stop a job. If it ended meanwhile, take its outcome instead. */
|
|
10
|
+
export declare function stopJob(api: VocalStackAPI, recordingId: string): Promise<JobOutcome>;
|