@seamly/web-ui 20.5.0 → 20.6.0
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/CHANGELOG.md +769 -0
- package/build/dist/lib/index.debug.js +41 -41
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.debug.min.js.LICENSE.txt +4 -4
- package/build/dist/lib/index.js +411 -590
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/standalone.js +327 -733
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/style-guide.js +145 -68
- package/build/dist/lib/style-guide.min.js +1 -1
- package/package.json +1 -1
- package/src/javascripts/domains/store/index.js +11 -11
- package/src/javascripts/domains/translations/middleware.js +6 -5
- package/src/javascripts/style-guide/states.js +31 -1
- package/src/javascripts/ui/components/conversation/conversation.js +31 -26
- package/src/javascripts/ui/utils/seamly-utils.js +3 -0
- package/webpack/parts/dev-server.js +10 -1
- package/src/.DS_Store +0 -0
|
@@ -172,7 +172,8 @@ const baseState = {
|
|
|
172
172
|
},
|
|
173
173
|
currentUploads: []
|
|
174
174
|
};
|
|
175
|
-
const avatar = 'data:image/svg+xml;base64,
|
|
175
|
+
const avatar = 'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAzMiAzMiIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMzIgMzIiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8cGF0aCBmaWxsPSIjNEE0OEMxIiBkPSJNMTAsMTQuOGMtMS4xLDAtMi0wLjktMi0yczAuOS0yLDItMnMyLDAuOSwyLDJTMTEuMSwxNC44LDEwLDE0Ljh6IE0xNS45LDE0LjhjMS4xLDAsMi0wLjksMi0ycy0wLjktMi0yLTIKCXMtMiwwLjktMiwyUzE0LjgsMTQuOCwxNS45LDE0Ljh6IE0yMS44LDEwLjhjLTEuMSwwLTIsMC45LTIsMnMwLjksMiwyLDJzMi0wLjksMi0yUzIyLjksMTAuOCwyMS44LDEwLjh6IE0yMS4zLDE4LjFIMTAuNwoJQzExLjcsMjMuOSwyMC4yLDIzLjksMjEuMywxOC4xeiIvPgo8L3N2Zz4K';
|
|
176
|
+
const transferAvatar = 'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAzMiAzMiIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMzIgMzIiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8cGF0aCBmaWxsPSIjNEE0OEMxIiBkPSJNMTAuMSwxNC45Yy0xLjEsMC0yLTAuOS0yLTJzMC45LTIsMi0yczIsMC45LDIsMlMxMS4yLDE0LjksMTAuMSwxNC45eiBNMjEuOSwxMC45Yy0xLjEsMC0yLDAuOS0yLDIKCXMwLjksMiwyLDJzMi0wLjksMi0yUzIzLDEwLjksMjEuOSwxMC45eiBNMjEuNCwxOC4ySDEwLjhDMTEuOCwyNCwyMC4zLDI0LDIxLjQsMTguMnogTTE3LjIsMjUuM2gtMi40Yy0wLjYsMC0xLjIsMC40LTEuNCwxCgljLTUuMS0wLjItOS4yLTQuNC05LjQtOS42YzAuMSwwLDAuMiwwLjEsMC40LDAuMWgwLjFjMC44LDAsMS40LTAuNiwxLjQtMS40di00LjdjMC0wLjgtMC42LTEuNC0xLjQtMS40aDBjLTAuOCwwLTEuNCwwLjYtMS40LDEuNAoJdjIuN3YydjEuMWMwLDUuOSw0LjcsMTAuNiwxMC41LDEwLjhjMC4yLDAuNSwwLjcsMC44LDEuMiwwLjhoMi40YzAuOCwwLDEuNC0wLjYsMS40LTEuNFMxOCwyNS4zLDE3LjIsMjUuM3oiLz4KPC9zdmc+Cg==';
|
|
176
177
|
const participantInfo = {
|
|
177
178
|
participants: {
|
|
178
179
|
agent: {
|
|
@@ -343,6 +344,33 @@ const participantMessage = {
|
|
|
343
344
|
type: 'participant'
|
|
344
345
|
}
|
|
345
346
|
};
|
|
347
|
+
const participantTransferMessage = {
|
|
348
|
+
type: 'participant',
|
|
349
|
+
payload: {
|
|
350
|
+
fromClient: false,
|
|
351
|
+
fromHistory: true,
|
|
352
|
+
id: (0,web_ui_namespaceObject.randomId)(),
|
|
353
|
+
messageStatus: 'received',
|
|
354
|
+
participant: {
|
|
355
|
+
introduction: 'Welcome, you are now chatting with Mrs. Bot 2, give me a minit to read back the chat history.',
|
|
356
|
+
id: 'agent',
|
|
357
|
+
avatar: transferAvatar,
|
|
358
|
+
name: 'Two',
|
|
359
|
+
service: {
|
|
360
|
+
expose: {
|
|
361
|
+
map: {},
|
|
362
|
+
version: 3
|
|
363
|
+
},
|
|
364
|
+
meta: {},
|
|
365
|
+
name: 'new service',
|
|
366
|
+
serviceSessionId: (0,web_ui_namespaceObject.randomId)(),
|
|
367
|
+
settings: {}
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
transactionId: (0,web_ui_namespaceObject.randomId)(),
|
|
371
|
+
type: 'participant'
|
|
372
|
+
}
|
|
373
|
+
};
|
|
346
374
|
const participantMessageDefaultIcon = {
|
|
347
375
|
type: 'participant',
|
|
348
376
|
payload: {
|
|
@@ -1148,7 +1176,7 @@ const standardState = {
|
|
|
1148
1176
|
payload: states_objectSpread(states_objectSpread({}, choicePromptMessage.payload), {}, {
|
|
1149
1177
|
id: `${choicePromptMessage.payload.id}XXX`
|
|
1150
1178
|
})
|
|
1151
|
-
}), longTextMessage, userMessage, textMessageBoldItalicUnderline, userMessageWithLinks, newTopicDivider, imageMessage, fileDownloadAgentMessage, deletedFileDownloadAgentMessage, userMessageLong, videoMessage, textMessageWithLinks, textMessageWithLongLink, imageMessageWithLightbox, fileDownloadUserMessage, emptyUrlFileDownloadUserMessage, textMesageWithBullets, choicePromptMessage, ctaMessage]
|
|
1179
|
+
}), longTextMessage, participantTransferMessage, userMessage, textMessageBoldItalicUnderline, userMessageWithLinks, newTopicDivider, imageMessage, fileDownloadAgentMessage, deletedFileDownloadAgentMessage, userMessageLong, videoMessage, textMessageWithLinks, textMessageWithLongLink, imageMessageWithLightbox, fileDownloadUserMessage, emptyUrlFileDownloadUserMessage, textMesageWithBullets, choicePromptMessage, ctaMessage]
|
|
1152
1180
|
}),
|
|
1153
1181
|
userMessages: states_objectSpread(states_objectSpread({
|
|
1154
1182
|
category: categoryKeys.messages,
|
|
@@ -1226,7 +1254,7 @@ const standardState = {
|
|
|
1226
1254
|
type: 'text'
|
|
1227
1255
|
}
|
|
1228
1256
|
})
|
|
1229
|
-
}, participantMessage, participantMessageDefaultIcon, newTopicDivider, transcriptInfoMessage, ...[newTranslationDividerStart, newTranslationDividerStop].map(addTranslationData), infoMessage]
|
|
1257
|
+
}, participantMessage, participantMessageDefaultIcon, participantTransferMessage, newTopicDivider, transcriptInfoMessage, ...[newTranslationDividerStart, newTranslationDividerStop].map(addTranslationData), infoMessage]
|
|
1230
1258
|
}),
|
|
1231
1259
|
choicePromptMessages: states_objectSpread(states_objectSpread({
|
|
1232
1260
|
category: categoryKeys.messages,
|
|
@@ -2224,6 +2252,7 @@ function seamly_utils_objectSpread(target) { for (var i = 1; i < arguments.lengt
|
|
|
2224
2252
|
function seamly_utils_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; }
|
|
2225
2253
|
|
|
2226
2254
|
|
|
2255
|
+
|
|
2227
2256
|
const eventTypes = {
|
|
2228
2257
|
info: 'info',
|
|
2229
2258
|
message: 'message',
|
|
@@ -2547,7 +2576,10 @@ const seamlyStateReducer = (state, action) => {
|
|
|
2547
2576
|
// event optimistically.
|
|
2548
2577
|
payload: seamly_utils_objectSpread(seamly_utils_objectSpread({}, incrementUnread && {
|
|
2549
2578
|
messageStatus: payload.fromClient ? readStates.read : readStates.received
|
|
2550
|
-
}),
|
|
2579
|
+
}), {}, {
|
|
2580
|
+
// We add a randomid to use as key for mapping of Events to avoid rerendering
|
|
2581
|
+
key: id_randomId()
|
|
2582
|
+
}, payload)
|
|
2551
2583
|
})]
|
|
2552
2584
|
});
|
|
2553
2585
|
|
|
@@ -2996,7 +3028,7 @@ function createAction(type, identityReducer = payload => ({
|
|
|
2996
3028
|
|
|
2997
3029
|
action.toString = () => String(type);
|
|
2998
3030
|
|
|
2999
|
-
action.match = obj => obj
|
|
3031
|
+
action.match = obj => (obj === null || obj === void 0 ? void 0 : obj.type) === String(type);
|
|
3000
3032
|
|
|
3001
3033
|
return action;
|
|
3002
3034
|
}
|
|
@@ -3086,7 +3118,7 @@ function createThunk(type, payloadCreator) {
|
|
|
3086
3118
|
}
|
|
3087
3119
|
function createReducer(domain, handlers = {}, defaultState) {
|
|
3088
3120
|
const reducer = (state = defaultState, action) => {
|
|
3089
|
-
const typeReducer = handlers
|
|
3121
|
+
const typeReducer = handlers === null || handlers === void 0 ? void 0 : handlers[action === null || action === void 0 ? void 0 : action.type];
|
|
3090
3122
|
return typeReducer ? typeReducer(state, action) : state;
|
|
3091
3123
|
};
|
|
3092
3124
|
|
|
@@ -3517,7 +3549,7 @@ function selectors_defineProperty(obj, key, value) { if (key in obj) { Object.de
|
|
|
3517
3549
|
|
|
3518
3550
|
const selectConfig = createSelector(selectState, config => {
|
|
3519
3551
|
let newConfig = selectors_objectSpread({
|
|
3520
|
-
visible: config
|
|
3552
|
+
visible: (config === null || config === void 0 ? void 0 : config.layoutMode) === 'inline' ? constants_visibilityStates.open : constants_visibilityStates.minimized,
|
|
3521
3553
|
appContainerClassNames: config.appContainerClassNames || []
|
|
3522
3554
|
}, config);
|
|
3523
3555
|
|
|
@@ -3609,6 +3641,8 @@ function hooks_useSelector(selector, deps = []) {
|
|
|
3609
3641
|
useLayoutEffect(() => {
|
|
3610
3642
|
// we subscribe to the store changes
|
|
3611
3643
|
return store.subscribe(() => {
|
|
3644
|
+
var _selectorRef$current;
|
|
3645
|
+
|
|
3612
3646
|
const newState = store.getState(); // prevent recalculating if the state hasn't changed
|
|
3613
3647
|
// if the selector changed, it was already handled synchronously
|
|
3614
3648
|
|
|
@@ -3617,7 +3651,7 @@ function hooks_useSelector(selector, deps = []) {
|
|
|
3617
3651
|
} // calculate the new value based on selector+state
|
|
3618
3652
|
|
|
3619
3653
|
|
|
3620
|
-
const newValue = selectorRef.current
|
|
3654
|
+
const newValue = (_selectorRef$current = selectorRef.current) === null || _selectorRef$current === void 0 ? void 0 : _selectorRef$current.call(selectorRef, store.getState()); // only if the value changed we update. this saves heaps of re-rendering
|
|
3621
3655
|
|
|
3622
3656
|
if (newValue !== valueRef.current) {
|
|
3623
3657
|
valueRef.current = newValue;
|
|
@@ -3680,7 +3714,9 @@ const selectEventsWithSuggestion = createSelector(seamly_state_hooks_selectState
|
|
|
3680
3714
|
events,
|
|
3681
3715
|
serviceData
|
|
3682
3716
|
}, config, userHasResponded) => {
|
|
3683
|
-
|
|
3717
|
+
var _serviceData$suggesti;
|
|
3718
|
+
|
|
3719
|
+
if (userHasResponded || config.layoutMode === 'inline' || !serviceData.suggestion || !((_serviceData$suggesti = serviceData.suggestion) !== null && _serviceData$suggesti !== void 0 && _serviceData$suggesti.body.length)) {
|
|
3684
3720
|
return events;
|
|
3685
3721
|
}
|
|
3686
3722
|
|
|
@@ -3691,10 +3727,12 @@ const selectEventsWithSuggestion = createSelector(seamly_state_hooks_selectState
|
|
|
3691
3727
|
return [...events, suggestionsEvent];
|
|
3692
3728
|
});
|
|
3693
3729
|
const selectEvents = createSelector(selectEventsWithSuggestion, selectConfig, (events, config) => {
|
|
3730
|
+
var _config$messages;
|
|
3731
|
+
|
|
3694
3732
|
const {
|
|
3695
3733
|
enabled,
|
|
3696
3734
|
threshold
|
|
3697
|
-
} = config
|
|
3735
|
+
} = (config === null || config === void 0 ? void 0 : (_config$messages = config.messages) === null || _config$messages === void 0 ? void 0 : _config$messages.timeIndicator) ?? {};
|
|
3698
3736
|
|
|
3699
3737
|
if (!enabled) {
|
|
3700
3738
|
return events;
|
|
@@ -3728,8 +3766,10 @@ const seamly_state_hooks_useSkiplink = () => seamly_state_hooks_useSeamlyStateCo
|
|
|
3728
3766
|
const useSeamlyParticipant = participantId => seamly_state_hooks_useSeamlyStateContext().participantInfo.participants[participantId];
|
|
3729
3767
|
const useSeamlyServiceInfo = () => seamly_state_hooks_useSeamlyStateContext().serviceInfo;
|
|
3730
3768
|
const selectLastMessageEventId = createSelector(selectEvents, events => {
|
|
3769
|
+
var _filteredEvents;
|
|
3770
|
+
|
|
3731
3771
|
const filteredEvents = events.filter(event => event.type === 'message');
|
|
3732
|
-
return filteredEvents[filteredEvents.length - 1]
|
|
3772
|
+
return (_filteredEvents = filteredEvents[filteredEvents.length - 1]) === null || _filteredEvents === void 0 ? void 0 : _filteredEvents.payload.id;
|
|
3733
3773
|
});
|
|
3734
3774
|
const useLastMessageEventId = () => useSelector(selectLastMessageEventId);
|
|
3735
3775
|
const useSeamlyIsHistoryLoaded = () => seamly_state_hooks_useSeamlyStateContext().historyLoaded;
|
|
@@ -3898,11 +3938,13 @@ const actions_initialize = visibility_utils_createThunk('initialize', async (loc
|
|
|
3898
3938
|
api
|
|
3899
3939
|
}
|
|
3900
3940
|
}) => {
|
|
3941
|
+
var _api$store$get;
|
|
3942
|
+
|
|
3901
3943
|
// initialize stored visibility
|
|
3902
3944
|
const {
|
|
3903
3945
|
layoutMode
|
|
3904
3946
|
} = selectConfig(getState());
|
|
3905
|
-
const storedVisibility = api.store.get(StoreKey)
|
|
3947
|
+
const storedVisibility = (_api$store$get = api.store.get(StoreKey)) === null || _api$store$get === void 0 ? void 0 : _api$store$get[layoutMode];
|
|
3906
3948
|
|
|
3907
3949
|
if (storedVisibility) {
|
|
3908
3950
|
dispatch(setFromStorage(storedVisibility));
|
|
@@ -3940,13 +3982,13 @@ class SeamlyBaseError extends Error {
|
|
|
3940
3982
|
|
|
3941
3983
|
this.originalError = originalError;
|
|
3942
3984
|
|
|
3943
|
-
if (originalError
|
|
3985
|
+
if (originalError !== null && originalError !== void 0 && originalError.payload) {
|
|
3944
3986
|
this.originalEvent = originalError;
|
|
3945
3987
|
this.originalError = originalError.payload.error;
|
|
3946
3988
|
this.message = `Event of type ${originalError.payload.type} encountered`;
|
|
3947
3989
|
}
|
|
3948
3990
|
|
|
3949
|
-
if (originalError
|
|
3991
|
+
if (originalError !== null && originalError !== void 0 && originalError.error) {
|
|
3950
3992
|
this.originalError = originalError.error;
|
|
3951
3993
|
}
|
|
3952
3994
|
}
|
|
@@ -3995,8 +4037,10 @@ const app_actions_initialize = app_utils_createThunk('initialize', async (_, {
|
|
|
3995
4037
|
config
|
|
3996
4038
|
}
|
|
3997
4039
|
}) => {
|
|
4040
|
+
var _config$context;
|
|
4041
|
+
|
|
3998
4042
|
dispatch(initialize(config));
|
|
3999
|
-
let locale = config
|
|
4043
|
+
let locale = config === null || config === void 0 ? void 0 : (_config$context = config.context) === null || _config$context === void 0 ? void 0 : _config$context.locale;
|
|
4000
4044
|
|
|
4001
4045
|
try {
|
|
4002
4046
|
const {
|
|
@@ -4023,7 +4067,7 @@ const app_actions_initialize = app_utils_createThunk('initialize', async (_, {
|
|
|
4023
4067
|
startChatIcon
|
|
4024
4068
|
}));
|
|
4025
4069
|
|
|
4026
|
-
if (agentParticipant
|
|
4070
|
+
if (agentParticipant !== null && agentParticipant !== void 0 && agentParticipant.name) {
|
|
4027
4071
|
dispatch({
|
|
4028
4072
|
type: seamly_utils_seamlyActions.SET_HEADER_SUB_TITLE,
|
|
4029
4073
|
title: agentParticipant.name
|
|
@@ -4035,18 +4079,22 @@ const app_actions_initialize = app_utils_createThunk('initialize', async (_, {
|
|
|
4035
4079
|
|
|
4036
4080
|
try {
|
|
4037
4081
|
if (api.hasConversation()) {
|
|
4082
|
+
var _initialState$transla;
|
|
4083
|
+
|
|
4038
4084
|
const initialState = await api.getConversationIntitialState();
|
|
4039
4085
|
dispatch({
|
|
4040
4086
|
type: seamly_utils_seamlyActions.SET_INITIAL_STATE,
|
|
4041
4087
|
initialState
|
|
4042
4088
|
});
|
|
4043
|
-
locale = initialState.translation
|
|
4089
|
+
locale = ((_initialState$transla = initialState.translation) === null || _initialState$transla === void 0 ? void 0 : _initialState$transla.locale) || locale;
|
|
4044
4090
|
|
|
4045
4091
|
if ('userResponded' in initialState) {
|
|
4046
4092
|
dispatch(actions_setHasResponded(initialState.userResponded));
|
|
4047
4093
|
}
|
|
4048
4094
|
} else {
|
|
4049
|
-
|
|
4095
|
+
var _config$context2, _config$context3;
|
|
4096
|
+
|
|
4097
|
+
if (config !== null && config !== void 0 && (_config$context2 = config.context) !== null && _config$context2 !== void 0 && _config$context2.topic) {
|
|
4050
4098
|
api.send('action', {
|
|
4051
4099
|
type: seamly_utils_actionTypes.setTopic,
|
|
4052
4100
|
body: {
|
|
@@ -4058,7 +4106,7 @@ const app_actions_initialize = app_utils_createThunk('initialize', async (_, {
|
|
|
4058
4106
|
});
|
|
4059
4107
|
}
|
|
4060
4108
|
|
|
4061
|
-
if (config
|
|
4109
|
+
if (config !== null && config !== void 0 && (_config$context3 = config.context) !== null && _config$context3 !== void 0 && _config$context3.translationLocale) {
|
|
4062
4110
|
locale = config.context.translationLocale;
|
|
4063
4111
|
api.send('action', {
|
|
4064
4112
|
type: seamly_utils_actionTypes.setTranslation,
|
|
@@ -4166,7 +4214,9 @@ function utils_validate(values, schema = {}) {
|
|
|
4166
4214
|
validations = [validations];
|
|
4167
4215
|
}
|
|
4168
4216
|
|
|
4169
|
-
for (let i = 0; i < validations
|
|
4217
|
+
for (let i = 0; i < ((_validations = validations) === null || _validations === void 0 ? void 0 : _validations.length) ?? 0; i++) {
|
|
4218
|
+
var _validations;
|
|
4219
|
+
|
|
4170
4220
|
if (!validations[i].fn(values[key], validations[i].compareValue)) {
|
|
4171
4221
|
errors[key] = validations[i].errorText;
|
|
4172
4222
|
break;
|
|
@@ -4226,7 +4276,7 @@ const getPropSelector = (propName, orDefault) => (_, props) => props[propName] |
|
|
|
4226
4276
|
|
|
4227
4277
|
const getState = forms_utils_selectState;
|
|
4228
4278
|
const selectors_getFormById = createSelector(getState, getPropSelector('formId'), (forms, formId) => forms[formId]);
|
|
4229
|
-
const getFormControlsByFormId = createSelector(selectors_getFormById, form => form
|
|
4279
|
+
const getFormControlsByFormId = createSelector(selectors_getFormById, form => (form === null || form === void 0 ? void 0 : form.controls) || {});
|
|
4230
4280
|
const selectors_getFormValuesByFormId = createSelector(getFormControlsByFormId, controls => {
|
|
4231
4281
|
const valuesObj = {};
|
|
4232
4282
|
Object.entries(controls).forEach(([key, {
|
|
@@ -4236,8 +4286,16 @@ const selectors_getFormValuesByFormId = createSelector(getFormControlsByFormId,
|
|
|
4236
4286
|
});
|
|
4237
4287
|
return valuesObj;
|
|
4238
4288
|
});
|
|
4239
|
-
const selectors_getControlValueByName = createSelector(getFormControlsByFormId, getPropSelector('name'), (controls, name) =>
|
|
4240
|
-
|
|
4289
|
+
const selectors_getControlValueByName = createSelector(getFormControlsByFormId, getPropSelector('name'), (controls, name) => {
|
|
4290
|
+
var _controls$name;
|
|
4291
|
+
|
|
4292
|
+
return (_controls$name = controls[name]) === null || _controls$name === void 0 ? void 0 : _controls$name.value;
|
|
4293
|
+
});
|
|
4294
|
+
const selectors_getControlTouchedByName = createSelector(getFormControlsByFormId, getPropSelector('name'), (controls, name) => {
|
|
4295
|
+
var _controls$name2;
|
|
4296
|
+
|
|
4297
|
+
return (_controls$name2 = controls[name]) === null || _controls$name2 === void 0 ? void 0 : _controls$name2.touched;
|
|
4298
|
+
});
|
|
4241
4299
|
;// CONCATENATED MODULE: ./src/javascripts/domains/forms/context.js
|
|
4242
4300
|
|
|
4243
4301
|
const context_FormContext = (0,external_preact_namespaceObject.createContext)({});
|
|
@@ -4297,7 +4355,7 @@ function hooks_useFormControl(name) {
|
|
|
4297
4355
|
formId,
|
|
4298
4356
|
name
|
|
4299
4357
|
}, [formId, name]);
|
|
4300
|
-
const error = errors
|
|
4358
|
+
const error = errors === null || errors === void 0 ? void 0 : errors[name];
|
|
4301
4359
|
const isValid = !error;
|
|
4302
4360
|
useEffect(() => {
|
|
4303
4361
|
// Make sure the form is registered
|
|
@@ -4399,9 +4457,11 @@ function provider_FormProvider(_ref) {
|
|
|
4399
4457
|
});
|
|
4400
4458
|
}, [setExternalErrors]);
|
|
4401
4459
|
const handleSubmit = useCallback(e => {
|
|
4460
|
+
var _e$submitter;
|
|
4461
|
+
|
|
4402
4462
|
e.preventDefault(); // If the submitter is set to being aria-disabled, block the submit action
|
|
4403
4463
|
|
|
4404
|
-
const ariaDisabled = e.submitter
|
|
4464
|
+
const ariaDisabled = ((_e$submitter = e.submitter) === null || _e$submitter === void 0 ? void 0 : _e$submitter.ariaDisabled) === 'true';
|
|
4405
4465
|
setIsSubmitted(!ariaDisabled);
|
|
4406
4466
|
|
|
4407
4467
|
if (!ariaDisabled && validationIsValid) {
|
|
@@ -4468,7 +4528,9 @@ const initialControlState = {
|
|
|
4468
4528
|
};
|
|
4469
4529
|
|
|
4470
4530
|
function updateFormControl(state, formId, name, controlState) {
|
|
4471
|
-
|
|
4531
|
+
var _state$formId;
|
|
4532
|
+
|
|
4533
|
+
const currentControlState = ((_state$formId = state[formId]) === null || _state$formId === void 0 ? void 0 : _state$formId.controls[name]) || initialControlState;
|
|
4472
4534
|
return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
|
|
4473
4535
|
[formId]: reducer_objectSpread(reducer_objectSpread({}, state[formId]), {}, {
|
|
4474
4536
|
controls: reducer_objectSpread(reducer_objectSpread({}, state[formId].controls), {}, {
|
|
@@ -4496,9 +4558,11 @@ function updateFormControl(state, formId, name, controlState) {
|
|
|
4496
4558
|
[deregisterForm]: (state, {
|
|
4497
4559
|
formId
|
|
4498
4560
|
}) => {
|
|
4561
|
+
var _newState$formId;
|
|
4562
|
+
|
|
4499
4563
|
const newState = reducer_objectSpread({}, state);
|
|
4500
4564
|
|
|
4501
|
-
if (!newState[formId]
|
|
4565
|
+
if (!((_newState$formId = newState[formId]) !== null && _newState$formId !== void 0 && _newState$formId.persistData)) {
|
|
4502
4566
|
delete newState[formId];
|
|
4503
4567
|
}
|
|
4504
4568
|
|
|
@@ -5962,13 +6026,13 @@ const useIntersect = ({
|
|
|
5962
6026
|
}) => {
|
|
5963
6027
|
const [entry, setEntry] = useState(null);
|
|
5964
6028
|
const containerRef = useRef(null);
|
|
5965
|
-
const isVisible = !!entry
|
|
6029
|
+
const isVisible = !!(entry !== null && entry !== void 0 && entry.isIntersecting) || !enabled;
|
|
5966
6030
|
const frozen = isVisible && freezeOnceVisible;
|
|
5967
6031
|
|
|
5968
6032
|
const observerCallback = ([updatedEntry]) => setEntry(updatedEntry);
|
|
5969
6033
|
|
|
5970
6034
|
useEffect(() => {
|
|
5971
|
-
const node = containerRef
|
|
6035
|
+
const node = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current;
|
|
5972
6036
|
const hasIOSupport = !!window.IntersectionObserver;
|
|
5973
6037
|
|
|
5974
6038
|
if (!node && "production" === 'development') {} // Return an arrow function to have a consistent return value
|
|
@@ -6910,19 +6974,21 @@ function hooks_useTranslations() {
|
|
|
6910
6974
|
function useTranslatedEventData({
|
|
6911
6975
|
payload
|
|
6912
6976
|
} = {}) {
|
|
6913
|
-
|
|
6977
|
+
var _translatedBody, _translatedBody2, _translatedBody3;
|
|
6978
|
+
|
|
6979
|
+
const payloadId = payload === null || payload === void 0 ? void 0 : payload.id;
|
|
6914
6980
|
let body;
|
|
6915
6981
|
let translatedBody;
|
|
6916
6982
|
|
|
6917
|
-
switch (payload
|
|
6983
|
+
switch (payload === null || payload === void 0 ? void 0 : payload.type) {
|
|
6918
6984
|
case 'participant':
|
|
6919
6985
|
body = payload.participant.introduction;
|
|
6920
6986
|
translatedBody = payload.participant.translatedIntroduction;
|
|
6921
6987
|
break;
|
|
6922
6988
|
|
|
6923
6989
|
default:
|
|
6924
|
-
body = payload
|
|
6925
|
-
translatedBody = payload
|
|
6990
|
+
body = payload === null || payload === void 0 ? void 0 : payload.body;
|
|
6991
|
+
translatedBody = payload === null || payload === void 0 ? void 0 : payload.translatedBody;
|
|
6926
6992
|
}
|
|
6927
6993
|
|
|
6928
6994
|
const hasTranslation = !!translatedBody;
|
|
@@ -6937,12 +7003,12 @@ function useTranslatedEventData({
|
|
|
6937
7003
|
dispatch(Actions.enableEvent(payloadId));
|
|
6938
7004
|
}
|
|
6939
7005
|
}, [isTranslated, payloadId, dispatch]);
|
|
6940
|
-
return [hasTranslation && isTranslated ? translatedBody
|
|
7006
|
+
return [hasTranslation && isTranslated ? (_translatedBody = translatedBody) === null || _translatedBody === void 0 ? void 0 : _translatedBody.data : body, {
|
|
6941
7007
|
hasTranslation,
|
|
6942
7008
|
isTranslated: isTranslated && hasTranslation,
|
|
6943
7009
|
toggleTranslation,
|
|
6944
|
-
translatedBy: translatedBody
|
|
6945
|
-
locale: translatedBody
|
|
7010
|
+
translatedBy: (_translatedBody2 = translatedBody) === null || _translatedBody2 === void 0 ? void 0 : _translatedBody2.translatedBy,
|
|
7011
|
+
locale: (_translatedBody3 = translatedBody) === null || _translatedBody3 === void 0 ? void 0 : _translatedBody3.locale
|
|
6946
7012
|
}];
|
|
6947
7013
|
}
|
|
6948
7014
|
function hooks_useTranslationsContainer() {
|
|
@@ -6957,49 +7023,58 @@ function hooks_useLocaleNativeName(locale) {
|
|
|
6957
7023
|
const {
|
|
6958
7024
|
languages
|
|
6959
7025
|
} = hooks_useTranslations();
|
|
6960
|
-
return useMemo(() =>
|
|
7026
|
+
return useMemo(() => {
|
|
7027
|
+
var _languages$find;
|
|
7028
|
+
|
|
7029
|
+
return languages === null || languages === void 0 ? void 0 : (_languages$find = languages.find(lang => lang.locale === locale)) === null || _languages$find === void 0 ? void 0 : _languages$find.nativeName;
|
|
7030
|
+
}, [locale, languages]);
|
|
6961
7031
|
}
|
|
6962
7032
|
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/middleware.js
|
|
6963
7033
|
|
|
6964
7034
|
|
|
6965
7035
|
|
|
6966
|
-
function middleware_createMiddleware(
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
7036
|
+
function middleware_createMiddleware({
|
|
7037
|
+
dispatch,
|
|
7038
|
+
getState
|
|
7039
|
+
}) {
|
|
7040
|
+
return next => {
|
|
7041
|
+
return action => {
|
|
7042
|
+
var _action$history, _action$history$trans, _action$initialState, _action$initialState$, _action$event, _action$event$payload, _action$event$payload2;
|
|
6972
7043
|
|
|
6973
|
-
|
|
6974
|
-
case String(seamlyActions.SET_HISTORY):
|
|
6975
|
-
if (action.history?.translation?.enabled) {
|
|
6976
|
-
dispatch(Actions.enable(action.history.translation.locale));
|
|
6977
|
-
}
|
|
7044
|
+
const result = next(action);
|
|
6978
7045
|
|
|
6979
|
-
|
|
7046
|
+
switch (action.type) {
|
|
7047
|
+
case String(seamlyActions.SET_HISTORY):
|
|
7048
|
+
if ((_action$history = action.history) !== null && _action$history !== void 0 && (_action$history$trans = _action$history.translation) !== null && _action$history$trans !== void 0 && _action$history$trans.enabled) {
|
|
7049
|
+
dispatch(Actions.enable(action.history.translation.locale));
|
|
7050
|
+
dispatch(I18nActions.setLocale(action.history.translation.locale));
|
|
7051
|
+
}
|
|
6980
7052
|
|
|
6981
|
-
|
|
6982
|
-
if (action.initialState?.translation?.enabled) {
|
|
6983
|
-
dispatch(Actions.enable(action.initialState.translation.locale));
|
|
6984
|
-
dispatch(I18nActions.setLocale(action.locale));
|
|
6985
|
-
}
|
|
7053
|
+
break;
|
|
6986
7054
|
|
|
6987
|
-
|
|
7055
|
+
case String(seamlyActions.SET_INITIAL_STATE):
|
|
7056
|
+
if ((_action$initialState = action.initialState) !== null && _action$initialState !== void 0 && (_action$initialState$ = _action$initialState.translation) !== null && _action$initialState$ !== void 0 && _action$initialState$.enabled) {
|
|
7057
|
+
dispatch(Actions.enable(action.initialState.translation.locale));
|
|
7058
|
+
dispatch(I18nActions.setLocale(action.locale));
|
|
7059
|
+
}
|
|
6988
7060
|
|
|
6989
|
-
|
|
6990
|
-
if (action.event.type === 'info' && action.event?.payload?.body?.subtype === 'new_translation' && action.event.payload.body.translationEnabled) {
|
|
6991
|
-
dispatch(I18nActions.setLocale(action.event.payload.body.translationLocale));
|
|
6992
|
-
}
|
|
7061
|
+
break;
|
|
6993
7062
|
|
|
6994
|
-
|
|
7063
|
+
case String(seamlyActions.ADD_EVENT):
|
|
7064
|
+
if (action.event.type === 'info' && ((_action$event = action.event) === null || _action$event === void 0 ? void 0 : (_action$event$payload = _action$event.payload) === null || _action$event$payload === void 0 ? void 0 : (_action$event$payload2 = _action$event$payload.body) === null || _action$event$payload2 === void 0 ? void 0 : _action$event$payload2.subtype) === 'new_translation' && action.event.payload.body.translationEnabled) {
|
|
7065
|
+
dispatch(I18nActions.setLocale(action.event.payload.body.translationLocale));
|
|
7066
|
+
}
|
|
6995
7067
|
|
|
6996
|
-
|
|
6997
|
-
const initialLocale = I18nSelectors.selectInitialLocale(getState());
|
|
6998
|
-
dispatch(I18nActions.setLocale(initialLocale));
|
|
6999
|
-
break;
|
|
7000
|
-
}
|
|
7068
|
+
break;
|
|
7001
7069
|
|
|
7002
|
-
|
|
7070
|
+
case String(Actions.disable):
|
|
7071
|
+
const initialLocale = I18nSelectors.selectInitialLocale(getState());
|
|
7072
|
+
dispatch(I18nActions.setLocale(initialLocale));
|
|
7073
|
+
break;
|
|
7074
|
+
}
|
|
7075
|
+
|
|
7076
|
+
return result;
|
|
7077
|
+
};
|
|
7003
7078
|
};
|
|
7004
7079
|
}
|
|
7005
7080
|
;// CONCATENATED MODULE: ./src/javascripts/domains/translations/reducer.js
|
|
@@ -7024,7 +7099,9 @@ const translations_reducer_initialState = {
|
|
|
7024
7099
|
};
|
|
7025
7100
|
/* harmony default export */ const translations_reducer = (translations_utils_createReducer({
|
|
7026
7101
|
[seamly_utils_seamlyActions.SET_FEATURES]: (state, action) => {
|
|
7027
|
-
|
|
7102
|
+
var _action$features;
|
|
7103
|
+
|
|
7104
|
+
const feature = action === null || action === void 0 ? void 0 : (_action$features = action.features) === null || _action$features === void 0 ? void 0 : _action$features.translation;
|
|
7028
7105
|
|
|
7029
7106
|
if (!feature) {
|
|
7030
7107
|
return state;
|
|
@@ -8423,7 +8500,7 @@ const StyleGuideApp = ({
|
|
|
8423
8500
|
showFaq
|
|
8424
8501
|
}),
|
|
8425
8502
|
headerTitles: app_objectSpread(app_objectSpread({}, bareState.headerTitles), {}, {
|
|
8426
|
-
subTitle: agent
|
|
8503
|
+
subTitle: (agent === null || agent === void 0 ? void 0 : agent.name) || bareState.headerTitles.subTitle
|
|
8427
8504
|
})
|
|
8428
8505
|
});
|
|
8429
8506
|
|