@camunda/camunda-composite-components 0.0.0-rc-20250210082942

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.
Files changed (203) hide show
  1. package/README.md +149 -0
  2. package/lib/esm/package.json +116 -0
  3. package/lib/esm/src/api/api.d.ts +28 -0
  4. package/lib/esm/src/api/api.js +86 -0
  5. package/lib/esm/src/api/endpoints.const.d.ts +19 -0
  6. package/lib/esm/src/api/endpoints.const.js +44 -0
  7. package/lib/esm/src/api/help-center.d.ts +41 -0
  8. package/lib/esm/src/api/help-center.js +47 -0
  9. package/lib/esm/src/api/jwt.utils.d.ts +5 -0
  10. package/lib/esm/src/api/jwt.utils.js +23 -0
  11. package/lib/esm/src/api/notifications.d.ts +41 -0
  12. package/lib/esm/src/api/notifications.js +165 -0
  13. package/lib/esm/src/api/organizations.d.ts +15 -0
  14. package/lib/esm/src/api/organizations.js +11 -0
  15. package/lib/esm/src/api/profile.d.ts +21 -0
  16. package/lib/esm/src/api/profile.js +43 -0
  17. package/lib/esm/src/assets/app-teaser-images/operate-1-monitor.d.ts +1 -0
  18. package/lib/esm/src/assets/app-teaser-images/operate-1-monitor.js +1 -0
  19. package/lib/esm/src/assets/app-teaser-images/operate-2-inspect.d.ts +1 -0
  20. package/lib/esm/src/assets/app-teaser-images/operate-2-inspect.js +1 -0
  21. package/lib/esm/src/assets/app-teaser-images/operate-3-troubleshoot.d.ts +1 -0
  22. package/lib/esm/src/assets/app-teaser-images/operate-3-troubleshoot.js +1 -0
  23. package/lib/esm/src/assets/app-teaser-images/optimize-1-Kpis.d.ts +1 -0
  24. package/lib/esm/src/assets/app-teaser-images/optimize-1-Kpis.js +1 -0
  25. package/lib/esm/src/assets/app-teaser-images/optimize-2-opportunities.d.ts +1 -0
  26. package/lib/esm/src/assets/app-teaser-images/optimize-2-opportunities.js +1 -0
  27. package/lib/esm/src/assets/app-teaser-images/optimize-3-reports.d.ts +1 -0
  28. package/lib/esm/src/assets/app-teaser-images/optimize-3-reports.js +1 -0
  29. package/lib/esm/src/assets/app-teaser-images/tasklist-1-task-manager.d.ts +1 -0
  30. package/lib/esm/src/assets/app-teaser-images/tasklist-1-task-manager.js +1 -0
  31. package/lib/esm/src/assets/app-teaser-images/tasklist-2-form.d.ts +1 -0
  32. package/lib/esm/src/assets/app-teaser-images/tasklist-2-form.js +1 -0
  33. package/lib/esm/src/assets/app-teaser-images/tasklist-3-api.d.ts +1 -0
  34. package/lib/esm/src/assets/app-teaser-images/tasklist-3-api.js +1 -0
  35. package/lib/esm/src/assets/c3-icons.d.ts +5 -0
  36. package/lib/esm/src/assets/c3-icons.js +14 -0
  37. package/lib/esm/src/assets/c3-icons.types.d.ts +3 -0
  38. package/lib/esm/src/assets/c3-icons.types.js +1 -0
  39. package/lib/esm/src/components/c3-app-teaser/app-teaser-cards-config.d.ts +5 -0
  40. package/lib/esm/src/components/c3-app-teaser/app-teaser-cards-config.js +99 -0
  41. package/lib/esm/src/components/c3-app-teaser/app-teaser-cards.d.ts +16 -0
  42. package/lib/esm/src/components/c3-app-teaser/app-teaser-cards.js +35 -0
  43. package/lib/esm/src/components/c3-app-teaser/app-teaster-card.d.ts +14 -0
  44. package/lib/esm/src/components/c3-app-teaser/app-teaster-card.js +23 -0
  45. package/lib/esm/src/components/c3-app-teaser/c3-app-teaser-page.d.ts +9 -0
  46. package/lib/esm/src/components/c3-app-teaser/c3-app-teaser-page.js +67 -0
  47. package/lib/esm/src/components/c3-app-teaser/c3-app-teaser-page.test.d.ts +1 -0
  48. package/lib/esm/src/components/c3-app-teaser/c3-app-teaser-page.test.js +28 -0
  49. package/lib/esm/src/components/c3-app-teaser/c3-app-teaser.d.ts +14 -0
  50. package/lib/esm/src/components/c3-app-teaser/c3-app-teaser.js +62 -0
  51. package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.d.ts +5 -0
  52. package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.js +78 -0
  53. package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.test.d.ts +1 -0
  54. package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.test.js +8 -0
  55. package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.types.d.ts +26 -0
  56. package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.types.js +6 -0
  57. package/lib/esm/src/components/c3-data-table/c3-data-table.d.ts +2 -0
  58. package/lib/esm/src/components/c3-data-table/c3-data-table.js +483 -0
  59. package/lib/esm/src/components/c3-data-table/c3-data-table.types.d.ts +111 -0
  60. package/lib/esm/src/components/c3-data-table/c3-data-table.types.js +1 -0
  61. package/lib/esm/src/components/c3-data-table/link-button/link-button.d.ts +2 -0
  62. package/lib/esm/src/components/c3-data-table/link-button/link-button.js +12 -0
  63. package/lib/esm/src/components/c3-data-table/link-button/link-button.types.d.ts +9 -0
  64. package/lib/esm/src/components/c3-data-table/link-button/link-button.types.js +1 -0
  65. package/lib/esm/src/components/c3-empty-state/c3-empty-state.d.ts +2 -0
  66. package/lib/esm/src/components/c3-empty-state/c3-empty-state.js +19 -0
  67. package/lib/esm/src/components/c3-empty-state/c3-empty-state.test.d.ts +1 -0
  68. package/lib/esm/src/components/c3-empty-state/c3-empty-state.test.js +16 -0
  69. package/lib/esm/src/components/c3-empty-state/c3-empty-state.types.d.ts +29 -0
  70. package/lib/esm/src/components/c3-empty-state/c3-empty-state.types.js +1 -0
  71. package/lib/esm/src/components/c3-help-center/c3-help-center-provider.d.ts +19 -0
  72. package/lib/esm/src/components/c3-help-center/c3-help-center-provider.js +52 -0
  73. package/lib/esm/src/components/c3-help-center/c3-help-center.d.ts +16 -0
  74. package/lib/esm/src/components/c3-help-center/c3-help-center.js +215 -0
  75. package/lib/esm/src/components/c3-help-center/c3-help-center.types.d.ts +43 -0
  76. package/lib/esm/src/components/c3-help-center/c3-help-center.types.js +1 -0
  77. package/lib/esm/src/components/c3-help-center/defaultHelpCenterConfig.d.ts +10 -0
  78. package/lib/esm/src/components/c3-help-center/defaultHelpCenterConfig.js +12 -0
  79. package/lib/esm/src/components/c3-help-center/help-center-hint.d.ts +3 -0
  80. package/lib/esm/src/components/c3-help-center/help-center-hint.js +17 -0
  81. package/lib/esm/src/components/c3-help-center/help-center.d.ts +18 -0
  82. package/lib/esm/src/components/c3-help-center/help-center.js +217 -0
  83. package/lib/esm/src/components/c3-help-center/recommendations.d.ts +4 -0
  84. package/lib/esm/src/components/c3-help-center/recommendations.js +50 -0
  85. package/lib/esm/src/components/c3-help-center/styles.d.ts +5 -0
  86. package/lib/esm/src/components/c3-help-center/styles.js +40 -0
  87. package/lib/esm/src/components/c3-help-center/tabs/feedback.d.ts +9 -0
  88. package/lib/esm/src/components/c3-help-center/tabs/feedback.js +184 -0
  89. package/lib/esm/src/components/c3-help-center/tabs/tabContent.d.ts +20 -0
  90. package/lib/esm/src/components/c3-help-center/tabs/tabContent.js +20 -0
  91. package/lib/esm/src/components/c3-help-center/tabs/tabContentSkeleton.d.ts +2 -0
  92. package/lib/esm/src/components/c3-help-center/tabs/tabContentSkeleton.js +22 -0
  93. package/lib/esm/src/components/c3-help-center/tile.d.ts +10 -0
  94. package/lib/esm/src/components/c3-help-center/tile.js +62 -0
  95. package/lib/esm/src/components/c3-navigation/c3-info-button.d.ts +4 -0
  96. package/lib/esm/src/components/c3-navigation/c3-info-button.js +5 -0
  97. package/lib/esm/src/components/c3-navigation/c3-navigation-actions/c3-action-buttons.d.ts +6 -0
  98. package/lib/esm/src/components/c3-navigation/c3-navigation-actions/c3-action-buttons.js +13 -0
  99. package/lib/esm/src/components/c3-navigation/c3-navigation-actions/c3-action-buttons.types.d.ts +10 -0
  100. package/lib/esm/src/components/c3-navigation/c3-navigation-actions/c3-action-buttons.types.js +1 -0
  101. package/lib/esm/src/components/c3-navigation/c3-navigation-appbar/c3-navigation-appbar.d.ts +3 -0
  102. package/lib/esm/src/components/c3-navigation/c3-navigation-appbar/c3-navigation-appbar.js +259 -0
  103. package/lib/esm/src/components/c3-navigation/c3-navigation-appbar/components.d.ts +6 -0
  104. package/lib/esm/src/components/c3-navigation/c3-navigation-appbar/components.js +15 -0
  105. package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-info-sidebar.d.ts +6 -0
  106. package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-info-sidebar.js +41 -0
  107. package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar-element.d.ts +11 -0
  108. package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar-element.js +67 -0
  109. package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.d.ts +10 -0
  110. package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.js +98 -0
  111. package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.types.d.ts +79 -0
  112. package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.types.js +1 -0
  113. package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-notification-sidebar.d.ts +5 -0
  114. package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-notification-sidebar.js +111 -0
  115. package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-sidebar-state-provider.d.ts +29 -0
  116. package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-sidebar-state-provider.js +48 -0
  117. package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-user-sidebar.d.ts +6 -0
  118. package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-user-sidebar.js +76 -0
  119. package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/components.d.ts +2 -0
  120. package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/components.js +6 -0
  121. package/lib/esm/src/components/c3-navigation/c3-navigation.d.ts +6 -0
  122. package/lib/esm/src/components/c3-navigation/c3-navigation.js +214 -0
  123. package/lib/esm/src/components/c3-navigation/c3-navigation.test.d.ts +1 -0
  124. package/lib/esm/src/components/c3-navigation/c3-navigation.test.js +80 -0
  125. package/lib/esm/src/components/c3-navigation/c3-navigation.types.d.ts +94 -0
  126. package/lib/esm/src/components/c3-navigation/c3-navigation.types.js +1 -0
  127. package/lib/esm/src/components/c3-navigation/c3-notification-provider/c3-notification-container.d.ts +13 -0
  128. package/lib/esm/src/components/c3-navigation/c3-notification-provider/c3-notification-container.js +111 -0
  129. package/lib/esm/src/components/c3-navigation/c3-notification-provider/c3-notification-provider.d.ts +31 -0
  130. package/lib/esm/src/components/c3-navigation/c3-notification-provider/c3-notification-provider.js +105 -0
  131. package/lib/esm/src/components/c3-navigation/c3-org-name.d.ts +6 -0
  132. package/lib/esm/src/components/c3-navigation/c3-org-name.js +37 -0
  133. package/lib/esm/src/components/c3-navigation/c3-org-sidebar/c3-org-sidebar.d.ts +6 -0
  134. package/lib/esm/src/components/c3-navigation/c3-org-sidebar/c3-org-sidebar.js +195 -0
  135. package/lib/esm/src/components/c3-navigation/c3-org-sidebar/components.d.ts +29 -0
  136. package/lib/esm/src/components/c3-navigation/c3-org-sidebar/components.js +88 -0
  137. package/lib/esm/src/components/c3-navigation/helpers.d.ts +9 -0
  138. package/lib/esm/src/components/c3-navigation/helpers.js +55 -0
  139. package/lib/esm/src/components/c3-navigation/index.d.ts +3 -0
  140. package/lib/esm/src/components/c3-navigation/index.js +3 -0
  141. package/lib/esm/src/components/c3-navigation/stories/story-helpers.d.ts +34 -0
  142. package/lib/esm/src/components/c3-navigation/stories/story-helpers.js +243 -0
  143. package/lib/esm/src/components/c3-navigation/stories/story-templates.d.ts +9 -0
  144. package/lib/esm/src/components/c3-navigation/stories/story-templates.js +35 -0
  145. package/lib/esm/src/components/c3-onboarding-survey/c3-onboarding-survey.d.ts +14 -0
  146. package/lib/esm/src/components/c3-onboarding-survey/c3-onboarding-survey.js +88 -0
  147. package/lib/esm/src/components/c3-onboarding-survey/defaultOnboardingConfig.d.ts +16 -0
  148. package/lib/esm/src/components/c3-onboarding-survey/defaultOnboardingConfig.js +3 -0
  149. package/lib/esm/src/components/c3-onboarding-survey/elements/dropdownSelect.d.ts +15 -0
  150. package/lib/esm/src/components/c3-onboarding-survey/elements/dropdownSelect.js +64 -0
  151. package/lib/esm/src/components/c3-onboarding-survey/elements/radioGroupMulti.d.ts +7 -0
  152. package/lib/esm/src/components/c3-onboarding-survey/elements/radioGroupMulti.js +62 -0
  153. package/lib/esm/src/components/c3-onboarding-survey/elements/radioGroupSingle.d.ts +7 -0
  154. package/lib/esm/src/components/c3-onboarding-survey/elements/radioGroupSingle.js +44 -0
  155. package/lib/esm/src/components/c3-onboarding-survey/elements/textField.d.ts +6 -0
  156. package/lib/esm/src/components/c3-onboarding-survey/elements/textField.js +14 -0
  157. package/lib/esm/src/components/c3-onboarding-survey/helpers.d.ts +1 -0
  158. package/lib/esm/src/components/c3-onboarding-survey/helpers.js +5 -0
  159. package/lib/esm/src/components/c3-onboarding-survey/onboarding.types.d.ts +33 -0
  160. package/lib/esm/src/components/c3-onboarding-survey/onboarding.types.js +8 -0
  161. package/lib/esm/src/components/c3-onboarding-survey/onboardingModal.d.ts +24 -0
  162. package/lib/esm/src/components/c3-onboarding-survey/onboardingModal.js +53 -0
  163. package/lib/esm/src/components/c3-onboarding-survey/onboardingPage.d.ts +20 -0
  164. package/lib/esm/src/components/c3-onboarding-survey/onboardingPage.js +42 -0
  165. package/lib/esm/src/components/c3-onboarding-survey/onboardingSurvey.d.ts +17 -0
  166. package/lib/esm/src/components/c3-onboarding-survey/onboardingSurvey.js +143 -0
  167. package/lib/esm/src/components/c3-onboarding-survey/step.d.ts +6 -0
  168. package/lib/esm/src/components/c3-onboarding-survey/step.js +36 -0
  169. package/lib/esm/src/components/c3-page/c3-breadcrumb/c3-breadcrumb.d.ts +3 -0
  170. package/lib/esm/src/components/c3-page/c3-breadcrumb/c3-breadcrumb.js +32 -0
  171. package/lib/esm/src/components/c3-page/c3-breadcrumb/c3-breadcrumb.types.d.ts +19 -0
  172. package/lib/esm/src/components/c3-page/c3-breadcrumb/c3-breadcrumb.types.js +1 -0
  173. package/lib/esm/src/components/c3-page/c3-page.d.ts +4 -0
  174. package/lib/esm/src/components/c3-page/c3-page.js +18 -0
  175. package/lib/esm/src/components/c3-page/c3-page.test.d.ts +1 -0
  176. package/lib/esm/src/components/c3-page/c3-page.test.js +20 -0
  177. package/lib/esm/src/components/c3-page/c3-page.types.d.ts +18 -0
  178. package/lib/esm/src/components/c3-page/c3-page.types.js +1 -0
  179. package/lib/esm/src/components/c3-page/c3-tabs/c3-tabs.d.ts +3 -0
  180. package/lib/esm/src/components/c3-page/c3-tabs/c3-tabs.js +33 -0
  181. package/lib/esm/src/components/c3-page/c3-tabs/c3-tabs.types.d.ts +14 -0
  182. package/lib/esm/src/components/c3-page/c3-tabs/c3-tabs.types.js +1 -0
  183. package/lib/esm/src/components/c3-user-configuration/authToken.d.ts +30 -0
  184. package/lib/esm/src/components/c3-user-configuration/authToken.js +25 -0
  185. package/lib/esm/src/components/c3-user-configuration/c3-profile-provider/c3-profile-provider.d.ts +24 -0
  186. package/lib/esm/src/components/c3-user-configuration/c3-profile-provider/c3-profile-provider.js +108 -0
  187. package/lib/esm/src/components/c3-user-configuration/c3-profile-provider/carbon-theme-provider.d.ts +13 -0
  188. package/lib/esm/src/components/c3-user-configuration/c3-profile-provider/carbon-theme-provider.js +23 -0
  189. package/lib/esm/src/components/c3-user-configuration/c3-user-configuration-provider.d.ts +36 -0
  190. package/lib/esm/src/components/c3-user-configuration/c3-user-configuration-provider.js +51 -0
  191. package/lib/esm/src/components/styles.d.ts +14 -0
  192. package/lib/esm/src/components/styles.js +91 -0
  193. package/lib/esm/src/components/test-utils.d.ts +3 -0
  194. package/lib/esm/src/components/test-utils.js +22 -0
  195. package/lib/esm/src/hooks/useApi.d.ts +21 -0
  196. package/lib/esm/src/hooks/useApi.js +49 -0
  197. package/lib/esm/src/index.d.ts +30 -0
  198. package/lib/esm/src/index.js +21 -0
  199. package/lib/esm/src/utils/camunda.d.ts +7 -0
  200. package/lib/esm/src/utils/camunda.js +24 -0
  201. package/lib/esm/src/utils/camunda.types.d.ts +55 -0
  202. package/lib/esm/src/utils/camunda.types.js +1 -0
  203. package/package.json +115 -0
