@player-ui/external-action-plugin 0.14.1-next.0 → 0.14.1-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/
|
|
1
|
+
{"version":3,"sources":["/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2573/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/external-action/core/dist/index.global.js","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/external-action/core/src/index.ts"],"names":["ExternalActionPlugin","__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","src_exports","handler","apply","player","hooks","flowController","tap","flow","transition","fromState","toState","state","state_type","setTimeout","shouldTransition","currentState","transitionValue","latestState","error","status","controllers","current","getState","logger","warn","Error","fail"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAIA,uBAAuB,AAAC;IAC1B,IAAIC,YAAYC,OAAOC,cAAc;IACrC,IAAIC,mBAAmBF,OAAOG,wBAAwB;IACtD,IAAIC,oBAAoBJ,OAAOK,mBAAmB;IAClD,IAAIC,eAAeN,OAAOO,SAAS,CAACC,cAAc;IAClD,IAAIC,WAAW,SAACC,QAAQC;QACtB,IAAK,IAAIC,QAAQD,IACfZ,UAAUW,QAAQE,MAAM;YA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AAAOY,QAAUD,QAAjBX;gCACR,IAAIY,MAAMC,UAAA,KAAe,YAAY;oCACnCC,WAAW;;gDAEHC,kBAOAC,cAGIC,iBAOEC,aASDC;;;;wDA1BLJ,mBAAmB,SACvBC;gEAGAA,sDAAAA;mEADAA,cAAaI,MAAA,KAAW,iBACxBJ,EAAAA,0CAAAA,cAAaK,WAAA,CAAYb,IAAA,CAAKc,OAAA,cAA9BN,+DAAAA,uDAAAA,wCAAuCA,YAAA,cAAvCA,2EAAAA,qDAAqDhB,KAAA,MACnDY;;wDAEEI,eAAeZ,OAAOmB,QAAA;6DACxBR,iBAAiBC,eAAjBD;;;;;;;;;;;;wDAEwB;;4DAAM,IAAA,CAAKb,OAAA,CACjCU,OACAI,aAAaK,WAAA;;;wDAFTJ,kBAAkB;wDAKxB,IAAIA,oBAAoB,KAAA,GAAW;4DAE3BC,cAAcd,OAAOmB,QAAA;4DAC3B,IAAIR,iBAAiBG,cAAc;gEACjCA,YAAYG,WAAA,CAAYb,IAAA,CAAKC,UAAA,CAAWQ;4DAC1C,OAAO;gEACLb,OAAOoB,MAAA,CAAOC,IAAA,CACZ,iCAA8Fd,OAA7DM,iBAAe,+CAA0D,OAAZN,QAAQvB,IAAI,EAAA;4DAE9G;wDACF;;;;;;wDACO+B;wDACP,IAAIA,AAAA,YAAAA,OAAiBO,QAAO;4DAC1BV,aAAaW,IAAA,CAAKR;wDACpB;;;;;;;;;;;wCAGN;uCAAG;gCACL;4BACF;wBACF;oBACF;gBACF;;;;;IDDA,OAAOrB,aAAaG;AACtB","sourcesContent":["\"use strict\";\nvar ExternalActionPlugin = (() => {\n var __defProp = Object.defineProperty;\n var __getOwnPropDesc = Object.getOwnPropertyDescriptor;\n var __getOwnPropNames = Object.getOwnPropertyNames;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n };\n var __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n };\n var __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/external-action/core/src/index.ts\n var src_exports = {};\n __export(src_exports, {\n ExternalActionPlugin: () => ExternalActionPlugin\n });\n var ExternalActionPlugin = class {\n constructor(handler) {\n this.name = \"ExternalActionPlugin\";\n this.handler = handler;\n }\n apply(player) {\n player.hooks.flowController.tap(this.name, (flowController) => {\n flowController.hooks.flow.tap(this.name, (flow) => {\n flow.hooks.transition.tap(this.name, (fromState, toState) => {\n const { value: state } = toState;\n if (state.state_type === \"EXTERNAL\") {\n setTimeout(async () => {\n const shouldTransition = (currentState2) => currentState2.status === \"in-progress\" && currentState2.controllers.flow.current?.currentState?.value === state;\n const currentState = player.getState();\n if (shouldTransition(currentState)) {\n try {\n const transitionValue = await this.handler(\n state,\n currentState.controllers\n );\n if (transitionValue !== void 0) {\n const latestState = player.getState();\n if (shouldTransition(latestState)) {\n latestState.controllers.flow.transition(transitionValue);\n } else {\n player.logger.warn(\n `External state resolved with [${transitionValue}], but Player already navigated away from [${toState.name}]`\n );\n }\n }\n } catch (error) {\n if (error instanceof Error) {\n currentState.fail(error);\n }\n }\n }\n }, 0);\n }\n });\n });\n });\n }\n };\n return __toCommonJS(src_exports);\n})();\n","import type {\n Player,\n PlayerPlugin,\n InProgressState,\n PlayerFlowState,\n NavigationFlowExternalState,\n} from \"@player-ui/player\";\n\nexport type ExternalStateHandler = (\n state: NavigationFlowExternalState,\n options: InProgressState[\"controllers\"],\n) => string | undefined | Promise<string | undefined>;\n\n/**\n * A plugin to handle external actions states\n */\nexport class ExternalActionPlugin implements PlayerPlugin {\n name = \"ExternalActionPlugin\";\n private handler: ExternalStateHandler;\n\n constructor(handler: ExternalStateHandler) {\n this.handler = handler;\n }\n\n apply(player: Player) {\n player.hooks.flowController.tap(this.name, (flowController) => {\n flowController.hooks.flow.tap(this.name, (flow) => {\n flow.hooks.transition.tap(this.name, (fromState, toState) => {\n const { value: state } = toState;\n if (state.state_type === \"EXTERNAL\") {\n setTimeout(async () => {\n /** Helper for ensuring state is still current relative to external state this is handling */\n const shouldTransition = (\n currentState: PlayerFlowState,\n ): currentState is InProgressState =>\n currentState.status === \"in-progress\" &&\n currentState.controllers.flow.current?.currentState?.value ===\n state;\n\n const currentState = player.getState();\n if (shouldTransition(currentState)) {\n try {\n const transitionValue = await this.handler(\n state,\n currentState.controllers,\n );\n\n if (transitionValue !== undefined) {\n // Ensure the Player is still in the same state after waiting for transitionValue\n const latestState = player.getState();\n if (shouldTransition(latestState)) {\n latestState.controllers.flow.transition(transitionValue);\n } else {\n player.logger.warn(\n `External state resolved with [${transitionValue}], but Player already navigated away from [${toState.name}]`,\n );\n }\n }\n } catch (error) {\n if (error instanceof Error) {\n currentState.fail(error);\n }\n }\n }\n }, 0);\n }\n });\n });\n });\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
"types"
|
|
7
7
|
],
|
|
8
8
|
"name": "@player-ui/external-action-plugin",
|
|
9
|
-
"version": "0.14.1-next.
|
|
9
|
+
"version": "0.14.1-next.2",
|
|
10
10
|
"main": "dist/cjs/index.cjs",
|
|
11
11
|
"peerDependencies": {
|
|
12
|
-
"@player-ui/player": "0.14.1-next.
|
|
12
|
+
"@player-ui/player": "0.14.1-next.2"
|
|
13
13
|
},
|
|
14
14
|
"module": "dist/index.legacy-esm.js",
|
|
15
15
|
"types": "types/index.d.ts",
|