@livelike/custom-kit 0.0.0-stage → 1.0.0
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/components/index.d.ts +1 -0
- package/dist/components/livelike-widget-sponsor/index.d.ts +1 -0
- package/dist/components/livelike-widget-sponsor/livelike-widget-sponsor.d.ts +1 -0
- package/dist/image-poll/image-poll-option/image-poll-option.d.ts +1 -0
- package/dist/image-poll/image-poll-option/index.d.ts +1 -0
- package/dist/image-poll/image-poll.d.ts +0 -0
- package/dist/image-poll/index.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/livelike.js +482 -0
- package/dist/livelike.umd.cjs +247 -0
- package/dist/loader.d.ts +1 -0
- package/dist/utils/gated.d.ts +2 -0
- package/dist/utils/inject-styles.d.ts +2 -0
- package/dist/utils/svgs.d.ts +5 -0
- package/dist/utils/vote-submit.d.ts +7 -0
- package/package.json +26 -4
- package/readme.md +118 -0
- package/README.md +0 -3
package/dist/loader.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function LiveLikeInit(options?: any): Promise<any>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livelike/custom-kit",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "dist/livelike.umd.cjs",
|
|
5
|
+
"module": "dist/livelike.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"type": "module",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "vite build",
|
|
13
|
+
"dev": "vite"
|
|
14
|
+
},
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"@livelike/engagementsdk": "^2.59.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"vite-plugin-dts": "^5.0.3",
|
|
20
|
+
"vite": "^7.2.4"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"lit": "^3.3.1"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
}
|
|
28
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Widget Elements
|
|
2
|
+
|
|
3
|
+
LiveLike custom widget elements (Web Components).
|
|
4
|
+
ships one widget: `<image-poll>`.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @livelike/custom-kit
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
`@livelike/engagementsdk` is a peer dependency and must be installed by the host
|
|
13
|
+
app.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
The widget fetches its data when it's added to the page, so **initialize the
|
|
18
|
+
SDK first, then render the widget.**
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
import * as LiveLike from "@livelike/custom-kit";
|
|
22
|
+
|
|
23
|
+
await LiveLike.LiveLikeInit({
|
|
24
|
+
clientId: "**************",
|
|
25
|
+
accessToken: "**************", // optional; omit for an anonymous viewer
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const poll = document.createElement("image-poll");
|
|
29
|
+
poll.setAttribute("widgetid", "**************");
|
|
30
|
+
document.body.appendChild(poll);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
- Importing the package registers `<image-poll>` and exposes `LiveLikeInit`.
|
|
34
|
+
- Styles and fonts are injected automatically on import; there is no separate
|
|
35
|
+
CSS import.
|
|
36
|
+
- ⚠️ The widget must not be in the DOM before `LiveLikeInit()` resolves.
|
|
37
|
+
|
|
38
|
+
## Image Poll
|
|
39
|
+
|
|
40
|
+
```html
|
|
41
|
+
<image-poll widgetid="***************"></image-poll>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`widgetid` is the only HTML attribute. Everything else is set on the widget in
|
|
45
|
+
LiveLike:
|
|
46
|
+
|
|
47
|
+
- **Header title:** the widget's question.
|
|
48
|
+
- **Hero image:** the widget's sponsor logo.
|
|
49
|
+
- **Option name and photo:** each option's description and image.
|
|
50
|
+
- **Voting close time:** the widget's `interactive_until`.
|
|
51
|
+
- **Everything else:** [widget attributes](#widget-attributes).
|
|
52
|
+
|
|
53
|
+
### States
|
|
54
|
+
|
|
55
|
+
1. **Before voting opens:** the banner reads "Voting opens soon" and options
|
|
56
|
+
can't be picked.
|
|
57
|
+
2. **Voting open:** the banner counts down ("Voting closes in 2 Hrs 13 Mins").
|
|
58
|
+
The viewer picks an option and presses **Choose player**.
|
|
59
|
+
3. **Vote submitted:** a "Voting submitted!" popup appears.
|
|
60
|
+
- **×** closes it, and the button reads "Vote successful".
|
|
61
|
+
- **Vote again** reopens the options. Submitting again changes the existing
|
|
62
|
+
vote rather than adding a second one.
|
|
63
|
+
- **Watch highlights** opens `highlights_url` in a new tab.
|
|
64
|
+
4. **Voting closed:** the banner reads "Voting closed", the hero is replaced by
|
|
65
|
+
a "Voting closed: the whistle has blown!" banner, options are dimmed, and
|
|
66
|
+
there's no button.
|
|
67
|
+
|
|
68
|
+
In any state:
|
|
69
|
+
|
|
70
|
+
- Percentages appear on every option once `polling_result_time` passes.
|
|
71
|
+
- The **ⓘ** icon in the header opens an info popup with `info_title` and
|
|
72
|
+
`info_text`. It closes with **×** or by clicking outside it.
|
|
73
|
+
|
|
74
|
+
## Widget attributes
|
|
75
|
+
|
|
76
|
+
Widget attributes are `{ key, value }` pairs set on the widget in LiveLike
|
|
77
|
+
(`widget_attributes` in the payload). All are optional.
|
|
78
|
+
|
|
79
|
+
- **Keys are case-sensitive and not validated.** A typo is silently ignored and
|
|
80
|
+
the default applies.
|
|
81
|
+
- **Times are ISO 8601 UTC strings**, e.g. `2026-10-13T10:17:00Z`. An
|
|
82
|
+
unparseable value is treated as missing.
|
|
83
|
+
|
|
84
|
+
| Key | Value | What it does | If missing |
|
|
85
|
+
| --- | --- | --- | --- |
|
|
86
|
+
| `club_option_{n}` | Text | Club name under option `n`. **1-based:** `club_option_1` is the first option. | No club name |
|
|
87
|
+
| `description` | Text | Supporting line under the hero image. | Nothing shown. |
|
|
88
|
+
| `polling_starts_time` | ISO date-time | When voting opens. | Voting is open immediately. |
|
|
89
|
+
| `polling_result_time` | ISO date-time | When vote percentages appear. Independent of the open/close times. | Percentages are never shown. |
|
|
90
|
+
| `highlights_url` | URL | "Watch highlights" link in the "Voting submitted!" popup. | Link is hidden. |
|
|
91
|
+
| `info_title` | Text | Title of the info popup. | "How it works" |
|
|
92
|
+
| `info_text` | Text | Body of the info popup. | Default voting instructions. |
|
|
93
|
+
|
|
94
|
+
A widget left open on screen updates itself at each of these times, so viewers
|
|
95
|
+
don't need to reload. When percentages are revealed, it fetches fresh vote
|
|
96
|
+
counts.
|
|
97
|
+
|
|
98
|
+
### Example
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
"widget_attributes": [
|
|
102
|
+
{ "key": "club_option_1", "value": "Inter Miami CF" },
|
|
103
|
+
{ "key": "club_option_2", "value": "LA Galaxy" },
|
|
104
|
+
{ "key": "polling_starts_time", "value": "2026-10-10T12:00:00Z" },
|
|
105
|
+
{ "key": "polling_result_time", "value": "2026-10-14T06:00:00Z" },
|
|
106
|
+
{ "key": "highlights_url", "value": "https://www.mlssoccer.com/video" },
|
|
107
|
+
{ "key": "info_title", "value": "Player of the Match" },
|
|
108
|
+
{ "key": "info_text", "value": "Vote for your standout player. You can change your vote until voting closes." }
|
|
109
|
+
]
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Development
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
npm install
|
|
116
|
+
npm run dev # local dev server
|
|
117
|
+
npm run build # build to dist/ (es + umd + types)
|
|
118
|
+
```
|
package/README.md
DELETED