-
Couldn't load subscription status.
- Fork 5.5k
17541 components walletap #18619
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
17541 components walletap #18619
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2165d1f
Update Walletap component to version 0.1.0, add new actions for creat…
luancazarine d07ed52
pnpm update
luancazarine dd62f8e
Update components/walletap/actions/get-pass/get-pass.mjs
luancazarine ebe9656
Update components/walletap/actions/get-pass/get-pass.mjs
michelle0927 0b699b7
Update components/walletap/actions/get-pass/get-pass.mjs
michelle0927 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
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,70 @@ | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
| import walletap from "../../walletap.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "walletap-create-pass", | ||
| name: "Create Pass", | ||
| description: "Creates a mobile Wallet pass. [See the documentation](https://walletap.io/docs/api#tag/Pass/operation/createPass)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| props: { | ||
| walletap, | ||
| passes: { | ||
| type: "string[]", | ||
| label: "Passes", | ||
| description: "A list of objects with the pass data. Example: `[{ \"templateId\": \"daltQAV1vidnfj6C6Vws\", \"templateFields\": { \"validUntil\": \"2025-01-15T21:38:37+01:00\" }, \"customFields\": { \"memberName\": \"John Doe\" } }]`", | ||
| optional: true, | ||
| }, | ||
| email: { | ||
| type: "string", | ||
| label: "Email", | ||
| description: "The email of the user", | ||
| optional: true, | ||
| }, | ||
| phone: { | ||
| type: "string", | ||
| label: "Phone", | ||
| description: "The phone of the user", | ||
| optional: true, | ||
| }, | ||
| sendToEmail: { | ||
| type: "boolean", | ||
| label: "Send to Email", | ||
| description: "Whether to send pass link via email", | ||
| optional: true, | ||
| }, | ||
| sendToPhone: { | ||
| type: "boolean", | ||
| label: "Send to Phone", | ||
| description: "Whether to send pass link via phone messaging", | ||
| optional: true, | ||
| }, | ||
| locale: { | ||
| type: "string", | ||
| label: "Locale", | ||
| description: "[ISO 639 language code](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) to display localized \"Add to Wallet\" badges, SMS and WhatsApp messages", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.walletap.createPass({ | ||
| $, | ||
| data: { | ||
| passes: parseObject(this.passes), | ||
| email: this.email, | ||
| phone: this.phone, | ||
| sendToEmail: this.sendToEmail, | ||
| sendToPhone: this.sendToPhone, | ||
| locale: this.locale, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully created pass with id: ${response.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,33 @@ | ||
| import walletap from "../../walletap.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "walletap-get-pass", | ||
| name: "Get Pass", | ||
| description: "Gets a Walletap pass by ID. [See the documentation](https://walletap.io/docs/api#tag/Pass/operation/getPass)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: true, | ||
| }, | ||
| props: { | ||
| walletap, | ||
| passId: { | ||
| type: "string", | ||
| label: "Pass ID", | ||
| description: "Internal pass ID or External pass ID", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.walletap.getPass({ | ||
| $, | ||
| params: { | ||
| id: this.passId, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved pass with ID: ${response.id}`); | ||
| return response; | ||
| }, | ||
| }; |
39 changes: 39 additions & 0 deletions
39
components/walletap/actions/send-notification/send-notification.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,39 @@ | ||
| import walletap from "../../walletap.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "walletap-send-notification", | ||
| name: "Send Notification", | ||
| description: "Sends a notification to all pass users. [See the documentation](https://walletap.io/docs/api#tag/Template/operation/sendNotification)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| props: { | ||
| walletap, | ||
| title: { | ||
| type: "string", | ||
| label: "Title", | ||
| description: "The title of the notification", | ||
| }, | ||
| content: { | ||
| type: "string", | ||
| label: "Content", | ||
| description: "The content of the notification", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.walletap.sendNotification({ | ||
| $, | ||
| data: { | ||
| title: this.title, | ||
| content: this.content, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", "Successfully sent notification"); | ||
| 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,83 @@ | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
| import walletap from "../../walletap.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "walletap-update-pass", | ||
| name: "Update Pass", | ||
| description: "Updates an existing Walletap pass and pushes the updated pass to the user. [See the documentation](https://walletap.io/docs/api#tag/Pass/operation/updatePass)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| props: { | ||
| walletap, | ||
| passId: { | ||
| type: "string", | ||
| label: "Pass ID", | ||
| description: "Walletap generated pass ID", | ||
| }, | ||
| templateFields: { | ||
| type: "object", | ||
| label: "Template Fields", | ||
| description: "The template fields to update. Generic (object) or Loyalty (object) or Gift Card (object) or Event Ticket (object) or Offer/Coupon (object)", | ||
| optional: true, | ||
| }, | ||
| memberId: { | ||
| type: "string", | ||
| label: "Member ID", | ||
| description: "The ID connecting this pass to a member in your system", | ||
| optional: true, | ||
| }, | ||
| customFields: { | ||
| type: "object", | ||
| label: "Custom Fields", | ||
| description: "Custom fields defined in pass design, using field IDs as object keys", | ||
| optional: true, | ||
| }, | ||
| redemptionValue: { | ||
| type: "string", | ||
| label: "Redemption Value", | ||
| description: "Value to be encoded in barcode and/or NFC payload. If not provided, it is set to `externalId`. If also not provided, it is set to Walletap generated `id`", | ||
| optional: true, | ||
| }, | ||
| isValid: { | ||
| type: "boolean", | ||
| label: "Valid", | ||
| description: "If set to `false` it invalidates the pass and moves it to the \"Expired passes\" section in user Wallet", | ||
| optional: true, | ||
| }, | ||
| email: { | ||
| type: "string", | ||
| label: "Email", | ||
| description: "The email of the user", | ||
| optional: true, | ||
| }, | ||
| phone: { | ||
| type: "string", | ||
| label: "Phone", | ||
| description: "The phone of the user", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.walletap.updatePass({ | ||
| $, | ||
| data: { | ||
| id: this.passId, | ||
| templateFields: parseObject(this.templateFields), | ||
| memberId: this.memberId, | ||
| customFields: parseObject(this.customFields), | ||
| redemptionValue: this.redemptionValue, | ||
| isValid: this.isValid, | ||
| email: this.email, | ||
| phone: this.phone, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully updated pass with id: ${response.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,24 @@ | ||
| 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; | ||
| }; |
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/walletap", | ||
| "version": "0.0.1", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream WalleTap Components", | ||
| "main": "walletap.app.mjs", | ||
| "keywords": [ | ||
|
|
@@ -11,5 +11,8 @@ | |
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.1.0" | ||
| } | ||
| } | ||
| } | ||
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,11 +1,53 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "walletap", | ||
| propDefinitions: {}, | ||
| methods: { | ||
| // this.$auth contains connected account data | ||
| authKeys() { | ||
| console.log(Object.keys(this.$auth)); | ||
| _apiUrl() { | ||
| return "https://api.walletap.io"; | ||
| }, | ||
| _getHeaders() { | ||
| return { | ||
| "x-api-key": this.$auth.api_key, | ||
| }; | ||
| }, | ||
| _makeRequest({ | ||
| $ = this, path, ...opts | ||
| }) { | ||
| return axios($, { | ||
| url: `${this._apiUrl()}${path}`, | ||
| headers: this._getHeaders(), | ||
| ...opts, | ||
| }); | ||
| }, | ||
| createPass(args = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: "/pass", | ||
| ...args, | ||
| }); | ||
| }, | ||
| getPass(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/pass", | ||
| ...args, | ||
| }); | ||
| }, | ||
| updatePass(args = {}) { | ||
| return this._makeRequest({ | ||
| method: "PATCH", | ||
| path: "/pass", | ||
| ...args, | ||
| }); | ||
| }, | ||
| sendNotification(args = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: `/template/${this.$auth.template_id}/notification`, | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
| }; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.