Skip to content

Commit 28dadda

Browse files
committed
Fix sorting to by alphabetical
1 parent ce377a0 commit 28dadda

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

source/includes/_utilities.md

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,48 @@ This fetches an object containing the array of VINs on the current page and a co
126126

127127
This fetches the <a href="#page-event">Page Event object</a> for the current website and page.
128128

129+
## API.utils.getUnlockedVehicles()
130+
The utility method `getUnlockedVehicles` returns an array of vehicle UUIDs where the vehicle's pricing has already been unlocked.
131+
132+
This can be useful when paired with the `unlockPricing` method. When `vehicle-data-updated-v1` triggers, a list of currently displayed vehicles is provided. You could gather the list of vehicles, skip the ones which are already unlocked, and then call your service for a smaller subset of vehicles which may need to be unlocked.
133+
134+
> Usage:
135+
136+
```javascript
137+
(async APILoader => {
138+
const API = await APILoader.create(document.currentScript);
139+
API.subscribe('vehicle-data-updated-v1', data => {
140+
const unlockedUuids = await API.utils.getUnlockedVehicles();
141+
});
142+
})(window.DDC.APILoader);
143+
```
144+
145+
> Another example:
146+
147+
```javascript
148+
(async APILoader => {
149+
const API = await APILoader.create(document.currentScript);
150+
API.subscribe('vehicle-data-updated-v1', data => {
151+
// Get the list of unlocked vehicles
152+
const unlockedUuids = await API.utils.getUnlockedVehicles();
153+
154+
// Get the list of all vehicles
155+
const uuids = API.utils.getAttributeForVehicles('uuid');
156+
157+
// Filter the unlocked UUIDs from the UUIDs.
158+
const finalUuids = uuids.filter((el) => !unlockedUuids.includes(el));
159+
160+
// Call your service with the list of finalUuids here, to reduce network overhead.
161+
// Note: `callToYourService` is just an example here and not an implemented function in the API.
162+
const uuidsToUnlock = await callToYourService(finalUuids);
163+
164+
// Unlock vehicles which are not already unlocked, and your service indicates should be unlocked.
165+
API.utils.unlockPricing(uuidsToUnlock);
166+
167+
});
168+
})(window.DDC.APILoader);
169+
```
170+
129171
## API.utils.getUrlParams()
130172

131173
> Usage:
@@ -169,48 +211,6 @@ Will return the following object:
169211
})(window.DDC.APILoader);
170212
```
171213

172-
## API.utils.getUnlockedVehicles()
173-
The utility method `getUnlockedVehicles` returns an array of vehicle UUIDs where the vehicle's pricing has already been unlocked.
174-
175-
This can be useful when paired with the `unlockPricing` method. When `vehicle-data-updated-v1` triggers, a list of currently displayed vehicles is provided. You could gather the list of vehicles, skip the ones which are already unlocked, and then call your service for a smaller subset of vehicles which may need to be unlocked.
176-
177-
> Usage:
178-
179-
```javascript
180-
(async APILoader => {
181-
const API = await APILoader.create(document.currentScript);
182-
API.subscribe('vehicle-data-updated-v1', data => {
183-
const unlockedUuids = await API.utils.getUnlockedVehicles();
184-
});
185-
})(window.DDC.APILoader);
186-
```
187-
188-
> Another example:
189-
190-
```javascript
191-
(async APILoader => {
192-
const API = await APILoader.create(document.currentScript);
193-
API.subscribe('vehicle-data-updated-v1', data => {
194-
// Get the list of unlocked vehicles
195-
const unlockedUuids = await API.utils.getUnlockedVehicles();
196-
197-
// Get the list of all vehicles
198-
const uuids = API.utils.getAttributeForVehicles('uuid');
199-
200-
// Filter the unlocked UUIDs from the UUIDs.
201-
const finalUuids = uuids.filter((el) => !unlockedUuids.includes(el));
202-
203-
// Call your service with the list of finalUuids here, to reduce network overhead.
204-
// Note: `callToYourService` is just an example here and not an implemented function in the API.
205-
const uuidsToUnlock = await callToYourService(finalUuids);
206-
207-
// Unlock vehicles which are not already unlocked, and your service indicates should be unlocked.
208-
API.utils.unlockPricing(uuidsToUnlock);
209-
210-
});
211-
})(window.DDC.APILoader);
212-
```
213-
214214
## API.utils.unlockPricing(uuids)
215215
The utility method `unlockPricing` is used to unlock special pricing for specific vehicles on a page.
216216

0 commit comments

Comments
 (0)