-
Notifications
You must be signed in to change notification settings - Fork 5.5k
17674 components pingback #17750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
17674 components pingback #17750
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
...ack/actions/add-subscriber-to-segmentation-lists/add-subscriber-to-segmentation-lists.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
| import pingback from "../../pingback.app.mjs"; | ||
|
|
||
| export default { | ||
| name: "Add Subscriber To Segmentation Lists", | ||
| description: "Add a subscriber to segmentation lists by email [See the documentation](https://developer.pingback.com/docs/api/add-subscriber-to-segment)", | ||
| key: "pingback-add-subscriber-to-segmentation-lists", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| pingback, | ||
| email: { | ||
| propDefinition: [ | ||
| pingback, | ||
| "email", | ||
| ], | ||
| }, | ||
| segmentationLists: { | ||
| propDefinition: [ | ||
| pingback, | ||
| "segmentationLists", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.pingback.addSubscriberToSegmentationLists({ | ||
| $, | ||
| email: this.email, | ||
| data: { | ||
| segmentationLists: parseObject(this.segmentationLists), | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Subscriber ${this.email} added to segmentation list(s) successfully`); | ||
| return response; | ||
| }, | ||
| }; |
71 changes: 71 additions & 0 deletions
71
components/pingback/actions/create-subscriber/create-subscriber.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import { | ||
| parseCustomFields, | ||
| parseObject, | ||
| } from "../../common/utils.mjs"; | ||
| import pingback from "../../pingback.app.mjs"; | ||
|
|
||
| export default { | ||
| name: "Create Subscriber", | ||
| description: "Create a new subscriber [See the documentation](https://developer.pingback.com/docs/api/create-subscriber)", | ||
| key: "pingback-create-subscriber", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| pingback, | ||
| email: { | ||
| propDefinition: [ | ||
| pingback, | ||
| "email", | ||
| ], | ||
| }, | ||
| phone: { | ||
| propDefinition: [ | ||
| pingback, | ||
| "phone", | ||
| ], | ||
| }, | ||
| name: { | ||
| propDefinition: [ | ||
| pingback, | ||
| "name", | ||
| ], | ||
| }, | ||
| status: { | ||
| propDefinition: [ | ||
| pingback, | ||
| "status", | ||
| ], | ||
| }, | ||
| customFields: { | ||
| propDefinition: [ | ||
| pingback, | ||
| "customFields", | ||
| ], | ||
| }, | ||
| segmentationLists: { | ||
| propDefinition: [ | ||
| pingback, | ||
| "segmentationLists", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const data = { | ||
| email: this.email, | ||
| phone: this.phone, | ||
| name: this.name, | ||
| status: this.status, | ||
| segmentationLists: parseObject(this.segmentationLists), | ||
| }; | ||
|
|
||
| data.customFields = parseCustomFields(this.customFields); | ||
|
|
||
| const response = await this.pingback.createSubscriber({ | ||
| $, | ||
| data, | ||
| }); | ||
|
|
||
| $.export("$summary", `Subscriber created successfully with ID: ${response.data.data.id}`); | ||
| return response; | ||
| }, | ||
| }; |
32 changes: 32 additions & 0 deletions
32
components/pingback/actions/get-subscriber/get-subscriber.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import { ConfigurationError } from "@pipedream/platform"; | ||
| import pingback from "../../pingback.app.mjs"; | ||
|
|
||
| export default { | ||
| name: "Get Subscriber", | ||
| description: "Get a subscriber by email [See the documentation](https://developer.pingback.com/docs/api/get-subscriber)", | ||
| key: "pingback-get-subscriber", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| pingback, | ||
| email: { | ||
| propDefinition: [ | ||
| pingback, | ||
| "email", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| try { | ||
| const response = await this.pingback.getSubscriber({ | ||
| $, | ||
| email: this.email, | ||
| }); | ||
|
|
||
| $.export("$summary", `Subscriber retrieved successfully with email: ${response.data.data.email}`); | ||
| return response; | ||
| } catch ({ response }) { | ||
| throw new ConfigurationError(response.data.error); | ||
| } | ||
| }, | ||
| }; |
37 changes: 37 additions & 0 deletions
37
...ons/remove-subscriber-from-segmentation-list/remove-subscriber-from-segmentation-list.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import pingback from "../../pingback.app.mjs"; | ||
|
|
||
| export default { | ||
| name: "Remove Subscriber From Segmentation List", | ||
| description: "Remove a subscriber from a segmentation list by email [See the documentation](https://developer.pingback.com/docs/api/remove-subscriber-from-segment)", | ||
| key: "pingback-remove-subscriber-from-segmentation-list", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| pingback, | ||
| email: { | ||
| propDefinition: [ | ||
| pingback, | ||
| "email", | ||
| ], | ||
| }, | ||
| segmentationListId: { | ||
| propDefinition: [ | ||
| pingback, | ||
| "segmentationLists", | ||
| ], | ||
| type: "string[]", | ||
| label: "Segmentation Lists", | ||
| description: "Segmentation list ID to remove the subscriber from. You can get the ID by clicking audience and lists at Pingback dashboard.", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.pingback.removeSubscriberFromSegmentationList({ | ||
| $, | ||
| email: this.email, | ||
| segmentationListId: this.segmentationListId, | ||
| }); | ||
|
|
||
| $.export("$summary", `Subscriber ${this.email} removed from segmentation list ${this.segmentationListId} successfully`); | ||
| return response; | ||
| }, | ||
| }; | ||
61 changes: 61 additions & 0 deletions
61
components/pingback/actions/update-subscriber/update-subscriber.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| import { parseCustomFields } from "../../common/utils.mjs"; | ||
| import pingback from "../../pingback.app.mjs"; | ||
|
|
||
| export default { | ||
| name: "Update Subscriber", | ||
| description: "Update a specific subscriber by email [See the documentation](https://developer.pingback.com/docs/api/update-subscriber)", | ||
| key: "pingback-update-subscriber", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| pingback, | ||
| email: { | ||
| propDefinition: [ | ||
| pingback, | ||
| "email", | ||
| ], | ||
| }, | ||
| phone: { | ||
| propDefinition: [ | ||
| pingback, | ||
| "phone", | ||
| ], | ||
| }, | ||
| name: { | ||
| propDefinition: [ | ||
| pingback, | ||
| "name", | ||
| ], | ||
| }, | ||
| status: { | ||
| propDefinition: [ | ||
| pingback, | ||
| "status", | ||
| ], | ||
| }, | ||
| customFields: { | ||
| propDefinition: [ | ||
| pingback, | ||
| "customFields", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const data = { | ||
| phone: this.phone, | ||
| name: this.name, | ||
| status: this.status, | ||
| }; | ||
|
|
||
| data.customFields = parseCustomFields(this.customFields); | ||
|
|
||
| const response = await this.pingback.updateSubscriber({ | ||
| $, | ||
| email: this.email, | ||
| data, | ||
| }); | ||
|
|
||
| $.export("$summary", `Subscriber updated successfully with ID: ${response.data.data.id}`); | ||
| return response; | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| export const STATUS_OPTIONS = [ | ||
| { | ||
| label: "Free Subscriber", | ||
| value: "free_subscriber", | ||
| }, | ||
| { | ||
| label: "Paid Subscriber", | ||
| value: "paid_subscriber", | ||
| }, | ||
| { | ||
| label: "Unsubscribed Subscriber", | ||
| value: "unsubscribed_subscriber", | ||
| }, | ||
| ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| export const parseObject = (obj) => { | ||
| if (!obj) return undefined; | ||
|
|
||
| if (Array.isArray(obj)) { | ||
| return obj.map((item) => { | ||
| if (typeof item === "string") { | ||
| try { | ||
| return JSON.parse(item); | ||
| } catch (e) { | ||
| return item; | ||
| } | ||
| } | ||
| return item; | ||
| }); | ||
| } | ||
| if (typeof obj === "string") { | ||
| try { | ||
| return JSON.parse(obj); | ||
| } catch (e) { | ||
| return obj; | ||
| } | ||
| } | ||
| return obj; | ||
| }; | ||
|
|
||
| export const parseCustomFields = (customFields) => { | ||
| const parsedCustomFields = Object.entries(parseObject(customFields) || {}); | ||
| if (parsedCustomFields.length) { | ||
| return parsedCustomFields.map(([ | ||
| key, | ||
| value, | ||
| ]) => ({ | ||
| label: key, | ||
| value, | ||
| })); | ||
| } | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "@pipedream/pingback", | ||
| "version": "0.0.1", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream Pingback Components", | ||
| "main": "pingback.app.mjs", | ||
| "keywords": [ | ||
|
|
@@ -11,5 +11,8 @@ | |
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.1.0" | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.