@rolatech/angular-services 18.0.0 → 18.1.0

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.
Files changed (36) hide show
  1. package/esm2022/index.mjs +2 -1
  2. package/esm2022/lib/components/dialog/dialog.component.mjs +3 -3
  3. package/esm2022/lib/directive/back-button.directive.mjs +3 -3
  4. package/esm2022/lib/interceptor/loading.interceptor.mjs +3 -3
  5. package/esm2022/lib/services/base.service.mjs +3 -3
  6. package/esm2022/lib/services/breadcrumb.service.mjs +3 -3
  7. package/esm2022/lib/services/cart.service.mjs +11 -5
  8. package/esm2022/lib/services/dialog.service.mjs +3 -3
  9. package/esm2022/lib/services/index.mjs +7 -2
  10. package/esm2022/lib/services/inventory.service.mjs +75 -0
  11. package/esm2022/lib/services/layout.service.mjs +3 -3
  12. package/esm2022/lib/services/loading.service.mjs +3 -3
  13. package/esm2022/lib/services/media.service.mjs +3 -3
  14. package/esm2022/lib/services/navigation.service.mjs +3 -3
  15. package/esm2022/lib/services/notification-template.service.mjs +49 -0
  16. package/esm2022/lib/services/notification.service.mjs +81 -0
  17. package/esm2022/lib/services/order.service.mjs +3 -3
  18. package/esm2022/lib/services/product-category.service.mjs +38 -0
  19. package/esm2022/lib/services/product.service.mjs +3 -3
  20. package/esm2022/lib/services/sidenav.service.mjs +3 -3
  21. package/esm2022/lib/services/snack-bar.service.mjs +3 -3
  22. package/esm2022/lib/services/support.service.mjs +3 -3
  23. package/esm2022/lib/services/theme.service.mjs +3 -3
  24. package/esm2022/lib/state/notification.store.mjs +18 -0
  25. package/fesm2022/rolatech-angular-services.mjs +561 -313
  26. package/fesm2022/rolatech-angular-services.mjs.map +1 -1
  27. package/index.d.ts +1 -0
  28. package/lib/services/cart.service.d.ts +6 -0
  29. package/lib/services/index.d.ts +6 -1
  30. package/lib/services/inventory.service.d.ts +27 -0
  31. package/lib/services/notification-template.service.d.ts +14 -0
  32. package/lib/services/notification.service.d.ts +19 -0
  33. package/lib/services/product-category.service.d.ts +12 -0
  34. package/lib/state/notification.store.d.ts +8 -0
  35. package/package.json +1 -1
  36. package/themes/_default.scss +1 -1
