@activepieces/piece-poper 0.0.1 → 0.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/package.json +3 -5
- 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 +26 -113
- package/src/lib/triggers/new-lead.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-poper",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@sinclair/typebox": "0.26.8",
|
|
6
6
|
"axios": "1.6.7",
|
|
7
7
|
"dayjs": "1.11.9",
|
|
8
8
|
"is-base64": "1.1.0",
|
|
9
|
-
"lodash": "4.17.21",
|
|
10
9
|
"nanoid": "3.3.6",
|
|
11
10
|
"semver": "7.6.0",
|
|
12
|
-
"@activepieces/pieces-
|
|
13
|
-
"@activepieces/
|
|
14
|
-
"@activepieces/shared": "0.10.104",
|
|
11
|
+
"@activepieces/pieces-framework": "0.7.32",
|
|
12
|
+
"@activepieces/shared": "0.10.107",
|
|
15
13
|
"tslib": "1.14.1"
|
|
16
14
|
},
|
|
17
15
|
"main": "./src/index.js",
|
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,46 @@ 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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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 URLs:
|
|
11
|
+
|
|
12
|
+
**Test URL (only generate sample data)**:
|
|
13
|
+
\`\`\`text
|
|
14
|
+
{{webhookUrl}}/test
|
|
15
|
+
\`\`\`
|
|
16
|
+
|
|
17
|
+
**Trigger Flow URL**:
|
|
18
|
+
\`\`\`text
|
|
19
|
+
{{webhookUrl}}
|
|
20
|
+
\`\`\`
|
|
21
|
+
`;
|
|
101
22
|
exports.newLead = (0, pieces_framework_1.createTrigger)({
|
|
102
|
-
auth: __1.poperAuth,
|
|
103
23
|
name: 'newLead',
|
|
104
24
|
displayName: 'New Lead',
|
|
105
|
-
description: 'Triggers when a new lead is obtained from popup',
|
|
25
|
+
description: 'Triggers when a new lead is obtained from popup.',
|
|
106
26
|
props: {
|
|
107
|
-
|
|
27
|
+
markdown: pieces_framework_1.Property.MarkDown({
|
|
28
|
+
value: message,
|
|
29
|
+
}),
|
|
108
30
|
},
|
|
109
31
|
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) {
|
|
32
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
33
|
+
onEnable() {
|
|
118
34
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
|
|
120
|
-
yield pieces_common_1.pollingHelper.onEnable(polling, { store, auth, propsValue });
|
|
35
|
+
// ignore
|
|
121
36
|
});
|
|
122
37
|
},
|
|
123
|
-
onDisable(
|
|
38
|
+
onDisable() {
|
|
124
39
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
125
|
-
|
|
126
|
-
yield pieces_common_1.pollingHelper.onDisable(polling, { store, auth, propsValue });
|
|
40
|
+
// ignore
|
|
127
41
|
});
|
|
128
42
|
},
|
|
129
43
|
run(context) {
|
|
130
44
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
131
|
-
|
|
132
|
-
return yield pieces_common_1.pollingHelper.poll(polling, { store, auth, propsValue });
|
|
45
|
+
return [context.payload.body];
|
|
133
46
|
});
|
|
134
47
|
},
|
|
135
48
|
});
|
|
@@ -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;;;;;;;;;;;;;;;CAef,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"}
|