@omniumretail/shared-resources 0.2.18 → 0.2.20

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.
@@ -0,0 +1,2 @@
1
+ import { Actions } from '../../../../interfaces';
2
+ export declare const startActionQueryHook: () => import("@tanstack/react-query").UseMutationResult<Actions, unknown, Actions, unknown>;
@@ -1,2 +1,2 @@
1
1
  import { Inspection } from '../../../../interfaces';
2
- export declare const useInspectionMutateHook: (templateId: string) => import("@tanstack/react-query").UseMutationResult<Inspection, unknown, Inspection, unknown>;
2
+ export declare const useInspectionMutateHook: (templateId: string, userId: string, userName: string) => import("@tanstack/react-query").UseMutationResult<Inspection, unknown, Inspection, unknown>;
@@ -1,9 +1,9 @@
1
1
  import { UseQueryOptions } from '@tanstack/react-query';
2
- import { GNGDocumentosResponse, ResponseList } from '../../../../interfaces';
3
- interface GetGNGDocumentosProps extends UseQueryOptions<ResponseList<"Documents", GNGDocumentosResponse>> {
2
+ import { DocumentGng, ResponseList } from '../../../../interfaces';
3
+ interface GetGNGDocumentosProps extends UseQueryOptions<ResponseList<"Documents", DocumentGng>> {
4
4
  page?: number;
5
5
  records?: number;
6
6
  query?: string;
7
7
  }
8
- export declare const getGngDocumentos: ({ page, records, query, ...options }: GetGNGDocumentosProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"Documents", GNGDocumentosResponse>, unknown>;
8
+ export declare const getGngDocumentos: ({ page, records, query, ...options }: GetGNGDocumentosProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"Documents", DocumentGng>, unknown>;
9
9
  export {};
@@ -1,9 +1,8 @@
1
1
  import { UseQueryOptions } from '@tanstack/react-query';
2
- import { ResponseList, SitooDocumentoResponse } from '../../../../interfaces';
3
- interface GetSitooDocumentosProps extends UseQueryOptions<ResponseList<"Items", SitooDocumentoResponse>> {
2
+ import { ResponseList, DocumentSitoo } from '../../../../interfaces';
3
+ interface GetSitooDocumentosProps extends UseQueryOptions<ResponseList<"Items", DocumentSitoo>> {
4
4
  fields?: string;
5
5
  externalid?: string;
6
- num?: number;
7
6
  }
8
- export declare const getSitooDocumentos: ({ fields, externalid, num, ...options }: GetSitooDocumentosProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"Items", SitooDocumentoResponse>, unknown>;
7
+ export declare const getSitooDocumentos: ({ fields, externalid, ...options }: GetSitooDocumentosProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"Items", DocumentSitoo>, unknown>;
9
8
  export {};
@@ -3,9 +3,5 @@ import { SitooVoucher } from '../../../../interfaces';
3
3
  interface GetSitooVouchersProps extends UseQueryOptions<SitooVoucher> {
4
4
  id?: string;
5
5
  }
6
- interface SitooVoucherError {
7
- statuscode: number;
8
- errortext: string;
9
- }
10
- export declare const getSitooVouchers: ({ id, ...options }: GetSitooVouchersProps) => import("@tanstack/react-query").UseQueryResult<SitooVoucher, SitooVoucherError>;
6
+ export declare const getSitooVouchers: ({ id, ...options }: GetSitooVouchersProps) => import("@tanstack/react-query").UseQueryResult<SitooVoucher, unknown>;
11
7
  export {};
@@ -104,6 +104,7 @@ export * from './Asta/Actions/others/deleteActionQuery.hook';
104
104
  export * from './Asta/Actions/others/extractActionQuery.hook';
105
105
  export * from './Asta/Actions/others/archiveActionQuery.hook';
106
106
  export * from './Asta/Actions/others/finishActionQuery.hook';
107
+ export * from './Asta/Actions/others/startActionQuery.hook';
107
108
  export * from './Aprc/get/getPriceChangePinQuery.hook';
108
109
  export * from './Aprc/others/postPriceChangePinQuery.hook';
109
110
  export * from './Aprc/others/sendEmailWithPinQuery.hook';
@@ -61,14 +61,202 @@ export interface IntegrationRequestStatus {
61
61
  CreateDate: number;
62
62
  UpdatedDate: number;
63
63
  }
64
- export interface GNGDocumentosResponse {
65
- Documents: [];
64
+ export interface BillingAddress {
65
+ Street: string | null;
66
+ City: string | null;
67
+ ZipCode: string | null;
68
+ CountryISO2: string | null;
66
69
  }
67
- export interface SitooDocumento {
68
- orderid: number;
69
- externalid: string;
70
+ export interface DeliveryAddress {
71
+ Street: string | null;
72
+ City: string | null;
73
+ ZipCode: string | null;
74
+ CountryISO2: string | null;
70
75
  }
71
- export interface SitooDocumentoResponse {
72
- totalcount: number;
73
- items: SitooDocumento;
76
+ export interface FiscalInformation {
77
+ TaxName: string | null;
78
+ TaxNumber: string | null;
79
+ }
80
+ export interface Lines {
81
+ LineNumber: number;
82
+ Description: string;
83
+ Reference: string;
84
+ SKU: string;
85
+ Quantity: number;
86
+ VAT: string;
87
+ Taxes: number;
88
+ UnitPrice: number;
89
+ Discount: number;
90
+ PriceNet: number;
91
+ PriceGross: number;
92
+ CostPrice: number;
93
+ CampaignId: string | null;
94
+ ReasonCode: string;
95
+ UnitLabel: string;
96
+ }
97
+ export interface Payments {
98
+ LineNumber: number;
99
+ Amount: number;
100
+ PaymentTypeId: string;
101
+ GiftCardNumber: string | null;
102
+ Name: string;
103
+ }
104
+ export interface AdditionalFields {
105
+ Name: string;
106
+ Value: string;
107
+ }
108
+ export interface DocumentGng {
109
+ Id: string;
110
+ DocumentNumber: string;
111
+ CompanyCode: string;
112
+ DocumentTypeCode: string;
113
+ LocationCode: string;
114
+ Date: number;
115
+ AssociatedDocumentNumber: string | null;
116
+ SourceLocationCode: string | null;
117
+ DestinationLocationCode: string | null;
118
+ UserCode: string;
119
+ CustomerId: string | null;
120
+ SalesAssociateUserCode: string;
121
+ BillingAddress: BillingAddress | null;
122
+ DeliveryAddress: DeliveryAddress | null;
123
+ SubTotalNet: number;
124
+ SubTotalGross: number;
125
+ PostageNet: number;
126
+ PostageGross: number;
127
+ Taxes: number;
128
+ Discount: number;
129
+ TotalGross: number;
130
+ InternalStaffComments: string | null;
131
+ FiscalInformation: FiscalInformation | null;
132
+ POSReceiptId: string | null;
133
+ CreateDate: number;
134
+ UpdateDate: number;
135
+ Status: string;
136
+ Lines: Lines;
137
+ Payments: Payments;
138
+ ExternalPlatforms: any | null;
139
+ AdditionalFields: AdditionalFields;
140
+ }
141
+ export interface OrderItemAdditionalData {
142
+ ReasonCodeReturn: string | null;
143
+ InventTransId: string | null;
144
+ ReasonCodeManualPrice: string | null;
145
+ ReasonCodeManualDiscount: string | null;
146
+ POSStaffSalesExternalId: string | null;
147
+ OrderItemMoneyRowDiscount: string | null;
148
+ }
149
+ export interface OrderItems {
150
+ OrderItemId: number;
151
+ OrderItemType: number;
152
+ ProductId: number;
153
+ ProductName: string;
154
+ SKU: string;
155
+ ProductAttributes: string;
156
+ ExternalInput: string;
157
+ ExternalInputTitle: string;
158
+ Quantity: number;
159
+ DecimalUnitQuantity: number | null;
160
+ MoneyNetPricePerUnit: string;
161
+ MoneyPriceOrg: string;
162
+ VatValue: number;
163
+ DeliveryInfo: string;
164
+ MoneyItemTotalNet: string;
165
+ MoneyItemTotalVat: string;
166
+ VoucherId: number;
167
+ VoucherCode: string;
168
+ VoucherName: string;
169
+ MoneyOriginalPrice: string;
170
+ MoneyDiscountedPrice: string;
171
+ MoneyDiscount: string;
172
+ SalesTaxes: any;
173
+ DecimalQuantityTotal: string;
174
+ MoneyNetPricePerQuantity: string;
175
+ AdditionalData: OrderItemAdditionalData;
176
+ }
177
+ export interface PaymentAdditionalData {
178
+ GiftCardNumber: string | null;
179
+ }
180
+ export interface Payment {
181
+ Name: string;
182
+ MoneyAmount: string;
183
+ ExternalId: string;
184
+ AdditionalData: PaymentAdditionalData;
185
+ }
186
+ export interface AdditionalData {
187
+ POSTimezone: string;
188
+ StoreExternalId: string | null;
189
+ POSStaffSalesUserId: string | null;
190
+ POSStaffUserId: string | null;
191
+ CrmMemberNumber: string;
192
+ POSStaffExternalId: string;
193
+ POSStaffSalesExternalId: string;
194
+ CustomerTaxId: string | null;
195
+ POSReceiptId: string | null;
196
+ ATCUD: string | null;
197
+ CTUInvoiceNumber: string | null;
198
+ POSOriginalSalesOrderId: string | null;
199
+ OmniumIdentification: string | null;
200
+ FiscalInvoiceNumber: string | null;
201
+ InvoiceNumberCorrected: string | null;
202
+ FiscalInvoiceType: string | null;
203
+ }
204
+ export interface DocumentSitoo {
205
+ OrderId: number;
206
+ EshopId: number;
207
+ ExternalId: string;
208
+ CreditOrderId: number | null;
209
+ CheckoutTypeId: number;
210
+ DeliveryTypeId: number;
211
+ Email: string | null;
212
+ NameFirst: string | null;
213
+ NameLast: string | null;
214
+ PersonalId: string;
215
+ Company: string;
216
+ Phone: string | null;
217
+ InvoiceAddress: string;
218
+ InvoiceAddress2: string;
219
+ InvoiceZip: string;
220
+ InvoiceCity: string;
221
+ InvoiceState: string | null;
222
+ InvoiceCountryid: string;
223
+ DeliveryAddress: string;
224
+ DeliveryAddress2: string;
225
+ DeliveryZip: string;
226
+ DeliveryCity: string;
227
+ DeliveryState: string;
228
+ DeliveryCountryid: string;
229
+ Comment: string | null;
230
+ CommentInternal: string;
231
+ CustomerRef: string | null;
232
+ CheckoutRef: string | null;
233
+ MoneyTotalNet: string | null;
234
+ MoneyTotalVat: string | null;
235
+ MoneyCheckoutNet: string | null;
236
+ MoneyCheckoutVat: string | null;
237
+ MoneyTotalGrossCheckout: string | null;
238
+ MoneyDeliveryNet: string;
239
+ MoneyDeliveryVat: string | null;
240
+ MoneyTotalGrossDelivery: string;
241
+ MoneyFinalNet: string | null;
242
+ MoneyFinalVat: string | null;
243
+ MoneyFinalSalestax: string | null;
244
+ MoneyTotalGrossRoundoff: string | null;
245
+ MoneyTotalGrossAll: string | null;
246
+ CheckoutTypeName: string | null;
247
+ CheckoutMethodId: number;
248
+ CheckoutMethodSubId: number;
249
+ DeliveryTypeName: string | null;
250
+ OrderDate: number;
251
+ OrderStateId: number;
252
+ PaymentStateId: number;
253
+ OrderTypeId: number;
254
+ UserIdStaff: string | null;
255
+ RegisterId: string | null;
256
+ WarehouseId: number;
257
+ DateReserved: string | null;
258
+ CurrencyCode: string;
259
+ AdditionalData: AdditionalData;
260
+ OrderItems: OrderItems;
261
+ Payments: Payment;
74
262
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/shared-resources",
3
- "version": "0.2.18",
3
+ "version": "0.2.20",
4
4
  "private": false,
5
5
  "description": "Shared Components and services or utils to the frontend versions",
6
6
  "main": "dist/bundle.js",
@@ -0,0 +1,17 @@
1
+ import { useMutation, useQueryClient } from '@tanstack/react-query';
2
+ import { Actions } from '../../../../interfaces';
3
+ import { putAuth0 } from '../../../../services/ApiService';
4
+
5
+ export const startActionQueryHook = () => {
6
+ const queryClient = useQueryClient();
7
+ return useMutation<Actions, unknown, Actions>((data: Actions) => {
8
+ return putAuth0(`/ASTA/Actions/StartAction?`, {
9
+ pId: data.Id
10
+ }, data);
11
+ }, {
12
+ onSuccess: (data: Actions) => {
13
+ queryClient.setQueryData(
14
+ ['ACTION_ID_QUERY'], data);
15
+ },
16
+ });
17
+ }
@@ -2,7 +2,7 @@ import { useMutation, useQueryClient } from '@tanstack/react-query';
2
2
  import { Inspection } from '../../../../interfaces';
3
3
  import { putAuth0, postAuth0 } from '../../../../services/ApiService';
4
4
 
5
- export const useInspectionMutateHook = (templateId: string) => {
5
+ export const useInspectionMutateHook = (templateId: string, userId: string, userName: string) => {
6
6
  const queryClient = useQueryClient();
7
7
  return useMutation<Inspection, unknown, Inspection>((data: Inspection) => {
8
8
  return data.Id ?
@@ -11,7 +11,9 @@ export const useInspectionMutateHook = (templateId: string) => {
11
11
  }, data) :
12
12
 
13
13
  postAuth0(`/ASTA/Inspection?`, {
14
- pId: templateId
14
+ pId: templateId,
15
+ pUserId: userId,
16
+ pUserName: userName
15
17
  } , data);
16
18
  }, {
17
19
  onSuccess: (data: Inspection) => {
@@ -1,17 +1,17 @@
1
1
  import { useQuery, UseQueryOptions } from '@tanstack/react-query';
2
2
  import { get } from '../../../../services/ApiService';
3
- import { GNGDocumentosResponse , ResponseList} from '../../../../interfaces';
3
+ import { DocumentGng , ResponseList} from '../../../../interfaces';
4
4
 
5
- interface GetGNGDocumentosProps extends UseQueryOptions<ResponseList<"Documents", GNGDocumentosResponse>> {
5
+ interface GetGNGDocumentosProps extends UseQueryOptions<ResponseList<"Documents", DocumentGng>> {
6
6
  page?: number;
7
7
  records?: number;
8
8
  query?: string;
9
9
  }
10
10
 
11
- export const getGngDocumentos = ({ page, records, query, ...options }: GetGNGDocumentosProps) => {
11
+ export const getGngDocumentos = ({ page, records , query, ...options }: GetGNGDocumentosProps) => {
12
12
  return useQuery(
13
13
  ['GNG_DOCUMENTOS', page, records, query],
14
- () => get<ResponseList<"Documents", GNGDocumentosResponse>>('/GNG/Document/Documents', {
14
+ () => get<ResponseList<"Documents", DocumentGng>>('/GNG/Document/Documents', {
15
15
  pPage: page || 1,
16
16
  pRecords: records || 50,
17
17
  pQuery: query
@@ -19,4 +19,3 @@ export const getGngDocumentos = ({ page, records, query, ...options }: GetGNGDoc
19
19
  options
20
20
  );
21
21
  }
22
-
@@ -1,20 +1,20 @@
1
1
  import { useQuery, UseQueryOptions } from '@tanstack/react-query';
2
2
  import { get } from "../../../../services/ApiService";
3
- import { ResponseList, SitooDocumentoResponse } from '../../../../interfaces';
3
+ import { ResponseList, DocumentSitoo } from '../../../../interfaces';
4
4
 
5
- interface GetSitooDocumentosProps extends UseQueryOptions<ResponseList<"Items", SitooDocumentoResponse>> {
5
+ interface GetSitooDocumentosProps extends UseQueryOptions<ResponseList<"Items", DocumentSitoo>> {
6
6
  fields?: string;
7
7
  externalid?: string;
8
- num?: number;
8
+
9
9
  }
10
10
 
11
- export const getSitooDocumentos = ({ fields, externalid, num, ...options}: GetSitooDocumentosProps) => {
11
+ export const getSitooDocumentos = ({ fields, externalid, ...options}: GetSitooDocumentosProps) => {
12
12
  return useQuery(
13
- ['SITOO_DOCUMENTOS', fields, externalid, num],
14
- () => get<ResponseList<"Items", SitooDocumentoResponse>>('/Sitoo/Orders', {
13
+ ['SITOO_DOCUMENTOS', fields, externalid],
14
+ () => get<ResponseList<"Items", DocumentSitoo>>('/Sitoo/Orders', {
15
15
  pFields: fields || "externalid,orderid",
16
16
  pExternalid: externalid ,
17
- pNum: num
17
+
18
18
  }),
19
19
  options
20
20
  );
@@ -2,35 +2,21 @@ import { useQuery, UseQueryOptions } from '@tanstack/react-query';
2
2
  import { get } from "../../../../services/ApiService";
3
3
  import { SitooVoucher } from '../../../../interfaces';
4
4
 
5
- interface GetSitooVouchersProps extends UseQueryOptions<SitooVoucher> {
5
+ interface GetSitooVouchersProps extends UseQueryOptions<SitooVoucher>{
6
6
  id?: string;
7
7
  }
8
8
 
9
- interface SitooVoucherError {
10
- statuscode: number;
11
- errortext: string;
12
- }
13
-
14
9
  export const getSitooVouchers = ({ id, ...options }: GetSitooVouchersProps) => {
15
- return useQuery<SitooVoucher, SitooVoucherError>(
10
+ return useQuery(
16
11
  ['SITOO_VOUCHERS', id],
17
- async () => {
18
- try {
19
- const response = await get<SitooVoucher>(`/GNG/GiftCard/SPIGiftCard/giftcards/${id}.json`);
20
- return response;
21
- } catch (error: any) {
22
- if (error.response && error.response.data) {
23
- const { statuscode, errortext } = error.response.data;
24
- throw { statuscode, errortext }; // Throwing an error object with custom fields
25
- } else {
26
- throw error;
27
- }
28
- }
29
- },
12
+
13
+ () => get<SitooVoucher>(`/GNG/GiftCard/SPIGiftCard/giftcards/${id}.json`),
30
14
  {
31
15
  ...options,
32
- retry: false, // Disables automatic retries
16
+ retry: false,
17
+
33
18
  }
19
+
34
20
  );
35
- };
21
+ }
36
22
 
@@ -14,6 +14,10 @@ export const getVoucherIntegrationRequestStatus = ({ pIntegrationType, pSourcePl
14
14
  pIntegrationType: pIntegrationType ,
15
15
  pSourcePlatformId: pSourcePlatformId
16
16
  }),
17
- options
17
+ {
18
+ ...options,
19
+ retry: false,
20
+
21
+ }
18
22
  );
19
23
  }
@@ -14,7 +14,7 @@ interface PostCreateIntegrationRequestProps extends UseQueryOptions<IntegrationR
14
14
  export const postCreateIntegrationRequest = ({integrationType, sourcePlatformId, destinations, query}: PostCreateIntegrationRequestProps) => {
15
15
  const queryClient = useQueryClient();
16
16
  return useMutation<IntegrationRequestStatus, unknown, IntegrationRequestStatus>(() => {
17
- return postWithParameters('/Document/IntegrationRequests', {
17
+ return postWithParameters('/Document/IntegrationRequests?', {
18
18
  pIntegrationType: integrationType ,
19
19
  pSourcePlatformId: sourcePlatformId ,
20
20
  pDestinations: destinations,
@@ -135,6 +135,7 @@ export * from './Asta/Actions/others/deleteActionQuery.hook';
135
135
  export * from './Asta/Actions/others/extractActionQuery.hook';
136
136
  export * from './Asta/Actions/others/archiveActionQuery.hook';
137
137
  export * from './Asta/Actions/others/finishActionQuery.hook';
138
+ export * from './Asta/Actions/others/startActionQuery.hook';
138
139
 
139
140
  //APRC
140
141
  export * from './Aprc/get/getPriceChangePinQuery.hook';
@@ -156,7 +157,6 @@ export * from './OSUA/get/vouchers/getVoucherIntegrationRequestStatus.hook';
156
157
 
157
158
  export * from './OSUA/mutate/postCreateIntegrationRequest.hook';
158
159
 
159
-
160
160
  //Others
161
161
  export * from './Others/useJobTitlesQuery.hook';
162
162
  export * from './Others/useContractStatesQuery.hook';