slice-machine-ui 1.23.2-beta.8 → 1.24.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 (132) hide show
  1. package/.depcheckrc +3 -0
  2. package/components/ChangesEmptyState/OfflinePage.tsx +1 -1
  3. package/components/ChangesItems/ChangesItems.tsx +6 -2
  4. package/components/CustomTypeTable/changesPage.tsx +12 -7
  5. package/components/DeleteSliceModal/index.tsx +3 -0
  6. package/components/DeleteVariationModal/index.tsx +1 -0
  7. package/components/Forms/CreateCustomTypeModal/CreateCustomTypeModal.tsx +4 -0
  8. package/components/Forms/CreateSliceModal/CreateSliceModal.tsx +3 -1
  9. package/components/Forms/RenameCustomTypeModal/RenameCustomTypeModal.tsx +6 -1
  10. package/components/Forms/RenameSliceModal/RenameSliceModal.tsx +3 -0
  11. package/components/Forms/RenameVariationModal/RenameVariationModal.tsx +0 -1
  12. package/components/LoginModal/index.tsx +40 -2
  13. package/components/ModalFormCard/index.tsx +0 -1
  14. package/components/Navigation/ChangesItem.tsx +117 -0
  15. package/components/Navigation/Environment.tsx +51 -4
  16. package/components/Navigation/index.css.ts +1 -2
  17. package/components/Navigation/index.test.tsx +5 -85
  18. package/components/Navigation/index.tsx +32 -20
  19. package/components/ReviewModal/ReviewForm.tsx +0 -1
  20. package/lib/builders/SliceBuilder/index.tsx +3 -3
  21. package/lib/builders/common/EditModal/Form.jsx +0 -1
  22. package/lib/builders/common/Zone/Card/components/NewField.tsx +0 -1
  23. package/lib/models/common/ModelStatus/index.ts +25 -0
  24. package/out/404.html +1 -1
  25. package/out/_next/static/chunks/18539003-5f78714a35fde4a1.js +97 -0
  26. package/out/_next/static/chunks/25-3aa4d4b24167d340.js +1 -0
  27. package/out/_next/static/chunks/318-19dbcae10cdb6408.js +1 -0
  28. package/out/_next/static/chunks/727-de03055e40815a3a.js +1 -0
  29. package/out/_next/static/chunks/777-8c5507e3b119b5dc.js +8 -0
  30. package/out/_next/static/chunks/799-0af1215eb2b3c17e.js +1 -0
  31. package/out/_next/static/chunks/904-40686b0426716111.js +1 -0
  32. package/out/_next/static/chunks/pages/_app-bca191df4ac7078e.js +434 -0
  33. package/out/_next/static/chunks/pages/{changelog-afd18276fe018b24.js → changelog-cb1df3a70b20f1b8.js} +1 -1
  34. package/out/_next/static/chunks/pages/changes-ccfd715c2bdc4f83.js +1 -0
  35. package/out/_next/static/chunks/pages/{labs-ee206005948f8e87.js → labs-2adfb5127f9c4081.js} +1 -1
  36. package/out/_next/static/chunks/pages/settings-94bcd7422e8b237d.js +1 -0
  37. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/{simulator-52c3e1f9d14160b8.js → simulator-aaf65fbec8f5839c.js} +1 -1
  38. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-90bb2ea76d2abf42.js +1 -0
  39. package/out/_next/static/chunks/pages/slices-e0ce615c38e8338d.js +1 -0
  40. package/out/_next/static/css/39e089aad1742a3a.css +1 -0
  41. package/out/_next/static/css/{37153180c3b0dd66.css → 838fd8bb5a7c32b0.css} +1 -1
  42. package/out/_next/static/css/ca32882a5d2d8d88.css +1 -0
  43. package/out/_next/static/eNujlD43QIdmra7ggcNtK/_buildManifest.js +1 -0
  44. package/out/changelog.html +1 -1
  45. package/out/changes.html +1 -1
  46. package/out/custom-types/[customTypeId].html +1 -1
  47. package/out/custom-types.html +1 -1
  48. package/out/index.html +1 -1
  49. package/out/labs.html +1 -1
  50. package/out/page-types/[pageTypeId].html +1 -1
  51. package/out/settings.html +1 -0
  52. package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  53. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  54. package/out/slices.html +1 -1
  55. package/package.json +10 -8
  56. package/pages/_app.tsx +34 -32
  57. package/pages/changes.tsx +27 -41
  58. package/pages/settings.tsx +1 -0
  59. package/postcss.config.js +10 -0
  60. package/src/components/FieldSet/FieldSet.stories.tsx +20 -11
  61. package/src/components/RelativeTime/RelativeTime.stories.tsx +25 -0
  62. package/src/components/RelativeTime/RelativeTime.tsx +40 -0
  63. package/src/components/RelativeTime/index.ts +1 -0
  64. package/src/components/SideNav/SideNav.css.ts +1 -1
  65. package/src/components/SideNav/SideNav.tsx +9 -5
  66. package/src/components/SideNav/SideNavEnvironmentSelector.tsx +31 -11
  67. package/src/domain/__tests__/customType.test.ts +26 -19
  68. package/src/domain/customType.ts +22 -5
  69. package/src/features/autoSave/AutoSaveStatusIndicator.tsx +4 -4
  70. package/src/features/customTypes/customTypesBuilder/CustomTypeProvider.tsx +11 -10
  71. package/src/features/customTypes/customTypesBuilder/CustomTypesBuilderPage.tsx +3 -3
  72. package/src/features/environments/actions/setEnvironment.ts +4 -4
  73. package/src/features/settings/SettingsPage.tsx +47 -0
  74. package/src/features/settings/git/ConnectGitRepository.tsx +126 -0
  75. package/src/features/settings/git/ConnectGitRepositoryBlankSlate.tsx +33 -0
  76. package/src/features/settings/git/GitOwnerSelect.tsx +71 -0
  77. package/src/features/settings/git/GitProvider.ts +40 -0
  78. package/src/features/settings/git/GitProviderConnectButtons.tsx +63 -0
  79. package/src/features/settings/git/GitRepositoriesList.tsx +76 -0
  80. package/src/features/settings/git/GitRepositoriesSearch.tsx +69 -0
  81. package/src/features/settings/git/GitRepositoryConnectDialog.tsx +85 -0
  82. package/src/features/settings/git/GitRepositoryDisconnectDialog.tsx +60 -0
  83. package/src/features/settings/git/useGitIntegrationExperiment.ts +8 -0
  84. package/src/features/settings/git/useGitOwners.ts +12 -0
  85. package/src/features/settings/git/useGitRepos.ts +24 -0
  86. package/src/features/settings/git/useLinkedGitRepos.ts +41 -0
  87. package/src/features/settings/git/useWriteAPIToken.ts +23 -0
  88. package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewSliceDialog.tsx +0 -1
  89. package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewVariationDialog.tsx +0 -1
  90. package/src/features/slices/convertLegacySlice/ConvertLegacySliceMergeWithIdenticalDialog.tsx +0 -1
  91. package/src/features/slices/sliceBuilder/SliceBuilderProvider.tsx +12 -10
  92. package/src/features/sync/AutoSyncProvider.tsx +252 -0
  93. package/src/features/sync/components/AutoSyncStatusIndicator.module.css +17 -0
  94. package/src/features/sync/components/AutoSyncStatusIndicator.module.css.d.ts +5 -0
  95. package/src/features/sync/components/AutoSyncStatusIndicator.tsx +58 -0
  96. package/src/features/sync/fetchUnSyncChanges.ts +40 -0
  97. package/src/features/sync/getUnSyncChanges.ts +144 -0
  98. package/src/features/sync/useUnSyncChanges.ts +32 -0
  99. package/src/hooks/useActionQueue.tsx +177 -0
  100. package/src/hooks/useAuthStatus.ts +12 -0
  101. package/src/hooks/useUser.ts +14 -0
  102. package/src/icons/SettingsIcon.tsx +19 -0
  103. package/src/icons/SyncFailed.tsx +30 -0
  104. package/src/icons/Synced.tsx +19 -0
  105. package/src/icons/Syncing.tsx +23 -0
  106. package/test/__testutils__/index.tsx +8 -5
  107. package/test/src/modules/__fixtures__/serverState.ts +1 -2
  108. package/components/Navigation/ChangesListItem.tsx +0 -74
  109. package/components/Navigation/ChangesRightElement.tsx +0 -33
  110. package/out/_next/static/chunks/18539003-5cc559566b738915.js +0 -97
  111. package/out/_next/static/chunks/25-01f422cea8066349.js +0 -1
  112. package/out/_next/static/chunks/318-387e3f23d717c53d.js +0 -1
  113. package/out/_next/static/chunks/376-7e784d6069e01654.js +0 -8
  114. package/out/_next/static/chunks/727-358d7fae68a880b3.js +0 -1
  115. package/out/_next/static/chunks/799-d95a93e965557aeb.js +0 -1
  116. package/out/_next/static/chunks/904-1ff7519adece2b55.js +0 -1
  117. package/out/_next/static/chunks/pages/_app-e31adcf75e9176d3.js +0 -432
  118. package/out/_next/static/chunks/pages/changes-92c84f6cac0285fd.js +0 -1
  119. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-608d206d10a719e3.js +0 -1
  120. package/out/_next/static/chunks/pages/slices-b0b58192a87df822.js +0 -1
  121. package/out/_next/static/css/200244e3e0463c39.css +0 -1
  122. package/out/_next/static/vxOhh_oqUIQ5PTSKUKgMR/_buildManifest.js +0 -1
  123. package/src/features/autoSave/useAutoSave.tsx +0 -177
  124. package/src/features/legacyState/actions/getLegacySliceMachineState.ts +0 -53
  125. package/src/features/legacyState/useLegacySliceMachineState.ts +0 -7
  126. package/src/hooks/useModelStatus.ts +0 -78
  127. package/src/hooks/useUnSyncChanges.ts +0 -88
  128. package/test/components/LoginModal.test.tsx +0 -67
  129. package/test/src/hooks/useModelStatus.test.ts +0 -115
  130. /package/out/_next/static/{vxOhh_oqUIQ5PTSKUKgMR → eNujlD43QIdmra7ggcNtK}/_ssgManifest.js +0 -0
  131. /package/src/features/{changes → sync}/actions/pushChanges.ts +0 -0
  132. /package/src/features/{changes → sync}/actions/trackPushChangesSuccess.ts +0 -0
