@seamly/web-ui 24.3.0-alpha.1 → 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.
@@ -2908,6 +2908,7 @@ __webpack_require__.d(__webpack_exports__, {
2908
2908
  Icon: () => (/* reexport */ layout_icon),
2909
2909
  Interrupt: () => (/* reexport */ interrupt),
2910
2910
  MessageContainer: () => (/* reexport */ message_container),
2911
+ SeamlyActivityEventContext: () => (/* reexport */ seamly_activity_event_context),
2911
2912
  SeamlyActivityMonitor: () => (/* reexport */ seamly_activity_monitor),
2912
2913
  SeamlyApiContext: () => (/* reexport */ SeamlyApiContext),
2913
2914
  SeamlyEventBusContext: () => (/* reexport */ SeamlyEventBusContext),
@@ -2933,8 +2934,10 @@ __webpack_require__.d(__webpack_exports__, {
2933
2934
  getUrlSearchParams: () => (/* reexport */ getUrlSearchParams),
2934
2935
  getUrlSearchString: () => (/* reexport */ getUrlSearchString),
2935
2936
  i18nReducer: () => (/* reexport */ i18n_slice),
2937
+ initResetSearchParams: () => (/* reexport */ initResetSearchParams),
2936
2938
  interruptReducer: () => (/* reexport */ interrupt_slice),
2937
2939
  randomId: () => (/* reexport */ randomId),
2940
+ replaceSearchParams: () => (/* reexport */ replaceSearchParams),
2938
2941
  sessionStorageProvider: () => (/* reexport */ store),
2939
2942
  setConfig: () => (/* reexport */ setConfig),
2940
2943
  setInitialLocale: () => (/* reexport */ setInitialLocale),
@@ -4474,7 +4477,7 @@ class API {
4474
4477
  return {
4475
4478
  clientName: "@seamly/web-ui",
4476
4479
  clientVariant: this.#layoutMode,
4477
- clientVersion: "24.3.0-alpha.1",
4480
+ clientVersion: "24.3.0-beta.1",
4478
4481
  currentUrl: window.location.toString(),
4479
4482
  screenResolution: `${window.screen.width}x${window.screen.height}`,
4480
4483
  timezone: getTimeZone(),
@@ -12650,7 +12653,6 @@ const useSeamlyHasConversation = () => {
12650
12653
 
12651
12654
 
12652
12655
 
12653
-
12654
12656
  const useSeamlyCommands = () => {
12655
12657
  const api = useSeamlyApiContext();
12656
12658
  const dispatch = useAppDispatch();
@@ -12773,13 +12775,7 @@ const useSeamlyCommands = () => {
12773
12775
  return;
12774
12776
  }
12775
12777
  api.send('action', body);
12776
- const {
12777
- type
12778
- } = body;
12779
- if (type !== actionTypes.typing && type !== actionTypes.read) {
12780
- emitEvent(`action.${type}`, body);
12781
- }
12782
- }, [api, emitEvent]);
12778
+ }, [api]);
12783
12779
  const sendContext = (0,hooks_.useCallback)(context => {
12784
12780
  api.sendContext(context);
12785
12781
  }, [api]);
@@ -14373,9 +14369,10 @@ const useChoicePrompt = event => {
14373
14369
  } = event;
14374
14370
  const [showOptions, setShowOptions] = (0,hooks_.useState)(false);
14375
14371
  const {
14376
- sendAction,
14377
14372
  addMessageBubble,
14378
- addDivider
14373
+ addDivider,
14374
+ emitEvent,
14375
+ sendAction
14379
14376
  } = use_seamly_commands();
14380
14377
  const {
14381
14378
  activeServiceSessionId
@@ -14407,20 +14404,28 @@ const useChoicePrompt = event => {
14407
14404
  }, [payload, lastEventId]);
14408
14405
  const onChoiceClickHandler = choice => {
14409
14406
  const transactionId = randomId();
14410
- if (chooseAgain) {
14411
- addDivider('new_topic', transactionId);
14412
- }
14413
- addMessageBubble(choice.text, transactionId);
14414
- sendAction({
14407
+ const action = {
14415
14408
  type: actionTypes.pickChoice,
14416
14409
  originMessage: payload.id,
14417
14410
  choice: {
14418
- id: choice.id,
14419
- chooseAgain
14411
+ chooseAgain,
14412
+ id: choice.id
14420
14413
  },
14421
14414
  transactionId
14422
- });
14415
+ };
14416
+ if (chooseAgain) {
14417
+ addDivider('new_topic', transactionId);
14418
+ }
14419
+ addMessageBubble(choice.text, transactionId);
14420
+ sendAction(action);
14423
14421
  setShowOptions(false);
14422
+ emitEvent(`action.${action.type}`, {
14423
+ ...action,
14424
+ choice: {
14425
+ ...action.choice,
14426
+ text: choice.text
14427
+ }
14428
+ });
14424
14429
  };
14425
14430
  const onChooseAgainClickHandler = () => {
14426
14431
  setShowOptions(s => !s);
@@ -14590,8 +14595,9 @@ const ConversationSuggestions = ({
14590
14595
  const dispatch = useAppDispatch();
14591
14596
  const userHasResponded = useUserHasResponded();
14592
14597
  const {
14593
- sendAction,
14594
- addMessageBubble
14598
+ addMessageBubble,
14599
+ emitEvent,
14600
+ sendAction
14595
14601
  } = use_seamly_commands();
14596
14602
  const {
14597
14603
  suggestions,
@@ -14620,9 +14626,7 @@ const ConversationSuggestions = ({
14620
14626
  setIsExpanded(false);
14621
14627
  dispatch(setHasResponded(true));
14622
14628
  const transactionId = randomId();
14623
-
14624
- // @todo Refactor to 'suggestionclick'
14625
- sendAction({
14629
+ const action = {
14626
14630
  type: actionTypes.custom,
14627
14631
  originMessage: payload.id,
14628
14632
  body: {
@@ -14633,9 +14637,13 @@ const ConversationSuggestions = ({
14633
14637
  }
14634
14638
  },
14635
14639
  transactionId
14636
- });
14640
+ };
14641
+
14642
+ // @todo Refactor to 'suggestionclick'
14643
+ sendAction(action);
14637
14644
  addMessageBubble(question, transactionId);
14638
- }, [dispatch, sendAction, payload.id, addMessageBubble]);
14645
+ emitEvent(`action.${action.type}`, action);
14646
+ }, [addMessageBubble, dispatch, emitEvent, payload.id, sendAction]);
14639
14647
  if (!isExpanded || userHasResponded || !hasLastTransactionEvent || !showSuggestions) {
14640
14648
  return null;
14641
14649
  }
@@ -14669,11 +14677,12 @@ const useEventLinkClickHandler = ({
14669
14677
  transactionId
14670
14678
  }) => {
14671
14679
  const {
14680
+ emitEvent,
14672
14681
  sendAction
14673
14682
  } = use_seamly_commands();
14674
14683
  const eventClick = e => {
14675
14684
  if (e.target && e.target.dataset.linkId) {
14676
- sendAction({
14685
+ const action = {
14677
14686
  type: actionTypes.navigate,
14678
14687
  originMessage,
14679
14688
  transactionId,
@@ -14681,7 +14690,9 @@ const useEventLinkClickHandler = ({
14681
14690
  id: e.target.dataset.linkId,
14682
14691
  url: e.target.getAttribute('href')
14683
14692
  }
14684
- });
14693
+ };
14694
+ sendAction(action);
14695
+ emitEvent(`action.${action.type}`, action);
14685
14696
  }
14686
14697
  };
14687
14698
  return eventClick;
@@ -17736,9 +17747,10 @@ function useSeamlyInstanceFunction(functionName, fn, deps = []) {
17736
17747
  const SeamlyInstanceFunctionsLoader = () => {
17737
17748
  const config = useConfig();
17738
17749
  const {
17739
- sendMessage,
17750
+ emitEvent,
17751
+ sendAction,
17740
17752
  sendContext,
17741
- sendAction
17753
+ sendMessage
17742
17754
  } = use_seamly_commands();
17743
17755
  const dispatch = useAppDispatch();
17744
17756
  const {
@@ -17793,13 +17805,15 @@ const SeamlyInstanceFunctionsLoader = () => {
17793
17805
  setVisibility(args);
17794
17806
  }, [config.api]);
17795
17807
  useSeamlyInstanceFunction('sendCustomAction', (actionType, body) => {
17796
- sendAction({
17808
+ const action = {
17797
17809
  type: 'custom',
17798
17810
  body: {
17799
17811
  type: actionType,
17800
17812
  body
17801
17813
  }
17802
- });
17814
+ };
17815
+ sendAction(action);
17816
+ emitEvent(`action.${action.type}`, action);
17803
17817
  }, [api.send]);
17804
17818
  useSeamlyInstanceFunction('setTopic', ({
17805
17819
  name,
@@ -18783,8 +18797,9 @@ const Suggestions = ({
18783
18797
  t
18784
18798
  } = useI18n();
18785
18799
  const {
18786
- sendAction,
18787
- addMessageBubble
18800
+ addMessageBubble,
18801
+ emitEvent,
18802
+ sendAction
18788
18803
  } = use_seamly_commands();
18789
18804
  const {
18790
18805
  isOpen,
@@ -18855,9 +18870,7 @@ const Suggestions = ({
18855
18870
  continueChat();
18856
18871
  }
18857
18872
  const transactionId = randomId();
18858
-
18859
- // @todo Refactor to 'suggestionclick'
18860
- sendAction({
18873
+ const action = {
18861
18874
  type: actionTypes.custom,
18862
18875
  originMessage: payload.id,
18863
18876
  body: {
@@ -18868,15 +18881,19 @@ const Suggestions = ({
18868
18881
  }
18869
18882
  },
18870
18883
  transactionId
18871
- });
18884
+ };
18885
+
18886
+ // @todo Refactor to 'suggestionclick'
18887
+ sendAction(action);
18872
18888
  addMessageBubble(question, transactionId);
18889
+ emitEvent(`action.${action.type}`, action);
18873
18890
  if (!isOpen) {
18874
18891
  setVisibility({
18875
18892
  visibility: visibilityStates.open
18876
18893
  });
18877
18894
  }
18878
18895
  focusSkiplinkTarget();
18879
- }, [addMessageBubble, continueChat, endCountdown, focusSkiplinkTarget, hasCountdown, hasPrompt, payload, sendAction, setVisibility, isOpen]);
18896
+ }, [addMessageBubble, continueChat, endCountdown, emitEvent, focusSkiplinkTarget, hasCountdown, hasPrompt, isOpen, payload, sendAction, setVisibility]);
18880
18897
  (0,hooks_.useEffect)(() => {
18881
18898
  if (prevSuggestions.current !== suggestions && !hideSuggestions) {
18882
18899
  if (hasSuggestions) {
@@ -22740,6 +22757,7 @@ const initResetSearchParams = (...keys) => {
22740
22757
 
22741
22758
 
22742
22759
 
22760
+
22743
22761
  // Used by: Client
22744
22762
  /* harmony default export */ const core = (initializeExternalApi);
22745
22763
  })();