@seamly/web-ui 24.3.0-alpha.2 → 24.3.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/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
package/build/dist/lib/index.js
CHANGED
|
@@ -4477,7 +4477,7 @@ class API {
|
|
|
4477
4477
|
return {
|
|
4478
4478
|
clientName: "@seamly/web-ui",
|
|
4479
4479
|
clientVariant: this.#layoutMode,
|
|
4480
|
-
clientVersion: "24.3.0
|
|
4480
|
+
clientVersion: "24.3.0",
|
|
4481
4481
|
currentUrl: window.location.toString(),
|
|
4482
4482
|
screenResolution: `${window.screen.width}x${window.screen.height}`,
|
|
4483
4483
|
timezone: getTimeZone(),
|
|
@@ -12653,7 +12653,6 @@ const useSeamlyHasConversation = () => {
|
|
|
12653
12653
|
|
|
12654
12654
|
|
|
12655
12655
|
|
|
12656
|
-
|
|
12657
12656
|
const useSeamlyCommands = () => {
|
|
12658
12657
|
const api = useSeamlyApiContext();
|
|
12659
12658
|
const dispatch = useAppDispatch();
|
|
@@ -12776,13 +12775,7 @@ const useSeamlyCommands = () => {
|
|
|
12776
12775
|
return;
|
|
12777
12776
|
}
|
|
12778
12777
|
api.send('action', body);
|
|
12779
|
-
|
|
12780
|
-
type
|
|
12781
|
-
} = body;
|
|
12782
|
-
if (type !== actionTypes.typing && type !== actionTypes.read) {
|
|
12783
|
-
emitEvent(`action.${type}`, body);
|
|
12784
|
-
}
|
|
12785
|
-
}, [api, emitEvent]);
|
|
12778
|
+
}, [api]);
|
|
12786
12779
|
const sendContext = (0,hooks_.useCallback)(context => {
|
|
12787
12780
|
api.sendContext(context);
|
|
12788
12781
|
}, [api]);
|
|
@@ -14376,9 +14369,10 @@ const useChoicePrompt = event => {
|
|
|
14376
14369
|
} = event;
|
|
14377
14370
|
const [showOptions, setShowOptions] = (0,hooks_.useState)(false);
|
|
14378
14371
|
const {
|
|
14379
|
-
sendAction,
|
|
14380
14372
|
addMessageBubble,
|
|
14381
|
-
addDivider
|
|
14373
|
+
addDivider,
|
|
14374
|
+
emitEvent,
|
|
14375
|
+
sendAction
|
|
14382
14376
|
} = use_seamly_commands();
|
|
14383
14377
|
const {
|
|
14384
14378
|
activeServiceSessionId
|
|
@@ -14410,20 +14404,28 @@ const useChoicePrompt = event => {
|
|
|
14410
14404
|
}, [payload, lastEventId]);
|
|
14411
14405
|
const onChoiceClickHandler = choice => {
|
|
14412
14406
|
const transactionId = randomId();
|
|
14413
|
-
|
|
14414
|
-
addDivider('new_topic', transactionId);
|
|
14415
|
-
}
|
|
14416
|
-
addMessageBubble(choice.text, transactionId);
|
|
14417
|
-
sendAction({
|
|
14407
|
+
const action = {
|
|
14418
14408
|
type: actionTypes.pickChoice,
|
|
14419
14409
|
originMessage: payload.id,
|
|
14420
14410
|
choice: {
|
|
14421
|
-
|
|
14422
|
-
|
|
14411
|
+
chooseAgain,
|
|
14412
|
+
id: choice.id
|
|
14423
14413
|
},
|
|
14424
14414
|
transactionId
|
|
14425
|
-
}
|
|
14415
|
+
};
|
|
14416
|
+
if (chooseAgain) {
|
|
14417
|
+
addDivider('new_topic', transactionId);
|
|
14418
|
+
}
|
|
14419
|
+
addMessageBubble(choice.text, transactionId);
|
|
14420
|
+
sendAction(action);
|
|
14426
14421
|
setShowOptions(false);
|
|
14422
|
+
emitEvent(`action.${action.type}`, {
|
|
14423
|
+
...action,
|
|
14424
|
+
choice: {
|
|
14425
|
+
...action.choice,
|
|
14426
|
+
text: choice.text
|
|
14427
|
+
}
|
|
14428
|
+
});
|
|
14427
14429
|
};
|
|
14428
14430
|
const onChooseAgainClickHandler = () => {
|
|
14429
14431
|
setShowOptions(s => !s);
|
|
@@ -14593,8 +14595,9 @@ const ConversationSuggestions = ({
|
|
|
14593
14595
|
const dispatch = useAppDispatch();
|
|
14594
14596
|
const userHasResponded = useUserHasResponded();
|
|
14595
14597
|
const {
|
|
14596
|
-
|
|
14597
|
-
|
|
14598
|
+
addMessageBubble,
|
|
14599
|
+
emitEvent,
|
|
14600
|
+
sendAction
|
|
14598
14601
|
} = use_seamly_commands();
|
|
14599
14602
|
const {
|
|
14600
14603
|
suggestions,
|
|
@@ -14623,9 +14626,7 @@ const ConversationSuggestions = ({
|
|
|
14623
14626
|
setIsExpanded(false);
|
|
14624
14627
|
dispatch(setHasResponded(true));
|
|
14625
14628
|
const transactionId = randomId();
|
|
14626
|
-
|
|
14627
|
-
// @todo Refactor to 'suggestionclick'
|
|
14628
|
-
sendAction({
|
|
14629
|
+
const action = {
|
|
14629
14630
|
type: actionTypes.custom,
|
|
14630
14631
|
originMessage: payload.id,
|
|
14631
14632
|
body: {
|
|
@@ -14636,9 +14637,13 @@ const ConversationSuggestions = ({
|
|
|
14636
14637
|
}
|
|
14637
14638
|
},
|
|
14638
14639
|
transactionId
|
|
14639
|
-
}
|
|
14640
|
+
};
|
|
14641
|
+
|
|
14642
|
+
// @todo Refactor to 'suggestionclick'
|
|
14643
|
+
sendAction(action);
|
|
14640
14644
|
addMessageBubble(question, transactionId);
|
|
14641
|
-
|
|
14645
|
+
emitEvent(`action.${action.type}`, action);
|
|
14646
|
+
}, [addMessageBubble, dispatch, emitEvent, payload.id, sendAction]);
|
|
14642
14647
|
if (!isExpanded || userHasResponded || !hasLastTransactionEvent || !showSuggestions) {
|
|
14643
14648
|
return null;
|
|
14644
14649
|
}
|
|
@@ -14672,11 +14677,12 @@ const useEventLinkClickHandler = ({
|
|
|
14672
14677
|
transactionId
|
|
14673
14678
|
}) => {
|
|
14674
14679
|
const {
|
|
14680
|
+
emitEvent,
|
|
14675
14681
|
sendAction
|
|
14676
14682
|
} = use_seamly_commands();
|
|
14677
14683
|
const eventClick = e => {
|
|
14678
14684
|
if (e.target && e.target.dataset.linkId) {
|
|
14679
|
-
|
|
14685
|
+
const action = {
|
|
14680
14686
|
type: actionTypes.navigate,
|
|
14681
14687
|
originMessage,
|
|
14682
14688
|
transactionId,
|
|
@@ -14684,7 +14690,9 @@ const useEventLinkClickHandler = ({
|
|
|
14684
14690
|
id: e.target.dataset.linkId,
|
|
14685
14691
|
url: e.target.getAttribute('href')
|
|
14686
14692
|
}
|
|
14687
|
-
}
|
|
14693
|
+
};
|
|
14694
|
+
sendAction(action);
|
|
14695
|
+
emitEvent(`action.${action.type}`, action);
|
|
14688
14696
|
}
|
|
14689
14697
|
};
|
|
14690
14698
|
return eventClick;
|
|
@@ -17739,9 +17747,10 @@ function useSeamlyInstanceFunction(functionName, fn, deps = []) {
|
|
|
17739
17747
|
const SeamlyInstanceFunctionsLoader = () => {
|
|
17740
17748
|
const config = useConfig();
|
|
17741
17749
|
const {
|
|
17742
|
-
|
|
17750
|
+
emitEvent,
|
|
17751
|
+
sendAction,
|
|
17743
17752
|
sendContext,
|
|
17744
|
-
|
|
17753
|
+
sendMessage
|
|
17745
17754
|
} = use_seamly_commands();
|
|
17746
17755
|
const dispatch = useAppDispatch();
|
|
17747
17756
|
const {
|
|
@@ -17796,13 +17805,15 @@ const SeamlyInstanceFunctionsLoader = () => {
|
|
|
17796
17805
|
setVisibility(args);
|
|
17797
17806
|
}, [config.api]);
|
|
17798
17807
|
useSeamlyInstanceFunction('sendCustomAction', (actionType, body) => {
|
|
17799
|
-
|
|
17808
|
+
const action = {
|
|
17800
17809
|
type: 'custom',
|
|
17801
17810
|
body: {
|
|
17802
17811
|
type: actionType,
|
|
17803
17812
|
body
|
|
17804
17813
|
}
|
|
17805
|
-
}
|
|
17814
|
+
};
|
|
17815
|
+
sendAction(action);
|
|
17816
|
+
emitEvent(`action.${action.type}`, action);
|
|
17806
17817
|
}, [api.send]);
|
|
17807
17818
|
useSeamlyInstanceFunction('setTopic', ({
|
|
17808
17819
|
name,
|
|
@@ -18786,8 +18797,9 @@ const Suggestions = ({
|
|
|
18786
18797
|
t
|
|
18787
18798
|
} = useI18n();
|
|
18788
18799
|
const {
|
|
18789
|
-
|
|
18790
|
-
|
|
18800
|
+
addMessageBubble,
|
|
18801
|
+
emitEvent,
|
|
18802
|
+
sendAction
|
|
18791
18803
|
} = use_seamly_commands();
|
|
18792
18804
|
const {
|
|
18793
18805
|
isOpen,
|
|
@@ -18858,9 +18870,7 @@ const Suggestions = ({
|
|
|
18858
18870
|
continueChat();
|
|
18859
18871
|
}
|
|
18860
18872
|
const transactionId = randomId();
|
|
18861
|
-
|
|
18862
|
-
// @todo Refactor to 'suggestionclick'
|
|
18863
|
-
sendAction({
|
|
18873
|
+
const action = {
|
|
18864
18874
|
type: actionTypes.custom,
|
|
18865
18875
|
originMessage: payload.id,
|
|
18866
18876
|
body: {
|
|
@@ -18871,15 +18881,19 @@ const Suggestions = ({
|
|
|
18871
18881
|
}
|
|
18872
18882
|
},
|
|
18873
18883
|
transactionId
|
|
18874
|
-
}
|
|
18884
|
+
};
|
|
18885
|
+
|
|
18886
|
+
// @todo Refactor to 'suggestionclick'
|
|
18887
|
+
sendAction(action);
|
|
18875
18888
|
addMessageBubble(question, transactionId);
|
|
18889
|
+
emitEvent(`action.${action.type}`, action);
|
|
18876
18890
|
if (!isOpen) {
|
|
18877
18891
|
setVisibility({
|
|
18878
18892
|
visibility: visibilityStates.open
|
|
18879
18893
|
});
|
|
18880
18894
|
}
|
|
18881
18895
|
focusSkiplinkTarget();
|
|
18882
|
-
}, [addMessageBubble, continueChat, endCountdown, focusSkiplinkTarget, hasCountdown, hasPrompt, payload, sendAction, setVisibility
|
|
18896
|
+
}, [addMessageBubble, continueChat, endCountdown, emitEvent, focusSkiplinkTarget, hasCountdown, hasPrompt, isOpen, payload, sendAction, setVisibility]);
|
|
18883
18897
|
(0,hooks_.useEffect)(() => {
|
|
18884
18898
|
if (prevSuggestions.current !== suggestions && !hideSuggestions) {
|
|
18885
18899
|
if (hasSuggestions) {
|