@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 CHANGED
@@ -1,19 +1,28 @@
1
1
  {
2
2
  "name": "@activepieces/piece-poper",
3
- "version": "0.0.1",
3
+ "version": "0.1.1",
4
4
  "dependencies": {
5
- "@sinclair/typebox": "0.26.8",
6
- "axios": "1.6.7",
5
+ "@sinclair/typebox": "0.33.18",
7
6
  "dayjs": "1.11.9",
8
- "is-base64": "1.1.0",
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-common": "0.2.12",
13
- "@activepieces/pieces-framework": "0.7.29",
14
- "@activepieces/shared": "0.10.104",
15
- "tslib": "1.14.1"
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 poperAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
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 = exports.poperAuth = void 0;
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: exports.poperAuth,
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":";;;;AAAA,qEAAwE;AACxE,sDAAkD;AAClD,+DAAkF;AAClF,iDAAqD;AAExC,QAAA,SAAS,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC7C,WAAW,EAAE,SAAS;IACtB,WAAW,EACV,mGAAmG;IACpG,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,CAAO,EAAE,IAAI,EAAE,EAAE,EAAE;QAC5B,MAAM,OAAO,GAAgB;YAC5B,MAAM,EAAE,0BAAU,CAAC,IAAI;YACvB,GAAG,EAAE,sCAAsC;YAC3C,OAAO,EAAE;gBACR,cAAc,EAAE,mCAAmC;aACnD;YACD,IAAI,EAAE;gBACL,OAAO,EAAE,IAAI;aACb;SACD,CAAC;QAEF,IAAI,CAAC;YACJ,MAAM,GAAG,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAElD,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBACxB,OAAO;oBACN,KAAK,EAAE,IAAI;iBACX,CAAC;YACH,CAAC;YAED,OAAO;gBACN,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,oBAAoB;aAC3B,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACZ,OAAO;gBACN,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,oBAAoB;aAC3B,CAAC;QACH,CAAC;IACF,CAAC,CAAA;CACD,CAAC,CAAC;AAEU,QAAA,KAAK,GAAG,IAAA,8BAAW,EAAC;IAChC,WAAW,EAAE,OAAO;IACpB,IAAI,EAAE,iBAAS;IACf,uBAAuB,EAAE,QAAQ;IACjC,UAAU,EAAE,CAAC,sBAAa,CAAC,SAAS,CAAC;IACrC,WAAW,EACV,mHAAmH;IACpH,OAAO,EAAE,+CAA+C;IACxD,OAAO,EAAE,CAAC,aAAa,CAAC;IACxB,OAAO,EAAE,EAAE;IACX,QAAQ,EAAE,CAAC,kBAAO,CAAC;CACnB,CAAC,CAAC"}
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, DropdownProperty } from '@activepieces/pieces-framework';
2
- export declare const newLead: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
3
- popup_id: DropdownProperty<string, false> | DropdownProperty<string, true>;
4
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
5
- popup_id: DropdownProperty<string, false> | DropdownProperty<string, true>;
6
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
7
- popup_id: DropdownProperty<string, false> | DropdownProperty<string, true>;
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 pieces_common_1 = require("@activepieces/pieces-common");
7
- const __1 = require("./../../");
8
- const pieces_framework_2 = require("@activepieces/pieces-framework");
9
- const buildEmptyList = ({ placeholder }) => {
10
- return {
11
- disabled: true,
12
- options: [],
13
- placeholder,
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
- popup_id: popupsDropdown,
20
+ markdown: pieces_framework_1.Property.MarkDown({
21
+ value: message,
22
+ }),
108
23
  },
109
24
  sampleData: {},
110
- type: pieces_framework_1.TriggerStrategy.POLLING,
111
- test(context) {
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
- const { store, auth, propsValue } = context;
120
- yield pieces_common_1.pollingHelper.onEnable(polling, { store, auth, propsValue });
28
+ // ignore
121
29
  });
122
30
  },
123
- onDisable(context) {
31
+ onDisable() {
124
32
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
125
- const { store, auth, propsValue } = context;
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
- const { store, auth, propsValue } = context;
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":";;;;AACA,qEAA2I;AAC3I,+DAA0H;AAC1H,gCAAqC;AAErC,qEAA0D;AAE1D,MAAM,cAAc,GAAG,CAAC,EAAE,WAAW,EAA2B,EAAE,EAAE;IAClE,OAAO;QACL,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,EAAE;QACX,WAAW;KACZ,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,2BAAQ,CAAC,QAAQ,CAAS;IAC/C,WAAW,EAAE,YAAY;IACzB,UAAU,EAAE,EAAE;IACd,WAAW,EAAE,6CAA6C;IAC1D,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,CAAO,EAAE,IAAI,EAAE,EAAE,EAAE;QAC1B,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,cAAc,CAAC;gBACpB,WAAW,EAAE,iCAAiC;aAC/C,CAAC,CAAC;QACL,CAAC;QAED,MAAM,OAAO,GAAgB;YACzB,MAAM,EAAE,0BAAU,CAAC,IAAI;YACvB,GAAG,EAAE,4CAA4C;YACjD,OAAO,EAAE;gBACP,cAAc,EAAE,mCAAmC;aACpD;YACD,IAAI,EAAE;gBACJ,OAAO,EAAE,IAAI;aACd;SACF,CAAC;QAEF,IAAG,CAAC;YAEE,MAAM,GAAG,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC,OAA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OAAO;;YACnB,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;YAC5C,MAAM,6BAAa,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;QACxE,CAAC;KAAA;IAEK,GAAG,CAAC,OAAO;;YACb,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;YAC5C,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;QAC1E,CAAC;KAAA;CACA,CAAC,CAAC"}
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"}