package/README.md ADDED
@@ -0,0 +1,149 @@
1
+ # Camunda Composite Components
2
+
3
+ Camunda Composite Components (also known as **C3**) is the main software
4
+ artifact of the
5
+ [Design System Team](https://confluence.camunda.com/display/HAN/Design+System).
6
+
7
+ We have a dedicated slack channel for everyone having questions, comments, bug
8
+ reports or concerns about this repository:
9
+ [#camunda-composite-components](https://app.slack.com/client/T0PM0P1SA/C049YH1C202/thread/C03NF7FH17G-1671730364.608129).
10
+ For more general questions towards the Design System team, please use
11
+ [#ask-cds](https://app.slack.com/client/T0PM0P1SA/C04FUEGLG8N).
12
+
13
+ If you like the idea of having a repository for your own composite components -
14
+ how about you do your own **Camunda Custom Composite Components**? Just go over
15
+ [here](https://github.com/camunda-cloud/c4-starter), fork it, lezgo! A list of
16
+ C4-Adopters can be found <a href="#c4list">here</a>.
17
+
18
+ ## Storybook
19
+
20
+ A live view of the `main` branch can be found
21
+ [here](https://camunda-composite-components.pages.dev/). When opening a PR, a
22
+ version of storybook with the changes is deployed automatically and can be
23
+ accessed by clicking on the link in the PR.
24
+
25
+ ## Dev
26
+
27
+ ```bash
28
+ # install
29
+ yarn
30
+
31
+ # start storybook
32
+ yarn storybook
33
+
34
+ # build components
35
+ yarn build
36
+ ```
37
+
38
+ ## Release
39
+
40
+ Simply run our
41
+ [release workflow](https://github.com/camunda-cloud/camunda-composite-components/actions/workflows/release.yml)
42
+ in the GitHub Actions tab. This will create a new release, publish the package
43
+ to npm and update the changelog automatically.
44
+
45
+ Pushing to `main` will update the storybook available under
46
+ [cloudflare page](https://camunda-composite-components.pages.dev/).
47
+
48
+ ## Usage
49
+
50
+ Example for navbar:
51
+
52
+ ```tsx
53
+ import { C3NavigationElementProps } from "@camunda/camunda-composite-components"
54
+
55
+ // ...
56
+
57
+ return (
58
+ <C3Navigation
59
+ app={{
60
+ ariaLabel: "Camunda Console",
61
+ name: "Console",
62
+ prefix: "Camunda",
63
+ routeProps: { route: routes.home, router: router },
64
+ }}
65
+ // ...
66
+ />
67
+ )
68
+ ```
69
+
70
+ ## <a name="c4list"></a> (incomplete) List of adopters of C3+C4
71
+
72
+ - [Console team](https://confluence.camunda.com/display/HAN/Console+Team)
73
+ started this, their C4 repo can be found
74
+ [here](https://github.com/camunda/camunda-cloud-management-apps/tree/main/packages/c4)
75
+ - [Identity team](https://github.com/camunda/team-identity):
76
+ [c4-identity](https://github.com/camunda-cloud/c4-identity)
77
+
78
+ ## Testing
79
+
80
+ ### Visual regression tests (VRT)
81
+
82
+ We use [Playwright](https://playwright.dev/docs/intro) screenshot tests to be
83
+ aware of any visual changes introduced by dependency updates or changes in the
84
+ component code.
85
+
86
+ #### Running VRT locally
87
+
88
+ We run VRT inside a docker container to avoid different results caused by
89
+ different platforms. Simply run:
90
+
91
+ ```shell
92
+ yarn start:docker-storybook
93
+ ```
94
+
95
+ then
96
+
97
+ ```shell
98
+ yarn test:visual-regression:docker
99
+ ```
100
+
101
+ The commands above will:
102
+
103
+ 1. Build storybook.
104
+ 2. Start a Playwright docker container with the name `c3-visual-regression`.
105
+ 3. Serve storybook within the docker container.
106
+ 4. Run the visual regression tests within the docker container.
107
+
108
+ When developing, it might not always be helpful to run all of these steps at
109
+ once. You can find more granular scripts in the [package.json](package.json).
110
+
111
+ #### Running VRT in the CI
112
+
113
+ There is a `Visual regression tests` workflow that is triggered automatically on
114
+ push. You can also trigger it manually in the `Actions` tab.
115
+
116
+ If the workflow fails, you can find the test report by navigating to the
117
+ workflow run summary, then scrolling down to the `Artifacts` section. Click on
118
+ the artifact called `Playwright report` to download it, go to your downloads
119
+ folder, then open the `index.html` file of the test report in your browser to
120
+ view the report.
121
+
122
+ #### How to deal with failing tests
123
+
124
+ When a VRT fails, this can have two reasons:
125
+
126
+ 1. A change was introduced unknowingly. In this case, have a look at the test
127
+ report and check if the change was intended. If it is, proceed with 2.
128
+ 2. You made a change to the UI on purpose. In this case you need to update the
129
+ screenshot as follows.
130
+
131
+ Make sure you have the `c3-visual-regression` docker container running, or start
132
+ it like described [here](#running-vrt-locally). Then, have a look at the test
133
+ report:
134
+
135
+ ```shell
136
+ yarn report:visual-regression
137
+ ```
138
+
139
+ Double-check that you don't apply any unwanted changes by looking at the
140
+ difference that is highlighted in the failed test's report.
141
+
142
+ To update all screenshots, run:
143
+
144
+ ```shell
145
+ yarn update:visual-regression:docker
146
+ ```
147
+
148
+ The tests should now pass locally and in the CI. Commit and push the updated
149
+ screenshot(s).
@@ -0,0 +1,116 @@
1
+ {
2
+ "name": "@camunda/camunda-composite-components",
3
+ "version": "0.16.0",
4
+ "publishConfig": {
5
+ "access": "public",
6
+ "registry": "https://registry.npmjs.org/"
7
+ },
8
+ "scripts": {
9
+ "clean": "rimraf lib/",
10
+ "build": "pnpm clean && tsc",
11
+ "storybook": "storybook dev -p 6006",
12
+ "start": "pnpm storybook",
13
+ "build-storybook": "storybook build",
14
+ "build:all": "pnpm build && pnpm build-storybook",
15
+ "serve:storybook": "serve ./storybook-static -p 6006 -n -L",
16
+ "prepare": "husky",
17
+ "format": "prettier --write .",
18
+ "lint": "eslint src/",
19
+ "lint:fix": "eslint --fix src/",
20
+ "test:ts": "tsc --noEmit --project ./tsconfig.json",
21
+ "test:storybook": "TEST_A11Y=true test-storybook",
22
+ "test:storybook:smoke": "test-storybook",
23
+ "start:docker-storybook": "pnpm build-storybook && docker-compose up -d && docker-compose exec c3-visual-regression pnpm serve:storybook",
24
+ "test:visual-regression": "wait-on http://localhost:6006 && PWTEST_SKIP_TEST_OUTPUT=1 pnpm playwright test",
25
+ "test:visual-regression:ui": "pnpm test:playwright --ui",
26
+ "report:visual-regression": "pnpm playwright show-report",
27
+ "update:visual-regression": "pnpm playwright test --update-snapshots",
28
+ "test:visual-regression:docker": "docker exec -it -t c3-visual-regression pnpm test:visual-regression",
29
+ "update:visual-regression:docker": "docker exec -it -t c3-visual-regression pnpm update:visual-regression",
30
+ "test": "pnpm test:ts && pnpm test:storybook && pnpm test:visual-regression:docker"
31
+ },
32
+ "devDependencies": {
33
+ "@babel/core": "7.25.7",
34
+ "@babel/preset-env": "7.25.7",
35
+ "@babel/preset-react": "7.25.7",
36
+ "@babel/preset-typescript": "7.25.7",
37
+ "@carbon/react": "1.69.0",
38
+ "@mdx-js/react": "3.0.1",
39
+ "@playwright/test": "1.45.2",
40
+ "@semantic-release/changelog": "6.0.3",
41
+ "@semantic-release/git": "10.0.1",
42
+ "@storybook/addon-a11y": "8.2.9",
43
+ "@storybook/addon-actions": "8.2.9",
44
+ "@storybook/addon-docs": "8.2.9",
45
+ "@storybook/addon-essentials": "8.2.9",
46
+ "@storybook/addon-interactions": "8.2.9",
47
+ "@storybook/addon-links": "8.2.9",
48
+ "@storybook/addon-mdx-gfm": "8.2.9",
49
+ "@storybook/addon-webpack5-compiler-babel": "3.0.3",
50
+ "@storybook/blocks": "8.2.9",
51
+ "@storybook/preset-scss": "1.0.3",
52
+ "@storybook/react": "8.2.9",
53
+ "@storybook/react-webpack5": "8.2.9",
54
+ "@storybook/test": "8.2.9",
55
+ "@storybook/test-runner": "0.19.1",
56
+ "@types/carbon-components-react": "7.55.10",
57
+ "@types/event-source-polyfill": "1.0.5",
58
+ "@types/mixpanel-browser": "2.49.0",
59
+ "@types/node": "20.12.4",
60
+ "@types/react": "18.0.28",
61
+ "@types/react-dom": "18.0.11",
62
+ "@types/styled-components": "5.1.34",
63
+ "@typescript-eslint/eslint-plugin": "7.17.0",
64
+ "@typescript-eslint/parser": "7.17.0",
65
+ "axe-playwright": "2.0.1",
66
+ "babel-loader": "9.2.1",
67
+ "conventional-changelog-conventionalcommits": "7.0.2",
68
+ "copyfiles": "2.4.1",
69
+ "css-loader": "7.1.0",
70
+ "eslint": "8.57.0",
71
+ "eslint-config-prettier": "9.1.0",
72
+ "eslint-import-resolver-typescript": "3.6.1",
73
+ "eslint-plugin-import": "2.29.1",
74
+ "eslint-plugin-prettier": "5.2.1",
75
+ "eslint-plugin-react": "7.35.0",
76
+ "eslint-plugin-react-hooks": "4.6.2",
77
+ "eslint-plugin-storybook": "0.8.0",
78
+ "event-source-polyfill": "1.0.31",
79
+ "husky": "9.1.2",
80
+ "mixpanel-browser": "2.49.0",
81
+ "prettier": "3.3.3",
82
+ "react": "18.2.0",
83
+ "react-dom": "18.2.0",
84
+ "rimraf": "6.0.1",
85
+ "sass": "1.74.1",
86
+ "sass-loader": "14.1.1",
87
+ "semantic-release": "23.0.7",
88
+ "serve": "14.2.1",
89
+ "storybook": "8.2.9",
90
+ "style-loader": "4.0.0",
91
+ "styled-components": "6.1.8",
92
+ "typescript": "4.9.5",
93
+ "wait-on": "7.2.0",
94
+ "webpack": "5.94.0"
95
+ },
96
+ "dependencies": {
97
+ "jwt-decode": "4.0.0",
98
+ "react-error-boundary": "4.0.13",
99
+ "react-markdown": "8.0.7"
100
+ },
101
+ "peerDependencies": {
102
+ "@carbon/react": "1.x",
103
+ "event-source-polyfill": "1.0.x",
104
+ "react": "18.x",
105
+ "react-dom": "18.x",
106
+ "styled-components": "5.x || 6.x"
107
+ },
108
+ "description": "Camunda Composite Components",
109
+ "main": "./lib/esm/src/index.js",
110
+ "types": "./lib/esm/src/index.d.ts",
111
+ "files": [
112
+ "/lib"
113
+ ],
114
+ "author": "Camunda",
115
+ "license": "Apache-2.0"
116
+ }
@@ -0,0 +1,28 @@
1
+ import { Endpoints, Stage } from "./endpoints.const";
2
+ export interface RequestPayload {
3
+ url: string;
4
+ base?: "notifications" | "accounts";
5
+ stage?: Stage;
6
+ endpoints?: Endpoints;
7
+ method?: "get" | "post" | "put" | "delete" | "patch";
8
+ headers?: {
9
+ [key: string]: string;
10
+ };
11
+ type?: "json" | "text" | "form" | "none";
12
+ responseType?: "json" | "text" | "none";
13
+ camundaAuth?: {
14
+ token: string;
15
+ refreshTokenMethod?: () => Promise<string>;
16
+ };
17
+ body?: string | FormData | {
18
+ [key: string]: unknown;
19
+ };
20
+ enableLogs?: boolean;
21
+ }
22
+ export type RequestResponse<R = undefined> = {
23
+ success: boolean;
24
+ result?: R;
25
+ status?: number;
26
+ error?: string;
27
+ };
28
+ export declare const request: <R = undefined>(payload: RequestPayload) => Promise<RequestResponse<R>>;
@@ -0,0 +1,86 @@
1
+ import { getEndpoint, NOTIFICATIONS, ACCOUNTS, } from "./endpoints.const";
2
+ import { JWTUtils } from "./jwt.utils";
3
+ export const request = async (payload) => {
4
+ const headers = {};
5
+ if (payload.camundaAuth) {
6
+ if (JWTUtils.isExpired(payload.camundaAuth.token) &&
7
+ payload.camundaAuth.refreshTokenMethod) {
8
+ const newToken = await payload.camundaAuth?.refreshTokenMethod?.();
9
+ headers.Authorization = `Bearer ${newToken}`;
10
+ }
11
+ else {
12
+ headers.Authorization = `Bearer ${payload.camundaAuth.token}`;
13
+ }
14
+ }
15
+ const type = payload.type ?? "json";
16
+ if (type) {
17
+ switch (type) {
18
+ case "json":
19
+ headers["Content-Type"] = "application/json";
20
+ break;
21
+ case "text":
22
+ headers["Content-Type"] = "text/plain";
23
+ break;
24
+ }
25
+ }
26
+ const body = payload.body && type === "json"
27
+ ? JSON.stringify(payload.body)
28
+ : payload.body instanceof FormData
29
+ ? payload.body
30
+ : undefined;
31
+ let base;
32
+ if (payload.base) {
33
+ switch (payload.base) {
34
+ case "notifications":
35
+ if (payload.endpoints?.notifications) {
36
+ base = payload.endpoints.notifications;
37
+ }
38
+ else if (payload.stage) {
39
+ base = getEndpoint(payload.stage, NOTIFICATIONS);
40
+ }
41
+ break;
42
+ case "accounts":
43
+ if (payload.endpoints?.accounts) {
44
+ base = payload.endpoints.accounts;
45
+ }
46
+ else if (payload.stage) {
47
+ base = getEndpoint(payload.stage, ACCOUNTS);
48
+ }
49
+ }
50
+ }
51
+ const url = base ? `${base}/${payload.url}` : payload.url;
52
+ try {
53
+ const response = await fetch(url, {
54
+ method: payload.method ? payload.method.toUpperCase() : "GET",
55
+ headers,
56
+ body,
57
+ });
58
+ if (response.status >= 400) {
59
+ if (payload.enableLogs)
60
+ console.error(response.statusText, response.status);
61
+ return {
62
+ success: false,
63
+ status: response.status,
64
+ error: response.statusText,
65
+ };
66
+ }
67
+ const responseType = payload.responseType ?? type;
68
+ let res;
69
+ switch (responseType) {
70
+ case "json":
71
+ res = await response.json();
72
+ break;
73
+ case "text":
74
+ res = await response.text();
75
+ break;
76
+ default:
77
+ res = response;
78
+ }
79
+ return { success: true, result: res };
80
+ }
81
+ catch (error) {
82
+ if (payload.enableLogs)
83
+ console.error("API request failed:", error);
84
+ return { success: false, error: error?.toString() };
85
+ }
86
+ };
@@ -0,0 +1,19 @@
1
+ export interface Endpoint {
2
+ id: string;
3
+ dev: string;
4
+ int: string;
5
+ prod: string;
6
+ }
7
+ export interface Endpoints {
8
+ notifications?: string;
9
+ accounts?: string;
10
+ }
11
+ export declare const NOTIFICATIONS: Endpoint;
12
+ export declare const ACCOUNTS: Endpoint;
13
+ export type Stage = "dev" | "int" | "prod";
14
+ export declare function getEndpoint(stage: Stage, endpoint: Endpoint): string;
15
+ export declare function getEndpointByOptions(options: {
16
+ stage?: Stage;
17
+ endpoints?: Endpoints;
18
+ endpoint: Endpoint;
19
+ }): string;
@@ -0,0 +1,44 @@
1
+ export const NOTIFICATIONS = {
2
+ id: "notifications",
3
+ dev: "https://notifications.cloud.dev.ultrawombat.com",
4
+ int: "https://notifications.cloud.ultrawombat.com",
5
+ prod: "https://notifications.cloud.camunda.io",
6
+ };
7
+ export const ACCOUNTS = {
8
+ id: "accounts",
9
+ dev: "https://accounts.cloud.dev.ultrawombat.com",
10
+ int: "https://accounts.cloud.ultrawombat.com",
11
+ prod: "https://accounts.cloud.camunda.io",
12
+ };
13
+ export function getEndpoint(stage, endpoint) {
14
+ switch (stage) {
15
+ case "dev":
16
+ return endpoint.dev;
17
+ case "int":
18
+ return endpoint.int;
19
+ case "prod":
20
+ return endpoint.prod;
21
+ default:
22
+ throw new Error(`Unknown stage: ${stage}`);
23
+ }
24
+ }
25
+ export function getEndpointByOptions(options) {
26
+ switch (options.endpoint.id) {
27
+ case "notifications":
28
+ if (options.endpoints?.notifications) {
29
+ return options.endpoints.notifications;
30
+ }
31
+ else if (options.stage) {
32
+ return getEndpoint(options.stage, options.endpoint);
33
+ }
34
+ break;
35
+ case "accounts":
36
+ if (options.endpoints?.accounts) {
37
+ return options.endpoints.accounts;
38
+ }
39
+ else if (options.stage) {
40
+ return getEndpoint(options.stage, options.endpoint);
41
+ }
42
+ }
43
+ throw new Error(`Missing stage or notifications endpoint`);
44
+ }
@@ -0,0 +1,41 @@
1
+ import { HelpCenterConfig } from "../components/c3-help-center/defaultHelpCenterConfig";
2
+ import { Persona, TileConfig, WpCardType } from "../components/c3-help-center/c3-help-center.types";
3
+ import { OnboardingConfig } from "../components/c3-onboarding-survey/defaultOnboardingConfig";
4
+ import { RequestPayload, RequestResponse } from "./api";
5
+ export declare const getConfig: (accessToken: string, audience: string, orgId: string) => Promise<RequestResponse<HelpCenterConfig | null>>;
6
+ export declare const getTiles: ({ accessToken, tileConfig, salesPlanType, clusterIds, persona, flags, cloudAudience, }: {
7
+ accessToken: string;
8
+ tileConfig: TileConfig[];
9
+ cloudAudience: string;
10
+ persona: {
11
+ [id: string]: unknown;
12
+ };
13
+ clusterIds: string[];
14
+ salesPlanType: string;
15
+ flags: string[];
16
+ }) => Promise<RequestResponse<WpCardType[]>>;
17
+ export declare const getOnboardingConfig: ({ camundaAuth, audience, orgId, }: {
18
+ audience: string;
19
+ camundaAuth: RequestPayload["camundaAuth"];
20
+ orgId: string;
21
+ }) => Promise<RequestResponse<OnboardingConfig>>;
22
+ export declare const updatePersona: ({ newPersona, audience, accessToken, orgId, userId, }: {
23
+ newPersona: Persona;
24
+ audience: string;
25
+ orgId: string;
26
+ userId: string;
27
+ accessToken: string;
28
+ }) => Promise<RequestResponse<undefined>>;
29
+ export declare const submitSurvey: ({ audience, token, data, }: {
30
+ audience: string;
31
+ token: string;
32
+ data: Persona & {
33
+ email: string;
34
+ orgUuid: string;
35
+ };
36
+ }) => Promise<RequestResponse<undefined>>;
37
+ export declare const submitFeedback: ({ token, audience, formData, }: {
38
+ token: string;
39
+ audience: string;
40
+ formData: FormData;
41
+ }) => Promise<RequestResponse<undefined>>;
@@ -0,0 +1,47 @@
1
+ import { recommendations } from "../components/c3-help-center/recommendations";
2
+ import { request } from "./api";
3
+ export const getConfig = async (accessToken, audience, orgId) => {
4
+ return await request({
5
+ url: `https://helpcenter.${audience}/helpcenter/config/${orgId}`,
6
+ camundaAuth: {
7
+ token: accessToken,
8
+ },
9
+ });
10
+ };
11
+ export const getTiles = async ({ accessToken, tileConfig, salesPlanType, clusterIds, persona, flags, cloudAudience, }) => {
12
+ const availableTileTypes = recommendations(persona, flags, tileConfig, salesPlanType, clusterIds?.length > 0);
13
+ return await request({
14
+ url: `https://helpcenter.${cloudAudience}/cards?card_id=${availableTileTypes.join(",")}`,
15
+ responseType: "json",
16
+ camundaAuth: { token: accessToken },
17
+ });
18
+ };
19
+ export const getOnboardingConfig = ({ camundaAuth, audience, orgId, }) => request({
20
+ url: `https://helpcenter.${audience}/survey/config/${orgId}`,
21
+ camundaAuth,
22
+ type: "json",
23
+ });
24
+ export const updatePersona = async ({ newPersona, audience, accessToken, orgId, userId, }) => request({
25
+ url: `https://helpcenter.${audience}/persona`,
26
+ method: "patch",
27
+ camundaAuth: { token: accessToken },
28
+ type: "json",
29
+ body: { persona: newPersona, userId, orgId },
30
+ responseType: "text",
31
+ });
32
+ export const submitSurvey = async ({ audience, token, data, }) => request({
33
+ method: "post",
34
+ url: `https://helpcenter.${audience}/survey/submit`,
35
+ camundaAuth: { token },
36
+ type: "json",
37
+ body: { data },
38
+ responseType: "text",
39
+ });
40
+ export const submitFeedback = async ({ token, audience, formData, }) => request({
41
+ method: "post",
42
+ url: `https://helpcenter.${audience}/feedback/submit`,
43
+ camundaAuth: { token },
44
+ body: formData,
45
+ type: "form",
46
+ responseType: "text",
47
+ });
@@ -0,0 +1,5 @@
1
+ export declare class JWTUtils {
2
+ static decode(token: string): any;
3
+ static getExpiration(token: string): number;
4
+ static isExpired(token: string): boolean;
5
+ }
@@ -0,0 +1,23 @@
1
+ export class JWTUtils {
2
+ static decode(token) {
3
+ const base64Url = token.split(".")[1];
4
+ const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
5
+ const jsonPayload = decodeURIComponent(window
6
+ .atob(base64)
7
+ .split("")
8
+ .map(function (c) {
9
+ return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
10
+ })
11
+ .join(""));
12
+ return JSON.parse(jsonPayload);
13
+ }
14
+ static getExpiration(token) {
15
+ const decoded = JWTUtils.decode(token);
16
+ return decoded.exp;
17
+ }
18
+ static isExpired(token) {
19
+ const expiration = JWTUtils.getExpiration(token);
20
+ const now = new Date().getTime() / 1000;
21
+ return expiration < now;
22
+ }
23
+ }
@@ -0,0 +1,41 @@
1
+ import { C3NotificationsProps } from "../components/c3-navigation/c3-navigation.types";
2
+ import { RequestResponse } from "./api";
3
+ export interface Notification {
4
+ uuid: string;
5
+ userId?: string;
6
+ orgId?: string;
7
+ timestamp: number;
8
+ source: string;
9
+ type: string;
10
+ title: string;
11
+ description: string;
12
+ state: string;
13
+ meta?: {
14
+ identifier?: string;
15
+ href?: string;
16
+ label?: string;
17
+ entity?: {
18
+ id: string;
19
+ type: string;
20
+ };
21
+ parentEntity?: {
22
+ id: string;
23
+ type: string;
24
+ };
25
+ };
26
+ }
27
+ export type AnalyticsEvent = "notification-panel-opened" | "notification-clicked-cta";
28
+ export declare class NotificationService {
29
+ static getNotifications(options: C3NotificationsProps): Promise<RequestResponse<Notification[]>>;
30
+ static sendAnalyticsEvent(options: C3NotificationsProps, eventOptions: {
31
+ event: AnalyticsEvent;
32
+ id?: string;
33
+ }): void;
34
+ static changeState(options: C3NotificationsProps, notificationId: string, operation: "read" | "dismiss"): void;
35
+ static markManyAsRead(options: C3NotificationsProps, notificationIds: string[]): void;
36
+ static dismissAll(options: C3NotificationsProps, orgId: string): void;
37
+ static notificationsStream(options: C3NotificationsProps, handler: (notification: Notification) => void): void;
38
+ static updateNotifications(allNotifications: Notification[], newNotification: Notification): Notification[];
39
+ static updateNotificationState(allNotifications: Notification[], notificationId: string, newState: "read" | "dismiss"): Notification[];
40
+ static updateNotificationStates(allNotifications: Notification[], notificationIds: string[], newState: "read" | "dismiss"): Notification[];
41
+ }