@infosoftas/s4-orders-js-sdk 0.1.3 → 0.1.4
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.
- package/package.json +1 -1
- package/src/api/InvoiceApi.ts +2 -1
- package/src/components/EHFForm/EHFForm.tsx +1 -0
- package/src/components/FormFields/ToggleFiled.tsx +3 -0
- package/src/components/OIOForm/OIOForm.tsx +1 -0
- package/src/components/OrderForm/OrderForm.tsx +1 -0
- package/src/enums/general.ts +3 -1
- package/src/hooks/useOrderForm.tsx +11 -1
package/package.json
CHANGED
package/src/api/InvoiceApi.ts
CHANGED
|
@@ -6,7 +6,8 @@ type RequestInvoiceLookupType = {
|
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
type InvoiceLookupResponseType = {
|
|
9
|
-
|
|
9
|
+
receivesInvoice: boolean;
|
|
10
|
+
recievesInvoice: boolean; // TODO: Should be deleted in the future (misspelled), use "receivesInvoice" instead of this.
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
export const invoiceLookup = (
|
|
@@ -14,6 +14,7 @@ type Props = {
|
|
|
14
14
|
message?: string;
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
|
+
toggleCallback?: (value: boolean) => void;
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
const ToggleField: FC<Props> = ({
|
|
@@ -23,6 +24,7 @@ const ToggleField: FC<Props> = ({
|
|
|
23
24
|
label = '',
|
|
24
25
|
errorReqMsg = 'This field is required!',
|
|
25
26
|
errors,
|
|
27
|
+
toggleCallback
|
|
26
28
|
}) => {
|
|
27
29
|
const { register } = useFormContext();
|
|
28
30
|
const id = uuidv4();
|
|
@@ -44,6 +46,7 @@ const ToggleField: FC<Props> = ({
|
|
|
44
46
|
{...register(name, {
|
|
45
47
|
required: required ? errorReqMsg : false,
|
|
46
48
|
})}
|
|
49
|
+
onClick={(e) => toggleCallback?.(e.currentTarget.checked)}
|
|
47
50
|
/>
|
|
48
51
|
<span className="slider round"></span>
|
|
49
52
|
</label>
|
package/src/enums/general.ts
CHANGED
|
@@ -33,4 +33,6 @@ export enum UserActionEnum {
|
|
|
33
33
|
SELECT_FORM = 'selectForm',
|
|
34
34
|
SELECT_PAYMENT_METHOD = 'selectPaymentMethod',
|
|
35
35
|
RETURN_TO_MAIN = 'returnToMain',
|
|
36
|
-
|
|
36
|
+
TOGGLE_INVOICE_ADDRESS = 'toggleInvoiceAddress',
|
|
37
|
+
SEARCH_ORGANIZATION_NUMBER = 'searchOrganizationNumber',
|
|
38
|
+
}
|
|
@@ -96,7 +96,17 @@ const useOrderForm = ({
|
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
// TODO: "recievesInvoice" should be deleted in the future
|
|
100
|
+
const receivesInvoice = invoiceResponse?.receivesInvoice || invoiceResponse?.recievesInvoice;
|
|
101
|
+
|
|
102
|
+
userActionCallback?.(UserActionEnum.SEARCH_ORGANIZATION_NUMBER, {
|
|
103
|
+
organizationNumber: data.organizationNumber,
|
|
104
|
+
cvr: data.cvr,
|
|
105
|
+
gln: data.gln,
|
|
106
|
+
found: !!receivesInvoice
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
if (invoiceResponse && !receivesInvoice) {
|
|
100
110
|
setLoading(false);
|
|
101
111
|
const value =
|
|
102
112
|
data.paymentMethod === PaymentMethodEnum.OIO
|