@woosmap/ui 4.185.6 → 4.187.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@woosmap/ui",
3
- "version": "4.185.6",
3
+ "version": "4.187.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/WebGeoServices/ui.git"
@@ -15,7 +15,6 @@ import distanceImg from '../../images/products/product-distance.png';
15
15
  import addressImg from '../../images/products/product-address.png';
16
16
  import mapImg from '../../images/products/product-map.png';
17
17
  import trafficImg from '../../images/products/product-traffic.png';
18
- import merchantImg from '../../images/products/product-merchant.png';
19
18
  import indoorImg from '../../images/products/product-indoor.png';
20
19
  import what3wordsImg from '../../images/products/product-what3words.png';
21
20
  import transitImg from '../../images/products/product-transit.png';
@@ -30,7 +29,6 @@ import distanceImgSq from '../../images/products/product-distance-sq.png';
30
29
  import addressImgSq from '../../images/products/product-address-sq.png';
31
30
  import mapImgSq from '../../images/products/product-map-sq.png';
32
31
  import trafficImgSq from '../../images/products/product-traffic-sq.png';
33
- import merchantImgSq from '../../images/products/product-merchant-sq.png';
34
32
  import indoorImgSq from '../../images/products/product-indoor-sq.png';
35
33
  import what3wordsImgSq from '../../images/products/product-what3words-sq.png';
36
34
  import transitImgSq from '../../images/products/product-transit-sq.png';
