3.4.1 • Published 7 months ago

@futureordering/fo-web-plugin-types v3.4.1

Weekly downloads
-
License
ISC
Repository
-
Last release
7 months ago

Future Ordering frontend plugin types

TypeScript typings for frontend extensibility plugins for the Future Ordering frontend.

Installation

npm i @futureordering/fo-web-plugin-types

Examples

See https://github.com/Future-Ordering/frontend-plugin-boilerplate for usage example

Changelog

Upcoming major version

  • File plugin-specs will be removed. For example when importing BlockComponentLocations, change import form @futureordering/fo-web-plugin-types/plugin-specs to @futureordering/fo-web-plugin-types.

Version 3.4

Adds new block component location sidebar-basket-item which is displayed at each basket item. Component context-object for this location includes locationContext which has data about the current order item.

Version 3.2

Adds optional parameter to navigation method navigateToPage (ctx.location.navigateToPage):

  • expectedDiscount, the amount to subtract from a product's displayed total price in the product configurator

Version 3.1

Adds methods to menuContext:

  • isProductQuickAddable, whether product can be added directly without any config
  • isProductConfigurable, whether product can be configured separately on product-config page
  • getProductPrice, returns products total price

menuContext can be retrieved using ctx.menu.getMenu or (await ctx.order.getCurrentOrder()).menu

Version 3

Version 3 changes:

  • Adds basic order support for working with orders, menus and products. Some of the new addons include:
    • Create order (ctx.order.createOrder)
    • Add item to basket (orderContext.addItem, orderContext can for example be retrieved using ctx.order.getCurrentOrder and ctx.order.createOrder)
    • Get order items ((await orderContext.getOrderData()).orderItems)
    • Remove item from order (orderContext.removeItem)
    • Set order class (orderContext.setOrderClass)
    • Get menu (ctx.menu.getMenu)
    • Get product (menuContext.getProduct, menuContext can for example be retrieved using ctx.menu.getMenu or (await ctx.order.getCurrentOrder()).menu)
    • Iterate products (menuContext.products)
    • Selecting config item (menuContext.setItem)
  • Starting order from plugin by navigating to select store and order type, and then back to plugin (ctx.location.navigateToStartOrderAndBack)
  • Navigate to page (ctx.location.navigateToPage, currently only supported to navigate to productConfig page)
  • Removes ctx.location.navigateToPageComponent overload
  • Changes ctx.location.navigate argument menuType to orderClass

Migrating from version 2 to 3

ctx.location.navigateToPageComponent

Change

ctx.location.navigateToPageComponent('myPlugin', {}, { addReturnUrl: true });

To

ctx.location.navigateToPageComponent({
    pageName: 'myPlugin',
    queryParams: {},
    addReturnUrl: truer
})

ctx.location.navigate

Change

ctx.location.navigate({
    menuType: 'takeaway',
    ...
})

To

ctx.location.navigate({
    orderClass: 'takeaway',
    ...
})

ctx.page.setButton

Available in page components. Removed because overriding the back button behavior goes against user expectations and the way the app works in general.

3.4.0

7 months ago

3.2.0

10 months ago

3.1.0

11 months ago

3.4.0-preview.0

7 months ago

3.4.1

7 months ago

3.0.0

1 year ago

3.0.0-preview.5

1 year ago

3.0.0-preview.4

1 year ago

3.0.0-preview.2

1 year ago

3.0.0-preview.1

1 year ago

2.5.0

1 year ago

2.4.0

2 years ago

2.2.0

2 years ago

2.0.0

2 years ago

2.0.0-preview.1

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago