@agnocon/piece-bitly 0.1.7
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/LICENSE.MIT-AP +24 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/actions/archive-bitlink.d.ts +11 -0
- package/dist/lib/actions/archive-bitlink.d.ts.map +1 -0
- package/dist/lib/actions/archive-bitlink.js +54 -0
- package/dist/lib/actions/archive-bitlink.js.map +1 -0
- package/dist/lib/actions/create-bitlink.d.ts +34 -0
- package/dist/lib/actions/create-bitlink.d.ts.map +1 -0
- package/dist/lib/actions/create-bitlink.js +134 -0
- package/dist/lib/actions/create-bitlink.js.map +1 -0
- package/dist/lib/actions/create-qr-code.d.ts +39 -0
- package/dist/lib/actions/create-qr-code.d.ts.map +1 -0
- package/dist/lib/actions/create-qr-code.js +383 -0
- package/dist/lib/actions/create-qr-code.js.map +1 -0
- package/dist/lib/actions/get-bitlink-details.d.ts +11 -0
- package/dist/lib/actions/get-bitlink-details.d.ts.map +1 -0
- package/dist/lib/actions/get-bitlink-details.js +50 -0
- package/dist/lib/actions/get-bitlink-details.js.map +1 -0
- package/dist/lib/actions/update-bitlink.d.ts +18 -0
- package/dist/lib/actions/update-bitlink.d.ts.map +1 -0
- package/dist/lib/actions/update-bitlink.js +135 -0
- package/dist/lib/actions/update-bitlink.js.map +1 -0
- package/dist/lib/common/auth.d.ts +4 -0
- package/dist/lib/common/auth.d.ts.map +1 -0
- package/dist/lib/common/auth.js +44 -0
- package/dist/lib/common/auth.js.map +1 -0
- package/dist/lib/common/client.d.ts +13 -0
- package/dist/lib/common/client.d.ts.map +1 -0
- package/dist/lib/common/client.js +69 -0
- package/dist/lib/common/client.js.map +1 -0
- package/dist/lib/common/props.d.ts +10 -0
- package/dist/lib/common/props.d.ts.map +1 -0
- package/dist/lib/common/props.js +118 -0
- package/dist/lib/common/props.js.map +1 -0
- package/dist/lib/triggers/new-bitlink-created.d.ts +43 -0
- package/dist/lib/triggers/new-bitlink-created.d.ts.map +1 -0
- package/dist/lib/triggers/new-bitlink-created.js +312 -0
- package/dist/lib/triggers/new-bitlink-created.js.map +1 -0
- package/package.json +46 -0
- package/src/index.ts +38 -0
- package/src/lib/actions/archive-bitlink.ts +59 -0
- package/src/lib/actions/create-bitlink.ts +158 -0
- package/src/lib/actions/create-qr-code.ts +398 -0
- package/src/lib/actions/get-bitlink-details.ts +54 -0
- package/src/lib/actions/update-bitlink.ts +153 -0
- package/src/lib/common/auth.ts +37 -0
- package/src/lib/common/client.ts +122 -0
- package/src/lib/common/props.ts +123 -0
- package/src/lib/triggers/new-bitlink-created.ts +361 -0
package/LICENSE.MIT-AP
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Activepieces AB
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
Derived helpers in this folder are adapted from Activepieces (MIT) for use
|
|
24
|
+
inside CX without depending on @activepieces/* packages at runtime.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,KAAK;;GA0BhB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bitly = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/bitly/src/index.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
8
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
9
|
+
const pieces_framework_2 = require("@agnocon/pieces-framework");
|
|
10
|
+
const auth_1 = require("./lib/common/auth");
|
|
11
|
+
const new_bitlink_created_1 = require("./lib/triggers/new-bitlink-created");
|
|
12
|
+
const archive_bitlink_1 = require("./lib/actions/archive-bitlink");
|
|
13
|
+
const create_bitlink_1 = require("./lib/actions/create-bitlink");
|
|
14
|
+
const create_qr_code_1 = require("./lib/actions/create-qr-code");
|
|
15
|
+
const get_bitlink_details_1 = require("./lib/actions/get-bitlink-details");
|
|
16
|
+
const update_bitlink_1 = require("./lib/actions/update-bitlink");
|
|
17
|
+
exports.bitly = (0, pieces_framework_1.createPiece)({
|
|
18
|
+
displayName: 'Bitly',
|
|
19
|
+
description: 'URL shortening and link management platform with analytics.',
|
|
20
|
+
auth: auth_1.bitlyAuth,
|
|
21
|
+
minimumSupportedRelease: '0.20.0',
|
|
22
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/bitly.png',
|
|
23
|
+
authors: ['aryel780'],
|
|
24
|
+
categories: [pieces_framework_2.PieceCategory.MARKETING],
|
|
25
|
+
actions: [
|
|
26
|
+
archive_bitlink_1.archiveBitlinkAction,
|
|
27
|
+
create_bitlink_1.createBitlinkAction,
|
|
28
|
+
create_qr_code_1.createQrCodeAction,
|
|
29
|
+
get_bitlink_details_1.getBitlinkDetailsAction,
|
|
30
|
+
update_bitlink_1.updateBitlinkAction,
|
|
31
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
32
|
+
auth: auth_1.bitlyAuth,
|
|
33
|
+
baseUrl: () => 'https://api-ssl.bitly.com/v4',
|
|
34
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
+
const { accessToken } = auth.props;
|
|
36
|
+
return {
|
|
37
|
+
Authorization: `Bearer ${accessToken}`,
|
|
38
|
+
};
|
|
39
|
+
}),
|
|
40
|
+
}),
|
|
41
|
+
],
|
|
42
|
+
triggers: [new_bitlink_created_1.newBitlinkCreatedTrigger],
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,iFAAiF;AACjF,qEAAqE;AACrE,0DAAmE;AACnE,gEAAwD;AACxD,gEAA0D;AAC1D,4CAA8C;AAC9C,4EAA8E;AAC9E,mEAAqE;AACrE,iEAAmE;AACnE,iEAAkE;AAClE,2EAA4E;AAC5E,iEAAmE;AAEtD,QAAA,KAAK,GAAG,IAAA,8BAAW,EAAC;IAC/B,WAAW,EAAE,OAAO;IACpB,WAAW,EAAE,6DAA6D;IAC1E,IAAI,EAAE,gBAAS;IACf,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,+CAA+C;IACxD,OAAO,EAAE,CAAC,UAAU,CAAC;IACrB,UAAU,EAAE,CAAC,gCAAa,CAAC,SAAS,CAAC;IACrC,OAAO,EAAE;QACP,sCAAoB;QACpB,oCAAmB;QACnB,mCAAkB;QAClB,6CAAuB;QACvB,oCAAmB;QACnB,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,gBAAS;YACf,OAAO,EAAE,GAAG,EAAE,CAAC,8BAA8B;YAC7C,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC1B,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;gBACnC,OAAO;oBACL,aAAa,EAAE,UAAU,WAAW,EAAE;iBACvC,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE,CAAE,8CAAwB,CAAE;CACvC,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const archiveBitlinkAction: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
accessToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
}>, {
|
|
4
|
+
group_guid: import("@agnocon/pieces-framework").DropdownProperty<string, true, import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
5
|
+
accessToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
|
|
6
|
+
}>>;
|
|
7
|
+
bitlink: import("@agnocon/pieces-framework").DropdownProperty<string, true, import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
8
|
+
accessToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
|
|
9
|
+
}>>;
|
|
10
|
+
}>;
|
|
11
|
+
//# sourceMappingURL=archive-bitlink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive-bitlink.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/archive-bitlink.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,oBAAoB;;;;;;;;;EAoD/B,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.archiveBitlinkAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/bitly/src/lib/actions/archive-bitlink.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
8
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
9
|
+
const client_1 = require("../common/client");
|
|
10
|
+
const auth_1 = require("../common/auth");
|
|
11
|
+
const props_1 = require("../common/props");
|
|
12
|
+
exports.archiveBitlinkAction = (0, pieces_framework_1.createAction)({
|
|
13
|
+
auth: auth_1.bitlyAuth,
|
|
14
|
+
name: 'archive_bitlink',
|
|
15
|
+
displayName: 'Archive Bitlink',
|
|
16
|
+
description: 'Archive a Bitlink to stop redirects.',
|
|
17
|
+
audience: 'both',
|
|
18
|
+
aiMetadata: { description: 'Archives an existing Bitlink so it stops redirecting, identified by its Bitlink ID (e.g. bit.ly/xyz123). Use to retire or disable a short link. Idempotent: re-archiving an already-archived link leaves it archived with no additional effect.', idempotent: true },
|
|
19
|
+
props: {
|
|
20
|
+
group_guid: props_1.groupGuid,
|
|
21
|
+
bitlink: props_1.bitlinkDropdown,
|
|
22
|
+
},
|
|
23
|
+
run(context) {
|
|
24
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
26
|
+
const { bitlink } = context.propsValue;
|
|
27
|
+
try {
|
|
28
|
+
const body = {
|
|
29
|
+
archived: true,
|
|
30
|
+
};
|
|
31
|
+
return yield (0, client_1.bitlyApiCall)({
|
|
32
|
+
method: pieces_common_1.HttpMethod.PATCH,
|
|
33
|
+
auth: context.auth.props,
|
|
34
|
+
resourceUri: `/bitlinks/${bitlink}`,
|
|
35
|
+
body,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
const errorMessage = ((_b = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.description) || ((_d = (_c = error.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.message) || error.message;
|
|
40
|
+
if (((_e = error.response) === null || _e === void 0 ? void 0 : _e.status) === 429) {
|
|
41
|
+
throw new Error('Rate limit exceeded. Please wait before trying again.');
|
|
42
|
+
}
|
|
43
|
+
if (((_f = error.response) === null || _f === void 0 ? void 0 : _f.status) === 404) {
|
|
44
|
+
throw new Error(`Bitlink not found: ${errorMessage}. Please verify the link (e.g., 'bit.ly/xyz123') is correct.`);
|
|
45
|
+
}
|
|
46
|
+
if (((_g = error.response) === null || _g === void 0 ? void 0 : _g.status) === 401 || ((_h = error.response) === null || _h === void 0 ? void 0 : _h.status) === 403) {
|
|
47
|
+
throw new Error(`Authentication failed or forbidden: ${errorMessage}. Please check your Access Token and permissions.`);
|
|
48
|
+
}
|
|
49
|
+
throw new Error(`Failed to archive Bitlink: ${errorMessage || 'Unknown error occurred'}`);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=archive-bitlink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive-bitlink.js","sourceRoot":"","sources":["../../../src/lib/actions/archive-bitlink.ts"],"names":[],"mappings":";;;;AAAA,uGAAuG;AACvG,qEAAqE;AACrE,0DAAoD;AACpD,gEAAmE;AACnE,6CAAgD;AAChD,yCAA2C;AAC3C,2CAA6D;AAEhD,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,iBAAi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AAE,CAAC;oBACrE,MAAM,IAAI,KAAK,CACb,uCAAuC,YAAY,mDAAmD,CACvG,CAAC;gBACJ,CAAC;gBAED,MAAM,IAAI,KAAK,CACb,8BAA8B,YAAY,IAAI,wBAAwB,EAAE,CACzE,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const createBitlinkAction: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
accessToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
}>, {
|
|
4
|
+
long_url: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
group_guid: import("@agnocon/pieces-framework").DropdownProperty<string, true, import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
6
|
+
accessToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
|
|
7
|
+
}>>;
|
|
8
|
+
domain: {
|
|
9
|
+
defaultValue: string;
|
|
10
|
+
displayName: string;
|
|
11
|
+
description?: string | undefined;
|
|
12
|
+
auth: import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
13
|
+
accessToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
|
|
14
|
+
}>;
|
|
15
|
+
refreshers: string[];
|
|
16
|
+
refreshOnSearch?: boolean;
|
|
17
|
+
options: (propsValue: Record<string, unknown> & {
|
|
18
|
+
auth?: import("@agnocon/pieces-framework").CustomAuthConnectionValue<import("@agnocon/pieces-framework").StaticPropsValue<{
|
|
19
|
+
accessToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
|
|
20
|
+
}>> | undefined;
|
|
21
|
+
}, ctx: import("@agnocon/pieces-framework").PropertyContext) => Promise<import("@agnocon/pieces-framework").DropdownState<string>>;
|
|
22
|
+
valueSchema: string;
|
|
23
|
+
type: import("@agnocon/pieces-framework").PropertyType.DROPDOWN;
|
|
24
|
+
required: false;
|
|
25
|
+
};
|
|
26
|
+
title: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
27
|
+
tags: import("@agnocon/pieces-framework").ArrayProperty<false>;
|
|
28
|
+
force_new_link: import("@agnocon/pieces-framework").CheckboxProperty<false>;
|
|
29
|
+
app_id: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
30
|
+
app_uri_path: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
31
|
+
install_url: import("@agnocon/pieces-framework").LongTextProperty<false>;
|
|
32
|
+
install_type: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
33
|
+
}>;
|
|
34
|
+
//# sourceMappingURL=create-bitlink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-bitlink.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/create-bitlink.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuJ9B,CAAC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createBitlinkAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/bitly/src/lib/actions/create-bitlink.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
8
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
9
|
+
const client_1 = require("../common/client");
|
|
10
|
+
const auth_1 = require("../common/auth");
|
|
11
|
+
const props_1 = require("../common/props");
|
|
12
|
+
exports.createBitlinkAction = (0, pieces_framework_1.createAction)({
|
|
13
|
+
auth: auth_1.bitlyAuth,
|
|
14
|
+
name: 'create_bitlink',
|
|
15
|
+
displayName: 'Create Bitlink',
|
|
16
|
+
description: 'Shorten a long URL with optional customization.',
|
|
17
|
+
audience: 'both',
|
|
18
|
+
aiMetadata: { description: 'Shortens a long URL into a Bitlink, optionally setting title, tags, custom branded domain, and mobile app deeplinks. Use to create a trackable short link from a destination URL (must start with http:// or https://). Not idempotent: each call creates a link, though Bitly may return an existing Bitlink for the same URL unless Force New Link is enabled.', idempotent: false },
|
|
19
|
+
props: {
|
|
20
|
+
long_url: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'Long URL',
|
|
22
|
+
description: 'The URL to shorten (must include http:// or https://).',
|
|
23
|
+
required: true,
|
|
24
|
+
}),
|
|
25
|
+
group_guid: props_1.groupGuid,
|
|
26
|
+
domain: Object.assign(Object.assign({}, props_1.domain), { defaultValue: 'bit.ly' }),
|
|
27
|
+
title: pieces_framework_1.Property.ShortText({
|
|
28
|
+
displayName: 'Title',
|
|
29
|
+
description: 'Custom title for the Bitlink.',
|
|
30
|
+
required: false,
|
|
31
|
+
}),
|
|
32
|
+
tags: pieces_framework_1.Property.Array({
|
|
33
|
+
displayName: 'Tags',
|
|
34
|
+
description: 'Tags to apply to the Bitlink.',
|
|
35
|
+
required: false,
|
|
36
|
+
}),
|
|
37
|
+
force_new_link: pieces_framework_1.Property.Checkbox({
|
|
38
|
+
displayName: 'Force New Link',
|
|
39
|
+
description: 'Create new link even if one exists for this URL.',
|
|
40
|
+
required: false,
|
|
41
|
+
defaultValue: false,
|
|
42
|
+
}),
|
|
43
|
+
// Mobile App Deeplink Configuration
|
|
44
|
+
app_id: pieces_framework_1.Property.ShortText({
|
|
45
|
+
displayName: 'Mobile App ID',
|
|
46
|
+
description: 'Mobile app identifier (e.g., com.yourapp.name).',
|
|
47
|
+
required: false,
|
|
48
|
+
}),
|
|
49
|
+
app_uri_path: pieces_framework_1.Property.ShortText({
|
|
50
|
+
displayName: 'App URI Path',
|
|
51
|
+
description: 'Path within the mobile app (e.g., /product/123).',
|
|
52
|
+
required: false,
|
|
53
|
+
}),
|
|
54
|
+
install_url: pieces_framework_1.Property.LongText({
|
|
55
|
+
displayName: 'App Install URL',
|
|
56
|
+
description: 'URL where users can install the mobile app.',
|
|
57
|
+
required: false,
|
|
58
|
+
}),
|
|
59
|
+
install_type: pieces_framework_1.Property.StaticDropdown({
|
|
60
|
+
displayName: 'Install Type',
|
|
61
|
+
description: 'How to handle app installation.',
|
|
62
|
+
required: false,
|
|
63
|
+
options: {
|
|
64
|
+
disabled: false,
|
|
65
|
+
options: [
|
|
66
|
+
{ label: 'No Install', value: 'no_install' },
|
|
67
|
+
{ label: 'Auto Install', value: 'auto_install' },
|
|
68
|
+
{ label: 'Promote Install', value: 'promote_install' },
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
},
|
|
73
|
+
run(context) {
|
|
74
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
76
|
+
const { long_url, group_guid, domain, title, tags, force_new_link, app_id, app_uri_path, install_url, install_type, } = context.propsValue;
|
|
77
|
+
try {
|
|
78
|
+
// Pre-flight validation
|
|
79
|
+
if (!long_url.startsWith('http://') && !long_url.startsWith('https://')) {
|
|
80
|
+
throw new Error("Invalid Long URL. It must start with 'http://' or 'https://'.");
|
|
81
|
+
}
|
|
82
|
+
const body = { long_url };
|
|
83
|
+
if (group_guid) {
|
|
84
|
+
body['group_guid'] = group_guid;
|
|
85
|
+
}
|
|
86
|
+
if (domain) {
|
|
87
|
+
body['domain'] = domain;
|
|
88
|
+
}
|
|
89
|
+
if (title) {
|
|
90
|
+
body['title'] = title;
|
|
91
|
+
}
|
|
92
|
+
if (tags && tags.length > 0) {
|
|
93
|
+
body['tags'] = tags;
|
|
94
|
+
}
|
|
95
|
+
if (force_new_link) {
|
|
96
|
+
body['force_new_link'] = force_new_link;
|
|
97
|
+
}
|
|
98
|
+
// Build deeplinks array if app configuration is provided
|
|
99
|
+
if (app_id && app_uri_path && install_url && install_type) {
|
|
100
|
+
body['deeplinks'] = [
|
|
101
|
+
{
|
|
102
|
+
app_id,
|
|
103
|
+
app_uri_path,
|
|
104
|
+
install_url,
|
|
105
|
+
install_type,
|
|
106
|
+
},
|
|
107
|
+
];
|
|
108
|
+
}
|
|
109
|
+
return yield (0, client_1.bitlyApiCall)({
|
|
110
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
111
|
+
auth: context.auth.props,
|
|
112
|
+
resourceUri: '/bitlinks',
|
|
113
|
+
body,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
const errorMessage = ((_b = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.description) ||
|
|
118
|
+
((_d = (_c = error.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.message) ||
|
|
119
|
+
error.message;
|
|
120
|
+
if (((_e = error.response) === null || _e === void 0 ? void 0 : _e.status) === 429) {
|
|
121
|
+
throw new Error('Rate limit exceeded. Please wait before trying again.');
|
|
122
|
+
}
|
|
123
|
+
if (((_f = error.response) === null || _f === void 0 ? void 0 : _f.status) === 422) {
|
|
124
|
+
throw new Error(`Unprocessable Entity: ${errorMessage}. Please check the format of your Long URL or other inputs.`);
|
|
125
|
+
}
|
|
126
|
+
if (((_g = error.response) === null || _g === void 0 ? void 0 : _g.status) === 401 || ((_h = error.response) === null || _h === void 0 ? void 0 : _h.status) === 403) {
|
|
127
|
+
throw new Error(`Authentication failed or forbidden: ${errorMessage}. Please check your Access Token and permissions.`);
|
|
128
|
+
}
|
|
129
|
+
throw new Error(`Failed to create Bitlink: ${errorMessage || 'Unknown error occurred'}`);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
//# sourceMappingURL=create-bitlink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-bitlink.js","sourceRoot":"","sources":["../../../src/lib/actions/create-bitlink.ts"],"names":[],"mappings":";;;;A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AC;gBACJ,CAAC;gBAED,IAAI,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,IAAI,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;oBACrE,MAAM,IAAI,KAAK,CACb,uCAAuC,YAAY,mDAAmD,CACvG,CAAC;gBACJ,CAAC;gBAED,MAAM,IAAI,KAAK,CACb,6BAA6B,YAAY,IAAI,wBAAwB,EAAE,CACxE,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export declare const createQrCodeAction: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
accessToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
}>, {
|
|
4
|
+
group_guid: import("@agnocon/pieces-framework").DropdownProperty<string, true, import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
5
|
+
accessToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
|
|
6
|
+
}>>;
|
|
7
|
+
destination_type: import("@agnocon/pieces-framework").StaticDropdownProperty<string, true>;
|
|
8
|
+
destination: import("@agnocon/pieces-framework").DynamicProperties<true, import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
9
|
+
accessToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
|
|
10
|
+
}>>;
|
|
11
|
+
title: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
12
|
+
archived: import("@agnocon/pieces-framework").CheckboxProperty<false>;
|
|
13
|
+
background_color: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
14
|
+
dot_pattern_color: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
15
|
+
dot_pattern_type: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
16
|
+
corner_1_shape: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
17
|
+
corner_1_inner_color: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
18
|
+
corner_1_outer_color: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
19
|
+
corner_2_shape: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
20
|
+
corner_2_inner_color: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
21
|
+
corner_2_outer_color: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
22
|
+
corner_3_shape: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
23
|
+
corner_3_inner_color: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
24
|
+
corner_3_outer_color: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
25
|
+
gradient_style: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
26
|
+
gradient_color_1: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
27
|
+
gradient_color_2: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
28
|
+
gradient_angle: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
29
|
+
gradient_exclude_corners: import("@agnocon/pieces-framework").CheckboxProperty<false>;
|
|
30
|
+
frame_id: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
31
|
+
frame_primary_color: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
32
|
+
frame_secondary_color: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
33
|
+
frame_background_color: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
34
|
+
frame_text: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
35
|
+
logo_image_guid: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
36
|
+
bitly_brand: import("@agnocon/pieces-framework").CheckboxProperty<false>;
|
|
37
|
+
error_correction: import("@agnocon/pieces-framework").StaticDropdownProperty<number, false>;
|
|
38
|
+
}>;
|
|
39
|
+
//# sourceMappingURL=create-qr-code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-qr-code.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/create-qr-code.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmY7B,CAAC"}
|