@seamly/web-ui 24.3.0-alpha.2 → 24.3.0-beta.1
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/index.debug.js +60 -47
- package/build/dist/lib/index.debug.js.map +1 -1
- 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 +53 -39
- 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/package.json +1 -1
- package/src/javascripts/core/ui/components/conversation/event/choice-prompt.tsx +15 -9
- package/src/javascripts/core/ui/components/conversation/event/conversation-suggestions.tsx +8 -6
- package/src/javascripts/core/ui/components/conversation/event/hooks/use-event-link-click-handler.ts +5 -3
- package/src/javascripts/core/ui/components/core/seamly-instance-functions-loader.ts +5 -2
- package/src/javascripts/core/ui/components/suggestions/index.tsx +9 -6
- package/src/javascripts/core/ui/hooks/use-seamly-commands.ts +1 -7
|
@@ -869,7 +869,7 @@ class API {
|
|
|
869
869
|
return {
|
|
870
870
|
clientName: "@seamly/web-ui",
|
|
871
871
|
clientVariant: this.#layoutMode,
|
|
872
|
-
clientVersion: "24.3.0-
|
|
872
|
+
clientVersion: "24.3.0-beta.1",
|
|
873
873
|
currentUrl: window.location.toString(),
|
|
874
874
|
screenResolution: `${window.screen.width}x${window.screen.height}`,
|
|
875
875
|
timezone: (0,_utils__WEBPACK_IMPORTED_MODULE_10__.getTimeZone)(),
|
|
@@ -6650,9 +6650,10 @@ const useChoicePrompt = event => {
|
|
|
6650
6650
|
} = event;
|
|
6651
6651
|
const [showOptions, setShowOptions] = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_1__.useState)(false);
|
|
6652
6652
|
const {
|
|
6653
|
-
sendAction,
|
|
6654
6653
|
addMessageBubble,
|
|
6655
|
-
addDivider
|
|
6654
|
+
addDivider,
|
|
6655
|
+
emitEvent,
|
|
6656
|
+
sendAction
|
|
6656
6657
|
} = (0,ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_8__.useSeamlyCommands)();
|
|
6657
6658
|
const {
|
|
6658
6659
|
activeServiceSessionId
|
|
@@ -6684,20 +6685,28 @@ const useChoicePrompt = event => {
|
|
|
6684
6685
|
}, [payload, lastEventId]);
|
|
6685
6686
|
const onChoiceClickHandler = choice => {
|
|
6686
6687
|
const transactionId = (0,lib_id__WEBPACK_IMPORTED_MODULE_5__.randomId)();
|
|
6687
|
-
|
|
6688
|
-
addDivider('new_topic', transactionId);
|
|
6689
|
-
}
|
|
6690
|
-
addMessageBubble(choice.text, transactionId);
|
|
6691
|
-
sendAction({
|
|
6688
|
+
const action = {
|
|
6692
6689
|
type: ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_10__.actionTypes.pickChoice,
|
|
6693
6690
|
originMessage: payload.id,
|
|
6694
6691
|
choice: {
|
|
6695
|
-
|
|
6696
|
-
|
|
6692
|
+
chooseAgain,
|
|
6693
|
+
id: choice.id
|
|
6697
6694
|
},
|
|
6698
6695
|
transactionId
|
|
6699
|
-
}
|
|
6696
|
+
};
|
|
6697
|
+
if (chooseAgain) {
|
|
6698
|
+
addDivider('new_topic', transactionId);
|
|
6699
|
+
}
|
|
6700
|
+
addMessageBubble(choice.text, transactionId);
|
|
6701
|
+
sendAction(action);
|
|
6700
6702
|
setShowOptions(false);
|
|
6703
|
+
emitEvent(`action.${action.type}`, {
|
|
6704
|
+
...action,
|
|
6705
|
+
choice: {
|
|
6706
|
+
...action.choice,
|
|
6707
|
+
text: choice.text
|
|
6708
|
+
}
|
|
6709
|
+
});
|
|
6701
6710
|
};
|
|
6702
6711
|
const onChooseAgainClickHandler = () => {
|
|
6703
6712
|
setShowOptions(s => !s);
|
|
@@ -6837,8 +6846,9 @@ const ConversationSuggestions = ({
|
|
|
6837
6846
|
const dispatch = (0,domains_store__WEBPACK_IMPORTED_MODULE_5__.useAppDispatch)();
|
|
6838
6847
|
const userHasResponded = (0,domains_app_hooks__WEBPACK_IMPORTED_MODULE_1__.useUserHasResponded)();
|
|
6839
6848
|
const {
|
|
6840
|
-
|
|
6841
|
-
|
|
6849
|
+
addMessageBubble,
|
|
6850
|
+
emitEvent,
|
|
6851
|
+
sendAction
|
|
6842
6852
|
} = (0,ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_11__.useSeamlyCommands)();
|
|
6843
6853
|
const {
|
|
6844
6854
|
suggestions,
|
|
@@ -6867,9 +6877,7 @@ const ConversationSuggestions = ({
|
|
|
6867
6877
|
setIsExpanded(false);
|
|
6868
6878
|
dispatch((0,domains_app_slice__WEBPACK_IMPORTED_MODULE_2__.setHasResponded)(true));
|
|
6869
6879
|
const transactionId = (0,lib_id__WEBPACK_IMPORTED_MODULE_8__.randomId)();
|
|
6870
|
-
|
|
6871
|
-
// @todo Refactor to 'suggestionclick'
|
|
6872
|
-
sendAction({
|
|
6880
|
+
const action = {
|
|
6873
6881
|
type: ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_12__.actionTypes.custom,
|
|
6874
6882
|
originMessage: payload.id,
|
|
6875
6883
|
body: {
|
|
@@ -6880,9 +6888,13 @@ const ConversationSuggestions = ({
|
|
|
6880
6888
|
}
|
|
6881
6889
|
},
|
|
6882
6890
|
transactionId
|
|
6883
|
-
}
|
|
6891
|
+
};
|
|
6892
|
+
|
|
6893
|
+
// @todo Refactor to 'suggestionclick'
|
|
6894
|
+
sendAction(action);
|
|
6884
6895
|
addMessageBubble(question, transactionId);
|
|
6885
|
-
|
|
6896
|
+
emitEvent(`action.${action.type}`, action);
|
|
6897
|
+
}, [addMessageBubble, dispatch, emitEvent, payload.id, sendAction]);
|
|
6886
6898
|
if (!isExpanded || userHasResponded || !hasLastTransactionEvent || !showSuggestions) {
|
|
6887
6899
|
return null;
|
|
6888
6900
|
}
|
|
@@ -7401,11 +7413,12 @@ const useEventLinkClickHandler = ({
|
|
|
7401
7413
|
transactionId
|
|
7402
7414
|
}) => {
|
|
7403
7415
|
const {
|
|
7416
|
+
emitEvent,
|
|
7404
7417
|
sendAction
|
|
7405
7418
|
} = (0,ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_0__.useSeamlyCommands)();
|
|
7406
7419
|
const eventClick = e => {
|
|
7407
7420
|
if (e.target && e.target.dataset.linkId) {
|
|
7408
|
-
|
|
7421
|
+
const action = {
|
|
7409
7422
|
type: ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_1__.actionTypes.navigate,
|
|
7410
7423
|
originMessage,
|
|
7411
7424
|
transactionId,
|
|
@@ -7413,7 +7426,9 @@ const useEventLinkClickHandler = ({
|
|
|
7413
7426
|
id: e.target.dataset.linkId,
|
|
7414
7427
|
url: e.target.getAttribute('href')
|
|
7415
7428
|
}
|
|
7416
|
-
}
|
|
7429
|
+
};
|
|
7430
|
+
sendAction(action);
|
|
7431
|
+
emitEvent(`action.${action.type}`, action);
|
|
7417
7432
|
}
|
|
7418
7433
|
};
|
|
7419
7434
|
return eventClick;
|
|
@@ -9090,9 +9105,10 @@ function useSeamlyInstanceFunction(functionName, fn, deps = []) {
|
|
|
9090
9105
|
const SeamlyInstanceFunctionsLoader = () => {
|
|
9091
9106
|
const config = (0,domains_config_hooks__WEBPACK_IMPORTED_MODULE_1__.useConfig)();
|
|
9092
9107
|
const {
|
|
9093
|
-
|
|
9108
|
+
emitEvent,
|
|
9109
|
+
sendAction,
|
|
9094
9110
|
sendContext,
|
|
9095
|
-
|
|
9111
|
+
sendMessage
|
|
9096
9112
|
} = (0,ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_9__.useSeamlyCommands)();
|
|
9097
9113
|
const dispatch = (0,domains_store__WEBPACK_IMPORTED_MODULE_4__.useAppDispatch)();
|
|
9098
9114
|
const {
|
|
@@ -9147,13 +9163,15 @@ const SeamlyInstanceFunctionsLoader = () => {
|
|
|
9147
9163
|
setVisibility(args);
|
|
9148
9164
|
}, [config.api]);
|
|
9149
9165
|
useSeamlyInstanceFunction('sendCustomAction', (actionType, body) => {
|
|
9150
|
-
|
|
9166
|
+
const action = {
|
|
9151
9167
|
type: 'custom',
|
|
9152
9168
|
body: {
|
|
9153
9169
|
type: actionType,
|
|
9154
9170
|
body
|
|
9155
9171
|
}
|
|
9156
|
-
}
|
|
9172
|
+
};
|
|
9173
|
+
sendAction(action);
|
|
9174
|
+
emitEvent(`action.${action.type}`, action);
|
|
9157
9175
|
}, [api.send]);
|
|
9158
9176
|
useSeamlyInstanceFunction('setTopic', ({
|
|
9159
9177
|
name,
|
|
@@ -11961,8 +11979,9 @@ const Suggestions = ({
|
|
|
11961
11979
|
t
|
|
11962
11980
|
} = (0,domains_i18n_hooks__WEBPACK_IMPORTED_MODULE_4__.useI18n)();
|
|
11963
11981
|
const {
|
|
11964
|
-
|
|
11965
|
-
|
|
11982
|
+
addMessageBubble,
|
|
11983
|
+
emitEvent,
|
|
11984
|
+
sendAction
|
|
11966
11985
|
} = (0,ui_hooks_use_seamly_commands__WEBPACK_IMPORTED_MODULE_16__["default"])();
|
|
11967
11986
|
const {
|
|
11968
11987
|
isOpen,
|
|
@@ -12033,9 +12052,7 @@ const Suggestions = ({
|
|
|
12033
12052
|
continueChat();
|
|
12034
12053
|
}
|
|
12035
12054
|
const transactionId = (0,lib_id__WEBPACK_IMPORTED_MODULE_10__.randomId)();
|
|
12036
|
-
|
|
12037
|
-
// @todo Refactor to 'suggestionclick'
|
|
12038
|
-
sendAction({
|
|
12055
|
+
const action = {
|
|
12039
12056
|
type: ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_21__.actionTypes.custom,
|
|
12040
12057
|
originMessage: payload.id,
|
|
12041
12058
|
body: {
|
|
@@ -12046,15 +12063,19 @@ const Suggestions = ({
|
|
|
12046
12063
|
}
|
|
12047
12064
|
},
|
|
12048
12065
|
transactionId
|
|
12049
|
-
}
|
|
12066
|
+
};
|
|
12067
|
+
|
|
12068
|
+
// @todo Refactor to 'suggestionclick'
|
|
12069
|
+
sendAction(action);
|
|
12050
12070
|
addMessageBubble(question, transactionId);
|
|
12071
|
+
emitEvent(`action.${action.type}`, action);
|
|
12051
12072
|
if (!isOpen) {
|
|
12052
12073
|
setVisibility({
|
|
12053
12074
|
visibility: domains_visibility_constants__WEBPACK_IMPORTED_MODULE_7__.visibilityStates.open
|
|
12054
12075
|
});
|
|
12055
12076
|
}
|
|
12056
12077
|
focusSkiplinkTarget();
|
|
12057
|
-
}, [addMessageBubble, continueChat, endCountdown, focusSkiplinkTarget, hasCountdown, hasPrompt, payload, sendAction, setVisibility
|
|
12078
|
+
}, [addMessageBubble, continueChat, endCountdown, emitEvent, focusSkiplinkTarget, hasCountdown, hasPrompt, isOpen, payload, sendAction, setVisibility]);
|
|
12058
12079
|
(0,preact_hooks__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {
|
|
12059
12080
|
if (prevSuggestions.current !== suggestions && !hideSuggestions) {
|
|
12060
12081
|
if (hasSuggestions) {
|
|
@@ -14624,11 +14645,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
14624
14645
|
/* harmony import */ var domains_visibility_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! domains/visibility/constants */ "./src/javascripts/core/domains/visibility/constants.ts");
|
|
14625
14646
|
/* harmony import */ var domains_visibility_hooks__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! domains/visibility/hooks */ "./src/javascripts/core/domains/visibility/hooks.ts");
|
|
14626
14647
|
/* harmony import */ var lib_id__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! lib/id */ "./src/javascripts/core/lib/id.ts");
|
|
14627
|
-
/* harmony import */ var
|
|
14628
|
-
/* harmony import */ var
|
|
14629
|
-
/* harmony import */ var
|
|
14630
|
-
/* harmony import */ var _seamly_state_hooks__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./seamly-state-hooks */ "./src/javascripts/core/ui/hooks/seamly-state-hooks.ts");
|
|
14631
|
-
|
|
14648
|
+
/* harmony import */ var _event_bus_hooks__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./event-bus-hooks */ "./src/javascripts/core/ui/hooks/event-bus-hooks.ts");
|
|
14649
|
+
/* harmony import */ var _seamly_api_hooks__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./seamly-api-hooks */ "./src/javascripts/core/ui/hooks/seamly-api-hooks.ts");
|
|
14650
|
+
/* harmony import */ var _seamly_state_hooks__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./seamly-state-hooks */ "./src/javascripts/core/ui/hooks/seamly-state-hooks.ts");
|
|
14632
14651
|
|
|
14633
14652
|
|
|
14634
14653
|
|
|
@@ -14643,16 +14662,16 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
14643
14662
|
|
|
14644
14663
|
|
|
14645
14664
|
const useSeamlyCommands = () => {
|
|
14646
|
-
const api = (0,
|
|
14665
|
+
const api = (0,_seamly_api_hooks__WEBPACK_IMPORTED_MODULE_11__.useSeamlyApiContext)();
|
|
14647
14666
|
const dispatch = (0,domains_store__WEBPACK_IMPORTED_MODULE_5__.useAppDispatch)();
|
|
14648
|
-
const eventBus = (0,
|
|
14667
|
+
const eventBus = (0,_event_bus_hooks__WEBPACK_IMPORTED_MODULE_10__["default"])();
|
|
14649
14668
|
const userHasResponded = (0,domains_app_hooks__WEBPACK_IMPORTED_MODULE_2__.useUserHasResponded)();
|
|
14650
|
-
const hasConversation = (0,
|
|
14669
|
+
const hasConversation = (0,_seamly_api_hooks__WEBPACK_IMPORTED_MODULE_11__.useSeamlyHasConversation)();
|
|
14651
14670
|
const {
|
|
14652
14671
|
visible: visibility,
|
|
14653
14672
|
setVisibility
|
|
14654
14673
|
} = (0,domains_visibility_hooks__WEBPACK_IMPORTED_MODULE_8__.useVisibility)();
|
|
14655
|
-
const unreadMessageCount = (0,
|
|
14674
|
+
const unreadMessageCount = (0,_seamly_state_hooks__WEBPACK_IMPORTED_MODULE_12__.useSeamlyUnreadCount)();
|
|
14656
14675
|
const emitEvent = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useCallback)((...args) => {
|
|
14657
14676
|
// @ts-ignore
|
|
14658
14677
|
eventBus.emit(...args);
|
|
@@ -14764,13 +14783,7 @@ const useSeamlyCommands = () => {
|
|
|
14764
14783
|
return;
|
|
14765
14784
|
}
|
|
14766
14785
|
api.send('action', body);
|
|
14767
|
-
|
|
14768
|
-
type
|
|
14769
|
-
} = body;
|
|
14770
|
-
if (type !== ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_10__.actionTypes.typing && type !== ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_10__.actionTypes.read) {
|
|
14771
|
-
emitEvent(`action.${type}`, body);
|
|
14772
|
-
}
|
|
14773
|
-
}, [api, emitEvent]);
|
|
14786
|
+
}, [api]);
|
|
14774
14787
|
const sendContext = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useCallback)(context => {
|
|
14775
14788
|
api.sendContext(context);
|
|
14776
14789
|
}, [api]);
|