@monkvision/common 4.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 (183) hide show
  1. package/LICENSE +32 -0
  2. package/README/APP_UTILS.md +52 -0
  3. package/README/HOOKS.md +242 -0
  4. package/README/INTERNATIONALIZATION.md +89 -0
  5. package/README/STATE_MANAGEMENT.md +125 -0
  6. package/README/THEMING.md +70 -0
  7. package/README/UTILITIES.md +254 -0
  8. package/README.md +23 -0
  9. package/lib/PreventExit/hooks.d.ts +15 -0
  10. package/lib/PreventExit/hooks.js +27 -0
  11. package/lib/PreventExit/hooks.js.map +1 -0
  12. package/lib/PreventExit/index.d.ts +1 -0
  13. package/lib/PreventExit/index.js +18 -0
  14. package/lib/PreventExit/index.js.map +1 -0
  15. package/lib/PreventExit/store.d.ts +23 -0
  16. package/lib/PreventExit/store.js +41 -0
  17. package/lib/PreventExit/store.js.map +1 -0
  18. package/lib/apps/analytics.d.ts +2 -0
  19. package/lib/apps/analytics.js +16 -0
  20. package/lib/apps/analytics.js.map +1 -0
  21. package/lib/apps/appState.d.ts +61 -0
  22. package/lib/apps/appState.js +11 -0
  23. package/lib/apps/appState.js.map +1 -0
  24. package/lib/apps/appStateProvider.d.ts +64 -0
  25. package/lib/apps/appStateProvider.js +116 -0
  26. package/lib/apps/appStateProvider.js.map +1 -0
  27. package/lib/apps/index.d.ts +3 -0
  28. package/lib/apps/index.js +20 -0
  29. package/lib/apps/index.js.map +1 -0
  30. package/lib/apps/monitoring.d.ts +2 -0
  31. package/lib/apps/monitoring.js +25 -0
  32. package/lib/apps/monitoring.js.map +1 -0
  33. package/lib/apps/searchParams.d.ts +60 -0
  34. package/lib/apps/searchParams.js +81 -0
  35. package/lib/apps/searchParams.js.map +1 -0
  36. package/lib/hooks/index.d.ts +12 -0
  37. package/lib/hooks/index.js +29 -0
  38. package/lib/hooks/index.js.map +1 -0
  39. package/lib/hooks/useAsyncEffect.d.ts +7 -0
  40. package/lib/hooks/useAsyncEffect.js +37 -0
  41. package/lib/hooks/useAsyncEffect.js.map +1 -0
  42. package/lib/hooks/useAsyncInterval.d.ts +7 -0
  43. package/lib/hooks/useAsyncInterval.js +54 -0
  44. package/lib/hooks/useAsyncInterval.js.map +1 -0
  45. package/lib/hooks/useInteractiveStatus.d.ts +52 -0
  46. package/lib/hooks/useInteractiveStatus.js +70 -0
  47. package/lib/hooks/useInteractiveStatus.js.map +1 -0
  48. package/lib/hooks/useInterval.d.ts +5 -0
  49. package/lib/hooks/useInterval.js +27 -0
  50. package/lib/hooks/useInterval.js.map +1 -0
  51. package/lib/hooks/useLoadingState.d.ts +33 -0
  52. package/lib/hooks/useLoadingState.js +36 -0
  53. package/lib/hooks/useLoadingState.js.map +1 -0
  54. package/lib/hooks/useObjectMemo.d.ts +12 -0
  55. package/lib/hooks/useObjectMemo.js +20 -0
  56. package/lib/hooks/useObjectMemo.js.map +1 -0
  57. package/lib/hooks/useObjectTranslation.d.ts +15 -0
  58. package/lib/hooks/useObjectTranslation.js +19 -0
  59. package/lib/hooks/useObjectTranslation.js.map +1 -0
  60. package/lib/hooks/useQueue.d.ts +152 -0
  61. package/lib/hooks/useQueue.js +194 -0
  62. package/lib/hooks/useQueue.js.map +1 -0
  63. package/lib/hooks/useResponsiveStyle.d.ts +28 -0
  64. package/lib/hooks/useResponsiveStyle.js +64 -0
  65. package/lib/hooks/useResponsiveStyle.js.map +1 -0
  66. package/lib/hooks/useSearchParams.d.ts +4 -0
  67. package/lib/hooks/useSearchParams.js +12 -0
  68. package/lib/hooks/useSearchParams.js.map +1 -0
  69. package/lib/hooks/useSightLabel.d.ts +21 -0
  70. package/lib/hooks/useSightLabel.js +19 -0
  71. package/lib/hooks/useSightLabel.js.map +1 -0
  72. package/lib/hooks/useWindowDimensions.d.ts +15 -0
  73. package/lib/hooks/useWindowDimensions.js +27 -0
  74. package/lib/hooks/useWindowDimensions.js.map +1 -0
  75. package/lib/i18n/index.d.ts +2 -0
  76. package/lib/i18n/index.js +19 -0
  77. package/lib/i18n/index.js.map +1 -0
  78. package/lib/i18n/translations/image.d.ts +22 -0
  79. package/lib/i18n/translations/image.js +408 -0
  80. package/lib/i18n/translations/image.js.map +1 -0
  81. package/lib/i18n/translations/index.d.ts +2 -0
  82. package/lib/i18n/translations/index.js +19 -0
  83. package/lib/i18n/translations/index.js.map +1 -0
  84. package/lib/i18n/translations/vehicleParts.d.ts +5 -0
  85. package/lib/i18n/translations/vehicleParts.js +461 -0
  86. package/lib/i18n/translations/vehicleParts.js.map +1 -0
  87. package/lib/i18n/utils.d.ts +45 -0
  88. package/lib/i18n/utils.js +86 -0
  89. package/lib/i18n/utils.js.map +1 -0
  90. package/lib/index.d.ts +7 -0
  91. package/lib/index.js +24 -0
  92. package/lib/index.js.map +1 -0
  93. package/lib/state/actions/createdOneImage.d.ts +44 -0
  94. package/lib/state/actions/createdOneImage.js +52 -0
  95. package/lib/state/actions/createdOneImage.js.map +1 -0
  96. package/lib/state/actions/gotOneInspection.d.ts +24 -0
  97. package/lib/state/actions/gotOneInspection.js +55 -0
  98. package/lib/state/actions/gotOneInspection.js.map +1 -0
  99. package/lib/state/actions/index.d.ts +6 -0
  100. package/lib/state/actions/index.js +23 -0
  101. package/lib/state/actions/index.js.map +1 -0
  102. package/lib/state/actions/monkAction.d.ts +34 -0
  103. package/lib/state/actions/monkAction.js +30 -0
  104. package/lib/state/actions/monkAction.js.map +1 -0
  105. package/lib/state/actions/resetState.d.ts +20 -0
  106. package/lib/state/actions/resetState.js +21 -0
  107. package/lib/state/actions/resetState.js.map +1 -0
  108. package/lib/state/actions/updatedManyTasks.d.ts +32 -0
  109. package/lib/state/actions/updatedManyTasks.js +47 -0
  110. package/lib/state/actions/updatedManyTasks.js.map +1 -0
  111. package/lib/state/actions/updatedVehicle.d.ts +38 -0
  112. package/lib/state/actions/updatedVehicle.js +50 -0
  113. package/lib/state/actions/updatedVehicle.js.map +1 -0
  114. package/lib/state/context.d.ts +21 -0
  115. package/lib/state/context.js +10 -0
  116. package/lib/state/context.js.map +1 -0
  117. package/lib/state/hooks.d.ts +8 -0
  118. package/lib/state/hooks.js +20 -0
  119. package/lib/state/hooks.js.map +1 -0
  120. package/lib/state/index.d.ts +6 -0
  121. package/lib/state/index.js +23 -0
  122. package/lib/state/index.js.map +1 -0
  123. package/lib/state/provider.d.ts +19 -0
  124. package/lib/state/provider.js +40 -0
  125. package/lib/state/provider.js.map +1 -0
  126. package/lib/state/reducer.d.ts +6 -0
  127. package/lib/state/reducer.js +24 -0
  128. package/lib/state/reducer.js.map +1 -0
  129. package/lib/state/state.d.ts +50 -0
  130. package/lib/state/state.js +22 -0
  131. package/lib/state/state.js.map +1 -0
  132. package/lib/theme/context.d.ts +5 -0
  133. package/lib/theme/context.js +10 -0
  134. package/lib/theme/context.js.map +1 -0
  135. package/lib/theme/default/index.d.ts +1 -0
  136. package/lib/theme/default/index.js +18 -0
  137. package/lib/theme/default/index.js.map +1 -0
  138. package/lib/theme/default/palette.d.ts +2 -0
  139. package/lib/theme/default/palette.js +69 -0
  140. package/lib/theme/default/palette.js.map +1 -0
  141. package/lib/theme/hooks.d.ts +5 -0
  142. package/lib/theme/hooks.js +13 -0
  143. package/lib/theme/hooks.js.map +1 -0
  144. package/lib/theme/index.d.ts +5 -0
  145. package/lib/theme/index.js +22 -0
  146. package/lib/theme/index.js.map +1 -0
  147. package/lib/theme/provider.d.ts +16 -0
  148. package/lib/theme/provider.js +29 -0
  149. package/lib/theme/provider.js.map +1 -0
  150. package/lib/theme/theme.d.ts +17 -0
  151. package/lib/theme/theme.js +54 -0
  152. package/lib/theme/theme.js.map +1 -0
  153. package/lib/utils/array.utils.d.ts +26 -0
  154. package/lib/utils/array.utils.js +75 -0
  155. package/lib/utils/array.utils.js.map +1 -0
  156. package/lib/utils/browser.utils.d.ts +4 -0
  157. package/lib/utils/browser.utils.js +16 -0
  158. package/lib/utils/browser.utils.js.map +1 -0
  159. package/lib/utils/color.utils.d.ts +51 -0
  160. package/lib/utils/color.utils.js +155 -0
  161. package/lib/utils/color.utils.js.map +1 -0
  162. package/lib/utils/env.utils.d.ts +5 -0
  163. package/lib/utils/env.utils.js +16 -0
  164. package/lib/utils/env.utils.js.map +1 -0
  165. package/lib/utils/index.d.ts +9 -0
  166. package/lib/utils/index.js +26 -0
  167. package/lib/utils/index.js.map +1 -0
  168. package/lib/utils/mimetype.utils.d.ts +14 -0
  169. package/lib/utils/mimetype.utils.js +69 -0
  170. package/lib/utils/mimetype.utils.js.map +1 -0
  171. package/lib/utils/promise.utils.d.ts +4 -0
  172. package/lib/utils/promise.utils.js +13 -0
  173. package/lib/utils/promise.utils.js.map +1 -0
  174. package/lib/utils/state.utils.d.ts +9 -0
  175. package/lib/utils/state.utils.js +35 -0
  176. package/lib/utils/state.utils.js.map +1 -0
  177. package/lib/utils/string.utils.d.ts +22 -0
  178. package/lib/utils/string.utils.js +48 -0
  179. package/lib/utils/string.utils.js.map +1 -0
  180. package/lib/utils/zlib.utils.d.ts +8 -0
  181. package/lib/utils/zlib.utils.js +30 -0
  182. package/lib/utils/zlib.utils.js.map +1 -0
  183. package/package.json +97 -0
