@liquidcommerce/elements-sdk 2.6.0-beta.124 → 2.6.0-beta.125
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/dist/index.checkout.esm.js +8724 -8692
- package/dist/index.esm.js +13716 -13681
- package/dist/types/core/api/api-client.service.d.ts +2 -2
- package/dist/types/core/client/actions/client-address-action.service.d.ts +1 -1
- package/dist/types/modules/address/address-input.component.d.ts +1 -0
- package/dist/types/modules/address/address.command.d.ts +2 -2
- package/dist/types/utils/places-session-token.d.ts +1 -0
- package/docs/v1/api/actions/address-actions.md +5 -1
- package/docs/v1/guides/address-component.md +6 -0
- package/package.json +1 -1
|
@@ -15,8 +15,8 @@ export declare class ApiClientService {
|
|
|
15
15
|
setPersistedStore(userDeviceId: string, data: IPersistedStore): Promise<ApiResult<IPersistedStoreAction>>;
|
|
16
16
|
getPersistedStore(userDeviceId: string): Promise<ApiResult<IPersistedStore>>;
|
|
17
17
|
deletePersistedStore(userDeviceId: string): Promise<ApiResult<IPersistedStoreAction>>;
|
|
18
|
-
getAddressSuggestions(input: string): Promise<ApiResult<IAddressAutocompleteResult[]>>;
|
|
19
|
-
getAddressDetails(id: string): Promise<ApiResult<IAddressDetailsResult>>;
|
|
18
|
+
getAddressSuggestions(input: string, sessionToken?: string): Promise<ApiResult<IAddressAutocompleteResult[]>>;
|
|
19
|
+
getAddressDetails(id: string, sessionToken?: string): Promise<ApiResult<IAddressDetailsResult>>;
|
|
20
20
|
getProductsData(identifier: string[], location?: ILocation): Promise<ApiResult<IProductAvailabilityResponse>>;
|
|
21
21
|
productListSearch(params: IProductSearchParams): Promise<ApiResult<IProductSearchResponse>>;
|
|
22
22
|
getProductAvailabilityByState(identifiers: string[], state?: string): Promise<ApiResult<IProductAvailabilityResponse>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IAddressAddress, IAddressCoordinates, IAddressData } from '@/interfaces/api/address.interface';
|
|
2
2
|
import { BaseActionService } from './base-action.service';
|
|
3
3
|
export interface IAddressActions {
|
|
4
|
-
setAddressByPlacesId: (placesId: string) => Promise<void>;
|
|
4
|
+
setAddressByPlacesId: (placesId: string, sessionToken?: string) => Promise<void>;
|
|
5
5
|
setAddressManually: (address: IAddressAddress, coordinates: IAddressCoordinates) => Promise<void>;
|
|
6
6
|
clear: () => Promise<void>;
|
|
7
7
|
getDetails: () => IAddressData | null;
|
|
@@ -12,6 +12,7 @@ export declare class AddressInputComponent extends BaseComponent<IAddressInputCo
|
|
|
12
12
|
private selectedAddress;
|
|
13
13
|
private searchTimeout?;
|
|
14
14
|
private minSearchLength;
|
|
15
|
+
private placesSessionToken;
|
|
15
16
|
private inputElement;
|
|
16
17
|
private suggestionsContainer;
|
|
17
18
|
private errorContainer;
|
|
@@ -5,8 +5,8 @@ export declare class AddressCommands extends BaseCommand {
|
|
|
5
5
|
private cartCommands;
|
|
6
6
|
constructor();
|
|
7
7
|
static getInstance(): AddressCommands;
|
|
8
|
-
searchAddresses(query: string): Promise<IAddressAutocompleteResult[]>;
|
|
9
|
-
getAddressDetails(addressId: string): Promise<IAddressDetailsResult | null>;
|
|
8
|
+
searchAddresses(query: string, sessionToken?: string): Promise<IAddressAutocompleteResult[]>;
|
|
9
|
+
getAddressDetails(addressId: string, sessionToken?: string): Promise<IAddressDetailsResult | null>;
|
|
10
10
|
setSelectedAddress(addressData: IAddressData): Promise<void>;
|
|
11
11
|
setAddressManually(address: IAddressAddress, coordinates: IAddressCoordinates): Promise<void>;
|
|
12
12
|
clearSelectedAddress(): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createPlacesSessionToken(): string;
|
|
@@ -9,7 +9,7 @@ Set address using a Google Places ID.
|
|
|
9
9
|
### Signature
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
setAddressByPlacesId(placesId: string): Promise<void>
|
|
12
|
+
setAddressByPlacesId(placesId: string, sessionToken?: string): Promise<void>
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
### Parameters
|
|
@@ -17,6 +17,7 @@ setAddressByPlacesId(placesId: string): Promise<void>
|
|
|
17
17
|
| Parameter | Type | Required | Description |
|
|
18
18
|
|-----------|------|----------|-------------|
|
|
19
19
|
| `placesId` | string | Yes | Google Places ID |
|
|
20
|
+
| `sessionToken` | string | No | Google Places session token of the autocomplete requests that returned `placesId`. The details request ends that session, so Google bills the autocomplete requests as one session instead of per request. Applies only when the autocomplete requests used an API key in the same Google Cloud project as LiquidCommerce's address service. |
|
|
20
21
|
|
|
21
22
|
### Example
|
|
22
23
|
|
|
@@ -24,6 +25,9 @@ setAddressByPlacesId(placesId: string): Promise<void>
|
|
|
24
25
|
await window.LiquidCommerce.elements.actions.address.setAddressByPlacesId(
|
|
25
26
|
'ChIJOwg_06VPwokRYv534QaPC8g'
|
|
26
27
|
);
|
|
28
|
+
|
|
29
|
+
// With the session token your own Places Autocomplete requests used
|
|
30
|
+
await window.LiquidCommerce.elements.actions.address.setAddressByPlacesId(placesId, sessionToken);
|
|
27
31
|
```
|
|
28
32
|
|
|
29
33
|
### How to Get Places ID
|
|
@@ -56,6 +56,12 @@ The recommended method - provides accurate geocoding:
|
|
|
56
56
|
await window.LiquidCommerce.elements.actions.address.setAddressByPlacesId('ChIJOwg_06VPwokRYv534QaPC8g');
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
+
If you run Google Places Autocomplete yourself with a [session token](https://developers.google.com/maps/documentation/places/web-service/session-tokens), pass the same token as the second argument. The details request then ends your session, and Google bills the autocomplete requests as one session instead of per request. Google only groups requests whose API keys belong to the same Google Cloud project, so this applies only when your autocomplete requests used the same project as LiquidCommerce's address service; a token from autocomplete requests made with an API key in another project doesn't change billing:
|
|
60
|
+
|
|
61
|
+
```javascript
|
|
62
|
+
await window.LiquidCommerce.elements.actions.address.setAddressByPlacesId(placesId, sessionToken);
|
|
63
|
+
```
|
|
64
|
+
|
|
59
65
|
**How to get a Places ID:**
|
|
60
66
|
|
|
61
67
|
Visit [Google Place IDs](https://developers.google.com/maps/documentation/places/web-service/place-id#find-id) for details on obtaining a Places ID.
|
package/package.json
CHANGED