swoop-common 2.2.181 → 2.2.183
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/dist/api/generated/core/exports.d.ts +3 -0
- package/dist/api/generated/core/exports.js +2 -0
- package/dist/api/generated/core/index.d.ts +3 -0
- package/dist/api/generated/core/index.js +2 -0
- package/dist/api/generated/core/models/ComponentInstance.d.ts +2 -0
- package/dist/api/generated/core/models/CreditEntry.d.ts +38 -0
- package/dist/api/generated/core/models/CreditEntry.js +17 -0
- package/dist/api/generated/core/models/CreditEntryId.d.ts +1 -0
- package/dist/api/generated/core/models/CreditEntryId.js +1 -0
- package/dist/api/generated/core/models/CreditEntryType.d.ts +5 -0
- package/dist/api/generated/core/models/CreditEntryType.js +10 -0
- package/dist/api/generated/core/models/DTOComponentEntity.d.ts +2 -0
- package/dist/api/generated/core/models/DTOComponentRead.d.ts +2 -0
- package/dist/rendering/components/ComponentPicker.js +3 -4
- package/dist/rendering/renderers/ComponentPicker.d.ts +1 -0
- package/dist/rendering/renderers/ComponentPicker.js +39 -26
- package/package.json +1 -1
|
@@ -28,6 +28,9 @@ export { ComponentState } from './index';
|
|
|
28
28
|
export type { ComponentStateFilterQueryParam } from './index';
|
|
29
29
|
export type { ComponentTemplateIdQueryParam } from './index';
|
|
30
30
|
export type { ComponentTripsQueryParam } from './index';
|
|
31
|
+
export { CreditEntry } from './index';
|
|
32
|
+
export type { CreditEntryId } from './index';
|
|
33
|
+
export { CreditEntryType } from './index';
|
|
31
34
|
export { Currency } from './index';
|
|
32
35
|
export { Destination } from './index';
|
|
33
36
|
export type { DTOBranchCreate } from './index';
|
|
@@ -5,6 +5,8 @@ export { OpenAPI } from './index';
|
|
|
5
5
|
export { AmendmentType } from './index';
|
|
6
6
|
export { BookingStatus } from './index';
|
|
7
7
|
export { ComponentState } from './index';
|
|
8
|
+
export { CreditEntry } from './index';
|
|
9
|
+
export { CreditEntryType } from './index';
|
|
8
10
|
export { Currency } from './index';
|
|
9
11
|
export { Destination } from './index';
|
|
10
12
|
export { InfoNote } from './index';
|
|
@@ -28,6 +28,9 @@ export { ComponentState } from './models/ComponentState';
|
|
|
28
28
|
export type { ComponentStateFilterQueryParam } from './models/ComponentStateFilterQueryParam';
|
|
29
29
|
export type { ComponentTemplateIdQueryParam } from './models/ComponentTemplateIdQueryParam';
|
|
30
30
|
export type { ComponentTripsQueryParam } from './models/ComponentTripsQueryParam';
|
|
31
|
+
export { CreditEntry } from './models/CreditEntry';
|
|
32
|
+
export type { CreditEntryId } from './models/CreditEntryId';
|
|
33
|
+
export { CreditEntryType } from './models/CreditEntryType';
|
|
31
34
|
export { Currency } from './models/Currency';
|
|
32
35
|
export { Destination } from './models/Destination';
|
|
33
36
|
export type { DTOBranchCreate } from './models/DTOBranchCreate';
|
|
@@ -8,6 +8,8 @@ export { OpenAPI } from './core/OpenAPI';
|
|
|
8
8
|
export { AmendmentType } from './models/AmendmentType';
|
|
9
9
|
export { BookingStatus } from './models/BookingStatus';
|
|
10
10
|
export { ComponentState } from './models/ComponentState';
|
|
11
|
+
export { CreditEntry } from './models/CreditEntry';
|
|
12
|
+
export { CreditEntryType } from './models/CreditEntryType';
|
|
11
13
|
export { Currency } from './models/Currency';
|
|
12
14
|
export { Destination } from './models/Destination';
|
|
13
15
|
export { InfoNote } from './models/InfoNote';
|
|
@@ -3,6 +3,7 @@ import type { AssignedTravellerGroup } from './AssignedTravellerGroup';
|
|
|
3
3
|
import type { BookingStatus } from './BookingStatus';
|
|
4
4
|
import type { ComponentId } from './ComponentId';
|
|
5
5
|
import type { ComponentInstanceId } from './ComponentInstanceId';
|
|
6
|
+
import type { CreditEntry } from './CreditEntry';
|
|
6
7
|
import type { Field } from './Field';
|
|
7
8
|
import type { Flag } from './Flag';
|
|
8
9
|
import type { InternalSwoopId } from './InternalSwoopId';
|
|
@@ -33,4 +34,5 @@ export type ComponentInstance = {
|
|
|
33
34
|
bookingStatus: BookingStatus;
|
|
34
35
|
isCancellationFee?: boolean;
|
|
35
36
|
sortOrder?: number;
|
|
37
|
+
creditEntries?: Array<CreditEntry>;
|
|
36
38
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { CreditEntryId } from './CreditEntryId';
|
|
2
|
+
import type { CreditEntryType } from './CreditEntryType';
|
|
3
|
+
export type CreditEntry = {
|
|
4
|
+
id: CreditEntryId;
|
|
5
|
+
type: CreditEntryType;
|
|
6
|
+
customerTitle: string;
|
|
7
|
+
currency?: string;
|
|
8
|
+
partnerId?: string;
|
|
9
|
+
authorisedBy?: string;
|
|
10
|
+
customerIds?: Array<string>;
|
|
11
|
+
notes?: string;
|
|
12
|
+
department?: CreditEntry.department;
|
|
13
|
+
reasons?: Array<string>;
|
|
14
|
+
costAbsorbedBy?: CreditEntry.costAbsorbedBy;
|
|
15
|
+
costToSwoop?: number;
|
|
16
|
+
refundAmountTotal?: number;
|
|
17
|
+
voucherValue?: number;
|
|
18
|
+
bookBy?: string;
|
|
19
|
+
travelBy?: string;
|
|
20
|
+
uploadedInCrm?: boolean;
|
|
21
|
+
expiryNotificationDate?: string;
|
|
22
|
+
createdAt?: string;
|
|
23
|
+
createdBy?: string;
|
|
24
|
+
};
|
|
25
|
+
export declare namespace CreditEntry {
|
|
26
|
+
enum department {
|
|
27
|
+
CX = "cx",
|
|
28
|
+
SALES_PROCESS = "salesProcess",
|
|
29
|
+
PRE_TRAVEL_FEEDBACK = "preTravelFeedback",
|
|
30
|
+
POST_DEPARTURE_FEEDBACK = "postDepartureFeedback",
|
|
31
|
+
OTHER = "other"
|
|
32
|
+
}
|
|
33
|
+
enum costAbsorbedBy {
|
|
34
|
+
SWOOP = "swoop",
|
|
35
|
+
PARTNER = "partner",
|
|
36
|
+
COMBINED = "combined"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export var CreditEntry;
|
|
2
|
+
(function (CreditEntry) {
|
|
3
|
+
let department;
|
|
4
|
+
(function (department) {
|
|
5
|
+
department["CX"] = "cx";
|
|
6
|
+
department["SALES_PROCESS"] = "salesProcess";
|
|
7
|
+
department["PRE_TRAVEL_FEEDBACK"] = "preTravelFeedback";
|
|
8
|
+
department["POST_DEPARTURE_FEEDBACK"] = "postDepartureFeedback";
|
|
9
|
+
department["OTHER"] = "other";
|
|
10
|
+
})(department = CreditEntry.department || (CreditEntry.department = {}));
|
|
11
|
+
let costAbsorbedBy;
|
|
12
|
+
(function (costAbsorbedBy) {
|
|
13
|
+
costAbsorbedBy["SWOOP"] = "swoop";
|
|
14
|
+
costAbsorbedBy["PARTNER"] = "partner";
|
|
15
|
+
costAbsorbedBy["COMBINED"] = "combined";
|
|
16
|
+
})(costAbsorbedBy = CreditEntry.costAbsorbedBy || (CreditEntry.costAbsorbedBy = {}));
|
|
17
|
+
})(CreditEntry || (CreditEntry = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type CreditEntryId = string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
export var CreditEntryType;
|
|
6
|
+
(function (CreditEntryType) {
|
|
7
|
+
CreditEntryType["COMPENSATION"] = "compensation";
|
|
8
|
+
CreditEntryType["GESTURE"] = "gesture";
|
|
9
|
+
CreditEntryType["CREDIT_VOUCHER"] = "creditVoucher";
|
|
10
|
+
})(CreditEntryType || (CreditEntryType = {}));
|
|
@@ -4,6 +4,7 @@ import type { ComponentId } from './ComponentId';
|
|
|
4
4
|
import type { ComponentNotes } from './ComponentNotes';
|
|
5
5
|
import type { ComponentRevisionGroupId } from './ComponentRevisionGroupId';
|
|
6
6
|
import type { ComponentState } from './ComponentState';
|
|
7
|
+
import type { CreditEntry } from './CreditEntry';
|
|
7
8
|
import type { Destination } from './Destination';
|
|
8
9
|
import type { Field } from './Field';
|
|
9
10
|
import type { Media } from './Media';
|
|
@@ -38,4 +39,5 @@ export type DTOComponentEntity = {
|
|
|
38
39
|
package?: Package | null;
|
|
39
40
|
state: ComponentState;
|
|
40
41
|
isBookable: boolean;
|
|
42
|
+
creditEntries?: Array<CreditEntry>;
|
|
41
43
|
};
|
|
@@ -4,6 +4,7 @@ import type { ComponentId } from './ComponentId';
|
|
|
4
4
|
import type { ComponentNotes } from './ComponentNotes';
|
|
5
5
|
import type { ComponentRevisionGroupId } from './ComponentRevisionGroupId';
|
|
6
6
|
import type { ComponentState } from './ComponentState';
|
|
7
|
+
import type { CreditEntry } from './CreditEntry';
|
|
7
8
|
import type { Destination } from './Destination';
|
|
8
9
|
import type { Field } from './Field';
|
|
9
10
|
import type { Media } from './Media';
|
|
@@ -38,4 +39,5 @@ export type DTOComponentRead = {
|
|
|
38
39
|
package?: Package;
|
|
39
40
|
state: ComponentState;
|
|
40
41
|
isBookable: boolean;
|
|
42
|
+
creditEntries?: Array<CreditEntry>;
|
|
41
43
|
};
|
|
@@ -162,6 +162,8 @@ export default function ComponentPickerModal({ open, onClose, onSelect, selected
|
|
|
162
162
|
};
|
|
163
163
|
const handleClearSearch = () => setSearchTerm("");
|
|
164
164
|
const handleSelect = (component) => {
|
|
165
|
+
if (!component)
|
|
166
|
+
return;
|
|
165
167
|
onSelect(component);
|
|
166
168
|
onClose();
|
|
167
169
|
};
|
|
@@ -235,8 +237,5 @@ export default function ComponentPickerModal({ open, onClose, onSelect, selected
|
|
|
235
237
|
components.length > 0 && (React.createElement(Box, { display: "flex", justifyContent: "center", mt: 2 },
|
|
236
238
|
React.createElement(Pagination, { count: Math.ceil(totalCount / pageSize), page: page, onChange: (_, newPage) => setPage(newPage), color: "primary" })))),
|
|
237
239
|
React.createElement(DialogActions, null,
|
|
238
|
-
React.createElement(Button, { onClick: onClose }, "Cancel")
|
|
239
|
-
selectedComponent && (React.createElement(Button, { variant: "contained", onClick: () => handleSelect(selectedComponent) },
|
|
240
|
-
"Select ",
|
|
241
|
-
selectedComponent.name)))));
|
|
240
|
+
React.createElement(Button, { onClick: onClose }, "Cancel"))));
|
|
242
241
|
}
|
|
@@ -32,5 +32,6 @@ export declare const fetchComponents: () => Promise<{
|
|
|
32
32
|
package?: import("../../api/generated/core").Package;
|
|
33
33
|
state: import("../../api/generated/core").ComponentState;
|
|
34
34
|
isBookable: boolean;
|
|
35
|
+
creditEntries?: Array<import("../../api/generated/core").CreditEntry>;
|
|
35
36
|
}[];
|
|
36
37
|
}>;
|
|
@@ -8,14 +8,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import React, { useEffect, useMemo, useState } from "react";
|
|
11
|
-
import { Paper, Button, } from "@mui/material";
|
|
11
|
+
import { Paper, Box, Button, IconButton } from "@mui/material";
|
|
12
|
+
import ClearIcon from "@mui/icons-material/Clear";
|
|
12
13
|
import { useLocalErrors } from "../hooks/errors";
|
|
13
14
|
import { ComponentPool } from "../registry/types";
|
|
14
15
|
import { registerComponent } from "../registry/components";
|
|
15
16
|
import { CoreService } from "../../api/generated/core";
|
|
16
17
|
import { useComponentPicker } from "../contexts/ComponentPickerContext";
|
|
17
18
|
import { InternalServices } from "../../api/init";
|
|
18
|
-
import { getComponentDataByTemplateName, TEMPLATE_NAMES } from "../../lib/config/templateStructure";
|
|
19
|
+
import { getComponentDataByTemplateName, TEMPLATE_NAMES, } from "../../lib/config/templateStructure";
|
|
19
20
|
export const FormComponentPicker = ({ selectedComponent, onChange, templateIds, getError, label, enabled, }) => {
|
|
20
21
|
const [selected, setSelected] = useState();
|
|
21
22
|
const { get } = useComponentPicker();
|
|
@@ -37,30 +38,42 @@ export const FormComponentPicker = ({ selectedComponent, onChange, templateIds,
|
|
|
37
38
|
: selected.name;
|
|
38
39
|
}, [selected, selectedComponent, label]);
|
|
39
40
|
return (React.createElement(Paper, { component: "form", sx: { display: "flex", flexDirection: "column", gap: 1, p: 2, mb: 1 }, noValidate: true, autoComplete: "off" },
|
|
40
|
-
React.createElement(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
borderColor: !selectedComponent ? "error.
|
|
59
|
-
|
|
60
|
-
? "
|
|
61
|
-
:
|
|
62
|
-
|
|
63
|
-
|
|
41
|
+
React.createElement(Box, { sx: { position: "relative" } },
|
|
42
|
+
React.createElement(Button, { disabled: !enabled, onClick: () => {
|
|
43
|
+
get(templateIds)
|
|
44
|
+
.then((comp) => {
|
|
45
|
+
onChange(comp.id);
|
|
46
|
+
})
|
|
47
|
+
.catch(() => { });
|
|
48
|
+
}, variant: "outlined", fullWidth: true, sx: {
|
|
49
|
+
height: 56,
|
|
50
|
+
fontSize: "1rem",
|
|
51
|
+
fontWeight: 500,
|
|
52
|
+
borderRadius: 1,
|
|
53
|
+
textTransform: "none",
|
|
54
|
+
justifyContent: "flex-start",
|
|
55
|
+
px: 2,
|
|
56
|
+
pr: selectedComponent ? 6 : 2,
|
|
57
|
+
// Red if not selected
|
|
58
|
+
color: !selectedComponent ? "error.main" : "text.primary",
|
|
59
|
+
borderColor: !selectedComponent ? "error.main" : "divider",
|
|
60
|
+
"&:hover": {
|
|
61
|
+
borderColor: !selectedComponent ? "error.dark" : undefined,
|
|
62
|
+
backgroundColor: !selectedComponent
|
|
63
|
+
? "rgba(211, 47, 47, 0.04)"
|
|
64
|
+
: undefined,
|
|
65
|
+
},
|
|
66
|
+
} }, displayLabel),
|
|
67
|
+
selectedComponent && (React.createElement(IconButton, { disabled: !enabled, size: "small", onClick: (e) => {
|
|
68
|
+
e.stopPropagation();
|
|
69
|
+
onChange("");
|
|
70
|
+
}, sx: {
|
|
71
|
+
position: "absolute",
|
|
72
|
+
right: 8,
|
|
73
|
+
top: "50%",
|
|
74
|
+
transform: "translateY(-50%)",
|
|
75
|
+
} },
|
|
76
|
+
React.createElement(ClearIcon, { fontSize: "small" }))))));
|
|
64
77
|
};
|
|
65
78
|
const FormRendererComponentPicker = ({ data, handleChange, path, label, enabled, schema, }) => {
|
|
66
79
|
const getError = useLocalErrors(path);
|