@kineticdata/react 5.1.1 → 6.0.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 (305) hide show
  1. package/assets/task/icons/drag-handle.svg +3 -0
  2. package/assets/task/icons/plus_small.svg +2 -4
  3. package/lib/apis/agent/adapters.js +16 -12
  4. package/lib/apis/agent/bridges.js +54 -41
  5. package/lib/apis/agent/handlers.js +51 -38
  6. package/lib/apis/core/activity.js +19 -11
  7. package/lib/apis/core/attributeDefinitions.js +54 -46
  8. package/lib/apis/core/attributeDefinitions.test.js +47 -55
  9. package/lib/apis/core/authentication.js +58 -63
  10. package/lib/apis/core/backgroundJobs.js +38 -30
  11. package/lib/apis/core/bridgeModelAttributeMappings.js +42 -34
  12. package/lib/apis/core/bridgeModelAttributes.js +47 -37
  13. package/lib/apis/core/bridgeModelMappings.js +42 -34
  14. package/lib/apis/core/bridgeModelQualificationMappings.js +42 -34
  15. package/lib/apis/core/bridgeModelQualifications.js +42 -34
  16. package/lib/apis/core/bridgeModels.js +61 -45
  17. package/lib/apis/core/bridgeModels.test.js +64 -80
  18. package/lib/apis/core/bridgedresources.js +64 -71
  19. package/lib/apis/core/bridgedresources.test.js +34 -31
  20. package/lib/apis/core/categories.js +59 -52
  21. package/lib/apis/core/categories.test.js +36 -33
  22. package/lib/apis/core/fileResources.js +41 -33
  23. package/lib/apis/core/filestores.js +42 -34
  24. package/lib/apis/core/formTypes.js +50 -44
  25. package/lib/apis/core/forms.js +53 -48
  26. package/lib/apis/core/forms.test.js +60 -74
  27. package/lib/apis/core/kapps.js +45 -39
  28. package/lib/apis/core/kapps.test.js +45 -52
  29. package/lib/apis/core/logs.js +20 -16
  30. package/lib/apis/core/memberships.js +23 -20
  31. package/lib/apis/core/meta.js +31 -19
  32. package/lib/apis/core/notices.js +17 -9
  33. package/lib/apis/core/oauthClients.js +49 -45
  34. package/lib/apis/core/platformComponents.js +73 -57
  35. package/lib/apis/core/platformItems.js +30 -0
  36. package/lib/apis/core/profile.js +28 -21
  37. package/lib/apis/core/profile.test.js +20 -17
  38. package/lib/apis/core/securityPolicyDefinitions.js +48 -41
  39. package/lib/apis/core/securityPolicyDefinitions.test.js +50 -60
  40. package/lib/apis/core/space.js +23 -16
  41. package/lib/apis/core/space.test.js +31 -38
  42. package/lib/apis/core/submissions.js +220 -172
  43. package/lib/apis/core/submissions.test.js +81 -51
  44. package/lib/apis/core/teams.js +51 -44
  45. package/lib/apis/core/teams.test.js +42 -39
  46. package/lib/apis/core/translations.js +123 -130
  47. package/lib/apis/core/translations.test.js +278 -368
  48. package/lib/apis/core/users.js +56 -49
  49. package/lib/apis/core/users.test.js +42 -39
  50. package/lib/apis/core/version.js +20 -11
  51. package/lib/apis/core/webApis.js +42 -34
  52. package/lib/apis/core/webhooks.js +48 -41
  53. package/lib/apis/core/webhooks.test.js +50 -60
  54. package/lib/apis/core/webhooksJobs.js +30 -26
  55. package/lib/apis/core/workflows.js +64 -0
  56. package/lib/apis/http.js +89 -80
  57. package/lib/apis/http.test.js +37 -38
  58. package/lib/apis/index.js +506 -48
  59. package/lib/apis/system/index.js +228 -211
  60. package/lib/apis/task/index.js +283 -226
  61. package/lib/components/agent/bridge/BridgeForm.js +50 -50
  62. package/lib/components/agent/bridge/BridgeTable.js +12 -8
  63. package/lib/components/agent/filestore/FilestoreForm.js +49 -48
  64. package/lib/components/agent/filestore/FilestoreTable.js +12 -8
  65. package/lib/components/agent/handler/AgentHandlerForm.js +24 -27
  66. package/lib/components/agent/handler/AgentHandlerTable.js +12 -8
  67. package/lib/components/common/AttributeSelect.js +15 -9
  68. package/lib/components/common/BridgeSelect.js +48 -43
  69. package/lib/components/common/ComponentConfigContext.js +9 -2
  70. package/lib/components/common/ContentEditable.js +36 -60
  71. package/lib/components/common/FormSelect.js +70 -58
  72. package/lib/components/common/NodeSelect.js +23 -19
  73. package/lib/components/common/Scroller.js +24 -23
  74. package/lib/components/common/StaticSelect.js +57 -50
  75. package/lib/components/common/TableInput.js +54 -57
  76. package/lib/components/common/TeamSelect.js +42 -39
  77. package/lib/components/common/Typeahead.js +121 -138
  78. package/lib/components/common/UserSelect.js +42 -41
  79. package/lib/components/common/authentication/AuthInterceptor.js +15 -19
  80. package/lib/components/common/authentication/AuthInterceptor.test.js +46 -64
  81. package/lib/components/common/authentication/AuthenticationContainer.js +350 -454
  82. package/lib/components/common/authentication/RequestInterceptor.js +16 -19
  83. package/lib/components/common/code_input/CodeInput.js +92 -122
  84. package/lib/components/common/code_input/draftHelpers.js +96 -90
  85. package/lib/components/common/code_input/languageHelpers.js +49 -47
  86. package/lib/components/common/code_input/languageHelpers.test.js +21 -16
  87. package/lib/components/core/CoreFormModal.js +26 -24
  88. package/lib/components/core/CoreModal.js +37 -31
  89. package/lib/components/core/attribute_definition/AttributeDefinitionForm.js +24 -23
  90. package/lib/components/core/attribute_definition/AttributeDefinitionTable.js +18 -15
  91. package/lib/components/core/bridge_model/BridgeModelForm.js +27 -37
  92. package/lib/components/core/bridge_model/BridgeModelTable.js +12 -8
  93. package/lib/components/core/bridge_model_attribute/BridgeModelAttributeForm.js +17 -16
  94. package/lib/components/core/bridge_model_attribute/BridgeModelAttributeTable.js +25 -21
  95. package/lib/components/core/bridge_model_qualification/BridgeModelQualificationForm.js +20 -20
  96. package/lib/components/core/bridge_model_qualification/BridgeModelQualificationTable.js +27 -22
  97. package/lib/components/core/category/CategoryForm.js +22 -22
  98. package/lib/components/core/category/CategoryTable.js +15 -10
  99. package/lib/components/core/core_form/CoreForm.js +209 -285
  100. package/lib/components/core/core_form/CoreForm.test.js +12 -10
  101. package/lib/components/core/core_form/defaults/index.js +52 -44
  102. package/lib/components/core/core_form/globals.js +14 -5
  103. package/lib/components/core/field_definition/FieldDefinitionForm.js +23 -21
  104. package/lib/components/core/field_definition/FieldDefinitionTable.js +15 -10
  105. package/lib/components/core/file_resource/FileResourceForm.js +38 -37
  106. package/lib/components/core/file_resource/FileResourceTable.js +16 -12
  107. package/lib/components/core/form/FormForm.js +56 -61
  108. package/lib/components/core/form/FormTable.js +25 -22
  109. package/lib/components/core/form_type/FormTypeForm.js +14 -13
  110. package/lib/components/core/form_type/FormTypeTable.js +12 -8
  111. package/lib/components/core/i18n/I18n.js +54 -61
  112. package/lib/components/core/i18n/I18nContext.js +9 -2
  113. package/lib/components/core/i18n/I18nProvider.js +40 -43
  114. package/lib/components/core/i18n/Moment.js +40 -50
  115. package/lib/components/core/index_definition/IndexDefinitionForm.js +23 -24
  116. package/lib/components/core/index_definition/IndexDefinitionTable.js +19 -11
  117. package/lib/components/core/index_job/IndexJobTable.js +20 -15
  118. package/lib/components/core/kapp/KappForm.js +57 -58
  119. package/lib/components/core/kapp/KappTable.js +17 -12
  120. package/lib/components/core/log/LogTable.js +35 -33
  121. package/lib/components/core/oauth_client/OAuthClientForm.js +17 -17
  122. package/lib/components/core/oauth_client/OAuthClientTable.js +12 -8
  123. package/lib/components/core/platform_component/AgentComponentForm.js +15 -15
  124. package/lib/components/core/platform_component/AgentComponentTable.js +10 -5
  125. package/lib/components/core/platform_component/TaskComponentForm.js +14 -14
  126. package/lib/components/core/profile/ProfileForm.js +40 -39
  127. package/lib/components/core/security_definition/SecurityDefinitionForm.js +28 -25
  128. package/lib/components/core/security_definition/SecurityDefinitionTable.js +18 -13
  129. package/lib/components/core/space/SpaceForm.js +79 -90
  130. package/lib/components/core/submission/DatastoreSubmissionFilters.js +39 -40
  131. package/lib/components/core/submission/DatastoreSubmissionTable.js +37 -34
  132. package/lib/components/core/submission/FormSubmissionFilters.js +79 -75
  133. package/lib/components/core/submission/FormSubmissionTable.js +27 -20
  134. package/lib/components/core/submission/KappSubmissionTable.js +30 -29
  135. package/lib/components/core/submission/SubmissionForm.js +126 -55
  136. package/lib/components/core/submission/SubmissionTable.js +24 -20
  137. package/lib/components/core/submission/helpers.js +37 -33
  138. package/lib/components/core/submission/helpers.test.js +69 -20
  139. package/lib/components/core/team/TeamForm.js +24 -21
  140. package/lib/components/core/team/TeamTable.js +16 -11
  141. package/lib/components/core/translation/ContextForm.js +13 -10
  142. package/lib/components/core/translation/ContextTable.js +13 -10
  143. package/lib/components/core/translation/EntryForm.js +27 -24
  144. package/lib/components/core/translation/EntryTable.js +19 -16
  145. package/lib/components/core/translation/LocaleForm.js +16 -13
  146. package/lib/components/core/translation/LocaleTable.js +12 -8
  147. package/lib/components/core/user/UserForm.js +38 -37
  148. package/lib/components/core/user/UserTable.js +19 -15
  149. package/lib/components/core/webapi/WebApiForm.js +49 -61
  150. package/lib/components/core/webapi/WebApiTable.js +14 -10
  151. package/lib/components/core/webhook/WebhookForm.js +33 -32
  152. package/lib/components/core/webhook/WebhookTable.js +22 -20
  153. package/lib/components/core/webhook_job/WebhookJobTable.js +19 -16
  154. package/lib/components/form/Form.helpers.js +102 -90
  155. package/lib/components/form/Form.js +467 -524
  156. package/lib/components/form/Form.models.js +38 -24
  157. package/lib/components/form/FormState.js +8 -5
  158. package/lib/components/form/KitchenSinkForm.js +135 -4
  159. package/lib/components/form/defaults/AttributesField.js +48 -59
  160. package/lib/components/form/defaults/CheckboxField.js +14 -6
  161. package/lib/components/form/defaults/CodeField.js +15 -7
  162. package/lib/components/form/defaults/FormButtons.js +12 -4
  163. package/lib/components/form/defaults/FormError.js +12 -4
  164. package/lib/components/form/defaults/FormField.js +15 -7
  165. package/lib/components/form/defaults/FormLayout.js +12 -4
  166. package/lib/components/form/defaults/FormMultiField.js +15 -7
  167. package/lib/components/form/defaults/PasswordField.js +14 -6
  168. package/lib/components/form/defaults/RadioField.js +15 -7
  169. package/lib/components/form/defaults/SampleTeamsRolesFIeld.js +17 -9
  170. package/lib/components/form/defaults/SelectField.js +16 -8
  171. package/lib/components/form/defaults/SelectMultiField.js +15 -7
  172. package/lib/components/form/defaults/TableField.js +14 -6
  173. package/lib/components/form/defaults/TeamField.js +15 -7
  174. package/lib/components/form/defaults/TeamMultiField.js +15 -7
  175. package/lib/components/form/defaults/TextField.js +14 -6
  176. package/lib/components/form/defaults/TextMultiField.js +26 -28
  177. package/lib/components/form/defaults/UserField.js +15 -7
  178. package/lib/components/form/defaults/UserMultiField.js +15 -7
  179. package/lib/components/form/defaults/index.js +48 -41
  180. package/lib/components/form/tests/Form.test.js +568 -864
  181. package/lib/components/form/tests/components.js +15 -25
  182. package/lib/components/form/tests/helpers.test.js +35 -33
  183. package/lib/components/index.js +981 -133
  184. package/lib/components/system/SystemBackgroundTasksTable.js +14 -10
  185. package/lib/components/system/SystemFilestoreForm.js +28 -25
  186. package/lib/components/system/SystemForm.js +19 -16
  187. package/lib/components/system/SystemIngressForm.js +10 -9
  188. package/lib/components/system/SystemSecurityForm.js +17 -14
  189. package/lib/components/system/SystemSmtpForm.js +13 -13
  190. package/lib/components/system/SystemTaskAdapterForm.js +21 -17
  191. package/lib/components/system/SystemUserForm.js +15 -14
  192. package/lib/components/system/helpers.js +62 -60
  193. package/lib/components/system/helpers.test.js +16 -12
  194. package/lib/components/system/spaces/SystemSpaceForm.js +25 -24
  195. package/lib/components/system/spaces/SystemTenantForm.js +43 -40
  196. package/lib/components/system/spaces/SystemTenantTable.js +12 -8
  197. package/lib/components/table/Table.js +219 -225
  198. package/lib/components/table/Table.redux.js +298 -327
  199. package/lib/components/table/Table.redux.test.js +49 -47
  200. package/lib/components/table/Table.test.js +107 -132
  201. package/lib/components/table/defaults/BodyCell.js +12 -6
  202. package/lib/components/table/defaults/BodyRow.js +10 -4
  203. package/lib/components/table/defaults/BooleanFilter.js +17 -11
  204. package/lib/components/table/defaults/EmptyBodyRow.js +12 -6
  205. package/lib/components/table/defaults/FilterLayout.js +17 -11
  206. package/lib/components/table/defaults/Footer.js +11 -5
  207. package/lib/components/table/defaults/FooterCell.js +10 -4
  208. package/lib/components/table/defaults/FooterRow.js +10 -4
  209. package/lib/components/table/defaults/Header.js +10 -4
  210. package/lib/components/table/defaults/HeaderCell.js +16 -10
  211. package/lib/components/table/defaults/HeaderRow.js +10 -4
  212. package/lib/components/table/defaults/PaginationControl.js +18 -9
  213. package/lib/components/table/defaults/TableBody.js +10 -4
  214. package/lib/components/table/defaults/TableLayout.js +12 -6
  215. package/lib/components/table/defaults/TextFilter.js +16 -10
  216. package/lib/components/table/defaults/index.js +41 -33
  217. package/lib/components/task/builder/Connector.js +100 -111
  218. package/lib/components/task/builder/ConnectorForm.js +17 -11
  219. package/lib/components/task/builder/Node.js +101 -83
  220. package/lib/components/task/builder/NodeForm.js +30 -27
  221. package/lib/components/task/builder/NodeParametersForm.js +27 -24
  222. package/lib/components/task/builder/SvgCanvas.js +67 -96
  223. package/lib/components/task/builder/SvgText.js +19 -134
  224. package/lib/components/task/builder/TaskDefinitionConfigForm.js +28 -23
  225. package/lib/components/task/builder/TreeBuilder.js +140 -115
  226. package/lib/components/task/builder/builder.redux.js +322 -300
  227. package/lib/components/task/builder/constants.js +94 -45
  228. package/lib/components/task/builder/helpers.js +184 -173
  229. package/lib/components/task/builder/helpers.test.js +20 -18
  230. package/lib/components/task/builder/models.js +133 -91
  231. package/lib/components/task/category/TaskCategoryForm.js +31 -29
  232. package/lib/components/task/category/TaskCategoryTable.js +12 -8
  233. package/lib/components/task/common/UsageTable.js +16 -12
  234. package/lib/components/task/engine/EngineSettingsForm.js +13 -11
  235. package/lib/components/task/errors/RunErrorTable.js +17 -13
  236. package/lib/components/task/errors/SystemErrorsTable.js +13 -9
  237. package/lib/components/task/handlers/HandlerForm.js +55 -55
  238. package/lib/components/task/handlers/HandlerTable.js +12 -8
  239. package/lib/components/task/handlers/MissingHandlerTable.js +12 -8
  240. package/lib/components/task/policy_rule/PolicyRuleForm.js +33 -32
  241. package/lib/components/task/policy_rule/PolicyRuleTable.js +12 -8
  242. package/lib/components/task/runs/CreateManualTriggerForm.js +17 -15
  243. package/lib/components/task/runs/RunTable.js +23 -20
  244. package/lib/components/task/runs/RunTaskTable.js +10 -6
  245. package/lib/components/task/sources/SourceForm.js +47 -47
  246. package/lib/components/task/sources/SourceTable.js +14 -11
  247. package/lib/components/task/triggers/TriggerTable.js +21 -18
  248. package/lib/components/task/workflows/LinkedWorkflowForm.js +249 -0
  249. package/lib/components/task/workflows/LinkedWorkflowTable.js +137 -0
  250. package/lib/components/task/workflows/MissingRoutineTable.js +12 -8
  251. package/lib/components/task/workflows/WorkflowForm.js +61 -46
  252. package/lib/components/task/workflows/WorkflowTable.js +17 -14
  253. package/lib/helpers/SearchBuilder.js +73 -127
  254. package/lib/helpers/SearchBuilder.test.js +184 -175
  255. package/lib/helpers/index.js +116 -74
  256. package/lib/index.js +86 -38
  257. package/lib/reducer.js +11 -3
  258. package/lib/saga.js +42 -38
  259. package/lib/store.js +59 -35
  260. package/package.json +4 -29
  261. package/proxyhelper.js +105 -47
  262. package/assets/discussions/images/avi_128.png +0 -0
  263. package/assets/discussions/images/excel_128.png +0 -0
  264. package/assets/discussions/images/html_128.png +0 -0
  265. package/assets/discussions/images/illustrator_128.png +0 -0
  266. package/assets/discussions/images/indesign_128.png +0 -0
  267. package/assets/discussions/images/movie_128.png +0 -0
  268. package/assets/discussions/images/mpeg_128.png +0 -0
  269. package/assets/discussions/images/pdf_128.png +0 -0
  270. package/assets/discussions/images/photoshop_128.png +0 -0
  271. package/assets/discussions/images/powerpoint_128.png +0 -0
  272. package/assets/discussions/images/txt_128.png +0 -0
  273. package/assets/discussions/images/unknown_128.png +0 -0
  274. package/assets/discussions/images/word_128.png +0 -0
  275. package/assets/discussions/styles/_discussion.scss +0 -506
  276. package/lib/apis/discussions/index.js +0 -395
  277. package/lib/apis/socket/index.js +0 -77
  278. package/lib/apis/socket/socket.js +0 -350
  279. package/lib/apis/socket/socket.test.js +0 -90
  280. package/lib/apis/socket/timer.js +0 -45
  281. package/lib/apis/socket/timer.test.js +0 -51
  282. package/lib/apis/socket/topic.js +0 -185
  283. package/lib/apis/topics/index.js +0 -19
  284. package/lib/components/discussions/ChatInputForm.js +0 -424
  285. package/lib/components/discussions/DateBanner.js +0 -10
  286. package/lib/components/discussions/Discussion.js +0 -202
  287. package/lib/components/discussions/DiscussionForm.js +0 -227
  288. package/lib/components/discussions/InvitationForm.js +0 -107
  289. package/lib/components/discussions/MessageHistory.js +0 -110
  290. package/lib/components/discussions/MessagesByDate.js +0 -40
  291. package/lib/components/discussions/MessagesList.js +0 -30
  292. package/lib/components/discussions/MoreMessagesBanner.js +0 -26
  293. package/lib/components/discussions/ScrollHelper.js +0 -84
  294. package/lib/components/discussions/SystemMessage.js +0 -88
  295. package/lib/components/discussions/SystemMessageGroup.js +0 -15
  296. package/lib/components/discussions/UserMessage.js +0 -163
  297. package/lib/components/discussions/UserMessageGroup.js +0 -34
  298. package/lib/components/discussions/redux.js +0 -178
  299. package/lib/components/discussions/sagas.js +0 -500
  300. package/lib/helpers/discussions/canManage.js +0 -30
  301. package/lib/helpers/discussions/canManage.test.js +0 -69
  302. package/lib/helpers/discussions/generateSystemMessageContent.js +0 -131
  303. package/lib/helpers/discussions/generateSystemMessageContent.test.js +0 -450
  304. package/lib/models/discussions.js +0 -76
  305. package/lib/models/index.js +0 -1
