@vestcards/shared 1.0.3 → 1.2.0
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/colors-G1GHbBJq.js +120 -0
- package/dist/colors-c6Q-ORB_.cjs +1 -0
- package/dist/fsrs-DEA3eLGO.cjs +1 -0
- package/dist/fsrs-sJJWxUiC.js +14 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +215 -11
- package/dist/index.js +196 -23
- package/dist/spaced-repetition.cjs +1 -1
- package/dist/spaced-repetition.d.ts +9 -7
- package/dist/spaced-repetition.js +1 -1
- package/dist/theme.cjs +1 -1
- package/dist/theme.d.ts +48 -27
- package/dist/theme.js +16 -111
- package/dist/utils.cjs +1 -0
- package/dist/utils.d.ts +15 -0
- package/dist/utils.js +36 -0
- package/package.json +10 -3
- package/dist/fsrs-C8QUsZ5l.js +0 -10
- package/dist/fsrs-HJutnIWm.cjs +0 -1
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import * as c from "@radix-ui/colors";
|
|
2
|
+
const a = (r, e) => {
|
|
3
|
+
var o;
|
|
4
|
+
const g = e.charAt(0) === "a" && !Number.isNaN(Number(e.slice(1))) ? `${r}A` : r, s = `${r}${e.charAt(0).toUpperCase() + e.slice(1)}`;
|
|
5
|
+
return ((o = c[g]) == null ? void 0 : o[s]) ?? `var(--${r}-${e})`;
|
|
6
|
+
}, t = (r, e, b) => [r, a(e, b)];
|
|
7
|
+
function n(r) {
|
|
8
|
+
const e = Array.from({ length: 12 }, (b, g) => {
|
|
9
|
+
const s = g + 1;
|
|
10
|
+
return [t(s.toString(), r, s.toString()), t(`a${s}`, r, `a${s}`)];
|
|
11
|
+
}).flat();
|
|
12
|
+
return e.push(t("DEFAULT", r, "9")), e.push(t("hover", r, "10")), e.push(t("dark", r, "11")), e.push(t("light", r, "4")), e.push(t("lightness", r, "2")), Object.fromEntries(e);
|
|
13
|
+
}
|
|
14
|
+
const d = {
|
|
15
|
+
transparent: "transparent",
|
|
16
|
+
current: "currentColor",
|
|
17
|
+
brand: {
|
|
18
|
+
DEFAULT: "#FF7824"
|
|
19
|
+
},
|
|
20
|
+
primary: {
|
|
21
|
+
...n("orange")
|
|
22
|
+
},
|
|
23
|
+
secondary: {
|
|
24
|
+
...n("blue")
|
|
25
|
+
},
|
|
26
|
+
tertiary: {
|
|
27
|
+
...n("amber")
|
|
28
|
+
},
|
|
29
|
+
quaternary: {
|
|
30
|
+
...n("crimson")
|
|
31
|
+
},
|
|
32
|
+
quinary: {
|
|
33
|
+
...n("jade")
|
|
34
|
+
},
|
|
35
|
+
gray: {
|
|
36
|
+
...n("sand")
|
|
37
|
+
},
|
|
38
|
+
success: {
|
|
39
|
+
...n("grass")
|
|
40
|
+
},
|
|
41
|
+
warning: {
|
|
42
|
+
...n("amber")
|
|
43
|
+
},
|
|
44
|
+
danger: {
|
|
45
|
+
...n("red")
|
|
46
|
+
},
|
|
47
|
+
black: {
|
|
48
|
+
DEFAULT: "#000000",
|
|
49
|
+
a1: "rgba(0, 0, 0, 0.05)",
|
|
50
|
+
a2: "rgba(0, 0, 0, 0.1)",
|
|
51
|
+
a3: "rgba(0, 0, 0, 0.15)",
|
|
52
|
+
a4: "rgba(0, 0, 0, 0.2)",
|
|
53
|
+
a5: "rgba(0, 0, 0, 0.3)",
|
|
54
|
+
a6: "rgba(0, 0, 0, 0.4)",
|
|
55
|
+
a7: "rgba(0, 0, 0, 0.5)",
|
|
56
|
+
a8: "rgba(0, 0, 0, 0.6)",
|
|
57
|
+
a9: "rgba(0, 0, 0, 0.7)",
|
|
58
|
+
a10: "rgba(0, 0, 0, 0.8)",
|
|
59
|
+
a11: "rgba(0, 0, 0, 0.9)",
|
|
60
|
+
a12: "rgba(0, 0, 0, 0.95)"
|
|
61
|
+
},
|
|
62
|
+
white: {
|
|
63
|
+
DEFAULT: "#FFFFFF",
|
|
64
|
+
a1: "rgba(255, 255, 255, 0.05)",
|
|
65
|
+
a2: "rgba(255, 255, 255, 0.1)",
|
|
66
|
+
a3: "rgba(255, 255, 255, 0.15)",
|
|
67
|
+
a4: "rgba(255, 255, 255, 0.2)",
|
|
68
|
+
a5: "rgba(255, 255, 255, 0.3)",
|
|
69
|
+
a6: "rgba(255, 255, 255, 0.4)",
|
|
70
|
+
a7: "rgba(255, 255, 255, 0.5)",
|
|
71
|
+
a8: "rgba(255, 255, 255, 0.6)",
|
|
72
|
+
a9: "rgba(255, 255, 255, 0.7)",
|
|
73
|
+
a10: "rgba(255, 255, 255, 0.8)",
|
|
74
|
+
a11: "rgba(255, 255, 255, 0.9)",
|
|
75
|
+
a12: "rgba(255, 255, 255, 0.95)"
|
|
76
|
+
},
|
|
77
|
+
data: {
|
|
78
|
+
1: "#1d4aff",
|
|
79
|
+
2: "#621da6",
|
|
80
|
+
3: "#42827e",
|
|
81
|
+
4: "#ce0e74",
|
|
82
|
+
5: "#f14f58",
|
|
83
|
+
6: "#7c440e",
|
|
84
|
+
7: "#529a0a",
|
|
85
|
+
8: "#0476fb",
|
|
86
|
+
9: "#fe729e",
|
|
87
|
+
10: "#35416b",
|
|
88
|
+
11: "#41cbc4",
|
|
89
|
+
12: "#b64b02",
|
|
90
|
+
13: "#e4a604",
|
|
91
|
+
14: "#a56eff",
|
|
92
|
+
15: "#30d5c8"
|
|
93
|
+
},
|
|
94
|
+
// shadcn colors
|
|
95
|
+
foreground: a("sand", "12"),
|
|
96
|
+
background: a("sand", "2"),
|
|
97
|
+
ring: a("blue", "6"),
|
|
98
|
+
muted: {
|
|
99
|
+
DEFAULT: a("sand", "3"),
|
|
100
|
+
foreground: a("sand", "10")
|
|
101
|
+
},
|
|
102
|
+
border: a("sand", "5"),
|
|
103
|
+
input: a("sand", "4"),
|
|
104
|
+
accent: a("blue", "2"),
|
|
105
|
+
sidebar: {
|
|
106
|
+
DEFAULT: a("sand", "3"),
|
|
107
|
+
foreground: a("sand", "11"),
|
|
108
|
+
accent: "white",
|
|
109
|
+
"accent-foreground": a("orange", "11"),
|
|
110
|
+
border: a("sand", "6"),
|
|
111
|
+
ring: a("blue", "6")
|
|
112
|
+
},
|
|
113
|
+
popover: {
|
|
114
|
+
DEFAULT: "#FFFFFF",
|
|
115
|
+
foreground: a("sand", "11")
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
export {
|
|
119
|
+
d as c
|
|
120
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const c=require("@radix-ui/colors");function u(a){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const n in a)if(n!=="default"){const b=Object.getOwnPropertyDescriptor(a,n);Object.defineProperty(r,n,b.get?b:{enumerable:!0,get:()=>a[n]})}}return r.default=a,Object.freeze(r)}const d=u(c),e=(a,r)=>{var g;const b=r.charAt(0)==="a"&&!Number.isNaN(Number(r.slice(1)))?`${a}A`:a,o=`${a}${r.charAt(0).toUpperCase()+r.slice(1)}`;return((g=d[b])==null?void 0:g[o])??`var(--${a}-${r})`},s=(a,r,n)=>[a,e(r,n)];function t(a){const r=Array.from({length:12},(n,b)=>{const o=b+1;return[s(o.toString(),a,o.toString()),s(`a${o}`,a,`a${o}`)]}).flat();return r.push(s("DEFAULT",a,"9")),r.push(s("hover",a,"10")),r.push(s("dark",a,"11")),r.push(s("light",a,"4")),r.push(s("lightness",a,"2")),Object.fromEntries(r)}const i={transparent:"transparent",current:"currentColor",brand:{DEFAULT:"#FF7824"},primary:{...t("orange")},secondary:{...t("blue")},tertiary:{...t("amber")},quaternary:{...t("crimson")},quinary:{...t("jade")},gray:{...t("sand")},success:{...t("grass")},warning:{...t("amber")},danger:{...t("red")},black:{DEFAULT:"#000000",a1:"rgba(0, 0, 0, 0.05)",a2:"rgba(0, 0, 0, 0.1)",a3:"rgba(0, 0, 0, 0.15)",a4:"rgba(0, 0, 0, 0.2)",a5:"rgba(0, 0, 0, 0.3)",a6:"rgba(0, 0, 0, 0.4)",a7:"rgba(0, 0, 0, 0.5)",a8:"rgba(0, 0, 0, 0.6)",a9:"rgba(0, 0, 0, 0.7)",a10:"rgba(0, 0, 0, 0.8)",a11:"rgba(0, 0, 0, 0.9)",a12:"rgba(0, 0, 0, 0.95)"},white:{DEFAULT:"#FFFFFF",a1:"rgba(255, 255, 255, 0.05)",a2:"rgba(255, 255, 255, 0.1)",a3:"rgba(255, 255, 255, 0.15)",a4:"rgba(255, 255, 255, 0.2)",a5:"rgba(255, 255, 255, 0.3)",a6:"rgba(255, 255, 255, 0.4)",a7:"rgba(255, 255, 255, 0.5)",a8:"rgba(255, 255, 255, 0.6)",a9:"rgba(255, 255, 255, 0.7)",a10:"rgba(255, 255, 255, 0.8)",a11:"rgba(255, 255, 255, 0.9)",a12:"rgba(255, 255, 255, 0.95)"},data:{1:"#1d4aff",2:"#621da6",3:"#42827e",4:"#ce0e74",5:"#f14f58",6:"#7c440e",7:"#529a0a",8:"#0476fb",9:"#fe729e",10:"#35416b",11:"#41cbc4",12:"#b64b02",13:"#e4a604",14:"#a56eff",15:"#30d5c8"},foreground:e("sand","12"),background:e("sand","2"),ring:e("blue","6"),muted:{DEFAULT:e("sand","3"),foreground:e("sand","10")},border:e("sand","5"),input:e("sand","4"),accent:e("blue","2"),sidebar:{DEFAULT:e("sand","3"),foreground:e("sand","11"),accent:"white","accent-foreground":e("orange","11"),border:e("sand","6"),ring:e("blue","6")},popover:{DEFAULT:"#FFFFFF",foreground:e("sand","11")}};exports.colors=i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var a=(e=>(e.New="New",e.Learning="Learning",e.Review="Review",e.Relearning="Relearning",e))(a||{});const n=["New","Learning","Review","Relearning"],i={Manual:"Manual",Again:"Again",Hard:"Hard",Good:"Good",Easy:"Easy"},r=["Manual","Again","Hard","Good","Easy"];exports.ReviewRating=i;exports.ReviewState=a;exports.reviewRatings=r;exports.reviewStates=n;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
var n = /* @__PURE__ */ ((a) => (a.New = "New", a.Learning = "Learning", a.Review = "Review", a.Relearning = "Relearning", a))(n || {});
|
|
2
|
+
const e = ["New", "Learning", "Review", "Relearning"], r = {
|
|
3
|
+
Manual: "Manual",
|
|
4
|
+
Again: "Again",
|
|
5
|
+
Hard: "Hard",
|
|
6
|
+
Good: "Good",
|
|
7
|
+
Easy: "Easy"
|
|
8
|
+
}, i = ["Manual", "Again", "Hard", "Good", "Easy"];
|
|
9
|
+
export {
|
|
10
|
+
r as R,
|
|
11
|
+
n as a,
|
|
12
|
+
e as b,
|
|
13
|
+
i as r
|
|
14
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./fsrs-DEA3eLGO.cjs"),P=require("./colors-c6Q-ORB_.cjs"),C=9999;function I({data:e,error:r},a){if(r){const t=r.value,A=t&&typeof t=="object"&&t!==null&&"message"in t?String(t.message):a;throw new Error(A||a)}if(!e||typeof e=="object"&&"error"in e)throw new Error(a);return e}var D=(e=>(e.Draft="draft",e.Published="published",e))(D||{});const N=["not-reviewed","card-updated","demand-rejected","card-removed"];var c=(e=>(e.Draft="draft",e.Review="to_review",e.Published="published",e.Archived="archived",e))(c||{});const m=["matemática","geografia","física","biologia","história","literatura","gramática","sociologia","química","filosofia","redação","artes","inglês"];var i=(e=>(e.Admin="admin",e.Moderator="moderator",e.User="user",e))(i||{}),R=(e=>(e.Owner="owner",e.Admin="admin",e.Member="member",e))(R||{}),s=(e=>(e.Premium="premium",e))(s||{}),_=(e=>(e.Active="active",e.Canceled="canceled",e.Pending="pending",e.Expired="expired",e))(_||{});const E={APP:{ACCESS:"app:access"},DECK:{CREATE_OWN:"deck:create:own",CREATE_PUBLIC:"deck:create:public",READ_OWN:"deck:read:own",READ_OTHERS:"deck:read:others",READ_UNPUBLISHED:"deck:read:unpublished",READ_FREE:"deck:read:free",READ_PREMIUM:"deck:read:premium",READ_PRIVATE:"deck:read:private",UPDATE_OWN:"deck:update:own",UPDATE_PUBLIC:"deck:update:public",DELETE_OWN:"deck:delete:own",DELETE_PUBLIC:"deck:delete:public"},CARD_DEMAND:{READ_ALL:"card-demand:read:*",CREATE:"card-demand:create",ACTION:"card-demand:action"},USER:{UPDATE_OWN:"user:update:own",UPDATE_ALL:"user:update:*",DELETE_OWN:"user:delete:own",DELETE_ALL:"user:delete:*",READ_OWN:"user:read:own",READ_ALL:"user:read:*"},STATS:{VIEW:"stats:view"},MEMBERSHIP:{MANAGE:"membership:manage"},PLAN:{CREATE:"plan:create",UPDATE:"plan:update",DELETE:"plan:delete"},BLOGPOST:{CREATE:"blogpost:create",UPDATE:"blogpost:update",DELETE:"blogpost:delete"},VESTY:{CHAT:"vesty:chat"},STUDY:{READ:"study:read",WRITE:"study:write"},LIBRARY:{READ:"library:read",WRITE:"library:write",WRITE_PREMIUM:"library:write:premium"},ADMIN_PANEL:{VIEW:"admin-panel:view"}},U={APP_ACCESS:E.APP.ACCESS,DECK_CREATE_OWN:E.DECK.CREATE_OWN,DECK_CREATE_PUBLIC:E.DECK.CREATE_PUBLIC,DECK_READ_OWN:E.DECK.READ_OWN,DECK_READ_OTHERS:E.DECK.READ_OTHERS,DECK_READ_UNPUBLISHED:E.DECK.READ_UNPUBLISHED,DECK_READ_FREE:E.DECK.READ_FREE,DECK_READ_PREMIUM:E.DECK.READ_PREMIUM,DECK_READ_PRIVATE:E.DECK.READ_PRIVATE,DECK_UPDATE_OWN:E.DECK.UPDATE_OWN,DECK_UPDATE_PUBLIC:E.DECK.UPDATE_PUBLIC,DECK_DELETE_OWN:E.DECK.DELETE_OWN,DECK_DELETE_PUBLIC:E.DECK.DELETE_PUBLIC,CARD_DEMAND_READ_ALL:E.CARD_DEMAND.READ_ALL,CARD_DEMAND_CREATE:E.CARD_DEMAND.CREATE,CARD_DEMAND_ACTION:E.CARD_DEMAND.ACTION,USER_UPDATE_OWN:E.USER.UPDATE_OWN,USER_UPDATE_ALL:E.USER.UPDATE_ALL,USER_DELETE_OWN:E.USER.DELETE_OWN,USER_DELETE_ALL:E.USER.DELETE_ALL,USER_READ_OWN:E.USER.READ_OWN,USER_READ_ALL:E.USER.READ_ALL,STATS_VIEW:E.STATS.VIEW,MEMBERSHIP_MANAGE:E.MEMBERSHIP.MANAGE,PLAN_CREATE:E.PLAN.CREATE,PLAN_UPDATE:E.PLAN.UPDATE,PLAN_DELETE:E.PLAN.DELETE,BLOGPOST_CREATE:E.BLOGPOST.CREATE,BLOGPOST_UPDATE:E.BLOGPOST.UPDATE,BLOGPOST_DELETE:E.BLOGPOST.DELETE,VESTY_CHAT:E.VESTY.CHAT,STUDY_READ:E.STUDY.READ,STUDY_WRITE:E.STUDY.WRITE,LIBRARY_READ:E.LIBRARY.READ,LIBRARY_WRITE:E.LIBRARY.WRITE,LIBRARY_WRITE_PREMIUM:E.LIBRARY.WRITE_PREMIUM,ADMIN_PANEL_VIEW:E.ADMIN_PANEL.VIEW},T=Object.values(E).flatMap(e=>Object.values(e)),u={[i.User]:["deck:read:free","deck:read:own","deck:delete:own","study:read","study:write","library:read","library:write","card-demand:create","user:update:own","user:delete:own","user:read:own"],[i.Moderator]:["app:access","deck:read:free","deck:read:own","deck:read:premium","deck:read:private","deck:read:unpublished","deck:delete:own","card-demand:read:*","card-demand:create","card-demand:action","study:read","study:write","library:read","library:write","library:write:premium","user:update:own","user:delete:own","user:read:own","admin-panel:view"],[i.Admin]:T},S={[s.Premium]:["app:access","deck:create:own","deck:update:own","deck:read:premium","stats:view","vesty:chat","library:write:premium"]},p=(e,r,a)=>{if(!r)return!1;if(u[r].includes(e))return!0;for(const A of a??[])if((S[A]??[]).includes(e))return!0;return!1};var l=(e=>(e.Published="published",e.Draft="draft",e.Archived="archived",e))(l||{});const n={história:"quaternary",geografia:"tertiary",matemática:"secondary",biologia:"primary",física:"quinary",gramática:"tertiary",literatura:"secondary",química:"primary",filosofia:"quaternary",sociologia:"quinary",redação:"secondary",artes:"tertiary",inglês:"quinary",default:"default"},o={matemática:"radical",gramática:"spell-check",literatura:"book-open",biologia:"dna",química:"test-tube-diagonal",física:"atom",história:"scroll",geografia:"earth",filosofia:"brain",sociologia:"users-round",redação:"notebook-pen",artes:"palette",inglês:"languages",default:"graduation-cap"},O=e=>o[e]||o.default,L=e=>n[e]||n.default,w=e=>{const r=L(e),a=r==="default"?"gray":r;return P.colors[a].DEFAULT};exports.ReviewRating=d.ReviewRating;exports.ReviewState=d.ReviewState;exports.reviewRatings=d.reviewRatings;exports.reviewStates=d.reviewStates;exports.ALL_PERMISSIONS=T;exports.BlogPostStatus=D;exports.DeckStatus=c;exports.ENTITLEMENT_PERMISSIONS=S;exports.Entitlement=s;exports.EntranceExamProgramStatus=l;exports.MembershipStatus=_;exports.OrganizationRole=R;exports.PERMISSIONS=E;exports.Permission=U;exports.ROLE_PERMISSIONS=u;exports.SUBJECTS=m;exports.SUBJECT_COLORS=n;exports.SUBJECT_ICONS=o;exports.UNPAGINATED_SIZE=C;exports.UserRole=i;exports.cardDemandStatus=N;exports.getSubjectCSSColor=w;exports.getSubjectColor=L;exports.getSubjectIcon=O;exports.hasPermission=p;exports.unwrapApiResponse=I;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
|
+
export declare const ALL_PERMISSIONS: Permission[];
|
|
2
|
+
|
|
1
3
|
export declare type BillingType = 'PIX' | 'CREDIT_CARD' | 'BOLETO';
|
|
2
4
|
|
|
5
|
+
export declare type BlogPostQuestion = {
|
|
6
|
+
question: string;
|
|
7
|
+
answer: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export declare enum BlogPostStatus {
|
|
11
|
+
Draft = "draft",
|
|
12
|
+
Published = "published"
|
|
13
|
+
}
|
|
14
|
+
|
|
3
15
|
export declare type CardDemandStatus = (typeof cardDemandStatus)[number];
|
|
4
16
|
|
|
5
17
|
export declare const cardDemandStatus: readonly ["not-reviewed", "card-updated", "demand-rejected", "card-removed"];
|
|
@@ -11,15 +23,59 @@ export declare enum DeckStatus {
|
|
|
11
23
|
Archived = "archived"
|
|
12
24
|
}
|
|
13
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Extracts the success data type from an Eden Treaty endpoint function.
|
|
28
|
+
*
|
|
29
|
+
* Usage:
|
|
30
|
+
* ```ts
|
|
31
|
+
* type PaginatedDecks = EdenData<typeof server.v1.decks.get>;
|
|
32
|
+
* // → { data: IDeck[]; pageCount: number; total: number; }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare type EdenData<T extends (...args: never) => unknown> = Awaited<ReturnType<T>> extends {
|
|
36
|
+
data: infer D;
|
|
37
|
+
} ? NonNullable<D> : never;
|
|
38
|
+
|
|
39
|
+
declare interface EdenError {
|
|
40
|
+
value: unknown;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Extracts the parameters object from an Eden Treaty endpoint function.
|
|
45
|
+
*
|
|
46
|
+
* Usage:
|
|
47
|
+
* ```ts
|
|
48
|
+
* type DeckFilters = EdenParams<typeof server.v1.decks.get>['query'];
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare type EdenParams<T extends (...args: never) => unknown> = Parameters<T>[0];
|
|
52
|
+
|
|
53
|
+
declare interface EdenResponse<T> {
|
|
54
|
+
data: T | null;
|
|
55
|
+
error: EdenError | null;
|
|
56
|
+
}
|
|
57
|
+
|
|
14
58
|
export declare enum Entitlement {
|
|
15
59
|
Premium = "premium"
|
|
16
60
|
}
|
|
17
61
|
|
|
62
|
+
export declare const ENTITLEMENT_PERMISSIONS: Record<Entitlement, Permission[]>;
|
|
63
|
+
|
|
18
64
|
export declare type EntityType = 'user' | 'organization' | 'official';
|
|
19
65
|
|
|
66
|
+
export declare enum EntranceExamProgramStatus {
|
|
67
|
+
Published = "published",
|
|
68
|
+
Draft = "draft",
|
|
69
|
+
Archived = "archived"
|
|
70
|
+
}
|
|
71
|
+
|
|
20
72
|
export declare const getSubjectColor: (subject: string) => SemanticColor;
|
|
21
73
|
|
|
22
|
-
export declare const
|
|
74
|
+
export declare const getSubjectCSSColor: (subject: string) => string;
|
|
75
|
+
|
|
76
|
+
export declare const getSubjectIcon: (subject: string) => SubjectIcon;
|
|
77
|
+
|
|
78
|
+
export declare const hasPermission: (required: Permission, userRole?: UserRole, userEntitlements?: Entitlement[]) => boolean;
|
|
23
79
|
|
|
24
80
|
export declare interface IArchivedLibraryItem {
|
|
25
81
|
deckId: string;
|
|
@@ -71,6 +127,7 @@ export declare interface IDeck {
|
|
|
71
127
|
subject: Subject;
|
|
72
128
|
topic?: string;
|
|
73
129
|
topicIcon?: string | null;
|
|
130
|
+
ownerInfo?: IOwnerInfo;
|
|
74
131
|
}
|
|
75
132
|
|
|
76
133
|
export declare interface IDeckDetail extends IDeck {
|
|
@@ -93,10 +150,10 @@ export declare interface IGroupedLibraryItem {
|
|
|
93
150
|
}
|
|
94
151
|
|
|
95
152
|
export declare interface IOwnerInfo {
|
|
96
|
-
type: EntityType;
|
|
97
153
|
id: string;
|
|
98
154
|
name: string;
|
|
99
155
|
image: string | null;
|
|
156
|
+
type: EntityType;
|
|
100
157
|
}
|
|
101
158
|
|
|
102
159
|
export declare interface IReviewLog {
|
|
@@ -150,17 +207,127 @@ export declare enum OrganizationRole {
|
|
|
150
207
|
|
|
151
208
|
export declare type OrganizationScopeRole = (typeof OrganizationRole)[keyof typeof OrganizationRole];
|
|
152
209
|
|
|
153
|
-
export declare
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
210
|
+
export declare type Permission = ValueOf<{
|
|
211
|
+
[K in keyof typeof PERMISSIONS]: ValueOf<(typeof PERMISSIONS)[K]>;
|
|
212
|
+
}>;
|
|
213
|
+
|
|
214
|
+
export declare const Permission: {
|
|
215
|
+
readonly APP_ACCESS: "app:access";
|
|
216
|
+
readonly DECK_CREATE_OWN: "deck:create:own";
|
|
217
|
+
readonly DECK_CREATE_PUBLIC: "deck:create:public";
|
|
218
|
+
readonly DECK_READ_OWN: "deck:read:own";
|
|
219
|
+
readonly DECK_READ_OTHERS: "deck:read:others";
|
|
220
|
+
readonly DECK_READ_UNPUBLISHED: "deck:read:unpublished";
|
|
221
|
+
readonly DECK_READ_FREE: "deck:read:free";
|
|
222
|
+
readonly DECK_READ_PREMIUM: "deck:read:premium";
|
|
223
|
+
readonly DECK_READ_PRIVATE: "deck:read:private";
|
|
224
|
+
readonly DECK_UPDATE_OWN: "deck:update:own";
|
|
225
|
+
readonly DECK_UPDATE_PUBLIC: "deck:update:public";
|
|
226
|
+
readonly DECK_DELETE_OWN: "deck:delete:own";
|
|
227
|
+
readonly DECK_DELETE_PUBLIC: "deck:delete:public";
|
|
228
|
+
readonly CARD_DEMAND_READ_ALL: "card-demand:read:*";
|
|
229
|
+
readonly CARD_DEMAND_CREATE: "card-demand:create";
|
|
230
|
+
readonly CARD_DEMAND_ACTION: "card-demand:action";
|
|
231
|
+
readonly USER_UPDATE_OWN: "user:update:own";
|
|
232
|
+
readonly USER_UPDATE_ALL: "user:update:*";
|
|
233
|
+
readonly USER_DELETE_OWN: "user:delete:own";
|
|
234
|
+
readonly USER_DELETE_ALL: "user:delete:*";
|
|
235
|
+
readonly USER_READ_OWN: "user:read:own";
|
|
236
|
+
readonly USER_READ_ALL: "user:read:*";
|
|
237
|
+
readonly STATS_VIEW: "stats:view";
|
|
238
|
+
readonly MEMBERSHIP_MANAGE: "membership:manage";
|
|
239
|
+
readonly PLAN_CREATE: "plan:create";
|
|
240
|
+
readonly PLAN_UPDATE: "plan:update";
|
|
241
|
+
readonly PLAN_DELETE: "plan:delete";
|
|
242
|
+
readonly BLOGPOST_CREATE: "blogpost:create";
|
|
243
|
+
readonly BLOGPOST_UPDATE: "blogpost:update";
|
|
244
|
+
readonly BLOGPOST_DELETE: "blogpost:delete";
|
|
245
|
+
readonly VESTY_CHAT: "vesty:chat";
|
|
246
|
+
readonly STUDY_READ: "study:read";
|
|
247
|
+
readonly STUDY_WRITE: "study:write";
|
|
248
|
+
readonly LIBRARY_READ: "library:read";
|
|
249
|
+
readonly LIBRARY_WRITE: "library:write";
|
|
250
|
+
readonly LIBRARY_WRITE_PREMIUM: "library:write:premium";
|
|
251
|
+
readonly ADMIN_PANEL_VIEW: "admin-panel:view";
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
export declare const PERMISSIONS: {
|
|
255
|
+
readonly APP: {
|
|
256
|
+
readonly ACCESS: "app:access";
|
|
257
|
+
};
|
|
258
|
+
readonly DECK: {
|
|
259
|
+
readonly CREATE_OWN: "deck:create:own";
|
|
260
|
+
readonly CREATE_PUBLIC: "deck:create:public";
|
|
261
|
+
readonly READ_OWN: "deck:read:own";
|
|
262
|
+
readonly READ_OTHERS: "deck:read:others";
|
|
263
|
+
readonly READ_UNPUBLISHED: "deck:read:unpublished";
|
|
264
|
+
readonly READ_FREE: "deck:read:free";
|
|
265
|
+
readonly READ_PREMIUM: "deck:read:premium";
|
|
266
|
+
readonly READ_PRIVATE: "deck:read:private";
|
|
267
|
+
readonly UPDATE_OWN: "deck:update:own";
|
|
268
|
+
readonly UPDATE_PUBLIC: "deck:update:public";
|
|
269
|
+
readonly DELETE_OWN: "deck:delete:own";
|
|
270
|
+
readonly DELETE_PUBLIC: "deck:delete:public";
|
|
271
|
+
};
|
|
272
|
+
readonly CARD_DEMAND: {
|
|
273
|
+
readonly READ_ALL: "card-demand:read:*";
|
|
274
|
+
readonly CREATE: "card-demand:create";
|
|
275
|
+
readonly ACTION: "card-demand:action";
|
|
276
|
+
};
|
|
277
|
+
readonly USER: {
|
|
278
|
+
readonly UPDATE_OWN: "user:update:own";
|
|
279
|
+
readonly UPDATE_ALL: "user:update:*";
|
|
280
|
+
readonly DELETE_OWN: "user:delete:own";
|
|
281
|
+
readonly DELETE_ALL: "user:delete:*";
|
|
282
|
+
readonly READ_OWN: "user:read:own";
|
|
283
|
+
readonly READ_ALL: "user:read:*";
|
|
284
|
+
};
|
|
285
|
+
readonly STATS: {
|
|
286
|
+
readonly VIEW: "stats:view";
|
|
287
|
+
};
|
|
288
|
+
readonly MEMBERSHIP: {
|
|
289
|
+
readonly MANAGE: "membership:manage";
|
|
290
|
+
};
|
|
291
|
+
readonly PLAN: {
|
|
292
|
+
readonly CREATE: "plan:create";
|
|
293
|
+
readonly UPDATE: "plan:update";
|
|
294
|
+
readonly DELETE: "plan:delete";
|
|
295
|
+
};
|
|
296
|
+
readonly BLOGPOST: {
|
|
297
|
+
readonly CREATE: "blogpost:create";
|
|
298
|
+
readonly UPDATE: "blogpost:update";
|
|
299
|
+
readonly DELETE: "blogpost:delete";
|
|
300
|
+
};
|
|
301
|
+
readonly VESTY: {
|
|
302
|
+
readonly CHAT: "vesty:chat";
|
|
303
|
+
};
|
|
304
|
+
readonly STUDY: {
|
|
305
|
+
readonly READ: "study:read";
|
|
306
|
+
readonly WRITE: "study:write";
|
|
307
|
+
};
|
|
308
|
+
readonly LIBRARY: {
|
|
309
|
+
readonly READ: "library:read";
|
|
310
|
+
readonly WRITE: "library:write";
|
|
311
|
+
readonly WRITE_PREMIUM: "library:write:premium";
|
|
312
|
+
};
|
|
313
|
+
readonly ADMIN_PANEL: {
|
|
314
|
+
readonly VIEW: "admin-panel:view";
|
|
315
|
+
};
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
export declare const ReviewRating: {
|
|
319
|
+
readonly Manual: "Manual";
|
|
320
|
+
readonly Again: "Again";
|
|
321
|
+
readonly Hard: "Hard";
|
|
322
|
+
readonly Good: "Good";
|
|
323
|
+
readonly Easy: "Easy";
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
export declare type ReviewRating = (typeof ReviewRating)[keyof typeof ReviewRating];
|
|
160
327
|
|
|
161
328
|
export declare const reviewRatings: readonly ["Manual", "Again", "Hard", "Good", "Easy"];
|
|
162
329
|
|
|
163
|
-
export declare type ReviewRatingType =
|
|
330
|
+
export declare type ReviewRatingType = ReviewRating;
|
|
164
331
|
|
|
165
332
|
export declare enum ReviewState {
|
|
166
333
|
New = "New",
|
|
@@ -173,6 +340,8 @@ export declare const reviewStates: readonly ["New", "Learning", "Review", "Relea
|
|
|
173
340
|
|
|
174
341
|
export declare type ReviewStateType = keyof typeof ReviewState;
|
|
175
342
|
|
|
343
|
+
export declare const ROLE_PERMISSIONS: Record<UserRole, Permission[]>;
|
|
344
|
+
|
|
176
345
|
export declare type SemanticColor = 'primary' | 'secondary' | 'tertiary' | 'quaternary' | 'quinary' | 'default';
|
|
177
346
|
|
|
178
347
|
export declare type StudyStatus = 'not-started' | 'suspended' | 'has-cards' | 'no-cards';
|
|
@@ -183,7 +352,24 @@ export declare type Subject = (typeof SUBJECTS)[number];
|
|
|
183
352
|
|
|
184
353
|
export declare const SUBJECT_COLORS: Record<SubjectWithDefault, SemanticColor>;
|
|
185
354
|
|
|
186
|
-
export declare const SUBJECT_ICONS:
|
|
355
|
+
export declare const SUBJECT_ICONS: {
|
|
356
|
+
readonly matemática: "radical";
|
|
357
|
+
readonly gramática: "spell-check";
|
|
358
|
+
readonly literatura: "book-open";
|
|
359
|
+
readonly biologia: "dna";
|
|
360
|
+
readonly química: "test-tube-diagonal";
|
|
361
|
+
readonly física: "atom";
|
|
362
|
+
readonly história: "scroll";
|
|
363
|
+
readonly geografia: "earth";
|
|
364
|
+
readonly filosofia: "brain";
|
|
365
|
+
readonly sociologia: "users-round";
|
|
366
|
+
readonly redação: "notebook-pen";
|
|
367
|
+
readonly artes: "palette";
|
|
368
|
+
readonly inglês: "languages";
|
|
369
|
+
readonly default: "graduation-cap";
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
declare type SubjectIcon = (typeof SUBJECT_ICONS)[SubjectWithDefault];
|
|
187
373
|
|
|
188
374
|
export declare const SUBJECTS: readonly ["matemática", "geografia", "física", "biologia", "história", "literatura", "gramática", "sociologia", "química", "filosofia", "redação", "artes", "inglês"];
|
|
189
375
|
|
|
@@ -196,6 +382,22 @@ export declare interface Topic {
|
|
|
196
382
|
subject: Subject;
|
|
197
383
|
}
|
|
198
384
|
|
|
385
|
+
export declare const UNPAGINATED_SIZE = 9999;
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Unwraps an Eden API response, throwing on error and returning the typed success data.
|
|
389
|
+
*
|
|
390
|
+
* Usage:
|
|
391
|
+
* ```ts
|
|
392
|
+
* queryFn: async (): Promise<IDeckDetail> => {
|
|
393
|
+
* return unwrapApiResponse(await api.v1.decks({ deckId }).get(), 'Erro ao buscar deck.');
|
|
394
|
+
* }
|
|
395
|
+
* ```
|
|
396
|
+
*/
|
|
397
|
+
export declare function unwrapApiResponse<T>({ data, error }: EdenResponse<T>, message: string): Exclude<NonNullable<T>, {
|
|
398
|
+
error: string;
|
|
399
|
+
}>;
|
|
400
|
+
|
|
199
401
|
export declare enum UserRole {
|
|
200
402
|
Admin = "admin",
|
|
201
403
|
Moderator = "moderator",
|
|
@@ -204,4 +406,6 @@ export declare enum UserRole {
|
|
|
204
406
|
|
|
205
407
|
export declare type UserScopeRole = (typeof UserRole)[keyof typeof UserRole];
|
|
206
408
|
|
|
409
|
+
declare type ValueOf<T> = T[keyof T];
|
|
410
|
+
|
|
207
411
|
export { }
|