- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.5k
Webflow V2 migration #14734
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
Webflow V2 migration #14734
Changes from 18 commits
fb6999d
              33073c4
              0e2bf0c
              3e4105b
              0dbdb33
              917d3b0
              2772446
              0e43160
              f122394
              c31961c
              140cab6
              8bfd692
              b9dbb19
              beb681e
              37a7a4e
              c2e688a
              aa6372a
              c05d062
              e0fbe70
              2ea44ee
              d527968
              96c1f3c
              3c6e0fe
              c5201ca
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,44 +1,38 @@ | ||||||
| import webflow from "../../webflow.app.mjs"; | ||||||
| import app from "../../webflow_v2.app.mjs"; | ||||||
|  | ||||||
| export default { | ||||||
| key: "webflow-create-collection-item", | ||||||
| key: "webflow_v2-create-collection-item", | ||||||
| name: "Create Collection Item", | ||||||
| description: "Create new collection item. [See the docs here](https://developers.webflow.com/#create-new-collection-item)", | ||||||
| version: "0.1.7", | ||||||
| version: "0.0.{{ts}}", | ||||||
| type: "action", | ||||||
| props: { | ||||||
| webflow, | ||||||
| app, | ||||||
| siteId: { | ||||||
| propDefinition: [ | ||||||
| webflow, | ||||||
| app, | ||||||
| "sites", | ||||||
| ], | ||||||
| }, | ||||||
| collectionId: { | ||||||
| propDefinition: [ | ||||||
| webflow, | ||||||
| app, | ||||||
| "collections", | ||||||
| (c) => ({ | ||||||
| siteId: c.siteId, | ||||||
| }), | ||||||
| ], | ||||||
| reloadProps: true, | ||||||
| }, | ||||||
| live: { | ||||||
| label: "Live", | ||||||
| description: "Indicate if the item should be published to the live site", | ||||||
| type: "boolean", | ||||||
| default: false, | ||||||
| }, | ||||||
| }, | ||||||
| async additionalProps() { | ||||||
| const props = {}; | ||||||
| if (!this.collectionId) { | ||||||
| return props; | ||||||
| } | ||||||
| const { fields } = await this.webflow.getCollection(this.collectionId); | ||||||
| const { fields } = await this.app.getCollection(this.collectionId); | ||||||
| for (const field of fields) { | ||||||
| if (field.editable && field.slug !== "_archived" && field.slug !== "_draft") { | ||||||
| if (field.editable && field.slug !== "isArchived" && field.slug !== "isDraft") { | ||||||
| props[field.slug] = { | ||||||
| type: "string", | ||||||
| label: field.name, | ||||||
|  | @@ -55,29 +49,23 @@ export default { | |||||
| }, | ||||||
| async run({ $ }) { | ||||||
| const { | ||||||
| webflow, | ||||||
| app, | ||||||
| // eslint-disable-next-line no-unused-vars | ||||||
| siteId, | ||||||
| // eslint-disable-next-line no-unused-vars | ||||||
| collectionId, | ||||||
| live, | ||||||
| ...fields | ||||||
| ...fieldData | ||||||
| } = this; | ||||||
|  | ||||||
| const webflowClient = webflow._createApiClient(); | ||||||
|  | ||||||
| const response = await webflowClient.createItem({ | ||||||
| collectionId: this.collectionId, | ||||||
| fields: { | ||||||
| ...fields, | ||||||
| _archived: false, | ||||||
| _draft: false, | ||||||
| const response = await app.createCollectionItem( | ||||||
| collectionId, | ||||||
| { | ||||||
| fieldData, | ||||||
| isArchived: false, | ||||||
| isDraft: false, | ||||||
| }, | ||||||
| }, { | ||||||
| live, | ||||||
| }); | ||||||
| ); | ||||||
|  | ||||||
| $.export("$summary", `Successfully created collection item ${fields.name}`); | ||||||
| $.export("$summary", `Successfully created collection item ${fields.name ?? ""}`); | ||||||
|          | ||||||
| $.export("$summary", `Successfully created collection item ${fields.name ?? ""}`); | |
| $.export("$summary", `Successfully created collection item ${response.name ?? ""}`); | 
🧰 Tools
🪛 eslint
[error] 68-68: 'fields' is not defined.
(no-undef)
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,22 +1,22 @@ | ||
| import webflow from "../../webflow.app.mjs"; | ||
| import app from "../../webflow_v2.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "webflow-delete-collection-item", | ||
| key: "webflow_v2-delete-collection-item", | ||
| name: "Delete Collection Item", | ||
| description: "Delete Item of a Collection. [See the docs here](https://developers.webflow.com/#remove-collection-item)", | ||
| version: "0.0.5", | ||
| version: "0.0.{{ts}}", | ||
|          | ||
| type: "action", | ||
| props: { | ||
| webflow, | ||
| app, | ||
| siteId: { | ||
| propDefinition: [ | ||
| webflow, | ||
| app, | ||
| "sites", | ||
| ], | ||
| }, | ||
| collectionId: { | ||
| propDefinition: [ | ||
| webflow, | ||
| app, | ||
| "collections", | ||
| (c) => ({ | ||
| siteId: c.siteId, | ||
|  | @@ -25,7 +25,7 @@ export default { | |
| }, | ||
| itemId: { | ||
| propDefinition: [ | ||
| webflow, | ||
| app, | ||
| "items", | ||
| (c) => ({ | ||
| collectionId: c.collectionId, | ||
|  | @@ -34,12 +34,8 @@ export default { | |
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const webflow = this.webflow._createApiClient(); | ||
|  | ||
| const response = await webflow.removeItem({ | ||
| collectionId: this.collectionId, | ||
| itemId: this.itemId, | ||
| }); | ||
| const { collectionId, itemId } = this; | ||
| const response = await this.app.deleteCollectionItem(collectionId, itemId); | ||
|  | ||
| $.export("$summary", "Successfully deleted item"); | ||
|  | ||
|  | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,22 +1,22 @@ | ||
| import webflow from "../../webflow.app.mjs"; | ||
| import app from "../../webflow_v2.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "webflow-fulfill-order", | ||
| key: "webflow_v2-fulfill-order", | ||
| name: "Fulfill Order", | ||
| description: "Fulfill an order. [See the docs here](https://developers.webflow.com/#fulfill-order)", | ||
| version: "0.0.4", | ||
| version: "0.0.{{ts}}", | ||
|          | ||
| type: "action", | ||
| props: { | ||
| webflow, | ||
| app, | ||
| siteId: { | ||
| propDefinition: [ | ||
| webflow, | ||
| app, | ||
| "sites", | ||
| ], | ||
| }, | ||
| orderId: { | ||
| propDefinition: [ | ||
| webflow, | ||
| app, | ||
| "orders", | ||
| ], | ||
| }, | ||
|  | @@ -28,13 +28,8 @@ export default { | |
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const apiClient = this.webflow._createApiClient(); | ||
|  | ||
| const response = await apiClient.post(`/sites/${this.siteId}/order/${this.orderId}/fulfill`, { | ||
| data: { | ||
| sendOrderFulfilledEmail: this.sendOrderFulfilledEmail, | ||
| }, | ||
| }); | ||
| const { app, siteId, orderId, ...data } = this; | ||
| const response = await app.fulfillOrder(siteId, orderId, data); | ||
|  | ||
| $.export("$summary", "Successfully fulfilled order"); | ||
|  | ||
|  | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please set the right version