{"_id":"@borislavhr/emdash-plugin-review-link","_rev":"2-710ab5e8925255b63e0955d723bb4d9e","name":"@borislavhr/emdash-plugin-review-link","dist-tags":{"latest":"1.0.0"},"versions":{"0.0.0-stage":{"name":"@borislavhr/emdash-plugin-review-link","version":"0.0.0-stage","_id":"@borislavhr/emdash-plugin-review-link@0.0.0-stage","stub":true,"maintainers":[{"name":"borislavhr","email":"borislav.christov@gmail.com"}],"dist":{"shasum":"7155b8b40842549767858181bdab84961b71e80e","tarball":"https://registry.npmjs.org/@borislavhr/emdash-plugin-review-link/-/emdash-plugin-review-link-0.0.0-stage.tgz","fileCount":2,"integrity":"sha512-J46z0eAtCq6qq9CemFSmQG9A8gQJAGJkIbFhjj3Ytj2pel1FmfO/mm2iTbaWypn/T7uVMlj1P5kId4WW3/6fKg==","signatures":[{"sig":"MEUCIDKUkdasSw7aAQuzC/FQyIFDfp1nMzdVlayj/eFvnzAmAiEA0FUTI8DDTmJ9LIjpBK7djASUzxjhXVzkjK88moT7HGA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":359},"_npmUser":{"name":"borislavhr","email":"borislav.christov@gmail.com"},"description":"Temporary package placeholder for staged publishing","directories":{}},"1.0.0":{"_id":"@borislavhr/emdash-plugin-review-link@1.0.0","bugs":"https://github.com/BorislavHr/emdash-plugins/issues","dist":{"shasum":"6ee5204e9755da9c075ce7262b9dcc86f45bc8f2","tarball":"https://registry.npmjs.org/@borislavhr/emdash-plugin-review-link/-/emdash-plugin-review-link-1.0.0.tgz","fileCount":16,"integrity":"sha512-Y8UPzElWS6LmNcBrxyjNP4wvbjXEAPx7nM2Myul7S99YcZEKX2EZ+a1mMY/cMcCSCX/QGiBSSyya/FhaUNdzqw==","signatures":[{"sig":"MEUCIQCOaG1XE+VLmiErNr7qsZrB0LJ3OWJ4SJy8G5goYrQKDgIgLmPwHRYHD5maXRHjuKgySEsnCMvUEBOGBwlXcb5/ryE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCjTNSYLRz1KJQlEQUjsla9ieCr4SA7rOzVYiuwBjFEtwIgKd3mToBbBore5QjspGUU4QH9QGrYH8+BLnXfr1SjHjI="}],"unpackedSize":25482},"name":"@borislavhr/emdash-plugin-review-link","type":"module","author":{"url":"https://europe4u.online","name":"Borislav Hristov"},"engines":{"node":">=22.18"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./plugin":{"types":"./dist/plugin.d.ts","default":"./dist/plugin.js"}},"license":"MIT","scripts":{"test":"node --test \"test/*.test.ts\"","build":"tsc -p tsconfig.build.json","typecheck":"tsc -p tsconfig.json"},"version":"1.0.0","_npmUser":{"name":"borislavhr","email":"borislav.christov@gmail.com"},"homepage":"https://github.com/BorislavHr/emdash-plugins/tree/main/packages/review-link#readme","keywords":["emdash","emdash-plugin","cms","preview","review","draft","astro"],"repository":{"url":"git+https://github.com/BorislavHr/emdash-plugins.git","type":"git","directory":"packages/review-link"},"description":"EmDash CMS plugin: a private link to a draft that works for days, for reviewers without an admin account.","directories":{},"maintainers":[{"name":"borislavhr","email":"borislav.christov@gmail.com"}],"sideEffects":false,"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"emdash":"1.5.0"},"peerDependencies":{"emdash":">=1.5.0 <2"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/emdash-plugin-review-link_1.0.0_1795356796783_0.8630881103197985"}}},"time":{"created":"2026-11-22T14:11:09.447Z","modified":"2026-11-22T14:13:17.106Z","0.0.0-stage":"2026-11-22T14:11:09.447Z","1.0.0":"2026-11-22T14:13:16.882Z"},"description":"EmDash CMS plugin: a private link to a draft that works for days, for reviewers without an admin account.","maintainers":[{"name":"borislavhr","email":"borislav.christov@gmail.com"}],"readme":"# @borislavhr/emdash-plugin-review-link\n\nA private link to an entry's draft that works for days instead of an hour, so someone without an\nadmin account can review it. Example reviewers: an expert checking an article, a client approving\na page, or a translator.\n\nEmDash's own **Preview** button makes a link that stops working after one hour. That's fine for\nthe editor, but too short for someone outside the team who reads the draft tomorrow. This plugin\nadds a **Review link** panel to the entry editor. One click gives a link that works for 7 days (or\nthe number of days you choose, up to 30).\n\nThe link is EmDash's own signed preview link with a later end date. EmDash checks it, shows the\ncurrent draft, and treats the request as a preview, exactly as it does for its one-hour links. The\nplugin adds no route, stores nothing and makes no network requests.\n\n## What editors see\n\nOn every entry in the collections you choose, the editor's sidebar gets a **Review link** panel:\n\n1. **Make a review link** creates the link. The panel shows it once, with the date and time it\n   stops working.\n2. The editor copies the link and sends it to the reviewer. The link isn't kept anywhere: to send\n   it again, they make another one.\n3. Whoever opens the link sees the draft **as it is at that moment**. Changes made after the link\n   was sent show up the next time the reviewer opens it. There's no need to send a new link after\n   each edit.\n\nIf the site isn't set up yet (see [Set the preview secret](#set-the-preview-secret)), the panel\nsays so and offers no button. If the entry has no slug yet, it asks the editor to save the draft\nfirst.\n\nAnyone who can edit their own entries (Authors and above, permission `content:edit_own`) can make\na review link.\n\n## Requirements\n\n- **EmDash 1.5 or later** (1.x).\n- The plugin runs as a **trusted plugin** (EmDash's `plugins: []` list). It isn't a sandboxed\n  plugin and isn't in the EmDash marketplace.\n- **`EMDASH_PREVIEW_SECRET`** must be set in the site's environment (below).\n- Your page templates load entries through EmDash's own functions (`getEmDashEntry` and the\n  others). Those honour the `?_preview=` token, as they do for EmDash's own preview links.\n\n## Install\n\n```sh\npnpm add @borislavhr/emdash-plugin-review-link\n# or: npm install @borislavhr/emdash-plugin-review-link\n```\n\nAdd it to EmDash's `plugins` in `astro.config.mjs`:\n\n```js\nimport { defineConfig } from 'astro/config';\nimport emdash from 'emdash/astro';\nimport { reviewLink } from '@borislavhr/emdash-plugin-review-link';\n\nexport default defineConfig({\n  integrations: [\n    emdash({\n      // …your database, storage and other settings\n      plugins: [\n        reviewLink({\n          // Which collections get the panel, and where their entries live on the site.\n          collections: {\n            posts: '/blog/{slug}',\n            pages: '/{slug}',\n          },\n          days: 7,\n        }),\n      ],\n    }),\n  ],\n});\n```\n\nThe options are checked when the site builds, so a mistake (a path without `{slug}`, `days: 90`)\nstops the build with a plain message instead of failing later in the editor.\n\n## Set the preview secret\n\nEmDash signs and checks preview links with a secret. When `EMDASH_PREVIEW_SECRET` (or\n`PREVIEW_SECRET`) is set in the environment, EmDash uses it. Otherwise EmDash makes a secret of\nits own and keeps it in the database, where a plugin can't read it. So this plugin needs the\nenvironment variable, and with it EmDash and the plugin sign with the same secret.\n\nMake a random value of at least 32 characters (64 is better):\n\n```sh\nopenssl rand -hex 32\n# or: node -e \"console.log(require('node:crypto').randomBytes(32).toString('hex'))\"\n```\n\nThen set it where the site runs:\n\n- **Cloudflare Workers:** `npx wrangler secret put EMDASH_PREVIEW_SECRET`, once for each Worker\n  (staging and production get different values). For local development, put it in `.dev.vars`.\n  EmDash and this plugin read it from `process.env`. Workers fill `process.env` with your secrets\n  when `nodejs_compat` is on and the compatibility date is 2025-04-01 or later, which EmDash needs\n  anyway.\n- **Node:** an environment variable, or your `.env` file.\n\nKeep the value out of your repository and out of chats.\n\nSetting the secret for the first time replaces the one EmDash kept in the database, so any\nEmDash preview links that are open at that moment stop working. That's harmless: the editor\npresses Preview again.\n\n## Options\n\n| Option        | Default                      | What it does                                                                                                                      |\n| ------------- | ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |\n| `collections` | `{ posts: '/posts/{slug}' }` | The collections that get the panel, each with the address of its entries on the site. `{slug}` is replaced with the entry's slug. |\n| `days`        | `7`                          | How long a link works: a whole number from 1 to 30.                                                                               |\n| `dateLocale`  | `'en-GB'`                    | The language the end date is written in, such as `'de-DE'` or `'en-US'`.                                                          |\n| `timeZone`    | `'UTC'`                      | The time zone of the end date, such as `'Europe/Berlin'`.                                                                         |\n| `text`        | English                      | Replaces any of the panel's words (below).                                                                                        |\n| `order`       | `4`                          | Where the panel sits among the editor's panels; lower comes first.                                                                |\n\nThe slug is put into the address with `encodeURIComponent`. An entry whose slug contains a slash,\n`?`, `#`, `%` or white space, or is `.` or `..`, gets no link, so a link can't point outside the\nentry's own path.\n\n## Other languages\n\nEvery text in the panel can be replaced. Only give the ones you change; the others stay English:\n\n```js\nreviewLink({\n  collections: { posts: '/blog/{slug}' },\n  dateLocale: 'nl-NL',\n  timeZone: 'Europe/Amsterdam',\n  text: {\n    panelTitle: 'Reviewlink',\n    about: 'Een privélink naar dit concept voor iemand zonder account. Hij werkt {days} dagen.',\n    make: 'Maak een reviewlink',\n    makeAnother: 'Maak nog een link',\n    made: 'Reviewlink gemaakt. Hij werkt tot {date}.',\n    // copy, rules, saveFirst, notConnected, failed\n  },\n});\n```\n\n`{days}` and `{date}` are filled in. The default English texts are exported as `DEFAULT_TEXT`, so\nyou can see every key.\n\n## Taking a link back\n\nA review link can't be cancelled on its own: it's a signed token, and the site keeps no list of\nthe links it made. To end links early, **change `EMDASH_PREVIEW_SECRET`**. That ends every\npreview and review link at once, on that site. Editors then make new links for the reviewers who\nstill need them.\n\nSo choose `days` with that in mind. The default of 7 suits most reviews; 30 is the upper limit on\npurpose.\n\n## Privacy and security\n\n- **Who can read the draft:** anyone who has the link, until it ends. Send it to one person, by a\n  private channel.\n- **What it shows:** the current draft of that one entry, never other entries.\n- **Network:** none. **Storage:** none. **Logs:** none. The link is shown once in the panel and\n  isn't saved.\n- **Capabilities:** `content:read`, to read the entry's slug.\n- **Permission:** the panel's route needs `content:edit_own` (Authors and above).\n- A short or placeholder secret (under 32 characters) counts as not set up, so the plugin never\n  signs links with one.\n\n## Development\n\nThis package lives in the [emdash-plugins](https://github.com/BorislavHr/emdash-plugins)\nrepository.\n\n```sh\npnpm install\npnpm --filter @borislavhr/emdash-plugin-review-link test\npnpm --filter @borislavhr/emdash-plugin-review-link build\n```\n\n## License\n\n[MIT](./LICENSE)\n","readmeFilename":"","homepage":"https://github.com/BorislavHr/emdash-plugins/tree/main/packages/review-link#readme","keywords":["emdash","emdash-plugin","cms","preview","review","draft","astro"],"repository":{"url":"git+https://github.com/BorislavHr/emdash-plugins.git","type":"git","directory":"packages/review-link"},"author":{"url":"https://europe4u.online","name":"Borislav Hristov"},"bugs":"https://github.com/BorislavHr/emdash-plugins/issues","license":"MIT"}