@plaidev/karte-action-sdk 1.1.213 → 1.1.214

Sign up to get free protection for your applications and to get access to all the features.
@@ -1756,11 +1756,7 @@ function createModal(App, options = {
1756
1756
  context: { api_key: '' },
1757
1757
  }) {
1758
1758
  let app = null;
1759
- const data = {
1760
- ...options.props,
1761
- ...options.variables,
1762
- ...getVariables(),
1763
- };
1759
+ const data = getVariables();
1764
1760
  const actionProps = {
1765
1761
  send: options.send,
1766
1762
  publish: options.publish,
@@ -2043,21 +2039,14 @@ async function runScript$1(options = {
2043
2039
  }) {
2044
2040
  if (!options.onCreate)
2045
2041
  return;
2046
- let data = {
2047
- ...options.props,
2048
- ...options.variables,
2049
- ...getVariables(),
2050
- };
2042
+ let data = getVariables();
2051
2043
  initialize({ send: options.send, initialState: data.initial_state });
2052
2044
  initActionTable(options.localVariablesQuery);
2053
2045
  const { success } = await setupActionTable(options.localVariablesQuery, data, data.api_key);
2054
2046
  if (!success)
2055
2047
  return;
2056
2048
  // Action Tableの取得結果を反映する
2057
- data = {
2058
- ...data,
2059
- ...getVariables(),
2060
- };
2049
+ data = getVariables();
2061
2050
  const actionProps = {
2062
2051
  send: options.send,
2063
2052
  publish: options.publish,
@@ -2158,11 +2147,11 @@ function create(App, options = {
2158
2147
  karteTemplate: {},
2159
2148
  context: { api_key: '' },
2160
2149
  }) {
2161
- const data = {
2150
+ setVariables({
2162
2151
  ...options.props,
2163
2152
  ...options.variables,
2164
- ...getVariables(),
2165
- };
2153
+ });
2154
+ const data = getVariables();
2166
2155
  const actionProps = {
2167
2156
  send: options.send,
2168
2157
  publish: options.publish,
@@ -2924,6 +2913,7 @@ class StateItem extends SvelteComponent {
2924
2913
  }
2925
2914
  }
2926
2915
 
2916
+ const USER_ID_VARIABLE_NAME = '__karte_form_identify_user_id';
2927
2917
  function isEmpty(value) {
2928
2918
  if (Array.isArray(value)) {
2929
2919
  return value.length === 0;
@@ -3043,6 +3033,9 @@ function submit() {
3043
3033
  const identifyFormData$1 = get(identifyFormData);
3044
3034
  const values = formDataToEventValues(campaignId, formData$1);
3045
3035
  const identifyValues = formDataToIdentifyEventValues(identifyFormData$1);
3036
+ if (Object.keys(identifyValues).length > 0) {
3037
+ identifyValues['user_id'] = getVariables()?.[USER_ID_VARIABLE_NAME];
3038
+ }
3046
3039
  return { values, identifyValues };
3047
3040
  }
3048
3041
  return {};
package/dist/index.es.js CHANGED
@@ -1792,11 +1792,7 @@ function createModal(App, options = {
1792
1792
  context: { api_key: '' },
1793
1793
  }) {
1794
1794
  let app = null;
1795
- const data = {
1796
- ...options.props,
1797
- ...options.variables,
1798
- ...getVariables(),
1799
- };
1795
+ const data = getVariables();
1800
1796
  const actionProps = {
1801
1797
  send: options.send,
1802
1798
  publish: options.publish,
@@ -2102,21 +2098,14 @@ async function runScript$1(options = {
2102
2098
  }) {
2103
2099
  if (!options.onCreate)
2104
2100
  return;
2105
- let data = {
2106
- ...options.props,
2107
- ...options.variables,
2108
- ...getVariables(),
2109
- };
2101
+ let data = getVariables();
2110
2102
  initialize({ send: options.send, initialState: data.initial_state });
2111
2103
  initActionTable(options.localVariablesQuery);
2112
2104
  const { success } = await setupActionTable(options.localVariablesQuery, data, data.api_key);
2113
2105
  if (!success)
2114
2106
  return;
2115
2107
  // Action Tableの取得結果を反映する
2116
- data = {
2117
- ...data,
2118
- ...getVariables(),
2119
- };
2108
+ data = getVariables();
2120
2109
  const actionProps = {
2121
2110
  send: options.send,
2122
2111
  publish: options.publish,
@@ -2217,11 +2206,11 @@ function create(App, options = {
2217
2206
  karteTemplate: {},
2218
2207
  context: { api_key: '' },
2219
2208
  }) {
2220
- const data = {
2209
+ setVariables({
2221
2210
  ...options.props,
2222
2211
  ...options.variables,
2223
- ...getVariables(),
2224
- };
2212
+ });
2213
+ const data = getVariables();
2225
2214
  const actionProps = {
2226
2215
  send: options.send,
2227
2216
  publish: options.publish,
@@ -2948,6 +2937,7 @@ class StateItem extends SvelteComponent {
2948
2937
  }
2949
2938
  }
2950
2939
 
2940
+ const USER_ID_VARIABLE_NAME = '__karte_form_identify_user_id';
2951
2941
  function isEmpty(value) {
2952
2942
  if (Array.isArray(value)) {
2953
2943
  return value.length === 0;
@@ -3067,6 +3057,9 @@ function submit() {
3067
3057
  const identifyFormData$1 = get(identifyFormData);
3068
3058
  const values = formDataToEventValues(campaignId, formData$1);
3069
3059
  const identifyValues = formDataToIdentifyEventValues(identifyFormData$1);
3060
+ if (Object.keys(identifyValues).length > 0) {
3061
+ identifyValues['user_id'] = getVariables()?.[USER_ID_VARIABLE_NAME];
3062
+ }
3070
3063
  return { values, identifyValues };
3071
3064
  }
3072
3065
  return {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaidev/karte-action-sdk",
3
- "version": "1.1.213",
3
+ "version": "1.1.214",
4
4
  "author": "Plaid Inc.",
5
5
  "license": "Apache-2.0",
6
6
  "module": "./dist/index.es.js",