@haus-tech/badge-plugin 4.0.0 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -53,6 +53,7 @@ let BadgeAdminResolver = class BadgeAdminResolver {
53
53
  return this.config;
54
54
  }
55
55
  };
56
+ exports.BadgeAdminResolver = BadgeAdminResolver;
56
57
  __decorate([
57
58
  (0, graphql_1.Query)(),
58
59
  __param(0, (0, core_1.Ctx)()),
@@ -91,9 +92,8 @@ __decorate([
91
92
  __metadata("design:paramtypes", []),
92
93
  __metadata("design:returntype", void 0)
93
94
  ], BadgeAdminResolver.prototype, "getBadgePluginConfig", null);
94
- BadgeAdminResolver = __decorate([
95
+ exports.BadgeAdminResolver = BadgeAdminResolver = __decorate([
95
96
  (0, graphql_1.Resolver)(),
96
97
  __param(0, (0, common_1.Inject)(constants_1.PLUGIN_INIT_OPTIONS)),
97
98
  __metadata("design:paramtypes", [Object, badge_service_1.BadgeService])
98
99
  ], BadgeAdminResolver);
99
- exports.BadgeAdminResolver = BadgeAdminResolver;
@@ -29,6 +29,7 @@ let ProductEntityResolver = class ProductEntityResolver {
29
29
  return this.badgeService.findBadgesForProduct(ctx, product);
30
30
  }
31
31
  };
32
+ exports.ProductEntityResolver = ProductEntityResolver;
32
33
  __decorate([
33
34
  (0, graphql_1.ResolveField)(),
34
35
  __param(0, (0, core_1.Ctx)()),
@@ -37,12 +38,11 @@ __decorate([
37
38
  __metadata("design:paramtypes", [core_1.RequestContext, core_1.Product]),
38
39
  __metadata("design:returntype", Promise)
39
40
  ], ProductEntityResolver.prototype, "badges", null);
40
- ProductEntityResolver = __decorate([
41
+ exports.ProductEntityResolver = ProductEntityResolver = __decorate([
41
42
  (0, graphql_1.Resolver)('Product'),
42
43
  __param(0, (0, common_1.Inject)(constants_1.PLUGIN_INIT_OPTIONS)),
43
44
  __metadata("design:paramtypes", [Object, badge_service_1.BadgeService])
44
45
  ], ProductEntityResolver);
45
- exports.ProductEntityResolver = ProductEntityResolver;
46
46
  let SearchResultEntityResolver = class SearchResultEntityResolver {
47
47
  config;
48
48
  badgeService;
@@ -54,6 +54,7 @@ let SearchResultEntityResolver = class SearchResultEntityResolver {
54
54
  return this.badgeService.findBadgesForSearchResult(ctx, searchResult);
55
55
  }
56
56
  };
57
+ exports.SearchResultEntityResolver = SearchResultEntityResolver;
57
58
  __decorate([
58
59
  (0, graphql_1.ResolveField)(),
59
60
  __param(0, (0, core_1.Ctx)()),
@@ -62,12 +63,11 @@ __decorate([
62
63
  __metadata("design:paramtypes", [core_1.RequestContext, Object]),
63
64
  __metadata("design:returntype", Promise)
64
65
  ], SearchResultEntityResolver.prototype, "badges", null);
65
- SearchResultEntityResolver = __decorate([
66
+ exports.SearchResultEntityResolver = SearchResultEntityResolver = __decorate([
66
67
  (0, graphql_1.Resolver)('SearchResult'),
67
68
  __param(0, (0, common_1.Inject)(constants_1.PLUGIN_INIT_OPTIONS)),
68
69
  __metadata("design:paramtypes", [Object, badge_service_1.BadgeService])
69
70
  ], SearchResultEntityResolver);
70
- exports.SearchResultEntityResolver = SearchResultEntityResolver;
71
71
  let ProductVariantEntityResolver = class ProductVariantEntityResolver {
72
72
  config;
73
73
  badgeService;
@@ -80,6 +80,7 @@ let ProductVariantEntityResolver = class ProductVariantEntityResolver {
80
80
  return this.badgeService.findByCollectionIds(ctx, collectionIds);
81
81
  }
82
82
  };
83
+ exports.ProductVariantEntityResolver = ProductVariantEntityResolver;
83
84
  __decorate([
84
85
  (0, graphql_1.ResolveField)(),
85
86
  __param(0, (0, core_1.Ctx)()),
@@ -88,12 +89,11 @@ __decorate([
88
89
  __metadata("design:paramtypes", [core_1.RequestContext, core_1.ProductVariant]),
89
90
  __metadata("design:returntype", Promise)
90
91
  ], ProductVariantEntityResolver.prototype, "badges", null);
91
- ProductVariantEntityResolver = __decorate([
92
+ exports.ProductVariantEntityResolver = ProductVariantEntityResolver = __decorate([
92
93
  (0, graphql_1.Resolver)('ProductVariant'),
93
94
  __param(0, (0, common_1.Inject)(constants_1.PLUGIN_INIT_OPTIONS)),
94
95
  __metadata("design:paramtypes", [Object, badge_service_1.BadgeService])
95
96
  ], ProductVariantEntityResolver);
96
- exports.ProductVariantEntityResolver = ProductVariantEntityResolver;
97
97
  let BadgeShopResolver = class BadgeShopResolver {
98
98
  config;
99
99
  badgeService;
@@ -111,6 +111,7 @@ let BadgeShopResolver = class BadgeShopResolver {
111
111
  return this.badgeService.findByCollectionIds(ctx, args.collectionIds);
112
112
  }
113
113
  };
114
+ exports.BadgeShopResolver = BadgeShopResolver;
114
115
  __decorate([
115
116
  (0, graphql_1.Query)(),
116
117
  __param(0, (0, core_1.Ctx)()),
@@ -135,9 +136,8 @@ __decorate([
135
136
  __metadata("design:paramtypes", [core_1.RequestContext, Object]),
136
137
  __metadata("design:returntype", Promise)
137
138
  ], BadgeShopResolver.prototype, "getBadgesFromCollections", null);
138
- BadgeShopResolver = __decorate([
139
+ exports.BadgeShopResolver = BadgeShopResolver = __decorate([
139
140
  (0, graphql_1.Resolver)(),
140
141
  __param(0, (0, common_1.Inject)(constants_1.PLUGIN_INIT_OPTIONS)),
141
142
  __metadata("design:paramtypes", [Object, badge_service_1.BadgeService])
142
143
  ], BadgeShopResolver);
143
- exports.BadgeShopResolver = BadgeShopResolver;
@@ -19,7 +19,8 @@ const badge_entity_1 = require("./entity/badge.entity");
19
19
  const path_1 = __importDefault(require("path"));
20
20
  const badge_service_1 = require("./service/badge.service");
21
21
  const shop_resolver_1 = require("./api/shop.resolver");
22
- let BadgePlugin = BadgePlugin_1 = class BadgePlugin {
22
+ let BadgePlugin = class BadgePlugin {
23
+ static { BadgePlugin_1 = this; }
23
24
  static options = {
24
25
  availablePositions: ['top-left', 'top-right', 'bottom-left', 'bottom-right'],
25
26
  };
@@ -50,13 +51,14 @@ let BadgePlugin = BadgePlugin_1 = class BadgePlugin {
50
51
  ],
51
52
  };
52
53
  };
53
- BadgePlugin = BadgePlugin_1 = __decorate([
54
+ exports.BadgePlugin = BadgePlugin;
55
+ exports.BadgePlugin = BadgePlugin = BadgePlugin_1 = __decorate([
54
56
  (0, core_1.VendurePlugin)({
55
57
  imports: [core_1.PluginCommonModule],
56
58
  providers: [
57
59
  {
58
60
  provide: constants_1.PLUGIN_INIT_OPTIONS,
59
- useFactory: () => BadgePlugin_1.options,
61
+ useFactory: () => BadgePlugin.options,
60
62
  },
61
63
  badge_service_1.BadgeService,
62
64
  ],
@@ -77,4 +79,3 @@ BadgePlugin = BadgePlugin_1 = __decorate([
77
79
  compatibility: '^3.0.0',
78
80
  })
79
81
  ], BadgePlugin);
80
- exports.BadgePlugin = BadgePlugin;
@@ -29,6 +29,7 @@ let Badge = class Badge extends core_1.VendureEntity {
29
29
  collection;
30
30
  collectionId;
31
31
  };
32
+ exports.Badge = Badge;
32
33
  __decorate([
33
34
  (0, typeorm_1.ManyToMany)((type) => core_1.Channel),
34
35
  (0, typeorm_1.JoinTable)(),
@@ -73,8 +74,7 @@ __decorate([
73
74
  (0, core_1.EntityId)({ nullable: true }),
74
75
  __metadata("design:type", Object)
75
76
  ], Badge.prototype, "collectionId", void 0);
76
- Badge = __decorate([
77
+ exports.Badge = Badge = __decorate([
77
78
  (0, typeorm_1.Entity)(),
78
79
  __metadata("design:paramtypes", [Object])
79
80
  ], Badge);
80
- exports.Badge = Badge;
@@ -6,13 +6,13 @@ var AdjustmentType;
6
6
  AdjustmentType["DISTRIBUTED_ORDER_PROMOTION"] = "DISTRIBUTED_ORDER_PROMOTION";
7
7
  AdjustmentType["OTHER"] = "OTHER";
8
8
  AdjustmentType["PROMOTION"] = "PROMOTION";
9
- })(AdjustmentType = exports.AdjustmentType || (exports.AdjustmentType = {}));
9
+ })(AdjustmentType || (exports.AdjustmentType = AdjustmentType = {}));
10
10
  var AssetType;
11
11
  (function (AssetType) {
12
12
  AssetType["BINARY"] = "BINARY";
13
13
  AssetType["IMAGE"] = "IMAGE";
14
14
  AssetType["VIDEO"] = "VIDEO";
15
- })(AssetType = exports.AssetType || (exports.AssetType = {}));
15
+ })(AssetType || (exports.AssetType = AssetType = {}));
16
16
  /**
17
17
  * @description
18
18
  * ISO 4217 currency code
@@ -335,14 +335,14 @@ var CurrencyCode;
335
335
  CurrencyCode["ZMW"] = "ZMW";
336
336
  /** Zimbabwean dollar */
337
337
  CurrencyCode["ZWL"] = "ZWL";
338
- })(CurrencyCode = exports.CurrencyCode || (exports.CurrencyCode = {}));
338
+ })(CurrencyCode || (exports.CurrencyCode = CurrencyCode = {}));
339
339
  var DeletionResult;
340
340
  (function (DeletionResult) {
341
341
  /** The entity was successfully deleted */
342
342
  DeletionResult["DELETED"] = "DELETED";
343
343
  /** Deletion did not take place, reason given in message */
344
344
  DeletionResult["NOT_DELETED"] = "NOT_DELETED";
345
- })(DeletionResult = exports.DeletionResult || (exports.DeletionResult = {}));
345
+ })(DeletionResult || (exports.DeletionResult = DeletionResult = {}));
346
346
  var ErrorCode;
347
347
  (function (ErrorCode) {
348
348
  ErrorCode["ALREADY_REFUNDED_ERROR"] = "ALREADY_REFUNDED_ERROR";
@@ -388,13 +388,13 @@ var ErrorCode;
388
388
  ErrorCode["REFUND_STATE_TRANSITION_ERROR"] = "REFUND_STATE_TRANSITION_ERROR";
389
389
  ErrorCode["SETTLE_PAYMENT_ERROR"] = "SETTLE_PAYMENT_ERROR";
390
390
  ErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
391
- })(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));
391
+ })(ErrorCode || (exports.ErrorCode = ErrorCode = {}));
392
392
  var GlobalFlag;
393
393
  (function (GlobalFlag) {
394
394
  GlobalFlag["FALSE"] = "FALSE";
395
395
  GlobalFlag["INHERIT"] = "INHERIT";
396
396
  GlobalFlag["TRUE"] = "TRUE";
397
- })(GlobalFlag = exports.GlobalFlag || (exports.GlobalFlag = {}));
397
+ })(GlobalFlag || (exports.GlobalFlag = GlobalFlag = {}));
398
398
  var HistoryEntryType;
399
399
  (function (HistoryEntryType) {
400
400
  HistoryEntryType["CUSTOMER_ADDED_TO_GROUP"] = "CUSTOMER_ADDED_TO_GROUP";
@@ -421,7 +421,7 @@ var HistoryEntryType;
421
421
  HistoryEntryType["ORDER_PAYMENT_TRANSITION"] = "ORDER_PAYMENT_TRANSITION";
422
422
  HistoryEntryType["ORDER_REFUND_TRANSITION"] = "ORDER_REFUND_TRANSITION";
423
423
  HistoryEntryType["ORDER_STATE_TRANSITION"] = "ORDER_STATE_TRANSITION";
424
- })(HistoryEntryType = exports.HistoryEntryType || (exports.HistoryEntryType = {}));
424
+ })(HistoryEntryType || (exports.HistoryEntryType = HistoryEntryType = {}));
425
425
  /**
426
426
  * @description
427
427
  * The state of a Job in the JobQueue
@@ -436,7 +436,7 @@ var JobState;
436
436
  JobState["PENDING"] = "PENDING";
437
437
  JobState["RETRYING"] = "RETRYING";
438
438
  JobState["RUNNING"] = "RUNNING";
439
- })(JobState = exports.JobState || (exports.JobState = {}));
439
+ })(JobState || (exports.JobState = JobState = {}));
440
440
  /**
441
441
  * @description
442
442
  * Languages in the form of a ISO 639-1 language code with optional
@@ -762,28 +762,28 @@ var LanguageCode;
762
762
  LanguageCode["zh_Hant"] = "zh_Hant";
763
763
  /** Zulu */
764
764
  LanguageCode["zu"] = "zu";
765
- })(LanguageCode = exports.LanguageCode || (exports.LanguageCode = {}));
765
+ })(LanguageCode || (exports.LanguageCode = LanguageCode = {}));
766
766
  var LogicalOperator;
767
767
  (function (LogicalOperator) {
768
768
  LogicalOperator["AND"] = "AND";
769
769
  LogicalOperator["OR"] = "OR";
770
- })(LogicalOperator = exports.LogicalOperator || (exports.LogicalOperator = {}));
770
+ })(LogicalOperator || (exports.LogicalOperator = LogicalOperator = {}));
771
771
  var MetricInterval;
772
772
  (function (MetricInterval) {
773
773
  MetricInterval["Daily"] = "Daily";
774
- })(MetricInterval = exports.MetricInterval || (exports.MetricInterval = {}));
774
+ })(MetricInterval || (exports.MetricInterval = MetricInterval = {}));
775
775
  var MetricType;
