@haus-tech/badge-plugin 4.0.2 → 4.0.3

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,7 +53,6 @@ let BadgeAdminResolver = class BadgeAdminResolver {
53
53
  return this.config;
54
54
  }
55
55
  };
56
- exports.BadgeAdminResolver = BadgeAdminResolver;
57
56
  __decorate([
58
57
  (0, graphql_1.Query)(),
59
58
  __param(0, (0, core_1.Ctx)()),
@@ -92,8 +91,9 @@ __decorate([
92
91
  __metadata("design:paramtypes", []),
93
92
  __metadata("design:returntype", void 0)
94
93
  ], BadgeAdminResolver.prototype, "getBadgePluginConfig", null);
95
- exports.BadgeAdminResolver = BadgeAdminResolver = __decorate([
94
+ BadgeAdminResolver = __decorate([
96
95
  (0, graphql_1.Resolver)(),
97
96
  __param(0, (0, common_1.Inject)(constants_1.PLUGIN_INIT_OPTIONS)),
98
97
  __metadata("design:paramtypes", [Object, badge_service_1.BadgeService])
99
98
  ], BadgeAdminResolver);
99
+ exports.BadgeAdminResolver = BadgeAdminResolver;
@@ -29,7 +29,6 @@ let ProductEntityResolver = class ProductEntityResolver {
29
29
  return this.badgeService.findBadgesForProduct(ctx, product);
30
30
  }
31
31
  };
32
- exports.ProductEntityResolver = ProductEntityResolver;
33
32
  __decorate([
34
33
  (0, graphql_1.ResolveField)(),
35
34
  __param(0, (0, core_1.Ctx)()),
@@ -38,11 +37,12 @@ __decorate([
38
37
  __metadata("design:paramtypes", [core_1.RequestContext, core_1.Product]),
39
38
  __metadata("design:returntype", Promise)
40
39
  ], ProductEntityResolver.prototype, "badges", null);
41
- exports.ProductEntityResolver = ProductEntityResolver = __decorate([
40
+ ProductEntityResolver = __decorate([
42
41
  (0, graphql_1.Resolver)('Product'),
43
42
  __param(0, (0, common_1.Inject)(constants_1.PLUGIN_INIT_OPTIONS)),
44
43
  __metadata("design:paramtypes", [Object, badge_service_1.BadgeService])
45
44
  ], ProductEntityResolver);
45
+ exports.ProductEntityResolver = ProductEntityResolver;
46
46
  let SearchResultEntityResolver = class SearchResultEntityResolver {
47
47
  config;
48
48
  badgeService;
@@ -54,7 +54,6 @@ let SearchResultEntityResolver = class SearchResultEntityResolver {
54
54
  return this.badgeService.findBadgesForSearchResult(ctx, searchResult);
55
55
  }
56
56
  };
57
- exports.SearchResultEntityResolver = SearchResultEntityResolver;
58
57
  __decorate([
59
58
  (0, graphql_1.ResolveField)(),
60
59
  __param(0, (0, core_1.Ctx)()),
@@ -63,11 +62,12 @@ __decorate([
63
62
  __metadata("design:paramtypes", [core_1.RequestContext, Object]),
64
63
  __metadata("design:returntype", Promise)
65
64
  ], SearchResultEntityResolver.prototype, "badges", null);
66
- exports.SearchResultEntityResolver = SearchResultEntityResolver = __decorate([
65
+ SearchResultEntityResolver = __decorate([
67
66
  (0, graphql_1.Resolver)('SearchResult'),
68
67
  __param(0, (0, common_1.Inject)(constants_1.PLUGIN_INIT_OPTIONS)),
69
68
  __metadata("design:paramtypes", [Object, badge_service_1.BadgeService])
70
69
  ], SearchResultEntityResolver);
70
+ exports.SearchResultEntityResolver = SearchResultEntityResolver;
71
71
  let ProductVariantEntityResolver = class ProductVariantEntityResolver {
72
72
  config;
73
73
  badgeService;
@@ -80,7 +80,6 @@ let ProductVariantEntityResolver = class ProductVariantEntityResolver {
80
80
  return this.badgeService.findByCollectionIds(ctx, collectionIds);
81
81
  }
82
82
  };
83
- exports.ProductVariantEntityResolver = ProductVariantEntityResolver;
84
83
  __decorate([
85
84
  (0, graphql_1.ResolveField)(),
86
85
  __param(0, (0, core_1.Ctx)()),
@@ -89,11 +88,12 @@ __decorate([
89
88
  __metadata("design:paramtypes", [core_1.RequestContext, core_1.ProductVariant]),
90
89
  __metadata("design:returntype", Promise)
91
90
  ], ProductVariantEntityResolver.prototype, "badges", null);
92
- exports.ProductVariantEntityResolver = ProductVariantEntityResolver = __decorate([
91
+ ProductVariantEntityResolver = __decorate([
93
92
  (0, graphql_1.Resolver)('ProductVariant'),
94
93
  __param(0, (0, common_1.Inject)(constants_1.PLUGIN_INIT_OPTIONS)),
95
94
  __metadata("design:paramtypes", [Object, badge_service_1.BadgeService])
96
95
  ], ProductVariantEntityResolver);
96
+ exports.ProductVariantEntityResolver = ProductVariantEntityResolver;
97
97
  let BadgeShopResolver = class BadgeShopResolver {
98
98
  config;
99
99
  badgeService;
@@ -111,7 +111,6 @@ let BadgeShopResolver = class BadgeShopResolver {
111
111
  return this.badgeService.findByCollectionIds(ctx, args.collectionIds);
112
112
  }
113
113
  };
114
- exports.BadgeShopResolver = BadgeShopResolver;
115
114
  __decorate([
116
115
  (0, graphql_1.Query)(),
117
116
  __param(0, (0, core_1.Ctx)()),
@@ -136,8 +135,9 @@ __decorate([
136
135
  __metadata("design:paramtypes", [core_1.RequestContext, Object]),
137
136
  __metadata("design:returntype", Promise)
138
137
  ], BadgeShopResolver.prototype, "getBadgesFromCollections", null);
139
- exports.BadgeShopResolver = BadgeShopResolver = __decorate([
138
+ BadgeShopResolver = __decorate([
140
139
  (0, graphql_1.Resolver)(),
141
140
  __param(0, (0, common_1.Inject)(constants_1.PLUGIN_INIT_OPTIONS)),
142
141
  __metadata("design:paramtypes", [Object, badge_service_1.BadgeService])
143
142
  ], BadgeShopResolver);
143
+ exports.BadgeShopResolver = BadgeShopResolver;
@@ -19,8 +19,7 @@ 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 = class BadgePlugin {
23
- static { BadgePlugin_1 = this; }
22
+ let BadgePlugin = BadgePlugin_1 = class BadgePlugin {
24
23
  static options = {
25
24
  availablePositions: ['top-left', 'top-right', 'bottom-left', 'bottom-right'],
26
25
  };
@@ -36,29 +35,30 @@ let BadgePlugin = class BadgePlugin {
36
35
  en: path_1.default.join(__dirname, 'ui/translations/en.json'),
37
36
  sv: path_1.default.join(__dirname, 'ui/translations/sv.json'),
38
37
  },
39
- ngModules: [
40
- {
41
- type: 'lazy',
42
- route: 'badges',
43
- ngModuleFileName: 'badge.module.ts',
44
- ngModuleName: 'BadgeModule',
45
- },
46
- {
47
- type: 'shared',
48
- ngModuleFileName: 'badge-nav.module.ts',
49
- ngModuleName: 'BadgesNavModule',
50
- },
51
- ],
38
+ routes: [{ route: 'badges', filePath: 'routes.ts' }],
39
+ providers: ['providers.ts'],
40
+ // ngModules: [
41
+ // {
42
+ // type: 'lazy',
43
+ // route: 'badges',
44
+ // ngModuleFileName: 'badge.module.ts',
45
+ // ngModuleName: 'BadgeModule',
46
+ // },
47
+ // {
48
+ // type: 'shared',
49
+ // ngModuleFileName: 'badge-nav.module.ts',
50
+ // ngModuleName: 'BadgesNavModule',
51
+ // },
52
+ // ],
52
53
  };
53
54
  };
54
- exports.BadgePlugin = BadgePlugin;
55
- exports.BadgePlugin = BadgePlugin = BadgePlugin_1 = __decorate([
55
+ BadgePlugin = BadgePlugin_1 = __decorate([
56
56
  (0, core_1.VendurePlugin)({
57
57
  imports: [core_1.PluginCommonModule],
58
58
  providers: [
59
59
  {
60
60
  provide: constants_1.PLUGIN_INIT_OPTIONS,
61
- useFactory: () => BadgePlugin.options,
61
+ useFactory: () => BadgePlugin_1.options,
62
62
  },
63
63
  badge_service_1.BadgeService,
64
64
  ],
@@ -79,3 +79,4 @@ exports.BadgePlugin = BadgePlugin = BadgePlugin_1 = __decorate([
79
79
  compatibility: '^3.0.0',
80
80
  })
81
81
  ], BadgePlugin);
82
+ exports.BadgePlugin = BadgePlugin;
@@ -29,7 +29,6 @@ let Badge = class Badge extends core_1.VendureEntity {
29
29
  collection;
30
30
  collectionId;
31
31
  };
32
- exports.Badge = Badge;
33
32
  __decorate([
34
33
  (0, typeorm_1.ManyToMany)((type) => core_1.Channel),
35
34
  (0, typeorm_1.JoinTable)(),
@@ -74,7 +73,8 @@ __decorate([
74
73
  (0, core_1.EntityId)({ nullable: true }),
75
74
  __metadata("design:type", Object)
76
75
  ], Badge.prototype, "collectionId", void 0);
77
- exports.Badge = Badge = __decorate([
76
+ Badge = __decorate([
78
77
  (0, typeorm_1.Entity)(),
79
78
  __metadata("design:paramtypes", [Object])
80
79
  ], 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 = AdjustmentType = {}));
9
+ })(AdjustmentType = exports.AdjustmentType || (exports.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 = AssetType = {}));
15
+ })(AssetType = exports.AssetType || (exports.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 = CurrencyCode = {}));
338
+ })(CurrencyCode = exports.CurrencyCode || (exports.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 = DeletionResult = {}));
345
+ })(DeletionResult = exports.DeletionResult || (exports.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 = ErrorCode = {}));
391
+ })(ErrorCode = exports.ErrorCode || (exports.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 = GlobalFlag = {}));
397
+ })(GlobalFlag = exports.GlobalFlag || (exports.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 = HistoryEntryType = {}));
424
+ })(HistoryEntryType = exports.HistoryEntryType || (exports.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 = JobState = {}));
439
+ })(JobState = exports.JobState || (exports.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 = LanguageCode = {}));
765
+ })(LanguageCode = exports.LanguageCode || (exports.LanguageCode = {}));
766
766
  var LogicalOperator;
767
767
  (function (LogicalOperator) {
768
768
  LogicalOperator["AND"] = "AND";
769
769
  LogicalOperator["OR"] = "OR";
770
- })(LogicalOperator || (exports.LogicalOperator = LogicalOperator = {}));
770
+ })(LogicalOperator = exports.LogicalOperator || (exports.LogicalOperator = {}));
771
771
  var MetricInterval;
772
772
  (function (MetricInterval) {
773
773
  MetricInterval["Daily"] = "Daily";
774
- })(MetricInterval || (exports.MetricInterval = MetricInterval = {}));
774
+ })(MetricInterval = exports.MetricInterval || (exports.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 = MetricType = {}));
780
+ })(MetricType = exports.MetricType || (exports.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 = OrderType = {}));
786
+ })(OrderType = exports.OrderType || (exports.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 = Permission = {}));
1009
+ })(Permission = exports.Permission || (exports.Permission = {}));
1010
1010
  var SortOrder;
