diff --git a/languages.ts b/languages.ts new file mode 100644 index 000000000..eaf9ff349 --- /dev/null +++ b/languages.ts @@ -0,0 +1,12 @@ +const languages = [ + { id: "en", title: "English" }, + { id: "se", title: "Swedish" }, + { id: "no", title: "Norwegian" }, +]; + +const i18n = { + languages, + base: "en", +}; + +export { i18n }; diff --git a/package-lock.json b/package-lock.json index d0401ed61..76f2bad93 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "0.1.0", "dependencies": { "@google-cloud/pubsub": "^4.5.0", + "@sanity/document-internationalization": "^3.0.1", "@sanity/image-url": "^1.0.2", "@sanity/preview-url-secret": "^1.6.11", "@sanity/react-loader": "^1.9.15", @@ -4659,9 +4660,9 @@ } }, "node_modules/@portabletext/editor": { - "version": "1.0.18", - "resolved": "https://registry.npmjs.org/@portabletext/editor/-/editor-1.0.18.tgz", - "integrity": "sha512-EYgeX+dZr8v9aEtTcSfptozPWOnXG5skEs/eBr+qhlMgl5e+BgM4Zbkeh/dNSO6ub50x+fM3KrX7oxVlVAQVNA==", + "version": "1.0.19", + "resolved": "https://registry.npmjs.org/@portabletext/editor/-/editor-1.0.19.tgz", + "integrity": "sha512-ZNOvErcy2OYchsHVpVtJdhGb12YI6m0vOSubKu8t1X6wllkJPNyduW6xxLbmJiv/Z/+Ua1gVEvczdkfsU2qvvQ==", "license": "MIT", "dependencies": { "@portabletext/patches": "1.1.0", @@ -4851,35 +4852,35 @@ } }, "node_modules/@sanity/block-tools": { - "version": "3.55.0", - "resolved": "https://registry.npmjs.org/@sanity/block-tools/-/block-tools-3.55.0.tgz", - "integrity": "sha512-sTbPYD9pBJetGCpRRNOoHCDwZl1YDDB/0KNgvpNm6freKdsRTUyjN5YEXLnXeFYuHej6LmcDUHAvUtXWnZK+QA==", + "version": "3.57.1", + "resolved": "https://registry.npmjs.org/@sanity/block-tools/-/block-tools-3.57.1.tgz", + "integrity": "sha512-qGfc1nuwuZdthf2DQVEbMJyU97FXrWh/69FOc3pVmmLMXQDbuGHGq6TClnhcKBxBCd3y7GAB/J0cuy5h04b4vA==", "license": "MIT", "dependencies": { - "@sanity/types": "3.55.0", + "@sanity/types": "3.57.1", "@types/react": "^18.3.3", "get-random-values-esm": "1.0.2", "lodash": "^4.17.21" } }, "node_modules/@sanity/cli": { - "version": "3.55.0", - "resolved": "https://registry.npmjs.org/@sanity/cli/-/cli-3.55.0.tgz", - "integrity": "sha512-Pu0QRiOB0bFBJtBOC9fjNEpyIi8Y7vmAXXWcZLQGMWF/a2JybuTRNnfZIGEvH+EqPXJB9jpdz4y/9UHCcl4AWA==", + "version": "3.57.1", + "resolved": "https://registry.npmjs.org/@sanity/cli/-/cli-3.57.1.tgz", + "integrity": "sha512-nXlbHwUxL+K21Zie4ycrImKW8BpzIY6v5RFs9fGM3dCMUUkdFvd4d1qs8u2q/n6ONdr3yQS8TlT8VfHX1pFYFg==", "license": "MIT", "dependencies": { "@babel/traverse": "^7.23.5", "@sanity/client": "^6.21.2", - "@sanity/codegen": "3.55.0", + "@sanity/codegen": "3.57.1", "@sanity/telemetry": "^0.7.7", - "@sanity/util": "3.55.0", + "@sanity/util": "3.57.1", "chalk": "^4.1.2", "debug": "^4.3.4", "decompress": "^4.2.0", "esbuild": "0.21.5", "esbuild-register": "^3.5.0", "get-it": "^8.6.5", - "groq-js": "^1.12.0", + "groq-js": "^1.13.0", "node-machine-id": "^1.1.12", "pkg-dir": "^5.0.0", "prettier": "^3.3.0", @@ -4985,9 +4986,9 @@ } }, "node_modules/@sanity/codegen": { - "version": "3.55.0", - "resolved": "https://registry.npmjs.org/@sanity/codegen/-/codegen-3.55.0.tgz", - "integrity": "sha512-zTYrWOiqNWBjEF8GLfYFqnOvYShZfnmPILaPqdm3zGjDXnHSj9WSx6sPrklBTDSWFqPmYxDBxScpga6wcLgKzg==", + "version": "3.57.1", + "resolved": "https://registry.npmjs.org/@sanity/codegen/-/codegen-3.57.1.tgz", + "integrity": "sha512-47j7xxluLP2pmwFHKEzxWwIw6V8Xgx4s0IsewZ8g1MEoIv0DDSqxyBxKFo1ieC4Fh6oHz8JISXKclq2LzSjbzQ==", "license": "MIT", "dependencies": { "@babel/core": "^7.23.9", @@ -5000,8 +5001,8 @@ "@babel/types": "^7.23.9", "debug": "^4.3.4", "globby": "^10.0.0", - "groq": "3.55.0", - "groq-js": "^1.12.0", + "groq": "3.57.1", + "groq-js": "^1.13.0", "json5": "^2.2.3", "tsconfig-paths": "^4.2.0", "zod": "^3.22.4" @@ -5072,9 +5073,9 @@ } }, "node_modules/@sanity/diff": { - "version": "3.55.0", - "resolved": "https://registry.npmjs.org/@sanity/diff/-/diff-3.55.0.tgz", - "integrity": "sha512-D3LE2j/ZWMLb+0prpr+CMbskcF5sceuyPoXc3NbsI2usQiUh2hS7pxpBZGH9GGZjwAhgzf2j8IbZTTYdh6niUA==", + "version": "3.57.1", + "resolved": "https://registry.npmjs.org/@sanity/diff/-/diff-3.57.1.tgz", + "integrity": "sha512-uGRtwCQwsLkujiJ/KrXEQrYPWVQ34t5t7QWrqzGSyiTnASc3pjfiWwFSVwSKkCyO9AiLT+/ynCBuKsAhnYWAwQ==", "license": "MIT", "dependencies": { "@sanity/diff-match-patch": "^3.1.1" @@ -5092,6 +5093,31 @@ "node": ">=14.18" } }, + "node_modules/@sanity/document-internationalization": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sanity/document-internationalization/-/document-internationalization-3.0.1.tgz", + "integrity": "sha512-ijnKWgzMZ5XED2sc+WaqOGiFAm2C1FpRQGxFmJBx8/rdmbINO/R95S4bg5+fm+cmiSQYimVNHKzCbKfyvpMk9A==", + "license": "MIT", + "dependencies": { + "@sanity/icons": "^2.11.7", + "@sanity/incompatible-plugin": "^1.0.4", + "@sanity/ui": "^2.1.0", + "@sanity/uuid": "^3.0.2", + "sanity-plugin-internationalized-array": "^2.0.0", + "sanity-plugin-utils": "^1.6.4" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@sanity/mutator": "^3.40.0", + "@sanity/ui": "^2.1", + "react": "^18", + "react-dom": "^18", + "sanity": "^3.40.0", + "styled-components": "^6.1" + } + }, "node_modules/@sanity/eventsource": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/@sanity/eventsource/-/eventsource-5.0.2.tgz", @@ -5176,7 +5202,6 @@ "resolved": "https://registry.npmjs.org/@sanity/icons/-/icons-2.11.8.tgz", "integrity": "sha512-C4ViXtk6eyiNTQ5OmxpfmcK6Jw+LLTi9zg9XBUD15DzC4xTHaGW9SVfUa43YtPGs3WC3M0t0K59r0GDjh52HIg==", "license": "MIT", - "peer": true, "engines": { "node": ">=14.0.0" }, @@ -5289,6 +5314,29 @@ "node": ">=4" } }, + "node_modules/@sanity/incompatible-plugin": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@sanity/incompatible-plugin/-/incompatible-plugin-1.0.4.tgz", + "integrity": "sha512-2z39G9PTM8MXOF4fJNx3TG4tH0RrTjtH6dVLW93DSjCPbIS7FgCY5yWjZfQ+HVkwhLsF7ATDAGLA/jp65pFjAg==", + "license": "MIT", + "dependencies": { + "@sanity/icons": "^1.3", + "react-copy-to-clipboard": "^5.1.0" + }, + "peerDependencies": { + "react": "^16.9 || ^17 || ^18", + "react-dom": "^16.9 || ^17 || ^18" + } + }, + "node_modules/@sanity/incompatible-plugin/node_modules/@sanity/icons": { + "version": "1.3.10", + "resolved": "https://registry.npmjs.org/@sanity/icons/-/icons-1.3.10.tgz", + "integrity": "sha512-5wVG/vIiGuGrSmq+Bl3PY7XDgQrGv0fyHdJI64FSulnr2wH3NMqZ6C59UFxnrZ93sr7kOt0zQFoNv2lkPBi0Cg==", + "license": "MIT", + "peerDependencies": { + "react": "^16.9 || ^17 || ^18" + } + }, "node_modules/@sanity/insert-menu": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/@sanity/insert-menu/-/insert-menu-1.0.8.tgz", @@ -5321,6 +5369,29 @@ "react": "^18.3 || >=19.0.0-rc" } }, + "node_modules/@sanity/language-filter": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@sanity/language-filter/-/language-filter-4.0.2.tgz", + "integrity": "sha512-guL7vZv/QwDdbzVbCA8YqY8G0tH6KW2obyp5UCbFvFy9NqlmfuaHtle/VIO+UwqbCXck2Xpz0WihFeQHHjhCcw==", + "license": "MIT", + "dependencies": { + "@sanity/icons": "^2.11.7", + "@sanity/incompatible-plugin": "^1.0.4", + "@sanity/ui": "^2.1.0", + "lodash": "^4.17.21" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@sanity/ui": "^2.1.0", + "@sanity/util": "^3.36.4", + "react": "^18", + "react-dom": "^18", + "sanity": "^3.36.4", + "styled-components": "^6.1" + } + }, "node_modules/@sanity/logos": { "version": "2.1.13", "resolved": "https://registry.npmjs.org/@sanity/logos/-/logos-2.1.13.tgz", @@ -5335,19 +5406,19 @@ } }, "node_modules/@sanity/migrate": { - "version": "3.55.0", - "resolved": "https://registry.npmjs.org/@sanity/migrate/-/migrate-3.55.0.tgz", - "integrity": "sha512-lXwVHLbMnbjpHtf1YZeQHXrZJxM1u7WCGDXQCvFHSHOPWJ9uG/lCW6Ew/8hm+Zteix8oWVay983O+ipaUERvmw==", + "version": "3.57.1", + "resolved": "https://registry.npmjs.org/@sanity/migrate/-/migrate-3.57.1.tgz", + "integrity": "sha512-zYGyxfrJLsshcOtycD4VXt9BjIdY8z/DfZ4jEzV0s76yjD2g92ZEAdRQ40QcXVnll4UO+Pl9Ae31srIzo4N/AQ==", "license": "MIT", "dependencies": { "@sanity/client": "^6.21.2", "@sanity/mutate": "^0.8.0", - "@sanity/types": "3.55.0", - "@sanity/util": "3.55.0", + "@sanity/types": "3.57.1", + "@sanity/util": "3.57.1", "arrify": "^2.0.1", "debug": "^4.3.4", "fast-fifo": "^1.3.2", - "groq-js": "^1.12.0", + "groq-js": "^1.13.0", "p-map": "^7.0.1" }, "engines": { @@ -5411,13 +5482,13 @@ } }, "node_modules/@sanity/mutator": { - "version": "3.55.0", - "resolved": "https://registry.npmjs.org/@sanity/mutator/-/mutator-3.55.0.tgz", - "integrity": "sha512-B/qmBhpluHSCZdPlS88nUGbj5fM4SP0/G12szqQL4Chxbj1JJSlUm4//KDg/ms5ZwiLeDJJAhWRSOPan/E9y2g==", + "version": "3.57.1", + "resolved": "https://registry.npmjs.org/@sanity/mutator/-/mutator-3.57.1.tgz", + "integrity": "sha512-G9blglmLkv+lsyTxnoDc2Tr/R8J2W9ZpAGFhwJo+Xg0ZcFQOOGg9hptJqCCzlQFo1pppKK0oDdLjwSzDNH6HhQ==", "license": "MIT", "dependencies": { "@sanity/diff-match-patch": "^3.1.1", - "@sanity/types": "3.55.0", + "@sanity/types": "3.57.1", "@sanity/uuid": "^3.0.1", "debug": "^4.3.4", "lodash": "^4.17.21" @@ -5558,15 +5629,15 @@ } }, "node_modules/@sanity/schema": { - "version": "3.55.0", - "resolved": "https://registry.npmjs.org/@sanity/schema/-/schema-3.55.0.tgz", - "integrity": "sha512-vHdxkXw6cXlm+hpOteEcSS8hMuu2cbqkIZ5v8zYp7d8Nd/u1nXeAhyAsqsjOrOh2GJbHhff8zzX+5ILvmWNmqw==", + "version": "3.57.1", + "resolved": "https://registry.npmjs.org/@sanity/schema/-/schema-3.57.1.tgz", + "integrity": "sha512-gbuZW0QPgp4ZSDsCV0L0esDXGPokSfZRXo7DV3D1qT5QiBu1qImaDqqXIoL5+qn4MEcwcEGrdXgmXpcw3p5+iw==", "license": "MIT", "dependencies": { "@sanity/generate-help-url": "^3.0.0", - "@sanity/types": "3.55.0", + "@sanity/types": "3.57.1", "arrify": "^1.0.1", - "groq-js": "^1.12.0", + "groq-js": "^1.13.0", "humanize-list": "^1.0.1", "leven": "^3.1.0", "lodash": "^4.17.21", @@ -5600,9 +5671,9 @@ } }, "node_modules/@sanity/types": { - "version": "3.55.0", - "resolved": "https://registry.npmjs.org/@sanity/types/-/types-3.55.0.tgz", - "integrity": "sha512-3oeVFeYVWurYXN3qN23kpwS1KfZ1Jk1J/fybHrAHSl2bRrnvAoLkbtTvuvOuR4/kOup0o1S/aNTYLzQmu+xGOA==", + "version": "3.57.1", + "resolved": "https://registry.npmjs.org/@sanity/types/-/types-3.57.1.tgz", + "integrity": "sha512-zozN7U0xdaT9c1VzYP58N6geyQFMDksYL5J2g3l4VRne2BzfjXAO+1H/q9FbdazOe6j2UMXwJRKPjiMLEiN1kg==", "license": "MIT", "dependencies": { "@sanity/client": "^6.21.2", @@ -5646,13 +5717,13 @@ } }, "node_modules/@sanity/util": { - "version": "3.55.0", - "resolved": "https://registry.npmjs.org/@sanity/util/-/util-3.55.0.tgz", - "integrity": "sha512-R1yFfLo8UVw7kQ7moJiVLg02F+xzg3KoewG50iETIGg+i1S9uGBIAVZrStWdd5Fhrj0x5vxGKhi4pmEzfxxjxQ==", + "version": "3.57.1", + "resolved": "https://registry.npmjs.org/@sanity/util/-/util-3.57.1.tgz", + "integrity": "sha512-OFK1kd9rS81953K8eBG4mizF1Iz/yC9zzLFKL+OJ71uunxjf8bpuY4bBuybnFc3xhJ54V9IGDg/Jy19QrNWi1Q==", "license": "MIT", "dependencies": { "@sanity/client": "^6.21.2", - "@sanity/types": "3.55.0", + "@sanity/types": "3.57.1", "get-random-values-esm": "1.0.2", "moment": "^2.29.4", "rxjs": "^7.8.1" @@ -9960,9 +10031,9 @@ "license": "MIT" }, "node_modules/body-parser": { - "version": "1.20.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", - "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", "dev": true, "license": "MIT", "dependencies": { @@ -9974,7 +10045,7 @@ "http-errors": "2.0.0", "iconv-lite": "0.4.24", "on-finished": "2.4.1", - "qs": "6.11.0", + "qs": "6.13.0", "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" @@ -10001,6 +10072,22 @@ "dev": true, "license": "MIT" }, + "node_modules/body-parser/node_modules/qs": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.0.6" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", @@ -13877,38 +13964,38 @@ "license": "MIT" }, "node_modules/express": { - "version": "4.19.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", - "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", + "version": "4.20.0", + "resolved": "https://registry.npmjs.org/express/-/express-4.20.0.tgz", + "integrity": "sha512-pLdae7I6QqShF5PnNTCVn4hI91Dx0Grkn2+IAsMTgMIKuQVte2dN9PeGSSAME2FR8anOhVA62QDIUaWVfEXVLw==", "dev": true, "license": "MIT", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.2", + "body-parser": "1.20.3", "content-disposition": "0.5.4", "content-type": "~1.0.4", "cookie": "0.6.0", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", "finalhandler": "1.2.0", "fresh": "0.5.2", "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", + "merge-descriptors": "1.0.3", "methods": "~1.1.2", "on-finished": "2.4.1", "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", + "path-to-regexp": "0.1.10", "proxy-addr": "~2.0.7", "qs": "6.11.0", "range-parser": "~1.2.1", "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", + "send": "0.19.0", + "serve-static": "1.16.0", "setprototypeof": "1.2.0", "statuses": "2.0.1", "type-is": "~1.6.18", @@ -13929,6 +14016,16 @@ "ms": "2.0.0" } }, + "node_modules/express/node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/express/node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -15416,9 +15513,9 @@ "license": "MIT" }, "node_modules/groq": { - "version": "3.55.0", - "resolved": "https://registry.npmjs.org/groq/-/groq-3.55.0.tgz", - "integrity": "sha512-oDMnjsIfEMtGfPJOMFx+6qS8fdX8YIRYbslF/VE6H77kKGOGOlrMK81diphkoiV0/xg0mS++gf9fCGbdasZIRQ==", + "version": "3.57.1", + "resolved": "https://registry.npmjs.org/groq/-/groq-3.57.1.tgz", + "integrity": "sha512-V/g54pJotZ+mS50kqw2hjde3STD4w1XtKNE//pbUXdR1DzqRCAkMhxr2tao8nU1r5DeA9OTAqsIHX53XyKOFKQ==", "license": "MIT", "engines": { "node": ">=18" @@ -19964,11 +20061,14 @@ } }, "node_modules/merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", "dev": true, - "license": "MIT" + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/merge-stream": { "version": "2.0.0", @@ -21924,9 +22024,9 @@ "license": "ISC" }, "node_modules/path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==", + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.10.tgz", + "integrity": "sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==", "dev": true, "license": "MIT" }, @@ -24262,9 +24362,9 @@ "license": "MIT" }, "node_modules/sanity": { - "version": "3.55.0", - "resolved": "https://registry.npmjs.org/sanity/-/sanity-3.55.0.tgz", - "integrity": "sha512-FYKYWQc4VZwHkwswT/Y7sWYq9dSvuFtQe2yeZLq9eWQPMyBBiuw4Y3F3YqwpAHl/18uxOeSOhHRbZP9+1dd0nQ==", + "version": "3.57.1", + "resolved": "https://registry.npmjs.org/sanity/-/sanity-3.57.1.tgz", + "integrity": "sha512-C6YMsJAV0Dep9da/TKF2eWXne6/HfvNfMqFYGk7OsoXbYMBBzSAzkgHeZMsz9rmjp9PUK03ktdFvP0u2ts+8hQ==", "license": "MIT", "dependencies": { "@dnd-kit/core": "^6.0.5", @@ -24272,32 +24372,32 @@ "@dnd-kit/sortable": "^7.0.1", "@dnd-kit/utilities": "^3.2.0", "@juggle/resize-observer": "^3.3.1", - "@portabletext/editor": "^1.0.15", + "@portabletext/editor": "^1.0.19", "@portabletext/react": "^3.0.0", "@rexxars/react-json-inspector": "^8.0.1", "@sanity/asset-utils": "^1.2.5", "@sanity/bifur-client": "^0.4.1", - "@sanity/block-tools": "3.55.0", - "@sanity/cli": "3.55.0", + "@sanity/block-tools": "3.57.1", + "@sanity/cli": "3.57.1", "@sanity/client": "^6.21.2", "@sanity/color": "^3.0.0", - "@sanity/diff": "3.55.0", + "@sanity/diff": "3.57.1", "@sanity/diff-match-patch": "^3.1.1", "@sanity/eventsource": "^5.0.0", "@sanity/export": "^3.41.0", - "@sanity/icons": "^3.3.1", + "@sanity/icons": "^3.4.0", "@sanity/image-url": "^1.0.2", "@sanity/import": "^3.37.3", "@sanity/insert-menu": "1.0.8", "@sanity/logos": "^2.1.4", - "@sanity/migrate": "3.55.0", - "@sanity/mutator": "3.55.0", + "@sanity/migrate": "3.57.1", + "@sanity/mutator": "3.57.1", "@sanity/presentation": "1.16.4", - "@sanity/schema": "3.55.0", + "@sanity/schema": "3.57.1", "@sanity/telemetry": "^0.7.7", - "@sanity/types": "3.55.0", + "@sanity/types": "3.57.1", "@sanity/ui": "^2.8.8", - "@sanity/util": "3.55.0", + "@sanity/util": "3.57.1", "@sanity/uuid": "^3.0.1", "@sentry/react": "^8.7.0", "@tanstack/react-table": "^8.16.0", @@ -24330,7 +24430,7 @@ "framer-motion": "11.0.8", "get-it": "^8.6.5", "get-random-values-esm": "1.0.2", - "groq-js": "^1.12.0", + "groq-js": "^1.13.0", "history": "^5.3.0", "i18next": "^23.2.7", "import-fresh": "^3.3.0", @@ -24408,6 +24508,54 @@ "node": ">=14.18" } }, + "node_modules/sanity-plugin-internationalized-array": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/sanity-plugin-internationalized-array/-/sanity-plugin-internationalized-array-2.1.0.tgz", + "integrity": "sha512-YpG8O3wdNbewsPNhSHZ13MYTPDqsf0Iz8eC6fB5hhDwttxcM6ftD40R1qXT73Ccl68X4DrbHi3bQzXC60E7D7g==", + "license": "MIT", + "dependencies": { + "@sanity/icons": "^2.11.7", + "@sanity/incompatible-plugin": "^1.0.4", + "@sanity/language-filter": "^4.0.2", + "@sanity/ui": "^2.1.0", + "fast-deep-equal": "^3.1.3", + "lodash": "^4.17.21", + "suspend-react": "0.1.3" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@sanity/ui": "^2.1.0", + "react": "^18", + "react-dom": "^18", + "sanity": "^3.36.4", + "styled-components": "^6.1" + } + }, + "node_modules/sanity-plugin-utils": { + "version": "1.6.5", + "resolved": "https://registry.npmjs.org/sanity-plugin-utils/-/sanity-plugin-utils-1.6.5.tgz", + "integrity": "sha512-QJOBaNSIR7nG8xaSRD/CsqPMz8ZMZIkJ2pCIzB14uD9J4iiCaRh6V4R6We6L4gNJ/Pr57AuzQS/SGqlyTue5Qw==", + "license": "MIT", + "dependencies": { + "@sanity/icons": "^2.11.8", + "@sanity/incompatible-plugin": "^1.0.4", + "styled-components": "^6.1.6" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@sanity/ui": "^1.0 || ^2.0", + "react": "^18", + "react-dom": "^18", + "react-fast-compare": "^3.2.2", + "rxjs": "^7.8.1", + "sanity": "^3.43.0", + "styled-components": "^6.1.11" + } + }, "node_modules/sanity/node_modules/@sanity/icons": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/@sanity/icons/-/icons-3.4.0.tgz", @@ -24736,9 +24884,9 @@ } }, "node_modules/send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", "dev": true, "license": "MIT", "dependencies": { @@ -24795,9 +24943,9 @@ } }, "node_modules/serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.0.tgz", + "integrity": "sha512-pDLK8zwl2eKaYrs8mrPZBJua4hMplRWJ1tIFksVC3FtBEBnl8dxgeHtsaMS8DhS9i4fLObaon6ABoc4/hQGdPA==", "dev": true, "license": "MIT", "dependencies": { @@ -24810,6 +24958,55 @@ "node": ">= 0.8.0" } }, + "node_modules/serve-static/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/serve-static/node_modules/debug/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT" + }, + "node_modules/serve-static/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/serve-static/node_modules/send": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", diff --git a/package.json b/package.json index 41e98a2d0..cf1119089 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ }, "dependencies": { "@google-cloud/pubsub": "^4.5.0", + "@sanity/document-internationalization": "^3.0.1", "@sanity/image-url": "^1.0.2", "@sanity/preview-url-secret": "^1.6.11", "@sanity/react-loader": "^1.9.15", diff --git a/studioShared/deskStructure.ts b/studioShared/deskStructure.ts new file mode 100644 index 000000000..355513603 --- /dev/null +++ b/studioShared/deskStructure.ts @@ -0,0 +1,17 @@ +import { i18n } from "languages"; +import { StructureResolver } from "sanity/structure"; +import { customerCaseID } from "./schemas/documents/customerCase"; + +export const deskStructure: StructureResolver = (S) => + S.list() + .title("Content") + .items([ + S.listItem() + .title("Customer cases") + .child( + S.documentList() + .title("Customer cases") + .filter("_type == $type && language == $lang") + .params({ type: customerCaseID, lang: i18n.base }), + ), + ]); diff --git a/studioShared/schema.ts b/studioShared/schema.ts index 7d0ee34f3..321db988c 100644 --- a/studioShared/schema.ts +++ b/studioShared/schema.ts @@ -1,6 +1,6 @@ import { type SchemaTypeDefinition } from "sanity"; import blogPosts from "./schemas/documents/blogPosts"; -import customerCases from "./schemas/documents/customerCases"; +import customerCases from "./schemas/documents/customerCase"; export const schema: { types: SchemaTypeDefinition[] } = { types: [blogPosts, customerCases], diff --git a/studioShared/schemas/documents/customerCases.ts b/studioShared/schemas/documents/customerCase.ts similarity index 51% rename from studioShared/schemas/documents/customerCases.ts rename to studioShared/schemas/documents/customerCase.ts index 5a84a6a7c..b82dc622c 100644 --- a/studioShared/schemas/documents/customerCases.ts +++ b/studioShared/schemas/documents/customerCase.ts @@ -1,20 +1,24 @@ import { defineField, defineType } from "sanity"; -import { format, parseISO } from "date-fns"; import { richText, title } from "studio/schemas/fields/text"; import { titleSlug } from "studio/schemas/schemaTypes/slug"; -export const customerCasesID = "costumerCases"; +export const customerCaseID = "CustomerCase"; -const customerCases = defineType({ - name: customerCasesID, +const customerCase = defineType({ + name: customerCaseID, type: "document", - title: "Costumer Cases", + title: "Customer Case", fields: [ + defineField({ + name: "language", + type: "string", + readOnly: true, + }), title, titleSlug, defineField({ ...richText, - description: "Enter the body content of the costumer case.", + description: "Enter the body content of the Customer case.", }), ], preview: { @@ -22,9 +26,9 @@ const customerCases = defineType({ title: "basicTitle", }, prepare({ title }) { - return { title, subtitle: "Costumer case" }; + return { title, subtitle: "Customer case" }; }, }, }); -export default customerCases; +export default customerCase; diff --git a/studioShared/studioConfig.tsx b/studioShared/studioConfig.tsx index 856fb4947..50b45d955 100644 --- a/studioShared/studioConfig.tsx +++ b/studioShared/studioConfig.tsx @@ -1,8 +1,14 @@ -import { dataset, projectId } from "./env"; -import { schema } from "./schema"; -import { structureTool } from "sanity/structure"; import { WorkspaceOptions } from "sanity"; import StudioIcon from "../studio/components/studioIcon/StudioIcon"; +import { defineField } from "sanity"; +import { documentInternationalization } from "@sanity/document-internationalization"; +import { visionTool } from "@sanity/vision"; +import { structureTool } from "sanity/structure"; +import { apiVersion, dataset, projectId } from "./env"; +import { schema } from "./schema"; +import { i18n } from "languages"; +import { customerCaseID } from "./schemas/documents/customerCase"; +import { deskStructure } from "./deskStructure"; const config: WorkspaceOptions = { name: "sharedStudio", @@ -12,8 +18,31 @@ const config: WorkspaceOptions = { basePath: "/shared", projectId, dataset, - schema, - plugins: [structureTool()], + schema: { + ...schema, + templates: (prev) => + prev.filter((template) => template.value.language === i18n.base), + }, + plugins: [ + structureTool({ + structure: deskStructure, + }), + visionTool({ defaultApiVersion: apiVersion }), + documentInternationalization({ + // TODO: a function that takes the client and returns a promise of an array of supported languages + // MUST return an "id" and "title" as strings + // supportedLanguages: (client) => client.fetch(`*[_type == "language"]{id, title}`), + supportedLanguages: i18n.languages, + schemaTypes: [customerCaseID], + languageField: `language`, + apiVersion, + // TODO: + // Optional + // Adds UI for publishing all translations at once. Requires access to the Scheduling API + // https://www.sanity.io/docs/scheduling-api + // bulkPublish: true, + }), + ], }; export default config;