1.1.49 • Published 3 years ago

@withkoji/vcc v1.1.49

Weekly downloads
418
License
-
Repository
github
Last release
3 years ago

Koji VCC (deprecated)

npm (scoped)

Core library for developing remixable Koji templates.

Overview

The @withkoji/vcc package enables you to implement core platform features in your Koji template, including instant remixing, Visual Customization Controls (VCCs), and the Koji feed.

DEPRECATED This package is deprecated and is included only for backwards compatibility. For new templates, use @withkoji/core.

Installation

Install the package in your Koji project.

npm install --save @withkoji/vcc

Basic use

Start the watcher

Reconfigure the package.json file to run the watcher (koji-vcc watch) concurrently with your development server. You can install and use a package like npm-run-all. For example:

{
  "scripts": {
    ...
    "start": "npm-run-all -p watch start:server",
    "watch": "koji-vcc watch",
    "start:server": "webpack-dev-server --config ./.internals/webpack.development.js --inline --hot"
  }
}

NOTE: Make sure to replace the value of "start:server" with the "start" command for your project and remove the prestart command, if there is one.

Support TypeScript

To ensure that VCCs work correctly in your TypeScript project, add the following line to the scripts section of the package.json file.

"prebuild": "koji-vcc preinstall-ts"

InstantRemixing

Instant remixing enables users to customize values directly from the template preview, rather than from the Koji editor, for a quick and easy way to remix without coding.

To enable instant remixing for your Koji template, you must implement the InstantRemixing class and enable the InstantRemixing entitlement in the .koji/project/entitlements.json file.

{
  "entitlements": {
    "InstantRemixing": true
  }
}

Instantiate InstantRemixing.

import { InstantRemixing } from '@withkoji/vcc';
const instantRemixing = new InstantRemixing();

VccMiddleware

This package includes an Express middleware to manage the environment variables for instant remixes and for access to VCC values from dynamic backends, as a companion to the frontend InstantRemixing class.

To implement this middleware, add it to your Express server.

import { VccMiddleware } from '@withkoji/vcc';

const app = express();
app.use(VccMiddleware.express);

This middleware is required to manage the environment variables to scope them for instant remixes of the original template. In particular, you must call this middleware before instantiating certain packages, including @withkoji/koji-iap, @withkoji/database, and @withkoji/koji-auth-sdk.

FeedSdk

The Koji feed enables users to browse available templates, moving them from off screen or out of focus, into the main window of the feed.

To ensure a template can be displayed correctly in the Koji feed, you must implement the FeedSdk and enable the FeedEvents entitlement in the .koji/project/entitlements.json file.

{
  "entitlements": {
    "FeedEvents": true
  }
}

NOTE: Kojis must be authorized by the Koji team to be displayed within the feed. When you are confident that your template is able to function well within a feed, please contact us for review and authorization.

Instantiate FeedSdk.

import { FeedSdk } from '@withkoji/vcc';
const feed = new FeedSdk();

Keystore

The Keystore module is used in conjunction with the secret VCC type to store sensitive data, ensuring the value is not visible when the project is remixed.

Instantiate Keystore.

import { Keystore } from '@withkoji/vcc';
const keystore = new Keystore();

Related resources

Contributions and questions

See the contributions page on the developer site for info on how to make contributions to Koji repositories and developer documentation.

For any questions, reach out to the developer community or the @Koji Team on our Discord server.

1.1.49

3 years ago

1.1.48

3 years ago

1.1.47

3 years ago

1.1.46

3 years ago

1.1.45

3 years ago

1.1.44

3 years ago

1.1.43

3 years ago

1.1.42

3 years ago

1.1.41

3 years ago

1.1.40

3 years ago

1.1.39

3 years ago

1.1.38

3 years ago

1.1.37

3 years ago

1.1.36

3 years ago

1.1.35

3 years ago

1.1.34

3 years ago

1.1.33

4 years ago

1.1.32

4 years ago

1.1.31

4 years ago

1.1.30

4 years ago

1.1.29

4 years ago

1.1.28

4 years ago

1.1.27

4 years ago

1.1.26

4 years ago

1.1.25

4 years ago

1.1.24

4 years ago

1.1.23

4 years ago

1.1.22

4 years ago

1.1.21

4 years ago

1.1.19

4 years ago

1.1.18

4 years ago

1.1.20

4 years ago

1.1.17

4 years ago

1.1.16

4 years ago

1.1.15

4 years ago

1.1.14

4 years ago

1.1.13

4 years ago

1.1.12

4 years ago

1.1.11

4 years ago

1.1.10

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago