@claspo/common 7.5.2 → 7.5.3-grp2
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.
- package/PrizePool.interface.d.ts +1 -0
- package/component-manifest/ComponentManifest.interface.d.ts +0 -1
- package/component-manifest/DisplayCondition.interface.d.ts +0 -1
- package/component-manifest/PropertyPaneManifest.interface.d.ts +0 -1
- package/document/ViewNavigationGraph.d.ts +7 -2
- package/document/ViewNavigationGraph.js +1 -1
- package/package.json +1 -1
package/PrizePool.interface.d.ts
CHANGED
|
@@ -23,7 +23,6 @@ export interface ComponentManifestI {
|
|
|
23
23
|
focusableElements?: string[];
|
|
24
24
|
autoContrast?: AutoContrastI[];
|
|
25
25
|
keepGeneralTabOpenUntilInteracted?: boolean;
|
|
26
|
-
isExternalStartCapable?: boolean;
|
|
27
26
|
waitForResourcesLoad?: boolean;
|
|
28
27
|
resourcesPropPaths?: string[][];
|
|
29
28
|
syncEnabled?: boolean;
|
|
@@ -28,5 +28,4 @@ export interface DisplayConditionDocumentUtilsServiceI {
|
|
|
28
28
|
findComponentsByTypes(componentsTree: ClBaseComponentI[], types: ClComponentType[]): ClBaseComponentI[];
|
|
29
29
|
findComponentsByName(componentsTree: ClBaseComponentI[], name: string): ClBaseComponentI[];
|
|
30
30
|
findComponentsByNames(componentsTree: ClBaseComponentI[], names: string[]): ClBaseComponentI[];
|
|
31
|
-
getExternalStartGamingComponents(componentsTree: ClBaseComponentI[], manifests: ComponentManifestI[]): ClBaseComponentI[];
|
|
32
31
|
}
|
|
@@ -386,7 +386,6 @@ export interface ActionsPropertyPaneManifestParamsI {
|
|
|
386
386
|
showTitleCondition?: DisplayConditionCallbackI;
|
|
387
387
|
hideSubmitActionCondition?: DisplayConditionCallbackI;
|
|
388
388
|
hideGoToViewActionCondition?: DisplayConditionCallbackI;
|
|
389
|
-
showRunGameActionCondition?: DisplayConditionCallbackI;
|
|
390
389
|
origin?: boolean;
|
|
391
390
|
}
|
|
392
391
|
export interface IntegrationFieldMappingPropertyPaneManifestModelI extends BasePropertyPaneManifestModelI {
|
|
@@ -4,7 +4,8 @@ export declare enum ViewNavEdgeKind {
|
|
|
4
4
|
GO_TO_NEXT_VIEW = "GO_TO_NEXT_VIEW",
|
|
5
5
|
GO_TO_PREVIOUS_VIEW = "GO_TO_PREVIOUS_VIEW",
|
|
6
6
|
SUBMIT = "SUBMIT",
|
|
7
|
-
NPS_CONDITIONAL = "NPS_CONDITIONAL"
|
|
7
|
+
NPS_CONDITIONAL = "NPS_CONDITIONAL",
|
|
8
|
+
PRIZE_CONDITIONAL = "PRIZE_CONDITIONAL"
|
|
8
9
|
}
|
|
9
10
|
export declare enum ViewTerminalKind {
|
|
10
11
|
TRUE_TERMINAL = "TRUE_TERMINAL",
|
|
@@ -23,6 +24,10 @@ export interface ViewNavEdgeI {
|
|
|
23
24
|
isForward: boolean;
|
|
24
25
|
label: string;
|
|
25
26
|
}
|
|
27
|
+
export interface PrizeNavigationTargetI {
|
|
28
|
+
fromViewId: string;
|
|
29
|
+
toViewId: string;
|
|
30
|
+
}
|
|
26
31
|
export interface ViewNavGraphI {
|
|
27
32
|
nodes: ViewNavNodeI[];
|
|
28
33
|
edges: ViewNavEdgeI[];
|
|
@@ -35,7 +40,7 @@ export declare function viewHasControls(viewModel: ClBaseComponentI | undefined
|
|
|
35
40
|
export declare function isResultView(viewModel: ClBaseComponentI | undefined | null, resultViewIds: string[]): boolean;
|
|
36
41
|
export declare function getConfiguredResultViewIds(submitActionParams: ClSubmitActionParamsI | undefined | null, hasFormControls: boolean): string[];
|
|
37
42
|
export declare function submitAdvancesToNextStep(graph: Pick<ViewNavGraphI, 'edges'>, views: ClBaseComponentI[], viewIndex: number, resultViewIds: string[]): boolean;
|
|
38
|
-
export declare function buildViewNavigationGraph(views: ClBaseComponentI[], shared?: Pick<ClDocumentSharedI, 'submitActionParams'> | null): ViewNavGraphI;
|
|
43
|
+
export declare function buildViewNavigationGraph(views: ClBaseComponentI[], shared?: Pick<ClDocumentSharedI, 'submitActionParams'> | null, prizeNavigationTargets?: PrizeNavigationTargetI[] | null): ViewNavGraphI;
|
|
39
44
|
export declare function classifyView(graph: ViewNavGraphI, viewIndex: number): ViewTerminalKind;
|
|
40
45
|
export declare function classifyViews(graph: ViewNavGraphI): ViewTerminalKind[];
|
|
41
46
|
export declare function isAutoCommitTerminal(graph: ViewNavGraphI, viewIndex: number): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ClDocumentActionType}from"./Document.interface";import{iterateDepthFirst}from"./DocumentUtils";export var ViewNavEdgeKind;!function(e){e.GO_TO_VIEW="GO_TO_VIEW",e.GO_TO_NEXT_VIEW="GO_TO_NEXT_VIEW",e.GO_TO_PREVIOUS_VIEW="GO_TO_PREVIOUS_VIEW",e.SUBMIT="SUBMIT",e.NPS_CONDITIONAL="NPS_CONDITIONAL"}(ViewNavEdgeKind||(ViewNavEdgeKind={}));export var ViewTerminalKind;!function(e){e.TRUE_TERMINAL="TRUE_TERMINAL",e.INTERMEDIATE="INTERMEDIATE"}(ViewTerminalKind||(ViewTerminalKind={}));const SUBMIT_ACTION_TYPES=[ClDocumentActionType.REQUEST,ClDocumentActionType.SUBSCRIBE_CONTACT],NPS_BAND_KEYS=["detractor","passive","promoter"];export const SUCCESS_LEGACY_LABELS=["DOCUMENT_VIEW_TYPE_SUCCESS","DOCUMENT_VIEW_TYPE_SUCCESSFUL_REQUEST","REQUEST_FORM_VIEW_TYPE_SUCCESS"];export const ERROR_LEGACY_LABELS=["DOCUMENT_VIEW_TYPE_ERROR"];export const ALREADY_SUBSCRIBED_LEGACY_LABELS=["DOCUMENT_VIEW_TYPE_SUBSCRIBED"];export const SYSTEM_RESULT_STATE_LABELS=[...SUCCESS_LEGACY_LABELS,...ERROR_LEGACY_LABELS,...ALREADY_SUBSCRIBED_LEGACY_LABELS];function componentModelHasSubmitAction(e){var n,i;try{return!!(null===(i=null===(n=e.props)||void 0===n?void 0:n.handlers)||void 0===i?void 0:i.find(e=>{var n;return null===(n=null==e?void 0:e.actions)||void 0===n?void 0:n.find(e=>SUBMIT_ACTION_TYPES.includes(e.type))}))}catch(e){return!1}}export function viewHasControls(e){if(!e)return!1;let n=0;return iterateDepthFirst(e,e=>{(["INPUT","MULTIPLE_INPUT",
|
|
1
|
+
import{ClDocumentActionType}from"./Document.interface";import{iterateDepthFirst}from"./DocumentUtils";export var ViewNavEdgeKind;!function(e){e.GO_TO_VIEW="GO_TO_VIEW",e.GO_TO_NEXT_VIEW="GO_TO_NEXT_VIEW",e.GO_TO_PREVIOUS_VIEW="GO_TO_PREVIOUS_VIEW",e.SUBMIT="SUBMIT",e.NPS_CONDITIONAL="NPS_CONDITIONAL",e.PRIZE_CONDITIONAL="PRIZE_CONDITIONAL"}(ViewNavEdgeKind||(ViewNavEdgeKind={}));export var ViewTerminalKind;!function(e){e.TRUE_TERMINAL="TRUE_TERMINAL",e.INTERMEDIATE="INTERMEDIATE"}(ViewTerminalKind||(ViewTerminalKind={}));const SUBMIT_ACTION_TYPES=[ClDocumentActionType.REQUEST,ClDocumentActionType.SUBSCRIBE_CONTACT],NPS_BAND_KEYS=["detractor","passive","promoter"],GAMING_COMPONENT_TYPE="PRIZE_BASED_GAMING";export const SUCCESS_LEGACY_LABELS=["DOCUMENT_VIEW_TYPE_SUCCESS","DOCUMENT_VIEW_TYPE_SUCCESSFUL_REQUEST","REQUEST_FORM_VIEW_TYPE_SUCCESS"];export const ERROR_LEGACY_LABELS=["DOCUMENT_VIEW_TYPE_ERROR"];export const ALREADY_SUBSCRIBED_LEGACY_LABELS=["DOCUMENT_VIEW_TYPE_SUBSCRIBED"];export const SYSTEM_RESULT_STATE_LABELS=[...SUCCESS_LEGACY_LABELS,...ERROR_LEGACY_LABELS,...ALREADY_SUBSCRIBED_LEGACY_LABELS];function componentModelHasSubmitAction(e){var n,i;try{return!!(null===(i=null===(n=e.props)||void 0===n?void 0:n.handlers)||void 0===i?void 0:i.find(e=>{var n;return null===(n=null==e?void 0:e.actions)||void 0===n?void 0:n.find(e=>SUBMIT_ACTION_TYPES.includes(e.type))}))}catch(e){return!1}}export function viewHasControls(e){if(!e)return!1;let n=0;return iterateDepthFirst(e,e=>{(["INPUT","MULTIPLE_INPUT",GAMING_COMPONENT_TYPE].includes(e.type)||componentModelHasSubmitAction(e))&&n++}),n>0}export function isResultView(e,n){return!!e&&(SYSTEM_RESULT_STATE_LABELS.includes(e.label)||n.includes(e.id))}export function getConfiguredResultViewIds(e,n){return n?!e||e.runAction?[]:[e.successViewId,e.errorViewId,e.alreadySubscribedViewId].filter(Boolean):[]}function resolveResultViewIndex(e,n,i,o){const t=null==n?void 0:n[i];if(t){const n=e.findIndex(e=>e.id===t);if(-1!==n)return n}return e.findIndex(e=>o.includes(e.label))}export function submitAdvancesToNextStep(e,n,i,o){const t=n[i+1];if(!t||isResultView(t,o))return!1;return!e.edges.some(e=>e.toIndex===i+1&&e.fromIndex!==i&&e.isForward&&e.kind!==ViewNavEdgeKind.SUBMIT)}export function buildViewNavigationGraph(e,n,i){var o;const t=new Map;e.forEach((e,n)=>t.set(e.id,n));const d=null!==(o=null==n?void 0:n.submitActionParams)&&void 0!==o?o:void 0,r=e.some(e=>viewHasControls(e)),E=getConfiguredResultViewIds(d,r),s=r?d:void 0,l=[],a=[],u=(e,n,i)=>{switch(i){case ViewNavEdgeKind.GO_TO_NEXT_VIEW:case ViewNavEdgeKind.SUBMIT:case ViewNavEdgeKind.NPS_CONDITIONAL:case ViewNavEdgeKind.PRIZE_CONDITIONAL:return!0;case ViewNavEdgeKind.GO_TO_PREVIOUS_VIEW:return!1;default:return n>e}},I=(n,i,o,t)=>{void 0===i||i<0||i>=e.length||l.push({fromIndex:n,toIndex:i,kind:o,isForward:u(n,i,o),label:t})},_=(n,i)=>{var o,d;switch(i.type){case ClDocumentActionType.GO_TO_VIEW:return(null===(o=i.params)||void 0===o?void 0:o.viewId)?t.get(i.params.viewId):"number"==typeof(null===(d=i.params)||void 0===d?void 0:d.viewIndex)?i.params.viewIndex:void 0;case ClDocumentActionType.GO_TO_NEXT_VIEW:return n+1<e.length?n+1:void 0;case ClDocumentActionType.GO_TO_PREVIOUS_VIEW:return n-1>=0?n-1:void 0;default:return}},c=e.map(()=>new Set),T=(e,n,i,o)=>{if(void 0===n||-1===n||n===e)return;const t=`${n}:${i}`;c[e].has(t)||(c[e].add(t),I(e,n,i,o))},S=[];e.forEach((e,n)=>{const i=new Set;let o;iterateDepthFirst(e,e=>{var t,d,r,E,s,l,a;const u=null===(t=e.props)||void 0===t?void 0:t.content,c=[];for(const n of null!==(r=null===(d=e.props)||void 0===d?void 0:d.handlers)&&void 0!==r?r:[])for(const e of null!==(E=n.actions)&&void 0!==E?E:[])c.push({action:e,label:null!==(s=null==u?void 0:u.text)&&void 0!==s?s:""});if(Array.isArray(null==u?void 0:u.options))for(const e of u.options)(null==e?void 0:e.action)&&c.push({action:e.action,label:null!==(a=null!==(l=null==e?void 0:e.label)&&void 0!==l?l:null==e?void 0:e.value)&&void 0!==a?a:""});e.type===GAMING_COMPONENT_TYPE&&(o=null!=o?o:"");for(const{action:e,label:i}of c)SUBMIT_ACTION_TYPES.includes(e.type)?o=null!=o?o:i:e.type!==ClDocumentActionType.GO_TO_VIEW&&e.type!==ClDocumentActionType.GO_TO_NEXT_VIEW&&e.type!==ClDocumentActionType.GO_TO_PREVIOUS_VIEW||I(n,_(n,e),e.type,i);NPS_BAND_KEYS.map(e=>(u||{})[e]||null).filter(e=>e).forEach(e=>i.add(e))}),i.forEach(e=>{T(n,t.get(e),ViewNavEdgeKind.NPS_CONDITIONAL,"")}),S[n]=o,a[n]=void 0!==o}),(null!=i?i:[]).forEach(({fromViewId:e,toViewId:n})=>{const i=t.get(e);void 0!==i&&T(i,t.get(n),ViewNavEdgeKind.PRIZE_CONDITIONAL,"")}),e.forEach((n,i)=>{const o=S[i];if(void 0===o)return;const t=e[i+1],d=submitAdvancesToNextStep({edges:l},e,i,E),a=o,u=()=>{T(i,resolveResultViewIndex(e,s,"errorViewId",ERROR_LEGACY_LABELS),ViewNavEdgeKind.SUBMIT,a),s&&!s.alreadySubscribedViewId?T(i,resolveResultViewIndex(e,s,"successViewId",SUCCESS_LEGACY_LABELS),ViewNavEdgeKind.SUBMIT,a):T(i,resolveResultViewIndex(e,s,"alreadySubscribedViewId",ALREADY_SUBSCRIBED_LEGACY_LABELS),ViewNavEdgeKind.SUBMIT,a)};if(d)return T(i,i+1,ViewNavEdgeKind.SUBMIT,a),void(!viewHasControls(t)&&r&&u());const I=null==s?void 0:s.runAction;I?T(i,_(i,I),I.type,a):(T(i,resolveResultViewIndex(e,s,"successViewId",SUCCESS_LEGACY_LABELS),ViewNavEdgeKind.SUBMIT,a),u())});const v=e.map((e,n)=>{var i,o;return{index:n,id:e.id,label:null!==(i=e.label)&&void 0!==i?i:e.id,hasSubmitAction:null!==(o=a[n])&&void 0!==o&&o}});return{nodes:v,edges:l}}export function classifyView(e,n){return e.edges.some(e=>e.fromIndex===n)?ViewTerminalKind.INTERMEDIATE:ViewTerminalKind.TRUE_TERMINAL}export function classifyViews(e){return e.nodes.map(n=>classifyView(e,n.index))}export function isAutoCommitTerminal(e,n){const i=e.nodes[n];return!!i&&(classifyView(e,n)===ViewTerminalKind.TRUE_TERMINAL&&!i.hasSubmitAction)}export function isMultiViewFlow(e){if(e.nodes.length<2)return!1;const n=new Set([0]),i=[0];for(;i.length;){const o=i.shift();for(const t of e.edges)t.fromIndex!==o||n.has(t.toIndex)||(n.add(t.toIndex),i.push(t.toIndex))}return n.size>1}export function isNonLinearFlow(e){return e.edges.some(e=>e.kind===ViewNavEdgeKind.GO_TO_VIEW||e.kind===ViewNavEdgeKind.NPS_CONDITIONAL||e.kind===ViewNavEdgeKind.PRIZE_CONDITIONAL||e.kind===ViewNavEdgeKind.SUBMIT&&e.toIndex<e.fromIndex)}
|