@colixsystems/widget-sdk 0.40.1 → 0.40.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
@@ -47,7 +47,11 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
47
47
 
48
48
  ## Status
49
49
 
50
- `v0.40.1` — pre-publish. The package surface (types, function names, export paths) is the v1 contract; runtime behaviour for some hooks is stubbed (each hook documents what's wired and what isn't). It is **not yet published to npm**.
50
+ `v0.40.2` — pre-publish. The package surface (types, function names, export paths) is the v1 contract; runtime behaviour for some hooks is stubbed (each hook documents what's wired and what isn't). It is **not yet published to npm**.
51
+
52
+ ### What's new in 0.40.2
53
+
54
+ **`useI18n().t()` no longer leaks the host's `{{t:key}}` miss placeholder.** Resolution steps 1–2 (per-widget and shared namespaces) already treated a `{{t:…}}` return from the host as a miss, but the final raw-key step did not — on the web Player (whose host resolver returns the placeholder form on a miss and ignores the fallback argument) a key absent from the tenant dictionary rendered as literal `{{t:key}}` text instead of degrading to `fallback ?? key`. The same guard now applies to all three steps. **The public contract is unchanged** — this is the behaviour `useI18n` always documented. `CONTRACT.version` is unchanged.
51
55
 
52
56
  ### What's new in 0.40.1
53
57
 
package/dist/hooks.js CHANGED
@@ -270,8 +270,17 @@ export function useI18n() {
270
270
  }
271
271
  // 3) Fall back to the raw key (shared app keys + widgets with no
272
272
  // manifest translations — unchanged from pre-1.10 behaviour).
273
+ // The same `{{t:…}}` miss guard as steps 1–2 applies: the Player's
274
+ // host t ignores the fallback arg and returns the placeholder on a
275
+ // miss, and without the guard that placeholder rendered verbatim
276
+ // instead of degrading to `fallback ?? key`.
273
277
  const out = hostT(key, fallback);
274
- if (typeof out === "string" && out.length > 0 && out !== key) {
278
+ if (
279
+ typeof out === "string" &&
280
+ out.length > 0 &&
281
+ out !== key &&
282
+ !out.startsWith("{{t:")
283
+ ) {
275
284
  return out;
276
285
  }
277
286
  // Host returned the key (unresolved) or nothing usable.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colixsystems/widget-sdk",
3
- "version": "0.40.1",
3
+ "version": "0.40.2",
4
4
  "description": "Common widget interface for AppStudio. Implements WidgetManifest, WidgetContext, property schema, and helper hooks.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",