@omniumretail/shared-resources 0.2.19 → 0.2.21

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 (34) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/types/hooks/ATIM/BackOffice/get/useEmployeeTimekeepingDetails.hook.d.ts +15 -0
  3. package/dist/types/hooks/ATIM/BackOffice/get/useStoresQueryHook.hook.d.ts +11 -0
  4. package/dist/types/hooks/ATIM/BackOffice/mutate/postAttendanceRange.hook.d.ts +2 -0
  5. package/dist/types/hooks/Asta/Actions/others/startActionQuery.hook.d.ts +2 -0
  6. package/dist/types/hooks/Asta/Inspection/mutate/useInspectionMutateQuery.hook.d.ts +1 -1
  7. package/dist/types/hooks/OSUA/get/documentos/getGngDocumentos.hook.d.ts +3 -3
  8. package/dist/types/hooks/OSUA/get/documentos/getSitooDocumentos.hook.d.ts +3 -4
  9. package/dist/types/hooks/OSUA/get/vouchers/getSitooVouchers.hook.d.ts +3 -3
  10. package/dist/types/hooks/index.d.ts +4 -0
  11. package/dist/types/interfaces/BackofficeAtim.d.ts +35 -0
  12. package/dist/types/interfaces/Configuration.d.ts +1 -0
  13. package/dist/types/interfaces/OUSA.d.ts +196 -8
  14. package/dist/types/interfaces/Responses.d.ts +6 -0
  15. package/dist/types/interfaces/index.d.ts +1 -0
  16. package/dist/types/services/ApiService/index.d.ts +1 -0
  17. package/package.json +1 -1
  18. package/src/hooks/ATIM/BackOffice/get/useEmployeeTimekeepingDetails.hook.ts +38 -0
  19. package/src/hooks/ATIM/BackOffice/get/useStoresQueryHook.hook.ts +27 -0
  20. package/src/hooks/ATIM/BackOffice/mutate/postAttendanceRange.hook.ts +16 -0
  21. package/src/hooks/Asta/Actions/others/startActionQuery.hook.ts +17 -0
  22. package/src/hooks/Asta/Inspection/mutate/useInspectionMutateQuery.hook.ts +4 -2
  23. package/src/hooks/OSUA/get/documentos/getGngDocumentos.hook.ts +4 -5
  24. package/src/hooks/OSUA/get/documentos/getSitooDocumentos.hook.ts +7 -7
  25. package/src/hooks/OSUA/get/vouchers/getSitooVouchers.hook.ts +14 -16
  26. package/src/hooks/OSUA/get/vouchers/getVoucherIntegrationRequestStatus.hook.ts +5 -1
  27. package/src/hooks/OSUA/mutate/postCreateIntegrationRequest.hook.ts +1 -1
  28. package/src/hooks/index.ts +8 -0
  29. package/src/interfaces/BackofficeAtim.ts +48 -0
  30. package/src/interfaces/Configuration.ts +1 -0
  31. package/src/interfaces/OUSA.ts +211 -10
  32. package/src/interfaces/Responses.ts +7 -0
  33. package/src/interfaces/index.ts +2 -1
  34. package/src/services/ApiService/index.ts +42 -0
@@ -0,0 +1,48 @@
1
+ import { Store } from './Store';
2
+
3
+
4
+
5
+ export interface WorkLogDetail {
6
+ Id: string;
7
+ Type: number;
8
+ Date: number;
9
+ }
10
+
11
+ export interface Breaks {
12
+ Number: number;
13
+ Time: number;
14
+ }
15
+
16
+ export interface WorkDayLog {
17
+ WorkDay: number;
18
+ TimeWorked: number;
19
+ Breaks: Breaks;
20
+ Details: WorkLogDetail[];
21
+ }
22
+
23
+ export interface EmployeesWorklog {
24
+ Id: string;
25
+ Code: string;
26
+ Name: string;
27
+ JobTitle: string;
28
+ IsWorking: boolean;
29
+ TimeWorked: number;
30
+ Breaks: Breaks;
31
+ WorkDayLogs: WorkDayLog[];
32
+ }
33
+
34
+
35
+ export interface Location {
36
+ Id: string;
37
+ Name: string;
38
+ Code: string;
39
+ Status: string;
40
+
41
+ }
42
+
43
+ export interface UserBackoffice {
44
+ UserId: string;
45
+ FullName: string;
46
+
47
+
48
+ }
@@ -4,4 +4,5 @@ export interface Configuration {
4
4
  ApiPath: string;
5
5
  token?: string;
6
6
  tokenAuth0?: string;
7
+ basic?: string;
7
8
  }