776
776
  (function (MetricType) {
777
777
  MetricType["AverageOrderValue"] = "AverageOrderValue";
778
778
  MetricType["OrderCount"] = "OrderCount";
779
779
  MetricType["OrderTotal"] = "OrderTotal";
780
- })(MetricType = exports.MetricType || (exports.MetricType = {}));
780
+ })(MetricType || (exports.MetricType = MetricType = {}));
781
781
  var OrderType;
782
782
  (function (OrderType) {
783
783
  OrderType["Aggregate"] = "Aggregate";
784
784
  OrderType["Regular"] = "Regular";
785
785
  OrderType["Seller"] = "Seller";
786
- })(OrderType = exports.OrderType || (exports.OrderType = {}));
786
+ })(OrderType || (exports.OrderType = OrderType = {}));
787
787
  /**
788
788
  * @description
789
789
  * Permissions for administrators and customers. Used to control access to
@@ -1006,12 +1006,12 @@ var Permission;
1006
1006
  Permission["UpdateTaxRate"] = "UpdateTaxRate";
1007
1007
  /** Grants permission to update Zone */
1008
1008
  Permission["UpdateZone"] = "UpdateZone";
1009
- })(Permission = exports.Permission || (exports.Permission = {}));
1009
+ })(Permission || (exports.Permission = Permission = {}));
1010
1010
  var SortOrder;
