Actions
Canonical actions define the write-operation contract between the frontend and your connector app. When you build an ecommerce connector, you implement action handlers for each of these actions so the frontend can authenticate users, manage carts, and perform other mutations against your commerce backend.
Import these from @laioutr-core/canonical-types/ecommerce.
Auth
AuthLoginAction
ecommerce/auth/loginThe email address of the user.
The password of the user.
AuthLogoutAction
ecommerce/auth/logoutaction:ecommerce_auth_logout:outputAuthRegisterAction
ecommerce/auth/registerThe email address of the user.
The password of the user.
The first name(s) of a person.
The last name(s) of a person.
Salutation of a person as lowercase key.
Title of a person as lowercase key.
action:ecommerce_auth_register:outputAuthRecoverAction
ecommerce/auth/recoveraction:ecommerce_auth_recover:outputAuthLoginOauthAction
ecommerce/auth/login-oauthA same-origin relative path to return to after login. Ignored when a session already exists.
Accepts one of the following:
AuthLogoutOauthAction
ecommerce/auth/logout-oauthAuthOauthCallbackAction
ecommerce/auth/oauth-callbackThe authorization code returned by Shopify's OAuth server.
The state parameter to prevent CSRF attacks.
action:ecommerce_auth_oauth-callback:outputCart
CartAddItemsAction
ecommerce/cart/add-itemsUnion of all possible items that can be added to the cart. If you find yourself in a situation where you need to add items which are not products or discount-codes, you should create a custom action for that or use the type custom.
Accepts an array of the following:
Per-item outcome, in input order where possible.
CartRemoveItemsAction
ecommerce/cart/remove-itemsstring[]action:ecommerce_cart_remove-items:outputCartUpdateItemsAction
ecommerce/cart/update-itemsCart line-item id.
The new quantity of the item. Won't update if undefined. Only works for products.
Custom fields are a way for implementations to pass arbitrary data to actions, queries, etc.
action:ecommerce_cart_update-items:outputCartGetCheckoutUrlAction
ecommerce/cart/get-checkout-urlProduct Lists
Product lists replace the former wishlist-specific mutations with one contract for wishlists, favorites, shopping lists, and B2B requisition lists.
ProductListCreateAction
ecommerce/product-list/createThe visibility value set — shared with the ecommerce/product-list/* actions so the vocabulary has a single source.
Initial items to create the list with.
The ID of the created product list.
ProductListUpdateAction
ecommerce/product-list/updateThe visibility value set — shared with the ecommerce/product-list/* actions so the vocabulary has a single source.
action:ecommerce_product-list_update:outputProductListDeleteAction
ecommerce/product-list/deleteaction:ecommerce_product-list_delete:outputProductListDuplicateAction
ecommerce/product-list/duplicateThe name of the new list.
The ID of the created copy.
ProductListAddItemsAction
ecommerce/product-list/add-itemsThe list to add to. Absent ⇒ the customer's default wishlist.
action:ecommerce_product-list_add-items:outputProductListUpdateItemsAction
ecommerce/product-list/update-itemsThe list the entries are on. Absent ⇒ the customer's default wishlist.
action:ecommerce_product-list_update-items:outputProductListRemoveItemsAction
ecommerce/product-list/remove-itemsThe list to remove from. Absent ⇒ the customer's default wishlist.
action:ecommerce_product-list_remove-items:outputProductListAddToCartAction
ecommerce/product-list/add-to-cartThe list to add to the cart. Absent ⇒ the customer's default wishlist.
Per-item outcome.
Customer
CustomerGetCurrentAction
ecommerce/customer/get-currentA customer is a person who has an account with the shop.
CustomerUpdateAction
ecommerce/customer/updateCustom fields are a way for implementations to pass arbitrary data to actions, queries, etc.
action:ecommerce_customer_update:outputCustomerAddressGetAllAction
ecommerce/customer/address-get-allCustomerAddressCreateAction
ecommerce/customer/address-createaction:ecommerce_customer_address-create:outputCustomerAddressUpdateAction
ecommerce/customer/address-updateThe ID of the address to update.
action:ecommerce_customer_address-update:outputCustomerAddressDeleteAction
ecommerce/customer/address-deleteThe ID of the address to delete.
action:ecommerce_customer_address-delete:outputCustomerAddressSetDefaultAction
ecommerce/customer/address-set-defaultThe ID of the address to set as default.
The type of default to set. Not all backends may support this distinction.
action:ecommerce_customer_address-set-default:outputOrders
OrderReorderAction
ecommerce/order/reorderThe ID of the order to reorder.
Per-item outcome of the reorder.
OrderCancelAction
ecommerce/order/cancelThe ID of the order to cancel.
action:ecommerce_order_cancel:outputOrderGetStatisticsAction
ecommerce/order/get-statisticsThe calendar year to aggregate. Defaults to the current year.
The calendar year the statistics cover.
One entry per month with data; months without orders may be omitted.
Documents
DocumentGetAllAction
ecommerce/document/get-allDocumentGetDownloadUrlAction
ecommerce/document/get-download-urlThe ID of the document to download.
Legal
LegalWithdrawalAction
ecommerce/legal/withdrawalA commerce connector does not need to implement this action. The Essentials Mailer app handles it for every commerce backend: from version 0.1.4 it posts the request to Laioutr Channels, which stores it and answers at once, and the Cockpit then sends the notice to the team and the confirmation to the consumer through the project's Email channel. The action answers { success: true } once Channels has received the request. A malformed request, a refusal or too many requests from one connection answer { success: false, message }. The storefront's own SMTP server, where configured in the Mailer, takes the request only when Channels cannot.
Review
ProductReviewsCreateAction
ecommerce/product/reviews/createA rating between 1 and 5. That's the most common rating scale. No other scale is supported at the moment. Decimals are allowed.