@claspo/common 7.5.12 → 7.5.13-usbscr

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.
@@ -24,6 +24,7 @@ export interface WidgetInitConfigI {
24
24
  actionFactoryClass?: any;
25
25
  widgetId?: number;
26
26
  prizePoolModels?: PrizePoolModelI[];
27
+ prizePoolModelsFromScript?: PrizePoolModelI[];
27
28
  bundledComponentClasses?: any[];
28
29
  translations?: TranslationsI;
29
30
  trackingService?: TrackingServiceI;
@@ -1,5 +1,5 @@
1
1
  import { ClBaseComponentI, ClComponentType, ClDocumentActionType } from '../document/Document.interface';
2
- import { DisplayConditionCallbackI } from './DisplayCondition.interface';
2
+ import { DisplayConditionCallbackI, DisplayConditionSdkI } from './DisplayCondition.interface';
3
3
  import { PropPathConditionCallbackI } from './PropPathCondition.interface';
4
4
  export interface PropertyPaneManifestI {
5
5
  content: BasePropertyPaneManifestModelI[];
@@ -43,7 +43,8 @@ export declare enum ValueTransformerName {
43
43
  export declare enum PropertyPaneManifestModelType {
44
44
  CONTROL = "CONTROL",
45
45
  TEXT = "TEXT",
46
- GROUP = "GROUP"
46
+ GROUP = "GROUP",
47
+ NOTIFICATION = "NOTIFICATION"
47
48
  }
48
49
  export declare enum ClPropertyPaneManifestModelName {
49
50
  SIZE = "SIZE",
@@ -161,11 +162,98 @@ export interface TextPropertyPaneManifestParamsI {
161
162
  type?: TextPropertyPaneManifestParamsType;
162
163
  styles?: string[];
163
164
  classes?: string[];
165
+ html?: boolean;
164
166
  }
165
167
  export declare enum TextPropertyPaneManifestParamsType {
166
168
  PRIMARY = "PRIMARY",
167
169
  SECONDARY = "SECONDARY"
168
170
  }
171
+ export interface PropertyPaneTranslationI {
172
+ key: string;
173
+ param?: {
174
+ [name: string]: string;
175
+ };
176
+ }
177
+ export type PropertyPaneCallbackI = (sdk: DisplayConditionSdkI) => void | Promise<void>;
178
+ export interface NotificationPropertyPaneManifestModelI extends BasePropertyPaneManifestModelI {
179
+ params: NotificationPropertyPaneManifestParamsI;
180
+ }
181
+ export interface NotificationPropertyPaneManifestParamsI {
182
+ notificationType: PropertyPaneNotificationType;
183
+ title?: PropertyPaneTranslationI;
184
+ description?: PropertyPaneTranslationI;
185
+ messages?: NotificationPropertyPaneMessageI[];
186
+ actions?: NotificationPropertyPaneActionI[];
187
+ closable?: boolean;
188
+ onClose?: PropertyPaneCallbackI;
189
+ hideIcon?: boolean;
190
+ }
191
+ export declare enum PropertyPaneNotificationType {
192
+ SUCCESS = "SUCCESS",
193
+ INFO = "INFO",
194
+ INFO_SECONDARY = "INFO_SECONDARY",
195
+ WARNING = "WARNING",
196
+ ERROR = "ERROR"
197
+ }
198
+ export interface NotificationPropertyPaneMessageI extends PropertyPaneTranslationI {
199
+ href?: string;
200
+ targetBlank?: boolean;
201
+ classes?: string;
202
+ tooltips?: PropertyPaneTooltipI[];
203
+ iconAfterMessage?: PropertyPaneIconWithTooltipI;
204
+ copyToClipboard?: string;
205
+ }
206
+ export interface PropertyPaneIconWithTooltipI {
207
+ iconMode: string;
208
+ tooltips: PropertyPaneTooltipI[];
209
+ }
210
+ export interface PropertyPaneTooltipI {
211
+ message?: PropertyPaneTranslationI;
212
+ interactiveElement?: PropertyPaneTooltipInteractiveElementI;
213
+ interactiveMessage?: boolean;
214
+ className?: string;
215
+ onClick?: PropertyPaneCallbackI;
216
+ hideTooltipOnClick?: boolean;
217
+ }
218
+ export interface PropertyPaneTooltipInteractiveElementI {
219
+ type: PropertyPaneTooltipInteractiveElementType;
220
+ name: PropertyPaneTranslationI;
221
+ href?: string;
222
+ target?: string;
223
+ buttonType?: PropertyPaneTooltipButtonType;
224
+ onClick?: PropertyPaneCallbackI;
225
+ hideTooltipOnClick?: boolean;
226
+ userActivityKey?: string;
227
+ }
228
+ export declare enum PropertyPaneTooltipInteractiveElementType {
229
+ BUTTON = "BUTTON",
230
+ LINK = "LINK"
231
+ }
232
+ export declare enum PropertyPaneTooltipButtonType {
233
+ PRIMARY = "primary",
234
+ SECONDARY = "secondary"
235
+ }
236
+ export type NotificationPropertyPaneActionI = NotificationPropertyPaneLinkActionI | NotificationPropertyPaneButtonActionI;
237
+ export declare enum NotificationPropertyPaneActionType {
238
+ BUTTON = "BUTTON",
239
+ LINK = "LINK"
240
+ }
241
+ export interface NotificationPropertyPaneLinkActionI {
242
+ type: NotificationPropertyPaneActionType.LINK;
243
+ label: PropertyPaneTranslationI;
244
+ href: string;
245
+ cssClass?: string;
246
+ targetBlank?: boolean;
247
+ onClick?: PropertyPaneCallbackI;
248
+ }
249
+ export interface NotificationPropertyPaneButtonActionI {
250
+ type: NotificationPropertyPaneActionType.BUTTON;
251
+ label: PropertyPaneTranslationI;
252
+ onClick: PropertyPaneCallbackI;
253
+ buttonType?: string;
254
+ iconBefore?: string;
255
+ iconAfter?: string;
256
+ }
169
257
  export interface SizePropertyPaneManifestModelI extends BasePropertyPaneManifestModelI {
170
258
  params: {
171
259
  [key: string]: SizePropertyPaneManifestParamsI;
@@ -1 +1 @@
1
- export var ValueTransformerName;!function(T){T.PIXELS="px"}(ValueTransformerName||(ValueTransformerName={}));export var PropertyPaneManifestModelType;!function(T){T.CONTROL="CONTROL",T.TEXT="TEXT",T.GROUP="GROUP"}(PropertyPaneManifestModelType||(PropertyPaneManifestModelType={}));export var ClPropertyPaneManifestModelName;!function(T){T.SIZE="SIZE",T.INDENTATION="INDENTATION",T.ALIGNMENT="ALIGNMENT",T.BACKGROUND="BACKGROUND",T.BACKDROP_FILTER="BACKDROP_FILTER",T.BACKGROUND_MARKER_SELECTED="BACKGROUND_MARKER_SELECTED",T.BORDERS="BORDERS",T.BOX_SHADOW="BOX_SHADOW",T.BORDER_RADIUS="BORDER_RADIUS",T.TEXT_PARAMS="TEXT_PARAMS",T.TEXT_INPUT="TEXT_INPUT",T.SWITCH="SWITCH",T.SWITCH_WITH_INPUT="SWITCH_WITH_INPUT",T.INPUT_VALIDATION="INPUT_VALIDATION",T.INPUT_LABEL="INPUT_LABEL",T.AUTOFILL="AUTOFILL",T.TEXT_COLOR="TEXT_COLOR",T.SELECT="SELECT",T.RADIO_BUTTONS="RADIO_BUTTONS",T.IMAGE_SOURCES="IMAGE_SOURCES",T.COUNTRY_PHONE_SELECT="COUNTRY_PHONE_SELECT",T.HOVER_ANIMATION="HOVER_ANIMATION",T.ACTIONS="ACTIONS",T.NPS_ACTIONS="NPS_ACTIONS",T.DATEPICKER="DATEPICKER",T.DATEPICKER_COUNTDOWN_TIMER="DATEPICKER_COUNTDOWN_TIMER",T.DISPLAY="DISPLAY",T.COMPONENT_OPTIONS="COMPONENT_OPTIONS",T.COLOR_SELECT="COLOR_SELECT",T.FLOATING_COMPONENT_POSITION="FLOATING_COMPONENT_POSITION",T.LOOP_ANIMATION="LOOP_ANIMATION",T.VIDEO_URL="VIDEO_URL",T.VIDEO_CUSTOM_COVER="VIDEO_CUSTOM_COVER",T.WIDGET_LAYOUT_SELECT="WIDGET_LAYOUT_SELECT",T.MULTIPLE_INPUT_SIZE="MULTIPLE_INPUT_SIZE",T.DATE_FORMAT="DATE_FORMAT",T.ICON="ICON",T.PROMOCODE_ICON="PROMOCODE_ICON",T.ICON_SELECT="ICON_SELECT",T.TEXT_VISIBILITY="TEXT_VISIBILITY",T.SLIDER_SETTINGS="SLIDER_SETTINGS",T.SLIDER_MANAGE_SLIDES="SLIDER_MANAGE_SLIDES",T.SLIDER_MODES="SLIDER_MODES",T.SLIDER_NAVIGATION_BUTTONS="SLIDER_NAVIGATION_BUTTONS",T.SLIDER_INDICATION="SLIDER_INDICATION",T.SLIDER_SLIDESHOW_ANIMATION="SLIDER_SLIDESHOW_ANIMATION",T.INTEGRATION_FIELD_MAPPING="INTEGRATION_FIELD_MAPPING",T.SUPPORTED_LANGUAGES="SUPPORTED_LANGUAGES",T.LIST_POSITION="LIST_POSITION",T.SOCIAL_ICON_SIZE="SOCIAL_ICON_SIZE",T.SOCIAL_TYPE_AND_ICON_SELECT="SOCIAL_TYPE_AND_ICON_SELECT",T.COLUMNS="COLUMNS",T.INSERT_BLOCK="INSERT_BLOCK",T.NUMBER_INPUT="NUMBER_INPUT",T.PRIZE_SETTINGS="PRIZE_SETTINGS",T.ROOT_COMPONENT_SELECT="ROOT_COMPONENT_SELECT",T.FEEDBACK_TYPE="FEEDBACK_TYPE",T.FEEDBACK_ICONS_SELECT="FEEDBACK_ICONS_SELECT",T.FEEDBACK_ACTIONS="FEEDBACK_ACTIONS",T.FLOATING_BOX_POSITION="FLOATING_BOX_POSITION",T.OVERLAY_POSITION="OVERLAY_POSITION",T.OVERLAY_BACKGROUND="OVERLAY_BACKGROUND",T.OVERLAY_BACKDROP_FILTER="OVERLAY_BACKDROP_FILTER",T.WIDGET_THEME_SELECT="WIDGET_THEME_SELECT"}(ClPropertyPaneManifestModelName||(ClPropertyPaneManifestModelName={}));export var TabPropertyPaneManifestType;!function(T){T.DESKTOP_STYLES="DESKTOP_STYLES",T.MOBILE_STYLES="MOBILE_STYLES"}(TabPropertyPaneManifestType||(TabPropertyPaneManifestType={}));export var TextPropertyPaneManifestParamsType;!function(T){T.PRIMARY="PRIMARY",T.SECONDARY="SECONDARY"}(TextPropertyPaneManifestParamsType||(TextPropertyPaneManifestParamsType={}));export var SizePropertyPaneOption;!function(T){T.FIXED="fixed",T.FILL="fill",T.HUG="hug"}(SizePropertyPaneOption||(SizePropertyPaneOption={}));export var IndentationPropertyPaneManifestType;!function(T){T.PADDING="PADDING",T.MARGIN="MARGIN"}(IndentationPropertyPaneManifestType||(IndentationPropertyPaneManifestType={}));
1
+ export var ValueTransformerName;!function(T){T.PIXELS="px"}(ValueTransformerName||(ValueTransformerName={}));export var PropertyPaneManifestModelType;!function(T){T.CONTROL="CONTROL",T.TEXT="TEXT",T.GROUP="GROUP",T.NOTIFICATION="NOTIFICATION"}(PropertyPaneManifestModelType||(PropertyPaneManifestModelType={}));export var ClPropertyPaneManifestModelName;!function(T){T.SIZE="SIZE",T.INDENTATION="INDENTATION",T.ALIGNMENT="ALIGNMENT",T.BACKGROUND="BACKGROUND",T.BACKDROP_FILTER="BACKDROP_FILTER",T.BACKGROUND_MARKER_SELECTED="BACKGROUND_MARKER_SELECTED",T.BORDERS="BORDERS",T.BOX_SHADOW="BOX_SHADOW",T.BORDER_RADIUS="BORDER_RADIUS",T.TEXT_PARAMS="TEXT_PARAMS",T.TEXT_INPUT="TEXT_INPUT",T.SWITCH="SWITCH",T.SWITCH_WITH_INPUT="SWITCH_WITH_INPUT",T.INPUT_VALIDATION="INPUT_VALIDATION",T.INPUT_LABEL="INPUT_LABEL",T.AUTOFILL="AUTOFILL",T.TEXT_COLOR="TEXT_COLOR",T.SELECT="SELECT",T.RADIO_BUTTONS="RADIO_BUTTONS",T.IMAGE_SOURCES="IMAGE_SOURCES",T.COUNTRY_PHONE_SELECT="COUNTRY_PHONE_SELECT",T.HOVER_ANIMATION="HOVER_ANIMATION",T.ACTIONS="ACTIONS",T.NPS_ACTIONS="NPS_ACTIONS",T.DATEPICKER="DATEPICKER",T.DATEPICKER_COUNTDOWN_TIMER="DATEPICKER_COUNTDOWN_TIMER",T.DISPLAY="DISPLAY",T.COMPONENT_OPTIONS="COMPONENT_OPTIONS",T.COLOR_SELECT="COLOR_SELECT",T.FLOATING_COMPONENT_POSITION="FLOATING_COMPONENT_POSITION",T.LOOP_ANIMATION="LOOP_ANIMATION",T.VIDEO_URL="VIDEO_URL",T.VIDEO_CUSTOM_COVER="VIDEO_CUSTOM_COVER",T.WIDGET_LAYOUT_SELECT="WIDGET_LAYOUT_SELECT",T.MULTIPLE_INPUT_SIZE="MULTIPLE_INPUT_SIZE",T.DATE_FORMAT="DATE_FORMAT",T.ICON="ICON",T.PROMOCODE_ICON="PROMOCODE_ICON",T.ICON_SELECT="ICON_SELECT",T.TEXT_VISIBILITY="TEXT_VISIBILITY",T.SLIDER_SETTINGS="SLIDER_SETTINGS",T.SLIDER_MANAGE_SLIDES="SLIDER_MANAGE_SLIDES",T.SLIDER_MODES="SLIDER_MODES",T.SLIDER_NAVIGATION_BUTTONS="SLIDER_NAVIGATION_BUTTONS",T.SLIDER_INDICATION="SLIDER_INDICATION",T.SLIDER_SLIDESHOW_ANIMATION="SLIDER_SLIDESHOW_ANIMATION",T.INTEGRATION_FIELD_MAPPING="INTEGRATION_FIELD_MAPPING",T.SUPPORTED_LANGUAGES="SUPPORTED_LANGUAGES",T.LIST_POSITION="LIST_POSITION",T.SOCIAL_ICON_SIZE="SOCIAL_ICON_SIZE",T.SOCIAL_TYPE_AND_ICON_SELECT="SOCIAL_TYPE_AND_ICON_SELECT",T.COLUMNS="COLUMNS",T.INSERT_BLOCK="INSERT_BLOCK",T.NUMBER_INPUT="NUMBER_INPUT",T.PRIZE_SETTINGS="PRIZE_SETTINGS",T.ROOT_COMPONENT_SELECT="ROOT_COMPONENT_SELECT",T.FEEDBACK_TYPE="FEEDBACK_TYPE",T.FEEDBACK_ICONS_SELECT="FEEDBACK_ICONS_SELECT",T.FEEDBACK_ACTIONS="FEEDBACK_ACTIONS",T.FLOATING_BOX_POSITION="FLOATING_BOX_POSITION",T.OVERLAY_POSITION="OVERLAY_POSITION",T.OVERLAY_BACKGROUND="OVERLAY_BACKGROUND",T.OVERLAY_BACKDROP_FILTER="OVERLAY_BACKDROP_FILTER",T.WIDGET_THEME_SELECT="WIDGET_THEME_SELECT"}(ClPropertyPaneManifestModelName||(ClPropertyPaneManifestModelName={}));export var TabPropertyPaneManifestType;!function(T){T.DESKTOP_STYLES="DESKTOP_STYLES",T.MOBILE_STYLES="MOBILE_STYLES"}(TabPropertyPaneManifestType||(TabPropertyPaneManifestType={}));export var TextPropertyPaneManifestParamsType;!function(T){T.PRIMARY="PRIMARY",T.SECONDARY="SECONDARY"}(TextPropertyPaneManifestParamsType||(TextPropertyPaneManifestParamsType={}));export var PropertyPaneNotificationType;!function(T){T.SUCCESS="SUCCESS",T.INFO="INFO",T.INFO_SECONDARY="INFO_SECONDARY",T.WARNING="WARNING",T.ERROR="ERROR"}(PropertyPaneNotificationType||(PropertyPaneNotificationType={}));export var PropertyPaneTooltipInteractiveElementType;!function(T){T.BUTTON="BUTTON",T.LINK="LINK"}(PropertyPaneTooltipInteractiveElementType||(PropertyPaneTooltipInteractiveElementType={}));export var PropertyPaneTooltipButtonType;!function(T){T.PRIMARY="primary",T.SECONDARY="secondary"}(PropertyPaneTooltipButtonType||(PropertyPaneTooltipButtonType={}));export var NotificationPropertyPaneActionType;!function(T){T.BUTTON="BUTTON",T.LINK="LINK"}(NotificationPropertyPaneActionType||(NotificationPropertyPaneActionType={}));export var SizePropertyPaneOption;!function(T){T.FIXED="fixed",T.FILL="fill",T.HUG="hug"}(SizePropertyPaneOption||(SizePropertyPaneOption={}));export var IndentationPropertyPaneManifestType;!function(T){T.PADDING="PADDING",T.MARGIN="MARGIN"}(IndentationPropertyPaneManifestType||(IndentationPropertyPaneManifestType={}));
@@ -140,6 +140,7 @@ export interface ClDocumentRequestActionParamsI {
140
140
  }
141
141
  export interface ClDocumentDispatchEventActionParamsI {
142
142
  eventName: string;
143
+ submitActionParams?: Pick<ClSubmitActionParamsI, 'successViewId' | 'errorViewId'> | null;
143
144
  }
144
145
  export declare enum DefaultSchemaTokens {
145
146
  ACCENT = "accent"
@@ -1,11 +1,12 @@
1
- import { ClBaseComponentI, ClDocumentSharedI, ClSubmitActionParamsI } from './Document.interface';
1
+ import { ClBaseComponentI, ClDocumentActionI, ClDocumentDispatchEventActionParamsI, ClDocumentSharedI, ClSubmitActionParamsI } from './Document.interface';
2
2
  export declare enum ViewNavEdgeKind {
3
3
  GO_TO_VIEW = "GO_TO_VIEW",
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
7
  NPS_CONDITIONAL = "NPS_CONDITIONAL",
8
- PRIZE_CONDITIONAL = "PRIZE_CONDITIONAL"
8
+ PRIZE_CONDITIONAL = "PRIZE_CONDITIONAL",
9
+ ACTION_CONDITIONAL = "ACTION_CONDITIONAL"
9
10
  }
10
11
  export declare enum ViewTerminalKind {
11
12
  TRUE_TERMINAL = "TRUE_TERMINAL",
@@ -36,6 +37,7 @@ export declare const SUCCESS_LEGACY_LABELS: string[];
36
37
  export declare const ERROR_LEGACY_LABELS: string[];
37
38
  export declare const ALREADY_SUBSCRIBED_LEGACY_LABELS: string[];
38
39
  export declare const SYSTEM_RESULT_STATE_LABELS: string[];
40
+ export declare function getActionSubmitActionParams(action: ClDocumentActionI | null | undefined): ClDocumentDispatchEventActionParamsI['submitActionParams'];
39
41
  export declare function viewHasControls(viewModel: ClBaseComponentI | undefined | null): boolean;
40
42
  export declare function isResultView(viewModel: ClBaseComponentI | undefined | null, resultViewIds: string[]): boolean;
41
43
  export declare function getConfiguredResultViewIds(submitActionParams: ClSubmitActionParamsI | undefined | null, hasFormControls: boolean): string[];
@@ -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",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)}
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",e.ACTION_CONDITIONAL="ACTION_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];export function getActionSubmitActionParams(e){var i;if(!e||e.type!==ClDocumentActionType.DISPATCH_EVENT)return null;const n=null===(i=e.params)||void 0===i?void 0:i.submitActionParams;return n&&"object"==typeof n?n:null}function componentModelHasSubmitAction(e){var i,n;try{return!!(null===(n=null===(i=e.props)||void 0===i?void 0:i.handlers)||void 0===n?void 0:n.find(e=>{var i;return null===(i=null==e?void 0:e.actions)||void 0===i?void 0:i.find(e=>SUBMIT_ACTION_TYPES.includes(e.type))}))}catch(e){return!1}}export function viewHasControls(e){if(!e)return!1;let i=0;return iterateDepthFirst(e,e=>{(["INPUT","MULTIPLE_INPUT",GAMING_COMPONENT_TYPE].includes(e.type)||componentModelHasSubmitAction(e))&&i++}),i>0}export function isResultView(e,i){return!!e&&(SYSTEM_RESULT_STATE_LABELS.includes(e.label)||i.includes(e.id))}export function getConfiguredResultViewIds(e,i){return i?!e||e.runAction?[]:[e.successViewId,e.errorViewId,e.alreadySubscribedViewId].filter(Boolean):[]}function resolveResultViewIndex(e,i,n,t){const o=null==i?void 0:i[n];if(o){const i=e.findIndex(e=>e.id===o);if(-1!==i)return i}return e.findIndex(e=>t.includes(e.label))}export function submitAdvancesToNextStep(e,i,n,t){const o=i[n+1];if(!o||isResultView(o,t))return!1;return!e.edges.some(e=>e.toIndex===n+1&&e.fromIndex!==n&&e.isForward&&e.kind!==ViewNavEdgeKind.SUBMIT)}export function buildViewNavigationGraph(e,i,n){var t;const o=new Map;e.forEach((e,i)=>o.set(e.id,i));const d=null!==(t=null==i?void 0:i.submitActionParams)&&void 0!==t?t:void 0,r=e.some(e=>viewHasControls(e)),E=getConfiguredResultViewIds(d,r),s=r?d:void 0,l=[],I=[],a=(e,i,n)=>{switch(n){case ViewNavEdgeKind.GO_TO_NEXT_VIEW:case ViewNavEdgeKind.SUBMIT:case ViewNavEdgeKind.NPS_CONDITIONAL:case ViewNavEdgeKind.PRIZE_CONDITIONAL:case ViewNavEdgeKind.ACTION_CONDITIONAL:return!0;case ViewNavEdgeKind.GO_TO_PREVIOUS_VIEW:return!1;default:return i>e}},u=(i,n,t,o)=>{void 0===n||n<0||n>=e.length||l.push({fromIndex:i,toIndex:n,kind:t,isForward:a(i,n,t),label:o})},c=(i,n)=>{var t,d;switch(n.type){case ClDocumentActionType.GO_TO_VIEW:return(null===(t=n.params)||void 0===t?void 0:t.viewId)?o.get(n.params.viewId):"number"==typeof(null===(d=n.params)||void 0===d?void 0:d.viewIndex)?n.params.viewIndex:void 0;case ClDocumentActionType.GO_TO_NEXT_VIEW:return i+1<e.length?i+1:void 0;case ClDocumentActionType.GO_TO_PREVIOUS_VIEW:return i-1>=0?i-1:void 0;default:return}},_=e.map(()=>new Set),T=(e,i,n,t)=>{if(void 0===i||-1===i||i===e)return;const o=`${i}:${n}`;_[e].has(o)||(_[e].add(o),u(e,i,n,t))},N=[];e.forEach((e,i)=>{const n=new Set;let t,d=!1;iterateDepthFirst(e,e=>{var r,E,s,l,I,a,_;const N=null===(r=e.props)||void 0===r?void 0:r.content,S=[];for(const i of null!==(s=null===(E=e.props)||void 0===E?void 0:E.handlers)&&void 0!==s?s:[])for(const e of null!==(l=i.actions)&&void 0!==l?l:[])S.push({action:e,label:null!==(I=null==N?void 0:N.text)&&void 0!==I?I:""});if(Array.isArray(null==N?void 0:N.options))for(const e of N.options)(null==e?void 0:e.action)&&S.push({action:e.action,label:null!==(_=null!==(a=null==e?void 0:e.label)&&void 0!==a?a:null==e?void 0:e.value)&&void 0!==_?_:""});e.type===GAMING_COMPONENT_TYPE&&(t=null!=t?t:"");for(const{action:e,label:n}of S){const r=getActionSubmitActionParams(e);r?(d=!0,[r.successViewId,r.errorViewId].filter(Boolean).forEach(e=>{T(i,o.get(e),ViewNavEdgeKind.ACTION_CONDITIONAL,n)})):SUBMIT_ACTION_TYPES.includes(e.type)?t=null!=t?t:n:e.type!==ClDocumentActionType.GO_TO_VIEW&&e.type!==ClDocumentActionType.GO_TO_NEXT_VIEW&&e.type!==ClDocumentActionType.GO_TO_PREVIOUS_VIEW||u(i,c(i,e),e.type,n)}NPS_BAND_KEYS.map(e=>(N||{})[e]||null).filter(e=>e).forEach(e=>n.add(e))}),n.forEach(e=>{T(i,o.get(e),ViewNavEdgeKind.NPS_CONDITIONAL,"")}),N[i]=t,I[i]=void 0!==t||d}),(null!=n?n:[]).forEach(({fromViewId:e,toViewId:i})=>{const n=o.get(e);void 0!==n&&T(n,o.get(i),ViewNavEdgeKind.PRIZE_CONDITIONAL,"")}),e.forEach((i,n)=>{const t=N[n];if(void 0===t)return;const o=e[n+1],d=submitAdvancesToNextStep({edges:l},e,n,E),I=t,a=()=>{T(n,resolveResultViewIndex(e,s,"errorViewId",ERROR_LEGACY_LABELS),ViewNavEdgeKind.SUBMIT,I),s&&!s.alreadySubscribedViewId?T(n,resolveResultViewIndex(e,s,"successViewId",SUCCESS_LEGACY_LABELS),ViewNavEdgeKind.SUBMIT,I):T(n,resolveResultViewIndex(e,s,"alreadySubscribedViewId",ALREADY_SUBSCRIBED_LEGACY_LABELS),ViewNavEdgeKind.SUBMIT,I)};if(d)return T(n,n+1,ViewNavEdgeKind.SUBMIT,I),void(!viewHasControls(o)&&r&&a());const u=null==s?void 0:s.runAction;u?T(n,c(n,u),u.type,I):(T(n,resolveResultViewIndex(e,s,"successViewId",SUCCESS_LEGACY_LABELS),ViewNavEdgeKind.SUBMIT,I),a())});const S=e.map((e,i)=>{var n,t;return{index:i,id:e.id,label:null!==(n=e.label)&&void 0!==n?n:e.id,hasSubmitAction:null!==(t=I[i])&&void 0!==t&&t}});return{nodes:S,edges:l}}export function classifyView(e,i){return e.edges.some(e=>e.fromIndex===i)?ViewTerminalKind.INTERMEDIATE:ViewTerminalKind.TRUE_TERMINAL}export function classifyViews(e){return e.nodes.map(i=>classifyView(e,i.index))}export function isAutoCommitTerminal(e,i){const n=e.nodes[i];return!!n&&(classifyView(e,i)===ViewTerminalKind.TRUE_TERMINAL&&!n.hasSubmitAction)}export function isMultiViewFlow(e){if(e.nodes.length<2)return!1;const i=new Set([0]),n=[0];for(;n.length;){const t=n.shift();for(const o of e.edges)o.fromIndex!==t||i.has(o.toIndex)||(i.add(o.toIndex),n.push(o.toIndex))}return i.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.ACTION_CONDITIONAL||e.kind===ViewNavEdgeKind.SUBMIT&&e.toIndex<e.fromIndex)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claspo/common",
3
- "version": "7.5.12",
3
+ "version": "7.5.13-usbscr",
4
4
  "sideEffects": false,
5
5
  "description": "",
6
6
  "main": "index.js",