Skip to content

Commit 60b9d0d

Browse files
Revert "Webflow V2 migration (#14734)"
This reverts commit 80f8dbe.
1 parent c9c2357 commit 60b9d0d

File tree

41 files changed

+690
-682
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+690
-682
lines changed

components/webflow_v2/actions/create-collection-item/create-collection-item.mjs renamed to components/webflow/actions/create-collection-item/create-collection-item.mjs

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,44 @@
1-
import app from "../../webflow_v2.app.mjs";
1+
import webflow from "../../webflow.app.mjs";
22

33
export default {
4-
key: "webflow_v2-create-collection-item",
4+
key: "webflow-create-collection-item",
55
name: "Create Collection Item",
66
description: "Create new collection item. [See the docs here](https://developers.webflow.com/#create-new-collection-item)",
7-
version: "0.0.1",
7+
version: "0.1.7",
88
type: "action",
99
props: {
10-
app,
10+
webflow,
1111
siteId: {
1212
propDefinition: [
13-
app,
13+
webflow,
1414
"sites",
1515
],
1616
},
1717
collectionId: {
1818
propDefinition: [
19-
app,
19+
webflow,
2020
"collections",
2121
(c) => ({
2222
siteId: c.siteId,
2323
}),
2424
],
2525
reloadProps: true,
2626
},
27+
live: {
28+
label: "Live",
29+
description: "Indicate if the item should be published to the live site",
30+
type: "boolean",
31+
default: false,
32+
},
2733
},
2834
async additionalProps() {
2935
const props = {};
3036
if (!this.collectionId) {
3137
return props;
3238
}
33-
const { fields } = await this.app.getCollection(this.collectionId);
39+
const { fields } = await this.webflow.getCollection(this.collectionId);
3440
for (const field of fields) {
35-
if (field.isEditable && field.slug !== "isArchived" && field.slug !== "isDraft") {
41+
if (field.editable && field.slug !== "_archived" && field.slug !== "_draft") {
3642
props[field.slug] = {
3743
type: "string",
3844
label: field.name,
@@ -41,31 +47,37 @@ export default {
4147
: field.slug === "slug"
4248
? "URL structure of the Item in your site."
4349
: "See the documentation for additional information about [Field Types & Item Values](https://developers.webflow.com/reference/field-types-item-values).",
44-
optional: !field.isRequired,
50+
optional: !field.required,
4551
};
4652
}
4753
}
4854
return props;
4955
},
5056
async run({ $ }) {
5157
const {
52-
app,
58+
webflow,
5359
// eslint-disable-next-line no-unused-vars
5460
siteId,
61+
// eslint-disable-next-line no-unused-vars
5562
collectionId,
56-
...fieldData
63+
live,
64+
...fields
5765
} = this;
5866

59-
const response = await app.createCollectionItem(
60-
collectionId,
61-
{
62-
fieldData,
63-
isArchived: false,
64-
isDraft: false,
67+
const webflowClient = webflow._createApiClient();
68+
69+
const response = await webflowClient.createItem({
70+
collectionId: this.collectionId,
71+
fields: {
72+
...fields,
73+
_archived: false,
74+
_draft: false,
6575
},
66-
);
76+
}, {
77+
live,
78+
});
6779

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

7082
return response;
7183
},

components/webflow_v2/actions/delete-collection-item/delete-collection-item.mjs renamed to components/webflow/actions/delete-collection-item/delete-collection-item.mjs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import app from "../../webflow_v2.app.mjs";
1+
import webflow from "../../webflow.app.mjs";
22

33
export default {
4-
key: "webflow_v2-delete-collection-item",
4+
key: "webflow-delete-collection-item",
55
name: "Delete Collection Item",
66
description: "Delete Item of a Collection. [See the docs here](https://developers.webflow.com/#remove-collection-item)",
7-
version: "0.0.1",
7+
version: "0.0.5",
88
type: "action",
99
props: {
10-
app,
10+
webflow,
1111
siteId: {
1212
propDefinition: [
13-
app,
13+
webflow,
1414
"sites",
1515
],
1616
},
1717
collectionId: {
1818
propDefinition: [
19-
app,
19+
webflow,
2020
"collections",
2121
(c) => ({
2222
siteId: c.siteId,
@@ -25,7 +25,7 @@ export default {
2525
},
2626
itemId: {
2727
propDefinition: [
28-
app,
28+
webflow,
2929
"items",
3030
(c) => ({
3131
collectionId: c.collectionId,
@@ -34,10 +34,12 @@ export default {
3434
},
3535
},
3636
async run({ $ }) {
37-
const {
38-
collectionId, itemId,
39-
} = this;
40-
const response = await this.app.deleteCollectionItem(collectionId, itemId);
37+
const webflow = this.webflow._createApiClient();
38+
39+
const response = await webflow.removeItem({
40+
collectionId: this.collectionId,
41+
itemId: this.itemId,
42+
});
4143

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

components/webflow_v2/actions/fulfill-order/fulfill-order.mjs renamed to components/webflow/actions/fulfill-order/fulfill-order.mjs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import app from "../../webflow_v2.app.mjs";
1+
import webflow from "../../webflow.app.mjs";
22

33
export default {
4-
key: "webflow_v2-fulfill-order",
4+
key: "webflow-fulfill-order",
55
name: "Fulfill Order",
66
description: "Fulfill an order. [See the docs here](https://developers.webflow.com/#fulfill-order)",
7-
version: "0.0.1",
7+
version: "0.0.4",
88
type: "action",
99
props: {
10-
app,
10+
webflow,
1111
siteId: {
1212
propDefinition: [
13-
app,
13+
webflow,
1414
"sites",
1515
],
1616
},
1717
orderId: {
1818
propDefinition: [
19-
app,
19+
webflow,
2020
"orders",
2121
],
2222
},
@@ -28,10 +28,13 @@ export default {
2828
},
2929
},
3030
async run({ $ }) {
31-
const {
32-
app, siteId, orderId, ...data
33-
} = this;
34-
const response = await app.fulfillOrder(siteId, orderId, data);
31+
const apiClient = this.webflow._createApiClient();
32+
33+
const response = await apiClient.post(`/sites/${this.siteId}/order/${this.orderId}/fulfill`, {
34+
data: {
35+
sendOrderFulfilledEmail: this.sendOrderFulfilledEmail,
36+
},
37+
});
3538

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

components/webflow_v2/actions/get-collection-item/get-collection-item.mjs renamed to components/webflow/actions/get-collection-item/get-collection-item.mjs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import app from "../../webflow_v2.app.mjs";
1+
import webflow from "../../webflow.app.mjs";
22

33
export default {
4-
key: "webflow_v2-get-collection-item",
4+
key: "webflow-get-collection-item",
55
name: "Get Collection Item",
66
description: "Get a Collection Item. [See the docs here](https://developers.webflow.com/#get-single-item)",
7-
version: "0.0.1",
7+
version: "0.1.7",
88
type: "action",
99
props: {
10-
app,
10+
webflow,
1111
siteId: {
1212
propDefinition: [
13-
app,
13+
webflow,
1414
"sites",
1515
],
1616
},
1717
collectionId: {
1818
propDefinition: [
19-
app,
19+
webflow,
2020
"collections",
2121
(c) => ({
2222
siteId: c.siteId,
@@ -25,7 +25,7 @@ export default {
2525
},
2626
itemId: {
2727
propDefinition: [
28-
app,
28+
webflow,
2929
"items",
3030
(c) => ({
3131
collectionId: c.collectionId,
@@ -34,7 +34,12 @@ export default {
3434
},
3535
},
3636
async run({ $ }) {
37-
const response = await this.app.getCollectionItem(this.collectionId, this.itemId);
37+
const webflow = this.webflow._createApiClient();
38+
39+
const response = await webflow.item({
40+
collectionId: this.collectionId,
41+
itemId: this.itemId,
42+
});
3843

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

components/webflow_v2/actions/get-collection/get-collection.mjs renamed to components/webflow/actions/get-collection/get-collection.mjs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import app from "../../webflow_v2.app.mjs";
1+
import webflow from "../../webflow.app.mjs";
22

33
export default {
4-
key: "webflow_v2-get-collection",
4+
key: "webflow-get-collection",
55
name: "Get Collection",
66
description: "Get a collection. [See the docs here](https://developers.webflow.com/#get-collection-with-full-schema)",
7-
version: "0.0.1",
7+
version: "0.0.5",
88
type: "action",
99
props: {
10-
app,
10+
webflow,
1111
siteId: {
1212
propDefinition: [
13-
app,
13+
webflow,
1414
"sites",
1515
],
1616
},
1717
collectionId: {
1818
propDefinition: [
19-
app,
19+
webflow,
2020
"collections",
2121
(c) => ({
2222
siteId: c.siteId,
@@ -25,7 +25,7 @@ export default {
2525
},
2626
},
2727
async run({ $ }) {
28-
const response = await this.app.getCollection(this.collectionId);
28+
const response = await this.webflow.getCollection(this.collectionId);
2929

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

components/webflow_v2/actions/get-item-inventory/get-item-inventory.mjs renamed to components/webflow/actions/get-item-inventory/get-item-inventory.mjs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import app from "../../webflow_v2.app.mjs";
1+
import webflow from "../../webflow.app.mjs";
22

33
export default {
4-
key: "webflow_v2-get-item-inventory",
4+
key: "webflow-get-item-inventory",
55
name: "Get Item Inventory",
66
description: "Get the inventory of a specific item. [See the docs here](https://developers.webflow.com/#item-inventory)",
7-
version: "0.0.1",
7+
version: "0.0.5",
88
type: "action",
99
props: {
10-
app,
10+
webflow,
1111
siteId: {
1212
propDefinition: [
13-
app,
13+
webflow,
1414
"sites",
1515
],
1616
},
1717
collectionId: {
1818
propDefinition: [
19-
app,
19+
webflow,
2020
"collections",
2121
(c) => ({
2222
siteId: c.siteId,
@@ -25,7 +25,7 @@ export default {
2525
},
2626
itemId: {
2727
propDefinition: [
28-
app,
28+
webflow,
2929
"items",
3030
(c) => ({
3131
collectionId: c.collectionId,
@@ -34,7 +34,9 @@ export default {
3434
},
3535
},
3636
async run({ $ }) {
37-
const response = await this.app.getCollectionItemInventory(this.collectionId, this.itemId);
37+
const apiClient = this.webflow._createApiClient();
38+
39+
const response = await apiClient.apiClient.get(`/collections/${this.collectionId}/items/${this.itemId}/inventory`);
3840

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import webflow from "../../webflow.app.mjs";
2+
3+
export default {
4+
key: "webflow-get-order",
5+
name: "Get Order",
6+
description: "Get an order. [See the docs here](https://developers.webflow.com/#get-order)",
7+
version: "0.0.4",
8+
type: "action",
9+
props: {
10+
webflow,
11+
siteId: {
12+
propDefinition: [
13+
webflow,
14+
"sites",
15+
],
16+
},
17+
orderId: {
18+
propDefinition: [
19+
webflow,
20+
"orders",
21+
],
22+
},
23+
},
24+
async run({ $ }) {
25+
const response = await this.webflow.getOrder({
26+
siteId: this.siteId,
27+
orderId: this.orderId,
28+
});
29+
30+
$.export("$summary", "Successfully retrieved order");
31+
32+
return response;
33+
},
34+
};

0 commit comments

Comments
 (0)