@monkvision/common 4.0.24 → 4.2.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.
- package/lib/state/actions/createdOnePricing.d.ts +34 -0
- package/lib/state/actions/createdOnePricing.js +47 -0
- package/lib/state/actions/deletedOnePricing.d.ts +37 -0
- package/lib/state/actions/deletedOnePricing.js +47 -0
- package/lib/state/actions/index.d.ts +4 -0
- package/lib/state/actions/index.js +4 -0
- package/lib/state/actions/monkAction.d.ts +20 -4
- package/lib/state/actions/monkAction.js +20 -4
- package/lib/state/actions/updatedOneInspectionAdditionalData.d.ts +38 -0
- package/lib/state/actions/updatedOneInspectionAdditionalData.js +45 -0
- package/lib/state/actions/updatedOnePricing.d.ts +34 -0
- package/lib/state/actions/updatedOnePricing.js +35 -0
- package/lib/state/reducer.js +15 -0
- package/lib/state/state.d.ts +5 -1
- package/lib/state/state.js +1 -0
- package/package.json +13 -13
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { PricingV2 } from '@monkvision/types';
|
|
2
|
+
import { MonkAction, MonkActionType } from './monkAction';
|
|
3
|
+
import { MonkState } from '../state';
|
|
4
|
+
/**
|
|
5
|
+
* The payload of a MonkCreatedOnePricingPayload.
|
|
6
|
+
*/
|
|
7
|
+
export interface MonkCreatedOnePricingPayload {
|
|
8
|
+
/**
|
|
9
|
+
* The pricing created.
|
|
10
|
+
*/
|
|
11
|
+
pricing: PricingV2;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Action dispatched when a vehicle have been updated.
|
|
15
|
+
*/
|
|
16
|
+
export interface MonkCreatedOnePricingAction extends MonkAction {
|
|
17
|
+
/**
|
|
18
|
+
* The type of the action : `MonkActionType.CREATED_ONE_PRICING`.
|
|
19
|
+
*/
|
|
20
|
+
type: MonkActionType.CREATED_ONE_PRICING;
|
|
21
|
+
/**
|
|
22
|
+
* The payload of the action containing the fetched entities.
|
|
23
|
+
*/
|
|
24
|
+
payload: MonkCreatedOnePricingPayload;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Matcher function that matches a CreatedOnePricing while also inferring its type using TypeScript's type predicate
|
|
28
|
+
* feature.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isCreatedOnePricingAction(action: MonkAction): action is MonkCreatedOnePricingAction;
|
|
31
|
+
/**
|
|
32
|
+
* Reducer function for a createdOnePricing action.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createdOnePricing(state: MonkState, action: MonkCreatedOnePricingAction): 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.createdOnePricing = exports.isCreatedOnePricingAction = void 0;
|
|
24
|
+
var monkAction_1 = require("./monkAction");
|
|
25
|
+
/**
|
|
26
|
+
* Matcher function that matches a CreatedOnePricing while also inferring its type using TypeScript's type predicate
|
|
27
|
+
* feature.
|
|
28
|
+
*/
|
|
29
|
+
function isCreatedOnePricingAction(action) {
|
|
30
|
+
return action.type === monkAction_1.MonkActionType.CREATED_ONE_PRICING;
|
|
31
|
+
}
|
|
32
|
+
exports.isCreatedOnePricingAction = isCreatedOnePricingAction;
|
|
33
|
+
/**
|
|
34
|
+
* Reducer function for a createdOnePricing action.
|
|
35
|
+
*/
|
|
36
|
+
function createdOnePricing(state, action) {
|
|
37
|
+
var _a;
|
|
38
|
+
var pricings = state.pricings, inspections = state.inspections;
|
|
39
|
+
var payload = action.payload;
|
|
40
|
+
var inspection = inspections.find(function (value) { return value.id === payload.pricing.inspectionId; });
|
|
41
|
+
if (inspection) {
|
|
42
|
+
(_a = inspection.pricings) === null || _a === void 0 ? void 0 : _a.push(action.payload.pricing.id);
|
|
43
|
+
}
|
|
44
|
+
pricings.push(action.payload.pricing);
|
|
45
|
+
return __assign(__assign({}, state), { pricings: __spreadArray([], pricings, true), inspections: __spreadArray([], inspections, true) });
|
|
46
|
+
}
|
|
47
|
+
exports.createdOnePricing = createdOnePricing;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { MonkAction, MonkActionType } from './monkAction';
|
|
2
|
+
import { MonkState } from '../state';
|
|
3
|
+
/**
|
|
4
|
+
* The payload of a MonkDeletedOnePricingPayload.
|
|
5
|
+
*/
|
|
6
|
+
export interface MonkDeletedtedOnePricingPayload {
|
|
7
|
+
/**
|
|
8
|
+
* The ID of the inspection to which the pricing was deleted.
|
|
9
|
+
*/
|
|
10
|
+
inspectionId: string;
|
|
11
|
+
/**
|
|
12
|
+
* The pricing ID deleted.
|
|
13
|
+
*/
|
|
14
|
+
pricingId: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Action dispatched when a pricing have been deleted.
|
|
18
|
+
*/
|
|
19
|
+
export interface MonkDeletedOnePricingAction extends MonkAction {
|
|
20
|
+
/**
|
|
21
|
+
* The type of the action : `MonkActionType.DELETED_ONE_PRICING`.
|
|
22
|
+
*/
|
|
23
|
+
type: MonkActionType.DELETED_ONE_PRICING;
|
|
24
|
+
/**
|
|
25
|
+
* The payload of the action containing the fetched entities.
|
|
26
|
+
*/
|
|
27
|
+
payload: MonkDeletedtedOnePricingPayload;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Matcher function that matches a DeletedOnePricing while also inferring its type using TypeScript's type predicate
|
|
31
|
+
* feature.
|
|
32
|
+
*/
|
|
33
|
+
export declare function isDeletedOnePricingAction(action: MonkAction): action is MonkDeletedOnePricingAction;
|
|
34
|
+
/**
|
|
35
|
+
* Reducer function for a deletedOnePricing action.
|
|
36
|
+
*/
|
|
37
|
+
export declare function deletedOnePricing(state: MonkState, action: MonkDeletedOnePricingAction): 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.deletedOnePricing = exports.isDeletedOnePricingAction = void 0;
|
|
24
|
+
var monkAction_1 = require("./monkAction");
|
|
25
|
+
/**
|
|
26
|
+
* Matcher function that matches a DeletedOnePricing while also inferring its type using TypeScript's type predicate
|
|
27
|
+
* feature.
|
|
28
|
+
*/
|
|
29
|
+
function isDeletedOnePricingAction(action) {
|
|
30
|
+
return action.type === monkAction_1.MonkActionType.DELETED_ONE_PRICING;
|
|
31
|
+
}
|
|
32
|
+
exports.isDeletedOnePricingAction = isDeletedOnePricingAction;
|
|
33
|
+
/**
|
|
34
|
+
* Reducer function for a deletedOnePricing action.
|
|
35
|
+
*/
|
|
36
|
+
function deletedOnePricing(state, action) {
|
|
37
|
+
var _a;
|
|
38
|
+
var pricings = state.pricings, inspections = state.inspections;
|
|
39
|
+
var payload = action.payload;
|
|
40
|
+
var inspection = inspections.find(function (value) { return value.id === payload.inspectionId; });
|
|
41
|
+
if (inspection) {
|
|
42
|
+
inspection.pricings = (_a = inspection.pricings) === null || _a === void 0 ? void 0 : _a.filter(function (pricingId) { return pricingId !== payload.pricingId; });
|
|
43
|
+
}
|
|
44
|
+
var newPricings = pricings.filter(function (pricing) { return pricing.id !== payload.pricingId; });
|
|
45
|
+
return __assign(__assign({}, state), { pricings: newPricings, inspections: __spreadArray([], inspections, true) });
|
|
46
|
+
}
|
|
47
|
+
exports.deletedOnePricing = deletedOnePricing;
|
|
@@ -4,3 +4,7 @@ export * from './gotOneInspection';
|
|
|
4
4
|
export * from './createdOneImage';
|
|
5
5
|
export * from './updatedManyTasks';
|
|
6
6
|
export * from './updatedVehicle';
|
|
7
|
+
export * from './createdOnePricing';
|
|
8
|
+
export * from './deletedOnePricing';
|
|
9
|
+
export * from './updatedOnePricing';
|
|
10
|
+
export * from './updatedOneInspectionAdditionalData';
|
|
@@ -20,3 +20,7 @@ __exportStar(require("./gotOneInspection"), exports);
|
|
|
20
20
|
__exportStar(require("./createdOneImage"), exports);
|
|
21
21
|
__exportStar(require("./updatedManyTasks"), exports);
|
|
22
22
|
__exportStar(require("./updatedVehicle"), exports);
|
|
23
|
+
__exportStar(require("./createdOnePricing"), exports);
|
|
24
|
+
__exportStar(require("./deletedOnePricing"), exports);
|
|
25
|
+
__exportStar(require("./updatedOnePricing"), exports);
|
|
26
|
+
__exportStar(require("./updatedOneInspectionAdditionalData"), exports);
|
|
@@ -6,6 +6,10 @@ export declare enum MonkActionType {
|
|
|
6
6
|
* An inspection has been fetched from the API.
|
|
7
7
|
*/
|
|
8
8
|
GOT_ONE_INSPECTION = "got_one_inspection",
|
|
9
|
+
/**
|
|
10
|
+
* An inspection additional data has been updated.
|
|
11
|
+
*/
|
|
12
|
+
UPDATED_ONE_INSPECTION_ADDITIONAL_DATA = "updated_one_inspection_additional_data",
|
|
9
13
|
/**
|
|
10
14
|
* An image has been uploaded to the API.
|
|
11
15
|
*/
|
|
@@ -15,13 +19,25 @@ export declare enum MonkActionType {
|
|
|
15
19
|
*/
|
|
16
20
|
UPDATED_MANY_TASKS = "updated_many_tasks",
|
|
17
21
|
/**
|
|
18
|
-
*
|
|
22
|
+
* A vehicle has been updated.
|
|
19
23
|
*/
|
|
20
|
-
|
|
24
|
+
UPDATED_VEHICLE = "updated_vehicle",
|
|
21
25
|
/**
|
|
22
|
-
* A
|
|
26
|
+
* A pricing has been uploaded to the API.
|
|
27
|
+
*/
|
|
28
|
+
CREATED_ONE_PRICING = "created_one_pricing",
|
|
29
|
+
/**
|
|
30
|
+
* A pricing has been updated.
|
|
31
|
+
*/
|
|
32
|
+
UPDATED_ONE_PRICING = "updated_one_pricing",
|
|
33
|
+
/**
|
|
34
|
+
* A pricing has been deleted.
|
|
35
|
+
*/
|
|
36
|
+
DELETED_ONE_PRICING = "deleted_one_pricing",
|
|
37
|
+
/**
|
|
38
|
+
* Clear and reset the state.
|
|
23
39
|
*/
|
|
24
|
-
|
|
40
|
+
RESET_STATE = "reset_state"
|
|
25
41
|
}
|
|
26
42
|
/**
|
|
27
43
|
* Type definition for a generic action dispatched in the Monk state.
|
|
@@ -10,6 +10,10 @@ var MonkActionType;
|
|
|
10
10
|
* An inspection has been fetched from the API.
|
|
11
11
|
*/
|
|
12
12
|
MonkActionType["GOT_ONE_INSPECTION"] = "got_one_inspection";
|
|
13
|
+
/**
|
|
14
|
+
* An inspection additional data has been updated.
|
|
15
|
+
*/
|
|
16
|
+
MonkActionType["UPDATED_ONE_INSPECTION_ADDITIONAL_DATA"] = "updated_one_inspection_additional_data";
|
|
13
17
|
/**
|
|
14
18
|
* An image has been uploaded to the API.
|
|
15
19
|
*/
|
|
@@ -18,12 +22,24 @@ var MonkActionType;
|
|
|
18
22
|
* One or more tasks have been updated.
|
|
19
23
|
*/
|
|
20
24
|
MonkActionType["UPDATED_MANY_TASKS"] = "updated_many_tasks";
|
|
21
|
-
/**
|
|
22
|
-
* Clear and reset the state.
|
|
23
|
-
*/
|
|
24
|
-
MonkActionType["RESET_STATE"] = "reset_state";
|
|
25
25
|
/**
|
|
26
26
|
* A vehicle has been updated.
|
|
27
27
|
*/
|
|
28
28
|
MonkActionType["UPDATED_VEHICLE"] = "updated_vehicle";
|
|
29
|
+
/**
|
|
30
|
+
* A pricing has been uploaded to the API.
|
|
31
|
+
*/
|
|
32
|
+
MonkActionType["CREATED_ONE_PRICING"] = "created_one_pricing";
|
|
33
|
+
/**
|
|
34
|
+
* A pricing has been updated.
|
|
35
|
+
*/
|
|
36
|
+
MonkActionType["UPDATED_ONE_PRICING"] = "updated_one_pricing";
|
|
37
|
+
/**
|
|
38
|
+
* A pricing has been deleted.
|
|
39
|
+
*/
|
|
40
|
+
MonkActionType["DELETED_ONE_PRICING"] = "deleted_one_pricing";
|
|
41
|
+
/**
|
|
42
|
+
* Clear and reset the state.
|
|
43
|
+
*/
|
|
44
|
+
MonkActionType["RESET_STATE"] = "reset_state";
|
|
29
45
|
})(MonkActionType = exports.MonkActionType || (exports.MonkActionType = {}));
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AdditionalData } from '@monkvision/types';
|
|
2
|
+
import { MonkAction, MonkActionType } from './monkAction';
|
|
3
|
+
import { MonkState } from '../state';
|
|
4
|
+
/**
|
|
5
|
+
* The payload of a MonkUpdatedOneInspectionAdditionalDataPayload.
|
|
6
|
+
*/
|
|
7
|
+
export interface MonkUpdatedOneInspectionAdditionalDataPayload {
|
|
8
|
+
/**
|
|
9
|
+
* The ID of the inspection to which the pricing was updated.
|
|
10
|
+
*/
|
|
11
|
+
inspectionId: string;
|
|
12
|
+
/**
|
|
13
|
+
* Additional data used for the update operation.
|
|
14
|
+
*/
|
|
15
|
+
additionalData?: AdditionalData;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Action dispatched when a inspection have been updated.
|
|
19
|
+
*/
|
|
20
|
+
export interface MonkUpdatedOneInspectionAdditionalDataAction extends MonkAction {
|
|
21
|
+
/**
|
|
22
|
+
* The type of the action : `MonkActionType.UPDATED_ONE_INSPECTION_ADDITIONAL_DATA`.
|
|
23
|
+
*/
|
|
24
|
+
type: MonkActionType.UPDATED_ONE_INSPECTION_ADDITIONAL_DATA;
|
|
25
|
+
/**
|
|
26
|
+
* The payload of the action containing the fetched entities.
|
|
27
|
+
*/
|
|
28
|
+
payload: MonkUpdatedOneInspectionAdditionalDataPayload;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Matcher function that matches a UpdatedOneInspection while also inferring its type using TypeScript's type predicate
|
|
32
|
+
* feature.
|
|
33
|
+
*/
|
|
34
|
+
export declare function isUpdatedOneInspectionAdditionalDataAction(action: MonkAction): action is MonkUpdatedOneInspectionAdditionalDataAction;
|
|
35
|
+
/**
|
|
36
|
+
* Reducer function for a UpdatedOneInspection action.
|
|
37
|
+
*/
|
|
38
|
+
export declare function updatedOneInspectionAdditionalData(state: MonkState, action: MonkUpdatedOneInspectionAdditionalDataAction): 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.updatedOneInspectionAdditionalData = exports.isUpdatedOneInspectionAdditionalDataAction = void 0;
|
|
24
|
+
var monkAction_1 = require("./monkAction");
|
|
25
|
+
/**
|
|
26
|
+
* Matcher function that matches a UpdatedOneInspection while also inferring its type using TypeScript's type predicate
|
|
27
|
+
* feature.
|
|
28
|
+
*/
|
|
29
|
+
function isUpdatedOneInspectionAdditionalDataAction(action) {
|
|
30
|
+
return action.type === monkAction_1.MonkActionType.UPDATED_ONE_INSPECTION_ADDITIONAL_DATA;
|
|
31
|
+
}
|
|
32
|
+
exports.isUpdatedOneInspectionAdditionalDataAction = isUpdatedOneInspectionAdditionalDataAction;
|
|
33
|
+
/**
|
|
34
|
+
* Reducer function for a UpdatedOneInspection action.
|
|
35
|
+
*/
|
|
36
|
+
function updatedOneInspectionAdditionalData(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.additionalData = payload.additionalData;
|
|
42
|
+
}
|
|
43
|
+
return __assign(__assign({}, state), { inspections: __spreadArray([], inspections, true) });
|
|
44
|
+
}
|
|
45
|
+
exports.updatedOneInspectionAdditionalData = updatedOneInspectionAdditionalData;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { PricingV2 } from '@monkvision/types';
|
|
2
|
+
import { MonkAction, MonkActionType } from './monkAction';
|
|
3
|
+
import { MonkState } from '../state';
|
|
4
|
+
/**
|
|
5
|
+
* The payload of a MonkUpdatedOnePricingPayload.
|
|
6
|
+
*/
|
|
7
|
+
export interface MonkUpdatedOnePricingPayload {
|
|
8
|
+
/**
|
|
9
|
+
* The pricing created.
|
|
10
|
+
*/
|
|
11
|
+
pricing: PricingV2;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Action dispatched when a pricing have been updated.
|
|
15
|
+
*/
|
|
16
|
+
export interface MonkUpdatedOnePricingAction extends MonkAction {
|
|
17
|
+
/**
|
|
18
|
+
* The type of the action : `MonkActionType.UPDATED_ONE_PRICING`.
|
|
19
|
+
*/
|
|
20
|
+
type: MonkActionType.UPDATED_ONE_PRICING;
|
|
21
|
+
/**
|
|
22
|
+
* The payload of the action containing the fetched entities.
|
|
23
|
+
*/
|
|
24
|
+
payload: MonkUpdatedOnePricingPayload;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Matcher function that matches a updatedOnePricing while also inferring its type using TypeScript's type predicate
|
|
28
|
+
* feature.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isUpdatedOnePricingAction(action: MonkAction): action is MonkUpdatedOnePricingAction;
|
|
31
|
+
/**
|
|
32
|
+
* Reducer function for a updatedOnePricing action.
|
|
33
|
+
*/
|
|
34
|
+
export declare function updatedOnePricing(state: MonkState, action: MonkUpdatedOnePricingAction): MonkState;
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.updatedOnePricing = exports.isUpdatedOnePricingAction = void 0;
|
|
15
|
+
var monkAction_1 = require("./monkAction");
|
|
16
|
+
/**
|
|
17
|
+
* Matcher function that matches a updatedOnePricing while also inferring its type using TypeScript's type predicate
|
|
18
|
+
* feature.
|
|
19
|
+
*/
|
|
20
|
+
function isUpdatedOnePricingAction(action) {
|
|
21
|
+
return action.type === monkAction_1.MonkActionType.UPDATED_ONE_PRICING;
|
|
22
|
+
}
|
|
23
|
+
exports.isUpdatedOnePricingAction = isUpdatedOnePricingAction;
|
|
24
|
+
/**
|
|
25
|
+
* Reducer function for a updatedOnePricing action.
|
|
26
|
+
*/
|
|
27
|
+
function updatedOnePricing(state, action) {
|
|
28
|
+
var pricings = state.pricings;
|
|
29
|
+
var payload = action.payload;
|
|
30
|
+
var updatedPricings = pricings.map(function (pricing) {
|
|
31
|
+
return pricing.id === payload.pricing.id ? __assign(__assign({}, pricing), payload.pricing) : pricing;
|
|
32
|
+
});
|
|
33
|
+
return __assign(__assign({}, state), { pricings: updatedPricings });
|
|
34
|
+
}
|
|
35
|
+
exports.updatedOnePricing = updatedOnePricing;
|
package/lib/state/reducer.js
CHANGED
|
@@ -12,12 +12,27 @@ function monkReducer(state, action) {
|
|
|
12
12
|
if ((0, actions_1.isGotOneInspectionAction)(action)) {
|
|
13
13
|
return (0, actions_1.gotOneInspection)(state, action);
|
|
14
14
|
}
|
|
15
|
+
if ((0, actions_1.isUpdatedOneInspectionAdditionalDataAction)(action)) {
|
|
16
|
+
return (0, actions_1.updatedOneInspectionAdditionalData)(state, action);
|
|
17
|
+
}
|
|
15
18
|
if ((0, actions_1.isCreatedOneImageAction)(action)) {
|
|
16
19
|
return (0, actions_1.createdOneImage)(state, action);
|
|
17
20
|
}
|
|
18
21
|
if ((0, actions_1.isUpdatedManyTasksAction)(action)) {
|
|
19
22
|
return (0, actions_1.updatedManyTasks)(state, action);
|
|
20
23
|
}
|
|
24
|
+
if ((0, actions_1.isCreatedOnePricingAction)(action)) {
|
|
25
|
+
return (0, actions_1.createdOnePricing)(state, action);
|
|
26
|
+
}
|
|
27
|
+
if ((0, actions_1.isDeletedOnePricingAction)(action)) {
|
|
28
|
+
return (0, actions_1.deletedOnePricing)(state, action);
|
|
29
|
+
}
|
|
30
|
+
if ((0, actions_1.isUpdatedOnePricingAction)(action)) {
|
|
31
|
+
return (0, actions_1.updatedOnePricing)(state, action);
|
|
32
|
+
}
|
|
33
|
+
if ((0, actions_1.isUpdatedVehicleAction)(action)) {
|
|
34
|
+
return (0, actions_1.updatedVehicle)(state, action);
|
|
35
|
+
}
|
|
21
36
|
return state;
|
|
22
37
|
}
|
|
23
38
|
exports.monkReducer = monkReducer;
|
package/lib/state/state.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Damage, Image, Inspection, Part, PartOperation, RenderedOutput, SeverityResult, Task, Vehicle, View } from '@monkvision/types';
|
|
1
|
+
import { Damage, Image, Inspection, Part, PartOperation, PricingV2, RenderedOutput, SeverityResult, Task, Vehicle, View } from '@monkvision/types';
|
|
2
2
|
/**
|
|
3
3
|
* The React state containing all the Monk entities.
|
|
4
4
|
*/
|
|
@@ -43,6 +43,10 @@ export interface MonkState {
|
|
|
43
43
|
* The views created during inspections.
|
|
44
44
|
*/
|
|
45
45
|
views: View[];
|
|
46
|
+
/**
|
|
47
|
+
* The pricings created during inspections.
|
|
48
|
+
*/
|
|
49
|
+
pricings: PricingV2[];
|
|
46
50
|
}
|
|
47
51
|
/**
|
|
48
52
|
* Creates an empty state that can be used to initialize the Monk state.
|
package/lib/state/state.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monkvision/common",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.2.0",
|
|
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.0
|
|
32
|
-
"@monkvision/monitoring": "4.0
|
|
33
|
-
"@monkvision/sights": "4.0
|
|
34
|
-
"@monkvision/types": "4.0
|
|
31
|
+
"@monkvision/analytics": "4.2.0",
|
|
32
|
+
"@monkvision/monitoring": "4.2.0",
|
|
33
|
+
"@monkvision/sights": "4.2.0",
|
|
34
|
+
"@monkvision/types": "4.2.0",
|
|
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.0
|
|
51
|
-
"@monkvision/eslint-config-typescript": "4.0
|
|
52
|
-
"@monkvision/eslint-config-typescript-react": "4.0
|
|
53
|
-
"@monkvision/jest-config": "4.0
|
|
54
|
-
"@monkvision/prettier-config": "4.0
|
|
55
|
-
"@monkvision/test-utils": "4.0
|
|
56
|
-
"@monkvision/typescript-config": "4.0
|
|
50
|
+
"@monkvision/eslint-config-base": "4.2.0",
|
|
51
|
+
"@monkvision/eslint-config-typescript": "4.2.0",
|
|
52
|
+
"@monkvision/eslint-config-typescript-react": "4.2.0",
|
|
53
|
+
"@monkvision/jest-config": "4.2.0",
|
|
54
|
+
"@monkvision/prettier-config": "4.2.0",
|
|
55
|
+
"@monkvision/test-utils": "4.2.0",
|
|
56
|
+
"@monkvision/typescript-config": "4.2.0",
|
|
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": "
|
|
99
|
+
"gitHead": "68bce4b15bcd2db64421c9269bbc4a2b24af1d0c"
|
|
100
100
|
}
|