@rolatech/angular-services 17.2.1 → 18.0.1

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 (31) hide show
  1. package/esm2022/index.mjs +2 -1
  2. package/esm2022/lib/components/dialog/dialog.component.mjs +6 -9
  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 +82 -0
  8. package/esm2022/lib/services/dialog.service.mjs +3 -3
  9. package/esm2022/lib/services/index.mjs +5 -2
  10. package/esm2022/lib/services/layout.service.mjs +3 -3
  11. package/esm2022/lib/services/loading.service.mjs +3 -3
  12. package/esm2022/lib/services/media.service.mjs +7 -4
  13. package/esm2022/lib/services/navigation.service.mjs +3 -3
  14. package/esm2022/lib/services/order.service.mjs +83 -0
  15. package/esm2022/lib/services/product.service.mjs +178 -0
  16. package/esm2022/lib/services/sidenav.service.mjs +3 -3
  17. package/esm2022/lib/services/snack-bar.service.mjs +3 -3
  18. package/esm2022/lib/services/support.service.mjs +3 -3
  19. package/esm2022/lib/services/theme.service.mjs +3 -3
  20. package/esm2022/provider.mjs +5 -2
  21. package/fesm2022/rolatech-angular-services.mjs +442 -107
  22. package/fesm2022/rolatech-angular-services.mjs.map +1 -1
  23. package/index.d.ts +1 -0
  24. package/lib/components/dialog/dialog.component.d.ts +1 -2
  25. package/lib/services/cart.service.d.ts +23 -0
  26. package/lib/services/index.d.ts +4 -1
  27. package/lib/services/media.service.d.ts +1 -0
  28. package/lib/services/order.service.d.ts +20 -0
  29. package/lib/services/product.service.d.ts +41 -0
  30. package/package.json +1 -1
  31. package/themes/_default.scss +1 -1
@@ -1,18 +1,328 @@
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 } 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
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.7", ngImport: i0, type: BaseService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
66
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: BaseService, providedIn: 'root' });
67
+ }
68
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", 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.7", ngImport: i0, type: ProductService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
241
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: ProductService, providedIn: 'root' });
242
+ }
243
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", 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.7", ngImport: i0, type: CartService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
317
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: CartService, providedIn: 'root' });
318
+ }
319
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: CartService, decorators: [{
320
+ type: Injectable,
321
+ args: [{
322
+ providedIn: 'root',
323
+ }]
324
+ }] });
325
+
16
326
  class NavigationService {
17
327
  history = [];
18
328
  router = inject(Router);
@@ -49,10 +359,10 @@ class NavigationService {
49
359
  }
50
360
  return '';
51
361
  }
52
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: NavigationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
53
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: NavigationService, providedIn: 'root' });
362
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: NavigationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
363
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: NavigationService, providedIn: 'root' });
54
364
  }
55
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: NavigationService, decorators: [{
365
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: NavigationService, decorators: [{
56
366
  type: Injectable,
57
367
  args: [{
58
368
  providedIn: 'root',
@@ -111,21 +421,18 @@ class DialogComponent {
111
421
  }
112
422
  });
113
423
  }
114
- cancel() {
115
- this.close(false);
116
- }
117
- close(value) {
424
+ close(value = false) {
118
425
  this.dialogRef.close(value);
119
426
  }
120
427
  confirm() {
121
428
  this.close(this.result || true);
122
429
  }
123
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: DialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
124
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.0.1", 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)=\"cancel()\">{{ 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.7", ngImport: i0, type: DialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
431
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.7", 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]" }] });
125
432
  }
126
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: DialogComponent, decorators: [{
433
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DialogComponent, decorators: [{
127
434
  type: Component,
128
- 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)=\"cancel()\">{{ 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" }]
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" }]
129
436
  }], propDecorators: { onEsc: [{
130
437
  type: HostListener,
131
438
  args: ['keydown.esc']
@@ -147,71 +454,13 @@ class DialogService {
147
454
  confirmed() {
148
455
  return this.dialogRef.afterClosed().pipe(take(1), map((res) => res));
149
456
  }
150
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: DialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
151
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: DialogService });
457
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
458
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DialogService });
152
459
  }
