├── CODEOWNERS ├── .yarnrc.yml ├── .gitignore ├── tsconfig.json ├── .changeset ├── config.json └── README.md ├── CHANGELOG.md ├── package.json ├── LICENSE ├── src └── index.ts ├── .github └── workflows │ └── ci-cd.yml └── README.md /CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @docusign/1fe 2 | -------------------------------------------------------------------------------- /.yarnrc.yml: -------------------------------------------------------------------------------- 1 | yarnPath: .yarn/releases/yarn-4.9.1.cjs 2 | nodeLinker: node-modules 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Yarn 2 | .pnp.* 3 | .yarn/* 4 | !.yarn/patches 5 | !.yarn/plugins 6 | !.yarn/releases 7 | !.yarn/sdks 8 | !.yarn/versions 9 | 10 | dist 11 | 12 | node_modules 13 | 14 | .npmrc 15 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "dist", 4 | "skipLibCheck": true, 5 | "target": "es2022", 6 | "module": "CommonJS", 7 | "declaration": true, 8 | "declarationDir": "dist" 9 | }, 10 | "include": ["src/**/*"] 11 | } 12 | -------------------------------------------------------------------------------- /.changeset/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json", 3 | "changelog": "@changesets/cli/changelog", 4 | "commit": false, 5 | "fixed": [], 6 | "linked": [], 7 | "access": "restricted", 8 | "baseBranch": "main", 9 | "updateInternalDependencies": "patch", 10 | "ignore": [] 11 | } 12 | -------------------------------------------------------------------------------- /.changeset/README.md: -------------------------------------------------------------------------------- 1 | # Changesets 2 | 3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works 4 | with multi-package repos, or single-package repos to help you version and publish your code. You can 5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets) 6 | 7 | We have a quick list of common questions to get you started engaging with this project in 8 | [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) 9 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @1fe/sample-widget-base-config 2 | 3 | ## 0.1.3 4 | 5 | ### Patch Changes 6 | 7 | - d01e3a3: - Patch: Minor bug fixes and improvements. 8 | 9 | ## 0.1.2 10 | 11 | ### Patch Changes 12 | 13 | - 56fc172: Moving to playground instead of bathtub 14 | 15 | ## 0.1.1 16 | 17 | ### Patch Changes 18 | 19 | - f4788e6: Manual patch update for sample widget base configuration 20 | 21 | ## 0.1.1 22 | 23 | ### Patch Changes 24 | 25 | - Test patch release for workflow validation 26 | 27 | ## 0.1.0 28 | 29 | ### Minor Changes 30 | 31 | - f170e77: add changesets 32 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@1fe/sample-widget-base-config", 3 | "version": "0.1.3", 4 | "repository": { 5 | "type": "git", 6 | "url": "https://github.com/docusign/1fe-sample-widget-base-config.git" 7 | }, 8 | "publishConfig": { 9 | "access": "public", 10 | "registry": "https://registry.npmjs.org/" 11 | }, 12 | "main": "dist/index.js", 13 | "types": "dist/index.d.ts", 14 | "scripts": { 15 | "build": "tsc --build --clean && tsc --build", 16 | "prepack": "yarn build" 17 | }, 18 | "dependencies": { 19 | "@1fe/cli": "^0.1.1", 20 | "ky": "^1.7.5", 21 | "typescript": "5.8.2" 22 | }, 23 | "devDependencies": { 24 | "@changesets/cli": "^2.29.5" 25 | }, 26 | "packageManager": "yarn@4.9.1" 27 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Docusign Inc. 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. -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import { OneFeDynamicConfig, OneFeBaseConfigurationObject, OneFeEnvironmentObject } from '@1fe/cli'; 2 | 3 | import ky from 'ky'; 4 | 5 | const environments = ['integration', 'production'] as const; 6 | 7 | export type Environments = (typeof environments)[number]; 8 | 9 | const dynamicConfigUrls: Record = { 10 | integration: 11 | 'https://1fe-a.akamaihd.net/integration/configs/live.json', 12 | production: 13 | 'https://1fe-a.akamaihd.net/production/configs/live.json', 14 | }; 15 | 16 | const libraryVersionsUrl: Record = { 17 | integration: 18 | 'https://1fe-a.akamaihd.net/integration/configs/lib-versions.json', 19 | production: 20 | 'https://1fe-a.akamaihd.net/production/configs/lib-versions.json', 21 | }; 22 | 23 | function getDynamicConfig(env: Environments) { 24 | return ky.get(dynamicConfigUrls[env]).json(); 25 | } 26 | 27 | function getLibraryVersions(env: Environments) { 28 | return ky.get(libraryVersionsUrl[env]).json(); 29 | } 30 | 31 | export async function getBaseConfig(): Promise { 32 | const isCI = process.env.CI === 'true'; 33 | 34 | const playgroundUrl = isCI 35 | ? 'https://demo.1fe.com/playground' 36 | : 'http://localhost:3001/playground'; 37 | 38 | const shellBaseUrl = isCI 39 | ? 'https://demo.1fe.com' 40 | : 'http://localhost:3001'; 41 | 42 | const serverBaseUrl = isCI 43 | ? 'https://demo.1fe.com' 44 | : 'http://localhost:3001'; 45 | 46 | const baseConfig: OneFeBaseConfigurationObject = { 47 | environments: {}, 48 | playgroundUrl, 49 | }; 50 | 51 | for (const env of environments) { 52 | baseConfig.environments[env] = { 53 | dynamicConfig: await getDynamicConfig(env), 54 | libraryVersions: await getLibraryVersions(env), 55 | shellBaseUrl, 56 | serverBaseUrl, 57 | }; 58 | } 59 | 60 | return baseConfig; 61 | } 62 | -------------------------------------------------------------------------------- /.github/workflows/ci-cd.yml: -------------------------------------------------------------------------------- 1 | name: 🚀 CI/CD 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | branches: 9 | - main 10 | 11 | permissions: 12 | contents: write 13 | pull-requests: write 14 | id-token: write 15 | 16 | jobs: 17 | build: 18 | name: 🚧 Build & Test 19 | runs-on: ubuntu-latest 20 | steps: 21 | - name: Checkout repository 22 | uses: actions/checkout@v4 23 | 24 | - name: Setup Node.js 25 | uses: actions/setup-node@v4 26 | with: 27 | node-version: '20' 28 | cache: 'yarn' 29 | registry-url: 'https://registry.npmjs.org' 30 | env: 31 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_READONLY_1FE }} 32 | 33 | - name: Install dependencies 34 | run: yarn install --no-immutable 35 | 36 | - name: Build package 37 | run: yarn build 38 | 39 | publish: 40 | name: 📦 Publish Package 41 | runs-on: ubuntu-latest 42 | needs: build 43 | if: github.ref == 'refs/heads/main' && github.event_name == 'push' 44 | steps: 45 | - name: Checkout repository 46 | uses: actions/checkout@v4 47 | with: 48 | fetch-depth: 0 49 | 50 | - name: Setup Node.js 51 | uses: actions/setup-node@v4 52 | with: 53 | node-version: '20' 54 | cache: 'yarn' 55 | registry-url: 'https://registry.npmjs.org' 56 | env: 57 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_READONLY_1FE }} 58 | 59 | - name: Ensure OIDC trusted publishing has latest npm 60 | run: npm install -g npm@latest 61 | 62 | - name: Install dependencies 63 | run: yarn install --no-immutable 64 | 65 | - name: Build package 66 | run: yarn build 67 | 68 | - name: Publish to npm 69 | uses: changesets/action@v1 70 | with: 71 | publish: yarn changeset publish 72 | createGithubReleases: true 73 | env: 74 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 1fe Sample Widget Base Config 2 | 3 | A shared configuration package providing base settings and environment configurations for 1fe widgets. This package standardizes widget development configurations across the 1fe ecosystem. 4 | 5 | ## What's in this repository 6 | 7 | This configuration package provides: 8 | 9 | - **Environment configurations** for integration and production 10 | - **Dynamic config URLs** for live configuration management 11 | - **Library version management** for consistent dependencies 12 | - **Widget version configurations** for deployment coordination 13 | - **Base CLI configurations** for 1fe widget builds 14 | - **Shared TypeScript settings** for widget development 15 | 16 | ## Prerequisites 17 | 18 | - **Node.js** `>= 22` 19 | - **Yarn** (package manager) 20 | 21 | ## Getting Started 22 | 23 | ### Installation 24 | 25 | ```bash 26 | # Install as a dependency in your widget project 27 | yarn add @1fe/sample-widget-base-config 28 | 29 | # Or install for development 30 | yarn install 31 | ``` 32 | 33 | ### Usage in Widget Projects 34 | 35 | ```typescript 36 | import { getBaseConfig } from '@1fe/sample-widget-base-config'; 37 | 38 | const configuration: OneFeConfiguration = { 39 | baseConfig: getBaseConfig, 40 | }; 41 | ``` 42 | 43 | ## Configuration Structure 44 | 45 | ### Environment URLs 46 | 47 | The package provides configuration URLs for: 48 | 49 | ```typescript 50 | const dynamicConfigUrls = { 51 | integration: 'https://1fe-a.akamaihd.net/integration/configs/live.json', 52 | production: 'https://1fe-a.akamaihd.net/production/configs/live.json', 53 | }; 54 | 55 | const libraryVersionsUrl = { 56 | integration: 57 | 'https://1fe-a.akamaihd.net/integration/configs/lib-versions.json', 58 | production: 'https://1fe-a.akamaihd.net/production/configs/lib-versions.json', 59 | }; 60 | ``` 61 | 62 | ### Widget Versions 63 | 64 | Manages widget version configurations for deployment coordination: 65 | 66 | ```typescript 67 | const widgetVersionsUrl = { 68 | integration: 69 | 'https://1fe-a.akamaihd.net/integration/configs/widget-versions.json', 70 | production: 71 | 'https://1fe-a.akamaihd.net/production/configs/widget-versions.json', 72 | }; 73 | ``` 74 | 75 | ## Development Commands 76 | 77 | ```bash 78 | # Build TypeScript configuration 79 | yarn build 80 | 81 | # Clean and rebuild 82 | yarn build --clean 83 | ``` 84 | 85 | ## Contributing 86 | 87 | ### Development Workflow 88 | 89 | 1. Fork the repository 90 | 2. Create a feature branch (`git checkout -b feature/your-feature`) 91 | 3. Make your changes to `src/index.ts` 92 | 4. Build and test (`yarn build`) 93 | 5. Commit your changes (`git commit -m 'Add feature'`) 94 | 6. Push to your branch (`git push origin feature/your-feature`) 95 | 7. Open a Pull Request 96 | 97 | ## Troubleshooting 98 | 99 | ### Common Issues 100 | 101 | - **Build failures**: Ensure TypeScript is properly configured 102 | - **Import errors**: Check that the package is properly installed 103 | - **Configuration errors**: Verify environment URLs are accessible 104 | 105 | ## Getting Help 106 | 107 | - **[1fe Documentation](https://1fe.com/getting-started/installation/)** - Complete platform documentation 108 | - **[GitHub Issues](https://github.com/docusign/1fe/issues)** - Report bugs or request features 109 | - **[GitHub Discussions](https://github.com/docusign/1fe/discussions)** - Ask questions and share ideas 110 | 111 | ## License 112 | 113 | This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. 114 | --------------------------------------------------------------------------------