@pipedream/pandadoc 1.0.1 → 1.0.2
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.
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "Create Document From Template",
|
|
6
6
|
description: "Create a Document from a PandaDoc Template. [See the documentation here](https://developers.pandadoc.com/reference/create-document-from-pandadoc-template)",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.8",
|
|
9
9
|
props: {
|
|
10
10
|
app,
|
|
11
11
|
name: {
|
|
@@ -52,7 +52,12 @@ export default {
|
|
|
52
52
|
},
|
|
53
53
|
async additionalProps() {
|
|
54
54
|
const props = {};
|
|
55
|
-
|
|
55
|
+
if (!this.templateId) {
|
|
56
|
+
return props;
|
|
57
|
+
}
|
|
58
|
+
const {
|
|
59
|
+
fields, images,
|
|
60
|
+
} = await this.app.getTemplate({
|
|
56
61
|
templateId: this.templateId,
|
|
57
62
|
});
|
|
58
63
|
for (const field of fields) {
|
|
@@ -65,6 +70,15 @@ export default {
|
|
|
65
70
|
optional: true,
|
|
66
71
|
};
|
|
67
72
|
}
|
|
73
|
+
if (images?.length) {
|
|
74
|
+
for (const image of images) {
|
|
75
|
+
props[image.block_uuid] = {
|
|
76
|
+
type: "string",
|
|
77
|
+
label: `${image.name} URL`,
|
|
78
|
+
optional: true,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
68
82
|
return props;
|
|
69
83
|
},
|
|
70
84
|
methods: {
|
|
@@ -91,7 +105,9 @@ export default {
|
|
|
91
105
|
} = this;
|
|
92
106
|
|
|
93
107
|
const fields = {};
|
|
94
|
-
const {
|
|
108
|
+
const {
|
|
109
|
+
fields: items, images: templateImages,
|
|
110
|
+
} = await this.app.getTemplate({
|
|
95
111
|
templateId: this.templateId,
|
|
96
112
|
});
|
|
97
113
|
for (const field of items) {
|
|
@@ -103,6 +119,20 @@ export default {
|
|
|
103
119
|
};
|
|
104
120
|
}
|
|
105
121
|
|
|
122
|
+
const images = [];
|
|
123
|
+
if (templateImages?.length) {
|
|
124
|
+
for (const image of templateImages) {
|
|
125
|
+
if (this[image.block_uuid]) {
|
|
126
|
+
images.push({
|
|
127
|
+
name: image.name,
|
|
128
|
+
urls: [
|
|
129
|
+
this[image.block_uuid],
|
|
130
|
+
],
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
106
136
|
const response = await this.app.createDocument({
|
|
107
137
|
$,
|
|
108
138
|
data: {
|
|
@@ -113,6 +143,7 @@ export default {
|
|
|
113
143
|
recipients: this.parseToAnyArray(recipients),
|
|
114
144
|
tokens: this.parseToAnyArray(tokens),
|
|
115
145
|
fields,
|
|
146
|
+
images,
|
|
116
147
|
},
|
|
117
148
|
});
|
|
118
149
|
|