diff --git a/components/lightspeed_ecom_c_series/actions/find-customers/find-customers.mjs b/components/lightspeed_ecom_c_series/actions/find-customers/find-customers.mjs new file mode 100644 index 0000000000000..6f9a46aa46b1f --- /dev/null +++ b/components/lightspeed_ecom_c_series/actions/find-customers/find-customers.mjs @@ -0,0 +1,79 @@ +import app from "../../lightspeed_ecom_c_series.app.mjs"; + +export default { + key: "lightspeed_ecom_c_series-find-customers", + name: "Find Customers", + description: "Find a customer by ID. [See the documentation](https://developers.lightspeedhq.com/ecom/endpoints/customer/#get-all-customers)", + version: "0.0.1", + type: "action", + props: { + app, + customerEmail: { + propDefinition: [ + app, + "customerEmail", + ], + description: "Retrieve all customers from a specific customer based on the customer email", + optional: true, + }, + sinceId: { + type: "string", + label: "Since ID", + description: "Restrict results to after the specified ID", + optional: true, + }, + createdAtMin: { + propDefinition: [ + app, + "createdAtMin", + ], + description: "Show customers created after date. **Format: `YYYY-MM-DD HH:MM:SS`**", + }, + createdAtMax: { + propDefinition: [ + app, + "createdAtMax", + ], + description: "Show customers created before date. **Format: `YYYY-MM-DD HH:MM:SS`**", + }, + updatedAtMin: { + propDefinition: [ + app, + "updatedAtMin", + ], + description: "Show customers last updated after date. **Format: `YYYY-MM-DD HH:MM:SS`**", + }, + updatedAtMax: { + propDefinition: [ + app, + "updatedAtMax", + ], + description: "Show customers last updated before date. **Format: `YYYY-MM-DD HH:MM:SS`**", + }, + }, + async run({ $ }) { + const response = this.app.paginate({ + fn: this.app.listCustomers, + $, + params: { + email: this.customerEmail, + since_id: this.sinceId, + created_at_min: this.createdAtMin, + created_at_max: this.createdAtMax, + updated_at_min: this.updatedAtMin, + updated_at_max: this.updatedAtMax, + }, + dataField: "customers", + }); + + const customers = []; + for await (const customer of response) { + customers.push(customer); + } + + $.export("$summary", `Successfully found ${customers.length} customer${customers.length === 1 + ? "" + : "s"}`); + return customers; + }, +}; diff --git a/components/lightspeed_ecom_c_series/actions/find-invoice/find-invoice.mjs b/components/lightspeed_ecom_c_series/actions/find-invoice/find-invoice.mjs new file mode 100644 index 0000000000000..19d1aa5dbe860 --- /dev/null +++ b/components/lightspeed_ecom_c_series/actions/find-invoice/find-invoice.mjs @@ -0,0 +1,97 @@ +import app from "../../lightspeed_ecom_c_series.app.mjs"; + +export default { + key: "lightspeed_ecom_c_series-find-invoice", + name: "Find Invoice", + description: "Find an invoice by ID. [See the documentation](https://developers.lightspeedhq.com/ecom/endpoints/invoice/#get-all-invoices)", + version: "0.0.1", + type: "action", + props: { + app, + customerId: { + propDefinition: [ + app, + "customerId", + ], + description: "Retrieve all invoices from a specific customer based on the customerid", + optional: true, + }, + orderNumber: { + propDefinition: [ + app, + "orderNumber", + ], + description: "Retrieve an order based on the order number", + optional: true, + }, + invoiceNumber: { + propDefinition: [ + app, + "invoiceNumber", + ], + description: "Retrieve an invoice based on the invoice number", + optional: true, + }, + sinceId: { + type: "string", + label: "Since ID", + description: "Restrict results to after the specified ID", + optional: true, + }, + createdAtMin: { + propDefinition: [ + app, + "createdAtMin", + ], + description: "Show invoices created after date. **Format: `YYYY-MM-DD HH:MM:SS`**", + }, + createdAtMax: { + propDefinition: [ + app, + "createdAtMax", + ], + description: "Show invoices created before date. **Format: `YYYY-MM-DD HH:MM:SS`**", + }, + updatedAtMin: { + propDefinition: [ + app, + "updatedAtMin", + ], + description: "Show invoices last updated after date. **Format: `YYYY-MM-DD HH:MM:SS`**", + }, + updatedAtMax: { + propDefinition: [ + app, + "updatedAtMax", + ], + description: "Show invoices last updated before date. **Format: `YYYY-MM-DD HH:MM:SS`**", + }, + }, + async run({ $ }) { + const response = this.app.paginate({ + fn: this.app.listInvoice, + $, + params: { + customer: this.customerId, + number: this.invoiceNumber, + order: this.orderNumber, + since_id: this.sinceId, + created_at_min: this.createdAtMin, + created_at_max: this.createdAtMax, + updated_at_min: this.updatedAtMin, + updated_at_max: this.updatedAtMax, + }, + dataField: "invoices", + }); + + const invoices = []; + for await (const invoice of response) { + invoices.push(invoice); + } + + $.export("$summary", `Successfully found ${invoices.length} invoice${invoices.length === 1 + ? "" + : "s"}`); + return invoices; + }, +}; diff --git a/components/lightspeed_ecom_c_series/actions/find-order/find-order.mjs b/components/lightspeed_ecom_c_series/actions/find-order/find-order.mjs new file mode 100644 index 0000000000000..4e90d5027d6b3 --- /dev/null +++ b/components/lightspeed_ecom_c_series/actions/find-order/find-order.mjs @@ -0,0 +1,88 @@ +import app from "../../lightspeed_ecom_c_series.app.mjs"; + +export default { + key: "lightspeed_ecom_c_series-find-order", + name: "Find Order", + description: "Find an order by ID. [See the documentation](https://developers.lightspeedhq.com/ecom/endpoints/order/#get-all-orders)", + version: "0.0.1", + type: "action", + props: { + app, + customerId: { + propDefinition: [ + app, + "customerId", + ], + description: "Retrieve all orders from a specific customer based on the customerid", + optional: true, + }, + orderNumber: { + propDefinition: [ + app, + "orderNumber", + ], + description: "Retrieve an order based on the order number", + optional: true, + }, + sinceId: { + type: "string", + label: "Since ID", + description: "Restrict results to after the specified ID", + optional: true, + }, + createdAtMin: { + propDefinition: [ + app, + "createdAtMin", + ], + description: "Show orders created after date. **Format: `YYYY-MM-DD HH:MM:SS`**", + }, + createdAtMax: { + propDefinition: [ + app, + "createdAtMax", + ], + description: "Show orders created before date. **Format: `YYYY-MM-DD HH:MM:SS`**", + }, + updatedAtMin: { + propDefinition: [ + app, + "updatedAtMin", + ], + description: "Show orders last updated after date. **Format: `YYYY-MM-DD HH:MM:SS`**", + }, + updatedAtMax: { + propDefinition: [ + app, + "updatedAtMax", + ], + description: "Show orders last updated before date. **Format: `YYYY-MM-DD HH:MM:SS`**", + }, + }, + async run({ $ }) { + const response = this.app.paginate({ + fn: this.app.listOrder, + $, + params: { + customer: this.customerId, + number: this.orderNumber, + since_id: this.sinceId, + created_at_min: this.createdAtMin, + created_at_max: this.createdAtMax, + updated_at_min: this.updatedAtMin, + updated_at_max: this.updatedAtMax, + }, + dataField: "orders", + }); + + const orders = []; + for await (const order of response) { + orders.push(order); + } + + $.export("$summary", `Successfully found ${orders.length} order${orders.length === 1 + ? "" + : "s"}`); + return orders; + }, +}; diff --git a/components/lightspeed_ecom_c_series/actions/find-product/find-product.mjs b/components/lightspeed_ecom_c_series/actions/find-product/find-product.mjs new file mode 100644 index 0000000000000..f7131d6805a9f --- /dev/null +++ b/components/lightspeed_ecom_c_series/actions/find-product/find-product.mjs @@ -0,0 +1,74 @@ +import app from "../../lightspeed_ecom_c_series.app.mjs"; + +export default { + key: "lightspeed_ecom_c_series-find-product", + name: "Find Product", + description: "Find an product by ID. [See the documentation](https://developers.lightspeedhq.com/ecom/endpoints/product/#get-all-products)", + version: "0.0.1", + type: "action", + props: { + app, + brandId: { + propDefinition: [ + app, + "brandId", + ], + optional: true, + }, + sinceId: { + type: "string", + label: "Since ID", + description: "Restrict results to after the specified ID", + optional: true, + }, + createdAtMin: { + propDefinition: [ + app, + "createdAtMin", + ], + }, + createdAtMax: { + propDefinition: [ + app, + "createdAtMax", + ], + }, + updatedAtMin: { + propDefinition: [ + app, + "updatedAtMin", + ], + }, + updatedAtMax: { + propDefinition: [ + app, + "updatedAtMax", + ], + }, + }, + async run({ $ }) { + const response = this.app.paginate({ + fn: this.app.listProduct, + $, + params: { + brand: this.brandId, + since_id: this.sinceId, + created_at_min: this.createdAtMin, + created_at_max: this.createdAtMax, + updated_at_min: this.updatedAtMin, + updated_at_max: this.updatedAtMax, + }, + dataField: "products", + }); + + const products = []; + for await (const product of response) { + products.push(product); + } + + $.export("$summary", `Successfully found ${products.length} product${products.length === 1 + ? "" + : "s"}`); + return products; + }, +}; diff --git a/components/lightspeed_ecom_c_series/actions/find-shipment/find-shipment.mjs b/components/lightspeed_ecom_c_series/actions/find-shipment/find-shipment.mjs new file mode 100644 index 0000000000000..159494163dc3a --- /dev/null +++ b/components/lightspeed_ecom_c_series/actions/find-shipment/find-shipment.mjs @@ -0,0 +1,96 @@ +import app from "../../lightspeed_ecom_c_series.app.mjs"; + +export default { + key: "lightspeed_ecom_c_series-find-shipment", + name: "Find Shipment", + description: "Find a shipment by ID. [See the documentation](https://developers.lightspeedhq.com/ecom/endpoints/shipment/#get-all-shipments)", + version: "0.0.1", + type: "action", + props: { + app, + customerId: { + propDefinition: [ + app, + "customerId", + ], + description: "Retrieve all shipments from a specific customer based on the customerid", + optional: true, + }, + orderNumber: { + propDefinition: [ + app, + "orderNumber", + ], + description: "Retrieve a shipment based on the order number", + optional: true, + }, + shipmentNumber: { + propDefinition: [ + app, + "shipmentNumber", + ], + optional: true, + }, + sinceId: { + type: "string", + label: "Since ID", + description: "Restrict results to after the specified ID", + optional: true, + }, + createdAtMin: { + propDefinition: [ + app, + "createdAtMin", + ], + description: "Show shipments created after date. **Format: `YYYY-MM-DD HH:MM:SS`**", + }, + createdAtMax: { + propDefinition: [ + app, + "createdAtMax", + ], + description: "Show shipments created before date. **Format: `YYYY-MM-DD HH:MM:SS`**", + }, + updatedAtMin: { + propDefinition: [ + app, + "updatedAtMin", + ], + description: "Show shipments last updated after date. **Format: `YYYY-MM-DD HH:MM:SS`**", + }, + updatedAtMax: { + propDefinition: [ + app, + "updatedAtMax", + ], + description: "Show shipments last updated before date. **Format: `YYYY-MM-DD HH:MM:SS`**", + }, + }, + async run({ $ }) { + const response = this.app.paginate({ + fn: this.app.listShipment, + $, + params: { + customer: this.customerId, + order: this.orderNumber, + number: this.shipmentNumber, + since_id: this.sinceId, + created_at_min: this.createdAtMin, + created_at_max: this.createdAtMax, + updated_at_min: this.updatedAtMin, + updated_at_max: this.updatedAtMax, + }, + dataField: "shipments", + }); + + const shipments = []; + for await (const shipment of response) { + shipments.push(shipment); + } + + $.export("$summary", `Successfully found ${shipments.length} shipment${shipments.length === 1 + ? "" + : "s"}`); + return shipments; + }, +}; diff --git a/components/lightspeed_ecom_c_series/actions/get-order-products/get-order-products.mjs b/components/lightspeed_ecom_c_series/actions/get-order-products/get-order-products.mjs new file mode 100644 index 0000000000000..5adf8f89409cc --- /dev/null +++ b/components/lightspeed_ecom_c_series/actions/get-order-products/get-order-products.mjs @@ -0,0 +1,36 @@ +import app from "../../lightspeed_ecom_c_series.app.mjs"; + +export default { + key: "lightspeed_ecom_c_series-get-order-products", + name: "Get Order Products", + description: "Get an order products by ID. [See the documentation](https://developers.lightspeedhq.com/ecom/endpoints/orderproduct/#get-all-order-products)", + version: "0.0.1", + type: "action", + props: { + app, + orderId: { + propDefinition: [ + app, + "orderId", + ], + }, + }, + async run({ $ }) { + const response = this.app.paginate({ + $, + fn: this.app.getOrderProducts, + orderId: this.orderId, + dataField: "orderProducts", + }); + + const products = []; + for await (const product of response) { + products.push(product); + } + + $.export("$summary", `Successfully retrieved order ${products.length} product${products.length === 1 + ? "" + : "s"} for order with ID: ${this.orderId}`); + return products; + }, +}; diff --git a/components/lightspeed_ecom_c_series/actions/get-order/get-order.mjs b/components/lightspeed_ecom_c_series/actions/get-order/get-order.mjs new file mode 100644 index 0000000000000..87b71cf7b8581 --- /dev/null +++ b/components/lightspeed_ecom_c_series/actions/get-order/get-order.mjs @@ -0,0 +1,26 @@ +import app from "../../lightspeed_ecom_c_series.app.mjs"; + +export default { + key: "lightspeed_ecom_c_series-get-order", + name: "Get Order", + description: "Get an order by ID. [See the documentation](https://developers.lightspeedhq.com/ecom/endpoints/order/#get-retrieve-an-order)", + version: "0.0.1", + type: "action", + props: { + app, + orderId: { + propDefinition: [ + app, + "orderId", + ], + }, + }, + async run({ $ }) { + const response = await this.app.getOrder({ + $, + orderId: this.orderId, + }); + $.export("$summary", `Successfully retrieved order with ID: ${this.orderId}`); + return response; + }, +}; diff --git a/components/lightspeed_ecom_c_series/actions/get-product/get-product.mjs b/components/lightspeed_ecom_c_series/actions/get-product/get-product.mjs new file mode 100644 index 0000000000000..a110678a0a1db --- /dev/null +++ b/components/lightspeed_ecom_c_series/actions/get-product/get-product.mjs @@ -0,0 +1,26 @@ +import app from "../../lightspeed_ecom_c_series.app.mjs"; + +export default { + key: "lightspeed_ecom_c_series-get-product", + name: "Get Product", + description: "Get a product by ID. [See the documentation](https://developers.lightspeedhq.com/ecom/endpoints/product/#get-retrieve-a-product)", + version: "0.0.1", + type: "action", + props: { + app, + productId: { + propDefinition: [ + app, + "productId", + ], + }, + }, + async run({ $ }) { + const response = await this.app.getProduct({ + $, + productId: this.productId, + }); + $.export("$summary", `Successfully retrieved product with ID: ${this.productId}`); + return response; + }, +}; diff --git a/components/lightspeed_ecom_c_series/actions/get-shipment/get-shipment.mjs b/components/lightspeed_ecom_c_series/actions/get-shipment/get-shipment.mjs new file mode 100644 index 0000000000000..a040a48558c18 --- /dev/null +++ b/components/lightspeed_ecom_c_series/actions/get-shipment/get-shipment.mjs @@ -0,0 +1,27 @@ +import app from "../../lightspeed_ecom_c_series.app.mjs"; + +export default { + key: "lightspeed_ecom_c_series-get-shipment", + name: "Get Shipment", + description: "Get a shipment by ID. [See the documentation](https://developers.lightspeedhq.com/ecom/endpoints/shipment/#get-retrieve-a-shipment)", + version: "0.0.1", + type: "action", + props: { + app, + shipmentId: { + propDefinition: [ + app, + "shipmentId", + ], + }, + }, + async run({ $ }) { + const response = await this.app.getShipment({ + $, + shipmentId: this.shipmentId, + }); + + $.export("$summary", `Successfully fetched shipment ${this.shipmentId}`); + return response; + }, +}; diff --git a/components/lightspeed_ecom_c_series/lightspeed_ecom_c_series.app.mjs b/components/lightspeed_ecom_c_series/lightspeed_ecom_c_series.app.mjs index 47001046778b7..74ddd3c3ce88c 100644 --- a/components/lightspeed_ecom_c_series/lightspeed_ecom_c_series.app.mjs +++ b/components/lightspeed_ecom_c_series/lightspeed_ecom_c_series.app.mjs @@ -1,11 +1,329 @@ +import { axios } from "@pipedream/platform"; + export default { type: "app", app: "lightspeed_ecom_c_series", - propDefinitions: {}, + propDefinitions: { + customerId: { + type: "string", + label: "Customer ID", + description: "Retrieve all orders from a specific customer based on the customerid", + async options({ page }) { + const { customers } = await this.listCustomers({ + params: { + page: page + 1, + }, + }); + + return customers.map(({ + id: value, firstname, middlename, lastname, email, + }) => ({ + label: `${firstname} ${middlename && `${middlename} ` || ""}${lastname} ${email && `(${email})` || ""}`, + value, + })); + }, + }, + customerEmail: { + type: "string", + label: "Customer Email", + description: "Retrieve all customers from a specific customer based on the customer email", + async options({ page }) { + const { customers } = await this.listCustomers({ + params: { + page: page + 1, + }, + }); + + return customers.map(({ + email: value, firstname, middlename, lastname, + }) => ({ + label: `${firstname} ${middlename && `${middlename} ` || ""}${lastname} ${value && `(${value})` || ""}`, + value, + })); + }, + }, + orderNumber: { + type: "string", + label: "Order Number", + description: "Retrieve an order based on the order number", + async options({ page }) { + const { orders } = await this.listOrder({ + params: { + page: page + 1, + }, + }); + + return orders.map(({ + number, email, + }) => ({ + label: `Order #${number} ${email && `(${email})`}`, + value: number, + })); + }, + }, + orderId: { + type: "string", + label: "Order ID", + description: "Retrieve an order based on the order ID", + async options({ page }) { + const { orders } = await this.listOrder({ + params: { + page: page + 1, + }, + }); + + return orders.map(({ + id: value, number, email, + }) => ({ + label: `Order #${number} ${email && `(${email})`}`, + value: value, + })); + }, + }, + shipmentNumber: { + type: "string", + label: "Shipment Number", + description: "Retrieve a shipment based on the shipment number", + async options({ page }) { + const { shipments } = await this.listShipment({ + params: { + page: page + 1, + }, + }); + + return shipments.map(({ + number, status, + }) => ({ + label: `Shipment #${number} ${status && `(${status})`}`, + value: number, + })); + }, + }, + shipmentId: { + type: "string", + label: "Shipment ID", + description: "Retrieve a shipment based on the shipment ID", + async options({ page }) { + const { shipments } = await this.listShipment({ + params: { + page: page + 1, + }, + }); + + return shipments.map(({ + id: value, number, status, + }) => ({ + label: `Shipment #${number} ${status && `(${status})`}`, + value: value, + })); + }, + }, + invoiceNumber: { + type: "string", + label: "Invoice Number", + description: "Retrieve an invoice based on the invoice number", + async options({ page }) { + const { invoices } = await this.listInvoice({ + params: { + page: page + 1, + }, + }); + + return invoices.map(({ + number, status, + }) => ({ + label: `Invoice #${number} ${status && `(${status})`}`, + value: number, + })); + }, + }, + brandId: { + type: "string", + label: "Brand ID", + description: "Retrieve a product based on the brand ID", + async options({ page }) { + const { brands } = await this.listBrands({ + params: { + page, + }, + }); + + return brands.map(({ + id: value, title: label, + }) => ({ + label, + value, + })); + }, + }, + productId: { + type: "string", + label: "Product ID", + description: "Retrieve a product based on the product ID", + async options({ page }) { + const { products } = await this.listProduct({ + params: { + page: page + 1, + }, + }); + + return products.map(({ + id: value, title: label, + }) => ({ + label, + value, + })); + }, + }, + createdAtMin: { + type: "string", + label: "Created At Min", + description: "Show products created after date. **Format: `YYYY-MM-DD HH:MM:SS`**", + optional: true, + }, + createdAtMax: { + type: "string", + label: "Created At Max", + description: "Show products created before date. **Format: `YYYY-MM-DD HH:MM:SS`**", + optional: true, + }, + updatedAtMin: { + type: "string", + label: "Updated At Min", + description: "Show products last updated after date. **Format: `YYYY-MM-DD HH:MM:SS`**", + optional: true, + }, + updatedAtMax: { + type: "string", + label: "Updated At Max", + description: "Show products last updated before date. **Format: `YYYY-MM-DD HH:MM:SS`**", + optional: true, + }, + }, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return `https://api.${this.$auth.cluster}.com/${this.$auth.lang}`; + }, + _auth() { + return { + username: `${this.$auth.api_key}`, + password: `${this.$auth.api_secret}`, + }; + }, + _makeRequest({ + $ = this, path, ...opts + }) { + return axios($, { + url: this._baseUrl() + path, + auth: this._auth(), + ...opts, + }); + }, + listCustomers(opts = {}) { + return this._makeRequest({ + path: "/customers.json", + ...opts, + }); + }, + listShipment(opts = {}) { + return this._makeRequest({ + path: "/shipments.json", + ...opts, + }); + }, + listOrder(opts = {}) { + return this._makeRequest({ + path: "/orders.json", + ...opts, + }); + }, + getOrder({ + orderId, ...opts + }) { + return this._makeRequest({ + path: `/orders/${orderId}.json`, + ...opts, + }); + }, + getOrderProducts({ + orderId, ...opts + }) { + return this._makeRequest({ + path: `/orders/${orderId}/products.json`, + ...opts, + }); + }, + getShipment({ + shipmentId, ...opts + }) { + return this._makeRequest({ + path: `/shipments/${shipmentId}.json`, + ...opts, + }); + }, + listInvoice(opts = {}) { + return this._makeRequest({ + path: "/invoices.json", + ...opts, + }); + }, + getProduct({ + productId, ...opts + }) { + return this._makeRequest({ + path: `/products/${productId}.json`, + ...opts, + }); + }, + listProduct(opts = {}) { + return this._makeRequest({ + path: "/products.json", + ...opts, + }); + }, + listBrands(opts = {}) { + return this._makeRequest({ + path: "/brands.json", + ...opts, + }); + }, + createHook(opts = {}) { + return this._makeRequest({ + method: "POST", + path: "/webhooks.json", + ...opts, + }); + }, + deleteHook(hookId) { + return this._makeRequest({ + method: "DELETE", + path: `/webhooks/${hookId}.json`, + }); + }, + async *paginate({ + fn, params = {}, dataField, maxResults = null, ...opts + }) { + let hasMore = false; + let count = 0; + let page = 0; + + do { + params.page = ++page; + const response = await fn({ + params, + ...opts, + }); + for (const d of response[dataField]) { + yield d; + + if (maxResults && ++count === maxResults) { + return count; + } + } + + hasMore = response[dataField].length; + + } while (hasMore); }, }, }; diff --git a/components/lightspeed_ecom_c_series/package.json b/components/lightspeed_ecom_c_series/package.json index 135da331e376f..d58f12fb8b8ad 100644 --- a/components/lightspeed_ecom_c_series/package.json +++ b/components/lightspeed_ecom_c_series/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/lightspeed_ecom_c_series", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream Lightspeed eCom (C-Series) Components", "main": "lightspeed_ecom_c_series.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.1.0" } -} \ No newline at end of file +} diff --git a/components/lightspeed_ecom_c_series/sources/common/base.mjs b/components/lightspeed_ecom_c_series/sources/common/base.mjs new file mode 100644 index 0000000000000..49eb61ddf4307 --- /dev/null +++ b/components/lightspeed_ecom_c_series/sources/common/base.mjs @@ -0,0 +1,47 @@ +import app from "../../lightspeed_ecom_c_series.app.mjs"; + +export default { + props: { + app, + db: "$.service.db", + http: { + type: "$.interface.http", + customResponse: true, + }, + }, + methods: { + _setWebhookId(id) { + this.db.set("webhookId", id); + }, + _getWebhookId() { + return this.db.get("webhookId"); + }, + }, + hooks: { + async activate() { + const response = await this.app.createHook({ + data: { + webhook: { + isActive: true, + itemGroup: this.getItemGroup(), + itemAction: this.getItemAction(), + format: "json", + address: this.http.endpoint, + }, + }, + }); + this._setWebhookId(response.webhook.id); + }, + async deactivate() { + const webhookId = this._getWebhookId(); + await this.app.deleteHook(webhookId); + }, + }, + async run({ body }) { + this.http.respond({ + status: 200, + }); + + this.$emit(body, this.generateMeta(body)); + }, +}; diff --git a/components/lightspeed_ecom_c_series/sources/customer-updated/customer-updated.mjs b/components/lightspeed_ecom_c_series/sources/customer-updated/customer-updated.mjs new file mode 100644 index 0000000000000..8f7657521ac6a --- /dev/null +++ b/components/lightspeed_ecom_c_series/sources/customer-updated/customer-updated.mjs @@ -0,0 +1,29 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "indiefunnels-customer-updated", + name: "Customer Updated (Instant)", + description: "Emit new event when an customer is updated.", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getItemGroup() { + return "customers"; + }, + getItemAction() { + return "updated"; + }, + generateMeta(body) { + return { + id: body.customer.id, + summary: this.getSummary(`Customer with ID ${body.customer.id} updated`), + ts: Date.parse(body.customer.updatedAt), + }; + }, + }, + sampleEmit, +}; diff --git a/components/lightspeed_ecom_c_series/sources/customer-updated/test-event.mjs b/components/lightspeed_ecom_c_series/sources/customer-updated/test-event.mjs new file mode 100644 index 0000000000000..3c8b0a9d637bc --- /dev/null +++ b/components/lightspeed_ecom_c_series/sources/customer-updated/test-event.mjs @@ -0,0 +1,116 @@ +export default { + "customer":{ + "id":123, + "createdAt":"2025-09-17T20:23:06+00:00", + "updatedAt":"2025-09-17T20:23:06+00:00", + "isConfirmed":false, + "type":"registered", + "lastOnlineAt":null, + "remoteIp":false, + "userAgent":false, + "referralId":false, + "gender":false, + "birthDate":false, + "nationalId":"", + "email":"customer@email.com", + "firstname":"John", + "middlename":"", + "lastname":"Doe", + "phone":"", + "mobile":"", + "isCompany":false, + "companyName":"", + "companyCoCNumber":"", + "companyVatNumber":"", + "addressBillingName":"John Doe", + "addressBillingStreet":"", + "addressBillingStreet2":"", + "addressBillingNumber":"", + "addressBillingExtension":"", + "addressBillingZipcode":"", + "addressBillingCity":"", + "addressBillingRegion":"", + "addressBillingCountry":{ + "id":150, + "code":"nl", + "code3":"nld", + "title":"Netherlands, The" + }, + "addressShippingCompany":false, + "addressShippingName":"John Doe", + "addressShippingStreet":"", + "addressShippingStreet2":"", + "addressShippingNumber":"", + "addressShippingExtension":"", + "addressShippingZipcode":"", + "addressShippingCity":"", + "addressShippingRegion":"", + "addressShippingCountry":{ + "id":150, + "code":"nl", + "code3":"nld", + "title":"Netherlands, The" + }, + "memo":"", + "doNotifyRegistered":false, + "doNotifyConfirmed":false, + "doNotifyPassword":false, + "groups":{ + "resource":{ + "id":false, + "url":"groups\/customers?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/groups\/customers.json?customer=123" + } + }, + "invoices":{ + "resource":{ + "id":false, + "url":"invoices?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices.json?customer=123" + } + }, + "language":false, + "orders":{ + "resource":{ + "id":false, + "url":"orders?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders.json?customer=123" + } + }, + "reviews":{ + "resource":{ + "id":false, + "url":"reviews?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/reviews.json?customer=123" + } + }, + "shipments":{ + "resource":{ + "id":false, + "url":"shipments?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/shipments.json?customer=123" + } + }, + "tickets":{ + "resource":{ + "id":false, + "url":"tickets?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/tickets.json?customer=123" + } + }, + "metafields":{ + "resource":{ + "id":false, + "url":"customers\/123\/metafields", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123\/metafields.json" + } + }, + "login":{ + "resource":{ + "id":false, + "url":"customers\/123\/login", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123\/login.json" + } + } + } +} \ No newline at end of file diff --git a/components/lightspeed_ecom_c_series/sources/invoice-updated/invoice-updated.mjs b/components/lightspeed_ecom_c_series/sources/invoice-updated/invoice-updated.mjs new file mode 100644 index 0000000000000..02795f503ca86 --- /dev/null +++ b/components/lightspeed_ecom_c_series/sources/invoice-updated/invoice-updated.mjs @@ -0,0 +1,29 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "indiefunnels-invoice-updated", + name: "Invoice Updated (Instant)", + description: "Emit new event when an invoice is updated.", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getItemGroup() { + return "invoices"; + }, + getItemAction() { + return "updated"; + }, + generateMeta(body) { + return { + id: body.invoice.id, + summary: this.getSummary(`Invoice with ID ${body.invoice.id} updated`), + ts: Date.parse(body.invoice.updatedAt), + }; + }, + }, + sampleEmit, +}; diff --git a/components/lightspeed_ecom_c_series/sources/invoice-updated/test-event.mjs b/components/lightspeed_ecom_c_series/sources/invoice-updated/test-event.mjs new file mode 100644 index 0000000000000..0f9a4178b5a94 --- /dev/null +++ b/components/lightspeed_ecom_c_series/sources/invoice-updated/test-event.mjs @@ -0,0 +1,52 @@ +export default { + "invoice":{ + "id":123, + "createdAt":"2025-09-17T20:04:13+00:00", + "updatedAt": "2025-09-17T20:16:30+00:00", + "number":"INV00001", + "status":"not_paid", + "isVatShifted":true, + "priceExcl":0, + "priceIncl":0, + "doNotifyNew":false, + "doNotifyPaid":false, + "invoice":false, + "isCreditNote":false, + "creditNote":false, + "order":{ + "resource":{ + "id":123, + "url":"orders\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123.json" + } + }, + "customer":{ + "resource":{ + "id":123, + "url":"customers\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123.json" + } + }, + "items":{ + "resource":{ + "id":false, + "url":"invoices\/123\/items", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices\/123\/items.json" + } + }, + "metafields":{ + "resource":{ + "id":false, + "url":"invoices\/123\/metafields", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices\/123\/metafields.json" + } + }, + "events":{ + "resource":{ + "id":false, + "url":"orders\/events?invoice=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/events.json?invoice=123" + } + } + } +} \ No newline at end of file diff --git a/components/lightspeed_ecom_c_series/sources/new-customer-created/new-customer-created.mjs b/components/lightspeed_ecom_c_series/sources/new-customer-created/new-customer-created.mjs new file mode 100644 index 0000000000000..60fcdd8f9e359 --- /dev/null +++ b/components/lightspeed_ecom_c_series/sources/new-customer-created/new-customer-created.mjs @@ -0,0 +1,29 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "indiefunnels-new-customer-created", + name: "New Customer Created (Instant)", + description: "Emit new event when an customer is created.", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getItemGroup() { + return "customers"; + }, + getItemAction() { + return "created"; + }, + generateMeta(body) { + return { + id: body.customer.id, + summary: this.getSummary(`Customer with ID ${body.customer.id} created`), + ts: Date.parse(body.customer.createdAt), + }; + }, + }, + sampleEmit, +}; diff --git a/components/lightspeed_ecom_c_series/sources/new-customer-created/test-event.mjs b/components/lightspeed_ecom_c_series/sources/new-customer-created/test-event.mjs new file mode 100644 index 0000000000000..3c8b0a9d637bc --- /dev/null +++ b/components/lightspeed_ecom_c_series/sources/new-customer-created/test-event.mjs @@ -0,0 +1,116 @@ +export default { + "customer":{ + "id":123, + "createdAt":"2025-09-17T20:23:06+00:00", + "updatedAt":"2025-09-17T20:23:06+00:00", + "isConfirmed":false, + "type":"registered", + "lastOnlineAt":null, + "remoteIp":false, + "userAgent":false, + "referralId":false, + "gender":false, + "birthDate":false, + "nationalId":"", + "email":"customer@email.com", + "firstname":"John", + "middlename":"", + "lastname":"Doe", + "phone":"", + "mobile":"", + "isCompany":false, + "companyName":"", + "companyCoCNumber":"", + "companyVatNumber":"", + "addressBillingName":"John Doe", + "addressBillingStreet":"", + "addressBillingStreet2":"", + "addressBillingNumber":"", + "addressBillingExtension":"", + "addressBillingZipcode":"", + "addressBillingCity":"", + "addressBillingRegion":"", + "addressBillingCountry":{ + "id":150, + "code":"nl", + "code3":"nld", + "title":"Netherlands, The" + }, + "addressShippingCompany":false, + "addressShippingName":"John Doe", + "addressShippingStreet":"", + "addressShippingStreet2":"", + "addressShippingNumber":"", + "addressShippingExtension":"", + "addressShippingZipcode":"", + "addressShippingCity":"", + "addressShippingRegion":"", + "addressShippingCountry":{ + "id":150, + "code":"nl", + "code3":"nld", + "title":"Netherlands, The" + }, + "memo":"", + "doNotifyRegistered":false, + "doNotifyConfirmed":false, + "doNotifyPassword":false, + "groups":{ + "resource":{ + "id":false, + "url":"groups\/customers?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/groups\/customers.json?customer=123" + } + }, + "invoices":{ + "resource":{ + "id":false, + "url":"invoices?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices.json?customer=123" + } + }, + "language":false, + "orders":{ + "resource":{ + "id":false, + "url":"orders?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders.json?customer=123" + } + }, + "reviews":{ + "resource":{ + "id":false, + "url":"reviews?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/reviews.json?customer=123" + } + }, + "shipments":{ + "resource":{ + "id":false, + "url":"shipments?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/shipments.json?customer=123" + } + }, + "tickets":{ + "resource":{ + "id":false, + "url":"tickets?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/tickets.json?customer=123" + } + }, + "metafields":{ + "resource":{ + "id":false, + "url":"customers\/123\/metafields", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123\/metafields.json" + } + }, + "login":{ + "resource":{ + "id":false, + "url":"customers\/123\/login", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123\/login.json" + } + } + } +} \ No newline at end of file diff --git a/components/lightspeed_ecom_c_series/sources/new-invoice-created/new-invoice-created.mjs b/components/lightspeed_ecom_c_series/sources/new-invoice-created/new-invoice-created.mjs new file mode 100644 index 0000000000000..704e2edb89b95 --- /dev/null +++ b/components/lightspeed_ecom_c_series/sources/new-invoice-created/new-invoice-created.mjs @@ -0,0 +1,29 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "indiefunnels-new-invoice-created", + name: "New Invoice Created (Instant)", + description: "Emit new event when an invoice is created.", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getItemGroup() { + return "invoices"; + }, + getItemAction() { + return "created"; + }, + generateMeta(body) { + return { + id: body.invoice.id, + summary: this.getSummary(`Invoice with ID ${body.invoice.id} created`), + ts: Date.parse(body.invoice.createdAt), + }; + }, + }, + sampleEmit, +}; diff --git a/components/lightspeed_ecom_c_series/sources/new-invoice-created/test-event.mjs b/components/lightspeed_ecom_c_series/sources/new-invoice-created/test-event.mjs new file mode 100644 index 0000000000000..72136169ccf15 --- /dev/null +++ b/components/lightspeed_ecom_c_series/sources/new-invoice-created/test-event.mjs @@ -0,0 +1,52 @@ +export default { + "invoice":{ + "id":123, + "createdAt":"2025-09-17T20:04:13+00:00", + "updatedAt":"2025-09-17T20:04:13+00:00", + "number":"INV00001", + "status":"paid", + "isVatShifted":true, + "priceExcl":0, + "priceIncl":0, + "doNotifyNew":false, + "doNotifyPaid":false, + "invoice":false, + "isCreditNote":false, + "creditNote":false, + "order":{ + "resource":{ + "id":123, + "url":"orders\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123.json" + } + }, + "customer":{ + "resource":{ + "id":123, + "url":"customers\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123.json" + } + }, + "items":{ + "resource":{ + "id":false, + "url":"invoices\/123\/items", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices\/123\/items.json" + } + }, + "metafields":{ + "resource":{ + "id":false, + "url":"invoices\/123\/metafields", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices\/123\/metafields.json" + } + }, + "events":{ + "resource":{ + "id":false, + "url":"orders\/events?invoice=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/events.json?invoice=123" + } + } + } +} \ No newline at end of file diff --git a/components/lightspeed_ecom_c_series/sources/new-order-created/new-order-created.mjs b/components/lightspeed_ecom_c_series/sources/new-order-created/new-order-created.mjs new file mode 100644 index 0000000000000..2d8ffab0e5688 --- /dev/null +++ b/components/lightspeed_ecom_c_series/sources/new-order-created/new-order-created.mjs @@ -0,0 +1,29 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "indiefunnels-new-order-created", + name: "New Order Created (Instant)", + description: "Emit new event when a order is created.", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getItemGroup() { + return "orders"; + }, + getItemAction() { + return "created"; + }, + generateMeta(body) { + return { + id: body.order.id, + summary: this.getSummary(`Order with ID ${body.order.id} created`), + ts: Date.parse(body.order.createdAt), + }; + }, + }, + sampleEmit, +}; diff --git a/components/lightspeed_ecom_c_series/sources/new-order-created/test-event.mjs b/components/lightspeed_ecom_c_series/sources/new-order-created/test-event.mjs new file mode 100644 index 0000000000000..f7a58b4d03a85 --- /dev/null +++ b/components/lightspeed_ecom_c_series/sources/new-order-created/test-event.mjs @@ -0,0 +1,693 @@ +export default { + "order":{ + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "updatedAt":"2025-09-17T19:12:38+00:00", + "number":"ORD00002", + "status":"processing_awaiting_shipment", + "customStatusId":null, + "channel":"", + "remoteIp":"35.245.159.47", + "userAgent":"WebshopappApi", + "referralId":false, + "priceCost":0, + "priceExcl":0, + "priceIncl":0, + "weight":0, + "volume":0, + "colli":0, + "gender":"male", + "birthDate":"2006-09-19", + "nationalId":"", + "email":"customer@email.com", + "firstname":"John", + "middlename":"", + "lastname":"Doe", + "phone":"+1 111111111", + "mobile":"11111111111", + "newsletterSubscribed":false, + "isCompany":false, + "companyName":"", + "companyCoCNumber":"", + "companyVatNumber":"", + "addressBillingName":"John Doe", + "addressBillingStreet":"", + "addressBillingStreet2":"", + "addressBillingNumber":"", + "addressBillingExtension":"", + "addressBillingZipcode":"", + "addressBillingCity":"", + "addressBillingRegion":"", + "addressBillingCountry":{ + "id":226, + "code":"us", + "code3":"usa", + "title":"United States" + }, + "addressBillingRegionData":{ + "id":4204, + "name":"", + "code":"CA" + }, + "addressShippingCompany":false, + "addressShippingName":"John Doe", + "addressShippingStreet":"", + "addressShippingStreet2":"", + "addressShippingNumber":"", + "addressShippingExtension":"", + "addressShippingZipcode":"", + "addressShippingCity":"", + "addressShippingRegion":"", + "addressShippingCountry":{ + "id":226, + "code":"us", + "code3":"usa", + "title":"United States" + }, + "addressShippingRegionData":{ + "id":4204, + "name":"", + "code":"CA" + }, + "paymentId":"external", + "paymentStatus":"paid", + "paymentIsPost":false, + "paymentIsInvoiceExternal":false, + "paymentTaxRate":0, + "paymentTaxRates":[ + { + "name":"VAT", + "rate":0, + "amount":0 + } + ], + "paymentBasePriceExcl":0, + "paymentBasePriceIncl":0, + "paymentPriceExcl":0, + "paymentPriceIncl":0, + "paymentTitle":"Customer choice", + "paymentData":{ + "user_id":null + }, + "shipmentId":"core|85518|424529", + "shipmentStatus":"not_shipped", + "shipmentIsCashOnDelivery":false, + "shipmentIsPickup":false, + "shipmentTaxRate":0, + "shipmentTaxRates":[ + { + "name":"VAT", + "rate":0, + "amount":0 + } + ], + "shipmentBasePriceExcl":0, + "shipmentBasePriceIncl":0, + "shipmentPriceExcl":0, + "shipmentPriceIncl":0, + "shipmentDiscountExcl":0, + "shipmentDiscountIncl":0, + "shipmentTitle":"Shipment Title", + "shipmentData":{ + "method":"default", + "shipment_id":85518, + "shipping_value_id":424529 + }, + "shippingDate":null, + "deliveryDate":null, + "isDiscounted":false, + "discountType":"amount", + "discountAmount":0, + "discountPercentage":0, + "discountCouponCode":"", + "taxRates":[ + { + "name":"VAT", + "rate":0, + "amount":0 + } + ], + "isNewCustomer":false, + "comment":"", + "memo":"", + "allowNotifications":false, + "doNotifyNew":true, + "doNotifyReminder":false, + "doNotifyCancelled":false, + "language":{ + "id":3, + "code":"en", + "locale":"en_GB", + "title":"English" + }, + "customer":{ + "resource":{ + "id":13353882, + "url":"customers\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123.json", + "embedded":{ + "id":13353882, + "createdAt":"2025-09-16T20:17:55+00:00", + "updatedAt":"2025-09-17T19:12:38+00:00", + "isConfirmed":false, + "type":"registered", + "lastOnlineAt":"2025-09-17T19:12:38+00:00", + "remoteIp":"35.245.159.47", + "userAgent":"WebshopappApi", + "referralId":false, + "gender":"male", + "birthDate":"2006-09-19", + "nationalId":"", + "email":"customer@email.com", + "firstname":"John", + "middlename":"", + "lastname":"Doe", + "phone":"+1 111111111", + "mobile":"11111111111", + "isCompany":false, + "companyName":"", + "companyCoCNumber":"", + "companyVatNumber":"", + "addressBillingName":"John Doe", + "addressBillingStreet":"", + "addressBillingStreet2":"", + "addressBillingNumber":"", + "addressBillingExtension":"", + "addressBillingZipcode":"", + "addressBillingCity":"", + "addressBillingRegion":"", + "addressBillingCountry":{ + "id":226, + "code":"us", + "code3":"usa", + "title":"United States" + }, + "addressShippingCompany":false, + "addressShippingName":"John Doe", + "addressShippingStreet":"", + "addressShippingStreet2":"", + "addressShippingNumber":"", + "addressShippingExtension":"", + "addressShippingZipcode":"", + "addressShippingCity":"", + "addressShippingRegion":"", + "addressShippingCountry":{ + "id":226, + "code":"us", + "code3":"usa", + "title":"United States" + }, + "memo":null, + "doNotifyRegistered":false, + "doNotifyConfirmed":false, + "doNotifyPassword":false, + "groups":{ + "resource":{ + "id":false, + "url":"groups\/customers?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/groups\/customers.json?customer=123" + } + }, + "invoices":{ + "resource":{ + "id":false, + "url":"invoices?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices.json?customer=123" + } + }, + "language":{ + "id":3, + "code":"en", + "locale":"en_GB", + "title":"English" + }, + "orders":{ + "resource":{ + "id":false, + "url":"orders?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders.json?customer=123" + } + }, + "reviews":{ + "resource":{ + "id":false, + "url":"reviews?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/reviews.json?customer=123" + } + }, + "shipments":{ + "resource":{ + "id":false, + "url":"shipments?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/shipments.json?customer=123" + } + }, + "tickets":{ + "resource":{ + "id":false, + "url":"tickets?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/tickets.json?customer=123" + } + }, + "metafields":{ + "resource":{ + "id":false, + "url":"customers\/123\/metafields", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123\/metafields.json" + } + }, + "login":{ + "resource":{ + "id":false, + "url":"customers\/123\/login", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123\/login.json" + } + } + } + } + }, + "invoices":{ + "resource":{ + "id":false, + "url":"invoices?order=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices.json?order=123", + "embedded":[ + { + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "updatedAt":"2025-09-17T19:12:38+00:00", + "number":"INV00002", + "status":"paid", + "isVatShifted":true, + "priceExcl":0, + "priceIncl":0, + "doNotifyNew":false, + "doNotifyPaid":false, + "invoice":false, + "isCreditNote":false, + "creditNote":false, + "order":{ + "resource":{ + "id":123, + "url":"orders\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123.json" + } + }, + "customer":{ + "resource":{ + "id":123, + "url":"customers\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123.json" + } + }, + "items":{ + "resource":{ + "id":false, + "url":"invoices\/123\/items", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices\/123\/items.json" + } + }, + "metafields":{ + "resource":{ + "id":false, + "url":"invoices\/123\/metafields", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices\/123\/metafields.json" + } + }, + "events":{ + "resource":{ + "id":false, + "url":"orders\/events?invoice=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/events.json?invoice=123" + } + } + } + ] + } + }, + "shipments":{ + "resource":{ + "id":false, + "url":"shipments?order=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/shipments.json?order=123", + "embedded":[ + { + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "updatedAt":"2025-09-17T19:12:38+00:00", + "number":"SHIP00002", + "status":"not_shipped", + "trackingCode":"", + "doNotifyShipped":false, + "doNotifyReadyForPickup":false, + "doNotifyTrackingCode":false, + "customer":{ + "resource":{ + "id":123, + "url":"customers\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123.json" + } + }, + "order":{ + "resource":{ + "id":123, + "url":"orders\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123.json" + } + }, + "products":{ + "resource":{ + "id":false, + "url":"shipments\/123\/products", + "link":"http:\/\/api.shoplightspeed.com\/en\/shipments\/123\/products.json" + } + }, + "metafields":{ + "resource":{ + "id":false, + "url":"shipments\/123\/metafields", + "link":"http:\/\/api.shoplightspeed.com\/en\/shipments\/123\/metafields.json" + } + }, + "events":{ + "resource":{ + "id":false, + "url":"orders\/events?shipment=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/events.json?shipment=123" + } + } + } + ] + } + }, + "products":{ + "resource":{ + "id":false, + "url":"orders\/123\/products", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123\/products.json", + "embedded":[ + { + "id":123, + "supplierTitle":"", + "brandTitle":"Brand Title", + "productTitle":"Product Title", + "variantTitle":"", + "taxRate":0, + "taxRates":[ + { + "name":"VAT", + "rate":0, + "amount":0 + } + ], + "quantityOrdered":1, + "quantityInvoiced":1, + "quantityShipped":1, + "quantityRefunded":0, + "quantityReturned":0, + "articleCode":"", + "ean":"", + "sku":"", + "weight":null, + "volume":0, + "colli":0, + "sizeX":0, + "sizeY":0, + "sizeZ":0, + "priceCost":0, + "customExcl":0, + "customIncl":0, + "basePriceExcl":0, + "basePriceIncl":0, + "priceExcl":0, + "priceIncl":0, + "discountExcl":0, + "discountIncl":0, + "customFields":false, + "product":{ + "resource":{ + "id":123, + "url":"products\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/products\/123.json" + } + }, + "variant":{ + "resource":{ + "id":123, + "url":"variants\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/variants\/123.json" + } + } + } + ] + } + }, + "metafields":{ + "resource":{ + "id":false, + "url":"orders\/123\/metafields", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123\/metafields.json", + "embedded":[ + + ] + } + }, + "quote":{ + "resource":{ + "id":123, + "url":"quotes\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/quotes\/123.json", + "embedded":{ + "id":123, + "createdAt":"2025-09-17T19:12:04+00:00", + "updatedAt":"2025-09-17T19:12:38+00:00", + "recalculatedAt":"2025-09-17T19:12:38+00:00", + "isLocked":false, + "channel":"backend", + "recoveryHash":"4ec74f67f981bf925decaaa123", + "remoteIp":"35.245.159.47", + "userAgent":"WebshopappApi", + "referralId":false, + "weight":0, + "volume":0, + "colli":0, + "paymentCountry":{ + "id":226, + "code":"us", + "code3":"usa", + "title":"United States" + }, + "shipmentCountry":{ + "id":226, + "code":"us", + "code3":"usa", + "title":"United States" + }, + "shipmentZipcode":"19111", + "shipmentSameAddress":true, + "priceCost":0, + "priceExcl":0, + "priceIncl":0, + "discountExcl":0, + "discountIncl":0, + "productsCount":1, + "productsQuantity":1, + "shipmentIsSet":true, + "shipmentId":"core|85518|424529", + "shipmentIsVirtual":false, + "shipmentIsCashOnDelivery":false, + "shipmentDiscountPercentage":0, + "shipmentIsServicePoint":false, + "shipmentIsPickup":false, + "shipmentTaxRate":0, + "shipmentBasePriceExcl":0, + "shipmentBasePriceIncl":0, + "shipmentPriceTax":0, + "shipmentPriceExcl":0, + "shipmentPriceIncl":0, + "shipmentDiscountExcl":0, + "shipmentDiscountIncl":0, + "shipmentTitle":"Shipment Title", + "shipmentData":{ + "method":"default", + "shipment_id":85518, + "shipping_value_id":424529 + }, + "paymentIsSet":true, + "paymentId":"external", + "paymentIsPost":false, + "paymentIsInvoiceExternal":false, + "paymentData":"{\"user_id\":null}", + "paymentTaxRate":0, + "paymentBasePriceExcl":0, + "paymentBasePriceIncl":0, + "paymentPriceTax":0, + "paymentPriceExcl":0, + "paymentPriceIncl":0, + "additionalCostIncl":"0.0000", + "additionalCostExcl":"0.0000", + "paymentTitle":"Customer choice", + "discountIsSet":false, + "discountId":0, + "discountType":"amount", + "discountAmount":0, + "discountPercentage":0, + "discountShipment":"default", + "discountMinimumAmount":"0.00", + "discountCouponCode":"", + "comment":"", + "allowNotifications":false, + "customer":{ + "resource":{ + "id":123, + "url":"customers\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123.json" + } + }, + "language":{ + "id":3, + "code":"en", + "locale":"en_GB", + "title":"English" + }, + "products":{ + "resource":{ + "id":false, + "url":"quotes\/123\/products", + "link":"http:\/\/api.shoplightspeed.com\/en\/quotes\/123\/products.json" + } + }, + "shippingmethods":{ + "resource":{ + "id":false, + "url":"quotes\/123\/shippingmethods", + "link":"http:\/\/api.shoplightspeed.com\/en\/quotes\/123\/shippingmethods.json" + } + }, + "paymentmethods":{ + "resource":{ + "id":false, + "url":"quotes\/123\/paymentmethods", + "link":"http:\/\/api.shoplightspeed.com\/en\/quotes\/123\/paymentmethods.json" + } + } + } + } + }, + "events":{ + "resource":{ + "id":false, + "url":"orders\/events?order=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/events.json?order=123", + "embedded":[ + { + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "channel":"manual", + "type":"order", + "message":"new", + "comment":null, + "order":{ + "resource":{ + "id":123, + "url":"orders\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123.json" + } + }, + "invoice":false, + "shipment":false + }, + { + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "channel":"auto", + "type":"invoice", + "message":"new", + "comment":null, + "order":{ + "resource":{ + "id":123, + "url":"orders\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123.json" + } + }, + "invoice":{ + "resource":{ + "id":123, + "url":"invoices\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices\/123.json" + } + }, + "shipment":false + }, + { + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "channel":"auto", + "type":"shipment", + "message":"new", + "comment":null, + "order":{ + "resource":{ + "id":123, + "url":"orders\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123.json" + } + }, + "invoice":false, + "shipment":{ + "resource":{ + "id":123, + "url":"shipments\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/shipments\/123.json" + } + } + }, + { + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "channel":"auto", + "type":"invoice", + "message":"paid", + "comment":null, + "order":{ + "resource":{ + "id":123, + "url":"orders\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123.json" + } + }, + "invoice":{ + "resource":{ + "id":123, + "url":"invoices\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices\/123.json" + } + }, + "shipment":false + }, + { + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "channel":"auto", + "type":"order", + "message":"paid", + "comment":"Total = 0", + "order":{ + "resource":{ + "id":123, + "url":"orders\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123.json" + } + }, + "invoice":false, + "shipment":false + } + ] + } + }, + "giftCardsPayment":[ + + ] + } +} \ No newline at end of file diff --git a/components/lightspeed_ecom_c_series/sources/new-product-created/new-product-created.mjs b/components/lightspeed_ecom_c_series/sources/new-product-created/new-product-created.mjs new file mode 100644 index 0000000000000..b2824678146ce --- /dev/null +++ b/components/lightspeed_ecom_c_series/sources/new-product-created/new-product-created.mjs @@ -0,0 +1,29 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "indiefunnels-new-product-created", + name: "New Product Created (Instant)", + description: "Emit new event when a product is created.", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getItemGroup() { + return "products"; + }, + getItemAction() { + return "created"; + }, + generateMeta(body) { + return { + id: body.product.id, + summary: this.getSummary(`Product with ID ${body.product.id} created`), + ts: Date.parse(body.product.createdAt), + }; + }, + }, + sampleEmit, +}; diff --git a/components/lightspeed_ecom_c_series/sources/new-product-created/test-event.mjs b/components/lightspeed_ecom_c_series/sources/new-product-created/test-event.mjs new file mode 100644 index 0000000000000..e6931a4b37762 --- /dev/null +++ b/components/lightspeed_ecom_c_series/sources/new-product-created/test-event.mjs @@ -0,0 +1,90 @@ +export default { + "product":{ + "id":123, + "createdAt":"2025-09-17T20:25:55+00:00", + "updatedAt":"2025-09-17T20:25:55+00:00", + "isVisible":true, + "visibility":"visible", + "hasMatrix":false, + "data01":"", + "data02":"", + "data03":"", + "url":"product-test", + "title":"product test", + "fulltitle":"product test", + "description":"", + "content":"", + "set":false, + "brand":{ + "resource":{ + "id":123, + "url":"brands\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/brands\/123.json" + } + }, + "categories":{ + "resource":{ + "id":false, + "url":"categories\/products?product=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/categories\/products.json?product=123" + } + }, + "deliverydate":false, + "image":false, + "images":false, + "relations":{ + "resource":{ + "id":false, + "url":"products\/123\/relations", + "link":"http:\/\/api.shoplightspeed.com\/en\/products\/123\/relations.json" + } + }, + "metafields":{ + "resource":{ + "id":false, + "url":"products\/123\/metafields", + "link":"http:\/\/api.shoplightspeed.com\/en\/products\/123\/metafields.json" + } + }, + "reviews":{ + "resource":{ + "id":false, + "url":"reviews?product=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/reviews.json?product=123" + } + }, + "type":false, + "attributes":{ + "resource":{ + "id":false, + "url":"products\/123\/attributes", + "link":"http:\/\/api.shoplightspeed.com\/en\/products\/123\/attributes.json" + } + }, + "supplier":false, + "tags":{ + "resource":{ + "id":false, + "url":"tags\/products?product=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/tags\/products.json?product=123" + } + }, + "variants":{ + "resource":{ + "id":false, + "url":"variants?product=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/variants.json?product=123" + } + }, + "movements":{ + "resource":{ + "id":false, + "url":"variants\/movements?product=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/variants\/movements.json?product=123" + } + }, + "templateDataFields":[ + + ] + } +} \ No newline at end of file diff --git a/components/lightspeed_ecom_c_series/sources/order-shipped/order-shipped.mjs b/components/lightspeed_ecom_c_series/sources/order-shipped/order-shipped.mjs new file mode 100644 index 0000000000000..995c59666c90a --- /dev/null +++ b/components/lightspeed_ecom_c_series/sources/order-shipped/order-shipped.mjs @@ -0,0 +1,29 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "indiefunnels-order-shipped", + name: "Order Shipped (Instant)", + description: "Emit new event when a order is shipped.", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getItemGroup() { + return "orders"; + }, + getItemAction() { + return "shipped"; + }, + generateMeta(body) { + return { + id: body.order.id, + summary: this.getSummary(`Order with ID ${body.order.id} shipped`), + ts: Date.parse(body.order.updatedAt), + }; + }, + }, + sampleEmit, +}; diff --git a/components/lightspeed_ecom_c_series/sources/order-shipped/test-event.mjs b/components/lightspeed_ecom_c_series/sources/order-shipped/test-event.mjs new file mode 100644 index 0000000000000..f6863ed616269 --- /dev/null +++ b/components/lightspeed_ecom_c_series/sources/order-shipped/test-event.mjs @@ -0,0 +1,693 @@ +export default { + "order":{ + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "updatedAt":"2025-09-17T19:12:38+00:00", + "number":"ORD00002", + "status":"completed_shipped", + "customStatusId":null, + "channel":"", + "remoteIp":"35.245.159.47", + "userAgent":"WebshopappApi", + "referralId":false, + "priceCost":0, + "priceExcl":0, + "priceIncl":0, + "weight":0, + "volume":0, + "colli":0, + "gender":"male", + "birthDate":"2006-09-19", + "nationalId":"", + "email":"customer@email.com", + "firstname":"John", + "middlename":"", + "lastname":"Doe", + "phone":"+1 111111111", + "mobile":"11111111111", + "newsletterSubscribed":false, + "isCompany":false, + "companyName":"", + "companyCoCNumber":"", + "companyVatNumber":"", + "addressBillingName":"John Doe", + "addressBillingStreet":"", + "addressBillingStreet2":"", + "addressBillingNumber":"", + "addressBillingExtension":"", + "addressBillingZipcode":"", + "addressBillingCity":"", + "addressBillingRegion":"", + "addressBillingCountry":{ + "id":226, + "code":"us", + "code3":"usa", + "title":"United States" + }, + "addressBillingRegionData":{ + "id":4204, + "name":"", + "code":"CA" + }, + "addressShippingCompany":false, + "addressShippingName":"John Doe", + "addressShippingStreet":"", + "addressShippingStreet2":"", + "addressShippingNumber":"", + "addressShippingExtension":"", + "addressShippingZipcode":"", + "addressShippingCity":"", + "addressShippingRegion":"", + "addressShippingCountry":{ + "id":226, + "code":"us", + "code3":"usa", + "title":"United States" + }, + "addressShippingRegionData":{ + "id":4204, + "name":"", + "code":"CA" + }, + "paymentId":"external", + "paymentStatus":"paid", + "paymentIsPost":false, + "paymentIsInvoiceExternal":false, + "paymentTaxRate":0, + "paymentTaxRates":[ + { + "name":"VAT", + "rate":0, + "amount":0 + } + ], + "paymentBasePriceExcl":0, + "paymentBasePriceIncl":0, + "paymentPriceExcl":0, + "paymentPriceIncl":0, + "paymentTitle":"Customer choice", + "paymentData":{ + "user_id":null + }, + "shipmentId":"core|85518|424529", + "shipmentStatus":"not_shipped", + "shipmentIsCashOnDelivery":false, + "shipmentIsPickup":false, + "shipmentTaxRate":0, + "shipmentTaxRates":[ + { + "name":"VAT", + "rate":0, + "amount":0 + } + ], + "shipmentBasePriceExcl":0, + "shipmentBasePriceIncl":0, + "shipmentPriceExcl":0, + "shipmentPriceIncl":0, + "shipmentDiscountExcl":0, + "shipmentDiscountIncl":0, + "shipmentTitle":"Shipment Title", + "shipmentData":{ + "method":"default", + "shipment_id":85518, + "shipping_value_id":424529 + }, + "shippingDate":null, + "deliveryDate":null, + "isDiscounted":false, + "discountType":"amount", + "discountAmount":0, + "discountPercentage":0, + "discountCouponCode":"", + "taxRates":[ + { + "name":"VAT", + "rate":0, + "amount":0 + } + ], + "isNewCustomer":false, + "comment":"", + "memo":"", + "allowNotifications":false, + "doNotifyNew":true, + "doNotifyReminder":false, + "doNotifyCancelled":false, + "language":{ + "id":3, + "code":"en", + "locale":"en_GB", + "title":"English" + }, + "customer":{ + "resource":{ + "id":13353882, + "url":"customers\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123.json", + "embedded":{ + "id":13353882, + "createdAt":"2025-09-16T20:17:55+00:00", + "updatedAt":"2025-09-17T19:12:38+00:00", + "isConfirmed":false, + "type":"registered", + "lastOnlineAt":"2025-09-17T19:12:38+00:00", + "remoteIp":"35.245.159.47", + "userAgent":"WebshopappApi", + "referralId":false, + "gender":"male", + "birthDate":"2006-09-19", + "nationalId":"", + "email":"customer@email.com", + "firstname":"John", + "middlename":"", + "lastname":"Doe", + "phone":"+1 111111111", + "mobile":"11111111111", + "isCompany":false, + "companyName":"", + "companyCoCNumber":"", + "companyVatNumber":"", + "addressBillingName":"John Doe", + "addressBillingStreet":"", + "addressBillingStreet2":"", + "addressBillingNumber":"", + "addressBillingExtension":"", + "addressBillingZipcode":"", + "addressBillingCity":"", + "addressBillingRegion":"", + "addressBillingCountry":{ + "id":226, + "code":"us", + "code3":"usa", + "title":"United States" + }, + "addressShippingCompany":false, + "addressShippingName":"John Doe", + "addressShippingStreet":"", + "addressShippingStreet2":"", + "addressShippingNumber":"", + "addressShippingExtension":"", + "addressShippingZipcode":"", + "addressShippingCity":"", + "addressShippingRegion":"", + "addressShippingCountry":{ + "id":226, + "code":"us", + "code3":"usa", + "title":"United States" + }, + "memo":null, + "doNotifyRegistered":false, + "doNotifyConfirmed":false, + "doNotifyPassword":false, + "groups":{ + "resource":{ + "id":false, + "url":"groups\/customers?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/groups\/customers.json?customer=123" + } + }, + "invoices":{ + "resource":{ + "id":false, + "url":"invoices?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices.json?customer=123" + } + }, + "language":{ + "id":3, + "code":"en", + "locale":"en_GB", + "title":"English" + }, + "orders":{ + "resource":{ + "id":false, + "url":"orders?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders.json?customer=123" + } + }, + "reviews":{ + "resource":{ + "id":false, + "url":"reviews?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/reviews.json?customer=123" + } + }, + "shipments":{ + "resource":{ + "id":false, + "url":"shipments?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/shipments.json?customer=123" + } + }, + "tickets":{ + "resource":{ + "id":false, + "url":"tickets?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/tickets.json?customer=123" + } + }, + "metafields":{ + "resource":{ + "id":false, + "url":"customers\/123\/metafields", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123\/metafields.json" + } + }, + "login":{ + "resource":{ + "id":false, + "url":"customers\/123\/login", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123\/login.json" + } + } + } + } + }, + "invoices":{ + "resource":{ + "id":false, + "url":"invoices?order=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices.json?order=123", + "embedded":[ + { + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "updatedAt":"2025-09-17T19:12:38+00:00", + "number":"INV00002", + "status":"paid", + "isVatShifted":true, + "priceExcl":0, + "priceIncl":0, + "doNotifyNew":false, + "doNotifyPaid":false, + "invoice":false, + "isCreditNote":false, + "creditNote":false, + "order":{ + "resource":{ + "id":123, + "url":"orders\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123.json" + } + }, + "customer":{ + "resource":{ + "id":123, + "url":"customers\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123.json" + } + }, + "items":{ + "resource":{ + "id":false, + "url":"invoices\/123\/items", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices\/123\/items.json" + } + }, + "metafields":{ + "resource":{ + "id":false, + "url":"invoices\/123\/metafields", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices\/123\/metafields.json" + } + }, + "events":{ + "resource":{ + "id":false, + "url":"orders\/events?invoice=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/events.json?invoice=123" + } + } + } + ] + } + }, + "shipments":{ + "resource":{ + "id":false, + "url":"shipments?order=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/shipments.json?order=123", + "embedded":[ + { + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "updatedAt":"2025-09-17T19:12:38+00:00", + "number":"SHIP00002", + "status":"not_shipped", + "trackingCode":"", + "doNotifyShipped":false, + "doNotifyReadyForPickup":false, + "doNotifyTrackingCode":false, + "customer":{ + "resource":{ + "id":123, + "url":"customers\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123.json" + } + }, + "order":{ + "resource":{ + "id":123, + "url":"orders\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123.json" + } + }, + "products":{ + "resource":{ + "id":false, + "url":"shipments\/123\/products", + "link":"http:\/\/api.shoplightspeed.com\/en\/shipments\/123\/products.json" + } + }, + "metafields":{ + "resource":{ + "id":false, + "url":"shipments\/123\/metafields", + "link":"http:\/\/api.shoplightspeed.com\/en\/shipments\/123\/metafields.json" + } + }, + "events":{ + "resource":{ + "id":false, + "url":"orders\/events?shipment=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/events.json?shipment=123" + } + } + } + ] + } + }, + "products":{ + "resource":{ + "id":false, + "url":"orders\/123\/products", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123\/products.json", + "embedded":[ + { + "id":123, + "supplierTitle":"", + "brandTitle":"Brand Title", + "productTitle":"Product Title", + "variantTitle":"", + "taxRate":0, + "taxRates":[ + { + "name":"VAT", + "rate":0, + "amount":0 + } + ], + "quantityOrdered":1, + "quantityInvoiced":1, + "quantityShipped":1, + "quantityRefunded":0, + "quantityReturned":0, + "articleCode":"", + "ean":"", + "sku":"", + "weight":null, + "volume":0, + "colli":0, + "sizeX":0, + "sizeY":0, + "sizeZ":0, + "priceCost":0, + "customExcl":0, + "customIncl":0, + "basePriceExcl":0, + "basePriceIncl":0, + "priceExcl":0, + "priceIncl":0, + "discountExcl":0, + "discountIncl":0, + "customFields":false, + "product":{ + "resource":{ + "id":123, + "url":"products\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/products\/123.json" + } + }, + "variant":{ + "resource":{ + "id":123, + "url":"variants\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/variants\/123.json" + } + } + } + ] + } + }, + "metafields":{ + "resource":{ + "id":false, + "url":"orders\/123\/metafields", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123\/metafields.json", + "embedded":[ + + ] + } + }, + "quote":{ + "resource":{ + "id":123, + "url":"quotes\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/quotes\/123.json", + "embedded":{ + "id":123, + "createdAt":"2025-09-17T19:12:04+00:00", + "updatedAt":"2025-09-17T19:12:38+00:00", + "recalculatedAt":"2025-09-17T19:12:38+00:00", + "isLocked":false, + "channel":"backend", + "recoveryHash":"4ec74f67f981bf925decaaa123", + "remoteIp":"35.245.159.47", + "userAgent":"WebshopappApi", + "referralId":false, + "weight":0, + "volume":0, + "colli":0, + "paymentCountry":{ + "id":226, + "code":"us", + "code3":"usa", + "title":"United States" + }, + "shipmentCountry":{ + "id":226, + "code":"us", + "code3":"usa", + "title":"United States" + }, + "shipmentZipcode":"19111", + "shipmentSameAddress":true, + "priceCost":0, + "priceExcl":0, + "priceIncl":0, + "discountExcl":0, + "discountIncl":0, + "productsCount":1, + "productsQuantity":1, + "shipmentIsSet":true, + "shipmentId":"core|85518|424529", + "shipmentIsVirtual":false, + "shipmentIsCashOnDelivery":false, + "shipmentDiscountPercentage":0, + "shipmentIsServicePoint":false, + "shipmentIsPickup":false, + "shipmentTaxRate":0, + "shipmentBasePriceExcl":0, + "shipmentBasePriceIncl":0, + "shipmentPriceTax":0, + "shipmentPriceExcl":0, + "shipmentPriceIncl":0, + "shipmentDiscountExcl":0, + "shipmentDiscountIncl":0, + "shipmentTitle":"Shipment Title", + "shipmentData":{ + "method":"default", + "shipment_id":85518, + "shipping_value_id":424529 + }, + "paymentIsSet":true, + "paymentId":"external", + "paymentIsPost":false, + "paymentIsInvoiceExternal":false, + "paymentData":"{\"user_id\":null}", + "paymentTaxRate":0, + "paymentBasePriceExcl":0, + "paymentBasePriceIncl":0, + "paymentPriceTax":0, + "paymentPriceExcl":0, + "paymentPriceIncl":0, + "additionalCostIncl":"0.0000", + "additionalCostExcl":"0.0000", + "paymentTitle":"Customer choice", + "discountIsSet":false, + "discountId":0, + "discountType":"amount", + "discountAmount":0, + "discountPercentage":0, + "discountShipment":"default", + "discountMinimumAmount":"0.00", + "discountCouponCode":"", + "comment":"", + "allowNotifications":false, + "customer":{ + "resource":{ + "id":123, + "url":"customers\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123.json" + } + }, + "language":{ + "id":3, + "code":"en", + "locale":"en_GB", + "title":"English" + }, + "products":{ + "resource":{ + "id":false, + "url":"quotes\/123\/products", + "link":"http:\/\/api.shoplightspeed.com\/en\/quotes\/123\/products.json" + } + }, + "shippingmethods":{ + "resource":{ + "id":false, + "url":"quotes\/123\/shippingmethods", + "link":"http:\/\/api.shoplightspeed.com\/en\/quotes\/123\/shippingmethods.json" + } + }, + "paymentmethods":{ + "resource":{ + "id":false, + "url":"quotes\/123\/paymentmethods", + "link":"http:\/\/api.shoplightspeed.com\/en\/quotes\/123\/paymentmethods.json" + } + } + } + } + }, + "events":{ + "resource":{ + "id":false, + "url":"orders\/events?order=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/events.json?order=123", + "embedded":[ + { + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "channel":"manual", + "type":"order", + "message":"new", + "comment":null, + "order":{ + "resource":{ + "id":123, + "url":"orders\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123.json" + } + }, + "invoice":false, + "shipment":false + }, + { + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "channel":"auto", + "type":"invoice", + "message":"new", + "comment":null, + "order":{ + "resource":{ + "id":123, + "url":"orders\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123.json" + } + }, + "invoice":{ + "resource":{ + "id":123, + "url":"invoices\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices\/123.json" + } + }, + "shipment":false + }, + { + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "channel":"auto", + "type":"shipment", + "message":"new", + "comment":null, + "order":{ + "resource":{ + "id":123, + "url":"orders\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123.json" + } + }, + "invoice":false, + "shipment":{ + "resource":{ + "id":123, + "url":"shipments\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/shipments\/123.json" + } + } + }, + { + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "channel":"auto", + "type":"invoice", + "message":"paid", + "comment":null, + "order":{ + "resource":{ + "id":123, + "url":"orders\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123.json" + } + }, + "invoice":{ + "resource":{ + "id":123, + "url":"invoices\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices\/123.json" + } + }, + "shipment":false + }, + { + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "channel":"auto", + "type":"order", + "message":"paid", + "comment":"Total = 0", + "order":{ + "resource":{ + "id":123, + "url":"orders\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123.json" + } + }, + "invoice":false, + "shipment":false + } + ] + } + }, + "giftCardsPayment":[ + + ] + } +} \ No newline at end of file diff --git a/components/lightspeed_ecom_c_series/sources/order-updated/order-updated.mjs b/components/lightspeed_ecom_c_series/sources/order-updated/order-updated.mjs new file mode 100644 index 0000000000000..28f7608dd2725 --- /dev/null +++ b/components/lightspeed_ecom_c_series/sources/order-updated/order-updated.mjs @@ -0,0 +1,29 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "indiefunnels-order-updated", + name: "Order Updated (Instant)", + description: "Emit new event when a order is updated.", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getItemGroup() { + return "orders"; + }, + getItemAction() { + return "updated"; + }, + generateMeta(body) { + return { + id: body.order.id, + summary: this.getSummary(`Order with ID ${body.order.id} updated`), + ts: Date.parse(body.order.updatedAt), + }; + }, + }, + sampleEmit, +}; diff --git a/components/lightspeed_ecom_c_series/sources/order-updated/test-event.mjs b/components/lightspeed_ecom_c_series/sources/order-updated/test-event.mjs new file mode 100644 index 0000000000000..6ec527cd6e642 --- /dev/null +++ b/components/lightspeed_ecom_c_series/sources/order-updated/test-event.mjs @@ -0,0 +1,693 @@ +export default { + "order":{ + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "updatedAt":"2025-09-17T19:20:56+00:00", + "number":"ORD00002", + "status":"completed_shipped", + "customStatusId":null, + "channel":"", + "remoteIp":"35.245.159.47", + "userAgent":"WebshopappApi", + "referralId":false, + "priceCost":0, + "priceExcl":0, + "priceIncl":0, + "weight":0, + "volume":0, + "colli":0, + "gender":"male", + "birthDate":"2006-09-19", + "nationalId":"", + "email":"customer@email.com", + "firstname":"John", + "middlename":"", + "lastname":"Doe", + "phone":"+1 111111111", + "mobile":"11111111111", + "newsletterSubscribed":false, + "isCompany":false, + "companyName":"", + "companyCoCNumber":"", + "companyVatNumber":"", + "addressBillingName":"John Doe", + "addressBillingStreet":"", + "addressBillingStreet2":"", + "addressBillingNumber":"", + "addressBillingExtension":"", + "addressBillingZipcode":"", + "addressBillingCity":"", + "addressBillingRegion":"", + "addressBillingCountry":{ + "id":226, + "code":"us", + "code3":"usa", + "title":"United States" + }, + "addressBillingRegionData":{ + "id":4204, + "name":"", + "code":"CA" + }, + "addressShippingCompany":false, + "addressShippingName":"John Doe", + "addressShippingStreet":"", + "addressShippingStreet2":"", + "addressShippingNumber":"", + "addressShippingExtension":"", + "addressShippingZipcode":"", + "addressShippingCity":"", + "addressShippingRegion":"", + "addressShippingCountry":{ + "id":226, + "code":"us", + "code3":"usa", + "title":"United States" + }, + "addressShippingRegionData":{ + "id":4204, + "name":"", + "code":"CA" + }, + "paymentId":"external", + "paymentStatus":"paid", + "paymentIsPost":false, + "paymentIsInvoiceExternal":false, + "paymentTaxRate":0, + "paymentTaxRates":[ + { + "name":"VAT", + "rate":0, + "amount":0 + } + ], + "paymentBasePriceExcl":0, + "paymentBasePriceIncl":0, + "paymentPriceExcl":0, + "paymentPriceIncl":0, + "paymentTitle":"Customer choice", + "paymentData":{ + "user_id":null + }, + "shipmentId":"core|85518|424529", + "shipmentStatus":"not_shipped", + "shipmentIsCashOnDelivery":false, + "shipmentIsPickup":false, + "shipmentTaxRate":0, + "shipmentTaxRates":[ + { + "name":"VAT", + "rate":0, + "amount":0 + } + ], + "shipmentBasePriceExcl":0, + "shipmentBasePriceIncl":0, + "shipmentPriceExcl":0, + "shipmentPriceIncl":0, + "shipmentDiscountExcl":0, + "shipmentDiscountIncl":0, + "shipmentTitle":"Shipment Title", + "shipmentData":{ + "method":"default", + "shipment_id":85518, + "shipping_value_id":424529 + }, + "shippingDate":null, + "deliveryDate":null, + "isDiscounted":false, + "discountType":"amount", + "discountAmount":0, + "discountPercentage":0, + "discountCouponCode":"", + "taxRates":[ + { + "name":"VAT", + "rate":0, + "amount":0 + } + ], + "isNewCustomer":false, + "comment":"", + "memo":"", + "allowNotifications":false, + "doNotifyNew":true, + "doNotifyReminder":false, + "doNotifyCancelled":false, + "language":{ + "id":3, + "code":"en", + "locale":"en_GB", + "title":"English" + }, + "customer":{ + "resource":{ + "id":13353882, + "url":"customers\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123.json", + "embedded":{ + "id":13353882, + "createdAt":"2025-09-16T20:17:55+00:00", + "updatedAt":"2025-09-17T19:12:38+00:00", + "isConfirmed":false, + "type":"registered", + "lastOnlineAt":"2025-09-17T19:12:38+00:00", + "remoteIp":"35.245.159.47", + "userAgent":"WebshopappApi", + "referralId":false, + "gender":"male", + "birthDate":"2006-09-19", + "nationalId":"", + "email":"customer@email.com", + "firstname":"John", + "middlename":"", + "lastname":"Doe", + "phone":"+1 111111111", + "mobile":"11111111111", + "isCompany":false, + "companyName":"", + "companyCoCNumber":"", + "companyVatNumber":"", + "addressBillingName":"John Doe", + "addressBillingStreet":"", + "addressBillingStreet2":"", + "addressBillingNumber":"", + "addressBillingExtension":"", + "addressBillingZipcode":"", + "addressBillingCity":"", + "addressBillingRegion":"", + "addressBillingCountry":{ + "id":226, + "code":"us", + "code3":"usa", + "title":"United States" + }, + "addressShippingCompany":false, + "addressShippingName":"John Doe", + "addressShippingStreet":"", + "addressShippingStreet2":"", + "addressShippingNumber":"", + "addressShippingExtension":"", + "addressShippingZipcode":"", + "addressShippingCity":"", + "addressShippingRegion":"", + "addressShippingCountry":{ + "id":226, + "code":"us", + "code3":"usa", + "title":"United States" + }, + "memo":null, + "doNotifyRegistered":false, + "doNotifyConfirmed":false, + "doNotifyPassword":false, + "groups":{ + "resource":{ + "id":false, + "url":"groups\/customers?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/groups\/customers.json?customer=123" + } + }, + "invoices":{ + "resource":{ + "id":false, + "url":"invoices?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices.json?customer=123" + } + }, + "language":{ + "id":3, + "code":"en", + "locale":"en_GB", + "title":"English" + }, + "orders":{ + "resource":{ + "id":false, + "url":"orders?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders.json?customer=123" + } + }, + "reviews":{ + "resource":{ + "id":false, + "url":"reviews?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/reviews.json?customer=123" + } + }, + "shipments":{ + "resource":{ + "id":false, + "url":"shipments?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/shipments.json?customer=123" + } + }, + "tickets":{ + "resource":{ + "id":false, + "url":"tickets?customer=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/tickets.json?customer=123" + } + }, + "metafields":{ + "resource":{ + "id":false, + "url":"customers\/123\/metafields", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123\/metafields.json" + } + }, + "login":{ + "resource":{ + "id":false, + "url":"customers\/123\/login", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123\/login.json" + } + } + } + } + }, + "invoices":{ + "resource":{ + "id":false, + "url":"invoices?order=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices.json?order=123", + "embedded":[ + { + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "updatedAt":"2025-09-17T19:12:38+00:00", + "number":"INV00002", + "status":"paid", + "isVatShifted":true, + "priceExcl":0, + "priceIncl":0, + "doNotifyNew":false, + "doNotifyPaid":false, + "invoice":false, + "isCreditNote":false, + "creditNote":false, + "order":{ + "resource":{ + "id":123, + "url":"orders\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123.json" + } + }, + "customer":{ + "resource":{ + "id":123, + "url":"customers\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123.json" + } + }, + "items":{ + "resource":{ + "id":false, + "url":"invoices\/123\/items", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices\/123\/items.json" + } + }, + "metafields":{ + "resource":{ + "id":false, + "url":"invoices\/123\/metafields", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices\/123\/metafields.json" + } + }, + "events":{ + "resource":{ + "id":false, + "url":"orders\/events?invoice=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/events.json?invoice=123" + } + } + } + ] + } + }, + "shipments":{ + "resource":{ + "id":false, + "url":"shipments?order=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/shipments.json?order=123", + "embedded":[ + { + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "updatedAt":"2025-09-17T19:12:38+00:00", + "number":"SHIP00002", + "status":"not_shipped", + "trackingCode":"", + "doNotifyShipped":false, + "doNotifyReadyForPickup":false, + "doNotifyTrackingCode":false, + "customer":{ + "resource":{ + "id":123, + "url":"customers\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123.json" + } + }, + "order":{ + "resource":{ + "id":123, + "url":"orders\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123.json" + } + }, + "products":{ + "resource":{ + "id":false, + "url":"shipments\/123\/products", + "link":"http:\/\/api.shoplightspeed.com\/en\/shipments\/123\/products.json" + } + }, + "metafields":{ + "resource":{ + "id":false, + "url":"shipments\/123\/metafields", + "link":"http:\/\/api.shoplightspeed.com\/en\/shipments\/123\/metafields.json" + } + }, + "events":{ + "resource":{ + "id":false, + "url":"orders\/events?shipment=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/events.json?shipment=123" + } + } + } + ] + } + }, + "products":{ + "resource":{ + "id":false, + "url":"orders\/123\/products", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123\/products.json", + "embedded":[ + { + "id":123, + "supplierTitle":"", + "brandTitle":"Brand Title", + "productTitle":"Product Title", + "variantTitle":"", + "taxRate":0, + "taxRates":[ + { + "name":"VAT", + "rate":0, + "amount":0 + } + ], + "quantityOrdered":1, + "quantityInvoiced":1, + "quantityShipped":1, + "quantityRefunded":0, + "quantityReturned":0, + "articleCode":"", + "ean":"", + "sku":"", + "weight":null, + "volume":0, + "colli":0, + "sizeX":0, + "sizeY":0, + "sizeZ":0, + "priceCost":0, + "customExcl":0, + "customIncl":0, + "basePriceExcl":0, + "basePriceIncl":0, + "priceExcl":0, + "priceIncl":0, + "discountExcl":0, + "discountIncl":0, + "customFields":false, + "product":{ + "resource":{ + "id":123, + "url":"products\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/products\/123.json" + } + }, + "variant":{ + "resource":{ + "id":123, + "url":"variants\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/variants\/123.json" + } + } + } + ] + } + }, + "metafields":{ + "resource":{ + "id":false, + "url":"orders\/123\/metafields", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123\/metafields.json", + "embedded":[ + + ] + } + }, + "quote":{ + "resource":{ + "id":123, + "url":"quotes\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/quotes\/123.json", + "embedded":{ + "id":123, + "createdAt":"2025-09-17T19:12:04+00:00", + "updatedAt":"2025-09-17T19:12:38+00:00", + "recalculatedAt":"2025-09-17T19:12:38+00:00", + "isLocked":false, + "channel":"backend", + "recoveryHash":"4ec74f67f981bf925decaaa123", + "remoteIp":"35.245.159.47", + "userAgent":"WebshopappApi", + "referralId":false, + "weight":0, + "volume":0, + "colli":0, + "paymentCountry":{ + "id":226, + "code":"us", + "code3":"usa", + "title":"United States" + }, + "shipmentCountry":{ + "id":226, + "code":"us", + "code3":"usa", + "title":"United States" + }, + "shipmentZipcode":"19111", + "shipmentSameAddress":true, + "priceCost":0, + "priceExcl":0, + "priceIncl":0, + "discountExcl":0, + "discountIncl":0, + "productsCount":1, + "productsQuantity":1, + "shipmentIsSet":true, + "shipmentId":"core|85518|424529", + "shipmentIsVirtual":false, + "shipmentIsCashOnDelivery":false, + "shipmentDiscountPercentage":0, + "shipmentIsServicePoint":false, + "shipmentIsPickup":false, + "shipmentTaxRate":0, + "shipmentBasePriceExcl":0, + "shipmentBasePriceIncl":0, + "shipmentPriceTax":0, + "shipmentPriceExcl":0, + "shipmentPriceIncl":0, + "shipmentDiscountExcl":0, + "shipmentDiscountIncl":0, + "shipmentTitle":"Shipment Title", + "shipmentData":{ + "method":"default", + "shipment_id":85518, + "shipping_value_id":424529 + }, + "paymentIsSet":true, + "paymentId":"external", + "paymentIsPost":false, + "paymentIsInvoiceExternal":false, + "paymentData":"{\"user_id\":null}", + "paymentTaxRate":0, + "paymentBasePriceExcl":0, + "paymentBasePriceIncl":0, + "paymentPriceTax":0, + "paymentPriceExcl":0, + "paymentPriceIncl":0, + "additionalCostIncl":"0.0000", + "additionalCostExcl":"0.0000", + "paymentTitle":"Customer choice", + "discountIsSet":false, + "discountId":0, + "discountType":"amount", + "discountAmount":0, + "discountPercentage":0, + "discountShipment":"default", + "discountMinimumAmount":"0.00", + "discountCouponCode":"", + "comment":"", + "allowNotifications":false, + "customer":{ + "resource":{ + "id":123, + "url":"customers\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/customers\/123.json" + } + }, + "language":{ + "id":3, + "code":"en", + "locale":"en_GB", + "title":"English" + }, + "products":{ + "resource":{ + "id":false, + "url":"quotes\/123\/products", + "link":"http:\/\/api.shoplightspeed.com\/en\/quotes\/123\/products.json" + } + }, + "shippingmethods":{ + "resource":{ + "id":false, + "url":"quotes\/123\/shippingmethods", + "link":"http:\/\/api.shoplightspeed.com\/en\/quotes\/123\/shippingmethods.json" + } + }, + "paymentmethods":{ + "resource":{ + "id":false, + "url":"quotes\/123\/paymentmethods", + "link":"http:\/\/api.shoplightspeed.com\/en\/quotes\/123\/paymentmethods.json" + } + } + } + } + }, + "events":{ + "resource":{ + "id":false, + "url":"orders\/events?order=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/events.json?order=123", + "embedded":[ + { + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "channel":"manual", + "type":"order", + "message":"new", + "comment":null, + "order":{ + "resource":{ + "id":123, + "url":"orders\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123.json" + } + }, + "invoice":false, + "shipment":false + }, + { + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "channel":"auto", + "type":"invoice", + "message":"new", + "comment":null, + "order":{ + "resource":{ + "id":123, + "url":"orders\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123.json" + } + }, + "invoice":{ + "resource":{ + "id":123, + "url":"invoices\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices\/123.json" + } + }, + "shipment":false + }, + { + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "channel":"auto", + "type":"shipment", + "message":"new", + "comment":null, + "order":{ + "resource":{ + "id":123, + "url":"orders\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123.json" + } + }, + "invoice":false, + "shipment":{ + "resource":{ + "id":123, + "url":"shipments\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/shipments\/123.json" + } + } + }, + { + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "channel":"auto", + "type":"invoice", + "message":"paid", + "comment":null, + "order":{ + "resource":{ + "id":123, + "url":"orders\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123.json" + } + }, + "invoice":{ + "resource":{ + "id":123, + "url":"invoices\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/invoices\/123.json" + } + }, + "shipment":false + }, + { + "id":123, + "createdAt":"2025-09-17T19:12:38+00:00", + "channel":"auto", + "type":"order", + "message":"paid", + "comment":"Total = 0", + "order":{ + "resource":{ + "id":123, + "url":"orders\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/orders\/123.json" + } + }, + "invoice":false, + "shipment":false + } + ] + } + }, + "giftCardsPayment":[ + + ] + } +} \ No newline at end of file diff --git a/components/lightspeed_ecom_c_series/sources/product-deleted/product-deleted.mjs b/components/lightspeed_ecom_c_series/sources/product-deleted/product-deleted.mjs new file mode 100644 index 0000000000000..df0f1b6cfd75f --- /dev/null +++ b/components/lightspeed_ecom_c_series/sources/product-deleted/product-deleted.mjs @@ -0,0 +1,29 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "indiefunnels-product-deleted", + name: "Product Deleted (Instant)", + description: "Emit new event when a product is deleted.", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getItemGroup() { + return "products"; + }, + getItemAction() { + return "deleted"; + }, + generateMeta(body) { + return { + id: body.product.id, + summary: this.getSummary(`Product with ID ${body.product.id} deleted`), + ts: Date.parse(body.product.deletedAt), + }; + }, + }, + sampleEmit, +}; diff --git a/components/lightspeed_ecom_c_series/sources/product-deleted/test-event.mjs b/components/lightspeed_ecom_c_series/sources/product-deleted/test-event.mjs new file mode 100644 index 0000000000000..56004c9f9e062 --- /dev/null +++ b/components/lightspeed_ecom_c_series/sources/product-deleted/test-event.mjs @@ -0,0 +1 @@ +export default {} \ No newline at end of file diff --git a/components/lightspeed_ecom_c_series/sources/product-updated/product-updated.mjs b/components/lightspeed_ecom_c_series/sources/product-updated/product-updated.mjs new file mode 100644 index 0000000000000..361821d44a9b6 --- /dev/null +++ b/components/lightspeed_ecom_c_series/sources/product-updated/product-updated.mjs @@ -0,0 +1,29 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "indiefunnels-product-updated", + name: "Product Updated (Instant)", + description: "Emit new event when a product is updated.", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getItemGroup() { + return "products"; + }, + getItemAction() { + return "updated"; + }, + generateMeta(body) { + return { + id: body.product.id, + summary: this.getSummary(`Product with ID ${body.product.id} updated`), + ts: Date.parse(body.product.updatedAt), + }; + }, + }, + sampleEmit, +}; diff --git a/components/lightspeed_ecom_c_series/sources/product-updated/test-event.mjs b/components/lightspeed_ecom_c_series/sources/product-updated/test-event.mjs new file mode 100644 index 0000000000000..e6931a4b37762 --- /dev/null +++ b/components/lightspeed_ecom_c_series/sources/product-updated/test-event.mjs @@ -0,0 +1,90 @@ +export default { + "product":{ + "id":123, + "createdAt":"2025-09-17T20:25:55+00:00", + "updatedAt":"2025-09-17T20:25:55+00:00", + "isVisible":true, + "visibility":"visible", + "hasMatrix":false, + "data01":"", + "data02":"", + "data03":"", + "url":"product-test", + "title":"product test", + "fulltitle":"product test", + "description":"", + "content":"", + "set":false, + "brand":{ + "resource":{ + "id":123, + "url":"brands\/123", + "link":"http:\/\/api.shoplightspeed.com\/en\/brands\/123.json" + } + }, + "categories":{ + "resource":{ + "id":false, + "url":"categories\/products?product=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/categories\/products.json?product=123" + } + }, + "deliverydate":false, + "image":false, + "images":false, + "relations":{ + "resource":{ + "id":false, + "url":"products\/123\/relations", + "link":"http:\/\/api.shoplightspeed.com\/en\/products\/123\/relations.json" + } + }, + "metafields":{ + "resource":{ + "id":false, + "url":"products\/123\/metafields", + "link":"http:\/\/api.shoplightspeed.com\/en\/products\/123\/metafields.json" + } + }, + "reviews":{ + "resource":{ + "id":false, + "url":"reviews?product=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/reviews.json?product=123" + } + }, + "type":false, + "attributes":{ + "resource":{ + "id":false, + "url":"products\/123\/attributes", + "link":"http:\/\/api.shoplightspeed.com\/en\/products\/123\/attributes.json" + } + }, + "supplier":false, + "tags":{ + "resource":{ + "id":false, + "url":"tags\/products?product=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/tags\/products.json?product=123" + } + }, + "variants":{ + "resource":{ + "id":false, + "url":"variants?product=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/variants.json?product=123" + } + }, + "movements":{ + "resource":{ + "id":false, + "url":"variants\/movements?product=123", + "link":"http:\/\/api.shoplightspeed.com\/en\/variants\/movements.json?product=123" + } + }, + "templateDataFields":[ + + ] + } +} \ No newline at end of file diff --git a/components/peekalink/peekalink.app.mjs b/components/peekalink/peekalink.app.mjs index 4da517b7f0204..4f21d0e8d688f 100644 --- a/components/peekalink/peekalink.app.mjs +++ b/components/peekalink/peekalink.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8e80001d314e6..8b6369e5573af 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4628,8 +4628,7 @@ importers: components/ethereum: {} - components/etrusted: - specifiers: {} + components/etrusted: {} components/etsy: dependencies: @@ -7105,8 +7104,7 @@ importers: specifier: ^1.5.1 version: 1.6.6 - components/intelliflo_office: - specifiers: {} + components/intelliflo_office: {} components/intellihr: dependencies: @@ -7626,8 +7624,7 @@ importers: specifier: ^1.0.1 version: 1.0.1 - components/kordiam: - specifiers: {} + components/kordiam: {} components/koyeb: {} @@ -7929,7 +7926,11 @@ importers: components/lightpanda: {} - components/lightspeed_ecom_c_series: {} + components/lightspeed_ecom_c_series: + dependencies: + '@pipedream/platform': + specifier: ^3.1.0 + version: 3.1.0 components/lightspeed_retail_pos: dependencies: @@ -10481,8 +10482,7 @@ importers: specifier: ^2.0.0 version: 2.0.0 - components/peekalink: - specifiers: {} + components/peekalink: {} components/peerdom: dependencies: @@ -12281,8 +12281,7 @@ importers: specifier: ^3.0.3 version: 3.0.3 - components/rundeck: - specifiers: {} + components/rundeck: {} components/runpod: {} @@ -14432,8 +14431,7 @@ importers: specifier: ^1.6.5 version: 1.6.6 - components/thoughtspot: - specifiers: {} + components/thoughtspot: {} components/threads: dependencies: @@ -14466,8 +14464,7 @@ importers: specifier: ^1.0.1 version: 1.0.1 - components/ticketsauce: - specifiers: {} + components/ticketsauce: {} components/ticktick: dependencies: