Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@player-ui/make-flow

Package Overview
Dependencies
Maintainers
2
Versions
294
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@player-ui/make-flow - npm Package Compare versions

Comparing version 0.7.4-next.4 to 0.7.5--canary.428.14992

dist/cjs/index.cjs

77

package.json
{
"name": "@player-ui/make-flow",
"version": "0.7.4-next.4",
"private": false,
"publishConfig": {
"registry": "https://registry.npmjs.org"
},
"peerDependencies": {},
"version": "0.7.5--canary.428.14992",
"main": "dist/cjs/index.cjs",
"dependencies": {
"@player-ui/types": "0.7.4-next.4",
"@babel/runtime": "7.15.4"
"@player-ui/types": "0.7.5--canary.428.14992",
"tslib": "^2.6.2"
},
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
"typings": "dist/index.d.ts",
"module": "dist/index.legacy-esm.js",
"types": "types/index.d.ts",
"bundle": "dist/MakeFlow.native.js",
"sideEffects": false,
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/player-ui/player-ui"
"exports": {
"./package.json": "./package.json",
"./dist/index.css": "./dist/index.css",
".": {
"types": "./types/index.d.ts",
"import": "./dist/index.mjs",
"default": "./dist/cjs/index.cjs"
}
},
"bugs": {
"url": "https://github.com/player-ui/player-ui/issues"
},
"homepage": "https://player-ui.github.io",
"contributors": [
{
"name": "Adam Dierkens",
"url": "https://github.com/adierkens"
},
{
"name": "Spencer Hamm",
"url": "https://github.com/spentacular"
},
{
"name": "Harris Borawski",
"url": "https://github.com/hborawski"
},
{
"name": "Jeremiah Zucker",
"url": "https://github.com/sugarmanz"
},
{
"name": "Ketan Reddy",
"url": "https://github.com/KetanReddy"
},
{
"name": "Brocollie08",
"url": "https://github.com/brocollie08"
},
{
"name": "Kelly Harrop",
"url": "https://github.com/kharrop"
},
{
"name": "Alejandro Fimbres",
"url": "https://github.com/lexfm"
},
{
"name": "Rafael Campos",
"url": "https://github.com/rafbcampos"
}
"files": [
"dist",
"src",
"types"
],
"bundle": "./dist/make-flow.prod.js"
"peerDependencies": {}
}

@@ -1,2 +0,2 @@

import type { AssetWrapper } from '@player-ui/types';
import type { AssetWrapper } from "@player-ui/types";

@@ -12,3 +12,3 @@ export enum ObjType {

export default function identify(obj: object): ObjType {
if ('id' in obj && 'type' in obj) {
if ("id" in obj && "type" in obj) {
return ObjType.ASSET;

@@ -18,3 +18,3 @@ }

if (
'asset' in obj &&
"asset" in obj &&
identify((obj as AssetWrapper).asset) === ObjType.ASSET

@@ -25,3 +25,3 @@ ) {

if ('navigation' in obj || 'schema' in obj || 'views' in obj) {
if ("navigation" in obj || "schema" in obj || "views" in obj) {
return ObjType.FLOW;

@@ -28,0 +28,0 @@ }

@@ -7,6 +7,6 @@ import type {

NavigationFlowEndState,
} from '@player-ui/types';
import identify, { ObjType } from './identify';
} from "@player-ui/types";
import identify, { ObjType } from "./identify";
export * from './identify';
export * from "./identify";
export { identify };

@@ -21,3 +21,3 @@

interface CollectionAsset extends Asset<'collection'> {
interface CollectionAsset extends Asset<"collection"> {
/** The values of the collection. Used when there are an array of assets passed to the makeFlow fn */

@@ -29,3 +29,3 @@ values: Array<AssetWrapper>;

function unwrapJSend(obj: object) {
const isJSend = 'status' in obj && 'data' in obj;
const isJSend = "status" in obj && "data" in obj;

@@ -41,5 +41,5 @@ if (isJSend) {

/** An optional expression to run when this Flow starts */
onStart?: NavigationFlow['onStart'];
onStart?: NavigationFlow["onStart"];
/** An optional expression to run when this Flow ends */
onEnd?: NavigationFlow['onEnd'];
onEnd?: NavigationFlow["onEnd"];
/**

@@ -49,3 +49,3 @@ * A description of _how_ the flow ended.

*/
outcome?: NavigationFlowEndState['outcome'];
outcome?: NavigationFlowEndState["outcome"];
}

@@ -63,18 +63,18 @@

const navFlow: NavigationFlow = {
startState: 'VIEW_0',
startState: "VIEW_0",
VIEW_0: {
state_type: 'VIEW',
state_type: "VIEW",
ref: flow.views[0].id ?? `${flow.id}-views-0`,
transitions: {
'*': 'END_done',
Prev: 'END_back',
"*": "END_done",
Prev: "END_back",
},
},
END_done: {
state_type: 'END',
outcome: options?.outcome ?? 'doneWithFlow',
state_type: "END",
outcome: options?.outcome ?? "doneWithFlow",
},
END_back: {
state_type: 'END',
outcome: 'BACK',
state_type: "END",
outcome: "BACK",
},

@@ -94,3 +94,3 @@ };

navigation: {
BEGIN: 'Flow',
BEGIN: "Flow",
Flow: navFlow,

@@ -108,8 +108,8 @@ },

export function makeFlow(obj: any, args?: NavOptions): Flow {
const objified = unwrapJSend(typeof obj === 'string' ? JSON.parse(obj) : obj);
const objified = unwrapJSend(typeof obj === "string" ? JSON.parse(obj) : obj);
if (Array.isArray(objified)) {
const collection: CollectionAsset = {
id: 'collection',
type: 'collection',
id: "collection",
type: "collection",
values: objified.map((v) => {

@@ -133,3 +133,3 @@ const type = identify(v);

throw new Error(
'No clue how to convert this into a flow. Just do it yourself'
"No clue how to convert this into a flow. Just do it yourself",
);

@@ -147,19 +147,19 @@ }

return {
id: 'generated-flow',
id: "generated-flow",
views: [obj],
data: {},
navigation: {
BEGIN: 'FLOW_1',
BEGIN: "FLOW_1",
FLOW_1: {
startState: 'VIEW_1',
startState: "VIEW_1",
VIEW_1: {
state_type: 'VIEW',
state_type: "VIEW",
ref: obj.id,
transitions: {
'*': 'END_Done',
"*": "END_Done",
},
},
END_Done: {
state_type: 'END',
outcome: 'done',
state_type: "END",
outcome: "done",
},

@@ -166,0 +166,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc