@infosoftas/s4-orders-js-sdk 0.1.0 → 0.1.2

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 CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "$schema": "https://unpkg.com/release-it/schema/release-it.json",
3
3
  "git": {
4
- "changelog" : ""
4
+ "changelog" : "",
5
+ "requireBranch": "release/*"
5
6
  },
6
7
  "github": {
7
8
  "release": true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infosoftas/s4-orders-js-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "scripts": {
5
5
  "build": "rimraf lib && webpack --mode production",
6
6
  "release": "release-it"
package/src/App.tsx CHANGED
@@ -102,23 +102,8 @@ const App: FC<ConfigType> = ({
102
102
  setFailedMsg('');
103
103
  setErrorsMsg([]);
104
104
  try {
105
- if (!data.orderInfo) {
106
- try {
107
- if (data.orderId) {
108
- await handleOrderDelete(data.orderId);
109
- }
110
- } catch (error) {
111
- console.log(error);
112
- }
113
-
114
- setLoading(false);
115
- setOrderId(null);
116
- setOrderInfo(null);
117
- setIframeSrc(null);
118
- setIsConfirmed(false);
119
- setShowOrderForm(true);
120
- return;
121
- }
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.
122
107
 
123
108
  await orderComplete(orderId || data.orderId || '');
124
109
  setIsConfirmed(true);
@@ -100,7 +100,10 @@ const OrderForm: FC<Props> = ({
100
100
  }
101
101
 
102
102
  if (!subscriberId) {
103
- console.error('"subscriberId" should be set' );
103
+ const sessionSubscriberId = sessionStorage.getItem('subscriberId');
104
+ if (sessionSubscriberId) {
105
+ subscriberId = sessionSubscriberId;
106
+ }
104
107
  }
105
108
 
106
109
  if (!userId) {
@@ -109,6 +109,8 @@ const useOrderForm = ({
109
109
  });
110
110
  id = response.id;
111
111
 
112
+ sessionStorage.setItem('subscriberId', id); // For avoiding attempt of creating subscriber again
113
+
112
114
  if (userId && identityProviderId) {
113
115
  await mapSubscriberToUser(id, {
114
116
  userId: userId,