1011
1011
  (function (SortOrder) {
1012
1012
  SortOrder["ASC"] = "ASC";
1013
1013
  SortOrder["DESC"] = "DESC";
1014
- })(SortOrder || (exports.SortOrder = SortOrder = {}));
1014
+ })(SortOrder = exports.SortOrder || (exports.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 = StockMovementType = {}));
1023
+ })(StockMovementType = exports.StockMovementType || (exports.StockMovementType = {}));
@@ -131,8 +131,7 @@ let BadgeService = class BadgeService {
131
131
  return this.connection.findByIdsInChannel(ctx, badge_entity_1.Badge, badges.map((b) => b.id), ctx.channelId, {});
132
132
  }
133
133
  };
134
- exports.BadgeService = BadgeService;
135
- exports.BadgeService = BadgeService = __decorate([
134
+ BadgeService = __decorate([
136
135
  (0, common_1.Injectable)(),
137
136
  __metadata("design:paramtypes", [core_1.ListQueryBuilder,
138
137
  core_1.TransactionalConnection,
@@ -141,3 +140,4 @@ exports.BadgeService = BadgeService = __decorate([
141
140
  core_1.CollectionService,
142
141
  core_1.ChannelService])
143
142
  ], BadgeService);
143
+ exports.BadgeService = BadgeService;
@@ -1,9 +1,10 @@
1
+ /// <reference types="node" />
1
2
  import { TypedBaseListComponent, NotificationService, ModalService, SelectionManager } from '@vendure/admin-ui/core';
2
3
  import { OnInit, OnChanges, SimpleChanges } from '@angular/core';
3
4
  import { Badge } from './gql/graphql';
4
5
  import { Asset } from '@vendure/core';
5
6
  declare const getBadgeListDocument: import("apollo-angular").TypedDocumentNode<import("./gql/graphql").GetBadgesQuery, import("./gql/graphql").Exact<{
6
- options?: import("./gql/graphql").InputMaybe<import("./gql/graphql").BadgeListOptions>;
7
+ options?: import("./gql/graphql").InputMaybe<import("./gql/graphql").BadgeListOptions> | undefined;
7
8
  }>>;
8
9
  export interface BadgePluginOptions {
9
10
  availablePositions: string[];
@@ -19,6 +19,7 @@ const rxjs_1 = require("rxjs");
19
19
  const operators_1 = require("rxjs/operators");
20
20
  const common_1 = require("@angular/common");
21
21
  const update_badge_component_1 = require("./update-badge.component");
22
+ const core_3 = require("@ngx-translate/core");
22
23
  const getBadgeListDocument = (0, gql_1.graphql)(`
23
24
  query GetBadges($options: BadgeListOptions) {
24
25
  badges(options: $options) {
@@ -91,7 +92,12 @@ let BadgeListComponent = class BadgeListComponent extends core_1.TypedBaseListCo
91
92
  this.badges = data.badges.items;
92
93
  return data.badges;
93
94
  },
94
- setVariables: () => ({ options: { skip: 0, take: 999 } }),
95
+ setVariables: () => ({
96
+ options: {
97
+ skip: 0,
98
+ take: 999,
99
+ },
100
+ }),
95
101
  refreshListOnChanges: [],
96
102
  });
97
103
  this.dataService
@@ -168,7 +174,10 @@ let BadgeListComponent = class BadgeListComponent extends core_1.TypedBaseListCo
168
174
  for (const asset of assets) {
169
175
  await this.dataService
170
176
  .mutate(createBadgeDocument, {
171
- input: { assetId: asset.id, position: this.config.availablePositions[0] },
177
+ input: {
178
+ assetId: asset.id,
179
+ position: this.config.availablePositions[0],
180
+ },
172
181
  })
173
182
  .toPromise();
174
183
  }
@@ -185,11 +194,15 @@ let BadgeListComponent = class BadgeListComponent extends core_1.TypedBaseListCo
185
194
  }
186
195
  }))
187
196
  .subscribe(() => {
188
- this.notificationService.success((0, ngx_translate_extract_marker_1.marker)('common.notify-delete-success'), { entity: 'Badges' });
197
+ this.notificationService.success((0, ngx_translate_extract_marker_1.marker)('common.notify-delete-success'), {
198
+ entity: 'Badges',
199
+ });
189
200
  this.refresh();
190
201
  this.selectionManager.clearSelection();
191
202
  }, () => {
192
- this.notificationService.error((0, ngx_translate_extract_marker_1.marker)('common.notify-delete-error'), { entity: 'Badges' });
203
+ this.notificationService.error((0, ngx_translate_extract_marker_1.marker)('common.notify-delete-error'), {
204
+ entity: 'Badges',
205
+ });
193
206
  });
194
207
  }
195
208
  onBadgeUpdated() {
@@ -199,27 +212,33 @@ let BadgeListComponent = class BadgeListComponent extends core_1.TypedBaseListCo
199
212
  return this.modalService
200
213
  .dialog({
201
214
  title: (0, ngx_translate_extract_marker_1.marker)('badge-plugin.confirm-delete-badges'),
202
- translationVars: { count: badgeIds.length },
215
+ translationVars: {
216
+ count: badgeIds.length,
217
+ },
203
218
  body: message,
204
219
  buttons: [
205
220
  { type: 'secondary', label: (0, ngx_translate_extract_marker_1.marker)('common.cancel') },
206
221
  { type: 'danger', label: (0, ngx_translate_extract_marker_1.marker)('common.delete'), returnValue: true },
207
222
  ],
208
223
  })
209
- .pipe((0, operators_1.switchMap)((res) => res ? this.dataService.mutate(deleteBadgeDocument, { ids: badgeIds }) : rxjs_1.EMPTY), (0, operators_1.map)((res) => res.deleteBadge));
224
+ .pipe((0, operators_1.switchMap)((res) => res
225
+ ? this.dataService.mutate(deleteBadgeDocument, {
226
+ ids: badgeIds,
227
+ })
228
+ : rxjs_1.EMPTY), (0, operators_1.map)((res) => res.deleteBadge));
210
229
  }
211
230
  };
212
- exports.BadgeListComponent = BadgeListComponent;
213
- exports.BadgeListComponent = BadgeListComponent = __decorate([
231
+ BadgeListComponent = __decorate([
214
232
  (0, core_2.Component)({
215
233
  selector: 'badge-list',
216
234
  templateUrl: './badge-list.component.html',
217
235
  styleUrls: ['./badge-list.component.scss'],
218
236
  changeDetection: core_2.ChangeDetectionStrategy.OnPush,
219
237
  standalone: true,
220
- imports: [common_1.CommonModule, update_badge_component_1.UpdateBadgeComponent],
238
+ imports: [common_1.CommonModule, update_badge_component_1.UpdateBadgeComponent, core_1.SharedModule, core_3.TranslateModule],
221
239
  }),
222
240
  (0, core_2.Injectable)(),
223
241
  __metadata("design:paramtypes", [core_1.NotificationService,
224
242
  core_1.ModalService])
225
243
  ], BadgeListComponent);
244
+ exports.BadgeListComponent = BadgeListComponent;
@@ -3,6 +3,7 @@ import {
3
3
  NotificationService,
4
4
  ModalService,
5
5
  SelectionManager,
6
+ SharedModule,
6
7
  } from '@vendure/admin-ui/core'
7
8
  import {
8
9
  Component,
@@ -20,6 +21,7 @@ import { finalize, map, switchMap } from 'rxjs/operators'
20
21
  import { Asset } from '@vendure/core'
21
22
  import { CommonModule } from '@angular/common'
22
23
  import { UpdateBadgeComponent } from './update-badge.component'
24
+ import { TranslateModule } from '@ngx-translate/core'
23
25
 
24
26
  const getBadgeListDocument = graphql(`
25
27
  query GetBadges($options: BadgeListOptions) {
@@ -85,7 +87,7 @@ export interface BadgePluginOptions {
85
87
  styleUrls: ['./badge-list.component.scss'],
86
88
  changeDetection: ChangeDetectionStrategy.OnPush,
87
89
  standalone: true,
88
- imports: [CommonModule, UpdateBadgeComponent],
90
+ imports: [CommonModule, UpdateBadgeComponent, SharedModule, TranslateModule],
89
91
  })
90
92
  @Injectable()
91
93
  export class BadgeListComponent
@@ -114,7 +116,12 @@ export class BadgeListComponent
114
116
  this.badges = data.badges.items as Badge[]
115
117
  return data.badges
116
118
  },
117
- setVariables: () => ({ options: { skip: 0, take: 999 } }),
119
+ setVariables: () => ({
120
+ options: {
121
+ skip: 0,
122
+ take: 999,
123
+ },
124
+ }),
118
125
  refreshListOnChanges: [],
119
126
  })
120
127
 
@@ -202,7 +209,10 @@ export class BadgeListComponent
202
209
  for (const asset of assets) {
203
210
  await this.dataService
204
211
  .mutate(createBadgeDocument, {
205
- input: { assetId: asset.id as string, position: this.config.availablePositions[0] },
212
+ input: {
213
+ assetId: asset.id as string,
214
+ position: this.config.availablePositions[0],
215
+ },
206
216
  })
207
217
  .toPromise()
208
218
  }
@@ -225,12 +235,16 @@ export class BadgeListComponent
225
235
  )
226
236
  .subscribe(
227
237
  () => {
228
- this.notificationService.success(_('common.notify-delete-success'), { entity: 'Badges' })
238
+ this.notificationService.success(_('common.notify-delete-success'), {
239
+ entity: 'Badges',
240
+ })
229
241
  this.refresh()
230
242
  this.selectionManager.clearSelection()
231
243
  },
232
244
  () => {
233
- this.notificationService.error(_('common.notify-delete-error'), { entity: 'Badges' })
245
+ this.notificationService.error(_('common.notify-delete-error'), {
246
+ entity: 'Badges',
247
+ })
234
248
  },
235
249
  )
236
250
  }
@@ -243,7 +257,9 @@ export class BadgeListComponent
243
257
  return this.modalService
244
258
  .dialog({
245
259
  title: _('badge-plugin.confirm-delete-badges'),
246
- translationVars: { count: badgeIds.length },
260
+ translationVars: {
261
+ count: badgeIds.length,
262
+ },
247
263
  body: message,
248
264
  buttons: [
249
265
  { type: 'secondary', label: _('common.cancel') },
@@ -252,7 +268,11 @@ export class BadgeListComponent
252
268
  })
253
269
  .pipe(
254
270
  switchMap((res) =>
255
- res ? this.dataService.mutate(deleteBadgeDocument, { ids: badgeIds }) : EMPTY,
271
+ res
272
+ ? this.dataService.mutate(deleteBadgeDocument, {
273
+ ids: badgeIds,
274
+ })
275
+ : EMPTY,
256
276
  ),
257
277
  map((res) => res.deleteBadge),
258
278
  )
@@ -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>;
15
+ options?: types.InputMaybe<types.BadgeListOptions> | undefined;
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: Array<types.Scalars["ID"]["input"]> | types.Scalars["ID"]["input"];
21
+ ids: string | string[];
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,25 +15,15 @@ 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 () {
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
- })();
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
+ };
35
25
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.graphql = graphql;
26
+ exports.graphql = void 0;
37
27
  /* eslint-disable */