@@ -1,94 +1,97 @@
1
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/esm/createClass";
4
- import _inherits from "@babel/runtime/helpers/esm/inherits";
5
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
7
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
- import React, { Component } from 'react';
9
- import t from 'prop-types';
10
- import isPlainObject from 'lodash.isplainobject';
11
- import isString from 'lodash.isstring';
12
- import deepEqual from 'deepequal';
13
- import { Map, get } from 'immutable';
14
- import { connect } from '../../../store';
15
- import { K, bundle } from '../../../helpers';
16
- import { corePath } from '../../../apis/http';
17
- import { fetchSubmission, updateSubmission, fetchForm } from '../../../apis';
18
- import { GlobalsContext } from './globals';
19
- import { ComponentConfigContext } from '../../common/ComponentConfigContext';
20
- import { LOCKED_BY_FIELD, LOCKED_UNTIL_FIELD, LOCK_TIME_ATTRIBUTE, LOCK_TIME_DEFAULT_VALUE, LOCK_CHECK_INTERVAL_ATTRIBUTE, LOCK_CHECK_INTERVAL_DEFAULT_VALUE, LOCK_PROMPT_TIME_ATTRIBUTE, LOCK_PROMPT_TIME_DEFAULT_VALUE, DefaultCoreFormConfig } from './defaults';
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.unlockSubmission = exports.queryString = exports.lockSubmission = exports.isLockedByMe = exports.isLocked = exports.isLockable = exports.getTimeLeft = exports.getLockedBy = exports.applyGuard = exports.CoreFormComponent = exports.CoreForm = void 0;
9
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
11
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
12
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));
13
+ var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createSuper"));
14
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
15
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
16
+ var _react = _interopRequireWildcard(require("react"));
17
+ var _propTypes = _interopRequireDefault(require("prop-types"));
18
+ var _lodash = _interopRequireDefault(require("lodash.isplainobject"));
19
+ var _lodash2 = _interopRequireDefault(require("lodash.isstring"));
20
+ var _deepequal = _interopRequireDefault(require("deepequal"));
21
+ var _immutable = require("immutable");
22
+ var _store = require("../../../store");
23
+ var _helpers = require("../../../helpers");
24
+ var _http = require("../../../apis/http");
25
+ var _apis = require("../../../apis");
26
+ var _globals = require("./globals");
27
+ var _ComponentConfigContext = require("../../common/ComponentConfigContext");
28
+ var _defaults = require("./defaults");
29
+ var _excluded = ["init", "poller"],
30
+ _excluded2 = ["components"];
21
31
  var submissionIncludes = 'values,form,form.fields,form.attributesMap,form.kapp,form.kapp.attributesMap,form.kapp.space,form.kapp.space.attributesMap';
