Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions components/webflow/actions/get-order/get-order.mjs

This file was deleted.

39 changes: 0 additions & 39 deletions components/webflow/actions/publish-site/publish-site.mjs

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}}",
Copy link
Collaborator

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

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,
Expand All @@ -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 ?? ""}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix ReferenceError: 'fields' is not defined

In line 68, fields is not defined within the scope of the run method, which will result in a ReferenceError. You should use response instead to access the properties of the created collection item.

Apply the following diff to correct the issue:

-    $.export("$summary", `Successfully created collection item ${fields.name ?? ""}`);
+    $.export("$summary", `Successfully created collection item ${response.name ?? ""}`);

Ensure that response contains the name property of the created item to be displayed in the summary.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
$.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)


return response;
},
Expand Down
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}}",
Copy link
Collaborator

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

type: "action",
props: {
webflow,
app,
siteId: {
propDefinition: [
webflow,
app,
"sites",
],
},
collectionId: {
propDefinition: [
webflow,
app,
"collections",
(c) => ({
siteId: c.siteId,
Expand All @@ -25,7 +25,7 @@ export default {
},
itemId: {
propDefinition: [
webflow,
app,
"items",
(c) => ({
collectionId: c.collectionId,
Expand All @@ -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");

Expand Down
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}}",
Copy link
Collaborator

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

type: "action",
props: {
webflow,
app,
siteId: {
propDefinition: [
webflow,
app,
"sites",
],
},
orderId: {
propDefinition: [
webflow,
app,
"orders",
],
},
Expand All @@ -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");

Expand Down
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-get-collection-item",
key: "webflow_v2-get-collection-item",
name: "Get Collection Item",
description: "Get a Collection Item. [See the docs here](https://developers.webflow.com/#get-single-item)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Documentation link needs to be updated to V2 API reference

The current documentation link (https://developers.webflow.com/#get-single-item) points to the V1 API. The correct link for the V2 API documentation should be https://developers.webflow.com/api/v2/reference/get-collection-item.

🔗 Analysis chain

Verify documentation link for V2 API

The documentation link appears to be for the V1 API. Please verify and update it to point to the V2 API documentation.


Let me search for any V2 API related files or documentation references in the codebase.


Let me check the webflow v2 app file and search for any API documentation references.


Based on the findings that the component is using webflow-api v2.4.2 and the code is in the webflow_v2 directory, let me check the official Webflow V2 API documentation.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the documentation URL is valid and points to V2 API
curl -I "https://developers.webflow.com/#get-single-item" | grep "HTTP/"

Length of output: 479


Script:

#!/bin/bash
# Search for V2 API documentation references
rg -i "webflow.*api.*v2.*doc|webflow.*v2.*api.*doc" -A 2

# Search for any V2 API related files
fd -g "*v2*" -t f

# Check if there's a README or documentation file in the webflow_v2 directory
fd -g "README*" -g "*.md" --exec grep -l -i "api.*documentation" {}

Length of output: 725


Script:

#!/bin/bash
# Check webflow v2 app file for documentation references
cat components/webflow_v2/webflow_v2.app.mjs

# Search for any documentation links in webflow v2 related files
rg -i "https.*webflow.*doc|webflow.*api" components/webflow_v2/

Length of output: 5594


Script:

#!/bin/bash
# Check if there's any reference to the new V2 API documentation URL
rg -i "https://developers.webflow.com/api" components/webflow_v2/

# Check the content of the get-collection-item action file
cat components/webflow_v2/actions/get-collection-item/get-collection-item.mjs

Length of output: 1056

version: "0.1.7",
version: "0.0.{{ts}}",
Copy link
Collaborator

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

type: "action",
props: {
webflow,
app,
siteId: {
propDefinition: [
webflow,
app,
"sites",
],
},
collectionId: {
propDefinition: [
webflow,
app,
"collections",
(c) => ({
siteId: c.siteId,
Expand All @@ -25,7 +25,7 @@ export default {
},
itemId: {
propDefinition: [
webflow,
app,
"items",
(c) => ({
collectionId: c.collectionId,
Expand All @@ -34,12 +34,7 @@ export default {
},
},
async run({ $ }) {
const webflow = this.webflow._createApiClient();

const response = await webflow.item({
collectionId: this.collectionId,
itemId: this.itemId,
});
const response = await this.app.getCollectionItem(this.collectionId, this.itemId);

$.export("$summary", "Successfully retrieved collection item");

Expand Down
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-get-collection",
key: "webflow_v2-get-collection",
name: "Get Collection",
description: "Get a collection. [See the docs here](https://developers.webflow.com/#get-collection-with-full-schema)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Update documentation link to V2 API reference

The current documentation link points to the V1 API (developers.webflow.com/#get-collection-with-full-schema). This should be updated to the V2 API reference URL: https://developers.webflow.com/reference/get-collection. The V2 documentation link is confirmed to be valid and redirects properly to the correct endpoint documentation.

🔗 Analysis chain

Update API documentation link

The documentation link in the description might need updating to point to the V2 API documentation.

Let's verify if the documentation link is still valid:


Let me gather more information about the API version and documentation references in the codebase.


Let me check the official Webflow API documentation URL.


Based on the findings, I can see that this component is part of the webflow_v2 package which uses the V2 API. Looking at the documentation references across the codebase, I notice that other components in the same directory are using the updated documentation URL pattern: https://developers.webflow.com/reference/....

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the API documentation link is valid for V2
# Expected: Link should point to V2 API docs

curl -I "https://developers.webflow.com/#get-collection-with-full-schema"

Length of output: 976


Script:

#!/bin/bash
# Check for v2 API related files and documentation references
rg -i "webflow.*api.*v2|v2.*api.*webflow" -g "!node_modules"

# Check the specific component directory for API version indicators
fd . components/webflow_v2 -t f -x cat {}

Length of output: 23453


Script:

#!/bin/bash
# Check if there are any other v2 API documentation references in the codebase
rg "developers\.webflow\.com/reference|developers\.webflow\.com/v2" -g "!node_modules"

# Also check for any README or documentation files that might contain API documentation links
fd -e md -e txt -x cat {}

Length of output: 102055


Script:

#!/bin/bash
# Check if the current documentation link is valid and compare with the new V2 API docs
curl -I "https://developers.webflow.com/reference/get-collection"

Length of output: 1395

version: "0.0.5",
version: "0.0.{{ts}}",
Copy link
Collaborator

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

type: "action",
props: {
webflow,
app,
siteId: {
propDefinition: [
webflow,
app,
"sites",
],
},
collectionId: {
propDefinition: [
webflow,
app,
"collections",
(c) => ({
siteId: c.siteId,
Expand All @@ -25,7 +25,7 @@ export default {
},
},
async run({ $ }) {
const response = await this.webflow.getCollection(this.collectionId);
const response = await this.app.getCollection(this.collectionId);

$.export("$summary", "Successfully retrieved collection");

Expand Down
Loading
Loading