1011
1011
  (function (SortOrder) {
1012
1012
  SortOrder["ASC"] = "ASC";
1013
1013
  SortOrder["DESC"] = "DESC";
1014
- })(SortOrder = exports.SortOrder || (exports.SortOrder = {}));
1014
+ })(SortOrder || (exports.SortOrder = SortOrder = {}));
1015
1015
  var StockMovementType;
1016
1016
  (function (StockMovementType) {
1017
1017
  StockMovementType["ADJUSTMENT"] = "ADJUSTMENT";
@@ -1020,4 +1020,4 @@ var StockMovementType;
1020
1020
  StockMovementType["RELEASE"] = "RELEASE";
1021
1021
  StockMovementType["RETURN"] = "RETURN";
1022
1022
  StockMovementType["SALE"] = "SALE";
1023
- })(StockMovementType = exports.StockMovementType || (exports.StockMovementType = {}));
1023
+ })(StockMovementType || (exports.StockMovementType = StockMovementType = {}));
@@ -1,14 +1,18 @@
1
- import { AssetService, CollectionService, EntityHydrator, ErrorResult, ListQueryBuilder, ListQueryOptions, PaginatedList, Product, RequestContext, TransactionalConnection } from '@vendure/core';
1
+ import { OnApplicationBootstrap } from '@nestjs/common';
2
+ import { AssetService, ChannelService, CollectionService, EntityHydrator, ErrorResult, ListQueryBuilder, ListQueryOptions, PaginatedList, Product, RequestContext, TransactionalConnection } from '@vendure/core';
2
3
  import { Badge } from '../entity/badge.entity';
3
4
  import { CreateBadgeInput, DeletionResponse, UpdateBadgeInput } from '../gql/generated';
4
5
  import { SearchResult } from '@vendure/common/lib/generated-shop-types';
