| 1 |
import { Interaction } from "@web/public/interaction"; |
| 2 |
import { registry } from "@web/core/registry"; |
| 3 |
|
| 4 |
import { browser } from "@web/core/browser/browser"; |
| 5 |
|
| 6 |
export class GiftCardCopy extends Interaction { |
| 7 |
static selector = ".o_purchased_gift_card .copy-to-clipboard"; |
| 8 |
dynamicContent = { |
| 9 |
_root: { "t-on-click": this.onClick }, |
| 10 |
}; |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
onClick(ev) { |
| 16 |
const textValue = ev.target.dataset.clipboardText; |
| 17 |
browser.navigator.clipboard.writeText(textValue); |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
registry |
| 22 |
.category("public.interactions") |
| 23 |
.add("website_sale_loyalty.gift_card_copy", GiftCardCopy); |