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,44 +1,38 @@
import webflow from "../../webflow.app.mjs";
import app from "../../webflow.app.mjs";

export default {
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: "1.0.1",
description: "Create new collection item. [See the documentation](https://developers.webflow.com/data/reference/cms/collection-items/staged-items/create-item)",
version: "2.0.0",
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.isEditable && field.slug !== "isArchived" && field.slug !== "isDraft") {
props[field.slug] = {
type: "string",
label: field.name,
Expand All @@ -47,37 +41,31 @@ 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.required,
optional: !field.isRequired,
};
}
}
return props;
},
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 ${this.name ?? ""}`);

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.app.mjs";

export default {
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: "1.0.1",
description: "Delete Item of a Collection. [See the documentation](https://developers.webflow.com/data/reference/cms/collection-items/staged-items/delete-item)",
version: "2.0.0",
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,10 @@ 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
23 changes: 10 additions & 13 deletions components/webflow/actions/fulfill-order/fulfill-order.mjs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import webflow from "../../webflow.app.mjs";
import app from "../../webflow.app.mjs";

export default {
key: "webflow-fulfill-order",
name: "Fulfill Order",
description: "Fulfill an order. [See the docs here](https://developers.webflow.com/#fulfill-order)",
version: "1.0.1",
description: "Fulfill an order. [See the documentation](https://developers.webflow.com/data/reference/ecommerce/orders/update-fulfill)",
version: "2.0.0",
type: "action",
props: {
webflow,
app,
siteId: {
propDefinition: [
webflow,
app,
"sites",
],
},
orderId: {
propDefinition: [
webflow,
app,
"orders",
],
},
Expand All @@ -28,13 +28,10 @@ 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.app.mjs";

export default {
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: "1.0.1",
description: "Get a Collection Item. [See the documentation](https://developers.webflow.com/data/reference/cms/collection-items/staged-items/get-item)",
version: "2.0.0",
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
14 changes: 7 additions & 7 deletions components/webflow/actions/get-collection/get-collection.mjs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import webflow from "../../webflow.app.mjs";
import app from "../../webflow.app.mjs";

export default {
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: "1.0.1",
description: "Get a collection. [See the documentation](https://developers.webflow.com/data/reference/cms/collections/get)",
version: "2.0.0",
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
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import webflow from "../../webflow.app.mjs";
import app from "../../webflow.app.mjs";

export default {
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: "1.0.1",
description: "Get the inventory of a specific item. [See the documentation](https://developers.webflow.com/data/reference/ecommerce/inventory/list)",
version: "2.0.0",
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,9 +34,7 @@ export default {
},
},
async run({ $ }) {
const apiClient = this.webflow._createApiClient();

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

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

Expand Down
17 changes: 7 additions & 10 deletions components/webflow/actions/get-order/get-order.mjs
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
import webflow from "../../webflow.app.mjs";
import app 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: "1.0.1",
description: "Get info on an order. [See the documentation](https://developers.webflow.com/data/reference/ecommerce/orders/get)",
version: "2.0.0",
type: "action",
props: {
webflow,
app,
siteId: {
propDefinition: [
webflow,
app,
"sites",
],
},
orderId: {
propDefinition: [
webflow,
app,
"orders",
],
},
},
async run({ $ }) {
const response = await this.webflow.getOrder({
siteId: this.siteId,
orderId: this.orderId,
});
const response = await this.app.getOrder(this.siteId, this.orderId);

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

Expand Down
Loading
Loading