@kaspernj/api-maker 1.0.220 → 1.0.221

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/.eslintrc.cjs CHANGED
@@ -66,6 +66,7 @@ module.exports = {
66
66
  "implicit-arrow-linebreak": "error",
67
67
  "indent": ["error", 2, {"MemberExpression": "off"}],
68
68
  "init-declarations": "off",
69
+ "jest/max-expects": "error",
69
70
  "jest/max-nested-describe": "error",
70
71
  "jest/no-alias-methods": "error",
71
72
  "jest/no-conditional-in-test": "error",
@@ -76,10 +77,12 @@ module.exports = {
76
77
  "jest/no-restricted-matchers": "error",
77
78
  "jest/no-test-return-statement": "error",
78
79
  "jest/prefer-comparison-matcher": "error",
80
+ "jest/prefer-each": "error",
79
81
  "jest/prefer-equality-matcher": "error",
80
82
  "jest/prefer-expect-resolves": "off", // Needs configuration and no documentation could be found?
81
83
  "jest/prefer-hooks-on-top": "error",
82
84
  "jest/prefer-lowercase-title": "off",
85
+ "jest/prefer-mock-promise-shorthand": "error",
83
86
  "prefer-object-has-own": "error",
84
87
  "jest/prefer-snapshot-hint": "error",
85
88
  "jest/prefer-to-be": "off", // Needs configuration and no documentation could be found?
@@ -249,7 +252,7 @@ module.exports = {
249
252
  "react/jsx-props-no-multi-spaces": "error",
250
253
  "react/jsx-props-no-spreading": "off",
251
254
  "react/jsx-sort-default-props": "error",
252
- "react/jsx-sort-props": "error",
255
+ "react/jsx-sort-props": ["error", {ignoreCase: true}],
253
256
  "react/jsx-tag-spacing": "error",
254
257
  "react/jsx-wrap-multilines": "error",
255
258
  "react/jsx-max-props-per-line": "off",
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  ]
17
17
  },
18
18
  "name": "@kaspernj/api-maker",
19
- "version": "1.0.220",
19
+ "version": "1.0.221",
20
20
  "type": "module",
21
21
  "description": "",
22
22
  "main": "index.js",
package/src/params.mjs CHANGED
@@ -15,7 +15,7 @@ export default class Params {
15
15
  return incorporator.merge()
16
16
  }
17
17
 
18
- static withParams (params, opts = {}) {
18
+ static withParams (params) {
19
19
  const newParams = qs.stringify(params)
20
20
  const newPath = `${location.pathname}?${newParams}`
21
21
 
@@ -1,5 +1,8 @@
1
1
  import {digg, digs} from "diggerize"
2
+ import inflection from "inflection"
2
3
  import Params from "../../params"
4
+ import PropTypes from "prop-types"
5
+ import React from "react"
3
6
  import Table from "../../table/table"
4
7
 
5
8
  export default class ApiMakerSuperAdminIndexPage extends React.PureComponent {
@@ -13,14 +16,12 @@ export default class ApiMakerSuperAdminIndexPage extends React.PureComponent {
13
16
  const {currentUser, modelClass} = digs(this.props, "currentUser", "modelClass")
14
17
 
15
18
  return (
16
- <div>
17
- <Table
18
- columns={digg(this, "columns")}
19
- currentUser={currentUser}
20
- modelClass={modelClass}
21
- viewModelPath={digg(this, "viewModelPath")}
22
- />
23
- </div>
19
+ <Table
20
+ columns={digg(this, "columns")}
21
+ currentUser={currentUser}
22
+ modelClass={modelClass}
23
+ viewModelPath={digg(this, "viewModelPath")}
24
+ />
24
25
  )
25
26
  }
26
27
 
@@ -1,7 +1,8 @@
1
- import {digs} from "diggerize"
1
+ import {digg, digs} from "diggerize"
2
2
  import IndexPage from "./index-page"
3
3
  import Layout from "./layout"
4
4
  import * as modelsModule from "@kaspernj/api-maker/src/models.mjs.erb"
5
+ import PropTypes from "prop-types"
5
6
  import ShowPage from "./show-page"
6
7
  import withQueryParams from "on-location-changed/src/with-query-params"
7
8
 
@@ -21,10 +22,19 @@ class ApiMakerSuperAdmin extends React.PureComponent {
21
22
  return (
22
23
  <Layout>
23
24
  {pageToShow == "index" &&
24
- <IndexPage currentUser={currentUser} modelClass={modelClass} queryParams={queryParams} />
25
+ <IndexPage
26
+ currentUser={currentUser}
27
+ key={`index-page-${digg(modelClass.modelClassData(), "name")}`}
28
+ modelClass={modelClass}
29
+ queryParams={queryParams}
30
+ />
25
31
  }
26
32
  {pageToShow == "show" &&
27
- <ShowPage modelClass={modelClass} modelId={queryParams.modelId} />
33
+ <ShowPage
34
+ key={`show-page-${digg(modelClass.modelClassData(), "name")}`}
35
+ modelClass={modelClass}
36
+ modelId={queryParams.modelId}
37
+ />
28
38
  }
29
39
  </Layout>
30
40
  )
@@ -1,6 +1,11 @@
1
1
  import "./style"
2
+ import {digg, digs} from "diggerize"
3
+ import EventListener from "../../../event-listener"
4
+ import PropTypes from "prop-types"
5
+ import PropTypesExact from "prop-types-exact"
6
+ import React from "react"
2
7
 
3
- export default class ApiMakerSuperAdminLayoutHeader extends BaseComponent {
8
+ export default class ApiMakerSuperAdminLayoutHeader extends React.PureComponent {
4
9
  static propTypes = PropTypesExact({
5
10
  actions: PropTypes.node,
6
11
  onTriggerMenu: PropTypes.func.isRequired,
@@ -8,13 +13,13 @@ export default class ApiMakerSuperAdminLayoutHeader extends BaseComponent {
8
13
  })
9
14
 
10
15
  headerActionsRef = React.createRef()
11
- shape = new Shape(this, {headerActionsActive: false})
16
+ state = {headerActionsActive: false}
12
17
 
13
18
  render() {
14
19
  const {headerActionsRef} = digs(this, "headerActionsRef")
15
20
  const {onGearsClicked} = digs(this, "onGearsClicked")
16
21
  const {actions, onTriggerMenu, title} = this.props
17
- const {headerActionsActive} = digs(this.shape, "headerActionsActive")
22
+ const {headerActionsActive} = digs(this.state, "headerActionsActive")
18
23
 
19
24
  return (
20
25
  <div className="components--admin--layout--header">
@@ -45,16 +50,16 @@ export default class ApiMakerSuperAdminLayoutHeader extends BaseComponent {
45
50
 
46
51
  onGearsClicked = (e) => {
47
52
  e.preventDefault()
48
- this.shape.set({
49
- headerActionsActive: !this.shape.headerActionsActive
53
+ this.setState({
54
+ headerActionsActive: !this.state.headerActionsActive
50
55
  })
51
56
  }
52
57
 
53
58
  onWindowMouseUp = (e) => {
54
59
  const {headerActionsRef} = digs(this, "headerActionsRef")
55
- const {headerActionsActive} = digs(this.shape, "headerActionsActive")
60
+ const {headerActionsActive} = digs(this.state, "headerActionsActive")
56
61
 
57
62
  // Close the header actions menu if clicked happened outside
58
- if (headerActionsActive && headerActionsRef.current && !headerActionsRef.current.contains(e.target)) this.shape.set({headerActionsActive: false})
63
+ if (headerActionsActive && headerActionsRef.current && !headerActionsRef.current.contains(e.target)) this.state.set({headerActionsActive: false})
59
64
  }
60
65
  }
@@ -1,4 +1,4 @@
1
- @import "stylesheets/variables";
1
+ @import "@kaspernj/api-maker/src/super-admin/stylesheets/variables";
2
2
 
3
3
  .components--admin--layout--header {
4
4
  top: 0;
@@ -1,16 +1,17 @@
1
1
  import "./style"
2
- import CommandsPool from "@kaspernj/api-maker/src/commands-pool"
2
+ import classNames from "classnames"
3
+ import CommandsPool from "../../commands-pool"
4
+ import {digg, digs} from "diggerize"
3
5
  import Header from "./header"
6
+ import Link from "../../link"
4
7
  import Menu from "./menu"
8
+ import PropTypes from "prop-types"
9
+ import PropTypesExact from "prop-types-exact"
10
+ import withCurrentUser from "../../with-current-user"
5
11
 
6
- const UsersSignIn = React.lazy(() => import("components/users/sign-in"))
7
12
  const NoAccess = React.lazy(() => import("./no-access"))
8
13
 
9
14
  class ApiMakerSuperAdminLayout extends React.PureComponent {
10
- static defaultProps = {
11
- requireAdmin: true
12
- }
13
-
14
15
  static propTypes = PropTypesExact({
15
16
  actions: PropTypes.node,
16
17
  active: PropTypes.string,
@@ -20,8 +21,7 @@ class ApiMakerSuperAdminLayout extends React.PureComponent {
20
21
  currentCustomerId: PropTypes.string,
21
22
  currentUser: PropTypes.instanceOf(User),
22
23
  headTitle: PropTypes.string,
23
- headerTitle: PropTypes.string,
24
- requireAdmin: PropTypes.bool.isRequired
24
+ headerTitle: PropTypes.string
25
25
  })
26
26
 
27
27
  componentDidMount() {
@@ -45,9 +45,9 @@ class ApiMakerSuperAdminLayout extends React.PureComponent {
45
45
  }
46
46
  }
47
47
 
48
- shape = new Shape(this, {
48
+ state = {
49
49
  menuTriggered: false
50
- })
50
+ }
51
51
 
52
52
  render() {
53
53
  const {
@@ -60,10 +60,9 @@ class ApiMakerSuperAdminLayout extends React.PureComponent {
60
60
  currentUser,
61
61
  headerTitle,
62
62
  menu,
63
- requireAdmin,
64
63
  ...restProps
65
64
  } = this.props
66
- const {menuTriggered} = digs(this.shape, "menuTriggered")
65
+ const {menuTriggered} = digs(this.state, "menuTriggered")
67
66
  const noAccess = this.noAccess()
68
67
 
69
68
  return (
@@ -82,21 +81,15 @@ class ApiMakerSuperAdminLayout extends React.PureComponent {
82
81
  {currentUser &&
83
82
  <>
84
83
  <div className="mb-4">
85
- {I18n.t("js.components.app_layout.try_signing_out_and_in_with_a_different_user")}
84
+ {I18n.t("js.api_maker.super_admin.layout.try_signing_out_and_in_with_a_different_user")}
86
85
  </div>
87
- {(isCurrentUserA("teacher") || isCurrentUserA("student")) &&
88
- <div className="mb-4">
89
- {this.clickHereToAccessTheUserUniverse()}
90
- </div>
91
- }
92
86
  </>
93
87
  }
94
88
  {!currentUser &&
95
89
  <>
96
90
  <div className="mb-4">
97
- {I18n.t("js.components.app_layout.try_signing_in")}
91
+ {I18n.t("js.api_maker.super_admin.layout.try_signing_in")}
98
92
  </div>
99
- <UsersSignIn />
100
93
  </>
101
94
  }
102
95
  </>
@@ -107,47 +100,18 @@ class ApiMakerSuperAdminLayout extends React.PureComponent {
107
100
  )
108
101
  }
109
102
 
110
- clickHereToAccessTheUserUniverse() {
111
- const replaces = [
112
- {
113
- component: (
114
- <Link key="here-user-universe-link" to={Routes.userRootPath()}>
115
- {I18n.t("js.components.app_layout.here")}
116
- </Link>
117
- ),
118
- text: "%{here}"
119
- },
120
- {
121
- component: (
122
- <Link key="user-universe-link" to={Routes.userRootPath()}>
123
- {I18n.t("js.components.app_layout.user_universe")}
124
- </Link>
125
- ),
126
- text: "%{user_universe}"
127
- }
128
- ]
129
-
130
- return (
131
- <TextComponentReplace
132
- replaces={replaces}
133
- text={I18n.t("js.components.app_layout.click_here_to_access_the_user_universe")}
134
- />
135
- )
136
- }
137
-
138
- onRequestMenuClose = () => this.shape.set({menuTriggered: false})
103
+ onRequestMenuClose = () => this.setState({menuTriggered: false})
139
104
 
140
105
  onTriggerMenu = (e) => {
141
106
  e.preventDefault()
142
107
 
143
- this.shape.set({menuTriggered: !this.shape.menuTriggered})
108
+ this.setState({menuTriggered: !this.state.menuTriggered})
144
109
  }
145
110
 
146
111
  noAccess() {
147
- const {currentUser, requireAdmin} = digs(this.props, "currentUser", "requireAdmin")
112
+ const {currentUser} = digs(this.props, "currentUser")
148
113
 
149
- if (requireAdmin && currentUser && !isCurrentUserA("admin") && !isCurrentUserA("hacker")) return true
150
- if (requireAdmin && !currentUser) return true
114
+ if (!currentUser) return true
151
115
 
152
116
  return false
153
117
  }
@@ -1,9 +1,14 @@
1
1
  import "./style"
2
- import {PopupMenu, PopupMenuItem} from "components/popup-menu"
2
+ import {digg, digs} from "diggerize"
3
+ import Link from "../../../link"
3
4
  import MenuContent from "./menu-content"
4
5
  import MenuItem from "./menu-item"
6
+ import React from "react"
7
+ import PropTypes from "prop-types"
8
+ import PropTypesExact from "prop-types-exact"
9
+ import withCurrentUser from "../../../with-current-user"
5
10
 
6
- class ComponentsAdminLayoutMenu extends BaseComponent {
11
+ class ComponentsAdminLayoutMenu extends React.PureComponent {
7
12
  static propTypes = PropTypesExact({
8
13
  active: PropTypes.string,
9
14
  currentUser: PropTypes.instanceOf(User),
@@ -12,12 +17,10 @@ class ComponentsAdminLayoutMenu extends BaseComponent {
12
17
  triggered: PropTypes.bool.isRequired
13
18
  })
14
19
 
15
- menuUserItemsRef = React.createRef()
16
20
  rootRef = React.createRef()
17
- shape = new Shape(this, {userMenuItemOpen: false})
18
21
 
19
22
  render() {
20
- const {menuUserItemsRef, onUserItemsClicked, rootRef} = digs(this, "menuUserItemsRef", "onUserItemsClicked", "rootRef")
23
+ const {rootRef} = digs(this, "rootRef")
21
24
  const {active} = this.props
22
25
  const {
23
26
  currentUser,
@@ -29,13 +32,10 @@ class ComponentsAdminLayoutMenu extends BaseComponent {
29
32
  "noAccess",
30
33
  "triggered"
31
34
  )
32
- const {userMenuItemOpen} = digs(this.shape, "userMenuItemOpen")
33
-
34
35
  return (
35
36
  <div className="components--admin--layout--menu" data-triggered={triggered} ref={rootRef}>
36
- <EventListener event="mouseup" onCalled={digg(this, "onWindowMouseUp")} target={window} />
37
37
  <div className="menu-logo">
38
- <Link className="menu-logo-link" to={Routes.adminRootPath()}>
38
+ <Link className="menu-logo-link" to={Params.withParams({})}>
39
39
  Admin
40
40
  </Link>
41
41
  </div>
@@ -55,20 +55,6 @@ class ComponentsAdminLayoutMenu extends BaseComponent {
55
55
  {currentUser.name()}
56
56
  </div>
57
57
  </div>
58
- <div className="menu-user-items" ref={menuUserItemsRef}>
59
- {userMenuItemOpen &&
60
- <PopupMenu>
61
- <PopupMenuItem
62
- children={I18n.t("js.components.app_layout.menu.notification_settings")}
63
- className="notifications-settings-menu-item"
64
- to="#"
65
- />
66
- </PopupMenu>
67
- }
68
- <a className="menu-user-items-link" href="#" onClick={onUserItemsClicked}>
69
- <i className="fa fa-ellipsis" />
70
- </a>
71
- </div>
72
58
  </div>
73
59
  }
74
60
  {currentUser &&
@@ -76,7 +62,7 @@ class ComponentsAdminLayoutMenu extends BaseComponent {
76
62
  active
77
63
  className="sign-out-menu-item"
78
64
  icon="sign-out-alt"
79
- label={I18n.t("js.components.admin.layout.menu.sign_out")}
65
+ label={I18n.t("js.api_maker.super_admin.layout.menu.sign_out", {defaultValue: "Sign out"})}
80
66
  onClick={digg(this, "onSignOutClicked")}
81
67
  />
82
68
  }
@@ -90,27 +76,12 @@ class ComponentsAdminLayoutMenu extends BaseComponent {
90
76
 
91
77
  try {
92
78
  await Devise.signOut()
93
- FlashMessage.success(I18n.t("js.components.admin.layout.menu.you_have_been_signed_out"))
79
+ FlashMessage.success(I18n.t("js.api_maker.super_admin.layout.menu.you_have_been_signed_out", {defaultValue: "You have been signed out"}))
94
80
  } catch (error) {
95
81
  FlashMessage.errorResponse(error)
96
82
  }
97
83
  }
98
84
 
99
- onUserItemsClicked = (e) => {
100
- e.preventDefault()
101
- this.shape.set({userMenuItemOpen: !this.shape.userMenuItemOpen})
102
- }
103
-
104
- onWindowMouseUp = (e) => {
105
- const {menuUserItemsRef, rootRef} = digs(this, "menuUserItemsRef", "rootRef")
106
- const {triggered} = digs(this.props, "triggered")
107
-
108
- // Close the menu if triggered (menu is open on mobile)
109
- if (triggered && !rootRef.current.contains(e.target)) setTimeout(this.props.onRequestMenuClose)
110
-
111
- // Close the user items menu if clicked happened outside of that
112
- if (!menuUserItemsRef?.current?.contains(e.target)) this.shape.set({userMenuItemOpen: false})
113
- }
114
85
  }
115
86
 
116
87
  export default withCurrentUser(ComponentsAdminLayoutMenu)
@@ -1,6 +1,9 @@
1
1
  import CanCanLoader from "@kaspernj/api-maker/src/can-can-loader"
2
- import MenuItem from "components/admin/layout/menu/menu-item"
2
+ import {digg, digs} from "diggerize"
3
+ import MenuItem from "./menu-item"
3
4
  import Params from "../../../params"
5
+ import PropTypes from "prop-types"
6
+ import PropTypesExact from "prop-types-exact"
4
7
  import * as modelsModule from "@kaspernj/api-maker/src/models.mjs.erb"
5
8
 
6
9
  const models = []
@@ -19,18 +22,18 @@ for (const model of models) {
19
22
  )
20
23
  }
21
24
 
22
- export default class ComponentsAdminLayoutMenuContent extends BaseComponent {
25
+ export default class ComponentsAdminLayoutMenuContent extends React.PureComponent {
23
26
  static propTypes = PropTypesExact({
24
27
  active: PropTypes.string
25
28
  })
26
29
 
27
- shape = new Shape(this, {
30
+ state = {
28
31
  canCan: undefined
29
- })
32
+ }
30
33
 
31
34
  render() {
32
35
  const {active} = digs(this.props, "active")
33
- const {canCan} = digs(this.shape, "canCan")
36
+ const {canCan} = digs(this.state, "canCan")
34
37
 
35
38
  return (
36
39
  <>
@@ -39,7 +42,7 @@ export default class ComponentsAdminLayoutMenuContent extends BaseComponent {
39
42
  <MenuItem
40
43
  active={active}
41
44
  icon="sitemap"
42
- identifier="check-ins"
45
+ identifier={digg(model.modelClassData(), "name")}
43
46
  label={model.modelName().human({count: 2})}
44
47
  key={model.modelClassData().name}
45
48
  to={Params.withParams({model: model.modelClassData().name})}
@@ -1,6 +1,10 @@
1
1
  import "./style"
2
+ import classNames from "classnames"
3
+ import Link from "../../../../link"
4
+ import PropTypes from "prop-types"
5
+ import React from "react"
2
6
 
3
- export default class ComponentsAdminLayoutMenuMenuItem extends BaseComponent {
7
+ export default class ComponentsAdminLayoutMenuMenuItem extends React.PureComponent {
4
8
  static propTypes = {
5
9
  active: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
6
10
  className: PropTypes.string,
@@ -1,4 +1,4 @@
1
- @import "stylesheets/variables";
1
+ @import "@kaspernj/api-maker/src/super-admin/stylesheets/variables";
2
2
 
3
3
  .components--admin--layout--menu {
4
4
  position: fixed;
@@ -1,4 +1,4 @@
1
- class ComponentsAdminLayoutNoAccess extends BaseComponent {
1
+ class ComponentsAdminLayoutNoAccess extends React.PureComponent {
2
2
  render() {
3
3
  const {currentUser} = digs(this.props, "currentUser")
4
4
 
@@ -7,7 +7,7 @@ class ComponentsAdminLayoutNoAccess extends BaseComponent {
7
7
  className="components--admin--layout-no-access"
8
8
  data-user-roles={currentUser?.userRoles()?.loaded()?.map((userRole) => userRole.role()?.identifier()).join(", ")}
9
9
  >
10
- {I18n.t("js.components.app_layout.no_access.you_dont_have_no_access_to_this_page")}
10
+ {I18n.t("js.api_maker.super_admin.layout.no_access.you_dont_have_no_access_to_this_page")}
11
11
  </div>
12
12
  )
13
13
  }
@@ -1,4 +1,4 @@
1
- @import "stylesheets/variables";
1
+ @import "@kaspernj/api-maker/src/super-admin/stylesheets/variables";
2
2
 
3
3
  .components--admin--layout {
4
4
  width: 100%;
@@ -1,7 +1,9 @@
1
+ import React from "react"
2
+
1
3
  export default class ApiMakerSuperAdminShowPage extends React.PureComponent {
2
4
  render() {
3
5
  return (
4
- <div>
6
+ <div className="super-admin--show-page">
5
7
  show page
6
8
  </div>
7
9
  )
@@ -0,0 +1,11 @@
1
+ $xs-from: 0;
2
+ $xs-to: 575;
3
+ $sm-from: 576px;
4
+ $sm-to: 767px;
5
+ $md-from: 768px;
6
+ $md-to: 991px;
7
+ $lg-from: 992px;
8
+ $lg-to: 1199px;
9
+ $xl-from: 1200px;
10
+ $xl-to: 1399px;
11
+ $xxl-from: 1400px;
@@ -151,9 +151,9 @@ export default class ApiMakerBootStrapLiveTableModelRow extends React.PureCompon
151
151
  } else if (MoneyFormatter.isMoney(value)) {
152
152
  return MoneyFormatter.format(value)
153
153
  } else if (typeof value == "boolean") {
154
- if (value) return I18n.t("js.shared.yes")
154
+ if (value) return I18n.t("js.shared.yes", {defaultValue: "Yes"})
155
155
 
156
- return I18n.t("js.shared.no")
156
+ return I18n.t("js.shared.no", {defaultValue: "No"})
157
157
  } else if (Array.isArray(value)) {
158
158
  return value
159
159
  .map((valuePart) => this.presentColumnValue(valuePart))
@@ -3,7 +3,7 @@ import inflection from "inflection"
3
3
  import modelClassRequire from "./model-class-require.mjs"
4
4
 
5
5
  class ValidationError {
6
- constructor (args) {
6
+ constructor(args) {
7
7
  this.attributeName = digg(args, "attribute_name")
8
8
  this.attributeType = digg(args, "attribute_type")
9
9
  this.errorMessages = digg(args, "error_messages")
@@ -13,7 +13,7 @@ class ValidationError {
13
13
  this.modelName = digg(args, "model_name")
14
14
  }
15
15
 
16
- matchesAttributeAndInputName (attributeName, inputName) {
16
+ matchesAttributeAndInputName(attributeName, inputName) {
17
17
  if (this.getInputName() == inputName) return true
18
18
  if (!attributeName) return false
19
19
 
@@ -30,15 +30,15 @@ class ValidationError {
30
30
  return false
31
31
  }
32
32
 
33
- getAttributeName () {
33
+ getAttributeName() {
34
34
  return digg(this, "attributeName")
35
35
  }
36
36
 
37
- getErrorMessages () {
37
+ getErrorMessages() {
38
38
  return digg(this, "errorMessages")
39
39
  }
40
40
 
41
- getFullErrorMessages () {
41
+ getFullErrorMessages() {
42
42
  const {attributeType} = digs(this, "attributeType")
43
43
 
44
44
  if (attributeType == "base") {
@@ -55,32 +55,32 @@ class ValidationError {
55
55
  }
56
56
  }
57
57
 
58
- getHandled () {
58
+ getHandled() {
59
59
  return digg(this, "handled")
60
60
  }
61
61
 
62
- getInputName () {
62
+ getInputName() {
63
63
  return digg(this, "inputName")
64
64
  }
65
65
 
66
- getModelClass () {
66
+ getModelClass() {
67
67
  const modelName = inflection.classify(digg(this, "modelName"))
68
68
 
69
69
  return modelClassRequire(modelName)
70
70
  }
71
71
 
72
- setHandled () {
72
+ setHandled() {
73
73
  this.handled = true
74
74
  }
75
75
  }
76
76
 
77
77
  class ValidationErrors {
78
- constructor (args) {
78
+ constructor(args) {
79
79
  this.rootModel = digg(args, "model")
80
80
  this.validationErrors = digg(args, "validationErrors").map((validationError) => new ValidationError(validationError))
81
81
  }
82
82
 
83
- getErrorMessage () {
83
+ getErrorMessage() {
84
84
  const fullErrorMessages = []
85
85
 
86
86
  for (const validationError of this.validationErrors) {
@@ -92,7 +92,7 @@ class ValidationErrors {
92
92
  return fullErrorMessages.join(". ")
93
93
  }
94
94
 
95
- getValidationErrors () {
95
+ getValidationErrors() {
96
96
  return this.validationErrors
97
97
  }
98
98
 
@@ -1,6 +1,8 @@
1
+ import Devise from "./devise"
1
2
  import {digs} from "diggerize"
2
3
  import EventEmitterListener from "./event-emitter-listener"
3
4
  import PureComponent from "set-state-compare/src/pure-component"
5
+ import React from "react"
4
6
 
5
7
  export default (WrappedComponent) => class WithCurrentUser extends PureComponent {
6
8
  state = {