@@ -72,18 +72,219 @@ export interface IntegrationRequestStatus {
72
72
  UpdatedDate: number;
73
73
  }
74
74
 
75
- export interface GNGDocumentosResponse {
76
- Documents: [];
77
-
75
+ export interface BillingAddress {
76
+ Street: string | null;
77
+ City: string | null;
78
+ ZipCode: string | null;
79
+ CountryISO2: string | null;
78
80
  }
79
-
80
- export interface SitooDocumento {
81
- orderid: number;
82
- externalid: string;
81
+
82
+ export interface DeliveryAddress {
83
+ Street: string | null;
84
+ City: string | null;
85
+ ZipCode: string | null;
86
+ CountryISO2: string | null;
87
+ }
88
+
89
+ export interface FiscalInformation {
90
+ TaxName: string | null;
91
+ TaxNumber: string | null;
92
+ }
93
+
94
+ export interface Lines {
95
+ LineNumber: number;
96
+ Description: string;
97
+ Reference: string;
98
+ SKU: string;
99
+ Quantity: number;
100
+ VAT: string;
101
+ Taxes: number;
102
+ UnitPrice: number;
103
+ Discount: number;
104
+ PriceNet: number;
105
+ PriceGross: number;
106
+ CostPrice: number;
107
+ CampaignId: string | null;
108
+ ReasonCode: string;
109
+ UnitLabel: string;
110
+ }
111
+
112
+ export interface Payments {
113
+ LineNumber: number;
114
+ Amount: number;
115
+ PaymentTypeId: string;
116
+ GiftCardNumber: string | null;
117
+ Name: string;
83
118
  }
84
119
 
85
- export interface SitooDocumentoResponse {
86
- totalcount: number;
87
- items: SitooDocumento;
120
+ export interface AdditionalFields {
121
+ Name: string;
122
+ Value: string;
123
+ }
124
+
125
+ export interface DocumentGng {
126
+ Id: string;
127
+ DocumentNumber: string;
128
+ CompanyCode: string;
129
+ DocumentTypeCode: string;
130
+ LocationCode: string;
131
+ Date: number;
132
+ AssociatedDocumentNumber: string | null;
133
+ SourceLocationCode: string | null;
134
+ DestinationLocationCode: string | null;
135
+ UserCode: string;
136
+ CustomerId: string | null;
137
+ SalesAssociateUserCode: string;
138
+ BillingAddress: BillingAddress | null;
139
+ DeliveryAddress: DeliveryAddress | null;
140
+ SubTotalNet: number;
141
+ SubTotalGross: number;
142
+ PostageNet: number;
143
+ PostageGross: number;
144
+ Taxes: number;
145
+ Discount: number;
146
+ TotalGross: number;
147
+ InternalStaffComments: string | null;
148
+ FiscalInformation: FiscalInformation | null;
149
+ POSReceiptId: string | null;
150
+ CreateDate: number;
151
+ UpdateDate: number;
152
+ Status: string;
153
+ Lines: Lines;
154
+ Payments: Payments;
155
+ ExternalPlatforms: any | null;
156
+ AdditionalFields: AdditionalFields;
88
157
  }
158
+
159
+ export interface OrderItemAdditionalData {
160
+ ReasonCodeReturn: string | null;
161
+ InventTransId: string | null;
162
+ ReasonCodeManualPrice: string | null;
163
+ ReasonCodeManualDiscount: string | null;
164
+ POSStaffSalesExternalId: string | null;
165
+ OrderItemMoneyRowDiscount: string | null;
166
+ }
167
+
168
+ export interface OrderItems {
169
+ OrderItemId: number;
170
+ OrderItemType: number;
171
+ ProductId: number;
172
+ ProductName: string;
173
+ SKU: string;
174
+ ProductAttributes: string;
175
+ ExternalInput: string;
176
+ ExternalInputTitle: string;
177
+ Quantity: number;
178
+ DecimalUnitQuantity: number | null;
179
+ MoneyNetPricePerUnit: string;
180
+ MoneyPriceOrg: string;
181
+ VatValue: number;
182
+ DeliveryInfo: string;
183
+ MoneyItemTotalNet: string;
184
+ MoneyItemTotalVat: string;
185
+ VoucherId: number;
186
+ VoucherCode: string;
187
+ VoucherName: string;
188
+ MoneyOriginalPrice: string;
189
+ MoneyDiscountedPrice: string;
190
+ MoneyDiscount: string;
191
+ SalesTaxes: any;
192
+ DecimalQuantityTotal: string;
193
+ MoneyNetPricePerQuantity: string;
194
+ AdditionalData: OrderItemAdditionalData;
195
+ }
196
+
197
+ export interface PaymentAdditionalData {
198
+ GiftCardNumber: string | null;
199
+ }
200
+
201
+ export interface Payment {
202
+ Name: string;
203
+ MoneyAmount: string;
204
+ ExternalId: string;
205
+ AdditionalData: PaymentAdditionalData;
206
+ }
207
+
208
+ export interface AdditionalData {
209
+ POSTimezone: string;
210
+ StoreExternalId: string | null;
211
+ POSStaffSalesUserId: string | null;
212
+ POSStaffUserId: string | null;
213
+ CrmMemberNumber: string;
214
+ POSStaffExternalId: string;
215
+ POSStaffSalesExternalId: string;
216
+ CustomerTaxId: string | null;
217
+ POSReceiptId: string | null;
218
+ ATCUD: string | null;
219
+ CTUInvoiceNumber: string | null;
220
+ POSOriginalSalesOrderId: string | null;
221
+ OmniumIdentification: string | null;
222
+ FiscalInvoiceNumber: string | null;
223
+ InvoiceNumberCorrected: string | null;
224
+ FiscalInvoiceType: string | null;
225
+ }
226
+
227
+ export interface DocumentSitoo {
228
+ OrderId: number;
229
+ EshopId: number;
230
+ ExternalId: string;
231
+ CreditOrderId: number | null;
232
+ CheckoutTypeId: number;
233
+ DeliveryTypeId: number;
234
+ Email: string | null;
235
+ NameFirst: string | null;
236
+ NameLast: string | null;
237
+ PersonalId: string;
238
+ Company: string;
239
+ Phone: string | null;
240
+ InvoiceAddress: string;
241
+ InvoiceAddress2: string;
242
+ InvoiceZip: string;
243
+ InvoiceCity: string;
244
+ InvoiceState: string | null;
245
+ InvoiceCountryid: string;
246
+ DeliveryAddress: string;
247
+ DeliveryAddress2: string;
248
+ DeliveryZip: string;
249
+ DeliveryCity: string;
250
+ DeliveryState: string;
251
+ DeliveryCountryid: string;
252
+ Comment: string | null;
253
+ CommentInternal: string;
254
+ CustomerRef: string | null;
255
+ CheckoutRef: string | null;
256
+ MoneyTotalNet: string | null;
257
+ MoneyTotalVat: string | null;
258
+ MoneyCheckoutNet: string | null;
259
+ MoneyCheckoutVat: string | null;
260
+ MoneyTotalGrossCheckout: string | null;
261
+ MoneyDeliveryNet: string;
262
+ MoneyDeliveryVat: string | null;
263
+ MoneyTotalGrossDelivery: string;
264
+ MoneyFinalNet: string | null;
265
+ MoneyFinalVat: string | null;
266
+ MoneyFinalSalestax: string | null;
267
+ MoneyTotalGrossRoundoff: string | null;
268
+ MoneyTotalGrossAll: string | null;
269
+ CheckoutTypeName: string | null;
270
+ CheckoutMethodId: number;
271
+ CheckoutMethodSubId: number;
272
+ DeliveryTypeName: string | null;
273
+ OrderDate: number;
274
+ OrderStateId: number;
275
+ PaymentStateId: number;
276
+ OrderTypeId: number;
277
+ UserIdStaff: string | null;
278
+ RegisterId: string | null;
279
+ WarehouseId: number;
280
+ DateReserved: string | null;
281
+ CurrencyCode: string;
282
+ AdditionalData: AdditionalData;
283
+ OrderItems: OrderItems;
284
+ Payments: Payment;
285
+ }
286
+
287
+
288
+
289
+
89
290
 
@@ -30,6 +30,13 @@ export interface Attendance {
30
30
 
31
31
  }
32
32
 
33
+ export interface AttendanceRange {
34
+ StoreID: string;
35
+ EmployeeID: string;
36
+ EntryDate: number;
37
+ ExitDate: number;
38
+ }
39
+
33
40
 
34
41
 
35
42
 
@@ -51,4 +51,5 @@ export * from './GetMonths';
51
51
  export * from './AstsStockInfo';
52
52
  export * from './AstsStock';
53
53
  export * from './UserAuthentication';
54
- export * from './OUSA';
54
+ export * from './OUSA';
55
+ export * from './BackofficeAtim';
@@ -9,6 +9,10 @@ export const getAuth0 = <T>(path: string, params?: Record<string, unknown>): Pro
9
9
  return buildApiRequestForAuth0<T>(`${path}?${buildParams(params || {})}`, 'GET');
10
10
  }
11
11
 
12
+ export const getBasic = <T>(path: string, params?: Record<string, unknown>): Promise<T> => {
13
+ return buildApiRequestForBasic<T>(`${path}?${buildParams(params || {})}`, 'GET');
14
+ }
15
+
12
16
  export const putAuth0 = <T>(path: string, params?: Record<string, unknown>, body?: unknown, bodyType?: string): Promise<T> => {
13
17
  return buildApiRequestForAuth0<T>(`${path}${buildParams(params || {})}`, 'PUT', body, bodyType);
14
18
  }
@@ -128,6 +132,44 @@ const buildApiRequestForAuth0 = <T>(path: string, method = 'GET', data?: unknown
128
132
  });
129
133
  }
