@strapi/admin 5.17.0 → 5.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/admin/src/StrapiApp.js +27 -4
- package/dist/admin/admin/src/StrapiApp.js.map +1 -1
- package/dist/admin/admin/src/StrapiApp.mjs +27 -4
- package/dist/admin/admin/src/StrapiApp.mjs.map +1 -1
- package/dist/admin/admin/src/components/GuidedTour/Provider.js +2 -1
- package/dist/admin/admin/src/components/GuidedTour/Provider.js.map +1 -1
- package/dist/admin/admin/src/components/GuidedTour/Provider.mjs +2 -1
- package/dist/admin/admin/src/components/GuidedTour/Provider.mjs.map +1 -1
- package/dist/admin/admin/src/components/LeftMenu.js +1 -1
- package/dist/admin/admin/src/components/LeftMenu.js.map +1 -1
- package/dist/admin/admin/src/components/LeftMenu.mjs +2 -2
- package/dist/admin/admin/src/components/LeftMenu.mjs.map +1 -1
- package/dist/admin/admin/src/components/MainNav/NavLink.js +40 -4
- package/dist/admin/admin/src/components/MainNav/NavLink.js.map +1 -1
- package/dist/admin/admin/src/components/MainNav/NavLink.mjs +21 -4
- package/dist/admin/admin/src/components/MainNav/NavLink.mjs.map +1 -1
- package/dist/admin/admin/src/components/MainNav/NavUser.js +1 -1
- package/dist/admin/admin/src/components/MainNav/NavUser.js.map +1 -1
- package/dist/admin/admin/src/components/MainNav/NavUser.mjs +1 -1
- package/dist/admin/admin/src/components/MainNav/NavUser.mjs.map +1 -1
- package/dist/admin/admin/src/components/Providers.js +0 -2
- package/dist/admin/admin/src/components/Providers.js.map +1 -1
- package/dist/admin/admin/src/components/Providers.mjs +0 -2
- package/dist/admin/admin/src/components/Providers.mjs.map +1 -1
- package/dist/admin/admin/src/components/SubNav.js +27 -7
- package/dist/admin/admin/src/components/SubNav.js.map +1 -1
- package/dist/admin/admin/src/components/SubNav.mjs +28 -8
- package/dist/admin/admin/src/components/SubNav.mjs.map +1 -1
- package/dist/admin/admin/src/components/UnstableGuidedTour/Context.js +31 -9
- package/dist/admin/admin/src/components/UnstableGuidedTour/Context.js.map +1 -1
- package/dist/admin/admin/src/components/UnstableGuidedTour/Context.mjs +31 -9
- package/dist/admin/admin/src/components/UnstableGuidedTour/Context.mjs.map +1 -1
- package/dist/admin/admin/src/components/UnstableGuidedTour/Overview.js +306 -0
- package/dist/admin/admin/src/components/UnstableGuidedTour/Overview.js.map +1 -0
- package/dist/admin/admin/src/components/UnstableGuidedTour/Overview.mjs +304 -0
- package/dist/admin/admin/src/components/UnstableGuidedTour/Overview.mjs.map +1 -0
- package/dist/admin/admin/src/components/UnstableGuidedTour/Step.js +73 -27
- package/dist/admin/admin/src/components/UnstableGuidedTour/Step.js.map +1 -1
- package/dist/admin/admin/src/components/UnstableGuidedTour/Step.mjs +75 -30
- package/dist/admin/admin/src/components/UnstableGuidedTour/Step.mjs.map +1 -1
- package/dist/admin/admin/src/components/UnstableGuidedTour/Tours.js +316 -28
- package/dist/admin/admin/src/components/UnstableGuidedTour/Tours.js.map +1 -1
- package/dist/admin/admin/src/components/UnstableGuidedTour/Tours.mjs +319 -30
- package/dist/admin/admin/src/components/UnstableGuidedTour/Tours.mjs.map +1 -1
- package/dist/admin/admin/src/components/Widgets.js +52 -0
- package/dist/admin/admin/src/components/Widgets.js.map +1 -0
- package/dist/admin/admin/src/components/Widgets.mjs +50 -0
- package/dist/admin/admin/src/components/Widgets.mjs.map +1 -0
- package/dist/admin/admin/src/core/apis/Widgets.js.map +1 -1
- package/dist/admin/admin/src/core/apis/Widgets.mjs.map +1 -1
- package/dist/admin/admin/src/features/Auth.js.map +1 -1
- package/dist/admin/admin/src/features/Auth.mjs.map +1 -1
- package/dist/admin/admin/src/layouts/AuthenticatedLayout.js.map +1 -1
- package/dist/admin/admin/src/layouts/AuthenticatedLayout.mjs.map +1 -1
- package/dist/admin/admin/src/pages/Home/HomePage.js +3 -1
- package/dist/admin/admin/src/pages/Home/HomePage.js.map +1 -1
- package/dist/admin/admin/src/pages/Home/HomePage.mjs +3 -1
- package/dist/admin/admin/src/pages/Home/HomePage.mjs.map +1 -1
- package/dist/admin/admin/src/pages/Settings/components/Tokens/TokenBox.js +93 -0
- package/dist/admin/admin/src/pages/Settings/components/Tokens/TokenBox.js.map +1 -1
- package/dist/admin/admin/src/pages/Settings/components/Tokens/TokenBox.mjs +95 -3
- package/dist/admin/admin/src/pages/Settings/components/Tokens/TokenBox.mjs.map +1 -1
- package/dist/admin/admin/src/pages/Settings/pages/ApiTokens/EditView/EditViewPage.js +8 -3
- package/dist/admin/admin/src/pages/Settings/pages/ApiTokens/EditView/EditViewPage.js.map +1 -1
- package/dist/admin/admin/src/pages/Settings/pages/ApiTokens/EditView/EditViewPage.mjs +10 -5
- package/dist/admin/admin/src/pages/Settings/pages/ApiTokens/EditView/EditViewPage.mjs.map +1 -1
- package/dist/admin/admin/src/pages/Settings/pages/ApiTokens/EditView/components/CollapsableContentType.js +6 -1
- package/dist/admin/admin/src/pages/Settings/pages/ApiTokens/EditView/components/CollapsableContentType.js.map +1 -1
- package/dist/admin/admin/src/pages/Settings/pages/ApiTokens/EditView/components/CollapsableContentType.mjs +6 -1
- package/dist/admin/admin/src/pages/Settings/pages/ApiTokens/EditView/components/CollapsableContentType.mjs.map +1 -1
- package/dist/admin/admin/src/pages/Settings/pages/ApiTokens/ListView.js +58 -53
- package/dist/admin/admin/src/pages/Settings/pages/ApiTokens/ListView.js.map +1 -1
- package/dist/admin/admin/src/pages/Settings/pages/ApiTokens/ListView.mjs +58 -53
- package/dist/admin/admin/src/pages/Settings/pages/ApiTokens/ListView.mjs.map +1 -1
- package/dist/admin/admin/src/translations/en.json.js +38 -2
- package/dist/admin/admin/src/translations/en.json.js.map +1 -1
- package/dist/admin/admin/src/translations/en.json.mjs +38 -2
- package/dist/admin/admin/src/translations/en.json.mjs.map +1 -1
- package/dist/admin/admin/src/translations/es.json.js +3 -1
- package/dist/admin/admin/src/translations/es.json.js.map +1 -1
- package/dist/admin/admin/src/translations/es.json.mjs +3 -1
- package/dist/admin/admin/src/translations/es.json.mjs.map +1 -1
- package/dist/admin/admin/src/translations/fr.json.js +3 -1
- package/dist/admin/admin/src/translations/fr.json.js.map +1 -1
- package/dist/admin/admin/src/translations/fr.json.mjs +3 -1
- package/dist/admin/admin/src/translations/fr.json.mjs.map +1 -1
- package/dist/admin/admin/src/utils/users.js +8 -0
- package/dist/admin/admin/src/utils/users.js.map +1 -1
- package/dist/admin/admin/src/utils/users.mjs +8 -1
- package/dist/admin/admin/src/utils/users.mjs.map +1 -1
- package/dist/admin/admin/tests/server.js +8 -0
- package/dist/admin/admin/tests/server.js.map +1 -1
- package/dist/admin/admin/tests/server.mjs +8 -0
- package/dist/admin/admin/tests/server.mjs.map +1 -1
- package/dist/admin/admin/tests/utils.js +25 -21
- package/dist/admin/admin/tests/utils.js.map +1 -1
- package/dist/admin/admin/tests/utils.mjs +25 -21
- package/dist/admin/admin/tests/utils.mjs.map +1 -1
- package/dist/admin/src/components/UnstableGuidedTour/Context.d.ts +12 -3
- package/dist/admin/src/components/UnstableGuidedTour/Overview.d.ts +1 -0
- package/dist/admin/src/components/UnstableGuidedTour/Step.d.ts +11 -3
- package/dist/admin/src/components/UnstableGuidedTour/Tours.d.ts +40 -9
- package/dist/admin/src/components/Widgets.d.ts +2 -0
- package/dist/admin/src/core/apis/Widgets.d.ts +1 -1
- package/dist/admin/src/features/Auth.d.ts +1 -1
- package/dist/admin/src/pages/Settings/components/Tokens/TokenBox.d.ts +1 -0
- package/dist/admin/src/utils/users.d.ts +5 -1
- package/dist/server/server/src/services/guided-tour.js +20 -2
- package/dist/server/server/src/services/guided-tour.js.map +1 -1
- package/dist/server/server/src/services/guided-tour.mjs +20 -2
- package/dist/server/server/src/services/guided-tour.mjs.map +1 -1
- package/dist/server/server/src/strategies/api-token.js +15 -4
- package/dist/server/server/src/strategies/api-token.js.map +1 -1
- package/dist/server/server/src/strategies/api-token.mjs +15 -4
- package/dist/server/server/src/strategies/api-token.mjs.map +1 -1
- package/dist/server/src/services/guided-tour.d.ts.map +1 -1
- package/dist/server/src/strategies/api-token.d.ts.map +1 -1
- package/package.json +9 -9
|
@@ -1,26 +1,72 @@
|
|
|
1
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { Flex, Popover,
|
|
3
|
+
import { Flex, Popover, Typography, Box, Button, LinkButton } from '@strapi/design-system';
|
|
4
4
|
import { FormattedMessage } from 'react-intl';
|
|
5
|
+
import { NavLink } from 'react-router-dom';
|
|
5
6
|
import { styled } from 'styled-components';
|
|
6
7
|
import { unstableUseGuidedTour } from './Context.mjs';
|
|
7
8
|
|
|
8
9
|
const ActionsContainer = styled(Flex)`
|
|
9
10
|
border-top: ${({ theme })=>`1px solid ${theme.colors.neutral150}`};
|
|
10
11
|
`;
|
|
12
|
+
/**
|
|
13
|
+
* TODO:
|
|
14
|
+
* We should probably move all arrow styles + svg to the DS
|
|
15
|
+
*/ const PopoverArrow = styled(Popover.Arrow)`
|
|
16
|
+
fill: ${({ theme })=>theme.colors.neutral0};
|
|
17
|
+
transform: translateY(-16px) rotate(-90deg);
|
|
18
|
+
`;
|
|
19
|
+
const StepCount = ({ tourName })=>{
|
|
20
|
+
const state = unstableUseGuidedTour('GuidedTourPopover', (s)=>s.state);
|
|
21
|
+
const currentStep = state.tours[tourName].currentStep + 1;
|
|
22
|
+
// TODO: Currently all tours do not count their last step, but we should find a way to make this more smart
|
|
23
|
+
const displayedLength = state.tours[tourName].length - 1;
|
|
24
|
+
return /*#__PURE__*/ jsx(Typography, {
|
|
25
|
+
variant: "omega",
|
|
26
|
+
fontSize: "12px",
|
|
27
|
+
children: /*#__PURE__*/ jsx(FormattedMessage, {
|
|
28
|
+
id: "tours.stepCount",
|
|
29
|
+
defaultMessage: "Step {currentStep} of {tourLength}",
|
|
30
|
+
values: {
|
|
31
|
+
currentStep,
|
|
32
|
+
tourLength: displayedLength
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
};
|
|
11
37
|
const createStepComponents = (tourName)=>({
|
|
12
|
-
Root: /*#__PURE__*/ React.forwardRef((props, ref)
|
|
38
|
+
Root: /*#__PURE__*/ React.forwardRef(({ withArrow = true, ...props }, ref)=>{
|
|
39
|
+
return /*#__PURE__*/ jsxs(Popover.Content, {
|
|
13
40
|
ref: ref,
|
|
14
41
|
side: "top",
|
|
15
42
|
align: "center",
|
|
43
|
+
style: {
|
|
44
|
+
border: 'none'
|
|
45
|
+
},
|
|
16
46
|
...props,
|
|
17
|
-
children:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
47
|
+
children: [
|
|
48
|
+
withArrow && /*#__PURE__*/ jsx(PopoverArrow, {
|
|
49
|
+
asChild: true,
|
|
50
|
+
children: /*#__PURE__*/ jsx("svg", {
|
|
51
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
52
|
+
width: "23",
|
|
53
|
+
height: "25",
|
|
54
|
+
viewBox: "0 0 23 25",
|
|
55
|
+
fill: "none",
|
|
56
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
57
|
+
d: "M11 24.5L1.82843 15.3284C0.266332 13.7663 0.26633 11.2337 1.82843 9.67157L11 0.5L23 12.5L11 24.5Z"
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
}),
|
|
61
|
+
/*#__PURE__*/ jsx(Flex, {
|
|
62
|
+
width: "360px",
|
|
63
|
+
direction: "column",
|
|
64
|
+
alignItems: "start",
|
|
65
|
+
children: props.children
|
|
66
|
+
})
|
|
67
|
+
]
|
|
68
|
+
});
|
|
69
|
+
}),
|
|
24
70
|
Title: (props)=>{
|
|
25
71
|
return /*#__PURE__*/ jsx(Box, {
|
|
26
72
|
paddingTop: 5,
|
|
@@ -55,30 +101,18 @@ const createStepComponents = (tourName)=>({
|
|
|
55
101
|
})
|
|
56
102
|
})
|
|
57
103
|
}),
|
|
58
|
-
Actions: ({ showStepCount = true, showSkip = false, ...
|
|
104
|
+
Actions: ({ showStepCount = true, showSkip = false, to, children, ...flexProps })=>{
|
|
59
105
|
const dispatch = unstableUseGuidedTour('GuidedTourPopover', (s)=>s.dispatch);
|
|
60
|
-
const state = unstableUseGuidedTour('GuidedTourPopover', (s)=>s.state);
|
|
61
|
-
const currentStep = state.tours[tourName].currentStep + 1;
|
|
62
|
-
const tourLength = state.tours[tourName].length;
|
|
63
106
|
return /*#__PURE__*/ jsx(ActionsContainer, {
|
|
64
107
|
width: "100%",
|
|
65
108
|
padding: 3,
|
|
66
109
|
paddingLeft: 5,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
110
|
+
justifyContent: showStepCount ? 'space-between' : 'flex-end',
|
|
111
|
+
...flexProps,
|
|
112
|
+
children: children ? children : /*#__PURE__*/ jsxs(Fragment, {
|
|
70
113
|
children: [
|
|
71
|
-
showStepCount && /*#__PURE__*/ jsx(
|
|
72
|
-
|
|
73
|
-
fontSize: "12px",
|
|
74
|
-
children: /*#__PURE__*/ jsx(FormattedMessage, {
|
|
75
|
-
id: "tours.stepCount",
|
|
76
|
-
defaultMessage: "Step {currentStep} of {tourLength}",
|
|
77
|
-
values: {
|
|
78
|
-
currentStep,
|
|
79
|
-
tourLength
|
|
80
|
-
}
|
|
81
|
-
})
|
|
114
|
+
showStepCount && /*#__PURE__*/ jsx(StepCount, {
|
|
115
|
+
tourName: tourName
|
|
82
116
|
}),
|
|
83
117
|
/*#__PURE__*/ jsxs(Flex, {
|
|
84
118
|
gap: 2,
|
|
@@ -94,7 +128,18 @@ const createStepComponents = (tourName)=>({
|
|
|
94
128
|
defaultMessage: "Skip"
|
|
95
129
|
})
|
|
96
130
|
}),
|
|
97
|
-
/*#__PURE__*/ jsx(
|
|
131
|
+
to ? /*#__PURE__*/ jsx(LinkButton, {
|
|
132
|
+
tag: NavLink,
|
|
133
|
+
to: to,
|
|
134
|
+
onClick: ()=>dispatch({
|
|
135
|
+
type: 'next_step',
|
|
136
|
+
payload: tourName
|
|
137
|
+
}),
|
|
138
|
+
children: /*#__PURE__*/ jsx(FormattedMessage, {
|
|
139
|
+
id: "tours.next",
|
|
140
|
+
defaultMessage: "Next"
|
|
141
|
+
})
|
|
142
|
+
}) : /*#__PURE__*/ jsx(Button, {
|
|
98
143
|
onClick: ()=>dispatch({
|
|
99
144
|
type: 'next_step',
|
|
100
145
|
payload: tourName
|
|
@@ -112,5 +157,5 @@ const createStepComponents = (tourName)=>({
|
|
|
112
157
|
}
|
|
113
158
|
});
|
|
114
159
|
|
|
115
|
-
export { createStepComponents };
|
|
160
|
+
export { StepCount, createStepComponents };
|
|
116
161
|
//# sourceMappingURL=Step.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Step.mjs","sources":["../../../../../../admin/src/components/UnstableGuidedTour/Step.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Popover, Box, Flex, Button, Typography } from '@strapi/design-system';\nimport { FormattedMessage, type MessageDescriptor } from 'react-intl';\nimport { styled } from 'styled-components';\n\nimport { unstableUseGuidedTour, ValidTourName } from './Context';\n\n/* -------------------------------------------------------------------------------------------------\n * Step factory\n * -----------------------------------------------------------------------------------------------*/\n\ntype WithChildren = {\n children: React.ReactNode;\n id?: never;\n defaultMessage?: never;\n};\n\ntype WithIntl = {\n children?: undefined;\n id: MessageDescriptor['id'];\n defaultMessage: MessageDescriptor['defaultMessage'];\n};\n\ntype WithActionsChildren = {\n children: React.ReactNode;\n showStepCount?: boolean;\n showSkip?: boolean;\n};\n\ntype WithActionsProps = {\n children?: undefined;\n showStepCount?: boolean;\n showSkip?: boolean;\n};\n\ntype StepProps = WithChildren | WithIntl;\ntype ActionsProps = WithActionsChildren | WithActionsProps;\n\ntype Step = {\n Root: React.ForwardRefExoticComponent<React.ComponentProps<typeof Popover.Content>>;\n Title: (props: StepProps) => React.ReactNode;\n Content: (props: StepProps) => React.ReactNode;\n Actions: (props: ActionsProps) => React.ReactNode;\n};\n\nconst ActionsContainer = styled(Flex)`\n border-top: ${({ theme }) => `1px solid ${theme.colors.neutral150}`};\n`;\n\nconst createStepComponents = (tourName: ValidTourName): Step => ({\n Root: React.forwardRef((props, ref) => (\n <Popover.Content ref={ref} side=\"top\" align=\"center\" {...props}>\n <Flex width=\"360px\" direction=\"column\" alignItems=\"start\">\n {props.children}\n </Flex>\n </Popover.Content>\n )),\n\n Title: (props) => {\n return (\n <Box paddingTop={5} paddingLeft={5} paddingRight={5} paddingBottom={1} width=\"100%\">\n {'children' in props ? (\n props.children\n ) : (\n <Typography tag=\"div\" variant=\"omega\" fontWeight=\"bold\">\n <FormattedMessage tagName=\"h1\" id={props.id} defaultMessage={props.defaultMessage} />\n </Typography>\n )}\n </Box>\n );\n },\n\n Content: (props) => (\n <Box paddingBottom={5} paddingLeft={5} paddingRight={5} width=\"100%\">\n {'children' in props ? (\n props.children\n ) : (\n <Typography tag=\"div\" variant=\"omega\">\n <FormattedMessage tagName=\"p\" id={props.id} defaultMessage={props.defaultMessage} />\n </Typography>\n )}\n </Box>\n ),\n\n Actions: ({ showStepCount = true, showSkip = false, ...props }) => {\n const dispatch = unstableUseGuidedTour('GuidedTourPopover', (s) => s.dispatch);\n const state = unstableUseGuidedTour('GuidedTourPopover', (s) => s.state);\n const currentStep = state.tours[tourName].currentStep + 1;\n const tourLength = state.tours[tourName].length;\n\n return (\n <ActionsContainer width=\"100%\" padding={3} paddingLeft={5}>\n {'children' in props ? (\n props.children\n ) : (\n <Flex flex={1} justifyContent={showStepCount ? 'space-between' : 'flex-end'}>\n {showStepCount && (\n <Typography variant=\"omega\" fontSize=\"12px\">\n <FormattedMessage\n id=\"tours.stepCount\"\n defaultMessage=\"Step {currentStep} of {tourLength}\"\n values={{ currentStep, tourLength }}\n />\n </Typography>\n )}\n <Flex gap={2}>\n {showSkip && (\n <Button\n variant=\"tertiary\"\n onClick={() => dispatch({ type: 'skip_tour', payload: tourName })}\n >\n <FormattedMessage id=\"tours.skip\" defaultMessage=\"Skip\" />\n </Button>\n )}\n <Button onClick={() => dispatch({ type: 'next_step', payload: tourName })}>\n <FormattedMessage id=\"tours.next\" defaultMessage=\"Next\" />\n </Button>\n </Flex>\n </Flex>\n )}\n </ActionsContainer>\n );\n },\n});\n\nexport type { Step };\nexport { createStepComponents };\n"],"names":["ActionsContainer","styled","Flex","theme","colors","neutral150","createStepComponents","tourName","Root","React","forwardRef","props","ref","_jsx","Popover","Content","side","align","width","direction","alignItems","children","Title","Box","paddingTop","paddingLeft","paddingRight","paddingBottom","Typography","tag","variant","fontWeight","FormattedMessage","tagName","id","defaultMessage","Actions","showStepCount","showSkip","dispatch","unstableUseGuidedTour","s","state","currentStep","tours","tourLength","length","padding","_jsxs","flex","justifyContent","fontSize","values","gap","Button","onClick","type","payload"],"mappings":";;;;;;;AA8CA,MAAMA,gBAAAA,GAAmBC,MAAOC,CAAAA,IAAAA,CAAK;AACvB,cAAA,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAK,CAAC,UAAU,EAAEA,KAAAA,CAAMC,MAAM,CAACC,UAAU,CAAC,CAAC,CAAC;AACtE,CAAC;AAEKC,MAAAA,oBAAAA,GAAuB,CAACC,QAAAA,IAAmC;QAC/DC,IAAMC,gBAAAA,KAAAA,CAAMC,UAAU,CAAC,CAACC,OAAOC,GAC7B,iBAAAC,GAAA,CAACC,QAAQC,OAAO,EAAA;gBAACH,GAAKA,EAAAA,GAAAA;gBAAKI,IAAK,EAAA,KAAA;gBAAMC,KAAM,EAAA,QAAA;AAAU,gBAAA,GAAGN,KAAK;AAC5D,gBAAA,QAAA,gBAAAE,GAACX,CAAAA,IAAAA,EAAAA;oBAAKgB,KAAM,EAAA,OAAA;oBAAQC,SAAU,EAAA,QAAA;oBAASC,UAAW,EAAA,OAAA;AAC/CT,oBAAAA,QAAAA,EAAAA,KAAAA,CAAMU;;;AAKbC,QAAAA,KAAAA,EAAO,CAACX,KAAAA,GAAAA;AACN,YAA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BAAAM,GAACmB,CAAAA,gBAAAA,EAAAA;wCAAiBE,EAAG,EAAA,YAAA;wCAAaC,cAAe,EAAA;;;8CAGrDtB,GAACyC,CAAAA,MAAAA,EAAAA;AAAOC,oCAAAA,OAAAA,EAAS,IAAMhB,QAAS,CAAA;4CAAEiB,IAAM,EAAA,WAAA;4CAAaC,OAASlD,EAAAA;AAAS,yCAAA,CAAA;AACrE,oCAAA,QAAA,gBAAAM,GAACmB,CAAAA,gBAAAA,EAAAA;wCAAiBE,EAAG,EAAA,YAAA;wCAAaC,cAAe,EAAA;;;;;;;;AAO/D;KACF;;;;"}
|
|
1
|
+
{"version":3,"file":"Step.mjs","sources":["../../../../../../admin/src/components/UnstableGuidedTour/Step.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n Popover,\n Box,\n Flex,\n Button,\n Typography,\n LinkButton,\n FlexProps,\n} from '@strapi/design-system';\nimport { FormattedMessage, type MessageDescriptor } from 'react-intl';\nimport { NavLink } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { unstableUseGuidedTour, ValidTourName } from './Context';\n\n/* -------------------------------------------------------------------------------------------------\n * Step factory\n * -----------------------------------------------------------------------------------------------*/\n\ntype WithChildren = {\n children: React.ReactNode;\n id?: never;\n defaultMessage?: never;\n};\n\ntype WithIntl = {\n children?: undefined;\n id: MessageDescriptor['id'];\n defaultMessage: MessageDescriptor['defaultMessage'];\n withArrow?: boolean;\n};\n\ntype WithActionsChildren = {\n children: React.ReactNode;\n showStepCount?: boolean;\n showSkip?: boolean;\n};\n\ntype WithActionsProps = {\n children?: undefined;\n showStepCount?: boolean;\n showSkip?: boolean;\n};\n\ntype StepProps = WithChildren | WithIntl;\ntype ActionsProps = WithActionsChildren | WithActionsProps;\n\ntype Step = {\n Root: React.ForwardRefExoticComponent<\n React.ComponentProps<typeof Popover.Content> & { withArrow?: boolean }\n >;\n Title: (props: StepProps) => React.ReactNode;\n Content: (props: StepProps) => React.ReactNode;\n Actions: (props: ActionsProps & { to?: string } & FlexProps) => React.ReactNode;\n};\n\nconst ActionsContainer = styled(Flex)`\n border-top: ${({ theme }) => `1px solid ${theme.colors.neutral150}`};\n`;\n\n/**\n * TODO:\n * We should probably move all arrow styles + svg to the DS\n */\nconst PopoverArrow = styled(Popover.Arrow)`\n fill: ${({ theme }) => theme.colors.neutral0};\n transform: translateY(-16px) rotate(-90deg);\n`;\n\nexport const StepCount = ({ tourName }: { tourName: ValidTourName }) => {\n const state = unstableUseGuidedTour('GuidedTourPopover', (s) => s.state);\n const currentStep = state.tours[tourName].currentStep + 1;\n // TODO: Currently all tours do not count their last step, but we should find a way to make this more smart\n const displayedLength = state.tours[tourName].length - 1;\n\n return (\n <Typography variant=\"omega\" fontSize=\"12px\">\n <FormattedMessage\n id=\"tours.stepCount\"\n defaultMessage=\"Step {currentStep} of {tourLength}\"\n values={{ currentStep, tourLength: displayedLength }}\n />\n </Typography>\n );\n};\n\nconst createStepComponents = (tourName: ValidTourName): Step => ({\n Root: React.forwardRef(({ withArrow = true, ...props }, ref) => {\n return (\n <Popover.Content ref={ref} side=\"top\" align=\"center\" style={{ border: 'none' }} {...props}>\n {withArrow && (\n <PopoverArrow asChild>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"23\"\n height=\"25\"\n viewBox=\"0 0 23 25\"\n fill=\"none\"\n >\n <path d=\"M11 24.5L1.82843 15.3284C0.266332 13.7663 0.26633 11.2337 1.82843 9.67157L11 0.5L23 12.5L11 24.5Z\" />\n </svg>\n </PopoverArrow>\n )}\n <Flex width=\"360px\" direction=\"column\" alignItems=\"start\">\n {props.children}\n </Flex>\n </Popover.Content>\n );\n }),\n\n Title: (props) => {\n return (\n <Box paddingTop={5} paddingLeft={5} paddingRight={5} paddingBottom={1} width=\"100%\">\n {'children' in props ? (\n props.children\n ) : (\n <Typography tag=\"div\" variant=\"omega\" fontWeight=\"bold\">\n <FormattedMessage tagName=\"h1\" id={props.id} defaultMessage={props.defaultMessage} />\n </Typography>\n )}\n </Box>\n );\n },\n\n Content: (props) => (\n <Box paddingBottom={5} paddingLeft={5} paddingRight={5} width=\"100%\">\n {'children' in props ? (\n props.children\n ) : (\n <Typography tag=\"div\" variant=\"omega\">\n <FormattedMessage tagName=\"p\" id={props.id} defaultMessage={props.defaultMessage} />\n </Typography>\n )}\n </Box>\n ),\n\n Actions: ({ showStepCount = true, showSkip = false, to, children, ...flexProps }) => {\n const dispatch = unstableUseGuidedTour('GuidedTourPopover', (s) => s.dispatch);\n\n return (\n <ActionsContainer\n width=\"100%\"\n padding={3}\n paddingLeft={5}\n justifyContent={showStepCount ? 'space-between' : 'flex-end'}\n {...flexProps}\n >\n {children ? (\n children\n ) : (\n <>\n {showStepCount && <StepCount tourName={tourName} />}\n <Flex gap={2}>\n {showSkip && (\n <Button\n variant=\"tertiary\"\n onClick={() => dispatch({ type: 'skip_tour', payload: tourName })}\n >\n <FormattedMessage id=\"tours.skip\" defaultMessage=\"Skip\" />\n </Button>\n )}\n {to ? (\n <LinkButton\n tag={NavLink}\n to={to}\n onClick={() => dispatch({ type: 'next_step', payload: tourName })}\n >\n <FormattedMessage id=\"tours.next\" defaultMessage=\"Next\" />\n </LinkButton>\n ) : (\n <Button onClick={() => dispatch({ type: 'next_step', payload: tourName })}>\n <FormattedMessage id=\"tours.next\" defaultMessage=\"Next\" />\n </Button>\n )}\n </Flex>\n </>\n )}\n </ActionsContainer>\n );\n },\n});\n\nexport type { Step };\nexport { createStepComponents };\n"],"names":["ActionsContainer","styled","Flex","theme","colors","neutral150","PopoverArrow","Popover","Arrow","neutral0","StepCount","tourName","state","unstableUseGuidedTour","s","currentStep","tours","displayedLength","length","_jsx","Typography","variant","fontSize","FormattedMessage","id","defaultMessage","values","tourLength","createStepComponents","Root","React","forwardRef","withArrow","props","ref","_jsxs","Content","side","align","style","border","asChild","svg","xmlns","width","height","viewBox","fill","path","d","direction","alignItems","children","Title","Box","paddingTop","paddingLeft","paddingRight","paddingBottom","tag","fontWeight","tagName","Actions","showStepCount","showSkip","to","flexProps","dispatch","padding","justifyContent","_Fragment","gap","Button","onClick","type","payload","LinkButton","NavLink"],"mappings":";;;;;;;;AA0DA,MAAMA,gBAAAA,GAAmBC,MAAOC,CAAAA,IAAAA,CAAK;AACvB,cAAA,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAK,CAAC,UAAU,EAAEA,KAAAA,CAAMC,MAAM,CAACC,UAAU,CAAC,CAAC,CAAC;AACtE,CAAC;AAED;;;AAGC,IACD,MAAMC,YAAeL,GAAAA,MAAAA,CAAOM,OAAQC,CAAAA,KAAK,CAAC;QAClC,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACK,QAAQ,CAAC;;AAE/C,CAAC;AAEYC,MAAAA,SAAAA,GAAY,CAAC,EAAEC,QAAQ,EAA+B,GAAA;AACjE,IAAA,MAAMC,QAAQC,qBAAsB,CAAA,mBAAA,EAAqB,CAACC,CAAAA,GAAMA,EAAEF,KAAK,CAAA;AACvE,IAAA,MAAMG,cAAcH,KAAMI,CAAAA,KAAK,CAACL,QAAS,CAAA,CAACI,WAAW,GAAG,CAAA;;AAExD,IAAA,MAAME,kBAAkBL,KAAMI,CAAAA,KAAK,CAACL,QAAS,CAAA,CAACO,MAAM,GAAG,CAAA;AAEvD,IAAA,qBACEC,GAACC,CAAAA,UAAAA,EAAAA;QAAWC,OAAQ,EAAA,OAAA;QAAQC,QAAS,EAAA,MAAA;AACnC,QAAA,QAAA,gBAAAH,GAACI,CAAAA,gBAAAA,EAAAA;YACCC,EAAG,EAAA,iBAAA;YACHC,cAAe,EAAA,oCAAA;YACfC,MAAQ,EAAA;AAAEX,gBAAAA,WAAAA;gBAAaY,UAAYV,EAAAA;AAAgB;;;AAI3D;AAEMW,MAAAA,oBAAAA,GAAuB,CAACjB,QAAAA,IAAmC;QAC/DkB,IAAMC,gBAAAA,KAAAA,CAAMC,UAAU,CAAC,CAAC,EAAEC,YAAY,IAAI,EAAE,GAAGC,KAAAA,E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AAAA,aAAAA,kBAAiB5C,GAACT,CAAAA,SAAAA,EAAAA;4BAAUC,QAAUA,EAAAA;;sCACvCwB,IAACjC,CAAAA,IAAAA,EAAAA;4BAAKqE,GAAK,EAAA,CAAA;;AACRP,gCAAAA,QAAAA,kBACC7C,GAACqD,CAAAA,MAAAA,EAAAA;oCACCnD,OAAQ,EAAA,UAAA;AACRoD,oCAAAA,OAAAA,EAAS,IAAMN,QAAS,CAAA;4CAAEO,IAAM,EAAA,WAAA;4CAAaC,OAAShE,EAAAA;AAAS,yCAAA,CAAA;AAE/D,oCAAA,QAAA,gBAAAQ,GAACI,CAAAA,gBAAAA,EAAAA;wCAAiBC,EAAG,EAAA,YAAA;wCAAaC,cAAe,EAAA;;;AAGpDwC,gCAAAA,EAAAA,iBACC9C,GAACyD,CAAAA,UAAAA,EAAAA;oCACCjB,GAAKkB,EAAAA,OAAAA;oCACLZ,EAAIA,EAAAA,EAAAA;AACJQ,oCAAAA,OAAAA,EAAS,IAAMN,QAAS,CAAA;4CAAEO,IAAM,EAAA,WAAA;4CAAaC,OAAShE,EAAAA;AAAS,yCAAA,CAAA;AAE/D,oCAAA,QAAA,gBAAAQ,GAACI,CAAAA,gBAAAA,EAAAA;wCAAiBC,EAAG,EAAA,YAAA;wCAAaC,cAAe,EAAA;;mDAGnDN,GAACqD,CAAAA,MAAAA,EAAAA;AAAOC,oCAAAA,OAAAA,EAAS,IAAMN,QAAS,CAAA;4CAAEO,IAAM,EAAA,WAAA;4CAAaC,OAAShE,EAAAA;AAAS,yCAAA,CAAA;AACrE,oCAAA,QAAA,gBAAAQ,GAACI,CAAAA,gBAAAA,EAAAA;wCAAiBC,EAAG,EAAA,YAAA;wCAAaC,cAAe,EAAA;;;;;;;;AAQjE;KACF;;;;"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var designSystem = require('@strapi/design-system');
|
|
6
|
+
var reactIntl = require('react-intl');
|
|
6
7
|
var styled = require('styled-components');
|
|
7
8
|
var admin = require('../../services/admin.js');
|
|
8
9
|
var Context = require('./Context.js');
|
|
@@ -29,12 +30,128 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
29
30
|
|
|
30
31
|
/* -------------------------------------------------------------------------------------------------
|
|
31
32
|
* Tours
|
|
32
|
-
* -----------------------------------------------------------------------------------------------*/ const
|
|
33
|
-
|
|
33
|
+
* -----------------------------------------------------------------------------------------------*/ const GotItAction = ({ onClick })=>{
|
|
34
|
+
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
|
|
35
|
+
onClick: onClick,
|
|
36
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(reactIntl.FormattedMessage, {
|
|
37
|
+
id: "tours.gotIt",
|
|
38
|
+
defaultMessage: "Got it"
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
const tours = {
|
|
43
|
+
contentTypeBuilder: createTour('contentTypeBuilder', [
|
|
34
44
|
{
|
|
35
45
|
name: 'Introduction',
|
|
36
46
|
content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
37
|
-
|
|
47
|
+
side: "bottom",
|
|
48
|
+
withArrow: false,
|
|
49
|
+
children: [
|
|
50
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
51
|
+
id: "tours.contentTypeBuilder.Introduction.title",
|
|
52
|
+
defaultMessage: "Content-Type Builder"
|
|
53
|
+
}),
|
|
54
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Content, {
|
|
55
|
+
id: "tours.contentTypeBuilder.Introduction.content",
|
|
56
|
+
defaultMessage: "Create and manage your content structure with collection types, single types and components."
|
|
57
|
+
}),
|
|
58
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Actions, {
|
|
59
|
+
showSkip: true
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
})
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'CollectionTypes',
|
|
66
|
+
content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
67
|
+
side: "right",
|
|
68
|
+
sideOffset: 16,
|
|
69
|
+
children: [
|
|
70
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
71
|
+
id: "tours.contentTypeBuilder.CollectionTypes.title",
|
|
72
|
+
defaultMessage: "Collection Types"
|
|
73
|
+
}),
|
|
74
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Content, {
|
|
75
|
+
id: "tours.contentTypeBuilder.CollectionTypes.content",
|
|
76
|
+
defaultMessage: "A content structure that can manage multiple entries, such as articles or products."
|
|
77
|
+
}),
|
|
78
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Actions, {})
|
|
79
|
+
]
|
|
80
|
+
})
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'SingleTypes',
|
|
84
|
+
content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
85
|
+
side: "right",
|
|
86
|
+
sideOffset: 16,
|
|
87
|
+
children: [
|
|
88
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
89
|
+
id: "tours.contentTypeBuilder.SingleTypes.title",
|
|
90
|
+
defaultMessage: "Single Types"
|
|
91
|
+
}),
|
|
92
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Content, {
|
|
93
|
+
id: "tours.contentTypeBuilder.SingleTypes.content",
|
|
94
|
+
defaultMessage: "A content structure that can manage a single entry, such as a homepage or a header."
|
|
95
|
+
}),
|
|
96
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Actions, {})
|
|
97
|
+
]
|
|
98
|
+
})
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'Components',
|
|
102
|
+
content: (Step, { dispatch })=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
103
|
+
side: "right",
|
|
104
|
+
sideOffset: 16,
|
|
105
|
+
children: [
|
|
106
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
107
|
+
id: "tours.contentTypeBuilder.Components.title",
|
|
108
|
+
defaultMessage: "Components"
|
|
109
|
+
}),
|
|
110
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Content, {
|
|
111
|
+
id: "tours.contentTypeBuilder.Components.content",
|
|
112
|
+
defaultMessage: "A reusable content structure that can be used across multiple content types, such as buttons, sliders or cards."
|
|
113
|
+
}),
|
|
114
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Actions, {
|
|
115
|
+
justifyContent: "flex-end",
|
|
116
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(GotItAction, {
|
|
117
|
+
onClick: ()=>dispatch({
|
|
118
|
+
type: 'next_step',
|
|
119
|
+
payload: 'contentTypeBuilder'
|
|
120
|
+
})
|
|
121
|
+
})
|
|
122
|
+
})
|
|
123
|
+
]
|
|
124
|
+
})
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: 'Finish',
|
|
128
|
+
content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
129
|
+
side: "right",
|
|
130
|
+
children: [
|
|
131
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
132
|
+
id: "tours.contentTypeBuilder.Finish.title",
|
|
133
|
+
defaultMessage: "It’s time to create content!"
|
|
134
|
+
}),
|
|
135
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Content, {
|
|
136
|
+
id: "tours.contentTypeBuilder.Finish.content",
|
|
137
|
+
defaultMessage: "Now that you created content types, you’ll be able to create content in the content manager."
|
|
138
|
+
}),
|
|
139
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Actions, {
|
|
140
|
+
showStepCount: false,
|
|
141
|
+
to: "/content-manager"
|
|
142
|
+
})
|
|
143
|
+
]
|
|
144
|
+
}),
|
|
145
|
+
when: (completedActions)=>completedActions.includes('didCreateContentTypeSchema')
|
|
146
|
+
}
|
|
147
|
+
]),
|
|
148
|
+
contentManager: createTour('contentManager', [
|
|
149
|
+
{
|
|
150
|
+
name: 'Introduction',
|
|
151
|
+
when: (completedActions)=>completedActions.includes('didCreateContentTypeSchema') && !completedActions.includes('didCreateContent'),
|
|
152
|
+
content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
153
|
+
side: "top",
|
|
154
|
+
withArrow: false,
|
|
38
155
|
children: [
|
|
39
156
|
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
40
157
|
id: "tours.contentManager.Introduction.title",
|
|
@@ -51,47 +168,202 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
51
168
|
})
|
|
52
169
|
},
|
|
53
170
|
{
|
|
54
|
-
name: '
|
|
55
|
-
requiredActions: [
|
|
56
|
-
'didCreateApiToken'
|
|
57
|
-
],
|
|
171
|
+
name: 'Fields',
|
|
58
172
|
content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
59
|
-
|
|
173
|
+
sideOffset: -12,
|
|
60
174
|
children: [
|
|
61
175
|
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
62
|
-
id: "tours.contentManager.
|
|
63
|
-
defaultMessage: "
|
|
176
|
+
id: "tours.contentManager.Fields.title",
|
|
177
|
+
defaultMessage: "Fields"
|
|
64
178
|
}),
|
|
65
179
|
/*#__PURE__*/ jsxRuntime.jsx(Step.Content, {
|
|
66
|
-
id: "tours.contentManager.
|
|
67
|
-
defaultMessage: "
|
|
180
|
+
id: "tours.contentManager.Fields.content",
|
|
181
|
+
defaultMessage: "Add content to the fields created in the Content-Type Builder."
|
|
68
182
|
}),
|
|
69
183
|
/*#__PURE__*/ jsxRuntime.jsx(Step.Actions, {})
|
|
70
184
|
]
|
|
71
185
|
})
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: 'Publish',
|
|
189
|
+
content: (Step, { dispatch })=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
190
|
+
side: "left",
|
|
191
|
+
align: "center",
|
|
192
|
+
children: [
|
|
193
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
194
|
+
id: "tours.contentManager.Publish.title",
|
|
195
|
+
defaultMessage: "Publish"
|
|
196
|
+
}),
|
|
197
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Content, {
|
|
198
|
+
id: "tours.contentManager.Publish.content",
|
|
199
|
+
defaultMessage: "Publish entries to make their content available through the Document Service API."
|
|
200
|
+
}),
|
|
201
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Actions, {
|
|
202
|
+
justifyContent: "flex-end",
|
|
203
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(GotItAction, {
|
|
204
|
+
onClick: ()=>dispatch({
|
|
205
|
+
type: 'next_step',
|
|
206
|
+
payload: 'contentManager'
|
|
207
|
+
})
|
|
208
|
+
})
|
|
209
|
+
})
|
|
210
|
+
]
|
|
211
|
+
})
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
name: 'Finish',
|
|
215
|
+
content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
216
|
+
side: "right",
|
|
217
|
+
children: [
|
|
218
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
219
|
+
id: "tours.contentManager.FinalStep.title",
|
|
220
|
+
defaultMessage: "It’s time to create API Tokens!"
|
|
221
|
+
}),
|
|
222
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Content, {
|
|
223
|
+
id: "tours.contentManager.FinalStep.content",
|
|
224
|
+
defaultMessage: "Now that you’ve created and published content, time to create API tokens and set up permissions."
|
|
225
|
+
}),
|
|
226
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Actions, {
|
|
227
|
+
showStepCount: false,
|
|
228
|
+
to: "/settings/api-tokens"
|
|
229
|
+
})
|
|
230
|
+
]
|
|
231
|
+
}),
|
|
232
|
+
when: (completedActions)=>completedActions.includes('didCreateContent')
|
|
72
233
|
}
|
|
73
|
-
])
|
|
234
|
+
]),
|
|
235
|
+
apiTokens: createTour('apiTokens', [
|
|
236
|
+
{
|
|
237
|
+
name: 'Introduction',
|
|
238
|
+
when: (completedActions)=>!completedActions.includes('didCreateApiToken'),
|
|
239
|
+
content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
240
|
+
sideOffset: -36,
|
|
241
|
+
withArrow: false,
|
|
242
|
+
children: [
|
|
243
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
244
|
+
id: "tours.apiTokens.Introduction.title",
|
|
245
|
+
defaultMessage: "API tokens"
|
|
246
|
+
}),
|
|
247
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Content, {
|
|
248
|
+
id: "tours.apiTokens.Introduction.content",
|
|
249
|
+
defaultMessage: "Create and manage API tokens with highly customizable permissions."
|
|
250
|
+
}),
|
|
251
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Actions, {
|
|
252
|
+
showSkip: true
|
|
253
|
+
})
|
|
254
|
+
]
|
|
255
|
+
})
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
name: 'CreateAnAPIToken',
|
|
259
|
+
content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
260
|
+
side: "bottom",
|
|
261
|
+
align: "end",
|
|
262
|
+
sideOffset: -10,
|
|
263
|
+
children: [
|
|
264
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
265
|
+
id: "tours.apiTokens.CreateAnAPIToken.title",
|
|
266
|
+
defaultMessage: "Create an API token"
|
|
267
|
+
}),
|
|
268
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Content, {
|
|
269
|
+
id: "tours.apiTokens.CreateAnAPIToken.content",
|
|
270
|
+
defaultMessage: "Create a new API token. Choose a name, duration and type."
|
|
271
|
+
}),
|
|
272
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Actions, {})
|
|
273
|
+
]
|
|
274
|
+
})
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
name: 'CopyAPIToken',
|
|
278
|
+
content: (Step$1, { dispatch })=>/*#__PURE__*/ jsxRuntime.jsxs(Step$1.Root, {
|
|
279
|
+
side: "bottom",
|
|
280
|
+
align: "start",
|
|
281
|
+
sideOffset: -5,
|
|
282
|
+
children: [
|
|
283
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step$1.Title, {
|
|
284
|
+
id: "tours.apiTokens.CopyAPIToken.title",
|
|
285
|
+
defaultMessage: "Copy your new API token"
|
|
286
|
+
}),
|
|
287
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step$1.Content, {
|
|
288
|
+
id: "tours.apiTokens.CopyAPIToken.content",
|
|
289
|
+
defaultMessage: "Make sure to do it now, you won’t be able to see it again. You’ll need to generate a new one if you lose it."
|
|
290
|
+
}),
|
|
291
|
+
/*#__PURE__*/ jsxRuntime.jsxs(Step$1.Actions, {
|
|
292
|
+
children: [
|
|
293
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.StepCount, {
|
|
294
|
+
tourName: "apiTokens"
|
|
295
|
+
}),
|
|
296
|
+
/*#__PURE__*/ jsxRuntime.jsx(GotItAction, {
|
|
297
|
+
onClick: ()=>dispatch({
|
|
298
|
+
type: 'next_step',
|
|
299
|
+
payload: 'apiTokens'
|
|
300
|
+
})
|
|
301
|
+
})
|
|
302
|
+
]
|
|
303
|
+
})
|
|
304
|
+
]
|
|
305
|
+
}),
|
|
306
|
+
when: (completedActions)=>completedActions.includes('didCreateApiToken')
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
name: 'Finish',
|
|
310
|
+
content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
311
|
+
side: "right",
|
|
312
|
+
align: "start",
|
|
313
|
+
children: [
|
|
314
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
315
|
+
id: "tours.apiTokens.FinalStep.title",
|
|
316
|
+
defaultMessage: "It’s time to deploy your application!"
|
|
317
|
+
}),
|
|
318
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Content, {
|
|
319
|
+
id: "tours.apiTokens.FinalStep.content",
|
|
320
|
+
defaultMessage: "Your application is ready to be deployed and its content to be shared with the world!"
|
|
321
|
+
}),
|
|
322
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Actions, {
|
|
323
|
+
showStepCount: false,
|
|
324
|
+
to: "/"
|
|
325
|
+
})
|
|
326
|
+
]
|
|
327
|
+
}),
|
|
328
|
+
when: (completedActions)=>completedActions.includes('didCopyApiToken')
|
|
329
|
+
}
|
|
330
|
+
]),
|
|
331
|
+
strapiCloud: createTour('strapiCloud', [])
|
|
332
|
+
};
|
|
333
|
+
const UnstableGuidedTourTooltip = ({ children, ...props })=>{
|
|
334
|
+
const state = Context.unstableUseGuidedTour('TooltipWrapper', (s)=>s.state);
|
|
335
|
+
const hasFutureFlag = window.strapi.future.isEnabled('unstableGuidedTour');
|
|
336
|
+
if (!state.enabled) {
|
|
337
|
+
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
338
|
+
children: children
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
if (!hasFutureFlag) {
|
|
342
|
+
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
343
|
+
children: children
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
return /*#__PURE__*/ jsxRuntime.jsx(GuidedTourTooltipImpl, {
|
|
347
|
+
...props,
|
|
348
|
+
children: children
|
|
349
|
+
});
|
|
74
350
|
};
|
|
75
351
|
const GuidedTourOverlay = styled.styled(designSystem.Box)`
|
|
76
352
|
position: fixed;
|
|
77
|
-
|
|
353
|
+
top: 0;
|
|
354
|
+
left: 0;
|
|
355
|
+
right: 0;
|
|
356
|
+
bottom: 0;
|
|
78
357
|
background-color: rgba(50, 50, 77, 0.2);
|
|
79
358
|
z-index: 10;
|
|
80
359
|
`;
|
|
81
|
-
const
|
|
360
|
+
const GuidedTourTooltipImpl = ({ children, content, tourName, step, when })=>{
|
|
82
361
|
const { data: guidedTourMeta } = admin.useGetGuidedTourMetaQuery();
|
|
83
362
|
const state = Context.unstableUseGuidedTour('UnstableGuidedTourTooltip', (s)=>s.state);
|
|
84
363
|
const dispatch = Context.unstableUseGuidedTour('UnstableGuidedTourTooltip', (s)=>s.dispatch);
|
|
85
|
-
const Step$1 = React__namespace.useMemo(()=>Step.createStepComponents(tourName), [
|
|
86
|
-
tourName
|
|
87
|
-
]);
|
|
88
364
|
const isCurrentStep = state.tours[tourName].currentStep === step;
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
}) ?? true;
|
|
92
|
-
const hasFutureFlag = window.strapi.future.isEnabled('unstableGuidedTour');
|
|
93
|
-
const isEnabled = guidedTourMeta?.data?.isFirstSuperAdminUser && !state.tours[tourName].isCompleted && hasFutureFlag;
|
|
94
|
-
const isPopoverOpen = isEnabled && isCurrentStep && hasCompletedRequiredActions;
|
|
365
|
+
const isStepConditionMet = when ? when(state.completedActions) : true;
|
|
366
|
+
const isPopoverOpen = guidedTourMeta?.data?.isFirstSuperAdminUser && !state.tours[tourName].isCompleted && isCurrentStep && isStepConditionMet;
|
|
95
367
|
// Lock the scroll
|
|
96
368
|
React__namespace.useEffect(()=>{
|
|
97
369
|
if (!isPopoverOpen) return;
|
|
@@ -103,9 +375,24 @@ const UnstableGuidedTourTooltip = ({ children, content, tourName, step, required
|
|
|
103
375
|
}, [
|
|
104
376
|
isPopoverOpen
|
|
105
377
|
]);
|
|
378
|
+
// TODO: This isn't great but the only solution for syncing the completed actions
|
|
379
|
+
React__namespace.useEffect(()=>{
|
|
380
|
+
dispatch({
|
|
381
|
+
type: 'set_completed_actions',
|
|
382
|
+
payload: guidedTourMeta?.data?.completedActions ?? []
|
|
383
|
+
});
|
|
384
|
+
}, [
|
|
385
|
+
dispatch,
|
|
386
|
+
guidedTourMeta?.data?.completedActions
|
|
387
|
+
]);
|
|
388
|
+
const Step$1 = React__namespace.useMemo(()=>Step.createStepComponents(tourName), [
|
|
389
|
+
tourName
|
|
390
|
+
]);
|
|
106
391
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
107
392
|
children: [
|
|
108
|
-
isPopoverOpen && /*#__PURE__*/ jsxRuntime.jsx(
|
|
393
|
+
isPopoverOpen && /*#__PURE__*/ jsxRuntime.jsx(designSystem.Portal, {
|
|
394
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(GuidedTourOverlay, {})
|
|
395
|
+
}),
|
|
109
396
|
/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Popover.Root, {
|
|
110
397
|
open: isPopoverOpen,
|
|
111
398
|
children: [
|
|
@@ -126,18 +413,19 @@ function createTour(tourName, steps) {
|
|
|
126
413
|
if (step.name in acc) {
|
|
127
414
|
throw Error(`The tour: ${tourName} with step: ${step.name} has already been registered`);
|
|
128
415
|
}
|
|
129
|
-
acc[step.name] = ({ children })
|
|
416
|
+
acc[step.name] = ({ children })=>{
|
|
417
|
+
return /*#__PURE__*/ jsxRuntime.jsx(UnstableGuidedTourTooltip, {
|
|
130
418
|
tourName: tourName,
|
|
131
419
|
step: index,
|
|
132
420
|
content: step.content,
|
|
133
|
-
|
|
421
|
+
when: step.when,
|
|
134
422
|
children: children
|
|
135
423
|
});
|
|
424
|
+
};
|
|
136
425
|
return acc;
|
|
137
426
|
}, {});
|
|
138
427
|
return tour;
|
|
139
428
|
}
|
|
140
429
|
|
|
141
|
-
exports.GuidedTourOverlay = GuidedTourOverlay;
|
|
142
430
|
exports.tours = tours;
|
|
143
431
|
//# sourceMappingURL=Tours.js.map
|