5
- export declare class BadgeService {
6
+ import { AssignBadgesToChannelInput } from '../types';
7
+ export declare class BadgeService implements OnApplicationBootstrap {
6
8
  private listQueryBuilder;
7
9
  private connection;
8
10
  private assetService;
9
11
  private entityHydratorService;
10
12
  private collectionService;
11
- constructor(listQueryBuilder: ListQueryBuilder, connection: TransactionalConnection, assetService: AssetService, entityHydratorService: EntityHydrator, collectionService: CollectionService);
13
+ private channelService;
14
+ constructor(listQueryBuilder: ListQueryBuilder, connection: TransactionalConnection, assetService: AssetService, entityHydratorService: EntityHydrator, collectionService: CollectionService, channelService: ChannelService);
15
+ onApplicationBootstrap(): Promise<void>;
12
16
  findOne(ctx: RequestContext, id: number): Promise<Badge | null>;
13
17
  findAll(ctx: RequestContext, options?: ListQueryOptions<Badge>): Promise<PaginatedList<Badge>>;
14
18
  create(ctx: RequestContext, input: CreateBadgeInput): Promise<Badge>;
@@ -18,4 +22,5 @@ export declare class BadgeService {
18
22
  findByCollectionIds(ctx: RequestContext, collectionIds: string[]): Promise<Badge[]>;
19
23
  findBadgesForProduct(ctx: RequestContext, product: Product): Promise<Badge[]>;
20
24
  findBadgesForSearchResult(ctx: RequestContext, searchResult: SearchResult): Promise<Badge[]>;
25
+ assignToChannel(ctx: RequestContext, input: AssignBadgesToChannelInput): Promise<Badge[]>;
21
26
  }
@@ -21,12 +21,28 @@ let BadgeService = class BadgeService {
21
21
  assetService;
22
22
  entityHydratorService;
23
23
  collectionService;
24
- constructor(listQueryBuilder, connection, assetService, entityHydratorService, collectionService) {
24
+ channelService;
25
+ constructor(listQueryBuilder, connection, assetService, entityHydratorService, collectionService, channelService) {
25
26
  this.listQueryBuilder = listQueryBuilder;
26
27
  this.connection = connection;
27
28
  this.assetService = assetService;
28
29
  this.entityHydratorService = entityHydratorService;
29
30
  this.collectionService = collectionService;
31
+ this.channelService = channelService;
32
+ }
33
+ async onApplicationBootstrap() {
34
+ // Assign all badges which are not assigned to any channel to the default channel
35
+ const defaultChannel = await this.channelService.getDefaultChannel();
36
+ const badgesWithoutChannels = await this.connection.rawConnection
37
+ .getRepository(badge_entity_1.Badge)
38
+ .createQueryBuilder('badge')
39
+ .leftJoinAndSelect('badge.channels', 'channel')
40
+ .where('channel.id IS NULL')
41
+ .getMany();
42
+ for (const badge of badgesWithoutChannels) {
43
+ badge.channels = [defaultChannel];
44
+ await this.connection.rawConnection.getRepository(badge_entity_1.Badge).save(badge);
45
+ }
30
46
  }
31
47
  async findOne(ctx, id) {
32
48
  return this.connection.getRepository(ctx, badge_entity_1.Badge).findOne({ where: { id } });
@@ -107,13 +123,21 @@ let BadgeService = class BadgeService {
107
123
  const collectionIds = collections.map((c) => c.id);
108
124
  return this.findByCollectionIds(ctx, collectionIds);
109
125
  }
126
+ async assignToChannel(ctx, input) {
127
+ const badges = await this.connection.findByIdsInChannel(ctx, badge_entity_1.Badge, input.badgeIds, ctx.channelId, {});
128
+ await Promise.all(badges.map(async (badge) => {
129
+ await this.channelService.assignToChannels(ctx, badge_entity_1.Badge, badge.id, [input.channelId]);
130
+ }));
131
+ return this.connection.findByIdsInChannel(ctx, badge_entity_1.Badge, badges.map((b) => b.id), ctx.channelId, {});
132
+ }
110
133
  };
111
- BadgeService = __decorate([
134
+ exports.BadgeService = BadgeService;
135
+ exports.BadgeService = BadgeService = __decorate([
112
136
  (0, common_1.Injectable)(),
113
137
  __metadata("design:paramtypes", [core_1.ListQueryBuilder,
114
138
  core_1.TransactionalConnection,
115
139
  core_1.AssetService,
116
140
  core_1.EntityHydrator,
117
- core_1.CollectionService])
141
+ core_1.CollectionService,
142
+ core_1.ChannelService])
118
143
  ], BadgeService);
119
- exports.BadgeService = BadgeService;
@@ -0,0 +1,5 @@
1
+ import { Scalars } from '@vendure/core';
2
+ export type AssignBadgesToChannelInput = {
3
+ badgeIds: Array<Scalars['ID']>;
4
+ channelId: Scalars['ID'];
5
+ };
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,10 +1,9 @@
1
- /// <reference types="node" />
2
1
  import { TypedBaseListComponent, NotificationService, ModalService, SelectionManager } from '@vendure/admin-ui/core';
3
2
  import { OnInit, OnChanges, SimpleChanges } from '@angular/core';
4
3
  import { Badge } from './gql/graphql';
5
4
  import { Asset } from '@vendure/core';
6
5
  declare const getBadgeListDocument: import("apollo-angular").TypedDocumentNode<import("./gql/graphql").GetBadgesQuery, import("./gql/graphql").Exact<{
7
- options?: import("./gql/graphql").InputMaybe<import("./gql/graphql").BadgeListOptions> | undefined;
6
+ options?: import("./gql/graphql").InputMaybe<import("./gql/graphql").BadgeListOptions>;
8
7
  }>>;
9
8
  export interface BadgePluginOptions {
10
9
  availablePositions: string[];
@@ -17,6 +17,8 @@ const graphql_1 = require("./gql/graphql");
17
17
  const ngx_translate_extract_marker_1 = require("@biesbjerg/ngx-translate-extract-marker");
18
18
  const rxjs_1 = require("rxjs");
19
19
  const operators_1 = require("rxjs/operators");
20
+ const common_1 = require("@angular/common");
21
+ const update_badge_component_1 = require("./update-badge.component");
20
22
  const getBadgeListDocument = (0, gql_1.graphql)(`
21
23
  query GetBadges($options: BadgeListOptions) {
22
24
  badges(options: $options) {
@@ -89,12 +91,7 @@ let BadgeListComponent = class BadgeListComponent extends core_1.TypedBaseListCo
89
91
  this.badges = data.badges.items;
90
92
  return data.badges;
91
93
  },
92
- setVariables: () => ({
93
- options: {
94
- skip: 0,
95
- take: 999,
96
- },
97
- }),
94
+ setVariables: () => ({ options: { skip: 0, take: 999 } }),
98
95
  refreshListOnChanges: [],
99
96
  });
100
97
  this.dataService
@@ -171,10 +168,7 @@ let BadgeListComponent = class BadgeListComponent extends core_1.TypedBaseListCo
171
168
  for (const asset of assets) {
172
169
  await this.dataService
173
170
  .mutate(createBadgeDocument, {
174
- input: {
175
- assetId: asset.id,
176
- position: this.config.availablePositions[0],
177
- },
171
+ input: { assetId: asset.id, position: this.config.availablePositions[0] },
178
172
  })
179
173
  .toPromise();
180
174
  }
@@ -191,15 +185,11 @@ let BadgeListComponent = class BadgeListComponent extends core_1.TypedBaseListCo
191
185
  }
192
186
  }))
193
187
  .subscribe(() => {
194
- this.notificationService.success((0, ngx_translate_extract_marker_1.marker)('common.notify-delete-success'), {
195
- entity: 'Badges',
196
- });
188
+ this.notificationService.success((0, ngx_translate_extract_marker_1.marker)('common.notify-delete-success'), { entity: 'Badges' });
197
189
  this.refresh();
198
190
  this.selectionManager.clearSelection();
199
191
  }, () => {
200
- this.notificationService.error((0, ngx_translate_extract_marker_1.marker)('common.notify-delete-error'), {
201
- entity: 'Badges',
202
- });
192
+ this.notificationService.error((0, ngx_translate_extract_marker_1.marker)('common.notify-delete-error'), { entity: 'Badges' });
203
193
  });
204
194
  }
205
195
  onBadgeUpdated() {
@@ -209,31 +199,27 @@ let BadgeListComponent = class BadgeListComponent extends core_1.TypedBaseListCo
209
199
  return this.modalService
210
200
  .dialog({
211
201
  title: (0, ngx_translate_extract_marker_1.marker)('badge-plugin.confirm-delete-badges'),
212
- translationVars: {
213
- count: badgeIds.length,
214
- },
202
+ translationVars: { count: badgeIds.length },
215
203
  body: message,
216
204
  buttons: [
217
205
  { type: 'secondary', label: (0, ngx_translate_extract_marker_1.marker)('common.cancel') },
218
206
  { type: 'danger', label: (0, ngx_translate_extract_marker_1.marker)('common.delete'), returnValue: true },
219
207
  ],
220
208
  })
221
- .pipe((0, operators_1.switchMap)((res) => res
222
- ? this.dataService.mutate(deleteBadgeDocument, {
223
- ids: badgeIds,
224
- })
225
- : rxjs_1.EMPTY), (0, operators_1.map)((res) => res.deleteBadge));
209
+ .pipe((0, operators_1.switchMap)((res) => res ? this.dataService.mutate(deleteBadgeDocument, { ids: badgeIds }) : rxjs_1.EMPTY), (0, operators_1.map)((res) => res.deleteBadge));
226
210
  }
227
211
  };
228
- BadgeListComponent = __decorate([
212
+ exports.BadgeListComponent = BadgeListComponent;
213
+ exports.BadgeListComponent = BadgeListComponent = __decorate([
229
214
  (0, core_2.Component)({
230
215
  selector: 'badge-list',
231
216
  templateUrl: './badge-list.component.html',
232
217
  styleUrls: ['./badge-list.component.scss'],
233
218
  changeDetection: core_2.ChangeDetectionStrategy.OnPush,
219
+ standalone: true,
220
+ imports: [common_1.CommonModule, update_badge_component_1.UpdateBadgeComponent],
234
221
  }),
235
222
  (0, core_2.Injectable)(),
236
223
  __metadata("design:paramtypes", [core_1.NotificationService,
237
224
  core_1.ModalService])
238
225
  ], BadgeListComponent);
239
- exports.BadgeListComponent = BadgeListComponent;
@@ -18,6 +18,8 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'
18
18
  import { EMPTY } from 'rxjs'
19
19
  import { finalize, map, switchMap } from 'rxjs/operators'
20
20
  import { Asset } from '@vendure/core'
21
+ import { CommonModule } from '@angular/common'
22
+ import { UpdateBadgeComponent } from './update-badge.component'
21
23
 
22
24
  const getBadgeListDocument = graphql(`
23
25
  query GetBadges($options: BadgeListOptions) {
@@ -82,6 +84,8 @@ export interface BadgePluginOptions {
82
84
  templateUrl: './badge-list.component.html',
83
85
  styleUrls: ['./badge-list.component.scss'],
84
86
  changeDetection: ChangeDetectionStrategy.OnPush,
87
+ standalone: true,
88
+ imports: [CommonModule, UpdateBadgeComponent],
85
89
  })
86
90
  @Injectable()
87
91
  export class BadgeListComponent
@@ -110,12 +114,7 @@ export class BadgeListComponent
110
114
  this.badges = data.badges.items as Badge[]
111
115
  return data.badges
112
116
  },
113
- setVariables: () => ({
114
- options: {
115
- skip: 0,
116
- take: 999,
117
- },
118
- }),
117
+ setVariables: () => ({ options: { skip: 0, take: 999 } }),
119
118
  refreshListOnChanges: [],
120
119
  })
121
120
 
@@ -203,10 +202,7 @@ export class BadgeListComponent
203
202
  for (const asset of assets) {
204
203
  await this.dataService
205
204
  .mutate(createBadgeDocument, {
206
- input: {
207
- assetId: asset.id as string,
208
- position: this.config.availablePositions[0],
209
- },
205
+ input: { assetId: asset.id as string, position: this.config.availablePositions[0] },
210
206
  })
211
207
  .toPromise()
212
208
  }
@@ -229,16 +225,12 @@ export class BadgeListComponent
229
225
  )
230
226
  .subscribe(
231
227
  () => {
232
- this.notificationService.success(_('common.notify-delete-success'), {
233
- entity: 'Badges',
234
- })
228
+ this.notificationService.success(_('common.notify-delete-success'), { entity: 'Badges' })
235
229
  this.refresh()
236
230
  this.selectionManager.clearSelection()
237
231
  },
238
232
  () => {
239
- this.notificationService.error(_('common.notify-delete-error'), {
240
- entity: 'Badges',
241
- })
233
+ this.notificationService.error(_('common.notify-delete-error'), { entity: 'Badges' })
242
234
  },
243
235
  )
244
236
  }
@@ -251,9 +243,7 @@ export class BadgeListComponent
251
243
  return this.modalService
252
244
  .dialog({
253
245
  title: _('badge-plugin.confirm-delete-badges'),
254
- translationVars: {
255
- count: badgeIds.length,
256
- },
246
+ translationVars: { count: badgeIds.length },
257
247
  body: message,
258
248
  buttons: [
259
249
  { type: 'secondary', label: _('common.cancel') },
@@ -262,11 +252,7 @@ export class BadgeListComponent
262
252
  })
263
253
  .pipe(
264
254
  switchMap((res) =>
265
- res
266
- ? this.dataService.mutate(deleteBadgeDocument, {
267
- ids: badgeIds,
268
- })
269
- : EMPTY,
255
+ res ? this.dataService.mutate(deleteBadgeDocument, { ids: badgeIds }) : EMPTY,
270
256
  ),
271
257
  map((res) => res.deleteBadge),
272
258
  )
@@ -11,7 +11,8 @@ const core_1 = require("@angular/core");
11
11
  const core_2 = require("@vendure/admin-ui/core");
12
12
  let BadgesNavModule = class BadgesNavModule {
13
13
  };
14
- BadgesNavModule = __decorate([
14
+ exports.BadgesNavModule = BadgesNavModule;
15
+ exports.BadgesNavModule = BadgesNavModule = __decorate([
15
16
  (0, core_1.NgModule)({
16
17
  imports: [core_2.SharedModule],
17
18
  providers: [
@@ -24,4 +25,3 @@ BadgesNavModule = __decorate([
24
25
  ],
25
26
  })
26
27
  ], BadgesNavModule);
27
- exports.BadgesNavModule = BadgesNavModule;
@@ -14,10 +14,13 @@ const badge_list_component_1 = require("./badge-list.component");
14
14
  const update_badge_component_1 = require("./update-badge.component");
15
15
  let BadgeModule = class BadgeModule {
16
16
  };
17
- BadgeModule = __decorate([
17
+ exports.BadgeModule = BadgeModule;
18
+ exports.BadgeModule = BadgeModule = __decorate([
18
19
  (0, core_1.NgModule)({
19
20
  imports: [
20
21
  core_2.SharedModule,
22
+ badge_list_component_1.BadgeListComponent,
23
+ update_badge_component_1.UpdateBadgeComponent,
21
24
  router_1.RouterModule.forChild([
22
25
  {
23
26
  path: '',
@@ -28,7 +31,5 @@ BadgeModule = __decorate([
28
31
  ]),
29
32
  ],
30
33
  providers: [],
31
- declarations: [badge_list_component_1.BadgeListComponent, update_badge_component_1.UpdateBadgeComponent],
32
34
  })
33
35
  ], BadgeModule);
34
- exports.BadgeModule = BadgeModule;
@@ -7,6 +7,8 @@ import { UpdateBadgeComponent } from './update-badge.component'
7
7
  @NgModule({
8
8
  imports: [
9
9
  SharedModule,
10
+ BadgeListComponent,
11
+ UpdateBadgeComponent,
10
12
  RouterModule.forChild([
11
13
  {
12
14
  path: '',
@@ -17,6 +19,5 @@ import { UpdateBadgeComponent } from './update-badge.component'
17
19
  ]),
18
20
  ],
19
21
  providers: [],
20
- declarations: [BadgeListComponent, UpdateBadgeComponent],
21
22
  })
22
23
  export class BadgeModule {}
@@ -12,13 +12,13 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
12
12
  */
13
13
  declare const documents: {
14
14
  "\n query GetBadges($options: BadgeListOptions) {\n badges(options: $options) {\n items {\n id\n createdAt\n updatedAt\n collection {\n id\n }\n collectionId\n position\n asset {\n id\n name\n type\n mimeType\n width\n height\n fileSize\n source\n preview\n }\n }\n totalItems\n }\n }\n": DocumentNode<types.GetBadgesQuery, types.Exact<{
15
- options?: types.InputMaybe<types.BadgeListOptions> | undefined;
15
+ options?: types.InputMaybe<types.BadgeListOptions>;
16
16
  }>>;
17
17
  "\n mutation CreateBadge($input: CreateBadgeInput!) {\n createBadge(input: $input) {\n id\n }\n }\n": DocumentNode<types.CreateBadgeMutation, types.Exact<{
18
18
  input: types.CreateBadgeInput;
19
19
  }>>;
20
20
  "\n mutation DeleteBadge($ids: [ID!]!) {\n deleteBadge(ids: $ids) {\n result\n message\n }\n }\n": DocumentNode<types.DeleteBadgeMutation, types.Exact<{
21
- ids: string | string[];
21
+ ids: Array<types.Scalars["ID"]["input"]> | types.Scalars["ID"]["input"];
22
22
  }>>;
23
23
  "\n query GetBadgePluginConfig {\n getBadgePluginConfig {\n availablePositions\n }\n }\n": DocumentNode<types.GetBadgePluginConfigQuery, types.Exact<{
24
24
  [key: string]: never;
@@ -15,15 +15,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.graphql = void 0;
36
+ exports.graphql = graphql;
27
37
  /* eslint-disable */
28
38
  const types = __importStar(require("./graphql"));
29
39
  /**
@@ -46,4 +56,3 @@ const documents = {
46
56
  function graphql(source) {
47
57
  return documents[source] ?? {};
48
58
  }
49
- exports.graphql = graphql;
@@ -5987,18 +5987,8 @@ export type UpdateBadgeMutation = {
5987
5987
  id: string;
5988
5988
  };
5989
5989
  };
5990
- export declare const GetBadgesDocument: DocumentNode<GetBadgesQuery, Exact<{
5991
- options?: InputMaybe<BadgeListOptions> | undefined;
5992
- }>>;
5993
- export declare const CreateBadgeDocument: DocumentNode<CreateBadgeMutation, Exact<{
5994
- input: CreateBadgeInput;
5995
- }>>;
5996
- export declare const DeleteBadgeDocument: DocumentNode<DeleteBadgeMutation, Exact<{
5997
- ids: Array<Scalars['ID']['input']> | Scalars['ID']['input'];
5998
- }>>;
5999
- export declare const GetBadgePluginConfigDocument: DocumentNode<GetBadgePluginConfigQuery, Exact<{
6000
- [key: string]: never;
6001
- }>>;
6002
- export declare const UpdateBadgeDocument: DocumentNode<UpdateBadgeMutation, Exact<{
6003
- input: UpdateBadgeInput;
6004
- }>>;
5990
+ export declare const GetBadgesDocument: DocumentNode<GetBadgesQuery, GetBadgesQueryVariables>;
5991
+ export declare const CreateBadgeDocument: DocumentNode<CreateBadgeMutation, CreateBadgeMutationVariables>;
5992
+ export declare const DeleteBadgeDocument: DocumentNode<DeleteBadgeMutation, DeleteBadgeMutationVariables>;
5993
+ export declare const GetBadgePluginConfigDocument: DocumentNode<GetBadgePluginConfigQuery, GetBadgePluginConfigQueryVariables>;
5994
+ export declare const UpdateBadgeDocument: DocumentNode<UpdateBadgeMutation, UpdateBadgeMutationVariables>;
@@ -6,13 +6,13 @@ var AdjustmentType;
6
6
  AdjustmentType["DISTRIBUTED_ORDER_PROMOTION"] = "DISTRIBUTED_ORDER_PROMOTION";
7
7
  AdjustmentType["OTHER"] = "OTHER";
8
8
  AdjustmentType["PROMOTION"] = "PROMOTION";
9
- })(AdjustmentType = exports.AdjustmentType || (exports.AdjustmentType = {}));
9
+ })(AdjustmentType || (exports.AdjustmentType = AdjustmentType = {}));
10
10
  var AssetType;
11
11
  (function (AssetType) {
12
12
  AssetType["BINARY"] = "BINARY";
13
13
  AssetType["IMAGE"] = "IMAGE";
14
14
  AssetType["VIDEO"] = "VIDEO";
15
- })(AssetType = exports.AssetType || (exports.AssetType = {}));
15
+ })(AssetType || (exports.AssetType = AssetType = {}));
16
16
  /**
17
17
  * @description
18
18
  * ISO 4217 currency code
@@ -335,14 +335,14 @@ var CurrencyCode;
335
335
  CurrencyCode["ZMW"] = "ZMW";
336
336
  /** Zimbabwean dollar */
337
337
  CurrencyCode["ZWL"] = "ZWL";
338
- })(CurrencyCode = exports.CurrencyCode || (exports.CurrencyCode = {}));
338
+ })(CurrencyCode || (exports.CurrencyCode = CurrencyCode = {}));
339
339
  var DeletionResult;
340
340
  (function (DeletionResult) {
341
341
  /** The entity was successfully deleted */
342
342
  DeletionResult["DELETED"] = "DELETED";
343
343
  /** Deletion did not take place, reason given in message */
344
344
  DeletionResult["NOT_DELETED"] = "NOT_DELETED";
345
- })(DeletionResult = exports.DeletionResult || (exports.DeletionResult = {}));
345
+ })(DeletionResult || (exports.DeletionResult = DeletionResult = {}));
346
346
  var ErrorCode;
347
347
  (function (ErrorCode) {
348
348
  ErrorCode["ALREADY_REFUNDED_ERROR"] = "ALREADY_REFUNDED_ERROR";
@@ -388,13 +388,13 @@ var ErrorCode;
388
388
  ErrorCode["REFUND_STATE_TRANSITION_ERROR"] = "REFUND_STATE_TRANSITION_ERROR";
389
389
  ErrorCode["SETTLE_PAYMENT_ERROR"] = "SETTLE_PAYMENT_ERROR";
390
390
  ErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
391
- })(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));
391
+ })(ErrorCode || (exports.ErrorCode = ErrorCode = {}));
392
392
  var GlobalFlag;
393
393
  (function (GlobalFlag) {
394
394
  GlobalFlag["FALSE"] = "FALSE";
395
395
  GlobalFlag["INHERIT"] = "INHERIT";
396
396
  GlobalFlag["TRUE"] = "TRUE";
397
- })(GlobalFlag = exports.GlobalFlag || (exports.GlobalFlag = {}));
397
+ })(GlobalFlag || (exports.GlobalFlag = GlobalFlag = {}));
398
398
  var HistoryEntryType;
399
399
  (function (HistoryEntryType) {
400
400
  HistoryEntryType["CUSTOMER_ADDED_TO_GROUP"] = "CUSTOMER_ADDED_TO_GROUP";
@@ -421,7 +421,7 @@ var HistoryEntryType;
421
421
  HistoryEntryType["ORDER_PAYMENT_TRANSITION"] = "ORDER_PAYMENT_TRANSITION";
422
422
  HistoryEntryType["ORDER_REFUND_TRANSITION"] = "ORDER_REFUND_TRANSITION";
423
423
  HistoryEntryType["ORDER_STATE_TRANSITION"] = "ORDER_STATE_TRANSITION";
424
- })(HistoryEntryType = exports.HistoryEntryType || (exports.HistoryEntryType = {}));
424
+ })(HistoryEntryType || (exports.HistoryEntryType = HistoryEntryType = {}));
425
425
  /**
426
426
  * @description
427
427
  * The state of a Job in the JobQueue
@@ -436,7 +436,7 @@ var JobState;
436
436
  JobState["PENDING"] = "PENDING";
437
437
  JobState["RETRYING"] = "RETRYING";
438
438
  JobState["RUNNING"] = "RUNNING";
439
- })(JobState = exports.JobState || (exports.JobState = {}));
439
+ })(JobState || (exports.JobState = JobState = {}));
440
440
  /**
441
441
  * @description
442
442
  * Languages in the form of a ISO 639-1 language code with optional
@@ -762,28 +762,28 @@ var LanguageCode;
762
762
  LanguageCode["zh_Hant"] = "zh_Hant";
763
763
  /** Zulu */
764
764
  LanguageCode["zu"] = "zu";
765
- })(LanguageCode = exports.LanguageCode || (exports.LanguageCode = {}));
765
+ })(LanguageCode || (exports.LanguageCode = LanguageCode = {}));
766
766
  var LogicalOperator;
