@seamly/web-ui 21.0.8 → 21.0.9
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 +222 -224
- package/build/dist/lib/components.min.js +1 -1
- package/build/dist/lib/hooks.js +114 -9
- package/build/dist/lib/hooks.min.js +1 -1
- package/build/dist/lib/index.debug.js +49 -38
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.debug.min.js.LICENSE.txt +5 -1
- package/build/dist/lib/index.js +206 -213
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/standalone.js +213 -244
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/style-guide.js +192 -184
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/utils.js +190 -182
- package/build/dist/lib/utils.min.js +1 -1
- package/package.json +1 -1
- package/src/javascripts/domains/forms/provider.tsx +1 -1
- package/src/javascripts/domains/i18n/slice.ts +2 -0
- package/src/javascripts/domains/interrupt/hooks.ts +15 -7
- package/src/javascripts/domains/interrupt/selectors.ts +4 -0
- package/src/javascripts/domains/interrupt/slice.ts +2 -2
- package/src/javascripts/domains/translations/components/translation-status.tsx +4 -3
- package/src/javascripts/domains/translations/slice.ts +2 -0
- package/src/javascripts/ui/components/app-options/index.js +4 -3
- package/src/javascripts/ui/components/core/seamly-event-subscriber.ts +9 -13
- package/src/javascripts/ui/components/core/seamly-instance-functions-loader.js +5 -5
- package/src/javascripts/ui/components/entry/deprecated-toggle-button.js +4 -3
- package/src/javascripts/ui/components/faq/faq.js +5 -4
- package/src/javascripts/ui/components/layout/agent-info.js +4 -3
- package/src/javascripts/ui/components/layout/chat-frame.js +7 -8
- package/src/javascripts/ui/components/layout/deprecated-chat-frame.js +7 -8
- package/src/javascripts/ui/components/layout/interrupt.js +6 -15
- package/src/javascripts/ui/components/layout/pre-chat-messages.js +4 -3
- package/src/javascripts/ui/components/suggestions/index.js +5 -4
- package/src/javascripts/ui/components/translation-chat-status/index.tsx +4 -3
- package/src/javascripts/ui/components/view/app-view.js +1 -2
- package/src/javascripts/ui/components/view/deprecated-view.js +1 -2
- package/src/javascripts/ui/components/view/inline-view.js +1 -11
- package/src/javascripts/ui/components/view/window-view/index.js +1 -9
- package/src/javascripts/ui/components/view/window-view/window-open-button.js +4 -3
- package/src/javascripts/ui/hooks/{use-seamly-chat.js → use-seamly-chat.ts} +5 -1
- package/src/javascripts/ui/hooks/use-session-expired-command.ts +17 -0
- package/src/.DS_Store +0 -0
package/build/dist/lib/utils.js
CHANGED
|
@@ -7393,7 +7393,7 @@ _API_ready = new WeakMap(), _API_externalId = new WeakMap(), _API_layoutMode = n
|
|
|
7393
7393
|
return {
|
|
7394
7394
|
clientName: "@seamly/web-ui",
|
|
7395
7395
|
clientVariant: api_classPrivateFieldGet(this, _API_layoutMode, "f"),
|
|
7396
|
-
clientVersion: "21.0.
|
|
7396
|
+
clientVersion: "21.0.9",
|
|
7397
7397
|
currentUrl: window.location.toString(),
|
|
7398
7398
|
screenResolution: `${window.screen.width}x${window.screen.height}`,
|
|
7399
7399
|
timezone: getTimeZone(),
|
|
@@ -11729,7 +11729,7 @@ const interruptSlice = createSlice({
|
|
|
11729
11729
|
clearInterrupt: () => slice_initialState
|
|
11730
11730
|
},
|
|
11731
11731
|
extraReducers: builder => {
|
|
11732
|
-
builder.addCase(
|
|
11732
|
+
builder.addCase(initializeConfig.pending, () => slice_initialState).addMatcher(isAnyOf(initializeApp.rejected, initializeConfig.rejected, setLocale.rejected, setVisibility.rejected, initializeVisibility.rejected), (state, {
|
|
11733
11733
|
payload
|
|
11734
11734
|
}) => {
|
|
11735
11735
|
state.error = payload;
|
|
@@ -12605,6 +12605,7 @@ const {
|
|
|
12605
12605
|
|
|
12606
12606
|
|
|
12607
12607
|
|
|
12608
|
+
|
|
12608
12609
|
const i18n_slice_initialState = {
|
|
12609
12610
|
translations: {
|
|
12610
12611
|
'errors.configError.message': 'We are sorry this happened, please retry at a later time.',
|
|
@@ -12641,7 +12642,7 @@ const i18nSlice = createSlice({
|
|
|
12641
12642
|
},
|
|
12642
12643
|
extraReducers: builder => {
|
|
12643
12644
|
// Add reducers for additional action types here, and handle loading state as needed
|
|
12644
|
-
builder.addCase(initializeConfig.fulfilled, (state, {
|
|
12645
|
+
builder.addCase(resetApp.pending, () => i18n_slice_initialState).addCase(initializeConfig.fulfilled, (state, {
|
|
12645
12646
|
payload
|
|
12646
12647
|
}) => {
|
|
12647
12648
|
state.initialLocale = payload.locale;
|
|
@@ -12744,6 +12745,7 @@ const selectIsLoading = es_createSelector(({
|
|
|
12744
12745
|
|
|
12745
12746
|
|
|
12746
12747
|
|
|
12748
|
+
|
|
12747
12749
|
const translationsInitialState = {
|
|
12748
12750
|
isActive: false,
|
|
12749
12751
|
currentLocale: undefined,
|
|
@@ -12834,7 +12836,7 @@ const translationSlice = createSlice({
|
|
|
12834
12836
|
}
|
|
12835
12837
|
},
|
|
12836
12838
|
extraReducers: builder => {
|
|
12837
|
-
builder.addCase(initializeConfig.fulfilled, (state, {
|
|
12839
|
+
builder.addCase(resetApp.pending, () => translationsInitialState).addCase(initializeConfig.fulfilled, (state, {
|
|
12838
12840
|
payload
|
|
12839
12841
|
}) => {
|
|
12840
12842
|
var _a;
|
|
@@ -14021,7 +14023,109 @@ const useLiveRegion = () => {
|
|
|
14021
14023
|
sendAssertive
|
|
14022
14024
|
};
|
|
14023
14025
|
};
|
|
14024
|
-
;// CONCATENATED MODULE: ./src/javascripts/
|
|
14026
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/selectors.ts
|
|
14027
|
+
|
|
14028
|
+
const selectError = es_createSelector(({
|
|
14029
|
+
interrupt
|
|
14030
|
+
}) => interrupt, ({
|
|
14031
|
+
error
|
|
14032
|
+
}) => error);
|
|
14033
|
+
const selectHasError = es_createSelector(selectError, error => Boolean(error));
|
|
14034
|
+
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/hooks.ts
|
|
14035
|
+
|
|
14036
|
+
|
|
14037
|
+
|
|
14038
|
+
|
|
14039
|
+
function useInterrupt() {
|
|
14040
|
+
const {
|
|
14041
|
+
t
|
|
14042
|
+
} = useI18n();
|
|
14043
|
+
const error = useSelector_useSelector(selectError);
|
|
14044
|
+
const hasError = useSelector_useSelector(selectHasError);
|
|
14045
|
+
const meta = (0,hooks_.useMemo)(() => {
|
|
14046
|
+
if (!hasError) {
|
|
14047
|
+
return {
|
|
14048
|
+
title: undefined,
|
|
14049
|
+
message: undefined,
|
|
14050
|
+
srText: undefined,
|
|
14051
|
+
buttonText: undefined,
|
|
14052
|
+
originalError: undefined
|
|
14053
|
+
};
|
|
14054
|
+
}
|
|
14055
|
+
const {
|
|
14056
|
+
langKey,
|
|
14057
|
+
action
|
|
14058
|
+
} = error;
|
|
14059
|
+
const title = t(`${langKey}.title`);
|
|
14060
|
+
const message = t(`${langKey}.message`);
|
|
14061
|
+
const srText = t(`${langKey}.srText`);
|
|
14062
|
+
const buttonText = t(`${langKey}.buttonText`);
|
|
14063
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, langKey ? {
|
|
14064
|
+
title,
|
|
14065
|
+
message,
|
|
14066
|
+
srText
|
|
14067
|
+
} : {}), action ? {
|
|
14068
|
+
action
|
|
14069
|
+
} : {}), action && langKey ? {
|
|
14070
|
+
buttonText
|
|
14071
|
+
} : {}), {
|
|
14072
|
+
originalError: error
|
|
14073
|
+
});
|
|
14074
|
+
}, [hasError, error, t]);
|
|
14075
|
+
return {
|
|
14076
|
+
hasError,
|
|
14077
|
+
meta,
|
|
14078
|
+
error
|
|
14079
|
+
};
|
|
14080
|
+
}
|
|
14081
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-session-expired-command.ts
|
|
14082
|
+
|
|
14083
|
+
|
|
14084
|
+
|
|
14085
|
+
function useSessionExpiredCommand() {
|
|
14086
|
+
const {
|
|
14087
|
+
meta: {
|
|
14088
|
+
originalError,
|
|
14089
|
+
action
|
|
14090
|
+
}
|
|
14091
|
+
} = useInterrupt();
|
|
14092
|
+
const seamlyCommands = use_seamly_commands();
|
|
14093
|
+
const isExpiredError = (originalError === null || originalError === void 0 ? void 0 : originalError.name) === 'SeamlySessionExpiredError';
|
|
14094
|
+
(0,hooks_.useEffect)(() => {
|
|
14095
|
+
if (isExpiredError && seamlyCommands[action]) {
|
|
14096
|
+
seamlyCommands[action]();
|
|
14097
|
+
}
|
|
14098
|
+
}, [action, seamlyCommands, isExpiredError]);
|
|
14099
|
+
}
|
|
14100
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/use-seamly-chat.ts
|
|
14101
|
+
var use_seamly_chat_awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
14102
|
+
function adopt(value) {
|
|
14103
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
14104
|
+
resolve(value);
|
|
14105
|
+
});
|
|
14106
|
+
}
|
|
14107
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14108
|
+
function fulfilled(value) {
|
|
14109
|
+
try {
|
|
14110
|
+
step(generator.next(value));
|
|
14111
|
+
} catch (e) {
|
|
14112
|
+
reject(e);
|
|
14113
|
+
}
|
|
14114
|
+
}
|
|
14115
|
+
function rejected(value) {
|
|
14116
|
+
try {
|
|
14117
|
+
step(generator["throw"](value));
|
|
14118
|
+
} catch (e) {
|
|
14119
|
+
reject(e);
|
|
14120
|
+
}
|
|
14121
|
+
}
|
|
14122
|
+
function step(result) {
|
|
14123
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
14124
|
+
}
|
|
14125
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14126
|
+
});
|
|
14127
|
+
};
|
|
14128
|
+
|
|
14025
14129
|
|
|
14026
14130
|
|
|
14027
14131
|
|
|
@@ -14060,6 +14164,8 @@ const useSeamlyChat = () => {
|
|
|
14060
14164
|
const {
|
|
14061
14165
|
sendAssertive
|
|
14062
14166
|
} = useLiveRegion();
|
|
14167
|
+
// Automatically reset conversation if the session has expired
|
|
14168
|
+
useSessionExpiredCommand();
|
|
14063
14169
|
(0,hooks_.useEffect)(() => {
|
|
14064
14170
|
if (isVisible) {
|
|
14065
14171
|
// Wait for the live containers to stabilise in the DOM before injecting
|
|
@@ -14106,24 +14212,23 @@ const useSeamlyChat = () => {
|
|
|
14106
14212
|
connectCalled.current = false;
|
|
14107
14213
|
}
|
|
14108
14214
|
}, [apiConfigReady, apiConnected]);
|
|
14109
|
-
const connectAndStart = (0,hooks_.useCallback)(
|
|
14215
|
+
const connectAndStart = (0,hooks_.useCallback)(() => use_seamly_chat_awaiter(void 0, void 0, void 0, function* () {
|
|
14110
14216
|
// We don't connect if we are already connected to the api to avoid multiple in-flight connection processes.
|
|
14111
14217
|
if (!apiConnected) {
|
|
14112
14218
|
connectCalled.current = true;
|
|
14113
|
-
|
|
14219
|
+
yield connect();
|
|
14114
14220
|
}
|
|
14115
|
-
|
|
14116
14221
|
// We only start a conversation when the chat interface is either app, 'open' or if using the inline view if it's 'open' or 'minimized'.
|
|
14117
14222
|
if (isApp || isOpen || isVisible && isInline) {
|
|
14118
14223
|
start();
|
|
14119
14224
|
}
|
|
14120
|
-
}, [apiConnected, connect, isApp, isInline, isOpen, isVisible, start]);
|
|
14225
|
+
}), [apiConnected, connect, isApp, isInline, isOpen, isVisible, start]);
|
|
14121
14226
|
(0,hooks_.useEffect)(() => {
|
|
14122
14227
|
// We dont't connect or start when the apiConfig is not ready yet.
|
|
14123
14228
|
// We also keep track of whether start has been called to avoid multiple in-flight connection processes.
|
|
14124
14229
|
// We check if the window view is not open and no conversation is started yet.
|
|
14125
14230
|
// Lastly we check if the inline view is not scrolled in to view.
|
|
14126
|
-
if (!apiConfigReady || connectCalled.current || isWindow && !isOpen
|
|
14231
|
+
if (!apiConfigReady || connectCalled.current || isWindow && !isOpen || isInline && (!isVisible || !showInlineView)) {
|
|
14127
14232
|
return;
|
|
14128
14233
|
}
|
|
14129
14234
|
if (hasConversation() && isOpen) {
|
|
@@ -17997,7 +18102,7 @@ const SeamlyEventSubscriber = () => {
|
|
|
17997
18102
|
channel === null || channel === void 0 ? void 0 : channel.leave();
|
|
17998
18103
|
};
|
|
17999
18104
|
}
|
|
18000
|
-
return () =>
|
|
18105
|
+
return () => undefined;
|
|
18001
18106
|
}, [api, api.connectionInfo, api.conversation]);
|
|
18002
18107
|
(0,hooks_.useEffect)(() => {
|
|
18003
18108
|
api.conversation.onConnection(({
|
|
@@ -18180,6 +18285,9 @@ const SeamlyEventSubscriber = () => {
|
|
|
18180
18285
|
const {
|
|
18181
18286
|
channel
|
|
18182
18287
|
} = api.conversation;
|
|
18288
|
+
if (messageChannelRef.current) {
|
|
18289
|
+
channel === null || channel === void 0 ? void 0 : channel.off('message', messageChannelRef.current);
|
|
18290
|
+
}
|
|
18183
18291
|
messageChannelRef.current = channel.on('message', payload => {
|
|
18184
18292
|
if (!EMITTABLE_MESSAGE_TYPES.includes(payload.type)) {
|
|
18185
18293
|
return payload;
|
|
@@ -18196,19 +18304,18 @@ const SeamlyEventSubscriber = () => {
|
|
|
18196
18304
|
});
|
|
18197
18305
|
return true;
|
|
18198
18306
|
});
|
|
18199
|
-
return () => {
|
|
18200
|
-
var _a;
|
|
18201
|
-
(_a = api.conversation.channel) === null || _a === void 0 ? void 0 : _a.off('message', messageChannelRef.current);
|
|
18202
|
-
};
|
|
18203
18307
|
}
|
|
18204
|
-
return () => undefined;
|
|
18205
18308
|
}, [api, api.connectionInfo, api.conversation.channel, eventBus]);
|
|
18206
18309
|
(0,hooks_.useEffect)(() => {
|
|
18207
18310
|
if (api.connectionInfo) {
|
|
18208
18311
|
api.conversation.onConnection(({
|
|
18209
18312
|
connected
|
|
18210
18313
|
}) => {
|
|
18314
|
+
var _a;
|
|
18211
18315
|
if (!connected) return false;
|
|
18316
|
+
if (syncChannelRef.current) {
|
|
18317
|
+
(_a = api.conversation.channel) === null || _a === void 0 ? void 0 : _a.off('sync', syncChannelRef.current);
|
|
18318
|
+
}
|
|
18212
18319
|
syncChannelRef.current = api.conversation.channel.on('sync', payload => {
|
|
18213
18320
|
var _a;
|
|
18214
18321
|
const lastEvent = events[events.length - 1];
|
|
@@ -18232,12 +18339,7 @@ const SeamlyEventSubscriber = () => {
|
|
|
18232
18339
|
});
|
|
18233
18340
|
return true;
|
|
18234
18341
|
});
|
|
18235
|
-
return () => {
|
|
18236
|
-
var _a;
|
|
18237
|
-
(_a = api.conversation.channel) === null || _a === void 0 ? void 0 : _a.off('sync', syncChannelRef.current);
|
|
18238
|
-
};
|
|
18239
18342
|
}
|
|
18240
|
-
return () => undefined;
|
|
18241
18343
|
}, [api, api.connectionInfo, api.conversation.channel, events, dispatch]);
|
|
18242
18344
|
return null;
|
|
18243
18345
|
};
|
|
@@ -18373,52 +18475,6 @@ const SeamlyInitializer = () => {
|
|
|
18373
18475
|
return null;
|
|
18374
18476
|
};
|
|
18375
18477
|
/* harmony default export */ const seamly_initializer = (SeamlyInitializer);
|
|
18376
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/selectors.ts
|
|
18377
|
-
|
|
18378
|
-
const selectError = es_createSelector(({
|
|
18379
|
-
interrupt
|
|
18380
|
-
}) => interrupt, ({
|
|
18381
|
-
error
|
|
18382
|
-
}) => error);
|
|
18383
|
-
;// CONCATENATED MODULE: ./src/javascripts/domains/interrupt/hooks.ts
|
|
18384
|
-
|
|
18385
|
-
|
|
18386
|
-
|
|
18387
|
-
|
|
18388
|
-
function useInterrupt() {
|
|
18389
|
-
const {
|
|
18390
|
-
t
|
|
18391
|
-
} = useI18n();
|
|
18392
|
-
const error = useSelector_useSelector(selectError);
|
|
18393
|
-
const hasInterrupt = Boolean(error);
|
|
18394
|
-
const meta = (0,hooks_.useMemo)(() => {
|
|
18395
|
-
if (!error) return {};
|
|
18396
|
-
const {
|
|
18397
|
-
langKey,
|
|
18398
|
-
action
|
|
18399
|
-
} = error;
|
|
18400
|
-
const title = t(`${langKey}.title`);
|
|
18401
|
-
const message = t(`${langKey}.message`);
|
|
18402
|
-
const srText = t(`${langKey}.srText`);
|
|
18403
|
-
const buttonText = t(`${langKey}.buttonText`);
|
|
18404
|
-
return Object.assign(Object.assign(Object.assign(Object.assign({}, langKey ? {
|
|
18405
|
-
title,
|
|
18406
|
-
message,
|
|
18407
|
-
srText
|
|
18408
|
-
} : {}), action ? {
|
|
18409
|
-
action
|
|
18410
|
-
} : {}), action && langKey ? {
|
|
18411
|
-
buttonText
|
|
18412
|
-
} : {}), {
|
|
18413
|
-
originalError: error
|
|
18414
|
-
});
|
|
18415
|
-
}, [t, error]);
|
|
18416
|
-
return {
|
|
18417
|
-
hasInterrupt,
|
|
18418
|
-
meta,
|
|
18419
|
-
error
|
|
18420
|
-
};
|
|
18421
|
-
}
|
|
18422
18478
|
;// CONCATENATED MODULE: ./src/javascripts/ui/components/core/seamly-instance-functions-loader.js
|
|
18423
18479
|
|
|
18424
18480
|
|
|
@@ -18468,9 +18524,7 @@ const SeamlyInstanceFunctionsLoader = () => {
|
|
|
18468
18524
|
isInline,
|
|
18469
18525
|
isResolving
|
|
18470
18526
|
} = useSeamlyLayoutMode();
|
|
18471
|
-
const
|
|
18472
|
-
hasInterrupt
|
|
18473
|
-
} = useInterrupt();
|
|
18527
|
+
const hasError = useSelector_useSelector(selectHasError);
|
|
18474
18528
|
const currentConversationUrl = useSeamlyConversationUrl();
|
|
18475
18529
|
const prevConversationUrl = (0,hooks_.useRef)(null);
|
|
18476
18530
|
const onActivityHandler = use_seamly_activity_event_handler();
|
|
@@ -18550,7 +18604,7 @@ const SeamlyInstanceFunctionsLoader = () => {
|
|
|
18550
18604
|
}
|
|
18551
18605
|
}, [api.send]);
|
|
18552
18606
|
(0,hooks_.useEffect)(() => {
|
|
18553
|
-
if (!isResolving && !
|
|
18607
|
+
if (!isResolving && !hasError) {
|
|
18554
18608
|
// Check for app reset
|
|
18555
18609
|
if (prevConversationUrl.current && prevConversationUrl.current !== currentConversationUrl) {
|
|
18556
18610
|
eventBus.emit('unreadMessageCount', unreadCount);
|
|
@@ -18569,7 +18623,7 @@ const SeamlyInstanceFunctionsLoader = () => {
|
|
|
18569
18623
|
previousUnreadCount.current = unreadCount;
|
|
18570
18624
|
prevConversationUrl.current = currentConversationUrl;
|
|
18571
18625
|
}
|
|
18572
|
-
}, [unreadCount, visible, eventBus, isInline, isResolving,
|
|
18626
|
+
}, [unreadCount, visible, eventBus, isInline, isResolving, hasError, currentConversationUrl]);
|
|
18573
18627
|
return null;
|
|
18574
18628
|
};
|
|
18575
18629
|
/* harmony default export */ const seamly_instance_functions_loader = (SeamlyInstanceFunctionsLoader);
|
|
@@ -19046,6 +19100,7 @@ const InOutTransition = ({
|
|
|
19046
19100
|
|
|
19047
19101
|
|
|
19048
19102
|
|
|
19103
|
+
|
|
19049
19104
|
|
|
19050
19105
|
|
|
19051
19106
|
const Suggestions = ({
|
|
@@ -19077,9 +19132,7 @@ const Suggestions = ({
|
|
|
19077
19132
|
sendPolite
|
|
19078
19133
|
} = useLiveRegion();
|
|
19079
19134
|
// interrupt & countdown hooks
|
|
19080
|
-
const
|
|
19081
|
-
hasInterrupt
|
|
19082
|
-
} = useInterrupt();
|
|
19135
|
+
const hasError = useSelector_useSelector(selectHasError);
|
|
19083
19136
|
const {
|
|
19084
19137
|
hasCountdown,
|
|
19085
19138
|
endCountdown
|
|
@@ -19096,7 +19149,7 @@ const Suggestions = ({
|
|
|
19096
19149
|
} = useTranslatedEventData({
|
|
19097
19150
|
payload
|
|
19098
19151
|
});
|
|
19099
|
-
const suggestions = (0,hooks_.useMemo)(() => payload && !
|
|
19152
|
+
const suggestions = (0,hooks_.useMemo)(() => payload && !hasError ? eventBody : [], [payload, hasError, eventBody]);
|
|
19100
19153
|
const prevSuggestions = (0,hooks_.useRef)(null);
|
|
19101
19154
|
const prevHasSuggestions = (0,hooks_.useRef)(false);
|
|
19102
19155
|
const previousRenderedSuggestions = (0,hooks_.useRef)([]);
|
|
@@ -19548,10 +19601,9 @@ function FormProvider(_a) {
|
|
|
19548
19601
|
});
|
|
19549
19602
|
}, [setExternalErrors]);
|
|
19550
19603
|
const handleSubmit = (0,hooks_.useCallback)((e) => {
|
|
19551
|
-
var _a;
|
|
19552
19604
|
e.preventDefault();
|
|
19553
19605
|
// If the submitter is set to being aria-disabled, block the submit action
|
|
19554
|
-
const ariaDisabled =
|
|
19606
|
+
const ariaDisabled = e.submitter.getAttribute('aria-disabled') === 'true';
|
|
19555
19607
|
setIsSubmitted(!ariaDisabled);
|
|
19556
19608
|
if (!ariaDisabled && validationIsValid) {
|
|
19557
19609
|
dispatch(setHasResponded(true));
|
|
@@ -20226,6 +20278,7 @@ function TranslationsOptionsButton({ children, position = {
|
|
|
20226
20278
|
|
|
20227
20279
|
|
|
20228
20280
|
|
|
20281
|
+
|
|
20229
20282
|
function AppOptions() {
|
|
20230
20283
|
const {
|
|
20231
20284
|
menuOptions,
|
|
@@ -20234,15 +20287,13 @@ function AppOptions() {
|
|
|
20234
20287
|
const {
|
|
20235
20288
|
isAvailable: isTranslationsAvailable
|
|
20236
20289
|
} = useTranslations();
|
|
20237
|
-
const
|
|
20238
|
-
hasInterrupt
|
|
20239
|
-
} = useInterrupt();
|
|
20290
|
+
const hasError = useSelector_useSelector(selectHasError);
|
|
20240
20291
|
const {
|
|
20241
20292
|
t,
|
|
20242
20293
|
locale
|
|
20243
20294
|
} = useI18n();
|
|
20244
20295
|
const localeNativeName = useLocaleNativeName(locale);
|
|
20245
|
-
if (!isTranslationsAvailable && (!allowOptionSelection || !menuOptions.length) ||
|
|
20296
|
+
if (!isTranslationsAvailable && (!allowOptionSelection || !menuOptions.length) || hasError) {
|
|
20246
20297
|
return null;
|
|
20247
20298
|
}
|
|
20248
20299
|
const openButtonText = t('translations.settings.openButtonText', {
|
|
@@ -21504,10 +21555,11 @@ const ChatStatus = ({ children, handleClose, title, closeButtonText, srCloseButt
|
|
|
21504
21555
|
|
|
21505
21556
|
|
|
21506
21557
|
|
|
21558
|
+
|
|
21507
21559
|
function TranslationChatStatus() {
|
|
21508
21560
|
const { t } = useI18n();
|
|
21509
21561
|
const { id } = useTranslationsContainer();
|
|
21510
|
-
const
|
|
21562
|
+
const hasError = useSelector_useSelector(selectHasError);
|
|
21511
21563
|
const { disableTranslations, currentLocale } = useTranslations();
|
|
21512
21564
|
const localeNativeName = useLocaleNativeName(currentLocale);
|
|
21513
21565
|
const focusSkiplinkTarget = useSkiplinkTargetFocusing();
|
|
@@ -21516,7 +21568,7 @@ function TranslationChatStatus() {
|
|
|
21516
21568
|
disableTranslations();
|
|
21517
21569
|
focusSkiplinkTarget();
|
|
21518
21570
|
}, [disableTranslations, focusSkiplinkTarget]);
|
|
21519
|
-
if (
|
|
21571
|
+
if (hasError) {
|
|
21520
21572
|
return null;
|
|
21521
21573
|
}
|
|
21522
21574
|
return ((0,jsx_runtime_namespaceObject.jsx)(chat_status, { handleClose: handleClickStop, title: label, id: id, closeButtonText: t('translations.status.stopText'), srCloseButtonText: t('translations.status.srStopText') }));
|
|
@@ -21549,24 +21601,17 @@ function TranslationProposal() {
|
|
|
21549
21601
|
|
|
21550
21602
|
|
|
21551
21603
|
|
|
21604
|
+
|
|
21552
21605
|
function TranslationStatus() {
|
|
21553
|
-
const
|
|
21606
|
+
const hasError = useSelector_useSelector(selectHasError);
|
|
21554
21607
|
const { isActive } = useTranslations();
|
|
21555
|
-
if (
|
|
21608
|
+
if (hasError) {
|
|
21556
21609
|
return null;
|
|
21557
21610
|
}
|
|
21558
21611
|
return !isActive ? (0,jsx_runtime_namespaceObject.jsx)(TranslationProposal, {}) : (0,jsx_runtime_namespaceObject.jsx)(TranslationChatStatus, {});
|
|
21559
21612
|
}
|
|
21560
21613
|
|
|
21561
|
-
;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/
|
|
21562
|
-
function chat_frame_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21563
|
-
function chat_frame_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? chat_frame_ownKeys(Object(source), !0).forEach(function (key) { chat_frame_defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : chat_frame_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21564
|
-
function chat_frame_defineProperty(obj, key, value) { key = chat_frame_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21565
|
-
function chat_frame_toPropertyKey(arg) { var key = chat_frame_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
21566
|
-
function chat_frame_toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
21567
|
-
|
|
21568
|
-
|
|
21569
|
-
|
|
21614
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/interrupt.js
|
|
21570
21615
|
|
|
21571
21616
|
|
|
21572
21617
|
|
|
@@ -21575,61 +21620,24 @@ function chat_frame_toPrimitive(input, hint) { if (typeof input !== "object" ||
|
|
|
21575
21620
|
|
|
21576
21621
|
|
|
21577
21622
|
|
|
21578
|
-
|
|
21579
|
-
children,
|
|
21580
|
-
interruptComponent: InterruptComponent
|
|
21581
|
-
}) {
|
|
21582
|
-
const {
|
|
21583
|
-
hasInterrupt,
|
|
21584
|
-
meta
|
|
21585
|
-
} = useInterrupt();
|
|
21623
|
+
const Interrupt = () => {
|
|
21586
21624
|
const {
|
|
21587
|
-
|
|
21588
|
-
|
|
21589
|
-
|
|
21590
|
-
|
|
21591
|
-
|
|
21625
|
+
meta: {
|
|
21626
|
+
originalError,
|
|
21627
|
+
title,
|
|
21628
|
+
message,
|
|
21629
|
+
buttonText,
|
|
21630
|
+
action,
|
|
21631
|
+
srText
|
|
21592
21632
|
}
|
|
21593
|
-
|
|
21594
|
-
}
|
|
21595
|
-
return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
21596
|
-
children: [(0,jsx_runtime_namespaceObject.jsxs)(chat_scroll_provider, {
|
|
21597
|
-
children: [(0,jsx_runtime_namespaceObject.jsxs)("div", {
|
|
21598
|
-
className: css_className('chat__container__header'),
|
|
21599
|
-
children: [(0,jsx_runtime_namespaceObject.jsx)(TranslationStatus, {}), (0,jsx_runtime_namespaceObject.jsx)(collapse_button, {})]
|
|
21600
|
-
}), children]
|
|
21601
|
-
}), (0,jsx_runtime_namespaceObject.jsx)(entry_container, {}), isOpen && (0,jsx_runtime_namespaceObject.jsx)(AppOptions, {})]
|
|
21602
|
-
});
|
|
21603
|
-
}
|
|
21604
|
-
/* harmony default export */ const chat_frame = (ChatFrame);
|
|
21605
|
-
;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/interrupt.js
|
|
21606
|
-
|
|
21607
|
-
|
|
21608
|
-
|
|
21609
|
-
|
|
21610
|
-
|
|
21611
|
-
|
|
21612
|
-
|
|
21613
|
-
const Interrupt = ({
|
|
21614
|
-
originalError,
|
|
21615
|
-
title,
|
|
21616
|
-
message,
|
|
21617
|
-
buttonText,
|
|
21618
|
-
action,
|
|
21619
|
-
srText
|
|
21620
|
-
}) => {
|
|
21633
|
+
} = useInterrupt();
|
|
21621
21634
|
const seamlyCommands = use_seamly_commands();
|
|
21622
21635
|
const headingId = useGeneratedId();
|
|
21623
21636
|
const {
|
|
21624
21637
|
sendPolite
|
|
21625
21638
|
} = useLiveRegion();
|
|
21626
21639
|
const focusSkiplinkTarget = useSkiplinkTargetFocusing();
|
|
21627
|
-
const isExpiredError = originalError
|
|
21628
|
-
(0,hooks_.useEffect)(() => {
|
|
21629
|
-
if (isExpiredError && seamlyCommands[action]) {
|
|
21630
|
-
seamlyCommands[action]();
|
|
21631
|
-
}
|
|
21632
|
-
}, [action, seamlyCommands, isExpiredError]);
|
|
21640
|
+
const isExpiredError = originalError?.name === 'SeamlySessionExpiredError';
|
|
21633
21641
|
(0,hooks_.useEffect)(() => {
|
|
21634
21642
|
if (!isExpiredError && srText) {
|
|
21635
21643
|
// Wait for live regions to stabilise in case this occurs
|
|
@@ -21670,16 +21678,48 @@ const Interrupt = ({
|
|
|
21670
21678
|
}) : (0,jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {});
|
|
21671
21679
|
};
|
|
21672
21680
|
/* harmony default export */ const interrupt = (Interrupt);
|
|
21673
|
-
;// CONCATENATED MODULE: ./src/javascripts/ui/components/
|
|
21681
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/components/layout/chat-frame.js
|
|
21682
|
+
|
|
21674
21683
|
|
|
21675
21684
|
|
|
21676
21685
|
|
|
21677
21686
|
|
|
21678
21687
|
|
|
21688
|
+
|
|
21689
|
+
|
|
21690
|
+
|
|
21691
|
+
|
|
21692
|
+
|
|
21693
|
+
|
|
21694
|
+
|
|
21695
|
+
function ChatFrame({
|
|
21696
|
+
children
|
|
21697
|
+
}) {
|
|
21698
|
+
const hasError = useSelector_useSelector(selectHasError);
|
|
21699
|
+
const {
|
|
21700
|
+
isOpen
|
|
21701
|
+
} = useVisibility();
|
|
21702
|
+
if (hasError) {
|
|
21703
|
+
return (0,jsx_runtime_namespaceObject.jsx)(interrupt, {});
|
|
21704
|
+
}
|
|
21705
|
+
return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
21706
|
+
children: [(0,jsx_runtime_namespaceObject.jsxs)(chat_scroll_provider, {
|
|
21707
|
+
children: [(0,jsx_runtime_namespaceObject.jsxs)("div", {
|
|
21708
|
+
className: css_className('chat__container__header'),
|
|
21709
|
+
children: [(0,jsx_runtime_namespaceObject.jsx)(TranslationStatus, {}), (0,jsx_runtime_namespaceObject.jsx)(collapse_button, {})]
|
|
21710
|
+
}), children]
|
|
21711
|
+
}), (0,jsx_runtime_namespaceObject.jsx)(entry_container, {}), isOpen && (0,jsx_runtime_namespaceObject.jsx)(AppOptions, {})]
|
|
21712
|
+
});
|
|
21713
|
+
}
|
|
21714
|
+
/* harmony default export */ const chat_frame = (ChatFrame);
|
|
21715
|
+
;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/app-view.js
|
|
21716
|
+
|
|
21717
|
+
|
|
21718
|
+
|
|
21719
|
+
|
|
21679
21720
|
const AppView = () => {
|
|
21680
21721
|
return (0,jsx_runtime_namespaceObject.jsx)(chat, {
|
|
21681
21722
|
children: (0,jsx_runtime_namespaceObject.jsx)(chat_frame, {
|
|
21682
|
-
interruptComponent: interrupt,
|
|
21683
21723
|
children: (0,jsx_runtime_namespaceObject.jsx)(conversation, {})
|
|
21684
21724
|
})
|
|
21685
21725
|
});
|
|
@@ -21692,6 +21732,7 @@ const AppView = () => {
|
|
|
21692
21732
|
|
|
21693
21733
|
|
|
21694
21734
|
|
|
21735
|
+
|
|
21695
21736
|
function PreChatMessageEvent({
|
|
21696
21737
|
event
|
|
21697
21738
|
}) {
|
|
@@ -21705,13 +21746,11 @@ function PreChatMessages() {
|
|
|
21705
21746
|
preChatEvents,
|
|
21706
21747
|
layoutMode
|
|
21707
21748
|
} = useConfig();
|
|
21708
|
-
const
|
|
21709
|
-
hasInterrupt
|
|
21710
|
-
} = useInterrupt();
|
|
21749
|
+
const hasError = useSelector_useSelector(selectHasError);
|
|
21711
21750
|
const {
|
|
21712
21751
|
isOpen
|
|
21713
21752
|
} = useVisibility();
|
|
21714
|
-
const isVisible = !(
|
|
21753
|
+
const isVisible = !(hasError || !preChatEvents?.length || isOpen);
|
|
21715
21754
|
return isVisible && (0,jsx_runtime_namespaceObject.jsx)("ul", {
|
|
21716
21755
|
className: css_className('pre-chat-messages', `pre-chat-messages--${layoutMode}`),
|
|
21717
21756
|
"aria-hidden": !isVisible,
|
|
@@ -21724,13 +21763,6 @@ function PreChatMessages() {
|
|
|
21724
21763
|
});
|
|
21725
21764
|
}
|
|
21726
21765
|
;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/inline-view.js
|
|
21727
|
-
function inline_view_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21728
|
-
function inline_view_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? inline_view_ownKeys(Object(source), !0).forEach(function (key) { inline_view_defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : inline_view_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21729
|
-
function inline_view_defineProperty(obj, key, value) { key = inline_view_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21730
|
-
function inline_view_toPropertyKey(arg) { var key = inline_view_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
21731
|
-
function inline_view_toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
21732
|
-
|
|
21733
|
-
|
|
21734
21766
|
|
|
21735
21767
|
|
|
21736
21768
|
|
|
@@ -21750,13 +21782,6 @@ const InlineView = () => {
|
|
|
21750
21782
|
const {
|
|
21751
21783
|
isOpen
|
|
21752
21784
|
} = useVisibility();
|
|
21753
|
-
const {
|
|
21754
|
-
hasInterrupt,
|
|
21755
|
-
meta
|
|
21756
|
-
} = useInterrupt();
|
|
21757
|
-
if (hasInterrupt && !isOpen) {
|
|
21758
|
-
return (0,jsx_runtime_namespaceObject.jsx)(interrupt, inline_view_objectSpread({}, meta));
|
|
21759
|
-
}
|
|
21760
21785
|
return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
21761
21786
|
children: [(0,jsx_runtime_namespaceObject.jsx)(in_out_transition, {
|
|
21762
21787
|
isActive: !isOpen,
|
|
@@ -21772,7 +21797,6 @@ const InlineView = () => {
|
|
|
21772
21797
|
children: (0,jsx_runtime_namespaceObject.jsx)(chat, {
|
|
21773
21798
|
ref: containerRef,
|
|
21774
21799
|
children: showInlineView && (0,jsx_runtime_namespaceObject.jsx)(chat_frame, {
|
|
21775
|
-
interruptComponent: interrupt,
|
|
21776
21800
|
children: isOpen && (0,jsx_runtime_namespaceObject.jsx)(conversation, {})
|
|
21777
21801
|
})
|
|
21778
21802
|
})
|
|
@@ -21794,13 +21818,12 @@ const InlineView = () => {
|
|
|
21794
21818
|
|
|
21795
21819
|
|
|
21796
21820
|
|
|
21821
|
+
|
|
21797
21822
|
const ButtonIcon = () => {
|
|
21798
21823
|
const startChatIcon = useStartChatIcon();
|
|
21799
21824
|
const currentAgent = useSeamlyCurrentAgent();
|
|
21800
|
-
const
|
|
21801
|
-
|
|
21802
|
-
} = useInterrupt();
|
|
21803
|
-
const isActiveConversation = currentAgent && !hasInterrupt;
|
|
21825
|
+
const hasError = useSelector_useSelector(selectHasError);
|
|
21826
|
+
const isActiveConversation = currentAgent && !hasError;
|
|
21804
21827
|
const src = isActiveConversation ? currentAgent.avatar : startChatIcon;
|
|
21805
21828
|
return src ? (0,jsx_runtime_namespaceObject.jsx)("img", {
|
|
21806
21829
|
className: css_className(isActiveConversation ? 'avatar' : 'icon'),
|
|
@@ -21846,13 +21869,6 @@ const WindowOpenButton = ({
|
|
|
21846
21869
|
};
|
|
21847
21870
|
/* harmony default export */ const window_open_button = (WindowOpenButton);
|
|
21848
21871
|
;// CONCATENATED MODULE: ./src/javascripts/ui/components/view/window-view/index.js
|
|
21849
|
-
function window_view_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21850
|
-
function window_view_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? window_view_ownKeys(Object(source), !0).forEach(function (key) { window_view_defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : window_view_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21851
|
-
function window_view_defineProperty(obj, key, value) { key = window_view_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21852
|
-
function window_view_toPropertyKey(arg) { var key = window_view_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
21853
|
-
function window_view_toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
21854
|
-
|
|
21855
|
-
|
|
21856
21872
|
|
|
21857
21873
|
|
|
21858
21874
|
|
|
@@ -21874,10 +21890,6 @@ const WindowView = () => {
|
|
|
21874
21890
|
openChat
|
|
21875
21891
|
} = useVisibility();
|
|
21876
21892
|
const userHasResponded = useUserHasResponded();
|
|
21877
|
-
const {
|
|
21878
|
-
hasInterrupt,
|
|
21879
|
-
meta
|
|
21880
|
-
} = useInterrupt();
|
|
21881
21893
|
const {
|
|
21882
21894
|
t
|
|
21883
21895
|
} = useI18n();
|
|
@@ -21889,9 +21901,6 @@ const WindowView = () => {
|
|
|
21889
21901
|
}
|
|
21890
21902
|
}
|
|
21891
21903
|
}), [continueChatText]);
|
|
21892
|
-
if (hasInterrupt && !isOpen) {
|
|
21893
|
-
return (0,jsx_runtime_namespaceObject.jsx)(interrupt, window_view_objectSpread({}, meta));
|
|
21894
|
-
}
|
|
21895
21904
|
return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
21896
21905
|
children: [(0,jsx_runtime_namespaceObject.jsx)(window_open_button, {
|
|
21897
21906
|
onClick: openChat
|
|
@@ -21916,7 +21925,6 @@ const WindowView = () => {
|
|
|
21916
21925
|
transitionStartState: transitionStartStates.notRendered,
|
|
21917
21926
|
children: (0,jsx_runtime_namespaceObject.jsx)(chat, {
|
|
21918
21927
|
children: (0,jsx_runtime_namespaceObject.jsx)(chat_frame, {
|
|
21919
|
-
interruptComponent: interrupt,
|
|
21920
21928
|
children: (0,jsx_runtime_namespaceObject.jsx)(conversation, {})
|
|
21921
21929
|
})
|
|
21922
21930
|
})
|