@player-ui/make-flow
Advanced tools
Comparing version 0.7.4-next.4 to 0.7.5--canary.432.14776
{ | ||
"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.432.14776", | ||
"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.432.14776", | ||
"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 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47660
14
936
1
2
2
1
1
+ Addedtslib@^2.6.2
+ Added@player-ui/types@0.7.5--canary.432.14776(transitive)
+ Addedtslib@2.8.1(transitive)
- Removed@babel/runtime@7.15.4
- Removed@babel/runtime@7.15.4(transitive)
- Removed@player-ui/types@0.7.4-next.4(transitive)
- Removedregenerator-runtime@0.13.11(transitive)