@vimine/sdk 0.3.3 → 0.3.5

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.
@@ -10,7 +10,10 @@ declare const STRINGS: {
10
10
  error: string;
11
11
  noEvents: string;
12
12
  free: string;
13
- places: string;
13
+ places: {
14
+ one: string;
15
+ other: string;
16
+ };
14
17
  register: string;
15
18
  signInToRegister: string;
16
19
  joinAndBook: string;
@@ -30,7 +33,10 @@ declare const STRINGS: {
30
33
  error: string;
31
34
  noEvents: string;
32
35
  free: string;
33
- places: string;
36
+ places: {
37
+ one: string;
38
+ other: string;
39
+ };
34
40
  register: string;
35
41
  signInToRegister: string;
36
42
  joinAndBook: string;
@@ -90,7 +96,10 @@ declare const STRINGS: {
90
96
  error: string;
91
97
  noEvents: string;
92
98
  free: string;
93
- places: string;
99
+ places: {
100
+ one: string;
101
+ other: string;
102
+ };
94
103
  register: string;
95
104
  signInToRegister: string;
96
105
  joinAndBook: string;
@@ -110,7 +119,10 @@ declare const STRINGS: {
110
119
  error: string;
111
120
  noEvents: string;
112
121
  free: string;
113
- places: string;
122
+ places: {
123
+ one: string;
124
+ other: string;
125
+ };
114
126
  register: string;
115
127
  signInToRegister: string;
116
128
  joinAndBook: string;
@@ -130,7 +142,10 @@ declare const STRINGS: {
130
142
  error: string;
131
143
  noEvents: string;
132
144
  free: string;
133
- places: string;
145
+ places: {
146
+ one: string;
147
+ other: string;
148
+ };
134
149
  register: string;
135
150
  signInToRegister: string;
136
151
  joinAndBook: string;
@@ -150,7 +165,35 @@ declare const STRINGS: {
150
165
  error: string;
151
166
  noEvents: string;
152
167
  free: string;
153
- places: string;
168
+ places: {
169
+ one: string;
170
+ other: string;
171
+ };
172
+ register: string;
173
+ signInToRegister: string;
174
+ joinAndBook: string;
175
+ alreadyMember: string;
176
+ registered: string;
177
+ reserved: string;
178
+ details: string;
179
+ reason: Record<string, string>;
180
+ };
181
+ ru: {
182
+ signIn: string;
183
+ signOut: string;
184
+ loading: string;
185
+ notSignedIn: string;
186
+ noMembership: string;
187
+ notActive: string;
188
+ error: string;
189
+ noEvents: string;
190
+ free: string;
191
+ places: {
192
+ one: string;
193
+ few: string;
194
+ many: string;
195
+ other: string;
196
+ };
154
197
  register: string;
155
198
  signInToRegister: string;
156
199
  joinAndBook: string;
@@ -164,6 +207,8 @@ declare const STRINGS: {
164
207
  type Lang = keyof typeof STRINGS;
165
208
  /** The elements' language for a page's tag, or null when they do not speak it (`preview`: drafts included). */
166
209
  export declare const matchLang: (tag: string, preview?: boolean) => Lang | null;
210
+ /** "1 posto", "5 posti", "21 место": the places left, in the reader's plural — a language without one keeps one word. */
211
+ export declare const placesLabel: (n: number, lang: Lang) => string;
167
212
  /** The client the elements use. Call once; pass your own instance to share it with the rest of the page. */
168
213
  export declare function defineVimineElements(options: VimineOptions | Vimine, elements?: {
169
214
  previewLanguages?: boolean;
package/dist/elements.js CHANGED
@@ -30,7 +30,7 @@ const STRINGS = {
30
30
  error: "Si è verificato un errore.",
31
31
  noEvents: "Nessun evento in programma.",
32
32
  free: "gratuita",
33
- places: "posti",
33
+ places: { one: "posto", other: "posti" },
34
34
  register: "Iscriviti",
35
35
  signInToRegister: "Accedi per iscriverti",
36
36
  joinAndBook: "Iscriviti all’associazione e prenota",
@@ -65,7 +65,7 @@ const STRINGS = {
65
65
  error: "Something went wrong.",
66
66
  noEvents: "No upcoming events.",
67
67
  free: "free",
68
- places: "places",
68
+ places: { one: "place", other: "places" },
69
69
  register: "Register",
70
70
  signInToRegister: "Sign in to register",
71
71
  joinAndBook: "Join the association and book",
@@ -127,13 +127,13 @@ const STRINGS = {
127
127
  },
128
128
  "zh-Hant": {
129
129
  signIn: "使用 Vimine 登入",
130
- signOut: "退出",
130
+ signOut: "登出",
131
131
  loading: "載入中…",
132
132
  notSignedIn: "請登入以檢視您的會員卡。",
133
133
  noMembership: "您在這個協會沒有會員卡。",
134
- notActive: "會員卡尚未生效:生效後會顯示二維碼。",
135
- error: "出現錯誤。",
136
- noEvents: "暫無安排的活動。",
134
+ notActive: "會員卡尚未生效:生效後會顯示 QR Code。",
135
+ error: "發生錯誤。",
136
+ noEvents: "目前沒有安排的活動。",
137
137
  free: "免費",
138
138
  places: "個名額",
139
139
  register: "報名",
@@ -142,7 +142,7 @@ const STRINGS = {
142
142
  alreadyMember: "已是會員?請登入",
143
143
  registered: "報名已確認",
144
144
  reserved: "名額已保留:等待繳納參與費",
145
- details: "詳情",
145
+ details: "詳細資訊",
146
146
  reason: {
147
147
  sold_out: "名額已滿",
148
148
  event_full: "已滿員",
@@ -155,7 +155,7 @@ const STRINGS = {
155
155
  max_per_user: "已報名",
156
156
  event_past: "活動已結束",
157
157
  event_cancelled: "活動已取消",
158
- event_not_published: "未釋出",
158
+ event_not_published: "未發布",
159
159
  plan_limit: "不可用",
160
160
  invalid_type: "類型無效",
161
161
  },
@@ -170,7 +170,7 @@ const STRINGS = {
170
170
  error: "Une erreur s'est produite.",
171
171
  noEvents: "Aucun événement prévu.",
172
172
  free: "gratuite",
173
- places: "places",
173
+ places: { one: "place", other: "places" },
174
174
  register: "S'inscrire",
175
175
  signInToRegister: "Se connecter pour s'inscrire",
176
176
  joinAndBook: "Adhérer à l'association et réserver",
@@ -205,7 +205,7 @@ const STRINGS = {
205
205
  error: "Se ha producido un error.",
206
206
  noEvents: "No hay eventos programados.",
207
207
  free: "gratuita",
208
- places: "plazas",
208
+ places: { one: "plaza", other: "plazas" },
209
209
  register: "Inscríbete",
210
210
  signInToRegister: "Inicia sesión para inscribirte",
211
211
  joinAndBook: "Hazte socio y reserva",
@@ -240,7 +240,7 @@ const STRINGS = {
240
240
  error: "Ein Fehler ist aufgetreten.",
241
241
  noEvents: "Keine Veranstaltungen geplant.",
242
242
  free: "kostenlos",
243
- places: "Plätze",
243
+ places: { one: "Platz", other: "Plätze" },
244
244
  register: "Teilnehmen",
245
245
  signInToRegister: "Zum Teilnehmen anmelden",
246
246
  joinAndBook: "Dem Verein beitreten und Platz reservieren",
@@ -275,7 +275,7 @@ const STRINGS = {
275
275
  error: "Ocorreu um erro.",
276
276
  noEvents: "Nenhum evento programado.",
277
277
  free: "gratuita",
278
- places: "vagas",
278
+ places: { one: "vaga", other: "vagas" },
279
279
  register: "Inscrever-se",
280
280
  signInToRegister: "Entre para se inscrever",
281
281
  joinAndBook: "Associe-se e reserve",
@@ -300,13 +300,49 @@ const STRINGS = {
300
300
  invalid_type: "tipo inválido",
301
301
  },
302
302
  },
303
+ // drafted 2026-10-22, pending its native review (LOCALE_EXPANSION_PLAN LX8 in the app repository): see DRAFT_LANGS
304
+ ru: {
305
+ signIn: "Войти через Vimine",
306
+ signOut: "Выйти",
307
+ loading: "Загрузка…",
308
+ notSignedIn: "Войдите, чтобы увидеть свою членскую карту.",
309
+ noMembership: "Нет членства в этой организации.",
310
+ notActive: "Членская карта ещё не активна: код появится, когда она станет активной.",
311
+ error: "Произошла ошибка.",
312
+ noEvents: "Запланированных мероприятий нет.",
313
+ free: "бесплатно",
314
+ places: { one: "место", few: "места", many: "мест", other: "места" },
315
+ register: "Зарегистрироваться",
316
+ signInToRegister: "Войти, чтобы зарегистрироваться",
317
+ joinAndBook: "Вступить в организацию и забронировать место",
318
+ alreadyMember: "Уже член организации? Войти",
319
+ registered: "Регистрация подтверждена",
320
+ reserved: "Место забронировано: ожидается взнос за участие",
321
+ details: "Подробнее",
322
+ reason: {
323
+ sold_out: "места закончились",
324
+ event_full: "все места заняты",
325
+ registration_not_open: "регистрация ещё не открыта",
326
+ registration_closed: "регистрация закрыта",
327
+ membership_required: "только для членов организации",
328
+ membership_not_active: "членство недействительно",
329
+ membership_not_yet_valid: "на эту дату ваша членская карта ещё не действует",
330
+ membership_type_not_allowed: "этот тип членства не допускается",
331
+ max_per_user: "вы уже зарегистрированы",
332
+ event_past: "мероприятие завершено",
333
+ event_cancelled: "мероприятие отменено",
334
+ event_not_published: "не опубликовано",
335
+ plan_limit: "недоступно",
336
+ invalid_type: "недопустимый тип",
337
+ },
338
+ },
303
339
  };
304
340
  // Languages drafted and not yet read by a native speaker — as on the platform, which serves a draft only where its preview
305
341
  // switch names it. Their strings ship, but an element speaks one only on a page that opted in
306
342
  // (`defineVimineElements(options, { previewLanguages: true })`); elsewhere it speaks Italian, as the platform would.
307
343
  // A language leaves this list with the platform, in an SDK release. Empty since 2026-10-20: the platform enabled its six
308
344
  // drafted languages ahead of their review (the owner's decision), and the elements speak them with it.
309
- const DRAFT_LANGS = [];
345
+ const DRAFT_LANGS = ["ru"];
310
346
  let previewLanguages = false;
311
347
  // The page's language → the elements' own: the tag itself, Chinese by script (zh-TW, zh-HK → Traditional; zh, zh-CN →
312
348
  // Simplified), any other variant to the language's (en-GB → en, pt-PT → pt-BR); Italian otherwise. The platform's rule.
@@ -339,6 +375,14 @@ const INTL = {
339
375
  es: "es-ES",
340
376
  de: "de-DE",
341
377
  "pt-BR": "pt-BR",
378
+ ru: "ru-RU",
379
+ };
380
+ /** "1 posto", "5 posti", "21 место": the places left, in the reader's plural — a language without one keeps one word. */
381
+ export const placesLabel = (n, lang) => {
382
+ const word = STRINGS[lang].places;
383
+ if (typeof word === "string")
384
+ return `${n} ${word}`;
385
+ return `${n} ${word[new Intl.PluralRules(INTL[lang]).select(n)] ?? word.other}`;
342
386
  };
343
387
  const BASE_CSS = /* CSS */ `
344
388
  :host { display: inline-block; font-family: var(--vimine-font, system-ui, sans-serif); color: var(--vimine-color, #111); }
@@ -792,7 +836,7 @@ button.link { background: none; color: var(--vimine-accent, #0a0e1a); padding: 0
792
836
  const s = document.createElement("div");
793
837
  s.className = "muted";
794
838
  s.textContent = [
795
- tp.remaining != null ? `${tp.remaining} ${t.places}` : "",
839
+ tp.remaining != null ? placesLabel(tp.remaining, lang) : "",
796
840
  tp.reason ? t.reason[tp.reason] || tp.reason : "",
797
841
  ]
798
842
  .filter(Boolean)
@@ -1 +1 @@
1
- {"version":3,"file":"elements.js","sourceRoot":"","sources":["../src/elements.ts"],"names":[],"mappings":"AAAA,uGAAuG;AACvG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AAC,IAAI,EAAE;oBACjD,iBAAiB,EAAE,EAAE,CAAC,GAAG;iBAC1B,CAAC,CAAC;gBACH,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;gBACxB,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,qBAAqB,EAAE;oBACrC,MAAM,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE;oBAC7B,OAAO,EAAE,IAAI;iBACd,CAAC,CACH,CAAC;gBACF,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;YACrB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,GAAG,CAAC,QAAQ,GAAG,KAAK,CAAC;gBACrB,MAAM,OAAO,GAAG,CACb,GAAwC,EAAE,MAAM,IAAI,EAAE,CACxD;qBACE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;qBAC5C,MAAM,CAAC,OAAO,CAAC,CAAC;gBACnB,CAAC,CAAC,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;gBAC9D,CAAC,CAAC,SAAS,GAAG,OAAO,CAAC;YACxB,CAAC;QACH,CAAC,CAAC,CAAC;QACH,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACrB,OAAO,GAAG,CAAC;IACb,CAAC;CACF","sourcesContent":["// @vimine/sdk/elements — the low-code tier: three custom elements over the browser client, Shadow DOM,\n// styled through `--vimine-*` CSS custom properties, Italian by default (`lang=\"en\"` on the element or the page\n// switches the strings). Register them once, then use the tags anywhere (CMS pages, static sites):\n//\n// import { defineVimineElements } from '@vimine/sdk/elements';\n// defineVimineElements({ clientId: 'vmc_…', redirectUri: 'https://www.example.org/callback' });\n//\n// <vimine-sign-in scope=\"membership:read\"></vimine-sign-in> a \"Sign in with Vimine\" button\n// <vimine-card></vimine-card> the signed-in member's card (SVG + QR)\n// <vimine-enroll slug=\"your-slug\"></vimine-enroll> the hosted enrolment form (iframe, Embed v0), in the\n// element's language; someone who already has a\n// Vimine account is offered a hand-off to the hosted\n// page, where they join in one step\n// <vimine-events slug=\"your-slug\"></vimine-events> the association's events (public ones for\n// visitors, every one for a signed-in member) with\n// a register button per type\n//\n// The callback page still calls `client.handleRedirect()` (or `<vimine-sign-in>` does it for you when\n// `handle-redirect` is set on the element and the page is the redirect URI).\nimport { Vimine, type VimineOptions } from \"./index.js\";\nimport type { Event, Registration, RegistrationType, Scope } from \"./types.js\";\n\nlet shared: Vimine | null = null;\n\nconst STRINGS = {\n it: {\n signIn: \"Accedi con Vimine\",\n signOut: \"Esci\",\n loading: \"Caricamento…\",\n notSignedIn: \"Accedi per vedere la tua tessera.\",\n noMembership: \"Nessuna tessera in questa associazione.\",\n notActive:\n \"La tessera non è ancora attiva: il codice compare quando lo diventa.\",\n error: \"Si è verificato un errore.\",\n noEvents: \"Nessun evento in programma.\",\n free: \"gratuita\",\n places: \"posti\",\n register: \"Iscriviti\",\n signInToRegister: \"Accedi per iscriverti\",\n joinAndBook: \"Iscriviti all’associazione e prenota\",\n alreadyMember: \"Sono già socio: accedi\",\n registered: \"Iscrizione confermata\",\n reserved: \"Posto riservato: in attesa del contributo\",\n details: \"Dettagli\",\n reason: {\n sold_out: \"esaurito\",\n event_full: \"al completo\",\n registration_not_open: \"iscrizioni non ancora aperte\",\n registration_closed: \"iscrizioni chiuse\",\n membership_required: \"riservato ai soci\",\n membership_not_active: \"tessera non valida\",\n membership_not_yet_valid:\n \"la tessera non è ancora utilizzabile a quella data\",\n membership_type_not_allowed: \"tipo di tessera non ammesso\",\n max_per_user: \"già iscritto\",\n event_past: \"evento concluso\",\n event_cancelled: \"evento annullato\",\n event_not_published: \"non pubblicato\",\n plan_limit: \"non disponibile\",\n invalid_type: \"tipo non valido\",\n } as Record<string, string>,\n },\n en: {\n signIn: \"Sign in with Vimine\",\n signOut: \"Sign out\",\n loading: \"Loading…\",\n notSignedIn: \"Sign in to see your card.\",\n noMembership: \"No membership in this association.\",\n notActive: \"The card is not active yet: its code appears once it is.\",\n error: \"Something went wrong.\",\n noEvents: \"No upcoming events.\",\n free: \"free\",\n places: \"places\",\n register: \"Register\",\n signInToRegister: \"Sign in to register\",\n joinAndBook: \"Join the association and book\",\n alreadyMember: \"Already a member? Sign in\",\n registered: \"Registration confirmed\",\n reserved: \"Place reserved: awaiting the contribution\",\n details: \"Details\",\n reason: {\n sold_out: \"sold out\",\n event_full: \"full\",\n registration_not_open: \"registrations not open yet\",\n registration_closed: \"registrations closed\",\n membership_required: \"members only\",\n membership_not_active: \"membership not valid\",\n membership_not_yet_valid: \"your card is not usable yet on that date\",\n membership_type_not_allowed: \"membership type not admitted\",\n max_per_user: \"already registered\",\n event_past: \"event over\",\n event_cancelled: \"event cancelled\",\n event_not_published: \"not published\",\n plan_limit: \"not available\",\n invalid_type: \"invalid type\",\n } as Record<string, string>,\n },\n \"zh-Hans\": {\n signIn: \"使用 Vimine 登录\",\n signOut: \"退出\",\n loading: \"加载中…\",\n notSignedIn: \"请登录以查看您的会员卡。\",\n noMembership: \"您在这个协会没有会员卡。\",\n notActive: \"会员卡尚未生效:生效后会显示二维码。\",\n error: \"出现错误。\",\n noEvents: \"暂无安排的活动。\",\n free: \"免费\",\n places: \"个名额\",\n register: \"报名\",\n signInToRegister: \"登录后报名\",\n joinAndBook: \"加入协会并预约\",\n alreadyMember: \"已是会员?请登录\",\n registered: \"报名已确认\",\n reserved: \"名额已保留:等待缴纳参与费\",\n details: \"详情\",\n reason: {\n sold_out: \"名额已满\",\n event_full: \"已满员\",\n registration_not_open: \"报名尚未开始\",\n registration_closed: \"报名已截止\",\n membership_required: \"仅限会员\",\n membership_not_active: \"会员卡无效\",\n membership_not_yet_valid: \"在该日期您的会员卡尚不可用\",\n membership_type_not_allowed: \"该会员卡类型不在允许范围内\",\n max_per_user: \"已报名\",\n event_past: \"活动已结束\",\n event_cancelled: \"活动已取消\",\n event_not_published: \"未发布\",\n plan_limit: \"不可用\",\n invalid_type: \"类型无效\",\n } as Record<string, string>,\n },\n \"zh-Hant\": {\n signIn: \"使用 Vimine 登入\",\n signOut: \"退出\",\n loading: \"載入中…\",\n notSignedIn: \"請登入以檢視您的會員卡。\",\n noMembership: \"您在這個協會沒有會員卡。\",\n notActive: \"會員卡尚未生效:生效後會顯示二維碼。\",\n error: \"出現錯誤。\",\n noEvents: \"暫無安排的活動。\",\n free: \"免費\",\n places: \"個名額\",\n register: \"報名\",\n signInToRegister: \"登入後報名\",\n joinAndBook: \"加入協會並預約\",\n alreadyMember: \"已是會員?請登入\",\n registered: \"報名已確認\",\n reserved: \"名額已保留:等待繳納參與費\",\n details: \"詳情\",\n reason: {\n sold_out: \"名額已滿\",\n event_full: \"已滿員\",\n registration_not_open: \"報名尚未開始\",\n registration_closed: \"報名已截止\",\n membership_required: \"僅限會員\",\n membership_not_active: \"會員卡無效\",\n membership_not_yet_valid: \"在該日期您的會員卡尚不可用\",\n membership_type_not_allowed: \"該會員卡類型不在允許範圍內\",\n max_per_user: \"已報名\",\n event_past: \"活動已結束\",\n event_cancelled: \"活動已取消\",\n event_not_published: \"未釋出\",\n plan_limit: \"不可用\",\n invalid_type: \"類型無效\",\n } as Record<string, string>,\n },\n \"fr\": {\n signIn: \"Se connecter avec Vimine\",\n signOut: \"Se déconnecter\",\n loading: \"Chargement…\",\n notSignedIn: \"Connectez-vous pour voir votre carte.\",\n noMembership: \"Aucune carte dans cette association.\",\n notActive: \"La carte n'est pas encore active : le code apparaîtra lorsqu'elle le sera.\",\n error: \"Une erreur s'est produite.\",\n noEvents: \"Aucun événement prévu.\",\n free: \"gratuite\",\n places: \"places\",\n register: \"S'inscrire\",\n signInToRegister: \"Se connecter pour s'inscrire\",\n joinAndBook: \"Adhérer à l'association et réserver\",\n alreadyMember: \"Déjà membre : se connecter\",\n registered: \"Inscription confirmée\",\n reserved: \"Place réservée : en attente de la contribution\",\n details: \"Détails\",\n reason: {\n sold_out: \"plus de places\",\n event_full: \"complet\",\n registration_not_open: \"inscriptions pas encore ouvertes\",\n registration_closed: \"inscriptions closes\",\n membership_required: \"réservé aux membres\",\n membership_not_active: \"adhésion non valable\",\n membership_not_yet_valid: \"la carte n'est pas encore utilisable à cette date\",\n membership_type_not_allowed: \"type d'adhésion non admis\",\n max_per_user: \"déjà inscrit\",\n event_past: \"événement terminé\",\n event_cancelled: \"événement annulé\",\n event_not_published: \"non publié\",\n plan_limit: \"non disponible\",\n invalid_type: \"type non valide\",\n } as Record<string, string>,\n },\n \"es\": {\n signIn: \"Iniciar sesión con Vimine\",\n signOut: \"Cerrar sesión\",\n loading: \"Cargando…\",\n notSignedIn: \"Inicia sesión para ver tu carné.\",\n noMembership: \"No tienes carné en esta asociación.\",\n notActive: \"El carné aún no está activo: el código aparece cuando lo esté.\",\n error: \"Se ha producido un error.\",\n noEvents: \"No hay eventos programados.\",\n free: \"gratuita\",\n places: \"plazas\",\n register: \"Inscríbete\",\n signInToRegister: \"Inicia sesión para inscribirte\",\n joinAndBook: \"Hazte socio y reserva\",\n alreadyMember: \"¿Ya eres socio? Inicia sesión\",\n registered: \"Inscripción confirmada\",\n reserved: \"Plaza reservada: pendiente de la contribución\",\n details: \"Detalles\",\n reason: {\n sold_out: \"agotado\",\n event_full: \"completo\",\n registration_not_open: \"inscripciones aún no abiertas\",\n registration_closed: \"inscripciones cerradas\",\n membership_required: \"solo para socios\",\n membership_not_active: \"carné no válido\",\n membership_not_yet_valid: \"el carné aún no se puede usar en esa fecha\",\n membership_type_not_allowed: \"tipo de carné no admitido\",\n max_per_user: \"ya inscrito\",\n event_past: \"evento finalizado\",\n event_cancelled: \"evento cancelado\",\n event_not_published: \"no publicado\",\n plan_limit: \"no disponible\",\n invalid_type: \"tipo no válido\",\n } as Record<string, string>,\n },\n \"de\": {\n signIn: \"Mit Vimine anmelden\",\n signOut: \"Abmelden\",\n loading: \"Wird geladen…\",\n notSignedIn: \"Melden Sie sich an, um Ihren Ausweis zu sehen.\",\n noMembership: \"Keine Mitgliedschaft in diesem Verein.\",\n notActive: \"Der Ausweis ist noch nicht aktiv: Der Code erscheint, sobald er es ist.\",\n error: \"Ein Fehler ist aufgetreten.\",\n noEvents: \"Keine Veranstaltungen geplant.\",\n free: \"kostenlos\",\n places: \"Plätze\",\n register: \"Teilnehmen\",\n signInToRegister: \"Zum Teilnehmen anmelden\",\n joinAndBook: \"Dem Verein beitreten und Platz reservieren\",\n alreadyMember: \"Schon Mitglied? Anmelden\",\n registered: \"Anmeldung bestätigt\",\n reserved: \"Platz reserviert: Beitrag ausstehend\",\n details: \"Details\",\n reason: {\n sold_out: \"ausgebucht\",\n event_full: \"voll\",\n registration_not_open: \"Anmeldung noch nicht offen\",\n registration_closed: \"Anmeldung geschlossen\",\n membership_required: \"nur für Mitglieder\",\n membership_not_active: \"Mitgliedschaft nicht gültig\",\n membership_not_yet_valid: \"Ihr Ausweis ist an diesem Datum noch nicht nutzbar\",\n membership_type_not_allowed: \"Mitgliedsart nicht zugelassen\",\n max_per_user: \"bereits angemeldet\",\n event_past: \"Veranstaltung vorbei\",\n event_cancelled: \"Veranstaltung abgesagt\",\n event_not_published: \"nicht veröffentlicht\",\n plan_limit: \"nicht verfügbar\",\n invalid_type: \"ungültige Art\",\n } as Record<string, string>,\n },\n \"pt-BR\": {\n signIn: \"Entrar com Vimine\",\n signOut: \"Sair\",\n loading: \"Carregando…\",\n notSignedIn: \"Entre para ver sua carteirinha.\",\n noMembership: \"Nenhuma carteirinha nesta associação.\",\n notActive: \"A carteirinha ainda não está ativa: o código aparece quando ela for ativada.\",\n error: \"Ocorreu um erro.\",\n noEvents: \"Nenhum evento programado.\",\n free: \"gratuita\",\n places: \"vagas\",\n register: \"Inscrever-se\",\n signInToRegister: \"Entre para se inscrever\",\n joinAndBook: \"Associe-se e reserve\",\n alreadyMember: \"Já sou associado: entrar\",\n registered: \"Inscrição confirmada\",\n reserved: \"Vaga reservada: aguardando a contribuição\",\n details: \"Detalhes\",\n reason: {\n sold_out: \"esgotado\",\n event_full: \"lotado\",\n registration_not_open: \"inscrições ainda não abertas\",\n registration_closed: \"inscrições encerradas\",\n membership_required: \"exclusivo para associados\",\n membership_not_active: \"carteirinha inválida\",\n membership_not_yet_valid: \"a carteirinha ainda não pode ser usada nessa data\",\n membership_type_not_allowed: \"tipo de carteirinha não admitido\",\n max_per_user: \"já inscrito\",\n event_past: \"evento encerrado\",\n event_cancelled: \"evento cancelado\",\n event_not_published: \"não publicado\",\n plan_limit: \"indisponível\",\n invalid_type: \"tipo inválido\",\n } as Record<string, string>,\n },\n};\ntype Lang = keyof typeof STRINGS;\n// Languages drafted and not yet read by a native speaker — as on the platform, which serves a draft only where its preview\n// switch names it. Their strings ship, but an element speaks one only on a page that opted in\n// (`defineVimineElements(options, { previewLanguages: true })`); elsewhere it speaks Italian, as the platform would.\n// A language leaves this list with the platform, in an SDK release. Empty since 2026-10-20: the platform enabled its six\n// drafted languages ahead of their review (the owner's decision), and the elements speak them with it.\nconst DRAFT_LANGS: Lang[] = [];\nlet previewLanguages = false;\n// The page's language → the elements' own: the tag itself, Chinese by script (zh-TW, zh-HK → Traditional; zh, zh-CN →\n// Simplified), any other variant to the language's (en-GB → en, pt-PT → pt-BR); Italian otherwise. The platform's rule.\nconst LANGS = Object.keys(STRINGS) as Lang[];\n/** The elements' language for a page's tag, or null when they do not speak it (`preview`: drafts included). */\nexport const matchLang = (tag: string, preview = previewLanguages): Lang | null => {\n const served = LANGS.filter((l) => preview || !DRAFT_LANGS.includes(l));\n const lower = tag.trim().replace(/_/g, \"-\").toLowerCase();\n const exact = served.find((l) => l.toLowerCase() === lower);\n if (exact) return exact;\n const [lang, ...rest] = lower.split(\"-\");\n if (lang === \"zh\") {\n const script = rest.some((p) => [\"hant\", \"tw\", \"hk\", \"mo\"].includes(p)) ? \"zh-Hant\" : \"zh-Hans\";\n return served.includes(script) ? script : null;\n }\n return served.find((l) => l.toLowerCase().split(\"-\")[0] === lang) || null;\n};\nconst langOf = (el: HTMLElement): Lang =>\n matchLang(\n el.getAttribute(\"lang\") ||\n el.closest(\"[lang]\")?.getAttribute(\"lang\") ||\n document.documentElement.lang ||\n \"it\",\n ) || \"it\";\n// Dates and amounts in the reader's conventions: English with day-month order, Chinese naming its script.\nconst INTL: Record<Lang, string> = {\n it: \"it-IT\",\n en: \"en-GB\",\n \"zh-Hans\": \"zh-Hans-CN\",\n \"zh-Hant\": \"zh-Hant-TW\",\n fr: \"fr-FR\",\n es: \"es-ES\",\n de: \"de-DE\",\n \"pt-BR\": \"pt-BR\",\n};\n\nconst BASE_CSS = /* CSS */ `\n:host { display: inline-block; font-family: var(--vimine-font, system-ui, sans-serif); color: var(--vimine-color, #111); }\nbutton { cursor: pointer; border: 0; border-radius: var(--vimine-radius, 999px); padding: var(--vimine-padding, 0.65rem 1.1rem);\n background: var(--vimine-accent, #0a0e1a); color: var(--vimine-accent-contrast, #fff); font: inherit; font-weight: 600; }\nbutton:disabled { opacity: .6; cursor: default; }\n.muted { color: var(--vimine-muted, #666); font-size: .9em; }\n.error { color: var(--vimine-error, #a33); font-size: .9em; }\n`;\n\nconst shadow = (el: HTMLElement, css: string): ShadowRoot => {\n const root = el.shadowRoot || el.attachShadow({ mode: \"open\" });\n root.innerHTML = `<style>${BASE_CSS}${css}</style>`;\n return root;\n};\n\n/** The client the elements use. Call once; pass your own instance to share it with the rest of the page. */\nexport function defineVimineElements(\n options: VimineOptions | Vimine,\n elements: { previewLanguages?: boolean } = {},\n): Vimine {\n shared = options instanceof Vimine ? options : new Vimine(options);\n previewLanguages = !!elements.previewLanguages;\n if (typeof customElements !== \"undefined\") {\n if (!customElements.get(\"vimine-sign-in\"))\n customElements.define(\"vimine-sign-in\", VimineSignIn);\n if (!customElements.get(\"vimine-card\"))\n customElements.define(\"vimine-card\", VimineCard);\n if (!customElements.get(\"vimine-enroll\"))\n customElements.define(\"vimine-enroll\", VimineEnroll);\n if (!customElements.get(\"vimine-events\"))\n customElements.define(\"vimine-events\", VimineEvents);\n }\n return shared;\n}\n\nconst client = (): Vimine => {\n if (!shared)\n throw new Error(\n \"Vimine elements: call defineVimineElements({ clientId, redirectUri }) first\",\n );\n return shared;\n};\n\n/** `<vimine-sign-in scope=\"…\" return-to=\"/area\" label=\"…\" handle-redirect>` — a sign-in / sign-out button. */\nexport class VimineSignIn extends HTMLElement {\n private unsubscribe: (() => void) | null = null;\n connectedCallback(): void {\n void this.boot();\n }\n disconnectedCallback(): void {\n this.unsubscribe?.();\n this.unsubscribe = null;\n }\n private async boot(): Promise<void> {\n const mp = client();\n if (this.hasAttribute(\"handle-redirect\")) {\n try {\n await mp.handleRedirect();\n } catch (err) {\n this.render(err instanceof Error ? err.message : String(err));\n return;\n }\n }\n this.render();\n this.unsubscribe = mp.onChange(() => this.render());\n }\n private render(error?: string): void {\n const mp = client();\n const t = STRINGS[langOf(this)];\n const root = shadow(this, \"\");\n const btn = document.createElement(\"button\");\n btn.type = \"button\";\n if (mp.isSignedIn()) {\n btn.textContent = this.getAttribute(\"label-signed-in\") || t.signOut;\n btn.addEventListener(\n \"click\",\n () => void mp.signOut({ everywhere: this.hasAttribute(\"everywhere\") }),\n );\n } else {\n btn.textContent = this.getAttribute(\"label\") || t.signIn;\n btn.addEventListener(\"click\", () => {\n const scopes = (this.getAttribute(\"scope\") || \"\")\n .split(/[\\s,]+/)\n .filter(Boolean) as Scope[];\n void mp.signIn({\n ...(scopes.length ? { scopes } : {}),\n ...(this.getAttribute(\"return-to\")\n ? { returnTo: this.getAttribute(\"return-to\")! }\n : {}),\n });\n });\n }\n root.appendChild(btn);\n if (error) {\n const e = document.createElement(\"div\");\n e.className = \"error\";\n e.textContent = error;\n root.appendChild(e);\n }\n this.dispatchEvent(\n new CustomEvent(\"vimine-change\", {\n detail: { signedIn: mp.isSignedIn() },\n bubbles: true,\n }),\n );\n }\n}\n\n/** `<vimine-card>` — the signed-in member's card as SVG (with the live QR); refreshes when the session changes. */\nexport class VimineCard extends HTMLElement {\n private unsubscribe: (() => void) | null = null;\n connectedCallback(): void {\n void this.render();\n this.unsubscribe = client().onChange(() => void this.render());\n }\n disconnectedCallback(): void {\n this.unsubscribe?.();\n this.unsubscribe = null;\n }\n private async render(): Promise<void> {\n const mp = client();\n const t = STRINGS[langOf(this)];\n const root = shadow(\n this,\n \":host { display: block; max-width: var(--vimine-card-width, 600px); } svg { width: 100%; height: auto; display: block; border-radius: 24px; box-shadow: var(--vimine-card-shadow, 0 8px 30px rgba(0,0,0,.12)); }\",\n );\n const note = (cls: string, text: string) => {\n const d = document.createElement(\"div\");\n d.className = cls;\n d.textContent = text;\n root.appendChild(d);\n };\n if (!mp.isSignedIn()) return note(\"muted\", t.notSignedIn);\n note(\"muted\", t.loading);\n try {\n const svg = await mp.membership.cardSvg();\n root.innerHTML = `<style>${BASE_CSS}:host { display: block; max-width: var(--vimine-card-width, 600px); } svg { width: 100%; height: auto; display: block; border-radius: 24px; box-shadow: var(--vimine-card-shadow, 0 8px 30px rgba(0,0,0,.12)); }</style>${svg}`;\n this.dispatchEvent(\n new CustomEvent(\"vimine-card\", {\n detail: { loaded: true },\n bubbles: true,\n }),\n );\n } catch (err) {\n root.innerHTML = `<style>${BASE_CSS}</style>`;\n const code = (err as { code?: string })?.code;\n // `not_active`: the membership exists but has no card (pending, suspended, revoked) — a state, not a failure.\n const quiet = code === \"not_found\" || code === \"not_active\";\n note(\n quiet ? \"muted\" : \"error\",\n code === \"not_found\"\n ? t.noMembership\n : code === \"not_active\"\n ? t.notActive\n : t.error,\n );\n }\n }\n}\n\n/** The hosted enrolment page of an association, in a language: the frame's address, and where a hand-off lands. */\n/**\n * How the hosted enrolment page looks inside the host site: its scheme, the accent of its buttons, links and the\n * association's name, and the ground behind its cards (`transparent`: the host page shows through). The page reads them\n * from its address — a framed page cannot see the host's CSS — and ignores anything that is not a colour or a keyword.\n */\nexport type EnrollAppearance = { scheme?: \"light\" | \"dark\"; accent?: string; background?: string; font?: Typeface };\n\n/** The faces the hosted page offers — served by Vimine itself — or `system`, the device's own. They set everything. */\nexport const TYPEFACES = [\n \"system\",\n \"inter\",\n \"roboto\",\n \"open-sans\",\n \"montserrat\",\n \"nunito\",\n \"lora\",\n \"merriweather\",\n \"roboto-slab\",\n] as const;\nexport type Typeface = (typeof TYPEFACES)[number];\n\nconst HEX = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i;\nconst appearanceQuery = (a?: EnrollAppearance): string => {\n if (!a) return \"\";\n const out: string[] = [];\n if (a.scheme === \"light\" || a.scheme === \"dark\") out.push(`scheme=${a.scheme}`);\n if (a.accent && HEX.test(a.accent)) out.push(`accent=${encodeURIComponent(a.accent.replace(/^#/, \"\"))}`);\n if (a.background === \"transparent\") out.push(\"background=transparent\");\n else if (a.background && HEX.test(a.background))\n out.push(`background=${encodeURIComponent(a.background.replace(/^#/, \"\"))}`);\n if (a.font && (TYPEFACES as readonly string[]).includes(a.font)) out.push(`font=${a.font}`);\n return out.length ? `&${out.join(\"&\")}` : \"\";\n};\n\nexport const enrollUrl = (appUrl: string, slug: string, lang: string, appearance?: EnrollAppearance): string =>\n `${appUrl.replace(/\\/+$/, \"\")}/enroll/${encodeURIComponent(slug)}?locale=${encodeURIComponent(lang)}${appearanceQuery(appearance)}`;\n\n/**\n * The same page, opened FROM an event: the person joins the association and asks for a place at the event in one go.\n * The request carries the event; the place is confirmed, or held until the membership is active.\n */\nexport const eventEnrollUrl = (\n appUrl: string,\n slug: string,\n event: string,\n lang: string,\n): string =>\n `${enrollUrl(appUrl, slug, lang)}&event=${encodeURIComponent(event)}`;\n\n/** Any CSS colour (a name, `rgb()`, `hsl()`, a hex) as `#rrggbb`, resolved by the browser; null when it is none. */\nconst hexColour = (root: ShadowRoot, value: string): string | null => {\n const v = value.trim();\n if (!v) return null;\n const probe = document.createElement(\"span\");\n probe.style.color = v;\n if (!probe.style.color) return null;\n root.appendChild(probe);\n const m = /rgba?\\(([^)]+)\\)/.exec(getComputedStyle(probe).color);\n probe.remove();\n const parts = (m?.[1] ?? \"\").split(/[\\s,/]+/).filter(Boolean).map(Number);\n if (parts.length < 3) return null;\n const [r = 0, g = 0, b = 0, alpha] = parts;\n if (alpha === 0) return null;\n return `#${[r, g, b].map((n) => Math.round(n).toString(16).padStart(2, \"0\")).join(\"\")}`;\n};\n\n/**\n * The page's look from the host's CSS: `--vimine-scheme` (light | dark), `--vimine-accent` and `--vimine-background` (a\n * colour, or `transparent`), `--vimine-typeface` (one of TYPEFACES) — custom properties inherit, so one rule on `:root`\n * styles every Vimine element at once.\n */\nconst appearanceOf = (el: HTMLElement, root: ShadowRoot): EnrollAppearance => {\n const css = getComputedStyle(el);\n const read = (name: string) => css.getPropertyValue(name).trim();\n const out: EnrollAppearance = {};\n const scheme = read(\"--vimine-scheme\");\n if (scheme === \"light\" || scheme === \"dark\") out.scheme = scheme;\n const accent = hexColour(root, read(\"--vimine-accent\"));\n if (accent) out.accent = accent;\n const background = read(\"--vimine-background\");\n if (background === \"transparent\") out.background = \"transparent\";\n else {\n const bg = hexColour(root, background);\n if (bg) out.background = bg;\n }\n const typeface = read(\"--vimine-typeface\");\n if ((TYPEFACES as readonly string[]).includes(typeface)) out.font = typeface as Typeface;\n return out;\n};\n\n/**\n * `<vimine-enroll slug=\"…\" app-url=\"https://app.vimine.network\" height=\"900\" lang=\"en\">` — the hosted enrolment form.\n *\n * Styled like the other elements, through CSS custom properties on the element or any ancestor:\n *\n * vimine-enroll { --vimine-scheme: light; --vimine-accent: #1e3a5f; --vimine-background: transparent; }\n *\n * `--vimine-scheme` the page's scheme; `--vimine-accent` its buttons, links and the association's name (moved towards\n * the page's ink when it would not read on its cards); `--vimine-background` the ground behind the cards;\n * `--vimine-typeface` the face of the whole page, fields included — one of TYPEFACES, served by Vimine (a framed page\n * cannot use the host's fonts). The frame is styled once, when the element connects.\n *\n * The form opens in the element's language (`lang` on the element or the page; Italian by default). Someone who already\n * has a Vimine account need not fill it: the form offers *Continua su Vimine*, which opens the hosted page in a new\n * tab — there their session is recognised and they join in one step (the association's statuto and privacy notice, and\n * nothing they have already told Vimine). It is a hand-off and not a sign-in inside the frame because a browser keeps a\n * framed page's session apart from the same site opened directly; the frame's sandbox lets that tab open as an ordinary\n * page (`allow-popups-to-escape-sandbox`).\n */\nexport class VimineEnroll extends HTMLElement {\n connectedCallback(): void {\n const slug = this.getAttribute(\"slug\");\n const root = shadow(\n this,\n \":host { display: block; } iframe { width: 100%; border: 0; border-radius: var(--vimine-radius, 16px); background: transparent; }\",\n );\n if (!slug) {\n const e = document.createElement(\"div\");\n e.className = \"error\";\n e.textContent = \"vimine-enroll: missing slug\";\n root.appendChild(e);\n return;\n }\n const appUrl = (\n this.getAttribute(\"app-url\") ||\n client().options.appUrl ||\n \"https://app.vimine.network\"\n ).replace(/\\/+$/, \"\");\n const frame = document.createElement(\"iframe\");\n frame.src = enrollUrl(appUrl, slug, langOf(this), appearanceOf(this, root));\n frame.title = \"Vimine\";\n frame.loading = \"lazy\";\n frame.style.height = `${Number(this.getAttribute(\"height\")) || 900}px`;\n frame.setAttribute(\n \"sandbox\",\n \"allow-forms allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox\",\n );\n root.appendChild(frame);\n }\n}\n\nconst money = (amount: number, currency: string, lang: Lang): string => {\n try {\n return new Intl.NumberFormat(INTL[lang], {\n style: \"currency\",\n currency: currency || \"EUR\",\n }).format(amount);\n } catch {\n return `${amount.toFixed(2)} ${currency}`;\n }\n};\nconst when = (iso: string, tz: string, lang: Lang): string => {\n try {\n return new Date(iso).toLocaleString(INTL[lang], {\n timeZone: tz,\n dateStyle: \"full\",\n timeStyle: \"short\",\n });\n } catch {\n return new Date(iso).toLocaleString();\n }\n};\n\n/**\n * `<vimine-events slug=\"…\" filter=\"upcoming\" limit=\"10\" detail-url=\"/eventi/{slug}\">` — the association's events:\n * the public ones for a visitor (no sign-in), every published one for a signed-in member, each with its registration\n * types (contribution, places left) and a register button (`registrations:write`). Fires `vimine-registration`\n * `{ registration }` after a registration. `detail-url` (with `{slug}`) adds a details link.\n *\n * A VISITOR is offered a way in, not a bare sign-in: *Iscriviti all’associazione e prenota* opens the association's\n * hosted enrolment page with the event (a new tab; `app-url` as on `<vimine-enroll>`) — they join and ask for the place\n * in one go — and *Sono già socio: accedi* signs a member in here. The first is shown while the event has a registration\n * that can be had and the association takes enrolment requests; otherwise the sign-in alone.\n */\nexport class VimineEvents extends HTMLElement {\n private unsubscribe: (() => void) | null = null;\n private state: Record<string, Registration> = {};\n connectedCallback(): void {\n void this.render();\n this.unsubscribe = client().onChange(() => void this.render());\n }\n disconnectedCallback(): void {\n this.unsubscribe?.();\n this.unsubscribe = null;\n }\n private async render(): Promise<void> {\n const mp = client();\n const lang = langOf(this);\n const t = STRINGS[lang];\n const root = shadow(\n this,\n /* CSS */ `:host { display: block; }\n.event { border: 1px solid var(--vimine-border, #e5e5e5); border-radius: var(--vimine-radius, 16px); padding: var(--vimine-padding, 1rem); margin: 0 0 1rem; }\n.event h3 { margin: 0 0 .25rem; font-size: 1.15em; } .event img { width: 100%; border-radius: var(--vimine-radius, 16px); margin-bottom: .75rem; display: block; }\n.type { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .5rem 0; border-top: 1px solid var(--vimine-border, #eee); }\n.type .n { font-weight: 600; } .type button { padding: .45rem .9rem; } a { color: var(--vimine-accent, #0a0e1a); }\n.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; padding-top: .75rem; border-top: 1px solid var(--vimine-border, #eee); }\na.button { display: inline-block; text-decoration: none; border-radius: var(--vimine-radius, 999px); padding: var(--vimine-padding, 0.65rem 1.1rem);\n background: var(--vimine-accent, #0a0e1a); color: var(--vimine-accent-contrast, #fff); font-weight: 600; }\nbutton.link { background: none; color: var(--vimine-accent, #0a0e1a); padding: 0; border-radius: 0; text-decoration: underline; font-weight: 400; }`,\n );\n const note = (cls: string, text: string): void => {\n const d = document.createElement(\"div\");\n d.className = cls;\n d.textContent = text;\n root.appendChild(d);\n };\n note(\"muted\", t.loading);\n const slug = this.getAttribute(\"slug\") || \"\";\n const filter = (this.getAttribute(\"filter\") || \"upcoming\") as\n | \"upcoming\"\n | \"past\"\n | \"cancelled\"\n | \"all\";\n const limit = Number(this.getAttribute(\"limit\")) || undefined;\n let items: Event[];\n // For a visitor: does the association take enrolment requests? Only then is joining a way to a place. A side\n // read — a failure leaves the sign-in alone.\n let joinable = false;\n try {\n const params = { filter, ...(limit ? { limit } : {}) };\n items = mp.isSignedIn()\n ? (await mp.events.list(params)).items\n : (await mp.public.events.list(slug, params)).items;\n if (!mp.isSignedIn() && slug)\n joinable = await mp.public\n .association(slug)\n .then((config) => config.aps.accepting_requests === true)\n .catch(() => false);\n } catch {\n root.innerHTML = `<style>${BASE_CSS}</style>`;\n return note(\"error\", t.error);\n }\n root.innerHTML = root.querySelector(\"style\")!.outerHTML;\n if (!items.length) return note(\"muted\", t.noEvents);\n const detailUrl = this.getAttribute(\"detail-url\");\n const join = joinable\n ? {\n slug,\n appUrl: (\n this.getAttribute(\"app-url\") ||\n mp.options.appUrl ||\n \"https://app.vimine.network\"\n ).replace(/\\/+$/, \"\"),\n }\n : null;\n for (const ev of items)\n root.appendChild(this.card(ev, mp, lang, detailUrl, join));\n }\n private card(\n ev: Event,\n mp: Vimine,\n lang: Lang,\n detailUrl: string | null,\n join: { slug: string; appUrl: string } | null,\n ): HTMLElement {\n const t = STRINGS[lang];\n const el = document.createElement(\"article\");\n el.className = \"event\";\n if (ev.cover_url) {\n const img = document.createElement(\"img\");\n img.src = ev.cover_url;\n img.alt = \"\";\n el.appendChild(img);\n }\n const h = document.createElement(\"h3\");\n h.textContent = ev.title;\n el.appendChild(h);\n const meta = document.createElement(\"div\");\n meta.className = \"muted\";\n meta.textContent = `${when(ev.starts_at, ev.timezone, lang)}${ev.location ? ` · ${ev.location.name || ev.location.address || \"\"}` : \"\"}`;\n el.appendChild(meta);\n if (ev.summary) {\n const p = document.createElement(\"p\");\n p.textContent = ev.summary;\n el.appendChild(p);\n }\n if (detailUrl) {\n const a = document.createElement(\"a\");\n a.href = detailUrl.replace(\"{slug}\", encodeURIComponent(ev.slug));\n a.textContent = t.details;\n el.appendChild(a);\n }\n const mine = this.state[ev.id];\n if (mine) {\n const d = document.createElement(\"div\");\n d.className = \"muted\";\n d.textContent = mine.status === \"confirmed\" ? t.registered : t.reserved;\n el.appendChild(d);\n return el;\n }\n if (ev.status === \"published\")\n for (const tp of ev.registration_types)\n el.appendChild(this.typeRow(ev, tp, mp, lang));\n // A visitor: one call for the event, under its registrations — join and book on the hosted page, or sign in here.\n if (\n ev.status === \"published\" &&\n !mp.isSignedIn() &&\n ev.registration_types.some((tp) => tp.open)\n ) {\n const actions = document.createElement(\"div\");\n actions.className = \"actions\";\n const signIn = document.createElement(\"button\");\n signIn.type = \"button\";\n signIn.addEventListener(\n \"click\",\n () =>\n void mp.signIn({\n scopes: [\n \"events:read\",\n \"registrations:read\",\n \"registrations:write\",\n ],\n }),\n );\n if (join) {\n const a = document.createElement(\"a\");\n a.className = \"button\";\n a.href = eventEnrollUrl(join.appUrl, join.slug, ev.slug, lang);\n a.target = \"_blank\";\n a.rel = \"noopener\";\n a.textContent = t.joinAndBook;\n actions.appendChild(a);\n signIn.className = \"link\";\n signIn.textContent = t.alreadyMember;\n } else signIn.textContent = t.signInToRegister;\n actions.appendChild(signIn);\n el.appendChild(actions);\n }\n return el;\n }\n private typeRow(\n ev: Event,\n tp: RegistrationType,\n mp: Vimine,\n lang: Lang,\n ): HTMLElement {\n const t = STRINGS[lang];\n const row = document.createElement(\"div\");\n row.className = \"type\";\n const left = document.createElement(\"div\");\n const n = document.createElement(\"div\");\n n.className = \"n\";\n n.textContent = `${tp.name} · ${tp.amount > 0 ? money(tp.amount, tp.currency, lang) : t.free}`;\n left.appendChild(n);\n const s = document.createElement(\"div\");\n s.className = \"muted\";\n s.textContent = [\n tp.remaining != null ? `${tp.remaining} ${t.places}` : \"\",\n tp.reason ? t.reason[tp.reason] || tp.reason : \"\",\n ]\n .filter(Boolean)\n .join(\" · \");\n left.appendChild(s);\n row.appendChild(left);\n // A visitor has the event's own call below the registrations (`card`): no button per registration.\n if (!mp.isSignedIn()) return row;\n const btn = document.createElement(\"button\");\n btn.type = \"button\";\n btn.textContent = t.register;\n btn.disabled = !tp.open;\n btn.addEventListener(\"click\", async () => {\n btn.disabled = true;\n try {\n const reg = await mp.registrations.create(ev.slug, {\n registration_type: tp.uid,\n });\n this.state[ev.id] = reg;\n this.dispatchEvent(\n new CustomEvent(\"vimine-registration\", {\n detail: { registration: reg },\n bubbles: true,\n }),\n );\n void this.render();\n } catch (err) {\n btn.disabled = false;\n const reasons = (\n (err as { errors?: { code?: string }[] })?.errors || []\n )\n .map((e) => t.reason[e.code || \"\"] || e.code)\n .filter(Boolean);\n s.textContent = reasons.length ? reasons.join(\", \") : t.error;\n s.className = \"error\";\n }\n });\n row.appendChild(btn);\n return row;\n }\n}\n"]}
1
+ {"version":3,"file":"elements.js","sourceRoot":"","sources":["../src/elements.ts"],"names":[],"mappings":"AAAA,uGAAuG;AACvG,gHAAgH;AAChH,mGAAmG;AACnG,EAAE;AACF,iEAAiE;AACjE,kGAAkG;AAClG,EAAE;AACF,+FAA+F;AAC/F,uGAAuG;AACvG,qHAAqH;AACrH,oHAAoH;AACpH,yHAAyH;AACzH,wGAAwG;AACxG,0GAA0G;AAC1G,uHAAuH;AACvH,iGAAiG;AACjG,EAAE;AACF,sGAAsG;AACtG,6EAA6E;AAC7E,OAAO,EAAE,MAAM,EAAsB,MAAM,YAAY,CAAC;AAGxD,IAAI,MAAM,GAAkB,IAAI,CAAC;AAEjC,MAAM,OAAO,GAAG;IACd,EAAE,EAAE;QACF,MAAM,EAAE,mBAAmB;QAC3B,OAAO,EAAE,MAAM;QACf,OAAO,EAAE,cAAc;QACvB,WAAW,EAAE,mCAAmC;QAChD,YAAY,EAAE,yCAAyC;QACvD,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AAC,EAAE,CAAC,IAAI,EAAE;oBACjD,iBAAiB,EAAE,EAAE,CAAC,GAAG;iBAC1B,CAAC,CAAC;gBACH,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;gBACxB,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,qBAAqB,EAAE;oBACrC,MAAM,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE;oBAC7B,OAAO,EAAE,IAAI;iBACd,CAAC,CACH,CAAC;gBACF,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;YACrB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,GAAG,CAAC,QAAQ,GAAG,KAAK,CAAC;gBACrB,MAAM,OAAO,GAAG,CACb,GAAwC,EAAE,MAAM,IAAI,EAAE,CACxD;qBACE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;qBAC5C,MAAM,CAAC,OAAO,CAAC,CAAC;gBACnB,CAAC,CAAC,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;gBAC9D,CAAC,CAAC,SAAS,GAAG,OAAO,CAAC;YACxB,CAAC;QACH,CAAC,CAAC,CAAC;QACH,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACrB,OAAO,GAAG,CAAC;IACb,CAAC;CACF","sourcesContent":["// @vimine/sdk/elements — the low-code tier: three custom elements over the browser client, Shadow DOM,\n// styled through `--vimine-*` CSS custom properties, Italian by default (`lang=\"en\"` on the element or the page\n// switches the strings). Register them once, then use the tags anywhere (CMS pages, static sites):\n//\n// import { defineVimineElements } from '@vimine/sdk/elements';\n// defineVimineElements({ clientId: 'vmc_…', redirectUri: 'https://www.example.org/callback' });\n//\n// <vimine-sign-in scope=\"membership:read\"></vimine-sign-in> a \"Sign in with Vimine\" button\n// <vimine-card></vimine-card> the signed-in member's card (SVG + QR)\n// <vimine-enroll slug=\"your-slug\"></vimine-enroll> the hosted enrolment form (iframe, Embed v0), in the\n// element's language; someone who already has a\n// Vimine account is offered a hand-off to the hosted\n// page, where they join in one step\n// <vimine-events slug=\"your-slug\"></vimine-events> the association's events (public ones for\n// visitors, every one for a signed-in member) with\n// a register button per type\n//\n// The callback page still calls `client.handleRedirect()` (or `<vimine-sign-in>` does it for you when\n// `handle-redirect` is set on the element and the page is the redirect URI).\nimport { Vimine, type VimineOptions } from \"./index.js\";\nimport type { Event, Registration, RegistrationType, Scope } from \"./types.js\";\n\nlet shared: Vimine | null = null;\n\nconst STRINGS = {\n it: {\n signIn: \"Accedi con Vimine\",\n signOut: \"Esci\",\n loading: \"Caricamento…\",\n notSignedIn: \"Accedi per vedere la tua tessera.\",\n noMembership: \"Nessuna tessera in questa associazione.\",\n notActive:\n \"La tessera non è ancora attiva: il codice compare quando lo diventa.\",\n error: \"Si è verificato un errore.\",\n noEvents: \"Nessun evento in programma.\",\n free: \"gratuita\",\n places: { one: \"posto\", other: \"posti\" },\n register: \"Iscriviti\",\n signInToRegister: \"Accedi per iscriverti\",\n joinAndBook: \"Iscriviti all’associazione e prenota\",\n alreadyMember: \"Sono già socio: accedi\",\n registered: \"Iscrizione confermata\",\n reserved: \"Posto riservato: in attesa del contributo\",\n details: \"Dettagli\",\n reason: {\n sold_out: \"esaurito\",\n event_full: \"al completo\",\n registration_not_open: \"iscrizioni non ancora aperte\",\n registration_closed: \"iscrizioni chiuse\",\n membership_required: \"riservato ai soci\",\n membership_not_active: \"tessera non valida\",\n membership_not_yet_valid:\n \"la tessera non è ancora utilizzabile a quella data\",\n membership_type_not_allowed: \"tipo di tessera non ammesso\",\n max_per_user: \"già iscritto\",\n event_past: \"evento concluso\",\n event_cancelled: \"evento annullato\",\n event_not_published: \"non pubblicato\",\n plan_limit: \"non disponibile\",\n invalid_type: \"tipo non valido\",\n } as Record<string, string>,\n },\n en: {\n signIn: \"Sign in with Vimine\",\n signOut: \"Sign out\",\n loading: \"Loading…\",\n notSignedIn: \"Sign in to see your card.\",\n noMembership: \"No membership in this association.\",\n notActive: \"The card is not active yet: its code appears once it is.\",\n error: \"Something went wrong.\",\n noEvents: \"No upcoming events.\",\n free: \"free\",\n places: { one: \"place\", other: \"places\" },\n register: \"Register\",\n signInToRegister: \"Sign in to register\",\n joinAndBook: \"Join the association and book\",\n alreadyMember: \"Already a member? Sign in\",\n registered: \"Registration confirmed\",\n reserved: \"Place reserved: awaiting the contribution\",\n details: \"Details\",\n reason: {\n sold_out: \"sold out\",\n event_full: \"full\",\n registration_not_open: \"registrations not open yet\",\n registration_closed: \"registrations closed\",\n membership_required: \"members only\",\n membership_not_active: \"membership not valid\",\n membership_not_yet_valid: \"your card is not usable yet on that date\",\n membership_type_not_allowed: \"membership type not admitted\",\n max_per_user: \"already registered\",\n event_past: \"event over\",\n event_cancelled: \"event cancelled\",\n event_not_published: \"not published\",\n plan_limit: \"not available\",\n invalid_type: \"invalid type\",\n } as Record<string, string>,\n },\n \"zh-Hans\": {\n signIn: \"使用 Vimine 登录\",\n signOut: \"退出\",\n loading: \"加载中…\",\n notSignedIn: \"请登录以查看您的会员卡。\",\n noMembership: \"您在这个协会没有会员卡。\",\n notActive: \"会员卡尚未生效:生效后会显示二维码。\",\n error: \"出现错误。\",\n noEvents: \"暂无安排的活动。\",\n free: \"免费\",\n places: \"个名额\",\n register: \"报名\",\n signInToRegister: \"登录后报名\",\n joinAndBook: \"加入协会并预约\",\n alreadyMember: \"已是会员?请登录\",\n registered: \"报名已确认\",\n reserved: \"名额已保留:等待缴纳参与费\",\n details: \"详情\",\n reason: {\n sold_out: \"名额已满\",\n event_full: \"已满员\",\n registration_not_open: \"报名尚未开始\",\n registration_closed: \"报名已截止\",\n membership_required: \"仅限会员\",\n membership_not_active: \"会员卡无效\",\n membership_not_yet_valid: \"在该日期您的会员卡尚不可用\",\n membership_type_not_allowed: \"该会员卡类型不在允许范围内\",\n max_per_user: \"已报名\",\n event_past: \"活动已结束\",\n event_cancelled: \"活动已取消\",\n event_not_published: \"未发布\",\n plan_limit: \"不可用\",\n invalid_type: \"类型无效\",\n } as Record<string, string>,\n },\n \"zh-Hant\": {\n signIn: \"使用 Vimine 登入\",\n signOut: \"登出\",\n loading: \"載入中…\",\n notSignedIn: \"請登入以檢視您的會員卡。\",\n noMembership: \"您在這個協會沒有會員卡。\",\n notActive: \"會員卡尚未生效:生效後會顯示 QR Code。\",\n error: \"發生錯誤。\",\n noEvents: \"目前沒有安排的活動。\",\n free: \"免費\",\n places: \"個名額\",\n register: \"報名\",\n signInToRegister: \"登入後報名\",\n joinAndBook: \"加入協會並預約\",\n alreadyMember: \"已是會員?請登入\",\n registered: \"報名已確認\",\n reserved: \"名額已保留:等待繳納參與費\",\n details: \"詳細資訊\",\n reason: {\n sold_out: \"名額已滿\",\n event_full: \"已滿員\",\n registration_not_open: \"報名尚未開始\",\n registration_closed: \"報名已截止\",\n membership_required: \"僅限會員\",\n membership_not_active: \"會員卡無效\",\n membership_not_yet_valid: \"在該日期您的會員卡尚不可用\",\n membership_type_not_allowed: \"該會員卡類型不在允許範圍內\",\n max_per_user: \"已報名\",\n event_past: \"活動已結束\",\n event_cancelled: \"活動已取消\",\n event_not_published: \"未發布\",\n plan_limit: \"不可用\",\n invalid_type: \"類型無效\",\n } as Record<string, string>,\n },\n \"fr\": {\n signIn: \"Se connecter avec Vimine\",\n signOut: \"Se déconnecter\",\n loading: \"Chargement…\",\n notSignedIn: \"Connectez-vous pour voir votre carte.\",\n noMembership: \"Aucune carte dans cette association.\",\n notActive: \"La carte n'est pas encore active : le code apparaîtra lorsqu'elle le sera.\",\n error: \"Une erreur s'est produite.\",\n noEvents: \"Aucun événement prévu.\",\n free: \"gratuite\",\n places: { one: \"place\", other: \"places\" },\n register: \"S'inscrire\",\n signInToRegister: \"Se connecter pour s'inscrire\",\n joinAndBook: \"Adhérer à l'association et réserver\",\n alreadyMember: \"Déjà membre : se connecter\",\n registered: \"Inscription confirmée\",\n reserved: \"Place réservée : en attente de la contribution\",\n details: \"Détails\",\n reason: {\n sold_out: \"plus de places\",\n event_full: \"complet\",\n registration_not_open: \"inscriptions pas encore ouvertes\",\n registration_closed: \"inscriptions closes\",\n membership_required: \"réservé aux membres\",\n membership_not_active: \"adhésion non valable\",\n membership_not_yet_valid: \"la carte n'est pas encore utilisable à cette date\",\n membership_type_not_allowed: \"type d'adhésion non admis\",\n max_per_user: \"déjà inscrit\",\n event_past: \"événement terminé\",\n event_cancelled: \"événement annulé\",\n event_not_published: \"non publié\",\n plan_limit: \"non disponible\",\n invalid_type: \"type non valide\",\n } as Record<string, string>,\n },\n \"es\": {\n signIn: \"Iniciar sesión con Vimine\",\n signOut: \"Cerrar sesión\",\n loading: \"Cargando…\",\n notSignedIn: \"Inicia sesión para ver tu carné.\",\n noMembership: \"No tienes carné en esta asociación.\",\n notActive: \"El carné aún no está activo: el código aparece cuando lo esté.\",\n error: \"Se ha producido un error.\",\n noEvents: \"No hay eventos programados.\",\n free: \"gratuita\",\n places: { one: \"plaza\", other: \"plazas\" },\n register: \"Inscríbete\",\n signInToRegister: \"Inicia sesión para inscribirte\",\n joinAndBook: \"Hazte socio y reserva\",\n alreadyMember: \"¿Ya eres socio? Inicia sesión\",\n registered: \"Inscripción confirmada\",\n reserved: \"Plaza reservada: pendiente de la contribución\",\n details: \"Detalles\",\n reason: {\n sold_out: \"agotado\",\n event_full: \"completo\",\n registration_not_open: \"inscripciones aún no abiertas\",\n registration_closed: \"inscripciones cerradas\",\n membership_required: \"solo para socios\",\n membership_not_active: \"carné no válido\",\n membership_not_yet_valid: \"el carné aún no se puede usar en esa fecha\",\n membership_type_not_allowed: \"tipo de carné no admitido\",\n max_per_user: \"ya inscrito\",\n event_past: \"evento finalizado\",\n event_cancelled: \"evento cancelado\",\n event_not_published: \"no publicado\",\n plan_limit: \"no disponible\",\n invalid_type: \"tipo no válido\",\n } as Record<string, string>,\n },\n \"de\": {\n signIn: \"Mit Vimine anmelden\",\n signOut: \"Abmelden\",\n loading: \"Wird geladen…\",\n notSignedIn: \"Melden Sie sich an, um Ihren Ausweis zu sehen.\",\n noMembership: \"Keine Mitgliedschaft in diesem Verein.\",\n notActive: \"Der Ausweis ist noch nicht aktiv: Der Code erscheint, sobald er es ist.\",\n error: \"Ein Fehler ist aufgetreten.\",\n noEvents: \"Keine Veranstaltungen geplant.\",\n free: \"kostenlos\",\n places: { one: \"Platz\", other: \"Plätze\" },\n register: \"Teilnehmen\",\n signInToRegister: \"Zum Teilnehmen anmelden\",\n joinAndBook: \"Dem Verein beitreten und Platz reservieren\",\n alreadyMember: \"Schon Mitglied? Anmelden\",\n registered: \"Anmeldung bestätigt\",\n reserved: \"Platz reserviert: Beitrag ausstehend\",\n details: \"Details\",\n reason: {\n sold_out: \"ausgebucht\",\n event_full: \"voll\",\n registration_not_open: \"Anmeldung noch nicht offen\",\n registration_closed: \"Anmeldung geschlossen\",\n membership_required: \"nur für Mitglieder\",\n membership_not_active: \"Mitgliedschaft nicht gültig\",\n membership_not_yet_valid: \"Ihr Ausweis ist an diesem Datum noch nicht nutzbar\",\n membership_type_not_allowed: \"Mitgliedsart nicht zugelassen\",\n max_per_user: \"bereits angemeldet\",\n event_past: \"Veranstaltung vorbei\",\n event_cancelled: \"Veranstaltung abgesagt\",\n event_not_published: \"nicht veröffentlicht\",\n plan_limit: \"nicht verfügbar\",\n invalid_type: \"ungültige Art\",\n } as Record<string, string>,\n },\n \"pt-BR\": {\n signIn: \"Entrar com Vimine\",\n signOut: \"Sair\",\n loading: \"Carregando…\",\n notSignedIn: \"Entre para ver sua carteirinha.\",\n noMembership: \"Nenhuma carteirinha nesta associação.\",\n notActive: \"A carteirinha ainda não está ativa: o código aparece quando ela for ativada.\",\n error: \"Ocorreu um erro.\",\n noEvents: \"Nenhum evento programado.\",\n free: \"gratuita\",\n places: { one: \"vaga\", other: \"vagas\" },\n register: \"Inscrever-se\",\n signInToRegister: \"Entre para se inscrever\",\n joinAndBook: \"Associe-se e reserve\",\n alreadyMember: \"Já sou associado: entrar\",\n registered: \"Inscrição confirmada\",\n reserved: \"Vaga reservada: aguardando a contribuição\",\n details: \"Detalhes\",\n reason: {\n sold_out: \"esgotado\",\n event_full: \"lotado\",\n registration_not_open: \"inscrições ainda não abertas\",\n registration_closed: \"inscrições encerradas\",\n membership_required: \"exclusivo para associados\",\n membership_not_active: \"carteirinha inválida\",\n membership_not_yet_valid: \"a carteirinha ainda não pode ser usada nessa data\",\n membership_type_not_allowed: \"tipo de carteirinha não admitido\",\n max_per_user: \"já inscrito\",\n event_past: \"evento encerrado\",\n event_cancelled: \"evento cancelado\",\n event_not_published: \"não publicado\",\n plan_limit: \"indisponível\",\n invalid_type: \"tipo inválido\",\n } as Record<string, string>,\n },\n // drafted 2026-10-22, pending its native review (LOCALE_EXPANSION_PLAN LX8 in the app repository): see DRAFT_LANGS\n ru: {\n signIn: \"Войти через Vimine\",\n signOut: \"Выйти\",\n loading: \"Загрузка…\",\n notSignedIn: \"Войдите, чтобы увидеть свою членскую карту.\",\n noMembership: \"Нет членства в этой организации.\",\n notActive: \"Членская карта ещё не активна: код появится, когда она станет активной.\",\n error: \"Произошла ошибка.\",\n noEvents: \"Запланированных мероприятий нет.\",\n free: \"бесплатно\",\n places: { one: \"место\", few: \"места\", many: \"мест\", other: \"места\" },\n register: \"Зарегистрироваться\",\n signInToRegister: \"Войти, чтобы зарегистрироваться\",\n joinAndBook: \"Вступить в организацию и забронировать место\",\n alreadyMember: \"Уже член организации? Войти\",\n registered: \"Регистрация подтверждена\",\n reserved: \"Место забронировано: ожидается взнос за участие\",\n details: \"Подробнее\",\n reason: {\n sold_out: \"места закончились\",\n event_full: \"все места заняты\",\n registration_not_open: \"регистрация ещё не открыта\",\n registration_closed: \"регистрация закрыта\",\n membership_required: \"только для членов организации\",\n membership_not_active: \"членство недействительно\",\n membership_not_yet_valid: \"на эту дату ваша членская карта ещё не действует\",\n membership_type_not_allowed: \"этот тип членства не допускается\",\n max_per_user: \"вы уже зарегистрированы\",\n event_past: \"мероприятие завершено\",\n event_cancelled: \"мероприятие отменено\",\n event_not_published: \"не опубликовано\",\n plan_limit: \"недоступно\",\n invalid_type: \"недопустимый тип\",\n } as Record<string, string>,\n },\n};\ntype Lang = keyof typeof STRINGS;\n// Languages drafted and not yet read by a native speaker — as on the platform, which serves a draft only where its preview\n// switch names it. Their strings ship, but an element speaks one only on a page that opted in\n// (`defineVimineElements(options, { previewLanguages: true })`); elsewhere it speaks Italian, as the platform would.\n// A language leaves this list with the platform, in an SDK release. Empty since 2026-10-20: the platform enabled its six\n// drafted languages ahead of their review (the owner's decision), and the elements speak them with it.\nconst DRAFT_LANGS: Lang[] = [\"ru\"];\nlet previewLanguages = false;\n// The page's language → the elements' own: the tag itself, Chinese by script (zh-TW, zh-HK → Traditional; zh, zh-CN →\n// Simplified), any other variant to the language's (en-GB → en, pt-PT → pt-BR); Italian otherwise. The platform's rule.\nconst LANGS = Object.keys(STRINGS) as Lang[];\n/** The elements' language for a page's tag, or null when they do not speak it (`preview`: drafts included). */\nexport const matchLang = (tag: string, preview = previewLanguages): Lang | null => {\n const served = LANGS.filter((l) => preview || !DRAFT_LANGS.includes(l));\n const lower = tag.trim().replace(/_/g, \"-\").toLowerCase();\n const exact = served.find((l) => l.toLowerCase() === lower);\n if (exact) return exact;\n const [lang, ...rest] = lower.split(\"-\");\n if (lang === \"zh\") {\n const script = rest.some((p) => [\"hant\", \"tw\", \"hk\", \"mo\"].includes(p)) ? \"zh-Hant\" : \"zh-Hans\";\n return served.includes(script) ? script : null;\n }\n return served.find((l) => l.toLowerCase().split(\"-\")[0] === lang) || null;\n};\nconst langOf = (el: HTMLElement): Lang =>\n matchLang(\n el.getAttribute(\"lang\") ||\n el.closest(\"[lang]\")?.getAttribute(\"lang\") ||\n document.documentElement.lang ||\n \"it\",\n ) || \"it\";\n// Dates and amounts in the reader's conventions: English with day-month order, Chinese naming its script.\nconst INTL: Record<Lang, string> = {\n it: \"it-IT\",\n en: \"en-GB\",\n \"zh-Hans\": \"zh-Hans-CN\",\n \"zh-Hant\": \"zh-Hant-TW\",\n fr: \"fr-FR\",\n es: \"es-ES\",\n de: \"de-DE\",\n \"pt-BR\": \"pt-BR\",\n ru: \"ru-RU\",\n};\n\n/** \"1 posto\", \"5 posti\", \"21 место\": the places left, in the reader's plural — a language without one keeps one word. */\nexport const placesLabel = (n: number, lang: Lang): string => {\n const word: string | Record<string, string> = STRINGS[lang].places;\n if (typeof word === \"string\") return `${n} ${word}`;\n return `${n} ${word[new Intl.PluralRules(INTL[lang]).select(n)] ?? word.other}`;\n};\n\nconst BASE_CSS = /* CSS */ `\n:host { display: inline-block; font-family: var(--vimine-font, system-ui, sans-serif); color: var(--vimine-color, #111); }\nbutton { cursor: pointer; border: 0; border-radius: var(--vimine-radius, 999px); padding: var(--vimine-padding, 0.65rem 1.1rem);\n background: var(--vimine-accent, #0a0e1a); color: var(--vimine-accent-contrast, #fff); font: inherit; font-weight: 600; }\nbutton:disabled { opacity: .6; cursor: default; }\n.muted { color: var(--vimine-muted, #666); font-size: .9em; }\n.error { color: var(--vimine-error, #a33); font-size: .9em; }\n`;\n\nconst shadow = (el: HTMLElement, css: string): ShadowRoot => {\n const root = el.shadowRoot || el.attachShadow({ mode: \"open\" });\n root.innerHTML = `<style>${BASE_CSS}${css}</style>`;\n return root;\n};\n\n/** The client the elements use. Call once; pass your own instance to share it with the rest of the page. */\nexport function defineVimineElements(\n options: VimineOptions | Vimine,\n elements: { previewLanguages?: boolean } = {},\n): Vimine {\n shared = options instanceof Vimine ? options : new Vimine(options);\n previewLanguages = !!elements.previewLanguages;\n if (typeof customElements !== \"undefined\") {\n if (!customElements.get(\"vimine-sign-in\"))\n customElements.define(\"vimine-sign-in\", VimineSignIn);\n if (!customElements.get(\"vimine-card\"))\n customElements.define(\"vimine-card\", VimineCard);\n if (!customElements.get(\"vimine-enroll\"))\n customElements.define(\"vimine-enroll\", VimineEnroll);\n if (!customElements.get(\"vimine-events\"))\n customElements.define(\"vimine-events\", VimineEvents);\n }\n return shared;\n}\n\nconst client = (): Vimine => {\n if (!shared)\n throw new Error(\n \"Vimine elements: call defineVimineElements({ clientId, redirectUri }) first\",\n );\n return shared;\n};\n\n/** `<vimine-sign-in scope=\"…\" return-to=\"/area\" label=\"…\" handle-redirect>` — a sign-in / sign-out button. */\nexport class VimineSignIn extends HTMLElement {\n private unsubscribe: (() => void) | null = null;\n connectedCallback(): void {\n void this.boot();\n }\n disconnectedCallback(): void {\n this.unsubscribe?.();\n this.unsubscribe = null;\n }\n private async boot(): Promise<void> {\n const mp = client();\n if (this.hasAttribute(\"handle-redirect\")) {\n try {\n await mp.handleRedirect();\n } catch (err) {\n this.render(err instanceof Error ? err.message : String(err));\n return;\n }\n }\n this.render();\n this.unsubscribe = mp.onChange(() => this.render());\n }\n private render(error?: string): void {\n const mp = client();\n const t = STRINGS[langOf(this)];\n const root = shadow(this, \"\");\n const btn = document.createElement(\"button\");\n btn.type = \"button\";\n if (mp.isSignedIn()) {\n btn.textContent = this.getAttribute(\"label-signed-in\") || t.signOut;\n btn.addEventListener(\n \"click\",\n () => void mp.signOut({ everywhere: this.hasAttribute(\"everywhere\") }),\n );\n } else {\n btn.textContent = this.getAttribute(\"label\") || t.signIn;\n btn.addEventListener(\"click\", () => {\n const scopes = (this.getAttribute(\"scope\") || \"\")\n .split(/[\\s,]+/)\n .filter(Boolean) as Scope[];\n void mp.signIn({\n ...(scopes.length ? { scopes } : {}),\n ...(this.getAttribute(\"return-to\")\n ? { returnTo: this.getAttribute(\"return-to\")! }\n : {}),\n });\n });\n }\n root.appendChild(btn);\n if (error) {\n const e = document.createElement(\"div\");\n e.className = \"error\";\n e.textContent = error;\n root.appendChild(e);\n }\n this.dispatchEvent(\n new CustomEvent(\"vimine-change\", {\n detail: { signedIn: mp.isSignedIn() },\n bubbles: true,\n }),\n );\n }\n}\n\n/** `<vimine-card>` — the signed-in member's card as SVG (with the live QR); refreshes when the session changes. */\nexport class VimineCard extends HTMLElement {\n private unsubscribe: (() => void) | null = null;\n connectedCallback(): void {\n void this.render();\n this.unsubscribe = client().onChange(() => void this.render());\n }\n disconnectedCallback(): void {\n this.unsubscribe?.();\n this.unsubscribe = null;\n }\n private async render(): Promise<void> {\n const mp = client();\n const t = STRINGS[langOf(this)];\n const root = shadow(\n this,\n \":host { display: block; max-width: var(--vimine-card-width, 600px); } svg { width: 100%; height: auto; display: block; border-radius: 24px; box-shadow: var(--vimine-card-shadow, 0 8px 30px rgba(0,0,0,.12)); }\",\n );\n const note = (cls: string, text: string) => {\n const d = document.createElement(\"div\");\n d.className = cls;\n d.textContent = text;\n root.appendChild(d);\n };\n if (!mp.isSignedIn()) return note(\"muted\", t.notSignedIn);\n note(\"muted\", t.loading);\n try {\n const svg = await mp.membership.cardSvg();\n root.innerHTML = `<style>${BASE_CSS}:host { display: block; max-width: var(--vimine-card-width, 600px); } svg { width: 100%; height: auto; display: block; border-radius: 24px; box-shadow: var(--vimine-card-shadow, 0 8px 30px rgba(0,0,0,.12)); }</style>${svg}`;\n this.dispatchEvent(\n new CustomEvent(\"vimine-card\", {\n detail: { loaded: true },\n bubbles: true,\n }),\n );\n } catch (err) {\n root.innerHTML = `<style>${BASE_CSS}</style>`;\n const code = (err as { code?: string })?.code;\n // `not_active`: the membership exists but has no card (pending, suspended, revoked) — a state, not a failure.\n const quiet = code === \"not_found\" || code === \"not_active\";\n note(\n quiet ? \"muted\" : \"error\",\n code === \"not_found\"\n ? t.noMembership\n : code === \"not_active\"\n ? t.notActive\n : t.error,\n );\n }\n }\n}\n\n/** The hosted enrolment page of an association, in a language: the frame's address, and where a hand-off lands. */\n/**\n * How the hosted enrolment page looks inside the host site: its scheme, the accent of its buttons, links and the\n * association's name, and the ground behind its cards (`transparent`: the host page shows through). The page reads them\n * from its address — a framed page cannot see the host's CSS — and ignores anything that is not a colour or a keyword.\n */\nexport type EnrollAppearance = { scheme?: \"light\" | \"dark\"; accent?: string; background?: string; font?: Typeface };\n\n/** The faces the hosted page offers — served by Vimine itself — or `system`, the device's own. They set everything. */\nexport const TYPEFACES = [\n \"system\",\n \"inter\",\n \"roboto\",\n \"open-sans\",\n \"montserrat\",\n \"nunito\",\n \"lora\",\n \"merriweather\",\n \"roboto-slab\",\n] as const;\nexport type Typeface = (typeof TYPEFACES)[number];\n\nconst HEX = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i;\nconst appearanceQuery = (a?: EnrollAppearance): string => {\n if (!a) return \"\";\n const out: string[] = [];\n if (a.scheme === \"light\" || a.scheme === \"dark\") out.push(`scheme=${a.scheme}`);\n if (a.accent && HEX.test(a.accent)) out.push(`accent=${encodeURIComponent(a.accent.replace(/^#/, \"\"))}`);\n if (a.background === \"transparent\") out.push(\"background=transparent\");\n else if (a.background && HEX.test(a.background))\n out.push(`background=${encodeURIComponent(a.background.replace(/^#/, \"\"))}`);\n if (a.font && (TYPEFACES as readonly string[]).includes(a.font)) out.push(`font=${a.font}`);\n return out.length ? `&${out.join(\"&\")}` : \"\";\n};\n\nexport const enrollUrl = (appUrl: string, slug: string, lang: string, appearance?: EnrollAppearance): string =>\n `${appUrl.replace(/\\/+$/, \"\")}/enroll/${encodeURIComponent(slug)}?locale=${encodeURIComponent(lang)}${appearanceQuery(appearance)}`;\n\n/**\n * The same page, opened FROM an event: the person joins the association and asks for a place at the event in one go.\n * The request carries the event; the place is confirmed, or held until the membership is active.\n */\nexport const eventEnrollUrl = (\n appUrl: string,\n slug: string,\n event: string,\n lang: string,\n): string =>\n `${enrollUrl(appUrl, slug, lang)}&event=${encodeURIComponent(event)}`;\n\n/** Any CSS colour (a name, `rgb()`, `hsl()`, a hex) as `#rrggbb`, resolved by the browser; null when it is none. */\nconst hexColour = (root: ShadowRoot, value: string): string | null => {\n const v = value.trim();\n if (!v) return null;\n const probe = document.createElement(\"span\");\n probe.style.color = v;\n if (!probe.style.color) return null;\n root.appendChild(probe);\n const m = /rgba?\\(([^)]+)\\)/.exec(getComputedStyle(probe).color);\n probe.remove();\n const parts = (m?.[1] ?? \"\").split(/[\\s,/]+/).filter(Boolean).map(Number);\n if (parts.length < 3) return null;\n const [r = 0, g = 0, b = 0, alpha] = parts;\n if (alpha === 0) return null;\n return `#${[r, g, b].map((n) => Math.round(n).toString(16).padStart(2, \"0\")).join(\"\")}`;\n};\n\n/**\n * The page's look from the host's CSS: `--vimine-scheme` (light | dark), `--vimine-accent` and `--vimine-background` (a\n * colour, or `transparent`), `--vimine-typeface` (one of TYPEFACES) — custom properties inherit, so one rule on `:root`\n * styles every Vimine element at once.\n */\nconst appearanceOf = (el: HTMLElement, root: ShadowRoot): EnrollAppearance => {\n const css = getComputedStyle(el);\n const read = (name: string) => css.getPropertyValue(name).trim();\n const out: EnrollAppearance = {};\n const scheme = read(\"--vimine-scheme\");\n if (scheme === \"light\" || scheme === \"dark\") out.scheme = scheme;\n const accent = hexColour(root, read(\"--vimine-accent\"));\n if (accent) out.accent = accent;\n const background = read(\"--vimine-background\");\n if (background === \"transparent\") out.background = \"transparent\";\n else {\n const bg = hexColour(root, background);\n if (bg) out.background = bg;\n }\n const typeface = read(\"--vimine-typeface\");\n if ((TYPEFACES as readonly string[]).includes(typeface)) out.font = typeface as Typeface;\n return out;\n};\n\n/**\n * `<vimine-enroll slug=\"…\" app-url=\"https://app.vimine.network\" height=\"900\" lang=\"en\">` — the hosted enrolment form.\n *\n * Styled like the other elements, through CSS custom properties on the element or any ancestor:\n *\n * vimine-enroll { --vimine-scheme: light; --vimine-accent: #1e3a5f; --vimine-background: transparent; }\n *\n * `--vimine-scheme` the page's scheme; `--vimine-accent` its buttons, links and the association's name (moved towards\n * the page's ink when it would not read on its cards); `--vimine-background` the ground behind the cards;\n * `--vimine-typeface` the face of the whole page, fields included — one of TYPEFACES, served by Vimine (a framed page\n * cannot use the host's fonts). The frame is styled once, when the element connects.\n *\n * The form opens in the element's language (`lang` on the element or the page; Italian by default). Someone who already\n * has a Vimine account need not fill it: the form offers *Continua su Vimine*, which opens the hosted page in a new\n * tab — there their session is recognised and they join in one step (the association's statuto and privacy notice, and\n * nothing they have already told Vimine). It is a hand-off and not a sign-in inside the frame because a browser keeps a\n * framed page's session apart from the same site opened directly; the frame's sandbox lets that tab open as an ordinary\n * page (`allow-popups-to-escape-sandbox`).\n */\nexport class VimineEnroll extends HTMLElement {\n connectedCallback(): void {\n const slug = this.getAttribute(\"slug\");\n const root = shadow(\n this,\n \":host { display: block; } iframe { width: 100%; border: 0; border-radius: var(--vimine-radius, 16px); background: transparent; }\",\n );\n if (!slug) {\n const e = document.createElement(\"div\");\n e.className = \"error\";\n e.textContent = \"vimine-enroll: missing slug\";\n root.appendChild(e);\n return;\n }\n const appUrl = (\n this.getAttribute(\"app-url\") ||\n client().options.appUrl ||\n \"https://app.vimine.network\"\n ).replace(/\\/+$/, \"\");\n const frame = document.createElement(\"iframe\");\n frame.src = enrollUrl(appUrl, slug, langOf(this), appearanceOf(this, root));\n frame.title = \"Vimine\";\n frame.loading = \"lazy\";\n frame.style.height = `${Number(this.getAttribute(\"height\")) || 900}px`;\n frame.setAttribute(\n \"sandbox\",\n \"allow-forms allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox\",\n );\n root.appendChild(frame);\n }\n}\n\nconst money = (amount: number, currency: string, lang: Lang): string => {\n try {\n return new Intl.NumberFormat(INTL[lang], {\n style: \"currency\",\n currency: currency || \"EUR\",\n }).format(amount);\n } catch {\n return `${amount.toFixed(2)} ${currency}`;\n }\n};\nconst when = (iso: string, tz: string, lang: Lang): string => {\n try {\n return new Date(iso).toLocaleString(INTL[lang], {\n timeZone: tz,\n dateStyle: \"full\",\n timeStyle: \"short\",\n });\n } catch {\n return new Date(iso).toLocaleString();\n }\n};\n\n/**\n * `<vimine-events slug=\"…\" filter=\"upcoming\" limit=\"10\" detail-url=\"/eventi/{slug}\">` — the association's events:\n * the public ones for a visitor (no sign-in), every published one for a signed-in member, each with its registration\n * types (contribution, places left) and a register button (`registrations:write`). Fires `vimine-registration`\n * `{ registration }` after a registration. `detail-url` (with `{slug}`) adds a details link.\n *\n * A VISITOR is offered a way in, not a bare sign-in: *Iscriviti all’associazione e prenota* opens the association's\n * hosted enrolment page with the event (a new tab; `app-url` as on `<vimine-enroll>`) — they join and ask for the place\n * in one go — and *Sono già socio: accedi* signs a member in here. The first is shown while the event has a registration\n * that can be had and the association takes enrolment requests; otherwise the sign-in alone.\n */\nexport class VimineEvents extends HTMLElement {\n private unsubscribe: (() => void) | null = null;\n private state: Record<string, Registration> = {};\n connectedCallback(): void {\n void this.render();\n this.unsubscribe = client().onChange(() => void this.render());\n }\n disconnectedCallback(): void {\n this.unsubscribe?.();\n this.unsubscribe = null;\n }\n private async render(): Promise<void> {\n const mp = client();\n const lang = langOf(this);\n const t = STRINGS[lang];\n const root = shadow(\n this,\n /* CSS */ `:host { display: block; }\n.event { border: 1px solid var(--vimine-border, #e5e5e5); border-radius: var(--vimine-radius, 16px); padding: var(--vimine-padding, 1rem); margin: 0 0 1rem; }\n.event h3 { margin: 0 0 .25rem; font-size: 1.15em; } .event img { width: 100%; border-radius: var(--vimine-radius, 16px); margin-bottom: .75rem; display: block; }\n.type { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .5rem 0; border-top: 1px solid var(--vimine-border, #eee); }\n.type .n { font-weight: 600; } .type button { padding: .45rem .9rem; } a { color: var(--vimine-accent, #0a0e1a); }\n.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; padding-top: .75rem; border-top: 1px solid var(--vimine-border, #eee); }\na.button { display: inline-block; text-decoration: none; border-radius: var(--vimine-radius, 999px); padding: var(--vimine-padding, 0.65rem 1.1rem);\n background: var(--vimine-accent, #0a0e1a); color: var(--vimine-accent-contrast, #fff); font-weight: 600; }\nbutton.link { background: none; color: var(--vimine-accent, #0a0e1a); padding: 0; border-radius: 0; text-decoration: underline; font-weight: 400; }`,\n );\n const note = (cls: string, text: string): void => {\n const d = document.createElement(\"div\");\n d.className = cls;\n d.textContent = text;\n root.appendChild(d);\n };\n note(\"muted\", t.loading);\n const slug = this.getAttribute(\"slug\") || \"\";\n const filter = (this.getAttribute(\"filter\") || \"upcoming\") as\n | \"upcoming\"\n | \"past\"\n | \"cancelled\"\n | \"all\";\n const limit = Number(this.getAttribute(\"limit\")) || undefined;\n let items: Event[];\n // For a visitor: does the association take enrolment requests? Only then is joining a way to a place. A side\n // read — a failure leaves the sign-in alone.\n let joinable = false;\n try {\n const params = { filter, ...(limit ? { limit } : {}) };\n items = mp.isSignedIn()\n ? (await mp.events.list(params)).items\n : (await mp.public.events.list(slug, params)).items;\n if (!mp.isSignedIn() && slug)\n joinable = await mp.public\n .association(slug)\n .then((config) => config.aps.accepting_requests === true)\n .catch(() => false);\n } catch {\n root.innerHTML = `<style>${BASE_CSS}</style>`;\n return note(\"error\", t.error);\n }\n root.innerHTML = root.querySelector(\"style\")!.outerHTML;\n if (!items.length) return note(\"muted\", t.noEvents);\n const detailUrl = this.getAttribute(\"detail-url\");\n const join = joinable\n ? {\n slug,\n appUrl: (\n this.getAttribute(\"app-url\") ||\n mp.options.appUrl ||\n \"https://app.vimine.network\"\n ).replace(/\\/+$/, \"\"),\n }\n : null;\n for (const ev of items)\n root.appendChild(this.card(ev, mp, lang, detailUrl, join));\n }\n private card(\n ev: Event,\n mp: Vimine,\n lang: Lang,\n detailUrl: string | null,\n join: { slug: string; appUrl: string } | null,\n ): HTMLElement {\n const t = STRINGS[lang];\n const el = document.createElement(\"article\");\n el.className = \"event\";\n if (ev.cover_url) {\n const img = document.createElement(\"img\");\n img.src = ev.cover_url;\n img.alt = \"\";\n el.appendChild(img);\n }\n const h = document.createElement(\"h3\");\n h.textContent = ev.title;\n el.appendChild(h);\n const meta = document.createElement(\"div\");\n meta.className = \"muted\";\n meta.textContent = `${when(ev.starts_at, ev.timezone, lang)}${ev.location ? ` · ${ev.location.name || ev.location.address || \"\"}` : \"\"}`;\n el.appendChild(meta);\n if (ev.summary) {\n const p = document.createElement(\"p\");\n p.textContent = ev.summary;\n el.appendChild(p);\n }\n if (detailUrl) {\n const a = document.createElement(\"a\");\n a.href = detailUrl.replace(\"{slug}\", encodeURIComponent(ev.slug));\n a.textContent = t.details;\n el.appendChild(a);\n }\n const mine = this.state[ev.id];\n if (mine) {\n const d = document.createElement(\"div\");\n d.className = \"muted\";\n d.textContent = mine.status === \"confirmed\" ? t.registered : t.reserved;\n el.appendChild(d);\n return el;\n }\n if (ev.status === \"published\")\n for (const tp of ev.registration_types)\n el.appendChild(this.typeRow(ev, tp, mp, lang));\n // A visitor: one call for the event, under its registrations — join and book on the hosted page, or sign in here.\n if (\n ev.status === \"published\" &&\n !mp.isSignedIn() &&\n ev.registration_types.some((tp) => tp.open)\n ) {\n const actions = document.createElement(\"div\");\n actions.className = \"actions\";\n const signIn = document.createElement(\"button\");\n signIn.type = \"button\";\n signIn.addEventListener(\n \"click\",\n () =>\n void mp.signIn({\n scopes: [\n \"events:read\",\n \"registrations:read\",\n \"registrations:write\",\n ],\n }),\n );\n if (join) {\n const a = document.createElement(\"a\");\n a.className = \"button\";\n a.href = eventEnrollUrl(join.appUrl, join.slug, ev.slug, lang);\n a.target = \"_blank\";\n a.rel = \"noopener\";\n a.textContent = t.joinAndBook;\n actions.appendChild(a);\n signIn.className = \"link\";\n signIn.textContent = t.alreadyMember;\n } else signIn.textContent = t.signInToRegister;\n actions.appendChild(signIn);\n el.appendChild(actions);\n }\n return el;\n }\n private typeRow(\n ev: Event,\n tp: RegistrationType,\n mp: Vimine,\n lang: Lang,\n ): HTMLElement {\n const t = STRINGS[lang];\n const row = document.createElement(\"div\");\n row.className = \"type\";\n const left = document.createElement(\"div\");\n const n = document.createElement(\"div\");\n n.className = \"n\";\n n.textContent = `${tp.name} · ${tp.amount > 0 ? money(tp.amount, tp.currency, lang) : t.free}`;\n left.appendChild(n);\n const s = document.createElement(\"div\");\n s.className = \"muted\";\n s.textContent = [\n tp.remaining != null ? placesLabel(tp.remaining, lang) : \"\",\n tp.reason ? t.reason[tp.reason] || tp.reason : \"\",\n ]\n .filter(Boolean)\n .join(\" · \");\n left.appendChild(s);\n row.appendChild(left);\n // A visitor has the event's own call below the registrations (`card`): no button per registration.\n if (!mp.isSignedIn()) return row;\n const btn = document.createElement(\"button\");\n btn.type = \"button\";\n btn.textContent = t.register;\n btn.disabled = !tp.open;\n btn.addEventListener(\"click\", async () => {\n btn.disabled = true;\n try {\n const reg = await mp.registrations.create(ev.slug, {\n registration_type: tp.uid,\n });\n this.state[ev.id] = reg;\n this.dispatchEvent(\n new CustomEvent(\"vimine-registration\", {\n detail: { registration: reg },\n bubbles: true,\n }),\n );\n void this.render();\n } catch (err) {\n btn.disabled = false;\n const reasons = (\n (err as { errors?: { code?: string }[] })?.errors || []\n )\n .map((e) => t.reason[e.code || \"\"] || e.code)\n .filter(Boolean);\n s.textContent = reasons.length ? reasons.join(\", \") : t.error;\n s.className = \"error\";\n }\n });\n row.appendChild(btn);\n return row;\n }\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type PublicApi } from './public.js';
2
2
  import { type StorageKind, type TokenStorage } from './storage.js';
3
- import type { AcceptanceInput, AcceptanceResult, Accepted, Card, Connection, Eligibility, Event, EventList, EventListParams, LocaleParam, Me, Membership, MembershipEvents, MembershipRequest, MembershipRequestResult, MeUpdate, MyAcceptances, NetworkOptIn, Registration, RegistrationList, RegistrationRequest, RenewResult, Scope, StatutoAccept, StatutoInfo } from './types.js';
3
+ import type { AcceptanceInput, AcceptanceResult, Accepted, Card, Connection, Eligibility, Event, EventList, EventListParams, Locale, LocaleParam, Me, Membership, MembershipEvents, MembershipRequest, MembershipRequestResult, MeUpdate, MyAcceptances, NetworkOptIn, Registration, RegistrationList, RegistrationRequest, RenewResult, Scope, StatutoAccept, StatutoInfo } from './types.js';
4
4
  export { VimineError } from './errors.js';
5
5
  export type { FieldError, ProblemDetails } from './errors.js';
6
6
  export { createPkce, createState, createVerifier, createChallenge, base64url } from './pkce.js';
@@ -25,8 +25,8 @@ export interface VimineOptions {
25
25
  storage?: StorageKind | TokenStorage;
26
26
  /** Storage key prefix (default derived from the client id). */
27
27
  storageKey?: string;
28
- /** UI language of the hosted pages. */
29
- locale?: 'it' | 'en';
28
+ /** UI language of the hosted pages (a platform language; Chinese by script: `zh-Hans`, `zh-Hant`). */
29
+ locale?: Locale;
30
30
  /** Custom fetch (tests, polyfills). */
31
31
  fetch?: typeof fetch;
32
32
  /** How to leave the page (default: the top window's `location.assign`). */
@@ -157,7 +157,7 @@ export declare class Vimine {
157
157
  */
158
158
  readonly legal: {
159
159
  acceptances: (params?: {
160
- locale?: "it" | "en";
160
+ locale?: Locale;
161
161
  }) => Promise<MyAcceptances>;
162
162
  record: (body: AcceptanceInput, opts?: {
163
163
  idempotencyKey?: string;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,8GAA8G;AAC9G,iCAAiC;AACjC,EAAE;AACF,mGAAmG;AACnG,gHAAgH;AAChH,+GAA+G;AAC/G,kDAAkD;AAClD,EAAE;AACF,8GAA8G;AAC9G,uDAAuD;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAkB,MAAM,aAAa,CAAC;AACjI,OAAO,EAAE,cAAc,EAAuC,MAAM,cAAc,CAAC;AA8BnF,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAChG,OAAO,EAAE,a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;QACD,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC9D,CAAC;IAAC,MAAM,CAAC;QACL,YAAY;IAChB,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,GAAW,EAAQ,EAAE;IAC1C,MAAM,CAAC,GAAG,UAA6E,CAAC;IACxF,MAAM,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC;IAC5B,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IACnD,6FAA6F;IAC7F,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC,CAAC","sourcesContent":["// @vimine/sdk — Sign in with Vimine (OAuth 2.1 + PKCE) and the member API, for websites and apps of\n// associations on vimine.network. Zero dependencies; browser-first (WebCrypto, fetch), also fine in Node ≥ 18\n// with a storage of your choice.\n//\n// const mp = new Vimine({ clientId: 'vmc_…', redirectUri: 'https://www.example.org/callback' });\n// await mp.signIn(); // → the hosted sign-in + consent page, then back to redirectUri\n// await mp.handleRedirect(); // on the callback page: exchanges the code, stores the session\n// const membership = await mp.membership.get();\n//\n// The member's password is never typed into your page: sign-in happens on vimine.network, your site only ever\n// holds tokens for the permissions the member granted.\nimport { VimineError } from './errors.js';\nimport { createPkce, createState } from './pkce.js';\nimport { DEFAULT_API_URL, eventQuery, jsonOrThrow, localeQuery, publicApi, withNetworkError, type PublicApi } from './public.js';\nimport { resolveStorage, type StorageKind, type TokenStorage } from './storage.js';\nimport type {\n AcceptanceInput,\n AcceptanceResult,\n Accepted,\n Card,\n Connection,\n Eligibility,\n Event,\n EventList,\n EventListParams,\n LocaleParam,\n Me,\n Membership,\n MembershipEvents,\n MembershipRequest,\n MembershipRequestResult,\n MeUpdate,\n MyAcceptances,\n NetworkOptIn,\n Registration,\n RegistrationList,\n RegistrationRequest,\n RenewResult,\n Scope,\n StatutoAccept,\n StatutoInfo,\n TokenResponse\n} from './types.js';\n\nexport { VimineError } from './errors.js';\nexport type { FieldError, ProblemDetails } from './errors.js';\nexport { createPkce, createState, createVerifier, createChallenge, base64url } from './pkce.js';\nexport { MemoryStorage, type StorageKind, type TokenStorage } from './storage.js';\n/** The OpenAPI document's own vocabulary (generated from openapi/v1.json — `npm run spec:types`). */\nexport type * as Spec from './generated.js';\nexport { publicApi, DEFAULT_API_URL, eventQuery, type PublicApi, type PublicOptions } from './public.js';\nexport type * from './types.js';\n\nexport const DEFAULT_APP_URL = 'https://app.vimine.network';\n/** Refresh this long before the access token expires. */\nconst REFRESH_LEAD_MS = 30_000;\n\nexport interface VimineOptions {\n /** Your client id (`vmc_…`), from the association's developer console. */\n clientId: string;\n /** One of the redirect URIs registered for the client — the page that calls `handleRedirect()`. */\n redirectUri: string;\n /** Default permissions to ask for; `signIn()` may override. */\n scopes?: Scope[];\n /** The API origin (default production). */\n apiUrl?: string;\n /** The app origin that hosts sign-in and consent (default production). */\n appUrl?: string;\n /** Where tokens live: `session` (default, per tab), `local` (shared across tabs), `memory`, or your own adapter. */\n storage?: StorageKind | TokenStorage;\n /** Storage key prefix (default derived from the client id). */\n storageKey?: string;\n /** UI language of the hosted pages. */\n locale?: 'it' | 'en';\n /** Custom fetch (tests, polyfills). */\n fetch?: typeof fetch;\n /** How to leave the page (default: the top window's `location.assign`). */\n navigate?: (url: string) => void;\n}\n\nexport interface SignInOptions {\n scopes?: Scope[];\n /** `login` forces the credential form even with a live session; `consent` forces the consent screen. */\n prompt?: 'login' | 'consent';\n /** Your own state to get back after the redirect (kept in storage, not sent). */\n returnTo?: string;\n}\n\nexport interface Session {\n accessToken: string;\n refreshToken: string | null;\n /** Absolute time (ms) the access token expires. */\n expiresAt: number;\n scope: Scope[];\n /** The member's pairwise subject for this association. */\n sub: string | null;\n /** `test` for sessions minted through a sandbox client. */\n mode?: 'live' | 'test';\n}\n\nexport interface RedirectResult {\n session: Session;\n /** The `returnTo` given to `signIn()`, if any. */\n returnTo: string | null;\n}\n\nexport interface SignOutOptions {\n /** Also end the member's Vimine session (single sign-out): leaves the page for the app's logout route. */\n everywhere?: boolean;\n /** Where the app sends the member afterwards (must be on a registered origin); default: `redirectUri`. */\n postLogoutRedirectUri?: string;\n state?: string;\n}\n\ninterface PendingFlow {\n verifier: string;\n state: string;\n redirectUri: string;\n scope: string;\n returnTo: string | null;\n createdAt: number;\n}\n\nconst decodeJwtPayload = (token: string): Record<string, unknown> | null => {\n try {\n const part = token.split('.')[1];\n if (!part) return null;\n const json = atob(part.replace(/-/g, '+').replace(/_/g, '/'));\n return JSON.parse(json) as Record<string, unknown>;\n } catch {\n return null;\n }\n};\n\nexport class Vimine {\n readonly options: Required<Pick<VimineOptions, 'clientId' | 'redirectUri' | 'apiUrl' | 'appUrl' | 'locale'>> & VimineOptions;\n /** The public, credential-less endpoints (verify a card, an association's profile, fiscal code, card keys). */\n readonly public: PublicApi;\n private readonly storage: TokenStorage;\n private readonly fetchImpl: typeof fetch;\n private readonly keys: { session: string; flow: string };\n private refreshing: Promise<Session> | null = null;\n private readonly listeners = new Set<(session: Session | null) => void>();\n\n constructor(options: VimineOptions) {\n if (!options?.clientId) throw new VimineError('invalid_options', 'clientId is required');\n if (!options.redirectUri) throw new VimineError('invalid_options', 'redirectUri is required');\n this.options = {\n ...options,\n apiUrl: (options.apiUrl || DEFAULT_API_URL).replace(/\\/+$/, ''),\n appUrl: (options.appUrl || DEFAULT_APP_URL).replace(/\\/+$/, ''),\n locale: options.locale || 'it'\n };\n this.storage = resolveStorage(options.storage);\n this.fetchImpl = options.fetch || globalThis.fetch.bind(globalThis);\n const prefix = options.storageKey || `vimine:${options.clientId}:`;\n this.keys = { session: `${prefix}session`, flow: `${prefix}flow` };\n this.public = publicApi({ apiUrl: this.options.apiUrl, fetch: this.fetchImpl });\n // Sign-out (or sign-in) in another tab, when tokens live in localStorage.\n const w = globalThis as unknown as { addEventListener?: (t: string, l: (e: StorageEvent) => void) => void };\n if (options.storage === 'local' && typeof w.addEventListener === 'function') {\n w.addEventListener('storage', (e) => {\n if (e.key === this.keys.session) this.emit(this.getSession());\n });\n }\n }\n\n // ---- sign-in -----------------------------------------------------------------------------------\n\n /** Build the authorization URL and remember the pending flow. Use `signIn()` unless you render the link yourself. */\n async createSignInUrl(opts: SignInOptions = {}): Promise<string> {\n const { verifier, challenge } = await createPkce();\n const state = createState();\n const scopes = opts.scopes || this.options.scopes || ['profile:read', 'membership:read'];\n const flow: PendingFlow = { verifier, state, redirectUri: this.options.redirectUri, scope: scopes.join(' '), returnTo: opts.returnTo ?? null, createdAt: Date.now() };\n this.storage.set(this.keys.flow, JSON.stringify(flow));\n const u = new URL(`${this.options.appUrl}/authorize`);\n u.searchParams.set('client_id', this.options.clientId);\n u.searchParams.set('redirect_uri', this.options.redirectUri);\n u.searchParams.set('response_type', 'code');\n u.searchParams.set('state', state);\n u.searchParams.set('code_challenge', challenge);\n u.searchParams.set('code_challenge_method', 'S256');\n u.searchParams.set('scope', flow.scope);\n u.searchParams.set('ui_locales', this.options.locale);\n if (opts.prompt) u.searchParams.set('prompt', opts.prompt);\n return u.toString();\n }\n\n /**\n * Start the sign-in: navigates the TOP window to the hosted sign-in + consent page. Call it from a user\n * gesture (a click). From inside a cross-origin or sandboxed frame the navigation is refused (`framed`):\n * the hosted page is never shown in a frame.\n */\n async signIn(opts: SignInOptions = {}): Promise<void> {\n const url = await this.createSignInUrl(opts);\n const nav = this.options.navigate || defaultNavigate;\n try {\n nav(url);\n } catch (err) {\n this.storage.remove(this.keys.flow);\n throw new VimineError('framed', 'Sign in with Vimine cannot start from this frame', { cause: err });\n }\n }\n\n /** Does this URL carry the parameters of a sign-in redirect (`code`+`state` or `error`)? */\n hasRedirectParams(url?: string): boolean {\n const params = paramsOf(url);\n return !!params && ((params.has('code') && params.has('state')) || params.has('error'));\n }\n\n /**\n * On the redirect page: exchange the authorization code for tokens and store the session. Returns null when\n * the URL carries no sign-in parameters. Throws `state_mismatch` / `no_flow` for a redirect this client did\n * not start, and the OAuth error (`access_denied`, …) when the member did not authorize.\n */\n async handleRedirect(opts: { url?: string; cleanUrl?: boolean } = {}): Promise<RedirectResult | null> {\n const params = paramsOf(opts.url);\n if (!params || !this.hasRedirectParams(opts.url)) return null;\n const raw = this.storage.get(this.keys.flow);\n const flow: PendingFlow | null = raw ? (JSON.parse(raw) as PendingFlow) : null;\n const finish = () => {\n this.storage.remove(this.keys.flow);\n if (opts.cleanUrl !== false) cleanRedirectParams();\n };\n if (params.has('error')) {\n finish();\n throw new VimineError(params.get('error') || 'access_denied', params.get('error_description') || 'The member did not authorize this app');\n }\n if (!flow) throw new VimineError('no_flow', 'No sign-in was started from this browser (storage empty or expired)');\n if (params.get('state') !== flow.state) throw new VimineError('state_mismatch', 'The redirect does not match the sign-in that was started');\n const tokens = await this.tokenRequest({\n grant_type: 'authorization_code',\n code: params.get('code') || '',\n code_verifier: flow.verifier,\n client_id: this.options.clientId,\n redirect_uri: flow.redirectUri\n });\n finish();\n const session = this.storeTokens(tokens);\n return { session, returnTo: flow.returnTo };\n }\n\n // ---- session -----------------------------------------------------------------------------------\n\n getSession(): Session | null {\n const raw = this.storage.get(this.keys.session);\n if (!raw) return null;\n try {\n return JSON.parse(raw) as Session;\n } catch {\n return null;\n }\n }\n\n isSignedIn(): boolean {\n return !!this.getSession();\n }\n\n /** A valid access token, refreshed when about to expire. Throws `not_signed_in` when there is no session. */\n async getAccessToken(): Promise<string> {\n const session = this.getSession();\n if (!session) throw new VimineError('not_signed_in', 'No Vimine session: call signIn() first');\n if (session.expiresAt - Date.now() > REFRESH_LEAD_MS) return session.accessToken;\n return (await this.refresh()).accessToken;\n }\n\n /** Rotate the session (single-flight). An unusable refresh token ends the session. */\n refresh(): Promise<Session> {\n if (this.refreshing) return this.refreshing;\n this.refreshing = (async () => {\n const session = this.getSession();\n if (!session?.refreshToken) {\n this.clearSession();\n throw new VimineError('not_signed_in', 'No refresh token: sign in again');\n }\n try {\n const tokens = await this.tokenRequest({ grant_type: 'refresh_token', refresh_token: session.refreshToken, client_id: this.options.clientId });\n return this.storeTokens(tokens);\n } catch (err) {\n if (err instanceof VimineError && err.isAuthError) this.clearSession();\n throw err;\n } finally {\n this.refreshing = null;\n }\n })();\n return this.refreshing;\n }\n\n /** Revoke the session (RFC 7009) and forget it; with `everywhere`, also end the member's Vimine session. */\n async signOut(opts: SignOutOptions = {}): Promise<void> {\n const session = this.getSession();\n this.clearSession();\n if (session?.refreshToken) {\n await withNetworkError(\n this.fetchImpl(`${this.options.apiUrl}/v1/oauth/revoke`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n body: new URLSearchParams({ token: session.refreshToken, token_type_hint: 'refresh_token' }).toString()\n })\n ).catch(() => {\n /* revocation is best effort: the tokens are already forgotten here */\n });\n }\n if (opts.everywhere) {\n const u = new URL(`${this.options.appUrl}/oauth/logout`);\n u.searchParams.set('client_id', this.options.clientId);\n u.searchParams.set('post_logout_redirect_uri', opts.postLogoutRedirectUri || this.options.redirectUri);\n if (opts.state) u.searchParams.set('state', opts.state);\n (this.options.navigate || defaultNavigate)(u.toString());\n }\n }\n\n /** Subscribe to session changes (sign-in, refresh, sign-out; other tabs when storage is `local`). */\n onChange(listener: (session: Session | null) => void): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n // ---- API ---------------------------------------------------------------------------------------\n\n /** An authenticated call to the API; JSON in and out, problem details as `VimineError`, one retry after a refresh on 401. */\n async request<T>(path: string, init: RequestInit & { idempotencyKey?: string } = {}): Promise<T> {\n const attempt = async (token: string): Promise<Response> => {\n const headers: Record<string, string> = { Accept: 'application/json', Authorization: `Bearer ${token}` };\n if (init.body !== undefined) headers['Content-Type'] = 'application/json';\n if (init.idempotencyKey) headers['Idempotency-Key'] = init.idempotencyKey;\n const given = init.headers as Record<string, string> | undefined;\n const { idempotencyKey: _ignored, ...rest } = init;\n return this.fetchImpl(`${this.options.apiUrl}${path}`, { ...rest, headers: { ...headers, ...(given || {}) } });\n };\n let res = await withNetworkError(attempt(await this.getAccessToken()));\n if (res.status === 401) {\n const refreshed = await this.refresh();\n res = await withNetworkError(attempt(refreshed.accessToken));\n }\n return jsonOrThrow<T>(res);\n }\n\n /** The member's profile (`profile:read` / `profile:write`). */\n readonly me = {\n get: (): Promise<Me> => this.request<Me>('/v1/me'),\n /**\n * A fiscal code that disagrees with the particulars answers 422 with a `codicefiscale_mismatch` entry in\n * `errors[]`; when that entry says `confirmable: true` the person may confirm it: send `codicefiscale_confirmed: true`.\n */\n update: (patch: MeUpdate): Promise<Me> => this.request<Me>('/v1/me', { method: 'PATCH', body: JSON.stringify(patch) })\n };\n\n /** The member's membership in this association (`membership:read`, `membership:request`, `statuto:accept`). */\n readonly membership = {\n get: (): Promise<Membership> => this.request<Membership>('/v1/me/membership'),\n /**\n * Ask for a membership. 422 `identification_required` when the profile is not identified yet — a fiscal code, or\n * date, place and country of birth: `errors[]` names what is missing; complete it with `me.update()` and ask again.\n */\n request: (body: MembershipRequest, opts: { idempotencyKey?: string } = {}): Promise<MembershipRequestResult> =>\n this.request<MembershipRequestResult>('/v1/me/membership', { method: 'POST', body: JSON.stringify(body), idempotencyKey: opts.idempotencyKey || createState() }),\n events: (params: { limit?: number; cursor?: string } = {}): Promise<MembershipEvents> => {\n const q = new URLSearchParams();\n if (params.limit) q.set('limit', String(params.limit));\n if (params.cursor) q.set('cursor', params.cursor);\n const qs = q.toString();\n return this.request<MembershipEvents>(`/v1/me/membership/events${qs ? `?${qs}` : ''}`);\n },\n statuto: (): Promise<StatutoInfo> => this.request<StatutoInfo>('/v1/me/membership/statuto'),\n acceptStatuto: (body: StatutoAccept): Promise<{ accepted: true; version: number }> =>\n this.request('/v1/me/membership/statuto/accept', { method: 'POST', body: JSON.stringify(body) }),\n /** The signed card token and its window. 409 `not_active` unless the membership is active: only an active membership has a card. */\n card: (): Promise<Card> => this.request<Card>('/v1/me/membership/card'),\n /** Self-service renewal (`membership:request`): renewed at once for a free type with no approval gate, else a request. */\n renew: (body: StatutoAccept, opts: { idempotencyKey?: string } = {}): Promise<RenewResult> =>\n this.request<RenewResult>('/v1/me/membership/renew', { method: 'POST', body: JSON.stringify({ accept_statuto: body }), idempotencyKey: opts.idempotencyKey || createState() }),\n /** Network consent (`network:manage`); 409 `not_eligible` when the membership type is not in the network. */\n setNetworkOptIn: (optIn: boolean): Promise<NetworkOptIn> => this.request<NetworkOptIn>('/v1/me/membership/network-opt-in', { method: 'PATCH', body: JSON.stringify({ opt_in: optIn }) }),\n /** A Save-to-Google-Wallet link for the card (`membership:read`); 409 `not_active` when there is no card yet, 503 when the deployment has no wallet issuer. */\n googleWalletUrl: (): Promise<{ url: string }> => this.request<{ url: string }>('/v1/me/membership/wallet/google'),\n /** The card as SVG markup (with the current QR) — inline it, or hand it to `<vimine-card>`. 409 `not_active` unless the membership is active. */\n cardSvg: async (): Promise<string> => {\n const token = await this.getAccessToken();\n const res = await withNetworkError(this.fetchImpl(`${this.options.apiUrl}/v1/me/membership/card.svg`, { headers: { Accept: 'image/svg+xml', Authorization: `Bearer ${token}` } }));\n if (!res.ok) throw await VimineError.fromResponse(res);\n return res.text();\n },\n /** Ask the API to e-mail the member their card (SVG + QR attached). 409 `not_active` unless the membership is active. */\n emailCard: (): Promise<Accepted> => this.request<Accepted>('/v1/me/membership/card/email', { method: 'POST' })\n };\n\n /**\n * The member's legal acceptances (`legal:read`, `legal:accept`): what they accepted or acknowledged, what is still\n * pending — the account terms, the platform privacy notice, this association's notice to members — and the call\n * that records one at the in-force version your app showed (422 `<kind>_outdated` otherwise).\n */\n readonly legal = {\n acceptances: (params: { locale?: 'it' | 'en' } = {}): Promise<MyAcceptances> => this.request<MyAcceptances>(`/v1/me/acceptances${params.locale ? `?locale=${params.locale}` : ''}`),\n record: (body: AcceptanceInput, opts: { idempotencyKey?: string } = {}): Promise<AcceptanceResult> =>\n this.request<AcceptanceResult>('/v1/me/acceptances', { method: 'POST', body: JSON.stringify(body), idempotencyKey: opts.idempotencyKey || createState() })\n };\n\n /** Events of the association (`events:read`): published ones, members-only included — the public ones need no sign-in: `publicApi().events`. */\n readonly events = {\n /** `filter`: upcoming (default) | past | cancelled | all; `from` / `to` bound `starts_at`. */\n list: (params: EventListParams = {}): Promise<EventList> => this.request<EventList>(`/v1/events${eventQuery(params)}`),\n get: (slug: string, params: LocaleParam = {}): Promise<Event> => this.request<Event>(`/v1/events/${encodeURIComponent(slug)}${localeQuery(params)}`),\n /** May the member register, per registration type, with reasons. */\n eligibility: (slug: string): Promise<Eligibility> => this.request<Eligibility>(`/v1/events/${encodeURIComponent(slug)}/eligibility`)\n };\n\n /** The member's event registrations (`registrations:read` / `registrations:write`). */\n readonly registrations = {\n /**\n * Register for an event: a free type answers `confirmed` with the QR `token`; a paid one answers `reserved`\n * with `payment_instructions` until the association records the contribution. `422 not_eligible` carries\n * the reasons. Retries are safe: an `Idempotency-Key` is generated unless you pass one.\n */\n create: (slug: string, body: RegistrationRequest, opts: { idempotencyKey?: string } = {}): Promise<Registration> =>\n this.request<Registration>(`/v1/events/${encodeURIComponent(slug)}/registrations`, { method: 'POST', body: JSON.stringify(body), idempotencyKey: opts.idempotencyKey || createState() }),\n /** The member's registrations, newest event first (`filter: 'upcoming'` for the ones still to come). */\n list: (params: { filter?: 'upcoming' | 'all' } = {}): Promise<RegistrationList> => this.request<RegistrationList>(`/v1/me/registrations${params.filter ? `?filter=${params.filter}` : ''}`),\n get: (id: string): Promise<Registration> => this.request<Registration>(`/v1/me/registrations/${encodeURIComponent(id)}`),\n /** Cancel inside the event's cancellation window — `409 window_closed` otherwise. */\n cancel: (id: string): Promise<Registration> => this.request<Registration>(`/v1/me/registrations/${encodeURIComponent(id)}`, { method: 'DELETE' }),\n /** The QR payload of a confirmed registration (what the door scans), or null. */\n tokenPayload: async (id: string): Promise<string | null> => (await this.request<Registration>(`/v1/me/registrations/${encodeURIComponent(id)}`)).token || null\n };\n\n /** The apps the member authorized in this association. */\n readonly connections = {\n list: (): Promise<{ items: Connection[] }> => this.request('/v1/me/connections'),\n revoke: (clientId: string): Promise<void> => this.request<void>(`/v1/me/connections/${encodeURIComponent(clientId)}`, { method: 'DELETE' })\n };\n\n // ---- internals ---------------------------------------------------------------------------------\n\n private async tokenRequest(form: Record<string, string>): Promise<TokenResponse> {\n const res = await withNetworkError(\n this.fetchImpl(`${this.options.apiUrl}/v1/oauth/token`, {\n method: 'POST',\n headers: { Accept: 'application/json', 'Content-Type': 'application/x-www-form-urlencoded' },\n body: new URLSearchParams(form).toString()\n })\n );\n return jsonOrThrow<TokenResponse>(res);\n }\n\n private storeTokens(tokens: TokenResponse): Session {\n const claims = decodeJwtPayload(tokens.access_token);\n const session: Session = {\n accessToken: tokens.access_token,\n refreshToken: tokens.refresh_token ?? this.getSession()?.refreshToken ?? null,\n expiresAt: Date.now() + Math.max(0, tokens.expires_in) * 1000,\n scope: String(tokens.scope || '').split(/\\s+/).filter(Boolean) as Scope[],\n sub: tokens.sub ?? (typeof claims?.sub === 'string' ? claims.sub : null),\n mode: claims?.mode === 'test' ? 'test' : 'live'\n };\n this.storage.set(this.keys.session, JSON.stringify(session));\n this.emit(session);\n return session;\n }\n\n private clearSession(): void {\n const had = !!this.storage.get(this.keys.session);\n this.storage.remove(this.keys.session);\n if (had) this.emit(null);\n }\n\n private emit(session: Session | null): void {\n for (const l of this.listeners) {\n try {\n l(session);\n } catch {\n /* a listener must not break the others */\n }\n }\n }\n}\n\nconst paramsOf = (url?: string): URLSearchParams | null => {\n if (url) {\n try {\n return new URL(url, 'http://localhost').searchParams;\n } catch {\n return null;\n }\n }\n const loc = (globalThis as unknown as { location?: Location }).location;\n return loc ? new URLSearchParams(loc.search) : null;\n};\n\nconst cleanRedirectParams = (): void => {\n const g = globalThis as unknown as { history?: History; location?: Location };\n if (!g.history || !g.location) return;\n const u = new URL(g.location.href);\n for (const k of ['code', 'state', 'error', 'error_description']) u.searchParams.delete(k);\n try {\n g.history.replaceState(g.history.state, '', u.toString());\n } catch {\n /* ignore */\n }\n};\n\nconst defaultNavigate = (url: string): void => {\n const w = globalThis as unknown as { top?: Window; self?: Window; location?: Location };\n const top = w.top || w.self;\n if (!top) throw new Error('No window to navigate');\n // Navigating the top window from a cross-origin frame throws — which is the refusal we want.\n top.location.assign(url);\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,8GAA8G;AAC9G,iCAAiC;AACjC,EAAE;AACF,mGAAmG;AACnG,gHAAgH;AAChH,+GAA+G;AAC/G,kDAAkD;AAClD,EAAE;AACF,8GAA8G;AAC9G,uDAAuD;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAkB,MAAM,aAAa,CAAC;AACjI,OAAO,EAAE,cAAc,EAAuC,MAAM,cAAc,CAAC;AA+BnF,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAChG,OAAO,EAAE,aAAa,EAAuC,MAAM,cAAc,CAAC;AAGlF,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAsC,MAAM,aAAa,CAAC;AAGzG,MAAM,CAAC,MAAM,eAAe,GAAG,4BAA4B,CAAC;AAC5D,yDAAyD;AACzD,MAAM,eAAe,GAAG,MAAM,CAAC;AAoE/B,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAkC,EAAE;IACvE,IAAI,CAAC;QACD,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,GAA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AAI,CAAC,CAAC,IAAI,CAAC;IAC5B,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IACnD,6FAA6F;IAC7F,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC,CAAC","sourcesContent":["// @vimine/sdk — Sign in with Vimine (OAuth 2.1 + PKCE) and the member API, for websites and apps of\n// associations on vimine.network. Zero dependencies; browser-first (WebCrypto, fetch), also fine in Node ≥ 18\n// with a storage of your choice.\n//\n// const mp = new Vimine({ clientId: 'vmc_…', redirectUri: 'https://www.example.org/callback' });\n// await mp.signIn(); // → the hosted sign-in + consent page, then back to redirectUri\n// await mp.handleRedirect(); // on the callback page: exchanges the code, stores the session\n// const membership = await mp.membership.get();\n//\n// The member's password is never typed into your page: sign-in happens on vimine.network, your site only ever\n// holds tokens for the permissions the member granted.\nimport { VimineError } from './errors.js';\nimport { createPkce, createState } from './pkce.js';\nimport { DEFAULT_API_URL, eventQuery, jsonOrThrow, localeQuery, publicApi, withNetworkError, type PublicApi } from './public.js';\nimport { resolveStorage, type StorageKind, type TokenStorage } from './storage.js';\nimport type {\n AcceptanceInput,\n AcceptanceResult,\n Accepted,\n Card,\n Connection,\n Eligibility,\n Event,\n EventList,\n EventListParams,\n Locale,\n LocaleParam,\n Me,\n Membership,\n MembershipEvents,\n MembershipRequest,\n MembershipRequestResult,\n MeUpdate,\n MyAcceptances,\n NetworkOptIn,\n Registration,\n RegistrationList,\n RegistrationRequest,\n RenewResult,\n Scope,\n StatutoAccept,\n StatutoInfo,\n TokenResponse\n} from './types.js';\n\nexport { VimineError } from './errors.js';\nexport type { FieldError, ProblemDetails } from './errors.js';\nexport { createPkce, createState, createVerifier, createChallenge, base64url } from './pkce.js';\nexport { MemoryStorage, type StorageKind, type TokenStorage } from './storage.js';\n/** The OpenAPI document's own vocabulary (generated from openapi/v1.json — `npm run spec:types`). */\nexport type * as Spec from './generated.js';\nexport { publicApi, DEFAULT_API_URL, eventQuery, type PublicApi, type PublicOptions } from './public.js';\nexport type * from './types.js';\n\nexport const DEFAULT_APP_URL = 'https://app.vimine.network';\n/** Refresh this long before the access token expires. */\nconst REFRESH_LEAD_MS = 30_000;\n\nexport interface VimineOptions {\n /** Your client id (`vmc_…`), from the association's developer console. */\n clientId: string;\n /** One of the redirect URIs registered for the client — the page that calls `handleRedirect()`. */\n redirectUri: string;\n /** Default permissions to ask for; `signIn()` may override. */\n scopes?: Scope[];\n /** The API origin (default production). */\n apiUrl?: string;\n /** The app origin that hosts sign-in and consent (default production). */\n appUrl?: string;\n /** Where tokens live: `session` (default, per tab), `local` (shared across tabs), `memory`, or your own adapter. */\n storage?: StorageKind | TokenStorage;\n /** Storage key prefix (default derived from the client id). */\n storageKey?: string;\n /** UI language of the hosted pages (a platform language; Chinese by script: `zh-Hans`, `zh-Hant`). */\n locale?: Locale;\n /** Custom fetch (tests, polyfills). */\n fetch?: typeof fetch;\n /** How to leave the page (default: the top window's `location.assign`). */\n navigate?: (url: string) => void;\n}\n\nexport interface SignInOptions {\n scopes?: Scope[];\n /** `login` forces the credential form even with a live session; `consent` forces the consent screen. */\n prompt?: 'login' | 'consent';\n /** Your own state to get back after the redirect (kept in storage, not sent). */\n returnTo?: string;\n}\n\nexport interface Session {\n accessToken: string;\n refreshToken: string | null;\n /** Absolute time (ms) the access token expires. */\n expiresAt: number;\n scope: Scope[];\n /** The member's pairwise subject for this association. */\n sub: string | null;\n /** `test` for sessions minted through a sandbox client. */\n mode?: 'live' | 'test';\n}\n\nexport interface RedirectResult {\n session: Session;\n /** The `returnTo` given to `signIn()`, if any. */\n returnTo: string | null;\n}\n\nexport interface SignOutOptions {\n /** Also end the member's Vimine session (single sign-out): leaves the page for the app's logout route. */\n everywhere?: boolean;\n /** Where the app sends the member afterwards (must be on a registered origin); default: `redirectUri`. */\n postLogoutRedirectUri?: string;\n state?: string;\n}\n\ninterface PendingFlow {\n verifier: string;\n state: string;\n redirectUri: string;\n scope: string;\n returnTo: string | null;\n createdAt: number;\n}\n\nconst decodeJwtPayload = (token: string): Record<string, unknown> | null => {\n try {\n const part = token.split('.')[1];\n if (!part) return null;\n const json = atob(part.replace(/-/g, '+').replace(/_/g, '/'));\n return JSON.parse(json) as Record<string, unknown>;\n } catch {\n return null;\n }\n};\n\nexport class Vimine {\n readonly options: Required<Pick<VimineOptions, 'clientId' | 'redirectUri' | 'apiUrl' | 'appUrl' | 'locale'>> & VimineOptions;\n /** The public, credential-less endpoints (verify a card, an association's profile, fiscal code, card keys). */\n readonly public: PublicApi;\n private readonly storage: TokenStorage;\n private readonly fetchImpl: typeof fetch;\n private readonly keys: { session: string; flow: string };\n private refreshing: Promise<Session> | null = null;\n private readonly listeners = new Set<(session: Session | null) => void>();\n\n constructor(options: VimineOptions) {\n if (!options?.clientId) throw new VimineError('invalid_options', 'clientId is required');\n if (!options.redirectUri) throw new VimineError('invalid_options', 'redirectUri is required');\n this.options = {\n ...options,\n apiUrl: (options.apiUrl || DEFAULT_API_URL).replace(/\\/+$/, ''),\n appUrl: (options.appUrl || DEFAULT_APP_URL).replace(/\\/+$/, ''),\n locale: options.locale || 'it'\n };\n this.storage = resolveStorage(options.storage);\n this.fetchImpl = options.fetch || globalThis.fetch.bind(globalThis);\n const prefix = options.storageKey || `vimine:${options.clientId}:`;\n this.keys = { session: `${prefix}session`, flow: `${prefix}flow` };\n this.public = publicApi({ apiUrl: this.options.apiUrl, fetch: this.fetchImpl });\n // Sign-out (or sign-in) in another tab, when tokens live in localStorage.\n const w = globalThis as unknown as { addEventListener?: (t: string, l: (e: StorageEvent) => void) => void };\n if (options.storage === 'local' && typeof w.addEventListener === 'function') {\n w.addEventListener('storage', (e) => {\n if (e.key === this.keys.session) this.emit(this.getSession());\n });\n }\n }\n\n // ---- sign-in -----------------------------------------------------------------------------------\n\n /** Build the authorization URL and remember the pending flow. Use `signIn()` unless you render the link yourself. */\n async createSignInUrl(opts: SignInOptions = {}): Promise<string> {\n const { verifier, challenge } = await createPkce();\n const state = createState();\n const scopes = opts.scopes || this.options.scopes || ['profile:read', 'membership:read'];\n const flow: PendingFlow = { verifier, state, redirectUri: this.options.redirectUri, scope: scopes.join(' '), returnTo: opts.returnTo ?? null, createdAt: Date.now() };\n this.storage.set(this.keys.flow, JSON.stringify(flow));\n const u = new URL(`${this.options.appUrl}/authorize`);\n u.searchParams.set('client_id', this.options.clientId);\n u.searchParams.set('redirect_uri', this.options.redirectUri);\n u.searchParams.set('response_type', 'code');\n u.searchParams.set('state', state);\n u.searchParams.set('code_challenge', challenge);\n u.searchParams.set('code_challenge_method', 'S256');\n u.searchParams.set('scope', flow.scope);\n u.searchParams.set('ui_locales', this.options.locale);\n if (opts.prompt) u.searchParams.set('prompt', opts.prompt);\n return u.toString();\n }\n\n /**\n * Start the sign-in: navigates the TOP window to the hosted sign-in + consent page. Call it from a user\n * gesture (a click). From inside a cross-origin or sandboxed frame the navigation is refused (`framed`):\n * the hosted page is never shown in a frame.\n */\n async signIn(opts: SignInOptions = {}): Promise<void> {\n const url = await this.createSignInUrl(opts);\n const nav = this.options.navigate || defaultNavigate;\n try {\n nav(url);\n } catch (err) {\n this.storage.remove(this.keys.flow);\n throw new VimineError('framed', 'Sign in with Vimine cannot start from this frame', { cause: err });\n }\n }\n\n /** Does this URL carry the parameters of a sign-in redirect (`code`+`state` or `error`)? */\n hasRedirectParams(url?: string): boolean {\n const params = paramsOf(url);\n return !!params && ((params.has('code') && params.has('state')) || params.has('error'));\n }\n\n /**\n * On the redirect page: exchange the authorization code for tokens and store the session. Returns null when\n * the URL carries no sign-in parameters. Throws `state_mismatch` / `no_flow` for a redirect this client did\n * not start, and the OAuth error (`access_denied`, …) when the member did not authorize.\n */\n async handleRedirect(opts: { url?: string; cleanUrl?: boolean } = {}): Promise<RedirectResult | null> {\n const params = paramsOf(opts.url);\n if (!params || !this.hasRedirectParams(opts.url)) return null;\n const raw = this.storage.get(this.keys.flow);\n const flow: PendingFlow | null = raw ? (JSON.parse(raw) as PendingFlow) : null;\n const finish = () => {\n this.storage.remove(this.keys.flow);\n if (opts.cleanUrl !== false) cleanRedirectParams();\n };\n if (params.has('error')) {\n finish();\n throw new VimineError(params.get('error') || 'access_denied', params.get('error_description') || 'The member did not authorize this app');\n }\n if (!flow) throw new VimineError('no_flow', 'No sign-in was started from this browser (storage empty or expired)');\n if (params.get('state') !== flow.state) throw new VimineError('state_mismatch', 'The redirect does not match the sign-in that was started');\n const tokens = await this.tokenRequest({\n grant_type: 'authorization_code',\n code: params.get('code') || '',\n code_verifier: flow.verifier,\n client_id: this.options.clientId,\n redirect_uri: flow.redirectUri\n });\n finish();\n const session = this.storeTokens(tokens);\n return { session, returnTo: flow.returnTo };\n }\n\n // ---- session -----------------------------------------------------------------------------------\n\n getSession(): Session | null {\n const raw = this.storage.get(this.keys.session);\n if (!raw) return null;\n try {\n return JSON.parse(raw) as Session;\n } catch {\n return null;\n }\n }\n\n isSignedIn(): boolean {\n return !!this.getSession();\n }\n\n /** A valid access token, refreshed when about to expire. Throws `not_signed_in` when there is no session. */\n async getAccessToken(): Promise<string> {\n const session = this.getSession();\n if (!session) throw new VimineError('not_signed_in', 'No Vimine session: call signIn() first');\n if (session.expiresAt - Date.now() > REFRESH_LEAD_MS) return session.accessToken;\n return (await this.refresh()).accessToken;\n }\n\n /** Rotate the session (single-flight). An unusable refresh token ends the session. */\n refresh(): Promise<Session> {\n if (this.refreshing) return this.refreshing;\n this.refreshing = (async () => {\n const session = this.getSession();\n if (!session?.refreshToken) {\n this.clearSession();\n throw new VimineError('not_signed_in', 'No refresh token: sign in again');\n }\n try {\n const tokens = await this.tokenRequest({ grant_type: 'refresh_token', refresh_token: session.refreshToken, client_id: this.options.clientId });\n return this.storeTokens(tokens);\n } catch (err) {\n if (err instanceof VimineError && err.isAuthError) this.clearSession();\n throw err;\n } finally {\n this.refreshing = null;\n }\n })();\n return this.refreshing;\n }\n\n /** Revoke the session (RFC 7009) and forget it; with `everywhere`, also end the member's Vimine session. */\n async signOut(opts: SignOutOptions = {}): Promise<void> {\n const session = this.getSession();\n this.clearSession();\n if (session?.refreshToken) {\n await withNetworkError(\n this.fetchImpl(`${this.options.apiUrl}/v1/oauth/revoke`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n body: new URLSearchParams({ token: session.refreshToken, token_type_hint: 'refresh_token' }).toString()\n })\n ).catch(() => {\n /* revocation is best effort: the tokens are already forgotten here */\n });\n }\n if (opts.everywhere) {\n const u = new URL(`${this.options.appUrl}/oauth/logout`);\n u.searchParams.set('client_id', this.options.clientId);\n u.searchParams.set('post_logout_redirect_uri', opts.postLogoutRedirectUri || this.options.redirectUri);\n if (opts.state) u.searchParams.set('state', opts.state);\n (this.options.navigate || defaultNavigate)(u.toString());\n }\n }\n\n /** Subscribe to session changes (sign-in, refresh, sign-out; other tabs when storage is `local`). */\n onChange(listener: (session: Session | null) => void): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n // ---- API ---------------------------------------------------------------------------------------\n\n /** An authenticated call to the API; JSON in and out, problem details as `VimineError`, one retry after a refresh on 401. */\n async request<T>(path: string, init: RequestInit & { idempotencyKey?: string } = {}): Promise<T> {\n const attempt = async (token: string): Promise<Response> => {\n const headers: Record<string, string> = { Accept: 'application/json', Authorization: `Bearer ${token}` };\n if (init.body !== undefined) headers['Content-Type'] = 'application/json';\n if (init.idempotencyKey) headers['Idempotency-Key'] = init.idempotencyKey;\n const given = init.headers as Record<string, string> | undefined;\n const { idempotencyKey: _ignored, ...rest } = init;\n return this.fetchImpl(`${this.options.apiUrl}${path}`, { ...rest, headers: { ...headers, ...(given || {}) } });\n };\n let res = await withNetworkError(attempt(await this.getAccessToken()));\n if (res.status === 401) {\n const refreshed = await this.refresh();\n res = await withNetworkError(attempt(refreshed.accessToken));\n }\n return jsonOrThrow<T>(res);\n }\n\n /** The member's profile (`profile:read` / `profile:write`). */\n readonly me = {\n get: (): Promise<Me> => this.request<Me>('/v1/me'),\n /**\n * A fiscal code that disagrees with the particulars answers 422 with a `codicefiscale_mismatch` entry in\n * `errors[]`; when that entry says `confirmable: true` the person may confirm it: send `codicefiscale_confirmed: true`.\n */\n update: (patch: MeUpdate): Promise<Me> => this.request<Me>('/v1/me', { method: 'PATCH', body: JSON.stringify(patch) })\n };\n\n /** The member's membership in this association (`membership:read`, `membership:request`, `statuto:accept`). */\n readonly membership = {\n get: (): Promise<Membership> => this.request<Membership>('/v1/me/membership'),\n /**\n * Ask for a membership. 422 `identification_required` when the profile is not identified yet — a fiscal code, or\n * date, place and country of birth: `errors[]` names what is missing; complete it with `me.update()` and ask again.\n */\n request: (body: MembershipRequest, opts: { idempotencyKey?: string } = {}): Promise<MembershipRequestResult> =>\n this.request<MembershipRequestResult>('/v1/me/membership', { method: 'POST', body: JSON.stringify(body), idempotencyKey: opts.idempotencyKey || createState() }),\n events: (params: { limit?: number; cursor?: string } = {}): Promise<MembershipEvents> => {\n const q = new URLSearchParams();\n if (params.limit) q.set('limit', String(params.limit));\n if (params.cursor) q.set('cursor', params.cursor);\n const qs = q.toString();\n return this.request<MembershipEvents>(`/v1/me/membership/events${qs ? `?${qs}` : ''}`);\n },\n statuto: (): Promise<StatutoInfo> => this.request<StatutoInfo>('/v1/me/membership/statuto'),\n acceptStatuto: (body: StatutoAccept): Promise<{ accepted: true; version: number }> =>\n this.request('/v1/me/membership/statuto/accept', { method: 'POST', body: JSON.stringify(body) }),\n /** The signed card token and its window. 409 `not_active` unless the membership is active: only an active membership has a card. */\n card: (): Promise<Card> => this.request<Card>('/v1/me/membership/card'),\n /** Self-service renewal (`membership:request`): renewed at once for a free type with no approval gate, else a request. */\n renew: (body: StatutoAccept, opts: { idempotencyKey?: string } = {}): Promise<RenewResult> =>\n this.request<RenewResult>('/v1/me/membership/renew', { method: 'POST', body: JSON.stringify({ accept_statuto: body }), idempotencyKey: opts.idempotencyKey || createState() }),\n /** Network consent (`network:manage`); 409 `not_eligible` when the membership type is not in the network. */\n setNetworkOptIn: (optIn: boolean): Promise<NetworkOptIn> => this.request<NetworkOptIn>('/v1/me/membership/network-opt-in', { method: 'PATCH', body: JSON.stringify({ opt_in: optIn }) }),\n /** A Save-to-Google-Wallet link for the card (`membership:read`); 409 `not_active` when there is no card yet, 503 when the deployment has no wallet issuer. */\n googleWalletUrl: (): Promise<{ url: string }> => this.request<{ url: string }>('/v1/me/membership/wallet/google'),\n /** The card as SVG markup (with the current QR) — inline it, or hand it to `<vimine-card>`. 409 `not_active` unless the membership is active. */\n cardSvg: async (): Promise<string> => {\n const token = await this.getAccessToken();\n const res = await withNetworkError(this.fetchImpl(`${this.options.apiUrl}/v1/me/membership/card.svg`, { headers: { Accept: 'image/svg+xml', Authorization: `Bearer ${token}` } }));\n if (!res.ok) throw await VimineError.fromResponse(res);\n return res.text();\n },\n /** Ask the API to e-mail the member their card (SVG + QR attached). 409 `not_active` unless the membership is active. */\n emailCard: (): Promise<Accepted> => this.request<Accepted>('/v1/me/membership/card/email', { method: 'POST' })\n };\n\n /**\n * The member's legal acceptances (`legal:read`, `legal:accept`): what they accepted or acknowledged, what is still\n * pending — the account terms, the platform privacy notice, this association's notice to members — and the call\n * that records one at the in-force version your app showed (422 `<kind>_outdated` otherwise).\n */\n readonly legal = {\n acceptances: (params: { locale?: Locale } = {}): Promise<MyAcceptances> => this.request<MyAcceptances>(`/v1/me/acceptances${params.locale ? `?locale=${params.locale}` : ''}`),\n record: (body: AcceptanceInput, opts: { idempotencyKey?: string } = {}): Promise<AcceptanceResult> =>\n this.request<AcceptanceResult>('/v1/me/acceptances', { method: 'POST', body: JSON.stringify(body), idempotencyKey: opts.idempotencyKey || createState() })\n };\n\n /** Events of the association (`events:read`): published ones, members-only included — the public ones need no sign-in: `publicApi().events`. */\n readonly events = {\n /** `filter`: upcoming (default) | past | cancelled | all; `from` / `to` bound `starts_at`. */\n list: (params: EventListParams = {}): Promise<EventList> => this.request<EventList>(`/v1/events${eventQuery(params)}`),\n get: (slug: string, params: LocaleParam = {}): Promise<Event> => this.request<Event>(`/v1/events/${encodeURIComponent(slug)}${localeQuery(params)}`),\n /** May the member register, per registration type, with reasons. */\n eligibility: (slug: string): Promise<Eligibility> => this.request<Eligibility>(`/v1/events/${encodeURIComponent(slug)}/eligibility`)\n };\n\n /** The member's event registrations (`registrations:read` / `registrations:write`). */\n readonly registrations = {\n /**\n * Register for an event: a free type answers `confirmed` with the QR `token`; a paid one answers `reserved`\n * with `payment_instructions` until the association records the contribution. `422 not_eligible` carries\n * the reasons. Retries are safe: an `Idempotency-Key` is generated unless you pass one.\n */\n create: (slug: string, body: RegistrationRequest, opts: { idempotencyKey?: string } = {}): Promise<Registration> =>\n this.request<Registration>(`/v1/events/${encodeURIComponent(slug)}/registrations`, { method: 'POST', body: JSON.stringify(body), idempotencyKey: opts.idempotencyKey || createState() }),\n /** The member's registrations, newest event first (`filter: 'upcoming'` for the ones still to come). */\n list: (params: { filter?: 'upcoming' | 'all' } = {}): Promise<RegistrationList> => this.request<RegistrationList>(`/v1/me/registrations${params.filter ? `?filter=${params.filter}` : ''}`),\n get: (id: string): Promise<Registration> => this.request<Registration>(`/v1/me/registrations/${encodeURIComponent(id)}`),\n /** Cancel inside the event's cancellation window — `409 window_closed` otherwise. */\n cancel: (id: string): Promise<Registration> => this.request<Registration>(`/v1/me/registrations/${encodeURIComponent(id)}`, { method: 'DELETE' }),\n /** The QR payload of a confirmed registration (what the door scans), or null. */\n tokenPayload: async (id: string): Promise<string | null> => (await this.request<Registration>(`/v1/me/registrations/${encodeURIComponent(id)}`)).token || null\n };\n\n /** The apps the member authorized in this association. */\n readonly connections = {\n list: (): Promise<{ items: Connection[] }> => this.request('/v1/me/connections'),\n revoke: (clientId: string): Promise<void> => this.request<void>(`/v1/me/connections/${encodeURIComponent(clientId)}`, { method: 'DELETE' })\n };\n\n // ---- internals ---------------------------------------------------------------------------------\n\n private async tokenRequest(form: Record<string, string>): Promise<TokenResponse> {\n const res = await withNetworkError(\n this.fetchImpl(`${this.options.apiUrl}/v1/oauth/token`, {\n method: 'POST',\n headers: { Accept: 'application/json', 'Content-Type': 'application/x-www-form-urlencoded' },\n body: new URLSearchParams(form).toString()\n })\n );\n return jsonOrThrow<TokenResponse>(res);\n }\n\n private storeTokens(tokens: TokenResponse): Session {\n const claims = decodeJwtPayload(tokens.access_token);\n const session: Session = {\n accessToken: tokens.access_token,\n refreshToken: tokens.refresh_token ?? this.getSession()?.refreshToken ?? null,\n expiresAt: Date.now() + Math.max(0, tokens.expires_in) * 1000,\n scope: String(tokens.scope || '').split(/\\s+/).filter(Boolean) as Scope[],\n sub: tokens.sub ?? (typeof claims?.sub === 'string' ? claims.sub : null),\n mode: claims?.mode === 'test' ? 'test' : 'live'\n };\n this.storage.set(this.keys.session, JSON.stringify(session));\n this.emit(session);\n return session;\n }\n\n private clearSession(): void {\n const had = !!this.storage.get(this.keys.session);\n this.storage.remove(this.keys.session);\n if (had) this.emit(null);\n }\n\n private emit(session: Session | null): void {\n for (const l of this.listeners) {\n try {\n l(session);\n } catch {\n /* a listener must not break the others */\n }\n }\n }\n}\n\nconst paramsOf = (url?: string): URLSearchParams | null => {\n if (url) {\n try {\n return new URL(url, 'http://localhost').searchParams;\n } catch {\n return null;\n }\n }\n const loc = (globalThis as unknown as { location?: Location }).location;\n return loc ? new URLSearchParams(loc.search) : null;\n};\n\nconst cleanRedirectParams = (): void => {\n const g = globalThis as unknown as { history?: History; location?: Location };\n if (!g.history || !g.location) return;\n const u = new URL(g.location.href);\n for (const k of ['code', 'state', 'error', 'error_description']) u.searchParams.delete(k);\n try {\n g.history.replaceState(g.history.state, '', u.toString());\n } catch {\n /* ignore */\n }\n};\n\nconst defaultNavigate = (url: string): void => {\n const w = globalThis as unknown as { top?: Window; self?: Window; location?: Location };\n const top = w.top || w.self;\n if (!top) throw new Error('No window to navigate');\n // Navigating the top window from a cross-origin frame throws — which is the refusal we want.\n top.location.assign(url);\n};\n"]}
package/package.json CHANGED
@@ -1,13 +1,9 @@
1
1
  {
2
2
  "name": "@vimine/sdk",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "Sign in with Vimine and the Vimine API, for websites and apps of associations on vimine.network.",
5
5
  "license": "MIT",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/vimine-network/vimine-developers.git",
9
- "directory": "packages/sdk"
10
- },
6
+ "homepage": "https://developers.vimine.network/",
11
7
  "type": "module",
12
8
  "sideEffects": false,
13
9
  "main": "./dist/index.js",