@spokane-folio/security-incident 1.0.28

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 (188) hide show
  1. package/.eslintrc +32 -0
  2. package/.github/workflows/CODEOWNERS +8 -0
  3. package/.github/workflows/pr-validation.yml +44 -0
  4. package/.github/workflows/release.yml +64 -0
  5. package/.prettierrc +6 -0
  6. package/.stripesclirc +4 -0
  7. package/CHANGELOG.md +8 -0
  8. package/CONTRIBUTING.md +4 -0
  9. package/LICENSE +201 -0
  10. package/README.md +16 -0
  11. package/administrator-documentation/roles-and-permissions.md +65 -0
  12. package/administrator-documentation/track-settings-admin-guide-sketch.md +192 -0
  13. package/administrator-documentation/using-the-application.md +192 -0
  14. package/icons/app.png +0 -0
  15. package/icons/app.svg +1 -0
  16. package/icons/playButton.png +0 -0
  17. package/icons/profilePicThumbnail.png +0 -0
  18. package/jest.config.js +10 -0
  19. package/module-descriptor.json +75 -0
  20. package/output/service-worker.js +0 -0
  21. package/package.json +146 -0
  22. package/src/components/incidents/ColumnChooser.js +37 -0
  23. package/src/components/incidents/CreateMedia.js +132 -0
  24. package/src/components/incidents/CreatePane.js +1215 -0
  25. package/src/components/incidents/CreatePane.test.js +138 -0
  26. package/src/components/incidents/CreateReport.js +102 -0
  27. package/src/components/incidents/DetailsPane.js +1267 -0
  28. package/src/components/incidents/DetailsPane.test.js +150 -0
  29. package/src/components/incidents/EditPane.js +2334 -0
  30. package/src/components/incidents/EditPane.test.js +187 -0
  31. package/src/components/incidents/GetDetails.js +55 -0
  32. package/src/components/incidents/GetListDQLinkIncident.js +81 -0
  33. package/src/components/incidents/GetListDynamicQuery.js +66 -0
  34. package/src/components/incidents/GetLocations.js +57 -0
  35. package/src/components/incidents/GetMedia.js +98 -0
  36. package/src/components/incidents/GetName.js +111 -0
  37. package/src/components/incidents/GetNameCreatedBy.js +94 -0
  38. package/src/components/incidents/GetOrgLocaleSettings.js +61 -0
  39. package/src/components/incidents/GetPatronGroups.js +52 -0
  40. package/src/components/incidents/GetSelf.js +65 -0
  41. package/src/components/incidents/GetSummary.js +110 -0
  42. package/src/components/incidents/IncidentTypeCard.js +53 -0
  43. package/src/components/incidents/IncidentTypeCard.test.js +133 -0
  44. package/src/components/incidents/IncidentsPaneset.js +810 -0
  45. package/src/components/incidents/IncidentsPaneset.test.js +128 -0
  46. package/src/components/incidents/LinkedIncident.js +86 -0
  47. package/src/components/incidents/ModalAddMedia.js +262 -0
  48. package/src/components/incidents/ModalAddMedia.test.js +97 -0
  49. package/src/components/incidents/ModalAttentionDecOfService.js +111 -0
  50. package/src/components/incidents/ModalCustomWitness.js +469 -0
  51. package/src/components/incidents/ModalCustomWitness.test.js +147 -0
  52. package/src/components/incidents/ModalCustomerDetails.js +480 -0
  53. package/src/components/incidents/ModalCustomerDetails.test.js +116 -0
  54. package/src/components/incidents/ModalDescribeCustomer.js +361 -0
  55. package/src/components/incidents/ModalDescribeCustomer.test.js +156 -0
  56. package/src/components/incidents/ModalDirtyFormWarn.js +62 -0
  57. package/src/components/incidents/ModalLinkIncident.js +1213 -0
  58. package/src/components/incidents/ModalLinkIncidentStyle.css +32 -0
  59. package/src/components/incidents/ModalSelectIncidentTypes.js +178 -0
  60. package/src/components/incidents/ModalSelectIncidentTypes.test.js +273 -0
  61. package/src/components/incidents/ModalSelectKnownCustomer.js +395 -0
  62. package/src/components/incidents/ModalSelectWitness.js +406 -0
  63. package/src/components/incidents/ModalSelectWitness.test.js +308 -0
  64. package/src/components/incidents/ModalStyle.css +44 -0
  65. package/src/components/incidents/ModalTrespass.js +741 -0
  66. package/src/components/incidents/ModalViewCustomerDetails.js +241 -0
  67. package/src/components/incidents/ModalViewMedia.js +86 -0
  68. package/src/components/incidents/ModalViewTrespass.js +210 -0
  69. package/src/components/incidents/ResultsPane.js +437 -0
  70. package/src/components/incidents/ResultsPane.test.js +120 -0
  71. package/src/components/incidents/SearchCustomerOrWitness.js +108 -0
  72. package/src/components/incidents/Thumbnail.js +72 -0
  73. package/src/components/incidents/ThumbnailMarkRemoval.js +38 -0
  74. package/src/components/incidents/ThumbnailSkeleton.js +30 -0
  75. package/src/components/incidents/ThumbnailStyles.js +49 -0
  76. package/src/components/incidents/ThumbnailTempPreSave.js +71 -0
  77. package/src/components/incidents/UpdateReport.js +84 -0
  78. package/src/components/incidents/__snapshots__/CreatePane.test.js.snap +3 -0
  79. package/src/components/incidents/__snapshots__/DetailsPane.test.js.snap +3 -0
  80. package/src/components/incidents/__snapshots__/EditPane.test.js.snap +3 -0
  81. package/src/components/incidents/__snapshots__/IncidentTypeCard.test.js.snap +3 -0
  82. package/src/components/incidents/__snapshots__/IncidentsPaneset.test.js.snap +3 -0
  83. package/src/components/incidents/__snapshots__/ModalAddMedia.test.js.snap +3 -0
  84. package/src/components/incidents/__snapshots__/ModalCustomerDetails.test.js.snap +3 -0
  85. package/src/components/incidents/__snapshots__/ModalSelectWitness.test.js.snap +3 -0
  86. package/src/components/incidents/__snapshots__/ResultsPane.test.js.snap +3 -0
  87. package/src/components/incidents/helpers/ProfilePicture/ProfilePicture.css +5 -0
  88. package/src/components/incidents/helpers/ProfilePicture/ProfilePicture.js +51 -0
  89. package/src/components/incidents/helpers/ProfilePicture/isAValidURL.js +3 -0
  90. package/src/components/incidents/helpers/ProfilePicture/useProfilePicture.js +127 -0
  91. package/src/components/incidents/helpers/buildQueryString.js +28 -0
  92. package/src/components/incidents/helpers/cleanFormValues.js +53 -0
  93. package/src/components/incidents/helpers/computeEditedCustomers.js +124 -0
  94. package/src/components/incidents/helpers/convertDateIgnoringTZ.js +8 -0
  95. package/src/components/incidents/helpers/convertUTCISOToLocalePrettyTime.js +15 -0
  96. package/src/components/incidents/helpers/convertUTCISOToPrettyDate.js +19 -0
  97. package/src/components/incidents/helpers/decodeParamsToForm.js +20 -0
  98. package/src/components/incidents/helpers/deepNormalizeForComparison.js +39 -0
  99. package/src/components/incidents/helpers/extractFilterString.js +12 -0
  100. package/src/components/incidents/helpers/formatDateAndTimeToUTCISO.js +14 -0
  101. package/src/components/incidents/helpers/formatDateToUTCISO.js +14 -0
  102. package/src/components/incidents/helpers/formatTimeToUTCISO.js +28 -0
  103. package/src/components/incidents/helpers/getCurrentTime.js +20 -0
  104. package/src/components/incidents/helpers/getTodayDate.js +12 -0
  105. package/src/components/incidents/helpers/handlebarsHelpers.js +148 -0
  106. package/src/components/incidents/helpers/hasFormChangedAtCreate.js +50 -0
  107. package/src/components/incidents/helpers/hasTopLevelChangeAffectedDeclaration.js +90 -0
  108. package/src/components/incidents/helpers/hasTopLevelFormChanged.js +111 -0
  109. package/src/components/incidents/helpers/identifyCurrentTrespassDocs.js +109 -0
  110. package/src/components/incidents/helpers/isSameHtml.js +13 -0
  111. package/src/components/incidents/helpers/isValidDateFormat.js +14 -0
  112. package/src/components/incidents/helpers/isValidTimeInput.js +11 -0
  113. package/src/components/incidents/helpers/isValidUTCTimeFormat.js +14 -0
  114. package/src/components/incidents/helpers/parseMMDDYYYY.js +7 -0
  115. package/src/components/incidents/helpers/parseQueryString.js +16 -0
  116. package/src/components/incidents/helpers/sortTrespassDocuments.js +44 -0
  117. package/src/components/incidents/helpers/stripHTML.js +11 -0
  118. package/src/components/incidents/helpers/trespassDocUtils.js +197 -0
  119. package/src/components/incidents/helpers/validateTrespassDetails.js +37 -0
  120. package/src/components/incidents/usePersistedColModalLink.js +70 -0
  121. package/src/components/incidents/usePersistedColumns.js +70 -0
  122. package/src/components/incidents/usePersistedSort.js +23 -0
  123. package/src/components/incidents/usePersistedSortModalLink.js +23 -0
  124. package/src/contexts/IncidentContext.js +433 -0
  125. package/src/index.js +61 -0
  126. package/src/routes/Application.js +13 -0
  127. package/src/settings/GetIncidentCategories.js +56 -0
  128. package/src/settings/GetIncidentTypesDetails.js +88 -0
  129. package/src/settings/GetIncidentTypesIds.js +74 -0
  130. package/src/settings/GetLocationsInService.js +54 -0
  131. package/src/settings/GetSingleCustomLocationDetails.js +60 -0
  132. package/src/settings/GetSingleIncidentTypeDetails.js +60 -0
  133. package/src/settings/GetTrespassReasons.js +67 -0
  134. package/src/settings/GetTrespassTemplates.js +51 -0
  135. package/src/settings/IncidentCategoriesPane.js +285 -0
  136. package/src/settings/IncidentCategoriesPane.test.js +229 -0
  137. package/src/settings/IncidentTypeDetailsPane.js +215 -0
  138. package/src/settings/IncidentTypeDetailsPane.test.js +220 -0
  139. package/src/settings/IncidentTypeEditPane.js +211 -0
  140. package/src/settings/IncidentTypeEditPane.test.js +170 -0
  141. package/src/settings/IncidentTypesPaneset.js +167 -0
  142. package/src/settings/IncidentTypesPaneset.test.js +124 -0
  143. package/src/settings/LocationInServiceEditPane.js +320 -0
  144. package/src/settings/LocationsPaneset.js +415 -0
  145. package/src/settings/LocationsPaneset.test.js +106 -0
  146. package/src/settings/ModalDeleteCategory.js +47 -0
  147. package/src/settings/ModalDeleteIncidentType.js +49 -0
  148. package/src/settings/ModalDeleteLocationInService.js +49 -0
  149. package/src/settings/ModalDeleteTrespassReason.js +49 -0
  150. package/src/settings/ModalPreviewTrespassDoc.js +65 -0
  151. package/src/settings/ModalTrespassDocTokens.js +83 -0
  152. package/src/settings/NewIncidentTypePane.js +182 -0
  153. package/src/settings/PutIncidentType.js +60 -0
  154. package/src/settings/PutLocationsInService.js +52 -0
  155. package/src/settings/PutTrespassReasons.js +61 -0
  156. package/src/settings/PutTrespassTemplate.js +50 -0
  157. package/src/settings/TrespassDoc.css +17 -0
  158. package/src/settings/TrespassDocDetailsPane.js +215 -0
  159. package/src/settings/TrespassDocEditPane.js +538 -0
  160. package/src/settings/TrespassDocPaneset.js +581 -0
  161. package/src/settings/TrespassReasonDetailsPane.js +171 -0
  162. package/src/settings/TrespassReasonEditPane.js +221 -0
  163. package/src/settings/TrespassReasonsPaneset.js +282 -0
  164. package/src/settings/__snapshots__/IncidentCategoriesPane.test.js.snap +3 -0
  165. package/src/settings/__snapshots__/IncidentTypeDetailsPane.test.js.snap +3 -0
  166. package/src/settings/__snapshots__/IncidentTypeEditPane.test.js.snap +3 -0
  167. package/src/settings/__snapshots__/IncidentTypesPaneset.test.js.snap +3 -0
  168. package/src/settings/__snapshots__/LocationsPaneset.test.js.snap +3 -0
  169. package/src/settings/data/exampleJSON.json +92 -0
  170. package/src/settings/data/templateTokens.js +396 -0
  171. package/src/settings/helpers/alphabetize.js +18 -0
  172. package/src/settings/helpers/getCategoryTitleById.js +13 -0
  173. package/src/settings/helpers/makeId.js +15 -0
  174. package/src/settings/index.js +48 -0
  175. package/stripes.config.js +10 -0
  176. package/test/jest/__mock__/index.js +8 -0
  177. package/test/jest/__mock__/intl.mock.js +27 -0
  178. package/test/jest/__mock__/stripes.mock.js +26 -0
  179. package/test/jest/__mock__/stripesComponents.mock.js +151 -0
  180. package/test/jest/__mock__/stripesConfig.mock.js +1 -0
  181. package/test/jest/__mock__/stripesCore.mock.js +9 -0
  182. package/test/jest/__mock__/stripesIcon.mock.js +5 -0
  183. package/test/jest/__mock__/stripesSmartComponents.mock.js +7 -0
  184. package/test/jest/__mock__/stripesUtils.mock.js +3 -0
  185. package/test/jest/eslintrc.js +12 -0
  186. package/test/jest/setupFiles.js +5 -0
  187. package/translations/ui-security-incident/en_US.json +542 -0
  188. package/ui-module-acceptance-criteria.md +34 -0