22
32
  var formIncludes = 'fields,attributesMap,kapp,kapp.attributesMap,kapp.space,kapp.space.attributesMap';
23
-
24
33
  var getNumericAttributeValue = function getNumericAttributeValue(form, name) {
25
34
  var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
26
35
  var kapp = form ? form.kapp : null;
27
36
  var space = kapp ? kapp.space : null;
28
37
  return parseInt(form && form.attributesMap && form.attributesMap[name] && form.attributesMap[name][0] || kapp && kapp.attributesMap && kapp.attributesMap[name] && kapp.attributesMap[name][0] || space && space.attributesMap && space.attributesMap[name] && space.attributesMap[name][0], 10) || defaultValue;
29
38
  };
30
-
31
- export var isLockable = function isLockable(submission) {
39
+ var isLockable = function isLockable(submission) {
32
40
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
33
41
  return submission && submission.coreState === 'Draft' && submission.values && submission.form && submission.form.fields && submission.form.fields.find(function (f) {
34
- return f.name === (options.lockedByField || LOCKED_BY_FIELD);
42
+ return f.name === (options.lockedByField || _defaults.LOCKED_BY_FIELD);
35
43
  }) && submission.form.fields.find(function (f) {
36
- return f.name === (options.lockedUntilField || LOCKED_UNTIL_FIELD);
44
+ return f.name === (options.lockedUntilField || _defaults.LOCKED_UNTIL_FIELD);
37
45
  }) ? true : false;
38
46
  };
39
- export var isLocked = function isLocked(submission) {
47
+ exports.isLockable = isLockable;
48
+ var isLocked = function isLocked(submission) {
40
49
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
41
-
42
50
  if (!isLockable(submission, options)) {
43
51
  return false;
44
52
  }
45
-
46
- var lockedUntilDate = new Date(submission.values[options.lockedUntilField || LOCKED_UNTIL_FIELD]).getTime();
53
+ var lockedUntilDate = new Date(submission.values[options.lockedUntilField || _defaults.LOCKED_UNTIL_FIELD]).getTime();
47
54
  return lockedUntilDate > 0 && lockedUntilDate > new Date().getTime();
48
55
  };
49
- export var isLockedByMe = function isLockedByMe(submission) {
56
+ exports.isLocked = isLocked;
57
+ var isLockedByMe = function isLockedByMe(submission) {
50
58
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
51
-
52
59
  if (!isLockable(submission, options) || !isLocked(submission, options)) {
53
60
  return false;
54
61
  }
55
-
56
- return submission.values[options.lockedByField || LOCKED_BY_FIELD] === bundle.identity();
62
+ return submission.values[options.lockedByField || _defaults.LOCKED_BY_FIELD] === _helpers.bundle.identity();
57
63
  };
58
- export var getLockedBy = function getLockedBy(submission) {
64
+ exports.isLockedByMe = isLockedByMe;
65
+ var getLockedBy = function getLockedBy(submission) {
59
66
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
60
-
61
67
  if (!isLockable(submission, options) || !isLocked(submission, options)) {
62
68
  return '';
63
69
  }
64
-
65
- return submission.values[options.lockedByField || LOCKED_BY_FIELD] || '';
70
+ return submission.values[options.lockedByField || _defaults.LOCKED_BY_FIELD] || '';
66
71
  };
67
- export var getTimeLeft = function getTimeLeft(submission) {
72
+ exports.getLockedBy = getLockedBy;
73
+ var getTimeLeft = function getTimeLeft(submission) {
68
74
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
69
-
70
75
  if (!isLockable(submission, options) || !isLocked(submission, options)) {
71
76
  return 0;
72
77
  }
73
-
74
- var lockedUntilDate = new Date(submission.values[options.lockedUntilField || LOCKED_UNTIL_FIELD]).getTime();
78
+ var lockedUntilDate = new Date(submission.values[options.lockedUntilField || _defaults.LOCKED_UNTIL_FIELD]).getTime();
75
79
  return lockedUntilDate - new Date().getTime();
76
80
  };
77
- export var lockSubmission = function lockSubmission(_ref) {
81
+ exports.getTimeLeft = getTimeLeft;
82
+ var lockSubmission = function lockSubmission(_ref) {
78
83
  var id = _ref.id,
79
- datastore = _ref.datastore,
80
- _ref$options = _ref.options,
81
- options = _ref$options === void 0 ? {} : _ref$options;
82
- return fetchSubmission({
84
+ datastore = _ref.datastore,
85
+ _ref$options = _ref.options,
86
+ options = _ref$options === void 0 ? {} : _ref$options;
87
+ return (0, _apis.fetchSubmission)({
83
88
  id: id,
84
89
  datastore: !!datastore,
85
90
  include: submissionIncludes
86
91
  }).then(function (_ref2) {
87
92
  var _values;
88
-
89
93
  var submission = _ref2.submission,
90
- error = _ref2.error;
91
-
94
+ error = _ref2.error;
92
95
  if (error) {
93
96
  return {
94
97
  error: error
@@ -108,35 +111,33 @@ export var lockSubmission = function lockSubmission(_ref) {
108
111
  }
109
112
  };
110
113
  }
111
-
112
- var lockTime = getNumericAttributeValue(submission.form, options.lockTimeAttribute || LOCK_TIME_ATTRIBUTE, LOCK_TIME_DEFAULT_VALUE);
113
- return updateSubmission({
114
+ var lockTime = getNumericAttributeValue(submission.form, options.lockTimeAttribute || _defaults.LOCK_TIME_ATTRIBUTE, _defaults.LOCK_TIME_DEFAULT_VALUE);
115
+ return (0, _apis.updateSubmission)({
114
116
  id: submission.id,
115
117
  include: submissionIncludes,
116
- values: (_values = {}, _defineProperty(_values, options.lockedByField || LOCKED_BY_FIELD, bundle.identity()), _defineProperty(_values, options.lockedUntilField || LOCKED_UNTIL_FIELD, new Date(new Date().getTime() + lockTime * 1000).toISOString()), _values)
118
+ values: (_values = {}, (0, _defineProperty2["default"])(_values, options.lockedByField || _defaults.LOCKED_BY_FIELD, _helpers.bundle.identity()), (0, _defineProperty2["default"])(_values, options.lockedUntilField || _defaults.LOCKED_UNTIL_FIELD, new Date(new Date().getTime() + lockTime * 1000).toISOString()), _values)
117
119
  }).then(function (response) {
118
- return _objectSpread({
120
+ return (0, _objectSpread2["default"])({
119
121
  submission: submission
120
122
  }, response);
121
123
  });
122
124
  });
123
125
  };
124
- export var unlockSubmission = function unlockSubmission(_ref3) {
126
+ exports.lockSubmission = lockSubmission;
127
+ var unlockSubmission = function unlockSubmission(_ref3) {
125
128
  var id = _ref3.id,
126
- datastore = _ref3.datastore,
127
- _ref3$options = _ref3.options,
128
- options = _ref3$options === void 0 ? {} : _ref3$options,
129
- adminLockOverride = _ref3.adminLockOverride;
130
- return fetchSubmission({
129
+ datastore = _ref3.datastore,
130
+ _ref3$options = _ref3.options,
131
+ options = _ref3$options === void 0 ? {} : _ref3$options,
132
+ adminLockOverride = _ref3.adminLockOverride;
133
+ return (0, _apis.fetchSubmission)({
131
134
  id: id,
132
135
  datastore: !!datastore,
133
136
  include: submissionIncludes
134
137
  }).then(function (_ref4) {
135
138
  var _values2;
136
-
137
139
  var submission = _ref4.submission,
138
- error = _ref4.error;
139
-
140
+ error = _ref4.error;
140
141
  if (error) {
141
142
  return {
142
143
  error: error
@@ -163,46 +164,45 @@ export var unlockSubmission = function unlockSubmission(_ref3) {
163
164
  }
164
165
  };
165
166
  }
166
-
167
- return updateSubmission({
167
+ return (0, _apis.updateSubmission)({
168
168
  id: submission.id,
169
169
  include: submissionIncludes,
170
- values: (_values2 = {}, _defineProperty(_values2, options.lockedByField || LOCKED_BY_FIELD, ''), _defineProperty(_values2, options.lockedUntilField || LOCKED_UNTIL_FIELD, ''), _values2)
170
+ values: (_values2 = {}, (0, _defineProperty2["default"])(_values2, options.lockedByField || _defaults.LOCKED_BY_FIELD, ''), (0, _defineProperty2["default"])(_values2, options.lockedUntilField || _defaults.LOCKED_UNTIL_FIELD, ''), _values2)
171
171
  }).then(function (response) {
172
- return _objectSpread({
172
+ return (0, _objectSpread2["default"])({
173
173
  submission: submission
174
174
  }, response);
175
175
  });
176
176
  });
177
177
  };
178
- export var queryString = function queryString(_ref5, _ref6) {
178
+ exports.unlockSubmission = unlockSubmission;
179
+ var queryString = function queryString(_ref5, _ref6) {
179
180
  var review = _ref5.review,
180
- values = _ref5.values;
181
+ values = _ref5.values;
181
182
  var reviewPages = _ref6.reviewPages,
182
- reviewPageIndex = _ref6.reviewPageIndex;
183
+ reviewPageIndex = _ref6.reviewPageIndex;
183
184
  var parameters = [];
184
-
185
185
  if (!!review) {
186
186
  if (typeof reviewPageIndex === 'number') {
187
187
  parameters.push("review=".concat(encodeURIComponent(reviewPages[reviewPageIndex])));
188
- } else if (isString(review)) {
188
+ } else if ((0, _lodash2["default"])(review)) {
189
189
  parameters.push("review=".concat(encodeURIComponent(review)));
190
190
  } else {
191
191
  parameters.push('review');
192
192
  }
193
193
  }
194
-
195
- if (isPlainObject(values)) {
194
+ if ((0, _lodash["default"])(values)) {
196
195
  Object.keys(values).forEach(function (field) {
197
196
  parameters.push("".concat(encodeURIComponent("values[".concat(field, "]")), "=").concat(encodeURIComponent(values[field])));
198
197
  });
199
198
  }
200
-
201
199
  return parameters.join('&');
202
200
  };
203
- export var applyGuard = function applyGuard(func, context, args) {
201
+ exports.queryString = queryString;
202
+ var applyGuard = function applyGuard(func, context, args) {
204
203
  return typeof func === 'function' && func.apply(context, args);
205
204
  };
205
+ exports.applyGuard = applyGuard;
206
206
  var defaultState = {
207
207
  pending: true,
208
208
  submission: null,
@@ -212,33 +212,24 @@ var defaultState = {
212
212
  reviewPageIndex: null,
213
213
  reviewPages: []
214
214
  };
215
- export var CoreFormComponent = /*#__PURE__*/function (_Component) {
216
- _inherits(CoreFormComponent, _Component);
217
-
218
- var _super = _createSuper(CoreFormComponent);
219
-
215
+ var CoreFormComponent = /*#__PURE__*/function (_Component) {
216
+ (0, _inherits2["default"])(CoreFormComponent, _Component);
217
+ var _super = (0, _createSuper2["default"])(CoreFormComponent);
220
218
  function CoreFormComponent(props) {
221
219
  var _this;
222
-
223
- _classCallCheck(this, CoreFormComponent);
224
-
220
+ (0, _classCallCheck2["default"])(this, CoreFormComponent);
225
221
  _this = _super.call(this, props);
226
-
227
222
  _this.setStateSafe = function () {
228
223
  var _this2;
229
-
230
224
  return !_this._unmounted ? (_this2 = _this).setState.apply(_this2, arguments) : undefined;
231
225
  };
232
-
233
226
  _this.handleRef = function (element) {
234
227
  _this.container = element;
235
228
  };
236
-
237
- _this.state = _objectSpread({}, defaultState);
229
+ _this.state = (0, _objectSpread2["default"])({}, defaultState);
238
230
  return _this;
239
231
  }
240
-
241
- _createClass(CoreFormComponent, [{
232
+ (0, _createClass2["default"])(CoreFormComponent, [{
242
233
  key: "componentDidMount",
243
234
  value: function componentDidMount() {
244
235
  if (this.props.submission && this.props.lock) {
@@ -251,8 +242,7 @@ export var CoreFormComponent = /*#__PURE__*/function (_Component) {
251
242
  key: "resetComponent",
252
243
  value: function resetComponent() {
253
244
  this.closeForm();
254
- this.setStateSafe(_objectSpread({}, defaultState));
255
-
245
+ this.setStateSafe((0, _objectSpread2["default"])({}, defaultState));
256
246
  if (this.props.submission && this.props.lock) {
257
247
  this.obtainLock();
258
248
  } else {
@@ -263,9 +253,8 @@ export var CoreFormComponent = /*#__PURE__*/function (_Component) {
263
253
  key: "componentDidUpdate",
264
254
  value: function componentDidUpdate(prevProps, prevState) {
265
255
  var _this3 = this;
266
-
267
256
  // If props changed, reset component
268
- if (!deepEqual(this.props, prevProps)) {
257
+ if (!(0, _deepequal["default"])(this.props, prevProps)) {
269
258
  if (prevState.lock && prevState.lock.isLockedByMe) {
270
259
  this.releaseLock({
271
260
  state: prevState,
@@ -276,15 +265,16 @@ export var CoreFormComponent = /*#__PURE__*/function (_Component) {
276
265
  } else {
277
266
  this.resetComponent();
278
267
  }
279
- } // If pending and submission or form state has just been set, load form
280
-
268
+ }
281
269
 
270
+ // If pending and submission or form state has just been set, load form
282
271
  if (this.state.pending && (this.state.submission || this.state.form) && !prevState.submission && !prevState.form) {
283
- this.loadForm(_objectSpread(_objectSpread({}, this.props), {}, {
272
+ this.loadForm((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, this.props), {}, {
284
273
  // If locking is enabled and form is locked by someone else, open in review mode
285
274
  review: this.props.review || this.state.lock && !this.state.lock.isLockedByMe
286
275
  }));
287
- } // If pending and error state has just been set, call error callback
276
+ }
277
+ // If pending and error state has just been set, call error callback
288
278
  else if (this.state.pending && this.state.error && !prevState.error) {
289
279
  if (this.state.error.statusCode === 401) {
290
280
  applyGuard(this.props.onUnauthorized || this.props.unauthorized);
@@ -295,75 +285,74 @@ export var CoreFormComponent = /*#__PURE__*/function (_Component) {
295
285
  } else {
296
286
  applyGuard(this.props.onError || this.props.error);
297
287
  }
298
- } // If locking is turned on and has been initalized
299
-
288
+ }
300
289
 
290
+ // If locking is turned on and has been initalized
301
291
  if (this.state.lock && this.state.lock.init) {
302
- var lockPromptTime = getNumericAttributeValue(this.state.form, this.props.lockPromptTimeAttribute || LOCK_PROMPT_TIME_ATTRIBUTE, LOCK_PROMPT_TIME_DEFAULT_VALUE); // If I obtained the lock, start the poller
292
+ var lockPromptTime = getNumericAttributeValue(this.state.form, this.props.lockPromptTimeAttribute || _defaults.LOCK_PROMPT_TIME_ATTRIBUTE, _defaults.LOCK_PROMPT_TIME_DEFAULT_VALUE);
303
293
 
294
+ // If I obtained the lock, start the poller
304
295
  if (this.state.lock.isLockedByMe && !this.state.lock.poller) {
305
- var lockCheckInterval = getNumericAttributeValue(this.state.form, this.props.lockCheckIntervalAttribute || LOCK_CHECK_INTERVAL_ATTRIBUTE, LOCK_CHECK_INTERVAL_DEFAULT_VALUE);
296
+ var lockCheckInterval = getNumericAttributeValue(this.state.form, this.props.lockCheckIntervalAttribute || _defaults.LOCK_CHECK_INTERVAL_ATTRIBUTE, _defaults.LOCK_CHECK_INTERVAL_DEFAULT_VALUE);
306
297
  this.setStateSafe({
307
- lock: _objectSpread(_objectSpread({}, this.state.lock), {}, {
298
+ lock: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, this.state.lock), {}, {
308
299
  poller: setInterval(function () {
309
300
  _this3.pollSubmission();
310
301
  }, lockCheckInterval * 1000),
311
302
  isExpiring: false,
312
303
  lockLost: false
313
304
  })
314
- }); // If form is loaded and is in review mode but should be editable, close and re-load it
315
-
305
+ });
306
+ // If form is loaded and is in review mode but should be editable, close and re-load it
316
307
  this.form && !this.props.review && this.form.then(function (form) {
317
308
  if (form && form.reviewMode()) {
318
309
  _this3.closeForm();
319
-
320
310
  _this3.loadForm(_this3.props);
321
311
  }
322
312
  });
323
- } // If lock has been renewed, reset poller
324
-
313
+ }
325
314
 
315
+ // If lock has been renewed, reset poller
326
316
  if (this.state.lock.isLockedByMe && this.state.lock.poller && prevState.lock && prevState.lock.isLockedByMe && this.state.lock.timeLeft > prevState.lock.timeLeft) {
327
- var _lockCheckInterval = getNumericAttributeValue(this.state.form, this.props.lockCheckIntervalAttribute || LOCK_CHECK_INTERVAL_ATTRIBUTE, LOCK_CHECK_INTERVAL_DEFAULT_VALUE);
328
-
317
+ var _lockCheckInterval = getNumericAttributeValue(this.state.form, this.props.lockCheckIntervalAttribute || _defaults.LOCK_CHECK_INTERVAL_ATTRIBUTE, _defaults.LOCK_CHECK_INTERVAL_DEFAULT_VALUE);
329
318
  clearInterval(this.state.lock.poller);
330
319
  this.setStateSafe({
331
- lock: _objectSpread(_objectSpread({}, this.state.lock), {}, {
320
+ lock: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, this.state.lock), {}, {
332
321
  poller: setInterval(function () {
333
322
  _this3.pollSubmission();
334
323
  }, _lockCheckInterval * 1000)
335
324
  })
336
325
  });
337
- } // If I lost the lock, stop the poller
338
-
326
+ }
339
327
 
328
+ // If I lost the lock, stop the poller
340
329
  if (!this.state.lock.isLockedByMe && this.state.lock.poller) {
341
330
  clearInterval(this.state.lock.poller);
342
331
  this.setStateSafe({
343
- lock: _objectSpread(_objectSpread({}, this.state.lock), {}, {
332
+ lock: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, this.state.lock), {}, {
344
333
  poller: null,
345
334
  isExpiring: false,
346
335
  lockLost: true
347
336
  })
348
337
  });
349
- } // If remaining lock time is less than lock prompt time, prompt user
350
-
338
+ }
351
339
 
340
+ // If remaining lock time is less than lock prompt time, prompt user
352
341
  if (this.state.lock.isLockedByMe && this.state.lock.timeLeft <= lockPromptTime * 1000 && prevState.lock && prevState.lock.timeLeft > lockPromptTime * 1000) {
353
342
  this.setStateSafe({
354
- lock: _objectSpread(_objectSpread({}, this.state.lock), {}, {
343
+ lock: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, this.state.lock), {}, {
355
344
  isExpiring: true
356
345
  })
357
346
  });
358
347
  }
359
- } // If submission is no longer lockable, stop poller
360
-
348
+ }
361
349
 
350
+ // If submission is no longer lockable, stop poller
362
351
  if (!this.state.lock && prevState.lock && prevState.lock.poller) {
363
352
  clearInterval(prevState.lock.poller);
364
- } // If in review mode and page index changes, close and reload form
365
-
353
+ }
366
354
 
355
+ // If in review mode and page index changes, close and reload form
367
356
  if (!!this.props.review && typeof prevState.reviewPageIndex === 'number' && typeof this.state.reviewPageIndex === 'number' && this.state.reviewPageIndex !== prevState.reviewPageIndex) {
368
357
  this.closeForm();
369
358
  this.loadForm(this.props);
@@ -373,9 +362,7 @@ export var CoreFormComponent = /*#__PURE__*/function (_Component) {
373
362
  key: "componentWillUnmount",
374
363
  value: function componentWillUnmount() {
375
364
  var _this4 = this;
376
-
377
365
  this._unmounted = true;
378
-
379
366
  if (this.state.lock) {
380
367
  this.releaseLock(undefined, true).then(function () {
381
368
  _this4.closeForm();
@@ -388,22 +375,20 @@ export var CoreFormComponent = /*#__PURE__*/function (_Component) {
388
375
  key: "fetchData",
389
376
  value: function fetchData() {
390
377
  var _this5 = this;
391
-
392
- return this.props.submission ? fetchSubmission({
378
+ return this.props.submission ? (0, _apis.fetchSubmission)({
393
379
  id: this.props.submission,
394
380
  datastore: !!this.props.datastore,
395
381
  include: submissionIncludes,
396
382
  "public": this.props["public"]
397
383
  }).then(function (_ref7) {
398
384
  var submission = _ref7.submission,
399
- error = _ref7.error;
400
-
385
+ error = _ref7.error;
401
386
  _this5.setStateSafe({
402
387
  submission: submission,
403
388
  form: submission ? submission.form : null,
404
389
  error: error
405
390
  });
406
- }) : fetchForm({
391
+ }) : (0, _apis.fetchForm)({
407
392
  datastore: !!this.props.datastore,
408
393
  kappSlug: this.props.kapp,
409
394
  formSlug: this.props.form,
@@ -411,8 +396,7 @@ export var CoreFormComponent = /*#__PURE__*/function (_Component) {
411
396
  "public": this.props["public"]
412
397
  }).then(function (_ref8) {
413
398
  var form = _ref8.form,
414
- error = _ref8.error;
415
-
399
+ error = _ref8.error;
416
400
  _this5.setStateSafe({
417
401
  form: form,
418
402
  error: error
@@ -423,20 +407,18 @@ export var CoreFormComponent = /*#__PURE__*/function (_Component) {
423
407
  key: "pollSubmission",
424
408
  value: function pollSubmission() {
425
409
  var _this6 = this;
426
-
427
- return this.props.submission ? fetchSubmission({
410
+ return this.props.submission ? (0, _apis.fetchSubmission)({
428
411
  id: this.props.submission,
429
412
  datastore: !!this.props.datastore,
430
413
  include: submissionIncludes
431
414
  }).then(function (_ref9) {
432
415
  var submission = _ref9.submission,
433
- error = _ref9.error;
434
-
416
+ error = _ref9.error;
435
417
  _this6.setStateSafe({
436
418
  submission: submission,
437
419
  form: submission ? submission.form : null,
438
420
  error: error,
439
- lock: isLockable(submission, _this6.props) ? _objectSpread(_objectSpread({}, _this6.state.lock), {}, {
421
+ lock: isLockable(submission, _this6.props) ? (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _this6.state.lock), {}, {
440
422
  isLocked: isLocked(submission, _this6.props),
441
423
  isLockedByMe: isLockedByMe(submission, _this6.props),
442
424
  lockedBy: getLockedBy(submission, _this6.props),
@@ -455,20 +437,18 @@ export var CoreFormComponent = /*#__PURE__*/function (_Component) {
455
437
  key: "obtainLock",
456
438
  value: function obtainLock() {
457
439
  var _this7 = this;
458
-
459
440
  return this.props.submission ? lockSubmission({
460
441
  id: this.props.submission,
461
442
  datastore: this.props.datastore,
462
443
  options: this.props
463
444
  }).then(function (_ref10) {
464
445
  var submission = _ref10.submission,
465
- error = _ref10.error;
466
-
446
+ error = _ref10.error;
467
447
  if (submission) {
468
448
  _this7.setStateSafe({
469
449
  submission: submission,
470
450
  form: submission ? submission.form : null,
471
- lock: isLockable(submission, _this7.props) ? _objectSpread(_objectSpread({}, _this7.state.lock), {}, {
451
+ lock: isLockable(submission, _this7.props) ? (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _this7.state.lock), {}, {
472
452
  init: true,
473
453
  isExpiring: false,
474
454
  lockLost: false,
@@ -496,15 +476,13 @@ export var CoreFormComponent = /*#__PURE__*/function (_Component) {
496
476
  key: "releaseLock",
497
477
  value: function releaseLock() {
498
478
  var _this8 = this;
499
-
500
479
  var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
501
- _ref11$state = _ref11.state,
502
- state = _ref11$state === void 0 ? this.state : _ref11$state,
503
- _ref11$props = _ref11.props,
504
- props = _ref11$props === void 0 ? this.props : _ref11$props,
505
- _ref11$adminLockOverr = _ref11.adminLockOverride,
506
- adminLockOverride = _ref11$adminLockOverr === void 0 ? false : _ref11$adminLockOverr;
507
-
480
+ _ref11$state = _ref11.state,
481
+ state = _ref11$state === void 0 ? this.state : _ref11$state,
482
+ _ref11$props = _ref11.props,
483
+ props = _ref11$props === void 0 ? this.props : _ref11$props,
484
+ _ref11$adminLockOverr = _ref11.adminLockOverride,
485
+ adminLockOverride = _ref11$adminLockOverr === void 0 ? false : _ref11$adminLockOverr;
508
486
  var unmounting = arguments.length > 1 ? arguments[1] : undefined;
509
487
  return this.props.submission ? unlockSubmission({
510
488
  id: props.submission,
@@ -512,11 +490,10 @@ export var CoreFormComponent = /*#__PURE__*/function (_Component) {
512
490
  adminLockOverride: adminLockOverride
513
491
  }).then(function (submission, error) {
514
492
  clearInterval(state.lock.poller);
515
-
516
493
  if (!unmounting) {
517
494
  _this8.setStateSafe({
518
495
  submission: submission,
519
- lock: isLockable(submission, props) ? _objectSpread(_objectSpread({}, state.lock), {}, {
496
+ lock: isLockable(submission, props) ? (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state.lock), {}, {
520
497
  poller: null,
521
498
  isExpiring: false,
522
499
  isLocked: isLocked(submission, props),
@@ -568,7 +545,6 @@ export var CoreFormComponent = /*#__PURE__*/function (_Component) {
568
545
  this.globalsPromise = Promise.resolve();
569
546
  }
570
547
  }
571
-
572
548
  return this.globalsPromise;
573
549
  }
574
550
  }, {
@@ -584,15 +560,14 @@ export var CoreFormComponent = /*#__PURE__*/function (_Component) {
584
560
  key: "loadForm",
585
561
  value: function loadForm(props) {
586
562
  var _this9 = this;
587
-
588
563
  this.setStateSafe({
589
564
  pending: true,
590
565
  error: null
591
566
  });
592
567
  this.form = new Promise(function (resolve) {
593
568
  _this9.getGlobalsPromise().then(function () {
594
- K.load({
595
- path: "".concat(corePath(props), "?").concat(queryString(props, _this9.state)),
569
+ _helpers.K.load({
570
+ path: "".concat((0, _http.corePath)(props), "?").concat(queryString(props, _this9.state)),
596
571
  container: _this9.container,
597
572
  loaded: function loaded(form) {
598
573
  resolve(form);
@@ -602,12 +577,10 @@ export var CoreFormComponent = /*#__PURE__*/function (_Component) {
602
577
  }),
603
578
  reviewPages: form.displayablePages()
604
579
  } : {};
605
-
606
- _this9.setStateSafe(_objectSpread({
580
+ _this9.setStateSafe((0, _objectSpread2["default"])({
607
581
  pending: false,
608
582
  error: null
609
583
  }, reviewState));
610
-
611
584
  applyGuard(props.onLoaded || props.loaded, undefined, [form]);
612
585
  },
613
586
  unauthorized: function unauthorized() {
@@ -617,11 +590,9 @@ export var CoreFormComponent = /*#__PURE__*/function (_Component) {
617
590
  statusCode: 401
618
591
  }
619
592
  });
620
-
621
593
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
622
594
  args[_key] = arguments[_key];
623
595
  }
624
-
625
596
  applyGuard(props.onUnauthorized || props.unauthorized, undefined, args);
626
597
  },
627
598
  forbidden: function forbidden() {
@@ -631,11 +602,9 @@ export var CoreFormComponent = /*#__PURE__*/function (_Component) {
631
602
  statusCode: 403
632
603
  }
633
604
  });
634
-
635
605
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
636
606
  args[_key2] = arguments[_key2];
637
607
  }
638
-
639
608
  applyGuard(props.onForbidden || props.forbidden, undefined, args);
640
609
  },
641
610
  notFound: function notFound() {
@@ -645,11 +614,9 @@ export var CoreFormComponent = /*#__PURE__*/function (_Component) {
645
614
  statusCode: 404
646
615
  }
647
616
  });
648
-
649
617
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
650
618
  args[_key3] = arguments[_key3];
651
619
  }
652
-
653
620
  applyGuard(props.onNotFound || props.notFound, undefined, args);
654
621
  },
655
622
  error: function error() {
@@ -657,11 +624,9 @@ export var CoreFormComponent = /*#__PURE__*/function (_Component) {
657
624
  pending: false,
658
625
  error: _this9.state.error || {}
659
626
  });
660
-
661
627
  for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
662
628
  args[_key4] = arguments[_key4];
663
629
  }
664
-
665
630
  applyGuard(props.onError || props.error, undefined, args);
666
631
  },
667
632
  created: props.onCreated || props.created,
@@ -678,22 +643,19 @@ export var CoreFormComponent = /*#__PURE__*/function (_Component) {
678
643
  key: "render",
679
644
  value: function render() {
680
645
  var _this10 = this;
681
-
682
646
  var _this$props$component = this.props.components,
683
- Pending = _this$props$component.Pending,
684
- Unauthorized = _this$props$component.Unauthorized,
685
- Forbidden = _this$props$component.Forbidden,
686
- NotFound = _this$props$component.NotFound,
687
- Unexpected = _this$props$component.Unexpected,
688
- LockMessage = _this$props$component.LockMessage,
689
- ReviewPaginationControl = _this$props$component.ReviewPaginationControl,
690
- Layout = _this$props$component.Layout;
691
-
647
+ Pending = _this$props$component.Pending,
648
+ Unauthorized = _this$props$component.Unauthorized,
649
+ Forbidden = _this$props$component.Forbidden,
650
+ NotFound = _this$props$component.NotFound,
651
+ Unexpected = _this$props$component.Unexpected,
652
+ LockMessage = _this$props$component.LockMessage,
653
+ ReviewPaginationControl = _this$props$component.ReviewPaginationControl,
654
+ Layout = _this$props$component.Layout;
692
655
  var _ref12 = this.state.lock || {},
693
- init = _ref12.init,
694
- poller = _ref12.poller,
695
- lockProps = _objectWithoutProperties(_ref12, ["init", "poller"]);
696
-
656
+ init = _ref12.init,
657
+ poller = _ref12.poller,
658
+ lockProps = (0, _objectWithoutProperties2["default"])(_ref12, _excluded);
697
659
  var actions = {
698
660
  refreshSubmission: function refreshSubmission() {
699
661
  return _this10.pollSubmission();
@@ -716,30 +678,30 @@ export var CoreFormComponent = /*#__PURE__*/function (_Component) {
716
678
  return _this10.goToReviewPage(page);
717
679
  } : undefined
718
680
  };
719
- var lockMessage = /*#__PURE__*/React.createElement(LockMessage, {
681
+ var lockMessage = /*#__PURE__*/_react["default"].createElement(LockMessage, {
720
682
  lock: init ? lockProps : undefined,
721
683
  actions: actions
722
684
  });
723
- var reviewPaginationControl = !!this.props.review && !this.state.pending && !this.state.error && this.state.reviewPages.length > 1 ? /*#__PURE__*/React.createElement(ReviewPaginationControl, {
685
+ var reviewPaginationControl = !!this.props.review && !this.state.pending && !this.state.error && this.state.reviewPages.length > 1 ? /*#__PURE__*/_react["default"].createElement(ReviewPaginationControl, {
724
686
  pages: this.state.reviewPages,
725
687
  index: this.state.reviewPageIndex,
726
688
  actions: actions
727
689
  }) : null;
728
- var content = /*#__PURE__*/React.createElement("div", {
690
+ var content = /*#__PURE__*/_react["default"].createElement("div", {
729
691
  className: "embedded-core-form"
730
- }, !Layout && lockMessage, /*#__PURE__*/React.createElement("div", {
692
+ }, !Layout && lockMessage, /*#__PURE__*/_react["default"].createElement("div", {
731
693
  ref: this.handleRef,
732
694
  style: this.state.pending || this.state.error ? {
733
695
  display: 'none'
734
696
  } : {}
735
- }), this.state.pending && !this.state.error && /*#__PURE__*/React.createElement(Pending, null), this.state.error && (this.state.error.statusCode === 401 ? /*#__PURE__*/React.createElement(Unauthorized, {
697
+ }), this.state.pending && !this.state.error && /*#__PURE__*/_react["default"].createElement(Pending, null), this.state.error && (this.state.error.statusCode === 401 ? /*#__PURE__*/_react["default"].createElement(Unauthorized, {
736
698
  message: "You are unauthorized"
737
- }) : this.state.error.statusCode === 403 ? /*#__PURE__*/React.createElement(Forbidden, {
699
+ }) : this.state.error.statusCode === 403 ? /*#__PURE__*/_react["default"].createElement(Forbidden, {
738
700
  message: "You do not have access"
739
- }) : this.state.error.statusCode === 404 ? /*#__PURE__*/React.createElement(NotFound, {
701
+ }) : this.state.error.statusCode === 404 ? /*#__PURE__*/_react["default"].createElement(NotFound, {
740
702
  message: "".concat(this.props.submission ? 'Submission' : 'Form', " not found")
741
- }) : /*#__PURE__*/React.createElement(Unexpected, null)), !Layout && reviewPaginationControl);
742
- return Layout ? /*#__PURE__*/React.createElement(Layout, {
703
+ }) : /*#__PURE__*/_react["default"].createElement(Unexpected, null)), !Layout && reviewPaginationControl);
704
+ return Layout ? /*#__PURE__*/_react["default"].createElement(Layout, {
743
705
  submission: this.state.submission,
744
706
  form: this.state.form,
745
707
  error: this.state.error,
@@ -751,14 +713,12 @@ export var CoreFormComponent = /*#__PURE__*/function (_Component) {
751
713
  }) : content;
752
714
  }
753
715
  }]);
754
-
755
716
  return CoreFormComponent;
756
- }(Component);
757
-
717
+ }(_react.Component);
718
+ exports.CoreFormComponent = CoreFormComponent;
758
719
  var ContextCoreFormComponent = function ContextCoreFormComponent(_ref13) {
759
720
  var components = _ref13.components,
760
- props = _objectWithoutProperties(_ref13, ["components"]);
761
-
721
+ props = (0, _objectWithoutProperties2["default"])(_ref13, _excluded2);
762
722
  // Components passed in via deprecated props
763
723
  var deprecatedComponents = {
764
724
  Pending: props.pendingComponent,
@@ -770,148 +730,112 @@ var ContextCoreFormComponent = function ContextCoreFormComponent(_ref13) {
770
730
  ReviewPaginationControl: props.reviewPaginationControlComponent,
771
731
  Layout: props.layoutComponent
772
732
  };
773
- return /*#__PURE__*/React.createElement(GlobalsContext.Consumer, null, function (globals) {
774
- return /*#__PURE__*/React.createElement(ComponentConfigContext.Consumer, null, function (config) {
775
- return /*#__PURE__*/React.createElement(CoreFormComponent, Object.assign({}, props, {
776
- globals: globals // Override components. Start with RKL defaults, merge in defaults
733
+ return /*#__PURE__*/_react["default"].createElement(_globals.GlobalsContext.Consumer, null, function (globals) {
734
+ return /*#__PURE__*/_react["default"].createElement(_ComponentConfigContext.ComponentConfigContext.Consumer, null, function (config) {
735
+ return /*#__PURE__*/_react["default"].createElement(CoreFormComponent, Object.assign({}, props, {
736
+ globals: globals
737
+ // Override components. Start with RKL defaults, merge in defaults
777
738
  // passed into KineticLib, then merge in deprecated components,
778
739
  // and lastly merge in components prop.
779
740
  ,
780
- components: DefaultCoreFormConfig.merge(Map(get(config, 'coreForm', {}))).merge(Map(deprecatedComponents).filter(Boolean)).merge(Map(components || {}).filter(Boolean)).toObject()
741
+ components: _defaults.DefaultCoreFormConfig.merge((0, _immutable.Map)((0, _immutable.get)(config, 'coreForm', {}))).merge((0, _immutable.Map)(deprecatedComponents).filter(Boolean)).merge((0, _immutable.Map)(components || {}).filter(Boolean)).toObject()
781
742
  }));
782
743
  });
783
744
  });
784
745
  };
785
-
786
- export var CoreForm = connect(function (state) {
746
+ var CoreForm = (0, _store.connect)(function (state) {
787
747
  return {
788
748
  csrfToken: state.getIn(['session', 'csrfToken'])
789
749
  };
790
750
  })(ContextCoreFormComponent);
751
+ exports.CoreForm = CoreForm;
791
752
  CoreForm.propTypes = {
792
753
  /** Code to load prior to loading the form. */
793
- globals: t.oneOfType([t.func, t.instanceOf(Promise)]),
794
-
754
+ globals: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].instanceOf(Promise)]),
795
755
  /** Id of the submission to load. */
796
- submission: t.string,
797
-
756
+ submission: _propTypes["default"].string,
798
757
  /** Slug of the form to load if submission id is not provided. */
799
- formSlug: t.string,
800
-
758
+ formSlug: _propTypes["default"].string,
801
759
  /** Slug of the kapp which contains the form defined by formSlug. */
802
- kappSlug: t.string,
803
-
760
+ kappSlug: _propTypes["default"].string,
804
761
  /** Boolean determining if the form defined by formSlug is a datastore form. */
805
- datastore: t.bool,
806
-
762
+ datastore: _propTypes["default"].bool,
807
763
  /** Map of field values to pass to the form. */
808
- values: t.object,
809
-
764
+ values: _propTypes["default"].object,
810
765
  /** Boolean determining if the form should be opened in review mode, or name of the page to open in review mode */
811
- review: t.oneOfType([t.bool, t.string]),
812
-
766
+ review: _propTypes["default"].oneOfType([_propTypes["default"].bool, _propTypes["default"].string]),
813
767
  /** Boolean determining if the submission should be locked when opened. */
814
- lock: t.bool,
815
-
768
+ lock: _propTypes["default"].bool,
816
769
  /** Callback function that will execute when the form is loaded. */
817
- onLoaded: t.func,
818
- loaded: t.func,
819
-
770
+ onLoaded: _propTypes["default"].func,
771
+ loaded: _propTypes["default"].func,
820
772
  /** Callback function that will execute when the form returns a 401 error. */
821
- onUnauthorized: t.func,
822
- unauthorized: t.func,
823
-
773
+ onUnauthorized: _propTypes["default"].func,
774
+ unauthorized: _propTypes["default"].func,
824
775
  /** Callback function that will execute when the form returns a 403 error. */
825
- onForbidden: t.func,
826
- forbidden: t.func,
827
-
776
+ onForbidden: _propTypes["default"].func,
777
+ forbidden: _propTypes["default"].func,
828
778
  /** Callback function that will execute when the form returns a 404 error. */
829
- onNotFound: t.func,
830
- notFound: t.func,
831
-
779
+ onNotFound: _propTypes["default"].func,
780
+ notFound: _propTypes["default"].func,
832
781
  /** Callback function that will execute when the form returns any error. */
833
- onError: t.func,
834
- error: t.func,
835
-
782
+ onError: _propTypes["default"].func,
783
+ error: _propTypes["default"].func,
836
784
  /** Callback function that will execute when a submission is created. */
837
- onCreated: t.func,
838
- created: t.func,
839
-
785
+ onCreated: _propTypes["default"].func,
786
+ created: _propTypes["default"].func,
840
787
  /** Callback function that will execute when a submission is updated. */
841
- onUpdated: t.func,
842
- updated: t.func,
843
-
788
+ onUpdated: _propTypes["default"].func,
789
+ updated: _propTypes["default"].func,
844
790
  /** Callback function that will execute when a submission is completed. */
845
- onCompleted: t.func,
846
- completed: t.func,
847
-
791
+ onCompleted: _propTypes["default"].func,
792
+ completed: _propTypes["default"].func,
848
793
  /** */
849
- originId: t.string,
850
- parentId: t.string,
851
-
794
+ originId: _propTypes["default"].string,
795
+ parentId: _propTypes["default"].string,
852
796
  /** Component to display when the form is loading. (Deprecated: Use components prop.) */
853
- pendingComponent: t.func,
854
-
797
+ pendingComponent: _propTypes["default"].func,
855
798
  /** Component to display when the form returns a 401 error. (Deprecated: Use components prop.) */
856
- unauthorizedComponent: t.func,
857
-
799
+ unauthorizedComponent: _propTypes["default"].func,
858
800
  /** Component to display when the form returns a 403 error. (Deprecated: Use components prop.) */
859
- forbiddenComponent: t.func,
860
-
801
+ forbiddenComponent: _propTypes["default"].func,
861
802
  /** Component to display when the form returns a 404 error. (Deprecated: Use components prop.) */
862
- notFoundComponent: t.func,
863
-
803
+ notFoundComponent: _propTypes["default"].func,
864
804
  /** Component to display when the form returns any other error. (Deprecated: Use components prop.) */
865
- unexpectedErrorComponent: t.func,
866
-
805
+ unexpectedErrorComponent: _propTypes["default"].func,
867
806
  /** Component used to display the locking messages. (Deprecated: Use components prop.) */
868
- lockMessageComponent: t.func,
869
-
807
+ lockMessageComponent: _propTypes["default"].func,
870
808
  /** Component used to display the review pagination control. (Deprecated: Use components prop.) */
871
- reviewPaginationControlComponent: t.func,
872
-
809
+ reviewPaginationControlComponent: _propTypes["default"].func,
873
810
  /** Component used to display the entire content of the CoreForm. (Deprecated: Use components prop.) */
874
- layoutComponent: t.func,
875
-
811
+ layoutComponent: _propTypes["default"].func,
876
812
  /** Map of component overrides. */
877
- components: t.shape({
813
+ components: _propTypes["default"].shape({
878
814
  /** Override the loading state message. */
879
- Pending: t.func,
880
-
815
+ Pending: _propTypes["default"].func,
881
816
  /** Override the unauthorized error state message. */
882
- Unauthorized: t.func,
883
-
817
+ Unauthorized: _propTypes["default"].func,
884
818
  /** Override the forbidden error state message. */
885
- Forbidden: t.func,
886
-
819
+ Forbidden: _propTypes["default"].func,
887
820
  /** Override the unexpected error state message. */
888
- Unexpected: t.func,
889
-
821
+ Unexpected: _propTypes["default"].func,
890
822
  /** Override the not found error state message. */
891
- NotFound: t.func,
892
-
823
+ NotFound: _propTypes["default"].func,
893
824
  /** Override the lockMessage component shown when a form is lockable. */
894
- LockMessage: t.func,
895
-
825
+ LockMessage: _propTypes["default"].func,
896
826
  /** Override the reviewPaginationControl component shown when a form in review has multiple displayable pages. */
897
- ReviewPaginationControl: t.func,
898
-
827
+ ReviewPaginationControl: _propTypes["default"].func,
899
828
  /** Override the default form layout. */
900
- Layout: t.func
829
+ Layout: _propTypes["default"].func
901
830
  }),
902
-
903
831
  /** Name of field which should be used to store the locked by username. */
904
- lockedByField: t.string,
905
-
832
+ lockedByField: _propTypes["default"].string,
906
833
  /** Name of field which should be used to store the locked until value. */
907
- lockedUntilField: t.string,
908
-
834
+ lockedUntilField: _propTypes["default"].string,
909
835
  /** Name of attribute which stores the lock time value in seconds. */
910
- lockTimeAttribute: t.string,
911
-
836
+ lockTimeAttribute: _propTypes["default"].string,
912
837
  /** Name of attribute which stores the lock prompt time value in seconds. */
913
- lockPromptTimeAttribute: t.string,
914
-
838
+ lockPromptTimeAttribute: _propTypes["default"].string,
915
839
  /** Name of attribute which stores the lock check interval value in seconds. */
916
- lockCheckIntervalAttribute: t.string
840
+ lockCheckIntervalAttribute: _propTypes["default"].string
917
841
  };