@plaidev/karte-action-sdk 1.1.101-27899192.5a50ebd2 → 1.1.101-27899225.9f75dc0a

Sign up to get free protection for your applications and to get access to all the features.
@@ -260,15 +260,33 @@ type SystemConfig = {
260
260
  shortenId?: string;
261
261
  };
262
262
  type ActionEventHandler = (...args: any[]) => any | Promise<any>;
263
- type OPTIONS = {
263
+ type ActionSetting = {
264
264
  send?: (event_name: string, values?: any) => void;
265
- isPreview?: boolean;
266
265
  initialState?: string;
266
+ autoStart?: boolean;
267
267
  };
268
268
  type CustomVariables = {
269
269
  [key: string]: any;
270
270
  };
271
- declare const functionOptions: Store<OPTIONS>;
271
+ /**
272
+ * Store to handle action setting
273
+ */
274
+ declare const actionSetting: Store<ActionSetting>;
275
+ /**
276
+ * {@link getActionSetting} function to get action setting.
277
+ * @return {ActionSetting} Current action setting
278
+ */
279
+ declare function getActionSetting(): ActionSetting;
280
+ /**
281
+ * {@link setActionSetting} function to "update" action setting
282
+ * @param {ActonSetting} Updated action setting
283
+ * @return {ActionSetting} New action setting
284
+ */
285
+ declare function setActionSetting(setting: ActionSetting): ActionSetting;
286
+ /**
287
+ * {@link resetActionSetting} function to reset action setting
288
+ */
289
+ declare function resetActionSetting(): void;
272
290
  /**
273
291
  * Store to read KARTE system config
274
292
  */
@@ -469,14 +487,8 @@ declare const ACTION_SHOW_EVENT: string;
469
487
  declare const ACTION_CLOSE_EVENT: string;
470
488
  declare const ACTION_DESTROY_EVENT: string;
471
489
  declare const ACTION_CHANGE_STATE_EVENT: string;
472
- /**
473
- * {@link setAutoStart} function to set auto start flag.
474
- *
475
- * @param {boolean} on
476
- */
477
- declare const setAutoStart: (on?: boolean) => void;
478
490
  declare const handleState: (event: any) => void;
479
- declare const initialize: (options?: OPTIONS) => () => void;
491
+ declare const initialize: (setting?: ActionSetting) => () => void;
480
492
  declare const finalize: () => void;
481
493
  declare const send_event: (event_name: string, values?: any) => void;
482
494
  // eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -558,6 +570,15 @@ declare function loadGlobalStyle(href: string): Promise<any>;
558
570
  * @see https://stackoverflow.com/a/22429679
559
571
  */
560
572
  declare function hashCode(s: string): string;
573
+ /**
574
+ * {@link setAutoStart} function to set auto start flag.
575
+ *
576
+ * NOTE: Use setActionConfig({ autoStart: false }).
577
+ *
578
+ * @deprecated
579
+ * @param {boolean} on
580
+ */
581
+ declare const setAutoStart: (on?: boolean) => void;
561
582
  declare const NOOP: Function;
562
583
  declare const isPreview: () => boolean;
563
584
  declare const handleFocus: (node: HTMLElement | null) => (e: any) => void;
@@ -1171,15 +1192,33 @@ declare namespace widget {
1171
1192
  shortenId?: string;
1172
1193
  };
1173
1194
  type ActionEventHandler = (...args: any[]) => any | Promise<any>;
1174
- type OPTIONS = {
1195
+ type ActionSetting = {
1175
1196
  send?: (event_name: string, values?: any) => void;
1176
- isPreview?: boolean;
1177
1197
  initialState?: string;
1198
+ autoStart?: boolean;
1178
1199
  };
1179
1200
  type CustomVariables = {
1180
1201
  [key: string]: any;
1181
1202
  };
1182
- const functionOptions: Store<OPTIONS>;
1203
+ /**
1204
+ * Store to handle action setting
1205
+ */
1206
+ const actionSetting: Store<ActionSetting>;
1207
+ /**
1208
+ * {@link getActionSetting} function to get action setting.
1209
+ * @return {ActionSetting} Current action setting
1210
+ */
1211
+ function getActionSetting(): ActionSetting;
1212
+ /**
1213
+ * {@link setActionSetting} function to "update" action setting
1214
+ * @param {ActonSetting} Updated action setting
1215
+ * @return {ActionSetting} New action setting
1216
+ */
1217
+ function setActionSetting(setting: ActionSetting): ActionSetting;
1218
+ /**
1219
+ * {@link resetActionSetting} function to reset action setting
1220
+ */
1221
+ function resetActionSetting(): void;
1183
1222
  /**
1184
1223
  * Store to read KARTE system config
1185
1224
  */
@@ -1380,14 +1419,8 @@ declare namespace widget {
1380
1419
  const ACTION_CLOSE_EVENT: string;
1381
1420
  const ACTION_DESTROY_EVENT: string;
1382
1421
  const ACTION_CHANGE_STATE_EVENT: string;
1383
- /**
1384
- * {@link setAutoStart} function to set auto start flag.
1385
- *
1386
- * @param {boolean} on
1387
- */
1388
- const setAutoStart: (on?: boolean) => void;
1389
1422
  const handleState: (event: any) => void;
1390
- const initialize: (options?: OPTIONS) => () => void;
1423
+ const initialize: (setting?: ActionSetting) => () => void;
1391
1424
  const finalize: () => void;
1392
1425
  const send_event: (event_name: string, values?: any) => void;
1393
1426
  // eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -1469,6 +1502,15 @@ declare namespace widget {
1469
1502
  * @see https://stackoverflow.com/a/22429679
1470
1503
  */
1471
1504
  function hashCode(s: string): string;
1505
+ /**
1506
+ * {@link setAutoStart} function to set auto start flag.
1507
+ *
1508
+ * NOTE: Use setActionConfig({ autoStart: false }).
1509
+ *
1510
+ * @deprecated
1511
+ * @param {boolean} on
1512
+ */
1513
+ const setAutoStart: (on?: boolean) => void;
1472
1514
  // types of props to reference for internaly
1473
1515
  interface _Props {
1474
1516
  show_and_condition?: boolean;
@@ -1805,7 +1847,7 @@ declare namespace widget {
1805
1847
  */
1806
1848
  export { showAction as show, closeAction as hide };
1807
1849
  }
1808
- export { CloseTrigger, ALL_ACTION_ID, ALL_ACTION_SHORTEN_ID, actionId, ACTION_SHOW_EVENT, ACTION_CLOSE_EVENT, ACTION_DESTROY_EVENT, ACTION_CHANGE_STATE_EVENT, setAutoStart, handleState, initialize, finalize, send_event, none, moveTo, linkTo, closeApp, runScript, execOnClickOperation, haveFunction, customAnimation, loadGlobalScript, applyGlobalCss, loadGlobalStyle, hashCode, Store, getStoreState, SystemConfig, ActionEventHandler, OPTIONS, CustomVariables, functionOptions, system, getSystem, setSystem, state, setState, getState, states, addState, getStates, opened, isOpened, setOpened, closed, isClosed, setClosed, maximumZindex, setMaximumZindex, internalHandlers, getInternalHandlers, setInternalHandlers, updateInternalHandlers, customHandlers, getCustomHandlers, setCustomHandlers, updateCustomHandlers, destroyed, isDestroyed, setDestroyed, stopped, isStopped, setStopped, customVariables, getCustomVariables, setCustomVariables, updateCustomVariables, NOOP, isPreview, handleFocus, setPreviousFocus, handleKeydown, getPositionStyle, getTransform, getMarginStyle, ScrollDirection, OnScrollContext, OnScrollFunction, onScroll, onTime, hasSuffix, toBr, randStr, PropTypes, PropType, Code, MediaQueries, MediaQuery, Directions, Direction, AnimationStyles, AnimationStyle, ModalPositions, ModalPosition, ModalMargin, ModalPlacement, DefaultModalPlacement, OperationArgumentType, Operation, OnClickOperationOptions, OnClickOperation, LongText, Url, Image, LengthUnits, LengthUnit, Length, Color, Justifies, Justify, Alignments, Alignment, ObjectFits, ObjectFit, ClipPath, Repeats, Repeat, BackgroundSizes, BackgroundSize, Cursors, Cursor, Overflows, Overflow, Border, BorderStyle, BorderWidth, Style, StateName, ListSeparatorNone, ListSeparatorBorder, ListSeparatorGap, ListSeparator, DefaultListSeparatorNone, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparator, ListBackgroundNone, ListBackgroundStripe, ListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListBackground, ListDirection, ListContext, hideOnScroll, hideOnTime, showOnScroll, showOnTime, ActionProps, ActionOptions, create, dispatchDestroyEvent, destroy, showAction, closeAction, KARTE_ACTION_ROOT, KARTE_ACTION_RID, KARTE_ACTION_SHORTEN_ID, ensureActionRoot, onCreate, onShow, onClose, onDestroy, onChangeState, h, createFog, EmbedLogic, embed, getActionShadowRoot, applyCss, loadStyle, showModal, ModalOptions, KARTE_MODAL_ROOT, ensureModalRoot, show, close, AppOptions, App, createApp, collection, widget };
1850
+ export { CloseTrigger, ALL_ACTION_ID, ALL_ACTION_SHORTEN_ID, actionId, ACTION_SHOW_EVENT, ACTION_CLOSE_EVENT, ACTION_DESTROY_EVENT, ACTION_CHANGE_STATE_EVENT, handleState, initialize, finalize, send_event, none, moveTo, linkTo, closeApp, runScript, execOnClickOperation, haveFunction, customAnimation, loadGlobalScript, applyGlobalCss, loadGlobalStyle, hashCode, setAutoStart, Store, getStoreState, SystemConfig, ActionEventHandler, ActionSetting, CustomVariables, actionSetting, getActionSetting, setActionSetting, resetActionSetting, system, getSystem, setSystem, state, setState, getState, states, addState, getStates, opened, isOpened, setOpened, closed, isClosed, setClosed, maximumZindex, setMaximumZindex, internalHandlers, getInternalHandlers, setInternalHandlers, updateInternalHandlers, customHandlers, getCustomHandlers, setCustomHandlers, updateCustomHandlers, destroyed, isDestroyed, setDestroyed, stopped, isStopped, setStopped, customVariables, getCustomVariables, setCustomVariables, updateCustomVariables, NOOP, isPreview, handleFocus, setPreviousFocus, handleKeydown, getPositionStyle, getTransform, getMarginStyle, ScrollDirection, OnScrollContext, OnScrollFunction, onScroll, onTime, hasSuffix, toBr, randStr, PropTypes, PropType, Code, MediaQueries, MediaQuery, Directions, Direction, AnimationStyles, AnimationStyle, ModalPositions, ModalPosition, ModalMargin, ModalPlacement, DefaultModalPlacement, OperationArgumentType, Operation, OnClickOperationOptions, OnClickOperation, LongText, Url, Image, LengthUnits, LengthUnit, Length, Color, Justifies, Justify, Alignments, Alignment, ObjectFits, ObjectFit, ClipPath, Repeats, Repeat, BackgroundSizes, BackgroundSize, Cursors, Cursor, Overflows, Overflow, Border, BorderStyle, BorderWidth, Style, StateName, ListSeparatorNone, ListSeparatorBorder, ListSeparatorGap, ListSeparator, DefaultListSeparatorNone, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparator, ListBackgroundNone, ListBackgroundStripe, ListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListBackground, ListDirection, ListContext, hideOnScroll, hideOnTime, showOnScroll, showOnTime, ActionProps, ActionOptions, create, dispatchDestroyEvent, destroy, showAction, closeAction, KARTE_ACTION_ROOT, KARTE_ACTION_RID, KARTE_ACTION_SHORTEN_ID, ensureActionRoot, onCreate, onShow, onClose, onDestroy, onChangeState, h, createFog, EmbedLogic, embed, getActionShadowRoot, applyCss, loadStyle, showModal, ModalOptions, KARTE_MODAL_ROOT, ensureModalRoot, show, close, AppOptions, App, createApp, collection, widget };
1809
1851
  export { default as State } from './components/State.svelte';
1810
1852
  export { default as StateItem } from './components/StateItem.svelte';
1811
1853
  export { default as Modal } from './components/Modal.svelte';
@@ -194,7 +194,34 @@ function randStr(digit = 8) {
194
194
  * @deprecated
195
195
  */
196
196
  const getStoreState = get;
197
- const functionOptions = writable({});
197
+ /**
198
+ * Store to handle action setting
199
+ */
200
+ const actionSetting = writable({ autoStart: true });
201
+ /**
202
+ * {@link getActionSetting} function to get action setting.
203
+ * @return {ActionSetting} Current action setting
204
+ */
205
+ function getActionSetting() {
206
+ return get(actionSetting);
207
+ }
208
+ /**
209
+ * {@link setActionSetting} function to "update" action setting
210
+ * @param {ActonSetting} Updated action setting
211
+ * @return {ActionSetting} New action setting
212
+ */
213
+ function setActionSetting(setting) {
214
+ actionSetting.update(current => {
215
+ return { ...current, ...setting };
216
+ });
217
+ return getActionSetting();
218
+ }
219
+ /**
220
+ * {@link resetActionSetting} function to reset action setting
221
+ */
222
+ function resetActionSetting() {
223
+ actionSetting.set({ autoStart: true });
224
+ }
198
225
  /**
199
226
  * Store to read KARTE system config
200
227
  */
@@ -437,35 +464,27 @@ const ACTION_SHOW_EVENT = `KARTE-ACTION-SHOW-${actionId}`;
437
464
  const ACTION_CLOSE_EVENT = `KARTE-ACTION-CLOSE-${actionId}`;
438
465
  const ACTION_DESTROY_EVENT = `KARTE-ACTION-DESTROY-${actionId}`;
439
466
  const ACTION_CHANGE_STATE_EVENT = `KARTE-ACTION-CHANGE-STATE-${actionId}`;
440
- /**
441
- * {@link setAutoStart} function to set auto start flag.
442
- *
443
- * @param {boolean} on
444
- */
445
- const setAutoStart = (on = true) => {
446
- setStopped(!on);
447
- };
448
467
  const handleState = (event) => {
449
468
  if (event.detail.actionId === actionId || event.detail.actionId === ALL_ACTION_ID) {
450
469
  setState$1(event.detail.to, event.detail.force);
451
470
  }
452
471
  };
453
- const initialize = (options) => {
454
- if (options?.initialState) {
472
+ const initialize = (setting) => {
473
+ if (setting?.initialState) {
455
474
  const force = true;
456
- setState$1(options?.initialState, force);
475
+ setState$1(setting?.initialState, force);
457
476
  }
458
477
  setOpened(true);
459
478
  setClosed(false); // deprecated
460
- functionOptions.set(options ?? {});
479
+ setActionSetting(setting);
461
480
  return () => finalize();
462
481
  };
463
482
  const finalize = () => {
464
- functionOptions.set({});
483
+ resetActionSetting();
465
484
  };
466
485
  const send_event = (event_name, values) => {
467
- const options = get(functionOptions);
468
- options?.send?.(event_name, values);
486
+ const setting = getActionSetting();
487
+ setting?.send?.(event_name, values);
469
488
  };
470
489
  // eslint-disable-next-line @typescript-eslint/no-empty-function
471
490
  const none = () => () => { };
@@ -584,6 +603,17 @@ function hashCode(s) {
584
603
  });
585
604
  return ('0000000' + (hash >>> 0).toString(16)).substr(-8);
586
605
  }
606
+ /**
607
+ * {@link setAutoStart} function to set auto start flag.
608
+ *
609
+ * NOTE: Use setActionConfig({ autoStart: false }).
610
+ *
611
+ * @deprecated
612
+ * @param {boolean} on
613
+ */
614
+ const setAutoStart = (on = true) => {
615
+ setStopped(!on);
616
+ };
587
617
 
588
618
  const PropTypes = [
589
619
  'BooleanKeyword',
@@ -4637,4 +4667,4 @@ class ImageBlock extends SvelteComponent {
4637
4667
  }
4638
4668
  }
4639
4669
 
4640
- export { ACTION_CHANGE_STATE_EVENT, ACTION_CLOSE_EVENT, ACTION_DESTROY_EVENT, ACTION_SHOW_EVENT, ALL_ACTION_ID, ALL_ACTION_SHORTEN_ID, Alignments, AnimationStyles, BackgroundSizes, Cursors, DefaultListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListSeparator, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparatorNone, DefaultModalPlacement, Directions, EmbedElement, Flex, FlexItem, Grid, GridItem, GridModalState, ImageBlock, ImageElement, Justifies, KARTE_ACTION_RID, KARTE_ACTION_ROOT, KARTE_ACTION_SHORTEN_ID, KARTE_MODAL_ROOT, LengthUnits, List, ListItem, MediaQueries, Modal, ModalPositions, NOOP, ObjectFits, OnClickOperationOptions, Overflows, PropTypes, Repeats, State, StateItem, TextBlock, TextButtonBlock, TextButtonElement, TextElement, actionId, addState, applyCss, applyGlobalCss, close, closeAction, closeApp, closed, collection$1 as collection, create, createApp, createFog, customAnimation, customHandlers, customVariables, destroy, destroyed, dispatchDestroyEvent, embed, ensureActionRoot, ensureModalRoot, execOnClickOperation, finalize, functionOptions, getActionShadowRoot, getCustomHandlers, getCustomVariables, getInternalHandlers, getMarginStyle, getPositionStyle, getState$1 as getState, getStates, getStoreState, getSystem, getTransform, h, handleFocus, handleKeydown, handleState, hasSuffix, hashCode, haveFunction, hideOnScroll, hideOnTime, initialize, internalHandlers, isClosed, isDestroyed, isOpened, isPreview, isStopped, linkTo, loadGlobalScript, loadGlobalStyle, loadStyle, maximumZindex, moveTo, none, onChangeState, onClose, onCreate, onDestroy, onScroll, onShow, onTime, opened, randStr, runScript, send_event, setAutoStart, setClosed, setCustomHandlers, setCustomVariables, setDestroyed, setInternalHandlers, setMaximumZindex, setOpened, setPreviousFocus, setState$1 as setState, setStopped, setSystem, show, showAction, showModal, showOnScroll, showOnTime, state, states, stopped, system, toBr, updateCustomHandlers, updateCustomVariables, updateInternalHandlers, widget };
4670
+ export { ACTION_CHANGE_STATE_EVENT, ACTION_CLOSE_EVENT, ACTION_DESTROY_EVENT, ACTION_SHOW_EVENT, ALL_ACTION_ID, ALL_ACTION_SHORTEN_ID, Alignments, AnimationStyles, BackgroundSizes, Cursors, DefaultListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListSeparator, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparatorNone, DefaultModalPlacement, Directions, EmbedElement, Flex, FlexItem, Grid, GridItem, GridModalState, ImageBlock, ImageElement, Justifies, KARTE_ACTION_RID, KARTE_ACTION_ROOT, KARTE_ACTION_SHORTEN_ID, KARTE_MODAL_ROOT, LengthUnits, List, ListItem, MediaQueries, Modal, ModalPositions, NOOP, ObjectFits, OnClickOperationOptions, Overflows, PropTypes, Repeats, State, StateItem, TextBlock, TextButtonBlock, TextButtonElement, TextElement, actionId, actionSetting, addState, applyCss, applyGlobalCss, close, closeAction, closeApp, closed, collection$1 as collection, create, createApp, createFog, customAnimation, customHandlers, customVariables, destroy, destroyed, dispatchDestroyEvent, embed, ensureActionRoot, ensureModalRoot, execOnClickOperation, finalize, getActionSetting, getActionShadowRoot, getCustomHandlers, getCustomVariables, getInternalHandlers, getMarginStyle, getPositionStyle, getState$1 as getState, getStates, getStoreState, getSystem, getTransform, h, handleFocus, handleKeydown, handleState, hasSuffix, hashCode, haveFunction, hideOnScroll, hideOnTime, initialize, internalHandlers, isClosed, isDestroyed, isOpened, isPreview, isStopped, linkTo, loadGlobalScript, loadGlobalStyle, loadStyle, maximumZindex, moveTo, none, onChangeState, onClose, onCreate, onDestroy, onScroll, onShow, onTime, opened, randStr, resetActionSetting, runScript, send_event, setActionSetting, setAutoStart, setClosed, setCustomHandlers, setCustomVariables, setDestroyed, setInternalHandlers, setMaximumZindex, setOpened, setPreviousFocus, setState$1 as setState, setStopped, setSystem, show, showAction, showModal, showOnScroll, showOnTime, state, states, stopped, system, toBr, updateCustomHandlers, updateCustomVariables, updateInternalHandlers, widget };
@@ -260,15 +260,33 @@ type SystemConfig = {
260
260
  shortenId?: string;
261
261
  };
262
262
  type ActionEventHandler = (...args: any[]) => any | Promise<any>;
263
- type OPTIONS = {
263
+ type ActionSetting = {
264
264
  send?: (event_name: string, values?: any) => void;
265
- isPreview?: boolean;
266
265
  initialState?: string;
266
+ autoStart?: boolean;
267
267
  };
268
268
  type CustomVariables = {
269
269
  [key: string]: any;
270
270
  };
271
- declare const functionOptions: Store<OPTIONS>;
271
+ /**
272
+ * Store to handle action setting
273
+ */
274
+ declare const actionSetting: Store<ActionSetting>;
275
+ /**
276
+ * {@link getActionSetting} function to get action setting.
277
+ * @return {ActionSetting} Current action setting
278
+ */
279
+ declare function getActionSetting(): ActionSetting;
280
+ /**
281
+ * {@link setActionSetting} function to "update" action setting
282
+ * @param {ActonSetting} Updated action setting
283
+ * @return {ActionSetting} New action setting
284
+ */
285
+ declare function setActionSetting(setting: ActionSetting): ActionSetting;
286
+ /**
287
+ * {@link resetActionSetting} function to reset action setting
288
+ */
289
+ declare function resetActionSetting(): void;
272
290
  /**
273
291
  * Store to read KARTE system config
274
292
  */
@@ -469,14 +487,8 @@ declare const ACTION_SHOW_EVENT: string;
469
487
  declare const ACTION_CLOSE_EVENT: string;
470
488
  declare const ACTION_DESTROY_EVENT: string;
471
489
  declare const ACTION_CHANGE_STATE_EVENT: string;
472
- /**
473
- * {@link setAutoStart} function to set auto start flag.
474
- *
475
- * @param {boolean} on
476
- */
477
- declare const setAutoStart: (on?: boolean) => void;
478
490
  declare const handleState: (event: any) => void;
479
- declare const initialize: (options?: OPTIONS) => () => void;
491
+ declare const initialize: (setting?: ActionSetting) => () => void;
480
492
  declare const finalize: () => void;
481
493
  declare const send_event: (event_name: string, values?: any) => void;
482
494
  // eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -558,6 +570,15 @@ declare function loadGlobalStyle(href: string): Promise<any>;
558
570
  * @see https://stackoverflow.com/a/22429679
559
571
  */
560
572
  declare function hashCode(s: string): string;
573
+ /**
574
+ * {@link setAutoStart} function to set auto start flag.
575
+ *
576
+ * NOTE: Use setActionConfig({ autoStart: false }).
577
+ *
578
+ * @deprecated
579
+ * @param {boolean} on
580
+ */
581
+ declare const setAutoStart: (on?: boolean) => void;
561
582
  declare const NOOP: Function;
562
583
  declare const isPreview: () => boolean;
563
584
  declare const handleFocus: (node: HTMLElement | null) => (e: any) => void;
@@ -1171,15 +1192,33 @@ declare namespace widget {
1171
1192
  shortenId?: string;
1172
1193
  };
1173
1194
  type ActionEventHandler = (...args: any[]) => any | Promise<any>;
1174
- type OPTIONS = {
1195
+ type ActionSetting = {
1175
1196
  send?: (event_name: string, values?: any) => void;
1176
- isPreview?: boolean;
1177
1197
  initialState?: string;
1198
+ autoStart?: boolean;
1178
1199
  };
1179
1200
  type CustomVariables = {
1180
1201
  [key: string]: any;
1181
1202
  };
1182
- const functionOptions: Store<OPTIONS>;
1203
+ /**
1204
+ * Store to handle action setting
1205
+ */
1206
+ const actionSetting: Store<ActionSetting>;
1207
+ /**
1208
+ * {@link getActionSetting} function to get action setting.
1209
+ * @return {ActionSetting} Current action setting
1210
+ */
1211
+ function getActionSetting(): ActionSetting;
1212
+ /**
1213
+ * {@link setActionSetting} function to "update" action setting
1214
+ * @param {ActonSetting} Updated action setting
1215
+ * @return {ActionSetting} New action setting
1216
+ */
1217
+ function setActionSetting(setting: ActionSetting): ActionSetting;
1218
+ /**
1219
+ * {@link resetActionSetting} function to reset action setting
1220
+ */
1221
+ function resetActionSetting(): void;
1183
1222
  /**
1184
1223
  * Store to read KARTE system config
1185
1224
  */
@@ -1380,14 +1419,8 @@ declare namespace widget {
1380
1419
  const ACTION_CLOSE_EVENT: string;
1381
1420
  const ACTION_DESTROY_EVENT: string;
1382
1421
  const ACTION_CHANGE_STATE_EVENT: string;
1383
- /**
1384
- * {@link setAutoStart} function to set auto start flag.
1385
- *
1386
- * @param {boolean} on
1387
- */
1388
- const setAutoStart: (on?: boolean) => void;
1389
1422
  const handleState: (event: any) => void;
1390
- const initialize: (options?: OPTIONS) => () => void;
1423
+ const initialize: (setting?: ActionSetting) => () => void;
1391
1424
  const finalize: () => void;
1392
1425
  const send_event: (event_name: string, values?: any) => void;
1393
1426
  // eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -1469,6 +1502,15 @@ declare namespace widget {
1469
1502
  * @see https://stackoverflow.com/a/22429679
1470
1503
  */
1471
1504
  function hashCode(s: string): string;
1505
+ /**
1506
+ * {@link setAutoStart} function to set auto start flag.
1507
+ *
1508
+ * NOTE: Use setActionConfig({ autoStart: false }).
1509
+ *
1510
+ * @deprecated
1511
+ * @param {boolean} on
1512
+ */
1513
+ const setAutoStart: (on?: boolean) => void;
1472
1514
  // types of props to reference for internaly
1473
1515
  interface _Props {
1474
1516
  show_and_condition?: boolean;
@@ -1805,7 +1847,7 @@ declare namespace widget {
1805
1847
  */
1806
1848
  export { showAction as show, closeAction as hide };
1807
1849
  }
1808
- export { CloseTrigger, ALL_ACTION_ID, ALL_ACTION_SHORTEN_ID, actionId, ACTION_SHOW_EVENT, ACTION_CLOSE_EVENT, ACTION_DESTROY_EVENT, ACTION_CHANGE_STATE_EVENT, setAutoStart, handleState, initialize, finalize, send_event, none, moveTo, linkTo, closeApp, runScript, execOnClickOperation, haveFunction, customAnimation, loadGlobalScript, applyGlobalCss, loadGlobalStyle, hashCode, Store, getStoreState, SystemConfig, ActionEventHandler, OPTIONS, CustomVariables, functionOptions, system, getSystem, setSystem, state, setState, getState, states, addState, getStates, opened, isOpened, setOpened, closed, isClosed, setClosed, maximumZindex, setMaximumZindex, internalHandlers, getInternalHandlers, setInternalHandlers, updateInternalHandlers, customHandlers, getCustomHandlers, setCustomHandlers, updateCustomHandlers, destroyed, isDestroyed, setDestroyed, stopped, isStopped, setStopped, customVariables, getCustomVariables, setCustomVariables, updateCustomVariables, NOOP, isPreview, handleFocus, setPreviousFocus, handleKeydown, getPositionStyle, getTransform, getMarginStyle, ScrollDirection, OnScrollContext, OnScrollFunction, onScroll, onTime, hasSuffix, toBr, randStr, PropTypes, PropType, Code, MediaQueries, MediaQuery, Directions, Direction, AnimationStyles, AnimationStyle, ModalPositions, ModalPosition, ModalMargin, ModalPlacement, DefaultModalPlacement, OperationArgumentType, Operation, OnClickOperationOptions, OnClickOperation, LongText, Url, Image, LengthUnits, LengthUnit, Length, Color, Justifies, Justify, Alignments, Alignment, ObjectFits, ObjectFit, ClipPath, Repeats, Repeat, BackgroundSizes, BackgroundSize, Cursors, Cursor, Overflows, Overflow, Border, BorderStyle, BorderWidth, Style, StateName, ListSeparatorNone, ListSeparatorBorder, ListSeparatorGap, ListSeparator, DefaultListSeparatorNone, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparator, ListBackgroundNone, ListBackgroundStripe, ListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListBackground, ListDirection, ListContext, hideOnScroll, hideOnTime, showOnScroll, showOnTime, ActionProps, ActionOptions, create, dispatchDestroyEvent, destroy, showAction, closeAction, KARTE_ACTION_ROOT, KARTE_ACTION_RID, KARTE_ACTION_SHORTEN_ID, ensureActionRoot, onCreate, onShow, onClose, onDestroy, onChangeState, h, createFog, EmbedLogic, embed, getActionShadowRoot, applyCss, loadStyle, showModal, ModalOptions, KARTE_MODAL_ROOT, ensureModalRoot, show, close, AppOptions, App, createApp, collection, widget };
1850
+ export { CloseTrigger, ALL_ACTION_ID, ALL_ACTION_SHORTEN_ID, actionId, ACTION_SHOW_EVENT, ACTION_CLOSE_EVENT, ACTION_DESTROY_EVENT, ACTION_CHANGE_STATE_EVENT, handleState, initialize, finalize, send_event, none, moveTo, linkTo, closeApp, runScript, execOnClickOperation, haveFunction, customAnimation, loadGlobalScript, applyGlobalCss, loadGlobalStyle, hashCode, setAutoStart, Store, getStoreState, SystemConfig, ActionEventHandler, ActionSetting, CustomVariables, actionSetting, getActionSetting, setActionSetting, resetActionSetting, system, getSystem, setSystem, state, setState, getState, states, addState, getStates, opened, isOpened, setOpened, closed, isClosed, setClosed, maximumZindex, setMaximumZindex, internalHandlers, getInternalHandlers, setInternalHandlers, updateInternalHandlers, customHandlers, getCustomHandlers, setCustomHandlers, updateCustomHandlers, destroyed, isDestroyed, setDestroyed, stopped, isStopped, setStopped, customVariables, getCustomVariables, setCustomVariables, updateCustomVariables, NOOP, isPreview, handleFocus, setPreviousFocus, handleKeydown, getPositionStyle, getTransform, getMarginStyle, ScrollDirection, OnScrollContext, OnScrollFunction, onScroll, onTime, hasSuffix, toBr, randStr, PropTypes, PropType, Code, MediaQueries, MediaQuery, Directions, Direction, AnimationStyles, AnimationStyle, ModalPositions, ModalPosition, ModalMargin, ModalPlacement, DefaultModalPlacement, OperationArgumentType, Operation, OnClickOperationOptions, OnClickOperation, LongText, Url, Image, LengthUnits, LengthUnit, Length, Color, Justifies, Justify, Alignments, Alignment, ObjectFits, ObjectFit, ClipPath, Repeats, Repeat, BackgroundSizes, BackgroundSize, Cursors, Cursor, Overflows, Overflow, Border, BorderStyle, BorderWidth, Style, StateName, ListSeparatorNone, ListSeparatorBorder, ListSeparatorGap, ListSeparator, DefaultListSeparatorNone, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparator, ListBackgroundNone, ListBackgroundStripe, ListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListBackground, ListDirection, ListContext, hideOnScroll, hideOnTime, showOnScroll, showOnTime, ActionProps, ActionOptions, create, dispatchDestroyEvent, destroy, showAction, closeAction, KARTE_ACTION_ROOT, KARTE_ACTION_RID, KARTE_ACTION_SHORTEN_ID, ensureActionRoot, onCreate, onShow, onClose, onDestroy, onChangeState, h, createFog, EmbedLogic, embed, getActionShadowRoot, applyCss, loadStyle, showModal, ModalOptions, KARTE_MODAL_ROOT, ensureModalRoot, show, close, AppOptions, App, createApp, collection, widget };
1809
1851
  export { default as State } from './components/State.svelte';
1810
1852
  export { default as StateItem } from './components/StateItem.svelte';
1811
1853
  export { default as Modal } from './components/Modal.svelte';
package/dist/index.es.js CHANGED
@@ -194,7 +194,34 @@ function randStr(digit = 8) {
194
194
  * @deprecated
195
195
  */
196
196
  const getStoreState = get;
197
- const functionOptions = writable({});
197
+ /**
198
+ * Store to handle action setting
199
+ */
200
+ const actionSetting = writable({ autoStart: true });
201
+ /**
202
+ * {@link getActionSetting} function to get action setting.
203
+ * @return {ActionSetting} Current action setting
204
+ */
205
+ function getActionSetting() {
206
+ return get(actionSetting);
207
+ }
208
+ /**
209
+ * {@link setActionSetting} function to "update" action setting
210
+ * @param {ActonSetting} Updated action setting
211
+ * @return {ActionSetting} New action setting
212
+ */
213
+ function setActionSetting(setting) {
214
+ actionSetting.update(current => {
215
+ return { ...current, ...setting };
216
+ });
217
+ return getActionSetting();
218
+ }
219
+ /**
220
+ * {@link resetActionSetting} function to reset action setting
221
+ */
222
+ function resetActionSetting() {
223
+ actionSetting.set({ autoStart: true });
224
+ }
198
225
  /**
199
226
  * Store to read KARTE system config
200
227
  */
@@ -437,35 +464,27 @@ const ACTION_SHOW_EVENT = `KARTE-ACTION-SHOW-${actionId}`;
437
464
  const ACTION_CLOSE_EVENT = `KARTE-ACTION-CLOSE-${actionId}`;
438
465
  const ACTION_DESTROY_EVENT = `KARTE-ACTION-DESTROY-${actionId}`;
439
466
  const ACTION_CHANGE_STATE_EVENT = `KARTE-ACTION-CHANGE-STATE-${actionId}`;
440
- /**
441
- * {@link setAutoStart} function to set auto start flag.
442
- *
443
- * @param {boolean} on
444
- */
445
- const setAutoStart = (on = true) => {
446
- setStopped(!on);
447
- };
448
467
  const handleState = (event) => {
449
468
  if (event.detail.actionId === actionId || event.detail.actionId === ALL_ACTION_ID) {
450
469
  setState$1(event.detail.to, event.detail.force);
451
470
  }
452
471
  };
453
- const initialize = (options) => {
454
- if (options?.initialState) {
472
+ const initialize = (setting) => {
473
+ if (setting?.initialState) {
455
474
  const force = true;
456
- setState$1(options?.initialState, force);
475
+ setState$1(setting?.initialState, force);
457
476
  }
458
477
  setOpened(true);
459
478
  setClosed(false); // deprecated
460
- functionOptions.set(options ?? {});
479
+ setActionSetting(setting);
461
480
  return () => finalize();
462
481
  };
463
482
  const finalize = () => {
464
- functionOptions.set({});
483
+ resetActionSetting();
465
484
  };
466
485
  const send_event = (event_name, values) => {
467
- const options = get(functionOptions);
468
- options?.send?.(event_name, values);
486
+ const setting = getActionSetting();
487
+ setting?.send?.(event_name, values);
469
488
  };
470
489
  // eslint-disable-next-line @typescript-eslint/no-empty-function
471
490
  const none = () => () => { };
@@ -636,6 +655,17 @@ function hashCode(s) {
636
655
  });
637
656
  return ('0000000' + (hash >>> 0).toString(16)).substr(-8);
638
657
  }
658
+ /**
659
+ * {@link setAutoStart} function to set auto start flag.
660
+ *
661
+ * NOTE: Use setActionConfig({ autoStart: false }).
662
+ *
663
+ * @deprecated
664
+ * @param {boolean} on
665
+ */
666
+ const setAutoStart = (on = true) => {
667
+ setStopped(!on);
668
+ };
639
669
 
640
670
  const PropTypes = [
641
671
  'BooleanKeyword',
@@ -4463,4 +4493,4 @@ class ImageBlock extends SvelteComponent {
4463
4493
  }
4464
4494
  }
4465
4495
 
4466
- export { ACTION_CHANGE_STATE_EVENT, ACTION_CLOSE_EVENT, ACTION_DESTROY_EVENT, ACTION_SHOW_EVENT, ALL_ACTION_ID, ALL_ACTION_SHORTEN_ID, Alignments, AnimationStyles, BackgroundSizes, Cursors, DefaultListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListSeparator, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparatorNone, DefaultModalPlacement, Directions, EmbedElement, Flex, FlexItem, Grid, GridItem, GridModalState, ImageBlock, ImageElement, Justifies, KARTE_ACTION_RID, KARTE_ACTION_ROOT, KARTE_ACTION_SHORTEN_ID, KARTE_MODAL_ROOT, LengthUnits, List, ListItem, MediaQueries, Modal, ModalPositions, NOOP, ObjectFits, OnClickOperationOptions, Overflows, PropTypes, Repeats, State, StateItem, TextBlock, TextButtonBlock, TextButtonElement, TextElement, actionId, addState, applyCss, applyGlobalCss, close, closeAction, closeApp, closed, collection$1 as collection, create, createApp, createFog, customAnimation, customHandlers, customVariables, destroy, destroyed, dispatchDestroyEvent, embed, ensureActionRoot, ensureModalRoot, execOnClickOperation, finalize, functionOptions, getActionShadowRoot, getCustomHandlers, getCustomVariables, getInternalHandlers, getMarginStyle, getPositionStyle, getState$1 as getState, getStates, getStoreState, getSystem, getTransform, h, handleFocus, handleKeydown, handleState, hasSuffix, hashCode, haveFunction, hideOnScroll, hideOnTime, initialize, internalHandlers, isClosed, isDestroyed, isOpened, isPreview, isStopped, linkTo, loadGlobalScript, loadGlobalStyle, loadStyle, maximumZindex, moveTo, none, onChangeState, onClose, onCreate, onDestroy, onScroll, onShow, onTime, opened, randStr, runScript, send_event, setAutoStart, setClosed, setCustomHandlers, setCustomVariables, setDestroyed, setInternalHandlers, setMaximumZindex, setOpened, setPreviousFocus, setState$1 as setState, setStopped, setSystem, show, showAction, showModal, showOnScroll, showOnTime, state, states, stopped, system, toBr, updateCustomHandlers, updateCustomVariables, updateInternalHandlers, widget };
4496
+ export { ACTION_CHANGE_STATE_EVENT, ACTION_CLOSE_EVENT, ACTION_DESTROY_EVENT, ACTION_SHOW_EVENT, ALL_ACTION_ID, ALL_ACTION_SHORTEN_ID, Alignments, AnimationStyles, BackgroundSizes, Cursors, DefaultListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListSeparator, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparatorNone, DefaultModalPlacement, Directions, EmbedElement, Flex, FlexItem, Grid, GridItem, GridModalState, ImageBlock, ImageElement, Justifies, KARTE_ACTION_RID, KARTE_ACTION_ROOT, KARTE_ACTION_SHORTEN_ID, KARTE_MODAL_ROOT, LengthUnits, List, ListItem, MediaQueries, Modal, ModalPositions, NOOP, ObjectFits, OnClickOperationOptions, Overflows, PropTypes, Repeats, State, StateItem, TextBlock, TextButtonBlock, TextButtonElement, TextElement, actionId, actionSetting, addState, applyCss, applyGlobalCss, close, closeAction, closeApp, closed, collection$1 as collection, create, createApp, createFog, customAnimation, customHandlers, customVariables, destroy, destroyed, dispatchDestroyEvent, embed, ensureActionRoot, ensureModalRoot, execOnClickOperation, finalize, getActionSetting, getActionShadowRoot, getCustomHandlers, getCustomVariables, getInternalHandlers, getMarginStyle, getPositionStyle, getState$1 as getState, getStates, getStoreState, getSystem, getTransform, h, handleFocus, handleKeydown, handleState, hasSuffix, hashCode, haveFunction, hideOnScroll, hideOnTime, initialize, internalHandlers, isClosed, isDestroyed, isOpened, isPreview, isStopped, linkTo, loadGlobalScript, loadGlobalStyle, loadStyle, maximumZindex, moveTo, none, onChangeState, onClose, onCreate, onDestroy, onScroll, onShow, onTime, opened, randStr, resetActionSetting, runScript, send_event, setActionSetting, setAutoStart, setClosed, setCustomHandlers, setCustomVariables, setDestroyed, setInternalHandlers, setMaximumZindex, setOpened, setPreviousFocus, setState$1 as setState, setStopped, setSystem, show, showAction, showModal, showOnScroll, showOnTime, state, states, stopped, system, toBr, updateCustomHandlers, updateCustomVariables, updateInternalHandlers, widget };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaidev/karte-action-sdk",
3
- "version": "1.1.101-27899192.5a50ebd2",
3
+ "version": "1.1.101-27899225.9f75dc0a",
4
4
  "author": "Plaid Inc.",
5
5
  "license": "Apache-2.0",
6
6
  "module": "./dist/index.es.js",