@sonenta/react-i18next 2.3.0 → 2.3.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/dist/index.cjs CHANGED
@@ -76,7 +76,9 @@ async function loadCatalog(apiBase, fetchImpl = fetch) {
76
76
  const r = await fetchImpl(url, { method: "GET", credentials: "omit" });
77
77
  if (!r.ok) return null;
78
78
  const data = await r.json();
79
- return Array.isArray(data) ? data : null;
79
+ if (Array.isArray(data)) return data;
80
+ const items = data?.items;
81
+ return Array.isArray(items) ? items : null;
80
82
  } catch {
81
83
  return null;
82
84
  }
@@ -238,7 +240,7 @@ function flattenPlurals(tree, locale) {
238
240
 
239
241
  // src/transport.ts
240
242
  var SDK_LIB = "@sonenta/react-i18next";
241
- var SDK_VER = true ? "2.3.0" : "0.0.0-dev";
243
+ var SDK_VER = true ? "2.3.2" : "0.0.0-dev";
242
244
  function defaultTransport(opts) {
243
245
  return async (batch) => {
244
246
  if (!batch.length) return;
@@ -775,16 +777,18 @@ var SonentaI18n = class {
775
777
  * Skipped when disabled; a failure keeps any embedded catalog. */
776
778
  /**
777
779
  * Best-effort: fetch the per-version published-languages manifest
778
- * (`{cdnBase}/p/{project}/{version}/latest/languages.json`, public, no auth,
779
- * CDN-cached) — the SET of locales published for the active version. Codes
780
- * only; enriched from the catalog. A 404/offline keeps any prior manifest
781
- * (`availableLanguages` then falls back to default + fallback). CDN-only:
782
- * `env: "dev"` skips it (the dev runtime has no manifest yet).
780
+ * (`{apiBase}/cdn/v1/{project}/{version}/latest/languages.json`, public, no
781
+ * auth, CORS-open, CDN-cached `max-age=60` + ETag) — the SET of locales
782
+ * published for the active version (compute-on-serve from cdn_releases,
783
+ * always in sync with what is published). Codes only; enriched from the
784
+ * catalog. A 404/offline keeps any prior manifest (`availableLanguages` then
785
+ * falls back to default + fallback). Same route on prod + dev (backend task
786
+ * 989+; the authed `/v1/projects/{id}/languages` is ALL project languages,
787
+ * not the published set — this manifest is the in-production set).
783
788
  */
784
789
  async _loadManifest(fetchImpl, opts = {}) {
785
790
  if (this._manifestDisabled) return;
786
- if (this._config.env === "dev") return;
787
- const url = `${this._config.cdnBase.replace(/\/+$/, "")}/p/${this._config.projectUuid}/${this._config.version}/latest/languages.json`;
791
+ const url = `${this._config.apiBase.replace(/\/+$/, "")}/cdn/v1/${this._config.projectUuid}/${this._config.version}/latest/languages.json`;
788
792
  const init = { method: "GET", credentials: "omit" };
789
793
  if (opts.bust) init.cache = "reload";
790
794
  try {