Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/monta/.impeccable/hook.cache.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":1,"sessions":{}}

Check failure on line 1 in components/monta/.impeccable/hook.cache.json

View workflow job for this annotation

GitHub Actions / Lint Code Base

Newline required at end of file but not found

Check failure on line 1 in components/monta/.impeccable/hook.cache.json

View workflow job for this annotation

GitHub Actions / Lint Code Base

A space is required after ','
99 changes: 99 additions & 0 deletions components/monta/actions/add-order-colli/add-order-colli.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import monta from "../../monta.app.mjs";

export default {
key: "monta-add-order-colli",
name: "Add Order Colli",
description: "Register a collo (parcel) on an order, including its dimensions and tracking details. Use this to record how an order was packed; inspect the result with **List Order Colli**. [See the documentation](https://api-v6.monta.nl/index.html#tag/Order/paths/~1order~1%7Bwebshoporderid%7D~1colli/post)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
props: {
monta,
orderId: {
propDefinition: [
monta,
"orderId",
],
},
number: {
type: "integer",
label: "Number",
description: "The collo number within the order (e.g. `1` for the first parcel)",
},
weightGrammes: {
type: "integer",
label: "Weight (grammes)",
description: "The weight of the collo in grammes (e.g. `1234` for 1.234 kg)",
optional: true,
},
lengthMm: {
type: "integer",
label: "Length (mm)",
description: "The length of the collo in millimetres",
optional: true,
},
widthMm: {
type: "integer",
label: "Width (mm)",
description: "The width of the collo in millimetres",
optional: true,
},
heightMm: {
type: "integer",
label: "Height (mm)",
description: "The height of the collo in millimetres",
optional: true,
},
trackAndTraceCode: {
type: "string",
label: "Track and Trace Code",
description: "The track and trace code for the collo",
optional: true,
},
trackAndTraceLink: {
type: "string",
label: "Track and Trace Link",
description: "The track and trace link for the collo (e.g. `https://carrier.example/track/ABC123`)",
optional: true,
},
packageDescription: {
type: "string",
label: "Package Description",
description: "A description of the package",
optional: true,
},
additionalFields: {
propDefinition: [
monta,
"additionalFields",
],
description: "Additional collo properties to send in the request body, using Monta's request-body casing (e.g. `{ \"IsParent\": true }`)",
optional: true,
},
},
async run({ $ }) {
const response = await this.monta.createOrderColli({
$,
orderId: this.orderId,
data: {
...this.additionalFields,
Number: this.number,
WeightGrammes: this.weightGrammes,
LengthMm: this.lengthMm,
WidthMm: this.widthMm,
HeightMm: this.heightMm,
TrackAndTraceCode: this.trackAndTraceCode,
TrackAndTraceLink: this.trackAndTraceLink,
PackageDescription: this.packageDescription,
},
});

$.export("$summary", `Successfully added collo \`${this.number}\` to order \`${this.orderId}\``);

return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import monta from "../../monta.app.mjs";

export default {
key: "monta-approve-inbound-forecasts",
name: "Approve Inbound Forecasts",
description: "Approve multiple inbound forecasts at once by their IDs. Obtain forecast IDs from **List Inbound Forecasts by Product SKU** or **Get Inbound Forecast Group** (the `InboundForecastId` field). [See the documentation](https://api-v6.monta.nl/index.html#tag/InboundForecast/paths/~1inboundforecast~1approve/post)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
props: {
monta,
inboundForecastIds: {
type: "integer[]",
label: "Inbound Forecast IDs",
description: "The IDs of the inbound forecasts to approve (e.g. `[123, 456]`)",
},
},
async run({ $ }) {
const ids = this.inboundForecastIds.map(Number);
const response = await this.monta.approveInboundForecasts({
$,
data: ids,
});

$.export("$summary", `Successfully approved ${ids.length} inbound forecast${ids.length === 1
? ""
: "s"}`);

return response;
},
};
43 changes: 43 additions & 0 deletions components/monta/actions/cancel-order/cancel-order.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import monta from "../../monta.app.mjs";

export default {
key: "monta-cancel-order",
name: "Cancel Order",
description: "Cancel (delete) an order. Monta rejects this once picking has started (error 18), after the order has shipped (error 19), or when returns exist (error 25); the API error is surfaced to you. [See the documentation](https://api-v6.monta.nl/index.html#tag/Order/paths/~1order~1%7Bwebshoporderid%7D/delete)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: true,
openWorldHint: true,
readOnlyHint: false,
},
props: {
monta,
orderId: {
propDefinition: [
monta,
"orderId",
],
},
note: {
type: "string",
label: "Note",
description: "The reason for cancelling the order",
},
},
async run({ $ }) {
await this.monta.cancelOrder({
$,
orderId: this.orderId,
data: {
Note: this.note,
},
});

$.export("$summary", `Successfully cancelled order \`${this.orderId}\``);

return {
success: true,
};
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import monta from "../../monta.app.mjs";
import { parseJsonObjects } from "../../common/utils.mjs";

export default {
key: "monta-create-inbound-forecast-group",
name: "Create Inbound Forecast Group",
description: "Create a new inbound forecast group describing stock expected at the warehouse. Manage the group afterwards with **Update Inbound Forecast Group**, **Get Inbound Forecast Group**, or **Delete Inbound Forecast Group**. [See the documentation](https://api-v6.monta.nl/index.html#tag/InboundForecast/paths/~1inboundforecast~1group/post)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
props: {
monta,
reference: {
propDefinition: [
monta,
"reference",
],
description: "A unique reference for the new inbound forecast group",
},
inboundForecasts: {
propDefinition: [
monta,
"inboundForecasts",
],
},
supplierCode: {
propDefinition: [
monta,
"supplierCode",
],
optional: true,
},
comment: {
propDefinition: [
monta,
"comment",
],
optional: true,
},
warehouseDisplayName: {
propDefinition: [
monta,
"warehouseDisplayName",
],
optional: true,
},
allocateStockOnDelivery: {
propDefinition: [
monta,
"allocateStockOnDelivery",
],
optional: true,
},
expectedDeliveryDate: {
propDefinition: [
monta,
"expectedDeliveryDate",
],
optional: true,
},
deliveryDate: {
propDefinition: [
monta,
"deliveryDate",
],
optional: true,
},
additionalFields: {
propDefinition: [
monta,
"additionalFields",
],
description: "Additional properties to send in the request body, using Monta's request-body casing (e.g. `{ \"UniqueId\": \"...\" }`)",
optional: true,
},
},
async run({ $ }) {
const inboundForecasts = parseJsonObjects(this.inboundForecasts, "Inbound Forecast");

const response = await this.monta.createInboundForecastGroup({
$,
data: {
...this.additionalFields,
Reference: this.reference,
InboundForecasts: inboundForecasts,
SupplierCode: this.supplierCode,
Comment: this.comment,
WarehouseDisplayName: this.warehouseDisplayName,
AllocateStockOnDelivery: this.allocateStockOnDelivery,
ExpectedDeliveryDate: this.expectedDeliveryDate,
DeliveryDate: this.deliveryDate,
},
});

$.export("$summary", `Successfully created inbound forecast group \`${this.reference}\``);

return response;
},
};
Loading
Loading