@seamly/web-ui 23.0.0-alpha.1 → 23.0.0-alpha.3

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.
Files changed (39) hide show
  1. package/build/dist/lib/components.js +63 -76
  2. package/build/dist/lib/components.js.map +1 -1
  3. package/build/dist/lib/components.min.js +1 -1
  4. package/build/dist/lib/components.min.js.map +1 -1
  5. package/build/dist/lib/hooks.js +60 -73
  6. package/build/dist/lib/hooks.js.map +1 -1
  7. package/build/dist/lib/hooks.min.js +1 -1
  8. package/build/dist/lib/hooks.min.js.map +1 -1
  9. package/build/dist/lib/index.debug.js +9 -9
  10. package/build/dist/lib/index.debug.min.js +1 -1
  11. package/build/dist/lib/index.debug.min.js.map +1 -1
  12. package/build/dist/lib/index.js +47 -64
  13. package/build/dist/lib/index.js.map +1 -1
  14. package/build/dist/lib/index.min.js +1 -1
  15. package/build/dist/lib/index.min.js.map +1 -1
  16. package/build/dist/lib/standalone.js +57 -75
  17. package/build/dist/lib/standalone.js.map +1 -1
  18. package/build/dist/lib/standalone.min.js +1 -1
  19. package/build/dist/lib/standalone.min.js.map +1 -1
  20. package/build/dist/lib/style-guide.js +56 -69
  21. package/build/dist/lib/style-guide.js.map +1 -1
  22. package/build/dist/lib/style-guide.min.js +1 -1
  23. package/build/dist/lib/style-guide.min.js.map +1 -1
  24. package/build/dist/lib/utils.js +68 -100
  25. package/build/dist/lib/utils.js.map +1 -1
  26. package/build/dist/lib/utils.min.js +1 -1
  27. package/build/dist/lib/utils.min.js.map +1 -1
  28. package/package.json +1 -1
  29. package/src/javascripts/api/index.ts +2 -18
  30. package/src/javascripts/domains/app/actions.ts +5 -2
  31. package/src/javascripts/domains/config/actions.ts +3 -0
  32. package/src/javascripts/domains/config/slice.ts +3 -0
  33. package/src/javascripts/domains/i18n/slice.ts +1 -1
  34. package/src/javascripts/domains/translations/components/options-dialog/translation-options.tsx +1 -1
  35. package/src/javascripts/domains/translations/hooks.ts +1 -1
  36. package/src/javascripts/domains/translations/middleware.ts +5 -9
  37. package/src/javascripts/domains/translations/slice.ts +2 -2
  38. package/src/javascripts/style-guide/states.js +4 -0
  39. package/src/javascripts/style-guide/style-guide-engine.js +1 -1
@@ -4556,7 +4556,7 @@ module.exports = function (it) {
4556
4556
 
4557
4557
  /***/ }),
4558
4558
 
4559
- /***/ 2315:
4559
+ /***/ 4696:
4560
4560
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
4561
4561
 
4562
4562
  "use strict";
@@ -5910,7 +5910,7 @@ module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
5910
5910
 
5911
5911
  /***/ }),
5912
5912
 
5913
- /***/ 4696:
5913
+ /***/ 2315:
5914
5914
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
5915
5915
 
5916
5916
  "use strict";