767
767
  (function (LogicalOperator) {
768
768
  LogicalOperator["AND"] = "AND";
769
769
  LogicalOperator["OR"] = "OR";
770
- })(LogicalOperator = exports.LogicalOperator || (exports.LogicalOperator = {}));
770
+ })(LogicalOperator || (exports.LogicalOperator = LogicalOperator = {}));
771
771
  var MetricInterval;
772
772
  (function (MetricInterval) {
773
773
  MetricInterval["Daily"] = "Daily";
774
- })(MetricInterval = exports.MetricInterval || (exports.MetricInterval = {}));
774
+ })(MetricInterval || (exports.MetricInterval = MetricInterval = {}));
775
775
  var MetricType;
776
776
  (function (MetricType) {
777
777
  MetricType["AverageOrderValue"] = "AverageOrderValue";
778
778
  MetricType["OrderCount"] = "OrderCount";
779
779
  MetricType["OrderTotal"] = "OrderTotal";
780
- })(MetricType = exports.MetricType || (exports.MetricType = {}));
780
+ })(MetricType || (exports.MetricType = MetricType = {}));
781
781
  var OrderType;
782
782
  (function (OrderType) {
783
783
  OrderType["Aggregate"] = "Aggregate";
784
784
  OrderType["Regular"] = "Regular";
785
785
  OrderType["Seller"] = "Seller";
786
- })(OrderType = exports.OrderType || (exports.OrderType = {}));
786
+ })(OrderType || (exports.OrderType = OrderType = {}));
787
787
  /**
788
788
  * @description
789
789
  * Permissions for administrators and customers. Used to control access to
@@ -1006,12 +1006,12 @@ var Permission;
1006
1006
  Permission["UpdateTaxRate"] = "UpdateTaxRate";
1007
1007
  /** Grants permission to update Zone */