@@ -8,9 +8,9 @@ import { telemetry } from "@src/apiClient";
8
8
  import VideoItem from "@components/Navigation/VideoItem";
9
9
  import { LightningIcon } from "@src/icons/Lightning";
10
10
  import { MathPlusIcon } from "@src/icons/MathPlusIcon";
11
+ import { SettingsIcon } from "@src/icons/SettingsIcon";
11
12
  import { CUSTOM_TYPES_CONFIG } from "@src/features/customTypes/customTypesConfig";
12
13
  import {
13
- SideNavSeparator,
14
14
  SideNavLink,
15
15
  SideNavListItem,
16
16
  SideNavList,
@@ -26,9 +26,10 @@ import { SliceMachineStoreType } from "@src/redux/type";
26
26
  import useSliceMachineActions from "@src/modules/useSliceMachineActions";
27
27
  import { getChangelog } from "@src/modules/environment";
28
28
  import { CUSTOM_TYPES_MESSAGES } from "@src/features/customTypes/customTypesMessages";
29
+ import { useGitIntegrationExperiment } from "@src/features/settings/git/useGitIntegrationExperiment";
29
30
  import { useRepositoryInformation } from "@src/hooks/useRepositoryInformation";
30
31
 
31
- import { ChangesListItem } from "./ChangesListItem";
32
+ import { ChangesItem } from "./ChangesItem";
32
33
  import { Environment } from "./Environment";
33
34
 
34
35
  import * as styles from "./index.css";
@@ -45,6 +46,7 @@ const Navigation: FC = () => {
45
46
  useSliceMachineActions();
46
47
  const { repositoryName, repositoryDomain, repositoryUrl } =
47
48
  useRepositoryInformation();
49
+ const gitIntegrationExperiment = useGitIntegrationExperiment();
48
50
 
49
51
  return (
50
52
  <SideNav>
@@ -73,6 +75,8 @@ const Navigation: FC = () => {
73
75
  href={repositoryUrl}
74
76
  />
75
77
 
78
+ <ChangesItem />
79
+
76
80
  <SideNavList>
77
81
  <SideNavListItem>
78
82
  <SideNavLink
@@ -104,12 +108,6 @@ const Navigation: FC = () => {
104
108
  />
105
109
  </SideNavListItem>
106
110
 
107
- <SideNavSeparator />
108
-
109
- <ChangesListItem />
110
-
111
- <SideNavSeparator />
112
-
113
111
  <SideNavListItem>
114
112
  <SideNavLink
115
113
  title="Slices"
@@ -141,17 +139,19 @@ const Navigation: FC = () => {
141
139
  )}
142
140
 
143
141
  <SideNavList position="bottom">
144
- <SideNavLink
145
- title="Invite team"
146
- href={`${repositoryUrl}/settings/users`}
147
- Icon={(props) => <MathPlusIcon {...props} />}
148
- onClick={() => {
149
- void telemetry.track({
150
- event: "users-invite-button-clicked",
151
- });
152
- }}
153
- target="_blank"
154
- />
142
+ <SideNavListItem>
143
+ <SideNavLink
144
+ title="Invite team"
145
+ href={`${repositoryUrl}/settings/users`}
146
+ Icon={MathPlusIcon}
147
+ onClick={() => {
148
+ void telemetry.track({
149
+ event: "users-invite-button-clicked",
150
+ });
151
+ }}
152
+ target="_blank"
153
+ />
154
+ </SideNavListItem>
155
155
 
156
156
  <ErrorBoundary>
157
157
  <Suspense>
@@ -162,11 +162,23 @@ const Navigation: FC = () => {
162
162
  </Suspense>
163
163
  </ErrorBoundary>
164
164
 
165
+ {gitIntegrationExperiment.eligible ? (
166
+ <SideNavListItem>
167
+ <SideNavLink
168
+ title="Settings"
169
+ href="/settings"
170
+ Icon={SettingsIcon}
171
+ active={router.asPath.startsWith("/settings")}
172
+ component={Link}
173
+ />
174
+ </SideNavListItem>
175
+ ) : undefined}
176
+
165
177
  <SideNavListItem>
166
178
  <SideNavLink
167
179
  title="Changelog"
168
180
  href="/changelog"
169
- Icon={(props) => <LightningIcon {...props} />}
181
+ Icon={LightningIcon}
170
182
  active={router.asPath.startsWith("/changelog")}
171
183
  component={Link}
172
184
  RightElement={
@@ -94,7 +94,6 @@ export const ReviewForm: FC<ReviewFormProps> = (props) => {
94
94
  >
95
95
  <Formik
96
96
  validateOnMount
97
- validateOnChange
98
97
  initialValues={{
99
98
  rating: 0,
100
99
  comment: "",
@@ -21,7 +21,7 @@ import { useSliceState } from "@src/features/slices/sliceBuilder/SliceBuilderPro
21
21
  import { AutoSaveStatusIndicator } from "@src/features/autoSave/AutoSaveStatusIndicator";
22
22
 
23
23
  export const SliceBuilder: FC = () => {
24
- const { slice, autoSaveStatus } = useSliceState();
24
+ const { slice, actionQueueStatus } = useSliceState();
25
25
 
26
26
  const isSimulatorAvailableForFramework = useSelector(
27
27
  selectIsSimulatorAvailableForFramework,
@@ -33,10 +33,10 @@ export const SliceBuilder: FC = () => {
33
33
  <AppLayoutBackButton url="/slices" />
34
34
  <AppLayoutBreadcrumb folder="Slices" page={slice.model.name} />
35
35
  <AppLayoutActions>
36
- <AutoSaveStatusIndicator status={autoSaveStatus} />
36
+ <AutoSaveStatusIndicator status={actionQueueStatus} />
37
37
  <SimulatorButton
38
38
  isSimulatorAvailableForFramework={isSimulatorAvailableForFramework}
39
- disabled={autoSaveStatus !== "saved"}
39
+ disabled={actionQueueStatus !== "done"}
40
40
  />
41
41
  </AppLayoutActions>
42
42
  </AppLayoutHeader>
@@ -13,7 +13,6 @@ const WidgetForm = ({
13
13
  return (
14
14
  <Box>
15
15
  <Formik
16
- validateOnChange
17
16
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
18
17
  initialValues={initialValues}
19
18
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-assignment
@@ -114,7 +114,6 @@ const NewField: React.FC<NewField> = ({
114
114
 
115
115
  return (
116
116
  <Formik
117
- validateOnChange
118
117
  onSubmit={onSave}
119
118
  validationSchema={validationSchema}
120
119
  initialValues={initialValues}
@@ -117,3 +117,28 @@ export function computeModelStatus(
117
117
  : compareCustomTypeLocalToRemote(model);
118
118
  return { status, model };
119
119
  }
120
+
121
+ export function computeStatuses(
122
+ models: LocalOrRemoteCustomType[],
123
+ userHasAccessToModels: boolean,
124
+ ): { [sliceId: string]: ModelStatus };
125
+ export function computeStatuses(
126
+ models: LocalOrRemoteSlice[],
127
+ userHasAccessToModels: boolean,
128
+ ): { [sliceId: string]: ModelStatus };
129
+ export function computeStatuses(
130
+ models: LocalOrRemoteModel[],
131
+ userHasAccessToModels: boolean,
132
+ ) {
133
+ return models.reduce<{ [id: string]: ModelStatus }>(
134
+ (acc, model) => {
135
+ const { status } = computeModelStatus(model, userHasAccessToModels);
136
+
137
+ return {
138
+ ...acc,
139
+ [hasLocal(model) ? model.local.id : model.remote.id]: status,
140
+ };
141
+ },
142
+ {} as { [sliceId: string]: ModelStatus },
143
+ );
144
+ }
package/out/404.html CHANGED
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/200244e3e0463c39.css" as="style"/><link rel="stylesheet" href="/_next/static/css/200244e3e0463c39.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-e31adcf75e9176d3.js" defer=""></script><script src="/_next/static/chunks/pages/_error-69b4f498bafdd188.js" defer=""></script><script src="/_next/static/vxOhh_oqUIQ5PTSKUKgMR/_buildManifest.js" defer=""></script><script src="/_next/static/vxOhh_oqUIQ5PTSKUKgMR/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"vxOhh_oqUIQ5PTSKUKgMR","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/39e089aad1742a3a.css" as="style"/><link rel="stylesheet" href="/_next/static/css/39e089aad1742a3a.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-bca191df4ac7078e.js" defer=""></script><script src="/_next/static/chunks/pages/_error-69b4f498bafdd188.js" defer=""></script><script src="/_next/static/eNujlD43QIdmra7ggcNtK/_buildManifest.js" defer=""></script><script src="/_next/static/eNujlD43QIdmra7ggcNtK/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"eNujlD43QIdmra7ggcNtK","runtimeConfig":{"sentryEnvironment":"production"},"nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>