@@ -47,7 +45,6 @@ const productImg = {
47
45
  ADDRESS: addressImg,
48
46
  MAP: mapImg,
49
47
  TRAFFIC: trafficImg,
50
- MERCHANTS: merchantImg,
51
48
  INDOOR: indoorImg,
52
49
  W3W: what3wordsImg,
53
50
  TRANSIT: transitImg,
@@ -64,7 +61,6 @@ const productImgSq = {
64
61
  ADDRESS: addressImgSq,
65
62
  MAP: mapImgSq,
66
63
  TRAFFIC: trafficImgSq,
67
- MERCHANTS: merchantImgSq,
68
64
  INDOOR: indoorImgSq,
69
65
  W3W: what3wordsImgSq,
70
66
  TRANSIT: transitImgSq,
@@ -332,7 +328,6 @@ Card.propTypes = {
332
328
  'ADDRESS',
333
329
  'MAP',
334
330
  'TRAFFIC',
335
- 'MERCHANTS',
336
331
  'LOCALITIES',
337
332
  'INDOOR',
338
333
  'W3W',
@@ -88,9 +88,6 @@ function SimpleCardTemplate() {
88
88
  <Tooltip text="Mapping" direction="n" product="STORES">
89
89
  <Label round size="nano" label="Mg" tooltip="Mapping" product="STORES" />
90
90
  </Tooltip>
91
- <Tooltip text="Merchant" direction="n" product="MERCHANTS">
92
- <Label round size="nano" label="Me" tooltip="Merchant" product="MERCHANTS" />
93
- </Tooltip>
94
91
  </SimpleCard>
95
92
  </>
96
93
  );
@@ -119,9 +116,6 @@ function SimpleCardSelectedTemplate() {
119
116
  <Tooltip text="Mapping" direction="n" product="STORES">
120
117
  <Label round size="nano" label="Mg" tooltip="Mapping" product="STORES" />
121
118
  </Tooltip>
122
- <Tooltip text="Merchant" direction="n" product="MERCHANTS">
123
- <Label round size="nano" label="Me" tooltip="Merchant" product="MERCHANTS" />
124
- </Tooltip>
125
119
  </SimpleCard>
126
120
  );
127
121
  }
@@ -2,7 +2,6 @@ import React, { Component } from 'react';
2
2
  import DistanceDemo from './DistanceDemo';
3
3
  import GeolocationDemo from './GeolocationDemo';
4
4
  import LocalitiesDemo from './LocalitiesAllDemo';
5
- import MerchantDemo from './MerchantDemo';
6
5
  import MapDemo from './MapDemo';
7
6
  import SearchDemo from './SearchDemo';
8
7
  import { changeLanguage } from '../utils/locale';
@@ -32,7 +31,6 @@ class IframeCommunication extends Component {
32
31
  name: 'showcase',
33
32
  height: document.getElementById('root').offsetHeight + 20,
34
33
  'localities-demo': document.getElementById('localities-demo').offsetTop,
35
- 'merchant-demo': document.getElementById('merchant-demo').offsetTop,
36
34
  'geolocation-demo': document.getElementById('geolocation-demo').offsetTop,
37
35
  'search-demo': document.getElementById('search-demo').offsetTop,
38
36
  'distance-demo': document.getElementById('distance-demo').offsetTop,
@@ -65,7 +63,6 @@ function Template() {
65
63
  <TrackEventContext.Provider value={trackEvent}>
66
64
  <LocalitiesDemo />
67
65
  <SearchDemo />
68
- <MerchantDemo />
69
66
  <MapDemo />
70
67
  <DistanceDemo />
71
68
  <GeolocationDemo />
@@ -83,7 +80,6 @@ function TemplateEn() {
83
80
  <TrackEventContext.Provider value={trackEvent}>
84
81
  <LocalitiesDemo />
85
82
  <SearchDemo />
86
- <MerchantDemo />
87
83
  <MapDemo />
88
84
  <DistanceDemo />
89
85
  <GeolocationDemo />
@@ -20,8 +20,7 @@
20
20
  position relative
21
21
  // box-shadow 0 0 3rem rgba($logo2, .15)
22
22
  box-shadow 0 .3rem 1rem rgba($secondary, .15)
23
- .demo--merchant &
24
- border .1rem solid $light
23
+
25
24
  &__showcase
26
25
  &__data
27
26
  display flex
@@ -369,5 +368,3 @@
369
368
  border-right 0
370
369
  &__map
371
370
  height 32rem
372
- .demo--merchant &
373
- height auto
@@ -210,7 +210,6 @@ import { ReactComponent as Geolocation } from '../../icons/geolocation.svg';
210
210
  import { ReactComponent as Localities } from '../../icons/localities.svg';
211
211
  import { ReactComponent as Map } from '../../icons/map.svg';
212
212
 
213
- import { ReactComponent as Merchant } from '../../icons/merchant.svg';
214
213
  import { ReactComponent as Stores } from '../../icons/stores.svg';
215
214
  import { ReactComponent as Traffic } from '../../icons/traffic.svg';
216
215
  import { ReactComponent as Geofencing } from '../../icons/geofencing.svg';
@@ -817,7 +816,6 @@ const ProductsIcons = {
817
816
  localities: Localities,
818
817
  mapping: Mapping,
819
818
  maps: Map,
820
- merchant: Merchant,
821
819
  multisearch: MultiSearch,
822
820
  storelocator: StoreLocator,
823
821
  stores: Stores,
@@ -209,6 +209,27 @@ import { ReactComponent as StockAvailability } from '../../icons/stock-availabil
209
209
  import { ReactComponent as StoreGog } from '../../icons/store-cog.svg';
210
210
  import { ReactComponent as StoreInfo } from '../../icons/store-info.svg';
211
211
 
212
+ import { ReactComponent as Stores } from '../../icons/stores.svg';
213
+ import { ReactComponent as Traffic } from '../../icons/traffic.svg';
214
+ import { ReactComponent as Geofencing } from '../../icons/geofencing.svg';
215
+ import { ReactComponent as StoreLocator } from '../../icons/storelocator.svg';
216
+ import { ReactComponent as MultiSearch } from '../../icons/multisearch.svg';
217
+ import { ReactComponent as Mapping } from '../../icons/mapping.svg';
218
+ import { ReactComponent as Connectors } from '../../icons/connectors.svg';
219
+ import { ReactComponent as Showcases } from '../../icons/showcases.svg';
220
+ import { ReactComponent as Indoor } from '../../icons/indoor.svg';
221
+ import { ReactComponent as Address } from '../../icons/address.svg';
222
+ import { ReactComponent as Distance } from '../../icons/distance.svg';
223
+ import { ReactComponent as Geolocation } from '../../icons/geolocation.svg';
224
+ import { ReactComponent as Localities } from '../../icons/localities.svg';
225
+ import { ReactComponent as Map } from '../../icons/map.svg';
226
+
227
+ import { ReactComponent as SocialFacebook } from '../../icons/social-facebook.svg';
228
+ import { ReactComponent as SocialGithub } from '../../icons/social-github.svg';
229
+ import { ReactComponent as SocialGoogle } from '../../icons/social-google.svg';
230
+ import { ReactComponent as SocialLinkedin } from '../../icons/social-linkedin.svg';
231
+ import { ReactComponent as SocialTwitter } from '../../icons/social-twitter.svg';
232
+
212
233
  const WebsiteIcons = {
213
234
  autocomplete: Autocomplete,
214
235
  'autocomplete-check': AutocompleteCheck,
@@ -418,13 +439,32 @@ const MapDemo = {
418
439
  'map-high-speed-train': MapHighSpeedTrain,
419
440
  };
420
441
 
421
-
442
+ const ProductsIcons = {
443
+ address: Address,
444
+ connectors: Connectors,
445
+ distance: Distance,
446
+ geofencing: Geofencing,
447
+ geolocation: Geolocation,
448
+ indoor: Indoor,
449
+ localities: Localities,
450
+ mapping: Mapping,
451
+ maps: Map,
452
+ multisearch: MultiSearch,
453
+ storelocator: StoreLocator,
454
+ stores: Stores,
455
+ traffic: Traffic,
456
+ showcases: Showcases,
457
+ };
422
458
 
423
459
  const Icons = {
424
460
  ...WebsiteIcons,
425
- ...ConsoleIcons,
426
461
  ...ProductsIcons,
427
462
  ...MapDemo,
463
+ 'social-facebook': SocialFacebook,
464
+ 'social-github': SocialGithub,
465
+ 'social-google': SocialGoogle,
466
+ 'social-linkedin': SocialLinkedin,
467
+ 'social-twitter': SocialTwitter,
428
468
  };
429
469
 
430
470
  class Icon extends Component {
@@ -464,6 +504,8 @@ Icon.propTypes = {
464
504
  };
465
505
 
466
506
  export default Object.assign(Icon, {
507
+ Icons,
467
508
  WebsiteIcons,
509
+ ProductsIcons,
468
510
  MapDemo,
469
511
  });
@@ -101,7 +101,6 @@ Label.propTypes = {
101
101
  'address',
102
102
  'map',
103
103
  'mapping',
104
- 'merchants',
105
104
  'traffic',
106
105
  'indoor',
107
106
  'w3w',
@@ -42,7 +42,6 @@ Tooltip.propTypes = {
42
42
  noDelay: PropTypes.bool,
43
43
  product: PropTypes.oneOf([
44
44
  'localities',
45
- 'merchants',
46
45
  'address',
47
46
  'map',
48
47
  'stores',
@@ -11,7 +11,6 @@ import distanceImgSq from '../../images/products/product-distance-sq.png';
11
11
  import addressImgSq from '../../images/products/product-address-sq.png';
12
12
  import mapImgSq from '../../images/products/product-map-sq.png';
13
13
  import trafficImgSq from '../../images/products/product-traffic-sq.png';
14
- import merchantImgSq from '../../images/products/product-merchant-sq.png';
15
14
  import indoorImgSq from '../../images/products/product-indoor-sq.png';
16
15
 
17
16
  const productImg = {
@@ -24,7 +23,6 @@ const productImg = {
24
23
  ADDRESS: addressImgSq,
25
24
  MAP: mapImgSq,
26
25
  TRAFFIC: trafficImgSq,
27
- MERCHANTS: merchantImgSq,
28
26
  INDOOR: indoorImgSq,
29
27
  };
30
28
 
package/src/index.js CHANGED
@@ -54,7 +54,6 @@ export { default as LocalitiesCheckoutUKDemo } from './components/Demo/Localitie
54
54
  export { default as LocalitiesCheckoutFRDemo } from './components/Demo/LocalitiesFRAddressDemo';
55
55
  export { default as LocalitiesAddressDemo } from './components/Demo/LocalitiesAddressDemo';
56
56
  export { default as LocalitiesAllDemo } from './components/Demo/LocalitiesAllDemo';
57
- export { default as MerchantDemo } from './components/Demo/MerchantDemo';
58
57
  export { default as GeolocationDemo } from './components/Demo/GeolocationDemo';
59
58
  export { default as DistanceDemo } from './components/Demo/DistanceDemo';
60
59
  export { default as SearchDemo } from './components/Demo/SearchDemo';
package/src/website.js CHANGED
@@ -1,9 +1,7 @@
1
- export { changeLanguage } from './components/utils/locale';
2
-
3
1
  export { default as Button } from './components/Button/Button';
4
2
  export { default as Dropdown } from './components/Dropdown/Dropdown';
5
3
  export { default as Flash } from './components/Flash/Flash';
6
- export { default as Icon } from './components/Icon/Icon';
4
+ export { default as Icon } from './components/Icon/WebSiteIcon';
7
5
 
8
6
  export { default as Input } from './components/Input/Input';
9
7
  export { default as PasswordStrengthBar } from './components/PasswordStrengthBar/PasswordStrengthBar';
@@ -16,14 +14,12 @@ export { default as LocalitiesCheckoutUKDemo } from './components/Demo/Localitie
16
14
  export { default as LocalitiesCheckoutFRDemo } from './components/Demo/LocalitiesFRAddressDemo';
17
15
  export { default as LocalitiesAddressDemo } from './components/Demo/LocalitiesAddressDemo';
18
16
  export { default as LocalitiesAllDemo } from './components/Demo/LocalitiesAllDemo';
19
- export { default as MerchantDemo } from './components/Demo/MerchantDemo';
20
17
  export { default as GeolocationDemo } from './components/Demo/GeolocationDemo';
21
18
  export { default as DistanceDemo } from './components/Demo/DistanceDemo';
22
19
  export { default as SearchDemo } from './components/Demo/SearchDemo';
23
20
  export { default as AddressDemo } from './components/Demo/AddressDemo';
24
21
  export { default as MapDemo } from './components/Demo/MapDemo';
25
22
  export { default as AddressAutocomplete } from './components/Woosmap/AddressAutocomplete';
26
- export { default as OfflineChatBot } from './components/OfflineChatBot/OfflineChatBot';
27
23
  export { default as CountrySelect } from './components/Select/CountrySelect';
28
- export { default as PricingSimulator} from './components/PricingSlider/PricingSimulator';
24
+ export { default as PricingSimulator } from './components/PricingSlider/PricingSimulator';
29
25
  export { default as CodeSnippet } from './components/CodeSnippet/CodeSnippet';
@@ -1,633 +0,0 @@
1
- import React, { Component } from 'react';
2
- import GoogleMapReact from 'google-map-react';
3
- import PropTypes from 'prop-types';
4
- import { motion, AnimatePresence } from 'framer-motion';
5
- import Demo from './SkeletonDemo';
6
- import Marker from '../Map/Marker';
7
- import Button from '../Button/Button';
8
- import { viewport, boundsFromViewport } from '../Map/drawOnMap';
9
- import Constants from '../../Constants';
10
- import { tr } from '../utils/locale';
11
- import IphoneTime from '../../images/iphone-time.png';
12
- import IphoneIcons from '../../images/iphone-right-icons.png';
13
- import IphoneBack from '../../images/iphone-back-button.png';
14
- import IphoneAvatar from '../../images/iphone-avatar.png';
15
- import McDo from '../../images/mcdo.png';
16
- import Carrefour from '../../images/carrefour.png';
17
- import Apple from '../../images/apple.png';
18
- import Zara from '../../images/zara.png';
19
- import Apollo from '../../images/apollo.png';
20
- import PizzaHut from '../../images/pizza-hut.png';
21
- import Restaurant from '../../images/restaurant_poi_icon.png';
22
- import TransactionChevron from '../../images/transaction-chevron.png';
23
-
24
- const transition = { ease: 'easeInOut', duration: 0.3 };
25
- const variants = (isPush, isPop) => ({
26
- enter() {
27
- return {
28
- x: 0,
29
- transition,
30
- transitionEnd: {
31
- // after animation has finished, reset the position to static
32
- position: 'static',
33
- },
34
- // keep top "layer" of animation as a fixed position
35
- ...(isPush
36
- ? {
37
- position: 'absolute',
38
- top: 0,
39
- right: 0,
40
- left: 0,
41
- bottom: 0,
42
- }
43
- : {}),
44
- };
45
- },
46
- initial() {
47
- return {
48
- x: isPush ? '100%' : '-25%',
49
- transition,
50
- // keep top "layer" of animation as a fixed position
51
- position: 'absolute',
52
- top: 0,
53
- right: 0,
54
- left: 0,
55
- bottom: 0,
56
- };
57
- },
58
-
59
- // an updated history.action is provided in AnimatedSwitch via "custom" prop for AnimatePresence
60
- exit() {
61
- return {
62
- x: isPop ? '100%' : '-10%',
63
- zIndex: isPop ? 1 : -1,
64
- transitionStart: {
65
- // after animation has finished, reset the position to static
66
- zIndex: -1,
67
- },
68
- transition,
69
-
70
- // keep top "layer" of animation as a fixed position
71
- // this will, however, reset the scroll position of the page being dismissed
72
- ...(isPop
73
- ? {
74
- position: 'absolute',
75
- top: 0,
76
- right: 0,
77
- left: 0,
78
- bottom: 0,
79
- }
80
- : {}),
81
- };
82
- },
83
- });
84
- const request = {
85
- merchants: [
86
- {
87
- dirty_name: 'MCDO UK 2231 EP',
88
- country: 'GB',
89
- merchant_id: '234482729011',
90
- },
91
- {
92
- dirty_name: 'Zara Fashion Retail, S.A.',
93
- country: 'IT',
94
- merchant_id: '*44532UY2T33219',
95
- },
96
- {
97
- dirty_name: 'APOLLO PHARMACY BANGALORE IN',
98
- country: 'IN',
99
- },
100
- {
101
- dirty_name: 'PIZZA HUT - SHOP 157',
102
- },
103
- {
104
- dirty_name: 'CARREFOUR CITY 3112846',
105
- country: 'FR',
106
- merchant_id: '9651781125',
107
- },
108
- {
109
- dirty_name: 'ITUNES.COM/BILL',
110
- country: 'IE',
111
- merchant_id: '2070070200925',
112
- },
113
- {
114
- dirty_name: 'Pepa SL Gracia',
115
- country: 'ES',
116
- merchant_id: '34J21189',
117
- },
118
- ],
119
- };
120
- const response = {
121
- merchants: [
122
- {
123
- dirty_name: 'MCDO UK 2231 EP',
124
- clean_name: "McDonald's",
125
- date: '12:42',
126
- price: '£10',
127
- status: 'OK',
128
- logo: '956bcb3591a8976ff94871a59b09eecc',
129
- logo_url: 'https://api.woosmap.com/merchants/logos/956bcb3591a8976ff94871a59b09eecc.png',
130
- internal_logo: McDo,
131
- country: 'GB',
132
- merchant_id: '234482729011',
133
- place_id: 'ChIJGS7Sga0cdkgR46nd-S661TM',
134
- },
135
- {
136
- dirty_name: 'Zara Fashion Retail, S.A.',
137
- clean_name: 'Zara',
138
- date: '11:24',
139
- price: '98€',
140
- status: 'OK',
141
- internal_logo: Zara,
142
- logo: '72fc39033e0d9e923a0236cb874c9309',
143
- logo_url: 'https://api.woosmap.com/merchants/logos/72fc39033e0d9e923a0236cb874c9309.png',
144
- country: 'IT',
145
- merchant_id: '*44532UY2T33219',
146
- place_id: 'ChIJF2vQecLGhkcR83Zbpwpej3I',
147
- },
148
- {
149
- dirty_name: 'APOLLO PHARMACY BANGALORE IN',
150
- clean_name: 'Apollo Pharmacy',
151
- date: '11:07',
152
- price: '₹48',
153
- status: 'OK',
154
- internal_logo: Apollo,
155
- logo: 'c776d3336e0d8c2b9e893e9e92b2caf7',
156
- logo_url: 'https://api.woosmap.com/merchants/logos/c776d3336e0d8c2b9e893e9e92b2caf7.png',
157
- country: 'IN',
158
- },
159
- {
160
- dirty_name: 'PIZZA HUT - SHOP 157',
161
- clean_name: 'Pizza Hut',
162
- date: '10:36',
163
- price: '$12',
164
- status: 'OK',
165
- internal_logo: PizzaHut,
166
- logo: 'd5463410f32a5f497459ac79552d3ce3',
167
- logo_url: 'https://api.woosmap.com/merchants/logos/d5463410f32a5f497459ac79552d3ce3.png',
168
- country: '',
169
- },
170
- {
171
- dirty_name: 'CARREFOUR CITY 3112846',
172
- clean_name: 'Carrefour City',
173
- date: '10:07',
174
- price: '77€',
175
- status: 'OK',
176
- internal_logo: Carrefour,
177
- logo: '08ee8a3cecbcd3b7d9103bcf0e04db7e',
178
- logo_url: 'https://api.woosmap.com/merchants/logos/08ee8a3cecbcd3b7d9103bcf0e04db7e.png',
179
- country: 'FR',
180
- merchant_id: '9651781125',
181
- place_id: 'ChIJJ7ZEZDUnVQ0Ru5gudUqdvKM',
182
- },
183
- {
184
- dirty_name: 'ITUNES.COM/BILL',
185
- clean_name: 'Apple',
186
- status: 'OK',
187
- date: '09:14',
188
- price: '2€99',
189
- internal_logo: Apple,
190
- logo: '5eb75a5239b76287f44021f8e6e1bd41',
191
- logo_url: 'https://api.woosmap.com/merchants/logos/5eb75a5239b76287f44021f8e6e1bd41.png',
192
- country: 'IE',
193
- merchant_id: '2070070200925',
194
- place_id: '',
195
- },
196
- {
197
- status: 'OK',
198
- clean_name: '',
199
- logo: '',
200
- logo_url: '',
201
- price: '60€',
202
- country: 'ES',
203
- internal_logo: Restaurant,
204
- dirty_name: 'Pepa SL Gracia',
205
- merchant_id: '34J21189',
206
- place_id: 'ChIJZ9fQvb2ipBIRyaZy8wUqRGQ',
207
- },
208
- ],
209
- };
210
-
211
- export default class MerchantDemo extends Component {
212
- constructor(props) {
213
- super(props);
214
- this.state = {
215
- transaction: null,
216
- place: {},
217
- };
218
- this.map = null;
219
- this.marker = null;
220
- this.viewport = null;
221
- }
222
-
223
- getRequestUrl = () => {
224
- const { transaction } = this.state;
225
- if (transaction) {
226
- return 'https://api.woosmap.com/merchants/place';
227
- }
228
- return 'https://api.woosmap.com/merchants/brand';
229
- };
230
-
231
- getRequestBody = () => {
232
- const { transaction } = this.state;
233
- if (!transaction) {
234
- return JSON.stringify(
235
- {
236
- merchants: request.merchants.map((item) => ({
237
- dirty_name: item.dirty_name,
238
- country: item.country,
239
- })),
240
- },
241
- null,
242
- 2,
243
- );
244
- }
245
- return JSON.stringify(
246
- {
247
- merchants: [request.merchants.find((item) => item.dirty_name === transaction.dirty_name)],
248
- },
249
- null,
250
- 2,
251
- );
252
- };
253
-
254
- selectTransaction = (transaction) => {
255
- this.setState({ transaction, place: {} });
256
- };
257
-
258
- // eslint-disable-next-line class-methods-use-this
259
- getRequestparams = () => ({
260
- private_key: '{your private key}',
261
- });
262
-
263
- getResponse = () => {
264
- const { transaction } = this.state;
265
- if (!transaction) {
266
- return {
267
- merchants: response.merchants.map((merchant) => ({
268
- dirty_name: merchant.dirty_name,
269
- clean_name: merchant.clean_name,
270
- status: 'OK',
271
- logo: merchant.logo,
272
- logo_url: merchant.logo_url,
273
- country: merchant.country,
274
- merchant_id: merchant.merchant_id,
275
- })),
276
- };
277
- }
278
- const merchant = {
279
- ...response.merchants.find((item) => item.dirty_name === transaction.dirty_name),
280
- };
281
- delete merchant.internal_logo;
282
- delete merchant.date;
283
- delete merchant.price;
284
- return {
285
- merchants: [merchant],
286
- };
287
- };
288
-
289
- getDetailsOfTransaction = () => {
290
- const { transaction } = this.state;
291
- if (!google.maps.places) {
292
- return;
293
- }
294
- const placesProvider = new google.maps.places.PlacesService(document.createElement('div'));
295
- placesProvider.getDetails(
296
- {
297
- placeId: transaction.place_id,
298
- fields: [
299
- 'address_component',
300
- 'adr_address',
301
- 'formatted_address',
302
- 'geometry',
303
- 'icon',
304
- 'name',
305
- 'place_id',
306
- 'type',
307
- 'url',
308
- 'vicinity',
309
- ],
310
- },
311
- (item) => {
312
- this.setState({ place: item });
313
- },
314
- );
315
- };
316
-
317
- displayOnMap = () => {
318
- const { geolocation } = this.state;
319
- if (this.viewport) {
320
- this.viewport.setMap(null);
321
- }
322
- if (this.map && geolocation) {
323
- this.map.fitBounds(boundsFromViewport(geolocation.viewport), 20);
324
- this.viewport = viewport(this.map, geolocation.viewport);
325
- }
326
- };
327
-
328
- renderDirtyList = () => (
329
- <motion.article
330
- className="merchant__mobile merchant__mobile--dirty"
331
- key="dirtylist"
332
- initial="initial"
333
- animate="enter"
334
- exit="exit"
335
- style={{ zIndex: '-1' }}
336
- variants={variants(false, false)}
337
- >
338
- <header className="merchant__mobile__header">
339
- <div className="merchant__mobile__header__icons">
340
- <span>
341
- <img src={IphoneTime} alt="mobile time" />
342
- </span>
343
- <span>
344
- <img src={IphoneIcons} alt="mobile icons" />
345
- </span>
346
- </div>
347
- <div className="merchant__mobile__header__nav">
348
- <span>
349
- <img src={IphoneBack} className="merchant__mobile__header__nav__back" alt="Back button" />
350
- </span>
351
- <span>My account</span>
352
- <span>
353
- <img src={IphoneAvatar} className="merchant__mobile__header__nav__avatar" alt="User avatar" />
354
- </span>
355
- </div>
356
- </header>
357
- <section className="merchant__mobile__section">
358
- <div className="merchant__mobile__section__date">20 April</div>
359
- <ul>
360
- {response.merchants.map((item) => (
361
- <li key={item.dirty_name}>
362
- <button
363
- className="merchant__mobile__section__transaction"
364
- type="button"
365
- onClick={() => this.selectTransaction(item)}
366
- >
367
- <div className="merchant__mobile__section__transaction__info">
368
- <div className="merchant__mobile__section__transaction__info__name">
369
- {item.dirty_name}
370
- </div>
371
- <div className="merchant__mobile__section__transaction__info__date">
372
- {item.date}
373
- </div>
374
- </div>
375
- <div className="merchant__mobile__section__transaction__price">{item.price}</div>
376
- <div className="merchant__mobile__section__transaction__link">
377
- <img src={TransactionChevron} alt="See transaction" />
378
- </div>
379
- </button>
380
- </li>
381
- ))}
382
- </ul>
383
- </section>
384
- </motion.article>
385
- );
386
-
387
- renderDirtyTransaction = () => {
388
- const { transaction } = this.state;
389
- return (
390
- <motion.article
391
- key="dirtytransaction"
392
- className="merchant__mobile merchant__mobile--details--dirty"
393
- initial="initial"
394
- animate="enter"
395
- exit="exit"
396
- style={{ zIndex: '1' }}
397
- variants={variants(true, true)}
398
- >
399
- <header className="merchant__mobile__header">
400
- <div className="merchant__mobile__header__icons">
401
- <span>
402
- <img src={IphoneTime} alt="mobile time" />
403
- </span>
404
- <span>
405
- <img src={IphoneIcons} alt="mobile icons" />
406
- </span>
407
- </div>
408
- <div className="merchant__mobile__header__nav">
409
- <Button
410
- className="merchant__mobile__header__nav__button"
411
- onClick={() => this.setState({ transaction: null })}
412
- >
413
- <img src={IphoneBack} className="merchant__mobile__header__nav__back" alt="Back button" />
414
- </Button>
415
- <span className="merchant__mobile__header__nav__title">&nbsp;</span>
416
- </div>
417
- </header>
418
- <section className="merchant__mobile__section">
419
- <div className="merchant__mobile__section__date">20 April - {transaction.date}</div>
420
- <div className="merchant__mobile__section__transaction__info__name">{transaction.dirty_name}</div>
421
- <div className="merchant__mobile__section__transaction__price">{transaction.price}</div>
422
- </section>
423
- </motion.article>
424
- );
425
- };
426
-
427
- renderCleanList = () => (
428
- <motion.article
429
- className="merchant__mobile merchant__mobile--clean"
430
- key="cleanlist"
431
- initial="initial"
432
- animate="enter"
433
- exit="exit"
434
- style={{ zIndex: '-1' }}
435
- variants={variants(false, false)}
436
- >
437
- <header className="merchant__mobile__header">
438
- <div className="merchant__mobile__header__icons">
439
- <span>
440
- <img src={IphoneTime} alt="mobile time" />
441
- </span>
442
- <span>
443
- <img src={IphoneIcons} alt="mobile icons" />
444
- </span>
445
- </div>
446
- <div className="merchant__mobile__header__nav">
447
- <span>
448
- <img src={IphoneBack} className="merchant__mobile__header__nav__back" alt="Back button" />
449
- </span>
450
- <span>My account</span>
451
- <span>
452
- <img src={IphoneAvatar} className="merchant__mobile__header__nav__avatar" alt="User avatar" />
453
- </span>
454
- </div>
455
- </header>
456
- <section className="merchant__mobile__section">
457
- <div className="merchant__mobile__section__date">20 April</div>
458
- <ul>
459
- {response.merchants.map((item) => (
460
- <li key={item.dirty_name}>
461
- <button
462
- className="merchant__mobile__section__transaction"
463
- type="button"
464
- onClick={() => this.selectTransaction(item)}
465
- >
466
- <div className="merchant__mobile__section__transaction__info">
467
- <div className="merchant__mobile__section__transaction__info__logo">
468
- <img src={item.internal_logo} alt={item.clean_name || item.dirty_name} />
469
- </div>
470
- <div className="fullw">
471
- <div className="merchant__mobile__section__transaction__info__name">
472
- {item.clean_name || item.dirty_name}
473
- </div>
474
- <div className="merchant__mobile__section__transaction__info__date">
475
- {item.date}
476
- </div>
477
- </div>
478
- </div>
479
- <div className="merchant__mobile__section__transaction__price">{item.price}</div>
480
- <div className="merchant__mobile__section__transaction__link">
481
- <img src={TransactionChevron} alt="See transaction" />
482
- </div>
483
- </button>
484
- </li>
485
- ))}
486
- </ul>
487
- </section>
488
- </motion.article>
489
- );
490
-
491
- renderCleanTransaction = () => {
492
- const { transaction, place } = this.state;
493
- return (
494
- <motion.article
495
- key="cleantransaction"
496
- className="merchant__mobile merchant__mobile--details"
497
- initial="initial"
498
- animate="enter"
499
- exit="exit"
500
- style={{ zIndex: '1' }}
501
- variants={variants(true, true)}
502
- >
503
- <header className="merchant__mobile__header">
504
- <div className="merchant__mobile__header__icons">
505
- <span>
506
- <img src={IphoneTime} alt="mobile time" />
507
- </span>
508
- <span>
509
- <img src={IphoneIcons} alt="mobile icons" />
510
- </span>
511
- </div>
512
- <div className="merchant__mobile__header__nav">
513
- <Button
514
- className="merchant__mobile__header__nav__button"
515
- onClick={() => this.setState({ transaction: null })}
516
- >
517
- <img src={IphoneBack} className="merchant__mobile__header__nav__back" alt="Back button" />
518
- </Button>
519
- <span className="merchant__mobile__header__nav__title">
520
- {transaction.clean_name || transaction.dirty_name}
521
- </span>
522
- </div>
523
- </header>
524
- <section className="merchant__mobile__section">
525
- {transaction.place_id ? this.renderMap() : <div className="merchant__mobile__section__no-map" />}
526
- <div className="merchant__mobile__section__transaction__info">
527
- <div className="merchant__mobile__section__transaction__info__logo">
528
- <img
529
- src={transaction.internal_logo}
530
- alt={transaction.clean_name || transaction.dirty_name}
531
- />
532
- </div>
533
- <div className="merchant__mobile__section__transaction__info__name">
534
- {transaction.clean_name || transaction.dirty_name}
535
- </div>
536
- <div className="merchant__mobile__section__date">20 April - {transaction.date}</div>
537
- <div className="merchant__mobile__section__transaction__price">{transaction.price}</div>
538
- <div className="merchant__mobile__section__transaction__info__address">
539
- {place.formatted_address}
540
- </div>
541
- </div>
542
- </section>
543
- </motion.article>
544
- );
545
- };
546
-
547
- renderMap = () => {
548
- const { place } = this.state;
549
- const marker = place.geometry ? (
550
- <Marker lat={place.geometry.location.lat()} lng={place.geometry.location.lng()} />
551
- ) : null;
552
- return (
553
- <div className="merchant__mobile__section__map">
554
- <GoogleMapReact
555
- defaultZoom={10}
556
- options={{ disableDefaultUI: true }}
557
- center={
558
- place.geometry?.location
559
- ? [place.geometry.location.lat(), place.geometry.location.lng()]
560
- : [0, 0]
561
- }
562
- bootstrapURLKeys={{
563
- key: Constants.gmapKey,
564
- libraries: ['geometry', 'places'],
565
- }}
566
- yesIWantToUseGoogleMapApiInternals
567
- onGoogleApiLoaded={({ map }) => {
568
- this.map = map;
569
- this.getDetailsOfTransaction();
570
- }}
571
- >
572
- {marker}
573
- </GoogleMapReact>
574
- </div>
575
- );
576
- };
577
-
578
- renderResult = () => {
579
- const { transaction } = this.state;
580
- return (
581
- <div className="merchant__wrapper">
582
- <div className="merchant__mobilewrapper">
583
- <div className="merchant__mobilecontainer__title">Transactions</div>
584
- <div className="merchant__mobilecontainer" style={{ zIndex: 2 }}>
585
- <AnimatePresence exitBeforeEnter={false} initial={false}>
586
- {transaction ? this.renderDirtyTransaction() : this.renderDirtyList()}
587
- </AnimatePresence>
588
- </div>
589
- </div>
590
- <div className="merchant__mobilewrapper">
591
- <div className="merchant__mobilecontainer__title">Cleaned transactions</div>
592
- <div className="merchant__mobilecontainer" style={{ zIndex: 2 }}>
593
- <AnimatePresence exitBeforeEnter={false} initial={false}>
594
- {transaction ? this.renderCleanTransaction() : this.renderCleanList()}
595
- </AnimatePresence>
596
- </div>
597
- </div>
598
- </div>
599
- );
600
- };
601
-
602
- render() {
603
- const { noheader } = this.props;
604
- const headerLabels = {
605
- title: tr('Merchant API'),
606
- desc: tr(
607
- 'An API that helps your customers better understand their payments and where they took place. Send unclear merchant names to the API to convert them into clean names to improve the UX of your transactions list and add enriched data for Europe, North America and Asia: easy-to-recognize merchant names, brand logos, Google Place id of the location.',
608
- ),
609
- };
610
- return (
611
- <Demo
612
- noheader={noheader}
613
- className="demo--merchant"
614
- id="merchant-demo"
615
- docLink="https://developers.woosmap.com/products/merchant-api/get-started/"
616
- header={headerLabels}
617
- request={this.getRequestUrl()}
618
- params={this.getRequestparams()}
619
- body={this.getRequestBody()}
620
- method="POST"
621
- response={this.getResponse()}
622
- mainContent={this.renderResult()}
623
- />
624
- );
625
- }
626
- }
627
-
628
- MerchantDemo.defaultProps = {
629
- noheader: false,
630
- };
631
- MerchantDemo.propTypes = {
632
- noheader: PropTypes.bool,
633
- };
@@ -1,26 +0,0 @@
1
- import React from 'react';
2
- import MerchantDemo from './MerchantDemo';
3
- import { changeLanguage } from '../utils/locale';
4
-
5
- const Story = {
6
- title: 'demo/Merchant',
7
- component: MerchantDemo,
8
- };
9
-
10
- export default Story;
11
-
12
- function Template() {
13
- return <MerchantDemo />;
14
- }
15
- export const Merchant = Template.bind({});
16
-
17
- function TemplateNoHeader() {
18
- return <MerchantDemo noheader />;
19
- }
20
- export const MerchantNoHeader = TemplateNoHeader.bind({});
21
-
22
- function TemplateNoHeaderFr() {
23
- changeLanguage('fr');
24
- return <MerchantDemo noheader />;
25
- }
26
- export const MerchantNoHeaderFr = TemplateNoHeaderFr.bind({});
@@ -1,223 +0,0 @@
1
- .merchant
2
- &__wrapper
3
- trans()
4
- display flex
5
- justify-content center
6
- align-items center
7
- height 100%
8
- width 100%
9
- zoom .9
10
- padding 2rem
11
- background #31436C
12
- background radial-gradient(circle, #31436C 0%, #262D3E 100%)
13
- &__mobilewrapper
14
- trans()
15
- position relative
16
- margin 3rem
17
- &__mobilecontainer
18
- position relative
19
- height 51.9rem
20
- width 28rem
21
- margin auto
22
- box-shadow 0 0 .4rem .1rem rgba($secondary, .1)
23
- br(1)
24
- &__title
25
- text-align center
26
- font-size 1.2rem
27
- font-weight 700
28
- margin 0 0 1rem 0
29
- color $light
30
- &__mobile
31
- br(1)
32
- font-size 1.3rem
33
- width 100%
34
- background-color $light
35
- overflow hidden
36
- &--dirty
37
- &--details--dirty
38
- .merchant__mobile__header
39
- background #666767
40
- &--clean
41
- &--details
42
- .merchant__mobile__header
43
- background #4F70FF
44
- &--details
45
- position relative
46
- &__header
47
- padding 1.1rem
48
- color #fff
49
- text-transform uppercase
50
- font-weight 600
51
- &__nav
52
- &__icons
53
- flexSpread()
54
- &__icons
55
- img
56
- max-height .8rem
57
- &__nav
58
- font-weight 700
59
- margin-top 1.4rem
60
- position relative
61
- .merchant__mobile--details &
62
- .merchant__mobile--details--dirty &
63
- flexAxis()
64
- &__avatar
65
- max-width 2.4rem
66
- &__back
67
- max-width 1rem
68
- opacity 0
69
- .merchant__mobile--details &
70
- .merchant__mobile--details--dirty &
71
- opacity 1
72
- &__button
73
- position absolute
74
- background-color transparent !important
75
- left -.6rem
76
- padding 0
77
- display flex
78
- align-items center
79
- justify-content center
80
- flex-shrink 0
81
- &:hover
82
- background-color $dark30 !important
83
-
84
- &__section
85
- padding 1.4rem 2rem
86
- background-color #f5f5f5
87
- border-radius 0 0 1rem 1rem
88
- height 45rem
89
- .merchant__mobile--clean &
90
- background-color #f3f7ff
91
- .merchant__mobile--details &
92
- background-color $light
93
- padding 0
94
- .merchant__mobile--details--dirty &
95
- background-color $light
96
- padding 2rem
97
- &__map
98
- overflow hidden
99
- height 20rem
100
- &__no-map
101
- height 6rem
102
- &__date
103
- color #b7b7b7
104
- margin-bottom .6rem
105
- .merchant__mobile--clean &
106
- color #8697b1
107
- .merchant__mobile--details &
108
- .merchant__mobile--details--dirty &
109
- text-align center
110
- margin .4rem 0 0 0
111
- .merchant__mobile--details--dirty &
112
- margin 0 0 2rem 0
113
- &__transaction
114
- flexSpread()
115
- br(.6)
116
- trans()
117
- background-color $light
118
- font-size 1.3rem
119
- cursor pointer
120
- height 4.8rem
121
- padding 0 .8rem
122
- box-shadow 0 0 .3rem .1rem $dark10
123
- width 100%
124
- margin-bottom .8rem
125
- &:hover
126
- background-color #666767
127
- transform translateX(.5rem)
128
- .merchant__mobile--clean &
129
- background-color #4F70FF
130
- .merchant__mobile__section__transaction
131
- &__link
132
- color $light
133
- &__info
134
- &__name
135
- color $light
136
- &__date
137
- color $light50
138
- &__price
139
- color $light
140
- &__link
141
- color #999
142
- margin 0 .6rem 0 1.4rem
143
- img
144
- max-width .7rem
145
- &__info
146
- width 100%
147
- min-width 0
148
- margin-right 1.2rem
149
- .merchant__mobile--clean &
150
- flexMiddle()
151
- .merchant__mobile--details &
152
- margin 0
153
- &__address
154
- padding 1rem 2rem
155
- color#999
156
- text-align center
157
- &__logo
158
- sq(3)
159
- br(50)
160
- position relative
161
- margin-right 1.2rem
162
- flex-shrink 0
163
- .merchant__mobile--details &
164
- width 100%
165
- height 5rem
166
- img
167
- ellipsis()
168
- br(50)
169
- sq(3)
170
- background #fff
171
- border .1rem solid #f1f1f1
172
- box-shadow 0 0 .6rem $dark10
173
-
174
- .merchant__mobile--details &
175
- sq(8)
176
- position absolute
177
- left calc(50% - 4rem)
178
- top -4rem
179
- box-shadow 0 0 1rem $dark25
180
- border .3rem solid #fff
181
- &__name
182
- ellipsis()
183
- font-weight 500
184
- line-height 1.6rem
185
- margin-bottom .3rem
186
- .merchant__mobile--details &
187
- .merchant__mobile--details--dirty &
188
- text-align center
189
- font-size 2rem
190
- &__date
191
- color #a1a1a1
192
- font-size 1.2rem
193
- line-height 1.4rem
194
- &__price
195
- font-weight 700
196
- font-size 1.5rem
197
- .merchant__mobile--details &
198
- .merchant__mobile--details--dirty &
199
- margin-top 1rem
200
- font-size 5rem
201
- line-height 1
202
- text-align center
203
- font-weight 400
204
- .merchant__mobile--details--dirty &
205
- font-size 3.5rem
206
-
207
- @media screen and (max-width 760px)
208
- .merchant
209
- &__mobilewrapper
210
- margin 0 1rem
211
- @media screen and (max-width 660px)
212
- .merchant
213
- &__wrapper
214
- zoom .7
215
- @media screen and (max-width 469px)
216
- .merchant
217
- &__wrapper
218
- zoom .6
219
- @media screen and (max-width 400px)
220
- .merchant
221
- &__wrapper
222
- zoom .45
223
-