@plaidev/karte-action-sdk 1.1.197 → 1.1.198

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.
@@ -1721,9 +1721,11 @@ declare namespace widget {
1721
1721
  [key: string]: any;
1722
1722
  }>;
1723
1723
  /** @internal */
1724
- function setupActionTable(localVariablesQuery: any, apiKey: string): Promise<{
1724
+ function setupActionTable(localVariablesQuery: Array<VariableQuery>, apiKey: string): Promise<{
1725
1725
  success: boolean;
1726
1726
  }>;
1727
+ /** @internal */
1728
+ function initActionTable(localVariablesQuery: Array<VariableQuery> | undefined): void;
1727
1729
  /**
1728
1730
  * モーダル(ポップアップ)のプロパティ
1729
1731
  *
@@ -1346,10 +1346,8 @@ const loadActionTableQuery = async (config, api_key, endpoint) => {
1346
1346
  /** @internal */
1347
1347
  const loadActionTable = async (config, api_key, endpoint) => {
1348
1348
  console.debug('[debug] loadActionTable', isPreview(), api_key, endpoint, JSON.stringify(config));
1349
- console.log("load action table", config);
1350
1349
  const results = config.map(c => c.preview_value)
1351
1350
  ;
1352
- console.log("results", results);
1353
1351
  return config.reduce((acc, c, i) => {
1354
1352
  const value = results[i] ?? c.query.default_value;
1355
1353
  if (value) {
@@ -1370,6 +1368,17 @@ async function setupActionTable(localVariablesQuery, apiKey) {
1370
1368
  success,
1371
1369
  };
1372
1370
  }
1371
+ /** @internal */
1372
+ function initActionTable(localVariablesQuery) {
1373
+ let initValues = {
1374
+ // default values
1375
+ action_table: [],
1376
+ };
1377
+ localVariablesQuery?.forEach((query) => {
1378
+ initValues[query.name] = [];
1379
+ });
1380
+ setVariables(initValues);
1381
+ }
1373
1382
 
1374
1383
  /**
1375
1384
  * モーダル(ポップアップ)に関連するコードの管理
@@ -1563,7 +1572,6 @@ function createModal(App, options = {
1563
1572
  context: { api_key: '' },
1564
1573
  }) {
1565
1574
  let app = null;
1566
- console.log("start modal");
1567
1575
  const data = {
1568
1576
  ...options.props,
1569
1577
  ...options.variables,
@@ -1669,6 +1677,8 @@ function createModal(App, options = {
1669
1677
  // ここからメインの処理
1670
1678
  initialize({ send: options.send, initialState: data.initial_state });
1671
1679
  // ActionTable APIへの非同期リクエスト
1680
+ console.log("initialize action table");
1681
+ initActionTable(options.localVariablesQuery);
1672
1682
  let actionTablePromise = null;
1673
1683
  if (options.localVariablesQuery && data.api_key) {
1674
1684
  actionTablePromise = setupActionTable(options.localVariablesQuery, data.api_key);
@@ -1721,9 +1721,11 @@ declare namespace widget {
1721
1721
  [key: string]: any;
1722
1722
  }>;
1723
1723
  /** @internal */
1724
- function setupActionTable(localVariablesQuery: any, apiKey: string): Promise<{
1724
+ function setupActionTable(localVariablesQuery: Array<VariableQuery>, apiKey: string): Promise<{
1725
1725
  success: boolean;
1726
1726
  }>;
1727
+ /** @internal */
1728
+ function initActionTable(localVariablesQuery: Array<VariableQuery> | undefined): void;
1727
1729
  /**
1728
1730
  * モーダル(ポップアップ)のプロパティ
1729
1731
  *
package/dist/index.es.js CHANGED
@@ -1369,13 +1369,11 @@ const loadActionTableQuery = async (config, api_key, endpoint) => {
1369
1369
  /** @internal */
1370
1370
  const loadActionTable = async (config, api_key, endpoint) => {
1371
1371
  console.debug('[debug] loadActionTable', isPreview(), api_key, endpoint, JSON.stringify(config));
1372
- console.log("load action table", config);
1373
1372
  const results = await Promise.all(config
1374
1373
  .filter(c => c.resolver === 'action-table-row' ||
1375
1374
  c.resolver === 'action-table-rows' ||
1376
1375
  c.resolver === 'action-table-query')
1377
1376
  .map(async (c) => {
1378
- console.log("loadActionTable");
1379
1377
  if (c.resolver === 'action-table-row') {
1380
1378
  return await loadActionTableRow(c, api_key, endpoint);
1381
1379
  }
@@ -1386,7 +1384,6 @@ const loadActionTable = async (config, api_key, endpoint) => {
1386
1384
  return await loadActionTableQuery(c, api_key, endpoint);
1387
1385
  }
1388
1386
  }));
1389
- console.log("results", results);
1390
1387
  return config.reduce((acc, c, i) => {
1391
1388
  const value = results[i] ?? c.query.default_value;
1392
1389
  if (value) {
@@ -1407,6 +1404,17 @@ async function setupActionTable(localVariablesQuery, apiKey) {
1407
1404
  success,
1408
1405
  };
1409
1406
  }
1407
+ /** @internal */
1408
+ function initActionTable(localVariablesQuery) {
1409
+ let initValues = {
1410
+ // default values
1411
+ action_table: [],
1412
+ };
1413
+ localVariablesQuery?.forEach((query) => {
1414
+ initValues[query.name] = [];
1415
+ });
1416
+ setVariables(initValues);
1417
+ }
1410
1418
 
1411
1419
  /**
1412
1420
  * モーダル(ポップアップ)に関連するコードの管理
@@ -1600,7 +1608,6 @@ function createModal(App, options = {
1600
1608
  context: { api_key: '' },
1601
1609
  }) {
1602
1610
  let app = null;
1603
- console.log("start modal");
1604
1611
  const data = {
1605
1612
  ...options.props,
1606
1613
  ...options.variables,
@@ -1729,6 +1736,8 @@ function createModal(App, options = {
1729
1736
  // ここからメインの処理
1730
1737
  initialize({ send: options.send, initialState: data.initial_state });
1731
1738
  // ActionTable APIへの非同期リクエスト
1739
+ console.log("initialize action table");
1740
+ initActionTable(options.localVariablesQuery);
1732
1741
  let actionTablePromise = null;
1733
1742
  if (options.localVariablesQuery && data.api_key) {
1734
1743
  actionTablePromise = setupActionTable(options.localVariablesQuery, data.api_key);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaidev/karte-action-sdk",
3
- "version": "1.1.197",
3
+ "version": "1.1.198",
4
4
  "author": "Plaid Inc.",
5
5
  "license": "Apache-2.0",
6
6
  "module": "./dist/index.es.js",