@bunizao/contracts 0.9.0 → 0.10.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.
@@ -514,17 +514,36 @@ export declare function avatarClass(seed: number): number;
514
514
  /** A seed in colour class `cls`; `variety` fills the digits that pick the
515
515
  expression, pose and head shape. */
516
516
  export declare function seedInClass(cls: number, variety: number): number;
517
- /** POST body for `READER_AVATAR_SEED_PATH`. */
517
+ /** How many faces an `offer` holds. */
518
+ export declare const AVATAR_OFFER_SIZE = 5;
519
+ /** POST body for `READER_AVATAR_SEED_PATH`.
520
+
521
+ - `issue` (the default): one seed, handed out and counted. The first face
522
+ a browser gets.
523
+ - `offer`: AVATAR_OFFER_SIZE candidates to choose from, nothing counted
524
+ or kept -- a reader browsing faces has not taken one yet.
525
+ - `choose`: `seed` becomes the caller's face, counted and, for a verified
526
+ reader, kept. */
518
527
  export interface AvatarSeedInput {
519
- /** The seed on screen now. The answer is always in a different colour
520
- class, so every re-roll visibly changes the face. */
528
+ /** The seed on screen now. `issue` and `offer` always answer in other
529
+ colour classes, so every new face visibly changes. */
521
530
  current?: number | null;
531
+ mode?: 'issue' | 'offer' | 'choose';
532
+ /** Required for `choose`. */
533
+ seed?: number;
522
534
  }
535
+ /** The answer to `issue` and `choose`. */
523
536
  export interface AvatarSeedResult {
524
- /** In the least-used colour class across the site, never `current`'s. */
537
+ /** For `issue`, in the least-used colour class across the site, never
538
+ `current`'s. For `choose`, the seed that was sent. */
525
539
  seed: number;
526
540
  /** True when the caller is a verified reader and the seed is now theirs
527
541
  everywhere. False for anyone else: the client keeps it and sends it as
528
542
  `CommentCreateInput.avatarSeed`. */
529
543
  persisted: boolean;
530
544
  }
545
+ /** The answer to `offer`: one seed in each of the AVATAR_OFFER_SIZE
546
+ least-used colour classes, none of them `current`'s. */
547
+ export interface AvatarSeedOfferResult {
548
+ seeds: number[];
549
+ }
package/dist/comments.js CHANGED
@@ -74,8 +74,10 @@ function seedInClass(cls, variety) {
74
74
  const span = Math.floor(MAX_AVATAR_SEED / AVATAR_CLASSES);
75
75
  return Math.abs(Math.trunc(variety)) % span * AVATAR_CLASSES + Math.abs(Math.trunc(cls)) % AVATAR_CLASSES;
76
76
  }
77
+ var AVATAR_OFFER_SIZE = 5;
77
78
  export {
78
79
  AVATAR_CLASSES,
80
+ AVATAR_OFFER_SIZE,
79
81
  COMMENTS_MODES,
80
82
  COMMENT_ANCHOR_PATTERN,
81
83
  COMMENT_ANCHOR_TOKEN_LENGTH,
package/dist/index.js CHANGED
@@ -86,6 +86,7 @@ function seedInClass(cls, variety) {
86
86
  const span = Math.floor(MAX_AVATAR_SEED / AVATAR_CLASSES);
87
87
  return Math.abs(Math.trunc(variety)) % span * AVATAR_CLASSES + Math.abs(Math.trunc(cls)) % AVATAR_CLASSES;
88
88
  }
89
+ var AVATAR_OFFER_SIZE = 5;
89
90
  // src/content.ts
90
91
  var CONTENT_DOCUMENT_SOURCES = ["mood", "post"];
91
92
  var POST_LOCALE_RE = /^[a-z]{2,8}(?:-[a-z0-9]{1,8})*$/;
@@ -220,6 +221,7 @@ export {
220
221
  ADMIN_BASE_PATH,
221
222
  API_PREFIX,
222
223
  AVATAR_CLASSES,
224
+ AVATAR_OFFER_SIZE,
223
225
  BLOG_ANALYTICS_ARTICLE_ENDPOINT,
224
226
  BLOG_ANALYTICS_COMPLETION_SCROLL_DEPTH,
225
227
  BLOG_ANALYTICS_EVENTS_DEFAULT_LIMIT,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunizao/contracts",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Shared TypeScript contracts for buxx.me services and clients.",
5
5
  "type": "module",
6
6
  "sideEffects": false,