@strapi/admin 5.19.0 → 5.20.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.
Files changed (149) hide show
  1. package/dist/admin/admin/src/components/Filters.js +10 -1
  2. package/dist/admin/admin/src/components/Filters.js.map +1 -1
  3. package/dist/admin/admin/src/components/Filters.mjs +10 -1
  4. package/dist/admin/admin/src/components/Filters.mjs.map +1 -1
  5. package/dist/admin/admin/src/components/{UnstableGuidedTour → GuidedTour}/Context.js +18 -43
  6. package/dist/admin/admin/src/components/GuidedTour/Context.js.map +1 -0
  7. package/dist/admin/admin/src/components/{UnstableGuidedTour → GuidedTour}/Context.mjs +17 -42
  8. package/dist/admin/admin/src/components/GuidedTour/Context.mjs.map +1 -0
  9. package/dist/admin/admin/src/components/{UnstableGuidedTour → GuidedTour}/Overview.js +10 -6
  10. package/dist/admin/admin/src/components/GuidedTour/Overview.js.map +1 -0
  11. package/dist/admin/admin/src/components/{UnstableGuidedTour → GuidedTour}/Overview.mjs +11 -7
  12. package/dist/admin/admin/src/components/GuidedTour/Overview.mjs.map +1 -0
  13. package/dist/admin/admin/src/components/{UnstableGuidedTour → GuidedTour}/Step.js +6 -6
  14. package/dist/admin/admin/src/components/GuidedTour/Step.js.map +1 -0
  15. package/dist/admin/admin/src/components/{UnstableGuidedTour → GuidedTour}/Step.mjs +7 -7
  16. package/dist/admin/admin/src/components/GuidedTour/Step.mjs.map +1 -0
  17. package/dist/admin/admin/src/components/{UnstableGuidedTour → GuidedTour}/Tours.js +10 -16
  18. package/dist/admin/admin/src/components/GuidedTour/Tours.js.map +1 -0
  19. package/dist/admin/admin/src/components/{UnstableGuidedTour → GuidedTour}/Tours.mjs +11 -17
  20. package/dist/admin/admin/src/components/GuidedTour/Tours.mjs.map +1 -0
  21. package/dist/admin/admin/src/components/LeftMenu.js +1 -1
  22. package/dist/admin/admin/src/components/LeftMenu.js.map +1 -1
  23. package/dist/admin/admin/src/components/LeftMenu.mjs +1 -1
  24. package/dist/admin/admin/src/components/LeftMenu.mjs.map +1 -1
  25. package/dist/admin/admin/src/components/Providers.js +9 -10
  26. package/dist/admin/admin/src/components/Providers.js.map +1 -1
  27. package/dist/admin/admin/src/components/Providers.mjs +9 -10
  28. package/dist/admin/admin/src/components/Providers.mjs.map +1 -1
  29. package/dist/admin/admin/src/components/SubNav.js +1 -1
  30. package/dist/admin/admin/src/components/SubNav.js.map +1 -1
  31. package/dist/admin/admin/src/components/SubNav.mjs +1 -1
  32. package/dist/admin/admin/src/components/SubNav.mjs.map +1 -1
  33. package/dist/admin/admin/src/core/apis/Widgets.js +34 -16
  34. package/dist/admin/admin/src/core/apis/Widgets.js.map +1 -1
  35. package/dist/admin/admin/src/core/apis/Widgets.mjs +34 -16
  36. package/dist/admin/admin/src/core/apis/Widgets.mjs.map +1 -1
  37. package/dist/admin/admin/src/features/Tracking.js.map +1 -1
  38. package/dist/admin/admin/src/features/Tracking.mjs.map +1 -1
  39. package/dist/admin/admin/src/layouts/AuthenticatedLayout.js +1 -18
  40. package/dist/admin/admin/src/layouts/AuthenticatedLayout.js.map +1 -1
  41. package/dist/admin/admin/src/layouts/AuthenticatedLayout.mjs +1 -18
  42. package/dist/admin/admin/src/layouts/AuthenticatedLayout.mjs.map +1 -1
  43. package/dist/admin/admin/src/pages/Auth/components/Register.js +0 -11
  44. package/dist/admin/admin/src/pages/Auth/components/Register.js.map +1 -1
  45. package/dist/admin/admin/src/pages/Auth/components/Register.mjs +0 -11
  46. package/dist/admin/admin/src/pages/Auth/components/Register.mjs.map +1 -1
  47. package/dist/admin/admin/src/pages/Home/HomePage.js +2 -3
  48. package/dist/admin/admin/src/pages/Home/HomePage.js.map +1 -1
  49. package/dist/admin/admin/src/pages/Home/HomePage.mjs +2 -3
  50. package/dist/admin/admin/src/pages/Home/HomePage.mjs.map +1 -1
  51. package/dist/admin/admin/src/pages/ProfilePage.js +2 -2
  52. package/dist/admin/admin/src/pages/ProfilePage.js.map +1 -1
  53. package/dist/admin/admin/src/pages/ProfilePage.mjs +2 -2
  54. package/dist/admin/admin/src/pages/ProfilePage.mjs.map +1 -1
  55. package/dist/admin/admin/src/pages/Settings/components/Tokens/TokenBox.js +6 -6
  56. package/dist/admin/admin/src/pages/Settings/components/Tokens/TokenBox.js.map +1 -1
  57. package/dist/admin/admin/src/pages/Settings/components/Tokens/TokenBox.mjs +6 -6
  58. package/dist/admin/admin/src/pages/Settings/components/Tokens/TokenBox.mjs.map +1 -1
  59. package/dist/admin/admin/src/pages/Settings/pages/ApiTokens/EditView/EditViewPage.js +1 -7
  60. package/dist/admin/admin/src/pages/Settings/pages/ApiTokens/EditView/EditViewPage.js.map +1 -1
  61. package/dist/admin/admin/src/pages/Settings/pages/ApiTokens/EditView/EditViewPage.mjs +2 -8
  62. package/dist/admin/admin/src/pages/Settings/pages/ApiTokens/EditView/EditViewPage.mjs.map +1 -1
  63. package/dist/admin/admin/src/pages/Settings/pages/ApiTokens/ListView.js +1 -8
  64. package/dist/admin/admin/src/pages/Settings/pages/ApiTokens/ListView.js.map +1 -1
  65. package/dist/admin/admin/src/pages/Settings/pages/ApiTokens/ListView.mjs +1 -8
  66. package/dist/admin/admin/src/pages/Settings/pages/ApiTokens/ListView.mjs.map +1 -1
  67. package/dist/admin/admin/src/pages/Settings/pages/TransferTokens/EditView.js +0 -2
  68. package/dist/admin/admin/src/pages/Settings/pages/TransferTokens/EditView.js.map +1 -1
  69. package/dist/admin/admin/src/pages/Settings/pages/TransferTokens/EditView.mjs +0 -2
  70. package/dist/admin/admin/src/pages/Settings/pages/TransferTokens/EditView.mjs.map +1 -1
  71. package/dist/admin/admin/src/pages/Settings/pages/Users/ListPage.js +3 -1
  72. package/dist/admin/admin/src/pages/Settings/pages/Users/ListPage.js.map +1 -1
  73. package/dist/admin/admin/src/pages/Settings/pages/Users/ListPage.mjs +3 -1
  74. package/dist/admin/admin/src/pages/Settings/pages/Users/ListPage.mjs.map +1 -1
  75. package/dist/admin/admin/src/translations/en.json.js +7 -3
  76. package/dist/admin/admin/src/translations/en.json.js.map +1 -1
  77. package/dist/admin/admin/src/translations/en.json.mjs +7 -3
  78. package/dist/admin/admin/src/translations/en.json.mjs.map +1 -1
  79. package/dist/admin/admin/tests/utils.js +25 -28
  80. package/dist/admin/admin/tests/utils.js.map +1 -1
  81. package/dist/admin/admin/tests/utils.mjs +25 -28
  82. package/dist/admin/admin/tests/utils.mjs.map +1 -1
  83. package/dist/admin/ee/admin/src/pages/SettingsPage/pages/AuditLogs/ListPage.js +3 -1
  84. package/dist/admin/ee/admin/src/pages/SettingsPage/pages/AuditLogs/ListPage.js.map +1 -1
  85. package/dist/admin/ee/admin/src/pages/SettingsPage/pages/AuditLogs/ListPage.mjs +3 -1
  86. package/dist/admin/ee/admin/src/pages/SettingsPage/pages/AuditLogs/ListPage.mjs.map +1 -1
  87. package/dist/admin/index.js +2 -4
  88. package/dist/admin/index.js.map +1 -1
  89. package/dist/admin/index.mjs +1 -2
  90. package/dist/admin/index.mjs.map +1 -1
  91. package/dist/admin/src/components/Filters.d.ts +3 -1
  92. package/dist/admin/src/components/{UnstableGuidedTour → GuidedTour}/Context.d.ts +3 -3
  93. package/dist/admin/src/components/GuidedTour/Overview.d.ts +1 -0
  94. package/dist/admin/src/components/{UnstableGuidedTour → GuidedTour}/Step.d.ts +1 -1
  95. package/dist/admin/src/core/apis/Widgets.d.ts +8 -5
  96. package/dist/admin/src/features/Tracking.d.ts +1 -1
  97. package/dist/admin/src/index.d.ts +2 -3
  98. package/dist/admin/src/pages/Settings/components/Tokens/TokenBox.d.ts +1 -1
  99. package/dist/ee/server/src/audit-logs/services/lifecycles.d.ts.map +1 -1
  100. package/dist/server/ee/server/src/audit-logs/services/lifecycles.js +9 -8
  101. package/dist/server/ee/server/src/audit-logs/services/lifecycles.js.map +1 -1
  102. package/dist/server/ee/server/src/audit-logs/services/lifecycles.mjs +9 -8
  103. package/dist/server/ee/server/src/audit-logs/services/lifecycles.mjs.map +1 -1
  104. package/dist/server/server/src/domain/user.js +3 -1
  105. package/dist/server/server/src/domain/user.js.map +1 -1
  106. package/dist/server/server/src/domain/user.mjs +3 -1
  107. package/dist/server/server/src/domain/user.mjs.map +1 -1
  108. package/dist/server/src/domain/user.d.ts.map +1 -1
  109. package/package.json +8 -9
  110. package/dist/admin/admin/src/components/GuidedTour/Homepage.js +0 -132
  111. package/dist/admin/admin/src/components/GuidedTour/Homepage.js.map +0 -1
  112. package/dist/admin/admin/src/components/GuidedTour/Homepage.mjs +0 -130
  113. package/dist/admin/admin/src/components/GuidedTour/Homepage.mjs.map +0 -1
  114. package/dist/admin/admin/src/components/GuidedTour/Modal.js +0 -278
  115. package/dist/admin/admin/src/components/GuidedTour/Modal.js.map +0 -1
  116. package/dist/admin/admin/src/components/GuidedTour/Modal.mjs +0 -276
  117. package/dist/admin/admin/src/components/GuidedTour/Modal.mjs.map +0 -1
  118. package/dist/admin/admin/src/components/GuidedTour/Ornaments.js +0 -54
  119. package/dist/admin/admin/src/components/GuidedTour/Ornaments.js.map +0 -1
  120. package/dist/admin/admin/src/components/GuidedTour/Ornaments.mjs +0 -51
  121. package/dist/admin/admin/src/components/GuidedTour/Ornaments.mjs.map +0 -1
  122. package/dist/admin/admin/src/components/GuidedTour/Provider.js +0 -206
  123. package/dist/admin/admin/src/components/GuidedTour/Provider.js.map +0 -1
  124. package/dist/admin/admin/src/components/GuidedTour/Provider.mjs +0 -184
  125. package/dist/admin/admin/src/components/GuidedTour/Provider.mjs.map +0 -1
  126. package/dist/admin/admin/src/components/GuidedTour/constants.js +0 -167
  127. package/dist/admin/admin/src/components/GuidedTour/constants.js.map +0 -1
  128. package/dist/admin/admin/src/components/GuidedTour/constants.mjs +0 -164
  129. package/dist/admin/admin/src/components/GuidedTour/constants.mjs.map +0 -1
  130. package/dist/admin/admin/src/components/UnstableGuidedTour/Context.js.map +0 -1
  131. package/dist/admin/admin/src/components/UnstableGuidedTour/Context.mjs.map +0 -1
  132. package/dist/admin/admin/src/components/UnstableGuidedTour/Overview.js.map +0 -1
  133. package/dist/admin/admin/src/components/UnstableGuidedTour/Overview.mjs.map +0 -1
  134. package/dist/admin/admin/src/components/UnstableGuidedTour/Step.js.map +0 -1
  135. package/dist/admin/admin/src/components/UnstableGuidedTour/Step.mjs.map +0 -1
  136. package/dist/admin/admin/src/components/UnstableGuidedTour/Tours.js.map +0 -1
  137. package/dist/admin/admin/src/components/UnstableGuidedTour/Tours.mjs.map +0 -1
  138. package/dist/admin/admin/src/pages/Home/components/GuidedTour.js +0 -19
  139. package/dist/admin/admin/src/pages/Home/components/GuidedTour.js.map +0 -1
  140. package/dist/admin/admin/src/pages/Home/components/GuidedTour.mjs +0 -17
  141. package/dist/admin/admin/src/pages/Home/components/GuidedTour.mjs.map +0 -1
  142. package/dist/admin/src/components/GuidedTour/Homepage.d.ts +0 -2
  143. package/dist/admin/src/components/GuidedTour/Modal.d.ts +0 -2
  144. package/dist/admin/src/components/GuidedTour/Ornaments.d.ts +0 -13
  145. package/dist/admin/src/components/GuidedTour/Provider.d.ts +0 -39
  146. package/dist/admin/src/components/GuidedTour/constants.d.ts +0 -165
  147. package/dist/admin/src/components/UnstableGuidedTour/Overview.d.ts +0 -1
  148. package/dist/admin/src/pages/Home/components/GuidedTour.d.ts +0 -1
  149. /package/dist/admin/src/components/{UnstableGuidedTour → GuidedTour}/Tours.d.ts +0 -0
