simpo-component-library 1.6.54 → 1.6.55

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,10 +17,10 @@ import * as i13$1 from 'primeng/toast';
17
17
  import { ToastModule } from 'primeng/toast';
18
18
  import * as i7 from 'primeng/api';
19
19
  import { MessageService } from 'primeng/api';
20
- import { forkJoin, map } from 'rxjs';
20
+ import { map, forkJoin } from 'rxjs';
21
21
  import * as i1$1 from '@angular/common/http';
22
- import * as i2$2 from 'ngx-cookie-service';
23
22
  import * as i2$3 from '@angular/router';
23
+ import * as i2$2 from 'ngx-cookie-service';
24
24
  import Swal from 'sweetalert2';
25
25
  import * as i5 from '@angular/material/bottom-sheet';
26
26
  import { MAT_BOTTOM_SHEET_DATA, MatBottomSheetModule } from '@angular/material/bottom-sheet';
@@ -3157,6 +3157,191 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImpor
3157
3157
  args: ['simpoSticky']
3158
3158
  }] } });
3159
3159
 
3160
+ class RestService {
3161
+ constructor(http, eventService) {
3162
+ this.http = http;
3163
+ this.eventService = eventService;
3164
+ this.BASE_URL = "https://dev-api.simpo.ai/";
3165
+ this.environmentTypeSubscriber = null;
3166
+ this.environmentTypeSubscriber = this.eventService.environmentType.subscribe((response) => {
3167
+ if (response == "DEV")
3168
+ this.BASE_URL = "https://dev-api.simpo.ai/";
3169
+ else if (response == "STAGE")
3170
+ this.BASE_URL = "https://state-api.simpo.ai/";
3171
+ else
3172
+ this.BASE_URL = "https://api.simpo.ai/";
3173
+ });
3174
+ }
3175
+ ngOnDestroy() {
3176
+ if (this.environmentTypeSubscriber)
3177
+ this.environmentTypeSubscriber?.unsubscribe();
3178
+ }
3179
+ getFeaturedProduct(collectionId) {
3180
+ let subIndustryId = localStorage.getItem("subIndustryId");
3181
+ if (!subIndustryId)
3182
+ subIndustryId = "";
3183
+ return this.http.get(this.BASE_URL + `ecommerce/product/collection/id?collectionId=${collectionId || ''}&subIndustryId=${subIndustryId || ''}&isEndUser=true`).pipe(map((response) => response.data?.map((product) => new Product(product))));
3184
+ }
3185
+ getCategoriesByCollectionId(collectionId) {
3186
+ return this.http.get(this.BASE_URL + `ecommerce/inventory/category/collectionId?collectionId=${collectionId}`).pipe(map((response) => response.data?.map((category) => new Category(category))));
3187
+ }
3188
+ getProductDetails(productId = null) {
3189
+ const payload = {
3190
+ pageNo: 0,
3191
+ pageSize: 1,
3192
+ itemId: productId,
3193
+ subIndustryId: localStorage.getItem("subIndustryId"),
3194
+ userId: localStorage.getItem("perId") ?? null,
3195
+ request: "USER"
3196
+ };
3197
+ return this.http.put(this.BASE_URL + `ecommerce/product/item/search`, payload).pipe(map((response) => response.data.data.map((product) => new Product(product))));
3198
+ }
3199
+ getCollectionByIds(collectionIds) {
3200
+ const payload = {
3201
+ ids: collectionIds
3202
+ };
3203
+ return this.http.put(this.BASE_URL + `ecommerce/inventory/collection/list/all`, payload).pipe(map((response) => response.data?.map((collection) => new Collection(collection))));
3204
+ }
3205
+ getAllCategories() {
3206
+ const businessId = localStorage.getItem("bId") ?? localStorage.getItem("businessId") ?? "";
3207
+ const subIndustryId = localStorage.getItem("subIndustryId") ?? "";
3208
+ return this.http.get(this.BASE_URL + `ecommerce/inventory/featured?businessId=${businessId}&subId=${subIndustryId}`).pipe(map((response) => response.data?.map((category) => new Category(category))));
3209
+ }
3210
+ getAllCollections() {
3211
+ const payload = {
3212
+ pageNo: 0,
3213
+ pageSize: 10,
3214
+ request: "USER",
3215
+ businessId: localStorage.getItem("bId") ?? localStorage.getItem("businessId")
3216
+ };
3217
+ return this.http.put(this.BASE_URL + 'ecommerce/inventory/get/collection', payload).pipe(map((response) => response.data.data?.map((collection) => new Collection(collection))));
3218
+ }
3219
+ getFilteredProduct(collectionIds, categoryIds, searchText, minPrice, maxPrice, sortBy, pageNo, size) {
3220
+ const payload = {
3221
+ "businessId": localStorage.getItem("bId") ?? localStorage.getItem("businessId"),
3222
+ "subIndustryId": localStorage.getItem("subIndustryId"),
3223
+ "collectionId": collectionIds,
3224
+ "categoryId": categoryIds,
3225
+ "searchText": searchText,
3226
+ "minPrice": minPrice ?? 0,
3227
+ "maxPrice": maxPrice ?? 0,
3228
+ "sortBy": sortBy,
3229
+ "pageNo": pageNo,
3230
+ "pageSize": size,
3231
+ "userId": localStorage.getItem("perId") ?? null,
3232
+ request: "USER"
3233
+ };
3234
+ return this.http.put(this.BASE_URL + `ecommerce/product/item/search`, payload).pipe(map((response) => {
3235
+ return {
3236
+ count: response.data.count,
3237
+ data: response.data.data?.map((product) => new Product(product))
3238
+ };
3239
+ }));
3240
+ }
3241
+ getProductByCategoryId(categoryId) {
3242
+ const payload = {
3243
+ "businessId": localStorage.getItem("bId") ?? localStorage.getItem("businessId"),
3244
+ "categoryId": [categoryId],
3245
+ "subIndustryId": localStorage.getItem("subIndustryId"),
3246
+ "pageNo": 0,
3247
+ "pageSize": 10,
3248
+ "userId": localStorage.getItem("perId") ?? null,
3249
+ request: "USER"
3250
+ };
3251
+ return this.http.put(this.BASE_URL + `ecommerce/product/item/search`, payload).pipe(map((response) => {
3252
+ return {
3253
+ count: response.count,
3254
+ data: response.data.data?.map((product) => new Product(product))
3255
+ };
3256
+ }));
3257
+ }
3258
+ getProductByCollectionId(collectionId) {
3259
+ const payload = {
3260
+ "businessId": localStorage.getItem("bId") ?? localStorage.getItem("businessId"),
3261
+ "collectionId": [collectionId],
3262
+ "subIndustryId": localStorage.getItem("subIndustryId"),
3263
+ "pageNo": 0,
3264
+ "pageSize": 10,
3265
+ "userId": localStorage.getItem("perId") ?? null,
3266
+ request: "USER"
3267
+ };
3268
+ return this.http.put(this.BASE_URL + `ecommerce/product/item/search`, payload).pipe(map((response) => {
3269
+ return {
3270
+ count: response.count,
3271
+ data: response.data.data?.map((product) => new Product(product))
3272
+ };
3273
+ }));
3274
+ }
3275
+ addReview(payload) {
3276
+ return this.http.post(this.BASE_URL + `ecommerce/user/add/review`, payload);
3277
+ }
3278
+ getAllReviews(productId) {
3279
+ return this.http.put(this.BASE_URL + `ecommerce/user/filter/reviews?productId=${productId}`, null);
3280
+ }
3281
+ generateOTP(mobile, countryCode) {
3282
+ const businessId = localStorage.getItem("bId") ?? localStorage.getItem("businessId") ?? "";
3283
+ return this.http.post(this.BASE_URL + `ecommerce/user/otp/trigger?mobile=${mobile}&countryCode=${countryCode}&businessId=${businessId}`, null);
3284
+ }
3285
+ verifyOTP(mobile, otp, deviceInfo) {
3286
+ const businessId = localStorage.getItem("bId") ?? localStorage.getItem("businessId") ?? "";
3287
+ return this.http.put(this.BASE_URL + `ecommerce/user/authenticate?mobile=${mobile}&otp=${otp}&businessId=${businessId}`, deviceInfo);
3288
+ }
3289
+ resendOTP(mobile, countryCode) {
3290
+ const businessId = localStorage.getItem("bId") ?? localStorage.getItem("businessId") ?? "";
3291
+ return this.http.post(this.BASE_URL + `ecommerce/user/resend?mobile=${mobile}&countryCode=${countryCode}&businessId=${businessId}`, null);
3292
+ }
3293
+ addItemToDB(userCart) {
3294
+ return this.http.post(this.BASE_URL + `ecommerce/order/cart`, userCart);
3295
+ }
3296
+ getUserItems(userId, cartType) {
3297
+ return this.http.get(this.BASE_URL + `ecommerce/order/cart?userId=${userId}&cartType=${cartType}`);
3298
+ }
3299
+ placeOrder(cartId) {
3300
+ return this.http.post(this.BASE_URL + `ecommerce/order/order?cartId=${cartId}`, null);
3301
+ }
3302
+ getUserInfo(userId) {
3303
+ return this.http.put(this.BASE_URL + `ecommerce/user/get/user?userId=${userId}`, null);
3304
+ }
3305
+ addUserAddress(user) {
3306
+ return this.http.put(this.BASE_URL + `ecommerce/user/update/user`, user);
3307
+ }
3308
+ updateProfile(payload) {
3309
+ return this.http.put(this.BASE_URL + `ecommerce/user/update/user`, payload);
3310
+ }
3311
+ getUserOrders(payload) {
3312
+ return this.http.put(this.BASE_URL + `ecommerce/order/user/order`, payload);
3313
+ }
3314
+ toggleItemCartToFav() {
3315
+ }
3316
+ moveWishlistToCart() {
3317
+ return this.http.get(this.BASE_URL + `ecommerce/update/cart`);
3318
+ }
3319
+ getUserWishlist(userId) {
3320
+ return this.http.get(this.BASE_URL + `ecommerce/order/cart?userId=${userId}&cartType=WISHLIST`);
3321
+ }
3322
+ moveItemToCart(userId, payload) {
3323
+ return this.http.put(this.BASE_URL + `ecommerce/order/update/cart?userId=${userId}`, payload);
3324
+ }
3325
+ // Payment
3326
+ createPaymentToken(payload) {
3327
+ return this.http.post(this.BASE_URL + `ecommerce/payment/order`, payload);
3328
+ }
3329
+ refundPayment(orderId, payload) {
3330
+ return this.http.post(this.BASE_URL + `ecommerce/payment/refund/bank?orderId=${orderId}`, payload);
3331
+ }
3332
+ checkPaymentStatus(payload) {
3333
+ return this.http.post(this.BASE_URL + `ecommerce/payment/status`, payload);
3334
+ }
3335
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: RestService, deps: [{ token: i1$1.HttpClient }, { token: EventsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
3336
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: RestService, providedIn: 'root' }); }
3337
+ }
3338
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: RestService, decorators: [{
3339
+ type: Injectable,
3340
+ args: [{
3341
+ providedIn: 'root',
3342
+ }]
3343
+ }], ctorParameters: () => [{ type: i1$1.HttpClient }, { type: EventsService }] });
3344
+
3160
3345
  class StorageServiceService {
3161
3346
  constructor(eventService, cookieService, restService) {
3162
3347
  this.eventService = eventService;
@@ -3357,7 +3542,9 @@ class StorageServiceService {
3357
3542
  }
3358
3543
  getUser() {
3359
3544
  try {
3360
- return JSON.parse(this.cookieService.get("user"));
3545
+ const user = JSON.parse(this.cookieService.get("user"));
3546
+ localStorage.setItem("perId", user?.userId);
3547
+ return user;
3361
3548
  }
3362
3549
  catch (exception) { }
3363
3550
  return null;
@@ -3376,196 +3563,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImpor
3376
3563
  }]
3377
3564
  }], ctorParameters: () => [{ type: EventsService }, { type: i2$2.CookieService }, { type: RestService }] });
