@unchainedshop/plugins 4.1.0 → 4.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/lib/payment/stripe/stripe.js +1 -1
- package/lib/presets/countries/ch.d.ts +0 -1
- package/lib/presets/countries/ch.d.ts.map +1 -1
- package/lib/presets/countries/ch.js +0 -1
- package/lib/presets/countries/ch.js.map +1 -1
- package/package.json +1 -1
- package/src/payment/stripe/stripe.ts +1 -1
- package/src/presets/countries/ch.ts +0 -1
- package/src/delivery/pick-mup.ts +0 -115
|
@@ -11,7 +11,7 @@ export const initStripeClient = async () => {
|
|
|
11
11
|
// @ts-ignore
|
|
12
12
|
const { default: Stripe } = await import('stripe');
|
|
13
13
|
stripe = new Stripe(STRIPE_SECRET, {
|
|
14
|
-
apiVersion: '2025-
|
|
14
|
+
apiVersion: '2025-10-29.clover',
|
|
15
15
|
});
|
|
16
16
|
return stripe;
|
|
17
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ch.d.ts","sourceRoot":"","sources":["../../../src/presets/countries/ch.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ch.d.ts","sourceRoot":"","sources":["../../../src/presets/countries/ch.ts"],"names":[],"mappings":"AAAA,OAAO,oCAAoC,CAAC;AAC5C,OAAO,qCAAqC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ch.js","sourceRoot":"","sources":["../../../src/presets/countries/ch.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ch.js","sourceRoot":"","sources":["../../../src/presets/countries/ch.ts"],"names":[],"mappings":"AAAA,OAAO,oCAAoC,CAAC;AAC5C,OAAO,qCAAqC,CAAC"}
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@ export const initStripeClient = async (): Promise<StripeType | null> => {
|
|
|
18
18
|
// @ts-ignore
|
|
19
19
|
const { default: Stripe } = await import('stripe');
|
|
20
20
|
stripe = new Stripe(STRIPE_SECRET, {
|
|
21
|
-
apiVersion: '2025-
|
|
21
|
+
apiVersion: '2025-10-29.clover',
|
|
22
22
|
});
|
|
23
23
|
return stripe;
|
|
24
24
|
};
|
package/src/delivery/pick-mup.ts
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { DeliveryAdapter, DeliveryDirector, DeliveryError, IDeliveryAdapter } from '@unchainedshop/core';
|
|
2
|
-
import { DeliveryProviderType } from '@unchainedshop/core-delivery';
|
|
3
|
-
|
|
4
|
-
const fetchPickMupLocations = async (key: string, idsFilter?: string) => {
|
|
5
|
-
// const pickMupUrl = `https://web-api.migros.ch/widgets/stores?key=${key}&verbosity=detail&limit=5000&aggregation_options%5Bempty_buckets%5D=true&filters%5Bmarkets%5D%5B0%5D%5B%5D=super&filters%5Bmarkets%5D%5B0%5D%5B%5D=mno&filters%5Bmarkets%5D%5B0%5D%5B%5D=voi&filters%5Bmarkets%5D%5B0%5D%5B%5D=mp&filters%5Bmarkets%5D%5B0%5D%5B%5D=out&filters%5Bmarkets%5D%5B0%5D%5B%5D=spx&filters%5Bmarkets%5D%5B0%5D%5B%5D=doi&filters%5Bmarkets%5D%5B0%5D%5B%5D=mec&filters%5Bmarkets%5D%5B0%5D%5B%5D=mica&filters%5Bmarkets%5D%5B0%5D%5B%5D=res&filters%5Bmarkets%5D%5B0%5D%5B%5D=flori&filters%5Bmarkets%5D%5B0%5D%5B%5D=gour&filters%5Bmarkets%5D%5B0%5D%5B%5D=alna&filters%5Bmarkets%5D%5B0%5D%5B%5D=cof&filters%5Bmarkets%5D%5B0%5D%5B%5D=chng&filters%5Bservices%5D%5Bsub_type%5D%5B%5D=pickmup&aggregation_groups%5B_custom%5D%5Bopen_on%5D%5Bnow%5D=20190923T11%3A45&aggregation_groups%5B_custom%5D%5Bopen_on%5D%5Bafter_1900%5D=20190923T19%3A01&aggregation_groups%5B_custom%5D%5Bopen_on%5D%5Bsundays%5D=sunday&aggregation_groups%5Bmarkets%5D%5B_terms%5D%5B%5D=super&aggregation_groups%5Bmarkets%5D%5B_terms%5D%5B%5D=voi&aggregation_groups%5Bmarkets%5D%5B_terms%5D%5B%5D=mp&aggregation_groups%5Bmarkets%5D%5B_terms%5D%5B%5D=mec&aggregation_groups%5Bmarkets%5D%5B_terms%5D%5B%5D=spx&aggregation_groups%5Bmarkets%5D%5B_terms%5D%5B%5D=doi&aggregation_groups%5Bmarkets%5D%5B_terms%5D%5B%5D=mica&aggregation_groups%5Bmarkets%5D%5B_terms%5D%5B%5D=out&aggregation_groups%5Bmarkets%5D%5B_terms%5D%5B%5D=flori&aggregation_groups%5Bmarkets%5D%5B_terms%5D%5B%5D=alna&aggregation_groups%5Bmarkets%5D%5B_terms%5D%5B%5D=res&aggregation_groups%5Bmarkets%5D%5B_terms%5D%5B%5D=gour&aggregation_groups%5Bmarkets%5D%5B_terms%5D%5B%5D=cof&aggregation_groups%5Bmarkets%5D%5B_terms%5D%5B%5D=res&aggregation_groups%5Bmarkets%5D%5B_terms%5D%5B%5D=gour&aggregation_groups%5Bmarkets%5D%5B_terms%5D%5B%5D=cof&aggregation_groups%5Bservices%5D%5Bsub_type%5D%5B_terms%5D%5B%5D=market-service-mig_clean&aggregation_groups%5Bservices%5D%5Bsub_type%5D%5B_terms%5D%5B%5D=market-service-mig_online&aggregation_groups%5Bservices%5D%5Bsub_type%5D%5B_terms%5D%5B%5D=pickmup&aggregation_groups%5Bservices%5D%5Bsub_type%5D%5B_terms%5D%5B%5D=post-service-point&aggregation_groups%5Bservices%5D%5Bsub_type%5D%5B_terms%5D%5B%5D=subito-selfscanning&aggregation_groups%5Bservices%5D%5Bsub_type%5D%5B_terms%5D%5B%5D=subito-selfcheckout&aggregation_groups%5Bservices%5D%5Bsub_type%5D%5B_terms%5D%5B%5D=market-service-mig_bakery&aggregation_groups%5Bservices%5D%5Bsub_type%5D%5B_terms%5D%5B%5D=counter-mez&aggregation_groups%5Bservices%5D%5Bsub_type%5D%5B_terms%5D%5B%5D=counter-fisch&aggregation_groups%5Bservices%5D%5Bsub_type%5D%5B_terms%5D%5B%5D=counter-kaes&aggregation_groups%5Bservices%5D%5Bsub_type%5D%5B_terms%5D%5B%5D=srv`;
|
|
6
|
-
const pickMupUrl = '';
|
|
7
|
-
|
|
8
|
-
const data = await fetch(`${pickMupUrl}${idsFilter ? `&ids[]=${idsFilter}` : ''}`, {
|
|
9
|
-
headers: {
|
|
10
|
-
accept: 'application/json, text/javascript, */*; q=0.01',
|
|
11
|
-
'accept-language': 'de',
|
|
12
|
-
'sec-fetch-mode': 'cors',
|
|
13
|
-
origin: 'https://filialen.migros.ch',
|
|
14
|
-
DNT: '1',
|
|
15
|
-
'user-agent':
|
|
16
|
-
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36',
|
|
17
|
-
},
|
|
18
|
-
body: null,
|
|
19
|
-
method: 'GET',
|
|
20
|
-
});
|
|
21
|
-
const result: any = await data.json();
|
|
22
|
-
const { stores = [] } = result || {};
|
|
23
|
-
return stores.flatMap(({ markets = [], location = {}, id }) => {
|
|
24
|
-
return markets.map(({ full_name: fullName }) => {
|
|
25
|
-
const {
|
|
26
|
-
geo: { lat, lon },
|
|
27
|
-
zip,
|
|
28
|
-
country,
|
|
29
|
-
address,
|
|
30
|
-
city,
|
|
31
|
-
address2,
|
|
32
|
-
} = location as any;
|
|
33
|
-
return {
|
|
34
|
-
_id: id,
|
|
35
|
-
name: fullName,
|
|
36
|
-
address: {
|
|
37
|
-
addressLine: address,
|
|
38
|
-
addressLine2: address2,
|
|
39
|
-
postalCode: zip,
|
|
40
|
-
countryCode: country,
|
|
41
|
-
city,
|
|
42
|
-
},
|
|
43
|
-
geoPoint: {
|
|
44
|
-
latitude: lat,
|
|
45
|
-
longitude: lon,
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const PickMup: IDeliveryAdapter = {
|
|
53
|
-
...DeliveryAdapter,
|
|
54
|
-
|
|
55
|
-
key: 'shop.unchained.pick-mup',
|
|
56
|
-
label: 'Migros PickMUp',
|
|
57
|
-
version: '1.0.0',
|
|
58
|
-
|
|
59
|
-
initialConfiguration: [
|
|
60
|
-
{
|
|
61
|
-
key: 'key',
|
|
62
|
-
value: '',
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
|
|
66
|
-
typeSupported: (type) => {
|
|
67
|
-
return type === DeliveryProviderType.PICKUP;
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
actions: (config, context) => {
|
|
71
|
-
const getKey = () => {
|
|
72
|
-
// Load https://filialen.migros.ch/de/filter:market_services-pickmup, open the browser developer tools and look for the sessionKey:
|
|
73
|
-
// <html lang="de" data-setup="{'env': 'production','sessionKey': '8ApUDaqeNER3Mest'}" class="no-js">
|
|
74
|
-
return config.reduce((current, item) => {
|
|
75
|
-
if (item.key === 'key') return item.value;
|
|
76
|
-
return current;
|
|
77
|
-
}, '');
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
return {
|
|
81
|
-
...DeliveryAdapter.actions(config, context),
|
|
82
|
-
|
|
83
|
-
isActive: () => {
|
|
84
|
-
return true;
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
isAutoReleaseAllowed: () => {
|
|
88
|
-
return true;
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
configurationError: () => {
|
|
92
|
-
if (!getKey()) {
|
|
93
|
-
return DeliveryError.INCOMPLETE_CONFIGURATION;
|
|
94
|
-
}
|
|
95
|
-
return null;
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
pickUpLocationById: async (id) => {
|
|
99
|
-
const [foundLocation] = await fetchPickMupLocations(getKey(), id);
|
|
100
|
-
return foundLocation;
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
pickUpLocations: async () => {
|
|
104
|
-
const result = await fetchPickMupLocations(getKey());
|
|
105
|
-
return result;
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
send: async () => {
|
|
109
|
-
return false;
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
},
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
DeliveryDirector.registerAdapter(PickMup);
|