@plaidev/karte-action-sdk 1.1.123 → 1.1.124-27946655.bba7dcb4

Sign up to get free protection for your applications and to get access to all the features.
@@ -559,11 +559,13 @@ declare const state: Store<string>;
559
559
  * 現在のステートを設定する
560
560
  *
561
561
  * @param stateId - 表示するステートID
562
- * @param force - 強制的にステートを設定するフラグ。デフォルトは `false`
562
+ * @param options - オプション。`options.disableInPreview`でプレビュー時のステート遷移を無効化できます。
563
563
  *
564
564
  * @public
565
565
  */
566
- declare function setState(stateId: string, force?: boolean): void;
566
+ declare function setState(stateId: string, options?: {
567
+ disableInPreview: boolean;
568
+ }): void;
567
569
  /**
568
570
  * 現在のステートを取得する
569
571
  *
@@ -892,10 +894,8 @@ type Event = {
892
894
  values?: any;
893
895
  date?: Date;
894
896
  };
895
- // 実行ログ
896
- declare let messages: Log[];
897
- // KARTEイベント
898
- declare let events: Event[];
897
+ declare function getLogs(): Log[];
898
+ declare function getEvents(): Event[];
899
899
  /**
900
900
  * ログを送信する関数群
901
901
  */
@@ -1036,6 +1036,82 @@ declare function showOnScroll<Props extends Pick<_Props, "show_on_scroll" | "sho
1036
1036
  * @internal
1037
1037
  */
1038
1038
  declare function showOnTime<Props extends Pick<_Props, "show_on_time" | "show_on_time_count">>(props: Props, show?: Function): (() => void) | null;
1039
+ type ActionTableResult = number | string | boolean | Date | null | undefined;
1040
+ type ActionTableQueryParam = string | number | boolean | Date;
1041
+ type ActionTableQueryParams = {
1042
+ [key: string]: ActionTableQueryParam | ActionTableQueryParam[];
1043
+ };
1044
+ /**
1045
+ * アクションテーブルの設定情報
1046
+ *
1047
+ * @public
1048
+ */
1049
+ type CollectionConfig = {
1050
+ /**
1051
+ * APIキー
1052
+ */
1053
+ api_key: string;
1054
+ /**
1055
+ * テーブル名
1056
+ */
1057
+ table: string;
1058
+ /**
1059
+ * エンドポイント
1060
+ */
1061
+ endpoint?: string;
1062
+ };
1063
+ /**
1064
+ * アクションテーブルを管理するメソッドを取得する
1065
+ *
1066
+ * @param config - 設定情報
1067
+ *
1068
+ * @returns メソッドを返します
1069
+ *
1070
+ * @public
1071
+ */
1072
+ declare function collection(config: CollectionConfig): {
1073
+ get(key: string | Array<string>, cb: (err: Error | null, items?: ActionTableResult | Array<ActionTableResult>) => void): void;
1074
+ getByQuery(query_name: string, params: ActionTableQueryParams, options: {
1075
+ ignore_fields?: string[];
1076
+ } | null | undefined, cb: (err: Error | null, items?: Array<ActionTableResult>) => void): void;
1077
+ set(key: string, value: string, cb: (err: Error | null) => void): void;
1078
+ };
1079
+ type ActionTableRowRequestConfig = {
1080
+ resolver: "action-table-row";
1081
+ name: string;
1082
+ default: {
1083
+ table_name: string;
1084
+ key: string;
1085
+ default_value?: ActionTableResult;
1086
+ };
1087
+ preview_value?: ActionTableResult;
1088
+ };
1089
+ type ActionTableRowsRequestConfig = {
1090
+ resolver: "action-table-rows";
1091
+ name: string;
1092
+ default: {
1093
+ table_name: string;
1094
+ key: Array<string>;
1095
+ default_value?: Array<ActionTableResult>;
1096
+ };
1097
+ preview_value?: Array<ActionTableResult>;
1098
+ };
1099
+ type ActionTableQueryRequestConfig = {
1100
+ resolver: "action-table-query";
1101
+ name: string;
1102
+ default: {
1103
+ table_name: string;
1104
+ query_name: string;
1105
+ params?: ActionTableQueryParams;
1106
+ default_value?: Array<ActionTableResult>;
1107
+ };
1108
+ preview_value?: Array<ActionTableResult>;
1109
+ };
1110
+ type ActionTableRequestConfig = ActionTableRowRequestConfig | ActionTableRowsRequestConfig | ActionTableQueryRequestConfig;
1111
+ declare const loadActionTableRow: (config: ActionTableRowRequestConfig, api_key: string, endpoint?: string) => Promise<unknown>;
1112
+ declare const loadActionTableRows: (config: ActionTableRowsRequestConfig, api_key: string, endpoint?: string) => Promise<unknown>;
1113
+ declare const loadActionTableQuery: (config: ActionTableQueryRequestConfig, api_key: string, endpoint?: string) => Promise<unknown>;
1114
+ declare const loadActionTable: (config: Array<ActionTableRequestConfig>, api_key: string, endpoint?: string) => Promise<{}>;
1039
1115
  type _Props$0 = Props;
