@seamly/web-ui 23.0.0-alpha.2 → 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 (38) hide show
  1. package/build/dist/lib/components.js +58 -75
  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 +55 -72
  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 +8 -8
  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 +42 -63
  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 +52 -74
  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 +51 -68
  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 +63 -99
  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/config/actions.ts +3 -0
  31. package/src/javascripts/domains/config/slice.ts +3 -0
  32. package/src/javascripts/domains/i18n/slice.ts +1 -1
  33. package/src/javascripts/domains/translations/components/options-dialog/translation-options.tsx +1 -1
  34. package/src/javascripts/domains/translations/hooks.ts +1 -1
  35. package/src/javascripts/domains/translations/middleware.ts +4 -10
  36. package/src/javascripts/domains/translations/slice.ts +2 -2
  37. package/src/javascripts/style-guide/states.js +4 -0
  38. 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.2",
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
  };
@@ -19895,13 +19874,16 @@ const resetApp = create_debounced_async_thunk('resetApp', (_, {
19895
19874
  wait: 2000,
19896
19875
  leading: true
19897
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);
19898
19880
  ;// CONCATENATED MODULE: ./src/javascripts/domains/config/slice.ts
19899
19881
 
19900
19882
 
19901
19883
 
19902
19884
 
19903
19885
 
19904
- var slice_rest = undefined && undefined.__rest || function (s, e) {
19886
+ var __rest = undefined && undefined.__rest || function (s, e) {
19905
19887
  var t = {};
19906
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];
19907
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++) {
@@ -19945,7 +19927,7 @@ const updateState = (state, config) => {
19945
19927
  {
19946
19928
  messages
19947
19929
  } = _a,
19948
- partialConfig = slice_rest(_a, ["messages"]);
19930
+ partialConfig = __rest(_a, ["messages"]);
19949
19931
  let newState = state;
19950
19932
  if (keys_default()(partialConfig).length > 0) {
19951
19933
  newState = assign_default()(assign_default()({}, newState), partialConfig);
@@ -19980,6 +19962,7 @@ const configSlice = createSlice({
19980
19962
  agentParticipant,
19981
19963
  userParticipant,
19982
19964
  startChatIcon,
19965
+ defaultUserLocale,
19983
19966
  defaultContentLocale
19984
19967
  }
19985
19968
  }) => {
@@ -19988,6 +19971,7 @@ const configSlice = createSlice({
19988
19971
  type: 'message',
19989
19972
  payload
19990
19973
  }));
19974
+ state.context.userLocale = defaultUserLocale;
19991
19975
  state.context.contentLocale = defaultContentLocale;
19992
19976
  state.agentParticipant = agentParticipant;
19993
19977
  state.userParticipant = userParticipant;
@@ -20340,7 +20324,7 @@ const i18nSlice = createSlice({
20340
20324
  builder.addCase(resetApp.pending, () => i18n_slice_initialState).addCase(initializeConfig.fulfilled, (state, {
20341
20325
  payload
20342
20326
  }) => {
20343
- state.initialLocale = payload.defaultContentLocale;
20327
+ state.initialLocale = payload.defaultUserLocale;
20344
20328
  }).addCase(setLocale.pending, state => {
20345
20329
  state.isLoading = true;
20346
20330
  }).addCase(setLocale.rejected, state => {
@@ -21156,28 +21140,6 @@ function createOptionsMiddleware({
21156
21140
  return result;
21157
21141
  };
21158
21142
  }
21159
- ;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/selectors.ts
21160
-
21161
- const selectTranslations = createSelector(({
21162
- i18n
21163
- }) => i18n, ({
21164
- translations
21165
- }) => translations);
21166
- const selectInitialLocale = createSelector(({
21167
- i18n
21168
- }) => i18n, ({
21169
- initialLocale
21170
- }) => initialLocale);
21171
- const selectLocale = createSelector(({
21172
- i18n
21173
- }) => i18n, ({
21174
- userLocale
21175
- }) => userLocale);
21176
- const selectIsLoading = createSelector(({
21177
- i18n
21178
- }) => i18n, ({
21179
- isLoading
21180
- }) => isLoading);
21181
21143
  // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/splice.js
21182
21144
  var splice = __webpack_require__(3628);
21183
21145
  var splice_default = /*#__PURE__*/__webpack_require__.n(splice);
@@ -21295,8 +21257,8 @@ const translationSlice = createSlice({
21295
21257
  if (!feature) return;
21296
21258
  state.isAvailable = feature.enabled === true;
21297
21259
  state.languages = sort_default()(_context3 = [...feature.languages]).call(_context3, (a, b) => {
21298
- if (a.locale === payload.defaultContentLocale) return -1;
21299
- if (b.locale === payload.defaultContentLocale) return 1;
21260
+ if (a.locale === payload.defaultUserLocale) return -1;
21261
+ if (b.locale === payload.defaultUserLocale) return 1;
21300
21262
  return a.nativeName.localeCompare(b.nativeName, undefined, {
21301
21263
  sensitivity: 'base'
21302
21264
  });
@@ -21333,7 +21295,6 @@ const {
21333
21295
 
21334
21296
 
21335
21297
 
21336
-
21337
21298
  const createI18nMiddleware = ({
21338
21299
  dispatch,
21339
21300
  getState
@@ -21350,14 +21311,14 @@ const createI18nMiddleware = ({
21350
21311
  }
21351
21312
  }
21352
21313
  if (initializeConfig.fulfilled.match(action)) {
21353
- if (action.payload.defaultContentLocale) {
21354
- dispatch(setLocale(action.payload.defaultContentLocale));
21314
+ if (action.payload.defaultUserLocale) {
21315
+ dispatch(setLocale(action.payload.defaultUserLocale));
21355
21316
  return result;
21356
21317
  }
21357
21318
  }
21358
21319
  if (initializeApp.fulfilled.match(action)) {
21359
- if (action.payload.contentLocale) {
21360
- dispatch(setLocale(action.payload.contentLocale));
21320
+ if (action.payload.userLocale) {
21321
+ dispatch(setLocale(action.payload.userLocale));
21361
21322
  }
21362
21323
  return result;
21363
21324
  }
@@ -21367,11 +21328,6 @@ const createI18nMiddleware = ({
21367
21328
  return result;
21368
21329
  }
21369
21330
  }
21370
- if (disableTranslation.match(action)) {
21371
- const initialLocale = selectInitialLocale(getState());
21372
- dispatch(setLocale(initialLocale));
21373
- return result;
21374
- }
21375
21331
  return result;
21376
21332
  };
21377
21333
  };
@@ -22174,6 +22130,28 @@ function selectTypeHandler(value) {
22174
22130
 
22175
22131
  //# sourceMappingURL=icu-message-formatter.es.js.map
22176
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);
22177
22155
  ;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/hooks.ts
22178
22156
 
22179
22157
 
@@ -23315,7 +23293,7 @@ function useTranslations() {
23315
23293
  }, [sendContext]);
23316
23294
  const disableTranslations = (0,hooks_module/* useCallback */.kZ)(() => {
23317
23295
  sendContext({
23318
- userLocale: config.context.userLocale
23296
+ userLocale: config.context.contentLocale
23319
23297
  });
23320
23298
  dispatch(disableTranslation());
23321
23299
  }, [config.context, dispatch, sendContext]);
@@ -28616,7 +28594,7 @@ const TranslationOptions = ({ onChange, describedById, }) => {
28616
28594
  const { languages, currentLocale, enableTranslations, disableTranslations } = useTranslations();
28617
28595
  const focusSkiplinkTarget = useSkiplinkTargetFocusing();
28618
28596
  const handleChange = (locale) => () => {
28619
- if (locale === currentLocale || userLocale === locale) {
28597
+ if (locale === currentLocale || contentLocale === locale) {
28620
28598
  disableTranslations();
28621
28599
  }
28622
28600
  else {