@@ -1,206 +0,0 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var React = require('react');
5
- var immer = require('immer');
6
- var get = require('lodash/get');
7
- var set = require('lodash/set');
8
- var Context = require('../Context.js');
9
-
10
- function _interopNamespaceDefault(e) {
11
- var n = Object.create(null);
12
- if (e) {
13
- Object.keys(e).forEach(function (k) {
14
- if (k !== 'default') {
15
- var d = Object.getOwnPropertyDescriptor(e, k);
16
- Object.defineProperty(n, k, d.get ? d : {
17
- enumerable: true,
18
- get: function () { return e[k]; }
19
- });
20
- }
21
- });
22
- }
23
- n.default = e;
24
- return Object.freeze(n);
25
- }
26
-
27
- var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
28
-
29
- const GUIDED_TOUR_COMPLETED_STEPS = 'GUIDED_TOUR_COMPLETED_STEPS';
30
- const GUIDED_TOUR_CURRENT_STEP = 'GUIDED_TOUR_CURRENT_STEP';
31
- const GUIDED_TOUR_SKIPPED = 'GUIDED_TOUR_SKIPPED';
32
- const [GuidedTourProviderImpl, useGuidedTour] = Context.createContext('GuidedTour');
33
- const GuidedTourProvider = ({ children })=>{
34
- const [{ currentStep, guidedTourState, isGuidedTourVisible, isSkipped }, dispatch] = React__namespace.useReducer(reducer, initialState, initialiseState);
35
- const setCurrentStep = (step)=>{
36
- // if step is null it is intentional, we need to dispatch it
37
- if (step !== null) {
38
- const isStepAlreadyDone = get(guidedTourState, step);
39
- const [sectionName, stepName] = step.split('.');
40
- const sectionArray = Object.entries(guidedTourState[sectionName]);
41
- const currentStepIndex = sectionArray.findIndex(([key])=>key === stepName);
42
- const previousSteps = sectionArray.slice(0, currentStepIndex);
43
- const isStepToShow = previousSteps.every(([, sectionValue])=>sectionValue);
44
- if (isStepAlreadyDone || isSkipped || !isStepToShow) {
45
- return null;
46
- }
47
- }
48
- window.localStorage.setItem(GUIDED_TOUR_CURRENT_STEP, JSON.stringify(null));
49
- return dispatch({
50
- type: 'SET_CURRENT_STEP',
51
- step
52
- });
53
- };
54
- const setGuidedTourVisibility = (value)=>{
55
- dispatch({
56
- type: 'SET_GUIDED_TOUR_VISIBILITY',
57
- value
58
- });
59
- };
60
- const setStepState = (currentStep, value)=>{
61
- addCompletedStep(currentStep);
62
- dispatch({
63
- type: 'SET_STEP_STATE',
64
- currentStep,
65
- value
66
- });
67
- };
68
- const startSection = (sectionName)=>{
69
- const sectionSteps = guidedTourState[sectionName];
70
- if (sectionSteps) {
71
- const guidedTourArray = Object.entries(guidedTourState);
72
- // Find current section position in the guidedTourArray
73
- // Get only previous sections based on current section position
74
- const currentSectionIndex = guidedTourArray.findIndex(([key])=>key === sectionName);
75
- const previousSections = guidedTourArray.slice(0, currentSectionIndex);
76
- // Check if every steps from previous section are done
77
- const isSectionToShow = previousSections.every(([, sectionValue])=>Object.values(sectionValue).every(Boolean));
78
- const [firstStep] = Object.keys(sectionSteps);
79
- const isFirstStepDone = sectionSteps[firstStep];
80
- if (isSectionToShow && !currentStep && !isFirstStepDone) {
81
- setCurrentStep(`${sectionName}.${firstStep}`);
82
- }
83
- }
84
- };
85
- const setSkipped = (value)=>{
86
- window.localStorage.setItem(GUIDED_TOUR_SKIPPED, JSON.stringify(value));
87
- dispatch({
88
- type: 'SET_SKIPPED',
89
- value
90
- });
91
- };
92
- return /*#__PURE__*/ jsxRuntime.jsx(GuidedTourProviderImpl, {
93
- guidedTourState: guidedTourState,
94
- currentStep: currentStep,
95
- setCurrentStep: setCurrentStep,
96
- setGuidedTourVisibility: setGuidedTourVisibility,
97
- setSkipped: setSkipped,
98
- setStepState: setStepState,
99
- startSection: startSection,
100
- // TODO: remove the future condition when the unstable guided tour will be released
101
- isGuidedTourVisible: isGuidedTourVisible && !window.strapi.future.isEnabled('unstableGuidedTour'),
102
- isSkipped: isSkipped,
103
- children: children
104
- });
105
- };
106
- const initialState = {
107
- currentStep: null,
108
- guidedTourState: {
109
- contentTypeBuilder: {
110
- create: false,
111
- success: false
112
- },
113
- contentManager: {
114
- create: false,
115
- success: false
116
- },
117
- apiTokens: {
118
- create: false,
119
- success: false
120
- }
121
- },
122
- isGuidedTourVisible: false,
123
- isSkipped: false
124
- };
125
- const reducer = (state = initialState, action)=>immer.produce(state, (draftState)=>{
126
- switch(action.type){
127
- case 'SET_CURRENT_STEP':
128
- {
129
- draftState.currentStep = action.step;
130
- break;
131
- }
132
- case 'SET_STEP_STATE':
133
- {
134
- const [section, step] = action.currentStep.split('.');
135
- draftState.guidedTourState[section][step] = action.value;
136
- break;
137
- }
138
- case 'SET_SKIPPED':
139
- {
140
- draftState.isSkipped = action.value;
141
- break;
142
- }
143
- case 'SET_GUIDED_TOUR_VISIBILITY':
144
- {
145
- draftState.isGuidedTourVisible = action.value;
146
- break;
147
- }
148
- default:
149
- {
150
- return draftState;
151
- }
152
- }
153
- });
154
- const initialiseState = (initialState)=>{
155
- const copyInitialState = {
156
- ...initialState
157
- };
158
- const guidedTourLocaleStorage = JSON.parse(window.localStorage.getItem(GUIDED_TOUR_COMPLETED_STEPS) ?? '[]');
159
- const currentStepLocaleStorage = JSON.parse(window.localStorage.getItem(GUIDED_TOUR_CURRENT_STEP) ?? 'null');
160
- const skippedLocaleStorage = JSON.parse(window.localStorage.getItem(GUIDED_TOUR_SKIPPED) ?? 'null');
161
- if (Array.isArray(guidedTourLocaleStorage)) {
162
- guidedTourLocaleStorage.forEach((step)=>{
163
- const [sectionName, stepName] = step.split('.');
164
- set(copyInitialState, [
165
- 'guidedTourState',
166
- sectionName,
167
- stepName
168
- ], true);
169
- });
170
- }
171
- // if current step when initializing mark it as done
172
- if (currentStepLocaleStorage) {
173
- const [sectionName, stepName] = currentStepLocaleStorage.split('.');
174
- set(copyInitialState, [
175
- 'guidedTourState',
176
- sectionName,
177
- stepName
178
- ], true);
179
- addCompletedStep(currentStepLocaleStorage);
180
- window.localStorage.setItem(GUIDED_TOUR_CURRENT_STEP, JSON.stringify(null));
181
- }
182
- if (skippedLocaleStorage !== null) {
183
- set(copyInitialState, 'isSkipped', skippedLocaleStorage);
184
- }
185
- return copyInitialState;
186
- };
187
- /**
188
- * @description Add a completed step to the local storage if it does not already exist.
189
- */ const addCompletedStep = (completedStep)=>{
190
- const currentSteps = JSON.parse(window.localStorage.getItem(GUIDED_TOUR_COMPLETED_STEPS) ?? '[]');
191
- if (!Array.isArray(currentSteps)) {
192
- return;
193
- }
194
- const isAlreadyStored = currentSteps.includes(completedStep);
195
- if (isAlreadyStored) {
196
- return;
197
- }
198
- window.localStorage.setItem(GUIDED_TOUR_COMPLETED_STEPS, JSON.stringify([
199
- ...currentSteps,
200
- completedStep
201
- ]));
202
- };
203
-
204
- exports.GuidedTourProvider = GuidedTourProvider;
205
- exports.useGuidedTour = useGuidedTour;
206
- //# sourceMappingURL=Provider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Provider.js","sources":["../../../../../../admin/src/components/GuidedTour/Provider.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { produce } from 'immer';\nimport get from 'lodash/get';\nimport set from 'lodash/set';\n\nconst GUIDED_TOUR_COMPLETED_STEPS = 'GUIDED_TOUR_COMPLETED_STEPS';\nconst GUIDED_TOUR_CURRENT_STEP = 'GUIDED_TOUR_CURRENT_STEP';\nconst GUIDED_TOUR_SKIPPED = 'GUIDED_TOUR_SKIPPED';\n\nconst GUIDED_TOUR_KEYS = {\n GUIDED_TOUR_COMPLETED_STEPS,\n GUIDED_TOUR_CURRENT_STEP,\n GUIDED_TOUR_SKIPPED,\n} as const;\n\n/* -------------------------------------------------------------------------------------------------\n * GuidedTourProvider\n * -----------------------------------------------------------------------------------------------*/\n\nimport { createContext } from '../Context';\n\ntype SectionKey = keyof GuidedTourContextValue['guidedTourState'];\ntype StepKey = keyof GuidedTourContextValue['guidedTourState'][SectionKey];\ntype Step = `${SectionKey}.${StepKey}`;\ninterface GuidedTourContextValue {\n currentStep: Step | null;\n guidedTourState: {\n contentTypeBuilder: {\n create: boolean;\n success: boolean;\n };\n contentManager: {\n create: boolean;\n success: boolean;\n };\n apiTokens: {\n create: boolean;\n success: boolean;\n };\n };\n isGuidedTourVisible: boolean;\n isSkipped: boolean;\n setCurrentStep: (step: Step | null) => void | null;\n setGuidedTourVisibility: (isVisible: boolean) => void;\n setSkipped: (isSkipped: boolean) => void;\n setStepState: (step: Step, state: boolean) => void;\n startSection: (section: SectionKey) => void;\n}\n\nconst [GuidedTourProviderImpl, useGuidedTour] = createContext<GuidedTourContextValue>('GuidedTour');\n\ninterface GuidedTourProviderProps {\n children: React.ReactNode;\n}\n\nconst GuidedTourProvider = ({ children }: GuidedTourProviderProps) => {\n const [{ currentStep, guidedTourState, isGuidedTourVisible, isSkipped }, dispatch] =\n React.useReducer(reducer, initialState, initialiseState);\n\n const setCurrentStep = (step: SetCurrentStepAction['step']) => {\n // if step is null it is intentional, we need to dispatch it\n if (step !== null) {\n const isStepAlreadyDone = get(guidedTourState, step);\n const [sectionName, stepName] = step.split('.') as [SectionKey, StepKey];\n const sectionArray = Object.entries(guidedTourState[sectionName]);\n\n const currentStepIndex = sectionArray.findIndex(([key]) => key === stepName);\n const previousSteps = sectionArray.slice(0, currentStepIndex);\n\n const isStepToShow = previousSteps.every(([, sectionValue]) => sectionValue);\n\n if (isStepAlreadyDone || isSkipped || !isStepToShow) {\n return null;\n }\n }\n\n window.localStorage.setItem(GUIDED_TOUR_CURRENT_STEP, JSON.stringify(null));\n\n return dispatch({\n type: 'SET_CURRENT_STEP',\n step,\n });\n };\n\n const setGuidedTourVisibility = (value: SetGuidedTourVisibilityAction['value']) => {\n dispatch({\n type: 'SET_GUIDED_TOUR_VISIBILITY',\n value,\n });\n };\n\n const setStepState = (currentStep: Step, value: SetStepStateAction['value']) => {\n addCompletedStep(currentStep);\n\n dispatch({\n type: 'SET_STEP_STATE',\n currentStep,\n value,\n });\n };\n\n const startSection = (sectionName: SectionKey) => {\n const sectionSteps = guidedTourState[sectionName];\n\n if (sectionSteps) {\n const guidedTourArray = Object.entries(guidedTourState);\n\n // Find current section position in the guidedTourArray\n // Get only previous sections based on current section position\n const currentSectionIndex = guidedTourArray.findIndex(([key]) => key === sectionName);\n const previousSections = guidedTourArray.slice(0, currentSectionIndex);\n\n // Check if every steps from previous section are done\n const isSectionToShow = previousSections.every(([, sectionValue]) =>\n Object.values(sectionValue).every(Boolean)\n );\n\n const [firstStep] = Object.keys(sectionSteps) as [StepKey];\n const isFirstStepDone = sectionSteps[firstStep];\n\n if (isSectionToShow && !currentStep && !isFirstStepDone) {\n setCurrentStep(`${sectionName}.${firstStep}`);\n }\n }\n };\n\n const setSkipped = (value: SetSkippedAction['value']) => {\n window.localStorage.setItem(GUIDED_TOUR_SKIPPED, JSON.stringify(value));\n\n dispatch({\n type: 'SET_SKIPPED',\n value,\n });\n };\n\n return (\n <GuidedTourProviderImpl\n guidedTourState={guidedTourState}\n currentStep={currentStep}\n setCurrentStep={setCurrentStep}\n setGuidedTourVisibility={setGuidedTourVisibility}\n setSkipped={setSkipped}\n setStepState={setStepState}\n startSection={startSection}\n // TODO: remove the future condition when the unstable guided tour will be released\n isGuidedTourVisible={\n isGuidedTourVisible && !window.strapi.future.isEnabled('unstableGuidedTour')\n }\n isSkipped={isSkipped}\n >\n {children}\n </GuidedTourProviderImpl>\n );\n};\n\ntype State = Pick<\n GuidedTourContextValue,\n 'guidedTourState' | 'currentStep' | 'isGuidedTourVisible' | 'isSkipped'\n>;\n\nconst initialState = {\n currentStep: null,\n guidedTourState: {\n contentTypeBuilder: {\n create: false,\n success: false,\n },\n contentManager: {\n create: false,\n success: false,\n },\n apiTokens: {\n create: false,\n success: false,\n },\n },\n isGuidedTourVisible: false,\n isSkipped: false,\n} satisfies State;\n\ninterface SetCurrentStepAction {\n type: 'SET_CURRENT_STEP';\n step: Step | null;\n}\n\ninterface SetStepStateAction {\n type: 'SET_STEP_STATE';\n currentStep: Step;\n value: boolean;\n}\n\ninterface SetSkippedAction {\n type: 'SET_SKIPPED';\n value: boolean;\n}\n\ninterface SetGuidedTourVisibilityAction {\n type: 'SET_GUIDED_TOUR_VISIBILITY';\n value: boolean;\n}\n\ntype Action =\n | SetCurrentStepAction\n | SetStepStateAction\n | SetSkippedAction\n | SetGuidedTourVisibilityAction;\n\nconst reducer: React.Reducer<State, Action> = (state: State = initialState, action: Action) =>\n produce(state, (draftState) => {\n switch (action.type) {\n case 'SET_CURRENT_STEP': {\n draftState.currentStep = action.step;\n break;\n }\n case 'SET_STEP_STATE': {\n const [section, step] = action.currentStep.split('.') as [SectionKey, StepKey];\n draftState.guidedTourState[section][step] = action.value;\n break;\n }\n case 'SET_SKIPPED': {\n draftState.isSkipped = action.value;\n break;\n }\n case 'SET_GUIDED_TOUR_VISIBILITY': {\n draftState.isGuidedTourVisible = action.value;\n break;\n }\n default: {\n return draftState;\n }\n }\n });\n\nconst initialiseState = (initialState: State) => {\n const copyInitialState = { ...initialState };\n const guidedTourLocaleStorage = JSON.parse(\n window.localStorage.getItem(GUIDED_TOUR_COMPLETED_STEPS) ?? '[]'\n );\n const currentStepLocaleStorage = JSON.parse(\n window.localStorage.getItem(GUIDED_TOUR_CURRENT_STEP) ?? 'null'\n );\n const skippedLocaleStorage = JSON.parse(\n window.localStorage.getItem(GUIDED_TOUR_SKIPPED) ?? 'null'\n );\n\n if (Array.isArray(guidedTourLocaleStorage)) {\n guidedTourLocaleStorage.forEach((step) => {\n const [sectionName, stepName] = step.split('.');\n set(copyInitialState, ['guidedTourState', sectionName, stepName], true);\n });\n }\n\n // if current step when initializing mark it as done\n if (currentStepLocaleStorage) {\n const [sectionName, stepName] = currentStepLocaleStorage.split('.') as [SectionKey, StepKey];\n set(copyInitialState, ['guidedTourState', sectionName, stepName], true);\n\n addCompletedStep(currentStepLocaleStorage as Step);\n\n window.localStorage.setItem(GUIDED_TOUR_CURRENT_STEP, JSON.stringify(null));\n }\n\n if (skippedLocaleStorage !== null) {\n set(copyInitialState, 'isSkipped', skippedLocaleStorage);\n }\n\n return copyInitialState;\n};\n\n/**\n * @description Add a completed step to the local storage if it does not already exist.\n */\nconst addCompletedStep = (completedStep: Step) => {\n const currentSteps = JSON.parse(window.localStorage.getItem(GUIDED_TOUR_COMPLETED_STEPS) ?? '[]');\n\n if (!Array.isArray(currentSteps)) {\n return;\n }\n\n const isAlreadyStored = currentSteps.includes(completedStep);\n\n if (isAlreadyStored) {\n return;\n }\n\n window.localStorage.setItem(\n GUIDED_TOUR_COMPLETED_STEPS,\n JSON.stringify([...currentSteps, completedStep])\n );\n};\n\nexport { GuidedTourProvider, useGuidedTour, GuidedTourContextValue, GUIDED_TOUR_KEYS };\n"],"names":["GUIDED_TOUR_COMPLETED_STEPS","GUIDED_TOUR_CURRENT_STEP","GUIDED_TOUR_SKIPPED","GuidedTourProviderImpl","useGuidedTour","createContext","GuidedTourProvider","children","currentStep","guidedTourState","isGuidedTourVisible","isSkipped","dispatch","React","useReducer","reducer","initialState","initialiseState","setCurrentStep","step","isStepAlreadyDone","get","sectionName","stepName","split","sectionArray","Object","entries","currentStepIndex","findIndex","key","previousSteps","slice","isStepToShow","every","sectionValue","window","localStorage","setItem","JSON","stringify","type","setGuidedTourVisibility","value","setStepState","addCompletedStep","startSection","sectionSteps","guidedTourArray","currentSectionIndex","previousSections","isSectionToShow","values","Boolean","firstStep","keys","isFirstStepDone","setSkipped","_jsx","strapi","future","isEnabled","contentTypeBuilder","create","success","contentManager","apiTokens","state","action","produce","draftState","section","copyInitialState","guidedTourLocaleStorage","parse","getItem","currentStepLocaleStorage","skippedLocaleStorage","Array","isArray","forEach","set","completedStep","currentSteps","isAlreadyStored","includes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAMA,2BAA8B,GAAA,6BAAA;AACpC,MAAMC,wBAA2B,GAAA,0BAAA;AACjC,MAAMC,mBAAsB,GAAA,qBAAA;AA0C5B,MAAM,CAACC,sBAAAA,EAAwBC,aAAc,CAAA,GAAGC,qBAAsC,CAAA,YAAA;AAMtF,MAAMC,kBAAqB,GAAA,CAAC,EAAEC,QAAQ,EAA2B,GAAA;AAC/D,IAAA,MAAM,CAAC,EAAEC,WAAW,EAAEC,eAAe,EAAEC,mBAAmB,EAAEC,SAAS,EAAE,EAAEC,QAAS,CAAA,GAChFC,iBAAMC,UAAU,CAACC,SAASC,YAAcC,EAAAA,eAAAA,CAAAA;AAE1C,IAAA,MAAMC,iBAAiB,CAACC,IAAAA,GAAAA;;AAEtB,QAAA,IAAIA,SAAS,IAAM,EAAA;YACjB,MAAMC,iBAAAA,GAAoBC,IAAIZ,eAAiBU,EAAAA,IAAAA,CAAAA;AAC/C,YAAA,MAAM,CAACG,WAAaC,EAAAA,QAAAA,CAAS,GAAGJ,IAAAA,CAAKK,KAAK,CAAC,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AAAA,WAAAA;AAAaC,YAAAA;SAAS,EAAE,IAAA,CAAA;QAElEsB,gBAAiB+B,CAAAA,wBAAAA,CAAAA;AAEjBxC,QAAAA,MAAAA,CAAOC,YAAY,CAACC,OAAO,CAACrC,wBAA0BsC,EAAAA,IAAAA,CAAKC,SAAS,CAAC,IAAA,CAAA,CAAA;AACvE;AAEA,IAAA,IAAIqC,yBAAyB,IAAM,EAAA;AACjCI,QAAAA,GAAAA,CAAIT,kBAAkB,WAAaK,EAAAA,oBAAAA,CAAAA;AACrC;IAEA,OAAOL,gBAAAA;AACT,CAAA;AAEA;;IAGA,MAAM3B,mBAAmB,CAACqC,aAAAA,GAAAA;IACxB,MAAMC,YAAAA,GAAe5C,KAAKmC,KAAK,CAACtC,OAAOC,YAAY,CAACsC,OAAO,CAAC3E,2BAAgC,CAAA,IAAA,IAAA,CAAA;AAE5F,IAAA,IAAI,CAAC8E,KAAAA,CAAMC,OAAO,CAACI,YAAe,CAAA,EAAA;AAChC,QAAA;AACF;IAEA,MAAMC,eAAAA,GAAkBD,YAAaE,CAAAA,QAAQ,CAACH,aAAAA,CAAAA;AAE9C,IAAA,IAAIE,eAAiB,EAAA;AACnB,QAAA;AACF;AAEAhD,IAAAA,MAAAA,CAAOC,YAAY,CAACC,OAAO,CACzBtC,2BACAuC,EAAAA,IAAAA,CAAKC,SAAS,CAAC;AAAI2C,QAAAA,GAAAA,YAAAA;AAAcD,QAAAA;AAAc,KAAA,CAAA,CAAA;AAEnD,CAAA;;;;;"}
@@ -1,184 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import * as React from 'react';
3
- import { produce } from 'immer';
4
- import get from 'lodash/get';
5
- import set from 'lodash/set';
6
- import { createContext } from '../Context.mjs';
7
-
8
- const GUIDED_TOUR_COMPLETED_STEPS = 'GUIDED_TOUR_COMPLETED_STEPS';
9
- const GUIDED_TOUR_CURRENT_STEP = 'GUIDED_TOUR_CURRENT_STEP';
10
- const GUIDED_TOUR_SKIPPED = 'GUIDED_TOUR_SKIPPED';
11
- const [GuidedTourProviderImpl, useGuidedTour] = createContext('GuidedTour');
12
- const GuidedTourProvider = ({ children })=>{
13
- const [{ currentStep, guidedTourState, isGuidedTourVisible, isSkipped }, dispatch] = React.useReducer(reducer, initialState, initialiseState);
14
- const setCurrentStep = (step)=>{
15
- // if step is null it is intentional, we need to dispatch it
16
- if (step !== null) {
17
- const isStepAlreadyDone = get(guidedTourState, step);
18
- const [sectionName, stepName] = step.split('.');
19
- const sectionArray = Object.entries(guidedTourState[sectionName]);
20
- const currentStepIndex = sectionArray.findIndex(([key])=>key === stepName);
21
- const previousSteps = sectionArray.slice(0, currentStepIndex);
22
- const isStepToShow = previousSteps.every(([, sectionValue])=>sectionValue);
23
- if (isStepAlreadyDone || isSkipped || !isStepToShow) {
24
- return null;
25
- }
26
- }
27
- window.localStorage.setItem(GUIDED_TOUR_CURRENT_STEP, JSON.stringify(null));
28
- return dispatch({
29
- type: 'SET_CURRENT_STEP',
30
- step
31
- });
32
- };
33
- const setGuidedTourVisibility = (value)=>{
34
- dispatch({
35
- type: 'SET_GUIDED_TOUR_VISIBILITY',
36
- value
37
- });
38
- };
39
- const setStepState = (currentStep, value)=>{
40
- addCompletedStep(currentStep);
41
- dispatch({
42
- type: 'SET_STEP_STATE',
43
- currentStep,
44
- value
45
- });
46
- };
47
- const startSection = (sectionName)=>{
48
- const sectionSteps = guidedTourState[sectionName];
49
- if (sectionSteps) {
50
- const guidedTourArray = Object.entries(guidedTourState);
51
- // Find current section position in the guidedTourArray
52
- // Get only previous sections based on current section position
53
- const currentSectionIndex = guidedTourArray.findIndex(([key])=>key === sectionName);
54
- const previousSections = guidedTourArray.slice(0, currentSectionIndex);
55
- // Check if every steps from previous section are done
56
- const isSectionToShow = previousSections.every(([, sectionValue])=>Object.values(sectionValue).every(Boolean));
57
- const [firstStep] = Object.keys(sectionSteps);
58
- const isFirstStepDone = sectionSteps[firstStep];
59
- if (isSectionToShow && !currentStep && !isFirstStepDone) {
60
- setCurrentStep(`${sectionName}.${firstStep}`);
61
- }
62
- }
63
- };
64
- const setSkipped = (value)=>{
65
- window.localStorage.setItem(GUIDED_TOUR_SKIPPED, JSON.stringify(value));
66
- dispatch({
67
- type: 'SET_SKIPPED',
68
- value
69
- });
70
- };
71
- return /*#__PURE__*/ jsx(GuidedTourProviderImpl, {
72
- guidedTourState: guidedTourState,
73
- currentStep: currentStep,
74
- setCurrentStep: setCurrentStep,
75
- setGuidedTourVisibility: setGuidedTourVisibility,
76
- setSkipped: setSkipped,
77
- setStepState: setStepState,
78
- startSection: startSection,
79
- // TODO: remove the future condition when the unstable guided tour will be released
80
- isGuidedTourVisible: isGuidedTourVisible && !window.strapi.future.isEnabled('unstableGuidedTour'),
81
- isSkipped: isSkipped,
82
- children: children
83
- });
84
- };
85
- const initialState = {
86
- currentStep: null,
87
- guidedTourState: {
88
- contentTypeBuilder: {
89
- create: false,
90
- success: false
91
- },
92
- contentManager: {
93
- create: false,
94
- success: false
95
- },
96
- apiTokens: {
97
- create: false,
98
- success: false
99
- }
100
- },
101
- isGuidedTourVisible: false,
102
- isSkipped: false
103
- };
104
- const reducer = (state = initialState, action)=>produce(state, (draftState)=>{
105
- switch(action.type){
106
- case 'SET_CURRENT_STEP':
107
- {
108
- draftState.currentStep = action.step;
109
- break;
110
- }
111
- case 'SET_STEP_STATE':
112
- {
113
- const [section, step] = action.currentStep.split('.');
114
- draftState.guidedTourState[section][step] = action.value;
115
- break;
116
- }
117
- case 'SET_SKIPPED':
118
- {
119
- draftState.isSkipped = action.value;
120
- break;
121
- }
122
- case 'SET_GUIDED_TOUR_VISIBILITY':
123
- {
124
- draftState.isGuidedTourVisible = action.value;
125
- break;
126
- }
127
- default:
128
- {
129
- return draftState;
130
- }
131
- }
132
- });
133
- const initialiseState = (initialState)=>{
134
- const copyInitialState = {
135
- ...initialState
136
- };
137
- const guidedTourLocaleStorage = JSON.parse(window.localStorage.getItem(GUIDED_TOUR_COMPLETED_STEPS) ?? '[]');
138
- const currentStepLocaleStorage = JSON.parse(window.localStorage.getItem(GUIDED_TOUR_CURRENT_STEP) ?? 'null');
139
- const skippedLocaleStorage = JSON.parse(window.localStorage.getItem(GUIDED_TOUR_SKIPPED) ?? 'null');
140
- if (Array.isArray(guidedTourLocaleStorage)) {
141
- guidedTourLocaleStorage.forEach((step)=>{
142
- const [sectionName, stepName] = step.split('.');
143
- set(copyInitialState, [
144
- 'guidedTourState',
145
- sectionName,
146
- stepName
147
- ], true);
148
- });
149
- }
150
- // if current step when initializing mark it as done
151
- if (currentStepLocaleStorage) {
152
- const [sectionName, stepName] = currentStepLocaleStorage.split('.');
153
- set(copyInitialState, [
154
- 'guidedTourState',
155
- sectionName,
156
- stepName
157
- ], true);
158
- addCompletedStep(currentStepLocaleStorage);
159
- window.localStorage.setItem(GUIDED_TOUR_CURRENT_STEP, JSON.stringify(null));
160
- }
161
- if (skippedLocaleStorage !== null) {
162
- set(copyInitialState, 'isSkipped', skippedLocaleStorage);
163
- }
164
- return copyInitialState;
165
- };
166
- /**
167
- * @description Add a completed step to the local storage if it does not already exist.
168
- */ const addCompletedStep = (completedStep)=>{
169
- const currentSteps = JSON.parse(window.localStorage.getItem(GUIDED_TOUR_COMPLETED_STEPS) ?? '[]');
170
- if (!Array.isArray(currentSteps)) {
171
- return;
172
- }
173
- const isAlreadyStored = currentSteps.includes(completedStep);
174
- if (isAlreadyStored) {
175
- return;
176
- }
177
- window.localStorage.setItem(GUIDED_TOUR_COMPLETED_STEPS, JSON.stringify([
178
- ...currentSteps,
179
- completedStep
180
- ]));
181
- };
182
-
183
- export { GuidedTourProvider, useGuidedTour };
184
- //# sourceMappingURL=Provider.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Provider.mjs","sources":["../../../../../../admin/src/components/GuidedTour/Provider.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { produce } from 'immer';\nimport get from 'lodash/get';\nimport set from 'lodash/set';\n\nconst GUIDED_TOUR_COMPLETED_STEPS = 'GUIDED_TOUR_COMPLETED_STEPS';\nconst GUIDED_TOUR_CURRENT_STEP = 'GUIDED_TOUR_CURRENT_STEP';\nconst GUIDED_TOUR_SKIPPED = 'GUIDED_TOUR_SKIPPED';\n\nconst GUIDED_TOUR_KEYS = {\n GUIDED_TOUR_COMPLETED_STEPS,\n GUIDED_TOUR_CURRENT_STEP,\n GUIDED_TOUR_SKIPPED,\n} as const;\n\n/* -------------------------------------------------------------------------------------------------\n * GuidedTourProvider\n * -----------------------------------------------------------------------------------------------*/\n\nimport { createContext } from '../Context';\n\ntype SectionKey = keyof GuidedTourContextValue['guidedTourState'];\ntype StepKey = keyof GuidedTourContextValue['guidedTourState'][SectionKey];\ntype Step = `${SectionKey}.${StepKey}`;\ninterface GuidedTourContextValue {\n currentStep: Step | null;\n guidedTourState: {\n contentTypeBuilder: {\n create: boolean;\n success: boolean;\n };\n contentManager: {\n create: boolean;\n success: boolean;\n };\n apiTokens: {\n create: boolean;\n success: boolean;\n };\n };\n isGuidedTourVisible: boolean;\n isSkipped: boolean;\n setCurrentStep: (step: Step | null) => void | null;\n setGuidedTourVisibility: (isVisible: boolean) => void;\n setSkipped: (isSkipped: boolean) => void;\n setStepState: (step: Step, state: boolean) => void;\n startSection: (section: SectionKey) => void;\n}\n\nconst [GuidedTourProviderImpl, useGuidedTour] = createContext<GuidedTourContextValue>('GuidedTour');\n\ninterface GuidedTourProviderProps {\n children: React.ReactNode;\n}\n\nconst GuidedTourProvider = ({ children }: GuidedTourProviderProps) => {\n const [{ currentStep, guidedTourState, isGuidedTourVisible, isSkipped }, dispatch] =\n React.useReducer(reducer, initialState, initialiseState);\n\n const setCurrentStep = (step: SetCurrentStepAction['step']) => {\n // if step is null it is intentional, we need to dispatch it\n if (step !== null) {\n const isStepAlreadyDone = get(guidedTourState, step);\n const [sectionName, stepName] = step.split('.') as [SectionKey, StepKey];\n const sectionArray = Object.entries(guidedTourState[sectionName]);\n\n const currentStepIndex = sectionArray.findIndex(([key]) => key === stepName);\n const previousSteps = sectionArray.slice(0, currentStepIndex);\n\n const isStepToShow = previousSteps.every(([, sectionValue]) => sectionValue);\n\n if (isStepAlreadyDone || isSkipped || !isStepToShow) {\n return null;\n }\n }\n\n window.localStorage.setItem(GUIDED_TOUR_CURRENT_STEP, JSON.stringify(null));\n\n return dispatch({\n type: 'SET_CURRENT_STEP',\n step,\n });\n };\n\n const setGuidedTourVisibility = (value: SetGuidedTourVisibilityAction['value']) => {\n dispatch({\n type: 'SET_GUIDED_TOUR_VISIBILITY',\n value,\n });\n };\n\n const setStepState = (currentStep: Step, value: SetStepStateAction['value']) => {\n addCompletedStep(currentStep);\n\n dispatch({\n type: 'SET_STEP_STATE',\n currentStep,\n value,\n });\n };\n\n const startSection = (sectionName: SectionKey) => {\n const sectionSteps = guidedTourState[sectionName];\n\n if (sectionSteps) {\n const guidedTourArray = Object.entries(guidedTourState);\n\n // Find current section position in the guidedTourArray\n // Get only previous sections based on current section position\n const currentSectionIndex = guidedTourArray.findIndex(([key]) => key === sectionName);\n const previousSections = guidedTourArray.slice(0, currentSectionIndex);\n\n // Check if every steps from previous section are done\n const isSectionToShow = previousSections.every(([, sectionValue]) =>\n Object.values(sectionValue).every(Boolean)\n );\n\n const [firstStep] = Object.keys(sectionSteps) as [StepKey];\n const isFirstStepDone = sectionSteps[firstStep];\n\n if (isSectionToShow && !currentStep && !isFirstStepDone) {\n setCurrentStep(`${sectionName}.${firstStep}`);\n }\n }\n };\n\n const setSkipped = (value: SetSkippedAction['value']) => {\n window.localStorage.setItem(GUIDED_TOUR_SKIPPED, JSON.stringify(value));\n\n dispatch({\n type: 'SET_SKIPPED',\n value,\n });\n };\n\n return (\n <GuidedTourProviderImpl\n guidedTourState={guidedTourState}\n currentStep={currentStep}\n setCurrentStep={setCurrentStep}\n setGuidedTourVisibility={setGuidedTourVisibility}\n setSkipped={setSkipped}\n setStepState={setStepState}\n startSection={startSection}\n // TODO: remove the future condition when the unstable guided tour will be released\n isGuidedTourVisible={\n isGuidedTourVisible && !window.strapi.future.isEnabled('unstableGuidedTour')\n }\n isSkipped={isSkipped}\n >\n {children}\n </GuidedTourProviderImpl>\n );\n};\n\ntype State = Pick<\n GuidedTourContextValue,\n 'guidedTourState' | 'currentStep' | 'isGuidedTourVisible' | 'isSkipped'\n>;\n\nconst initialState = {\n currentStep: null,\n guidedTourState: {\n contentTypeBuilder: {\n create: false,\n success: false,\n },\n contentManager: {\n create: false,\n success: false,\n },\n apiTokens: {\n create: false,\n success: false,\n },\n },\n isGuidedTourVisible: false,\n isSkipped: false,\n} satisfies State;\n\ninterface SetCurrentStepAction {\n type: 'SET_CURRENT_STEP';\n step: Step | null;\n}\n\ninterface SetStepStateAction {\n type: 'SET_STEP_STATE';\n currentStep: Step;\n value: boolean;\n}\n\ninterface SetSkippedAction {\n type: 'SET_SKIPPED';\n value: boolean;\n}\n\ninterface SetGuidedTourVisibilityAction {\n type: 'SET_GUIDED_TOUR_VISIBILITY';\n value: boolean;\n}\n\ntype Action =\n | SetCurrentStepAction\n | SetStepStateAction\n | SetSkippedAction\n | SetGuidedTourVisibilityAction;\n\nconst reducer: React.Reducer<State, Action> = (state: State = initialState, action: Action) =>\n produce(state, (draftState) => {\n switch (action.type) {\n case 'SET_CURRENT_STEP': {\n draftState.currentStep = action.step;\n break;\n }\n case 'SET_STEP_STATE': {\n const [section, step] = action.currentStep.split('.') as [SectionKey, StepKey];\n draftState.guidedTourState[section][step] = action.value;\n break;\n }\n case 'SET_SKIPPED': {\n draftState.isSkipped = action.value;\n break;\n }\n case 'SET_GUIDED_TOUR_VISIBILITY': {\n draftState.isGuidedTourVisible = action.value;\n break;\n }\n default: {\n return draftState;\n }\n }\n });\n\nconst initialiseState = (initialState: State) => {\n const copyInitialState = { ...initialState };\n const guidedTourLocaleStorage = JSON.parse(\n window.localStorage.getItem(GUIDED_TOUR_COMPLETED_STEPS) ?? '[]'\n );\n const currentStepLocaleStorage = JSON.parse(\n window.localStorage.getItem(GUIDED_TOUR_CURRENT_STEP) ?? 'null'\n );\n const skippedLocaleStorage = JSON.parse(\n window.localStorage.getItem(GUIDED_TOUR_SKIPPED) ?? 'null'\n );\n\n if (Array.isArray(guidedTourLocaleStorage)) {\n guidedTourLocaleStorage.forEach((step) => {\n const [sectionName, stepName] = step.split('.');\n set(copyInitialState, ['guidedTourState', sectionName, stepName], true);\n });\n }\n\n // if current step when initializing mark it as done\n if (currentStepLocaleStorage) {\n const [sectionName, stepName] = currentStepLocaleStorage.split('.') as [SectionKey, StepKey];\n set(copyInitialState, ['guidedTourState', sectionName, stepName], true);\n\n addCompletedStep(currentStepLocaleStorage as Step);\n\n window.localStorage.setItem(GUIDED_TOUR_CURRENT_STEP, JSON.stringify(null));\n }\n\n if (skippedLocaleStorage !== null) {\n set(copyInitialState, 'isSkipped', skippedLocaleStorage);\n }\n\n return copyInitialState;\n};\n\n/**\n * @description Add a completed step to the local storage if it does not already exist.\n */\nconst addCompletedStep = (completedStep: Step) => {\n const currentSteps = JSON.parse(window.localStorage.getItem(GUIDED_TOUR_COMPLETED_STEPS) ?? '[]');\n\n if (!Array.isArray(currentSteps)) {\n return;\n }\n\n const isAlreadyStored = currentSteps.includes(completedStep);\n\n if (isAlreadyStored) {\n return;\n }\n\n window.localStorage.setItem(\n GUIDED_TOUR_COMPLETED_STEPS,\n JSON.stringify([...currentSteps, completedStep])\n );\n};\n\nexport { GuidedTourProvider, useGuidedTour, GuidedTourContextValue, GUIDED_TOUR_KEYS };\n"],"names":["GUIDED_TOUR_COMPLETED_STEPS","GUIDED_TOUR_CURRENT_STEP","GUIDED_TOUR_SKIPPED","GuidedTourProviderImpl","useGuidedTour","createContext","GuidedTourProvider","children","currentStep","guidedTourState","isGuidedTourVisible","isSkipped","dispatch","React","useReducer","reducer","initialState","initialiseState","setCurrentStep","step","isStepAlreadyDone","get","sectionName","stepName","split","sectionArray","Object","entries","currentStepIndex","findIndex","key","previousSteps","slice","isStepToShow","every","sectionValue","window","localStorage","setItem","JSON","stringify","type","setGuidedTourVisibility","value","setStepState","addCompletedStep","startSection","sectionSteps","guidedTourArray","currentSectionIndex","previousSections","isSectionToShow","values","Boolean","firstStep","keys","isFirstStepDone","setSkipped","_jsx","strapi","future","isEnabled","contentTypeBuilder","create","success","contentManager","apiTokens","state","action","produce","draftState","section","copyInitialState","guidedTourLocaleStorage","parse","getItem","currentStepLocaleStorage","skippedLocaleStorage","Array","isArray","forEach","set","completedStep","currentSteps","isAlreadyStored","includes"],"mappings":";;;;;;;AAMA,MAAMA,2BAA8B,GAAA,6BAAA;AACpC,MAAMC,wBAA2B,GAAA,0BAAA;AACjC,MAAMC,mBAAsB,GAAA,qBAAA;AA0C5B,MAAM,CAACC,sBAAAA,EAAwBC,aAAc,CAAA,GAAGC,aAAsC,CAAA,YAAA;AAMtF,MAAMC,kBAAqB,GAAA,CAAC,EAAEC,QAAQ,EAA2B,GAAA;AAC/D,IAAA,MAAM,CAAC,EAAEC,WAAW,EAAEC,eAAe,EAAEC,mBAAmB,EAAEC,SAAS,EAAE,EAAEC,QAAS,CAAA,GAChFC,MAAMC,UAAU,CAACC,SAASC,YAAcC,EAAAA,eAAAA,CAAAA;AAE1C,IAAA,MAAMC,iBAAiB,CAACC,IAAAA,GAAAA;;AAEtB,QAAA,IAAIA,SAAS,IAAM,EAAA;YACjB,MAAMC,iBAAAA,GAAoBC,IAAIZ,eAAiBU,EAAAA,IAAAA,CAAAA;AAC/C,YAAA,MAAM,CAACG,WAAaC,EAAAA,QAAAA,CAAS,GAAGJ,IAAAA,CAAKK,KAAK,CAAC,GAAA,CAAA;AAC3C,YAAA,MAAMC,eAAeC,MAAOC,CAAAA,OAAO,CAAClB,eAAe,CAACa,WAAY,CAAA,CAAA;YAEhE,MAAMM,gBAAAA,GAAmBH,aAAaI,SAAS,CAAC,CAAC,CAACC,GAAAA,CAAI,GAAKA,GAAQP,KAAAA,QAAAA,CAAAA;AACnE,YAAA,MAAMQ,aAAgBN,GAAAA,YAAAA,CAAaO,KAAK,CAAC,CAAGJ,EAAAA,gBA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AAkB,WAAaK,EAAAA,oBAAAA,CAAAA;AACrC;IAEA,OAAOL,gBAAAA;AACT,CAAA;AAEA;;IAGA,MAAM3B,mBAAmB,CAACqC,aAAAA,GAAAA;IACxB,MAAMC,YAAAA,GAAe5C,KAAKmC,KAAK,CAACtC,OAAOC,YAAY,CAACsC,OAAO,CAAC3E,2BAAgC,CAAA,IAAA,IAAA,CAAA;AAE5F,IAAA,IAAI,CAAC8E,KAAAA,CAAMC,OAAO,CAACI,YAAe,CAAA,EAAA;AAChC,QAAA;AACF;IAEA,MAAMC,eAAAA,GAAkBD,YAAaE,CAAAA,QAAQ,CAACH,aAAAA,CAAAA;AAE9C,IAAA,IAAIE,eAAiB,EAAA;AACnB,QAAA;AACF;AAEAhD,IAAAA,MAAAA,CAAOC,YAAY,CAACC,OAAO,CACzBtC,2BACAuC,EAAAA,IAAAA,CAAKC,SAAS,CAAC;AAAI2C,QAAAA,GAAAA,YAAAA;AAAcD,QAAAA;AAAc,KAAA,CAAA,CAAA;AAEnD,CAAA;;;;"}
@@ -1,167 +0,0 @@
1
- 'use strict';
2
-
3
- const LAYOUT_DATA = {
4
- contentTypeBuilder: {
5
- home: {
6
- title: {
7
- id: 'app.components.GuidedTour.home.CTB.title',
8
- defaultMessage: '🧠 Build the content structure'
9
- },
10
- cta: {
11
- title: {
12
- id: 'app.components.GuidedTour.home.CTB.cta.title',
13
- defaultMessage: 'Go to the Content type Builder'
14
- },
15
- type: 'REDIRECT',
16
- target: '/plugins/content-type-builder'
17
- },
18
- trackingEvent: 'didClickGuidedTourHomepageContentTypeBuilder'
19
- },
20
- create: {
21
- title: {
22
- id: 'app.components.GuidedTour.CTB.create.title',
23
- defaultMessage: '🧠 Create a first Collection type'
24
- },
25
- content: {
26
- id: 'app.components.GuidedTour.CTB.create.content',
27
- defaultMessage: '<p>Collection types help you manage several entries, Single types are suitable to manage only one entry.</p> <p>Ex: For a Blog website, Articles would be a Collection type whereas a Homepage would be a Single type.</p>'
28
- },
29
- cta: {
30
- title: {
31
- id: 'app.components.GuidedTour.CTB.create.cta.title',
32
- defaultMessage: 'Build a Collection type'
33
- },
34
- type: 'CLOSE'
35
- },
36
- trackingEvent: 'didClickGuidedTourStep1CollectionType'
37
- },
38
- success: {
39
- title: {
40
- id: 'app.components.GuidedTour.CTB.success.title',
41
- defaultMessage: 'Step 1: Completed ✅'
42
- },
43
- content: {
44
- id: 'app.components.GuidedTour.CTB.success.content',
45
- defaultMessage: '<p>Good going!</p><b>⚡️ What would you like to share with the world?</b>'
46
- },
47
- cta: {
48
- title: {
49
- id: 'app.components.GuidedTour.create-content',
50
- defaultMessage: 'Create content'
51
- },
52
- type: 'REDIRECT',
53
- target: '/content-manager'
54
- },
55
- trackingEvent: 'didCreateGuidedTourCollectionType'
56
- }
57
- },
58
- contentManager: {
59
- home: {
60
- title: {
61
- id: 'app.components.GuidedTour.home.CM.title',
62
- defaultMessage: '⚡️ What would you like to share with the world?'
63
- },
64
- cta: {
65
- title: {
66
- id: 'app.components.GuidedTour.create-content',
67
- defaultMessage: 'Create content'
68
- },
69
- type: 'REDIRECT',
70
- target: '/content-manager'
71
- },
72
- trackingEvent: 'didClickGuidedTourHomepageContentManager'
73
- },
74
- create: {
75
- title: {
76
- id: 'app.components.GuidedTour.CM.create.title',
77
- defaultMessage: '⚡️ Create content'
78
- },
79
- content: {
80
- id: 'app.components.GuidedTour.CM.create.content',
81
- defaultMessage: "<p>Create and manage all the content here in the Content Manager.</p><p>Ex: Taking the Blog website example further, one can write an Article, save and publish it as they like.</p><p>💡 Quick tip - Don't forget to hit publish on the content you create.</p>"
82
- },
83
- cta: {
84
- title: {
85
- id: 'app.components.GuidedTour.create-content',
86
- defaultMessage: 'Create content'
87
- },
88
- type: 'CLOSE'
89
- },
90
- trackingEvent: 'didClickGuidedTourStep2ContentManager'
91
- },
92
- success: {
93
- title: {
94
- id: 'app.components.GuidedTour.CM.success.title',
95
- defaultMessage: 'Step 2: Completed ✅'
96
- },
97
- content: {
98
- id: 'app.components.GuidedTour.CM.success.content',
99
- defaultMessage: '<p>Awesome, one last step to go!</p><b>🚀 See content in action</b>'
100
- },
101
- cta: {
102
- title: {
103
- id: 'app.components.GuidedTour.CM.success.cta.title',
104
- defaultMessage: 'Test the API'
105
- },
106
- type: 'REDIRECT',
107
- target: '/settings/api-tokens'
108
- },
109
- trackingEvent: 'didCreateGuidedTourEntry'
110
- }
111
- },
112
- apiTokens: {
113
- home: {
114
- title: {
115
- id: 'app.components.GuidedTour.apiTokens.create.title',
116
- defaultMessage: '🚀 See content in action'
117
- },
118
- cta: {
119
- title: {
120
- id: 'app.components.GuidedTour.home.apiTokens.cta.title',
121
- defaultMessage: 'Test the API'
122
- },
123
- type: 'REDIRECT',
124
- target: '/settings/api-tokens'
125
- },
126
- trackingEvent: 'didClickGuidedTourHomepageApiTokens'
127
- },
128
- create: {
129
- title: {
130
- id: 'app.components.GuidedTour.apiTokens.create.title',
131
- defaultMessage: '🚀 See content in action'
132
- },
133
- content: {
134
- id: 'app.components.GuidedTour.apiTokens.create.content',
135
- defaultMessage: '<p>Generate an authentication token here and retrieve the content you just created.</p>'
136
- },
137
- cta: {
138
- title: {
139
- id: 'app.components.GuidedTour.apiTokens.create.cta.title',
140
- defaultMessage: 'Generate an API Token'
141
- },
142
- type: 'CLOSE'
143
- },
144
- trackingEvent: 'didClickGuidedTourStep3ApiTokens'
145
- },
146
- success: {
147
- title: {
148
- id: 'app.components.GuidedTour.apiTokens.success.title',
149
- defaultMessage: 'Step 3: Completed ✅'
150
- },
151
- content: {
152
- id: 'app.components.GuidedTour.apiTokens.success.content',
153
- defaultMessage: "<p>See content in action by making an HTTP request:</p><ul><li><p>To this URL: <light>https://'<'YOUR_DOMAIN'>'/api/'<'YOUR_CT'>'</light></p></li><li><p>With the header: <light>Authorization: bearer '<'YOUR_API_TOKEN'>'</light></p></li></ul><p>For more ways to interact with content, see the <documentationLink>documentation</documentationLink>.</p>"
154
- },
155
- trackingEvent: 'didGenerateGuidedTourApiTokens'
156
- }
157
- }
158
- };
159
- const STATES = {
160
- IS_DONE: 'IS_DONE',
161
- IS_ACTIVE: 'IS_ACTIVE',
162
- IS_NOT_DONE: 'IS_NOT_DONE'
163
- };
164
-
165
- exports.LAYOUT_DATA = LAYOUT_DATA;
166
- exports.STATES = STATES;
167
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sources":["../../../../../../admin/src/components/GuidedTour/constants.ts"],"sourcesContent":["const LAYOUT_DATA = {\n contentTypeBuilder: {\n home: {\n title: {\n id: 'app.components.GuidedTour.home.CTB.title',\n defaultMessage: '🧠 Build the content structure',\n },\n cta: {\n title: {\n id: 'app.components.GuidedTour.home.CTB.cta.title',\n defaultMessage: 'Go to the Content type Builder',\n },\n type: 'REDIRECT',\n target: '/plugins/content-type-builder',\n },\n trackingEvent: 'didClickGuidedTourHomepageContentTypeBuilder',\n },\n create: {\n title: {\n id: 'app.components.GuidedTour.CTB.create.title',\n defaultMessage: '🧠 Create a first Collection type',\n },\n content: {\n id: 'app.components.GuidedTour.CTB.create.content',\n defaultMessage:\n '<p>Collection types help you manage several entries, Single types are suitable to manage only one entry.</p> <p>Ex: For a Blog website, Articles would be a Collection type whereas a Homepage would be a Single type.</p>',\n },\n cta: {\n title: {\n id: 'app.components.GuidedTour.CTB.create.cta.title',\n defaultMessage: 'Build a Collection type',\n },\n type: 'CLOSE',\n },\n trackingEvent: 'didClickGuidedTourStep1CollectionType',\n },\n success: {\n title: {\n id: 'app.components.GuidedTour.CTB.success.title',\n defaultMessage: 'Step 1: Completed ✅',\n },\n content: {\n id: 'app.components.GuidedTour.CTB.success.content',\n defaultMessage: '<p>Good going!</p><b>⚡️ What would you like to share with the world?</b>',\n },\n cta: {\n title: {\n id: 'app.components.GuidedTour.create-content',\n defaultMessage: 'Create content',\n },\n type: 'REDIRECT',\n target: '/content-manager',\n },\n trackingEvent: 'didCreateGuidedTourCollectionType',\n },\n },\n contentManager: {\n home: {\n title: {\n id: 'app.components.GuidedTour.home.CM.title',\n defaultMessage: '⚡️ What would you like to share with the world?',\n },\n cta: {\n title: {\n id: 'app.components.GuidedTour.create-content',\n defaultMessage: 'Create content',\n },\n type: 'REDIRECT',\n target: '/content-manager',\n },\n trackingEvent: 'didClickGuidedTourHomepageContentManager',\n },\n create: {\n title: {\n id: 'app.components.GuidedTour.CM.create.title',\n defaultMessage: '⚡️ Create content',\n },\n content: {\n id: 'app.components.GuidedTour.CM.create.content',\n defaultMessage:\n \"<p>Create and manage all the content here in the Content Manager.</p><p>Ex: Taking the Blog website example further, one can write an Article, save and publish it as they like.</p><p>💡 Quick tip - Don't forget to hit publish on the content you create.</p>\",\n },\n cta: {\n title: {\n id: 'app.components.GuidedTour.create-content',\n defaultMessage: 'Create content',\n },\n type: 'CLOSE',\n },\n trackingEvent: 'didClickGuidedTourStep2ContentManager',\n },\n success: {\n title: {\n id: 'app.components.GuidedTour.CM.success.title',\n defaultMessage: 'Step 2: Completed ✅',\n },\n content: {\n id: 'app.components.GuidedTour.CM.success.content',\n defaultMessage: '<p>Awesome, one last step to go!</p><b>🚀 See content in action</b>',\n },\n cta: {\n title: {\n id: 'app.components.GuidedTour.CM.success.cta.title',\n defaultMessage: 'Test the API',\n },\n type: 'REDIRECT',\n target: '/settings/api-tokens',\n },\n trackingEvent: 'didCreateGuidedTourEntry',\n },\n },\n apiTokens: {\n home: {\n title: {\n id: 'app.components.GuidedTour.apiTokens.create.title',\n defaultMessage: '🚀 See content in action',\n },\n cta: {\n title: {\n id: 'app.components.GuidedTour.home.apiTokens.cta.title',\n defaultMessage: 'Test the API',\n },\n type: 'REDIRECT',\n target: '/settings/api-tokens',\n },\n trackingEvent: 'didClickGuidedTourHomepageApiTokens',\n },\n create: {\n title: {\n id: 'app.components.GuidedTour.apiTokens.create.title',\n defaultMessage: '🚀 See content in action',\n },\n content: {\n id: 'app.components.GuidedTour.apiTokens.create.content',\n defaultMessage:\n '<p>Generate an authentication token here and retrieve the content you just created.</p>',\n },\n cta: {\n title: {\n id: 'app.components.GuidedTour.apiTokens.create.cta.title',\n defaultMessage: 'Generate an API Token',\n },\n type: 'CLOSE',\n },\n trackingEvent: 'didClickGuidedTourStep3ApiTokens',\n },\n success: {\n title: {\n id: 'app.components.GuidedTour.apiTokens.success.title',\n defaultMessage: 'Step 3: Completed ✅',\n },\n content: {\n id: 'app.components.GuidedTour.apiTokens.success.content',\n defaultMessage:\n \"<p>See content in action by making an HTTP request:</p><ul><li><p>To this URL: <light>https://'<'YOUR_DOMAIN'>'/api/'<'YOUR_CT'>'</light></p></li><li><p>With the header: <light>Authorization: bearer '<'YOUR_API_TOKEN'>'</light></p></li></ul><p>For more ways to interact with content, see the <documentationLink>documentation</documentationLink>.</p>\",\n },\n trackingEvent: 'didGenerateGuidedTourApiTokens',\n },\n },\n} as const;\n\nconst STATES = {\n IS_DONE: 'IS_DONE',\n IS_ACTIVE: 'IS_ACTIVE',\n IS_NOT_DONE: 'IS_NOT_DONE',\n} as const;\n\ntype LayoutData = typeof LAYOUT_DATA;\ntype States = keyof typeof STATES;\n\nexport { LAYOUT_DATA, STATES };\nexport type { LayoutData, States };\n"],"names":["LAYOUT_DATA","contentTypeBuilder","home","title","id","defaultMessage","cta","type","target","trackingEvent","create","content","success","contentManager","apiTokens","STATES","IS_DONE","IS_ACTIVE","IS_NOT_DONE"],"mappings":";;AAAA,MAAMA,WAAc,GAAA;IAClBC,kBAAoB,EAAA;QAClBC,IAAM,EAAA;YACJC,KAAO,EAAA;gBACLC,EAAI,EAAA,0CAAA;gBACJC,cAAgB,EAAA;AAClB,aAAA;YACAC,GAAK,EAAA;gBACHH,KAAO,EAAA;oBACLC,EAAI,EAAA,8CAAA;oBACJC,cAAgB,EAAA;AAClB,iBAAA;gBACAE,IAAM,EAAA,UAAA;gBACNC,MAAQ,EAAA;AACV,aAAA;YACAC,aAAe,EAAA;AACjB,SAAA;QACAC,MAAQ,EAAA;YACNP,KAAO,EAAA;gBACLC,EAAI,EAAA,4CAAA;gBACJC,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