130
134
 
135
+ /**
136
+ * Build the api request with auth
137
+ * @param path
138
+ * @param method
139
+ * @param data
140
+ * @returns
141
+ */
142
+ const buildApiRequestForBasic = <T>(path: string, method = 'GET', data?: unknown, bodyType?: string): Promise<T> => {
143
+ const requestUri = buildPath(path);
144
+
145
+ const headers: HeadersInit = {
146
+ Authorization: appConfig.basic ? `Basic ${appConfig.basic}` : undefined,
147
+ };
148
+
149
+ let body: FormData | string | undefined | any;
150
+
151
+ if (['POST', 'PUT', 'PATCH'].includes(method)) {
152
+ if (bodyType === 'formdata') {
153
+ // Não é necessário dar set do contentType porque o fetch faz isso por nós quando usamos o fetch
154
+ body = data;
155
+ } else {
156
+ headers['Content-Type'] = 'application/json';
157
+ body = JSON.stringify(data);
158
+ }
159
+ }
160
+
161
+ return fetch(requestUri, {
162
+ method,
163
+ headers,
164
+ body,
165
+ }).then((response) => {
166
+ if (response.status >= 200 && response.status <= 300) {
167
+ return response.json();
168
+ }
169
+ return response.json().then((data) => Promise.reject(data));
170
+ });
171
+ }
172
+
131
173
  /**
132
174
  * Builds the path to access the api
133
175
  * @param path