153
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: DialogService, decorators: [{
460
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DialogService, decorators: [{
154
461
  type: Injectable
155
462
  }] });
156
463
 
157
- class BaseService {
158
- http = inject(HttpClient);
159
- environment = inject(APP_CONFIG);
160
- actionUrl;
161
- endpoint;
162
- constructor() {
163
- this.init();
164
- }
165
- init() {
166
- this.actionUrl = `${this.environment.baseUrl}/${this.endpoint}`;
167
- }
168
- find(options) {
169
- return this.http.get(this.actionUrl, {
170
- params: options,
171
- withCredentials: true,
172
- });
173
- }
174
- get(id, options) {
175
- return this.http.get(`${this.actionUrl}/${id}`, {
176
- params: options,
177
- withCredentials: true,
178
- });
179
- }
180
- create(item) {
181
- return this.http.post(`${this.actionUrl}`, item, {
182
- withCredentials: true,
183
- });
184
- }
185
- update(id, data) {
186
- return this.http.put(`${this.actionUrl}/${id}`, data, {
187
- withCredentials: true,
188
- });
189
- }
190
- delete(id) {
191
- return this.http.delete(`${this.actionUrl}/${id}`, {
192
- withCredentials: true,
193
- });
194
- }
195
- updateStatus(id, data) {
196
- return this.http.put(`${this.actionUrl}/${id}/status`, data, {
197
- withCredentials: true,
198
- });
199
- }
200
- search(word) {
201
- return this.http.get(`${this.actionUrl}?search=${word}`, {
202
- withCredentials: true,
203
- });
204
- }
205
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BaseService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
206
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BaseService, providedIn: 'root' });
207
- }
208
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BaseService, decorators: [{
209
- type: Injectable,
210
- args: [{
211
- providedIn: 'root',
212
- }]
213
- }], ctorParameters: () => [] });
214
-
215
464
  class LoadingService {
216
465
  loading$ = new BehaviorSubject(false);
217
466
  ratio$ = new BehaviorSubject(0);
@@ -229,10 +478,10 @@ class LoadingService {
229
478
  async dismiss() {
230
479
  this.isLoading = false;
231
480
  }
232
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: LoadingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
233
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: LoadingService, providedIn: 'root' });
481
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: LoadingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
482
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: LoadingService, providedIn: 'root' });
234
483
  }
235
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: LoadingService, decorators: [{
484
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: LoadingService, decorators: [{
236
485
  type: Injectable,
237
486
  args: [{
238
487
  providedIn: 'root',
@@ -277,10 +526,13 @@ class MediaService extends BaseService {
277
526
  findGroups(options) {
278
527
  return this.http.get(`${this.actionUrl}/groups`, { withCredentials: true });
279
528
  }
280
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: MediaService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
281
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: MediaService, providedIn: 'root' });
529
+ getImageInfo(url) {
530
+ return this.http.get(`${url}?imageInfo`);
531
+ }
532
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: MediaService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
533
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: MediaService, providedIn: 'root' });
282
534
  }
283
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: MediaService, decorators: [{
535
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: MediaService, decorators: [{
284
536
  type: Injectable,
285
537
  args: [{
286
538
  providedIn: 'root',
@@ -296,10 +548,10 @@ class LayoutService {
296
548
  .observe([Breakpoints.Small, Breakpoints.HandsetPortrait])
297
549
  .pipe(map$1((result) => result.matches), shareReplay());
298
550
  }
299
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: LayoutService, deps: [{ token: i1$1.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Injectable });
300
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: LayoutService });
551
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", 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.7", ngImport: i0, type: LayoutService });
301
553
  }
302
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: LayoutService, decorators: [{
554
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: LayoutService, decorators: [{
303
555
  type: Injectable
304
556
  }], ctorParameters: () => [{ type: i1$1.BreakpointObserver }] });
305
557
 
@@ -311,10 +563,10 @@ class SnackBarService {
311
563
  dismiss() {
312
564
  this.snackBar.dismiss();
313
565
  }
314
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: SnackBarService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
315
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: SnackBarService });
566
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: SnackBarService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
567
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: SnackBarService });
316
568
  }
