@popsure/dirty-swan 0.54.13 → 0.54.14

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.
@@ -1,4 +1,4 @@
1
- import { Address } from '@popsure/public-models';
1
+ import { Address, Alpha2CountryCode } from '@popsure/public-models';
2
2
  export interface AutocompleteAddressProps {
3
3
  apiKey: string;
4
4
  address?: Partial<Address>;
@@ -32,6 +32,7 @@ export interface AutocompleteAddressProps {
32
32
  preText?: string;
33
33
  cta?: string;
34
34
  };
35
+ countryCode: Alpha2CountryCode;
35
36
  }
36
- declare const AutocompleteAddress: ({ apiKey, address: initialAddress, onAddressChange, placeholders, manualAddressEntryTexts, inputProps, }: AutocompleteAddressProps) => JSX.Element;
37
+ declare const AutocompleteAddress: ({ apiKey, address: initialAddress, onAddressChange, placeholders, manualAddressEntryTexts, inputProps, countryCode }: AutocompleteAddressProps) => JSX.Element;
37
38
  export { AutocompleteAddress };
@@ -1,7 +1,7 @@
1
1
  import { AutocompleteAddressProps } from '.';
2
2
  declare const story: {
3
3
  title: string;
4
- component: ({ apiKey, address: initialAddress, onAddressChange, placeholders, manualAddressEntryTexts, inputProps, }: AutocompleteAddressProps) => JSX.Element;
4
+ component: ({ apiKey, address: initialAddress, onAddressChange, placeholders, manualAddressEntryTexts, inputProps, countryCode }: AutocompleteAddressProps) => JSX.Element;
5
5
  argTypes: {
6
6
  address: {
7
7
  description: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popsure/dirty-swan",
3
- "version": "0.54.13",
3
+ "version": "0.54.14",
4
4
  "author": "Vincent Audoire <vincent@getpopsure.com>",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -81,6 +81,7 @@ export interface AutocompleteAddressProps {
81
81
  preText?: string;
82
82
  cta?: string;
83
83
  };
84
+ countryCode: Alpha2CountryCode;
84
85
  }
85
86
 
86
87
  const AutocompleteAddress = ({
@@ -90,6 +91,7 @@ const AutocompleteAddress = ({
90
91
  placeholders,
91
92
  manualAddressEntryTexts,
92
93
  inputProps,
94
+ countryCode = GERMANY_ALPHA_CODE
93
95
  }: AutocompleteAddressProps) => {
94
96
  const [manualAddressEntry, setManualAddressEntry] = useState(false);
95
97
  const [isLoading, setIsLoading] = useState(false);
@@ -131,7 +133,7 @@ const AutocompleteAddress = ({
131
133
 
132
134
  autocomplete.current = new google.maps.places.Autocomplete(reference, {
133
135
  types: ['address'],
134
- componentRestrictions: { country: GERMANY_ALPHA_CODE },
136
+ componentRestrictions: { country: countryCode },
135
137
  });
136
138
 
137
139
  autocomplete.current.addListener('place_changed', onPlaceChanged);
@@ -231,7 +233,7 @@ const AutocompleteAddress = ({
231
233
  const newAddress = {
232
234
  ...address,
233
235
  [e.target.name]: e.target.value,
234
- country: GERMANY_ALPHA_CODE,
236
+ country: countryCode,
235
237
  };
236
238
  setAddress(newAddress);
237
239
  onAddressChange(newAddress);