38
28
  const types = __importStar(require("./graphql"));
39
29
  /**
@@ -56,3 +46,4 @@ const documents = {
56
46
  function graphql(source) {
57
47
  return documents[source] ?? {};
58
48
  }
49
+ exports.graphql = graphql;
@@ -5987,8 +5987,18 @@ export type UpdateBadgeMutation = {
5987
5987
  id: string;
5988
5988
  };
5989
5989
  };
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>;
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
+ }>>;
@@ -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 = AdjustmentType = {}));
9
+ })(AdjustmentType = exports.AdjustmentType || (exports.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 = AssetType = {}));
15
+ })(AssetType = exports.AssetType || (exports.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 = CurrencyCode = {}));
338
+ })(CurrencyCode = exports.CurrencyCode || (exports.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 = DeletionResult = {}));
345
+ })(DeletionResult = exports.DeletionResult || (exports.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 = ErrorCode = {}));
391
+ })(ErrorCode = exports.ErrorCode || (exports.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 = GlobalFlag = {}));
397
+ })(GlobalFlag = exports.GlobalFlag || (exports.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 = HistoryEntryType = {}));
424
+ })(HistoryEntryType = exports.HistoryEntryType || (exports.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 = JobState = {}));
439
+ })(JobState = exports.JobState || (exports.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 = LanguageCode = {}));
765
+ })(LanguageCode = exports.LanguageCode || (exports.LanguageCode = {}));
766
766
  var LogicalOperator;
767
767
  (function (LogicalOperator) {
768
768
  LogicalOperator["AND"] = "AND";
769
769
  LogicalOperator["OR"] = "OR";
770
- })(LogicalOperator || (exports.LogicalOperator = LogicalOperator = {}));
770
+ })(LogicalOperator = exports.LogicalOperator || (exports.LogicalOperator = {}));
771
771
  var MetricInterval;
772
772
  (function (MetricInterval) {
773
773
  MetricInterval["Daily"] = "Daily";
774
- })(MetricInterval || (exports.MetricInterval = MetricInterval = {}));
774
+ })(MetricInterval = exports.MetricInterval || (exports.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 = MetricType = {}));
780
+ })(MetricType = exports.MetricType || (exports.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 = OrderType = {}));
786
+ })(OrderType = exports.OrderType || (exports.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 = Permission = {}));
1009
+ })(Permission = exports.Permission || (exports.Permission = {}));
1010
1010
  var SortOrder;
1011
1011
  (function (SortOrder) {
1012
1012
  SortOrder["ASC"] = "ASC";
1013
1013
  SortOrder["DESC"] = "DESC";
1014
- })(SortOrder || (exports.SortOrder = SortOrder = {}));
1014
+ })(SortOrder = exports.SortOrder || (exports.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 = StockMovementType = {}));
1023
+ })(StockMovementType = exports.StockMovementType || (exports.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" } }] } }] } }] };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("@angular/core").Provider[];
2
+ export default _default;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@vendure/admin-ui/core");
4
+ exports.default = [
5
+ (0, core_1.addNavMenuItem)({
6
+ id: 'badges',
7
+ label: 'Badges',
8
+ routerLink: ['/extensions/badges'],
9
+ icon: 'star',
10
+ }, 'catalog'),
11
+ ];
@@ -0,0 +1,13 @@
1
+ import { addNavMenuItem, SharedModule } from '@vendure/admin-ui/core'
2
+
3
+ export default [
4
+ addNavMenuItem(
5
+ {
6
+ id: 'badges',
7
+ label: 'Badges',
8
+ routerLink: ['/extensions/badges'],
9
+ icon: 'star',
10
+ },
11
+ 'catalog',
12
+ ),
13
+ ]
@@ -0,0 +1,31 @@
1
+ declare const _default: {
2
+ resolve: {
3
+ detail?: import("@angular/router").ResolveFn<{
4
+ entity: import("rxjs").Observable<any>;
5
+ result?: any;
6
+ }> | undefined;
7
+ };
8
+ data: {
9
+ breadcrumb: import("rxjs").BehaviorSubject<import("@vendure/admin-ui/core").BreadcrumbValue> | ((data: any) => any);
10
+ locationId: string | undefined;
11
+ description: string | undefined;
12
+ };
13
+ component: typeof import("@vendure/admin-ui/core").AngularRouteComponent;
14
+ title?: string | import("@angular/core").Type<import("@angular/router").Resolve<string>> | import("@angular/router").ResolveFn<string> | undefined;
15
+ path: string;
16
+ pathMatch?: "prefix" | "full" | undefined;
17
+ matcher?: import("@angular/router").UrlMatcher | undefined;
18
+ loadComponent?: (() => import("@angular/core").Type<unknown> | import("rxjs").Observable<import("@angular/core").Type<unknown> | import("@angular/router").DefaultExport<import("@angular/core").Type<unknown>>> | Promise<import("@angular/core").Type<unknown> | import("@angular/router").DefaultExport<import("@angular/core").Type<unknown>>>) | undefined;
19
+ redirectTo?: string | undefined;
20
+ outlet?: string | undefined;
21
+ canActivate?: any[] | undefined;
22
+ canMatch?: any[] | undefined;
23
+ canActivateChild?: any[] | undefined;
24
+ canDeactivate?: any[] | undefined;
25
+ canLoad?: any[] | undefined;
26
+ children?: import("@angular/router").Routes | undefined;
27
+ loadChildren?: import("@angular/router").LoadChildrenCallback | undefined;
28
+ runGuardsAndResolvers?: import("@angular/router").RunGuardsAndResolvers | undefined;
29
+ providers: (import("@angular/core").Provider | import("@angular/core").EnvironmentProviders)[];
30
+ }[];
31
+ export default _default;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@vendure/admin-ui/core");
4
+ const badge_list_component_1 = require("./badge-list.component");
5
+ exports.default = [
6
+ (0, core_1.registerRouteComponent)({
7
+ path: '',
8
+ component: badge_list_component_1.BadgeListComponent,
9
+ breadcrumb: 'Badges',
10
+ }),
11
+ ];
@@ -0,0 +1,10 @@
1
+ import { registerRouteComponent } from '@vendure/admin-ui/core'
2
+ import { BadgeListComponent } from './badge-list.component'
3
+
4
+ export default [
5
+ registerRouteComponent({
6
+ path: '',
7
+ component: BadgeListComponent,
8
+ breadcrumb: 'Badges',
9
+ }),
10
+ ]
@@ -16,6 +16,7 @@ const core_2 = require("@vendure/admin-ui/core");
16
16
  const gql_1 = require("./gql");
17
17
  const common_1 = require("@angular/common");
18
18
  const ng_select_1 = require("@ng-select/ng-select");
19
+ const core_3 = require("@ngx-translate/core");
19
20
  const updateBadgeDocument = (0, gql_1.graphql)(`
20
21
  mutation UpdateBadge($input: UpdateBadgeInput!) {
21
22
  updateBadge(input: $input) {
@@ -36,7 +37,10 @@ let UpdateBadgeComponent = class UpdateBadgeComponent {
36
37
  this.formBuilder = formBuilder;
37
38
  this.changeDetector = changeDetector;
38
39
  this.dataService = dataService;
39
- this.form = this.formBuilder.group({ collectionId: [''], position: [''] });
40
+ this.form = this.formBuilder.group({
41
+ collectionId: [''],
42
+ position: [''],
43
+ });
40
44
  this.allCollections$ = this.dataService.collection
41
45
  .getCollections()
42
46
  .mapSingle((data) => data.collections.items);
@@ -76,7 +80,6 @@ let UpdateBadgeComponent = class UpdateBadgeComponent {
76
80
  });
77
81
  }
78
82
  };
79
- exports.UpdateBadgeComponent = UpdateBadgeComponent;
80
83
  __decorate([
81
84
  (0, core_1.Input)(),
82
85
  __metadata("design:type", Object)
@@ -89,16 +92,17 @@ __decorate([
89
92
  (0, core_1.Output)(),
90
93
  __metadata("design:type", core_1.EventEmitter)
91
94
  ], UpdateBadgeComponent.prototype, "badgeUpdated", void 0);
92
- exports.UpdateBadgeComponent = UpdateBadgeComponent = __decorate([
95
+ UpdateBadgeComponent = __decorate([
93
96
  (0, core_1.Component)({
94
97
  selector: 'update-badge',
95
98
  templateUrl: './update-badge.component.html',
96
99
  styleUrls: ['./update-badge.component.scss'],
97
100
  changeDetection: core_1.ChangeDetectionStrategy.OnPush,
98
101
  standalone: true,
99
- imports: [common_1.CommonModule, forms_1.ReactiveFormsModule, ng_select_1.NgSelectModule],
102
+ imports: [common_1.CommonModule, forms_1.ReactiveFormsModule, ng_select_1.NgSelectModule, core_2.SharedModule, core_3.TranslateModule],
100
103
  }),
101
104
  __metadata("design:paramtypes", [forms_1.FormBuilder,
102
105
  core_1.ChangeDetectorRef,
103
106
  core_2.DataService])
104
107
  ], UpdateBadgeComponent);
108
+ exports.UpdateBadgeComponent = UpdateBadgeComponent;
@@ -10,11 +10,12 @@ import {
10
10
  } from '@angular/core'
11
11
  import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms'
12
12
  import { Observable } from 'rxjs'
13
- import { DataService } from '@vendure/admin-ui/core'
13
+ import { DataService, SharedModule } from '@vendure/admin-ui/core'
14
14
  import { Badge, Collection } from './gql/graphql'
15
15
  import { graphql } from './gql'
16
16
  import { CommonModule } from '@angular/common'
17
17
  import { NgSelectModule } from '@ng-select/ng-select'
18
+ import { TranslateModule } from '@ngx-translate/core'
18
19
 
19
20
  const updateBadgeDocument = graphql(`
20
21
  mutation UpdateBadge($input: UpdateBadgeInput!) {
@@ -30,7 +31,7 @@ const updateBadgeDocument = graphql(`
30
31
  styleUrls: ['./update-badge.component.scss'],
31
32
  changeDetection: ChangeDetectionStrategy.OnPush,
32
33
  standalone: true,
33
- imports: [CommonModule, ReactiveFormsModule, NgSelectModule],
34
+ imports: [CommonModule, ReactiveFormsModule, NgSelectModule, SharedModule, TranslateModule],
34
35
  })
35
36
  export class UpdateBadgeComponent implements OnChanges {
36
37
  @Input() badge: Badge
@@ -46,7 +47,10 @@ export class UpdateBadgeComponent implements OnChanges {
46
47
  private changeDetector: ChangeDetectorRef,
47
48
  private dataService: DataService,
48
49
  ) {
49
- this.form = this.formBuilder.group({ collectionId: [''], position: [''] })
50
+ this.form = this.formBuilder.group({
51
+ collectionId: [''],
52
+ position: [''],
53
+ })
50
54
  this.allCollections$ = this.dataService.collection
51
55
  .getCollections()
52
56
  .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.2",
3
+ "version": "4.0.3",
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",
@@ -21,7 +21,7 @@
21
21
  "prepublishOnly": "yarn && yarn build"
22
22
  },
23
23
  "devDependencies": {
24
- "@types/lodash": "^4.17.17",
24
+ "@types/lodash": "^4.17.14",
25
25
  "lodash": "^4.17.21"
26
26
  }
27
27
  }
@@ -1,2 +0,0 @@
1
- export declare class BadgesNavModule {
2
- }
@@ -1,27 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.BadgesNavModule = void 0;
10
- const core_1 = require("@angular/core");
11
- const core_2 = require("@vendure/admin-ui/core");
12
- let BadgesNavModule = class BadgesNavModule {
13
- };
14
- exports.BadgesNavModule = BadgesNavModule;
15
- exports.BadgesNavModule = BadgesNavModule = __decorate([
16
- (0, core_1.NgModule)({
17
- imports: [core_2.SharedModule],
18
- providers: [
19
- (0, core_2.addNavMenuItem)({
20
- id: 'badges',
21
- label: 'Badges',
22
- routerLink: ['/extensions/badges'],
23
- icon: 'star',
24
- }, 'catalog'),
25
- ],
26
- })
27
- ], BadgesNavModule);
@@ -1,18 +0,0 @@
1
- import { NgModule } from '@angular/core'
2
- import { addNavMenuItem, SharedModule } from '@vendure/admin-ui/core'
3
-
4
- @NgModule({
5
- imports: [SharedModule],
6
- providers: [
7
- addNavMenuItem(
8
- {
9
- id: 'badges',
10
- label: 'Badges',
11
- routerLink: ['/extensions/badges'],
12
- icon: 'star',
13
- },
14
- 'catalog',
15
- ),
16
- ],
17
- })
18
- export class BadgesNavModule {}
@@ -1,2 +0,0 @@
1
- export declare class BadgeModule {
2
- }
@@ -1,35 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.BadgeModule = void 0;
10
- const core_1 = require("@angular/core");
11
- const router_1 = require("@angular/router");
12
- const core_2 = require("@vendure/admin-ui/core");
13
- const badge_list_component_1 = require("./badge-list.component");
14
- const update_badge_component_1 = require("./update-badge.component");
15
- let BadgeModule = class BadgeModule {
16
- };
17
- exports.BadgeModule = BadgeModule;
18
- exports.BadgeModule = BadgeModule = __decorate([
19
- (0, core_1.NgModule)({
20
- imports: [
21
- core_2.SharedModule,
22
- badge_list_component_1.BadgeListComponent,
23
- update_badge_component_1.UpdateBadgeComponent,
24
- router_1.RouterModule.forChild([
25
- {
26
- path: '',
27
- pathMatch: 'full',
28
- component: badge_list_component_1.BadgeListComponent,
29
- data: { breadcrumb: 'Badges' },
30
- },
31
- ]),
32
- ],
33
- providers: [],
34
- })
35
- ], BadgeModule);
@@ -1,23 +0,0 @@
1
- import { NgModule } from '@angular/core'
2
- import { RouterModule } from '@angular/router'
3
- import { SharedModule } from '@vendure/admin-ui/core'
4
- import { BadgeListComponent } from './badge-list.component'
5
- import { UpdateBadgeComponent } from './update-badge.component'
6
-
7
- @NgModule({
8
- imports: [
9
- SharedModule,
10
- BadgeListComponent,
11
- UpdateBadgeComponent,
12
- RouterModule.forChild([
13
- {
14
- path: '',
15
- pathMatch: 'full',
16
- component: BadgeListComponent,
17
- data: { breadcrumb: 'Badges' },
18
- },
19
- ]),
20
- ],
21
- providers: [],
22
- })
23
- export class BadgeModule {}