@@ -0,0 +1,151 @@
1
+ import React from 'react';
2
+
3
+ jest.mock('@folio/stripes/components', () => ({
4
+ Badge: jest.fn((props) => (
5
+ <span>
6
+ <span>{props.children}</span>
7
+ </span>
8
+ )),
9
+ Button: jest.fn(({ children }) => (
10
+ <button data-test-button type="button">
11
+ <span>
12
+ {children}
13
+ </span>
14
+ </button>
15
+ )),
16
+ Col: jest.fn(({ children }) => <div className="col">{ children }</div>),
17
+ Datepicker: jest.fn(({ ref, children, ...rest }) => (
18
+ <div ref={ref} {...rest}>
19
+ {children}
20
+ <input type="text" />
21
+ </div>
22
+ )),
23
+ Headline: jest.fn(({ children }) => <div>{ children }</div>),
24
+ Icon: jest.fn((props) => (props && props.children ? props.children : <span />)),
25
+ IconButton: jest.fn(({
26
+ buttonProps,
27
+ // eslint-disable-next-line no-unused-vars
28
+ iconClassName,
29
+ ...rest
30
+ }) => (
31
+ <button type="button" {...buttonProps}>
32
+ <span {...rest} />
33
+ </button>
34
+ )),
35
+ Label: jest.fn(({ children, ...rest }) => (
36
+ <span {...rest}>{children}</span>
37
+ )),
38
+ // oy, dismissible. we need to pull it out of props so it doesn't
39
+ // get applied to the div as an attribute, which must have a string-value,
40
+ // which will shame you in the console:
41
+ //
42
+ // Warning: Received `true` for a non-boolean attribute `dismissible`.
43
+ // If you want to write it to the DOM, pass a string instead: dismissible="true" or dismissible={value.toString()}.
44
+ // in div (created by mockConstructor)
45
+ //
46
+ // is there a better way to throw it away? If we don't destructure and
47
+ // instead access props.label and props.children, then we get a test
48
+ // failure that the modal isn't visible. oy, dismissible.
49
+ Modal: jest.fn(({ children, label, dismissible, closeOnBackgroundClick, ...rest }) => {
50
+ return (
51
+
52
+ <div
53
+ data-test={dismissible ? '' : ''}
54
+ onClick={closeOnBackgroundClick ? jest.fn() : undefined}
55
+ {...rest}
56
+ >
57
+ <h1>{label}</h1>
58
+ {children}
59
+ </div>
60
+ );
61
+ }),
62
+ ModalFooter: jest.fn((props) => (
63
+ <div>{props.children}</div>
64
+ )),
65
+ MultiSelection: jest.fn(({ children, dataOptions }) => (
66
+ <div>
67
+ <select multiple>
68
+ {dataOptions.forEach((option, i) => (
69
+ <option
70
+ value={option.value}
71
+ key={option.id || `option-${i}`}
72
+ >
73
+ {option.label}
74
+ </option>
75
+ ))}
76
+ </select>
77
+ {children}
78
+ </div>
79
+ )),
80
+ NavList: jest.fn(({ children, className, ...rest }) => (
81
+ <div className={className} {...rest}>{children}</div>
82
+ )),
83
+ NavListItem: jest.fn(({ children, className, ...rest }) => (
84
+ <div className={className} {...rest}>{children}</div>
85
+ )),
86
+ NavListSection: jest.fn(({ children, className, ...rest }) => (
87
+ <div className={className} {...rest}>{children}</div>
88
+ )),
89
+ Pane: jest.fn(({ children, className, defaultWidth, paneTitle, firstMenu, lastMenu, fluidContentWidth, ...rest }) => {
90
+ return (
91
+ <div className={className} {...rest} style={!fluidContentWidth ? { width: '960px' } : { width: defaultWidth }}>
92
+ <div>
93
+ {firstMenu ?? null}
94
+ {paneTitle}
95
+ {lastMenu ?? null}
96
+ </div>
97
+ {children}
98
+ </div>
99
+ );
100
+ }),
101
+ Paneset: jest.fn(({ children, defaultWidth, ...rest }) => {
102
+ return (
103
+ <div {...rest} style={{ width: defaultWidth }}>
104
+ {children}
105
+ </div>
106
+ );
107
+ }),
108
+ PaneFooter: jest.fn(({ ref, children, ...rest }) => (
109
+ <div ref={ref} {...rest}>{children}</div>
110
+ )),
111
+ PaneHeader: jest.fn(({ paneTitle, firstMenu, lastMenu }) => (
112
+ <div>
113
+ {firstMenu ?? null}
114
+ {paneTitle}
115
+ {lastMenu ?? null}
116
+ </div>
117
+ )),
118
+ PaneBackLink: jest.fn(() => <span />),
119
+ PaneMenu: jest.fn((props) => <div>{props.children}</div>),
120
+ RadioButton: jest.fn(({ label, name, ...rest }) => (
121
+ <div>
122
+ <label htmlFor="male">{label}</label>
123
+ <input
124
+ type="radio"
125
+ name={name}
126
+ {...rest}
127
+ />
128
+ </div>
129
+ )),
130
+ RadioButtonGroup: jest.fn(({ label, children, ...rest }) => (
131
+ <fieldset {...rest}>
132
+ <legend>{label}</legend>
133
+ {children}
134
+ </fieldset>
135
+ )),
136
+ Row: jest.fn(({ children }) => <div className="row">{ children }</div>),
137
+ Select: jest.fn(({ children, dataOptions }) => (
138
+ <div>
139
+ <select>
140
+ {dataOptions.forEach((option, i) => (
141
+ <option
142
+ value={option.value}
143
+ key={option.id || `option-${i}`}
144
+ >
145
+ {option.label}
146
+ </option>))}
147
+ </select>
148
+ {children}
149
+ </div>
150
+ )),
151
+ }));
@@ -0,0 +1 @@
1
+ jest.mock('stripes-config', () => ({ modules: [] }), { virtual: true });
@@ -0,0 +1,9 @@
1
+ jest.mock('@folio/stripes/core', () => ({
2
+ IfInterface: jest.fn(({ name, children }) => {
3
+ return name === 'interface' ? children : null;
4
+ }),
5
+ IfPermission: jest.fn(({ perm, children }) => {
6
+ return perm === 'permission' ? children : null;
7
+ }),
8
+ Pluggable: jest.fn(({ children }) => [children]),
9
+ }));
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+
3
+ jest.mock('@folio/stripes-components/lib/Icon', () => {
4
+ return () => <span>Icon</span>;
5
+ });
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+
3
+ jest.mock('@folio/stripes/smart-components', () => ({
4
+ ViewMetaData: jest.fn(({ metadata, ...rest }) => (
5
+ <div {...rest}>{metadata.createdDate}</div>
6
+ )),
7
+ }));
@@ -0,0 +1,3 @@
1
+ jest.mock('@folio/stripes/util', () => ({
2
+ exportCsv: jest.fn(),
3
+ }));
@@ -0,0 +1,12 @@
1
+ module.exports = {
2
+ 'extends': ['@folio/eslint-config-stripes'],
3
+ 'parser': '@babel/eslint-parser',
4
+ 'overrides': [
5
+ {
6
+ 'files': ['src/**/tests/*', 'test/**/*'],
7
+ }
8
+ ],
9
+ 'env': {
10
+ 'jest': true
11
+ }
12
+ };
@@ -0,0 +1,5 @@
1
+ // See https://github.com/facebook/jest/issues/335#issuecomment-703691592
2
+ import './__mock__';
3
+
4
+ import 'regenerator-runtime/runtime';
5
+ global.IS_REACT_ACT_ENVIRONMENT = true; // React 18: enable act() support