@camunda/camunda-composite-components 0.2.17-rc.0 → 0.2.17-rc.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.
@@ -20,8 +20,6 @@ export const C3HelpCenter = ({ autoStartSurvey, origin, flags, onRequestClose, m
20
20
  const [helpCenterConfig, setHelpCenterConfig] = useState(defaultHelpCenterConfig);
21
21
  const [email, setEmail] = useState("");
22
22
  const [showSurvey, setShowSurvey] = useState(autoStartSurvey);
23
- const shouldOpen = autoStartSurvey && persona && !persona.wasShown;
24
- const shouldShowSurvey = showSurvey || !persona?.wasShown;
25
23
  useEffect(() => {
26
24
  const updateResolvedTheme = ({ matches }) => {
27
25
  if (themeRef.current === "system") {
@@ -51,10 +49,10 @@ export const C3HelpCenter = ({ autoStartSurvey, origin, flags, onRequestClose, m
51
49
  const fetchData = async () => {
52
50
  if (!userToken || !decodedToken || !decodedAudience)
53
51
  return;
54
- const { userId, meta, persona } = decodedToken;
55
- if (persona !== undefined) {
56
- setPersona(persona);
57
- if (persona.wasShown) {
52
+ const { userId, meta, persona: tokenPersona } = decodedToken;
53
+ if (tokenPersona !== undefined) {
54
+ setPersona(tokenPersona);
55
+ if (tokenPersona.wasShown) {
58
56
  setShowSurvey(false);
59
57
  }
60
58
  }
@@ -65,9 +63,11 @@ export const C3HelpCenter = ({ autoStartSurvey, origin, flags, onRequestClose, m
65
63
  setEmail(meta.email);
66
64
  if (userId)
67
65
  setUserId(userId);
68
- if (shouldOpen) {
69
- if (shouldShowSurvey)
66
+ if (autoStartSurvey && !tokenPersona?.wasShown) {
67
+ if (showSurvey || !tokenPersona?.wasShown) {
68
+ console.log("show survey", showSurvey);
70
69
  setShowSurvey(true);
70
+ }
71
71
  setIsHelpCenterOpen(true);
72
72
  onRequestOpen?.();
73
73
  }
@@ -86,8 +86,6 @@ export const C3HelpCenter = ({ autoStartSurvey, origin, flags, onRequestClose, m
86
86
  const tabs = helpCenterConfig.tabs;
87
87
  const firstTab = tabs[0].id;
88
88
  if (isOpen) {
89
- if (shouldShowSurvey)
90
- setShowSurvey(true);
91
89
  mixpanelTrack?.(`helpcenter:open`, {
92
90
  to: activeTab ?? firstTab,
93
91
  from: origin,
@@ -168,5 +166,5 @@ export const C3HelpCenter = ({ autoStartSurvey, origin, flags, onRequestClose, m
168
166
  reloadClusters();
169
167
  };
170
168
  return (React.createElement(Layer, null,
171
- React.createElement(ComposedModal, { open: isOpen, size: "lg", onClose: closeFn, className: "help-center", "aria-label": "HelpCenter" }, shouldShowSurvey ? (React.createElement(C3OnboardingSurvey, { personaCallback: personaCallback, persona: persona, mixpanelTrack: mixpanelTrack, onRequestClose: closeFn, onRequestSkip: onRequestSkipSurvey, theme: resolvedTheme, origin: origin, modal: true })) : (React.createElement(HelpCenter, { configuration: helpCenterConfig, persona: persona, audience: decodedAudience || "", organization: activeOrg, clusters: clusters || [], flags: flags, onRequestResumeSurvey: onRequestResumeSurvey, onRequestRetakeSurvey: onRequestRetakeSurvey, onRequestClose: closeFn, mixpanelTrack: mixpanelTrack, email: email, theme: resolvedTheme, origin: origin, initialTab: activeTab })))));
169
+ React.createElement(ComposedModal, { open: isOpen, size: "lg", onClose: closeFn, className: "help-center", "aria-label": "HelpCenter" }, showSurvey || !persona?.wasShown ? (React.createElement(C3OnboardingSurvey, { personaCallback: personaCallback, persona: persona, mixpanelTrack: mixpanelTrack, onRequestClose: closeFn, onRequestSkip: onRequestSkipSurvey, theme: resolvedTheme, origin: origin, modal: true })) : (React.createElement(HelpCenter, { configuration: helpCenterConfig, persona: persona, audience: decodedAudience || "", organization: activeOrg, clusters: clusters || [], flags: flags, onRequestResumeSurvey: onRequestResumeSurvey, onRequestRetakeSurvey: onRequestRetakeSurvey, onRequestClose: closeFn, mixpanelTrack: mixpanelTrack, email: email, theme: resolvedTheme, origin: origin, initialTab: activeTab })))));
172
170
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/camunda-composite-components",
3
- "version": "0.2.17-rc.0",
3
+ "version": "0.2.17-rc.1",
4
4
  "scripts": {
5
5
  "clean": "rimraf lib/",
6
6
  "build": "yarn clean && tsc",