@@ -1,18 +1,327 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, Injectable, viewChild, ViewContainerRef, OutputEmitterRef, EventEmitter, Component, HostListener, PLATFORM_ID, Directive, APP_INITIALIZER, makeEnvironmentProviders } from '@angular/core';
2
+ import { inject, Injectable, EventEmitter, viewChild, ViewContainerRef, OutputEmitterRef, Component, HostListener, PLATFORM_ID, Directive, APP_INITIALIZER, makeEnvironmentProviders } from '@angular/core';
3
+ import { switchMap, map, take, BehaviorSubject } from 'rxjs';
4
+ import _ from 'lodash';
5
+ import { HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
6
+ import { APP_CONFIG } from '@rolatech/angular-common';
3
7
  import { Location, isPlatformBrowser } from '@angular/common';
4
8
  import { Router, NavigationEnd } from '@angular/router';
5
9
  import { MAT_DIALOG_DATA, MatDialogRef, MatDialogActions, MatDialogTitle, MatDialogContent, MatDialogClose, MatDialog } from '@angular/material/dialog';
6
- import { take, map, BehaviorSubject, switchMap } from 'rxjs';
7
10
  import * as i1 from '@angular/material/button';
8
11
  import { MatButtonModule } from '@angular/material/button';
9
- import { HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
10
- import { APP_CONFIG } from '@rolatech/angular-common';
11
12
  import * as i1$1 from '@angular/cdk/layout';
12
13
  import { Breakpoints, MediaMatcher } from '@angular/cdk/layout';
13
14
  import { map as map$1, shareReplay, finalize } from 'rxjs/operators';
14
15
  import { MatSnackBar } from '@angular/material/snack-bar';
15
- import _ from 'lodash';
16
+
17
+ class BaseService {
18
+ http = inject(HttpClient);
19
+ environment = inject(APP_CONFIG);
20
+ actionUrl;
21
+ endpoint;
22
+ constructor() {
23
+ this.init();
24
+ }
25
+ init() {
26
+ this.actionUrl = `${this.environment.baseUrl}/${this.endpoint}`;
27
+ }
28
+ find(options) {
29
+ return this.http.get(this.actionUrl, {
30
+ params: options,
31
+ withCredentials: true,
32
+ });
33
+ }
34
+ get(id, options) {
35
+ return this.http.get(`${this.actionUrl}/${id}`, {
36
+ params: options,
37
+ withCredentials: true,
38
+ });
39
+ }
40
+ create(item) {
41
+ return this.http.post(`${this.actionUrl}`, item, {
42
+ withCredentials: true,
43
+ });
44
+ }
45
+ update(id, data) {
46
+ return this.http.put(`${this.actionUrl}/${id}`, data, {
47
+ withCredentials: true,
48
+ });
49
+ }
50
+ delete(id) {
51
+ return this.http.delete(`${this.actionUrl}/${id}`, {
52
+ withCredentials: true,
53
+ });
54
+ }
55
+ updateStatus(id, data) {
56
+ return this.http.put(`${this.actionUrl}/${id}/status`, data, {
57
+ withCredentials: true,
58
+ });
59
+ }
60
+ search(word) {
61
+ return this.http.get(`${this.actionUrl}?search=${word}`, {
62
+ withCredentials: true,
63
+ });
64
+ }
65
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: BaseService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
66
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: BaseService, providedIn: 'root' });
67
+ }
68
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: BaseService, decorators: [{
69
+ type: Injectable,
70
+ args: [{
71
+ providedIn: 'root',
72
+ }]
73
+ }], ctorParameters: () => [] });
74
+
75
+ class ProductService extends BaseService {
76
+ init() {
77
+ this.endpoint = 'products';
78
+ super.init();
79
+ }
80
+ me(options) {
81
+ return this.http.get(`${this.actionUrl}/me`, {
82
+ params: options,
83
+ withCredentials: true,
84
+ });
85
+ }
86
+ findByIds(ids) {
87
+ const params = { ids: ids.join(',') };
88
+ return this.http.get(`${this.actionUrl}/by`, {
89
+ params: params,
90
+ withCredentials: true,
91
+ });
92
+ }
93
+ publish(productId) {
94
+ return this.http.post(`${this.actionUrl}/${productId}/publish`, {}, {
95
+ withCredentials: true,
96
+ });
97
+ }
98
+ archived(productId) {
99
+ return this.http.post(`${this.actionUrl}/${productId}/archived`, {}, {
100
+ withCredentials: true,
101
+ });
102
+ }
103
+ findWishlist(options) {
104
+ return this.http.get(`${this.actionUrl}/wishlist`, { params: options, withCredentials: true });
105
+ }
106
+ addToWishlist(productId) {
107
+ return this.http.post(`${this.actionUrl}/${productId}/wishlist`, {}, { withCredentials: true });
108
+ }
109
+ removeFromWishlist(productId) {
110
+ return this.http.delete(`${this.actionUrl}/${productId}/wishlist`, { withCredentials: true });
111
+ }
112
+ findWishlistBy(productId) {
113
+ return this.http.get(`${this.actionUrl}/${productId}/wishlist/by`, { withCredentials: true });
114
+ }
115
+ findPurchasedByProductId(productId) {
116
+ return this.http.get(`${this.actionUrl}/users/me/by?productId=${productId}`, {
117
+ withCredentials: true,
118
+ });
119
+ }
120
+ // Media
121
+ uploadMedia(productId, data) {
122
+ return this.http.post(`${this.actionUrl}/${productId}/media`, data, {
123
+ withCredentials: true,
124
+ });
125
+ }
126
+ deleteMedia(id, mediaId) {
127
+ return this.http.delete(`${this.actionUrl}/${id}/media/${mediaId}`, {
128
+ withCredentials: true,
129
+ });
130
+ }
131
+ // Pricing
132
+ addPricing(productId, data) {
133
+ return this.http.post(`${this.actionUrl}/${productId}/pricing`, data, {
134
+ withCredentials: true,
135
+ });
136
+ }
137
+ updatePricing(pricingId, data) {
138
+ return this.http.put(`${this.actionUrl}/pricing/${pricingId}`, data, {
139
+ withCredentials: true,
140
+ });
141
+ }
142
+ deletePricing(pricingId) {
143
+ return this.http.delete(`${this.actionUrl}/pricing/${pricingId}`, {
144
+ withCredentials: true,
145
+ });
146
+ }
147
+ // Section
148
+ addSection(productId, data) {
149
+ return this.http.post(`${this.actionUrl}/${productId}/sections`, data, {
150
+ withCredentials: true,
151
+ });
152
+ }
153
+ addBatchSections(productId, data) {
154
+ return this.http.post(`${this.actionUrl}/${productId}/sections/batch`, data, {
155
+ withCredentials: true,
156
+ });
157
+ }
158
+ findSections(productId) {
159
+ return this.http.get(`${this.actionUrl}/${productId}/sections`, {
160
+ withCredentials: true,
161
+ });
162
+ }
163
+ updateSection(sectionId, data) {
164
+ return this.http.put(`${this.actionUrl}/sections/${sectionId}`, data, {
165
+ withCredentials: true,
166
+ });
167
+ }
168
+ deleteSection(sectionId) {
169
+ return this.http.delete(`${this.actionUrl}/sections/${sectionId}`, {
170
+ withCredentials: true,
171
+ });
172
+ }
173
+ uploadSectionMedia(sectionId, data) {
174
+ return this.http.post(`${this.actionUrl}/sections/${sectionId}/media`, data, {
175
+ withCredentials: true,
176
+ });
177
+ }
178
+ deleteSectionMedia(sectionId, mediaId) {
179
+ return this.http.delete(`${this.actionUrl}/sections/${sectionId}/media/${mediaId}`, {
180
+ withCredentials: true,
181
+ });
182
+ }
183
+ addOption(productId, data) {
184
+ return this.http.post(`${this.actionUrl}/${productId}/options`, data, {
185
+ withCredentials: true,
186
+ });
187
+ }
188
+ findOptions(productId) {
189
+ return this.http.get(`${this.actionUrl}/${productId}/options`);
190
+ }
191
+ updateOption(optionId, data) {
192
+ return this.http.put(`${this.actionUrl}/options/${optionId}`, data, {
193
+ withCredentials: true,
194
+ });
195
+ }
196
+ deleteOption(optionId) {
197
+ return this.http.delete(`${this.actionUrl}/options/${optionId}`, {
198
+ withCredentials: true,
199
+ });
200
+ }
201
+ // variants
202
+ updateVariantPrice(productId, status) {
203
+ return this.http.put(`${this.actionUrl}/${productId}/variants/by?status=${status}`, {}, {
204
+ withCredentials: true,
205
+ });
206
+ }
207
+ createVariants(productId, data) {
208
+ return this.http.post(`${this.actionUrl}/${productId}/variants`, data, {
209
+ withCredentials: true,
210
+ });
211
+ }
212
+ getVariant(variantId) {
213
+ return this.http.get(`${this.actionUrl}/variants/${variantId}`);
214
+ }
215
+ findVariants(productId) {
216
+ return this.http.get(`${this.actionUrl}/${productId}/variants`);
217
+ }
218
+ findVariantsByIds(ids) {
219
+ const params = { ids: ids.join(',') };
220
+ return this.http.get(`${this.actionUrl}/variants/by`, {
221
+ params: params,
222
+ withCredentials: true,
223
+ });
224
+ }
225
+ updateVariants(productId, data) {
226
+ return this.http.put(`${this.actionUrl}/${productId}/variants`, data, {
227
+ withCredentials: true,
228
+ });
229
+ }
230
+ uploadVariantMedia(variantId, data) {
231
+ return this.http.post(`${this.actionUrl}/variants/${variantId}/media`, data, {
232
+ withCredentials: true,
233
+ });
234
+ }
235
+ deleteVariantMedia(variantId, mediaId) {
236
+ return this.http.delete(`${this.actionUrl}/variants/${variantId}/media/${mediaId}`, {
237
+ withCredentials: true,
238
+ });
239
+ }
240
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: ProductService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
241
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: ProductService, providedIn: 'root' });
242
+ }
243
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: ProductService, decorators: [{
244
+ type: Injectable,
245
+ args: [{
246
+ providedIn: 'root',
247
+ }]
248
+ }] });
249
+
250
+ var CartEventType;
251
+ (function (CartEventType) {
252
+ CartEventType[CartEventType["CartAdd"] = 0] = "CartAdd";
253
+ CartEventType[CartEventType["CartRemove"] = 1] = "CartRemove";
254
+ })(CartEventType || (CartEventType = {}));
255
+ class CartService extends BaseService {
256
+ productService = inject(ProductService);
257
+ cartEvent = new EventEmitter();
258
+ init() {
259
+ this.endpoint = 'carts';
260
+ super.init();
261
+ }
262
+ findDetails(options) {
263
+ return this.http
264
+ .get(`${this.actionUrl}`, {
265
+ params: options,
266
+ withCredentials: true,
267
+ })
268
+ .pipe(switchMap((res) => {
269
+ const productIds = _.uniq(_.map(res.data, 'productId')); // [12, 14, 16, 18]
270
+ return this.findProductsByIds(productIds).pipe(map((products) => {
271
+ res.data?.forEach((item) => {
272
+ const matchingProduct = _.find(products.data, { id: item.productId });
273
+ item.product = matchingProduct;
274
+ });
275
+ return res;
276
+ }));
277
+ }), switchMap((res) => {
278
+ const variantIds = _.uniq(_.map(res.data, 'variantId')); // [12, 14, 16, 18]
279
+ return this.findVariantsByIds(variantIds).pipe(map((variants) => {
280
+ res.data?.forEach((item) => {
281
+ const matchingVariant = _.find(variants.data, { id: item.variantId });
282
+ item.variant = matchingVariant;
283
+ });
284
+ return res;
285
+ }));
286
+ }));
287
+ }
288
+ findProductsByIds(ids) {
289
+ return this.productService.findByIds(ids);
290
+ }
291
+ findVariantsByIds(ids) {
292
+ return this.productService.findVariantsByIds(ids);
293
+ }
294
+ by(options) {
295
+ return this.http.get(`${this.actionUrl}/items/by`, {
296
+ params: options,
297
+ withCredentials: true,
298
+ });
299
+ }
300
+ me(options) {
301
+ return this.http.get(`${this.actionUrl}/me`, {
302
+ params: options,
303
+ withCredentials: true,
304
+ });
305
+ }
306
+ deleteByIds(ids) {
307
+ return this.http.delete(`${this.actionUrl}/me`, {
308
+ withCredentials: true,
309
+ });
310
+ }
311
+ deleteAll() {
312
+ return this.http.delete(`${this.actionUrl}/me`, {
313
+ withCredentials: true,
314
+ });
315
+ }
316
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: CartService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
317
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: CartService, providedIn: 'root' });
318
+ }
319
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: CartService, decorators: [{
320
+ type: Injectable,
321
+ args: [{
322
+ providedIn: 'root',
323
+ }]
324
+ }] });
16
325
 
