@monkvision/common 4.4.3 → 4.4.4

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.
@@ -0,0 +1,37 @@
1
+ import { MonkAction, MonkActionType } from './monkAction';
2
+ import { MonkState } from '../state';
3
+ /**
4
+ * The payload of a MonkGotOneInspectionPdfPayload.
5
+ */
6
+ export interface MonkGotOneInspectionPdfPayload {
7
+ /**
8
+ * The ID of the inspection to which the PDF was fetched.
9
+ */
10
+ inspectionId: string;
11
+ /**
12
+ * The URL of the PDF.
13
+ */
14
+ pdfUrl: string;
15
+ }
16
+ /**
17
+ * Action dispatched when a inspection PDF has been fetched.
18
+ */
19
+ export interface MonkGotOneInspectionPdfAction extends MonkAction {
20
+ /**
21
+ * The type of the action : `MonkActionType.GOT_ONE_INSPECTION_PDF`.
22
+ */
23
+ type: MonkActionType.GOT_ONE_INSPECTION_PDF;
24
+ /**
25
+ * The payload of the action containing the fetched entities.
26
+ */
27
+ payload: MonkGotOneInspectionPdfPayload;
28
+ }
29
+ /**
30
+ * Matcher function that matches a GotOneInspection while also inferring its type using TypeScript's type predicate
31
+ * feature.
32
+ */
33
+ export declare function isGotOneInspectionPdfAction(action: MonkAction): action is MonkGotOneInspectionPdfAction;
34
+ /**
35
+ * Reducer function for a GotOneInspection action.
36
+ */
37
+ export declare function gotOneInspectionPdf(state: MonkState, action: MonkGotOneInspectionPdfAction): MonkState;
@@ -0,0 +1,45 @@
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.gotOneInspectionPdf = exports.isGotOneInspectionPdfAction = 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 isGotOneInspectionPdfAction(action) {
30
+ return action.type === monkAction_1.MonkActionType.GOT_ONE_INSPECTION_PDF;
31
+ }
32
+ exports.isGotOneInspectionPdfAction = isGotOneInspectionPdfAction;
33
+ /**
34
+ * Reducer function for a GotOneInspection action.
35
+ */
36
+ function gotOneInspectionPdf(state, action) {
37
+ var inspections = state.inspections;
38
+ var payload = action.payload;
39
+ var inspection = inspections.find(function (value) { return value.id === payload.inspectionId; });
40
+ if (inspection) {
41
+ inspection.pdfUrl = payload.pdfUrl;
42
+ }
43
+ return __assign(__assign({}, state), { inspections: __spreadArray([], inspections, true) });
44
+ }
45
+ exports.gotOneInspectionPdf = gotOneInspectionPdf;
@@ -10,3 +10,4 @@ export * from './updatedOnePricing';
10
10
  export * from './updatedOneInspectionAdditionalData';
11
11
  export * from './createdOneDamage';
12
12
  export * from './deletedOneDamage';
13
+ export * from './gotOneInspectionPdf';
@@ -26,3 +26,4 @@ __exportStar(require("./updatedOnePricing"), exports);
26
26
  __exportStar(require("./updatedOneInspectionAdditionalData"), exports);
27
27
  __exportStar(require("./createdOneDamage"), exports);
28
28
  __exportStar(require("./deletedOneDamage"), exports);
29
+ __exportStar(require("./gotOneInspectionPdf"), exports);
@@ -45,7 +45,11 @@ export declare enum MonkActionType {
45
45
  /**
46
46
  * Clear and reset the state.
47
47
  */
48
- RESET_STATE = "reset_state"
48
+ RESET_STATE = "reset_state",
49
+ /**
50
+ * An inspection PDF has been fetched from the API.
51
+ */
52
+ GOT_ONE_INSPECTION_PDF = "got_one_inspection_pdf"
49
53
  }
50
54
  /**
51
55
  * Type definition for a generic action dispatched in the Monk state.
@@ -50,4 +50,8 @@ var MonkActionType;
50
50
  * Clear and reset the state.
51
51
  */
52
52
  MonkActionType["RESET_STATE"] = "reset_state";
53
+ /**
54
+ * An inspection PDF has been fetched from the API.
55
+ */
56
+ MonkActionType["GOT_ONE_INSPECTION_PDF"] = "got_one_inspection_pdf";
53
57
  })(MonkActionType = exports.MonkActionType || (exports.MonkActionType = {}));
@@ -39,6 +39,9 @@ function monkReducer(state, action) {
39
39
  if ((0, actions_1.isDeletedOneDamageAction)(action)) {
40
40
  return (0, actions_1.deletedOneDamage)(state, action);
41
41
  }
42
+ if ((0, actions_1.isGotOneInspectionPdfAction)(action)) {
43
+ return (0, actions_1.gotOneInspectionPdf)(state, action);
44
+ }
42
45
  return state;
43
46
  }
44
47
  exports.monkReducer = monkReducer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monkvision/common",
3
- "version": "4.4.3",
3
+ "version": "4.4.4",
4
4
  "license": "BSD-3-Clause-Clear",
5
5
  "packageManager": "yarn@3.2.4",
6
6
  "description": "MonkJs common logic package",
@@ -28,10 +28,10 @@
28
28
  "lint:fix": "yarn run prettier:fix && yarn run eslint:fix"
29
29
  },
30
30
  "dependencies": {
31
- "@monkvision/analytics": "4.4.3",
32
- "@monkvision/monitoring": "4.4.3",
33
- "@monkvision/sights": "4.4.3",
34
- "@monkvision/types": "4.4.3",
31
+ "@monkvision/analytics": "4.4.4",
32
+ "@monkvision/monitoring": "4.4.4",
33
+ "@monkvision/sights": "4.4.4",
34
+ "@monkvision/types": "4.4.4",
35
35
  "i18next": "^23.4.5",
36
36
  "jsonwebtoken": "^9.0.2",
37
37
  "jwt-decode": "^4.0.0",
@@ -47,13 +47,13 @@
47
47
  "react-router-dom": "^6.22.3"
48
48
  },
49
49
  "devDependencies": {
50
- "@monkvision/eslint-config-base": "4.4.3",
51
- "@monkvision/eslint-config-typescript": "4.4.3",
52
- "@monkvision/eslint-config-typescript-react": "4.4.3",
53
- "@monkvision/jest-config": "4.4.3",
54
- "@monkvision/prettier-config": "4.4.3",
55
- "@monkvision/test-utils": "4.4.3",
56
- "@monkvision/typescript-config": "4.4.3",
50
+ "@monkvision/eslint-config-base": "4.4.4",
51
+ "@monkvision/eslint-config-typescript": "4.4.4",
52
+ "@monkvision/eslint-config-typescript-react": "4.4.4",
53
+ "@monkvision/jest-config": "4.4.4",
54
+ "@monkvision/prettier-config": "4.4.4",
55
+ "@monkvision/test-utils": "4.4.4",
56
+ "@monkvision/typescript-config": "4.4.4",
57
57
  "@testing-library/react": "^12.1.5",
58
58
  "@testing-library/react-hooks": "^8.0.1",
59
59
  "@types/jest": "^29.2.2",
@@ -96,5 +96,5 @@
96
96
  "url": "https://github.com/monkvision/monkjs/issues"
97
97
  },
98
98
  "homepage": "https://github.com/monkvision/monkjs",
99
- "gitHead": "2a145a56ba6ddcede0c5c6b9da6dd0f540e69573"
99
+ "gitHead": "7abfa7fbb0b482a6dd916c92cfc994f2b4e74257"
100
100
  }