Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): Enable to change the name of the cookie for Admin API #2482

Merged
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
b917e62
fix(admin-ui): Make ExtensionHostComponent work with new extension APIs
michaelbromley Oct 11, 2023
92cad43
fix(core): Fix regression in ProductService.findOne not using relations
michaelbromley Oct 12, 2023
eb54890
docs: Add redirects for old docs urls
michaelbromley Oct 12, 2023
9aac191
fix(common): Remove trademark symbols from normalized strings (#2447)
gdarchen Oct 12, 2023
b594c55
feat(admin-ui): Add Croatian translation (#2442)
kristiand00 Oct 12, 2023
3fd93c7
fix(admin-ui): Improve Italian translations (#2445)
Swampy469 Oct 12, 2023
8db459a
fix(payments-plugin): Fix Mollie klarna AutoCapture (#2446)
martijnvdbrug Oct 12, 2023
3942690
docs: Fix yarn add command (#2448)
BijanRegmi Oct 16, 2023
09dd7df
fix(core): Fix custom field resolver for eager translatable relation …
tianyingchun Oct 17, 2023
83c8a33
test(core): Add e2e test for #2453
michaelbromley Oct 17, 2023
ec61b58
fix(admin-ui): Add missing RTL compatibility to some admin-ui compone…
HoseinGhanbari Oct 17, 2023
b0ece21
fix(payments-plugin): Fix Stripe controller crashing server instance …
carathorys Oct 17, 2023
b7f3452
feat(admin-ui): Add product slug in product multi selector dialog com…
gdarchen Oct 17, 2023
2f7a8d5
fix(payments-plugin): Idempotent 'paid' Mollie webhooks (#2462)
martijnvdbrug Oct 17, 2023
08ad982
fix(admin-ui): Do not load pending search index updates if permission…
jnugh Oct 17, 2023
ce2b251
fix(admin-ui): Add unique location id for prod detail variants table
michaelbromley Oct 17, 2023
74c6634
fix(admin-ui): Make utility margin/padding classes RTL-compatible
michaelbromley Oct 17, 2023
005a1a4
chore(admin-ui): Tidy up unused code
michaelbromley Oct 17, 2023
d8989fc
test(core): Fix failing e2e test
michaelbromley Oct 17, 2023
02fe6ae
fix(admin-ui): Fix customer group select input
michaelbromley Oct 17, 2023
957d0ad
fix(core): Normalize email address on updating Customer
michaelbromley Oct 17, 2023
4035fda
fix(admin-ui): Improvements to Nepali translation (#2463)
BeepLoveKarki Oct 18, 2023
75f79f4
chore(admin-ui): Enable th HR translation
michaelbromley Oct 18, 2023
9d88db2
fix(admin-ui): Fix setting facet values on new product
michaelbromley Oct 18, 2023
e265a30
docs: Improve docs on custom order process
michaelbromley Oct 18, 2023
de8e3c0
docs: Improve docs working with DB relations
michaelbromley Oct 18, 2023
2df160c
docs: Fix shipping calculator example
michaelbromley Oct 18, 2023
4668391
docs: Improve property display in custom fields guide
michaelbromley Oct 18, 2023
9dda349
fix(admin-ui): Fix initial render of code editor input marking dirty
michaelbromley Oct 18, 2023
f6120ff
docs: Add docs on accessing custom fields via TS
michaelbromley Oct 18, 2023
eb79c3d
docs: Add docs on removing nav menu items from admin ui
michaelbromley Oct 18, 2023
4e7b1d7
docs: Add docs on accessing services from e2e tests
michaelbromley Oct 18, 2023
3322a56
docs: Fix scraper config
michaelbromley Oct 18, 2023
f175343
chore(test): Reinstate skipped e2e tests
michaelbromley Oct 18, 2023
b99d238
chore(core): tidy up unused imports
michaelbromley Oct 18, 2023
d3d4bb2
chore(admin-ui): Fix circular import
michaelbromley Oct 18, 2023
716d967
chore: Publish v2.1.1
michaelbromley Oct 18, 2023
5821abb
docs: Add Missing Closing Parentheses on TransitionToState Example Mu…
pevey Oct 21, 2023
ffe0039
docs: Add missing words (benefits from) in tech stack description (#2…
pevey Oct 21, 2023
19e7354
docs: Add missing word in docs (#2479)
pevey Oct 23, 2023
218561f
docs: Add breaking change note to readme
michaelbromley Oct 23, 2023
5818d39
feat(core): Enable to change the name of the cookie for Admin API
gdarchen Oct 23, 2023
ead93f1
refactor(core): Turn `cookieOptions?.name` into a union type allowing…
gdarchen Oct 25, 2023
3a1e364
fix(testing): Fix typing issue in test serverfix
gdarchen Oct 25, 2023
203fd90
refactor(core): Extract logic to configure session cookies
gdarchen Oct 27, 2023
8cf502d
fix(testing): Add missing parameter
gdarchen Oct 27, 2023
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
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
## <small>2.1.1 (2023-10-18)</small>


#### Fixes

* **admin-ui** Add missing RTL compatibility to some admin-ui components (#2451) ([ec61b58](https://github.com/vendure-ecommerce/vendure/commit/ec61b58)), closes [#2451](https://github.com/vendure-ecommerce/vendure/issues/2451)
* **admin-ui** Add unique location id for prod detail variants table ([ce2b251](https://github.com/vendure-ecommerce/vendure/commit/ce2b251))
* **admin-ui** Do not load pending search index updates if permissions are insufficient (#2460) ([08ad982](https://github.com/vendure-ecommerce/vendure/commit/08ad982)), closes [#2460](https://github.com/vendure-ecommerce/vendure/issues/2460) [#2456](https://github.com/vendure-ecommerce/vendure/issues/2456)
* **admin-ui** Fix customer group select input ([02fe6ae](https://github.com/vendure-ecommerce/vendure/commit/02fe6ae)), closes [#2441](https://github.com/vendure-ecommerce/vendure/issues/2441)
* **admin-ui** Fix initial render of code editor input marking dirty ([9dda349](https://github.com/vendure-ecommerce/vendure/commit/9dda349))
* **admin-ui** Fix setting facet values on new product ([9d88db2](https://github.com/vendure-ecommerce/vendure/commit/9d88db2)), closes [#2355](https://github.com/vendure-ecommerce/vendure/issues/2355)
* **admin-ui** Improve Italian translations (#2445) ([3fd93c7](https://github.com/vendure-ecommerce/vendure/commit/3fd93c7)), closes [#2445](https://github.com/vendure-ecommerce/vendure/issues/2445)
* **admin-ui** Improvements to Nepali translation (#2463) ([4035fda](https://github.com/vendure-ecommerce/vendure/commit/4035fda)), closes [#2463](https://github.com/vendure-ecommerce/vendure/issues/2463)
* **admin-ui** Make ExtensionHostComponent work with new extension APIs ([b917e62](https://github.com/vendure-ecommerce/vendure/commit/b917e62))
* **admin-ui** Make utility margin/padding classes RTL-compatible ([74c6634](https://github.com/vendure-ecommerce/vendure/commit/74c6634))
* **common** Remove trademark symbols from normalized strings (#2447) ([9aac191](https://github.com/vendure-ecommerce/vendure/commit/9aac191)), closes [#2447](https://github.com/vendure-ecommerce/vendure/issues/2447)
* **core** Fix custom field resolver for eager translatable relation (#2457) ([09dd7df](https://github.com/vendure-ecommerce/vendure/commit/09dd7df)), closes [#2453](https://github.com/vendure-ecommerce/vendure/issues/2453)
* **core** Fix regression in ProductService.findOne not using relations ([92cad43](https://github.com/vendure-ecommerce/vendure/commit/92cad43)), closes [#2443](https://github.com/vendure-ecommerce/vendure/issues/2443)
* **core** Normalize email address on updating Customer ([957d0ad](https://github.com/vendure-ecommerce/vendure/commit/957d0ad)), closes [#2449](https://github.com/vendure-ecommerce/vendure/issues/2449)
* **payments-plugin** Fix Mollie klarna AutoCapture (#2446) ([8db459a](https://github.com/vendure-ecommerce/vendure/commit/8db459a)), closes [#2446](https://github.com/vendure-ecommerce/vendure/issues/2446)
* **payments-plugin** Fix Stripe controller crashing server instance (#2454) ([b0ece21](https://github.com/vendure-ecommerce/vendure/commit/b0ece21)), closes [#2454](https://github.com/vendure-ecommerce/vendure/issues/2454) [#2450](https://github.com/vendure-ecommerce/vendure/issues/2450)
* **payments-plugin** Idempotent 'paid' Mollie webhooks (#2462) ([2f7a8d5](https://github.com/vendure-ecommerce/vendure/commit/2f7a8d5)), closes [#2462](https://github.com/vendure-ecommerce/vendure/issues/2462)

#### Features

* **admin-ui** Add Croatian translation (#2442) ([b594c55](https://github.com/vendure-ecommerce/vendure/commit/b594c55)), closes [#2442](https://github.com/vendure-ecommerce/vendure/issues/2442)
* **admin-ui** Add product slug in product multi selector dialog component (#2461) ([b7f3452](https://github.com/vendure-ecommerce/vendure/commit/b7f3452)), closes [#2461](https://github.com/vendure-ecommerce/vendure/issues/2461)

## 2.1.0 (2023-10-11)


Expand Down Expand Up @@ -82,6 +110,8 @@ https://www.apollographql.com/docs/apollo-server/migration/

* The ForbiddenError now defaults to a "warning" rather than "error" log level. Previously this was causing too much noise in logging services and the new level better reflects the severity of the error.

* If after update you are running into the error `[GraphQL error]: Message: POST body missing, invalid Content-Type, or JSON object has no keys.`, this may be due to having the [body-parser](https://www.npmjs.com/package/body-parser) `json` middleware configured in your app. You should be able to safely remove this middleware in order to resolve the issue.

## <small>2.0.10 (2023-10-11)</small>


Expand Down
89 changes: 89 additions & 0 deletions docs/docs/guides/core-concepts/orders/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,20 @@ const myCustomOrderProcess = configureDefaultOrderProcess({
// Orders to have a shipping method assigned
// before payment.
arrangingPaymentRequiresShipping: false,

// Other constraints which can be disabled. See the
// DefaultOrderProcessOptions interface docs for full
// explanations.
//
// checkModificationPayments: false,
// checkAdditionalPaymentsAmount: false,
// checkAllVariantsExist: false,
// arrangingPaymentRequiresContents: false,
// arrangingPaymentRequiresCustomer: false,
// arrangingPaymentRequiresStock: false,
// checkPaymentsCoverTotal: false,
// checkAllItemsBeforeCancel: false,
// checkFulfillmentStates: false,
});

export const config: VendureConfig = {
Expand Down Expand Up @@ -241,6 +255,81 @@ const customerValidationProcess: OrderProcess<'ValidatingCustomer'> = {
For an explanation of the `init()` method and `injector` argument, see the guide on [injecting dependencies in configurable operations](/guides/developer-guide/strategies-configurable-operations/#injecting-dependencies).
:::

### Responding to a state transition

Once an order has successfully transitioned to a new state, the [`onTransitionEnd` state transition hook](/reference/typescript-api/state-machine/state-machine-config#ontransitionend) is called. This can be used to perform some action
upon successful state transition.

In this example, we have a referral service which creates a new referral for a customer when they complete an order. We want to create the referral only if the customer has a referral code associated with their account.

```ts
import { OrderProcess, OrderState } from '@vendure/core';

import { ReferralService } from '../service/referral.service';

let referralService: ReferralService;

export const referralOrderProcess: OrderProcess<OrderState> = {
init: (injector) => {
referralService = injector.get(ReferralService);
},
onTransitionEnd: async (fromState, toState, data) => {
const { order, ctx } = data;
if (toState === 'PaymentSettled') {
if (order.customFields.referralCode) {
await referralService.createReferralForOrder(ctx, order);
}
}
},
};
```

:::caution
Use caution when modifying an order inside the `onTransitionEnd` function. The `order` object that gets passed in to this function
will later be persisted to the database. Therefore any changes must be made to that `order` object, otherwise the changes might be lost.

As an example, let's say we want to add a Surcharge to the order. The following code **will not work as expected**:

```ts
export const myOrderProcess: OrderProcess<OrderState> = {
async onTransitionEnd(fromState, toState, data) {
if (fromState === 'AddingItems' && toState === 'ArrangingPayment') {
// highlight-start
// WARNING: This will not work!
await orderService.addSurchargeToOrder(ctx, order.id, {
description: 'Test',
listPrice: 42,
listPriceIncludesTax: false,
});
// highlight-end
}
}
};
```

Instead, you need to ensure you **mutate the `order` object**:

```ts
export const myOrderProcess: OrderProcess<OrderState> = {
async onTransitionEnd(fromState, toState, data) {
if (fromState === 'AddingItems' && toState === 'ArrangingPayment') {
// highlight-start
const {surcharges} = await orderService.addSurchargeToOrder(ctx, order.id, {
description: 'Test',
listPrice: 42,
listPriceIncludesTax: false,
});
// Important: mutate the order object
order.surcharges = surcharges;
// highlight-end
}
},
}
```


:::

## TypeScript Typings

To make your custom states compatible with standard services you should declare your new states in the following way:
Expand Down
Loading
Loading