17
326
  class NavigationService {
18
327
  history = [];
@@ -50,10 +359,10 @@ class NavigationService {
50
359
  }
51
360
  return '';
52
361
  }
53
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: NavigationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
54
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: NavigationService, providedIn: 'root' });
362
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: NavigationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
363
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: NavigationService, providedIn: 'root' });
55
364
  }
56
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: NavigationService, decorators: [{
365
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: NavigationService, decorators: [{
57
366
  type: Injectable,
58
367
  args: [{
59
368
  providedIn: 'root',
@@ -118,10 +427,10 @@ class DialogComponent {
118
427
  confirm() {
119
428
  this.close(this.result || true);
120
429
  }
121
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: DialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
122
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.1.4", type: DialogComponent, isStandalone: true, selector: "rolatech-dialog", host: { listeners: { "keydown.esc": "onEsc()" } }, viewQueries: [{ propertyName: "componentRef", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, isSignal: true }], ngImport: i0, template: "<div class=\"min-w-[320px]\">\n <h1 class=\"text-xl\" mat-dialog-title>{{ data.title }}</h1>\n <mat-dialog-content>\n <div>\n <p>{{ data.message }}</p>\n <ng-template #container></ng-template>\n <!-- <ng-container #container></ng-container> -->\n </div>\n </mat-dialog-content>\n <div class=\"flex-1\"></div>\n <mat-dialog-actions>\n <button mat-button (click)=\"close()\">{{ data.cancelText ? data.cancelText : 'Cancel' }}</button>\n <button mat-flat-button class=\"w-20\" (click)=\"confirm()\">{{ data.confirmText ? data.confirmText : 'Ok' }}</button>\n </mat-dialog-actions>\n <!-- <div class=\"flex justify-end items-center p-2 gap-3\">\n <a mat-button (click)=\"cancel()\">{{ data.cancelText ? data.cancelText : 'Cancel' }}</a>\n <a mat-flat-button class=\"w-20\" (click)=\"confirm()\">{{ data.confirmText ? data.confirmText : 'Ok' }}</a>\n </div> -->\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }] });
430
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: DialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
431
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.8", type: DialogComponent, isStandalone: true, selector: "rolatech-dialog", host: { listeners: { "keydown.esc": "onEsc()" } }, viewQueries: [{ propertyName: "componentRef", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, isSignal: true }], ngImport: i0, template: "<div class=\"min-w-[320px]\">\n <h1 class=\"text-xl\" mat-dialog-title>{{ data.title }}</h1>\n <mat-dialog-content>\n <div>\n <p>{{ data.message }}</p>\n <ng-template #container></ng-template>\n <!-- <ng-container #container></ng-container> -->\n </div>\n </mat-dialog-content>\n <div class=\"flex-1\"></div>\n <mat-dialog-actions>\n <button mat-button (click)=\"close()\">{{ data.cancelText ? data.cancelText : 'Cancel' }}</button>\n <button mat-flat-button class=\"w-20\" (click)=\"confirm()\">{{ data.confirmText ? data.confirmText : 'Ok' }}</button>\n </mat-dialog-actions>\n <!-- <div class=\"flex justify-end items-center p-2 gap-3\">\n <a mat-button (click)=\"cancel()\">{{ data.cancelText ? data.cancelText : 'Cancel' }}</a>\n <a mat-flat-button class=\"w-20\" (click)=\"confirm()\">{{ data.confirmText ? data.confirmText : 'Ok' }}</a>\n </div> -->\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }] });
123
432
  }
124
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: DialogComponent, decorators: [{
433
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: DialogComponent, decorators: [{
125
434
  type: Component,
126
435
  args: [{ selector: 'rolatech-dialog', standalone: true, imports: [MatButtonModule, MatDialogActions, MatDialogClose, MatDialogTitle, MatDialogContent], template: "<div class=\"min-w-[320px]\">\n <h1 class=\"text-xl\" mat-dialog-title>{{ data.title }}</h1>\n <mat-dialog-content>\n <div>\n <p>{{ data.message }}</p>\n <ng-template #container></ng-template>\n <!-- <ng-container #container></ng-container> -->\n </div>\n </mat-dialog-content>\n <div class=\"flex-1\"></div>\n <mat-dialog-actions>\n <button mat-button (click)=\"close()\">{{ data.cancelText ? data.cancelText : 'Cancel' }}</button>\n <button mat-flat-button class=\"w-20\" (click)=\"confirm()\">{{ data.confirmText ? data.confirmText : 'Ok' }}</button>\n </mat-dialog-actions>\n <!-- <div class=\"flex justify-end items-center p-2 gap-3\">\n <a mat-button (click)=\"cancel()\">{{ data.cancelText ? data.cancelText : 'Cancel' }}</a>\n <a mat-flat-button class=\"w-20\" (click)=\"confirm()\">{{ data.confirmText ? data.confirmText : 'Ok' }}</a>\n </div> -->\n</div>\n" }]
127
436
  }], propDecorators: { onEsc: [{
@@ -145,71 +454,13 @@ class DialogService {
145
454
  confirmed() {
146
455
  return this.dialogRef.afterClosed().pipe(take(1), map((res) => res));
147
456
  }
148
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: DialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
149
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: DialogService });
457
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: DialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
458
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: DialogService });
150
459
  }
151
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: DialogService, decorators: [{
460
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: DialogService, decorators: [{
152
461
  type: Injectable
153
462
  }] });
154
463
 
155
- class BaseService {
156
- http = inject(HttpClient);
157
- environment = inject(APP_CONFIG);
158
- actionUrl;
159
- endpoint;
160
- constructor() {
161
- this.init();
162
- }
163
- init() {
164
- this.actionUrl = `${this.environment.baseUrl}/${this.endpoint}`;
165
- }
166
- find(options) {
167
- return this.http.get(this.actionUrl, {
168
- params: options,
169
- withCredentials: true,
170
- });
171
- }
172
- get(id, options) {
173
- return this.http.get(`${this.actionUrl}/${id}`, {
174
- params: options,
175
- withCredentials: true,
176
- });
177
- }
178
- create(item) {
179
- return this.http.post(`${this.actionUrl}`, item, {
180
- withCredentials: true,
181
- });
182
- }
183
- update(id, data) {
184
- return this.http.put(`${this.actionUrl}/${id}`, data, {
185
- withCredentials: true,
186
- });
187
- }
188
- delete(id) {
189
- return this.http.delete(`${this.actionUrl}/${id}`, {
190
- withCredentials: true,
191
- });
192
- }
193
- updateStatus(id, data) {
194
- return this.http.put(`${this.actionUrl}/${id}/status`, data, {
195
- withCredentials: true,
196
- });
197
- }
198
- search(word) {
199
- return this.http.get(`${this.actionUrl}?search=${word}`, {
200
- withCredentials: true,
201
- });
202
- }
203
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: BaseService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
204
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: BaseService, providedIn: 'root' });
205
- }
206
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: BaseService, decorators: [{
207
- type: Injectable,
208
- args: [{
209
- providedIn: 'root',
210
- }]
211
- }], ctorParameters: () => [] });
212
-
213
464
  class LoadingService {
214
465
  loading$ = new BehaviorSubject(false);
215
466
  ratio$ = new BehaviorSubject(0);
@@ -227,10 +478,10 @@ class LoadingService {
227
478
  async dismiss() {
228
479
  this.isLoading = false;
229
480
  }
230
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: LoadingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
231
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: LoadingService, providedIn: 'root' });
481
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: LoadingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
482
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: LoadingService, providedIn: 'root' });
232
483
  }
