Skip to content

Commit eb17e3c

Browse files
authored
Merge pull request #23 from DealerDotCom/feature/updateLink_ext
Feature/update link ext
2 parents e7de948 + d5765c6 commit eb17e3c

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

Diff for: CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
9+
### Added
10+
11+
- re-added doc for `updateLink` method for internal users due to github action failure
912

1013
## [v2021-08-10T23.15.33] - 2021-08-10
1114

Diff for: source/includes/_methods.md

+27
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,33 @@ Field Name | Purpose | Field Format
292292
`callback(elem, meta)` | The DOM element where the markup should be inserted, and the payload object for the current insertion point. | Element, Object
293293

294294

295+
## API.updateLink(intent, setupFunction(meta))
296+
The `updateLink` method is used to override links on the page where the integration is enabled.
297+
298+
Field Name | Purpose | Field Format
299+
-------------- | -------------- | --------------
300+
`intent` | The functionality of the overriding links. | String
301+
`setupFunction(meta)` | The payload object for the current page. | Object
302+
303+
Currently, we support `x-time` and `schedule-service` link intents.
304+
305+
And, we only support limited attributes of the link to be modified in order to preserve the look and feel of the link.
306+
The attributes that can be modified are `href`, `target`, `onclick`, `popover` and `attributes (data-*)`.
307+
308+
> Usage:
309+
310+
```javascript
311+
(async APILoader => {
312+
const API = await APILoader.create(document.currentScript);
313+
API.updateLink('x-time', meta => {
314+
return {
315+
href: 'https://www.yourdomain.com/?account=' + meta.accountId,
316+
target: '_blank',
317+
}
318+
});
319+
})(window.DDC.APILoader);
320+
```
321+
295322
## API.create(type, options)
296323

297324
> Create a Button

0 commit comments

Comments
 (0)