@saasquatch/component-environment 1.0.1-1 → 1.0.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.js CHANGED
@@ -370,7 +370,7 @@ function lazilyStartLocaleContext() {
370
370
  let globalProvider = window.squatchLocale;
371
371
  if (!globalProvider) {
372
372
  debug3("Creating locale context provider");
373
- const locale = ((_a = window.widgetIdent) == null ? void 0 : _a.locale) ?? validateLocale(navigator.language.replace("-", "_"));
373
+ const locale = ((_a = window.widgetIdent) == null ? void 0 : _a.locale) ?? validateLocale(navigator.language.replaceAll("-", "_"));
374
374
  globalProvider = new import_dom_context.ContextProvider({
375
375
  element: document.documentElement,
376
376
  initialState: locale,
@@ -449,7 +449,7 @@ var userContextListenerForLocale = new import_dom_context2.ContextListener({
449
449
  onChange: async (next) => {
450
450
  var _a;
451
451
  const localeProvider = lazilyStartLocaleContext();
452
- const defaultLocale = ((_a = window.widgetIdent) == null ? void 0 : _a.locale) || navigator.language.replace("-", "_");
452
+ const defaultLocale = ((_a = window.widgetIdent) == null ? void 0 : _a.locale) ?? validateLocale(navigator.language.replaceAll("-", "_"));
453
453
  let newLocale;
454
454
  if (next) {
455
455
  debug5("User context changed, refetching locale");
package/dist/index.mjs CHANGED
@@ -321,7 +321,7 @@ function lazilyStartLocaleContext() {
321
321
  let globalProvider = window.squatchLocale;
322
322
  if (!globalProvider) {
323
323
  debug3("Creating locale context provider");
324
- const locale = ((_a = window.widgetIdent) == null ? void 0 : _a.locale) ?? validateLocale(navigator.language.replace("-", "_"));
324
+ const locale = ((_a = window.widgetIdent) == null ? void 0 : _a.locale) ?? validateLocale(navigator.language.replaceAll("-", "_"));
325
325
  globalProvider = new ContextProvider({
326
326
  element: document.documentElement,
327
327
  initialState: locale,
@@ -400,7 +400,7 @@ var userContextListenerForLocale = new ContextListener({
400
400
  onChange: async (next) => {
401
401
  var _a;
402
402
  const localeProvider = lazilyStartLocaleContext();
403
- const defaultLocale = ((_a = window.widgetIdent) == null ? void 0 : _a.locale) || navigator.language.replace("-", "_");
403
+ const defaultLocale = ((_a = window.widgetIdent) == null ? void 0 : _a.locale) ?? validateLocale(navigator.language.replaceAll("-", "_"));
404
404
  let newLocale;
405
405
  if (next) {
406
406
  debug5("User context changed, refetching locale");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saasquatch/component-environment",
3
- "version": "1.0.1-1",
3
+ "version": "1.0.1",
4
4
  "description": "Environment and contexts for SaaSquatch components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",