233
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: LoadingService, decorators: [{
484
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: LoadingService, decorators: [{
234
485
  type: Injectable,
235
486
  args: [{
236
487
  providedIn: 'root',
@@ -278,10 +529,10 @@ class MediaService extends BaseService {
278
529
  getImageInfo(url) {
279
530
  return this.http.get(`${url}?imageInfo`);
280
531
  }
281
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: MediaService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
282
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: MediaService, providedIn: 'root' });
532
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: MediaService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
533
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: MediaService, providedIn: 'root' });
283
534
  }
284
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: MediaService, decorators: [{
535
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: MediaService, decorators: [{
285
536
  type: Injectable,
286
537
  args: [{
287
538
  providedIn: 'root',
@@ -297,10 +548,10 @@ class LayoutService {
297
548
  .observe([Breakpoints.Small, Breakpoints.HandsetPortrait])
298
549
  .pipe(map$1((result) => result.matches), shareReplay());
299
550
  }
300
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: LayoutService, deps: [{ token: i1$1.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Injectable });
301
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: LayoutService });
551
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: LayoutService, deps: [{ token: i1$1.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Injectable });
552
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: LayoutService });
302
553
  }
303
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: LayoutService, decorators: [{
554
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: LayoutService, decorators: [{
304
555
  type: Injectable
305
556
  }], ctorParameters: () => [{ type: i1$1.BreakpointObserver }] });
306
557
 
@@ -312,10 +563,10 @@ class SnackBarService {
312
563
  dismiss() {
313
564
  this.snackBar.dismiss();
314
565
  }
315
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SnackBarService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
316
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SnackBarService });
566
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SnackBarService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
567
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SnackBarService });
317
568
  }
318
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SnackBarService, decorators: [{
569
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SnackBarService, decorators: [{
319
570
  type: Injectable
320
571
  }] });
321
572
 
@@ -380,10 +631,10 @@ class SupportService {
380
631
  withCredentials: true,
381
632
  });
382
633
  }
383
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SupportService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
384
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SupportService, providedIn: 'root' });
634
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SupportService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
635
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SupportService, providedIn: 'root' });
385
636
  }
