@owlmeans/wled 0.1.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 (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +489 -0
  3. package/build/consts.d.ts +7 -0
  4. package/build/consts.d.ts.map +1 -0
  5. package/build/consts.js +7 -0
  6. package/build/consts.js.map +1 -0
  7. package/build/index.d.ts +5 -0
  8. package/build/index.d.ts.map +1 -0
  9. package/build/index.js +4 -0
  10. package/build/index.js.map +1 -0
  11. package/build/model/company.d.ts +4 -0
  12. package/build/model/company.d.ts.map +1 -0
  13. package/build/model/company.js +15 -0
  14. package/build/model/company.js.map +1 -0
  15. package/build/model/index.d.ts +4 -0
  16. package/build/model/index.d.ts.map +1 -0
  17. package/build/model/index.js +4 -0
  18. package/build/model/index.js.map +1 -0
  19. package/build/model/provider.d.ts +4 -0
  20. package/build/model/provider.d.ts.map +1 -0
  21. package/build/model/provider.js +10 -0
  22. package/build/model/provider.js.map +1 -0
  23. package/build/model/styles.d.ts +7 -0
  24. package/build/model/styles.d.ts.map +1 -0
  25. package/build/model/styles.js +43 -0
  26. package/build/model/styles.js.map +1 -0
  27. package/build/modules.d.ts +2 -0
  28. package/build/modules.d.ts.map +1 -0
  29. package/build/modules.js +8 -0
  30. package/build/modules.js.map +1 -0
  31. package/build/types.d.ts +47 -0
  32. package/build/types.d.ts.map +1 -0
  33. package/build/types.js +2 -0
  34. package/build/types.js.map +1 -0
  35. package/package.json +39 -0
  36. package/src/consts.ts +12 -0
  37. package/src/index.ts +5 -0
  38. package/src/model/company.ts +17 -0
  39. package/src/model/index.ts +4 -0
  40. package/src/model/provider.ts +13 -0
  41. package/src/model/styles.ts +49 -0
  42. package/src/modules.ts +11 -0
  43. package/src/types.ts +55 -0
  44. package/tsconfig.json +15 -0
  45. package/tsconfig.tsbuildinfo +1 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 OwlMeans Common — Fullstack typescript framework
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,489 @@
1
+ # @owlmeans/wled
2
+
3
+ Base types and module declarations for the OwlMeans Common Whitelabeling Subsystem.
4
+
5
+ ## Overview
6
+
7
+ The `@owlmeans/wled` package provides foundational types, constants, models, and modules for implementing whitelabeling functionality in OwlMeans applications. It serves as the core library for the OwlMeans Common Whitelabeling Subsystem, enabling applications to customize their appearance and branding dynamically.
8
+
9
+ ### Key Features
10
+
11
+ - **Company Information Management** - Define and manage company branding details
12
+ - **Custom Styling System** - Support for custom colors, fonts, and visual styling
13
+ - **Media Management** - Handle custom brand assets like logos and media
14
+ - **Validation Schemas** - AJV-based schemas for consistent data validation
15
+ - **Route Integration** - Module definitions for whitelabeling API endpoints
16
+ - **Type Safety** - Comprehensive TypeScript interfaces and types
17
+
18
+ ## Core Concepts
19
+
20
+ ### Whitelabeling Types
21
+
22
+ The package defines several core types for whitelabeling:
23
+
24
+ - **CompanyInfo** - Basic company information including name, slug, and description
25
+ - **CustomStyles** - Visual styling configuration with colors and fonts
26
+ - **CustomMedia** - Brand assets like logos and media files
27
+ - **CustomUrls** - Custom URL configurations for different environments
28
+
29
+ ### Provider System
30
+
31
+ The whitelabeling system uses a provider pattern where different types of whitelabeling data (company info, styles, media, DNS) can be requested and provided through a unified interface.
32
+
33
+ ### Validation Integration
34
+
35
+ All data structures include corresponding AJV validation schemas, ensuring consistent validation across both frontend and backend implementations in fullstack applications.
36
+
37
+ ## Installation
38
+
39
+ ```bash
40
+ npm install @owlmeans/wled
41
+ ```
42
+
43
+ ## API Reference
44
+
45
+ ### Types
46
+
47
+ #### CompanyInfo
48
+ Interface for company information in whitelabeling.
49
+
50
+ ```typescript
51
+ interface CompanyInfo {
52
+ resource?: string // Optional resource identifier
53
+ entityId: string // Unique entity identifier
54
+ fullName: string // Full company name
55
+ shortName: string // Abbreviated company name
56
+ slug: string // URL-friendly identifier
57
+ description: string // Company description
58
+ }
59
+ ```
60
+
61
+ #### CustomStyles
62
+ Interface for custom styling configuration.
63
+
64
+ ```typescript
65
+ interface CustomStyles {
66
+ resource?: string // Optional resource identifier
67
+ entityId: string // Unique entity identifier
68
+ font: CustomFont // Font configuration
69
+ colors: CustomColors // Color palette
70
+ }
71
+ ```
72
+
73
+ #### CustomColors
74
+ Interface for custom color configuration.
75
+
76
+ ```typescript
77
+ interface CustomColors {
78
+ primaryColor: string // Primary brand color (required)
79
+ secondaryColor?: string // Secondary brand color
80
+ alertColor?: string // Alert/error color
81
+ successColor?: string // Success color
82
+ primaryBackground?: string // Primary background color
83
+ secondaryBackground?: string // Secondary background color
84
+ alertBackground?: string // Alert background color
85
+ successBackground?: string // Success background color
86
+ }
87
+ ```
88
+
89
+ #### CustomFont
90
+ Interface for custom font configuration.
91
+
92
+ ```typescript
93
+ interface CustomFont {
94
+ fontFamily: string // Font family name
95
+ basicSize?: number // Base font size (minimum 8)
96
+ }
97
+ ```
98
+
99
+ #### CustomMedia
100
+ Interface for custom media assets.
101
+
102
+ ```typescript
103
+ interface CustomMedia {
104
+ brand: CustomBrand // Brand asset configuration
105
+ }
106
+ ```
107
+
108
+ #### CustomBrand
109
+ Interface for brand asset configuration.
110
+
111
+ ```typescript
112
+ interface CustomBrand {
113
+ squareLogo?: string // Square logo URL or path
114
+ wideLogo?: string // Wide/horizontal logo URL or path
115
+ }
116
+ ```
117
+
118
+ #### CustomUrls
119
+ Interface for custom URL configuration.
120
+
121
+ ```typescript
122
+ interface CustomUrls {
123
+ adminUrl: string // Admin panel URL
124
+ userUrl: string // User interface URL
125
+ }
126
+ ```
127
+
128
+ #### ProvideParams
129
+ Interface for provider request parameters.
130
+
131
+ ```typescript
132
+ interface ProvideParams {
133
+ entity: string // Entity identifier to provide data for
134
+ }
135
+ ```
136
+
137
+ #### ProvidedWL
138
+ Generic interface for provided whitelabeling data.
139
+
140
+ ```typescript
141
+ type ProvidedWL<T extends {} = {}> = T & {
142
+ type: string // Type identifier for the provided data
143
+ exists: boolean | null // Whether the data exists
144
+ }
145
+ ```
146
+
147
+ ### Constants
148
+
149
+ #### Route Constants
150
+ Constants for whitelabeling routes.
151
+
152
+ ```typescript
153
+ const WL_PROVIDE = 'wl-provide' // Route alias
154
+ const WL_PROVIDE_PATH = '/wl/provide/:entity' // Route path pattern
155
+ ```
156
+
157
+ #### Type Constants
158
+ Constants for whitelabeling data types.
159
+
160
+ ```typescript
161
+ const WL_TYPE_COMPANY_INFO = 'company-info' // Company information type
162
+ const WL_TYPE_STYLES = 'styles' // Styling configuration type
163
+ const WL_TYPE_MEDIA = 'media' // Media assets type
164
+ const WL_TYPE_DNS = 'dns' // DNS configuration type
165
+ ```
166
+
167
+ ### Validation Schemas
168
+
169
+ The package includes AJV validation schemas for all data structures, ensuring consistent validation across fullstack applications.
170
+
171
+ #### CompanyInfoSchema
172
+ AJV schema for validating CompanyInfo data.
173
+
174
+ ```typescript
175
+ const CompanyInfoSchema: JSONSchemaType<CompanyInfo> = {
176
+ type: 'object',
177
+ properties: {
178
+ resource: { type: 'string', minLength: 0, nullable: true },
179
+ entityId: { type: 'string', minLength: 1 },
180
+ fullName: { type: 'string', minLength: 1, maxLength: 128 },
181
+ shortName: { type: 'string', minLength: 0, maxLength: 32 },
182
+ slug: { type: 'string', minLength: 0 },
183
+ description: { type: 'string', minLength: 0, maxLength: 512 }
184
+ },
185
+ required: ['entityId', 'fullName', 'shortName', 'slug', 'description'],
186
+ additionalProperties: false
187
+ }
188
+ ```
189
+
190
+ #### CustomStylesSchema
191
+ AJV schema for validating CustomStyles data.
192
+
193
+ ```typescript
194
+ const CustomStylesSchema: JSONSchemaType<CustomStyles> = {
195
+ type: 'object',
196
+ properties: {
197
+ resource: { type: 'string', minLength: 0, nullable: true },
198
+ entityId: { type: 'string', minLength: 1 },
199
+ font: CustomFontSchema,
200
+ colors: CustomColorsSchema
201
+ },
202
+ required: ['entityId', 'font', 'colors'],
203
+ additionalProperties: false
204
+ }
205
+ ```
206
+
207
+ #### CustomColorsSchema
208
+ AJV schema for validating CustomColors data.
209
+
210
+ ```typescript
211
+ const CustomColorsSchema: JSONSchemaType<CustomColors> = {
212
+ type: 'object',
213
+ properties: {
214
+ primaryColor: { type: 'string', pattern: '^#(\\d|[a-fA-F]){3,8}$' },
215
+ secondaryColor: { type: 'string', pattern: '^#(\\d|[a-fA-F]){3,8}$', nullable: true },
216
+ // ... other color properties with hex color validation
217
+ },
218
+ required: ['primaryColor'],
219
+ additionalProperties: false
220
+ }
221
+ ```
222
+
223
+ #### CustomFontSchema
224
+ AJV schema for validating CustomFont data.
225
+
226
+ ```typescript
227
+ const CustomFontSchema: JSONSchemaType<CustomFont> = {
228
+ type: 'object',
229
+ properties: {
230
+ fontFamily: { type: 'string', minLength: 0, maxLength: 128 },
231
+ basicSize: { type: 'number', minimum: 8, nullable: true }
232
+ },
233
+ required: ['fontFamily'],
234
+ additionalProperties: false
235
+ }
236
+ ```
237
+
238
+ #### ProvideParamsSchema
239
+ AJV schema for validating ProvideParams data.
240
+
241
+ ```typescript
242
+ const ProvideParamsSchema: JSONSchemaType<ProvideParams> = {
243
+ type: 'object',
244
+ properties: {
245
+ entity: { type: 'string', minLength: 1 }
246
+ },
247
+ required: ['entity'],
248
+ additionalProperties: false
249
+ }
250
+ ```
251
+
252
+ ### Modules
253
+
254
+ #### Whitelabeling Provider Module
255
+ Pre-configured module for handling whitelabeling data provision.
256
+
257
+ ```typescript
258
+ import { modules } from '@owlmeans/wled'
259
+
260
+ // The package exports a pre-configured module array
261
+ const modules = [
262
+ module(
263
+ route(WL_PROVIDE, WL_PROVIDE_PATH, backend()),
264
+ filter(params(ProvideParamsSchema))
265
+ )
266
+ ]
267
+ ```
268
+
269
+ This module provides:
270
+ - Route configuration for `/wl/provide/:entity` endpoint
271
+ - Parameter validation using the ProvideParamsSchema
272
+ - Backend route configuration
273
+
274
+ ## Usage Examples
275
+
276
+ ### Basic Company Information
277
+
278
+ ```typescript
279
+ import { CompanyInfo, WL_TYPE_COMPANY_INFO } from '@owlmeans/wled'
280
+
281
+ // Create company information
282
+ const companyInfo: CompanyInfo = {
283
+ entityId: 'company-123',
284
+ fullName: 'Example Corporation',
285
+ shortName: 'ExampleCorp',
286
+ slug: 'example-corp',
287
+ description: 'A leading technology company'
288
+ }
289
+
290
+ // Use with provider system
291
+ const providedCompanyInfo: ProvidedWL<CompanyInfo> = {
292
+ ...companyInfo,
293
+ type: WL_TYPE_COMPANY_INFO,
294
+ exists: true
295
+ }
296
+ ```
297
+
298
+ ### Custom Styling Configuration
299
+
300
+ ```typescript
301
+ import { CustomStyles, CustomColors, CustomFont, WL_TYPE_STYLES } from '@owlmeans/wled'
302
+
303
+ // Define custom colors
304
+ const customColors: CustomColors = {
305
+ primaryColor: '#007bff',
306
+ secondaryColor: '#6c757d',
307
+ alertColor: '#dc3545',
308
+ successColor: '#28a745',
309
+ primaryBackground: '#ffffff',
310
+ secondaryBackground: '#f8f9fa'
311
+ }
312
+
313
+ // Define custom font
314
+ const customFont: CustomFont = {
315
+ fontFamily: 'Inter, sans-serif',
316
+ basicSize: 14
317
+ }
318
+
319
+ // Create custom styles
320
+ const customStyles: CustomStyles = {
321
+ entityId: 'company-123',
322
+ font: customFont,
323
+ colors: customColors
324
+ }
325
+
326
+ // Use with provider system
327
+ const providedStyles: ProvidedWL<CustomStyles> = {
328
+ ...customStyles,
329
+ type: WL_TYPE_STYLES,
330
+ exists: true
331
+ }
332
+ ```
333
+
334
+ ### Media Assets Configuration
335
+
336
+ ```typescript
337
+ import { CustomMedia, CustomBrand, WL_TYPE_MEDIA } from '@owlmeans/wled'
338
+
339
+ // Define brand assets
340
+ const customBrand: CustomBrand = {
341
+ squareLogo: '/assets/logo-square.png',
342
+ wideLogo: '/assets/logo-wide.png'
343
+ }
344
+
345
+ // Create media configuration
346
+ const customMedia: CustomMedia = {
347
+ brand: customBrand
348
+ }
349
+
350
+ // Use with provider system
351
+ const providedMedia: ProvidedWL<CustomMedia> = {
352
+ ...customMedia,
353
+ type: WL_TYPE_MEDIA,
354
+ exists: true
355
+ }
356
+ ```
357
+
358
+ ### Module Integration
359
+
360
+ ```typescript
361
+ import { modules } from '@owlmeans/wled'
362
+ import { context } from '@owlmeans/context'
363
+
364
+ // Add whitelabeling modules to your application context
365
+ context.modules.push(...modules)
366
+
367
+ // The modules will handle requests to /wl/provide/:entity
368
+ // with proper parameter validation
369
+ ```
370
+
371
+ ## Integration Patterns
372
+
373
+ ### Backend Integration
374
+
375
+ ```typescript
376
+ import { modules, ProvideParams, CompanyInfo, WL_TYPE_COMPANY_INFO } from '@owlmeans/wled'
377
+
378
+ // Register the whitelabeling provider module
379
+ app.use(modules)
380
+
381
+ // Implement handler for whitelabeling data provision
382
+ const handleProvideWL = async (params: ProvideParams) => {
383
+ const { entity } = params
384
+
385
+ // Fetch company information for the entity
386
+ const companyInfo = await getCompanyInfo(entity)
387
+
388
+ if (companyInfo) {
389
+ return {
390
+ ...companyInfo,
391
+ type: WL_TYPE_COMPANY_INFO,
392
+ exists: true
393
+ }
394
+ }
395
+
396
+ return {
397
+ type: WL_TYPE_COMPANY_INFO,
398
+ exists: false
399
+ }
400
+ }
401
+ ```
402
+
403
+ ### Frontend Integration
404
+
405
+ ```typescript
406
+ import { ProvideParams, ProvidedWL, CompanyInfo, WL_TYPE_COMPANY_INFO } from '@owlmeans/wled'
407
+
408
+ // Fetch whitelabeling data from the provider endpoint
409
+ const fetchWhitelabelingData = async (entity: string): Promise<ProvidedWL<CompanyInfo>> => {
410
+ const response = await fetch(`/wl/provide/${entity}`)
411
+ return response.json()
412
+ }
413
+
414
+ // Use in React component
415
+ const WhitelabeledHeader = ({ entity }: { entity: string }) => {
416
+ const [companyInfo, setCompanyInfo] = useState<ProvidedWL<CompanyInfo> | null>(null)
417
+
418
+ useEffect(() => {
419
+ fetchWhitelabelingData(entity).then(setCompanyInfo)
420
+ }, [entity])
421
+
422
+ if (!companyInfo?.exists) {
423
+ return <DefaultHeader />
424
+ }
425
+
426
+ return (
427
+ <header>
428
+ <h1>{companyInfo.fullName}</h1>
429
+ <p>{companyInfo.description}</p>
430
+ </header>
431
+ )
432
+ }
433
+ ```
434
+
435
+ ### Multi-Type Provider Implementation
436
+
437
+ ```typescript
438
+ import {
439
+ ProvideParams,
440
+ ProvidedWL,
441
+ CompanyInfo,
442
+ CustomStyles,
443
+ CustomMedia,
444
+ WL_TYPE_COMPANY_INFO,
445
+ WL_TYPE_STYLES,
446
+ WL_TYPE_MEDIA
447
+ } from '@owlmeans/wled'
448
+
449
+ // Generic provider that can handle different types
450
+ const provideWhitelabelingData = async (
451
+ entity: string,
452
+ type: string
453
+ ): Promise<ProvidedWL<any>> => {
454
+ switch (type) {
455
+ case WL_TYPE_COMPANY_INFO:
456
+ return await provideCompanyInfo(entity)
457
+ case WL_TYPE_STYLES:
458
+ return await provideCustomStyles(entity)
459
+ case WL_TYPE_MEDIA:
460
+ return await provideCustomMedia(entity)
461
+ default:
462
+ return { type, exists: false }
463
+ }
464
+ }
465
+ ```
466
+
467
+ ## Best Practices
468
+
469
+ 1. **Consistent Validation** - Always use the provided AJV schemas to validate data on both frontend and backend
470
+ 2. **Type Safety** - Leverage TypeScript interfaces to ensure type safety throughout your application
471
+ 3. **Resource Management** - Use the optional `resource` field to track data sources and manage resources
472
+ 4. **Error Handling** - Always check the `exists` property in `ProvidedWL` responses before using the data
473
+ 5. **Hex Color Validation** - The color schemas enforce hex color format with proper validation patterns
474
+ 6. **Font Size Constraints** - Ensure font sizes meet the minimum requirement (8) when specified
475
+ 7. **Entity Identification** - Use consistent entity identifiers across all whitelabeling data types
476
+
477
+ ## Dependencies
478
+
479
+ This package depends on:
480
+ - `@owlmeans/auth` - For authentication and entity validation schemas
481
+ - `@owlmeans/module` - For module creation and filtering
482
+ - `@owlmeans/route` - For route configuration
483
+ - `ajv` - For JSON schema validation (peer dependency)
484
+
485
+ ## Related Packages
486
+
487
+ - `@owlmeans/client-wl` - Client-side whitelabeling implementations
488
+ - `@owlmeans/server-wl` - Server-side whitelabeling implementations
489
+ - `@owlmeans/web-wl` - Web-specific whitelabeling components
@@ -0,0 +1,7 @@
1
+ export declare const WL_PROVIDE = "wl-provide";
2
+ export declare const WL_PROVIDE_PATH = "/wl/provide/:entity";
3
+ export declare const WL_TYPE_COMPANY_INFO = "company-info";
4
+ export declare const WL_TYPE_STYLES = "styles";
5
+ export declare const WL_TYPE_MEDIA = "media";
6
+ export declare const WL_TYPE_DNS = "dns";
7
+ //# sourceMappingURL=consts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,UAAU,eAAe,CAAA;AAEtC,eAAO,MAAM,eAAe,wBAAwB,CAAA;AAEpD,eAAO,MAAM,oBAAoB,iBAAiB,CAAA;AAElD,eAAO,MAAM,cAAc,WAAW,CAAA;AAEtC,eAAO,MAAM,aAAa,UAAU,CAAA;AAEpC,eAAO,MAAM,WAAW,QAAQ,CAAA"}
@@ -0,0 +1,7 @@
1
+ export const WL_PROVIDE = 'wl-provide';
2
+ export const WL_PROVIDE_PATH = '/wl/provide/:entity';
3
+ export const WL_TYPE_COMPANY_INFO = 'company-info';
4
+ export const WL_TYPE_STYLES = 'styles';
5
+ export const WL_TYPE_MEDIA = 'media';
6
+ export const WL_TYPE_DNS = 'dns';
7
+ //# sourceMappingURL=consts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAA;AAEtC,MAAM,CAAC,MAAM,eAAe,GAAG,qBAAqB,CAAA;AAEpD,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAc,CAAA;AAElD,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAA;AAEtC,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAA;AAEpC,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAA"}
@@ -0,0 +1,5 @@
1
+ export type * from './types.js';
2
+ export * from './model/index.js';
3
+ export * from './consts.js';
4
+ export * from './modules.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA"}
package/build/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from './model/index.js';
2
+ export * from './consts.js';
3
+ export * from './modules.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { JSONSchemaType } from 'ajv';
2
+ import type { CompanyInfo } from '../types.js';
3
+ export declare const CompanyInfoSchema: JSONSchemaType<CompanyInfo>;
4
+ //# sourceMappingURL=company.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"company.d.ts","sourceRoot":"","sources":["../../src/model/company.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAG9C,eAAO,MAAM,iBAAiB,EAAE,cAAc,CAAC,WAAW,CAYzD,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { EntityValueSchema, ResourceValueSchema } from '@owlmeans/auth';
2
+ export const CompanyInfoSchema = {
3
+ type: 'object',
4
+ properties: {
5
+ resource: { ...ResourceValueSchema, minLength: 0, nullable: true },
6
+ entityId: { ...EntityValueSchema },
7
+ fullName: { type: 'string', minLength: 1, maxLength: 128 },
8
+ shortName: { type: 'string', minLength: 0, maxLength: 32 },
9
+ slug: { ...EntityValueSchema, minLength: 0 },
10
+ description: { type: 'string', minLength: 0, maxLength: 512 }
11
+ },
12
+ required: ['entityId', 'fullName', 'shortName', 'slug', 'description'],
13
+ additionalProperties: false,
14
+ };
15
+ //# sourceMappingURL=company.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"company.js","sourceRoot":"","sources":["../../src/model/company.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEvE,MAAM,CAAC,MAAM,iBAAiB,GAAgC;IAC5D,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,GAAG,mBAAmB,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;QAClE,QAAQ,EAAE,EAAE,GAAG,iBAAiB,EAAE;QAClC,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE;QAC1D,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;QAC1D,IAAI,EAAE,EAAE,GAAG,iBAAiB,EAAE,SAAS,EAAE,CAAC,EAAE;QAC5C,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE;KAC9D;IACD,QAAQ,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,CAAC;IACtE,oBAAoB,EAAE,KAAK;CAC5B,CAAA"}
@@ -0,0 +1,4 @@
1
+ export * from './company.js';
2
+ export * from './styles.js';
3
+ export * from './provider.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA"}
@@ -0,0 +1,4 @@
1
+ export * from './company.js';
2
+ export * from './styles.js';
3
+ export * from './provider.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { JSONSchemaType } from 'ajv';
2
+ import type { ProvideParams } from '../types.js';
3
+ export declare const ProvideParamsSchema: JSONSchemaType<ProvideParams>;
4
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/model/provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAGhD,eAAO,MAAM,mBAAmB,EAAE,cAAc,CAAC,aAAa,CAO7D,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { EntityValueSchema } from '@owlmeans/auth';
2
+ export const ProvideParamsSchema = {
3
+ type: 'object',
4
+ properties: {
5
+ entity: { ...EntityValueSchema }
6
+ },
7
+ required: ['entity'],
8
+ additionalProperties: false,
9
+ };
10
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/model/provider.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAElD,MAAM,CAAC,MAAM,mBAAmB,GAAkC;IAChE,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,MAAM,EAAE,EAAE,GAAG,iBAAiB,EAAE;KACjC;IACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;IACpB,oBAAoB,EAAE,KAAK;CAC5B,CAAA"}
@@ -0,0 +1,7 @@
1
+ import type { JSONSchemaType } from 'ajv';
2
+ import type { CustomStyles, CustomColors, CustomFont } from '../types.js';
3
+ export declare const CustomFontSchema: JSONSchemaType<CustomFont>;
4
+ export declare const ColorSchema: JSONSchemaType<string>;
5
+ export declare const CustomColorsSchema: JSONSchemaType<CustomColors>;
6
+ export declare const CustomStylesSchema: JSONSchemaType<CustomStyles>;
7
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/model/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAGzE,eAAO,MAAM,gBAAgB,EAAE,cAAc,CAAC,UAAU,CAQvD,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,cAAc,CAAC,MAAM,CAK9C,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAC,YAAY,CAc3D,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAC,YAAY,CAU3D,CAAA"}
@@ -0,0 +1,43 @@
1
+ import { EntityValueSchema, ResourceValueSchema } from '@owlmeans/auth';
2
+ export const CustomFontSchema = {
3
+ type: 'object',
4
+ properties: {
5
+ fontFamily: { type: 'string', minLength: 0, maxLength: 128 },
6
+ basicSize: { type: 'number', minimum: 8, nullable: true, }
7
+ },
8
+ required: ['fontFamily'],
9
+ additionalProperties: false,
10
+ };
11
+ export const ColorSchema = {
12
+ type: 'string',
13
+ pattern: '^#(\\d|[a-fA-F]){3,8}$',
14
+ minLength: 4,
15
+ maxLength: 9
16
+ };
17
+ export const CustomColorsSchema = {
18
+ type: 'object',
19
+ properties: {
20
+ primaryColor: ColorSchema,
21
+ secondaryColor: { ...ColorSchema, nullable: true },
22
+ alertColor: { ...ColorSchema, nullable: true },
23
+ successColor: { ...ColorSchema, nullable: true },
24
+ primaryBackground: { ...ColorSchema, nullable: true },
25
+ secondaryBackground: { ...ColorSchema, nullable: true },
26
+ alertBackground: { ...ColorSchema, nullable: true },
27
+ successBackground: { ...ColorSchema, nullable: true },
28
+ },
29
+ required: ['primaryColor'],
30
+ additionalProperties: false,
31
+ };
32
+ export const CustomStylesSchema = {
33
+ type: 'object',
34
+ properties: {
35
+ resource: { ...ResourceValueSchema, minLength: 0, nullable: true },
36
+ entityId: { ...EntityValueSchema },
37
+ font: CustomFontSchema,
38
+ colors: CustomColorsSchema
39
+ },
40
+ required: ['font', 'colors'],
41
+ additionalProperties: false,
42
+ };
43
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/model/styles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEvE,MAAM,CAAC,MAAM,gBAAgB,GAA+B;IAC1D,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE;QAC5D,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,GAAG;KAC3D;IACD,QAAQ,EAAE,CAAC,YAAY,CAAC;IACxB,oBAAoB,EAAE,KAAK;CAC5B,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAA2B;IACjD,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,wBAAwB;IACjC,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,CAAC;CACb,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAiC;IAC9D,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,YAAY,EAAE,WAAW;QACzB,cAAc,EAAE,EAAE,GAAG,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE;QAClD,UAAU,EAAE,EAAE,GAAG,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC9C,YAAY,EAAE,EAAE,GAAG,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE;QAChD,iBAAiB,EAAE,EAAE,GAAG,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE;QACrD,mBAAmB,EAAE,EAAE,GAAG,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE;QACvD,eAAe,EAAE,EAAE,GAAG,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE;QACnD,iBAAiB,EAAE,EAAE,GAAG,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE;KACtD;IACD,QAAQ,EAAE,CAAC,cAAc,CAAC;IAC1B,oBAAoB,EAAE,KAAK;CAC5B,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAiC;IAC9D,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,GAAG,mBAAmB,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;QAClE,QAAQ,EAAE,EAAE,GAAG,iBAAiB,EAAE;QAClC,IAAI,EAAE,gBAAgB;QACtB,MAAM,EAAE,kBAAkB;KAC3B;IACD,QAAQ,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC5B,oBAAoB,EAAE,KAAK;CAC5B,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const modules: import("@owlmeans/module").CommonModule[];
2
+ //# sourceMappingURL=modules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,2CAKnB,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { filter, module, params } from '@owlmeans/module';
2
+ import { route, backend } from '@owlmeans/route';
3
+ import { WL_PROVIDE, WL_PROVIDE_PATH } from './consts.js';
4
+ import { ProvideParamsSchema } from './model/provider.js';
5
+ export const modules = [
6
+ module(route(WL_PROVIDE, WL_PROVIDE_PATH, backend()), filter(params(ProvideParamsSchema)))
7
+ ];
8
+ //# sourceMappingURL=modules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modules.js","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAEzD,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,MAAM,CACJ,KAAK,CAAC,UAAU,EAAE,eAAe,EAAE,OAAO,EAAE,CAAC,EAC7C,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CACpC;CACF,CAAA"}
@@ -0,0 +1,47 @@
1
+ export interface CompanyInfo {
2
+ resource?: string;
3
+ entityId: string;
4
+ fullName: string;
5
+ shortName: string;
6
+ slug: string;
7
+ description: string;
8
+ }
9
+ export interface CustomStyles {
10
+ resource?: string;
11
+ entityId: string;
12
+ font: CustomFont;
13
+ colors: CustomColors;
14
+ }
15
+ export interface CustomColors {
16
+ primaryColor: string;
17
+ secondaryColor?: string;
18
+ alertColor?: string;
19
+ successColor?: string;
20
+ primaryBackground?: string;
21
+ secondaryBackground?: string;
22
+ alertBackground?: string;
23
+ successBackground?: string;
24
+ }
25
+ export interface CustomFont {
26
+ fontFamily: string;
27
+ basicSize?: number;
28
+ }
29
+ export interface CustomMedia {
30
+ brand: CustomBrand;
31
+ }
32
+ export interface CustomBrand {
33
+ squareLogo?: string;
34
+ wideLogo?: string;
35
+ }
36
+ export interface ProvideParams {
37
+ entity: string;
38
+ }
39
+ export interface CustomUrls {
40
+ adminUrl: string;
41
+ userUrl: string;
42
+ }
43
+ export type ProvidedWL<T extends {} = {}> = T & {
44
+ type: string;
45
+ exists: boolean | null;
46
+ };
47
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,UAAU,CAAA;IAChB,MAAM,EAAE,YAAY,CAAA;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B;AAED,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,WAAW,CAAA;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAA;CACf;AAEC,MAAM,WAAW,UAAU;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG;IAC9C,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,OAAO,GAAG,IAAI,CAAA;CACvB,CAAA"}
package/build/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@owlmeans/wled",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "scripts": {
6
+ "build": "tsc -b",
7
+ "dev": "sleep 396 && nodemon -e ts,tsx,json --watch src --exec \"tsc -p ./tsconfig.json\"",
8
+ "watch": "tsc -b -w --preserveWatchOutput --pretty"
9
+ },
10
+ "main": "build/index.js",
11
+ "module": "build/index.js",
12
+ "types": "build/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "import": "./build/index.js",
16
+ "require": "./build/index.js",
17
+ "default": "./build/index.js",
18
+ "module": "./build/index.js",
19
+ "types": "./build/index.d.ts"
20
+ }
21
+ },
22
+ "peerDependencies": {
23
+ "ajv": "*"
24
+ },
25
+ "dependencies": {
26
+ "@owlmeans/auth": "^0.1.0",
27
+ "@owlmeans/module": "^0.1.0",
28
+ "@owlmeans/route": "^0.1.0"
29
+ },
30
+ "devDependencies": {
31
+ "nodemon": "^3.1.7",
32
+ "npm-check": "^6.0.1",
33
+ "typescript": "^5.6.3"
34
+ },
35
+ "private": false,
36
+ "publishConfig": {
37
+ "access": "public"
38
+ }
39
+ }
package/src/consts.ts ADDED
@@ -0,0 +1,12 @@
1
+
2
+ export const WL_PROVIDE = 'wl-provide'
3
+
4
+ export const WL_PROVIDE_PATH = '/wl/provide/:entity'
5
+
6
+ export const WL_TYPE_COMPANY_INFO = 'company-info'
7
+
8
+ export const WL_TYPE_STYLES = 'styles'
9
+
10
+ export const WL_TYPE_MEDIA = 'media'
11
+
12
+ export const WL_TYPE_DNS = 'dns'
package/src/index.ts ADDED
@@ -0,0 +1,5 @@
1
+
2
+ export type * from './types.js'
3
+ export * from './model/index.js'
4
+ export * from './consts.js'
5
+ export * from './modules.js'
@@ -0,0 +1,17 @@
1
+ import type { JSONSchemaType } from 'ajv'
2
+ import type { CompanyInfo } from '../types.js'
3
+ import { EntityValueSchema, ResourceValueSchema } from '@owlmeans/auth'
4
+
5
+ export const CompanyInfoSchema: JSONSchemaType<CompanyInfo> = {
6
+ type: 'object',
7
+ properties: {
8
+ resource: { ...ResourceValueSchema, minLength: 0, nullable: true },
9
+ entityId: { ...EntityValueSchema },
10
+ fullName: { type: 'string', minLength: 1, maxLength: 128 },
11
+ shortName: { type: 'string', minLength: 0, maxLength: 32 },
12
+ slug: { ...EntityValueSchema, minLength: 0 },
13
+ description: { type: 'string', minLength: 0, maxLength: 512 }
14
+ },
15
+ required: ['entityId', 'fullName', 'shortName', 'slug', 'description'],
16
+ additionalProperties: false,
17
+ }
@@ -0,0 +1,4 @@
1
+
2
+ export * from './company.js'
3
+ export * from './styles.js'
4
+ export * from './provider.js'
@@ -0,0 +1,13 @@
1
+
2
+ import type { JSONSchemaType } from 'ajv'
3
+ import type { ProvideParams } from '../types.js'
4
+ import { EntityValueSchema } from '@owlmeans/auth'
5
+
6
+ export const ProvideParamsSchema: JSONSchemaType<ProvideParams> = {
7
+ type: 'object',
8
+ properties: {
9
+ entity: { ...EntityValueSchema }
10
+ },
11
+ required: ['entity'],
12
+ additionalProperties: false,
13
+ }
@@ -0,0 +1,49 @@
1
+ import type { JSONSchemaType } from 'ajv'
2
+ import type { CustomStyles, CustomColors, CustomFont } from '../types.js'
3
+ import { EntityValueSchema, ResourceValueSchema } from '@owlmeans/auth'
4
+
5
+ export const CustomFontSchema: JSONSchemaType<CustomFont> = {
6
+ type: 'object',
7
+ properties: {
8
+ fontFamily: { type: 'string', minLength: 0, maxLength: 128 },
9
+ basicSize: { type: 'number', minimum: 8, nullable: true, }
10
+ },
11
+ required: ['fontFamily'],
12
+ additionalProperties: false,
13
+ }
14
+
15
+ export const ColorSchema: JSONSchemaType<string> = {
16
+ type: 'string',
17
+ pattern: '^#(\\d|[a-fA-F]){3,8}$',
18
+ minLength: 4,
19
+ maxLength: 9
20
+ }
21
+
22
+ export const CustomColorsSchema: JSONSchemaType<CustomColors> = {
23
+ type: 'object',
24
+ properties: {
25
+ primaryColor: ColorSchema,
26
+ secondaryColor: { ...ColorSchema, nullable: true },
27
+ alertColor: { ...ColorSchema, nullable: true },
28
+ successColor: { ...ColorSchema, nullable: true },
29
+ primaryBackground: { ...ColorSchema, nullable: true },
30
+ secondaryBackground: { ...ColorSchema, nullable: true },
31
+ alertBackground: { ...ColorSchema, nullable: true },
32
+ successBackground: { ...ColorSchema, nullable: true },
33
+ },
34
+ required: ['primaryColor'],
35
+ additionalProperties: false,
36
+ }
37
+
38
+ export const CustomStylesSchema: JSONSchemaType<CustomStyles> = {
39
+ type: 'object',
40
+ properties: {
41
+ resource: { ...ResourceValueSchema, minLength: 0, nullable: true },
42
+ entityId: { ...EntityValueSchema },
43
+ font: CustomFontSchema,
44
+ colors: CustomColorsSchema
45
+ },
46
+ required: ['font', 'colors'],
47
+ additionalProperties: false,
48
+ }
49
+
package/src/modules.ts ADDED
@@ -0,0 +1,11 @@
1
+ import { filter, module, params } from '@owlmeans/module'
2
+ import { route, backend } from '@owlmeans/route'
3
+ import { WL_PROVIDE, WL_PROVIDE_PATH } from './consts.js'
4
+ import { ProvideParamsSchema } from './model/provider.js'
5
+
6
+ export const modules = [
7
+ module(
8
+ route(WL_PROVIDE, WL_PROVIDE_PATH, backend()),
9
+ filter(params(ProvideParamsSchema))
10
+ )
11
+ ]
package/src/types.ts ADDED
@@ -0,0 +1,55 @@
1
+
2
+ export interface CompanyInfo {
3
+ resource?: string
4
+ entityId: string
5
+ fullName: string
6
+ shortName: string
7
+ slug: string
8
+ description: string
9
+ }
10
+
11
+ export interface CustomStyles {
12
+ resource?: string
13
+ entityId: string
14
+ font: CustomFont
15
+ colors: CustomColors
16
+ }
17
+
18
+ export interface CustomColors {
19
+ primaryColor: string
20
+ secondaryColor?: string
21
+ alertColor?: string
22
+ successColor?: string
23
+ primaryBackground?: string
24
+ secondaryBackground?: string
25
+ alertBackground?: string
26
+ successBackground?: string
27
+ }
28
+
29
+ export interface CustomFont {
30
+ fontFamily: string
31
+ basicSize?: number
32
+ }
33
+
34
+ export interface CustomMedia {
35
+ brand: CustomBrand
36
+ }
37
+
38
+ export interface CustomBrand {
39
+ squareLogo?: string
40
+ wideLogo?: string
41
+ }
42
+
43
+ export interface ProvideParams {
44
+ entity: string
45
+ }
46
+
47
+ export interface CustomUrls {
48
+ adminUrl: string
49
+ userUrl: string
50
+ }
51
+
52
+ export type ProvidedWL<T extends {} = {}> = T & {
53
+ type: string
54
+ exists: boolean | null
55
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "extends": [
3
+ "../tsconfig.default.json",
4
+ ],
5
+ "compilerOptions": {
6
+ "rootDir": "./src/", /* Specify the root folder within your source files. */
7
+ "outDir": "./build/", /* Specify an output folder for all emitted files. */
8
+ "moduleResolution": "Bundler",
9
+ },
10
+ "exclude": [
11
+ "./dist/**/*",
12
+ "./build/**/*",
13
+ "./*.ts"
14
+ ]
15
+ }
@@ -0,0 +1 @@
1
+ {"root":["./src/consts.ts","./src/index.ts","./src/modules.ts","./src/types.ts","./src/model/company.ts","./src/model/index.ts","./src/model/provider.ts","./src/model/styles.ts"],"version":"5.6.3"}