@vimine/sdk 0.2.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/types.d.ts CHANGED
@@ -21,7 +21,6 @@ export interface ClientInfo {
21
21
  aps: {
22
22
  slug: string;
23
23
  name: string;
24
- brandcolor: string | null;
25
24
  picture_url: string | null;
26
25
  };
27
26
  scopes: Array<{
@@ -153,6 +152,25 @@ export interface MembershipRequest {
153
152
  version: number;
154
153
  sha256?: string;
155
154
  };
155
+ /**
156
+ * The association's privacy notice the person read on your page (`ApsPublicConfig.privacy_notice`; add `locale` when
157
+ * you showed a translation). REQUIRED while a notice is in force that the person has not acknowledged yet
158
+ * (`legal.acceptances()` → `pending.privacy_notice`): 422 `validation_failed` on `privacy_notice` without it, 422
159
+ * `privacy_notice_outdated` when it is not the in-force version. Ignored once they stand at the in-force one.
160
+ */
161
+ privacy_notice?: {
162
+ version: number;
163
+ sha256?: string;
164
+ locale?: Locale | string;
165
+ };
166
+ /**
167
+ * Residence or, where different, domicile — kept on the association's own record of the member. REQUIRED where the
168
+ * association declared `member_address: required` (422 `validation_failed` on `address`), stored where it declared
169
+ * `optional`, ignored where it collects none.
170
+ */
171
+ address?: MemberAddress;
172
+ /** The language of the page the person used (`it`, `en`): which translation of the notice they read. */
173
+ locale?: Locale | string;
156
174
  }
157
175
  /** A free type with no approval gate is issued `active` at once; otherwise `pending` with its reasons. */
158
176
  /** What every answer about a membership request says about its gates. */
@@ -241,13 +259,17 @@ export interface AssociationPublicConfig {
241
259
  aps: {
242
260
  slug: string;
243
261
  name: string;
244
- brandcolor: string | null;
245
262
  picture_url: string | null;
246
263
  citta: string | null;
247
264
  provincia: string | null;
248
265
  enroll_enabled: boolean;
249
266
  /** Enrolment is on AND the association can take one more member right now (plan caps are never disclosed). */
250
267
  accepting_requests: boolean;
268
+ /**
269
+ * The private beta: the association takes only the people it invited — `accepting_requests` is then false and
270
+ * enrolment answers 403 `not_available`; invitees join from the link they receive by mail.
271
+ */
272
+ invitation_only: boolean;
251
273
  /**
252
274
  * How the association admits its members — tell an applicant up front. `board`: the request waits for a decision
253
275
  * of the association's board, and any fee is paid after it; `provisional`: admitted at once, ratified later;
@@ -366,7 +388,7 @@ export interface SignupInput {
366
388
  }
367
389
  /** Whether an association collects its members' address (`GET /v1/aps/{slug}` → `aps.member_address`). */
368
390
  export type MemberAddressPolicy = 'none' | 'optional' | 'required';
369
- /** A member's address, as `POST /v1/enroll` takes it. */
391
+ /** A member's address, as `POST /v1/enroll`, `POST /v1/me/membership` and `POST /v1/enroll/confirm` take it. */
370
392
  export interface MemberAddress {
371
393
  /** `residence` (the default) or, where different, `domicile`. */
372
394
  kind?: 'residence' | 'domicile';
@@ -495,6 +517,39 @@ export interface EnrollConfirmResult {
495
517
  name: string;
496
518
  slug: string;
497
519
  };
520
+ /**
521
+ * Only for a link sent by the association's hosted enrolment page when that page was opened from one of its public
522
+ * events: what became of the place asked for together with the request. `null` for every other link.
523
+ */
524
+ event?: EnrolledPlace | null;
525
+ }
526
+ /** The place asked for with a membership request made from an event's page (`EnrollConfirmResult.event`). */
527
+ export interface EnrolledPlace {
528
+ slug: string;
529
+ title: string;
530
+ starts_at: string;
531
+ timezone: string;
532
+ place: string | null;
533
+ registration_type: {
534
+ uid: string;
535
+ name: string;
536
+ amount: number;
537
+ currency: string;
538
+ };
539
+ /**
540
+ * `confirmed`: the place is theirs. `reserved`: held, see `waiting`. `held`: the membership request itself still
541
+ * waits for the address to be confirmed, and no place was asked for. `unavailable`: no place, see `reasons`.
542
+ */
543
+ state: 'confirmed' | 'reserved' | 'held' | 'unavailable';
544
+ /** What a `reserved` place waits for: the membership to become active, the contribution, or both. */
545
+ waiting: ('membership' | 'contribution')[];
546
+ /** Why the place is `unavailable`: the reasons of the eligibility endpoint. */
547
+ reasons: string[];
548
+ reserved_until: string | null;
549
+ /** How to pay a contribution that is owed, in the association's words. */
550
+ payment_instructions: string | null;
551
+ /** The person held this place before the link was used. */
552
+ already: boolean;
498
553
  }
499
554
  /** `POST /v1/me/membership/renew` — renewed at once (free type, no approval gate) or turned into a request. */
500
555
  export interface RenewResult {
@@ -604,6 +659,20 @@ export interface SandboxReset {
604
659
  export type EventStatus = 'published' | 'completed' | 'cancelled';
605
660
  export type EventVisibility = 'members_only' | 'public';
606
661
  export type RegistrationStatus = 'reserved' | 'confirmed' | 'cancelled' | 'refunded';
662
+ /** Why a registration was cancelled. */
663
+ export type RegistrationCancelReason =
664
+ /** The member cancelled it, inside the event's cancellation window. */
665
+ 'user'
666
+ /** The association's secretariat cancelled it. */
667
+ | 'staff'
668
+ /** A reserved place whose contribution did not arrive before the hold ran out. */
669
+ | 'expired' | 'event_cancelled'
670
+ /** A place held while the membership request was pending, for an event that starts before the new card is usable. */
671
+ | 'card_not_valid_yet'
672
+ /** The association did not accept the membership request (or the provisional admission) the place was held under. */
673
+ | 'membership_rejected'
674
+ /** The association revoked the membership the place needed. */
675
+ | 'membership_revoked';
607
676
  /** Why a registration type is not open right now. */
608
677
  export type RegistrationTypeReason = 'sold_out' | 'registration_not_open' | 'registration_closed';
609
678
  /** Why the member may not register (`GET /v1/events/{slug}/eligibility`, `422 not_eligible`). */
@@ -732,7 +801,7 @@ export interface Registration {
732
801
  reserved_until: string | null;
733
802
  checked_in_at: string | null;
734
803
  cancelled_at: string | null;
735
- cancel_reason: 'user' | 'staff' | 'expired' | 'event_cancelled' | null;
804
+ cancel_reason: RegistrationCancelReason | null;
736
805
  can_cancel: boolean;
737
806
  payment: {
738
807
  status: 'recorded' | 'refunded' | 'void';
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,kGAAkG","sourcesContent":["// Wire types of the Vimine API v1 — hand-kept in sync with openapi/v1.json (the document is the source of\n// truth; a generated file may replace this one later). Field names are the JSON names, unchanged.\n\n/** Permissions a member (user scopes) or an association's own system (client scopes) may hold. */\nexport type Scope =\n | 'profile:read'\n | 'profile:write'\n | 'membership:read'\n | 'membership:request'\n | 'statuto:accept'\n | 'network:manage'\n | 'identity:signup'\n | 'enroll:write'\n | 'verify:read'\n | 'memberships:read'\n | 'checkins:write'\n | 'webhooks:manage'\n | 'events:read'\n | 'registrations:read'\n | 'registrations:write';\n\n/** `rejected`: the request for admission was not accepted (a different act from `revoked`, which excludes a member). */\nexport type MembershipStatus = 'pending' | 'active' | 'suspended' | 'revoked' | 'rejected';\n/** What the card is worth right now: `valid`, `expired`, `statuto_required` (re-acceptance overdue) or `inactive`. */\n/** `not_yet_valid`: active and unexpired, but inside the association's usability delay — see `Membership.valid_from`. */\nexport type MembershipVerdict = 'valid' | 'expired' | 'not_yet_valid' | 'statuto_required' | 'inactive';\n\n// ---- OAuth ------------------------------------------------------------------------------------------\n\nexport interface TokenResponse {\n access_token: string;\n token_type: 'Bearer';\n expires_in: number;\n refresh_token?: string;\n scope: string;\n /** Pairwise subject of the member (per association); absent on client tokens. */\n sub?: string;\n}\n\nexport interface ClientInfo {\n client_id: string;\n name: string;\n kind: 'public' | 'native' | 'confidential' | 'first_party';\n aps: { slug: string; name: string; brandcolor: string | null; picture_url: string | null };\n scopes: Array<{ code: Scope; label: string }>;\n}\n\n// ---- member surface (/v1/me*) -------------------------------------------------------------------------\n\n/**\n * A language the platform speaks (`it`, `en` today). Wherever the API takes one it also takes a regional tag\n * (`en-GB`) and reduces it; a language it does not speak is ignored, never an error — except on `PATCH /v1/me`.\n */\nexport type Locale = 'it' | 'en';\n\n/** Ask for the association's copy in a language (`?locale=`). Default: the member's own, then `Accept-Language`, then the association's. */\nexport interface LocaleParam {\n locale?: Locale | string;\n}\n\nexport interface Me {\n sub: string;\n email: string;\n email_verified: boolean;\n first_name: string | null;\n last_name: string | null;\n phone: string | null;\n /** ISO date (YYYY-MM-DD) */\n dob: string | null;\n /** Demographic only: it is never cross-checked against a fiscal code. */\n gender: 'M' | 'F' | null;\n /** Comune (born in Italy) or city, free text (born abroad). */\n birthplace: string | null;\n /** Country of birth, ISO 3166-1 alpha-2. */\n birth_country: string | null;\n /** Optional: a person may have none. */\n codicefiscale: string | null;\n /** How the person is identified; `null` = not identified yet (they cannot request a membership). */\n codicefiscale_check: CodiceFiscaleCheck | null;\n /** The language the person chose for the platform and its mails; `null` = never chosen (the request's, then the association's, applies). */\n locale: Locale | null;\n updated_at: string | null;\n}\n\n/**\n * How a person is identified — by a fiscal code OR by their particulars (date, place and country of birth), never\n * neither. `matched`: a fiscal code that agrees with the particulars; `mismatch_confirmed`: a code that disagrees,\n * confirmed by the person as the one on their health card; `absent`: no code, the particulars identify them.\n */\nexport type CodiceFiscaleCheck = 'matched' | 'mismatch_confirmed' | 'absent';\n\nexport interface MeUpdate {\n phone?: string | null;\n dob?: string | null;\n gender?: 'M' | 'F' | null;\n birthplace?: string | null;\n /** ISO 3166-1 alpha-2. For a person born abroad a fiscal code encodes only the STATE: this is what it is compared with. */\n birth_country?: string | null;\n /** May be added later, or set to `null`. Validated and cross-checked when present (422 `codicefiscale_mismatch`). */\n codicefiscale?: string | null;\n /** Write-only: the person confirms a code that disagrees with their particulars (only after a `confirmable: true`). */\n codicefiscale_confirmed?: boolean;\n /** The person's language; `null` clears the choice. 422 `unsupported` for a language the platform does not speak. */\n locale?: Locale | null;\n}\n\nexport interface MembershipTypeRef {\n uid: string;\n cod: string;\n name: string;\n}\n\nexport interface MembershipStatuto {\n current_version: number | null;\n current_sha256: string | null;\n accepted_version_id: string | null;\n accepted_at: string | null;\n /** A newer statuto was published since the member accepted one. */\n pending: boolean;\n /** … and the association's grace window for re-acceptance has elapsed. */\n overdue: boolean;\n}\n\nexport interface CardToken {\n /** The `vmt_…` token: what a QR carries and what `/v1/verify/{card_token}` checks. */\n token: string;\n /** Validity window (unix seconds). */\n nbf: number;\n exp: number;\n}\n\nexport interface Membership {\n id: string;\n status: MembershipStatus;\n verdict: MembershipVerdict;\n subdate: string | null;\n issued_at: string | null;\n expires_at: string | null;\n membership_type: MembershipTypeRef | null;\n statuto: MembershipStatuto;\n /**\n * Why a `pending` membership is still pending, IN ORDER: the association's approval of the request first (when it\n * admits by decision of its board), then the quota of a paid type. Empty when active.\n */\n pending_reasons: PendingReason[];\n /** May the quota be paid yet? `false` while the approval is still pending: approval opens payment. */\n payment_open: boolean;\n /** When the card starts to count at the door (the association's usability delay); `null` = since activation. */\n valid_from: string | null;\n /** Is the card usable right now? `status` may be `active` while this is still `false` (see `valid_from`). */\n usable: boolean;\n /** The quota of a paid membership type and whether it is paid for the current period; `null` for a free type. */\n quota: { amount: number; currency: string; paid: boolean } | null;\n /** The association's instructions for paying the quota, only once the payment is open (`payment_open`). */\n payment_instructions: string | null;\n /** Days to expiry (negative once expired). */\n expires_in_days: number | null;\n /** Self-service renewal: open 60 days before expiry; `requested_at` once the member asked. */\n renewal: { window_open: boolean; requested_at: string | null };\n network_opt_in: boolean;\n /** The signed card token. `null` unless `status` is `active` (a pending, suspended or revoked membership has no card) or when card signing is not configured. */\n card: CardToken | null;\n}\n\nexport type PendingReason = 'approval' | 'payment';\n/** How an association admits its members (`GET /v1/aps/{slug}` → `aps.admission.model`). */\nexport type AdmissionModel = 'board' | 'provisional' | 'automatic';\n\nexport interface MembershipRequest {\n /** Membership type uid; optional when the association offers exactly one. */\n membership_type?: string;\n /** Must name the in-force statuto (see `Statuto.version`; `sha256` when published). */\n accept_statuto: { version: number; sha256?: string };\n}\n\n/** A free type with no approval gate is issued `active` at once; otherwise `pending` with its reasons. */\n/** What every answer about a membership request says about its gates. */\nexport interface MembershipGates {\n /** In order: the association's approval first (board model), then the fee. Empty when active. */\n pending_reasons: PendingReason[];\n /** May the fee be paid yet? `false` while the approval is pending: approval opens payment. */\n payment_open: boolean;\n /** When the card becomes usable, for an active membership inside the usability delay; `null` otherwise. */\n valid_from: string | null;\n}\nexport type MembershipRequestResult =\n | ({ created: true; status: MembershipStatus; id: string } & MembershipGates)\n | ({ already_requested: true; status: MembershipStatus } & MembershipGates);\n\nexport interface MembershipEvent {\n from: MembershipStatus | null;\n to: MembershipStatus;\n reason: string | null;\n changed_at: string;\n channel: string;\n}\n\nexport interface MembershipEvents {\n items: MembershipEvent[];\n next_cursor: string | null;\n}\n\nexport interface StatutoInfo {\n uid: string;\n version: number;\n approvaldate: string | null;\n sha256: string | null;\n content: string | null;\n document_url: string | null;\n accepted: boolean;\n accepted_at: string | null;\n overdue: boolean;\n}\n\nexport interface StatutoAccept {\n version: number;\n sha256?: string;\n}\n\nexport interface Card extends CardToken {\n status: MembershipStatus;\n}\n\nexport interface Connection {\n client_id: string;\n name: string;\n kind: ClientInfo['kind'];\n scopes: Scope[];\n granted_at: string;\n}\n\n// ---- public surface -------------------------------------------------------------------------------------\n\nexport interface Verification {\n status: 'active' | 'inactive';\n valid_until?: string;\n /** With `reason: 'not_yet_valid'`: the card is genuine and active, and becomes usable at this moment. */\n valid_from?: string;\n reason?: 'expired' | 'invalid' | 'not_yet_valid';\n}\n\nexport interface MembershipType {\n uid: string;\n cod: string;\n name: string;\n description: string | null;\n quota_amount: number | null;\n currency: string;\n expiry_model: 'solar_year' | 'rolling_12' | 'rolling_24' | 'prorated_solar' | 'custom';\n network_eligible: boolean;\n}\n\nexport interface Statuto {\n uid: string;\n version: number;\n approvaldate: string | null;\n sha256: string | null;\n content: string | null;\n document_url: string | null;\n}\n\nexport interface AssociationPublicConfig {\n /** The language this answer is written in: the one you asked for when the association offers it, its own otherwise. */\n locale: Locale;\n /** The languages the association offers: its own, plus those it enabled. */\n locales: Locale[];\n aps: {\n slug: string;\n name: string;\n brandcolor: string | null;\n picture_url: string | null;\n citta: string | null;\n provincia: string | null;\n enroll_enabled: boolean;\n /** Enrolment is on AND the association can take one more member right now (plan caps are never disclosed). */\n accepting_requests: boolean;\n /**\n * How the association admits its members — tell an applicant up front. `board`: the request waits for a decision\n * of the association's board, and any fee is paid after it; `provisional`: admitted at once, ratified later;\n * `automatic`: active as soon as the conditions are met. `delay_hours`: hours between admission and a USABLE card\n * (0 = at once) — the membership is active from admission, the card counts at the door only afterwards.\n */\n admission: { model: AdmissionModel; delay_hours: number };\n /** @deprecated Kept for compatibility: `true` when `admission.model` is `board`. Read `admission`. */\n approval_required: boolean;\n /**\n * Whether the association collects its members' address — of every member or of nobody. `none`: do not ask (an\n * `address` sent anyway is not stored); `optional`; `required`: enrolment answers 422 `required` on `address`\n * without one.\n */\n member_address: MemberAddressPolicy;\n /** How to pay the quota (IBAN, causale…), when the association published it. */\n payment_instructions: string | null;\n /**\n * The activities of general interest the association carries out (Italian Third Sector Code, art. 5): `cod` is\n * the letter of the article, `description` its Italian wording; one is marked as prevalent.\n */\n activity_sectors: Array<{ cod: string; description: string; prevalent: boolean }>;\n /**\n * Present when the association is registered in the RUNTS (the Italian national register of Third Sector\n * entities), as checked by the platform against the official public lists; `null` otherwise. Never typed by\n * the association.\n */\n registry: {\n section: 'APS' | 'ODV' | 'EF' | 'IS' | 'RA' | 'SOMS' | 'ALTRI' | null;\n /** Repertory number. */\n number: string | null;\n registered_on: string | null;\n /** Date of the official list the check ran against. */\n checked_on: string | null;\n } | null;\n };\n membership_types: MembershipType[];\n statuto: Statuto | null;\n}\n\nexport interface FiscalCodeCheck {\n /** Codice fiscale (16 characters). */\n code: string;\n first_name?: string;\n last_name?: string;\n gender?: 'M' | 'F';\n /** Date of birth, YYYY-MM-DD. */\n date?: string;\n /** Birthplace: the comune, for a person born in Italy. */\n place?: string;\n /**\n * Birth country, ISO 3166-1 alpha-2. A code encodes the comune for people born in Italy and only the STATE for\n * everybody else: anything but `IT` is compared with that state, and `place` is ignored.\n */\n country?: string;\n}\n\n/** What may disagree with a fiscal code. `gender` only where it is sent: enrolment and the profile never cross-check it. */\nexport type FiscalCodeMismatch = 'lastName' | 'firstName' | 'gender' | 'date' | 'place';\n/** `names_swapped`: the code matches once surname and given name are exchanged. */\nexport type FiscalCodeHint = 'names_swapped';\n\nexport interface FiscalCodeResult {\n valid: boolean;\n /** `invalid`: structure or check character; `mismatch`: a well-formed code that disagrees with the data sent. */\n error: 'invalid' | 'mismatch' | null;\n /** What disagrees with the code, when `error` is `mismatch`. */\n mismatches: FiscalCodeMismatch[];\n hints: FiscalCodeHint[];\n /** The date of birth the code itself encodes (YYYY-MM-DD). */\n birth_date: string | null;\n /** The birth country the code itself encodes, ISO 3166-1 alpha-2 (`IT` for a comune). */\n birth_country: string | null;\n}\n\nexport interface CardKeys {\n keys: Array<{ kty: string; crv: string; x: string; kid: string; use: string; alg: string }>;\n}\n\n// ---- client (server-side) surface ---------------------------------------------------------------------\n\n// ---- server-side signup + enrolment (client scopes identity:signup / enroll:write) ---------------------\n\n/** A person your system registers on Vimine (`POST /v1/signup`). */\nexport interface SignupInput {\n email: string;\n first_name: string;\n last_name: string;\n phone?: string | null;\n /** YYYY-MM-DD */\n dob?: string | null;\n /** Demographic only: it is not cross-checked. */\n gender?: 'M' | 'F' | null;\n /** Comune (born in Italy) or city, free text (born abroad). */\n birthplace?: string | null;\n /** ISO 3166-1 alpha-2. Send it for a person born abroad: their fiscal code encodes only the state. */\n birth_country?: string | null;\n /** Validated and cross-checked against the other fields when present. */\n codicefiscale?: string | null;\n /** The person confirms a code that disagrees with their particulars (422 `codicefiscale_mismatch` with `confirmable: true`). */\n codicefiscale_confirmed?: boolean;\n /** The account terms (`platform_terms`) the person accepted on your site — optional; when given it must name the in-force version (`GET /v1/legal/platform_terms`). */\n accept_terms?: LegalRef;\n /** The platform privacy notice (`platform_privacy`) the person read on your site — optional, same rule. */\n acknowledge_privacy?: LegalRef;\n /**\n * The language of the page the person filled in. It decides the language of the mails that follow and becomes the\n * preference of a NEW account; an existing account keeps its own.\n */\n locale?: Locale | string;\n}\n\n/** Whether an association collects its members' address (`GET /v1/aps/{slug}` → `aps.member_address`). */\nexport type MemberAddressPolicy = 'none' | 'optional' | 'required';\n\n/** A member's address, as `POST /v1/enroll` takes it. */\nexport interface MemberAddress {\n /** `residence` (the default) or, where different, `domicile`. */\n kind?: 'residence' | 'domicile';\n /** Street and number. */\n line: string;\n postal_code?: string | null;\n city: string;\n /** Italian addresses only (two letters); dropped abroad. */\n province?: string | null;\n /** ISO 3166-1 alpha-2 (default `IT`). */\n country?: string;\n}\n\n/**\n * `POST /v1/enroll/confirm` after a 409 `identification_required`: what the account still lacks — a fiscal code, or\n * date, place and country of birth. It completes the EMPTY fields of the profile, never over what is there.\n */\nexport interface EnrollIdentification {\n /** YYYY-MM-DD */\n dob?: string;\n birthplace?: string;\n /** ISO 3166-1 alpha-2 */\n birth_country?: string;\n codicefiscale?: string;\n codicefiscale_confirmed?: boolean;\n}\n\n/** A published legal text named by version (and hash when published). */\nexport interface LegalRef {\n version: string;\n sha256?: string;\n}\n\n/** A membership request your system submits for a person (`POST /v1/enroll`). */\nexport interface EnrollInput extends SignupInput {\n /**\n * Optional. A person is identified by a fiscal code OR by `dob` + `birthplace` + `birth_country` — never neither\n * (422 `required` on each missing particular). When present it is validated and cross-checked against the names,\n * the date and the place (the state, for people born abroad).\n */\n codicefiscale?: string | null;\n /**\n * Residence or, where different, domicile. Asked of every member or of nobody: the public profile says what the\n * association declared (`aps.member_address`).\n */\n address?: MemberAddress;\n /** Membership type uid; optional when the association offers exactly one. */\n membership_type?: string;\n /** The in-force statuto the person accepted on your site (see `Statuto.version`; `sha256` when published). */\n accept_statuto: { version: number; sha256?: string };\n /**\n * The association's privacy notice the person read on your site (`ApsPublicConfig.privacy_notice`). REQUIRED when the\n * association publishes one; 422 `privacy_notice_outdated` when it is not the in-force version.\n */\n privacy_notice?: { version: number; sha256?: string; locale?: Locale | string };\n}\n\n/** One acceptance, acknowledgement or consent the person recorded (`GET /v1/me/acceptances`). */\nexport interface AcceptanceRecord {\n at: string;\n action: 'accepted' | 'acknowledged' | 'consented' | 'withdrawn' | 'declared';\n channel: 'ui' | 'public' | 'api' | 'job' | 'paper';\n kind: string;\n title: string;\n version: string;\n sha256: string | null;\n /** Hash of the text actually shown. */\n rendered_sha256: string | null;\n locale: string | null;\n /** The association the act concerns, when any. */\n association: string | null;\n}\n\n/** A document the person has not acted on at its in-force version. */\nexport interface PendingDocument {\n kind: string;\n title: string;\n locale: string;\n version: string | number;\n sha256: string | null;\n effective_from: string | null;\n /** What the person is asked to do. */\n action: 'accepted' | 'acknowledged' | 'consented';\n /** Never acted on any version of this kind (false: a new version requires it again). */\n first: boolean;\n}\n\nexport interface MyAcceptances {\n items: AcceptanceRecord[];\n pending: {\n /** Account-layer documents still to accept / acknowledge. */\n platform: PendingDocument[];\n /** This association's notice to members, when not yet acknowledged. */\n privacy_notice: PendingDocument | null;\n };\n}\n\n/** `POST /v1/me/acceptances`: the in-force version your app showed. */\nexport interface AcceptanceInput {\n /** `platform_terms` | `platform_privacy` | `network_consent` | `privacy_notice` */\n kind: string;\n version: string | number;\n sha256?: string;\n}\n\nexport interface AcceptanceResult {\n recorded: true;\n kind: string;\n action: string;\n version: string;\n at: string;\n}\n\n/** The uniform answer of the creating routes: whatever happened behind the address, it was accepted. */\nexport interface Accepted {\n status: 'accepted';\n}\n\n/** `POST /v1/enroll/confirm` — the outcome of the confirmation link an existing account's owner uses. */\nexport interface EnrollConfirmResult {\n status: MembershipStatus;\n /** The person already had a membership request or membership here; nothing new was created. */\n already: boolean;\n /** In order: the association's approval first (board model), then the fee. */\n pending_reasons: PendingReason[];\n payment_open: boolean;\n valid_from: string | null;\n association: { name: string; slug: string };\n}\n\n/** `POST /v1/me/membership/renew` — renewed at once (free type, no approval gate) or turned into a request. */\nexport interface RenewResult {\n renewed: boolean;\n requested: boolean;\n status: MembershipStatus;\n expires_at: string | null;\n renewal_requested_at: string | null;\n}\n\n/** `PATCH /v1/me/membership/network-opt-in` */\nexport interface NetworkOptIn {\n network_opt_in: boolean;\n network_opt_in_at: string | null;\n}\n\n/** `POST /v1/checkins` — a door check-in from a scanned card token. No personal data. */\n/** `POST /v1/checkins` for a CARD token. */\nexport interface CardCheckinResult {\n kind: 'card';\n verdict: MembershipVerdict;\n status: MembershipStatus;\n membership_id: string;\n valid_until: string | null;\n /** With `verdict: 'not_yet_valid'`: when the card becomes usable. The scan is recorded all the same. */\n valid_from: string | null;\n /**\n * A note for whoever staffs the gate, never part of `verdict`: it restricts nothing. `pending`: the member has no\n * verifiable fiscal code and nobody of the association has looked at a document yet — show it. Cleared from the\n * association's console. `null`: nothing to check. The public `verifyCard` never carries it.\n */\n identity_check: IdentityCheck | null;\n checked_in_at: string;\n}\n/**\n * The identity check at first presence (`CardCheckinResult.identity_check`). `pending`: a document is still to be\n * looked at; `verified`: somebody of the association looked at one; `flagged`: somebody did, and it did not agree —\n * a matter for the association's office, which revokes nothing by itself.\n */\nexport type IdentityCheck = 'pending' | 'verified' | 'flagged';\nexport type RegistrationCheckinVerdict = 'valid' | 'already_checked_in' | 'not_confirmed' | 'cancelled' | 'event_cancelled' | 'membership_invalid';\n/** `POST /v1/checkins` for an event REGISTRATION token (`k:'reg'` in the payload). */\nexport interface RegistrationCheckinResult {\n kind: 'registration';\n verdict: RegistrationCheckinVerdict;\n status: RegistrationStatus;\n registration_id: string;\n event: { slug: string; title: string; starts_at: string };\n registration_type: string | null;\n membership_id: string | null;\n membership_verdict: MembershipVerdict | null;\n /** True the first time this registration is checked in. */\n first: boolean;\n checked_in_at: string | null;\n}\nexport type CheckinResult = CardCheckinResult | RegistrationCheckinResult;\n\n/** One row of `GET /v1/memberships` — ids and status only. */\nexport interface MembershipListItem {\n id: string;\n status: MembershipStatus;\n verdict: MembershipVerdict;\n membership_type: { cod: string } | null;\n issued_at: string | null;\n valid_until: string | null;\n updated_at: string;\n}\nexport interface MembershipList {\n items: MembershipListItem[];\n next_cursor: string | null;\n}\nexport interface MembershipListParams {\n status?: MembershipStatus;\n /** RFC 3339: only rows changed after this instant (incremental sync). */\n updated_since?: string;\n limit?: number;\n cursor?: string;\n}\n\nexport interface MembershipStatusInfo {\n id: string;\n status: MembershipStatus;\n verdict: MembershipVerdict;\n valid_until: string | null;\n membership_type: { cod: string } | null;\n}\n\nexport interface SandboxMember {\n email: string;\n name: string;\n status: MembershipStatus;\n expires_at: string | null;\n statuto_accepted: boolean;\n}\n\nexport interface SandboxMembers {\n slug: string;\n members: SandboxMember[];\n}\n\nexport interface SandboxReset {\n /** The synthetic members' shared password — shown only here. */\n password: string;\n members: Array<Pick<SandboxMember, 'email' | 'name' | 'status'>>;\n}\n\n// ---- events & registrations (/v1/aps/{slug}/events, /v1/events*, /v1/me/registrations*) ---------------------\n// Vocabulary: registration (iscrizione) and contribution (contributo) — never \"ticket\".\n\nexport type EventStatus = 'published' | 'completed' | 'cancelled';\nexport type EventVisibility = 'members_only' | 'public';\nexport type RegistrationStatus = 'reserved' | 'confirmed' | 'cancelled' | 'refunded';\n/** Why a registration type is not open right now. */\nexport type RegistrationTypeReason = 'sold_out' | 'registration_not_open' | 'registration_closed';\n/** Why the member may not register (`GET /v1/events/{slug}/eligibility`, `422 not_eligible`). */\nexport type EligibilityReason =\n | 'membership_required'\n | 'membership_not_active'\n /** The event starts before the member's card is usable (the association's usability delay). */\n | 'membership_not_yet_valid'\n | 'membership_type_not_allowed'\n | 'sold_out'\n | 'event_full'\n | 'registration_not_open'\n | 'registration_closed'\n | 'max_per_user'\n | 'event_past'\n | 'event_cancelled'\n | 'event_not_published'\n | 'plan_limit'\n | 'invalid_type';\n\nexport interface EventLocation {\n name: string | null;\n address: string | null;\n lat: number | null;\n lng: number | null;\n}\n\n/** An admission class of an event: free (`amount` 0) or a contribution; places and window are live. */\nexport interface RegistrationType {\n uid: string;\n cod: string;\n name: string;\n description: string | null;\n amount: number;\n currency: string;\n quantity: number | null;\n /** Places left (never who holds them); null = unlimited. */\n remaining: number | null;\n max_per_user: number;\n requires_active_membership: boolean;\n open: boolean;\n reason: RegistrationTypeReason | null;\n opens_at: string | null;\n closes_at: string | null;\n}\n\n/** An event as the API describes it: headless copy, dates, place, images, live availability per type. */\nexport interface Event {\n id: string;\n slug: string;\n /**\n * The language the `title` was served in. When it is not the one you asked for, the association wrote no\n * translation: you got its own text — never a machine translation. Each text falls back on its own.\n */\n locale: Locale;\n /** The languages in which this event has a title. */\n locales: Locale[];\n title: string;\n summary: string | null;\n /** Markdown — render it yourself. */\n description_md: string | null;\n starts_at: string;\n ends_at: string | null;\n timezone: string;\n status: EventStatus;\n visibility: EventVisibility;\n location: EventLocation | null;\n cover_url: string | null;\n gallery: { url: string; alt: string | null; order: number }[];\n links: { label: string; url: string }[];\n registration: { opens_at: string | null; closes_at: string | null; capacity: number | null; remaining: number | null; cancellation_hours: number };\n registration_types: RegistrationType[];\n published_at: string | null;\n cancelled_at: string | null;\n cancel_reason: string | null;\n}\nexport interface EventList {\n items: Event[];\n}\nexport interface EventListParams extends LocaleParam {\n /** `upcoming` (default) | `past` | `cancelled` | `all` */\n filter?: 'upcoming' | 'past' | 'cancelled' | 'all';\n /** RFC 3339 bounds on `starts_at`. */\n from?: string;\n to?: string;\n limit?: number;\n}\n\nexport interface Eligibility {\n can_register: boolean;\n membership_verdict: MembershipVerdict | null;\n types: { uid: string; cod: string; can_register: boolean; reasons: EligibilityReason[]; pending_membership: boolean }[];\n}\n\nexport interface RegistrationRequest {\n registration_type: string;\n note?: string | null;\n quantity?: number;\n /** The language the registration was made in: the fallback for a member who never chose one. */\n locale?: Locale | string;\n}\n\n/** A person's registration (the member's own, or a guest's after the confirmation link). */\nexport interface Registration {\n id: string;\n status: RegistrationStatus;\n event: { id: string; slug: string; title: string; starts_at: string; ends_at: string | null; timezone: string; status: EventStatus; location: string | null; cancel_reason: string | null } | null;\n registration_type: { uid: string; cod: string; name: string; amount: number; currency: string } | null;\n quantity: number;\n reserved_until: string | null;\n checked_in_at: string | null;\n cancelled_at: string | null;\n cancel_reason: 'user' | 'staff' | 'expired' | 'event_cancelled' | null;\n can_cancel: boolean;\n payment: { status: 'recorded' | 'refunded' | 'void'; amount: number; currency: string; method: string; paid_at: string } | null;\n /** How to pay the contribution while `reserved` (the association's own text). */\n payment_instructions?: string | null;\n note: string | null;\n created_at: string;\n /** The registration QR payload (`vmt_…`), confirmed registrations only — draw it as a QR code. */\n token?: string | null;\n}\nexport interface RegistrationList {\n items: Registration[];\n}\n\n/** `POST /v1/events/{slug}/registrations/guest` (client scope `registrations:write`, public events only). */\nexport interface GuestRegistrationRequest {\n email: string;\n first_name: string;\n last_name: string;\n registration_type: string;\n note?: string | null;\n /** The language the registration was made in — for a guest, the language of every mail they receive. */\n locale?: Locale | string;\n}\n\n/** One row of `GET /v1/events/{slug}/registrations` — no personal data. */\nexport interface RegistrationListItem {\n id: string;\n status: RegistrationStatus;\n registration_type: string | null;\n membership_id: string | null;\n quantity: number;\n checked_in_at: string | null;\n created_at: string;\n}\nexport interface EventRegistrationList {\n items: RegistrationListItem[];\n next_cursor: string | null;\n}\nexport interface EventRegistrationListParams {\n status?: RegistrationStatus;\n limit?: number;\n cursor?: string;\n}\n\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,kGAAkG","sourcesContent":["// Wire types of the Vimine API v1 — hand-kept in sync with openapi/v1.json (the document is the source of\n// truth; a generated file may replace this one later). Field names are the JSON names, unchanged.\n\n/** Permissions a member (user scopes) or an association's own system (client scopes) may hold. */\nexport type Scope =\n | 'profile:read'\n | 'profile:write'\n | 'membership:read'\n | 'membership:request'\n | 'statuto:accept'\n | 'network:manage'\n | 'identity:signup'\n | 'enroll:write'\n | 'verify:read'\n | 'memberships:read'\n | 'checkins:write'\n | 'webhooks:manage'\n | 'events:read'\n | 'registrations:read'\n | 'registrations:write';\n\n/** `rejected`: the request for admission was not accepted (a different act from `revoked`, which excludes a member). */\nexport type MembershipStatus = 'pending' | 'active' | 'suspended' | 'revoked' | 'rejected';\n/** What the card is worth right now: `valid`, `expired`, `statuto_required` (re-acceptance overdue) or `inactive`. */\n/** `not_yet_valid`: active and unexpired, but inside the association's usability delay — see `Membership.valid_from`. */\nexport type MembershipVerdict = 'valid' | 'expired' | 'not_yet_valid' | 'statuto_required' | 'inactive';\n\n// ---- OAuth ------------------------------------------------------------------------------------------\n\nexport interface TokenResponse {\n access_token: string;\n token_type: 'Bearer';\n expires_in: number;\n refresh_token?: string;\n scope: string;\n /** Pairwise subject of the member (per association); absent on client tokens. */\n sub?: string;\n}\n\nexport interface ClientInfo {\n client_id: string;\n name: string;\n kind: 'public' | 'native' | 'confidential' | 'first_party';\n aps: { slug: string; name: string; picture_url: string | null };\n scopes: Array<{ code: Scope; label: string }>;\n}\n\n// ---- member surface (/v1/me*) -------------------------------------------------------------------------\n\n/**\n * A language the platform speaks (`it`, `en` today). Wherever the API takes one it also takes a regional tag\n * (`en-GB`) and reduces it; a language it does not speak is ignored, never an error — except on `PATCH /v1/me`.\n */\nexport type Locale = 'it' | 'en';\n\n/** Ask for the association's copy in a language (`?locale=`). Default: the member's own, then `Accept-Language`, then the association's. */\nexport interface LocaleParam {\n locale?: Locale | string;\n}\n\nexport interface Me {\n sub: string;\n email: string;\n email_verified: boolean;\n first_name: string | null;\n last_name: string | null;\n phone: string | null;\n /** ISO date (YYYY-MM-DD) */\n dob: string | null;\n /** Demographic only: it is never cross-checked against a fiscal code. */\n gender: 'M' | 'F' | null;\n /** Comune (born in Italy) or city, free text (born abroad). */\n birthplace: string | null;\n /** Country of birth, ISO 3166-1 alpha-2. */\n birth_country: string | null;\n /** Optional: a person may have none. */\n codicefiscale: string | null;\n /** How the person is identified; `null` = not identified yet (they cannot request a membership). */\n codicefiscale_check: CodiceFiscaleCheck | null;\n /** The language the person chose for the platform and its mails; `null` = never chosen (the request's, then the association's, applies). */\n locale: Locale | null;\n updated_at: string | null;\n}\n\n/**\n * How a person is identified — by a fiscal code OR by their particulars (date, place and country of birth), never\n * neither. `matched`: a fiscal code that agrees with the particulars; `mismatch_confirmed`: a code that disagrees,\n * confirmed by the person as the one on their health card; `absent`: no code, the particulars identify them.\n */\nexport type CodiceFiscaleCheck = 'matched' | 'mismatch_confirmed' | 'absent';\n\nexport interface MeUpdate {\n phone?: string | null;\n dob?: string | null;\n gender?: 'M' | 'F' | null;\n birthplace?: string | null;\n /** ISO 3166-1 alpha-2. For a person born abroad a fiscal code encodes only the STATE: this is what it is compared with. */\n birth_country?: string | null;\n /** May be added later, or set to `null`. Validated and cross-checked when present (422 `codicefiscale_mismatch`). */\n codicefiscale?: string | null;\n /** Write-only: the person confirms a code that disagrees with their particulars (only after a `confirmable: true`). */\n codicefiscale_confirmed?: boolean;\n /** The person's language; `null` clears the choice. 422 `unsupported` for a language the platform does not speak. */\n locale?: Locale | null;\n}\n\nexport interface MembershipTypeRef {\n uid: string;\n cod: string;\n name: string;\n}\n\nexport interface MembershipStatuto {\n current_version: number | null;\n current_sha256: string | null;\n accepted_version_id: string | null;\n accepted_at: string | null;\n /** A newer statuto was published since the member accepted one. */\n pending: boolean;\n /** … and the association's grace window for re-acceptance has elapsed. */\n overdue: boolean;\n}\n\nexport interface CardToken {\n /** The `vmt_…` token: what a QR carries and what `/v1/verify/{card_token}` checks. */\n token: string;\n /** Validity window (unix seconds). */\n nbf: number;\n exp: number;\n}\n\nexport interface Membership {\n id: string;\n status: MembershipStatus;\n verdict: MembershipVerdict;\n subdate: string | null;\n issued_at: string | null;\n expires_at: string | null;\n membership_type: MembershipTypeRef | null;\n statuto: MembershipStatuto;\n /**\n * Why a `pending` membership is still pending, IN ORDER: the association's approval of the request first (when it\n * admits by decision of its board), then the quota of a paid type. Empty when active.\n */\n pending_reasons: PendingReason[];\n /** May the quota be paid yet? `false` while the approval is still pending: approval opens payment. */\n payment_open: boolean;\n /** When the card starts to count at the door (the association's usability delay); `null` = since activation. */\n valid_from: string | null;\n /** Is the card usable right now? `status` may be `active` while this is still `false` (see `valid_from`). */\n usable: boolean;\n /** The quota of a paid membership type and whether it is paid for the current period; `null` for a free type. */\n quota: { amount: number; currency: string; paid: boolean } | null;\n /** The association's instructions for paying the quota, only once the payment is open (`payment_open`). */\n payment_instructions: string | null;\n /** Days to expiry (negative once expired). */\n expires_in_days: number | null;\n /** Self-service renewal: open 60 days before expiry; `requested_at` once the member asked. */\n renewal: { window_open: boolean; requested_at: string | null };\n network_opt_in: boolean;\n /** The signed card token. `null` unless `status` is `active` (a pending, suspended or revoked membership has no card) or when card signing is not configured. */\n card: CardToken | null;\n}\n\nexport type PendingReason = 'approval' | 'payment';\n/** How an association admits its members (`GET /v1/aps/{slug}` → `aps.admission.model`). */\nexport type AdmissionModel = 'board' | 'provisional' | 'automatic';\n\nexport interface MembershipRequest {\n /** Membership type uid; optional when the association offers exactly one. */\n membership_type?: string;\n /** Must name the in-force statuto (see `Statuto.version`; `sha256` when published). */\n accept_statuto: { version: number; sha256?: string };\n /**\n * The association's privacy notice the person read on your page (`ApsPublicConfig.privacy_notice`; add `locale` when\n * you showed a translation). REQUIRED while a notice is in force that the person has not acknowledged yet\n * (`legal.acceptances()` → `pending.privacy_notice`): 422 `validation_failed` on `privacy_notice` without it, 422\n * `privacy_notice_outdated` when it is not the in-force version. Ignored once they stand at the in-force one.\n */\n privacy_notice?: { version: number; sha256?: string; locale?: Locale | string };\n /**\n * Residence or, where different, domicile — kept on the association's own record of the member. REQUIRED where the\n * association declared `member_address: required` (422 `validation_failed` on `address`), stored where it declared\n * `optional`, ignored where it collects none.\n */\n address?: MemberAddress;\n /** The language of the page the person used (`it`, `en`): which translation of the notice they read. */\n locale?: Locale | string;\n}\n\n/** A free type with no approval gate is issued `active` at once; otherwise `pending` with its reasons. */\n/** What every answer about a membership request says about its gates. */\nexport interface MembershipGates {\n /** In order: the association's approval first (board model), then the fee. Empty when active. */\n pending_reasons: PendingReason[];\n /** May the fee be paid yet? `false` while the approval is pending: approval opens payment. */\n payment_open: boolean;\n /** When the card becomes usable, for an active membership inside the usability delay; `null` otherwise. */\n valid_from: string | null;\n}\nexport type MembershipRequestResult =\n | ({ created: true; status: MembershipStatus; id: string } & MembershipGates)\n | ({ already_requested: true; status: MembershipStatus } & MembershipGates);\n\nexport interface MembershipEvent {\n from: MembershipStatus | null;\n to: MembershipStatus;\n reason: string | null;\n changed_at: string;\n channel: string;\n}\n\nexport interface MembershipEvents {\n items: MembershipEvent[];\n next_cursor: string | null;\n}\n\nexport interface StatutoInfo {\n uid: string;\n version: number;\n approvaldate: string | null;\n sha256: string | null;\n content: string | null;\n document_url: string | null;\n accepted: boolean;\n accepted_at: string | null;\n overdue: boolean;\n}\n\nexport interface StatutoAccept {\n version: number;\n sha256?: string;\n}\n\nexport interface Card extends CardToken {\n status: MembershipStatus;\n}\n\nexport interface Connection {\n client_id: string;\n name: string;\n kind: ClientInfo['kind'];\n scopes: Scope[];\n granted_at: string;\n}\n\n// ---- public surface -------------------------------------------------------------------------------------\n\nexport interface Verification {\n status: 'active' | 'inactive';\n valid_until?: string;\n /** With `reason: 'not_yet_valid'`: the card is genuine and active, and becomes usable at this moment. */\n valid_from?: string;\n reason?: 'expired' | 'invalid' | 'not_yet_valid';\n}\n\nexport interface MembershipType {\n uid: string;\n cod: string;\n name: string;\n description: string | null;\n quota_amount: number | null;\n currency: string;\n expiry_model: 'solar_year' | 'rolling_12' | 'rolling_24' | 'prorated_solar' | 'custom';\n network_eligible: boolean;\n}\n\nexport interface Statuto {\n uid: string;\n version: number;\n approvaldate: string | null;\n sha256: string | null;\n content: string | null;\n document_url: string | null;\n}\n\nexport interface AssociationPublicConfig {\n /** The language this answer is written in: the one you asked for when the association offers it, its own otherwise. */\n locale: Locale;\n /** The languages the association offers: its own, plus those it enabled. */\n locales: Locale[];\n aps: {\n slug: string;\n name: string;\n picture_url: string | null;\n citta: string | null;\n provincia: string | null;\n enroll_enabled: boolean;\n /** Enrolment is on AND the association can take one more member right now (plan caps are never disclosed). */\n accepting_requests: boolean;\n /**\n * The private beta: the association takes only the people it invited — `accepting_requests` is then false and\n * enrolment answers 403 `not_available`; invitees join from the link they receive by mail.\n */\n invitation_only: boolean;\n /**\n * How the association admits its members — tell an applicant up front. `board`: the request waits for a decision\n * of the association's board, and any fee is paid after it; `provisional`: admitted at once, ratified later;\n * `automatic`: active as soon as the conditions are met. `delay_hours`: hours between admission and a USABLE card\n * (0 = at once) — the membership is active from admission, the card counts at the door only afterwards.\n */\n admission: { model: AdmissionModel; delay_hours: number };\n /** @deprecated Kept for compatibility: `true` when `admission.model` is `board`. Read `admission`. */\n approval_required: boolean;\n /**\n * Whether the association collects its members' address — of every member or of nobody. `none`: do not ask (an\n * `address` sent anyway is not stored); `optional`; `required`: enrolment answers 422 `required` on `address`\n * without one.\n */\n member_address: MemberAddressPolicy;\n /** How to pay the quota (IBAN, causale…), when the association published it. */\n payment_instructions: string | null;\n /**\n * The activities of general interest the association carries out (Italian Third Sector Code, art. 5): `cod` is\n * the letter of the article, `description` its Italian wording; one is marked as prevalent.\n */\n activity_sectors: Array<{ cod: string; description: string; prevalent: boolean }>;\n /**\n * Present when the association is registered in the RUNTS (the Italian national register of Third Sector\n * entities), as checked by the platform against the official public lists; `null` otherwise. Never typed by\n * the association.\n */\n registry: {\n section: 'APS' | 'ODV' | 'EF' | 'IS' | 'RA' | 'SOMS' | 'ALTRI' | null;\n /** Repertory number. */\n number: string | null;\n registered_on: string | null;\n /** Date of the official list the check ran against. */\n checked_on: string | null;\n } | null;\n };\n membership_types: MembershipType[];\n statuto: Statuto | null;\n}\n\nexport interface FiscalCodeCheck {\n /** Codice fiscale (16 characters). */\n code: string;\n first_name?: string;\n last_name?: string;\n gender?: 'M' | 'F';\n /** Date of birth, YYYY-MM-DD. */\n date?: string;\n /** Birthplace: the comune, for a person born in Italy. */\n place?: string;\n /**\n * Birth country, ISO 3166-1 alpha-2. A code encodes the comune for people born in Italy and only the STATE for\n * everybody else: anything but `IT` is compared with that state, and `place` is ignored.\n */\n country?: string;\n}\n\n/** What may disagree with a fiscal code. `gender` only where it is sent: enrolment and the profile never cross-check it. */\nexport type FiscalCodeMismatch = 'lastName' | 'firstName' | 'gender' | 'date' | 'place';\n/** `names_swapped`: the code matches once surname and given name are exchanged. */\nexport type FiscalCodeHint = 'names_swapped';\n\nexport interface FiscalCodeResult {\n valid: boolean;\n /** `invalid`: structure or check character; `mismatch`: a well-formed code that disagrees with the data sent. */\n error: 'invalid' | 'mismatch' | null;\n /** What disagrees with the code, when `error` is `mismatch`. */\n mismatches: FiscalCodeMismatch[];\n hints: FiscalCodeHint[];\n /** The date of birth the code itself encodes (YYYY-MM-DD). */\n birth_date: string | null;\n /** The birth country the code itself encodes, ISO 3166-1 alpha-2 (`IT` for a comune). */\n birth_country: string | null;\n}\n\nexport interface CardKeys {\n keys: Array<{ kty: string; crv: string; x: string; kid: string; use: string; alg: string }>;\n}\n\n// ---- client (server-side) surface ---------------------------------------------------------------------\n\n// ---- server-side signup + enrolment (client scopes identity:signup / enroll:write) ---------------------\n\n/** A person your system registers on Vimine (`POST /v1/signup`). */\nexport interface SignupInput {\n email: string;\n first_name: string;\n last_name: string;\n phone?: string | null;\n /** YYYY-MM-DD */\n dob?: string | null;\n /** Demographic only: it is not cross-checked. */\n gender?: 'M' | 'F' | null;\n /** Comune (born in Italy) or city, free text (born abroad). */\n birthplace?: string | null;\n /** ISO 3166-1 alpha-2. Send it for a person born abroad: their fiscal code encodes only the state. */\n birth_country?: string | null;\n /** Validated and cross-checked against the other fields when present. */\n codicefiscale?: string | null;\n /** The person confirms a code that disagrees with their particulars (422 `codicefiscale_mismatch` with `confirmable: true`). */\n codicefiscale_confirmed?: boolean;\n /** The account terms (`platform_terms`) the person accepted on your site — optional; when given it must name the in-force version (`GET /v1/legal/platform_terms`). */\n accept_terms?: LegalRef;\n /** The platform privacy notice (`platform_privacy`) the person read on your site — optional, same rule. */\n acknowledge_privacy?: LegalRef;\n /**\n * The language of the page the person filled in. It decides the language of the mails that follow and becomes the\n * preference of a NEW account; an existing account keeps its own.\n */\n locale?: Locale | string;\n}\n\n/** Whether an association collects its members' address (`GET /v1/aps/{slug}` → `aps.member_address`). */\nexport type MemberAddressPolicy = 'none' | 'optional' | 'required';\n\n/** A member's address, as `POST /v1/enroll`, `POST /v1/me/membership` and `POST /v1/enroll/confirm` take it. */\nexport interface MemberAddress {\n /** `residence` (the default) or, where different, `domicile`. */\n kind?: 'residence' | 'domicile';\n /** Street and number. */\n line: string;\n postal_code?: string | null;\n city: string;\n /** Italian addresses only (two letters); dropped abroad. */\n province?: string | null;\n /** ISO 3166-1 alpha-2 (default `IT`). */\n country?: string;\n}\n\n/**\n * `POST /v1/enroll/confirm` after a 409 `identification_required`: what the account still lacks — a fiscal code, or\n * date, place and country of birth. It completes the EMPTY fields of the profile, never over what is there.\n */\nexport interface EnrollIdentification {\n /** YYYY-MM-DD */\n dob?: string;\n birthplace?: string;\n /** ISO 3166-1 alpha-2 */\n birth_country?: string;\n codicefiscale?: string;\n codicefiscale_confirmed?: boolean;\n}\n\n/** A published legal text named by version (and hash when published). */\nexport interface LegalRef {\n version: string;\n sha256?: string;\n}\n\n/** A membership request your system submits for a person (`POST /v1/enroll`). */\nexport interface EnrollInput extends SignupInput {\n /**\n * Optional. A person is identified by a fiscal code OR by `dob` + `birthplace` + `birth_country` — never neither\n * (422 `required` on each missing particular). When present it is validated and cross-checked against the names,\n * the date and the place (the state, for people born abroad).\n */\n codicefiscale?: string | null;\n /**\n * Residence or, where different, domicile. Asked of every member or of nobody: the public profile says what the\n * association declared (`aps.member_address`).\n */\n address?: MemberAddress;\n /** Membership type uid; optional when the association offers exactly one. */\n membership_type?: string;\n /** The in-force statuto the person accepted on your site (see `Statuto.version`; `sha256` when published). */\n accept_statuto: { version: number; sha256?: string };\n /**\n * The association's privacy notice the person read on your site (`ApsPublicConfig.privacy_notice`). REQUIRED when the\n * association publishes one; 422 `privacy_notice_outdated` when it is not the in-force version.\n */\n privacy_notice?: { version: number; sha256?: string; locale?: Locale | string };\n}\n\n/** One acceptance, acknowledgement or consent the person recorded (`GET /v1/me/acceptances`). */\nexport interface AcceptanceRecord {\n at: string;\n action: 'accepted' | 'acknowledged' | 'consented' | 'withdrawn' | 'declared';\n channel: 'ui' | 'public' | 'api' | 'job' | 'paper';\n kind: string;\n title: string;\n version: string;\n sha256: string | null;\n /** Hash of the text actually shown. */\n rendered_sha256: string | null;\n locale: string | null;\n /** The association the act concerns, when any. */\n association: string | null;\n}\n\n/** A document the person has not acted on at its in-force version. */\nexport interface PendingDocument {\n kind: string;\n title: string;\n locale: string;\n version: string | number;\n sha256: string | null;\n effective_from: string | null;\n /** What the person is asked to do. */\n action: 'accepted' | 'acknowledged' | 'consented';\n /** Never acted on any version of this kind (false: a new version requires it again). */\n first: boolean;\n}\n\nexport interface MyAcceptances {\n items: AcceptanceRecord[];\n pending: {\n /** Account-layer documents still to accept / acknowledge. */\n platform: PendingDocument[];\n /** This association's notice to members, when not yet acknowledged. */\n privacy_notice: PendingDocument | null;\n };\n}\n\n/** `POST /v1/me/acceptances`: the in-force version your app showed. */\nexport interface AcceptanceInput {\n /** `platform_terms` | `platform_privacy` | `network_consent` | `privacy_notice` */\n kind: string;\n version: string | number;\n sha256?: string;\n}\n\nexport interface AcceptanceResult {\n recorded: true;\n kind: string;\n action: string;\n version: string;\n at: string;\n}\n\n/** The uniform answer of the creating routes: whatever happened behind the address, it was accepted. */\nexport interface Accepted {\n status: 'accepted';\n}\n\n/** `POST /v1/enroll/confirm` — the outcome of the confirmation link an existing account's owner uses. */\nexport interface EnrollConfirmResult {\n status: MembershipStatus;\n /** The person already had a membership request or membership here; nothing new was created. */\n already: boolean;\n /** In order: the association's approval first (board model), then the fee. */\n pending_reasons: PendingReason[];\n payment_open: boolean;\n valid_from: string | null;\n association: { name: string; slug: string };\n /**\n * Only for a link sent by the association's hosted enrolment page when that page was opened from one of its public\n * events: what became of the place asked for together with the request. `null` for every other link.\n */\n event?: EnrolledPlace | null;\n}\n\n/** The place asked for with a membership request made from an event's page (`EnrollConfirmResult.event`). */\nexport interface EnrolledPlace {\n slug: string;\n title: string;\n starts_at: string;\n timezone: string;\n place: string | null;\n registration_type: { uid: string; name: string; amount: number; currency: string };\n /**\n * `confirmed`: the place is theirs. `reserved`: held, see `waiting`. `held`: the membership request itself still\n * waits for the address to be confirmed, and no place was asked for. `unavailable`: no place, see `reasons`.\n */\n state: 'confirmed' | 'reserved' | 'held' | 'unavailable';\n /** What a `reserved` place waits for: the membership to become active, the contribution, or both. */\n waiting: ('membership' | 'contribution')[];\n /** Why the place is `unavailable`: the reasons of the eligibility endpoint. */\n reasons: string[];\n reserved_until: string | null;\n /** How to pay a contribution that is owed, in the association's words. */\n payment_instructions: string | null;\n /** The person held this place before the link was used. */\n already: boolean;\n}\n\n/** `POST /v1/me/membership/renew` — renewed at once (free type, no approval gate) or turned into a request. */\nexport interface RenewResult {\n renewed: boolean;\n requested: boolean;\n status: MembershipStatus;\n expires_at: string | null;\n renewal_requested_at: string | null;\n}\n\n/** `PATCH /v1/me/membership/network-opt-in` */\nexport interface NetworkOptIn {\n network_opt_in: boolean;\n network_opt_in_at: string | null;\n}\n\n/** `POST /v1/checkins` — a door check-in from a scanned card token. No personal data. */\n/** `POST /v1/checkins` for a CARD token. */\nexport interface CardCheckinResult {\n kind: 'card';\n verdict: MembershipVerdict;\n status: MembershipStatus;\n membership_id: string;\n valid_until: string | null;\n /** With `verdict: 'not_yet_valid'`: when the card becomes usable. The scan is recorded all the same. */\n valid_from: string | null;\n /**\n * A note for whoever staffs the gate, never part of `verdict`: it restricts nothing. `pending`: the member has no\n * verifiable fiscal code and nobody of the association has looked at a document yet — show it. Cleared from the\n * association's console. `null`: nothing to check. The public `verifyCard` never carries it.\n */\n identity_check: IdentityCheck | null;\n checked_in_at: string;\n}\n/**\n * The identity check at first presence (`CardCheckinResult.identity_check`). `pending`: a document is still to be\n * looked at; `verified`: somebody of the association looked at one; `flagged`: somebody did, and it did not agree —\n * a matter for the association's office, which revokes nothing by itself.\n */\nexport type IdentityCheck = 'pending' | 'verified' | 'flagged';\nexport type RegistrationCheckinVerdict = 'valid' | 'already_checked_in' | 'not_confirmed' | 'cancelled' | 'event_cancelled' | 'membership_invalid';\n/** `POST /v1/checkins` for an event REGISTRATION token (`k:'reg'` in the payload). */\nexport interface RegistrationCheckinResult {\n kind: 'registration';\n verdict: RegistrationCheckinVerdict;\n status: RegistrationStatus;\n registration_id: string;\n event: { slug: string; title: string; starts_at: string };\n registration_type: string | null;\n membership_id: string | null;\n membership_verdict: MembershipVerdict | null;\n /** True the first time this registration is checked in. */\n first: boolean;\n checked_in_at: string | null;\n}\nexport type CheckinResult = CardCheckinResult | RegistrationCheckinResult;\n\n/** One row of `GET /v1/memberships` — ids and status only. */\nexport interface MembershipListItem {\n id: string;\n status: MembershipStatus;\n verdict: MembershipVerdict;\n membership_type: { cod: string } | null;\n issued_at: string | null;\n valid_until: string | null;\n updated_at: string;\n}\nexport interface MembershipList {\n items: MembershipListItem[];\n next_cursor: string | null;\n}\nexport interface MembershipListParams {\n status?: MembershipStatus;\n /** RFC 3339: only rows changed after this instant (incremental sync). */\n updated_since?: string;\n limit?: number;\n cursor?: string;\n}\n\nexport interface MembershipStatusInfo {\n id: string;\n status: MembershipStatus;\n verdict: MembershipVerdict;\n valid_until: string | null;\n membership_type: { cod: string } | null;\n}\n\nexport interface SandboxMember {\n email: string;\n name: string;\n status: MembershipStatus;\n expires_at: string | null;\n statuto_accepted: boolean;\n}\n\nexport interface SandboxMembers {\n slug: string;\n members: SandboxMember[];\n}\n\nexport interface SandboxReset {\n /** The synthetic members' shared password — shown only here. */\n password: string;\n members: Array<Pick<SandboxMember, 'email' | 'name' | 'status'>>;\n}\n\n// ---- events & registrations (/v1/aps/{slug}/events, /v1/events*, /v1/me/registrations*) ---------------------\n// Vocabulary: registration (iscrizione) and contribution (contributo) — never \"ticket\".\n\nexport type EventStatus = 'published' | 'completed' | 'cancelled';\nexport type EventVisibility = 'members_only' | 'public';\nexport type RegistrationStatus = 'reserved' | 'confirmed' | 'cancelled' | 'refunded';\n/** Why a registration was cancelled. */\nexport type RegistrationCancelReason =\n /** The member cancelled it, inside the event's cancellation window. */\n | 'user'\n /** The association's secretariat cancelled it. */\n | 'staff'\n /** A reserved place whose contribution did not arrive before the hold ran out. */\n | 'expired'\n | 'event_cancelled'\n /** A place held while the membership request was pending, for an event that starts before the new card is usable. */\n | 'card_not_valid_yet'\n /** The association did not accept the membership request (or the provisional admission) the place was held under. */\n | 'membership_rejected'\n /** The association revoked the membership the place needed. */\n | 'membership_revoked';\n/** Why a registration type is not open right now. */\nexport type RegistrationTypeReason = 'sold_out' | 'registration_not_open' | 'registration_closed';\n/** Why the member may not register (`GET /v1/events/{slug}/eligibility`, `422 not_eligible`). */\nexport type EligibilityReason =\n | 'membership_required'\n | 'membership_not_active'\n /** The event starts before the member's card is usable (the association's usability delay). */\n | 'membership_not_yet_valid'\n | 'membership_type_not_allowed'\n | 'sold_out'\n | 'event_full'\n | 'registration_not_open'\n | 'registration_closed'\n | 'max_per_user'\n | 'event_past'\n | 'event_cancelled'\n | 'event_not_published'\n | 'plan_limit'\n | 'invalid_type';\n\nexport interface EventLocation {\n name: string | null;\n address: string | null;\n lat: number | null;\n lng: number | null;\n}\n\n/** An admission class of an event: free (`amount` 0) or a contribution; places and window are live. */\nexport interface RegistrationType {\n uid: string;\n cod: string;\n name: string;\n description: string | null;\n amount: number;\n currency: string;\n quantity: number | null;\n /** Places left (never who holds them); null = unlimited. */\n remaining: number | null;\n max_per_user: number;\n requires_active_membership: boolean;\n open: boolean;\n reason: RegistrationTypeReason | null;\n opens_at: string | null;\n closes_at: string | null;\n}\n\n/** An event as the API describes it: headless copy, dates, place, images, live availability per type. */\nexport interface Event {\n id: string;\n slug: string;\n /**\n * The language the `title` was served in. When it is not the one you asked for, the association wrote no\n * translation: you got its own text — never a machine translation. Each text falls back on its own.\n */\n locale: Locale;\n /** The languages in which this event has a title. */\n locales: Locale[];\n title: string;\n summary: string | null;\n /** Markdown — render it yourself. */\n description_md: string | null;\n starts_at: string;\n ends_at: string | null;\n timezone: string;\n status: EventStatus;\n visibility: EventVisibility;\n location: EventLocation | null;\n cover_url: string | null;\n gallery: { url: string; alt: string | null; order: number }[];\n links: { label: string; url: string }[];\n registration: { opens_at: string | null; closes_at: string | null; capacity: number | null; remaining: number | null; cancellation_hours: number };\n registration_types: RegistrationType[];\n published_at: string | null;\n cancelled_at: string | null;\n cancel_reason: string | null;\n}\nexport interface EventList {\n items: Event[];\n}\nexport interface EventListParams extends LocaleParam {\n /** `upcoming` (default) | `past` | `cancelled` | `all` */\n filter?: 'upcoming' | 'past' | 'cancelled' | 'all';\n /** RFC 3339 bounds on `starts_at`. */\n from?: string;\n to?: string;\n limit?: number;\n}\n\nexport interface Eligibility {\n can_register: boolean;\n membership_verdict: MembershipVerdict | null;\n types: { uid: string; cod: string; can_register: boolean; reasons: EligibilityReason[]; pending_membership: boolean }[];\n}\n\nexport interface RegistrationRequest {\n registration_type: string;\n note?: string | null;\n quantity?: number;\n /** The language the registration was made in: the fallback for a member who never chose one. */\n locale?: Locale | string;\n}\n\n/** A person's registration (the member's own, or a guest's after the confirmation link). */\nexport interface Registration {\n id: string;\n status: RegistrationStatus;\n event: { id: string; slug: string; title: string; starts_at: string; ends_at: string | null; timezone: string; status: EventStatus; location: string | null; cancel_reason: string | null } | null;\n registration_type: { uid: string; cod: string; name: string; amount: number; currency: string } | null;\n quantity: number;\n reserved_until: string | null;\n checked_in_at: string | null;\n cancelled_at: string | null;\n cancel_reason: RegistrationCancelReason | null;\n can_cancel: boolean;\n payment: { status: 'recorded' | 'refunded' | 'void'; amount: number; currency: string; method: string; paid_at: string } | null;\n /** How to pay the contribution while `reserved` (the association's own text). */\n payment_instructions?: string | null;\n note: string | null;\n created_at: string;\n /** The registration QR payload (`vmt_…`), confirmed registrations only — draw it as a QR code. */\n token?: string | null;\n}\nexport interface RegistrationList {\n items: Registration[];\n}\n\n/** `POST /v1/events/{slug}/registrations/guest` (client scope `registrations:write`, public events only). */\nexport interface GuestRegistrationRequest {\n email: string;\n first_name: string;\n last_name: string;\n registration_type: string;\n note?: string | null;\n /** The language the registration was made in — for a guest, the language of every mail they receive. */\n locale?: Locale | string;\n}\n\n/** One row of `GET /v1/events/{slug}/registrations` — no personal data. */\nexport interface RegistrationListItem {\n id: string;\n status: RegistrationStatus;\n registration_type: string | null;\n membership_id: string | null;\n quantity: number;\n checked_in_at: string | null;\n created_at: string;\n}\nexport interface EventRegistrationList {\n items: RegistrationListItem[];\n next_cursor: string | null;\n}\nexport interface EventRegistrationListParams {\n status?: RegistrationStatus;\n limit?: number;\n cursor?: string;\n}\n\n"]}
package/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "@vimine/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.3.2",
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
11
  "type": "module",
7
12
  "sideEffects": false,
8
13
  "main": "./dist/index.js",