Start typing to search...

Remix

Manages the customization experience for your Koji app.

Methods

.cancel()

Cancels the customization experience and returns to where the user was before they started customization. If the user has made changes, they are prompted to confirm the cancellation.

Example

Koji.remix.cancel();

Source: frontend/remix/index.ts#L185

.decryptValue(encryptedValue)

Retrieves sensitive data that was [[encryptValue | stored as an encrypted value]].

Note
Only the owner of the Koji app can access the decrypted value with this method. For example, to check that the value was entered correctly. To retrieve the value for other users, use {@doclink core-backend-secret#resolveValue | Secret.resolveValue} on the backend.

Parameters

  • encryptedValue - Any, Path where the encrypted value is stored.

Returns

Promise<String>, Decrypted value.

Example

const value = await Koji.remix.decryptValue(encryptPath);

Source: frontend/remix/index.ts#L233

.encryptValue(rawValue, options)

Stores sensitive data as an encrypted value. The sensitive data can only be accessed programmatically and is not available when the Koji app is configured.

Parameters

  • rawValue - Any, Value to encrypt.

  • options - EncryptValueOptions (Optional), Options when encrypting a secret value.

Returns

Promise<String>, Encrypted value. Use this value to [[decryptValue | decrypt the value]] on the frontend, for the creator, or to {@doclink core-backend-secret#resolveValue | resolve the value} on the backend, for other users.

Example

const encryptPath = await Koji.remix.encryptValue(text);

Source: frontend/remix/index.ts#L204

.finish()

Advances the Koji app’s mode from customization to preview.

Example

<button onClick={() => Koji.remix.finish()}>
 Next
</button>

Source: frontend/remix/index.ts#L168

.get(path, defaultValue)

Gets the customization data for the Koji app.

Parameters

  • path - String (Optional), Array of keys to target a specific value in the object.

  • defaultValue - Any (Optional), Value to return if no value exists at the targeted path.

Returns

Any, Object containing the current customization data.

Example

// Return the entire `remixData` object
const values = Koji.remix.get();

// Return a particular value
const backgroundColor = Koji.remix.get(['colors', 'background']);

// Return a particular value with a default if the value is not defined
const textColor = Koji.remix.get(['colors', 'text'], '#000000');

Source: frontend/remix/index.ts#L108

.init(remixData)

Initializes the Koji app’s customization data with default values.

Note
In most cases, you do not need to call this method manually because it is automatically called when you initialize the package with Koji.config. Use this method only if you want to use the Remix class by itself, without any other classes in the package.

Parameters

  • remixData - Any, Object containing the default values for your Koji app.

Example

import { remixData } from '../../koji.json;

Koji.remix.init(remixData));

Source: frontend/remix/index.ts#L68

.overwrite(newValues)

Replaces all customization data with the specified object.

Note
This method overwrites all existing values in the customization data. To update specific values only, use [[set]].

Parameters

  • newValues - Object, Object containing the new customization data for the Koji app.

Returns

Promise<Boolean>, Indicates whether the customization data was successfully replaced.

Example

await Koji.remix.overwrite({'myColor': color, 'myText': text});

Source: frontend/remix/index.ts#L152

.set(newValue)

Updates the specified values in the customization data.

Note
This method updates only the values that are specified in newValue. If other values exist, they are not changed. To replace all customization data, use [[overwrite]].

Parameters

  • newValue - Object, Key-value pairs to update in the customization data.

Returns

Promise<Boolean>, Indicates whether the values were successfully updated.

Example

await Koji.remix.set({'myColor': color});

Source: frontend/remix/index.ts#L128

Interfaces

EncryptValueOptions

Options when encrypting a secret value.

Properties

  • skipEncryptionAtRest - Boolean (Optional), Set true to bypass at-rest encryption on Koji's servers, allowing you to encrypt values larger than 4kb.