wedance-shared 1.0.160 → 1.0.161
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/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/poll.d.ts +102 -0
- package/dist/types/poll.js +2 -0
- package/dist/types/poll.js.map +1 -0
- package/package.json +1 -1
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -12,6 +12,7 @@ export * from "./support.js";
|
|
|
12
12
|
export * from "./coupons.js";
|
|
13
13
|
export * from "./checkin.js";
|
|
14
14
|
export * from "./pass.js";
|
|
15
|
+
export * from "./poll.js";
|
|
15
16
|
// Re-export from subdirectories
|
|
16
17
|
export * from "./festivals/index.js";
|
|
17
18
|
//# sourceMappingURL=index.js.map
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAE1B,gCAAgC;AAChC,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAE1B,gCAAgC;AAChC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { LanguageCode } from "./other.js";
|
|
2
|
+
/**
|
|
3
|
+
* Mirrors the `{ fi, en }` shape already used by `Organizer.description`.
|
|
4
|
+
*/
|
|
5
|
+
export type LocalizedText = {
|
|
6
|
+
en: string;
|
|
7
|
+
fi: string;
|
|
8
|
+
};
|
|
9
|
+
export type PollQuestionType = "single_choice" | "multi_choice" | "text";
|
|
10
|
+
export type PollQuestionOption = {
|
|
11
|
+
/** Stable human-readable slug, e.g. "weekly". Never renamed after publish. */
|
|
12
|
+
id: string;
|
|
13
|
+
label: LocalizedText;
|
|
14
|
+
};
|
|
15
|
+
export type PollQuestion = {
|
|
16
|
+
/** Stable slug, unique within the poll, e.g. "q1". */
|
|
17
|
+
id: string;
|
|
18
|
+
type: PollQuestionType;
|
|
19
|
+
body: LocalizedText;
|
|
20
|
+
/** Present for "single" and "multi". Omitted for "text". */
|
|
21
|
+
options?: PollQuestionOption[];
|
|
22
|
+
/** "multi" only. Omit for no limit. */
|
|
23
|
+
maxSelections?: number;
|
|
24
|
+
isRequired: boolean;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Row shape for `public.polls`.
|
|
28
|
+
*/
|
|
29
|
+
export type Poll = {
|
|
30
|
+
id: string;
|
|
31
|
+
title: LocalizedText;
|
|
32
|
+
description: LocalizedText | null;
|
|
33
|
+
questions: PollQuestion[];
|
|
34
|
+
startsAt: string;
|
|
35
|
+
endsAt: string;
|
|
36
|
+
createdAt: string;
|
|
37
|
+
updatedAt: string;
|
|
38
|
+
status: "draft" | "published" | "archived";
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Answer value per question type:
|
|
42
|
+
* - "single" → option id
|
|
43
|
+
* - "multi" → option ids
|
|
44
|
+
* - "text" → the raw text
|
|
45
|
+
*/
|
|
46
|
+
export type PollAnswerValue = string | string[];
|
|
47
|
+
export type PollAnswers = Record<string, PollAnswerValue>;
|
|
48
|
+
/**
|
|
49
|
+
* Row shape for `public.poll_responses`.
|
|
50
|
+
*/
|
|
51
|
+
export type PollResponse = {
|
|
52
|
+
id: string;
|
|
53
|
+
pollId: string;
|
|
54
|
+
userId: string;
|
|
55
|
+
answers: PollAnswers;
|
|
56
|
+
/** Snapshot of the user's city at submit time. */
|
|
57
|
+
city: string | null;
|
|
58
|
+
/** Language the app was in when answering. */
|
|
59
|
+
language: LanguageCode | null;
|
|
60
|
+
createdAt: string;
|
|
61
|
+
};
|
|
62
|
+
/** `GET /polls/active` — null when no poll is running. */
|
|
63
|
+
export type ActivePollResponse = {
|
|
64
|
+
poll: Poll;
|
|
65
|
+
hasAnswered: boolean;
|
|
66
|
+
} | null;
|
|
67
|
+
/** `POST /polls/:id/responses` */
|
|
68
|
+
export type SubmitPollResponseInput = {
|
|
69
|
+
answers: PollAnswers;
|
|
70
|
+
language?: LanguageCode;
|
|
71
|
+
};
|
|
72
|
+
export type PollOptionTally = {
|
|
73
|
+
optionId: string;
|
|
74
|
+
count: number;
|
|
75
|
+
/** 0–100, rounded to one decimal. */
|
|
76
|
+
percentage: number;
|
|
77
|
+
};
|
|
78
|
+
export type PollQuestionResults = {
|
|
79
|
+
questionId: string;
|
|
80
|
+
type: PollQuestionType;
|
|
81
|
+
/** Choice questions only. */
|
|
82
|
+
tallies?: PollOptionTally[];
|
|
83
|
+
/** Text questions only — admin-visible, for manual quote selection. */
|
|
84
|
+
textAnswers?: {
|
|
85
|
+
text: string;
|
|
86
|
+
city: string | null;
|
|
87
|
+
language: LanguageCode | null;
|
|
88
|
+
}[];
|
|
89
|
+
/** Responses that answered this question. */
|
|
90
|
+
answeredCount: number;
|
|
91
|
+
};
|
|
92
|
+
/** `GET /polls/:id/results` — admin only. */
|
|
93
|
+
export type PollResults = {
|
|
94
|
+
pollId: string;
|
|
95
|
+
totalResponses: number;
|
|
96
|
+
/** Response counts per city, descending. */
|
|
97
|
+
byCity: {
|
|
98
|
+
city: string;
|
|
99
|
+
count: number;
|
|
100
|
+
}[];
|
|
101
|
+
questions: PollQuestionResults[];
|
|
102
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poll.js","sourceRoot":"","sources":["../../src/types/poll.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED