@devgateway/dvz-wp-commons 1.0.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.
Files changed (50) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +0 -0
  3. package/build/APIConfig.d.ts +49 -0
  4. package/build/APIConfig.js +302 -0
  5. package/build/APIutils.d.ts +4 -0
  6. package/build/APIutils.js +30 -0
  7. package/build/Blocks.d.ts +90 -0
  8. package/build/Blocks.js +374 -0
  9. package/build/CSVSourceConfig.d.ts +11 -0
  10. package/build/CSVSourceConfig.js +48 -0
  11. package/build/ChartColors.d.ts +55 -0
  12. package/build/ChartColors.js +401 -0
  13. package/build/ChartLegends.d.ts +33 -0
  14. package/build/ChartLegends.js +71 -0
  15. package/build/ChartMeasures.d.ts +23 -0
  16. package/build/ChartMeasures.js +117 -0
  17. package/build/Constants.d.ts +15 -0
  18. package/build/Constants.js +15 -0
  19. package/build/DataFilters.d.ts +13 -0
  20. package/build/DataFilters.js +98 -0
  21. package/build/Format.d.ts +12 -0
  22. package/build/Format.js +385 -0
  23. package/build/MapCSVSourceConfig.d.ts +12 -0
  24. package/build/MapCSVSourceConfig.js +12 -0
  25. package/build/Measures.d.ts +25 -0
  26. package/build/Measures.js +126 -0
  27. package/build/MobileConfigUtils.d.ts +6 -0
  28. package/build/MobileConfigUtils.js +88 -0
  29. package/build/Tooltip.d.ts +3 -0
  30. package/build/Tooltip.js +53 -0
  31. package/build/Util.d.ts +7 -0
  32. package/build/Util.js +11 -0
  33. package/build/hooks/index.d.ts +0 -0
  34. package/build/hooks/index.js +3 -0
  35. package/build/hooks/useSetting.d.ts +2 -0
  36. package/build/hooks/useSetting.js +11 -0
  37. package/build/icons/Chart.d.ts +3 -0
  38. package/build/icons/Chart.js +14 -0
  39. package/build/icons/Generic.d.ts +3 -0
  40. package/build/icons/Generic.js +5 -0
  41. package/build/icons/index.d.ts +2 -0
  42. package/build/icons/index.js +2 -0
  43. package/build/index.d.ts +18 -0
  44. package/build/index.js +19 -0
  45. package/build/post-type.d.ts +193 -0
  46. package/build/post-type.js +12 -0
  47. package/build/tsconfig.tsbuildinfo +1 -0
  48. package/build/types.d.ts +349 -0
  49. package/build/types.js +33 -0
  50. package/package.json +74 -0
