@infosoftas/s4-orders-js-sdk 0.0.1-beta1.6 → 0.1.1
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/.release-it.json +2 -1
- package/package.json +1 -1
- package/src/App.tsx +4 -1
- package/src/components/OrderForm/OrderForm.tsx +21 -0
- package/src/index.tsx +9 -0
package/.release-it.json
CHANGED
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -102,6 +102,9 @@ const App: FC<ConfigType> = ({
|
|
|
102
102
|
setFailedMsg('');
|
|
103
103
|
setErrorsMsg([]);
|
|
104
104
|
try {
|
|
105
|
+
// There is no way to detect the difference between "cancelled" and "accepted" payment for Vipps via UI
|
|
106
|
+
// Completing an order for cancelled payment is fine. The backend handles it correctly.
|
|
107
|
+
|
|
105
108
|
await orderComplete(orderId || data.orderId || '');
|
|
106
109
|
setIsConfirmed(true);
|
|
107
110
|
setLoading(false);
|
|
@@ -363,7 +366,7 @@ const App: FC<ConfigType> = ({
|
|
|
363
366
|
/>
|
|
364
367
|
)}
|
|
365
368
|
{formType !== FormTypeEnum.OIO &&
|
|
366
|
-
formType !== FormTypeEnum.EHF && (
|
|
369
|
+
formType !== FormTypeEnum.EHF && templatePackageId && (
|
|
367
370
|
<OrderForm
|
|
368
371
|
callback={handleForm}
|
|
369
372
|
updateFormData={updateFormData}
|
|
@@ -90,6 +90,27 @@ const OrderForm: FC<Props> = ({
|
|
|
90
90
|
errorInvalidEmailMsg = '',
|
|
91
91
|
errorInvalidPhoneMsg = '',
|
|
92
92
|
}) => {
|
|
93
|
+
|
|
94
|
+
if (!templatePackageId) {
|
|
95
|
+
console.error('"templatePackageId" should be set' );
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (!organizationId) {
|
|
99
|
+
console.error('"organizationId" should be set' );
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (!subscriberId) {
|
|
103
|
+
console.error('"subscriberId" should be set' );
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (!userId) {
|
|
107
|
+
console.error('"userId" should be set' );
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (!identityProviderId) {
|
|
111
|
+
console.error('"identityProviderId" should be set' );
|
|
112
|
+
}
|
|
113
|
+
|
|
93
114
|
const [orderFields, setOrderFields] = useState<OrderFormFiledType[]>(
|
|
94
115
|
paymentMethodsOptions?.[
|
|
95
116
|
defaultValues?.paymentMethod || PAYMENT_METHOD_DEFAULT
|
package/src/index.tsx
CHANGED
|
@@ -8,6 +8,15 @@ import App from './App';
|
|
|
8
8
|
export const orderComponent = {
|
|
9
9
|
root: null as Root | null,
|
|
10
10
|
init: function (config: ConfigType) {
|
|
11
|
+
|
|
12
|
+
if (!config.apiKey) {
|
|
13
|
+
console.error('"apiKey" should be set' );
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (!config.apiUrl) {
|
|
17
|
+
console.error('"apiUrl" should be set' );
|
|
18
|
+
}
|
|
19
|
+
|
|
11
20
|
const domNode = document.getElementById(config.domElementId);
|
|
12
21
|
orderComponent.root = createRoot(
|
|
13
22
|
domNode || document.createElement('div')
|