shared-features 0.0.1 → 0.0.2
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 +84 -7
- package/dist/AdBanner-B9918Vst.cjs +1427 -0
- package/dist/AdBanner-B9918Vst.cjs.map +1 -0
- package/dist/AdBanner-z1osYgog.js +1428 -0
- package/dist/AdBanner-z1osYgog.js.map +1 -0
- package/dist/components/ads/AdBanner.d.ts +25 -0
- package/dist/components/ads/AdBanner.d.ts.map +1 -0
- package/dist/components/ads/AdModal.d.ts +27 -0
- package/dist/components/ads/AdModal.d.ts.map +1 -0
- package/dist/components/ads/AdSlider.d.ts +21 -0
- package/dist/components/ads/AdSlider.d.ts.map +1 -0
- package/dist/components/ads/AdUpdateModal.d.ts +27 -0
- package/dist/components/ads/AdUpdateModal.d.ts.map +1 -0
- package/dist/components/ads/index.d.ts +9 -0
- package/dist/components/ads/index.d.ts.map +1 -1
- package/dist/components/ads/variants/LargePanelVariants.d.ts +34 -0
- package/dist/components/ads/variants/LargePanelVariants.d.ts.map +1 -0
- package/dist/components/ads/variants/SmallPanelVariants.d.ts +34 -0
- package/dist/components/ads/variants/SmallPanelVariants.d.ts.map +1 -0
- package/dist/components/ads/variants/index.d.ts +12 -0
- package/dist/components/ads/variants/index.d.ts.map +1 -0
- package/dist/components/index.cjs +20 -2
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +20 -2
- package/dist/hooks/index.cjs +3 -1
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +4 -2
- package/dist/hooks/useCampaigns.d.ts +44 -0
- package/dist/hooks/useCampaigns.d.ts.map +1 -1
- package/dist/index.cjs +23 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +23 -3
- package/dist/types/campaigns.d.ts +20 -32
- package/dist/types/campaigns.d.ts.map +1 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/{useCampaigns-BNOHpETm.cjs → useCampaigns-BKGqKAUo.cjs} +56 -1
- package/dist/useCampaigns-BKGqKAUo.cjs.map +1 -0
- package/dist/{useCampaigns-3NxODLLs.js → useCampaigns-osYDc6WC.js} +56 -1
- package/dist/{useCampaigns-3NxODLLs.js.map → useCampaigns-osYDc6WC.js.map} +1 -1
- package/package.json +3 -1
- package/dist/AdPanel-D0BiV6Xb.cjs +0 -88
- package/dist/AdPanel-D0BiV6Xb.cjs.map +0 -1
- package/dist/AdPanel-RGRBf4ub.js +0 -89
- package/dist/AdPanel-RGRBf4ub.js.map +0 -1
- package/dist/useCampaigns-BNOHpETm.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -5,6 +5,9 @@ Centralized common features for Zaions projects. Manage ads, contacts, feature r
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- **Advertising Campaigns** - Cross-promote Zaions products across all projects
|
|
8
|
+
- 5 Ad Components (AdPanel, AdSlider, AdModal, AdUpdateModal, AdBanner)
|
|
9
|
+
- 10 Display Variants (5 small, 5 large)
|
|
10
|
+
- Frequency capping and analytics
|
|
8
11
|
- **Products Catalog** - Centralized product information
|
|
9
12
|
- **Contact Forms** - (Coming soon)
|
|
10
13
|
- **Feature Requests** - (Coming soon)
|
|
@@ -23,7 +26,7 @@ yarn add shared-features
|
|
|
23
26
|
This package requires the following peer dependencies:
|
|
24
27
|
|
|
25
28
|
```bash
|
|
26
|
-
yarn add react react-dom firebase @radix-ui/themes zustand
|
|
29
|
+
yarn add react react-dom firebase @radix-ui/themes zustand lucide-react
|
|
27
30
|
# Optional for mobile:
|
|
28
31
|
yarn add @capacitor/preferences
|
|
29
32
|
```
|
|
@@ -175,18 +178,92 @@ interface UseCampaignsResult {
|
|
|
175
178
|
}
|
|
176
179
|
```
|
|
177
180
|
|
|
178
|
-
###
|
|
181
|
+
### Components
|
|
179
182
|
|
|
180
|
-
|
|
183
|
+
#### `AdPanel`
|
|
184
|
+
|
|
185
|
+
Simple single-ad panel for sidebars and footers.
|
|
186
|
+
|
|
187
|
+
```tsx
|
|
188
|
+
<AdPanel placement="sidebar_panel" variant="small_panel_2" className="my-ad" />
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
#### `AdSlider`
|
|
192
|
+
|
|
193
|
+
Small promotional slider using small panel variants.
|
|
194
|
+
|
|
195
|
+
```tsx
|
|
196
|
+
<AdSlider placement="footer_slider" className="my-slider" />
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
#### `AdBanner`
|
|
200
|
+
|
|
201
|
+
Permanent promotional banner with auto-rotation and progress indicators.
|
|
181
202
|
|
|
182
203
|
```tsx
|
|
183
|
-
<
|
|
184
|
-
placement="
|
|
185
|
-
|
|
186
|
-
|
|
204
|
+
<AdBanner
|
|
205
|
+
placement="home_banner"
|
|
206
|
+
rotationInterval={10000}
|
|
207
|
+
maxCampaigns={5}
|
|
187
208
|
/>
|
|
188
209
|
```
|
|
189
210
|
|
|
211
|
+
#### `AdModal`
|
|
212
|
+
|
|
213
|
+
One-time promotional modal shown on first visit.
|
|
214
|
+
|
|
215
|
+
```tsx
|
|
216
|
+
import { AdModal, useOneTimeAdModal } from 'shared-features';
|
|
217
|
+
|
|
218
|
+
function App() {
|
|
219
|
+
const { shouldShow, markAsShown } = useOneTimeAdModal();
|
|
220
|
+
|
|
221
|
+
return (
|
|
222
|
+
<>
|
|
223
|
+
{shouldShow && <AdModal onClose={markAsShown} />}
|
|
224
|
+
{/* Your app content */}
|
|
225
|
+
</>
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
#### `AdUpdateModal`
|
|
231
|
+
|
|
232
|
+
Carousel modal shown when app version changes.
|
|
233
|
+
|
|
234
|
+
```tsx
|
|
235
|
+
import { AdUpdateModal, useUpdateAdModal } from 'shared-features';
|
|
236
|
+
|
|
237
|
+
function App() {
|
|
238
|
+
const { shouldShow, currentVersion, markAsShown } = useUpdateAdModal();
|
|
239
|
+
|
|
240
|
+
return (
|
|
241
|
+
<>
|
|
242
|
+
{shouldShow && <AdUpdateModal onClose={markAsShown} />}
|
|
243
|
+
{/* Your app content */}
|
|
244
|
+
</>
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Modal Hooks
|
|
250
|
+
|
|
251
|
+
#### `useOneTimeAdModal()`
|
|
252
|
+
|
|
253
|
+
Manages one-time modal visibility (first visit).
|
|
254
|
+
|
|
255
|
+
```typescript
|
|
256
|
+
const { shouldShow, markAsShown } = useOneTimeAdModal();
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
#### `useUpdateAdModal(currentVersion?)`
|
|
260
|
+
|
|
261
|
+
Manages update modal visibility (version change).
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
const { shouldShow, previousVersion, currentVersion, markAsShown } = useUpdateAdModal();
|
|
265
|
+
```
|
|
266
|
+
|
|
190
267
|
## Frequency Capping
|
|
191
268
|
|
|
192
269
|
Ads automatically respect frequency capping set in the admin panel. By default, each campaign is shown to a user once every 20 days. This is tracked locally using Capacitor Preferences (mobile) or localStorage (web).
|