@acm-uiuc/js-shared 3.3.0 → 3.4.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/orgs.d.ts CHANGED
@@ -4,188 +4,30 @@ export declare enum OrgType {
4
4
  COMMITTEE = "committee",
5
5
  MISC = "misc"
6
6
  }
7
+ export declare const AllOrganizationIdList: readonly ["A01", "S01", "S02", "S03", "S04", "S05", "S06", "S07", "S08", "S09", "S10", "S11", "S12", "S13", "S14", "S15", "S16", "S17", "S18", "C01", "C02", "C03", "C04", "C05", "C06", "C07", "C08"];
8
+ export type OrganizationId = (typeof AllOrganizationIdList)[number];
7
9
  export type Organization = {
8
10
  name: string;
9
11
  type: OrgType;
10
12
  shortcode: string;
11
13
  color: string;
14
+ stripeAccountId?: string;
12
15
  };
13
16
  export declare const Organizations: {
14
- readonly A01: {
15
- readonly name: "ACM";
16
- readonly type: OrgType.MAIN;
17
- readonly shortcode: "acm";
18
- readonly color: "#4577f8";
19
- };
20
- readonly S01: {
21
- readonly name: "SIGPwny";
22
- readonly type: OrgType.SIG;
23
- readonly shortcode: "sigpwny";
24
- readonly color: "#33cc55";
25
- };
26
- readonly S02: {
27
- readonly name: "SIGCHI";
28
- readonly type: OrgType.SIG;
29
- readonly shortcode: "sigchi";
30
- readonly color: "#EEAE48";
31
- };
32
- readonly S03: {
33
- readonly name: "GameBuilders";
34
- readonly type: OrgType.SIG;
35
- readonly shortcode: "gamebuilders";
36
- readonly color: "#29386D";
37
- };
38
- readonly S04: {
39
- readonly name: "SIGAIDA";
40
- readonly type: OrgType.SIG;
41
- readonly shortcode: "sigaida";
42
- readonly color: "#BFDDFC";
43
- };
44
- readonly S05: {
45
- readonly name: "SIGGRAPH";
46
- readonly type: OrgType.SIG;
47
- readonly shortcode: "siggraph";
48
- readonly color: "#7896A7";
49
- };
50
- readonly S06: {
51
- readonly name: "ICPC";
52
- readonly type: OrgType.SIG;
53
- readonly shortcode: "icpc";
54
- readonly color: "#AF2A23";
55
- };
56
- readonly S07: {
57
- readonly name: "SIGMobile";
58
- readonly type: OrgType.SIG;
59
- readonly shortcode: "sigmobile";
60
- readonly color: "#0C7BBD";
61
- };
62
- readonly S08: {
63
- readonly name: "SIGMusic";
64
- readonly type: OrgType.SIG;
65
- readonly shortcode: "sigmusic";
66
- readonly color: "#F4DCA3";
67
- };
68
- readonly S09: {
69
- readonly name: "GLUG";
70
- readonly type: OrgType.SIG;
71
- readonly shortcode: "glug";
72
- readonly color: "#E94A27";
73
- };
74
- readonly S10: {
75
- readonly name: "SIGNLL";
76
- readonly type: OrgType.SIG;
77
- readonly shortcode: "signll";
78
- readonly color: "#F59A23";
79
- };
80
- readonly S11: {
81
- readonly name: "SIGma";
82
- readonly type: OrgType.SIG;
83
- readonly shortcode: "sigma";
84
- readonly color: "#4B65F2";
85
- };
86
- readonly S12: {
87
- readonly name: "SIGQuantum";
88
- readonly type: OrgType.SIG;
89
- readonly shortcode: "sigquantum";
90
- readonly color: "#233643";
91
- };
92
- readonly S13: {
93
- readonly name: "SIGecom";
94
- readonly type: OrgType.SIG;
95
- readonly shortcode: "sigecom";
96
- readonly color: "#00759A";
97
- };
98
- readonly S14: {
99
- readonly name: "SIGPLAN";
100
- readonly type: OrgType.SIG;
101
- readonly shortcode: "sigplan";
102
- readonly color: "#4577f8";
103
- };
104
- readonly S15: {
105
- readonly name: "SIGPolicy";
106
- readonly type: OrgType.SIG;
107
- readonly shortcode: "sigpolicy";
108
- readonly color: "#292929";
109
- };
110
- readonly S16: {
111
- readonly name: "SIGARCH";
112
- readonly type: OrgType.SIG;
113
- readonly shortcode: "sigarch";
114
- readonly color: "#155CD0";
115
- };
116
- readonly S17: {
117
- readonly name: "SIGRobotics";
118
- readonly type: OrgType.SIG;
119
- readonly shortcode: "sigrobotics";
120
- readonly color: "#B0B0B0";
121
- };
122
- readonly S18: {
123
- readonly name: "SIGtricity";
124
- readonly type: OrgType.SIG;
125
- readonly shortcode: "sigtricity";
126
- readonly color: "#4577f8";
127
- };
128
- readonly C01: {
129
- readonly name: "Infrastructure Committee";
130
- readonly type: OrgType.COMMITTEE;
131
- readonly shortcode: "infra";
132
- readonly color: "#4577f8";
133
- };
134
- readonly C02: {
135
- readonly name: "Social Committee";
136
- readonly type: OrgType.COMMITTEE;
137
- readonly shortcode: "social";
138
- readonly color: "#4577f8";
139
- };
140
- readonly C03: {
141
- readonly name: "Mentorship Committee";
142
- readonly type: OrgType.COMMITTEE;
143
- readonly shortcode: "mentorship";
144
- readonly color: "#4577f8";
145
- };
146
- readonly C04: {
147
- readonly name: "Academic Committee";
148
- readonly type: OrgType.COMMITTEE;
149
- readonly shortcode: "academic";
150
- readonly color: "#4577f8";
151
- };
152
- readonly C05: {
153
- readonly name: "Corporate Committee";
154
- readonly type: OrgType.COMMITTEE;
155
- readonly shortcode: "corporate";
156
- readonly color: "#4577f8";
157
- };
158
- readonly C06: {
159
- readonly name: "Marketing Committee";
160
- readonly type: OrgType.COMMITTEE;
161
- readonly shortcode: "marketing";
162
- readonly color: "#4577f8";
163
- };
164
- readonly C07: {
165
- readonly name: "Reflections | Projections";
166
- readonly type: OrgType.COMMITTEE;
167
- readonly shortcode: "reflproj";
168
- readonly color: "#4577f8";
169
- };
170
- readonly C08: {
171
- readonly name: "HackIllinois";
172
- readonly type: OrgType.COMMITTEE;
173
- readonly shortcode: "hackillinois";
174
- readonly color: "#4577f8";
175
- };
17
+ readonly [K in OrganizationId]: Organization;
176
18
  };
