Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 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.

This file was deleted.

30 changes: 0 additions & 30 deletions components/webflow/sources/common/collection-common.mjs

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}}",
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 ${this.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 incorrect reference to this.name in summary

The summary message uses this.name which isn't defined in the component's props. This should reference the name from the created item's response.

-    $.export("$summary", `Successfully created collection item ${this.name ?? ""}`);
+    $.export("$summary", `Successfully created collection item ${response.fieldData?.name ?? ""}`);
📝 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 ${this.name ?? ""}`);
$.export("$summary", `Successfully created collection item ${response.fieldData?.name ?? ""}`);


return response;
},
Expand Down
Loading
Loading