@posty5/n8n-nodes-posty5 4.2.0 → 5.1.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/README.md +364 -16
- package/dist/credentials/Posty5Api.credentials.d.ts +4 -0
- package/dist/credentials/Posty5Api.credentials.d.ts.map +1 -1
- package/dist/credentials/Posty5Api.credentials.js +30 -4
- package/dist/credentials/Posty5Api.credentials.js.map +1 -1
- package/dist/nodes/Posty5FormSubmission/Posty5FormSubmission.node.d.ts.map +1 -1
- package/dist/nodes/Posty5FormSubmission/Posty5FormSubmission.node.js +6 -2
- package/dist/nodes/Posty5FormSubmission/Posty5FormSubmission.node.js.map +1 -1
- package/dist/nodes/Posty5HtmlHosting/Posty5HtmlHosting.node.d.ts.map +1 -1
- package/dist/nodes/Posty5HtmlHosting/Posty5HtmlHosting.node.js +14 -3
- package/dist/nodes/Posty5HtmlHosting/Posty5HtmlHosting.node.js.map +1 -1
- package/dist/nodes/Posty5QrCode/Posty5QrCode.node.d.ts +8 -0
- package/dist/nodes/Posty5QrCode/Posty5QrCode.node.d.ts.map +1 -1
- package/dist/nodes/Posty5QrCode/Posty5QrCode.node.js +885 -190
- package/dist/nodes/Posty5QrCode/Posty5QrCode.node.js.map +1 -1
- package/dist/nodes/Posty5QrCode/helpers.d.ts +12 -0
- package/dist/nodes/Posty5QrCode/helpers.d.ts.map +1 -0
- package/dist/nodes/Posty5QrCode/helpers.js +56 -0
- package/dist/nodes/Posty5QrCode/helpers.js.map +1 -0
- package/dist/nodes/Posty5ShortLink/Posty5ShortLink.node.d.ts +8 -0
- package/dist/nodes/Posty5ShortLink/Posty5ShortLink.node.d.ts.map +1 -1
- package/dist/nodes/Posty5ShortLink/Posty5ShortLink.node.js +389 -78
- package/dist/nodes/Posty5ShortLink/Posty5ShortLink.node.js.map +1 -1
- package/dist/nodes/Posty5ShortLink/helpers.d.ts +12 -0
- package/dist/nodes/Posty5ShortLink/helpers.d.ts.map +1 -0
- package/dist/nodes/Posty5ShortLink/helpers.js +46 -0
- package/dist/nodes/Posty5ShortLink/helpers.js.map +1 -0
- package/dist/nodes/Posty5SocialPublisherPost/Posty5SocialPublisherPost.node.d.ts.map +1 -1
- package/dist/nodes/Posty5SocialPublisherPost/Posty5SocialPublisherPost.node.js +143 -52
- package/dist/nodes/Posty5SocialPublisherPost/Posty5SocialPublisherPost.node.js.map +1 -1
- package/dist/nodes/Posty5Store/Posty5Store.node.d.ts +17 -0
- package/dist/nodes/Posty5Store/Posty5Store.node.d.ts.map +1 -0
- package/dist/nodes/Posty5Store/Posty5Store.node.js +230 -0
- package/dist/nodes/Posty5Store/Posty5Store.node.js.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/fulfilment-group.description.d.ts +4 -0
- package/dist/nodes/Posty5Store/descriptions/fulfilment-group.description.d.ts.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/fulfilment-group.description.js +55 -0
- package/dist/nodes/Posty5Store/descriptions/fulfilment-group.description.js.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/order.description.d.ts +4 -0
- package/dist/nodes/Posty5Store/descriptions/order.description.d.ts.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/order.description.js +91 -0
- package/dist/nodes/Posty5Store/descriptions/order.description.js.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/product-link.description.d.ts +4 -0
- package/dist/nodes/Posty5Store/descriptions/product-link.description.d.ts.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/product-link.description.js +48 -0
- package/dist/nodes/Posty5Store/descriptions/product-link.description.js.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-order.description.d.ts +4 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-order.description.d.ts.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-order.description.js +118 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-order.description.js.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-product.description.d.ts +4 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-product.description.d.ts.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-product.description.js +167 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-product.description.js.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/supplier.description.d.ts +4 -0
- package/dist/nodes/Posty5Store/descriptions/supplier.description.d.ts.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/supplier.description.js +50 -0
- package/dist/nodes/Posty5Store/descriptions/supplier.description.js.map +1 -0
- package/dist/nodes/Posty5Trigger/Posty5Trigger.node.d.ts +13 -0
- package/dist/nodes/Posty5Trigger/Posty5Trigger.node.d.ts.map +1 -0
- package/dist/nodes/Posty5Trigger/Posty5Trigger.node.js +171 -0
- package/dist/nodes/Posty5Trigger/Posty5Trigger.node.js.map +1 -0
- package/dist/nodes/Posty5Trigger/config.d.ts +51 -0
- package/dist/nodes/Posty5Trigger/config.d.ts.map +1 -0
- package/dist/nodes/Posty5Trigger/config.js +76 -0
- package/dist/nodes/Posty5Trigger/config.js.map +1 -0
- package/dist/nodes/Posty5Trigger/descriptions.d.ts +4 -0
- package/dist/nodes/Posty5Trigger/descriptions.d.ts.map +1 -0
- package/dist/nodes/Posty5Trigger/descriptions.js +99 -0
- package/dist/nodes/Posty5Trigger/descriptions.js.map +1 -0
- package/dist/nodes/Posty5Trigger/helpers.d.ts +34 -0
- package/dist/nodes/Posty5Trigger/helpers.d.ts.map +1 -0
- package/dist/nodes/Posty5Trigger/helpers.js +139 -0
- package/dist/nodes/Posty5Trigger/helpers.js.map +1 -0
- package/dist/package.json +78 -0
- package/dist/types/common.d.ts +70 -0
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/link-analytics.types.d.ts +147 -0
- package/dist/types/link-analytics.types.d.ts.map +1 -0
- package/dist/types/link-analytics.types.js +10 -0
- package/dist/types/link-analytics.types.js.map +1 -0
- package/dist/types/link-bulk.types.d.ts +68 -0
- package/dist/types/link-bulk.types.d.ts.map +1 -0
- package/dist/types/link-bulk.types.js +8 -0
- package/dist/types/link-bulk.types.js.map +1 -0
- package/dist/types/qr-code.types.d.ts +252 -56
- package/dist/types/qr-code.types.d.ts.map +1 -1
- package/dist/types/short-link-controls.types.d.ts +82 -0
- package/dist/types/short-link-controls.types.d.ts.map +1 -0
- package/dist/types/short-link-controls.types.js +7 -0
- package/dist/types/short-link-controls.types.js.map +1 -0
- package/dist/types/short-link.types.d.ts +63 -15
- package/dist/types/short-link.types.d.ts.map +1 -1
- package/dist/types/store.types.d.ts +71 -0
- package/dist/types/store.types.d.ts.map +1 -0
- package/dist/types/store.types.js +7 -0
- package/dist/types/store.types.js.map +1 -0
- package/dist/types/webhook.types.d.ts +66 -0
- package/dist/types/webhook.types.d.ts.map +1 -0
- package/dist/types/webhook.types.js +7 -0
- package/dist/types/webhook.types.js.map +1 -0
- package/dist/utils/analytics.helpers.d.ts +68 -0
- package/dist/utils/analytics.helpers.d.ts.map +1 -0
- package/dist/utils/analytics.helpers.js +202 -0
- package/dist/utils/analytics.helpers.js.map +1 -0
- package/dist/utils/analytics.properties.d.ts +10 -0
- package/dist/utils/analytics.properties.d.ts.map +1 -0
- package/dist/utils/analytics.properties.js +172 -0
- package/dist/utils/analytics.properties.js.map +1 -0
- package/dist/utils/api.helpers.d.ts +50 -3
- package/dist/utils/api.helpers.d.ts.map +1 -1
- package/dist/utils/api.helpers.js +170 -7
- package/dist/utils/api.helpers.js.map +1 -1
- package/dist/utils/constants.d.ts +239 -0
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +260 -1
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/date.helpers.d.ts +25 -0
- package/dist/utils/date.helpers.d.ts.map +1 -0
- package/dist/utils/date.helpers.js +65 -0
- package/dist/utils/date.helpers.js.map +1 -0
- package/dist/utils/link-bulk.helpers.d.ts +26 -0
- package/dist/utils/link-bulk.helpers.d.ts.map +1 -0
- package/dist/utils/link-bulk.helpers.js +135 -0
- package/dist/utils/link-bulk.helpers.js.map +1 -0
- package/dist/utils/link-bulk.properties.d.ts +9 -0
- package/dist/utils/link-bulk.properties.d.ts.map +1 -0
- package/dist/utils/link-bulk.properties.js +113 -0
- package/dist/utils/link-bulk.properties.js.map +1 -0
- package/dist/utils/link-tool.helpers.d.ts +43 -0
- package/dist/utils/link-tool.helpers.d.ts.map +1 -0
- package/dist/utils/link-tool.helpers.js +121 -0
- package/dist/utils/link-tool.helpers.js.map +1 -0
- package/dist/utils/post-comments.d.ts +43 -0
- package/dist/utils/post-comments.d.ts.map +1 -0
- package/dist/utils/post-comments.js +53 -0
- package/dist/utils/post-comments.js.map +1 -0
- package/dist/utils/qr-content.config.d.ts +66 -0
- package/dist/utils/qr-content.config.d.ts.map +1 -0
- package/dist/utils/qr-content.config.js +139 -0
- package/dist/utils/qr-content.config.js.map +1 -0
- package/dist/utils/qr-file.helpers.d.ts +22 -0
- package/dist/utils/qr-file.helpers.d.ts.map +1 -0
- package/dist/utils/qr-file.helpers.js +63 -0
- package/dist/utils/qr-file.helpers.js.map +1 -0
- package/dist/utils/qr-render.helpers.d.ts +48 -0
- package/dist/utils/qr-render.helpers.d.ts.map +1 -0
- package/dist/utils/qr-render.helpers.js +172 -0
- package/dist/utils/qr-render.helpers.js.map +1 -0
- package/dist/utils/qr-render.properties.d.ts +8 -0
- package/dist/utils/qr-render.properties.d.ts.map +1 -0
- package/dist/utils/qr-render.properties.js +143 -0
- package/dist/utils/qr-render.properties.js.map +1 -0
- package/dist/utils/qr-target.helpers.d.ts +35 -0
- package/dist/utils/qr-target.helpers.d.ts.map +1 -0
- package/dist/utils/qr-target.helpers.js +260 -0
- package/dist/utils/qr-target.helpers.js.map +1 -0
- package/dist/utils/qr-templates.helpers.d.ts +26 -0
- package/dist/utils/qr-templates.helpers.d.ts.map +1 -0
- package/dist/utils/qr-templates.helpers.js +70 -0
- package/dist/utils/qr-templates.helpers.js.map +1 -0
- package/dist/utils/short-link-controls.helpers.d.ts +31 -0
- package/dist/utils/short-link-controls.helpers.d.ts.map +1 -0
- package/dist/utils/short-link-controls.helpers.js +185 -0
- package/dist/utils/short-link-controls.helpers.js.map +1 -0
- package/dist/utils/short-link-controls.properties.d.ts +17 -0
- package/dist/utils/short-link-controls.properties.d.ts.map +1 -0
- package/dist/utils/short-link-controls.properties.js +315 -0
- package/dist/utils/short-link-controls.properties.js.map +1 -0
- package/dist/utils/store.helpers.d.ts +43 -0
- package/dist/utils/store.helpers.d.ts.map +1 -0
- package/dist/utils/store.helpers.js +87 -0
- package/dist/utils/store.helpers.js.map +1 -0
- package/dist/utils/versioned-write.helpers.d.ts +31 -0
- package/dist/utils/versioned-write.helpers.d.ts.map +1 -0
- package/dist/utils/versioned-write.helpers.js +120 -0
- package/dist/utils/versioned-write.helpers.js.map +1 -0
- package/package.json +7 -3
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* `qrCodeTarget` for the QR Code node.
|
|
4
|
+
*
|
|
5
|
+
* The API reads a QR code's content from `qrCodeTarget: { type, [type]: {...} }`
|
|
6
|
+
* and nowhere else. The node builds no `options.text`: the server encodes the
|
|
7
|
+
* target itself, so the stored text is always the one its safety checks saw.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.requiredQrMode = requiredQrMode;
|
|
11
|
+
exports.buildQrCodeTarget = buildQrCodeTarget;
|
|
12
|
+
exports.readQrMode = readQrMode;
|
|
13
|
+
exports.buildQrAccess = buildQrAccess;
|
|
14
|
+
const constants_1 = require("./constants");
|
|
15
|
+
const link_tool_helpers_1 = require("./link-tool.helpers");
|
|
16
|
+
const qr_content_config_1 = require("./qr-content.config");
|
|
17
|
+
/** A coordinate as the API takes it: a number, or the text an expression produced. */
|
|
18
|
+
function toCoordinate(value) {
|
|
19
|
+
return typeof value === 'number' ? value : (0, link_tool_helpers_1.toText)(value).trim();
|
|
20
|
+
}
|
|
21
|
+
/** Sets `target[key]` to the trimmed text of `value`, or leaves it unset when empty. */
|
|
22
|
+
function setText(target, key, value) {
|
|
23
|
+
const text = (0, link_tool_helpers_1.toText)(value).trim();
|
|
24
|
+
if (text)
|
|
25
|
+
target[key] = text;
|
|
26
|
+
}
|
|
27
|
+
/** A boolean parameter, also accepting the text `"true"` an expression may produce. */
|
|
28
|
+
function readBoolean(value) {
|
|
29
|
+
return value === true || (0, link_tool_helpers_1.toText)(value).trim().toLowerCase() === 'true';
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* An event date-time as the API takes it: an ISO string kept as typed (a
|
|
33
|
+
* wall-clock value is read in the event's timezone), a `Date` as ISO, or
|
|
34
|
+
* `undefined` when empty.
|
|
35
|
+
*/
|
|
36
|
+
function readEventDateTime(value) {
|
|
37
|
+
if (value instanceof Date)
|
|
38
|
+
return value.toISOString();
|
|
39
|
+
const text = (0, link_tool_helpers_1.toText)(value).trim();
|
|
40
|
+
return text || undefined;
|
|
41
|
+
}
|
|
42
|
+
/** The vCard target: empty fields are not sent; emails split on commas, at most the API's cap. */
|
|
43
|
+
function buildVCardTarget(read) {
|
|
44
|
+
const config = qr_content_config_1.QR_CONTENT_CONFIG.vcard;
|
|
45
|
+
const vcard = {};
|
|
46
|
+
setText(vcard, 'firstName', read('vcardFirstName', ''));
|
|
47
|
+
setText(vcard, 'lastName', read('vcardLastName', ''));
|
|
48
|
+
setText(vcard, 'organization', read('vcardOrganization', ''));
|
|
49
|
+
setText(vcard, 'jobTitle', read('vcardJobTitle', ''));
|
|
50
|
+
const phonesParameter = (read('vcardPhones', {}) ?? {});
|
|
51
|
+
const phones = (phonesParameter.phone ?? [])
|
|
52
|
+
.map((row) => ({
|
|
53
|
+
kind: ((0, link_tool_helpers_1.toText)(row.kind).trim() || config.defaultPhoneKind),
|
|
54
|
+
number: (0, link_tool_helpers_1.toText)(row.number).trim(),
|
|
55
|
+
}))
|
|
56
|
+
.filter((phone) => phone.number);
|
|
57
|
+
// Over the cap is sent as is: the API's 400 names the limit.
|
|
58
|
+
if (phones.length)
|
|
59
|
+
vcard.phones = phones;
|
|
60
|
+
const emailsValue = read('vcardEmails', '');
|
|
61
|
+
const emails = (Array.isArray(emailsValue) ? emailsValue : (0, link_tool_helpers_1.toText)(emailsValue).split(config.emailSeparator))
|
|
62
|
+
.map((email) => (0, link_tool_helpers_1.toText)(email).trim())
|
|
63
|
+
.filter(Boolean);
|
|
64
|
+
if (emails.length)
|
|
65
|
+
vcard.emails = emails;
|
|
66
|
+
setText(vcard, 'website', read('vcardWebsite', ''));
|
|
67
|
+
const addressParameter = (read('vcardAddress', {}) ?? {});
|
|
68
|
+
const address = {};
|
|
69
|
+
for (const key of ['street', 'city', 'region', 'postalCode', 'country']) {
|
|
70
|
+
setText(address, key, addressParameter[key]);
|
|
71
|
+
}
|
|
72
|
+
if (Object.keys(address).length)
|
|
73
|
+
vcard.address = address;
|
|
74
|
+
setText(vcard, 'note', read('vcardNote', ''));
|
|
75
|
+
return vcard;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The social target from the Profiles fixedCollection (up to 12 rows). Rows
|
|
79
|
+
* with neither a handle nor a URL are dropped; over the cap is sent as is (the
|
|
80
|
+
* API's 400 names the limit). `title` only when set.
|
|
81
|
+
*/
|
|
82
|
+
function buildSocialTarget(read) {
|
|
83
|
+
const parameter = (read('socialProfiles', {}) ?? {});
|
|
84
|
+
const profiles = [];
|
|
85
|
+
for (const row of parameter.profile ?? []) {
|
|
86
|
+
const profile = {
|
|
87
|
+
platform: ((0, link_tool_helpers_1.toText)(row.platform).trim() || qr_content_config_1.QR_CONTENT_CONFIG.social.defaultPlatform),
|
|
88
|
+
};
|
|
89
|
+
setText(profile, 'handle', row.handle);
|
|
90
|
+
setText(profile, 'url', row.url);
|
|
91
|
+
if (profile.handle || profile.url)
|
|
92
|
+
profiles.push(profile);
|
|
93
|
+
}
|
|
94
|
+
const social = { profiles };
|
|
95
|
+
setText(social, 'title', read('socialTitle', ''));
|
|
96
|
+
return social;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* `dynamic` when the target has no static form — an `appStore` or `file` code,
|
|
100
|
+
* or `social` with more than one profile — so the node sends `mode: dynamic`
|
|
101
|
+
* whatever Mode says (the API answers 400 to a static one); else `undefined`.
|
|
102
|
+
*/
|
|
103
|
+
function requiredQrMode(target) {
|
|
104
|
+
if (qr_content_config_1.QR_CONTENT_CONFIG.dynamicOnlyTypes.includes(target.type))
|
|
105
|
+
return 'dynamic';
|
|
106
|
+
if (target.type === 'social' && (target.social?.profiles.length ?? 0) > qr_content_config_1.QR_CONTENT_CONFIG.social.maxProfilesStatic) {
|
|
107
|
+
return 'dynamic';
|
|
108
|
+
}
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* The `qrCodeTarget` for one QR type, read from that type's node fields.
|
|
113
|
+
* Optional values left empty (email subject/body, SMS message, WiFi password)
|
|
114
|
+
* are not sent; an open network never sends a password.
|
|
115
|
+
*/
|
|
116
|
+
function buildQrCodeTarget(qrType, read) {
|
|
117
|
+
switch (qrType) {
|
|
118
|
+
case 'url':
|
|
119
|
+
return { type: 'url', url: { url: (0, link_tool_helpers_1.toText)(read('url', '')).trim() } };
|
|
120
|
+
case 'freeText':
|
|
121
|
+
return { type: 'freeText', freeText: { text: (0, link_tool_helpers_1.toText)(read('text', '')) } };
|
|
122
|
+
case 'email': {
|
|
123
|
+
const email = { email: (0, link_tool_helpers_1.toText)(read('email', '')).trim() };
|
|
124
|
+
const subject = (0, link_tool_helpers_1.toText)(read('emailSubject', ''));
|
|
125
|
+
const body = (0, link_tool_helpers_1.toText)(read('emailBody', ''));
|
|
126
|
+
if (subject)
|
|
127
|
+
email.subject = subject;
|
|
128
|
+
if (body)
|
|
129
|
+
email.body = body;
|
|
130
|
+
return { type: 'email', email };
|
|
131
|
+
}
|
|
132
|
+
case 'wifi': {
|
|
133
|
+
const authenticationType = (0, link_tool_helpers_1.toText)(read('wifiAuthType', constants_1.QR_WIFI_AUTH.DEFAULT)) || constants_1.QR_WIFI_AUTH.DEFAULT;
|
|
134
|
+
const wifi = { name: (0, link_tool_helpers_1.toText)(read('wifiName', '')), authenticationType };
|
|
135
|
+
const password = authenticationType === constants_1.QR_WIFI_AUTH.OPEN_NETWORK ? '' : (0, link_tool_helpers_1.toText)(read('wifiPassword', ''));
|
|
136
|
+
if (password)
|
|
137
|
+
wifi.password = password;
|
|
138
|
+
return { type: 'wifi', wifi };
|
|
139
|
+
}
|
|
140
|
+
case 'call':
|
|
141
|
+
return { type: 'call', call: { phoneNumber: (0, link_tool_helpers_1.toText)(read('phoneNumber', '')).trim() } };
|
|
142
|
+
case 'sms': {
|
|
143
|
+
const sms = { phoneNumber: (0, link_tool_helpers_1.toText)(read('smsPhoneNumber', '')).trim() };
|
|
144
|
+
const message = (0, link_tool_helpers_1.toText)(read('smsMessage', ''));
|
|
145
|
+
if (message)
|
|
146
|
+
sms.message = message;
|
|
147
|
+
return { type: 'sms', sms };
|
|
148
|
+
}
|
|
149
|
+
case 'geolocation':
|
|
150
|
+
return {
|
|
151
|
+
type: 'geolocation',
|
|
152
|
+
geolocation: {
|
|
153
|
+
latitude: toCoordinate(read('latitude', 0)),
|
|
154
|
+
longitude: toCoordinate(read('longitude', 0)),
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
case 'vcard':
|
|
158
|
+
return { type: 'vcard', vcard: buildVCardTarget(read) };
|
|
159
|
+
case 'event': {
|
|
160
|
+
const event = {
|
|
161
|
+
title: (0, link_tool_helpers_1.toText)(read('eventTitle', '')).trim(),
|
|
162
|
+
startsAt: readEventDateTime(read('eventStartsAt', '')) ?? '',
|
|
163
|
+
};
|
|
164
|
+
setText(event, 'location', read('eventLocation', ''));
|
|
165
|
+
setText(event, 'description', read('eventDescription', ''));
|
|
166
|
+
const endsAt = readEventDateTime(read('eventEndsAt', ''));
|
|
167
|
+
if (endsAt)
|
|
168
|
+
event.endsAt = endsAt;
|
|
169
|
+
if (readBoolean(read('eventAllDay', false)))
|
|
170
|
+
event.allDay = true;
|
|
171
|
+
setText(event, 'timezone', read('eventTimezone', qr_content_config_1.QR_CONTENT_CONFIG.event.defaultTimezone));
|
|
172
|
+
setText(event, 'url', read('eventUrl', ''));
|
|
173
|
+
return { type: 'event', event };
|
|
174
|
+
}
|
|
175
|
+
case 'whatsapp': {
|
|
176
|
+
const whatsapp = {
|
|
177
|
+
phoneNumber: (0, link_tool_helpers_1.toText)(read('whatsappPhoneNumber', '')).trim(),
|
|
178
|
+
};
|
|
179
|
+
const message = (0, link_tool_helpers_1.toText)(read('whatsappMessage', ''));
|
|
180
|
+
if (message)
|
|
181
|
+
whatsapp.message = message;
|
|
182
|
+
return { type: 'whatsapp', whatsapp };
|
|
183
|
+
}
|
|
184
|
+
case 'review': {
|
|
185
|
+
const platform = (0, link_tool_helpers_1.toText)(read('reviewPlatform', 'google')).trim();
|
|
186
|
+
const review = { platform };
|
|
187
|
+
// Place ID is a Google-only field; another platform never sends it.
|
|
188
|
+
if (platform === qr_content_config_1.QR_CONTENT_CONFIG.review.placeIdPlatform) {
|
|
189
|
+
setText(review, 'placeId', read('reviewPlaceId', ''));
|
|
190
|
+
}
|
|
191
|
+
setText(review, 'url', read('reviewUrl', ''));
|
|
192
|
+
return { type: 'review', review };
|
|
193
|
+
}
|
|
194
|
+
case 'social':
|
|
195
|
+
return { type: 'social', social: buildSocialTarget(read) };
|
|
196
|
+
case 'appStore': {
|
|
197
|
+
const appStore = { fallbackUrl: (0, link_tool_helpers_1.toText)(read('appStoreFallbackUrl', '')).trim() };
|
|
198
|
+
setText(appStore, 'androidUrl', read('appStoreAndroidUrl', ''));
|
|
199
|
+
setText(appStore, 'iosUrl', read('appStoreIosUrl', ''));
|
|
200
|
+
return { type: 'appStore', appStore };
|
|
201
|
+
}
|
|
202
|
+
case 'file': {
|
|
203
|
+
// `bucketFilePath` is added by the node after the upload (see `uploadQrFile`);
|
|
204
|
+
// without it an update keeps the stored file.
|
|
205
|
+
const file = {};
|
|
206
|
+
setText(file, 'fileName', read('fileName', ''));
|
|
207
|
+
return { type: 'file', file };
|
|
208
|
+
}
|
|
209
|
+
default:
|
|
210
|
+
throw new Error(`Unsupported QR type "${qrType}". Use one of: ${constants_1.QR_CODE_TYPES.join(', ')}.`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* A Mode parameter value as the API takes it: `static`, `dynamic`, or
|
|
215
|
+
* `undefined` for anything else (an empty "Keep Current", or an expression that
|
|
216
|
+
* resolved to an empty string), so the caller sends no `mode` at all.
|
|
217
|
+
*/
|
|
218
|
+
function readQrMode(value) {
|
|
219
|
+
const mode = (0, link_tool_helpers_1.toText)(value).trim().toLowerCase();
|
|
220
|
+
return mode === 'static' || mode === 'dynamic' ? mode : undefined;
|
|
221
|
+
}
|
|
222
|
+
/** A date-time parameter as ISO, or `undefined` when empty (an expression that resolved to ''). */
|
|
223
|
+
function readDateTime(value) {
|
|
224
|
+
if (value instanceof Date)
|
|
225
|
+
return value.toISOString();
|
|
226
|
+
const text = (0, link_tool_helpers_1.toText)(value).trim();
|
|
227
|
+
if (!text)
|
|
228
|
+
return undefined;
|
|
229
|
+
const parsed = new Date(text);
|
|
230
|
+
// Leave anything unparseable as typed: the API's 400 names the field.
|
|
231
|
+
return Number.isNaN(parsed.getTime()) ? text : parsed.toISOString();
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* The `access` body value from the Scan Rules collection:
|
|
235
|
+
* - `undefined`: nothing set, send no `access` (Update keeps the stored rules);
|
|
236
|
+
* - `null`: Clear Scan Rules is on, send `access: null`;
|
|
237
|
+
* - otherwise the rules object, which replaces the stored rules as a whole.
|
|
238
|
+
* Empty values (including expressions that resolve to '') are skipped.
|
|
239
|
+
*/
|
|
240
|
+
function buildQrAccess(rules) {
|
|
241
|
+
if (!rules)
|
|
242
|
+
return undefined;
|
|
243
|
+
if (rules.clearScanRules === true || (0, link_tool_helpers_1.toText)(rules.clearScanRules).trim().toLowerCase() === 'true')
|
|
244
|
+
return null;
|
|
245
|
+
const access = {};
|
|
246
|
+
const activeFrom = readDateTime(rules.activeFrom);
|
|
247
|
+
if (activeFrom)
|
|
248
|
+
access.activeFrom = activeFrom;
|
|
249
|
+
const expiresAt = readDateTime(rules.expiresAt);
|
|
250
|
+
if (expiresAt)
|
|
251
|
+
access.expiresAt = expiresAt;
|
|
252
|
+
const maxVisitsText = (0, link_tool_helpers_1.toText)(rules.maxVisits).trim();
|
|
253
|
+
if (maxVisitsText)
|
|
254
|
+
access.maxVisits = Number(maxVisitsText);
|
|
255
|
+
const fallbackUrl = (0, link_tool_helpers_1.toText)(rules.fallbackUrl).trim();
|
|
256
|
+
if (fallbackUrl)
|
|
257
|
+
access.fallbackUrl = fallbackUrl;
|
|
258
|
+
return Object.keys(access).length ? access : undefined;
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=qr-target.helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qr-target.helpers.js","sourceRoot":"","sources":["../../utils/qr-target.helpers.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AA0HH,wCAMC;AAOD,8CAyGC;AAOD,gCAGC;AAmBD,sCAeC;AA1RD,2CAA0D;AAC1D,2DAA6C;AAC7C,2DAAwD;AA2BxD,sFAAsF;AACtF,SAAS,YAAY,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAA,0BAAM,EAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;AACjE,CAAC;AAED,wFAAwF;AACxF,SAAS,OAAO,CAAmB,MAAS,EAAE,GAAqB,EAAE,KAAc;IAClF,MAAM,IAAI,GAAG,IAAA,0BAAM,EAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;IAClC,IAAI,IAAI;QAAG,MAAkC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;AAC3D,CAAC;AAED,uFAAu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
|
|
|
1
|
+
/**
|
|
2
|
+
* The Template field of the Short Link and QR Code nodes: the dropdown's
|
|
3
|
+
* options, and which template a run sends.
|
|
4
|
+
*
|
|
5
|
+
* The Posty5 API requires `templateId` on every create and update made with an
|
|
6
|
+
* API key (which is every n8n call), so the node never sends a write without one.
|
|
7
|
+
*/
|
|
8
|
+
import type { ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow';
|
|
9
|
+
import type { ILinkToolAdditionalFields, ILinkToolStoredFields } from '../types/common';
|
|
10
|
+
import type { IQRCodeTemplateLookupItem } from '../types/qr-code.types';
|
|
11
|
+
/**
|
|
12
|
+
* `loadOptions` for the Template field: the caller's own templates first, then
|
|
13
|
+
* the public ones. A template in both lists appears once, as the caller's.
|
|
14
|
+
* A bad credential rejects the call, so n8n shows the error in the dropdown.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getQrTemplates(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
17
|
+
/** The dropdown options for two lookup pages: the caller's templates, then the public ones not already listed. */
|
|
18
|
+
export declare function mergeQrTemplateOptions(userTemplates: IQRCodeTemplateLookupItem[], publicTemplates: IQRCodeTemplateLookupItem[]): INodePropertyOptions[];
|
|
19
|
+
/**
|
|
20
|
+
* The template a write sends: the Template field; else the deprecated
|
|
21
|
+
* Additional Fields value that workflows saved before 4.6.0 carry; else, on
|
|
22
|
+
* Update, the record's stored template. Throws when there is none, before any
|
|
23
|
+
* request is made.
|
|
24
|
+
*/
|
|
25
|
+
export declare function requireTemplateId(selected: unknown, fields: ILinkToolAdditionalFields, stored?: ILinkToolStoredFields): string;
|
|
26
|
+
//# sourceMappingURL=qr-templates.helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qr-templates.helpers.d.ts","sourceRoot":"","sources":["../../utils/qr-templates.helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAIhF,OAAO,KAAK,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxF,OAAO,KAAK,EAAE,yBAAyB,EAA6B,MAAM,wBAAwB,CAAC;AAEnG;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAmBjG;AAED,kHAAkH;AAClH,wBAAgB,sBAAsB,CACrC,aAAa,EAAE,yBAAyB,EAAE,EAC1C,eAAe,EAAE,yBAAyB,EAAE,GAC1C,oBAAoB,EAAE,CAiBxB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE,yBAAyB,EACjC,MAAM,CAAC,EAAE,qBAAqB,GAC5B,MAAM,CAIR"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The Template field of the Short Link and QR Code nodes: the dropdown's
|
|
4
|
+
* options, and which template a run sends.
|
|
5
|
+
*
|
|
6
|
+
* The Posty5 API requires `templateId` on every create and update made with an
|
|
7
|
+
* API key (which is every n8n call), so the node never sends a write without one.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.getQrTemplates = getQrTemplates;
|
|
11
|
+
exports.mergeQrTemplateOptions = mergeQrTemplateOptions;
|
|
12
|
+
exports.requireTemplateId = requireTemplateId;
|
|
13
|
+
const api_helpers_1 = require("./api.helpers");
|
|
14
|
+
const constants_1 = require("./constants");
|
|
15
|
+
const link_tool_helpers_1 = require("./link-tool.helpers");
|
|
16
|
+
/**
|
|
17
|
+
* `loadOptions` for the Template field: the caller's own templates first, then
|
|
18
|
+
* the public ones. A template in both lists appears once, as the caller's.
|
|
19
|
+
* A bad credential rejects the call, so n8n shows the error in the dropdown.
|
|
20
|
+
*/
|
|
21
|
+
async function getQrTemplates() {
|
|
22
|
+
const credentials = await this.getCredentials('posty5Api');
|
|
23
|
+
const apiKey = credentials.apiKey;
|
|
24
|
+
const qs = { pageSize: constants_1.QR_TEMPLATE_LOOKUP.PAGE_SIZE };
|
|
25
|
+
const [userPage, publicPage] = (await Promise.all([
|
|
26
|
+
api_helpers_1.makeApiRequest.call(this, apiKey, {
|
|
27
|
+
method: 'GET',
|
|
28
|
+
endpoint: `${constants_1.API_ENDPOINTS.QR_CODE_TEMPLATE}${constants_1.QR_TEMPLATE_LOOKUP.USER_PATH}`,
|
|
29
|
+
qs,
|
|
30
|
+
}),
|
|
31
|
+
api_helpers_1.makeApiRequest.call(this, apiKey, {
|
|
32
|
+
method: 'GET',
|
|
33
|
+
endpoint: `${constants_1.API_ENDPOINTS.QR_CODE_TEMPLATE}${constants_1.QR_TEMPLATE_LOOKUP.PUBLIC_PATH}`,
|
|
34
|
+
qs,
|
|
35
|
+
}),
|
|
36
|
+
]));
|
|
37
|
+
return mergeQrTemplateOptions(userPage?.items || [], publicPage?.items || []);
|
|
38
|
+
}
|
|
39
|
+
/** The dropdown options for two lookup pages: the caller's templates, then the public ones not already listed. */
|
|
40
|
+
function mergeQrTemplateOptions(userTemplates, publicTemplates) {
|
|
41
|
+
const seen = new Set();
|
|
42
|
+
const options = [];
|
|
43
|
+
const lists = [
|
|
44
|
+
[userTemplates, constants_1.QR_TEMPLATE_LOOKUP.USER_LABEL],
|
|
45
|
+
[publicTemplates, constants_1.QR_TEMPLATE_LOOKUP.PUBLIC_LABEL],
|
|
46
|
+
];
|
|
47
|
+
for (const [templates, description] of lists) {
|
|
48
|
+
for (const template of templates) {
|
|
49
|
+
const id = (0, link_tool_helpers_1.firstText)(template?._id);
|
|
50
|
+
if (!id || seen.has(id))
|
|
51
|
+
continue;
|
|
52
|
+
seen.add(id);
|
|
53
|
+
options.push({ name: (0, link_tool_helpers_1.firstText)(template.name) || id, value: id, description });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return options;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The template a write sends: the Template field; else the deprecated
|
|
60
|
+
* Additional Fields value that workflows saved before 4.6.0 carry; else, on
|
|
61
|
+
* Update, the record's stored template. Throws when there is none, before any
|
|
62
|
+
* request is made.
|
|
63
|
+
*/
|
|
64
|
+
function requireTemplateId(selected, fields, stored) {
|
|
65
|
+
const templateId = (0, link_tool_helpers_1.firstText)(selected, fields.templateId, stored?.templateId);
|
|
66
|
+
if (!templateId)
|
|
67
|
+
throw new Error(constants_1.LINK_TOOL_MESSAGES.TEMPLATE_REQUIRED);
|
|
68
|
+
return templateId;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=qr-templates.helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qr-templates.helpers.js","sourceRoot":"","sources":["../../utils/qr-templates.helpers.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAcH,wCAmBC;AAGD,wDAoBC;AAQD,8CAQC;AArED,+CAA+C;AAC/C,2CAAoF;AACpF,2DAAgD;AAIhD;;;;GAIG;AACI,KAAK,UAAU,cAAc;IACnC,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,WAAW,CAAC,MAAgB,CAAC;IAC5C,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,8BAAkB,CAAC,SAAS,EAAE,CAAC;IAEtD,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC;QACjD,4BAAc,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE;YACjC,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,GAAG,yBAAa,CAAC,gBAAgB,GAAG,8BAAkB,CAAC,SAAS,EAAE;YAC5E,EAAE;SACF,CAAC;QACF,4BAAc,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE;Y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AE,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;IAC9E,IAAI,CAAC,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,8BAAkB,CAAC,iBAAiB,CAAC,CAAC;IACvE,OAAO,UAAU,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Short link controls: the body keys built from the node's control fields, the
|
|
3
|
+
* campaign bodies and the Campaign dropdown.
|
|
4
|
+
*
|
|
5
|
+
* Create sends only what the user filled in. Update and Set Rules send every
|
|
6
|
+
* field the user added: an empty value clears it (the API merges `access` key
|
|
7
|
+
* by key, and an absent section keeps the stored one).
|
|
8
|
+
*/
|
|
9
|
+
import { ILoadOptionsFunctions, INode, INodePropertyOptions } from 'n8n-workflow';
|
|
10
|
+
import type { ILinkCampaignBody, ILinkCampaignFields, IShortLinkAccess, IShortLinkControlBody, IShortLinkControlFields, IShortLinkPixel, IShortLinkUtm } from '../types/short-link-controls.types';
|
|
11
|
+
export type ControlsMode = 'create' | 'update';
|
|
12
|
+
/** A comma-separated list as trimmed, non-empty, unique items. */
|
|
13
|
+
export declare function splitList(value: unknown): string[];
|
|
14
|
+
/** A `json` parameter as an array; anything else throws naming the field. */
|
|
15
|
+
export declare function parseJsonArray(node: INode, value: unknown, field: string, itemIndex: number): unknown[];
|
|
16
|
+
/** The UTM values of a single-value fixedCollection; empty values are left out, or sent as null on update. */
|
|
17
|
+
export declare function buildUtm(values: IShortLinkUtm | undefined, mode: ControlsMode): IShortLinkUtm | null | undefined;
|
|
18
|
+
/** The `access` object; `removePassword` wins over a password. */
|
|
19
|
+
export declare function buildAccess(fields: IShortLinkControlFields, mode: ControlsMode): IShortLinkAccess | undefined;
|
|
20
|
+
/** The pixels of a multiple-value fixedCollection, the ones with an ID. */
|
|
21
|
+
export declare function buildPixels(fields: IShortLinkControlFields): IShortLinkPixel[];
|
|
22
|
+
/**
|
|
23
|
+
* The control keys of a create / update / set-rules body.
|
|
24
|
+
* @throws NodeOperationError when Routing Rules or Variants is not a JSON array.
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildControlFields(node: INode, fields: IShortLinkControlFields, mode: ControlsMode, itemIndex: number): IShortLinkControlBody;
|
|
27
|
+
/** A campaign create / update body; on update only the fields the user added. */
|
|
28
|
+
export declare function buildCampaignBody(name: string, fields: ILinkCampaignFields, mode: ControlsMode): ILinkCampaignBody;
|
|
29
|
+
/** The Campaign dropdown: the caller's campaigns that are not archived. */
|
|
30
|
+
export declare function getCampaigns(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
31
|
+
//# sourceMappingURL=short-link-controls.helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"short-link-controls.helpers.d.ts","sourceRoot":"","sources":["../../utils/short-link-controls.helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,qBAAqB,EAAE,KAAK,EAAE,oBAAoB,EAAsB,MAAM,cAAc,CAAC;AAUtG,OAAO,KAAK,EACX,iBAAiB,EACjB,mBAAmB,EAEnB,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,EACf,aAAa,EACb,MAAM,oCAAoC,CAAC;AAE5C,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE/C,kEAAkE;AAClE,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAMlD;AAED,6EAA6E;AAC7E,wBAAgB,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,EAAE,CAevG;AAED,8GAA8G;AAC9G,wBAAgB,QAAQ,CAAC,MAAM,EAAE,aAAa,GAAG,SAAS,EAAE,IAAI,EAAE,YAAY,GAAG,aAAa,GAAG,IAAI,GAAG,SAAS,CAUhH;AAED,kEAAkE;AAClE,wBAAgB,WAAW,CAAC,MAAM,EAAE,uBAAuB,EAAE,IAAI,EAAE,YAAY,GAAG,gBAAgB,GAAG,SAAS,CAmB7G;AAED,2EAA2E;AAC3E,wBAAgB,WAAW,CAAC,MAAM,EAAE,uBAAuB,GAAG,eAAe,EAAE,CAI9E;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,KAAK,EACX,MAAM,EAAE,uBAAuB,EAC/B,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,MAAM,GACf,qBAAqB,CAwCvB;AAED,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,EAAE,IAAI,EAAE,YAAY,GAAG,iBAAiB,CAkBlH;AAED,2EAA2E;AAC3E,wBAAsB,YAAY,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAQ/F"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Short link controls: the body keys built from the node's control fields, the
|
|
4
|
+
* campaign bodies and the Campaign dropdown.
|
|
5
|
+
*
|
|
6
|
+
* Create sends only what the user filled in. Update and Set Rules send every
|
|
7
|
+
* field the user added: an empty value clears it (the API merges `access` key
|
|
8
|
+
* by key, and an absent section keeps the stored one).
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.splitList = splitList;
|
|
12
|
+
exports.parseJsonArray = parseJsonArray;
|
|
13
|
+
exports.buildUtm = buildUtm;
|
|
14
|
+
exports.buildAccess = buildAccess;
|
|
15
|
+
exports.buildPixels = buildPixels;
|
|
16
|
+
exports.buildControlFields = buildControlFields;
|
|
17
|
+
exports.buildCampaignBody = buildCampaignBody;
|
|
18
|
+
exports.getCampaigns = getCampaigns;
|
|
19
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
20
|
+
const api_helpers_1 = require("./api.helpers");
|
|
21
|
+
const constants_1 = require("./constants");
|
|
22
|
+
const link_tool_helpers_1 = require("./link-tool.helpers");
|
|
23
|
+
/** A comma-separated list as trimmed, non-empty, unique items. */
|
|
24
|
+
function splitList(value) {
|
|
25
|
+
const items = (0, link_tool_helpers_1.toText)(value)
|
|
26
|
+
.split(constants_1.SHORT_LINK_CONTROLS.TAGS_SEPARATOR)
|
|
27
|
+
.map((item) => item.trim())
|
|
28
|
+
.filter(Boolean);
|
|
29
|
+
return Array.from(new Set(items));
|
|
30
|
+
}
|
|
31
|
+
/** A `json` parameter as an array; anything else throws naming the field. */
|
|
32
|
+
function parseJsonArray(node, value, field, itemIndex) {
|
|
33
|
+
let parsed = value;
|
|
34
|
+
if (typeof value === 'string') {
|
|
35
|
+
const text = value.trim();
|
|
36
|
+
if (!text)
|
|
37
|
+
return [];
|
|
38
|
+
try {
|
|
39
|
+
parsed = JSON.parse(text);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
parsed = undefined;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (!Array.isArray(parsed)) {
|
|
46
|
+
throw new n8n_workflow_1.NodeOperationError(node, constants_1.SHORT_LINK_CONTROLS_MESSAGES.INVALID_JSON(field), { itemIndex });
|
|
47
|
+
}
|
|
48
|
+
return parsed;
|
|
49
|
+
}
|
|
50
|
+
/** The UTM values of a single-value fixedCollection; empty values are left out, or sent as null on update. */
|
|
51
|
+
function buildUtm(values, mode) {
|
|
52
|
+
if (!values)
|
|
53
|
+
return undefined;
|
|
54
|
+
const utm = {};
|
|
55
|
+
for (const key of constants_1.LINK_UTM_KEYS) {
|
|
56
|
+
const text = (0, link_tool_helpers_1.toText)(values[key]).trim();
|
|
57
|
+
if (text)
|
|
58
|
+
utm[key] = text;
|
|
59
|
+
else if (mode === 'update' && (0, link_tool_helpers_1.hasField)(values, key))
|
|
60
|
+
utm[key] = null;
|
|
61
|
+
}
|
|
62
|
+
if (!Object.keys(utm).length)
|
|
63
|
+
return mode === 'update' ? null : undefined;
|
|
64
|
+
return utm;
|
|
65
|
+
}
|
|
66
|
+
/** The `access` object; `removePassword` wins over a password. */
|
|
67
|
+
function buildAccess(fields, mode) {
|
|
68
|
+
const access = {};
|
|
69
|
+
for (const key of constants_1.LINK_ACCESS_KEYS) {
|
|
70
|
+
if (!(0, link_tool_helpers_1.hasField)(fields, key))
|
|
71
|
+
continue;
|
|
72
|
+
const raw = fields[key];
|
|
73
|
+
if (key === 'maxVisits') {
|
|
74
|
+
const visits = Number(raw);
|
|
75
|
+
if (visits > 0)
|
|
76
|
+
access.maxVisits = visits;
|
|
77
|
+
else if (mode === 'update')
|
|
78
|
+
access.maxVisits = null;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const text = (0, link_tool_helpers_1.toText)(raw).trim();
|
|
82
|
+
if (text)
|
|
83
|
+
access[key] = text;
|
|
84
|
+
else if (mode === 'update')
|
|
85
|
+
access[key] = null;
|
|
86
|
+
}
|
|
87
|
+
const password = (0, link_tool_helpers_1.toText)(fields.password);
|
|
88
|
+
if (fields.removePassword === true)
|
|
89
|
+
access.password = null;
|
|
90
|
+
else if (password)
|
|
91
|
+
access.password = password;
|
|
92
|
+
return Object.keys(access).length ? access : undefined;
|
|
93
|
+
}
|
|
94
|
+
/** The pixels of a multiple-value fixedCollection, the ones with an ID. */
|
|
95
|
+
function buildPixels(fields) {
|
|
96
|
+
return (fields.pixels?.pixel || [])
|
|
97
|
+
.map((pixel) => ({ provider: pixel.provider, id: (0, link_tool_helpers_1.toText)(pixel.id).trim() }))
|
|
98
|
+
.filter((pixel) => pixel.provider && pixel.id);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The control keys of a create / update / set-rules body.
|
|
102
|
+
* @throws NodeOperationError when Routing Rules or Variants is not a JSON array.
|
|
103
|
+
*/
|
|
104
|
+
function buildControlFields(node, fields, mode, itemIndex) {
|
|
105
|
+
const body = {};
|
|
106
|
+
if ((0, link_tool_helpers_1.hasField)(fields, 'tags')) {
|
|
107
|
+
const tags = splitList(fields.tags);
|
|
108
|
+
if (tags.length || mode === 'update')
|
|
109
|
+
body.tags = tags;
|
|
110
|
+
}
|
|
111
|
+
if ((0, link_tool_helpers_1.hasField)(fields, 'campaignId')) {
|
|
112
|
+
const campaignId = (0, link_tool_helpers_1.toText)(fields.campaignId).trim();
|
|
113
|
+
if (campaignId)
|
|
114
|
+
body.campaignId = campaignId;
|
|
115
|
+
else if (mode === 'update')
|
|
116
|
+
body.campaignId = null;
|
|
117
|
+
}
|
|
118
|
+
const access = buildAccess(fields, mode);
|
|
119
|
+
if (access)
|
|
120
|
+
body.access = access;
|
|
121
|
+
if ((0, link_tool_helpers_1.hasField)(fields, 'utm')) {
|
|
122
|
+
const utm = buildUtm(fields.utm?.values, mode);
|
|
123
|
+
if (utm !== undefined)
|
|
124
|
+
body.utm = utm;
|
|
125
|
+
}
|
|
126
|
+
for (const [field, key, label] of [
|
|
127
|
+
['routingRules', 'routing', 'Routing Rules'],
|
|
128
|
+
['variants', 'variants', 'Variants'],
|
|
129
|
+
]) {
|
|
130
|
+
if (!(0, link_tool_helpers_1.hasField)(fields, field))
|
|
131
|
+
continue;
|
|
132
|
+
const list = parseJsonArray(node, fields[field], label, itemIndex);
|
|
133
|
+
if (list.length || mode === 'update')
|
|
134
|
+
body[key] = list;
|
|
135
|
+
}
|
|
136
|
+
if ((0, link_tool_helpers_1.hasField)(fields, 'pixels')) {
|
|
137
|
+
const pixels = buildPixels(fields);
|
|
138
|
+
if (pixels.length || mode === 'update')
|
|
139
|
+
body.pixels = pixels;
|
|
140
|
+
}
|
|
141
|
+
if (typeof fields.pixelsConsentAcknowledged === 'boolean' && fields.pixelsConsentAcknowledged) {
|
|
142
|
+
body.pixelsConsentAcknowledged = true;
|
|
143
|
+
}
|
|
144
|
+
if (typeof fields.healthMonitor === 'boolean')
|
|
145
|
+
body.health = { enabled: fields.healthMonitor };
|
|
146
|
+
return body;
|
|
147
|
+
}
|
|
148
|
+
/** A campaign create / update body; on update only the fields the user added. */
|
|
149
|
+
function buildCampaignBody(name, fields, mode) {
|
|
150
|
+
const body = {};
|
|
151
|
+
if (name)
|
|
152
|
+
body.name = name;
|
|
153
|
+
if ((0, link_tool_helpers_1.hasField)(fields, 'description')) {
|
|
154
|
+
const description = (0, link_tool_helpers_1.toText)(fields.description).trim();
|
|
155
|
+
if (description)
|
|
156
|
+
body.description = description;
|
|
157
|
+
else if (mode === 'update')
|
|
158
|
+
body.description = null;
|
|
159
|
+
}
|
|
160
|
+
if ((0, link_tool_helpers_1.hasField)(fields, 'color')) {
|
|
161
|
+
if (fields.color)
|
|
162
|
+
body.color = fields.color;
|
|
163
|
+
else if (mode === 'update')
|
|
164
|
+
body.color = null;
|
|
165
|
+
}
|
|
166
|
+
if ((0, link_tool_helpers_1.hasField)(fields, 'utm')) {
|
|
167
|
+
const utm = buildUtm(fields.utm?.values, mode);
|
|
168
|
+
if (utm !== undefined)
|
|
169
|
+
body.utm = utm;
|
|
170
|
+
}
|
|
171
|
+
if (typeof fields.archived === 'boolean')
|
|
172
|
+
body.archived = fields.archived;
|
|
173
|
+
return body;
|
|
174
|
+
}
|
|
175
|
+
/** The Campaign dropdown: the caller's campaigns that are not archived. */
|
|
176
|
+
async function getCampaigns() {
|
|
177
|
+
const credentials = await this.getCredentials('posty5Api');
|
|
178
|
+
const page = (await api_helpers_1.makeApiRequest.call(this, credentials.apiKey, {
|
|
179
|
+
method: 'GET',
|
|
180
|
+
endpoint: constants_1.API_ENDPOINTS.LINK_CAMPAIGN,
|
|
181
|
+
qs: { archived: false, page: 1, pageSize: constants_1.SHORT_LINK_CONTROLS.CAMPAIGN_LOOKUP_PAGE_SIZE },
|
|
182
|
+
}));
|
|
183
|
+
return (page?.items || []).map((campaign) => ({ name: campaign.name, value: campaign._id }));
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=short-link-controls.helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|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|
+
/**
|
|
2
|
+
* Short Link node parameters of the short link controls: the control fields of
|
|
3
|
+
* Create / Update / Set Rules, and the campaign operations' fields.
|
|
4
|
+
*/
|
|
5
|
+
import type { INodeProperties } from 'n8n-workflow';
|
|
6
|
+
/** UTM as a single-value fixedCollection (`utm.values`). */
|
|
7
|
+
export declare function buildUtmProperty(description: string): INodeProperties;
|
|
8
|
+
/** The control fields appended to the Create / Update Additional Fields. */
|
|
9
|
+
export declare const SHORT_LINK_CONTROL_ADDITIONAL_FIELDS: INodeProperties[];
|
|
10
|
+
/** Set Rules: the rule sections, each sent only when added. */
|
|
11
|
+
export declare const SHORT_LINK_SET_RULES_PROPERTIES: INodeProperties[];
|
|
12
|
+
/** List Tags and the List filters. */
|
|
13
|
+
export declare const SHORT_LINK_LIST_TAGS_PROPERTIES: INodeProperties[];
|
|
14
|
+
export declare const SHORT_LINK_CONTROL_LIST_FILTERS: INodeProperties[];
|
|
15
|
+
/** Campaign operations' fields. */
|
|
16
|
+
export declare const LINK_CAMPAIGN_PROPERTIES: INodeProperties[];
|
|
17
|
+
//# sourceMappingURL=short-link-controls.properties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"short-link-controls.properties.d.ts","sourceRoot":"","sources":["../../utils/short-link-controls.properties.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAcpD,4DAA4D;AAC5D,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,CAsBrE;AA4GD,4EAA4E;AAC5E,eAAO,MAAM,oCAAoC,EAAE,eAAe,EA0BjE,CAAC;AAEF,+DAA+D;AAC/D,eAAO,MAAM,+BAA+B,EAAE,eAAe,EAW5D,CAAC;AAEF,sCAAsC;AACtC,eAAO,MAAM,+BAA+B,EAAE,eAAe,EAS5D,CAAC;AAEF,eAAO,MAAM,+BAA+B,EAAE,eAAe,EAkB5D,CAAC;AAqBF,mCAAmC;AACnC,eAAO,MAAM,wBAAwB,EAAE,eAAe,EAkFrD,CAAC"}
|