@vdaluz/astro-affiliate 1.1.1 → 1.1.2

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/README.md CHANGED
@@ -204,7 +204,8 @@ const { affiliates = [] } = entry.data;
204
204
  ```
205
205
 
206
206
  Renders one paragraph joining the disclosure text for every program in `affiliates`, or nothing
207
- if the array is empty. Default styling is `text-sm text-muted italic`; pass `class` to override,
207
+ if the array is empty. A program named more than once (for example, one entry per card in a
208
+ card list) is disclosed once. Default styling is `text-sm text-muted italic`; pass `class` to override,
208
209
  see [Per-app glue](#per-app-glue) for the token variables this assumes.
209
210
 
210
211
  ### Localized disclosure text
@@ -244,7 +245,8 @@ import { affiliate } from '../config/affiliate';
244
245
  const disclosures = resolveDisclosures(affiliate, entry.data.affiliates ?? [], locale);
245
246
  ```
246
247
 
247
- It returns the resolved text for each program name in order (see [Localized disclosure
248
+ It returns the resolved text for each distinct program name, in first-seen order - a name passed
249
+ more than once appears once (see [Localized disclosure
248
250
  text](#localized-disclosure-text) for how `locale` selects between entries), and throws if any
249
251
  name isn't a program declared in `config.programs` - the same guarantee `<AffiliateDisclosure>`
250
252
  relies on internally, so a plain-text consumer can't silently drop a disclosure for a typo'd
@@ -336,6 +338,7 @@ Publishing / OIDC, no token secret):
336
338
  - [imperfectsystems.com](https://imperfectsystems.com)
337
339
  - [freetoolbox.net](https://freetoolbox.net)
338
340
  - [vicstradamus.com](https://vicstradamus.com)
341
+ - [deepcutatlas.com](https://deepcutatlas.com)
339
342
 
340
343
  ## License
341
344
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vdaluz/astro-affiliate",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "FTC-compliant affiliate-link catalog resolver and disclosure components - proven in production on vdaluz.com and imperfectsystems.com.",
5
5
  "keywords": [
6
6
  "astro",
@@ -5,10 +5,11 @@ import { resolveLocalized } from './i18n.ts';
5
5
  * Resolves a post's `affiliates:` frontmatter names to their disclosure text.
6
6
  * Throws on an unknown program name instead of silently omitting its
7
7
  * disclosure - a typo'd/renamed program must fail the build, not ship a
8
- * page that uses the program without disclosing it.
8
+ * page that uses the program without disclosing it. Repeated program names
9
+ * collapse to one entry, in first-seen order.
9
10
  */
10
11
  export function resolveDisclosures(config: AffiliateConfig, affiliates: string[], locale?: string): string[] {
11
- return affiliates.map((name) => {
12
+ return [...new Set(affiliates)].map((name) => {
12
13
  const program = config.programs[name];
13
14
  if (!program) {
14
15
  throw new Error(