1008
1008
  Permission["UpdateZone"] = "UpdateZone";
1009
- })(Permission = exports.Permission || (exports.Permission = {}));
1009
+ })(Permission || (exports.Permission = Permission = {}));
1010
1010
  var SortOrder;
1011
1011
  (function (SortOrder) {
1012
1012
  SortOrder["ASC"] = "ASC";
1013
1013
  SortOrder["DESC"] = "DESC";
1014
- })(SortOrder = exports.SortOrder || (exports.SortOrder = {}));
1014
+ })(SortOrder || (exports.SortOrder = SortOrder = {}));
1015
1015
  var StockMovementType;
1016
1016
  (function (StockMovementType) {
1017
1017
  StockMovementType["ADJUSTMENT"] = "ADJUSTMENT";
@@ -1020,7 +1020,7 @@ var StockMovementType;
1020
1020
  StockMovementType["RELEASE"] = "RELEASE";
1021
1021
  StockMovementType["RETURN"] = "RETURN";
1022
1022
  StockMovementType["SALE"] = "SALE";
1023
- })(StockMovementType = exports.StockMovementType || (exports.StockMovementType = {}));
1023
+ })(StockMovementType || (exports.StockMovementType = StockMovementType = {}));
1024
1024
  exports.GetBadgesDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetBadges" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "options" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "BadgeListOptions" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "badges" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "options" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "options" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "items" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "updatedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "collection" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "collectionId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "position" } }, { "kind": "Field", "name": { "kind": "Name", "value": "asset" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "type" } }, { "kind": "Field", "name": { "kind": "Name", "value": "mimeType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "width" } }, { "kind": "Field", "name": { "kind": "Name", "value": "height" } }, { "kind": "Field", "name": { "kind": "Name", "value": "fileSize" } }, { "kind": "Field", "name": { "kind": "Name", "value": "source" } }, { "kind": "Field", "name": { "kind": "Name", "value": "preview" } }] } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "totalItems" } }] } }] } }] };