@@ -0,0 +1,349 @@
1
+ export type Options = {
2
+ label: string;
3
+ value: string;
4
+ labels?: Record<string, string>;
5
+ };
6
+ export interface Dimension {
7
+ label: string;
8
+ labels: Record<string, any>;
9
+ value: string;
10
+ type: string;
11
+ field: string | null;
12
+ }
13
+ export interface FileContent {
14
+ id: string;
15
+ createdDate: Date;
16
+ name: string;
17
+ contentType: string;
18
+ size: number;
19
+ }
20
+ export interface Category {
21
+ id: number;
22
+ type: string;
23
+ code: string;
24
+ value: string;
25
+ position: number | null;
26
+ parent: string | null;
27
+ fileContent?: FileContent | null;
28
+ labels: Record<string, any>;
29
+ descriptions: Record<string, any>;
30
+ categoryStyle: Record<string, any> | null;
31
+ createdDate?: Date;
32
+ updatedDate?: Date;
33
+ delegate?: string | null;
34
+ aClass?: string | null;
35
+ enabled?: boolean | null;
36
+ param?: string | null;
37
+ field?: string | null;
38
+ fieldType?: string | null;
39
+ items?: CategoryItem[];
40
+ }
41
+ export interface CategoryItem {
42
+ value: string;
43
+ id: any;
44
+ code?: string;
45
+ labels?: Record<string, any>;
46
+ position?: number;
47
+ }
48
+ export type Categories = {
49
+ type: string;
50
+ items: Category[];
51
+ }[];
52
+ export interface Measure {
53
+ label: string;
54
+ labels: Record<string, any>;
55
+ value: string;
56
+ group: Group;
57
+ styles: Styles;
58
+ position: number;
59
+ enabled: boolean | null;
60
+ }
61
+ export interface Group {
62
+ label: string;
63
+ labels: Record<string, any>;
64
+ }
65
+ export interface Styles {
66
+ textColor: string | null;
67
+ backgroundColor: string | null;
68
+ className: string | null;
69
+ color: string;
70
+ }
71
+ export interface Filter {
72
+ label: string;
73
+ labels: Record<string, any>;
74
+ param: string;
75
+ type: string;
76
+ field: string;
77
+ value: string[];
78
+ values: string;
79
+ }
80
+ export interface DgSettings {
81
+ react_ui_url: string;
82
+ react_api_url: string | null;
83
+ apache_superset_url: string | boolean | null;
84
+ react_search_type: string;
85
+ react_menu_type: string;
86
+ languages: Languages;
87
+ landing_page_url: string;
88
+ google_analytics_code: string;
89
+ name: string;
90
+ description: string;
91
+ site_logo: number;
92
+ site_icon: number;
93
+ }
94
+ export interface Languages {
95
+ [key: string]: Language;
96
+ }
97
+ export interface Language {
98
+ enable: number;
99
+ locale: string;
100
+ name: string;
101
+ translation: string;
102
+ date: string;
103
+ time: string;
104
+ flag: string;
105
+ wpseo_og_locale: string;
106
+ }
107
+ export interface Taxonomy {
108
+ id: number;
109
+ name: string;
110
+ slug: string;
111
+ description: string;
112
+ types: string[];
113
+ hierarchical: boolean;
114
+ rest_base: string;
115
+ rest_namespace: string;
116
+ _links: Links;
117
+ taxonomy: string;
118
+ }
119
+ export interface Links {
120
+ collection: Collection[];
121
+ "wp:items": Collection[];
122
+ curies: Cury[];
123
+ }
124
+ export interface Collection {
125
+ href: string;
126
+ }
127
+ export interface Cury {
128
+ name: string;
129
+ href: string;
130
+ templated: boolean;
131
+ }
132
+ export interface Taxonomies {
133
+ [key: string]: Taxonomy;
134
+ }
135
+ export interface Wp_Types {
136
+ description: string;
137
+ hierarchical: boolean;
138
+ has_archive: boolean;
139
+ name: string;
140
+ slug: string;
141
+ icon: string;
142
+ taxonomies: string[];
143
+ rest_base: string;
144
+ rest_namespace: string;
145
+ template: any[];
146
+ template_lock: boolean;
147
+ yoast_head: string | null;
148
+ yoast_head_json: Record<string, any> | null;
149
+ _links: Links;
150
+ }
151
+ export interface Links {
152
+ collection: Collection[];
153
+ "wp:items": Collection[];
154
+ curies: Cury[];
155
+ }
156
+ export interface Collection {
157
+ href: string;
158
+ }
159
+ export interface EurekaResponse {
160
+ applications: ApplicationsClass;
161
+ }
162
+ export interface ApplicationsClass {
163
+ versions__delta: string;
164
+ apps__hashcode: string;
165
+ application: Application[];
166
+ }
167
+ export interface Application {
168
+ name: string;
169
+ instance: Instance[];
170
+ }
171
+ export interface Instance {
172
+ instanceId: string;
173
+ hostName: string;
174
+ app: string;
175
+ ipAddr: string;
176
+ status: string;
177
+ overriddenStatus: string;
178
+ port: Port;
179
+ securePort: Port;
180
+ countryId: number;
181
+ dataCenterInfo: DataCenterInfo;
182
+ leaseInfo: LeaseInfo;
183
+ metadata: Metadata;
184
+ homePageUrl: string;
185
+ statusPageUrl: string;
186
+ healthCheckUrl: string;
187
+ vipAddress: string;
188
+ secureVipAddress: string;
189
+ isCoordinatingDiscoveryServer: string;
190
+ lastUpdatedTimestamp: string;
191
+ lastDirtyTimestamp: string;
192
+ actionType: string;
193
+ }
194
+ export interface DataCenterInfo {
195
+ "@class": string;
196
+ name: string;
197
+ }
198
+ export interface LeaseInfo {
199
+ renewalIntervalInSecs: number;
200
+ durationInSecs: number;
201
+ registrationTimestamp: number;
202
+ lastRenewalTimestamp: number;
203
+ evictionTimestamp: number;
204
+ serviceUpTimestamp: number;
205
+ }
206
+ export interface Metadata {
207
+ "management.port": string;
208
+ tetsim?: string;
209
+ label?: string;
210
+ "dataset.required"?: string;
211
+ type?: string;
212
+ }
213
+ export interface Port {
214
+ $: number;
215
+ "@enabled": string;
216
+ }
217
+ export interface Media {
218
+ id: number;
219
+ date: Date;
220
+ date_gmt: Date;
221
+ guid: Caption;
222
+ modified: Date;
223
+ modified_gmt: Date;
224
+ slug: string;
225
+ status: Status;
226
+ type: Type;
227
+ link: string;
228
+ title: Caption;
229
+ author: number;
230
+ featured_media: number;
231
+ comment_status: CommentStatus;
232
+ ping_status: PingStatus;
233
+ template: string;
234
+ meta: Meta;
235
+ bread_crumbs: any[];
236
+ class_list: string[];
237
+ acf: any[];
238
+ meta_fields: MetaFields;
239
+ description: Caption;
240
+ caption: Caption;
241
+ alt_text: string;
242
+ media_type: MediaType;
243
+ mime_type: MIMEType;
244
+ media_details: MediaDetails;
245
+ post: null;
246
+ source_url: string;
247
+ _links: Links;
248
+ }
249
+ export interface Links {
250
+ self: Self[];
251
+ collection: About[];
252
+ about: About[];
253
+ author: Author[];
254
+ replies: Author[];
255
+ "wp:term": WpTerm[];
256
+ curies: Cury[];
257
+ }
258
+ export interface About {
259
+ href: string;
260
+ }
261
+ export interface Author {
262
+ embeddable: boolean;
263
+ href: string;
264
+ }
265
+ export interface Cury {
266
+ name: string;
267
+ href: string;
268
+ templated: boolean;
269
+ }
270
+ export interface Self {
271
+ href: string;
272
+ targetHints: TargetHints;
273
+ }
274
+ export interface TargetHints {
275
+ allow: Allow[];
276
+ }
277
+ export declare enum Allow {
278
+ Get = "GET"
279
+ }
280
+ export interface WpTerm {
281
+ taxonomy: Taxonomy;
282
+ embeddable: boolean;
283
+ href: string;
284
+ }
285
+ export declare enum MediaTaxonomy {
286
+ BreadCrumbs = "bread_crumbs"
287
+ }
288
+ export interface Caption {
289
+ rendered: string;
290
+ }
291
+ export declare enum CommentStatus {
292
+ Open = "open"
293
+ }
294
+ export interface MediaDetails {
295
+ filesize: number;
296
+ sizes: Sizes;
297
+ }
298
+ export interface Sizes {
299
+ }
300
+ export declare enum MediaType {
301
+ File = "file"
302
+ }
303
+ export interface Meta {
304
+ _acf_changed: boolean;
305
+ inline_featured_image: boolean;
306
+ redirect_url: string;
307
+ myguten_meta_block_field: string;
308
+ }
309
+ export interface MetaFields {
310
+ _wp_attached_file: string[];
311
+ _wp_attachment_metadata: string[];
312
+ _edit_lock?: string[];
313
+ }
314
+ export declare enum MIMEType {
315
+ ApplicationJSON = "application/json"
316
+ }
317
+ export declare enum PingStatus {
318
+ Closed = "closed"
319
+ }
320
+ export declare enum Status {
321
+ Inherit = "inherit"
322
+ }
323
+ export declare enum Type {
324
+ Attachment = "attachment"
325
+ }
326
+ export interface Menu {
327
+ term_id: number;
328
+ name: string;
329
+ slug: string;
330
+ term_group: number;
331
+ term_taxonomy_id: number;
332
+ taxonomy: string;
333
+ description: string;
334
+ parent: number;
335
+ count: number;
336
+ filter: string;
337
+ term_order: string;
338
+ icon_media_id?: number;
339
+ }
340
+ export interface SearchResult {
341
+ id: number;
342
+ title: string;
343
+ url: string;
344
+ type: string;
345
+ subtype: string;
346
+ _links: Links;
347
+ value: string;
348
+ }
349
+ export type SearchResults = SearchResult[];
package/build/types.js ADDED
@@ -0,0 +1,33 @@
1
+ ;
2
+ export var Allow;
3
+ (function (Allow) {
4
+ Allow["Get"] = "GET";
5
+ })(Allow || (Allow = {}));
6
+ export var MediaTaxonomy;
7
+ (function (MediaTaxonomy) {
8
+ MediaTaxonomy["BreadCrumbs"] = "bread_crumbs";
9
+ })(MediaTaxonomy || (MediaTaxonomy = {}));
10
+ export var CommentStatus;
11
+ (function (CommentStatus) {
12
+ CommentStatus["Open"] = "open";
13
+ })(CommentStatus || (CommentStatus = {}));
14
+ export var MediaType;
15
+ (function (MediaType) {
16
+ MediaType["File"] = "file";
17
+ })(MediaType || (MediaType = {}));
18
+ export var MIMEType;
19
+ (function (MIMEType) {
20
+ MIMEType["ApplicationJSON"] = "application/json";
21
+ })(MIMEType || (MIMEType = {}));
22
+ export var PingStatus;
23
+ (function (PingStatus) {
24
+ PingStatus["Closed"] = "closed";
25
+ })(PingStatus || (PingStatus = {}));
26
+ export var Status;
27
+ (function (Status) {
28
+ Status["Inherit"] = "inherit";
29
+ })(Status || (Status = {}));
30
+ export var Type;
31
+ (function (Type) {
32
+ Type["Attachment"] = "attachment";
33
+ })(Type || (Type = {}));
package/package.json ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "@devgateway/dvz-wp-commons",
3
+ "version": "1.0.0",
4
+ "private": false,
5
+ "description": "Common Utilities for Data Viz Wordpress that can be also used in other projects",
6
+ "author": "Sebastian Dimunzio",
7
+ "maintainers": [
8
+ "Sebastian Dimunzio",
9
+ "Timothy Mugo"
10
+ ],
11
+ "keywords": [
12
+ "react",
13
+ "WordPress",
14
+ "block",
15
+ "data-viz",
16
+ "data-viz-wordpress"
17
+ ],
18
+ "homepage": "https://github.com/devgateway/data-viz-wordpress",
19
+ "repository": "git+https://github.com/devgateway/data-viz-wordpress",
20
+ "bugs": {
21
+ "url": "https://github.com/devgateway/data-viz-wordpress/issues"
22
+ },
23
+ "main": "build/index.js",
24
+ "types": "build/index.d.ts",
25
+ "module": "build/index.js",
26
+ "files": [
27
+ "build",
28
+ "LICENSE",
29
+ "README.md"
30
+ ],
31
+ "publishConfig": {
32
+ "access": "public",
33
+ "registry": "https://registry.npmjs.org/"
34
+ },
35
+ "devDependencies": {
36
+ "@anolilab/semantic-release-pnpm": "^1.1.10",
37
+ "@babel/runtime": "^7.27.0",
38
+ "@semantic-release/changelog": "^6.0.3",
39
+ "@types/lodash.isempty": "^4.4.9",
40
+ "@types/papaparse": "^5.3.15",
41
+ "@types/react": "18.3.1",
42
+ "@types/wordpress__block-editor": "^11.5.16",
43
+ "@wordpress/scripts": "^30.15.0",
44
+ "dotenv": "^16.5.0",
45
+ "dotenv-webpack": "^8.1.0",
46
+ "semantic-release": "^24.2.3",
47
+ "semantic-release-monorepo": "^8.0.2",
48
+ "ts-loader": "^9.5.2",
49
+ "typescript": "^5.8.3"
50
+ },
51
+ "dependencies": {
52
+ "@wordpress/api-fetch": "^7.22.0",
53
+ "@wordpress/block-editor": "^14.17.0",
54
+ "@wordpress/components": "^29.8.0",
55
+ "@wordpress/data": "^10.22.0",
56
+ "@wordpress/editor": "^14.22.0",
57
+ "@wordpress/element": "^6.22.0",
58
+ "@wordpress/i18n": "^5.22.0",
59
+ "@wordpress/icons": "^10.22.0",
60
+ "classnames": "^2.5.1",
61
+ "lodash.isempty": "^4.4.0",
62
+ "papaparse": "^5.5.2"
63
+ },
64
+ "peerDependencies": {
65
+ "react": "18.3.1"
66
+ },
67
+ "scripts": {
68
+ "build": "tsc -b",
69
+ "format:js": "wp-scripts format-js",
70
+ "lint:js": "wp-scripts lint-js",
71
+ "start": "tsc -w",
72
+ "release": "semantic-release"
73
+ }
74
+ }