cic-kit 0.0.34 → 0.0.36
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 +6 -3
- package/dist/cic-kit.css +1 -1
- package/dist/cmp/AppConfig.d.ts +6 -0
- package/dist/cmp/notification/AutoPushPermissionModal.vue.d.ts +20 -0
- package/dist/index.cjs +52 -52
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +6631 -6523
- package/docs/pushMsg.md +70 -0
- package/package.json +1 -1
package/docs/pushMsg.md
CHANGED
|
@@ -50,6 +50,31 @@ import { registerSW } from "virtual:pwa-register";
|
|
|
50
50
|
|
|
51
51
|
4. Per invio remoto: Cloud Function `sendUserPush` deployata (chiamata da `pushMsg.sendTo`).
|
|
52
52
|
|
|
53
|
+
### Componente pronto per `App.vue`: `AutoPushPermissionModal`
|
|
54
|
+
|
|
55
|
+
`cic-kit` espone un componente che apre automaticamente una modal informativa prima del popup browser.
|
|
56
|
+
|
|
57
|
+
Prop disponibili:
|
|
58
|
+
- `onlyAfterLogin` (`boolean`, default `true`): se `true`, la modal parte solo dopo login.
|
|
59
|
+
- `autoOpen` (`boolean`, default `true`): abilita apertura automatica.
|
|
60
|
+
- `autoOpenDelayMs` (`number`, default `250`): piccolo delay per evitare pop-up brusco al mount.
|
|
61
|
+
|
|
62
|
+
Esempio consigliato (solo utenti loggati):
|
|
63
|
+
|
|
64
|
+
```vue
|
|
65
|
+
<script setup lang="ts">
|
|
66
|
+
import { RegisterSW, AutoPushPermissionModal } from "cic-kit";
|
|
67
|
+
import { registerSW } from "virtual:pwa-register";
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<template>
|
|
71
|
+
<RegisterSW :registerSW="registerSW" />
|
|
72
|
+
<AutoPushPermissionModal :only-after-login="true" />
|
|
73
|
+
</template>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Nota: la modal appare solo se `Notification.permission === "default"` e se il browser supporta notifiche.
|
|
77
|
+
|
|
53
78
|
### API disponibile
|
|
54
79
|
|
|
55
80
|
| elemento | type | cosa fa |
|
|
@@ -172,6 +197,51 @@ async function sendRemote() {
|
|
|
172
197
|
</script>
|
|
173
198
|
```
|
|
174
199
|
|
|
200
|
+
### Override pagina `/user` (mantenendo le stesse funzioni minime)
|
|
201
|
+
|
|
202
|
+
Se vuoi sovrascrivere la pagina user del kit, mantieni almeno queste funzioni:
|
|
203
|
+
- profilo utente (nome/email/avatar)
|
|
204
|
+
- modifica profilo (`UserProfileEditForm`)
|
|
205
|
+
- stato login + riepilogo permessi utente
|
|
206
|
+
- attivazione notifiche (`pushMsg.askPermission`)
|
|
207
|
+
- logout
|
|
208
|
+
|
|
209
|
+
Componenti/utility da importare da `cic-kit`:
|
|
210
|
+
- `Btn`
|
|
211
|
+
- `BtnMoveIcon`
|
|
212
|
+
- `Accordion`
|
|
213
|
+
- `PwaUpdateButton`
|
|
214
|
+
- `UserProfileEditForm`
|
|
215
|
+
- `_Auth`
|
|
216
|
+
- `pushMsg`
|
|
217
|
+
- `cicKitStore`
|
|
218
|
+
- `defaultUserPermission` (se vuoi vincolare aree admin/debug)
|
|
219
|
+
|
|
220
|
+
Route override esempio:
|
|
221
|
+
|
|
222
|
+
```ts
|
|
223
|
+
import type { RouteRecordRaw } from "vue-router";
|
|
224
|
+
import CustomUserView from "./views/CustomUserView.vue";
|
|
225
|
+
|
|
226
|
+
export const routes: RouteRecordRaw[] = [
|
|
227
|
+
{
|
|
228
|
+
path: "/user",
|
|
229
|
+
name: "user",
|
|
230
|
+
component: CustomUserView,
|
|
231
|
+
meta: { loginStatus: true },
|
|
232
|
+
},
|
|
233
|
+
];
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Permessi consigliati:
|
|
237
|
+
- minimo obbligatorio: `meta.loginStatus: true`
|
|
238
|
+
- opzionale: `meta.permission: ["ADMIN"]` o altra lista permessi progetto
|
|
239
|
+
|
|
240
|
+
UI guideline:
|
|
241
|
+
- conserva la stessa gerarchia funzionale della `UserView` di default
|
|
242
|
+
- adatta stile/colori al tuo design system (brand, contrasto, tipografia)
|
|
243
|
+
- non rimuovere azioni critiche (logout, gestione notifiche, update profilo)
|
|
244
|
+
|
|
175
245
|
### Errori comuni e soluzione
|
|
176
246
|
|
|
177
247
|
- `Firebase non inizializzato (...)`
|