{ "version": 3, "sources": ["src/app/modules/orders/orders.service.ts"], "sourcesContent": ["import {Injectable} from '@angular/core';\nimport {HttpClient, HttpParams} from '@angular/common/http';\nimport {Observable} from 'rxjs';\nimport {ConfigurationService} from 'src/app/core/config/configuration.service';\nimport {ItemPayload} from 'src/app/interfaces/general/responses/item-payload.interface';\nimport {IOrder} from 'src/app/interfaces/general/profile-definitions/order.interface';\nimport {ParamsEncoder} from 'src/app/core/config/params-encoder';\nimport {map} from 'rxjs/operators';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class OrdersService {\n constructor(\n private http: HttpClient,\n private config: ConfigurationService\n ) {}\n\n public getOrders(nextPageToken?: string, partner?: string): Observable> {\n let params = new HttpParams({encoder: new ParamsEncoder()}).append('top', 10000);\n if (nextPageToken) {\n params = params.append('continuationToken', nextPageToken);\n }\n if (partner) {\n params = params.append('partner', partner);\n }\n return this.http.get>(`${this.config.get('profileApiUrl')}/orders`, {params}).pipe(\n map((res) => {\n const data = [...res.data ?? []].sort((a, b) => {\n const aDate = new Date(a.createdDateTime).getTime();\n const bDate = new Date(b.createdDateTime).getTime();\n return bDate - aDate;\n });\n return {...res, data};\n })\n );\n }\n\n public getOrderById(id: string): Observable {\n return this.http.get(\n `${this.config.get('profileApiUrl')}/orders/${id}`\n );\n }\n}\n"], "mappings": "qMAYA,IAAaA,GAAa,IAAA,CAApB,MAAOA,CAAa,CACtBC,YACYC,EACAC,EAA4B,CAD5B,KAAAD,KAAAA,EACA,KAAAC,OAAAA,CACT,CAEIC,UAAUC,EAAwBC,EAAgB,CACrD,IAAIC,EAAS,IAAIC,EAAW,CAACC,QAAS,IAAIC,CAAe,CAAC,EAAEC,OAAO,MAAO,GAAK,EAC/E,OAAIN,IACAE,EAASA,EAAOI,OAAO,oBAAqBN,CAAa,GAEzDC,IACAC,EAASA,EAAOI,OAAO,UAAWL,CAAO,GAEtC,KAAKJ,KAAKU,IAAyB,GAAG,KAAKT,OAAOS,IAAI,eAAe,CAAC,UAAW,CAACL,OAAAA,CAAM,CAAC,EAAEM,KAC9FC,EAAKC,GAAO,CACR,IAAMC,EAAO,CAAC,GAAGD,EAAIC,MAAQ,CAAA,CAAE,EAAEC,KAAK,CAACC,EAAGC,IAAK,CAC3C,IAAMC,EAAQ,IAAIC,KAAKH,EAAEI,eAAe,EAAEC,QAAO,EAEjD,OADc,IAAIF,KAAKF,EAAEG,eAAe,EAAEC,QAAO,EAClCH,CACnB,CAAC,EACD,OAAOI,EAAAC,EAAA,GAAIV,GAAJ,CAASC,KAAAA,CAAI,EACxB,CAAC,CAAC,CAEV,CAEOU,aAAaC,EAAU,CAC1B,OAAO,KAAKzB,KAAKU,IACb,GAAG,KAAKT,OAAOS,IAAI,eAAe,CAAC,WAAWe,CAAE,EAAE,CAE1D,iDA9BS3B,GAAa4B,EAAAC,CAAA,EAAAD,EAAAE,CAAA,CAAA,CAAA,CAAA,iCAAb9B,EAAa+B,QAAb/B,EAAagC,UAAAC,WAFV,MAAM,CAAA,CAAA,SAETjC,CAAa,GAAA", "names": ["OrdersService", "constructor", "http", "config", "getOrders", "nextPageToken", "partner", "params", "HttpParams", "encoder", "ParamsEncoder", "append", "get", "pipe", "map", "res", "data", "sort", "a", "b", "aDate", "Date", "createdDateTime", "getTime", "__spreadProps", "__spreadValues", "getOrderById", "id", "\u0275\u0275inject", "HttpClient", "ConfigurationService", "factory", "\u0275fac", "providedIn"] }