@@ -0,0 +1,44 @@
1
+ import { Image } from '@monkvision/types';
2
+ import { MonkAction, MonkActionType } from './monkAction';
3
+ import { MonkState } from '../state';
4
+ /**
5
+ * The payload of a MonkCreatedOneImageAction.
6
+ */
7
+ export interface MonkCreatedOneImagePayload {
8
+ /**
9
+ * The ID of the inspection to which the image was added.
10
+ */
11
+ inspectionId: string;
12
+ /**
13
+ * The created image.
14
+ */
15
+ image: Image;
16
+ /**
17
+ * This ID is used when you first want to create the entity locally while you wait for the API to give you the true
18
+ * ID of the image. You first create the image with a custom local ID, then you dispatch the action a second time
19
+ * and specify this custom ID in the `localId` param. The image will then be updated instead of added.
20
+ */
21
+ localId?: string;
22
+ }
23
+ /**
24
+ * Action dispatched when an image has been uploaded to the API.
25
+ */
26
+ export interface MonkCreatedOneImageAction extends MonkAction {
27
+ /**
28
+ * The type of the action : `MonkActionType.CREATED_ONE_IMAGE`.
29
+ */
30
+ type: MonkActionType.CREATED_ONE_IMAGE;
31
+ /**
32
+ * The payload of the action.
33
+ */
34
+ payload: MonkCreatedOneImagePayload;
35
+ }
36
+ /**
37
+ * Matcher function that matches a CreatedOneImage while also inferring its type using TypeScript's type predicate
38
+ * feature.
39
+ */
40
+ export declare function isCreatedOneImageAction(action: MonkAction): action is MonkCreatedOneImageAction;
41
+ /**
42
+ * Reducer function for a CreatedOneImage action.
43
+ */
44
+ export declare function createdOneImage(state: MonkState, action: MonkCreatedOneImageAction): MonkState;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
+ if (ar || !(i in from)) {
16
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17
+ ar[i] = from[i];
18
+ }
19
+ }
20
+ return to.concat(ar || Array.prototype.slice.call(from));
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.createdOneImage = exports.isCreatedOneImageAction = void 0;
24
+ var monkAction_1 = require("./monkAction");
25
+ /**
26
+ * Matcher function that matches a CreatedOneImage while also inferring its type using TypeScript's type predicate
27
+ * feature.
28
+ */
29
+ function isCreatedOneImageAction(action) {
30
+ return action.type === monkAction_1.MonkActionType.CREATED_ONE_IMAGE;
31
+ }
32
+ exports.isCreatedOneImageAction = isCreatedOneImageAction;
33
+ /**
34
+ * Reducer function for a CreatedOneImage action.
35
+ */
36
+ function createdOneImage(state, action) {
37
+ var inspections = state.inspections;
38
+ var localImage = state.images.find(function (image) { return image.id === action.payload.localId; });
39
+ if (localImage) {
40
+ URL.revokeObjectURL(localImage.path);
41
+ }
42
+ var images = state.images.filter(function (image) { return ![action.payload.image.id, action.payload.localId].includes(image.id); });
43
+ images.push(action.payload.image);
44
+ var imageInspection = inspections.find(function (inspection) { return inspection.id === action.payload.inspectionId; });
45
+ if (imageInspection) {
46
+ imageInspection.images = imageInspection.images.filter(function (imageId) { return ![action.payload.image.id, action.payload.localId].includes(imageId); });
47
+ imageInspection.images.push(action.payload.image.id);
48
+ }
49
+ return __assign(__assign({}, state), { inspections: __spreadArray([], inspections, true), images: __spreadArray([], images, true) });
50
+ }
51
+ exports.createdOneImage = createdOneImage;
52
+ //# sourceMappingURL=createdOneImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createdOneImage.js","sourceRoot":"","sources":["../../../src/state/actions/createdOneImage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA0D;AAqC1D;;;GAGG;AACH,SAAgB,uBAAuB,CAAC,MAAkB;IACxD,OAAO,MAAM,CAAC,IAAI,KAAK,2BAAc,CAAC,iBAAiB,CAAC;AAC1D,CAAC;AAFD,0DAEC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,KAAgB,EAAE,MAAiC;IACzE,IAAA,WAAW,GAAK,KAAK,YAAV,CAAW;IAC9B,IAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,UAAC,KAAK,IAAK,OAAA,KAAK,CAAC,EAAE,KAAK,MAAM,CAAC,OAAO,CAAC,OAAO,EAAnC,CAAmC,CAAC,CAAC;IACrF,IAAI,UAAU,EAAE;QACd,GAAG,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;KACtC;IACD,IAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAChC,UAAC,KAAK,IAAK,OAAA,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,EAArE,CAAqE,CACjF,CAAC;IACF,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAClC,IAAM,eAAe,GAAG,WAAW,CAAC,IAAI,CACtC,UAAC,UAAU,IAAK,OAAA,UAAU,CAAC,EAAE,KAAK,MAAM,CAAC,OAAO,CAAC,YAAY,EAA7C,CAA6C,CAC9D,CAAC;IACF,IAAI,eAAe,EAAE;QACnB,eAAe,CAAC,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,MAAM,CACpD,UAAC,OAAO,IAAK,OAAA,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAApE,CAAoE,CAClF,CAAC;QACF,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;KACtD;IACD,6BACK,KAAK,KACR,WAAW,oBAAM,WAAW,SAC5B,MAAM,oBAAM,MAAM,WAClB;AACJ,CAAC;AAxBD,0CAwBC"}
@@ -0,0 +1,24 @@
1
+ import { MonkState } from '../state';
2
+ import { MonkAction, MonkActionType } from './monkAction';
3
+ /**
4
+ * Action dispatched when an inspection has been fetched from the API.
5
+ */
6
+ export interface MonkGotOneInspectionAction extends MonkAction {
7
+ /**
8
+ * The type of the action : `MonkActionType.GOT_ONE_INSPECTION`.
9
+ */
10
+ type: MonkActionType.GOT_ONE_INSPECTION;
11
+ /**
12
+ * The payload of the action containing the fetched entities.
13
+ */
14
+ payload: Partial<MonkState>;
15
+ }
16
+ /**
17
+ * Matcher function that matches a GotOneInspection while also inferring its type using TypeScript's type predicate
18
+ * feature.
19
+ */
20
+ export declare function isGotOneInspectionAction(action: MonkAction): action is MonkGotOneInspectionAction;
21
+ /**
22
+ * Reducer function for a GotOneInspection action.
23
+ */
24
+ export declare function gotOneInspection(state: MonkState, action: MonkGotOneInspectionAction): MonkState;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
+ if (ar || !(i in from)) {
16
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17
+ ar[i] = from[i];
18
+ }
19
+ }
20
+ return to.concat(ar || Array.prototype.slice.call(from));
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.gotOneInspection = exports.isGotOneInspectionAction = void 0;
24
+ var monkAction_1 = require("./monkAction");
25
+ /**
26
+ * Matcher function that matches a GotOneInspection while also inferring its type using TypeScript's type predicate
27
+ * feature.
28
+ */
29
+ function isGotOneInspectionAction(action) {
30
+ return action.type === monkAction_1.MonkActionType.GOT_ONE_INSPECTION;
31
+ }
32
+ exports.isGotOneInspectionAction = isGotOneInspectionAction;
33
+ /**
34
+ * Reducer function for a GotOneInspection action.
35
+ */
36
+ function gotOneInspection(state, action) {
37
+ var newState = __assign({}, state);
38
+ Object.keys(state).forEach(function (key) {
39
+ var _a;
40
+ var entityKey = key;
41
+ newState[entityKey] = __spreadArray([], newState[entityKey], true);
42
+ (_a = action.payload[entityKey]) === null || _a === void 0 ? void 0 : _a.forEach(function (payloadEntity) {
43
+ var newEntityIndex = state[entityKey].findIndex(function (newEntity) { return newEntity.id === payloadEntity.id; });
44
+ if (newEntityIndex !== -1) {
45
+ newState[entityKey][newEntityIndex] = payloadEntity;
46
+ }
47
+ else {
48
+ newState[entityKey].push(payloadEntity);
49
+ }
50
+ });
51
+ });
52
+ return newState;
53
+ }
54
+ exports.gotOneInspection = gotOneInspection;
55
+ //# sourceMappingURL=gotOneInspection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gotOneInspection.js","sourceRoot":"","sources":["../../../src/state/actions/gotOneInspection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAEA,2CAA0D;AAgB1D;;;GAGG;AACH,SAAgB,wBAAwB,CAAC,MAAkB;IACzD,OAAO,MAAM,CAAC,IAAI,KAAK,2BAAc,CAAC,kBAAkB,CAAC;AAC3D,CAAC;AAFD,4DAEC;AAED;;GAEG;AACH,SAAgB,gBAAgB,CAAC,KAAgB,EAAE,MAAkC;IACnF,IAAM,QAAQ,gBAAQ,KAAK,CAAE,CAAC;IAC9B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,UAAC,GAAW;;QACrC,IAAM,SAAS,GAAG,GAAsB,CAAC;QACzC,QAAQ,CAAC,SAAS,CAAC,GAAG,kBAAI,QAAQ,CAAC,SAAS,CAAC,OAAU,CAAC;QACxD,MAAA,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,0CAAE,OAAO,CAAC,UAAC,aAAa;YAC/C,IAAM,cAAc,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,SAAS,CAC/C,UAAC,SAAS,IAAK,OAAA,SAAS,CAAC,EAAE,KAAK,aAAa,CAAC,EAAE,EAAjC,CAAiC,CACjD,CAAC;YACF,IAAI,cAAc,KAAK,CAAC,CAAC,EAAE;gBACxB,QAAQ,CAAC,SAAS,CAAkB,CAAC,cAAc,CAAC,GAAG,aAAa,CAAC;aACvE;iBAAM;gBACJ,QAAQ,CAAC,SAAS,CAAkB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;aAC3D;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC;AAjBD,4CAiBC"}
@@ -0,0 +1,6 @@
1
+ export * from './monkAction';
2
+ export * from './resetState';
3
+ export * from './gotOneInspection';
4
+ export * from './createdOneImage';
5
+ export * from './updatedManyTasks';
6
+ export * from './updatedVehicle';
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./monkAction"), exports);
18
+ __exportStar(require("./resetState"), exports);
19
+ __exportStar(require("./gotOneInspection"), exports);
20
+ __exportStar(require("./createdOneImage"), exports);
21
+ __exportStar(require("./updatedManyTasks"), exports);
22
+ __exportStar(require("./updatedVehicle"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/state/actions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,+CAA6B;AAC7B,qDAAmC;AACnC,oDAAkC;AAClC,qDAAmC;AACnC,mDAAiC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Enumeration of the types of action that can be dispatched in the Monk state.
3
+ */
4
+ export declare enum MonkActionType {
5
+ /**
6
+ * An inspection has been fetched from the API.
7
+ */
8
+ GOT_ONE_INSPECTION = "got_one_inspection",
9
+ /**
10
+ * An image has been uploaded to the API.
11
+ */
12
+ CREATED_ONE_IMAGE = "created_one_image",
13
+ /**
14
+ * One or more tasks have been updated.
15
+ */
16
+ UPDATED_MANY_TASKS = "updated_many_tasks",
17
+ /**
18
+ * Clear and reset the state.
19
+ */
20
+ RESET_STATE = "reset_state",
21
+ /**
22
+ * A vehicle has been updated.
23
+ */
24
+ UPDATED_VEHICLE = "updated_vehicle"
25
+ }
26
+ /**
27
+ * Type definition for a generic action dispatched in the Monk state.
28
+ */
29
+ export interface MonkAction {
30
+ /**
31
+ * The type of the action.
32
+ */
33
+ type: MonkActionType;
34
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MonkActionType = void 0;
4
+ /**
5
+ * Enumeration of the types of action that can be dispatched in the Monk state.
6
+ */
7
+ var MonkActionType;
8
+ (function (MonkActionType) {
9
+ /**
10
+ * An inspection has been fetched from the API.
11
+ */
12
+ MonkActionType["GOT_ONE_INSPECTION"] = "got_one_inspection";
13
+ /**
14
+ * An image has been uploaded to the API.
15
+ */
16
+ MonkActionType["CREATED_ONE_IMAGE"] = "created_one_image";
17
+ /**
18
+ * One or more tasks have been updated.
19
+ */
20
+ MonkActionType["UPDATED_MANY_TASKS"] = "updated_many_tasks";
21
+ /**
22
+ * Clear and reset the state.
23
+ */
24
+ MonkActionType["RESET_STATE"] = "reset_state";
25
+ /**
26
+ * A vehicle has been updated.
27
+ */
28
+ MonkActionType["UPDATED_VEHICLE"] = "updated_vehicle";
29
+ })(MonkActionType = exports.MonkActionType || (exports.MonkActionType = {}));
30
+ //# sourceMappingURL=monkAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monkAction.js","sourceRoot":"","sources":["../../../src/state/actions/monkAction.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,cAqBX;AArBD,WAAY,cAAc;IACxB;;OAEG;IACH,2DAAyC,CAAA;IACzC;;OAEG;IACH,yDAAuC,CAAA;IACvC;;OAEG;IACH,2DAAyC,CAAA;IACzC;;OAEG;IACH,6CAA2B,CAAA;IAC3B;;OAEG;IACH,qDAAmC,CAAA;AACrC,CAAC,EArBW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAqBzB"}
@@ -0,0 +1,20 @@
1
+ import { MonkAction, MonkActionType } from './monkAction';
2
+ import { MonkState } from '../state';
3
+ /**
4
+ * Action dispatched when the state needs to be reset.
5
+ */
6
+ export interface MonkResetStateAction extends MonkAction {
7
+ /**
8
+ * The type of the action : `MonkActionType.RESET_STATE`.
9
+ */
10
+ type: MonkActionType.RESET_STATE;
11
+ }
12
+ /**
13
+ * Matcher function that matches a MonkGotOneAction while also inferring its type using TypeScript's type predicate
14
+ * feature.
15
+ */
16
+ export declare function isResetStateAction(action: MonkAction): action is MonkResetStateAction;
17
+ /**
18
+ * Reducer function for a ResetState action.
19
+ */
20
+ export declare function resetState(): MonkState;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resetState = exports.isResetStateAction = void 0;
4
+ var monkAction_1 = require("./monkAction");
5
+ var state_1 = require("../state");
6
+ /**
7
+ * Matcher function that matches a MonkGotOneAction while also inferring its type using TypeScript's type predicate
8
+ * feature.
9
+ */
10
+ function isResetStateAction(action) {
11
+ return action.type === monkAction_1.MonkActionType.RESET_STATE;
12
+ }
13
+ exports.isResetStateAction = isResetStateAction;
14
+ /**
15
+ * Reducer function for a ResetState action.
16
+ */
17
+ function resetState() {
18
+ return (0, state_1.createEmptyMonkState)();
19
+ }
20
+ exports.resetState = resetState;
21
+ //# sourceMappingURL=resetState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resetState.js","sourceRoot":"","sources":["../../../src/state/actions/resetState.ts"],"names":[],"mappings":";;;AAAA,2CAA0D;AAC1D,kCAA2D;AAY3D;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,MAAkB;IACnD,OAAO,MAAM,CAAC,IAAI,KAAK,2BAAc,CAAC,WAAW,CAAC;AACpD,CAAC;AAFD,gDAEC;AAED;;GAEG;AACH,SAAgB,UAAU;IACxB,OAAO,IAAA,4BAAoB,GAAE,CAAC;AAChC,CAAC;AAFD,gCAEC"}
@@ -0,0 +1,32 @@
1
+ import { ProgressStatus } from '@monkvision/types';
2
+ import { MonkAction, MonkActionType } from './monkAction';
3
+ import { MonkState } from '../state';
4
+ /**
5
+ * Details about a task which status has been updated.
6
+ */
7
+ export interface UpdatedTask {
8
+ id: string;
9
+ status: ProgressStatus;
10
+ }
11
+ /**
12
+ * Action dispatched when the status of multiple tasks have been updated.
13
+ */
14
+ export interface MonkUpdatedManyTasksAction extends MonkAction {
15
+ /**
16
+ * The type of the action : `MonkActionType.UPDATED_ONE_TASK`.
17
+ */
18
+ type: MonkActionType.UPDATED_MANY_TASKS;
19
+ /**
20
+ * The payload of the action.
21
+ */
22
+ payload: UpdatedTask[];
23
+ }
24
+ /**
25
+ * Matcher function that matches a UpdatedManyTasksAction while also inferring its type using TypeScript's type
26
+ * predicate feature.
27
+ */
28
+ export declare function isUpdatedManyTasksAction(action: MonkAction): action is MonkUpdatedManyTasksAction;
29
+ /**
30
+ * Reducer function for an UpdatedManyTasks action.
31
+ */
32
+ export declare function updatedManyTasks(state: MonkState, action: MonkUpdatedManyTasksAction): MonkState;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
+ if (ar || !(i in from)) {
16
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17
+ ar[i] = from[i];
18
+ }
19
+ }
20
+ return to.concat(ar || Array.prototype.slice.call(from));
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.updatedManyTasks = exports.isUpdatedManyTasksAction = void 0;
24
+ var monkAction_1 = require("./monkAction");
25
+ /**
26
+ * Matcher function that matches a UpdatedManyTasksAction while also inferring its type using TypeScript's type
27
+ * predicate feature.
28
+ */
29
+ function isUpdatedManyTasksAction(action) {
30
+ return action.type === monkAction_1.MonkActionType.UPDATED_MANY_TASKS;
31
+ }
32
+ exports.isUpdatedManyTasksAction = isUpdatedManyTasksAction;
33
+ /**
34
+ * Reducer function for an UpdatedManyTasks action.
35
+ */
36
+ function updatedManyTasks(state, action) {
37
+ var tasks = state.tasks;
38
+ action.payload.forEach(function (task) {
39
+ var taskToUpdate = tasks.find(function (t) { return t.id === task.id; });
40
+ if (taskToUpdate) {
41
+ taskToUpdate.status = task.status;
42
+ }
43
+ });
44
+ return __assign(__assign({}, state), { tasks: __spreadArray([], tasks, true) });
45
+ }
46
+ exports.updatedManyTasks = updatedManyTasks;
47
+ //# sourceMappingURL=updatedManyTasks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updatedManyTasks.js","sourceRoot":"","sources":["../../../src/state/actions/updatedManyTasks.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA0D;AAyB1D;;;GAGG;AACH,SAAgB,wBAAwB,CAAC,MAAkB;IACzD,OAAO,MAAM,CAAC,IAAI,KAAK,2BAAc,CAAC,kBAAkB,CAAC;AAC3D,CAAC;AAFD,4DAEC;AAED;;GAEG;AACH,SAAgB,gBAAgB,CAAC,KAAgB,EAAE,MAAkC;IAC3E,IAAA,KAAK,GAAK,KAAK,MAAV,CAAW;IACxB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,UAAC,IAAI;QAC1B,IAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,EAAhB,CAAgB,CAAC,CAAC;QACzD,IAAI,YAAY,EAAE;YAChB,YAAY,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;SACnC;IACH,CAAC,CAAC,CAAC;IACH,6BACK,KAAK,KACR,KAAK,oBAAM,KAAK,WAChB;AACJ,CAAC;AAZD,4CAYC"}
@@ -0,0 +1,38 @@
1
+ import { Vehicle } from '@monkvision/types';
2
+ import { MonkAction, MonkActionType } from './monkAction';
3
+ import { MonkState } from '../state';
4
+ /**
5
+ * The payload of a MonkUpdatedVehicleAction.
6
+ */
7
+ export interface MonkUpdatedVehiclePayload {
8
+ /**
9
+ * The ID of the inspection to which the vehicle was updated.
10
+ */
11
+ inspectionId: string;
12
+ /**
13
+ * The updated vehicle.
14
+ */
15
+ vehicle: Vehicle;
16
+ }
17
+ /**
18
+ * Action dispatched when a vehicle have been updated.
19
+ */
20
+ export interface MonkUpdatedVehicleAction extends MonkAction {
21
+ /**
22
+ * The type of the action : `MonkActionType.UPDATED_VEHICLE`.
23
+ */
24
+ type: MonkActionType.UPDATED_VEHICLE;
25
+ /**
26
+ * The payload of the action containing the fetched entities.
27
+ */
28
+ payload: MonkUpdatedVehiclePayload;
29
+ }
30
+ /**
31
+ * Matcher function that matches a UpdatedVehicle while also inferring its type using TypeScript's type predicate
32
+ * feature.
33
+ */
34
+ export declare function isUpdatedVehicleAction(action: MonkAction): action is MonkUpdatedVehicleAction;
35
+ /**
36
+ * Reducer function for a UpdatedVehicle action.
37
+ */
38
+ export declare function updatedVehicle(state: MonkState, action: MonkUpdatedVehicleAction): MonkState;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
+ if (ar || !(i in from)) {
16
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17
+ ar[i] = from[i];
18
+ }
19
+ }
20
+ return to.concat(ar || Array.prototype.slice.call(from));
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.updatedVehicle = exports.isUpdatedVehicleAction = void 0;
24
+ var monkAction_1 = require("./monkAction");
25
+ /**
26
+ * Matcher function that matches a UpdatedVehicle while also inferring its type using TypeScript's type predicate
27
+ * feature.
28
+ */
29
+ function isUpdatedVehicleAction(action) {
30
+ return action.type === monkAction_1.MonkActionType.UPDATED_VEHICLE;
31
+ }
32
+ exports.isUpdatedVehicleAction = isUpdatedVehicleAction;
33
+ /**
34
+ * Reducer function for a UpdatedVehicle action.
35
+ */
36
+ function updatedVehicle(state, action) {
37
+ var vehicles = state.vehicles, inspections = state.inspections;
38
+ var inspection = inspections.find(function (value) { return value.id === action.payload.inspectionId; });
39
+ var isVehiculeIdMatching = (inspection === null || inspection === void 0 ? void 0 : inspection.vehicle) === action.payload.vehicle.id;
40
+ if (inspection && !isVehiculeIdMatching) {
41
+ inspection.vehicle = action.payload.vehicle.id;
42
+ }
43
+ var index = vehicles.findIndex(function (vehicle) { return vehicle.id === action.payload.vehicle.id; });
44
+ if (index >= 0) {
45
+ vehicles[index] = action.payload.vehicle;
46
+ }
47
+ return __assign(__assign({}, state), { vehicles: __spreadArray([], vehicles, true) });
48
+ }
49
+ exports.updatedVehicle = updatedVehicle;
50
+ //# sourceMappingURL=updatedVehicle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updatedVehicle.js","sourceRoot":"","sources":["../../../src/state/actions/updatedVehicle.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA0D;AA+B1D;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,MAAkB;IACvD,OAAO,MAAM,CAAC,IAAI,KAAK,2BAAc,CAAC,eAAe,CAAC;AACxD,CAAC;AAFD,wDAEC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,KAAgB,EAAE,MAAgC;IACvE,IAAA,QAAQ,GAAkB,KAAK,SAAvB,EAAE,WAAW,GAAK,KAAK,YAAV,CAAW;IAExC,IAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,UAAC,KAAK,IAAK,OAAA,KAAK,CAAC,EAAE,KAAK,MAAM,CAAC,OAAO,CAAC,YAAY,EAAxC,CAAwC,CAAC,CAAC;IACzF,IAAM,oBAAoB,GAAG,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,OAAO,MAAK,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;IAE/E,IAAI,UAAU,IAAI,CAAC,oBAAoB,EAAE;QACvC,UAAU,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;KAChD;IAED,IAAM,KAAK,GAAG,QAAQ,CAAC,SAAS,CAAC,UAAC,OAAO,IAAK,OAAA,OAAO,CAAC,EAAE,KAAK,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAxC,CAAwC,CAAC,CAAC;IACxF,IAAI,KAAK,IAAI,CAAC,EAAE;QACd,QAAQ,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;KAC1C;IAED,6BACK,KAAK,KACR,QAAQ,oBAAM,QAAQ,WACtB;AACJ,CAAC;AAnBD,wCAmBC"}
@@ -0,0 +1,21 @@
1
+ import { Dispatch } from 'react';
2
+ import { MonkAction } from './actions';
3
+ import { MonkState } from './state';
4
+ /**
5
+ * An object that wraps the Monk state as well as its dispatch function.
6
+ */
7
+ export interface MonkStateWithDispatch {
8
+ /**
9
+ * The state of all the Monk entities.
10
+ */
11
+ state: MonkState;
12
+ /**
13
+ * The dispatch function used to dispatch actions to modify the state.
14
+ */
15
+ dispatch: Dispatch<MonkAction>;
16
+ }
17
+ /**
18
+ * A React Context that contains the Monk state as well as its dispatch function. If no MonkProvider was defined above,
19
+ * the default value is `null`.
20
+ */
21
+ export declare const MonkContext: import("react").Context<MonkStateWithDispatch | null>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MonkContext = void 0;
4
+ var react_1 = require("react");
5
+ /**
6
+ * A React Context that contains the Monk state as well as its dispatch function. If no MonkProvider was defined above,
7
+ * the default value is `null`.
8
+ */
9
+ exports.MonkContext = (0, react_1.createContext)(null);
10
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/state/context.ts"],"names":[],"mappings":";;;AAAA,+BAAgD;AAkBhD;;;GAGG;AACU,QAAA,WAAW,GAAG,IAAA,qBAAa,EAA+B,IAAI,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { MonkStateWithDispatch } from './context';
2
+ /**
3
+ * Custom hook that allows you to access the Monk State Context methods inside a component.
4
+ *
5
+ * Note : If this hook is called inside a component that is not a child of a MonkProvider component, it will throw an
6
+ * error.
7
+ */
8
+ export declare function useMonkState(): MonkStateWithDispatch;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useMonkState = void 0;
4
+ var react_1 = require("react");
5
+ var context_1 = require("./context");
6
+ /**
7
+ * Custom hook that allows you to access the Monk State Context methods inside a component.
8
+ *
9
+ * Note : If this hook is called inside a component that is not a child of a MonkProvider component, it will throw an
10
+ * error.
11
+ */
12
+ function useMonkState() {
13
+ var stateWithDispatch = (0, react_1.useContext)(context_1.MonkContext);
14
+ if (!stateWithDispatch) {
15
+ throw new Error('MonkContext not initialized! Did you make a call to `useMonkState()` without initializing the MonkContext in a parent component?');
16
+ }
17
+ return stateWithDispatch;
18
+ }
19
+ exports.useMonkState = useMonkState;
20
+ //# sourceMappingURL=hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/state/hooks.ts"],"names":[],"mappings":";;;AAAA,+BAAmC;AACnC,qCAA+D;AAE/D;;;;;GAKG;AACH,SAAgB,YAAY;IAC1B,IAAM,iBAAiB,GAAG,IAAA,kBAAU,EAAC,qBAAW,CAAC,CAAC;IAElD,IAAI,CAAC,iBAAiB,EAAE;QACtB,MAAM,IAAI,KAAK,CACb,kIAAkI,CACnI,CAAC;KACH;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAVD,oCAUC"}
@@ -0,0 +1,6 @@
1
+ export * from './actions';
2
+ export * from './context';
3
+ export * from './hooks';
4
+ export * from './provider';
5
+ export * from './reducer';
6
+ export * from './state';
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./actions"), exports);
18
+ __exportStar(require("./context"), exports);
19
+ __exportStar(require("./hooks"), exports);
20
+ __exportStar(require("./provider"), exports);
21
+ __exportStar(require("./reducer"), exports);
22
+ __exportStar(require("./state"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,4CAA0B;AAC1B,0CAAwB;AACxB,6CAA2B;AAC3B,4CAA0B;AAC1B,0CAAwB"}
@@ -0,0 +1,19 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { MonkState } from './state';
3
+ /**
4
+ * Prop types of the MonkProvider component.
5
+ */
6
+ export interface MonkProviderProps {
7
+ /**
8
+ * Optional initial state that you can pass to the MonkProvider component.
9
+ */
10
+ initialState?: Partial<MonkState>;
11
+ }
12
+ /**
13
+ * Context provider for the Monk Context. Place this at the root of your application in order to initialize the Monk
14
+ * state in your app and get access to the dispatch function.
15
+ *
16
+ * ***Important Note :*** If this provider component is placed in a component which is already a child of a
17
+ * MonkProvider, this provider will have no effect. Only the FIRST MonkProvider has any effect.
18
+ */
19
+ export declare function MonkProvider({ initialState, children }: PropsWithChildren<MonkProviderProps>): JSX.Element;