@activepieces/piece-dub 0.0.2 → 0.0.4

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.
@@ -1,209 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateLink = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const pieces_common_1 = require("@activepieces/pieces-common");
7
- const auth_1 = require("../auth");
8
- exports.updateLink = (0, pieces_framework_1.createAction)({
9
- name: 'update_link',
10
- displayName: 'Update Link',
11
- description: 'Update an existing Dub link. Only the fields you fill in will be updated.',
12
- auth: auth_1.dubAuth,
13
- props: {
14
- linkId: pieces_framework_1.Property.ShortText({
15
- displayName: 'Link ID',
16
- description: 'The ID of the link to update (e.g. `clv3g2...`). Find this from the Create Link or List Links actions.',
17
- required: true,
18
- }),
19
- url: pieces_framework_1.Property.ShortText({
20
- displayName: 'New Destination URL',
21
- description: 'Update the destination URL the link redirects to.',
22
- required: false,
23
- }),
24
- key: pieces_framework_1.Property.ShortText({
25
- displayName: 'New Slug',
26
- description: 'Update the short link slug (the part after the domain).',
27
- required: false,
28
- }),
29
- title: pieces_framework_1.Property.ShortText({
30
- displayName: 'Title',
31
- description: 'Update the human-readable title.',
32
- required: false,
33
- }),
34
- description: pieces_framework_1.Property.LongText({
35
- displayName: 'Description',
36
- description: 'Update the link description.',
37
- required: false,
38
- }),
39
- image: pieces_framework_1.Property.ShortText({
40
- displayName: 'OG Image URL',
41
- description: 'Update the custom link preview image (og:image).',
42
- required: false,
43
- }),
44
- video: pieces_framework_1.Property.ShortText({
45
- displayName: 'OG Video URL',
46
- description: 'Update the custom link preview video (og:video).',
47
- required: false,
48
- }),
49
- tags: pieces_framework_1.Property.Array({
50
- displayName: 'Tag Names',
51
- description: 'Replace the link\'s tags with this new list of tag names. Send an empty array to clear all tags.',
52
- required: false,
53
- }),
54
- folderId: pieces_framework_1.Property.ShortText({
55
- displayName: 'Folder ID',
56
- description: 'Move this link to a different folder by its ID.',
57
- required: false,
58
- }),
59
- expiresAt: pieces_framework_1.Property.ShortText({
60
- displayName: 'Expires At',
61
- description: 'ISO 8601 datetime when the link should expire. Set to empty to remove expiration.',
62
- required: false,
63
- }),
64
- expiredUrl: pieces_framework_1.Property.ShortText({
65
- displayName: 'Expired URL',
66
- description: 'URL to redirect to after expiration.',
67
- required: false,
68
- }),
69
- password: pieces_framework_1.Property.ShortText({
70
- displayName: 'Password',
71
- description: 'Update the password for this link. Leave blank to remove password protection.',
72
- required: false,
73
- }),
74
- trackConversion: pieces_framework_1.Property.Checkbox({
75
- displayName: 'Track Conversions',
76
- description: 'Whether to track conversions for this link.',
77
- required: false,
78
- }),
79
- proxy: pieces_framework_1.Property.Checkbox({
80
- displayName: 'Custom Link Previews',
81
- description: 'Enable or disable Custom Link Previews (og:title, og:description, og:image) for this link.',
82
- required: false,
83
- }),
84
- rewrite: pieces_framework_1.Property.Checkbox({
85
- displayName: 'Cloaked URL (URL Rewriting)',
86
- description: 'Toggle URL cloaking.',
87
- required: false,
88
- }),
89
- doIndex: pieces_framework_1.Property.Checkbox({
90
- displayName: 'Allow Search Engine Indexing',
91
- description: 'Allow search engines to index this short link.',
92
- required: false,
93
- }),
94
- archived: pieces_framework_1.Property.Checkbox({
95
- displayName: 'Archived',
96
- description: 'Archive or unarchive the link.',
97
- required: false,
98
- }),
99
- ios: pieces_framework_1.Property.ShortText({
100
- displayName: 'iOS Redirect URL',
101
- description: 'Update the iOS-specific redirect URL.',
102
- required: false,
103
- }),
104
- android: pieces_framework_1.Property.ShortText({
105
- displayName: 'Android Redirect URL',
106
- description: 'Update the Android-specific redirect URL.',
107
- required: false,
108
- }),
109
- comments: pieces_framework_1.Property.LongText({
110
- displayName: 'Comments',
111
- description: 'Update internal notes for this link.',
112
- required: false,
113
- }),
114
- utm_source: pieces_framework_1.Property.ShortText({
115
- displayName: 'UTM Source',
116
- description: 'Update the UTM source parameter.',
117
- required: false,
118
- }),
119
- utm_medium: pieces_framework_1.Property.ShortText({
120
- displayName: 'UTM Medium',
121
- description: 'Update the UTM medium parameter.',
122
- required: false,
123
- }),
124
- utm_campaign: pieces_framework_1.Property.ShortText({
125
- displayName: 'UTM Campaign',
126
- description: 'Update the UTM campaign parameter.',
127
- required: false,
128
- }),
129
- utm_term: pieces_framework_1.Property.ShortText({
130
- displayName: 'UTM Term',
131
- description: 'Update the UTM term parameter.',
132
- required: false,
133
- }),
134
- utm_content: pieces_framework_1.Property.ShortText({
135
- displayName: 'UTM Content',
136
- description: 'Update the UTM content parameter.',
137
- required: false,
138
- }),
139
- },
140
- run(context) {
141
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
142
- const { auth, propsValue } = context;
143
- const { linkId } = propsValue, rest = tslib_1.__rest(propsValue, ["linkId"]);
144
- const body = {};
145
- if (rest.url !== undefined && rest.url !== null && rest.url !== '')
146
- body['url'] = rest.url;
147
- if (rest.key !== undefined && rest.key !== null && rest.key !== '')
148
- body['key'] = rest.key;
149
- if (rest.title !== undefined && rest.title !== null)
150
- body['title'] = rest.title;
151
- if (rest.description !== undefined && rest.description !== null)
152
- body['description'] = rest.description;
153
- if (rest.image !== undefined && rest.image !== null)
154
- body['image'] = rest.image;
155
- if (rest.video !== undefined && rest.video !== null)
156
- body['video'] = rest.video;
157
- if (rest.tags !== undefined)
158
- body['tagNames'] = rest.tags;
159
- if (rest.folderId !== undefined && rest.folderId !== null)
160
- body['folderId'] = rest.folderId;
161
- if (rest.expiresAt !== undefined && rest.expiresAt !== null)
162
- body['expiresAt'] = rest.expiresAt;
163
- if (rest.expiredUrl !== undefined && rest.expiredUrl !== null)
164
- body['expiredUrl'] = rest.expiredUrl;
165
- if (rest.password !== undefined && rest.password !== null)
166
- body['password'] = rest.password;
167
- if (rest.trackConversion !== undefined)
168
- body['trackConversion'] = rest.trackConversion;
169
- if (rest.proxy !== undefined)
170
- body['proxy'] = rest.proxy;
171
- if (rest.rewrite !== undefined)
172
- body['rewrite'] = rest.rewrite;
173
- if (rest.doIndex !== undefined)
174
- body['doIndex'] = rest.doIndex;
175
- if (rest.archived !== undefined)
176
- body['archived'] = rest.archived;
177
- if (rest.ios !== undefined && rest.ios !== null)
178
- body['ios'] = rest.ios;
179
- if (rest.android !== undefined && rest.android !== null)
180
- body['android'] = rest.android;
181
- if (rest.comments !== undefined && rest.comments !== null)
182
- body['comments'] = rest.comments;
183
- if (rest.utm_source !== undefined && rest.utm_source !== null)
184
- body['utm_source'] = rest.utm_source;
185
- if (rest.utm_medium !== undefined && rest.utm_medium !== null)
186
- body['utm_medium'] = rest.utm_medium;
187
- if (rest.utm_campaign !== undefined && rest.utm_campaign !== null)
188
- body['utm_campaign'] = rest.utm_campaign;
189
- if (rest.utm_term !== undefined && rest.utm_term !== null)
190
- body['utm_term'] = rest.utm_term;
191
- if (rest.utm_content !== undefined && rest.utm_content !== null)
192
- body['utm_content'] = rest.utm_content;
193
- if (Object.keys(body).length === 0) {
194
- throw new Error('At least one field must be provided to update.');
195
- }
196
- const response = yield pieces_common_1.httpClient.sendRequest({
197
- method: pieces_common_1.HttpMethod.PATCH,
198
- url: `${auth_1.DUB_API_BASE}/links/${linkId}`,
199
- headers: {
200
- Authorization: `Bearer ${auth.secret_text}`,
201
- 'Content-Type': 'application/json',
202
- },
203
- body,
204
- });
205
- return response.body;
206
- });
207
- },
208
- });
209
- //# sourceMappingURL=update-link.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-link.js","sourceRoot":"","sources":["../../../../src/lib/actions/update-link.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,kCAAgD;AAGnC,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,2EAA2E;IACxF,IAAI,EAAE,cAAO;IACb,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC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,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC;YACpG,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI;gBAAE,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC;YACpG,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,IAAI,IAAI,CAAC,YAAY,KAAK,IAAI;gBAAE,IAAI,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC;YAC5G,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI;gBAAE,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;YAC5F,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI;gBAAE,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC;YAExG,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACnC,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;YACpE,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAU;gBACrD,MAAM,EAAE,0BAAU,CAAC,KAAK;gBACxB,GAAG,EAAE,GAAG,mBAAY,UAAU,MAAM,EAAE;gBACtC,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,IAAI,CAAC,WAAW,EAAE;oBAC3C,cAAc,EAAE,kBAAkB;iBACnC;gBACD,IAAI;aACL,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
package/src/lib/auth.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare const DUB_API_BASE = "https://api.dub.co";
2
- export declare const dubAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
package/src/lib/auth.js DELETED
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.dubAuth = exports.DUB_API_BASE = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const pieces_common_1 = require("@activepieces/pieces-common");
7
- exports.DUB_API_BASE = 'https://api.dub.co';
8
- const authDescription = `
9
- To obtain your Dub API key:
10
- 1. Go to [https://app.dub.co/settings/tokens](https://app.dub.co/settings/tokens)
11
- 2. Click **Create API Key**
12
- 3. Give your key a name and select the required scopes
13
- 4. Copy the key — it starts with \`dub_\` (e.g. \`dub_xxxxxxxxxxxxxxxx\`)
14
- 5. Paste it here
15
-
16
- > **Required scopes:** \`links.read\`, \`links.write\`, \`webhooks.write\` (for triggers)
17
- `;
18
- exports.dubAuth = pieces_framework_1.PieceAuth.SecretText({
19
- displayName: 'API Key',
20
- description: authDescription,
21
- required: true,
22
- validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
23
- var _b, _c;
24
- try {
25
- yield pieces_common_1.httpClient.sendRequest({
26
- method: pieces_common_1.HttpMethod.GET,
27
- url: `${exports.DUB_API_BASE}/folders`,
28
- headers: {
29
- Authorization: `Bearer ${auth.trim()}`,
30
- 'Content-Type': 'application/json',
31
- },
32
- });
33
- return { valid: true };
34
- }
35
- catch (e) {
36
- const err = e;
37
- if (((_b = err === null || err === void 0 ? void 0 : err.response) === null || _b === void 0 ? void 0 : _b.status) === 401) {
38
- return {
39
- valid: false,
40
- error: 'Invalid API key. Please check your Dub API credentials.',
41
- };
42
- }
43
- if (((_c = err === null || err === void 0 ? void 0 : err.response) === null || _c === void 0 ? void 0 : _c.status) === 403) {
44
- return {
45
- valid: false,
46
- error: 'Insufficient scopes. Ensure your API key has links.read, links.write, and webhooks.write permissions.',
47
- };
48
- }
49
- return {
50
- valid: false,
51
- error: 'Unable to validate API key. Please try again.',
52
- };
53
- }
54
- }),
55
- });
56
-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AK,EAAE,+CAA+C;aACvD,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
@@ -1,53 +0,0 @@
1
- export declare function verifyDubSignature(secret: string, rawBody: string, signatureHeader: string): boolean;
2
- export interface DubLink {
3
- id: string;
4
- domain: string;
5
- key: string;
6
- url: string;
7
- shortLink: string;
8
- qrCode: string;
9
- trackConversion: boolean;
10
- externalId: string | null;
11
- tenantId: string | null;
12
- programId: string | null;
13
- partnerId: string | null;
14
- archived: boolean;
15
- expiresAt: string | null;
16
- expiredUrl: string | null;
17
- disabledAt: string | null;
18
- password: string | null;
19
- proxy: boolean;
20
- title: string | null;
21
- description: string | null;
22
- image: string | null;
23
- video: string | null;
24
- rewrite: boolean;
25
- doIndex: boolean;
26
- ios: string | null;
27
- android: string | null;
28
- geo: Record<string, string> | null;
29
- publicStats: boolean;
30
- tags: Array<{
31
- id: string;
32
- name: string;
33
- color: string;
34
- }> | null;
35
- folderId: string | null;
36
- webhookIds: string[];
37
- comments: string | null;
38
- utm_source: string | null;
39
- utm_medium: string | null;
40
- utm_campaign: string | null;
41
- utm_term: string | null;
42
- utm_content: string | null;
43
- userId: string | null;
44
- workspaceId: string;
45
- clicks: number;
46
- leads: number;
47
- conversions: number;
48
- sales: number;
49
- saleAmount: number;
50
- lastClicked: string | null;
51
- createdAt: string;
52
- updatedAt: string;
53
- }
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.verifyDubSignature = verifyDubSignature;
4
- const tslib_1 = require("tslib");
5
- const crypto_1 = tslib_1.__importDefault(require("crypto"));
6
- function verifyDubSignature(secret, rawBody, signatureHeader) {
7
- try {
8
- const expected = crypto_1.default
9
- .createHmac('sha256', secret)
10
- .update(rawBody, 'utf8')
11
- .digest('hex');
12
- const provided = signatureHeader.startsWith('sha256=')
13
- ? signatureHeader.slice(7)
14
- : signatureHeader;
15
- const expectedBuf = Buffer.from(expected, 'hex');
16
- const providedBuf = Buffer.from(provided, 'hex');
17
- if (expectedBuf.length !== providedBuf.length) {
18
- return false;
19
- }
20
- return crypto_1.default.timingSafeEqual(expectedBuf, providedBuf);
21
- }
22
- catch (_a) {
23
- return false;
24
- }
25
- }
26
- //# sourceMappingURL=common.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/lib/common/common.ts"],"names":[],"mappings":";;AAGA,gDAsBC;;AAxBD,4DAA4B;AAE5B,SAAgB,kBAAkB,CAChC,MAAc,EACd,OAAe,EACf,eAAuB;IAEvB,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,gBAAM;aACpB,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC;aAC5B,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC;aACvB,MAAM,CAAC,KAAK,CAAC,CAAC;QACjB,MAAM,QAAQ,GAAG,eAAe,CAAC,UAAU,CAAC,SAAS,CAAC;YACpD,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;YAC1B,CAAC,CAAC,eAAe,CAAC;QACpB,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACjD,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACjD,IAAI,WAAW,CAAC,MAAM,KAAK,WAAW,CAAC,MAAM,EAAE,CAAC;YAC9C,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,gBAAM,CAAC,eAAe,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAC1D,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -1,10 +0,0 @@
1
- import { TriggerStrategy } from '@activepieces/pieces-framework';
2
- export declare const linkClicked: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
3
- md: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
4
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
5
- md: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
6
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
7
- md: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
8
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
9
- md: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
10
- }>;
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.linkClicked = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const shared_1 = require("@activepieces/shared");
7
- const auth_1 = require("../auth");
8
- exports.linkClicked = (0, pieces_framework_1.createTrigger)({
9
- auth: auth_1.dubAuth,
10
- name: 'link_clicked',
11
- displayName: 'Link Clicked',
12
- description: 'Triggers in real time whenever one of your Dub short links is clicked.',
13
- type: pieces_framework_1.TriggerStrategy.WEBHOOK,
14
- props: {
15
- md: pieces_framework_1.Property.MarkDown({
16
- value: `## Setup Instructions
17
-
18
- 1. Go to your Dub workspace and navigate to **Settings → [Webhooks](https://app.dub.co/settings/webhooks)**.
19
- 2. Click **Create Webhook**.
20
- 3. Give your webhook a name.
21
- 4. Paste the following URL into the **URL** field:
22
- \`\`\`text
23
- {{webhookUrl}}
24
- \`\`\`
25
- 5. Under **Events**, select **link.clicked**.
26
- 6. Click **Create webhook**.`,
27
- variant: shared_1.MarkdownVariant.INFO,
28
- }),
29
- },
30
- sampleData: {
31
- id: 'evt_abc123',
32
- event: 'link.clicked',
33
- createdAt: '2024-01-15T10:30:00.000Z',
34
- data: {
35
- link: {
36
- id: 'clv3g2xyz',
37
- domain: 'dub.sh',
38
- key: 'my-promo',
39
- url: 'https://example.com/landing',
40
- shortLink: 'https://dub.sh/my-promo',
41
- clicks: 42,
42
- },
43
- click: {
44
- id: 'click_abc',
45
- timestamp: '2024-01-15T10:30:00.000Z',
46
- identity: 'anonymous',
47
- url: 'https://dub.sh/my-promo',
48
- country: 'US',
49
- city: 'San Francisco',
50
- region: 'CA',
51
- continent: 'NA',
52
- device: 'Desktop',
53
- browser: 'Chrome',
54
- os: 'macOS',
55
- referer: 'https://twitter.com',
56
- refererUrl: 'https://twitter.com',
57
- },
58
- },
59
- },
60
- onEnable() {
61
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
62
- // Webhook is registered manually in the Dub platform
63
- });
64
- },
65
- onDisable() {
66
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
67
- // Webhook is removed manually in the Dub platform
68
- });
69
- },
70
- run(context) {
71
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
72
- return [context.payload.body];
73
- });
74
- },
75
- });
76
- //# sourceMappingURL=link-clicked.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"link-clicked.js","sourceRoot":"","sources":["../../../../src/lib/triggers/link-clicked.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,iDAAuD;AACvD,kCAAkC;AAErB,QAAA,WAAW,GAAG,IAAA,gCAAa,EAAC;IACvC,IAAI,EAAE,cAAO;IACb,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,WAAW,EACT,wEAAwE;IAC1E,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,KAAK,EAAE;QACL,EAAE,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACpB,KAAK,EAAE;;;;;;;;;;6BAUgB;YACvB,OAAO,EAAE,wBAAe,CAAC,IAAI;SAC9B,CAAC;KACH;IACD,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,cAAc;QACrB,SAAS,EAAE,0BAA0B;QACrC,IAAI,EAAE;YACJ,IAAI,EAAE;gBACJ,EAAE,EAAE,WAAW;gBACf,MAAM,EAAE,QAAQ;gBAChB,GAAG,EAAE,UAAU;gBACf,GAAG,EAAE,6BAA6B;gBAClC,SAAS,EAAE,yBAAyB;gBACpC,MAAM,EAAE,EAAE;aACX;YACD,KAAK,EAAE;gBACL,EAAE,EAAE,WAAW;gBACf,SAAS,EAAE,0BAA0B;gBACrC,QAAQ,EAAE,WAAW;gBACrB,GAAG,EAAE,yBAAyB;gBAC9B,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,eAAe;gBACrB,MAAM,EAAE,IAAI;gBACZ,SAAS,EAAE,IAAI;gBACf,MAAM,EAAE,SAAS;gBACjB,OAAO,EAAE,QAAQ;gBACjB,EAAE,EAAE,OAAO;gBACX,OAAO,EAAE,qBAAqB;gBAC9B,UAAU,EAAE,qBAAqB;aAClC;SACF;KACF;IACK,QAAQ;;YACZ,qDAAqD;QACvD,CAAC;KAAA;IACK,SAAS;;YACb,kDAAkD;QACpD,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,10 +0,0 @@
1
- import { TriggerStrategy } from '@activepieces/pieces-framework';
2
- export declare const linkCreated: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
3
- md: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
4
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
5
- md: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
6
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
7
- md: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
8
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
9
- md: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
10
- }>;
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.linkCreated = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const shared_1 = require("@activepieces/shared");
7
- const auth_1 = require("../auth");
8
- exports.linkCreated = (0, pieces_framework_1.createTrigger)({
9
- auth: auth_1.dubAuth,
10
- name: 'link_created',
11
- displayName: 'Link Created',
12
- description: 'Triggers in real time whenever a new short link is created in your Dub workspace.',
13
- type: pieces_framework_1.TriggerStrategy.WEBHOOK,
14
- props: {
15
- md: pieces_framework_1.Property.MarkDown({
16
- value: `## Setup Instructions
17
-
18
- 1. Go to your Dub workspace and navigate to **Settings → [Webhooks](https://app.dub.co/settings/webhooks)**.
19
- 2. Click **Create Webhook**.
20
- 3. Give your webhook a name.
21
- 4. Paste the following URL into the **URL** field:
22
- \`\`\`text
23
- {{webhookUrl}}
24
- \`\`\`
25
- 5. Under **Events**, select **link.created**.
26
- 6. Click **Create webhook**.`,
27
- variant: shared_1.MarkdownVariant.INFO,
28
- }),
29
- },
30
- sampleData: {
31
- id: 'evt_def456',
32
- event: 'link.created',
33
- createdAt: '2024-01-15T10:30:00.000Z',
34
- data: {
35
- link: {
36
- id: 'clv3g2xyz',
37
- domain: 'dub.sh',
38
- key: 'new-link',
39
- url: 'https://example.com/new-page',
40
- shortLink: 'https://dub.sh/new-link',
41
- clicks: 0,
42
- createdAt: '2024-01-15T10:30:00.000Z',
43
- },
44
- },
45
- },
46
- onEnable() {
47
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
48
- // Webhook is registered manually in the Dub platform
49
- });
50
- },
51
- onDisable() {
52
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
53
- // Webhook is removed manually in the Dub platform
54
- });
55
- },
56
- run(context) {
57
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
58
- return [context.payload.body];
59
- });
60
- },
61
- });
62
- //# sourceMappingURL=link-created.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"link-created.js","sourceRoot":"","sources":["../../../../src/lib/triggers/link-created.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,iDAAuD;AACvD,kCAAkC;AAErB,QAAA,WAAW,GAAG,IAAA,gCAAa,EAAC;IACvC,IAAI,EAAE,cAAO;IACb,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,mFAAmF;IAChG,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,KAAK,EAAE;QACL,EAAE,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACpB,KAAK,EAAE;;;;;;;;;;6BAUgB;YACvB,OAAO,EAAE,wBAAe,CAAC,IAAI;SAC9B,CAAC;KACH;IACD,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,cAAc;QACrB,SAAS,EAAE,0BAA0B;QACrC,IAAI,EAAE;YACJ,IAAI,EAAE;gBACJ,EAAE,EAAE,WAAW;gBACf,MAAM,EAAE,QAAQ;gBAChB,GAAG,EAAE,UAAU;gBACf,GAAG,EAAE,8BAA8B;gBACnC,SAAS,EAAE,yBAAyB;gBACpC,MAAM,EAAE,CAAC;gBACT,SAAS,EAAE,0BAA0B;aACtC;SACF;KACF;IACK,QAAQ;;YACZ,qDAAqD;QACvD,CAAC;KAAA;IACK,SAAS;;YACb,kDAAkD;QACpD,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}