317
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: SnackBarService, decorators: [{
569
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: SnackBarService, decorators: [{
318
570
  type: Injectable
319
571
  }] });
320
572
 
@@ -379,10 +631,10 @@ class SupportService {
379
631
  withCredentials: true,
380
632
  });
381
633
  }
382
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: SupportService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
383
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: SupportService, providedIn: 'root' });
634
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: SupportService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
635
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: SupportService, providedIn: 'root' });
384
636
  }
385
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: SupportService, decorators: [{
637
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: SupportService, decorators: [{
386
638
  type: Injectable,
387
639
  args: [{
388
640
  providedIn: 'root',
@@ -410,10 +662,10 @@ class BreadcrumbService {
410
662
  relativeTo: route,
411
663
  });
412
664
  }
413
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BreadcrumbService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
414
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BreadcrumbService, providedIn: 'root' });
665
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: BreadcrumbService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
666
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: BreadcrumbService, providedIn: 'root' });
415
667
  }
416
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BreadcrumbService, decorators: [{
668
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: BreadcrumbService, decorators: [{
417
669
  type: Injectable,
418
670
  args: [{
419
671
  providedIn: 'root',
@@ -445,10 +697,10 @@ class SidenavService {
445
697
  this.isCollaped = !this.isMobile && !this.sidenav?.opened;
446
698
  }
447
699
  lists() { }
448
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: SidenavService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
449
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: SidenavService });
700
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: SidenavService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
701
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: SidenavService });
450
702
  }
451
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: SidenavService, decorators: [{
703
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: SidenavService, decorators: [{
452
704
  type: Injectable
453
705
  }], ctorParameters: () => [] });
454
706
 
@@ -486,16 +738,96 @@ class ThemeService {
486
738
  setDarkTheme(isDarkTheme) {
487
739
  this.darkTheme.next(isDarkTheme);
488
740
  }
489
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
490
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ThemeService, providedIn: 'root' });
741
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
742
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: ThemeService, providedIn: 'root' });
491
743
  }
492
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ThemeService, decorators: [{
744
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: ThemeService, decorators: [{
493
745
  type: Injectable,
494
746
  args: [{
495
747
  providedIn: 'root',
496
748
  }]
497
749
  }], ctorParameters: () => [] });
498
750
 
