serene-core-client 0.1.4 → 0.1.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "serene-core-client",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "main": "./dist/src/index.js",
5
5
  "types": "./dist/src/index.d.ts",
6
6
  "exports": {
@@ -19,12 +19,12 @@ interface Props {
19
19
  session: any
20
20
  }
21
21
 
22
- export default function Profile({
23
- userProfile,
24
- clientUrl,
25
- serverUrl,
26
- session
27
- }: Props) {
22
+ export function Profile({
23
+ userProfile,
24
+ clientUrl,
25
+ serverUrl,
26
+ session
27
+ }: Props) {
28
28
 
29
29
  // Consts
30
30
  const personalDetails = 'personal details'
@@ -82,8 +82,8 @@ export default function Profile({
82
82
  async function setProfile() {
83
83
 
84
84
  const restApiService: RestApiService =
85
- new RestApiService(clientUrl,
86
- serverUrl)
85
+ new RestApiService(clientUrl,
86
+ serverUrl)
87
87
 
88
88
  restApiService.submit({
89
89
  relativeUrl: '/api/account/profile/update',
@@ -103,7 +103,8 @@ export default function Profile({
103
103
  setNotificationSuccessText: setNotificationSuccessText,
104
104
  setNotificationSuccessOpened: setNotificationSuccessOpened,
105
105
  setNotificationErrorText: setNotificationErrorText,
106
- setNotificationErrorOpened: setNotificationErrorOpened })
106
+ setNotificationErrorOpened: setNotificationErrorOpened
107
+ })
107
108
  }
108
109
 
109
110
  // Events
@@ -117,15 +118,15 @@ export default function Profile({
117
118
  // console.log(`fetching getUserPreferencesQuery for userProfileId: ${user.id}`)
118
119
 
119
120
  const results = await
120
- fetchGetUserPreferencesQuery({
121
- userProfileId: userProfile.id,
122
- category: personalDetails,
123
- keys: [
124
- profileService.fullName,
125
- profileService.firstName,
126
- profileService.countryCode,
127
- ]
128
- })
121
+ fetchGetUserPreferencesQuery({
122
+ userProfileId: userProfile.id,
123
+ category: personalDetails,
124
+ keys: [
125
+ profileService.fullName,
126
+ profileService.firstName,
127
+ profileService.countryCode,
128
+ ]
129
+ })
129
130
 
130
131
  // Set profile data
131
132
  const keyValues = results.data['getUserPreferences']
@@ -162,16 +163,16 @@ export default function Profile({
162
163
  return (
163
164
  <>
164
165
  {session ?
165
- <>
166
- <p>You're signed in: &nbsp;
167
- <span style={{ color: 'gray', fontWeight: '600' }}>{session.user.email}</span>
168
- <span style={{ marginLeft: '1em' }}>
169
- (<a
170
- href='#'
171
- onClick={handleSignout}
172
- className='btn-signin'>Sign out</a>)
173
- </span>
174
- </p>
166
+ <>
167
+ <p>You're signed in: &nbsp;
168
+ <span style={{ color: 'gray', fontWeight: '600' }}>{session.user.email}</span>
169
+ <span style={{ marginLeft: '1em' }}>
170
+ (<a
171
+ href='#'
172
+ onClick={handleSignout}
173
+ className='btn-signin'>Sign out</a>)
174
+ </span>
175
+ </p>
175
176
 
176
177
  {/* <p>userProfile: {JSON.stringify(userProfile)}</p> */}
177
178
 
@@ -213,7 +214,7 @@ export default function Profile({
213
214
  }
214
215
  }}
215
216
  required />
216
- <br/><br/>
217
+ <br /><br />
217
218
  <TextField
218
219
  fullWidth
219
220
  variant='outlined'
@@ -221,7 +222,7 @@ export default function Profile({
221
222
  value={firstName}
222
223
  onChange={(e) => setFirstName(e.target.value)}
223
224
  required />
224
- <br/><br/>
225
+ <br /><br />
225
226
  <FormControl fullWidth>
226
227
  <InputLabel
227
228
  htmlFor='select-country'
@@ -245,7 +246,7 @@ export default function Profile({
245
246
  ))}
246
247
  </Select>
247
248
  </FormControl>
248
- <br/><br/>
249
+ <br /><br />
249
250
 
250
251
  <Button
251
252
  type='submit'
@@ -255,25 +256,25 @@ export default function Profile({
255
256
  </Button>
256
257
  </form>
257
258
  <ActionNotification
258
- message='Updated.'
259
- autoHideDuration={5000}
260
- notificationOpened={notificationSuccessOpened}
261
- setNotificationOpened={setNotificationSuccessOpened} />
259
+ message='Updated.'
260
+ autoHideDuration={5000}
261
+ notificationOpened={notificationSuccessOpened}
262
+ setNotificationOpened={setNotificationSuccessOpened} />
262
263
  <ActionNotification
263
- message={notificationErrorText}
264
- autoHideDuration={5000}
265
- notificationOpened={notificationErrorOpened}
266
- setNotificationOpened={setNotificationErrorOpened} />
267
- </>
268
- :
269
- <>
270
- <Typography variant='body1'>
271
- You aren't signed in.
272
- </Typography>
273
-
274
- <a href='#' onClick={handleSignin} className='btn-signin'>Sign in</a>
275
- </>
264
+ message={notificationErrorText}
265
+ autoHideDuration={5000}
266
+ notificationOpened={notificationErrorOpened}
267
+ setNotificationOpened={setNotificationErrorOpened} />
268
+ </>
269
+ :
270
+ <>
271
+ <Typography variant='body1'>
272
+ You aren't signed in.
273
+ </Typography>
274
+
275
+ <a href='#' onClick={handleSignin} className='btn-signin'>Sign in</a>
276
+ </>
276
277
  }
277
- </>
278
+ </>
278
279
  )
279
280
  }
@@ -7,11 +7,11 @@ interface Props {
7
7
  style?: any
8
8
  }
9
9
 
10
- export default function CopyTextIcon({
11
- text,
12
- title = 'Copy',
13
- style = {}
14
- }: Props) {
10
+ export function CopyTextIcon({
11
+ text,
12
+ title = 'Copy',
13
+ style = {}
14
+ }: Props) {
15
15
 
16
16
  const handleCopy = async () => {
17
17
  try {
@@ -9,12 +9,12 @@ export interface Props {
9
9
  onChange?: any
10
10
  }
11
11
 
12
- export default function EditableStringList({
13
- label,
14
- values,
15
- setValues,
16
- onChange
17
- }: Props) {
12
+ export function EditableStringList({
13
+ label,
14
+ values,
15
+ setValues,
16
+ onChange
17
+ }: Props) {
18
18
 
19
19
  const [input, setInput] = useState('')
20
20
  const [editIndex, setEditIndex] = useState<number | null>(null)
@@ -67,7 +67,7 @@ export default function EditableStringList({
67
67
  <IconButton edge='end' onClick={() => handleAddOrUpdate()}>
68
68
  {editIndex !== null ?
69
69
  <Check />
70
- :
70
+ :
71
71
  <Add />
72
72
  }
73
73
  </IconButton>
@@ -11,16 +11,16 @@ interface Props {
11
11
  style?: any
12
12
  }
13
13
 
14
- export default function TextAreaField({
15
- disabled,
16
- id,
17
- label,
18
- minRows = 5,
19
- onChange = {},
20
- required = false,
21
- value,
22
- style = {}
23
- }: Props) {
14
+ export function TextAreaField({
15
+ disabled,
16
+ id,
17
+ label,
18
+ minRows = 5,
19
+ onChange = {},
20
+ required = false,
21
+ value,
22
+ style = {}
23
+ }: Props) {
24
24
 
25
25
  // Render
26
26
  return (
@@ -8,12 +8,12 @@ interface Props {
8
8
  style?: any
9
9
  }
10
10
 
11
- export default function ViewLinkField({
12
- label,
13
- href,
14
- value,
15
- style = {}
16
- }: Props) {
11
+ export function ViewLinkField({
12
+ label,
13
+ href,
14
+ value,
15
+ style = {}
16
+ }: Props) {
17
17
 
18
18
  // Render
19
19
  return (
@@ -7,11 +7,11 @@ interface Props {
7
7
  style?: any
8
8
  }
9
9
 
10
- export default function ViewMarkdownField({
11
- label,
12
- value,
13
- style = {}
14
- }: Props) {
10
+ export function ViewMarkdownField({
11
+ label,
12
+ value,
13
+ style = {}
14
+ }: Props) {
15
15
 
16
16
  // Render
17
17
  return (
@@ -7,11 +7,11 @@ interface Props {
7
7
  style?: any
8
8
  }
9
9
 
10
- export default function ViewTextField({
11
- label,
12
- value,
13
- style = {}
14
- }: Props) {
10
+ export function ViewTextField({
11
+ label,
12
+ value,
13
+ style = {}
14
+ }: Props) {
15
15
 
16
16
  // Render
17
17
  return (
@@ -12,16 +12,16 @@ interface Props {
12
12
  style?: any
13
13
  }
14
14
 
15
- export default function LabeledIconButton({
16
- disabled,
17
- icon,
18
- label,
19
- onClick,
20
- color = grey[700],
21
- textColor = grey[500],
22
- backgroundColor = grey[100],
23
- style = {}
24
- }: Props) {
15
+ export function LabeledIconButton({
16
+ disabled,
17
+ icon,
18
+ label,
19
+ onClick,
20
+ color = grey[700],
21
+ textColor = grey[500],
22
+ backgroundColor = grey[100],
23
+ style = {}
24
+ }: Props) {
25
25
 
26
26
  // Consts
27
27
  const Icon = icon
@@ -7,9 +7,9 @@ interface Props {
7
7
  mailingListName: string
8
8
  }
9
9
 
10
- export default function MailingListSignUp({
11
- mailingListName
12
- }: Props) {
10
+ export function MailingListSignUp({
11
+ mailingListName
12
+ }: Props) {
13
13
 
14
14
  // Types
15
15
  type AlertSeverity = 'error' | 'warning' | 'info' | 'success' | undefined
@@ -118,7 +118,7 @@ export default function MailingListSignUp({
118
118
  severity={alertSeverity}>
119
119
  {message}
120
120
  </Alert>
121
- :
121
+ :
122
122
  <></>
123
123
  }
124
124
  </>
@@ -9,11 +9,11 @@ interface Props {
9
9
  setNotificationOpened: any
10
10
  }
11
11
 
12
- export default function ActionNotification({
13
- message,
14
- autoHideDuration,
15
- notificationOpened,
16
- setNotificationOpened }: Props) {
12
+ export function ActionNotification({
13
+ message,
14
+ autoHideDuration,
15
+ notificationOpened,
16
+ setNotificationOpened }: Props) {
17
17
 
18
18
  const handleNotificationClose =
19
19
  (event: React.SyntheticEvent | Event, reason?: string) => {
@@ -8,11 +8,11 @@ interface Props {
8
8
  setTechs: any
9
9
  }
10
10
 
11
- export default function LoadTechByFilter({
12
- userProfileId,
13
- resource,
14
- setTechs
15
- }: Props) {
11
+ export function LoadTechByFilter({
12
+ userProfileId,
13
+ resource,
14
+ setTechs
15
+ }: Props) {
16
16
 
17
17
  // GraphQL
18
18
  const { refetch: fetchTechsQuery } =
@@ -35,10 +35,10 @@ export default function LoadTechByFilter({
35
35
 
36
36
  // Query
37
37
  const { data } = await
38
- fetchTechsQuery({
39
- userProfileId: userProfileId,
40
- resource: resource
41
- })
38
+ fetchTechsQuery({
39
+ userProfileId: userProfileId,
40
+ resource: resource
41
+ })
42
42
 
43
43
  // Set results
44
44
  const results = data.getTechs
@@ -18,16 +18,16 @@ interface Props {
18
18
  variant?: TextFieldVariants | undefined
19
19
  }
20
20
 
21
- export default function TechAutocomplete({
22
- disabled = false,
23
- label,
24
- onChange = () => {},
25
- setValue,
26
- style = {},
27
- value,
28
- values,
29
- variant = 'standard'
30
- }: Props) {
21
+ export function TechAutocomplete({
22
+ disabled = false,
23
+ label,
24
+ onChange = () => { },
25
+ setValue,
26
+ style = {},
27
+ value,
28
+ values,
29
+ variant = 'standard'
30
+ }: Props) {
31
31
 
32
32
  const selectedTech = values.find((tech) => tech.id === value) || null
33
33
 
@@ -9,11 +9,11 @@ interface Props {
9
9
  setTips: any
10
10
  }
11
11
 
12
- export default function LoadTips({
13
- userProfileId,
14
- tipTags,
15
- setTips
16
- }: Props) {
12
+ export function LoadTips({
13
+ userProfileId,
14
+ tipTags,
15
+ setTips
16
+ }: Props) {
17
17
 
18
18
  // GraphQL
19
19
  const { refetch: fetchGetTipsByUserProfileIdAndTagsQuery } =
@@ -36,11 +36,11 @@ export default function LoadTips({
36
36
  // Get tips data
37
37
  const { data } = await
38
38
  fetchGetTipsByUserProfileIdAndTagsQuery({
39
- variables: {
40
- userProfileId: userProfileId,
41
- tags: tipTags
42
- }
43
- })
39
+ variables: {
40
+ userProfileId: userProfileId,
41
+ tags: tipTags
42
+ }
43
+ })
44
44
 
45
45
  // Set profile data
46
46
  const results = data.getTipsByUserProfileIdAndTags
@@ -13,15 +13,15 @@ interface Props {
13
13
  userProfileId: string
14
14
  }
15
15
 
16
- export default function Tip({
17
- name,
18
- label,
19
- text,
20
- setFocusRef = undefined,
21
- setTipVisible,
22
- style = {},
23
- userProfileId
24
- }: Props) {
16
+ export function Tip({
17
+ name,
18
+ label,
19
+ text,
20
+ setFocusRef = undefined,
21
+ setTipVisible,
22
+ style = {},
23
+ userProfileId
24
+ }: Props) {
25
25
 
26
26
  // GraphQL
27
27
  const [sendUpsertTipGotItMutation] =
@@ -44,11 +44,11 @@ export default function Tip({
44
44
  // Get tips data
45
45
  const { data } = await
46
46
  sendUpsertTipGotItMutation({
47
- variables: {
48
- name: name,
49
- userProfileId: userProfileId
50
- }
51
- })
47
+ variables: {
48
+ name: name,
49
+ userProfileId: userProfileId
50
+ }
51
+ })
52
52
 
53
53
  // Set profile data
54
54
  const results = data.upsertTipGotIt