@seamly/web-ui 19.0.0-beta.2 → 19.0.0-beta.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.
@@ -12103,6 +12103,10 @@ const omit = (obj, keys) => Object.keys(obj).reduce((accum, key) => {
12103
12103
  if (!keys.includes(key)) accum[key] = obj[key];
12104
12104
  return accum;
12105
12105
  }, {});
12106
+ ;// CONCATENATED MODULE: ./src/javascripts/lib/id.js
12107
+ function randomId() {
12108
+ return '_' + (Number(String(Math.random()).slice(2)) + Date.now() + Math.round(performance.now())).toString(36);
12109
+ }
12106
12110
  ;// CONCATENATED MODULE: ./src/javascripts/lib/redux-helpers/index.js
12107
12111
  function redux_helpers_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
12108
12112
 
@@ -12110,6 +12114,7 @@ function redux_helpers_objectSpread(target) { for (var i = 1; i < arguments.leng
12110
12114
 
12111
12115
  function redux_helpers_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12112
12116
 
12117
+
12113
12118
  const SLICE_DELIMITER = '/';
12114
12119
  const DOMAIN_DELIMITER = '//';
12115
12120
  function prefixType(prefix, fn, delimiter = '/') {
@@ -12122,7 +12127,9 @@ function createAction(type, identityReducer = payload => ({
12122
12127
  type
12123
12128
  }, identityReducer(...params));
12124
12129
 
12125
- action.toString = () => type.toString();
12130
+ action.toString = () => String(type);
12131
+
12132
+ action.match = obj => (obj === null || obj === void 0 ? void 0 : obj.type) === String(type);
12126
12133
 
12127
12134
  return action;
12128
12135
  }
@@ -12145,16 +12152,70 @@ function createActions(baseType, ...args) {
12145
12152
  const create = prefixType(baseType, createAction, SLICE_DELIMITER);
12146
12153
  return handlers.map(handler => create(...handler));
12147
12154
  }
12148
- function createThunk(type, thunkCreator) {
12149
- const fn = (...args) => {
12150
- const thunk = thunkCreator(...args);
12151
- thunk.type = type;
12152
- return thunk;
12153
- };
12155
+ function createThunk(type, payloadCreator) {
12156
+ const [pending, fulfilled, rejected] = createActions(type, {
12157
+ pending: (arg, requestId) => ({
12158
+ meta: {
12159
+ arg,
12160
+ requestId,
12161
+ status: 'pending'
12162
+ }
12163
+ }),
12164
+ fulfilled: (arg, payload, requestId) => ({
12165
+ payload,
12166
+ meta: {
12167
+ arg,
12168
+ requestId,
12169
+ status: 'fulfilled'
12170
+ }
12171
+ }),
12172
+ rejected: (arg, error, requestId) => ({
12173
+ error,
12174
+ meta: {
12175
+ arg,
12176
+ requestId,
12177
+ status: 'rejected',
12178
+ error: String(error)
12179
+ }
12180
+ })
12181
+ });
12182
+
12183
+ const thunkCreator = arg => (dispatch, getState, extra) => {
12184
+ const requestId = randomId();
12154
12185
 
12155
- fn.toString = () => type;
12186
+ const promise = (async () => {
12187
+ let finalAction;
12156
12188
 
12157
- return fn;
12189
+ try {
12190
+ dispatch(pending(arg, requestId));
12191
+ const prms = payloadCreator(arg, {
12192
+ dispatch,
12193
+ getState,
12194
+ extra
12195
+ });
12196
+ const result = await prms;
12197
+ finalAction = fulfilled(arg, result, requestId);
12198
+ } catch (error) {
12199
+ finalAction = rejected(arg, error, requestId);
12200
+ }
12201
+
12202
+ dispatch(finalAction);
12203
+ return finalAction;
12204
+ })();
12205
+
12206
+ return Object.assign(promise, {
12207
+ type,
12208
+ arg,
12209
+ requestId
12210
+ });
12211
+ };
12212
+
12213
+ return Object.assign(thunkCreator, {
12214
+ type,
12215
+ pending,
12216
+ fulfilled,
12217
+ rejected
12218
+ });
12158
12219
  }
12159
12220
  function createReducer(domain, handlers = {}, defaultState) {
12160
12221
  const reducer = (state, action) => {
@@ -13387,7 +13448,6 @@ function createMutex() {
13387
13448
 
13388
13449
  const {
13389
13450
  createAction: i18n_utils_createAction,
13390
- createActions: utils_createActions,
13391
13451
  createThunk: i18n_utils_createThunk,
13392
13452
  createReducer: i18n_utils_createReducer,
13393
13453
  selectState: utils_selectState
@@ -13406,38 +13466,19 @@ const selectLocale = createSelector(utils_selectState, state => state.locale);
13406
13466
  const setInitialLocale = i18n_utils_createAction('setInitialLocale', locale => ({
13407
13467
  locale
13408
13468
  }));
13409
- const [setLocaleStart, setLocaleResolve, setLocaleReject] = utils_createActions('setLocale', {
13410
- start: locale => ({
13411
- locale
13412
- }),
13413
- resolve: (locale, translations) => ({
13414
- locale,
13415
- translations
13416
- }),
13417
- reject: (locale, error) => ({
13418
- locale,
13419
- error
13420
- })
13421
- });
13422
13469
  const mutex = createMutex();
13423
- const setLocale = i18n_utils_createThunk('setLocale', locale => async (dispatch, getState, {
13424
- api
13470
+ const setLocale = i18n_utils_createThunk('setLocale', async (locale, {
13471
+ getState,
13472
+ extra: {
13473
+ api
13474
+ }
13425
13475
  }) => {
13426
- await mutex.runExclusively(async () => {
13427
- const currentLocale = selectLocale(getState());
13428
-
13429
- if (currentLocale === locale) {
13430
- return;
13476
+ return mutex.runExclusively(() => {
13477
+ if (locale === selectLocale(getState())) {
13478
+ return undefined;
13431
13479
  }
13432
13480
 
13433
- dispatch(setLocaleStart(locale));
13434
-
13435
- try {
13436
- const translations = await api.getTranslations(locale);
13437
- dispatch(setLocaleResolve(locale, translations));
13438
- } catch (error) {
13439
- dispatch(setLocaleReject(locale, error));
13440
- }
13481
+ return api.getTranslations(locale);
13441
13482
  });
13442
13483
  });
13443
13484
  ;// CONCATENATED MODULE: ./node_modules/@ultraq/icu-message-formatter/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
@@ -14174,13 +14215,21 @@ const defaultState = {
14174
14215
  }) => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
14175
14216
  initialLocale: locale
14176
14217
  }),
14177
- [setLocaleStart]: state => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
14218
+ [setLocale.pending]: state => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
14178
14219
  isLoading: true
14179
14220
  }),
14180
- [setLocaleResolve]: (state, {
14181
- locale,
14182
- translations
14221
+ [setLocale.fulfilled]: (state, {
14222
+ payload: translations,
14223
+ meta: {
14224
+ arg: locale
14225
+ }
14183
14226
  }) => {
14227
+ if (!translations) {
14228
+ return i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
14229
+ isLoading: false
14230
+ });
14231
+ }
14232
+
14184
14233
  return i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
14185
14234
  isLoading: false,
14186
14235
  locale,
@@ -14189,7 +14238,7 @@ const defaultState = {
14189
14238
  }), {})
14190
14239
  });
14191
14240
  },
14192
- [setLocaleReject]: state => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
14241
+ [setLocale.rejected]: state => i18n_reducer_objectSpread(i18n_reducer_objectSpread({}, state), {}, {
14193
14242
  isLoading: false
14194
14243
  })
14195
14244
  }, defaultState));
@@ -14402,10 +14451,6 @@ const useFileUploads = () => {
14402
14451
  isComplete: currentUploads.every(file => file.complete)
14403
14452
  };
14404
14453
  };
14405
- ;// CONCATENATED MODULE: ./src/javascripts/lib/id.js
14406
- function randomId() {
14407
- return '_' + (Number(String(Math.random()).slice(2)) + Date.now() + Math.round(performance.now())).toString(36);
14408
- }
14409
14454
  ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/utility-hooks.js
14410
14455
 
14411
14456
 
@@ -14637,8 +14682,11 @@ const {
14637
14682
  const setHasResponded = app_utils_createAction('setHasResponded', hasResponded => ({
14638
14683
  hasResponded
14639
14684
  }));
14640
- const actions_initialize = app_utils_createThunk('initialize', config => async (dispatch, getState, {
14641
- api
14685
+ const actions_initialize = app_utils_createThunk('initialize', async (config, {
14686
+ dispatch,
14687
+ extra: {
14688
+ api
14689
+ }
14642
14690
  }) => {
14643
14691
  try {
14644
14692
  var _config$context;
@@ -15951,19 +15999,19 @@ const Icon = ({
15951
15999
  ;// CONCATENATED MODULE: ./src/javascripts/domains/translations/utils.js
15952
16000
 
15953
16001
  const {
15954
- createActions: translations_utils_createActions,
16002
+ createActions: utils_createActions,
15955
16003
  createReducer: translations_utils_createReducer,
15956
16004
  selectState: translations_utils_selectState
15957
16005
  } = createDomain('translations');
15958
16006
  ;// CONCATENATED MODULE: ./src/javascripts/domains/translations/actions.js
15959
16007
 
15960
- const [enable, disable] = translations_utils_createActions('translate', {
16008
+ const [enable, disable] = utils_createActions('translate', {
15961
16009
  enable: locale => ({
15962
16010
  locale
15963
16011
  }),
15964
16012
  disable: () => ({})
15965
16013
  });
15966
- const [enableEvent, disableEvent] = translations_utils_createActions('event', {
16014
+ const [enableEvent, disableEvent] = utils_createActions('event', {
15967
16015
  enable: payloadId => ({
15968
16016
  payloadId
15969
16017
  }),
@@ -24799,7 +24847,14 @@ function store(key) {
24799
24847
  const KEY = 'cvco.' + key;
24800
24848
  return {
24801
24849
  get() {
24802
- return JSON.parse(sessionStorage.getItem(KEY));
24850
+ const candidates = [KEY, KEY.split('.').slice(0, -1).join('.')];
24851
+ let val;
24852
+
24853
+ do {
24854
+ val = sessionStorage.getItem(candidates[0]);
24855
+ } while (candidates.shift() && !val);
24856
+
24857
+ return JSON.parse(val);
24803
24858
  },
24804
24859
 
24805
24860
  set(value) {