751
+ class OrderService extends BaseService {
752
+ init() {
753
+ this.endpoint = 'orders';
754
+ super.init();
755
+ }
756
+ by(options) {
757
+ return this.http.get(`${this.actionUrl}/items/by`, {
758
+ params: options,
759
+ withCredentials: true,
760
+ });
761
+ }
762
+ me(options) {
763
+ return this.http.get(`${this.actionUrl}/me`, {
764
+ params: options,
765
+ withCredentials: true,
766
+ });
767
+ }
768
+ timeline(id) {
769
+ return this.http.get(`${this.actionUrl}/${id}/timeline`, {
770
+ withCredentials: true,
771
+ });
772
+ }
773
+ pay(id) {
774
+ return this.http.post(`${this.actionUrl}/${id}/pay`, {}, {
775
+ withCredentials: true,
776
+ });
777
+ }
778
+ refund(id, data) {
779
+ return this.http.post(`${this.actionUrl}/${id}/refund`, data, {
780
+ withCredentials: true,
781
+ });
782
+ }
783
+ findAllReturns(options) {
784
+ return this.http.get(`${this.actionUrl}/returns`, {
785
+ params: options,
786
+ withCredentials: true,
787
+ });
788
+ }
789
+ findAllReturnsByInstructor(options) {
790
+ return this.http.get(`${this.actionUrl}/returns/instructor`, {
791
+ params: options,
792
+ withCredentials: true,
793
+ });
794
+ }
795
+ getReturn(id) {
796
+ return this.http.get(`${this.actionUrl}/returns/${id}`, {
797
+ withCredentials: true,
798
+ });
799
+ }
800
+ returnApprove(id) {
801
+ return this.http.post(`${this.actionUrl}/returns/${id}/approve`, {}, {
802
+ withCredentials: true,
803
+ });
804
+ }
805
+ returnReject(id, data) {
806
+ return this.http.post(`${this.actionUrl}/returns/${id}/reject`, data, {
807
+ withCredentials: true,
808
+ });
809
+ }
810
+ cancel(id) {
811
+ return this.http.post(`${this.actionUrl}/${id}/cancel`, {}, {
812
+ withCredentials: true,
813
+ });
814
+ }
815
+ countMeByStatus(options) {
816
+ return this.http.get(`${this.actionUrl}/count/me/by`, {
817
+ params: options,
818
+ withCredentials: true,
819
+ });
820
+ }
821
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: OrderService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
822
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: OrderService, providedIn: 'root' });
823
+ }
824
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: OrderService, decorators: [{
825
+ type: Injectable,
826
+ args: [{
827
+ providedIn: 'root',
828
+ }]
829
+ }] });
830
+
499
831
  class LoadingInterceptor {
500
832
  loadingService;
501
833
  activeRequests = 0;
@@ -514,10 +846,10 @@ class LoadingInterceptor {
514
846
  }
515
847
  }));
516
848
  }
517
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: LoadingInterceptor, deps: [{ token: LoadingService }], target: i0.ɵɵFactoryTarget.Injectable });
518
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: LoadingInterceptor, providedIn: 'root' });
849
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: LoadingInterceptor, deps: [{ token: LoadingService }], target: i0.ɵɵFactoryTarget.Injectable });
850
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: LoadingInterceptor, providedIn: 'root' });
519
851
  }
520
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: LoadingInterceptor, decorators: [{
852
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: LoadingInterceptor, decorators: [{
521
853
  type: Injectable,
522
854
  args: [{
523
855
  providedIn: 'root',
@@ -530,10 +862,10 @@ class BackButtonDirective {
530
862
  onClick() {
531
863
  this.navigation.back();
532
864
  }
533
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BackButtonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
534
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.1", type: BackButtonDirective, isStandalone: true, selector: "[rolatechBackButton]", host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
865
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: BackButtonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
866
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: BackButtonDirective, isStandalone: true, selector: "[rolatechBackButton]", host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
535
867
  }
536
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BackButtonDirective, decorators: [{
868
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: BackButtonDirective, decorators: [{
537
869
  type: Directive,
538
870
  args: [{
539
871
  selector: '[rolatechBackButton]',
@@ -559,6 +891,9 @@ function provideAngularServices() {
559
891
  BreadcrumbService,
560
892
  SidenavService,
561
893
  BackButtonDirective,
894
+ CartService,
895
+ ProductService,
896
+ OrderService,
562
897
  { provide: HTTP_INTERCEPTORS, useClass: LoadingInterceptor, multi: true },
563
898
  {
564
899
  provide: APP_INITIALIZER,
@@ -574,5 +909,5 @@ function provideAngularServices() {
574
909
  * Generated bundle index. Do not edit.
575
910
  */
576
911
 
577
- export { BackButtonDirective, BaseService, BreadcrumbService, DialogService, LayoutService, LoadingInterceptor, LoadingService, MediaService, NavigationService, SERVICE_DIRECTIVES, SidenavService, SnackBarService, SupportService, ThemeService, provideAngularServices };
912
+ export { BackButtonDirective, BaseService, BreadcrumbService, CartEventType, CartService, DialogService, LayoutService, LoadingInterceptor, LoadingService, MediaService, NavigationService, OrderService, ProductService, SERVICE_DIRECTIVES, SidenavService, SnackBarService, SupportService, ThemeService, provideAngularServices };
578
913
  //# sourceMappingURL=rolatech-angular-services.mjs.map