Просмотр исходного кода

Merge branch 'master' into minor

Michael Bromley 1 год назад
Родитель
Сommit
8a4ab91de1

+ 1 - 1
docs/docs/guides/developer-guide/events/index.mdx

@@ -255,7 +255,7 @@ type BlogPostInputTypes = CreateBlogPostInput | UpdateBlogPostInput | ID | ID[];
  * This event is fired whenever a BlogPost is added, updated
  * or deleted.
  */
-export class BlogPostEvent extends VendureEntityEvent<BlogPost[], BlogPostInputTypes> {
+export class BlogPostEvent extends VendureEntityEvent<BlogPost, BlogPostInputTypes> {
     constructor(
         ctx: RequestContext,
         entity: BlogPost,

+ 1 - 1
docs/docs/guides/developer-guide/plugins/index.mdx

@@ -358,7 +358,7 @@ export class WishlistService {
      */
     async addItem(ctx: RequestContext, variantId: ID): Promise<WishlistItem[]> {
         const customer = await this.getCustomerWithWishlistItems(ctx);
-        const variant = this.productVariantService.findOne(ctx, variantId);
+        const variant = await this.productVariantService.findOne(ctx, variantId);
         if (!variant) {
             throw new UserInputError(`No ProductVariant with the id ${variantId} could be found`);
         }

+ 1 - 1
docs/docs/reference/typescript-api/configuration/vendure-config.md

@@ -14,7 +14,7 @@ import MemberDescription from '@site/src/components/MemberDescription';
 <GenerationInfo sourceFile="packages/core/src/config/vendure-config.ts" sourceLine="1091" packageName="@vendure/core" />
 
 All possible configuration options are defined by the
-[`VendureConfig`](https://github.com/vendure-ecommerce/vendure/blob/master/server/src/config/vendure-config.ts) interface.
+[`VendureConfig`](https://github.com/vendure-ecommerce/vendure/blob/master/packages/core/src/config/vendure-config.ts) interface.
 
 ```ts title="Signature"
 interface VendureConfig {

+ 48 - 0
license/signatures/version1/cla.json

@@ -303,6 +303,54 @@
       "created_at": "2024-11-09T10:08:00Z",
       "repoId": 136938012,
       "pullRequestNo": 3205
+    },
+    {
+      "name": "areg-gareginyan-im",
+      "id": 29304156,
+      "comment_id": 2489024261,
+      "created_at": "2024-11-20T16:20:29Z",
+      "repoId": 136938012,
+      "pullRequestNo": 3220
+    },
+    {
+      "name": "DeltaSAMP",
+      "id": 47721109,
+      "comment_id": 2485190224,
+      "created_at": "2024-11-19T09:44:10Z",
+      "repoId": 136938012,
+      "pullRequestNo": 3214
+    },
+    {
+      "name": "xiopipe",
+      "id": 51303452,
+      "comment_id": 2495534224,
+      "created_at": "2024-11-23T16:40:53Z",
+      "repoId": 136938012,
+      "pullRequestNo": 3227
+    },
+    {
+      "name": "Draykee",
+      "id": 19676051,
+      "comment_id": 2498531458,
+      "created_at": "2024-11-25T16:47:49Z",
+      "repoId": 136938012,
+      "pullRequestNo": 3231
+    },
+    {
+      "name": "Rana-Faraz",
+      "id": 96161223,
+      "comment_id": 2503744724,
+      "created_at": "2024-11-27T12:25:05Z",
+      "repoId": 136938012,
+      "pullRequestNo": 3242
+    },
+    {
+      "name": "JavierElices",
+      "id": 15686364,
+      "comment_id": 2476096457,
+      "created_at": "2024-11-14T11:22:24Z",
+      "repoId": 136938012,
+      "pullRequestNo": 3208
     }
   ]
 }

+ 1 - 1
packages/admin-ui/README.md

@@ -27,7 +27,7 @@ In addition to the library, there is also a full application located at [./src/a
 
 ## Localization
 
-Localization of UI strings is handled by [ngx-translate](http://www.ngx-translate.com/). The translation strings should use the [ICU MessageFormat](http://userguide.icu-project.org/formatparse/messages).
+Localization of UI strings is handled by [ngx-translate](https://ngx-translate.org). The translation strings should use the [ICU MessageFormat](https://unicode-org.github.io/icu/userguide/format_parse/messages).
 
 Translation keys are automatically extracted by running:
 ```

+ 1 - 1
packages/admin-ui/src/lib/core/src/shared/components/data-table-filter-presets/data-table-filter-presets.component.html

@@ -19,7 +19,7 @@
             </div>
             <a
                 [routerLink]="['./']"
-                [queryParams]="preset.value === serializedActiveFilters ? {} : { filters: preset.value, page: 1 }"
+                [queryParams]="getQueryParamsForPreset(preset.value, serializedActiveFilters)"
             >
                 <div>{{ preset.name }}</div>
             </a>

+ 22 - 0
packages/admin-ui/src/lib/core/src/shared/components/data-table-filter-presets/data-table-filter-presets.component.ts

@@ -51,6 +51,28 @@ export class DataTableFilterPresetsComponent implements OnInit, OnDestroy {
         this.filterPresets$ = this.filterPresetService.presetChanges$.pipe(
             startWith(this.filterPresetService.getFilterPresets(this.dataTableId)),
         );
+        // When any query param changes, we want to trigger change detection
+        // so that the links for each preset are updated.
+        this.route.queryParamMap
+            .pipe(takeUntil(this.destroy$))
+            .subscribe(() => this.changeDetectorRef.markForCheck());
+    }
+
+    getQueryParamsForPreset(preset: string, serializedActiveFilters: string): Record<string, string> {
+        // Clone the current query params to avoid mutating them directly
+        const currentParams = { ...this.route.snapshot.queryParams };
+
+        if (preset === serializedActiveFilters) {
+            // Toggling off: remove 'filters' and 'page' params
+            delete currentParams['filters'];
+            delete currentParams['page'];
+        } else {
+            // Toggling on: set 'filters' and 'page' params
+            currentParams['filters'] = preset;
+            currentParams['page'] = 1;
+        }
+
+        return currentParams;
     }
 
     ngOnDestroy() {

+ 1 - 1
packages/core/src/config/vendure-config.ts

@@ -1084,7 +1084,7 @@ export interface SystemOptions {
 /**
  * @description
  * All possible configuration options are defined by the
- * [`VendureConfig`](https://github.com/vendure-ecommerce/vendure/blob/master/server/src/config/vendure-config.ts) interface.
+ * [`VendureConfig`](https://github.com/vendure-ecommerce/vendure/blob/master/packages/core/src/config/vendure-config.ts) interface.
  *
  * @docsCategory configuration
  * */

+ 1 - 1
packages/core/src/service/services/product-variant.service.ts

@@ -250,7 +250,7 @@ export class ProductVariantService {
         return this.connection
             .getRepository(ctx, ProductVariantPrice)
             .createQueryBuilder('pvp')
-            .where('pvp.productVariant = :productVariantId', { productVariantId })
+            .where('pvp.variant = :productVariantId', { productVariantId })
             .andWhere('pvp.channelId = :channelId', { channelId: ctx.channelId })
             .getMany();
     }

+ 1 - 1
packages/dev-server/example-plugins/wishlist-plugin/service/wishlist.service.ts

@@ -33,7 +33,7 @@ export class WishlistService {
      */
     async addItem(ctx: RequestContext, variantId: ID): Promise<WishlistItem[]> {
         const customer = await this.getCustomerWithWishlistItems(ctx);
-        const variant = this.productVariantService.findOne(ctx, variantId);
+        const variant = await this.productVariantService.findOne(ctx, variantId);
         if (!variant) {
             throw new UserInputError(`No ProductVariant with the id ${variantId} could be found`);
         }

+ 14 - 8
packages/payments-plugin/src/mollie/mollie.service.ts

@@ -279,15 +279,21 @@ export class MollieService {
                 `Unable to find order ${mollieOrder.orderNumber}, unable to process Mollie order ${mollieOrder.id}`,
             );
         }
-        if (mollieOrder.status === OrderStatus.expired) {
-            // Expired is fine, a customer can retry the payment later
+        const mollieStatesThatRequireAction: OrderStatus[] = [
+            OrderStatus.completed,
+            OrderStatus.authorized,
+            OrderStatus.paid,
+        ];
+        if (!mollieStatesThatRequireAction.includes(mollieOrder.status)) {
+            // No need to handle this mollie webhook status
+            Logger.info(
+                `Ignoring Mollie status '${mollieOrder.status}' from incoming webhook for '${order.code}'`,
+                loggerCtx,
+            );
             return;
         }
         if (order.orderPlacedAt) {
-            // Verify if the Vendure order isn't already paid for, and log if so
-            const paymentWithSameTransactionId = order.payments.find(
-                p => p.transactionId === mollieOrder.id && p.state === 'Settled',
-            );
+            const paymentWithSameTransactionId = order.payments.find(p => p.transactionId === mollieOrder.id);
             if (!paymentWithSameTransactionId) {
                 // The order is paid for again, with another transaction ID. This means the customer paid twice
                 Logger.error(
@@ -297,14 +303,14 @@ export class MollieService {
                 return;
             }
         }
-        const statesThatRequireAction: OrderState[] = [
+        const vendureStatesThatRequireAction: OrderState[] = [
             'AddingItems',
             'ArrangingPayment',
             'ArrangingAdditionalPayment',
             'PaymentAuthorized',
             'Draft',
         ];
-        if (!statesThatRequireAction.includes(order.state)) {
+        if (!vendureStatesThatRequireAction.includes(order.state)) {
             // If order is not in one of these states, we don't need to handle the Mollie webhook
             Logger.info(
                 `Order ${order.code} is already '${order.state}', no need for handling Mollie status '${mollieOrder.status}'`,