@saasquatch/component-environment 1.0.5 → 1.0.6-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.js CHANGED
@@ -366,7 +366,7 @@ var import_dom_context2 = require("dom-context");
366
366
  var import_dom_context = require("dom-context");
367
367
  var debug3 = (...args) => debug(LOCALE_CONTEXT_NAME, ...args);
368
368
  function validateLocale(locale) {
369
- if (locale && /^[a-z]{2}_(?:[A-Z]{2}|[0-9]{3})$/.test(locale)) {
369
+ if (locale && /^[a-z]{2}(_(?:[A-Z]{2}|[0-9]{3}))?$/.test(locale)) {
370
370
  return locale;
371
371
  }
372
372
  }
@@ -376,6 +376,7 @@ function lazilyStartLocaleContext() {
376
376
  if (!globalProvider) {
377
377
  debug3("Creating locale context provider");
378
378
  const locale = ((_a = window.widgetIdent) == null ? void 0 : _a.locale) ?? validateLocale(navigator.language.replaceAll("-", "_"));
379
+ debug3("initializing with locale:", locale);
379
380
  globalProvider = new import_dom_context.ContextProvider({
380
381
  element: document.documentElement,
381
382
  initialState: locale,
package/dist/index.mjs CHANGED
@@ -317,7 +317,7 @@ import { ContextListener } from "dom-context";
317
317
  import { ContextProvider } from "dom-context";
318
318
  var debug3 = (...args) => debug(LOCALE_CONTEXT_NAME, ...args);
319
319
  function validateLocale(locale) {
320
- if (locale && /^[a-z]{2}_(?:[A-Z]{2}|[0-9]{3})$/.test(locale)) {
320
+ if (locale && /^[a-z]{2}(_(?:[A-Z]{2}|[0-9]{3}))?$/.test(locale)) {
321
321
  return locale;
322
322
  }
323
323
  }
@@ -327,6 +327,7 @@ function lazilyStartLocaleContext() {
327
327
  if (!globalProvider) {
328
328
  debug3("Creating locale context provider");
329
329
  const locale = ((_a = window.widgetIdent) == null ? void 0 : _a.locale) ?? validateLocale(navigator.language.replaceAll("-", "_"));
330
+ debug3("initializing with locale:", locale);
330
331
  globalProvider = new ContextProvider({
331
332
  element: document.documentElement,
332
333
  initialState: locale,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saasquatch/component-environment",
3
- "version": "1.0.5",
3
+ "version": "1.0.6-2",
4
4
  "description": "Environment and contexts for SaaSquatch components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",