Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -1,38 +1,44 @@
import app from "../../webflow_v2.app.mjs";
import webflow from "../../webflow.app.mjs";

export default {
key: "webflow_v2-create-collection-item",
key: "webflow-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.0.1",
version: "0.1.7",
type: "action",
props: {
app,
webflow,
siteId: {
propDefinition: [
app,
webflow,
"sites",
],
},
collectionId: {
propDefinition: [
app,
webflow,
"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.app.getCollection(this.collectionId);
const { fields } = await this.webflow.getCollection(this.collectionId);
for (const field of fields) {
if (field.isEditable && field.slug !== "isArchived" && field.slug !== "isDraft") {
if (field.editable && field.slug !== "_archived" && field.slug !== "_draft") {
Comment on lines +39 to +41
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

Confirm the correct property for field editability

The code uses field.editable, but verify that the Field object from getCollection returns a property named editable. If the correct property is field.isEditable, you should update the code accordingly.

Apply this diff if necessary:

-          if (field.editable && field.slug !== "_archived" && field.slug !== "_draft") {
+          if (field.isEditable && field.slug !== "_archived" && field.slug !== "_draft") {

Committable suggestion skipped: line range outside the PR's diff.

props[field.slug] = {
type: "string",
label: field.name,
Expand All @@ -41,31 +47,37 @@ export default {
: field.slug === "slug"
? "URL structure of the Item in your site."
: "See the documentation for additional information about [Field Types & Item Values](https://developers.webflow.com/reference/field-types-item-values).",
optional: !field.isRequired,
optional: !field.required,
};
}
}
return props;
},
async run({ $ }) {
const {
app,
webflow,
// eslint-disable-next-line no-unused-vars
siteId,
// eslint-disable-next-line no-unused-vars
collectionId,
...fieldData
live,
...fields
} = this;

const response = await app.createCollectionItem(
collectionId,
{
fieldData,
isArchived: false,
isDraft: false,
const webflowClient = webflow._createApiClient();

const response = await webflowClient.createItem({
collectionId: this.collectionId,
fields: {
...fields,
_archived: false,
_draft: false,
},
);
}, {
live,
});

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

return response;
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import app from "../../webflow_v2.app.mjs";
import webflow from "../../webflow.app.mjs";

export default {
key: "webflow_v2-delete-collection-item",
key: "webflow-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.1",
version: "0.0.5",
type: "action",
props: {
app,
webflow,
siteId: {
propDefinition: [
app,
webflow,
"sites",
],
},
collectionId: {
propDefinition: [
app,
webflow,
"collections",
(c) => ({
siteId: c.siteId,
Expand All @@ -25,7 +25,7 @@ export default {
},
itemId: {
propDefinition: [
app,
webflow,
"items",
(c) => ({
collectionId: c.collectionId,
Expand All @@ -34,10 +34,12 @@ export default {
},
},
async run({ $ }) {
const {
collectionId, itemId,
} = this;
const response = await this.app.deleteCollectionItem(collectionId, itemId);
const webflow = this.webflow._createApiClient();

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

$.export("$summary", "Successfully deleted item");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import app from "../../webflow_v2.app.mjs";
import webflow from "../../webflow.app.mjs";

export default {
key: "webflow_v2-fulfill-order",
key: "webflow-fulfill-order",
name: "Fulfill Order",
description: "Fulfill an order. [See the docs here](https://developers.webflow.com/#fulfill-order)",
version: "0.0.1",
version: "0.0.4",
type: "action",
props: {
app,
webflow,
siteId: {
propDefinition: [
app,
webflow,
"sites",
],
},
orderId: {
propDefinition: [
app,
webflow,
"orders",
],
},
Expand All @@ -28,10 +28,13 @@ export default {
},
},
async run({ $ }) {
const {
app, siteId, orderId, ...data
} = this;
const response = await app.fulfillOrder(siteId, orderId, data);
const apiClient = this.webflow._createApiClient();

const response = await apiClient.post(`/sites/${this.siteId}/order/${this.orderId}/fulfill`, {
data: {
sendOrderFulfilledEmail: this.sendOrderFulfilledEmail,
},
});

$.export("$summary", "Successfully fulfilled order");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import app from "../../webflow_v2.app.mjs";
import webflow from "../../webflow.app.mjs";

export default {
key: "webflow_v2-get-collection-item",
key: "webflow-get-collection-item",
name: "Get Collection Item",
description: "Get a Collection Item. [See the docs here](https://developers.webflow.com/#get-single-item)",
version: "0.0.1",
version: "0.1.7",
type: "action",
props: {
app,
webflow,
siteId: {
propDefinition: [
app,
webflow,
"sites",
],
},
collectionId: {
propDefinition: [
app,
webflow,
"collections",
(c) => ({
siteId: c.siteId,
Expand All @@ -25,7 +25,7 @@ export default {
},
itemId: {
propDefinition: [
app,
webflow,
"items",
(c) => ({
collectionId: c.collectionId,
Expand All @@ -34,7 +34,12 @@ export default {
},
},
async run({ $ }) {
const response = await this.app.getCollectionItem(this.collectionId, this.itemId);
const webflow = this.webflow._createApiClient();

const response = await webflow.item({
collectionId: this.collectionId,
itemId: 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 app from "../../webflow_v2.app.mjs";
import webflow from "../../webflow.app.mjs";

export default {
key: "webflow_v2-get-collection",
key: "webflow-get-collection",
name: "Get Collection",
description: "Get a collection. [See the docs here](https://developers.webflow.com/#get-collection-with-full-schema)",
version: "0.0.1",
version: "0.0.5",
type: "action",
props: {
app,
webflow,
siteId: {
propDefinition: [
app,
webflow,
"sites",
],
},
collectionId: {
propDefinition: [
app,
webflow,
"collections",
(c) => ({
siteId: c.siteId,
Expand All @@ -25,7 +25,7 @@ export default {
},
},
async run({ $ }) {
const response = await this.app.getCollection(this.collectionId);
const response = await this.webflow.getCollection(this.collectionId);

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import app from "../../webflow_v2.app.mjs";
import webflow from "../../webflow.app.mjs";

export default {
key: "webflow_v2-get-item-inventory",
key: "webflow-get-item-inventory",
name: "Get Item Inventory",
description: "Get the inventory of a specific item. [See the docs here](https://developers.webflow.com/#item-inventory)",
version: "0.0.1",
version: "0.0.5",
type: "action",
props: {
app,
webflow,
siteId: {
propDefinition: [
app,
webflow,
"sites",
],
},
collectionId: {
propDefinition: [
app,
webflow,
"collections",
(c) => ({
siteId: c.siteId,
Expand All @@ -25,7 +25,7 @@ export default {
},
itemId: {
propDefinition: [
app,
webflow,
"items",
(c) => ({
collectionId: c.collectionId,
Expand All @@ -34,7 +34,9 @@ export default {
},
},
async run({ $ }) {
const response = await this.app.getCollectionItemInventory(this.collectionId, this.itemId);
const apiClient = this.webflow._createApiClient();

const response = await apiClient.apiClient.get(`/collections/${this.collectionId}/items/${this.itemId}/inventory`);

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

Expand Down
34 changes: 34 additions & 0 deletions components/webflow/actions/get-order/get-order.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import webflow from "../../webflow.app.mjs";

export default {
key: "webflow-get-order",
name: "Get Order",
description: "Get an order. [See the docs here](https://developers.webflow.com/#get-order)",
version: "0.0.4",
type: "action",
props: {
webflow,
siteId: {
propDefinition: [
webflow,
"sites",
],
},
orderId: {
propDefinition: [
webflow,
"orders",
],
},
},
async run({ $ }) {
const response = await this.webflow.getOrder({
siteId: this.siteId,
orderId: this.orderId,
});

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

return response;
},
};
Comment on lines +1 to +34
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

Remove this new file as part of the v2 revert

This appears to be a new file added as part of the v2 migration. As this is a revert PR, this entire file should be removed to properly revert the v2 changes.

Loading
Loading