1025
1025
  exports.CreateBadgeDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CreateBadge" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "CreateBadgeInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "createBadge" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }] } }] } }] };
1026
1026
  exports.DeleteBadgeDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "DeleteBadge" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "ids" } }, "type": { "kind": "NonNullType", "type": { "kind": "ListType", "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "deleteBadge" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "ids" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "ids" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "result" } }, { "kind": "Field", "name": { "kind": "Name", "value": "message" } }] } }] } }] };
@@ -14,6 +14,8 @@ const core_1 = require("@angular/core");
14
14
  const forms_1 = require("@angular/forms");
15
15
  const core_2 = require("@vendure/admin-ui/core");
16
16
  const gql_1 = require("./gql");
17
+ const common_1 = require("@angular/common");
18
+ const ng_select_1 = require("@ng-select/ng-select");
17
19
  const updateBadgeDocument = (0, gql_1.graphql)(`
18
20
  mutation UpdateBadge($input: UpdateBadgeInput!) {
19
21
  updateBadge(input: $input) {
@@ -34,10 +36,7 @@ let UpdateBadgeComponent = class UpdateBadgeComponent {
34
36
  this.formBuilder = formBuilder;
35
37
  this.changeDetector = changeDetector;
36
38
  this.dataService = dataService;
37
- this.form = this.formBuilder.group({
38
- collectionId: [''],
39
- position: [''],
40
- });
39
+ this.form = this.formBuilder.group({ collectionId: [''], position: [''] });
41
40
  this.allCollections$ = this.dataService.collection
42
41
  .getCollections()
43
42
  .mapSingle((data) => data.collections.items);
@@ -77,6 +76,7 @@ let UpdateBadgeComponent = class UpdateBadgeComponent {
77
76
  });
78
77
  }
79
78
  };
79
+ exports.UpdateBadgeComponent = UpdateBadgeComponent;
80
80
  __decorate([
81
81
  (0, core_1.Input)(),
82
82
  __metadata("design:type", Object)
@@ -89,15 +89,16 @@ __decorate([
89
89
  (0, core_1.Output)(),
90
90
  __metadata("design:type", core_1.EventEmitter)
91
91
  ], UpdateBadgeComponent.prototype, "badgeUpdated", void 0);
92
- UpdateBadgeComponent = __decorate([
92
+ exports.UpdateBadgeComponent = UpdateBadgeComponent = __decorate([
93
93
  (0, core_1.Component)({
94
94
  selector: 'update-badge',
95
95
  templateUrl: './update-badge.component.html',
96
96
  styleUrls: ['./update-badge.component.scss'],
97
97
  changeDetection: core_1.ChangeDetectionStrategy.OnPush,
98
+ standalone: true,
99
+ imports: [common_1.CommonModule, forms_1.ReactiveFormsModule, ng_select_1.NgSelectModule],
98
100
  }),
99
101
  __metadata("design:paramtypes", [forms_1.FormBuilder,
100
102
  core_1.ChangeDetectorRef,
101
103
  core_2.DataService])
102
104
  ], UpdateBadgeComponent);
103
- exports.UpdateBadgeComponent = UpdateBadgeComponent;
@@ -8,11 +8,13 @@ import {
8
8
  SimpleChanges,
9
9
  EventEmitter,
10
10
  } from '@angular/core'
11
- import { FormBuilder, FormGroup } from '@angular/forms'
11
+ import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms'
12
12
  import { Observable } from 'rxjs'
13
13
  import { DataService } from '@vendure/admin-ui/core'
14
14
  import { Badge, Collection } from './gql/graphql'
15
15
  import { graphql } from './gql'
16
+ import { CommonModule } from '@angular/common'
17
+ import { NgSelectModule } from '@ng-select/ng-select'
16
18
 
17
19
  const updateBadgeDocument = graphql(`
18
20
  mutation UpdateBadge($input: UpdateBadgeInput!) {
@@ -27,6 +29,8 @@ const updateBadgeDocument = graphql(`
27
29
  templateUrl: './update-badge.component.html',
28
30
  styleUrls: ['./update-badge.component.scss'],
29
31
  changeDetection: ChangeDetectionStrategy.OnPush,
32
+ standalone: true,
33
+ imports: [CommonModule, ReactiveFormsModule, NgSelectModule],
30
34
  })
31
35
  export class UpdateBadgeComponent implements OnChanges {
32
36
  @Input() badge: Badge
@@ -42,10 +46,7 @@ export class UpdateBadgeComponent implements OnChanges {
42
46
  private changeDetector: ChangeDetectorRef,
43
47
  private dataService: DataService,
44
48
  ) {
45
- this.form = this.formBuilder.group({
46
- collectionId: [''],
47
- position: [''],
48
- })
49
+ this.form = this.formBuilder.group({ collectionId: [''], position: [''] })
49
50
  this.allCollections$ = this.dataService.collection
50
51
  .getCollections()
51
52
  .mapSingle((data) => data.collections.items as Collection[])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haus-tech/badge-plugin",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "Adds a badge to product images",
5
5
  "author": "Haus Tech",
6
6
  "repository": "https://github.com/WeAreHausTech/haus-tech-vendure-plugins",
@@ -16,12 +16,12 @@
16
16
  ],
17
17
  "scripts": {
18
18
  "start": "yarn ts-node test/dev-server.ts",
19
- "build": "rimraf dist && tsc && copyfiles -u 1 'src/ui/**/*' dist/",
19
+ "build": "yarn run -T rimraf dist && yarn run -T tsc && yarn run -T copyfiles -u 1 'src/ui/**/*' dist/",
20
20
  "test": "jest --preset=\"ts-jest\"",
21
21
  "prepublishOnly": "yarn && yarn build"
22
22
  },
23
23
  "devDependencies": {
24
- "@types/lodash": "^4.14.202",
24
+ "@types/lodash": "^4.17.17",
25
25
  "lodash": "^4.17.21"
26
26
  }
27
27
  }