@plaidev/karte-action-sdk 1.1.137 → 1.1.138-27963974.e749560a

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.
@@ -1136,9 +1136,16 @@ declare function collection(config: CollectionConfig): {
1136
1136
  } | null | undefined, cb: (err: Error | null, items?: Array<ActionTableResult>) => void): void;
1137
1137
  set(key: string, value: string, cb: (err: Error | null) => void): void;
1138
1138
  };
1139
- type ActionTableRowRequestConfig = {
1140
- resolver: "action-table-row";
1139
+ /** @internal */
1140
+ type VariableQuery = {
1141
+ resolver: string;
1141
1142
  name: string;
1143
+ query: any;
1144
+ preview_value?: any;
1145
+ };
1146
+ /** @internal */
1147
+ type ActionTableRowRequestConfig = VariableQuery & {
1148
+ resolver: "action-table-row";
1142
1149
  query: {
1143
1150
  table_name: string;
1144
1151
  key: string;
@@ -1146,9 +1153,9 @@ type ActionTableRowRequestConfig = {
1146
1153
  };
1147
1154
  preview_value?: ActionTableResult;
1148
1155
  };
1149
- type ActionTableRowsRequestConfig = {
1156
+ /** @internal */
1157
+ type ActionTableRowsRequestConfig = VariableQuery & {
1150
1158
  resolver: "action-table-rows";
1151
- name: string;
1152
1159
  query: {
1153
1160
  table_name: string;
1154
1161
  key: Array<string>;
@@ -1156,9 +1163,9 @@ type ActionTableRowsRequestConfig = {
1156
1163
  };
1157
1164
  preview_value?: Array<ActionTableResult>;
1158
1165
  };
1159
- type ActionTableQueryRequestConfig = {
1166
+ /** @internal */
1167
+ type ActionTableQueryRequestConfig = VariableQuery & {
1160
1168
  resolver: "action-table-query";
1161
- name: string;
1162
1169
  query: {
1163
1170
  table_name: string;
1164
1171
  query_name: string;
@@ -1167,11 +1174,17 @@ type ActionTableQueryRequestConfig = {
1167
1174
  };
1168
1175
  preview_value?: Array<ActionTableResult>;
1169
1176
  };
1177
+ /** @internal */
1170
1178
  type ActionTableRequestConfig = ActionTableRowRequestConfig | ActionTableRowsRequestConfig | ActionTableQueryRequestConfig;
1179
+ /** @internal */
1171
1180
  declare const loadActionTableRow: (config: ActionTableRowRequestConfig, api_key: string, endpoint?: string) => Promise<unknown>;
1181
+ /** @internal */
1172
1182
  declare const loadActionTableRows: (config: ActionTableRowsRequestConfig, api_key: string, endpoint?: string) => Promise<unknown>;
1183
+ /** @internal */
1173
1184
  declare const loadActionTableQuery: (config: ActionTableQueryRequestConfig, api_key: string, endpoint?: string) => Promise<unknown>;
1174
- declare const loadActionTable: (config: Array<ActionTableRequestConfig>, api_key: string, endpoint?: string) => Promise<{}>;
1185
+ declare const loadActionTable: (config: Array<VariableQuery>, api_key: string, endpoint?: string) => Promise<{
1186
+ [key: string]: any;
1187
+ }>;
1175
1188
  type _Props$0 = Props;
1176
1189
  /** @internal */
1177
1190
  declare const ACTION_HOOK_LABEL = "__ACTION_HOOK__";
@@ -1322,7 +1335,7 @@ interface ActionOptions<Props, Variables, VariablesQuery> {
1322
1335
  *
1323
1336
  * @public
1324
1337
  */
1325
- declare function create<Props extends _Props$0, Variables, VariablesQuery extends ActionTableRequestConfig[]>(App: typeof SvelteComponentDev, options?: ActionOptions<Props, Variables & ActionVariables, VariablesQuery>): () => void;
1338
+ declare function create<Props extends _Props$0, Variables, VariablesQuery extends Array<VariableQuery>>(App: typeof SvelteComponentDev, options?: ActionOptions<Props, Variables & ActionVariables, VariablesQuery>): () => void;
1326
1339
  /**
1327
1340
  * アクションの破棄する
1328
1341
  *
@@ -2615,9 +2628,16 @@ declare namespace widget {
2615
2628
  } | null | undefined, cb: (err: Error | null, items?: Array<ActionTableResult>) => void): void;
2616
2629
  set(key: string, value: string, cb: (err: Error | null) => void): void;
2617
2630
  };
2618
- type ActionTableRowRequestConfig = {
2619
- resolver: "action-table-row";
2631
+ /** @internal */
2632
+ type VariableQuery = {
2633
+ resolver: string;
2620
2634
  name: string;
2635
+ query: any;
2636
+ preview_value?: any;
2637
+ };
2638
+ /** @internal */
2639
+ type ActionTableRowRequestConfig = VariableQuery & {
2640
+ resolver: "action-table-row";
2621
2641
  query: {
2622
2642
  table_name: string;
2623
2643
  key: string;
@@ -2625,9 +2645,9 @@ declare namespace widget {
2625
2645
  };
2626
2646
  preview_value?: ActionTableResult;
2627
2647
  };
2628
- type ActionTableRowsRequestConfig = {
2648
+ /** @internal */
2649
+ type ActionTableRowsRequestConfig = VariableQuery & {
2629
2650
  resolver: "action-table-rows";
2630
- name: string;
2631
2651
  query: {
2632
2652
  table_name: string;
2633
2653
  key: Array<string>;
@@ -2635,9 +2655,9 @@ declare namespace widget {
2635
2655
  };
2636
2656
  preview_value?: Array<ActionTableResult>;
2637
2657
  };
2638
- type ActionTableQueryRequestConfig = {
2658
+ /** @internal */
2659
+ type ActionTableQueryRequestConfig = VariableQuery & {
2639
2660
  resolver: "action-table-query";
2640
- name: string;
2641
2661
  query: {
2642
2662
  table_name: string;
2643
2663
  query_name: string;
@@ -2646,11 +2666,17 @@ declare namespace widget {
2646
2666
  };
2647
2667
  preview_value?: Array<ActionTableResult>;
2648
2668
  };
2669
+ /** @internal */
2649
2670
  type ActionTableRequestConfig = ActionTableRowRequestConfig | ActionTableRowsRequestConfig | ActionTableQueryRequestConfig;
2671
+ /** @internal */
2650
2672
  const loadActionTableRow: (config: ActionTableRowRequestConfig, api_key: string, endpoint?: string) => Promise<unknown>;
2673
+ /** @internal */
2651
2674
  const loadActionTableRows: (config: ActionTableRowsRequestConfig, api_key: string, endpoint?: string) => Promise<unknown>;
2675
+ /** @internal */
2652
2676
  const loadActionTableQuery: (config: ActionTableQueryRequestConfig, api_key: string, endpoint?: string) => Promise<unknown>;
2653
- const loadActionTable: (config: Array<ActionTableRequestConfig>, api_key: string, endpoint?: string) => Promise<{}>;
2677
+ const loadActionTable: (config: Array<VariableQuery>, api_key: string, endpoint?: string) => Promise<{
2678
+ [key: string]: any;
2679
+ }>;
2654
2680
  /**
2655
2681
  * プロパティ
2656
2682
  *
@@ -2856,7 +2882,7 @@ declare namespace widget {
2856
2882
  *
2857
2883
  * @public
2858
2884
  */
2859
- function create<Props extends _Props, Variables, VariablesQuery extends ActionTableRequestConfig[]>(App: typeof SvelteComponentDev, options?: ActionOptions<Props, Variables & ActionVariables, VariablesQuery>): () => void;
2885
+ function create<Props extends _Props, Variables, VariablesQuery extends Array<VariableQuery>>(App: typeof SvelteComponentDev, options?: ActionOptions<Props, Variables & ActionVariables, VariablesQuery>): () => void;
2860
2886
  /**
2861
2887
  * Dispatch the event to destroy KARTE action
2862
2888
  *
@@ -843,7 +843,7 @@ const handleState = (event) => {
843
843
  const initialize = (setting) => {
844
844
  const newSetting = setActionSetting(setting);
845
845
  if (newSetting.initialState) {
846
- setState$1(setting?.initialState);
846
+ setState$1(newSetting.initialState);
847
847
  }
848
848
  if (newSetting.autoStart) {
849
849
  setStopped(!newSetting.autoStart);
@@ -1541,12 +1541,15 @@ function request(url, data, cb) {
1541
1541
  return cb(null, response.json());
1542
1542
  });
1543
1543
  }
1544
+ /** @internal */
1544
1545
  const loadActionTableRow = async (config, api_key, endpoint) => {
1545
1546
  return new Promise((resolve, reject) => collection$1({ endpoint, api_key, table: config.query.table_name }).get(config.query.key, (err, data) => (err ? reject(err) : resolve(data))));
1546
1547
  };
1548
+ /** @internal */
1547
1549
  const loadActionTableRows = async (config, api_key, endpoint) => {
1548
1550
  return new Promise((resolve, reject) => collection$1({ endpoint, api_key, table: config.query.table_name }).get(config.query.key, (err, data) => (err ? reject(err) : resolve(data))));
1549
1551
  };
1552
+ /** @internal */
1550
1553
  const loadActionTableQuery = async (config, api_key, endpoint) => {
1551
1554
  return new Promise((resolve, reject) => collection$1({ endpoint, api_key, table: config.query.table_name }).getByQuery(config.query.query_name, config.query.params, null, (err, data) => (err ? reject(err) : resolve(data))));
1552
1555
  };
@@ -1660,7 +1663,7 @@ function create(App, options = {
1660
1663
  ...getVariables(),
1661
1664
  };
1662
1665
  const actionProps = { send: options.send, data };
1663
- initialize({ send: options.send });
1666
+ initialize({ send: options.send, initialState: data.initial_state, autoStart: true });
1664
1667
  const handleDestroy = () => {
1665
1668
  const { onDestroyHandlers } = getInternalHandlers();
1666
1669
  onDestroyHandlers?.forEach(h => {
@@ -1685,7 +1688,11 @@ function create(App, options = {
1685
1688
  });
1686
1689
  // ActionTable APIへの非同期リクエスト
1687
1690
  if (options.localVariablesQuery && data.api_key) {
1688
- loadActionTable(options.localVariablesQuery, data.api_key).then(result => setVariables(result));
1691
+ loadActionTable(options.localVariablesQuery, data.api_key).then(result => {
1692
+ if (Object.keys(result).length > 0) {
1693
+ setVariables(result);
1694
+ }
1695
+ });
1689
1696
  }
1690
1697
  const close = (trigger = 'none') => {
1691
1698
  if (!app) {
@@ -1136,9 +1136,16 @@ declare function collection(config: CollectionConfig): {
1136
1136
  } | null | undefined, cb: (err: Error | null, items?: Array<ActionTableResult>) => void): void;
1137
1137
  set(key: string, value: string, cb: (err: Error | null) => void): void;
1138
1138
  };
1139
- type ActionTableRowRequestConfig = {
1140
- resolver: "action-table-row";
1139
+ /** @internal */
1140
+ type VariableQuery = {
1141
+ resolver: string;
1141
1142
  name: string;
1143
+ query: any;
1144
+ preview_value?: any;
1145
+ };
1146
+ /** @internal */
1147
+ type ActionTableRowRequestConfig = VariableQuery & {
1148
+ resolver: "action-table-row";
1142
1149
  query: {
1143
1150
  table_name: string;
1144
1151
  key: string;
@@ -1146,9 +1153,9 @@ type ActionTableRowRequestConfig = {
1146
1153
  };
1147
1154
  preview_value?: ActionTableResult;
1148
1155
  };
1149
- type ActionTableRowsRequestConfig = {
1156
+ /** @internal */
1157
+ type ActionTableRowsRequestConfig = VariableQuery & {
1150
1158
  resolver: "action-table-rows";
1151
- name: string;
1152
1159
  query: {
1153
1160
  table_name: string;
1154
1161
  key: Array<string>;
@@ -1156,9 +1163,9 @@ type ActionTableRowsRequestConfig = {
1156
1163
  };
1157
1164
  preview_value?: Array<ActionTableResult>;
1158
1165
  };
1159
- type ActionTableQueryRequestConfig = {
1166
+ /** @internal */
1167
+ type ActionTableQueryRequestConfig = VariableQuery & {
1160
1168
  resolver: "action-table-query";
1161
- name: string;
1162
1169
  query: {
1163
1170
  table_name: string;
1164
1171
  query_name: string;
@@ -1167,11 +1174,17 @@ type ActionTableQueryRequestConfig = {
1167
1174
  };
1168
1175
  preview_value?: Array<ActionTableResult>;
1169
1176
  };
1177
+ /** @internal */
1170
1178
  type ActionTableRequestConfig = ActionTableRowRequestConfig | ActionTableRowsRequestConfig | ActionTableQueryRequestConfig;
1179
+ /** @internal */
1171
1180
  declare const loadActionTableRow: (config: ActionTableRowRequestConfig, api_key: string, endpoint?: string) => Promise<unknown>;
1181
+ /** @internal */
1172
1182
  declare const loadActionTableRows: (config: ActionTableRowsRequestConfig, api_key: string, endpoint?: string) => Promise<unknown>;
1183
+ /** @internal */
1173
1184
  declare const loadActionTableQuery: (config: ActionTableQueryRequestConfig, api_key: string, endpoint?: string) => Promise<unknown>;
1174
- declare const loadActionTable: (config: Array<ActionTableRequestConfig>, api_key: string, endpoint?: string) => Promise<{}>;
1185
+ declare const loadActionTable: (config: Array<VariableQuery>, api_key: string, endpoint?: string) => Promise<{
1186
+ [key: string]: any;
1187
+ }>;
1175
1188
  type _Props$0 = Props;
1176
1189
  /** @internal */
1177
1190
  declare const ACTION_HOOK_LABEL = "__ACTION_HOOK__";
@@ -1322,7 +1335,7 @@ interface ActionOptions<Props, Variables, VariablesQuery> {
1322
1335
  *
1323
1336
  * @public
1324
1337
  */
1325
- declare function create<Props extends _Props$0, Variables, VariablesQuery extends ActionTableRequestConfig[]>(App: typeof SvelteComponentDev, options?: ActionOptions<Props, Variables & ActionVariables, VariablesQuery>): () => void;
1338
+ declare function create<Props extends _Props$0, Variables, VariablesQuery extends Array<VariableQuery>>(App: typeof SvelteComponentDev, options?: ActionOptions<Props, Variables & ActionVariables, VariablesQuery>): () => void;
1326
1339
  /**
1327
1340
  * アクションの破棄する
1328
1341
  *
@@ -2615,9 +2628,16 @@ declare namespace widget {
2615
2628
  } | null | undefined, cb: (err: Error | null, items?: Array<ActionTableResult>) => void): void;
2616
2629
  set(key: string, value: string, cb: (err: Error | null) => void): void;
2617
2630
  };
2618
- type ActionTableRowRequestConfig = {
2619
- resolver: "action-table-row";
2631
+ /** @internal */
2632
+ type VariableQuery = {
2633
+ resolver: string;
2620
2634
  name: string;
2635
+ query: any;
2636
+ preview_value?: any;
2637
+ };
2638
+ /** @internal */
2639
+ type ActionTableRowRequestConfig = VariableQuery & {
2640
+ resolver: "action-table-row";
2621
2641
  query: {
2622
2642
  table_name: string;
2623
2643
  key: string;
@@ -2625,9 +2645,9 @@ declare namespace widget {
2625
2645
  };
2626
2646
  preview_value?: ActionTableResult;
2627
2647
  };
2628
- type ActionTableRowsRequestConfig = {
2648
+ /** @internal */
2649
+ type ActionTableRowsRequestConfig = VariableQuery & {
2629
2650
  resolver: "action-table-rows";
2630
- name: string;
2631
2651
  query: {
2632
2652
  table_name: string;
2633
2653
  key: Array<string>;
@@ -2635,9 +2655,9 @@ declare namespace widget {
2635
2655
  };
2636
2656
  preview_value?: Array<ActionTableResult>;
2637
2657
  };
2638
- type ActionTableQueryRequestConfig = {
2658
+ /** @internal */
2659
+ type ActionTableQueryRequestConfig = VariableQuery & {
2639
2660
  resolver: "action-table-query";
2640
- name: string;
2641
2661
  query: {
2642
2662
  table_name: string;
2643
2663
  query_name: string;
@@ -2646,11 +2666,17 @@ declare namespace widget {
2646
2666
  };
2647
2667
  preview_value?: Array<ActionTableResult>;
2648
2668
  };
2669
+ /** @internal */
2649
2670
  type ActionTableRequestConfig = ActionTableRowRequestConfig | ActionTableRowsRequestConfig | ActionTableQueryRequestConfig;
2671
+ /** @internal */
2650
2672
  const loadActionTableRow: (config: ActionTableRowRequestConfig, api_key: string, endpoint?: string) => Promise<unknown>;
2673
+ /** @internal */
2651
2674
  const loadActionTableRows: (config: ActionTableRowsRequestConfig, api_key: string, endpoint?: string) => Promise<unknown>;
2675
+ /** @internal */
2652
2676
  const loadActionTableQuery: (config: ActionTableQueryRequestConfig, api_key: string, endpoint?: string) => Promise<unknown>;
2653
- const loadActionTable: (config: Array<ActionTableRequestConfig>, api_key: string, endpoint?: string) => Promise<{}>;
2677
+ const loadActionTable: (config: Array<VariableQuery>, api_key: string, endpoint?: string) => Promise<{
2678
+ [key: string]: any;
2679
+ }>;
2654
2680
  /**
2655
2681
  * プロパティ
2656
2682
  *
@@ -2856,7 +2882,7 @@ declare namespace widget {
2856
2882
  *
2857
2883
  * @public
2858
2884
  */
2859
- function create<Props extends _Props, Variables, VariablesQuery extends ActionTableRequestConfig[]>(App: typeof SvelteComponentDev, options?: ActionOptions<Props, Variables & ActionVariables, VariablesQuery>): () => void;
2885
+ function create<Props extends _Props, Variables, VariablesQuery extends Array<VariableQuery>>(App: typeof SvelteComponentDev, options?: ActionOptions<Props, Variables & ActionVariables, VariablesQuery>): () => void;
2860
2886
  /**
2861
2887
  * Dispatch the event to destroy KARTE action
2862
2888
  *
package/dist/index.es.js CHANGED
@@ -841,7 +841,7 @@ const handleState = (event) => {
841
841
  const initialize = (setting) => {
842
842
  const newSetting = setActionSetting(setting);
843
843
  if (newSetting.initialState) {
844
- setState$1(setting?.initialState);
844
+ setState$1(newSetting.initialState);
845
845
  }
846
846
  if (newSetting.autoStart) {
847
847
  setStopped(!newSetting.autoStart);
@@ -1611,12 +1611,15 @@ function request(url, data, cb) {
1611
1611
  return cb(null, response.json());
1612
1612
  });
1613
1613
  }
1614
+ /** @internal */
1614
1615
  const loadActionTableRow = async (config, api_key, endpoint) => {
1615
1616
  return new Promise((resolve, reject) => collection$1({ endpoint, api_key, table: config.query.table_name }).get(config.query.key, (err, data) => (err ? reject(err) : resolve(data))));
1616
1617
  };
1618
+ /** @internal */
1617
1619
  const loadActionTableRows = async (config, api_key, endpoint) => {
1618
1620
  return new Promise((resolve, reject) => collection$1({ endpoint, api_key, table: config.query.table_name }).get(config.query.key, (err, data) => (err ? reject(err) : resolve(data))));
1619
1621
  };
1622
+ /** @internal */
1620
1623
  const loadActionTableQuery = async (config, api_key, endpoint) => {
1621
1624
  return new Promise((resolve, reject) => collection$1({ endpoint, api_key, table: config.query.table_name }).getByQuery(config.query.query_name, config.query.params, null, (err, data) => (err ? reject(err) : resolve(data))));
1622
1625
  };
@@ -1743,7 +1746,7 @@ function create(App, options = {
1743
1746
  ...getVariables(),
1744
1747
  };
1745
1748
  const actionProps = { send: options.send, data };
1746
- initialize({ send: options.send });
1749
+ initialize({ send: options.send, initialState: data.initial_state, autoStart: true });
1747
1750
  const handleDestroy = () => {
1748
1751
  const { onDestroyHandlers } = getInternalHandlers();
1749
1752
  onDestroyHandlers?.forEach(h => {
@@ -1768,7 +1771,11 @@ function create(App, options = {
1768
1771
  });
1769
1772
  // ActionTable APIへの非同期リクエスト
1770
1773
  if (options.localVariablesQuery && data.api_key) {
1771
- loadActionTable(options.localVariablesQuery, data.api_key).then(result => setVariables(result));
1774
+ loadActionTable(options.localVariablesQuery, data.api_key).then(result => {
1775
+ if (Object.keys(result).length > 0) {
1776
+ setVariables(result);
1777
+ }
1778
+ });
1772
1779
  }
1773
1780
  const close = (trigger = 'none') => {
1774
1781
  if (!app) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaidev/karte-action-sdk",
3
- "version": "1.1.137",
3
+ "version": "1.1.138-27963974.e749560a",
4
4
  "author": "Plaid Inc.",
5
5
  "license": "Apache-2.0",
6
6
  "module": "./dist/index.es.js",