@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.
- package/build/dist/lib/components.js +63 -76
- package/build/dist/lib/components.js.map +1 -1
- package/build/dist/lib/components.min.js +1 -1
- package/build/dist/lib/components.min.js.map +1 -1
- package/build/dist/lib/hooks.js +60 -73
- package/build/dist/lib/hooks.js.map +1 -1
- package/build/dist/lib/hooks.min.js +1 -1
- package/build/dist/lib/hooks.min.js.map +1 -1
- package/build/dist/lib/index.debug.js +9 -9
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.debug.min.js.map +1 -1
- package/build/dist/lib/index.js +47 -64
- package/build/dist/lib/index.js.map +1 -1
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/index.min.js.map +1 -1
- package/build/dist/lib/standalone.js +57 -75
- package/build/dist/lib/standalone.js.map +1 -1
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/standalone.min.js.map +1 -1
- package/build/dist/lib/style-guide.js +56 -69
- package/build/dist/lib/style-guide.js.map +1 -1
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/style-guide.min.js.map +1 -1
- package/build/dist/lib/utils.js +68 -100
- package/build/dist/lib/utils.js.map +1 -1
- package/build/dist/lib/utils.min.js +1 -1
- package/build/dist/lib/utils.min.js.map +1 -1
- package/package.json +1 -1
- package/src/javascripts/api/index.ts +2 -18
- package/src/javascripts/domains/app/actions.ts +5 -2
- package/src/javascripts/domains/config/actions.ts +3 -0
- package/src/javascripts/domains/config/slice.ts +3 -0
- package/src/javascripts/domains/i18n/slice.ts +1 -1
- package/src/javascripts/domains/translations/components/options-dialog/translation-options.tsx +1 -1
- package/src/javascripts/domains/translations/hooks.ts +1 -1
- package/src/javascripts/domains/translations/middleware.ts +5 -9
- package/src/javascripts/domains/translations/slice.ts +2 -2
- package/src/javascripts/style-guide/states.js +4 -0
- package/src/javascripts/style-guide/style-guide-engine.js +1 -1
|
@@ -2342,14 +2342,6 @@ var api_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet ||
|
|
|
2342
2342
|
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");
|
|
2343
2343
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
2344
2344
|
};
|
|
2345
|
-
var __rest = undefined && undefined.__rest || function (s, e) {
|
|
2346
|
-
var t = {};
|
|
2347
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2348
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2349
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2350
|
-
}
|
|
2351
|
-
return t;
|
|
2352
|
-
};
|
|
2353
2345
|
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;
|
|
2354
2346
|
|
|
2355
2347
|
|
|
@@ -2439,7 +2431,7 @@ class API {
|
|
|
2439
2431
|
_API_config.set(this, void 0);
|
|
2440
2432
|
this.conversation = new conversation_connector();
|
|
2441
2433
|
_API_getLocale.set(this, locale => locale || this.locale);
|
|
2442
|
-
this.store = objectStore(`${namespace}.connection${context.
|
|
2434
|
+
this.store = objectStore(`${namespace}.connection${context.userLocale ? `.${context.userLocale}` : ''}`, config.storageProvider || store);
|
|
2443
2435
|
this.connectionInfo = {
|
|
2444
2436
|
apiKey: config.key,
|
|
2445
2437
|
domain: config.domain || DOMAIN,
|
|
@@ -2705,7 +2697,6 @@ class API {
|
|
|
2705
2697
|
this.conversation.pushToChannel(command, buildPayload(command, payload), 10000);
|
|
2706
2698
|
}
|
|
2707
2699
|
sendContext(context) {
|
|
2708
|
-
var _a, _b;
|
|
2709
2700
|
const {
|
|
2710
2701
|
contentLocale,
|
|
2711
2702
|
userLocale,
|
|
@@ -2738,23 +2729,13 @@ class API {
|
|
|
2738
2729
|
if (Object.keys(payload).length === 0 && payload.constructor === Object) {
|
|
2739
2730
|
return;
|
|
2740
2731
|
}
|
|
2741
|
-
|
|
2742
|
-
const {
|
|
2743
|
-
contentLocale: _
|
|
2744
|
-
} = payload,
|
|
2745
|
-
restPayload = __rest(payload, ["contentLocale"]);
|
|
2746
|
-
const localContentLocale = (_a = api_classPrivateFieldGet(this, _API_config, "f").context) === null || _a === void 0 ? void 0 : _a.contentLocale;
|
|
2747
|
-
const localUserLocale = (_b = api_classPrivateFieldGet(this, _API_config, "f").context) === null || _b === void 0 ? void 0 : _b.userLocale;
|
|
2748
|
-
this.send('context', Object.assign(Object.assign({}, localContentLocale ? {
|
|
2749
|
-
contentLocale: localContentLocale,
|
|
2750
|
-
userLocale: localUserLocale
|
|
2751
|
-
} : {}), restPayload), false);
|
|
2732
|
+
this.send('context', payload, false);
|
|
2752
2733
|
}
|
|
2753
2734
|
getEnvironment() {
|
|
2754
2735
|
return {
|
|
2755
2736
|
clientName: "@seamly/web-ui",
|
|
2756
2737
|
clientVariant: api_classPrivateFieldGet(this, _API_layoutMode, "f"),
|
|
2757
|
-
clientVersion: "
|
|
2738
|
+
clientVersion: "22.3.6",
|
|
2758
2739
|
currentUrl: window.location.toString(),
|
|
2759
2740
|
screenResolution: `${window.screen.width}x${window.screen.height}`,
|
|
2760
2741
|
timezone: getTimeZone(),
|
|
@@ -7209,7 +7190,7 @@ const initializeConfig = createAsyncThunk('initializeConfig', (_, {
|
|
|
7209
7190
|
},
|
|
7210
7191
|
rejectWithValue
|
|
7211
7192
|
}) => actions_awaiter(void 0, void 0, void 0, function* () {
|
|
7212
|
-
var _a;
|
|
7193
|
+
var _a, _b;
|
|
7213
7194
|
try {
|
|
7214
7195
|
const {
|
|
7215
7196
|
features,
|
|
@@ -7219,7 +7200,8 @@ const initializeConfig = createAsyncThunk('initializeConfig', (_, {
|
|
|
7219
7200
|
userParticipant,
|
|
7220
7201
|
startChatIcon
|
|
7221
7202
|
} = yield api.getConfig();
|
|
7222
|
-
const
|
|
7203
|
+
const defaultUserLocale = ((_a = config === null || config === void 0 ? void 0 : config.context) === null || _a === void 0 ? void 0 : _a.userLocale) || defaultLocale;
|
|
7204
|
+
const defaultContentLocale = ((_b = config === null || config === void 0 ? void 0 : config.context) === null || _b === void 0 ? void 0 : _b.contentLocale) || defaultLocale;
|
|
7223
7205
|
const {
|
|
7224
7206
|
connectWhenInView
|
|
7225
7207
|
} = config;
|
|
@@ -7230,6 +7212,7 @@ const initializeConfig = createAsyncThunk('initializeConfig', (_, {
|
|
|
7230
7212
|
agentParticipant,
|
|
7231
7213
|
userParticipant,
|
|
7232
7214
|
startChatIcon,
|
|
7215
|
+
defaultUserLocale,
|
|
7233
7216
|
defaultContentLocale,
|
|
7234
7217
|
connectWhenInView
|
|
7235
7218
|
};
|
|
@@ -8737,12 +8720,14 @@ const initializeApp = createAsyncThunk('initializeApp', (_, {
|
|
|
8737
8720
|
rejectWithValue
|
|
8738
8721
|
}) => app_actions_awaiter(void 0, void 0, void 0, function* () {
|
|
8739
8722
|
var _a, _b, _c;
|
|
8740
|
-
|
|
8741
|
-
|
|
8723
|
+
let contentLocale = (_a = config === null || config === void 0 ? void 0 : config.context) === null || _a === void 0 ? void 0 : _a.contentLocale;
|
|
8724
|
+
let userLocale = (_b = config === null || config === void 0 ? void 0 : config.context) === null || _b === void 0 ? void 0 : _b.userLocale;
|
|
8742
8725
|
const environment = config.api.sendEnvironment !== false ? api.getEnvironment() : config.api.sendEnvironment;
|
|
8743
8726
|
try {
|
|
8744
8727
|
if (api.hasConversation()) {
|
|
8745
8728
|
const initialState = yield api.getConversationIntitialState();
|
|
8729
|
+
contentLocale = initialState.context.contentLocale || contentLocale;
|
|
8730
|
+
userLocale = initialState.context.userLocale || userLocale;
|
|
8746
8731
|
api.sendContext(Object.assign(Object.assign({}, initialState.context), {
|
|
8747
8732
|
environment
|
|
8748
8733
|
}));
|
|
@@ -8811,7 +8796,7 @@ const resetApp = create_debounced_async_thunk('resetApp', (_, {
|
|
|
8811
8796
|
leading: true
|
|
8812
8797
|
});
|
|
8813
8798
|
;// CONCATENATED MODULE: ./src/javascripts/domains/config/slice.ts
|
|
8814
|
-
var
|
|
8799
|
+
var __rest = undefined && undefined.__rest || function (s, e) {
|
|
8815
8800
|
var t = {};
|
|
8816
8801
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
8817
8802
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
@@ -8855,7 +8840,7 @@ const updateState = (state, config) => {
|
|
|
8855
8840
|
{
|
|
8856
8841
|
messages
|
|
8857
8842
|
} = _a,
|
|
8858
|
-
partialConfig =
|
|
8843
|
+
partialConfig = __rest(_a, ["messages"]);
|
|
8859
8844
|
let newState = state;
|
|
8860
8845
|
if (Object.keys(partialConfig).length > 0) {
|
|
8861
8846
|
newState = Object.assign(Object.assign({}, newState), partialConfig);
|
|
@@ -8890,6 +8875,7 @@ const configSlice = createSlice({
|
|
|
8890
8875
|
agentParticipant,
|
|
8891
8876
|
userParticipant,
|
|
8892
8877
|
startChatIcon,
|
|
8878
|
+
defaultUserLocale,
|
|
8893
8879
|
defaultContentLocale
|
|
8894
8880
|
}
|
|
8895
8881
|
}) => {
|
|
@@ -8898,6 +8884,7 @@ const configSlice = createSlice({
|
|
|
8898
8884
|
type: 'message',
|
|
8899
8885
|
payload
|
|
8900
8886
|
}));
|
|
8887
|
+
state.context.userLocale = defaultUserLocale;
|
|
8901
8888
|
state.context.contentLocale = defaultContentLocale;
|
|
8902
8889
|
state.agentParticipant = agentParticipant;
|
|
8903
8890
|
state.userParticipant = userParticipant;
|
|
@@ -9238,7 +9225,7 @@ const i18nSlice = createSlice({
|
|
|
9238
9225
|
builder.addCase(resetApp.pending, () => i18n_slice_initialState).addCase(initializeConfig.fulfilled, (state, {
|
|
9239
9226
|
payload
|
|
9240
9227
|
}) => {
|
|
9241
|
-
state.initialLocale = payload.
|
|
9228
|
+
state.initialLocale = payload.defaultUserLocale;
|
|
9242
9229
|
}).addCase(setLocale.pending, state => {
|
|
9243
9230
|
state.isLoading = true;
|
|
9244
9231
|
}).addCase(setLocale.rejected, state => {
|
|
@@ -10026,28 +10013,6 @@ function createOptionsMiddleware({
|
|
|
10026
10013
|
return result;
|
|
10027
10014
|
};
|
|
10028
10015
|
}
|
|
10029
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/selectors.ts
|
|
10030
|
-
|
|
10031
|
-
const selectTranslations = createSelector(({
|
|
10032
|
-
i18n
|
|
10033
|
-
}) => i18n, ({
|
|
10034
|
-
translations
|
|
10035
|
-
}) => translations);
|
|
10036
|
-
const selectInitialLocale = createSelector(({
|
|
10037
|
-
i18n
|
|
10038
|
-
}) => i18n, ({
|
|
10039
|
-
initialLocale
|
|
10040
|
-
}) => initialLocale);
|
|
10041
|
-
const selectLocale = createSelector(({
|
|
10042
|
-
i18n
|
|
10043
|
-
}) => i18n, ({
|
|
10044
|
-
userLocale
|
|
10045
|
-
}) => userLocale);
|
|
10046
|
-
const selectIsLoading = createSelector(({
|
|
10047
|
-
i18n
|
|
10048
|
-
}) => i18n, ({
|
|
10049
|
-
isLoading
|
|
10050
|
-
}) => isLoading);
|
|
10051
10016
|
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/slice.ts
|
|
10052
10017
|
|
|
10053
10018
|
|
|
@@ -10152,8 +10117,8 @@ const translationSlice = createSlice({
|
|
|
10152
10117
|
if (!feature) return;
|
|
10153
10118
|
state.isAvailable = feature.enabled === true;
|
|
10154
10119
|
state.languages = [...feature.languages].sort((a, b) => {
|
|
10155
|
-
if (a.locale === payload.
|
|
10156
|
-
if (b.locale === payload.
|
|
10120
|
+
if (a.locale === payload.defaultUserLocale) return -1;
|
|
10121
|
+
if (b.locale === payload.defaultUserLocale) return 1;
|
|
10157
10122
|
return a.nativeName.localeCompare(b.nativeName, undefined, {
|
|
10158
10123
|
sensitivity: 'base'
|
|
10159
10124
|
});
|
|
@@ -10190,7 +10155,6 @@ const {
|
|
|
10190
10155
|
|
|
10191
10156
|
|
|
10192
10157
|
|
|
10193
|
-
|
|
10194
10158
|
const createI18nMiddleware = ({
|
|
10195
10159
|
dispatch,
|
|
10196
10160
|
getState
|
|
@@ -10207,13 +10171,15 @@ const createI18nMiddleware = ({
|
|
|
10207
10171
|
}
|
|
10208
10172
|
}
|
|
10209
10173
|
if (initializeConfig.fulfilled.match(action)) {
|
|
10210
|
-
if (action.payload.
|
|
10211
|
-
dispatch(setLocale(action.payload.
|
|
10174
|
+
if (action.payload.defaultUserLocale) {
|
|
10175
|
+
dispatch(setLocale(action.payload.defaultUserLocale));
|
|
10212
10176
|
return result;
|
|
10213
10177
|
}
|
|
10214
10178
|
}
|
|
10215
10179
|
if (initializeApp.fulfilled.match(action)) {
|
|
10216
|
-
|
|
10180
|
+
if (action.payload.userLocale) {
|
|
10181
|
+
dispatch(setLocale(action.payload.userLocale));
|
|
10182
|
+
}
|
|
10217
10183
|
return result;
|
|
10218
10184
|
}
|
|
10219
10185
|
if (addEvent.match(action)) {
|
|
@@ -10222,11 +10188,6 @@ const createI18nMiddleware = ({
|
|
|
10222
10188
|
return result;
|
|
10223
10189
|
}
|
|
10224
10190
|
}
|
|
10225
|
-
if (disableTranslation.match(action)) {
|
|
10226
|
-
const initialLocale = selectInitialLocale(getState());
|
|
10227
|
-
dispatch(setLocale(initialLocale));
|
|
10228
|
-
return result;
|
|
10229
|
-
}
|
|
10230
10191
|
return result;
|
|
10231
10192
|
};
|
|
10232
10193
|
};
|
|
@@ -11025,6 +10986,28 @@ function selectTypeHandler(value) {
|
|
|
11025
10986
|
|
|
11026
10987
|
//# sourceMappingURL=icu-message-formatter.es.js.map
|
|
11027
10988
|
|
|
10989
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/selectors.ts
|
|
10990
|
+
|
|
10991
|
+
const selectTranslations = createSelector(({
|
|
10992
|
+
i18n
|
|
10993
|
+
}) => i18n, ({
|
|
10994
|
+
translations
|
|
10995
|
+
}) => translations);
|
|
10996
|
+
const selectInitialLocale = createSelector(({
|
|
10997
|
+
i18n
|
|
10998
|
+
}) => i18n, ({
|
|
10999
|
+
initialLocale
|
|
11000
|
+
}) => initialLocale);
|
|
11001
|
+
const selectLocale = createSelector(({
|
|
11002
|
+
i18n
|
|
11003
|
+
}) => i18n, ({
|
|
11004
|
+
userLocale
|
|
11005
|
+
}) => userLocale);
|
|
11006
|
+
const selectIsLoading = createSelector(({
|
|
11007
|
+
i18n
|
|
11008
|
+
}) => i18n, ({
|
|
11009
|
+
isLoading
|
|
11010
|
+
}) => isLoading);
|
|
11028
11011
|
;// CONCATENATED MODULE: ./src/javascripts/domains/i18n/hooks.ts
|
|
11029
11012
|
|
|
11030
11013
|
|
|
@@ -12138,7 +12121,7 @@ function useTranslations() {
|
|
|
12138
12121
|
}, [sendContext]);
|
|
12139
12122
|
const disableTranslations = (0,hooks_.useCallback)(() => {
|
|
12140
12123
|
sendContext({
|
|
12141
|
-
userLocale: config.context.
|
|
12124
|
+
userLocale: config.context.contentLocale
|
|
12142
12125
|
});
|
|
12143
12126
|
dispatch(disableTranslation());
|
|
12144
12127
|
}, [config.context, dispatch, sendContext]);
|
|
@@ -17372,7 +17355,7 @@ const TranslationOption = ({ label, checked, description, onChange, id, itemClas
|
|
|
17372
17355
|
|
|
17373
17356
|
const isChecked = (language, currentLocale, isOriginal) => currentLocale === language.locale || (!currentLocale && isOriginal);
|
|
17374
17357
|
const TranslationOptions = ({ onChange, describedById, }) => {
|
|
17375
|
-
const { context: { contentLocale }, } = useConfig();
|
|
17358
|
+
const { context: { userLocale, contentLocale }, } = useConfig();
|
|
17376
17359
|
const { t } = useI18n();
|
|
17377
17360
|
const { languages, currentLocale, enableTranslations, disableTranslations } = useTranslations();
|
|
17378
17361
|
const focusSkiplinkTarget = useSkiplinkTargetFocusing();
|
|
@@ -21863,7 +21846,8 @@ const standardState = {
|
|
|
21863
21846
|
...baseState.config,
|
|
21864
21847
|
context: {
|
|
21865
21848
|
...baseState.context,
|
|
21866
|
-
contentLocale: 'nl'
|
|
21849
|
+
contentLocale: 'nl',
|
|
21850
|
+
userLocale: 'en'
|
|
21867
21851
|
}
|
|
21868
21852
|
},
|
|
21869
21853
|
translations: {
|
|
@@ -21978,7 +21962,8 @@ const standardState = {
|
|
|
21978
21962
|
...baseState.config,
|
|
21979
21963
|
context: {
|
|
21980
21964
|
...baseState.context,
|
|
21981
|
-
contentLocale: 'nl'
|
|
21965
|
+
contentLocale: 'nl',
|
|
21966
|
+
userLocale: 'en'
|
|
21982
21967
|
}
|
|
21983
21968
|
},
|
|
21984
21969
|
translations: {
|
|
@@ -22117,7 +22102,8 @@ const standardState = {
|
|
|
22117
22102
|
...baseState.config,
|
|
22118
22103
|
showDisclaimer: true,
|
|
22119
22104
|
context: {
|
|
22120
|
-
contentLocale: 'nl-informal'
|
|
22105
|
+
contentLocale: 'nl-informal',
|
|
22106
|
+
userLocale: 'en-GB'
|
|
22121
22107
|
}
|
|
22122
22108
|
},
|
|
22123
22109
|
translations: {
|
|
@@ -22149,7 +22135,8 @@ const standardState = {
|
|
|
22149
22135
|
...baseState.config,
|
|
22150
22136
|
showDisclaimer: true,
|
|
22151
22137
|
context: {
|
|
22152
|
-
contentLocale: 'nl-informal'
|
|
22138
|
+
contentLocale: 'nl-informal',
|
|
22139
|
+
userLocale: 'en-GB'
|
|
22153
22140
|
}
|
|
22154
22141
|
},
|
|
22155
22142
|
translations: {
|
|
@@ -22944,7 +22931,7 @@ class SeamlyStyleGuideInstance extends Engine {
|
|
|
22944
22931
|
api.URLS = {
|
|
22945
22932
|
translations: `/client/${this.config.api.key}/translations/{version}/{locale}.json`
|
|
22946
22933
|
};
|
|
22947
|
-
const translations = await api.getTranslations(this.config.context.
|
|
22934
|
+
const translations = await api.getTranslations(this.config.context.userLocale || 'en-GB');
|
|
22948
22935
|
const {
|
|
22949
22936
|
agentParticipant,
|
|
22950
22937
|
userParticipant
|