@@ -7586,7 +7586,7 @@ $({ target: 'Object', stat: true }, {
7586
7586
  "use strict";
7587
7587
 
7588
7588
  var $ = __webpack_require__(7580);
7589
- var $parseFloat = __webpack_require__(2315);
7589
+ var $parseFloat = __webpack_require__(4696);
7590
7590
 
7591
7591
  // `parseFloat` method
7592
7592
  // https://tc39.es/ecma262/#sec-parsefloat-string
@@ -8410,7 +8410,7 @@ var uid = __webpack_require__(2360);
8410
8410
  var wellKnownSymbol = __webpack_require__(4604);
8411
8411
  var wrappedWellKnownSymbolModule = __webpack_require__(4460);
8412
8412
  var defineWellKnownSymbol = __webpack_require__(588);
8413
- var defineSymbolToPrimitive = __webpack_require__(4696);
8413
+ var defineSymbolToPrimitive = __webpack_require__(2315);
8414
8414
  var setToStringTag = __webpack_require__(6216);
8415
8415
  var InternalStateModule = __webpack_require__(2348);
8416
8416
  var $forEach = (__webpack_require__(6548).forEach);
@@ -11228,18 +11228,15 @@ var minivents_commonjs_min_default = /*#__PURE__*/__webpack_require__.n(minivent
11228
11228
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/promise.js
11229
11229
  var promise = __webpack_require__(8436);
11230
11230
  var promise_default = /*#__PURE__*/__webpack_require__.n(promise);
11231
- // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/index-of.js
11232
- var index_of = __webpack_require__(308);
11233
- var index_of_default = /*#__PURE__*/__webpack_require__.n(index_of);
11234
- // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols.js
11235
- var get_own_property_symbols = __webpack_require__(6512);
11236
- var get_own_property_symbols_default = /*#__PURE__*/__webpack_require__.n(get_own_property_symbols);
11237
11231
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/url.js
11238
11232
  var core_js_stable_url = __webpack_require__(7568);
11239
11233
  var url_default = /*#__PURE__*/__webpack_require__.n(core_js_stable_url);
11240
11234
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/object/assign.js
11241
11235
  var object_assign = __webpack_require__(2184);
11242
11236
  var assign_default = /*#__PURE__*/__webpack_require__.n(object_assign);
11237
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/index-of.js
11238
+ var index_of = __webpack_require__(308);
11239
+ var index_of_default = /*#__PURE__*/__webpack_require__.n(index_of);
11243
11240
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/json/stringify.js
11244
11241
  var stringify = __webpack_require__(9360);
11245
11242
  var stringify_default = /*#__PURE__*/__webpack_require__.n(stringify);
@@ -13372,7 +13369,6 @@ _ConversationConnector_connectionListeners = new (weak_map_default())(), _Conver
13372
13369
 
13373
13370
 
13374
13371
 
13375
-
13376
13372
  var api_awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
13377
13373
  function adopt(value) {
13378
13374
  return value instanceof P ? value : new P(function (resolve) {
@@ -13411,14 +13407,6 @@ var api_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet ||
13411
13407
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
13412
13408
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
13413
13409
  };
13414
- var __rest = undefined && undefined.__rest || function (s, e) {
13415
- var t = {};
13416
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && index_of_default()(e).call(e, p) < 0) t[p] = s[p];
13417
- if (s != null && typeof (get_own_property_symbols_default()) === "function") for (var i = 0, p = get_own_property_symbols_default()(s); i < p.length; i++) {
13418
- if (index_of_default()(e).call(e, p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
13419
- }
13420
- return t;
13421
- };
13422
13410
  var _API_instances, _API_ready, _API_externalId, _API_conversationAuthToken, _API_layoutMode, _API_config, _API_getAccessToken, _API_setAccessToken, _API_setConversationUrl, _API_getChannelTopic, _API_setChannelTopic, _API_getLocale, _API_getUrlPrefix, _API_updateUrls, _API_createConversation;
13423
13411
 
13424
13412
 
@@ -13508,7 +13496,7 @@ class API {
13508
13496
  _API_config.set(this, void 0);
13509
13497
  this.conversation = new conversation_connector();
13510
13498
  _API_getLocale.set(this, locale => locale || this.locale);
13511
- this.store = objectStore(`${namespace}.connection${context.contentLocale ? `.${context.contentLocale}` : ''}`, config.storageProvider || store);
13499
+ this.store = objectStore(`${namespace}.connection${context.userLocale ? `.${context.userLocale}` : ''}`, config.storageProvider || store);
13512
13500
  this.connectionInfo = {
13513
13501
  apiKey: config.key,
13514
13502
  domain: config.domain || DOMAIN,
@@ -13774,7 +13762,6 @@ class API {
13774
13762
  this.conversation.pushToChannel(command, buildPayload(command, payload), 10000);
13775
13763
  }
13776
13764
  sendContext(context) {
13777
- var _a, _b;
13778
13765
  const {
13779
13766
  contentLocale,
13780
13767
  userLocale,
@@ -13807,23 +13794,13 @@ class API {
13807
13794
  if (keys_default()(payload).length === 0 && payload.constructor === Object) {
13808
13795
  return;
13809
13796
  }
13810
- // Destructure the server locale from the payload
13811
- const {
13812
- contentLocale: _
13813
- } = payload,
13814
- restPayload = __rest(payload, ["contentLocale"]);
13815
- const localContentLocale = (_a = api_classPrivateFieldGet(this, _API_config, "f").context) === null || _a === void 0 ? void 0 : _a.contentLocale;
13816
- const localUserLocale = (_b = api_classPrivateFieldGet(this, _API_config, "f").context) === null || _b === void 0 ? void 0 : _b.userLocale;
13817
- this.send('context', assign_default()(assign_default()({}, localContentLocale ? {
13818
- contentLocale: localContentLocale,
13819
- userLocale: localUserLocale
13820
- } : {}), restPayload), false);
13797
+ this.send('context', payload, false);
13821
13798
  }
13822
13799
  getEnvironment() {
13823
13800
  return {
13824
13801
  clientName: "@seamly/web-ui",
13825
13802
  clientVariant: api_classPrivateFieldGet(this, _API_layoutMode, "f"),
13826
- clientVersion: "23.0.0-alpha.1",
13803
+ clientVersion: "22.3.6",
13827
13804
  currentUrl: window.location.toString(),
13828
13805
  screenResolution: `${window.screen.width}x${window.screen.height}`,
13829
13806
  timezone: getTimeZone(),
@@ -18280,7 +18257,7 @@ const initializeConfig = createAsyncThunk('initializeConfig', (_, {
18280
18257
  },
18281
18258
  rejectWithValue
18282
18259
  }) => actions_awaiter(void 0, void 0, void 0, function* () {
18283
- var _a;
18260
+ var _a, _b;
18284
18261
  try {
18285
18262
  const {
18286
18263
  features,
@@ -18290,7 +18267,8 @@ const initializeConfig = createAsyncThunk('initializeConfig', (_, {
18290
18267
  userParticipant,
18291
18268
  startChatIcon
18292
18269
  } = yield api.getConfig();
18293
- const defaultContentLocale = ((_a = config === null || config === void 0 ? void 0 : config.context) === null || _a === void 0 ? void 0 : _a.contentLocale) || defaultLocale;
18270
+ const defaultUserLocale = ((_a = config === null || config === void 0 ? void 0 : config.context) === null || _a === void 0 ? void 0 : _a.userLocale) || defaultLocale;
18271
+ const defaultContentLocale = ((_b = config === null || config === void 0 ? void 0 : config.context) === null || _b === void 0 ? void 0 : _b.contentLocale) || defaultLocale;
18294
18272
  const {
18295
18273
  connectWhenInView
18296
18274
  } = config;
@@ -18301,6 +18279,7 @@ const initializeConfig = createAsyncThunk('initializeConfig', (_, {
18301
18279
  agentParticipant,
18302
18280
  userParticipant,
18303
18281
  startChatIcon,
18282
+ defaultUserLocale,
18304
18283
  defaultContentLocale,
18305
18284
  connectWhenInView
18306
18285
  };
@@ -19820,12 +19799,14 @@ const initializeApp = createAsyncThunk('initializeApp', (_, {
19820
19799
  rejectWithValue
19821
19800
  }) => app_actions_awaiter(void 0, void 0, void 0, function* () {
19822
19801
  var _a, _b, _c;
19823
- const contentLocale = (_a = config === null || config === void 0 ? void 0 : config.context) === null || _a === void 0 ? void 0 : _a.contentLocale;
19824
- const userLocale = (_b = config === null || config === void 0 ? void 0 : config.context) === null || _b === void 0 ? void 0 : _b.userLocale;
19802
+ let contentLocale = (_a = config === null || config === void 0 ? void 0 : config.context) === null || _a === void 0 ? void 0 : _a.contentLocale;
19803
+ let userLocale = (_b = config === null || config === void 0 ? void 0 : config.context) === null || _b === void 0 ? void 0 : _b.userLocale;
19825
19804
  const environment = config.api.sendEnvironment !== false ? api.getEnvironment() : config.api.sendEnvironment;
19826
19805
  try {
19827
19806
  if (api.hasConversation()) {
19828
19807
  const initialState = yield api.getConversationIntitialState();
19808
+ contentLocale = initialState.context.contentLocale || contentLocale;
19809
+ userLocale = initialState.context.userLocale || userLocale;
19829
19810
  api.sendContext(assign_default()(assign_default()({}, initialState.context), {
19830
19811
  environment
19831
19812
  }));
@@ -19893,13 +19874,16 @@ const resetApp = create_debounced_async_thunk('resetApp', (_, {
19893
19874
  wait: 2000,
19894
19875
  leading: true
19895
19876
  });
19877
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols.js
19878
+ var get_own_property_symbols = __webpack_require__(6512);
19879
+ var get_own_property_symbols_default = /*#__PURE__*/__webpack_require__.n(get_own_property_symbols);
19896
19880
  ;// CONCATENATED MODULE: ./src/javascripts/domains/config/slice.ts
19897
19881
 
19898
19882
 
19899
19883
 
19900
19884
 
19901
19885
 
19902
- var slice_rest = undefined && undefined.__rest || function (s, e) {
19886
+ var __rest = undefined && undefined.__rest || function (s, e) {
19903
19887
  var t = {};
19904
19888
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && index_of_default()(e).call(e, p) < 0) t[p] = s[p];
19905
19889
  if (s != null && typeof (get_own_property_symbols_default()) === "function") for (var i = 0, p = get_own_property_symbols_default()(s); i < p.length; i++) {
@@ -19943,7 +19927,7 @@ const updateState = (state, config) => {
19943
19927
  {
19944
19928
  messages
19945
19929
  } = _a,
19946
- partialConfig = slice_rest(_a, ["messages"]);
19930
+ partialConfig = __rest(_a, ["messages"]);
19947
19931
  let newState = state;
19948
19932
  if (keys_default()(partialConfig).length > 0) {
19949
19933
  newState = assign_default()(assign_default()({}, newState), partialConfig);
@@ -19978,6 +19962,7 @@ const configSlice = createSlice({
19978
19962
  agentParticipant,
19979
19963
  userParticipant,
19980
19964
  startChatIcon,
19965
+ defaultUserLocale,
19981
19966
  defaultContentLocale
19982
19967
  }
19983
19968
  }) => {
@@ -19986,6 +19971,7 @@ const configSlice = createSlice({
19986
19971
  type: 'message',
19987
19972
  payload
19988
19973
  }));
19974
+ state.context.userLocale = defaultUserLocale;
19989
19975
  state.context.contentLocale = defaultContentLocale;
19990
19976
  state.agentParticipant = agentParticipant;
19991
19977
  state.userParticipant = userParticipant;
@@ -20338,7 +20324,7 @@ const i18nSlice = createSlice({
20338
20324
  builder.addCase(resetApp.pending, () => i18n_slice_initialState).addCase(initializeConfig.fulfilled, (state, {
20339
20325
  payload
20340
20326
  }) => {
20341
- state.initialLocale = payload.defaultContentLocale;
20327
+ state.initialLocale = payload.defaultUserLocale;
20342
20328
  }).addCase(setLocale.pending, state => {
20343
20329
  state.isLoading = true;
20344
20330
  }).addCase(setLocale.rejected, state => {
@@ -21154,28 +21140,6 @@ function createOptionsMiddleware({
21154
21140
  return result;
21155
21141
  };
21156
21142
  }
21157
- ;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/selectors.ts
21158
-
21159
- const selectTranslations = createSelector(({
21160
- i18n
21161
- }) => i18n, ({
21162
- translations
21163
- }) => translations);
21164
- const selectInitialLocale = createSelector(({
21165
- i18n
21166
- }) => i18n, ({
21167
- initialLocale
21168
- }) => initialLocale);
21169
- const selectLocale = createSelector(({
21170
- i18n
21171
- }) => i18n, ({
21172
- userLocale
21173
- }) => userLocale);
21174
- const selectIsLoading = createSelector(({
21175
- i18n
21176
- }) => i18n, ({
21177
- isLoading
21178
- }) => isLoading);
21179
21143
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/splice.js
21180
21144
  var splice = __webpack_require__(3628);
21181
21145
  var splice_default = /*#__PURE__*/__webpack_require__.n(splice);
@@ -21293,8 +21257,8 @@ const translationSlice = createSlice({
21293
21257
  if (!feature) return;
21294
21258
  state.isAvailable = feature.enabled === true;
21295
21259
  state.languages = sort_default()(_context3 = [...feature.languages]).call(_context3, (a, b) => {
21296
- if (a.locale === payload.defaultContentLocale) return -1;
21297
- if (b.locale === payload.defaultContentLocale) return 1;
21260
+ if (a.locale === payload.defaultUserLocale) return -1;
21261
+ if (b.locale === payload.defaultUserLocale) return 1;
21298
21262
  return a.nativeName.localeCompare(b.nativeName, undefined, {
21299
21263
  sensitivity: 'base'
21300
21264
  });
@@ -21331,7 +21295,6 @@ const {
21331
21295
 
21332
21296
 
21333
21297
 
21334
-
21335
21298
  const createI18nMiddleware = ({
21336
21299
  dispatch,
21337
21300
  getState
@@ -21348,13 +21311,15 @@ const createI18nMiddleware = ({
21348
21311
  }
21349
21312
  }
21350
21313
  if (initializeConfig.fulfilled.match(action)) {
21351
- if (action.payload.defaultContentLocale) {
21352
- dispatch(setLocale(action.payload.defaultContentLocale));
21314
+ if (action.payload.defaultUserLocale) {
21315
+ dispatch(setLocale(action.payload.defaultUserLocale));
21353
21316
  return result;
21354
21317
  }
21355
21318
  }
21356
21319
  if (initializeApp.fulfilled.match(action)) {
21357
- dispatch(setLocale(action.payload.contentLocale));
21320
+ if (action.payload.userLocale) {
21321
+ dispatch(setLocale(action.payload.userLocale));
21322
+ }
21358
21323
  return result;
21359
21324
  }
21360
21325
  if (addEvent.match(action)) {
@@ -21363,11 +21328,6 @@ const createI18nMiddleware = ({
21363
21328
  return result;
21364
21329
  }
21365
21330
  }
21366
- if (disableTranslation.match(action)) {
21367
- const initialLocale = selectInitialLocale(getState());
21368
- dispatch(setLocale(initialLocale));
21369
- return result;
21370
- }
21371
21331
  return result;
21372
21332
  };
21373
21333
  };
@@ -22170,6 +22130,28 @@ function selectTypeHandler(value) {
22170
22130
 
22171
22131
  //# sourceMappingURL=icu-message-formatter.es.js.map
22172
22132
 
22133
+ ;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/selectors.ts
22134
+
22135
+ const selectTranslations = createSelector(({
22136
+ i18n
22137
+ }) => i18n, ({
22138
+ translations
22139
+ }) => translations);
22140
+ const selectInitialLocale = createSelector(({
22141
+ i18n
22142
+ }) => i18n, ({
22143
+ initialLocale
22144
+ }) => initialLocale);
22145
+ const selectLocale = createSelector(({
22146
+ i18n
22147
+ }) => i18n, ({
22148
+ userLocale
22149
+ }) => userLocale);
22150
+ const selectIsLoading = createSelector(({
22151
+ i18n
22152
+ }) => i18n, ({
22153
+ isLoading
22154
+ }) => isLoading);
22173
22155
  ;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/hooks.ts
22174
22156
 
22175
22157
 
@@ -23311,7 +23293,7 @@ function useTranslations() {
23311
23293
  }, [sendContext]);
23312
23294
  const disableTranslations = (0,hooks_module/* useCallback */.kZ)(() => {
23313
23295
  sendContext({
23314
- userLocale: config.context.userLocale
23296
+ userLocale: config.context.contentLocale
23315
23297
  });
23316
23298
  dispatch(disableTranslation());
23317
23299
  }, [config.context, dispatch, sendContext]);
@@ -28607,7 +28589,7 @@ const TranslationOption = ({ label, checked, description, onChange, id, itemClas
28607
28589
 
28608
28590
  const isChecked = (language, currentLocale, isOriginal) => currentLocale === language.locale || (!currentLocale && isOriginal);
28609
28591
  const TranslationOptions = ({ onChange, describedById, }) => {
28610
- const { context: { contentLocale }, } = useConfig();
28592
+ const { context: { userLocale, contentLocale }, } = useConfig();
28611
28593
  const { t } = useI18n();
28612
28594
  const { languages, currentLocale, enableTranslations, disableTranslations } = useTranslations();
28613
28595
  const focusSkiplinkTarget = useSkiplinkTargetFocusing();