177
- export type OrganizationId = keyof typeof Organizations;
178
19
  export type OrganizationName = (typeof Organizations)[OrganizationId]["name"];
179
20
  export type OrganizationsByNameType = {
180
21
  [K in OrganizationId as (typeof Organizations)[K]["name"]]: K;
181
22
  };
182
23
  export declare const OrganizationsByName: OrganizationsByNameType;
24
+ export declare const AllOrganizationNameList: OrganizationName[];
183
25
  export declare function getOrgIdByName<N extends OrganizationName>(name: N): OrganizationsByNameType[N];
184
26
  export declare function getOrgByName<N extends OrganizationName>(name: N): (typeof Organizations)[OrganizationsByNameType[N]] & {
185
27
  id: OrganizationsByNameType[N];
186
28
  };
187
29
  export declare function isValidOrgName(name: string): name is OrganizationName;
30
+ export declare function isValidOrgId(id: string): id is OrganizationId;
188
31
  export declare function getOrgsByType(type: OrgType): Array<Organization & {
189
32
  id: OrganizationId;
190
33
  }>;
191
- export declare const AllOrganizationNameList: OrganizationName[];
package/dist/orgs.js CHANGED
@@ -5,8 +5,16 @@ export var OrgType;
5
5
  OrgType["COMMITTEE"] = "committee";
6
6
  OrgType["MISC"] = "misc";
7
7
  })(OrgType || (OrgType = {}));
8
+ // IDs are the source of truth
9
+ export const AllOrganizationIdList = [
10
+ "A01",
11
+ "S01", "S02", "S03", "S04", "S05", "S06", "S07", "S08", "S09",
12
+ "S10", "S11", "S12", "S13", "S14", "S15", "S16", "S17", "S18",
13
+ "C01", "C02", "C03", "C04", "C05", "C06", "C07", "C08",
14
+ ];
15
+ // This MUST have an entry for every ID (compile error if missing)
8
16
  export const Organizations = {
9
- "A01": { name: "ACM", type: OrgType.MAIN, shortcode: "acm", color: "#4577f8" },
17
+ "A01": { name: "ACM", type: OrgType.MAIN, shortcode: "acm", color: "#4577f8", stripeAccountId: "acct_19mShiDiGOXU9RuS" },
10
18
  "S01": { name: "SIGPwny", type: OrgType.SIG, shortcode: "sigpwny", color: "#33cc55" },
11
19
  "S02": { name: "SIGCHI", type: OrgType.SIG, shortcode: "sigchi", color: "#EEAE48" },
12
20
  "S03": { name: "GameBuilders", type: OrgType.SIG, shortcode: "gamebuilders", color: "#29386D" },
@@ -35,6 +43,7 @@ export const Organizations = {
35
43
  "C08": { name: "HackIllinois", type: OrgType.COMMITTEE, shortcode: "hackillinois", color: "#4577f8" },
36
44
  };
37
45
  export const OrganizationsByName = Object.fromEntries(Object.entries(Organizations).map(([id, org]) => [org.name, id]));
46
+ export const AllOrganizationNameList = AllOrganizationIdList.map(id => Organizations[id].name);
38
47
  // Helper to get ID from name (typed return)
39
48
  export function getOrgIdByName(name) {
40
49
  return OrganizationsByName[name];
@@ -48,9 +57,11 @@ export function getOrgByName(name) {
48
57
  export function isValidOrgName(name) {
49
58
  return name in OrganizationsByName;
50
59
  }
60
+ export function isValidOrgId(id) {
61
+ return id in Organizations;
62
+ }
51
63
  export function getOrgsByType(type) {
52
- return Object.entries(Organizations)
53
- .filter(([_, org]) => org.type === type)
54
- .map(([id, org]) => ({ ...org, id }));
64
+ return AllOrganizationIdList
65
+ .filter(id => Organizations[id].type === type)
66
+ .map(id => ({ ...Organizations[id], id }));
55
67
  }
56
- export const AllOrganizationNameList = Object.values(Organizations).map(x => x.name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acm-uiuc/js-shared",
3
- "version": "3.3.0",
3
+ "version": "3.4.0",
4
4
  "description": "ACM UIUC Shared JS code",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -28,4 +28,4 @@
28
28
  "publishConfig": {
29
29
  "registry": "https://registry.npmjs.org"
30
30
  }
31
- }
31
+ }