@open-slot-ui/core 0.5.0 → 0.5.1

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/dist/index.d.cts CHANGED
@@ -1791,14 +1791,26 @@ interface SocialPhraseIssue {
1791
1791
  }
1792
1792
  /** Every restricted phrase in `text` (empty when clean). Pure + total. */
1793
1793
  declare function findForbiddenPhrases(text: string): ForbiddenMatch[];
1794
+ /** A collected string. `text` is the base English (what renders with no social
1795
+ * override); `key` is the i18n key used to look up a social override — it defaults
1796
+ * to `text`, since a game's menu/rules copy doubles as its own key. */
1794
1797
  type Entry = {
1795
1798
  source: string;
1796
1799
  text: string;
1800
+ key?: string;
1797
1801
  };
1798
1802
  /** Collect every English string a spec ships (menu/rules blocks, titles, labels+hints,
1799
1803
  * game name, the `en` dictionary) with a source path — the input to {@link checkSocialPhrases}. */
1800
1804
  declare function collectSocialCopy(spec: UISpec): Entry[];
1801
- /** Scan a whole spec's English copy and return every restricted-phrase finding. */
1805
+ /**
1806
+ * Scan a spec's English copy AS IT RENDERS IN SOCIAL MODE and return every restricted
1807
+ * phrase. Each collected string is first resolved through the social dictionary
1808
+ * (`locale.socialMessages.en` → built-in `openuiSocialDefaults` → the base text) —
1809
+ * exactly like the translator does — so a game that already swaps "bet"/"pay(table)"
1810
+ * for compliant wording in social mode is NOT flagged, while a phrase with NO social
1811
+ * override (the classic slipped-through "paytable") IS. English by design: the check
1812
+ * targets the base `en` copy that every jurisdiction review starts from.
1813
+ */
1802
1814
  declare function checkSocialPhrases(spec: UISpec): SocialPhraseIssue[];
1803
1815
 
1804
1816
  /**
package/dist/index.d.ts CHANGED
@@ -1791,14 +1791,26 @@ interface SocialPhraseIssue {
1791
1791
  }
1792
1792
  /** Every restricted phrase in `text` (empty when clean). Pure + total. */
1793
1793
  declare function findForbiddenPhrases(text: string): ForbiddenMatch[];
1794
+ /** A collected string. `text` is the base English (what renders with no social
1795
+ * override); `key` is the i18n key used to look up a social override — it defaults
1796
+ * to `text`, since a game's menu/rules copy doubles as its own key. */
1794
1797
  type Entry = {
1795
1798
  source: string;
1796
1799
  text: string;
1800
+ key?: string;
1797
1801
  };
1798
1802
  /** Collect every English string a spec ships (menu/rules blocks, titles, labels+hints,
1799
1803
  * game name, the `en` dictionary) with a source path — the input to {@link checkSocialPhrases}. */
1800
1804
  declare function collectSocialCopy(spec: UISpec): Entry[];
1801
- /** Scan a whole spec's English copy and return every restricted-phrase finding. */
1805
+ /**
1806
+ * Scan a spec's English copy AS IT RENDERS IN SOCIAL MODE and return every restricted
1807
+ * phrase. Each collected string is first resolved through the social dictionary
1808
+ * (`locale.socialMessages.en` → built-in `openuiSocialDefaults` → the base text) —
1809
+ * exactly like the translator does — so a game that already swaps "bet"/"pay(table)"
1810
+ * for compliant wording in social mode is NOT flagged, while a phrase with NO social
1811
+ * override (the classic slipped-through "paytable") IS. English by design: the check
1812
+ * targets the base `en` copy that every jurisdiction review starts from.
1813
+ */
1802
1814
  declare function checkSocialPhrases(spec: UISpec): SocialPhraseIssue[];
1803
1815
 
1804
1816
  /**
package/dist/index.js CHANGED
@@ -2251,15 +2251,18 @@ function collectSocialCopy(spec) {
2251
2251
  if (spec.game?.name) out.push({ source: "game.name", text: spec.game.name });
2252
2252
  const en = spec.locale?.messages?.en;
2253
2253
  if (en) {
2254
- for (const [k, v] of Object.entries(en)) if (typeof v === "string") out.push({ source: `locale.en[${JSON.stringify(k)}]`, text: v });
2254
+ for (const [k, v] of Object.entries(en)) if (typeof v === "string") out.push({ source: `locale.en[${JSON.stringify(k)}]`, text: v, key: k });
2255
2255
  }
2256
2256
  return out;
2257
2257
  }
2258
2258
  function checkSocialPhrases(spec) {
2259
+ const socialEn = spec.locale?.socialMessages?.en ?? {};
2260
+ const render = (e) => socialEn[e.key ?? e.text] ?? openuiSocialDefaults[e.key ?? e.text] ?? e.text;
2259
2261
  const issues = [];
2260
- for (const { source, text } of collectSocialCopy(spec)) {
2262
+ for (const e of collectSocialCopy(spec)) {
2263
+ const text = render(e);
2261
2264
  const matches = findForbiddenPhrases(text);
2262
- if (matches.length) issues.push({ source, text, matches });
2265
+ if (matches.length) issues.push({ source: e.source, text, matches });
2263
2266
  }
2264
2267
  return issues;
2265
2268
  }