Skip to content

Commit c7a8420

Browse files
committed
Add constants for print job options in Intelliprint
- Introduced a new constants file to define options for splitting methods, double-sided printing, postage services, and ideal envelope sizes. - Updated the create-a-print-job action to utilize these constants for improved maintainability and clarity.
1 parent 70da9d0 commit c7a8420

File tree

2 files changed

+37
-24
lines changed

2 files changed

+37
-24
lines changed

components/intelliprint/actions/create-a-print-job/create-a-print-job.mjs

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ import {
44
getFileStreamAndMetadata,
55
} from "@pipedream/platform";
66
import FormData from "form-data";
7+
import {
8+
DOUBLE_SIDED_OPTIONS,
9+
IDEAL_ENVELOPE_OPTIONS,
10+
POSTAGE_SERVICE_OPTIONS,
11+
SPLITTING_METHOD_OPTIONS,
12+
} from "../../common/constants.mjs";
713
import { camelCaseToSnakeCase } from "../../common/utils.mjs";
814
import intelliprint from "../../intelliprint.app.mjs";
915

@@ -47,11 +53,7 @@ export default {
4753
type: "string",
4854
label: "Splitting Method",
4955
description: "The method to use to split the Print Job into multiple Print Jobs.",
50-
options: [
51-
"none",
52-
"split_on_phrase",
53-
"split_on_page",
54-
],
56+
options: SPLITTING_METHOD_OPTIONS,
5557
optional: true,
5658
},
5759
splitOnPhrase: {
@@ -70,11 +72,7 @@ export default {
7072
type: "string",
7173
label: "Double Sided",
7274
description: "Whether to print these letters double sided.",
73-
options: [
74-
"no",
75-
"yes",
76-
"mixed",
77-
],
75+
options: DOUBLE_SIDED_OPTIONS,
7876
optional: true,
7977
},
8078
doubleSidedSpecificPages: {
@@ -93,26 +91,14 @@ export default {
9391
type: "string",
9492
label: "Postage Service",
9593
description: "The postage service to use for this Print Job.",
96-
options: [
97-
"uk_first_class",
98-
"uk_second_class",
99-
"uk_first_class_signed_for",
100-
"uk_second_class_signed_for",
101-
"uk_special_delivery",
102-
"international",
103-
],
94+
options: POSTAGE_SERVICE_OPTIONS,
10495
optional: true,
10596
},
10697
idealEnvelope: {
10798
type: "string",
10899
label: "Ideal Envelope",
109100
description: "The ideal envelope size for these letters.",
110-
options: [
111-
"c4",
112-
"c5",
113-
"c4_plus",
114-
"a4_box",
115-
],
101+
options: IDEAL_ENVELOPE_OPTIONS,
116102
optional: true,
117103
},
118104
mailDate: {
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
export const SPLITTING_METHOD_OPTIONS = [
2+
"none",
3+
"split_on_phrase",
4+
"split_on_page",
5+
];
6+
7+
export const DOUBLE_SIDED_OPTIONS = [
8+
"no",
9+
"yes",
10+
"mixed",
11+
];
12+
13+
export const POSTAGE_SERVICE_OPTIONS = [
14+
"uk_first_class",
15+
"uk_second_class",
16+
"uk_first_class_signed_for",
17+
"uk_second_class_signed_for",
18+
"uk_special_delivery",
19+
"international",
20+
];
21+
22+
export const IDEAL_ENVELOPE_OPTIONS = [
23+
"c4",
24+
"c5",
25+
"c4_plus",
26+
"a4_box",
27+
];

0 commit comments

Comments
 (0)