@taskmagic/apps-oneclickimpact 0.0.1
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 +7 -0
- package/package.json +47 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +53 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/capture-carbon.d.ts +6 -0
- package/src/lib/actions/capture-carbon.js +49 -0
- package/src/lib/actions/capture-carbon.js.map +1 -0
- package/src/lib/actions/clean-ocean.d.ts +6 -0
- package/src/lib/actions/clean-ocean.js +49 -0
- package/src/lib/actions/clean-ocean.js.map +1 -0
- package/src/lib/actions/donate-money.d.ts +6 -0
- package/src/lib/actions/donate-money.js +49 -0
- package/src/lib/actions/donate-money.js.map +1 -0
- package/src/lib/actions/plant-trees.d.ts +6 -0
- package/src/lib/actions/plant-trees.js +49 -0
- package/src/lib/actions/plant-trees.js.map +1 -0
- package/src/lib/common/auth.d.ts +1 -0
- package/src/lib/common/auth.js +10 -0
- package/src/lib/common/auth.js.map +1 -0
- package/src/lib/common/client.d.ts +3 -0
- package/src/lib/common/client.js +27 -0
- package/src/lib/common/client.js.map +1 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@taskmagic/apps-oneclickimpact",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@anthropic-ai/sdk": "0.33.1",
|
|
6
|
+
"@sinclair/typebox": "0.34.11",
|
|
7
|
+
"axios": "1.17.0",
|
|
8
|
+
"axios-retry": "4.4.1",
|
|
9
|
+
"deepmerge-ts": "7.1.0",
|
|
10
|
+
"mime-types": "2.1.35",
|
|
11
|
+
"nanoid": "3.3.8",
|
|
12
|
+
"openai": "4.67.1",
|
|
13
|
+
"replicate": "0.34.1",
|
|
14
|
+
"semver": "7.6.0",
|
|
15
|
+
"zod": "3.25.76",
|
|
16
|
+
"@taskmagic/pieces-common": "0.4.4",
|
|
17
|
+
"@taskmagic/pieces-framework": "0.7.46",
|
|
18
|
+
"@taskmagic/shared": "0.10.171",
|
|
19
|
+
"tslib": "1.14.1"
|
|
20
|
+
},
|
|
21
|
+
"overrides": {
|
|
22
|
+
"cross-spawn": "7.0.6",
|
|
23
|
+
"elliptic": "^6.6.1",
|
|
24
|
+
"fast-xml-parser": "^4.4.1",
|
|
25
|
+
"protobufjs": "^7.5.5",
|
|
26
|
+
"tmp": "^0.2.4",
|
|
27
|
+
"koa": "^2.16.4",
|
|
28
|
+
"picomatch": "^4.0.4",
|
|
29
|
+
"langsmith": "^0.6.0",
|
|
30
|
+
"serialize-javascript": "^6.0.2",
|
|
31
|
+
"elevenlabs": {
|
|
32
|
+
"form-data": "^4.0.4"
|
|
33
|
+
},
|
|
34
|
+
"@tryfabric/martian": {
|
|
35
|
+
"@notionhq/client": "$@notionhq/client"
|
|
36
|
+
},
|
|
37
|
+
"vite": {
|
|
38
|
+
"rollup": "npm:@rollup/wasm-node@^4.61.1"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"resolutions": {
|
|
42
|
+
"rollup": "npm:@rollup/wasm-node@^4.61.1"
|
|
43
|
+
},
|
|
44
|
+
"types": "./src/index.d.ts",
|
|
45
|
+
"main": "./src/index.js",
|
|
46
|
+
"type": "commonjs"
|
|
47
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const oneclickimpact: import("@taskmagic/pieces-framework").Piece<import("@taskmagic/pieces-framework").SecretTextProperty<true>>;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.oneclickimpact = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
7
|
+
const shared_1 = require("@taskmagic/shared");
|
|
8
|
+
const auth_1 = require("./lib/common/auth");
|
|
9
|
+
const capture_carbon_1 = require("./lib/actions/capture-carbon");
|
|
10
|
+
const clean_ocean_1 = require("./lib/actions/clean-ocean");
|
|
11
|
+
const donate_money_1 = require("./lib/actions/donate-money");
|
|
12
|
+
const plant_trees_1 = require("./lib/actions/plant-trees");
|
|
13
|
+
exports.oneclickimpact = (0, pieces_framework_1.createPiece)({
|
|
14
|
+
displayName: '1ClickImpact',
|
|
15
|
+
auth: auth_1.oneclickimpactAuth,
|
|
16
|
+
minimumSupportedRelease: '0.30.0',
|
|
17
|
+
description: 'Make a positive environmental impact with every transaction.',
|
|
18
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/oneclickimpact.png',
|
|
19
|
+
categories: [shared_1.PieceCategory.PRODUCTIVITY],
|
|
20
|
+
authors: ['sanket-a11y'],
|
|
21
|
+
ai: {
|
|
22
|
+
description: 'Fund environmental impact through 1ClickImpact: capture carbon, clean ocean waste, plant trees, or donate money, optionally on behalf of a named customer.',
|
|
23
|
+
keywords: [
|
|
24
|
+
'carbon offset',
|
|
25
|
+
'capture carbon',
|
|
26
|
+
'plant trees',
|
|
27
|
+
'reforestation',
|
|
28
|
+
'ocean cleanup',
|
|
29
|
+
'clean ocean',
|
|
30
|
+
'donate',
|
|
31
|
+
'donation',
|
|
32
|
+
'environmental impact',
|
|
33
|
+
'sustainability',
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
actions: [
|
|
37
|
+
capture_carbon_1.captureCarbon,
|
|
38
|
+
clean_ocean_1.cleanOcean,
|
|
39
|
+
donate_money_1.donateMoney,
|
|
40
|
+
plant_trees_1.plantTrees,
|
|
41
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
42
|
+
auth: auth_1.oneclickimpactAuth,
|
|
43
|
+
baseUrl: () => 'https://api.1clickimpact.com/v1',
|
|
44
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
+
return {
|
|
46
|
+
'x-api-key': auth,
|
|
47
|
+
};
|
|
48
|
+
}),
|
|
49
|
+
}),
|
|
50
|
+
],
|
|
51
|
+
triggers: [],
|
|
52
|
+
});
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/oneclickimpact/src/index.ts"],"names":[],"mappings":";;;;AAAA,kEAA0D;AAC1D,4DAAqE;AACrE,8CAAkD;AAClD,4CAAuD;AACvD,iEAA6D;AAC7D,2DAAuD;AACvD,6DAAyD;AACzD,2DAAuD;AAE1C,QAAA,cAAc,GAAG,IAAA,8BAAW,EAAC;IACxC,WAAW,EAAE,cAAc;IAC3B,IAAI,EAAE,yBAAkB;IACxB,uBAAuB,EAAE,QAAQ;IACjC,WAAW,EAAE,8DAA8D;IAC3E,OAAO,EAAE,wDAAwD;IACjE,UAAU,EAAE,CAAC,sBAAa,CAAC,YAAY,CAAC;IACxC,OAAO,EAAE,CAAC,aAAa,CAAC;IACxB,EAAE,EAAE;QACF,WAAW,EACT,4JAA4J;QAC9J,QAAQ,EAAE;YACR,eAAe;YACf,gBAAgB;YAChB,aAAa;YACb,eAAe;YACf,eAAe;YACf,aAAa;YACb,QAAQ;YACR,UAAU;YACV,sBAAsB;YACtB,gBAAgB;SACjB;KACF;IACD,OAAO,EAAE;QACP,8BAAa;QACb,wBAAU;QACV,0BAAW;QACX,wBAAU;QACV,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,yBAAkB;YACxB,OAAO,EAAE,GAAG,EAAE,CAAC,iCAAiC;YAChD,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC1B,OAAO;oBACL,WAAW,EAAE,IAAc;iBAC5B,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const captureCarbon: import("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
amount: import("@taskmagic/pieces-framework").NumberProperty<true>;
|
|
3
|
+
customerEmail: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
customerName: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
notify: import("@taskmagic/pieces-framework").CheckboxProperty<false>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.captureCarbon = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
exports.captureCarbon = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.oneclickimpactAuth,
|
|
11
|
+
name: 'captureCarbon',
|
|
12
|
+
displayName: 'Capture carbon',
|
|
13
|
+
description: 'Capture carbon for yourself or on behalf of the customer',
|
|
14
|
+
props: {
|
|
15
|
+
amount: pieces_framework_1.Property.Number({
|
|
16
|
+
displayName: 'Amount',
|
|
17
|
+
description: 'The amount of carbon to capture in lbs (1 and 10,000,000)',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
customerEmail: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'Customer Email',
|
|
22
|
+
description: 'The email of the customer on whose behalf the carbon is being captured',
|
|
23
|
+
required: false,
|
|
24
|
+
}),
|
|
25
|
+
customerName: pieces_framework_1.Property.ShortText({
|
|
26
|
+
displayName: 'Customer Name',
|
|
27
|
+
description: 'The name of the customer on whose behalf the carbon is being captured',
|
|
28
|
+
required: false,
|
|
29
|
+
}),
|
|
30
|
+
notify: pieces_framework_1.Property.Checkbox({
|
|
31
|
+
displayName: 'Notify',
|
|
32
|
+
description: 'Notification preference',
|
|
33
|
+
required: false,
|
|
34
|
+
}),
|
|
35
|
+
},
|
|
36
|
+
run(_a) {
|
|
37
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
38
|
+
const body = {
|
|
39
|
+
amount: propsValue.amount,
|
|
40
|
+
customerEmail: propsValue.customerEmail,
|
|
41
|
+
customerName: propsValue.customerName,
|
|
42
|
+
notify: propsValue.notify,
|
|
43
|
+
};
|
|
44
|
+
const response = yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.POST, '/capture_carbon', body);
|
|
45
|
+
return response;
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=capture-carbon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-carbon.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/oneclickimpact/src/lib/actions/capture-carbon.ts"],"names":[],"mappings":";;;;AAAA,kEAAqE;AACrE,yCAAoD;AACpD,4DAAsD;AACtD,6CAA+C;AAElC,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,yBAAkB;IACxB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,0DAA0D;IACvE,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACtB,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,2DAA2D;YACxE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAChC,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EACT,wEAAwE;YAC1E,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,YAAY,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC/B,WAAW,EAAE,eAAe;YAC5B,WAAW,EACT,uEAAuE;YACzE,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACxB,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,yBAAyB;YACtC,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,IAAI,GAAQ;gBAChB,MAAM,EAAE,UAAU,CAAC,MAAM;gBACzB,aAAa,EAAE,UAAU,CAAC,aAAa;gBACvC,YAAY,EAAE,UAAU,CAAC,YAAY;gBACrC,MAAM,EAAE,UAAU,CAAC,MAAM;aAC1B,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,IAAc,EACd,0BAAU,CAAC,IAAI,EACf,iBAAiB,EACjB,IAAI,CACL,CAAC;YACF,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const cleanOcean: import("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
amount: import("@taskmagic/pieces-framework").NumberProperty<true>;
|
|
3
|
+
customerEmail: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
customerName: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
notify: import("@taskmagic/pieces-framework").CheckboxProperty<false>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cleanOcean = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const client_1 = require("../common/client");
|
|
8
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
9
|
+
exports.cleanOcean = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.oneclickimpactAuth,
|
|
11
|
+
name: 'cleanOcean',
|
|
12
|
+
displayName: 'Clean ocean',
|
|
13
|
+
description: 'Clean ocean waste yourself or on behalf of the customer',
|
|
14
|
+
props: {
|
|
15
|
+
amount: pieces_framework_1.Property.Number({
|
|
16
|
+
displayName: 'Amount',
|
|
17
|
+
description: 'The amount of ocean waste to clean in lbs (1 and 10,000,000)',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
customerEmail: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'Customer Email',
|
|
22
|
+
description: 'The email of the customer on whose behalf the ocean waste is being cleaned',
|
|
23
|
+
required: false,
|
|
24
|
+
}),
|
|
25
|
+
customerName: pieces_framework_1.Property.ShortText({
|
|
26
|
+
displayName: 'Customer Name',
|
|
27
|
+
description: 'The name of the customer on whose behalf the ocean waste is being cleaned',
|
|
28
|
+
required: false,
|
|
29
|
+
}),
|
|
30
|
+
notify: pieces_framework_1.Property.Checkbox({
|
|
31
|
+
displayName: 'Notify',
|
|
32
|
+
description: 'Notification preference',
|
|
33
|
+
required: false,
|
|
34
|
+
}),
|
|
35
|
+
},
|
|
36
|
+
run(_a) {
|
|
37
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
38
|
+
const body = {
|
|
39
|
+
amount: propsValue.amount,
|
|
40
|
+
customerEmail: propsValue.customerEmail,
|
|
41
|
+
customerName: propsValue.customerName,
|
|
42
|
+
notify: propsValue.notify,
|
|
43
|
+
};
|
|
44
|
+
const response = yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.POST, '/clean_ocean', body);
|
|
45
|
+
return response;
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=clean-ocean.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clean-ocean.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/oneclickimpact/src/lib/actions/clean-ocean.ts"],"names":[],"mappings":";;;;AAAA,kEAAqE;AACrE,yCAAoD;AACpD,6CAA+C;AAC/C,4DAAsD;AAEzC,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,yBAAkB;IACxB,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,0DAA0D;IACvE,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACtB,WAAW,EAAE,QAAQ;YACrB,WAAW,EACT,8DAA8D;YAChE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAChC,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EACT,4EAA4E;YAC9E,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,YAAY,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC/B,WAAW,EAAE,eAAe;YAC5B,WAAW,EACT,2EAA2E;YAC7E,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACxB,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,yBAAyB;YACtC,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,IAAI,GAAQ;gBAChB,MAAM,EAAE,UAAU,CAAC,MAAM;gBACzB,aAAa,EAAE,UAAU,CAAC,aAAa;gBACvC,YAAY,EAAE,UAAU,CAAC,YAAY;gBACrC,MAAM,EAAE,UAAU,CAAC,MAAM;aAC1B,CAAC;YACF,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,IAAc,EACd,0BAAU,CAAC,IAAI,EACf,cAAc,EACd,IAAI,CACL,CAAC;YACF,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const donateMoney: import("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
amount: import("@taskmagic/pieces-framework").NumberProperty<true>;
|
|
3
|
+
customerEmail: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
customerName: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
notify: import("@taskmagic/pieces-framework").CheckboxProperty<false>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.donateMoney = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const client_1 = require("../common/client");
|
|
8
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
9
|
+
exports.donateMoney = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.oneclickimpactAuth,
|
|
11
|
+
name: 'donateMoney',
|
|
12
|
+
displayName: 'Donate Money',
|
|
13
|
+
description: ' Donate money to support environmental causes',
|
|
14
|
+
props: {
|
|
15
|
+
amount: pieces_framework_1.Property.Number({
|
|
16
|
+
displayName: 'Amount (USD)',
|
|
17
|
+
description: 'The amount in USD you wish to donate. Minimum $1.00',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
customerEmail: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'Customer Email',
|
|
22
|
+
description: 'The email of the customer on whose behalf the donation is being made',
|
|
23
|
+
required: false,
|
|
24
|
+
}),
|
|
25
|
+
customerName: pieces_framework_1.Property.ShortText({
|
|
26
|
+
displayName: 'Customer Name',
|
|
27
|
+
description: 'The name of the customer on whose behalf the donation is being made',
|
|
28
|
+
required: false,
|
|
29
|
+
}),
|
|
30
|
+
notify: pieces_framework_1.Property.Checkbox({
|
|
31
|
+
displayName: 'Notify',
|
|
32
|
+
description: 'Notification preference',
|
|
33
|
+
required: false,
|
|
34
|
+
}),
|
|
35
|
+
},
|
|
36
|
+
run(_a) {
|
|
37
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
38
|
+
const body = {
|
|
39
|
+
customerEmail: propsValue.customerEmail,
|
|
40
|
+
customerName: propsValue.customerName,
|
|
41
|
+
notify: propsValue.notify,
|
|
42
|
+
};
|
|
43
|
+
const amountInCents = Math.round(propsValue.amount * 100);
|
|
44
|
+
const response = yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.POST, '/donate_money', Object.assign(Object.assign({}, body), { amount: amountInCents }));
|
|
45
|
+
return response;
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=donate-money.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"donate-money.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/oneclickimpact/src/lib/actions/donate-money.ts"],"names":[],"mappings":";;;;AAAA,kEAAqE;AACrE,yCAAoD;AACpD,6CAA+C;AAC/C,4DAAsD;AAEzC,QAAA,WAAW,GAAG,IAAA,+BAAY,EAAC;IACtC,IAAI,EAAE,yBAAkB;IACxB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,+CAA+C;IAC5D,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACtB,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,qDAAqD;YAClE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAChC,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EACT,sEAAsE;YACxE,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,YAAY,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC/B,WAAW,EAAE,eAAe;YAC5B,WAAW,EACT,qEAAqE;YACvE,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACxB,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,yBAAyB;YACtC,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,IAAI,GAAQ;gBAChB,aAAa,EAAE,UAAU,CAAC,aAAa;gBACvC,YAAY,EAAE,UAAU,CAAC,YAAY;gBACrC,MAAM,EAAE,UAAU,CAAC,MAAM;aAC1B,CAAC;YACF,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;YAE1D,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,IAAc,EACd,0BAAU,CAAC,IAAI,EACf,eAAe,kCACV,IAAI,KAAE,MAAM,EAAE,aAAa,IACjC,CAAC;YACF,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const plantTrees: import("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
amount: import("@taskmagic/pieces-framework").NumberProperty<true>;
|
|
3
|
+
customerEmail: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
customerName: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
notify: import("@taskmagic/pieces-framework").CheckboxProperty<false>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.plantTrees = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const client_1 = require("../common/client");
|
|
8
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
9
|
+
exports.plantTrees = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.oneclickimpactAuth,
|
|
11
|
+
name: 'plantTrees',
|
|
12
|
+
displayName: 'Plant Trees',
|
|
13
|
+
description: 'Plant trees for yourself or on behalf of the customer',
|
|
14
|
+
props: {
|
|
15
|
+
amount: pieces_framework_1.Property.Number({
|
|
16
|
+
displayName: 'Amount',
|
|
17
|
+
description: 'The number of trees to plant (1 and 10,000,000)',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
customerEmail: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'Customer Email',
|
|
22
|
+
description: 'The email of the customer on whose behalf the trees are being planted',
|
|
23
|
+
required: false,
|
|
24
|
+
}),
|
|
25
|
+
customerName: pieces_framework_1.Property.ShortText({
|
|
26
|
+
displayName: 'Customer Name',
|
|
27
|
+
description: 'The name of the customer on whose behalf the trees are being planted',
|
|
28
|
+
required: false,
|
|
29
|
+
}),
|
|
30
|
+
notify: pieces_framework_1.Property.Checkbox({
|
|
31
|
+
displayName: 'Notify',
|
|
32
|
+
description: 'Notification preference',
|
|
33
|
+
required: false,
|
|
34
|
+
}),
|
|
35
|
+
},
|
|
36
|
+
run(_a) {
|
|
37
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
38
|
+
const body = {
|
|
39
|
+
amount: propsValue.amount,
|
|
40
|
+
customerEmail: propsValue.customerEmail,
|
|
41
|
+
customerName: propsValue.customerName,
|
|
42
|
+
notify: propsValue.notify,
|
|
43
|
+
};
|
|
44
|
+
const response = yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.POST, '/plant_trees', body);
|
|
45
|
+
return response;
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=plant-trees.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plant-trees.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/oneclickimpact/src/lib/actions/plant-trees.ts"],"names":[],"mappings":";;;;AAAA,kEAAqE;AACrE,yCAAoD;AACpD,6CAA+C;AAC/C,4DAAsD;AAEzC,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,yBAAkB;IACxB,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,uDAAuD;IACpE,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACtB,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,iDAAiD;YAC9D,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAChC,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EACT,uEAAuE;YACzE,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,YAAY,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC/B,WAAW,EAAE,eAAe;YAC5B,WAAW,EACT,sEAAsE;YACxE,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACxB,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,yBAAyB;YACtC,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,IAAI,GAAQ;gBAChB,MAAM,EAAE,UAAU,CAAC,MAAM;gBACzB,aAAa,EAAE,UAAU,CAAC,aAAa;gBACvC,YAAY,EAAE,UAAU,CAAC,YAAY;gBACrC,MAAM,EAAE,UAAU,CAAC,MAAM;aAC1B,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,IAAc,EACd,0BAAU,CAAC,IAAI,EACf,cAAc,EACd,IAAI,CACL,CAAC;YACF,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const oneclickimpactAuth: import("@taskmagic/pieces-framework").SecretTextProperty<true>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.oneclickimpactAuth = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
5
|
+
exports.oneclickimpactAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
6
|
+
displayName: 'API Key',
|
|
7
|
+
description: 'API Key for authenticating with 1ClickImpact',
|
|
8
|
+
required: true,
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/oneclickimpact/src/lib/common/auth.ts"],"names":[],"mappings":";;;AAAA,kEAAwD;AAE3C,QAAA,kBAAkB,GAAG,4BAAS,CAAC,UAAU,CAAC;IACrD,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,8CAA8C;IAC3D,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BASE_URL = void 0;
|
|
4
|
+
exports.makeRequest = makeRequest;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
7
|
+
exports.BASE_URL = `https://api.1clickimpact.com/v1`;
|
|
8
|
+
function makeRequest(api_key, method, path, body) {
|
|
9
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
+
try {
|
|
11
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
12
|
+
method,
|
|
13
|
+
url: `${exports.BASE_URL}${path}`,
|
|
14
|
+
headers: {
|
|
15
|
+
'x-api-key': api_key,
|
|
16
|
+
'Content-Type': 'application/json',
|
|
17
|
+
},
|
|
18
|
+
body,
|
|
19
|
+
});
|
|
20
|
+
return response.body;
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
throw new Error(`Unexpected error: ${error.message || String(error)}`);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/oneclickimpact/src/lib/common/client.ts"],"names":[],"mappings":";;;AAIA,kCAoBC;;AAxBD,4DAAkE;AAErD,QAAA,QAAQ,GAAG,iCAAiC,CAAC;AAE1D,SAAsB,WAAW,CAC/B,OAAe,EACf,MAAkB,EAClB,IAAY,EACZ,IAAc;;QAEd,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM;gBACN,GAAG,EAAE,GAAG,gBAAQ,GAAG,IAAI,EAAE;gBACzB,OAAO,EAAE;oBACP,WAAW,EAAE,OAAO;oBACpB,cAAc,EAAE,kBAAkB;iBACnC;gBACD,IAAI;aACL,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,qBAAqB,KAAK,CAAC,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;CAAA"}
|