@seamly/web-ui 20.2.0-alpha.1 → 20.2.0-alpha.2
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/deprecated-view.css +1 -1
- package/build/dist/lib/index.debug.js +4 -4
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.js +43 -12
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/standalone.js +43 -12
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/style-guide.js +14 -0
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/styles.css +1 -1
- package/package.json +2 -2
- package/src/javascripts/api/index.js +1 -7
- package/src/javascripts/domains/app/actions.js +5 -0
- package/src/javascripts/domains/visibility/utils.js +6 -0
- package/src/javascripts/lib/external-api/index.js +27 -1
- package/src/stylesheets/5-components/_message-translation-info.scss +4 -0
- package/src/stylesheets/7-deprecated/5-components/_message.scss +4 -0
|
@@ -17027,6 +17027,12 @@ const calculateVisibility = ({
|
|
|
17027
17027
|
|
|
17028
17028
|
if (layoutMode === 'window' && hideOnNoUserResponse && requestedVisibility !== visibilityStates.open) {
|
|
17029
17029
|
return hasResponded ? requestedVisibility || previousVisibility || visibilityStates.open : visibilityStates.hidden;
|
|
17030
|
+
} // Allow users to continue a conversation (if they have responded and no visibility is requested)
|
|
17031
|
+
// when switching from the window layout to the inline layout
|
|
17032
|
+
|
|
17033
|
+
|
|
17034
|
+
if (layoutMode === 'inline' && hasResponded && !requestedVisibility) {
|
|
17035
|
+
return previousVisibility || visibilityStates.open;
|
|
17030
17036
|
}
|
|
17031
17037
|
|
|
17032
17038
|
const baseVisibility = visibilityStates.minimized;
|
|
@@ -17338,6 +17344,7 @@ const clear = interrupt_utils_createAction('clear');
|
|
|
17338
17344
|
|
|
17339
17345
|
|
|
17340
17346
|
|
|
17347
|
+
|
|
17341
17348
|
const setHasResponded = app_utils_createAction('setHasResponded', hasResponded => ({
|
|
17342
17349
|
hasResponded
|
|
17343
17350
|
}));
|
|
@@ -17406,6 +17413,13 @@ const app_actions_initialize = app_utils_createThunk('initialize', async (_, {
|
|
|
17406
17413
|
}
|
|
17407
17414
|
} else if (config !== null && config !== void 0 && (_config$context2 = config.context) !== null && _config$context2 !== void 0 && _config$context2.translationLocale) {
|
|
17408
17415
|
locale = config.context.translationLocale;
|
|
17416
|
+
api.send('action', {
|
|
17417
|
+
type: actionTypes.setTranslation,
|
|
17418
|
+
body: {
|
|
17419
|
+
enabled: true,
|
|
17420
|
+
locale
|
|
17421
|
+
}
|
|
17422
|
+
});
|
|
17409
17423
|
dispatch(enable(locale));
|
|
17410
17424
|
}
|
|
17411
17425
|
} catch (e) {
|
|
@@ -33635,7 +33649,6 @@ class API {
|
|
|
33635
33649
|
sendContext(context = {}) {
|
|
33636
33650
|
const {
|
|
33637
33651
|
locale,
|
|
33638
|
-
translationLocale,
|
|
33639
33652
|
variables
|
|
33640
33653
|
} = context;
|
|
33641
33654
|
const payload = {};
|
|
@@ -33648,14 +33661,6 @@ class API {
|
|
|
33648
33661
|
payload.locale = locale;
|
|
33649
33662
|
}
|
|
33650
33663
|
|
|
33651
|
-
if (translationLocale) {
|
|
33652
|
-
if (typeof translationLocale !== 'string') {
|
|
33653
|
-
throw new Error('Translation locale must be a string');
|
|
33654
|
-
}
|
|
33655
|
-
|
|
33656
|
-
payload.translationLocale = translationLocale;
|
|
33657
|
-
}
|
|
33658
|
-
|
|
33659
33664
|
if (variables) {
|
|
33660
33665
|
if (typeof variables !== 'object') {
|
|
33661
33666
|
throw new Error('Variables must be an object');
|
|
@@ -33682,7 +33687,7 @@ class API {
|
|
|
33682
33687
|
return {
|
|
33683
33688
|
clientName: "@seamly/web-ui",
|
|
33684
33689
|
clientVariant: this.layoutMode,
|
|
33685
|
-
clientVersion: "20.
|
|
33690
|
+
clientVersion: "20.1.0",
|
|
33686
33691
|
currentUrl: window.location.toString(),
|
|
33687
33692
|
screenResolution: `${window.screen.width}x${window.screen.height}`,
|
|
33688
33693
|
timezone: getTimeZone(),
|
|
@@ -34028,6 +34033,7 @@ class ExternalApi {
|
|
|
34028
34033
|
this._waitingActions = [];
|
|
34029
34034
|
this._instances = {};
|
|
34030
34035
|
this.appConfig = appConfig;
|
|
34036
|
+
this.context = {};
|
|
34031
34037
|
}
|
|
34032
34038
|
|
|
34033
34039
|
push(...actionObjects) {
|
|
@@ -34058,7 +34064,8 @@ class ExternalApi {
|
|
|
34058
34064
|
break;
|
|
34059
34065
|
|
|
34060
34066
|
default:
|
|
34061
|
-
if (!this.handleAction(actionObj)
|
|
34067
|
+
if (!this.handleAction(actionObj) && // Store context properties for the next instance that will be created
|
|
34068
|
+
!this.setContext(actionObj.action, ...actionObj.args)) {
|
|
34062
34069
|
this._waitingActions.push(actionObj);
|
|
34063
34070
|
}
|
|
34064
34071
|
|
|
@@ -34067,6 +34074,25 @@ class ExternalApi {
|
|
|
34067
34074
|
});
|
|
34068
34075
|
}
|
|
34069
34076
|
|
|
34077
|
+
setContext(action, args) {
|
|
34078
|
+
switch (action) {
|
|
34079
|
+
case 'setTranslation':
|
|
34080
|
+
const {
|
|
34081
|
+
enabled,
|
|
34082
|
+
locale
|
|
34083
|
+
} = args;
|
|
34084
|
+
|
|
34085
|
+
if (!!enabled && locale) {
|
|
34086
|
+
this.context.translationLocale = locale;
|
|
34087
|
+
}
|
|
34088
|
+
|
|
34089
|
+
return true;
|
|
34090
|
+
|
|
34091
|
+
default:
|
|
34092
|
+
return false;
|
|
34093
|
+
}
|
|
34094
|
+
}
|
|
34095
|
+
|
|
34070
34096
|
handleInit(actionObj) {
|
|
34071
34097
|
const userConfig = this.getUserConfig(...actionObj.args);
|
|
34072
34098
|
const config = this.getCombinedConfig(userConfig); // if this.appConfig is a function, it might return an invalid configuration (false, null, undefined)
|
|
@@ -34090,7 +34116,9 @@ class ExternalApi {
|
|
|
34090
34116
|
|
|
34091
34117
|
if (config) {
|
|
34092
34118
|
const instance = this.createInstance(config);
|
|
34093
|
-
this._instances[config.namespace] = instance;
|
|
34119
|
+
this._instances[config.namespace] = instance; // Clear the context after creating the instance, so we do not reuse it for the next
|
|
34120
|
+
|
|
34121
|
+
this.context = {};
|
|
34094
34122
|
instance.render();
|
|
34095
34123
|
}
|
|
34096
34124
|
}
|
|
@@ -34158,10 +34186,13 @@ class ExternalApi {
|
|
|
34158
34186
|
return this.appConfig(userConfig);
|
|
34159
34187
|
}
|
|
34160
34188
|
|
|
34189
|
+
const context = external_api_objectSpread(external_api_objectSpread({}, userConfig.context || this.appConfig.context), this.context);
|
|
34190
|
+
|
|
34161
34191
|
const defaults = external_api_objectSpread(external_api_objectSpread({}, this.appConfig.defaults), userConfig.defaults);
|
|
34162
34192
|
|
|
34163
34193
|
return external_api_objectSpread(external_api_objectSpread(external_api_objectSpread({}, this.appConfig), userConfig), {}, {
|
|
34164
34194
|
api: external_api_objectSpread(external_api_objectSpread({}, this.appConfig.api), userConfig.api),
|
|
34195
|
+
context: keys_default()(context).length ? context : undefined,
|
|
34165
34196
|
defaults: keys_default()(defaults).length ? defaults : undefined
|
|
34166
34197
|
});
|
|
34167
34198
|
}
|