3378
3565
 
3379
- class RestService {
3380
- constructor(http, eventService, storageService) {
3381
- this.http = http;
3382
- this.eventService = eventService;
3383
- this.storageService = storageService;
3384
- this.BASE_URL = "https://dev-api.simpo.ai/";
3385
- this.environmentTypeSubscriber = null;
3386
- this.environmentTypeSubscriber = this.eventService.environmentType.subscribe((response) => {
3387
- if (response == "DEV")
3388
- this.BASE_URL = "https://dev-api.simpo.ai/";
3389
- else if (response == "STAGE")
3390
- this.BASE_URL = "https://state-api.simpo.ai/";
3391
- else
3392
- this.BASE_URL = "https://api.simpo.ai/";
3393
- });
3394
- }
3395
- ngOnDestroy() {
3396
- if (this.environmentTypeSubscriber)
3397
- this.environmentTypeSubscriber?.unsubscribe();
3398
- }
3399
- getFeaturedProduct(collectionId) {
3400
- let subIndustryId = localStorage.getItem("subIndustryId");
3401
- if (!subIndustryId)
3402
- subIndustryId = "";
3403
- // collectionId = "1ef5b924-66ad-68f5-b931-2bd654300b1f"
3404
- return this.http.get(this.BASE_URL + `ecommerce/product/collection/id?collectionId=${collectionId || ''}&subIndustryId=${subIndustryId || ''}&isEndUser=true`).pipe(map((response) => response.data?.map((product) => new Product(product))));
3405
- }
3406
- // getCollectionById(collectionId: string) {
3407
- // return this.http.get(this.BASE_URL + `product/category/id?categoryId=1ef6944e-8483-6fc5-92d7-5bc8a38cc5b1`)
3408
- // }
3409
- getCategoriesByCollectionId(collectionId) {
3410
- return this.http.get(this.BASE_URL + `ecommerce/inventory/category/collectionId?collectionId=${collectionId}`).pipe(map((response) => response.data?.map((category) => new Category(category))));
3411
- }
3412
- getProductDetails(productId = null) {
3413
- const payload = {
3414
- pageNo: 0,
3415
- pageSize: 1,
3416
- itemId: productId,
3417
- subIndustryId: localStorage.getItem("subIndustryId"),
3418
- userId: this.storageService.getUser()?.userId ?? null,
3419
- request: "USER"
3420
- };
3421
- return this.http.put(this.BASE_URL + `ecommerce/product/item/search`, payload).pipe(map((response) => response.data.data.map((product) => new Product(product))));
3422
- }
3423
- getCollectionByIds(collectionIds) {
3424
- const payload = {
3425
- ids: collectionIds
3426
- };
3427
- return this.http.put(this.BASE_URL + `ecommerce/inventory/collection/list/all`, payload).pipe(map((response) => response.data?.map((collection) => new Collection(collection))));
3428
- }
3429
- getAllCategories() {
3430
- const businessId = localStorage.getItem("bId") ?? localStorage.getItem("businessId") ?? "";
3431
- const subIndustryId = localStorage.getItem("subIndustryId") ?? "";
3432
- return this.http.get(this.BASE_URL + `ecommerce/inventory/featured?businessId=${businessId}&subId=${subIndustryId}`).pipe(map((response) => response.data?.map((category) => new Category(category))));
3433
- }
3434
- getAllCollections() {
3435
- const payload = {
3436
- pageNo: 0,
3437
- pageSize: 10,
3438
- request: "USER",
3439
- businessId: localStorage.getItem("bId") ?? localStorage.getItem("businessId")
3440
- };
3441
- return this.http.put(this.BASE_URL + 'ecommerce/inventory/get/collection', payload).pipe(map((response) => response.data.data?.map((collection) => new Collection(collection))));
3442
- }
3443
- getFilteredProduct(collectionIds, categoryIds, searchText, minPrice, maxPrice, sortBy, pageNo, size) {
3444
- const payload = {
3445
- "businessId": localStorage.getItem("bId") ?? localStorage.getItem("businessId"),
3446
- "subIndustryId": localStorage.getItem("subIndustryId"),
3447
- "collectionId": collectionIds,
3448
- "categoryId": categoryIds,
3449
- "searchText": searchText,
3450
- "minPrice": minPrice ?? 0,
3451
- "maxPrice": maxPrice ?? 0,
3452
- "sortBy": sortBy,
3453
- "pageNo": pageNo,
3454
- "pageSize": size,
3455
- "userId": this.storageService.getUser()?.userId ?? null,
3456
- request: "USER"
3457
- };
3458
- return this.http.put(this.BASE_URL + `ecommerce/product/item/search`, payload).pipe(map((response) => {
3459
- return {
3460
- count: response.data.count,
3461
- data: response.data.data?.map((product) => new Product(product))
3462
- };
3463
- }));
3464
- }
3465
- getProductByCategoryId(categoryId) {
3466
- const payload = {
3467
- "businessId": localStorage.getItem("bId") ?? localStorage.getItem("businessId"),
3468
- "categoryId": [categoryId],
3469
- "subIndustryId": localStorage.getItem("subIndustryId"),
3470
- "pageNo": 0,
3471
- "pageSize": 10,
3472
- "userId": this.storageService.getUser()?.userId ?? null,
3473
- request: "USER"
3474
- };
3475
- return this.http.put(this.BASE_URL + `ecommerce/product/item/search`, payload).pipe(map((response) => {
3476
- return {
3477
- count: response.count,
3478
- data: response.data.data?.map((product) => new Product(product))
3479
- };
3480
- }));
3481
- }
3482
- getProductByCollectionId(collectionId) {
3483
- const payload = {
3484
- "businessId": localStorage.getItem("bId") ?? localStorage.getItem("businessId"),
3485
- "collectionId": [collectionId],
3486
- "subIndustryId": localStorage.getItem("subIndustryId"),
3487
- "pageNo": 0,
3488
- "pageSize": 10,
3489
- "userId": this.storageService.getUser()?.userId ?? null,
3490
- request: "USER"
3491
- };
3492
- return this.http.put(this.BASE_URL + `ecommerce/product/item/search`, payload).pipe(map((response) => {
3493
- return {
3494
- count: response.count,
3495
- data: response.data.data?.map((product) => new Product(product))
3496
- };
3497
- }));
3498
- }
3499
- addReview(payload) {
3500
- return this.http.post(this.BASE_URL + `ecommerce/user/add/review`, payload);
3501
- }
3502
- getAllReviews(productId) {
3503
- return this.http.put(this.BASE_URL + `ecommerce/user/filter/reviews?productId=${productId}`, null);
3504
- }
3505
- generateOTP(mobile, countryCode) {
3506
- const businessId = localStorage.getItem("bId") ?? localStorage.getItem("businessId") ?? "";
3507
- return this.http.post(this.BASE_URL + `ecommerce/user/otp/trigger?mobile=${mobile}&countryCode=${countryCode}&businessId=${businessId}`, null);
3508
- }
3509
- verifyOTP(mobile, otp, deviceInfo) {
3510
- const businessId = localStorage.getItem("bId") ?? localStorage.getItem("businessId") ?? "";
3511
- return this.http.put(this.BASE_URL + `ecommerce/user/authenticate?mobile=${mobile}&otp=${otp}&businessId=${businessId}`, deviceInfo);
3512
- }
3513
- resendOTP(mobile, countryCode) {
3514
- const businessId = localStorage.getItem("bId") ?? localStorage.getItem("businessId") ?? "";
3515
- return this.http.post(this.BASE_URL + `ecommerce/user/resend?mobile=${mobile}&countryCode=${countryCode}&businessId=${businessId}`, null);
3516
- }
3517
- addItemToDB(userCart) {
3518
- return this.http.post(this.BASE_URL + `ecommerce/order/cart`, userCart);
3519
- }
3520
- getUserItems(userId, cartType) {
3521
- return this.http.get(this.BASE_URL + `ecommerce/order/cart?userId=${userId}&cartType=${cartType}`);
3522
- }
3523
- placeOrder(cartId) {
3524
- return this.http.post(this.BASE_URL + `ecommerce/order/order?cartId=${cartId}`, null);
3525
- }
3526
- getUserInfo(userId) {
3527
- return this.http.put(this.BASE_URL + `ecommerce/user/get/user?userId=${userId}`, null);
3528
- }
3529
- addUserAddress(user) {
3530
- return this.http.put(this.BASE_URL + `ecommerce/user/update/user`, user);
3531
- }
3532
- updateProfile(payload) {
3533
- return this.http.put(this.BASE_URL + `ecommerce/user/update/user`, payload);
3534
- }
3535
- getUserOrders(payload) {
3536
- return this.http.put(this.BASE_URL + `ecommerce/order/user/order`, payload);
3537
- }
3538
- toggleItemCartToFav() {
3539
- }
3540
- moveWishlistToCart() {
3541
- return this.http.get(this.BASE_URL + `ecommerce/update/cart`);
3542
- }
3543
- getUserWishlist(userId) {
3544
- return this.http.get(this.BASE_URL + `ecommerce/order/cart?userId=${userId}&cartType=WISHLIST`);
3545
- }
3546
- moveItemToCart(userId, payload) {
3547
- return this.http.put(this.BASE_URL + `ecommerce/order/update/cart?userId=${userId}`, payload);
3548
- }
3549
- // Payment
3550
- createPaymentToken(payload) {
3551
- return this.http.post(this.BASE_URL + `ecommerce/payment/order`, payload);
3552
- }
3553
- refundPayment(orderId, payload) {
3554
- return this.http.post(this.BASE_URL + `ecommerce/payment/refund/bank?orderId=${orderId}`, payload);
3555
- }
3556
- checkPaymentStatus(payload) {
3557
- return this.http.post(this.BASE_URL + `ecommerce/payment/status`, payload);
3558
- }
3559
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: RestService, deps: [{ token: i1$1.HttpClient }, { token: EventsService }, { token: StorageServiceService }], target: i0.ɵɵFactoryTarget.Injectable }); }
3560
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: RestService, providedIn: 'root' }); }
3561
- }
3562
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: RestService, decorators: [{
3563
- type: Injectable,
3564
- args: [{
3565
- providedIn: 'root',
3566
- }]
3567
- }], ctorParameters: () => [{ type: i1$1.HttpClient }, { type: EventsService }, { type: StorageServiceService }] });
3568
-
3569
3566
  class UserBasicInfoComponent {
3570
3567
  constructor(restService, router, dialogRef, storageService, messageService) {
3571
3568
  this.restService = restService;