1040
1116
  /**
1041
1117
  * アクションのライフサイクルで呼び出されるフック
@@ -1137,7 +1213,7 @@ interface ActionProps<Props, Variables> {
1137
1213
  *
1138
1214
  * @public
1139
1215
  */
1140
- interface ActionOptions<Props, Variables> {
1216
+ interface ActionOptions<Props, Variables, VariablesQuery> {
1141
1217
  /**
1142
1218
  * アクションでイベントがトリガーされたときに受信するための関数
1143
1219
  *
@@ -1151,11 +1227,17 @@ interface ActionOptions<Props, Variables> {
1151
1227
  */
1152
1228
  props?: Props;
1153
1229
  /**
1154
- * アクションで使用されるアクションテーブルのユーザー環境変数
1230
+ * アクションで使用される解析時に取得される変数
1155
1231
  *
1156
1232
  * @defaultValue `{}`
1157
1233
  */
1158
1234
  variables?: Variables;
1235
+ /**
1236
+ * アクションで使用されるアクション実行時に取得される変数
1237
+ *
1238
+ * @defaultValue `[]`
1239
+ */
1240
+ localVariablesQuery?: VariablesQuery;
1159
1241
  /**
1160
1242
  * アクションが作成されているときにフックされる {@link onCreate}
1161
1243
  *
@@ -1173,7 +1255,7 @@ interface ActionOptions<Props, Variables> {
1173
1255
  *
1174
1256
  * @public
1175
1257
  */
1176
- declare function create<Props extends _Props$0, Variables>(App: typeof SvelteComponentDev, options?: ActionOptions<Props, Variables & CustomVariables>): () => void;
1258
+ declare function create<Props extends _Props$0, Variables, VariablesQuery extends ActionTableRequestConfig[]>(App: typeof SvelteComponentDev, options?: ActionOptions<Props, Variables & CustomVariables, VariablesQuery>): () => void;
1177
1259
  /**
1178
1260
  * アクションの破棄する
1179
1261
  *
@@ -1289,7 +1371,7 @@ declare const close: typeof closeAction;
1289
1371
  *
1290
1372
  * @internal
1291
1373
  */
1292
- type AppOptions<Props, Variables> = ActionOptions<Props, Variables>;
1374
+ type AppOptions<Props, Variables, VariablesQuery> = ActionOptions<Props, Variables, VariablesQuery>;
1293
1375
  /**
1294
1376
  * App application instance that is with {@link createApp}
1295
1377
  *
@@ -1321,44 +1403,7 @@ interface App {
1321
1403
  *
1322
1404
  * @internal
1323
1405
  */
1324
- declare function createApp<Props, Variables>(App: typeof SvelteComponentDev, options?: AppOptions<Props, Variables>): App;
1325
- /**
1326
- * アクションテーブルの設定情報
1327
- *
1328
- * @public
1329
- */
1330
- type CollectionConfig = {
1331
- /**
1332
- * APIキー
1333
- */
1334
- api_key: string;
1335
- /**
1336
- * テーブル名
1337
- */
1338
- table: string;
1339
- /**
1340
- * エンドポイント
1341
- */
1342
- endpoint?: string;
1343
- };
1344
- /**
1345
- * アクションテーブルを管理するメソッドを取得する
1346
- *
1347
- * @param config - 設定情報
1348
- *
1349
- * @returns メソッドを返します
1350
- *
1351
- * @public
1352
- */
1353
- declare function collection(config: CollectionConfig): {
1354
- get(key: string | string[], cb: (err: Error | null, items?: any) => void): void;
1355
- getByQuery(query_name: string, params: {
1356
- [p: string]: string | number | boolean | (string | number | boolean)[];
1357
- }, options: {
1358
- ignore_fields?: string[];
1359
- } | null | undefined, cb: (err: Error | null, items?: any) => void): void;
1360
- set(key: string, value: string, cb: (err: Error | null) => void): void;
1361
- };
1406
+ declare function createApp<Props, Variables, VariablesQuery>(App: typeof SvelteComponentDev, options?: AppOptions<Props, Variables, VariablesQuery>): App;
1362
1407
  declare namespace widget {
1363
1408
  /** @internal */
1364
1409
  const PropTypes: readonly [
@@ -1950,11 +1995,13 @@ declare namespace widget {
1950
1995
  * 現在のステートを設定する
1951
1996
  *
1952
1997
  * @param stateId - 表示するステートID
1953
- * @param force - 強制的にステートを設定するフラグ。デフォルトは `false`
1998
+ * @param options - オプション。`options.disableInPreview`でプレビュー時のステート遷移を無効化できます。
1954
1999
  *
1955
2000
  * @public
1956
2001
  */
1957
- function setState(stateId: string, force?: boolean): void;
2002
+ function setState(stateId: string, options?: {
2003
+ disableInPreview: boolean;
2004
+ }): void;
1958
2005
  /**
1959
2006
  * 現在のステートを取得する
1960
2007
  *
@@ -2367,6 +2414,82 @@ declare namespace widget {
2367
2414
  * @internal
2368
2415
  */
2369
2416
  const setAutoStart: (on?: boolean) => void;
2417
+ type ActionTableResult = number | string | boolean | Date | null | undefined;
2418
+ type ActionTableQueryParam = string | number | boolean | Date;
2419
+ type ActionTableQueryParams = {
2420
+ [key: string]: ActionTableQueryParam | ActionTableQueryParam[];
2421
+ };
2422
+ /**
2423
+ * アクションテーブルの設定情報
2424
+ *
2425
+ * @public
2426
+ */
2427
+ type CollectionConfig = {
2428
+ /**
2429
+ * APIキー
2430
+ */
2431
+ api_key: string;
2432
+ /**
2433
+ * テーブル名
2434
+ */
2435
+ table: string;
2436
+ /**
2437
+ * エンドポイント
2438
+ */
2439
+ endpoint?: string;
2440
+ };
2441
+ /**
2442
+ * アクションテーブルを管理するメソッドを取得する
2443
+ *
2444
+ * @param config - 設定情報
2445
+ *
2446
+ * @returns メソッドを返します
2447
+ *
2448
+ * @public
2449
+ */
2450
+ function collection(config: CollectionConfig): {
2451
+ get(key: string | Array<string>, cb: (err: Error | null, items?: ActionTableResult | Array<ActionTableResult>) => void): void;
2452
+ getByQuery(query_name: string, params: ActionTableQueryParams, options: {
2453
+ ignore_fields?: string[];
2454
+ } | null | undefined, cb: (err: Error | null, items?: Array<ActionTableResult>) => void): void;
2455
+ set(key: string, value: string, cb: (err: Error | null) => void): void;
2456
+ };
2457
+ type ActionTableRowRequestConfig = {
2458
+ resolver: "action-table-row";
2459
+ name: string;
2460
+ default: {
2461
+ table_name: string;
2462
+ key: string;
2463
+ default_value?: ActionTableResult;
2464
+ };
2465
+ preview_value?: ActionTableResult;
2466
+ };
2467
+ type ActionTableRowsRequestConfig = {
2468
+ resolver: "action-table-rows";
2469
+ name: string;
2470
+ default: {
2471
+ table_name: string;
2472
+ key: Array<string>;
2473
+ default_value?: Array<ActionTableResult>;
2474
+ };
2475
+ preview_value?: Array<ActionTableResult>;
2476
+ };
2477
+ type ActionTableQueryRequestConfig = {
2478
+ resolver: "action-table-query";
2479
+ name: string;
2480
+ default: {
2481
+ table_name: string;
2482
+ query_name: string;
2483
+ params?: ActionTableQueryParams;
2484
+ default_value?: Array<ActionTableResult>;
2485
+ };
2486
+ preview_value?: Array<ActionTableResult>;
2487
+ };
2488
+ type ActionTableRequestConfig = ActionTableRowRequestConfig | ActionTableRowsRequestConfig | ActionTableQueryRequestConfig;
2489
+ const loadActionTableRow: (config: ActionTableRowRequestConfig, api_key: string, endpoint?: string) => Promise<unknown>;
2490
+ const loadActionTableRows: (config: ActionTableRowsRequestConfig, api_key: string, endpoint?: string) => Promise<unknown>;
2491
+ const loadActionTableQuery: (config: ActionTableQueryRequestConfig, api_key: string, endpoint?: string) => Promise<unknown>;
2492
+ const loadActionTable: (config: Array<ActionTableRequestConfig>, api_key: string, endpoint?: string) => Promise<{}>;
2370
2493
  /**
2371
2494
  * プロパティ
2372
2495
  *
@@ -2523,7 +2646,7 @@ declare namespace widget {
2523
2646
  *
2524
2647
  * @public
2525
2648
  */
2526
- interface ActionOptions<Props, Variables> {
2649
+ interface ActionOptions<Props, Variables, VariablesQuery> {
2527
2650
  /**
2528
2651
  * アクションでイベントがトリガーされたときに受信するための関数
2529
2652
  *
@@ -2537,11 +2660,17 @@ declare namespace widget {
2537
2660
  */
2538
2661
  props?: Props;
2539
2662
  /**
2540
- * アクションで使用されるアクションテーブルのユーザー環境変数
2663
+ * アクションで使用される解析時に取得される変数
2541
2664
  *
2542
2665
  * @defaultValue `{}`
2543
2666
  */
2544
2667
  variables?: Variables;
2668
+ /**
2669
+ * アクションで使用されるアクション実行時に取得される変数
2670
+ *
2671
+ * @defaultValue `[]`
2672
+ */
2673
+ localVariablesQuery?: VariablesQuery;
2545
2674
  /**
2546
2675
  * アクションが作成されているときにフックされる {@link onCreate}
2547
2676
  *
@@ -2559,7 +2688,7 @@ declare namespace widget {
2559
2688
  *
2560
2689
  * @public
2561
2690
  */
2562
- function create<Props extends _Props, Variables>(App: typeof SvelteComponentDev, options?: ActionOptions<Props, Variables & CustomVariables>): () => void;
2691
+ function create<Props extends _Props, Variables, VariablesQuery extends ActionTableRequestConfig[]>(App: typeof SvelteComponentDev, options?: ActionOptions<Props, Variables & CustomVariables, VariablesQuery>): () => void;
2563
2692
  /**
2564
2693
  * Dispatch the event to destroy KARTE action
2565
2694
  *
@@ -2659,7 +2788,7 @@ declare namespace widget {
2659
2788
  *
2660
2789
  * @internal
2661
2790
  */
2662
- type ModalOptions<Props, Variables> = ActionOptions<Props, Variables>;
2791
+ type ModalOptions<Props, Variables, VariablesQuery> = ActionOptions<Props, Variables, VariablesQuery>;
2663
2792
  /**
2664
2793
  * 非推奨です
2665
2794
  *
@@ -2699,7 +2828,7 @@ declare namespace widget {
2699
2828
  *
2700
2829
  * @internal
2701
2830
  */
2702
- type AppOptions<Props, Variables> = ActionOptions<Props, Variables>;
2831
+ type AppOptions<Props, Variables, VariablesQuery> = ActionOptions<Props, Variables, VariablesQuery>;
2703
2832
  /**
2704
2833
  * App application instance that is with {@link createApp}
2705
2834
  *
@@ -2731,7 +2860,7 @@ declare namespace widget {
2731
2860
  *
2732
2861
  * @internal
2733
2862
  */
2734
- function createApp<Props, Variables>(App: typeof SvelteComponentDev, options?: AppOptions<Props, Variables>): App;
2863
+ function createApp<Props, Variables, VariablesQuery>(App: typeof SvelteComponentDev, options?: AppOptions<Props, Variables, VariablesQuery>): App;
2735
2864
  // @ts-ignore
2736
2865
  type ChangeValCallback = ({ newVal, oldVal, key }: {
2737
2866
  newVal: any;
@@ -2859,13 +2988,13 @@ declare namespace widget {
2859
2988
  *
2860
2989
  * @public
2861
2990
  */
2862
- function collection(table: string): {
2863
- get(key: string | string[], cb: (err: Error, items?: any) => void): void;
2991
+ function collection$0(table: string): {
2992
+ get(key: string | string[], cb: (err: Error, items?: (string | number | boolean | Date) | (string | number | boolean | Date)[]) => void): void;
2864
2993
  getByQuery(query_name: string, params: {
2865
- [p: string]: string | number | boolean | (string | number | boolean)[];
2994
+ [key: string]: (string | number | boolean | Date) | (string | number | boolean | Date)[];
2866
2995
  }, options: {
2867
2996
  ignore_fields?: string[];
2868
- }, cb: (err: Error, items?: any) => void): void;
2997
+ }, cb: (err: Error, items?: (string | number | boolean | Date)[]) => void): void;
2869
2998
  set(key: string, value: string, cb: (err: Error) => void): void;
2870
2999
  };
2871
3000
  /**
@@ -2878,8 +3007,8 @@ declare namespace widget {
2878
3007
  */
2879
3008
  export { showAction as show, closeAction as hide };
2880
3009
  }
2881
- export { loadGlobalScript, loadGlobalStyle, applyGlobalCss, initialize, finalize, setAutoStart, getState, setState, getStates, isOpened, getCustomVariables, setCustomVariables, updateCustomVariables, getCustomHandlers, setCustomHandlers, updateCustomHandlers, getSystem, setActionSetting, customHandlers, customVariables, formData, state, opened, closed, destroyed, stopped, isClosed, setClosed, getStoreState, onScroll, onTime, messages, events, logger, listenLogger, listenConsoleLogger, hideOnScroll, hideOnTime, showOnScroll, showOnTime, PropTypes, PropType, Code, MediaQueries, MediaQuery, Directions, Direction, AnimationStyles, AnimationStyle, ModalPositions, ModalPosition, ModalMargin, ModalPlacement, DefaultModalPlacement, Elasticities, Elasticity, ElasticityStyle, TextDirections, TextDirection, OperationArgumentType, Operation, OnClickOperationOptions, OnClickOperation, LongText, Url, Image, LengthUnits, LengthUnit, Length, Color, Justifies, Justify, Alignments, Alignment, ObjectFits, ObjectFit, ClipPaths, ClipPath, Repeats, Repeat, BackgroundSizes, BackgroundSize, Cursors, Cursor, Overflows, Overflow, Border, BorderStyle, BorderWidth, Style, StateName, WritingModes, WritingMode, ListSeparatorTypes, ListSeparatorNone, ListSeparatorBorder, ListSeparatorGap, ListSeparator, DefaultListSeparatorNone, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparator, ListBackgroundTypes, ListBackgroundNone, ListBackgroundStripe, ListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListBackground, ListDirections, ListDirection, ListContext, SlideButtonIcon, SlideButtonText, SlideButton, DefaultSlideButton, SlideButtonPosition, SlideNavigationButton, DefaultSlideNavigationButton, FormInputName, FormButtonStyle, DefaultFormButtonStyle, FormSelectStyle, DefaultFormSelectStyle, FormRatingButtonType, FormRatingButtonTypes, DefaultFormRatingButtonType, create, destroy, closeAction, showAction, loadStyle, applyCss, getActionShadowRoot, onCreate, onShow, onClose, onDestroy, onChangeState, showModal, ensureModalRoot, show, close, createApp, createFog, KARTE_MODAL_ROOT, collection, widget };
2882
- export type { CloseTrigger, CustomVariables, ActionEventHandler, SystemConfig, OnScrollContext, OnScrollFunction, ScrollDirection, LogLevel, Log, Event, ActionProps, ActionOptions, ActionHook, ActionCloseHook, ActionChangeStateHook, SendFunction, CollectionConfig };
3010
+ export { loadGlobalScript, loadGlobalStyle, applyGlobalCss, initialize, finalize, setAutoStart, getState, setState, getStates, isOpened, getCustomVariables, setCustomVariables, updateCustomVariables, getCustomHandlers, setCustomHandlers, updateCustomHandlers, getSystem, setActionSetting, customHandlers, customVariables, formData, state, opened, closed, destroyed, stopped, isClosed, setClosed, getStoreState, onScroll, onTime, getLogs, getEvents, logger, listenLogger, listenConsoleLogger, hideOnScroll, hideOnTime, showOnScroll, showOnTime, PropTypes, PropType, Code, MediaQueries, MediaQuery, Directions, Direction, AnimationStyles, AnimationStyle, ModalPositions, ModalPosition, ModalMargin, ModalPlacement, DefaultModalPlacement, Elasticities, Elasticity, ElasticityStyle, TextDirections, TextDirection, OperationArgumentType, Operation, OnClickOperationOptions, OnClickOperation, LongText, Url, Image, LengthUnits, LengthUnit, Length, Color, Justifies, Justify, Alignments, Alignment, ObjectFits, ObjectFit, ClipPaths, ClipPath, Repeats, Repeat, BackgroundSizes, BackgroundSize, Cursors, Cursor, Overflows, Overflow, Border, BorderStyle, BorderWidth, Style, StateName, WritingModes, WritingMode, ListSeparatorTypes, ListSeparatorNone, ListSeparatorBorder, ListSeparatorGap, ListSeparator, DefaultListSeparatorNone, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparator, ListBackgroundTypes, ListBackgroundNone, ListBackgroundStripe, ListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListBackground, ListDirections, ListDirection, ListContext, SlideButtonIcon, SlideButtonText, SlideButton, DefaultSlideButton, SlideButtonPosition, SlideNavigationButton, DefaultSlideNavigationButton, FormInputName, FormButtonStyle, DefaultFormButtonStyle, FormSelectStyle, DefaultFormSelectStyle, FormRatingButtonType, FormRatingButtonTypes, DefaultFormRatingButtonType, create, destroy, closeAction, showAction, loadStyle, applyCss, getActionShadowRoot, onCreate, onShow, onClose, onDestroy, onChangeState, showModal, ensureModalRoot, show, close, createApp, createFog, KARTE_MODAL_ROOT, collection, loadActionTableRow, loadActionTableRows, loadActionTableQuery, loadActionTable, widget };
3011
+ export type { CloseTrigger, CustomVariables, ActionEventHandler, SystemConfig, OnScrollContext, OnScrollFunction, ScrollDirection, LogLevel, Log, Event, ActionProps, ActionOptions, ActionHook, ActionCloseHook, ActionChangeStateHook, SendFunction, CollectionConfig, ActionTableRowRequestConfig, ActionTableRowsRequestConfig, ActionTableQueryRequestConfig, ActionTableRequestConfig };
2883
3012
  export { default as State } from './components/State.svelte';
2884
3013
  export { default as StateItem } from './components/StateItem.svelte';
2885
3014
  export { default as Modal } from './components/Modal.svelte';