@activepieces/piece-poper 0.0.1 → 0.1.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/package.json +19 -10
- package/src/index.d.ts +1 -2
- package/src/index.js +2 -39
- package/src/index.js.map +1 -1
- package/src/lib/triggers/new-lead.d.ts +7 -7
- package/src/lib/triggers/new-lead.js +19 -113
- package/src/lib/triggers/new-lead.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-poper",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@sinclair/typebox": "0.
|
|
6
|
-
"axios": "1.6.7",
|
|
5
|
+
"@sinclair/typebox": "0.33.18",
|
|
7
6
|
"dayjs": "1.11.9",
|
|
8
|
-
"
|
|
9
|
-
"lodash": "4.17.21",
|
|
7
|
+
"deepmerge": "4.3.1",
|
|
10
8
|
"nanoid": "3.3.6",
|
|
11
9
|
"semver": "7.6.0",
|
|
12
|
-
"@activepieces/pieces-
|
|
13
|
-
"@activepieces/
|
|
14
|
-
"
|
|
15
|
-
|
|
10
|
+
"@activepieces/pieces-framework": "0.7.39",
|
|
11
|
+
"@activepieces/shared": "0.10.126",
|
|
12
|
+
"tslib": "2.6.2"
|
|
13
|
+
},
|
|
14
|
+
"overrides": {
|
|
15
|
+
"@tryfabric/martian": {
|
|
16
|
+
"@notionhq/client": "$@notionhq/client"
|
|
17
|
+
},
|
|
18
|
+
"vite": {
|
|
19
|
+
"rollup": "npm:@rollup/wasm-node"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"resolutions": {
|
|
23
|
+
"rollup": "npm:@rollup/wasm-node"
|
|
16
24
|
},
|
|
17
25
|
"main": "./src/index.js",
|
|
18
|
-
"type": "commonjs"
|
|
26
|
+
"type": "commonjs",
|
|
27
|
+
"types": "./src/index.d.ts"
|
|
19
28
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const poper: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
1
|
+
export declare const poper: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").PieceAuthProperty>;
|
package/src/index.js
CHANGED
|
@@ -1,49 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.poper =
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
3
|
+
exports.poper = void 0;
|
|
5
4
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
5
|
const new_lead_1 = require("./lib/triggers/new-lead");
|
|
7
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
8
6
|
const shared_1 = require("@activepieces/shared");
|
|
9
|
-
exports.poperAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
10
|
-
displayName: 'API Key',
|
|
11
|
-
description: 'Use the Poper API key to authenticate the piece. You can find your API key in the Poper settings.',
|
|
12
|
-
required: true,
|
|
13
|
-
validate: ({ auth }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
-
const request = {
|
|
15
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
16
|
-
url: 'https://api.poper.ai/general/v1/ping',
|
|
17
|
-
headers: {
|
|
18
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
19
|
-
},
|
|
20
|
-
body: {
|
|
21
|
-
api_key: auth,
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
try {
|
|
25
|
-
const res = yield pieces_common_1.httpClient.sendRequest(request);
|
|
26
|
-
if (res.status === 200) {
|
|
27
|
-
return {
|
|
28
|
-
valid: true,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
return {
|
|
32
|
-
valid: false,
|
|
33
|
-
error: 'API Key is invalid',
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
catch (e) {
|
|
37
|
-
return {
|
|
38
|
-
valid: false,
|
|
39
|
-
error: 'API Key is invalid',
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
}),
|
|
43
|
-
});
|
|
44
7
|
exports.poper = (0, pieces_framework_1.createPiece)({
|
|
45
8
|
displayName: 'Poper',
|
|
46
|
-
auth:
|
|
9
|
+
auth: pieces_framework_1.PieceAuth.None(),
|
|
47
10
|
minimumSupportedRelease: '0.20.0',
|
|
48
11
|
categories: [shared_1.PieceCategory.MARKETING],
|
|
49
12
|
description: 'AI Driven Pop-up Builder that can convert visitors into customers,increase subscriber count, and skyrocket sales.',
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/poper/src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/poper/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,sDAAkD;AAClD,iDAAqD;AAExC,QAAA,KAAK,GAAG,IAAA,8BAAW,EAAC;IAC/B,WAAW,EAAE,OAAO;IACpB,IAAI,EAAE,4BAAS,CAAC,IAAI,EAAE;IACtB,uBAAuB,EAAE,QAAQ;IACjC,UAAU,EAAE,CAAC,sBAAa,CAAC,SAAS,CAAC;IACrC,WAAW,EACT,mHAAmH;IACrH,OAAO,EAAE,+CAA+C;IACxD,OAAO,EAAE,CAAC,aAAa,CAAC;IACxB,OAAO,EAAE,EAAE;IACX,QAAQ,EAAE,CAAC,kBAAO,CAAC;CACpB,CAAC,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { TriggerStrategy
|
|
2
|
-
export declare const newLead: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").
|
|
3
|
-
|
|
4
|
-
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").
|
|
5
|
-
|
|
6
|
-
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").
|
|
7
|
-
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const newLead: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").PieceAuthProperty, {
|
|
3
|
+
markdown: import("dist/packages/pieces/community/framework/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
4
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").PieceAuthProperty, {
|
|
5
|
+
markdown: import("dist/packages/pieces/community/framework/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
6
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").PieceAuthProperty, {
|
|
7
|
+
markdown: import("dist/packages/pieces/community/framework/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
8
8
|
}>;
|
|
@@ -3,133 +3,39 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.newLead = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
const popupsDropdown = pieces_framework_2.Property.Dropdown({
|
|
17
|
-
displayName: 'Popup Name',
|
|
18
|
-
refreshers: [],
|
|
19
|
-
description: "Select the popup name to trigger the action",
|
|
20
|
-
required: true,
|
|
21
|
-
options: ({ auth }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
-
if (!auth) {
|
|
23
|
-
return buildEmptyList({
|
|
24
|
-
placeholder: 'Please select an authentication',
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
const request = {
|
|
28
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
29
|
-
url: 'https://api.poper.ai/general/v1/popup/list',
|
|
30
|
-
headers: {
|
|
31
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
32
|
-
},
|
|
33
|
-
body: {
|
|
34
|
-
api_key: auth,
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
try {
|
|
38
|
-
const res = yield pieces_common_1.httpClient.sendRequest(request);
|
|
39
|
-
if (res.status === 200) {
|
|
40
|
-
const popups = res.body.popups;
|
|
41
|
-
if (popups.length === 0) {
|
|
42
|
-
return buildEmptyList({
|
|
43
|
-
placeholder: 'No popups found! Please create a popup.',
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
const options = popups.map((p) => ({
|
|
47
|
-
label: p.name,
|
|
48
|
-
value: p.id,
|
|
49
|
-
}));
|
|
50
|
-
return {
|
|
51
|
-
disabled: false,
|
|
52
|
-
options,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
return buildEmptyList({
|
|
56
|
-
placeholder: 'Not authorized.',
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
catch (e) {
|
|
60
|
-
return buildEmptyList({
|
|
61
|
-
placeholder: 'Not authorized.',
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
}),
|
|
65
|
-
});
|
|
66
|
-
// replace auth with piece auth variable
|
|
67
|
-
const polling = {
|
|
68
|
-
strategy: pieces_common_1.DedupeStrategy.LAST_ITEM,
|
|
69
|
-
items: ({ auth, propsValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
70
|
-
// implement the logic to fetch the items
|
|
71
|
-
const request = {
|
|
72
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
73
|
-
url: 'https://api.poper.ai/general/v1/popup/responses',
|
|
74
|
-
headers: {
|
|
75
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
76
|
-
},
|
|
77
|
-
body: {
|
|
78
|
-
api_key: auth,
|
|
79
|
-
popup_id: propsValue.popup_id,
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
try {
|
|
83
|
-
const res = yield pieces_common_1.httpClient.sendRequest(request);
|
|
84
|
-
if (res.status === 200) {
|
|
85
|
-
const responses = res.body.responses;
|
|
86
|
-
if (responses.length === 0) {
|
|
87
|
-
return [];
|
|
88
|
-
}
|
|
89
|
-
return responses.map((response) => ({
|
|
90
|
-
id: response.id,
|
|
91
|
-
data: response,
|
|
92
|
-
}));
|
|
93
|
-
}
|
|
94
|
-
return [];
|
|
95
|
-
}
|
|
96
|
-
catch (e) {
|
|
97
|
-
return [];
|
|
98
|
-
}
|
|
99
|
-
}),
|
|
100
|
-
};
|
|
6
|
+
const message = `
|
|
7
|
+
1. Log in to your [Poper Account](https://app.poper.ai/).
|
|
8
|
+
2. Click on the popup for which you want to set up a trigger.
|
|
9
|
+
3. On the left-side menu, click on Integrations and search for **Webhook**.
|
|
10
|
+
4. Enter an appropriate webhook name and paste the following URL:
|
|
11
|
+
\`\`\`text
|
|
12
|
+
{{webhookUrl}}
|
|
13
|
+
\`\`\`
|
|
14
|
+
`;
|
|
101
15
|
exports.newLead = (0, pieces_framework_1.createTrigger)({
|
|
102
|
-
auth: __1.poperAuth,
|
|
103
16
|
name: 'newLead',
|
|
104
17
|
displayName: 'New Lead',
|
|
105
|
-
description: 'Triggers when a new lead is obtained from popup',
|
|
18
|
+
description: 'Triggers when a new lead is obtained from popup.',
|
|
106
19
|
props: {
|
|
107
|
-
|
|
20
|
+
markdown: pieces_framework_1.Property.MarkDown({
|
|
21
|
+
value: message,
|
|
22
|
+
}),
|
|
108
23
|
},
|
|
109
24
|
sampleData: {},
|
|
110
|
-
type: pieces_framework_1.TriggerStrategy.
|
|
111
|
-
|
|
112
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
113
|
-
const { store, auth, propsValue } = context;
|
|
114
|
-
return yield pieces_common_1.pollingHelper.test(polling, { store, auth, propsValue });
|
|
115
|
-
});
|
|
116
|
-
},
|
|
117
|
-
onEnable(context) {
|
|
25
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
26
|
+
onEnable() {
|
|
118
27
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
|
|
120
|
-
yield pieces_common_1.pollingHelper.onEnable(polling, { store, auth, propsValue });
|
|
28
|
+
// ignore
|
|
121
29
|
});
|
|
122
30
|
},
|
|
123
|
-
onDisable(
|
|
31
|
+
onDisable() {
|
|
124
32
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
125
|
-
|
|
126
|
-
yield pieces_common_1.pollingHelper.onDisable(polling, { store, auth, propsValue });
|
|
33
|
+
// ignore
|
|
127
34
|
});
|
|
128
35
|
},
|
|
129
36
|
run(context) {
|
|
130
37
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
131
|
-
|
|
132
|
-
return yield pieces_common_1.pollingHelper.poll(polling, { store, auth, propsValue });
|
|
38
|
+
return [context.payload.body];
|
|
133
39
|
});
|
|
134
40
|
},
|
|
135
41
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-lead.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/poper/src/lib/triggers/new-lead.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"new-lead.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/poper/src/lib/triggers/new-lead.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AAExC,MAAM,OAAO,GAAG;;;;;;;;CAQf,CAAC;AAEW,QAAA,OAAO,GAAG,IAAA,gCAAa,EAAC;IACnC,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,kDAAkD;IAC/D,KAAK,EAAE;QACL,QAAQ,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC1B,KAAK,EAAE,OAAO;SACf,CAAC;KACH;IACD,UAAU,EAAE,EAAE;IACd,IAAI,EAAE,kCAAe,CAAC,OAAO;IACvB,QAAQ;;YACZ,SAAS;QACX,CAAC;KAAA;IACK,SAAS;;YACb,SAAS;QACX,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}
|