diff --git a/packages/admin-ui/package.json b/packages/admin-ui/package.json index 2fb5a5bf17..d0cdd483fa 100644 --- a/packages/admin-ui/package.json +++ b/packages/admin-ui/package.json @@ -18,15 +18,15 @@ "directory": "package" }, "dependencies": { - "@angular/animations": "9.0.6", - "@angular/cdk": "9.1.0", - "@angular/common": "9.0.6", - "@angular/core": "9.0.6", - "@angular/forms": "9.0.6", - "@angular/language-service": "9.0.6", - "@angular/platform-browser": "9.0.6", - "@angular/platform-browser-dynamic": "9.0.6", - "@angular/router": "9.0.6", + "@angular/animations": "9.1.0", + "@angular/cdk": "9.2.0", + "@angular/common": "9.1.0", + "@angular/core": "9.1.0", + "@angular/forms": "9.1.0", + "@angular/language-service": "9.1.0", + "@angular/platform-browser": "9.1.0", + "@angular/platform-browser-dynamic": "9.1.0", + "@angular/router": "9.1.0", "@biesbjerg/ngx-translate-extract-marker": "^1.0.0", "@clr/angular": "^3.0.0", "@clr/core": "^3.0.0", @@ -95,4 +95,4 @@ "tslint": "^5.12.1", "typescript": "~3.7.5" } -} +} \ No newline at end of file diff --git a/packages/admin-ui/src/lib/order/src/components/order-detail/order-detail.component.ts b/packages/admin-ui/src/lib/order/src/components/order-detail/order-detail.component.ts index bbbc30bd86..ad2b1ed76d 100644 --- a/packages/admin-ui/src/lib/order/src/components/order-detail/order-detail.component.ts +++ b/packages/admin-ui/src/lib/order/src/components/order-detail/order-detail.component.ts @@ -2,10 +2,6 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnIni import { FormGroup } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; -import { omit } from '@vendure/common/lib/omit'; -import { Observable, of, Subject } from 'rxjs'; -import { startWith, switchMap, take } from 'rxjs/operators'; - import { BaseDetailComponent } from '@vendure/admin-ui/core'; import { AdjustmentType, @@ -19,6 +15,10 @@ import { NotificationService } from '@vendure/admin-ui/core'; import { DataService } from '@vendure/admin-ui/core'; import { ServerConfigService } from '@vendure/admin-ui/core'; import { ModalService } from '@vendure/admin-ui/core'; +import { omit } from '@vendure/common/lib/omit'; +import { Observable, of, Subject } from 'rxjs'; +import { startWith, switchMap, take } from 'rxjs/operators'; + import { CancelOrderDialogComponent } from '../cancel-order-dialog/cancel-order-dialog.component'; import { FulfillOrderDialogComponent } from '../fulfill-order-dialog/fulfill-order-dialog.component'; import { RefundOrderDialogComponent } from '../refund-order-dialog/refund-order-dialog.component'; @@ -33,7 +33,7 @@ import { SettleRefundDialogComponent } from '../settle-refund-dialog/settle-refu export class OrderDetailComponent extends BaseDetailComponent implements OnInit, OnDestroy { detailForm = new FormGroup({}); - history$: Observable; + history$: Observable; fetchHistory = new Subject(); customFields: CustomFieldConfig[]; orderLineCustomFields: CustomFieldConfig[]; @@ -72,7 +72,7 @@ export class OrderDetailComponent extends BaseDetailComponent data.order && data.order.history.items); + .mapStream((data) => data.order && data.order.history.items); }), ); } @@ -86,7 +86,7 @@ export class OrderDetailComponent extends BaseDetailComponent a.type === AdjustmentType.PROMOTION); + return line.adjustments.filter((a) => a.type === AdjustmentType.PROMOTION); } getPromotionLink(promotion: OrderDetail.Adjustments): any[] { @@ -99,7 +99,7 @@ export class OrderDetailComponent extends BaseDetailComponent p.id === id); + const promotion = order.promotions.find((p) => p.id === id); if (promotion) { return promotion.couponCode || undefined; } @@ -110,8 +110,8 @@ export class OrderDetailComponent extends BaseDetailComponent val !== 'OrderAddress') - .filter(line => !!line); + .filter((val) => val !== 'OrderAddress') + .filter((line) => !!line); } settlePayment(payment: OrderDetail.Payments) { @@ -131,7 +131,7 @@ export class OrderDetailComponent extends BaseDetailComponent { + switchMap((order) => { return this.modalService.fromComponent(FulfillOrderDialogComponent, { size: 'xl', locals: { @@ -139,16 +139,16 @@ export class OrderDetailComponent extends BaseDetailComponent { + switchMap((input) => { if (input) { return this.dataService.order.createFullfillment(input); } else { return of(undefined); } }), - switchMap(result => this.refetchOrder(result)), + switchMap((result) => this.refetchOrder(result)), ) - .subscribe(result => { + .subscribe((result) => { if (result) { this.notificationService.success(_('order.create-fulfillment-success')); } @@ -172,7 +172,7 @@ export class OrderDetailComponent extends BaseDetailComponent { + switchMap((transactionId) => { if (transactionId) { return this.dataService.order.settleRefund( { @@ -187,7 +187,7 @@ export class OrderDetailComponent extends BaseDetailComponent this.refetchOrder(result)), ) - .subscribe(result => { + .subscribe((result) => { if (result) { this.notificationService.success(_('order.settle-refund-success')); } @@ -202,8 +202,8 @@ export class OrderDetailComponent extends BaseDetailComponent this.refetchOrder(result))) - .subscribe(result => { + .pipe(switchMap((result) => this.refetchOrder(result))) + .subscribe((result) => { this.notificationService.success(_('order.add-note-success')); }); } @@ -217,16 +217,16 @@ export class OrderDetailComponent extends BaseDetailComponent { + switchMap((input) => { if (input) { return this.dataService.order.cancelOrder(input); } else { return of(undefined); } }), - switchMap(result => this.refetchOrder(result)), + switchMap((result) => this.refetchOrder(result)), ) - .subscribe(result => { + .subscribe((result) => { if (result) { this.notificationService.success(_('order.cancelled-order-success')); } @@ -242,10 +242,10 @@ export class OrderDetailComponent extends BaseDetailComponent { + switchMap((input) => { if (input) { return this.dataService.order.refundOrder(omit(input, ['cancel'])).pipe( - switchMap(result => { + switchMap((result) => { if (input.cancel.length) { return this.dataService.order.cancelOrder({ orderId: this.id, @@ -261,9 +261,9 @@ export class OrderDetailComponent extends BaseDetailComponent this.refetchOrder(result)), + switchMap((result) => this.refetchOrder(result)), ) - .subscribe(result => { + .subscribe((result) => { if (result) { this.notificationService.success(_('order.refund-order-success')); } diff --git a/packages/admin-ui/src/lib/settings/src/components/test-order-builder/test-order-builder.component.ts b/packages/admin-ui/src/lib/settings/src/components/test-order-builder/test-order-builder.component.ts index e64ff497c5..c4df36e50e 100644 --- a/packages/admin-ui/src/lib/settings/src/components/test-order-builder/test-order-builder.component.ts +++ b/packages/admin-ui/src/lib/settings/src/components/test-order-builder/test-order-builder.component.ts @@ -42,7 +42,7 @@ export class TestOrderBuilderComponent implements OnInit { this.orderLinesChange.emit(this.lines); } this.initSearchResults(); - this.dataService.settings.getActiveChannel('cache-first').single$.subscribe(result => { + this.dataService.settings.getActiveChannel('cache-first').single$.subscribe((result) => { this.currencyCode = result.activeChannel.currencyCode; }); } @@ -56,14 +56,15 @@ export class TestOrderBuilderComponent implements OnInit { } private addToLines(result: SearchForTestOrder.Items) { - if (!this.lines.find(l => l.id === result.productVariantId)) { + if (!this.lines.find((l) => l.id === result.productVariantId)) { this.lines.push({ id: result.productVariantId, name: result.productVariantName, preview: result.productPreview, quantity: 1, sku: result.sku, - unitPriceWithTax: result.priceWithTax.value, + unitPriceWithTax: + (result.priceWithTax.__typename === 'SinglePrice' && result.priceWithTax.value) || 0, }); this.persistToLocalStorage(); this.orderLinesChange.emit(this.lines); @@ -76,7 +77,7 @@ export class TestOrderBuilderComponent implements OnInit { } removeLine(line: TestOrderLine) { - this.lines = this.lines.filter(l => l.id !== line.id); + this.lines = this.lines.filter((l) => l.id !== line.id); this.persistToLocalStorage(); this.orderLinesChange.emit(this.lines); } @@ -86,13 +87,13 @@ export class TestOrderBuilderComponent implements OnInit { debounceTime(200), distinctUntilChanged(), tap(() => (this.searchLoading = true)), - switchMap(term => { + switchMap((term) => { if (!term) { return of([]); } return this.dataService.settings .searchForTestOrder(term, 10) - .mapSingle(result => result.search.items); + .mapSingle((result) => result.search.items); }), tap(() => (this.searchLoading = false)), ); diff --git a/yarn.lock b/yarn.lock index fec25bdcdc..e5b975b3b9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -144,15 +144,15 @@ ora "4.0.3" rxjs "6.5.4" -"@angular/animations@9.0.6": - version "9.0.6" - resolved "https://registry.npmjs.org/@angular/animations/-/animations-9.0.6.tgz#d0c26f9e103948989416f7d8c26b5f5fd298d4a4" - integrity sha512-LNtzUrrjqLTlZyhuAEV0sdEV0yi52Ih/p+ozCr/ivhTSSemcPbniTBbJlFZO4NJ2BuS2iEXkXwZs3mm8Fvx5Sg== - -"@angular/cdk@9.1.0": +"@angular/animations@9.1.0": version "9.1.0" - resolved "https://registry.npmjs.org/@angular/cdk/-/cdk-9.1.0.tgz#da88568aed9efc39b160a0ac18cfca25f4961441" - integrity sha512-qKpAudJx9z0MD+ADptS0OZViJBTA49+JCKym0hPQUkcB9Po4Al6gu6oZ1VSXV5Ln3T84z9aAw/AhUGP/YCFNSQ== + resolved "https://registry.npmjs.org/@angular/animations/-/animations-9.1.0.tgz#3030e290683c0e2d63fa61060d36f659511d3b2c" + integrity sha512-o7X3HM+eocoryw3VrDUtG6Wci2KwtzyBFo3KBJXjQ16X6fwdkjTG+hLb7pp2CBFBEJW4tPYEy7cSBmEfMRTqag== + +"@angular/cdk@9.2.0": + version "9.2.0" + resolved "https://registry.npmjs.org/@angular/cdk/-/cdk-9.2.0.tgz#587e4a9d5046fa89a68d8eddaee6b185e2915842" + integrity sha512-jeeznvNDpR9POuxzz8Y0zFvMynG9HCJo3ZPTqOjlOq8Lj8876+rLsHDvKEMeLdwlkdi1EweYJW1CLQzI+TwqDA== optionalDependencies: parse5 "^5.0.0" @@ -182,10 +182,10 @@ universal-analytics "0.4.20" uuid "7.0.2" -"@angular/common@9.0.6": - version "9.0.6" - resolved "https://registry.npmjs.org/@angular/common/-/common-9.0.6.tgz#d9796d1f52f51852992aca09a1fe4794638cc953" - integrity sha512-z+c+zmoZTOQ2fT2sFQpHhpUbIYtjerxYmdOVpukprZCuv9WT2SGJfu4QVGSkeqejYnMp6VtXMdQ1CeAQojj0sw== +"@angular/common@9.1.0": + version "9.1.0" + resolved "https://registry.npmjs.org/@angular/common/-/common-9.1.0.tgz#f9b5353a28f9da6c06266bc7244bbabf9e005176" + integrity sha512-6JPLNtMhI03bGTVQJeSwc+dTjV6DtP7M/BAyzIV0InZP1D6XsOh2QahLFIaaN2sSxYA2ClKuwfX1v+rx9AbXQA== "@angular/compiler-cli@^9.0.6": version "9.1.0" @@ -217,35 +217,35 @@ resolved "https://registry.npmjs.org/@angular/compiler/-/compiler-9.1.0.tgz#e55b4f2f24df75283002d5e8e85e1acfc46928f6" integrity sha512-QHw/JSeTXHiJQ2Ih0EtU7FGsYcOr+0hwZhqwSW3EEn8TtUgA3DS5lXeiDV66f+3DdvNZFPmgiZIvun3ypxn1HA== -"@angular/core@9.0.6": - version "9.0.6" - resolved "https://registry.npmjs.org/@angular/core/-/core-9.0.6.tgz#cc72d859359b1bddc052549c20092905d6246ce7" - integrity sha512-egpVGqqI+L1QQFn9ziHIElXb0bCzY1l8vzyQGfm2KnxHpmx2TJp2uaaHh5LRcqYR7TLeGMpqmzhRxir6Up7AAQ== - -"@angular/forms@9.0.6": - version "9.0.6" - resolved "https://registry.npmjs.org/@angular/forms/-/forms-9.0.6.tgz#02df7adddd679706a8ac1bcc0f2da1fd5d11c348" - integrity sha512-mxUEqQny3scxQM/21QLKgtq5EcOm1Tn5cU3rStY1L8J6Mg+Rd2Rz4SY0WXQpaRKPj+WNd+PDgdGiRs3cAjfLFQ== - -"@angular/language-service@9.0.6": - version "9.0.6" - resolved "https://registry.npmjs.org/@angular/language-service/-/language-service-9.0.6.tgz#484bbaab9c08e72be31ca741e12f1b134d641c85" - integrity sha512-lyEYYsBXFhXKu3aT6XkKBmmf4c59lb/C6C15q4Dl8BW/wIuA/mNLosDKLnd/jCS0VpcY4v0HJRKg9SCopa8BhQ== - -"@angular/platform-browser-dynamic@9.0.6": - version "9.0.6" - resolved "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-9.0.6.tgz#cf8679210e6931233d5392e515fdb09c947a98a3" - integrity sha512-Z0/qHciqbR+c2fwGxrkr77tQkEKhZpAPljGva/VNoS3Ms1OikqZB9Ev7xmZOM9656khPBU38m3aLsTXAAnQ4YA== - -"@angular/platform-browser@9.0.6": - version "9.0.6" - resolved "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-9.0.6.tgz#6545454f964f3cbcfc8d854d89c0f2d97f4cd7b7" - integrity sha512-CA7dW+j1mVh3OUo3C2vIn05NxNgrDPK4vpfRIwBIn1gErpnIXCa2vgnRzn3H9zKizKt0iuwSIukEnWG280Q0xg== - -"@angular/router@9.0.6": - version "9.0.6" - resolved "https://registry.npmjs.org/@angular/router/-/router-9.0.6.tgz#a0d38380916337c4c0359892c03f75f93bf469bd" - integrity sha512-Ki1uk3jWPsoFh27SnyXatPSFK3ghF25pjiwWw9/inPvlS/HshSWgS2FbYf49LD5xVFF3Ni2Z5GRKxSEqxL8vQw== +"@angular/core@9.1.0": + version "9.1.0" + resolved "https://registry.npmjs.org/@angular/core/-/core-9.1.0.tgz#9dfc386bd1461e0fd4786031fd245da04371421c" + integrity sha512-RVlyegdIAij0P1wLY5ObIdsBAzvmHkHfElnmfiNKhaDftP6U/3zRtaKDu0bq0jvn1WCQ8zXxFQ8AWyKZwyFS+w== + +"@angular/forms@9.1.0": + version "9.1.0" + resolved "https://registry.npmjs.org/@angular/forms/-/forms-9.1.0.tgz#de14e34aa37bd41a28f93fee8666cd7f6393078c" + integrity sha512-5GC8HQlPChPV+168zLlm4yj4syA6N9ChSKV0tmzj1zIfMcub1UAOaB9IYaXRHQsjPFh9OuQXwmkzScyAfhEVjA== + +"@angular/language-service@9.1.0": + version "9.1.0" + resolved "https://registry.npmjs.org/@angular/language-service/-/language-service-9.1.0.tgz#b61aeec3469f0f33fec7bd30e6ad729cdf10b160" + integrity sha512-2f8ECoXrj40oS1rtIfi+F8T4WPzundcZDs8WMFNBuWYbk14v1S9sTgMEmZyePHGkPjt6IfYiLJKJCvVgrt1nxQ== + +"@angular/platform-browser-dynamic@9.1.0": + version "9.1.0" + resolved "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-9.1.0.tgz#830bd5038d1875736e87e68c3aef44f0f835e418" + integrity sha512-sMtz/poQ3TYaWZzWjrn9apKUZ/WKql2MYCWbpax7pql3GgC9OoTslc7ZEe7/d3ynfFE/CQqWBBOuWGD71Z0LMQ== + +"@angular/platform-browser@9.1.0": + version "9.1.0" + resolved "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-9.1.0.tgz#0bd40db37c9e314944c149de935b0f6cdd1f7350" + integrity sha512-OsS/blUjl8ranmDaRADjFAmvnlmwbT6WNU7dVov7FhV0rqesbwaOJ5bR0LSYHYpej7Jaa6oYk0v0XWkaH9LTFg== + +"@angular/router@9.1.0": + version "9.1.0" + resolved "https://registry.npmjs.org/@angular/router/-/router-9.1.0.tgz#df059c0f64fa41ada8f6b5ce741fe47d49f10194" + integrity sha512-cExO1nPnoPFiUJWZ28hTHozPLFoCmqr3xqcM57We0hhKE0esdrO+gRWKRH0EJERukLbU8coPKVhA8daGUpASiQ== "@apollo/federation@0.13.2", "@apollo/federation@^0.13.2": version "0.13.2"