@planoly/planogram-config 1.0.0-beta.1
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/README.md +151 -0
- package/dist/index.d.ts +3906 -0
- package/dist/index.js +2496 -0
- package/package.json +38 -0
- package/postExperienceConfig.json +2487 -0
package/README.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# @planoly/planogram-config
|
|
2
|
+
|
|
3
|
+
Centralized configuration for the Planoly post experience across all platforms.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This package provides a single source of truth for platform configurations, validation rules, and UI settings used across all Planoly clients (iOS, Android, Web, Backend).
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @planoly/planogram-config
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### TypeScript / JavaScript
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { postExperienceConfig, Platform, PostType, Validation } from '@planoly/planogram-config';
|
|
21
|
+
|
|
22
|
+
// Get enabled platforms
|
|
23
|
+
const enabledPlatforms = postExperienceConfig.platforms.filter(p => p.enabled);
|
|
24
|
+
|
|
25
|
+
// Find Instagram config
|
|
26
|
+
const instagram = postExperienceConfig.platforms.find(p => p.name === 'instagram');
|
|
27
|
+
|
|
28
|
+
// Get Grid Post validations
|
|
29
|
+
const gridPost = instagram?.postTypes.find(pt => pt.name === 'Grid Post');
|
|
30
|
+
const captionRule = gridPost?.validations.find(v => v.type === 'autoPostCaptionLength');
|
|
31
|
+
console.log(`Max caption: ${captionRule?.parameters?.max} characters`);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Default Import
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import postExperienceConfig from '@planoly/planogram-config';
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Raw JSON Access
|
|
41
|
+
|
|
42
|
+
If you need the raw JSON file directly:
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import config from '@planoly/planogram-config/json';
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Exported Types
|
|
49
|
+
|
|
50
|
+
| Type | Description |
|
|
51
|
+
|------|-------------|
|
|
52
|
+
| `PostExperienceConfig` | Root configuration object |
|
|
53
|
+
| `Platform` | Single platform configuration (Instagram, TikTok, etc.) |
|
|
54
|
+
| `PostType` | Post type within a platform (Grid Post, Reel, Story, etc.) |
|
|
55
|
+
| `Validation` | Validation rule for a post type |
|
|
56
|
+
| `VisibilityOption` | Visibility option (for YouTube: public, unlisted, private) |
|
|
57
|
+
| `Information` | Tooltip/informational message for a post type |
|
|
58
|
+
| `PlatformName` | Union type of all platform names |
|
|
59
|
+
| `PlatformId` | Union type of all platform IDs |
|
|
60
|
+
| `ValidationType` | Union type of all validation types |
|
|
61
|
+
|
|
62
|
+
## iOS / Swift
|
|
63
|
+
|
|
64
|
+
iOS clients should continue using the git submodule approach and read `postExperienceConfig.json` directly
|
|
65
|
+
|
|
66
|
+
## Configuration Structure
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
postExperienceConfig
|
|
70
|
+
├── version: string
|
|
71
|
+
└── platforms: Platform[]
|
|
72
|
+
├── name: string (e.g., "instagram", "tiktok")
|
|
73
|
+
├── id: number
|
|
74
|
+
├── enabled: boolean
|
|
75
|
+
├── order: number
|
|
76
|
+
├── isBeta: boolean
|
|
77
|
+
└── postTypes: PostType[]
|
|
78
|
+
├── name: string (e.g., "Grid Post", "Reel", "Story")
|
|
79
|
+
├── allowAutoPost: boolean
|
|
80
|
+
├── allowFirstComment: boolean
|
|
81
|
+
├── allowedMediaTypes: string[]
|
|
82
|
+
├── allowCanva: boolean
|
|
83
|
+
├── canvaDesignType: string
|
|
84
|
+
├── validations: Validation[]
|
|
85
|
+
│ ├── type: string
|
|
86
|
+
│ ├── userErrorMessage: string
|
|
87
|
+
│ ├── errorHelpLink?: string
|
|
88
|
+
│ └── parameters?: object
|
|
89
|
+
└── information?: Information[]
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Making Changes
|
|
93
|
+
|
|
94
|
+
### For Config Updates
|
|
95
|
+
|
|
96
|
+
1. Edit `postExperienceConfig.json`
|
|
97
|
+
2. Create a PR and get review
|
|
98
|
+
3. Merge to main
|
|
99
|
+
4. Tag a new release:
|
|
100
|
+
```bash
|
|
101
|
+
git tag v1.1.0
|
|
102
|
+
git push origin v1.1.0
|
|
103
|
+
```
|
|
104
|
+
5. CI will automatically publish to npm
|
|
105
|
+
|
|
106
|
+
### Versioning Guidelines
|
|
107
|
+
|
|
108
|
+
- Just use [semver](https://semver.org/)
|
|
109
|
+
|
|
110
|
+
## Development
|
|
111
|
+
|
|
112
|
+
### Building Locally
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
npm install
|
|
116
|
+
npm run build
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Testing the Package
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Create a tarball
|
|
123
|
+
npm pack
|
|
124
|
+
|
|
125
|
+
# In another project, install the tarball
|
|
126
|
+
npm install /path/to/planoly-planogram-config-1.0.0.tgz
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Repository Variables Required
|
|
130
|
+
|
|
131
|
+
For CI/CD to work, add these to Bitbucket repository settings:
|
|
132
|
+
|
|
133
|
+
| Variable | Description |
|
|
134
|
+
|----------|-------------|
|
|
135
|
+
| `NPM_TOKEN` | npm access token with publish permissions |
|
|
136
|
+
|
|
137
|
+
### ⚠️ NPM Token Expiration
|
|
138
|
+
|
|
139
|
+
**Important:** npm tokens with write access now expire after **90 days**.
|
|
140
|
+
|
|
141
|
+
Set a calendar reminder to rotate the token before expiration:
|
|
142
|
+
1. Generate a new token at https://www.npmjs.com → Account → Access Tokens
|
|
143
|
+
2. Update the `NPM_TOKEN` repository variable in Bitbucket
|
|
144
|
+
3. Delete the old token from npm
|
|
145
|
+
|
|
146
|
+
@planoly organization created on npm by david.hodge@planoly.com - eventually need to transfer org to more official account
|
|
147
|
+
|
|
148
|
+
## License
|
|
149
|
+
|
|
150
|
+
MIT
|
|
151
|
+
|