386
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SupportService, decorators: [{
637
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SupportService, decorators: [{
387
638
  type: Injectable,
388
639
  args: [{
389
640
  providedIn: 'root',
@@ -411,10 +662,10 @@ class BreadcrumbService {
411
662
  relativeTo: route,
412
663
  });
413
664
  }
414
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: BreadcrumbService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
415
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: BreadcrumbService, providedIn: 'root' });
665
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: BreadcrumbService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
666
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: BreadcrumbService, providedIn: 'root' });
416
667
  }
417
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: BreadcrumbService, decorators: [{
668
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: BreadcrumbService, decorators: [{
418
669
  type: Injectable,
419
670
  args: [{
420
671
  providedIn: 'root',
@@ -446,10 +697,10 @@ class SidenavService {
446
697
  this.isCollaped = !this.isMobile && !this.sidenav?.opened;
447
698
  }
448
699
  lists() { }
449
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SidenavService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
450
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SidenavService });
700
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SidenavService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
701
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SidenavService });
451
702
  }
452
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SidenavService, decorators: [{
703
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SidenavService, decorators: [{
453
704
  type: Injectable
454
705
  }], ctorParameters: () => [] });
455
706
 
@@ -487,335 +738,332 @@ class ThemeService {
487
738
  setDarkTheme(isDarkTheme) {
488
739
  this.darkTheme.next(isDarkTheme);
489
740
  }
490
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
491
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: ThemeService, providedIn: 'root' });
492
- }
493
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: ThemeService, decorators: [{
494
- type: Injectable,
495
- args: [{
496
- providedIn: 'root',
497
- }]
498
- }], ctorParameters: () => [] });
499
-
500
- class ProductService extends BaseService {
501
- init() {
502
- this.endpoint = 'products';
503
- super.init();
504
- }
505
- me(options) {
506
- return this.http.get(`${this.actionUrl}/me`, {
507
- params: options,
508
- withCredentials: true,
509
- });
510
- }
511
- findByIds(ids) {
512
- const params = { ids: ids.join(',') };
513
- return this.http.get(`${this.actionUrl}/by`, {
514
- params: params,
515
- withCredentials: true,
516
- });
517
- }
518
- publish(productId) {
519
- return this.http.post(`${this.actionUrl}/${productId}/publish`, {}, {
520
- withCredentials: true,
521
- });
522
- }
523
- archived(productId) {
524
- return this.http.post(`${this.actionUrl}/${productId}/archived`, {}, {
525
- withCredentials: true,
526
- });
527
- }
528
- findWishlist(options) {
529
- return this.http.get(`${this.actionUrl}/wishlist`, { params: options, withCredentials: true });
530
- }
531
- addToWishlist(productId) {
532
- return this.http.post(`${this.actionUrl}/${productId}/wishlist`, {}, { withCredentials: true });
533
- }
534
- removeFromWishlist(productId) {
535
- return this.http.delete(`${this.actionUrl}/${productId}/wishlist`, { withCredentials: true });
536
- }
537
- findWishlistBy(productId) {
538
- return this.http.get(`${this.actionUrl}/${productId}/wishlist/by`, { withCredentials: true });
539
- }
540
- findPurchasedByProductId(productId) {
541
- return this.http.get(`${this.actionUrl}/users/me/by?productId=${productId}`, {
542
- withCredentials: true,
543
- });
741
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
742
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: ThemeService, providedIn: 'root' });
743
+ }
744
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: ThemeService, decorators: [{
745
+ type: Injectable,
746
+ args: [{
747
+ providedIn: 'root',
748
+ }]
749
+ }], ctorParameters: () => [] });
750
+
751
+ class OrderService extends BaseService {
752
+ init() {
753
+ this.endpoint = 'orders';
754
+ super.init();
544
755
  }
545
- // Media
546
- uploadMedia(productId, data) {
547
- return this.http.post(`${this.actionUrl}/${productId}/media`, data, {
756
+ by(options) {
757
+ return this.http.get(`${this.actionUrl}/items/by`, {
758
+ params: options,
548
759
  withCredentials: true,
549
760
  });
550
761
  }
551
- deleteMedia(id, mediaId) {
552
- return this.http.delete(`${this.actionUrl}/${id}/media/${mediaId}`, {
762
+ me(options) {
763
+ return this.http.get(`${this.actionUrl}/me`, {
764
+ params: options,
553
765
  withCredentials: true,
554
766
  });
555
767
  }
556
- // Pricing
557
- addPricing(productId, data) {
558
- return this.http.post(`${this.actionUrl}/${productId}/pricing`, data, {
768
+ timeline(id) {
769
+ return this.http.get(`${this.actionUrl}/${id}/timeline`, {
559
770
  withCredentials: true,
560
771
  });
561
772
  }
562
- updatePricing(pricingId, data) {
563
- return this.http.put(`${this.actionUrl}/pricing/${pricingId}`, data, {
773
+ pay(id) {
774
+ return this.http.post(`${this.actionUrl}/${id}/pay`, {}, {
564
775
  withCredentials: true,
565
776
  });
566
777
  }
567
- deletePricing(pricingId) {
568
- return this.http.delete(`${this.actionUrl}/pricing/${pricingId}`, {
778
+ refund(id, data) {
779
+ return this.http.post(`${this.actionUrl}/${id}/refund`, data, {
569
780
  withCredentials: true,
570
781
  });
571
782
  }
572
- // Section
573
- addSection(productId, data) {
574
- return this.http.post(`${this.actionUrl}/${productId}/sections`, data, {
783
+ findAllReturns(options) {
784
+ return this.http.get(`${this.actionUrl}/returns`, {
785
+ params: options,
575
786
  withCredentials: true,
576
787
  });
577
788
  }
578
- addBatchSections(productId, data) {
579
- return this.http.post(`${this.actionUrl}/${productId}/sections/batch`, data, {
789
+ findAllReturnsByInstructor(options) {
790
+ return this.http.get(`${this.actionUrl}/returns/instructor`, {
791
+ params: options,
580
792
  withCredentials: true,
581
793
  });
582
794
  }
583
- findSections(productId) {
584
- return this.http.get(`${this.actionUrl}/${productId}/sections`, {
795
+ getReturn(id) {
796
+ return this.http.get(`${this.actionUrl}/returns/${id}`, {
585
797
  withCredentials: true,
586
798
  });
587
799
  }
588
- updateSection(sectionId, data) {
589
- return this.http.put(`${this.actionUrl}/sections/${sectionId}`, data, {
800
+ returnApprove(id) {
801
+ return this.http.post(`${this.actionUrl}/returns/${id}/approve`, {}, {
590
802
  withCredentials: true,
591
803
  });
592
804
  }
593
- deleteSection(sectionId) {
594
- return this.http.delete(`${this.actionUrl}/sections/${sectionId}`, {
805
+ returnReject(id, data) {
806
+ return this.http.post(`${this.actionUrl}/returns/${id}/reject`, data, {
595
807
  withCredentials: true,
596
808
  });
597
809
  }
598
- uploadSectionMedia(sectionId, data) {
599
- return this.http.post(`${this.actionUrl}/sections/${sectionId}/media`, data, {
810
+ cancel(id) {
811
+ return this.http.post(`${this.actionUrl}/${id}/cancel`, {}, {
600
812
  withCredentials: true,
601
813
  });
602
814
  }
603
- deleteSectionMedia(sectionId, mediaId) {
604
- return this.http.delete(`${this.actionUrl}/sections/${sectionId}/media/${mediaId}`, {
815
+ countMeByStatus(options) {
816
+ return this.http.get(`${this.actionUrl}/count/me/by`, {
817
+ params: options,
605
818
  withCredentials: true,
606
819
  });
607
820
  }
608
- addOption(productId, data) {
609
- return this.http.post(`${this.actionUrl}/${productId}/options`, data, {
610
- withCredentials: true,
611
- });
821
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OrderService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
822
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OrderService, providedIn: 'root' });
823
+ }
824
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OrderService, decorators: [{
825
+ type: Injectable,
826
+ args: [{
827
+ providedIn: 'root',
828
+ }]
829
+ }] });
830
+
831
+ class InventoryService extends BaseService {
832
+ init() {
833
+ this.endpoint = 'inventories';
834
+ super.init();
612
835
  }
613
- findOptions(productId) {
614
- return this.http.get(`${this.actionUrl}/${productId}/options`);
836
+ getLocation(locationId) {
837
+ return this.http.get(`${this.actionUrl}/locations/${locationId}`, { withCredentials: true });
615
838
  }
616
- updateOption(optionId, data) {
617
- return this.http.put(`${this.actionUrl}/options/${optionId}`, data, {
618
- withCredentials: true,
619
- });
839
+ findLocations(options) {
840
+ return this.http.get(`${this.actionUrl}/locations`, { params: options, withCredentials: true });
620
841
  }
621
- deleteOption(optionId) {
622
- return this.http.delete(`${this.actionUrl}/options/${optionId}`, {
623
- withCredentials: true,
624
- });
842
+ addLocation(data) {
843
+ return this.http.post(`${this.actionUrl}/locations`, data, { withCredentials: true });
625
844
  }
626
- // variants
627
- updateVariantPrice(productId, status) {
628
- return this.http.put(`${this.actionUrl}/${productId}/variants/by?status=${status}`, {}, {
629
- withCredentials: true,
630
- });
845
+ updateLocation(locationId, data) {
846
+ return this.http.put(`${this.actionUrl}/locations/${locationId}`, data, { withCredentials: true });
631
847
  }
632
- createVariants(productId, data) {
633
- return this.http.post(`${this.actionUrl}/${productId}/variants`, data, {
634
- withCredentials: true,
635
- });
848
+ deleteLocation(locationId) {
849
+ return this.http.delete(`${this.actionUrl}/locations/${locationId}`, { withCredentials: true });
636
850
  }
637
- getVariant(variantId) {
638
- return this.http.get(`${this.actionUrl}/variants/${variantId}`);
851
+ findMyInventoryItems(options) {
852
+ return this.http.get(`${this.actionUrl}/items/me`, { params: options, withCredentials: true });
639
853
  }
640
- findVariants(productId) {
641
- return this.http.get(`${this.actionUrl}/${productId}/variants`);
854
+ addInventoryItem(data) {
855
+ return this.http.post(`${this.actionUrl}/items`, data, { withCredentials: true });
642
856
  }
643
- findVariantsByIds(ids) {
644
- const params = { ids: ids.join(',') };
645
- return this.http.get(`${this.actionUrl}/variants/by`, {
646
- params: params,
647
- withCredentials: true,
648
- });
857
+ addInventoryByProductId(locationId, productId, data) {
858
+ return this.http.post(`${this.actionUrl}/locations/${locationId}`, data, { withCredentials: true });
649
859
  }
650
- updateVariants(productId, data) {
651
- return this.http.put(`${this.actionUrl}/${productId}/variants`, data, {
652
- withCredentials: true,
653
- });
860
+ addInventoryByVariantId(locationId, variantId, data) {
861
+ return this.http.post(`${this.actionUrl}/locations`, data, { withCredentials: true });
654
862
  }
655
- uploadVariantMedia(variantId, data) {
656
- return this.http.post(`${this.actionUrl}/variants/${variantId}/media`, data, {
657
- withCredentials: true,
658
- });
863
+ findInventoryItemByProductId(productId) {
864
+ return this.http.get(`${this.actionUrl}/products/${productId}`, { withCredentials: true });
659
865
  }
660
- deleteVariantMedia(variantId, mediaId) {
661
- return this.http.delete(`${this.actionUrl}/variants/${variantId}/media/${mediaId}`, {
662
- withCredentials: true,
663
- });
866
+ findInventoryItemsByVariantId(variantId) {
867
+ return this.http.get(`${this.actionUrl}/variantId/${variantId}`, { withCredentials: true });
868
+ }
869
+ deleteInventoryItemsByProductId(productId) {
870
+ return this.http.delete(`${this.actionUrl}/products/${productId}`, { withCredentials: true });
871
+ }
872
+ deleteInventoryItemsByVariantId(variantId) {
873
+ return this.http.delete(`${this.actionUrl}/variants/${variantId}`, { withCredentials: true });
874
+ }
875
+ deleteInventoryLevel(levelId) {
876
+ return this.http.delete(`${this.actionUrl}/levels/${levelId}`, { withCredentials: true });
664
877
  }
665
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: ProductService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
666
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: ProductService, providedIn: 'root' });
878
+ findProductsInLocation(locationId) {
879
+ return this.http.get(`${this.actionUrl}/locations/${locationId}/products`, { withCredentials: true });
880
+ }
881
+ findLocationsByProductId(productId) {
882
+ return this.http.get(`${this.actionUrl}/products/${productId}/locations`, { withCredentials: true });
883
+ }
884
+ findLocationsByVariantId(variantId) {
885
+ return this.http.get(`${this.actionUrl}/variants/${variantId}/locations`, { withCredentials: true });
886
+ }
887
+ updateStockByLocationIdAndProductId(locationId, productId, data) {
888
+ return this.http.put(`${this.actionUrl}/locations${locationId}/products/${productId}`, data, { withCredentials: true });
889
+ }
890
+ updateStockByLocationIdAndVariantId(locationId, variantId, data) {
891
+ return this.http.put(`${this.actionUrl}/locations${locationId}/variants/${variantId}`, data, { withCredentials: true });
892
+ }
893
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: InventoryService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
894
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: InventoryService, providedIn: 'root' });
667
895
  }
668
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: ProductService, decorators: [{
896
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: InventoryService, decorators: [{
669
897
  type: Injectable,
670
898
  args: [{
671
899
  providedIn: 'root',
672
900
  }]
673
901
  }] });
674
902
 
675
- class CartService extends BaseService {
676
- productService = inject(ProductService);
677
- init() {
678
- this.endpoint = 'carts';
679
- super.init();
903
+ class NotificationStore {
904
+ $count = new BehaviorSubject(0);
905
+ getCount() {
906
+ return this.$count.asObservable();
680
907
  }
681
- findDetails(options) {
682
- return this.http
683
- .get(`${this.actionUrl}`, {
908
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: NotificationStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
909
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: NotificationStore, providedIn: 'root' });
910
+ }
911
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: NotificationStore, decorators: [{
912
+ type: Injectable,
913
+ args: [{
914
+ providedIn: 'root',
915
+ }]
916
+ }] });
917
+
918
+ class NotificationService {
919
+ environment = inject(APP_CONFIG);
920
+ http = inject(HttpClient);
921
+ storeService = inject(NotificationStore);
922
+ find(options) {
923
+ return this.http.get(`${this.environment.baseUrl}/notifications`, {
684
924
  params: options,
685
925
  withCredentials: true,
686
- })
687
- .pipe(switchMap((res) => {
688
- const productIds = _.uniq(_.map(res.data, 'productId')); // [12, 14, 16, 18]
689
- return this.findProductsByIds(productIds).pipe(map((products) => {
690
- res.data?.forEach((item) => {
691
- const matchingProduct = _.find(products.data, { id: item.productId });
692
- item.product = matchingProduct;
693
- });
694
- return res;
695
- }));
696
- }), switchMap((res) => {
697
- const variantIds = _.uniq(_.map(res.data, 'variantId')); // [12, 14, 16, 18]
698
- return this.findVariantsByIds(variantIds).pipe(map((variants) => {
699
- res.data?.forEach((item) => {
700
- const matchingVariant = _.find(variants.data, { id: item.variantId });
701
- item.variant = matchingVariant;
702
- });
703
- return res;
704
- }));
705
- }));
706
- }
707
- findProductsByIds(ids) {
708
- return this.productService.findByIds(ids);
709
- }
710
- findVariantsByIds(ids) {
711
- return this.productService.findVariantsByIds(ids);
926
+ });
712
927
  }
713
- by(options) {
714
- return this.http.get(`${this.actionUrl}/items/by`, {
928
+ me(options) {
929
+ return this.http.get(`${this.environment.baseUrl}/notifications/me`, {
715
930
  params: options,
716
931
  withCredentials: true,
717
932
  });
718
933
  }
719
- me(options) {
720
- return this.http.get(`${this.actionUrl}/me`, {
721
- params: options,
934
+ get(id) {
935
+ return this.http.get(`${this.environment.baseUrl}/notifications/${id}`, {
722
936
  withCredentials: true,
723
937
  });
724
938
  }
725
- deleteByIds(ids) {
726
- return this.http.delete(`${this.actionUrl}/me`, {
939
+ read(ids) {
940
+ return this.http.get(`${this.environment.baseUrl}/notifications/${ids}`, {
727
941
  withCredentials: true,
728
942
  });
729
943
  }
730
- deleteAll() {
731
- return this.http.delete(`${this.actionUrl}/me`, {
944
+ update(id) {
945
+ return this.http
946
+ .put(`${this.environment.baseUrl}/notifications/${id}`, { status: 'READ' }, {
947
+ withCredentials: true,
948
+ })
949
+ .pipe(map((res) => {
950
+ const value = this.storeService.$count.value - 1;
951
+ this.storeService.$count.next(value);
952
+ }));
953
+ }
954
+ readAll() {
955
+ return this.http
956
+ .put(`${this.environment.baseUrl}/notifications/status/all`, { status: 'READ' }, {
957
+ withCredentials: true,
958
+ })
959
+ .pipe(map((res) => {
960
+ this.storeService.$count.next(0);
961
+ }));
962
+ }
963
+ delete(id) {
964
+ return this.http.get(`${this.environment.baseUrl}/notifications/${id}`, {
965
+ withCredentials: true,
966
+ });
967
+ }
968
+ findByUserId(userId) {
969
+ return this.http.get(`${this.environment.baseUrl}/notifications/by?userId=${userId}`, {
732
970
  withCredentials: true,
733
971
  });
734
972
  }
735
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: CartService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
736
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: CartService, providedIn: 'root' });
973
+ countByStatus(status) {
974
+ return this.http
975
+ .get(`${this.environment.baseUrl}/notifications/count/by?status=${status}`, {
976
+ withCredentials: true,
977
+ })
978
+ .pipe(map(({ data }) => {
979
+ this.storeService.$count.next(data);
980
+ return data;
981
+ }));
982
+ }
983
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: NotificationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
984
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: NotificationService, providedIn: 'root' });
737
985
  }
738
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: CartService, decorators: [{
986
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: NotificationService, decorators: [{
739
987
  type: Injectable,
740
988
  args: [{
741
989
  providedIn: 'root',
742
990
  }]
743
991
  }] });
744
992
 
745
- class OrderService extends BaseService {
993
+ class ProductCategoryService extends BaseService {
746
994
  init() {
747
- this.endpoint = 'orders';
995
+ this.endpoint = 'products/categories';
748
996
  super.init();
749
997
  }
750
- by(options) {
751
- return this.http.get(`${this.actionUrl}/items/by`, {
752
- params: options,
753
- withCredentials: true,
754
- });
755
- }
756
- me(options) {
757
- return this.http.get(`${this.actionUrl}/me`, {
758
- params: options,
998
+ uploadMedia(id, data) {
999
+ return this.http.post(`${this.actionUrl}/${id}/media`, data, {
759
1000
  withCredentials: true,
760
1001
  });
761
1002
  }
762
- timeline(id) {
763
- return this.http.get(`${this.actionUrl}/${id}/timeline`, {
1003
+ deleteMedia(id, mediaId) {
1004
+ return this.http.delete(`${this.actionUrl}/${id}/media/${mediaId}`, {
764
1005
  withCredentials: true,
765
1006
  });
766
1007
  }
767
- pay(id) {
768
- return this.http.post(`${this.actionUrl}/${id}/pay`, {}, {
1008
+ importFromExcel(data) {
1009
+ return this.http.post(`${this.actionUrl}/excel`, data, {
769
1010
  withCredentials: true,
770
1011
  });
771
1012
  }
772
- refund(id, data) {
773
- return this.http.post(`${this.actionUrl}/${id}/refund`, data, {
1013
+ createFromExcel(data) {
1014
+ return this.http.post(`${this.actionUrl}/list`, data, {
774
1015
  withCredentials: true,
775
1016
  });
776
1017
  }
777
- findAllReturns(options) {
778
- return this.http.get(`${this.actionUrl}/returns`, {
1018
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: ProductCategoryService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1019
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: ProductCategoryService, providedIn: 'root' });
1020
+ }
1021
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: ProductCategoryService, decorators: [{
1022
+ type: Injectable,
1023
+ args: [{
1024
+ providedIn: 'root',
1025
+ }]
1026
+ }] });
1027
+
1028
+ class NotificationTemplateService {
1029
+ environment = inject(APP_CONFIG);
1030
+ http = inject(HttpClient);
1031
+ find(options) {
1032
+ return this.http.get(`${this.environment.baseUrl}/notifications`, {
779
1033
  params: options,
780
1034
  withCredentials: true,
781
1035
  });
782
1036
  }
783
- findAllReturnsByInstructor(options) {
784
- return this.http.get(`${this.actionUrl}/returns/instructor`, {
1037
+ me(options) {
1038
+ return this.http.get(`${this.environment.baseUrl}/notifications/me`, {
785
1039
  params: options,
786
1040
  withCredentials: true,
787
1041
  });
788
1042
  }
789
- getReturn(id) {
790
- return this.http.get(`${this.actionUrl}/returns/${id}`, {
791
- withCredentials: true,
792
- });
793
- }
794
- returnApprove(id) {
795
- return this.http.post(`${this.actionUrl}/returns/${id}/approve`, {}, {
1043
+ get(id) {
1044
+ return this.http.get(`${this.environment.baseUrl}/notifications/${id}`, {
796
1045
  withCredentials: true,
797
1046
  });
798
1047
  }
799
- returnReject(id, data) {
800
- return this.http.post(`${this.actionUrl}/returns/${id}/reject`, data, {
1048
+ read(ids) {
1049
+ return this.http.get(`${this.environment.baseUrl}/notifications/${ids}`, {
801
1050
  withCredentials: true,
802
1051
  });
803
1052
  }
804
- cancel(id) {
805
- return this.http.post(`${this.actionUrl}/${id}/cancel`, {}, {
1053
+ delete(id) {
1054
+ return this.http.get(`${this.environment.baseUrl}/notifications/${id}`, {
806
1055
  withCredentials: true,
807
1056
  });
808
1057
  }
809
- countMeByStatus(options) {
810
- return this.http.get(`${this.actionUrl}/count/me/by`, {
811
- params: options,
1058
+ findByUserId(userId) {
1059
+ return this.http.get(`${this.environment.baseUrl}/notifications/by?userId=${userId}`, {
812
1060
  withCredentials: true,
813
1061
  });
814
1062
  }
815
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: OrderService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
816
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: OrderService, providedIn: 'root' });
1063
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: NotificationTemplateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1064
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: NotificationTemplateService, providedIn: 'root' });
817
1065
  }
818
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: OrderService, decorators: [{
1066
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: NotificationTemplateService, decorators: [{
819
1067
  type: Injectable,
820
1068
  args: [{
821
1069
  providedIn: 'root',
@@ -840,10 +1088,10 @@ class LoadingInterceptor {
840
1088
  }
841
1089
  }));
842
1090
  }
843
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: LoadingInterceptor, deps: [{ token: LoadingService }], target: i0.ɵɵFactoryTarget.Injectable });
844
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: LoadingInterceptor, providedIn: 'root' });
1091
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: LoadingInterceptor, deps: [{ token: LoadingService }], target: i0.ɵɵFactoryTarget.Injectable });
1092
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: LoadingInterceptor, providedIn: 'root' });
845
1093
  }
846
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: LoadingInterceptor, decorators: [{
1094
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: LoadingInterceptor, decorators: [{
847
1095
  type: Injectable,
848
1096
  args: [{
849
1097
  providedIn: 'root',
@@ -856,10 +1104,10 @@ class BackButtonDirective {
856
1104
  onClick() {
857
1105
  this.navigation.back();
858
1106
  }
859
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: BackButtonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
860
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.1.4", type: BackButtonDirective, isStandalone: true, selector: "[rolatechBackButton]", host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
1107
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: BackButtonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1108
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.8", type: BackButtonDirective, isStandalone: true, selector: "[rolatechBackButton]", host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
861
1109
  }
862
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: BackButtonDirective, decorators: [{
1110
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: BackButtonDirective, decorators: [{
863
1111
  type: Directive,
864
1112
  args: [{
865
1113
  selector: '[rolatechBackButton]',
@@ -903,5 +1151,5 @@ function provideAngularServices() {
903
1151
  * Generated bundle index. Do not edit.
904
1152
  */
905
1153
 
906
- export { BackButtonDirective, BaseService, BreadcrumbService, CartService, DialogService, LayoutService, LoadingInterceptor, LoadingService, MediaService, NavigationService, OrderService, ProductService, SERVICE_DIRECTIVES, SidenavService, SnackBarService, SupportService, ThemeService, provideAngularServices };
1154
+ export { BackButtonDirective, BaseService, BreadcrumbService, CartEventType, CartService, DialogService, InventoryService, LayoutService, LoadingInterceptor, LoadingService, MediaService, NavigationService, NotificationService, NotificationStore, NotificationTemplateService, OrderService, ProductCategoryService, ProductService, SERVICE_DIRECTIVES, SidenavService, SnackBarService, SupportService, ThemeService, provideAngularServices };
907
1155
  //# sourceMappingURL=rolatech-angular-services.mjs.map