@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
package/build/dist/lib/index.js
CHANGED
|
@@ -9288,6 +9288,12 @@ const calculateVisibility = ({
|
|
|
9288
9288
|
|
|
9289
9289
|
if (layoutMode === 'window' && hideOnNoUserResponse && requestedVisibility !== visibilityStates.open) {
|
|
9290
9290
|
return hasResponded ? requestedVisibility || previousVisibility || visibilityStates.open : visibilityStates.hidden;
|
|
9291
|
+
} // Allow users to continue a conversation (if they have responded and no visibility is requested)
|
|
9292
|
+
// when switching from the window layout to the inline layout
|
|
9293
|
+
|
|
9294
|
+
|
|
9295
|
+
if (layoutMode === 'inline' && hasResponded && !requestedVisibility) {
|
|
9296
|
+
return previousVisibility || visibilityStates.open;
|
|
9291
9297
|
}
|
|
9292
9298
|
|
|
9293
9299
|
const baseVisibility = visibilityStates.minimized;
|
|
@@ -9574,6 +9580,7 @@ const clear = interrupt_utils_createAction('clear');
|
|
|
9574
9580
|
|
|
9575
9581
|
|
|
9576
9582
|
|
|
9583
|
+
|
|
9577
9584
|
const setHasResponded = app_utils_createAction('setHasResponded', hasResponded => ({
|
|
9578
9585
|
hasResponded
|
|
9579
9586
|
}));
|
|
@@ -9642,6 +9649,13 @@ const app_actions_initialize = app_utils_createThunk('initialize', async (_, {
|
|
|
9642
9649
|
}
|
|
9643
9650
|
} else if (config !== null && config !== void 0 && (_config$context2 = config.context) !== null && _config$context2 !== void 0 && _config$context2.translationLocale) {
|
|
9644
9651
|
locale = config.context.translationLocale;
|
|
9652
|
+
api.send('action', {
|
|
9653
|
+
type: actionTypes.setTranslation,
|
|
9654
|
+
body: {
|
|
9655
|
+
enabled: true,
|
|
9656
|
+
locale
|
|
9657
|
+
}
|
|
9658
|
+
});
|
|
9645
9659
|
dispatch(enable(locale));
|
|
9646
9660
|
}
|
|
9647
9661
|
} catch (e) {
|
|
@@ -25276,7 +25290,6 @@ class API {
|
|
|
25276
25290
|
sendContext(context = {}) {
|
|
25277
25291
|
const {
|
|
25278
25292
|
locale,
|
|
25279
|
-
translationLocale,
|
|
25280
25293
|
variables
|
|
25281
25294
|
} = context;
|
|
25282
25295
|
const payload = {};
|
|
@@ -25289,14 +25302,6 @@ class API {
|
|
|
25289
25302
|
payload.locale = locale;
|
|
25290
25303
|
}
|
|
25291
25304
|
|
|
25292
|
-
if (translationLocale) {
|
|
25293
|
-
if (typeof translationLocale !== 'string') {
|
|
25294
|
-
throw new Error('Translation locale must be a string');
|
|
25295
|
-
}
|
|
25296
|
-
|
|
25297
|
-
payload.translationLocale = translationLocale;
|
|
25298
|
-
}
|
|
25299
|
-
|
|
25300
25305
|
if (variables) {
|
|
25301
25306
|
if (typeof variables !== 'object') {
|
|
25302
25307
|
throw new Error('Variables must be an object');
|
|
@@ -25321,7 +25326,7 @@ class API {
|
|
|
25321
25326
|
return {
|
|
25322
25327
|
clientName: "@seamly/web-ui",
|
|
25323
25328
|
clientVariant: this.layoutMode,
|
|
25324
|
-
clientVersion: "20.
|
|
25329
|
+
clientVersion: "20.1.0",
|
|
25325
25330
|
currentUrl: window.location.toString(),
|
|
25326
25331
|
screenResolution: `${window.screen.width}x${window.screen.height}`,
|
|
25327
25332
|
timezone: getTimeZone(),
|
|
@@ -25638,6 +25643,7 @@ class ExternalApi {
|
|
|
25638
25643
|
this._waitingActions = [];
|
|
25639
25644
|
this._instances = {};
|
|
25640
25645
|
this.appConfig = appConfig;
|
|
25646
|
+
this.context = {};
|
|
25641
25647
|
}
|
|
25642
25648
|
|
|
25643
25649
|
push(...actionObjects) {
|
|
@@ -25665,7 +25671,8 @@ class ExternalApi {
|
|
|
25665
25671
|
break;
|
|
25666
25672
|
|
|
25667
25673
|
default:
|
|
25668
|
-
if (!this.handleAction(actionObj)
|
|
25674
|
+
if (!this.handleAction(actionObj) && // Store context properties for the next instance that will be created
|
|
25675
|
+
!this.setContext(actionObj.action, ...actionObj.args)) {
|
|
25669
25676
|
this._waitingActions.push(actionObj);
|
|
25670
25677
|
}
|
|
25671
25678
|
|
|
@@ -25674,6 +25681,25 @@ class ExternalApi {
|
|
|
25674
25681
|
});
|
|
25675
25682
|
}
|
|
25676
25683
|
|
|
25684
|
+
setContext(action, args) {
|
|
25685
|
+
switch (action) {
|
|
25686
|
+
case 'setTranslation':
|
|
25687
|
+
const {
|
|
25688
|
+
enabled,
|
|
25689
|
+
locale
|
|
25690
|
+
} = args;
|
|
25691
|
+
|
|
25692
|
+
if (!!enabled && locale) {
|
|
25693
|
+
this.context.translationLocale = locale;
|
|
25694
|
+
}
|
|
25695
|
+
|
|
25696
|
+
return true;
|
|
25697
|
+
|
|
25698
|
+
default:
|
|
25699
|
+
return false;
|
|
25700
|
+
}
|
|
25701
|
+
}
|
|
25702
|
+
|
|
25677
25703
|
handleInit(actionObj) {
|
|
25678
25704
|
const userConfig = this.getUserConfig(...actionObj.args);
|
|
25679
25705
|
const config = this.getCombinedConfig(userConfig); // if this.appConfig is a function, it might return an invalid configuration (false, null, undefined)
|
|
@@ -25695,7 +25721,9 @@ class ExternalApi {
|
|
|
25695
25721
|
|
|
25696
25722
|
if (config) {
|
|
25697
25723
|
const instance = this.createInstance(config);
|
|
25698
|
-
this._instances[config.namespace] = instance;
|
|
25724
|
+
this._instances[config.namespace] = instance; // Clear the context after creating the instance, so we do not reuse it for the next
|
|
25725
|
+
|
|
25726
|
+
this.context = {};
|
|
25699
25727
|
instance.render();
|
|
25700
25728
|
}
|
|
25701
25729
|
}
|
|
@@ -25759,10 +25787,13 @@ class ExternalApi {
|
|
|
25759
25787
|
return this.appConfig(userConfig);
|
|
25760
25788
|
}
|
|
25761
25789
|
|
|
25790
|
+
const context = external_api_objectSpread(external_api_objectSpread({}, userConfig.context || this.appConfig.context), this.context);
|
|
25791
|
+
|
|
25762
25792
|
const defaults = external_api_objectSpread(external_api_objectSpread({}, this.appConfig.defaults), userConfig.defaults);
|
|
25763
25793
|
|
|
25764
25794
|
return external_api_objectSpread(external_api_objectSpread(external_api_objectSpread({}, this.appConfig), userConfig), {}, {
|
|
25765
25795
|
api: external_api_objectSpread(external_api_objectSpread({}, this.appConfig.api), userConfig.api),
|
|
25796
|
+
context: Object.keys(context).length ? context : undefined,
|
|
25766
25797
|
defaults: Object.keys(defaults).length ? defaults : undefined
|
|
25767
25798
|
});
|
|
25768
25799
|
}
|