@sesamy/sesamy-components 2.14.1 → 2.16.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/README.md +138 -9
- package/dist/lib/sesamy-components.es.js +3847 -3674
- package/dist/lib/sesamy-components.umd.js +14 -13
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -14,13 +14,12 @@ npm install @sesamy/sesamy-components
|
|
|
14
14
|
yarn add @sesamy/sesamy-components
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
### sesamy-login
|
|
17
|
+
# sesamy-login
|
|
20
18
|
|
|
21
19
|
A web component that provides authentication functionality, displaying a login button for unauthenticated users and an avatar with a dropdown menu for authenticated users.
|
|
22
20
|
|
|
23
21
|
**Props/Attributes:**
|
|
22
|
+
|
|
24
23
|
- `buttonText`: Text to display on the login button
|
|
25
24
|
- `loading`: Boolean to show loading state
|
|
26
25
|
- `loggedIn`: Boolean indicating if user is logged in
|
|
@@ -30,9 +29,11 @@ A web component that provides authentication functionality, displaying a login b
|
|
|
30
29
|
- `class`: CSS classes to apply to the component
|
|
31
30
|
|
|
32
31
|
**Events:**
|
|
32
|
+
|
|
33
33
|
- `login`: Dispatched when login action is triggered
|
|
34
34
|
|
|
35
35
|
**Basic Usage Example:**
|
|
36
|
+
|
|
36
37
|
```html
|
|
37
38
|
<!-- Simple login button -->
|
|
38
39
|
<sesamy-login></sesamy-login>
|
|
@@ -42,6 +43,7 @@ A web component that provides authentication functionality, displaying a login b
|
|
|
42
43
|
```
|
|
43
44
|
|
|
44
45
|
**Design tokens:**
|
|
46
|
+
|
|
45
47
|
```html
|
|
46
48
|
<sesamy-login
|
|
47
49
|
style="
|
|
@@ -63,11 +65,83 @@ A web component that provides authentication functionality, displaying a login b
|
|
|
63
65
|
></sesamy-login>
|
|
64
66
|
```
|
|
65
67
|
|
|
68
|
+
## Slots
|
|
69
|
+
|
|
70
|
+
The `sesamy-login` component provides several slots for customizing its appearance and behavior:
|
|
71
|
+
|
|
72
|
+
### button-text
|
|
73
|
+
|
|
74
|
+
- **Purpose:** Replaces the default login button text.
|
|
75
|
+
- **Behavior:** Content in this slot will be rendered as the main text of the login button, replacing the default (localized) "login" text.
|
|
76
|
+
- **Example:**
|
|
77
|
+
```html
|
|
78
|
+
<sesamy-login>
|
|
79
|
+
<span slot="button-text">Sign in with Email</span>
|
|
80
|
+
</sesamy-login>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### button-text-prefix
|
|
84
|
+
|
|
85
|
+
- **Purpose:** Inserts content before the login button text.
|
|
86
|
+
- **Behavior:** Content in this slot will appear before the main button text, useful for adding icons or labels.
|
|
87
|
+
- **Example:**
|
|
88
|
+
```html
|
|
89
|
+
<sesamy-login>
|
|
90
|
+
<span slot="button-text-prefix">🔒</span>
|
|
91
|
+
</sesamy-login>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### button-text-suffix
|
|
95
|
+
|
|
96
|
+
- **Purpose:** Inserts content after the login button text.
|
|
97
|
+
- **Behavior:** Content in this slot will appear after the main button text, useful for adding icons or additional info.
|
|
98
|
+
- **Example:**
|
|
99
|
+
```html
|
|
100
|
+
<sesamy-login>
|
|
101
|
+
<span slot="button-text-suffix">→</span>
|
|
102
|
+
</sesamy-login>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### avatar
|
|
106
|
+
|
|
107
|
+
- **Purpose:** Replaces the default avatar shown when logged in.
|
|
108
|
+
- **Behavior:** Content in this slot will be rendered instead of the default avatar image/button when the user is authenticated.
|
|
109
|
+
- **Example:**
|
|
110
|
+
```html
|
|
111
|
+
<sesamy-login>
|
|
112
|
+
<img
|
|
113
|
+
slot="avatar"
|
|
114
|
+
src="/my-avatar.png"
|
|
115
|
+
alt="User avatar"
|
|
116
|
+
style="width:32px;height:32px;border-radius:50%"
|
|
117
|
+
/>
|
|
118
|
+
</sesamy-login>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### popup-menu
|
|
122
|
+
|
|
123
|
+
- **Purpose:** Replaces the default popup menu shown when clicking the avatar.
|
|
124
|
+
- **Behavior:** Content in this slot will be rendered instead of the default menu (email/account/logout) when the user is authenticated and opens the menu.
|
|
125
|
+
- **Example:**
|
|
126
|
+
```html
|
|
127
|
+
<sesamy-login>
|
|
128
|
+
<div slot="popup-menu">
|
|
129
|
+
<a href="/profile">Profile</a>
|
|
130
|
+
<a href="/logout">Logout</a>
|
|
131
|
+
</div>
|
|
132
|
+
</sesamy-login>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Note:**
|
|
136
|
+
|
|
137
|
+
- All slots are optional. If not provided, the component will render its default content for each area.
|
|
138
|
+
|
|
66
139
|
### sesamy-content-container
|
|
67
140
|
|
|
68
141
|
A web component that controls access to content based on user authentication and entitlements, with support for different content locking mechanisms.
|
|
69
142
|
|
|
70
143
|
**Props/Attributes:**
|
|
144
|
+
|
|
71
145
|
- `item-src`: URL of the content item
|
|
72
146
|
- `pass`: Semicolon-separated list of pass IDs that grant access
|
|
73
147
|
- `access-level`: Access level required ('public', 'logged-in', or 'entitlement')
|
|
@@ -76,9 +150,11 @@ A web component that controls access to content based on user authentication and
|
|
|
76
150
|
- `locked-content-selector`: CSS selector for locked content when using signed URLs
|
|
77
151
|
|
|
78
152
|
**Events:**
|
|
153
|
+
|
|
79
154
|
- `sesamyUnlocked`: Dispatched when content is unlocked (with `item-src` and `publisher-content-id` in detail)
|
|
80
155
|
|
|
81
156
|
**Basic Usage Example:**
|
|
157
|
+
|
|
82
158
|
```html
|
|
83
159
|
<!-- Basic content container with preview and locked content -->
|
|
84
160
|
<sesamy-content-container item-src="https://example.com/article.html">
|
|
@@ -93,11 +169,12 @@ A web component that controls access to content based on user authentication and
|
|
|
93
169
|
</sesamy-content-container>
|
|
94
170
|
```
|
|
95
171
|
|
|
96
|
-
|
|
172
|
+
# sesamy-paywall
|
|
97
173
|
|
|
98
174
|
A web component that displays a paywall for content, loading paywall settings from a remote URL and supporting different templates (Article, Boxes, Login).
|
|
99
175
|
|
|
100
176
|
**Props/Attributes:**
|
|
177
|
+
|
|
101
178
|
- `settings-url`: URL to fetch paywall settings (required)
|
|
102
179
|
- `item-src`: URL of the content item
|
|
103
180
|
- `price`: Price of the content
|
|
@@ -106,27 +183,79 @@ A web component that displays a paywall for content, loading paywall settings fr
|
|
|
106
183
|
- `utm-source`, `utm-medium`, `utm-campaign`, `utm-term`, `utm-content`: UTM parameters for tracking
|
|
107
184
|
- `pass`: Pass ID for access
|
|
108
185
|
|
|
186
|
+
**Events:**
|
|
187
|
+
|
|
188
|
+
- `sesamyPaywallAccessChecked`: Emitted after access check, with `{ hasAccess, paywallId, articleUrl, passes }` in `detail`.
|
|
189
|
+
- `sesamyPaywallProductSelected`: Emitted when a product/subscription is selected and the continue button is pressed, with `{ product, checkoutId, paywallId }` in `detail`.
|
|
190
|
+
- `sesamyPaywallCheckoutRedirect`: Emitted before redirecting to checkout, with `{ checkout, paywallId, paymentMethod }` in `detail`.
|
|
191
|
+
**Slots:**
|
|
192
|
+
|
|
193
|
+
- `below-headline`: Content rendered below the paywall headline (e.g., additional info, custom elements)
|
|
194
|
+
- `features`: Content rendered in the features section of the paywall (e.g., feature list, benefits)
|
|
195
|
+
|
|
109
196
|
**Basic Usage Example:**
|
|
197
|
+
|
|
110
198
|
```html
|
|
111
199
|
<!-- Article paywall -->
|
|
112
|
-
<sesamy-paywall
|
|
113
|
-
settings-url="https://api.example.com/paywall/settings"
|
|
200
|
+
<sesamy-paywall
|
|
201
|
+
settings-url="https://api.example.com/paywall/settings"
|
|
114
202
|
item-src="https://example.com/article"
|
|
115
203
|
price="99"
|
|
116
|
-
currency="USD"
|
|
204
|
+
currency="USD"
|
|
205
|
+
>
|
|
206
|
+
<<<<<<< HEAD =======
|
|
207
|
+
<div slot="features">✔️ Unlimited access<br />✔️ Cancel anytime</div>
|
|
208
|
+
>>>>>>> main
|
|
117
209
|
</sesamy-paywall>
|
|
118
210
|
|
|
119
|
-
<!-- Login paywall -->
|
|
211
|
+
<!-- Login paywall with below-headline slot -->
|
|
120
212
|
<sesamy-paywall settings-url="https://api.example.com/paywall/login-settings">
|
|
121
213
|
<div slot="below-headline">Additional content below headline</div>
|
|
122
214
|
</sesamy-paywall>
|
|
123
215
|
```
|
|
124
216
|
|
|
125
|
-
|
|
217
|
+
## Slots
|
|
218
|
+
|
|
219
|
+
The `sesamy-paywall` component provides two main slots for customization:
|
|
220
|
+
|
|
221
|
+
### below-headline
|
|
222
|
+
|
|
223
|
+
- **Purpose:** Inserts custom content directly below the paywall headline.
|
|
224
|
+
- **Behavior:** The content you provide in this slot will be rendered in addition to the default paywall content, immediately below the headline. Use this for adding extra information, banners, or custom elements.
|
|
225
|
+
- **Example:**
|
|
226
|
+
```html
|
|
227
|
+
<sesamy-paywall settings-url="https://api.example.com/paywall/login-settings">
|
|
228
|
+
<div slot="below-headline">Special offer for new users!</div>
|
|
229
|
+
</sesamy-paywall>
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### features
|
|
233
|
+
|
|
234
|
+
- **Purpose:** Replaces the default features section of the paywall.
|
|
235
|
+
- **Behavior:** When you provide content in the `features` slot, it will completely replace the built-in features list or section. Use this slot to fully customize the list of benefits, features, or selling points shown to the user.
|
|
236
|
+
- **Example:**
|
|
237
|
+
```html
|
|
238
|
+
<sesamy-paywall settings-url="https://api.example.com/paywall/settings">
|
|
239
|
+
<div slot="features">
|
|
240
|
+
<ul>
|
|
241
|
+
<li>✔️ Unlimited access</li>
|
|
242
|
+
<li>✔️ Cancel anytime</li>
|
|
243
|
+
<li>✔️ Exclusive articles</li>
|
|
244
|
+
</ul>
|
|
245
|
+
</div>
|
|
246
|
+
</sesamy-paywall>
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**Note:**
|
|
250
|
+
|
|
251
|
+
- The `below-headline` slot adds to the paywall, while the `features` slot replaces the default features section entirely.
|
|
252
|
+
|
|
253
|
+
# sesamy-visibility
|
|
126
254
|
|
|
127
255
|
A simple web component that conditionally renders content based on user authentication status.
|
|
128
256
|
|
|
129
257
|
**Basic Usage Example:**
|
|
258
|
+
|
|
130
259
|
```html
|
|
131
260
|
<sesamy-visibility>
|
|
132
261
|
<div slot="logged-in">This content is only visible when logged in</div>
|