@plaidev/karte-action-sdk 1.1.184 → 1.1.185

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.
@@ -152,6 +152,10 @@ interface ActionOptions<Props, Variables, VariablesQuery> {
152
152
  karteTemplate?: {
153
153
  [key: string]: any;
154
154
  };
155
+ /**
156
+ * アクション実行時のコンテキスト
157
+ */
158
+ context: ActionRunnerContext;
155
159
  }
156
160
  /**
157
161
  * KARTE のシステム設定情報
@@ -174,6 +178,13 @@ type ActionHookLog = {
174
178
  name: string;
175
179
  values?: any;
176
180
  };
181
+ /**
182
+ * アクション実行時のコンテキスト
183
+ */
184
+ type ActionRunnerContext = {
185
+ api_key: string;
186
+ target?: "web" | "native";
187
+ };
177
188
  type ActionTableResult = number | string | boolean | Date | null | undefined;
178
189
  type ActionTableQueryParam = string | number | boolean | Date;
179
190
  type ActionTableQueryParams = {
@@ -1582,6 +1593,10 @@ declare namespace widget {
1582
1593
  karteTemplate?: {
1583
1594
  [key: string]: any;
1584
1595
  };
1596
+ /**
1597
+ * アクション実行時のコンテキスト
1598
+ */
1599
+ context: ActionRunnerContext;
1585
1600
  }
1586
1601
  /**
1587
1602
  * KARTE のシステム設定情報
@@ -1604,6 +1619,13 @@ declare namespace widget {
1604
1619
  name: string;
1605
1620
  values?: any;
1606
1621
  };
1622
+ /**
1623
+ * アクション実行時のコンテキスト
1624
+ */
1625
+ type ActionRunnerContext = {
1626
+ api_key: string;
1627
+ target?: "web" | "native";
1628
+ };
1607
1629
  type ActionTableResult = number | string | boolean | Date | null | undefined;
1608
1630
  type ActionTableQueryParam = string | number | boolean | Date;
1609
1631
  type ActionTableQueryParams = {
@@ -631,6 +631,28 @@ function getSystem() {
631
631
  function setSystem(config) {
632
632
  system.set(config);
633
633
  }
634
+ /**
635
+ * アクション実行時のコンテキストを保存するストア
636
+ *
637
+ * @internal
638
+ */
639
+ const actionRunnerContext = writable(null);
640
+ /**
641
+ * アクション実行時のコンテキストを取得する
642
+ *
643
+ * @internal
644
+ */
645
+ function getActionRunnerContext() {
646
+ return get(actionRunnerContext);
647
+ }
648
+ /**
649
+ * アクション実行時のコンテキストを保存する
650
+ *
651
+ * @internal
652
+ */
653
+ function setActionRunnerContext(value) {
654
+ return actionRunnerContext.set(value);
655
+ }
634
656
  /**
635
657
  * Store to handle current state ID
636
658
  *
@@ -1531,6 +1553,7 @@ function createModal(App, options = {
1531
1553
  variables: {},
1532
1554
  localVariablesQuery: undefined,
1533
1555
  karteTemplate: {},
1556
+ context: { api_key: '' },
1534
1557
  }) {
1535
1558
  let app = null;
1536
1559
  const data = {
@@ -1730,6 +1753,7 @@ function createApp(App, options = {
1730
1753
  props: {},
1731
1754
  variables: {},
1732
1755
  localVariablesQuery: undefined,
1756
+ context: { api_key: '' },
1733
1757
  }) {
1734
1758
  let app = null;
1735
1759
  const close = () => {
@@ -1810,6 +1834,7 @@ async function runScript$1(options = {
1810
1834
  variables: {},
1811
1835
  localVariablesQuery: undefined,
1812
1836
  karteTemplate: {},
1837
+ context: { api_key: '' },
1813
1838
  }) {
1814
1839
  if (!options.onCreate)
1815
1840
  return;
@@ -1920,6 +1945,7 @@ function create(App, options = {
1920
1945
  variables: {},
1921
1946
  localVariablesQuery: undefined,
1922
1947
  karteTemplate: {},
1948
+ context: { api_key: '' },
1923
1949
  }) {
1924
1950
  const data = {
1925
1951
  ...options.props,
@@ -1951,6 +1977,7 @@ function create(App, options = {
1951
1977
  shortenId: data.shorten_id || null,
1952
1978
  campaignId: data.campaign_id || null,
1953
1979
  });
1980
+ setActionRunnerContext(options.context);
1954
1981
  const loggerCleanup = listenConsoleLogger() ;
1955
1982
  window.addEventListener(ACTION_DESTROY_EVENT, handleDestroy);
1956
1983
  window.addEventListener('beforeunload', dispatchDestroyEvent, false);
@@ -2795,6 +2822,7 @@ const moveTo = (to) => () => {
2795
2822
  };
2796
2823
  /** @internal */
2797
2824
  const linkTo = (to, targetBlank = true) => () => {
2825
+ const { target } = getActionRunnerContext() ?? {};
2798
2826
  async function sleep(ms) {
2799
2827
  return new Promise(resolve => setTimeout(resolve, ms));
2800
2828
  }
@@ -2803,11 +2831,12 @@ const linkTo = (to, targetBlank = true) => () => {
2803
2831
  // # edge.js の retransmitter が送るのを待つ
2804
2832
  await sleep(450);
2805
2833
  }
2806
- if (targetBlank) {
2834
+ const isRequiredWindowOpen = target === 'native' || targetBlank;
2835
+ if (isRequiredWindowOpen) {
2807
2836
  window.open(to);
2808
2837
  }
2809
2838
  Promise.race([_send(), sleep(650)]).then(() => {
2810
- if (!targetBlank) {
2839
+ if (!isRequiredWindowOpen) {
2811
2840
  location.href = to;
2812
2841
  }
2813
2842
  });
@@ -5829,10 +5858,10 @@ function create_fragment$j(ctx) {
5829
5858
  m(target, anchor) {
5830
5859
  insert_hydration(target, div1, anchor);
5831
5860
  append_hydration(div1, div0);
5832
- /*div0_binding*/ ctx[7](div0);
5861
+ /*div0_binding*/ ctx[26](div0);
5833
5862
  },
5834
- p(ctx, [dirty]) {
5835
- if (dirty & /*_style*/ 1) {
5863
+ p(ctx, dirty) {
5864
+ if (dirty[0] & /*_style*/ 1) {
5836
5865
  attr(div1, "style", /*_style*/ ctx[0]);
5837
5866
  }
5838
5867
  },
@@ -5840,26 +5869,55 @@ function create_fragment$j(ctx) {
5840
5869
  o: noop,
5841
5870
  d(detaching) {
5842
5871
  if (detaching) detach(div1);
5843
- /*div0_binding*/ ctx[7](null);
5872
+ /*div0_binding*/ ctx[26](null);
5844
5873
  }
5845
5874
  };
5846
5875
  }
5847
5876
 
5877
+ function _bton(value) {
5878
+ return value ? 1 : 0;
5879
+ }
5880
+
5881
+ function _setValue(obj, key, value) {
5882
+ if (value) {
5883
+ obj[key] = value;
5884
+ }
5885
+ }
5886
+
5848
5887
  function instance$j($$self, $$props, $$invalidate) {
5849
5888
  let $system;
5850
- component_subscribe($$self, system, $$value => $$invalidate(12, $system = $$value));
5851
- let { videoId = "wt0OjOeX-JA" } = $$props;
5889
+ component_subscribe($$self, system, $$value => $$invalidate(31, $system = $$value));
5890
+ let { videoId = 'wt0OjOeX-JA' } = $$props;
5852
5891
  let { sendEvent = true } = $$props;
5853
5892
  let { autoplay = false } = $$props;
5893
+ let { cc_lang_pref = '' } = $$props;
5894
+ let { cc_load_policy = '' } = $$props;
5895
+ let { color = '' } = $$props;
5896
+ let { controls = true } = $$props;
5897
+ let { disablekb = false } = $$props;
5898
+ let { enablejsapi = false } = $$props;
5899
+ let { end = -1 } = $$props;
5900
+ let { fs = true } = $$props;
5901
+ let { hl = '' } = $$props;
5902
+ let { iv_load_policy = 1 } = $$props;
5903
+ let { list = '' } = $$props;
5904
+ let { listType = '' } = $$props;
5854
5905
  let { loop = false } = $$props;
5906
+ let { modestbranding = false } = $$props;
5907
+ let { origin = '' } = $$props;
5908
+ let { playlist = '' } = $$props;
5909
+ let { playsinline = false } = $$props;
5910
+ let { rel = true } = $$props;
5911
+ let { start = -1 } = $$props;
5912
+ let { widget_referrer = '' } = $$props;
5855
5913
  let { mute = false } = $$props;
5856
- let { _style = "" } = $$props;
5914
+ let { _style = '' } = $$props;
5857
5915
 
5858
5916
  // @ts-ignore
5859
5917
  if (!window.YT) {
5860
- const tag = document.createElement("script");
5861
- tag.src = "https://www.youtube.com/iframe_api";
5862
- const firstScriptTag = document.getElementsByTagName("script")[0];
5918
+ const tag = document.createElement('script');
5919
+ tag.src = 'https://www.youtube.com/iframe_api';
5920
+ const firstScriptTag = document.getElementsByTagName('script')[0];
5863
5921
  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
5864
5922
  }
5865
5923
 
@@ -5892,7 +5950,7 @@ function instance$j($$self, $$props, $$invalidate) {
5892
5950
  const playSeconds = Math.round((currentDate - startDate) / 1000);
5893
5951
  totalPlaySeconds += playSeconds;
5894
5952
 
5895
- sendMovieEvent("_movie_playtime", {
5953
+ sendMovieEvent('_movie_playtime', {
5896
5954
  seconds: playSeconds,
5897
5955
  total_seconds: totalPlaySeconds
5898
5956
  });
@@ -5910,7 +5968,7 @@ function instance$j($$self, $$props, $$invalidate) {
5910
5968
 
5911
5969
  if (!alreadyPlay) {
5912
5970
  alreadyPlay = true;
5913
- sendMovieEvent("_movie_play");
5971
+ sendMovieEvent('_movie_play');
5914
5972
  }
5915
5973
  }
5916
5974
 
@@ -5920,7 +5978,7 @@ function instance$j($$self, $$props, $$invalidate) {
5920
5978
  }
5921
5979
 
5922
5980
  function onFinish() {
5923
- sendMovieEvent("_movie_finish");
5981
+ sendMovieEvent('_movie_finish');
5924
5982
  sendPlaytime();
5925
5983
  startDate = null;
5926
5984
  }
@@ -5948,14 +6006,40 @@ function instance$j($$self, $$props, $$invalidate) {
5948
6006
  }
5949
6007
 
5950
6008
  const playerVars = {
5951
- autoplay: autoplay ? 1 : 0,
5952
- loop: loop ? 1 : 0,
5953
- rel: 0,
5954
- playlist: null
6009
+ autoplay: _bton(autoplay),
6010
+ controls: _bton(controls),
6011
+ disablekb: _bton(disablekb),
6012
+ enablejsapi: _bton(enablejsapi),
6013
+ fs: _bton(fs),
6014
+ iv_load_policy,
6015
+ loop: _bton(loop),
6016
+ modestbranding: _bton(modestbranding),
6017
+ playsinline: _bton(playsinline),
6018
+ rel: _bton(rel)
5955
6019
  };
5956
6020
 
6021
+ _setValue(playerVars, 'cc_lang_pref', cc_lang_pref);
6022
+ _setValue(playerVars, 'cc_load_policy', cc_load_policy);
6023
+ _setValue(playerVars, 'color', color);
6024
+ _setValue(playerVars, 'hl', hl);
6025
+ _setValue(playerVars, 'list', list);
6026
+ _setValue(playerVars, 'listType', listType);
6027
+ _setValue(playerVars, 'origin', origin);
6028
+ _setValue(playerVars, 'playlist', playlist);
6029
+ _setValue(playerVars, 'widget_referrer', widget_referrer);
6030
+
5957
6031
  if (loop) {
5958
- playerVars.playlist = videoId;
6032
+ if (!playlist) {
6033
+ playerVars.playlist = videoId;
6034
+ }
6035
+ }
6036
+
6037
+ if (end >= 0) {
6038
+ playerVars.end = end;
6039
+ }
6040
+
6041
+ if (start >= 0) {
6042
+ playerVars.start = start;
5959
6043
  }
5960
6044
 
5961
6045
  // @ts-ignore
@@ -5984,8 +6068,8 @@ function instance$j($$self, $$props, $$invalidate) {
5984
6068
 
5985
6069
  onDestroy$1(() => {
5986
6070
  if (player) {
5987
- player.stopVideo();
5988
- player.destroy();
6071
+ player.stopVideo?.();
6072
+ player.destroy?.();
5989
6073
  }
5990
6074
  });
5991
6075
 
@@ -5994,7 +6078,7 @@ function instance$j($$self, $$props, $$invalidate) {
5994
6078
  createPlayer();
5995
6079
  };
5996
6080
 
5997
- window.addEventListener("beforeunload", () => {
6081
+ window.addEventListener('beforeunload', () => {
5998
6082
  sendPlaytime();
5999
6083
  });
6000
6084
 
@@ -6009,12 +6093,59 @@ function instance$j($$self, $$props, $$invalidate) {
6009
6093
  if ('videoId' in $$props) $$invalidate(2, videoId = $$props.videoId);
6010
6094
  if ('sendEvent' in $$props) $$invalidate(3, sendEvent = $$props.sendEvent);
6011
6095
  if ('autoplay' in $$props) $$invalidate(4, autoplay = $$props.autoplay);
6012
- if ('loop' in $$props) $$invalidate(5, loop = $$props.loop);
6013
- if ('mute' in $$props) $$invalidate(6, mute = $$props.mute);
6096
+ if ('cc_lang_pref' in $$props) $$invalidate(5, cc_lang_pref = $$props.cc_lang_pref);
6097
+ if ('cc_load_policy' in $$props) $$invalidate(6, cc_load_policy = $$props.cc_load_policy);
6098
+ if ('color' in $$props) $$invalidate(7, color = $$props.color);
6099
+ if ('controls' in $$props) $$invalidate(8, controls = $$props.controls);
6100
+ if ('disablekb' in $$props) $$invalidate(9, disablekb = $$props.disablekb);
6101
+ if ('enablejsapi' in $$props) $$invalidate(10, enablejsapi = $$props.enablejsapi);
6102
+ if ('end' in $$props) $$invalidate(11, end = $$props.end);
6103
+ if ('fs' in $$props) $$invalidate(12, fs = $$props.fs);
6104
+ if ('hl' in $$props) $$invalidate(13, hl = $$props.hl);
6105
+ if ('iv_load_policy' in $$props) $$invalidate(14, iv_load_policy = $$props.iv_load_policy);
6106
+ if ('list' in $$props) $$invalidate(15, list = $$props.list);
6107
+ if ('listType' in $$props) $$invalidate(16, listType = $$props.listType);
6108
+ if ('loop' in $$props) $$invalidate(17, loop = $$props.loop);
6109
+ if ('modestbranding' in $$props) $$invalidate(18, modestbranding = $$props.modestbranding);
6110
+ if ('origin' in $$props) $$invalidate(19, origin = $$props.origin);
6111
+ if ('playlist' in $$props) $$invalidate(20, playlist = $$props.playlist);
6112
+ if ('playsinline' in $$props) $$invalidate(21, playsinline = $$props.playsinline);
6113
+ if ('rel' in $$props) $$invalidate(22, rel = $$props.rel);
6114
+ if ('start' in $$props) $$invalidate(23, start = $$props.start);
6115
+ if ('widget_referrer' in $$props) $$invalidate(24, widget_referrer = $$props.widget_referrer);
6116
+ if ('mute' in $$props) $$invalidate(25, mute = $$props.mute);
6014
6117
  if ('_style' in $$props) $$invalidate(0, _style = $$props._style);
6015
6118
  };
6016
6119
 
6017
- return [_style, domRef, videoId, sendEvent, autoplay, loop, mute, div0_binding];
6120
+ return [
6121
+ _style,
6122
+ domRef,
6123
+ videoId,
6124
+ sendEvent,
6125
+ autoplay,
6126
+ cc_lang_pref,
6127
+ cc_load_policy,
6128
+ color,
6129
+ controls,
6130
+ disablekb,
6131
+ enablejsapi,
6132
+ end,
6133
+ fs,
6134
+ hl,
6135
+ iv_load_policy,
6136
+ list,
6137
+ listType,
6138
+ loop,
6139
+ modestbranding,
6140
+ origin,
6141
+ playlist,
6142
+ playsinline,
6143
+ rel,
6144
+ start,
6145
+ widget_referrer,
6146
+ mute,
6147
+ div0_binding
6148
+ ];
6018
6149
  }
6019
6150
 
6020
6151
  class MovieYouTubeElement extends SvelteComponent {
@@ -6031,11 +6162,31 @@ class MovieYouTubeElement extends SvelteComponent {
6031
6162
  videoId: 2,
6032
6163
  sendEvent: 3,
6033
6164
  autoplay: 4,
6034
- loop: 5,
6035
- mute: 6,
6165
+ cc_lang_pref: 5,
6166
+ cc_load_policy: 6,
6167
+ color: 7,
6168
+ controls: 8,
6169
+ disablekb: 9,
6170
+ enablejsapi: 10,
6171
+ end: 11,
6172
+ fs: 12,
6173
+ hl: 13,
6174
+ iv_load_policy: 14,
6175
+ list: 15,
6176
+ listType: 16,
6177
+ loop: 17,
6178
+ modestbranding: 18,
6179
+ origin: 19,
6180
+ playlist: 20,
6181
+ playsinline: 21,
6182
+ rel: 22,
6183
+ start: 23,
6184
+ widget_referrer: 24,
6185
+ mute: 25,
6036
6186
  _style: 0
6037
6187
  },
6038
- add_css$i
6188
+ add_css$i,
6189
+ [-1, -1]
6039
6190
  );
6040
6191
  }
6041
6192
  }
@@ -6197,7 +6348,7 @@ function instance$i($$self, $$props, $$invalidate) {
6197
6348
 
6198
6349
  onDestroy$1(() => {
6199
6350
  if (player) {
6200
- player.destroy();
6351
+ player.destroy?.();
6201
6352
  }
6202
6353
  });
6203
6354
 
@@ -152,6 +152,10 @@ interface ActionOptions<Props, Variables, VariablesQuery> {
152
152
  karteTemplate?: {
153
153
  [key: string]: any;
154
154
  };
155
+ /**
156
+ * アクション実行時のコンテキスト
157
+ */
158
+ context: ActionRunnerContext;
155
159
  }
156
160
  /**
157
161
  * KARTE のシステム設定情報
@@ -174,6 +178,13 @@ type ActionHookLog = {
174
178
  name: string;
175
179
  values?: any;
176
180
  };
181
+ /**
182
+ * アクション実行時のコンテキスト
183
+ */
184
+ type ActionRunnerContext = {
185
+ api_key: string;
186
+ target?: "web" | "native";
187
+ };
177
188
  type ActionTableResult = number | string | boolean | Date | null | undefined;
178
189
  type ActionTableQueryParam = string | number | boolean | Date;
179
190
  type ActionTableQueryParams = {
@@ -1582,6 +1593,10 @@ declare namespace widget {
1582
1593
  karteTemplate?: {
1583
1594
  [key: string]: any;
1584
1595
  };
1596
+ /**
1597
+ * アクション実行時のコンテキスト
1598
+ */
1599
+ context: ActionRunnerContext;
1585
1600
  }
1586
1601
  /**
1587
1602
  * KARTE のシステム設定情報
@@ -1604,6 +1619,13 @@ declare namespace widget {
1604
1619
  name: string;
1605
1620
  values?: any;
1606
1621
  };
1622
+ /**
1623
+ * アクション実行時のコンテキスト
1624
+ */
1625
+ type ActionRunnerContext = {
1626
+ api_key: string;
1627
+ target?: "web" | "native";
1628
+ };
1607
1629
  type ActionTableResult = number | string | boolean | Date | null | undefined;
1608
1630
  type ActionTableQueryParam = string | number | boolean | Date;
1609
1631
  type ActionTableQueryParams = {
package/dist/index.es.js CHANGED
@@ -635,6 +635,28 @@ function getSystem() {
635
635
  function setSystem(config) {
636
636
  system.set(config);
637
637
  }
638
+ /**
639
+ * アクション実行時のコンテキストを保存するストア
640
+ *
641
+ * @internal
642
+ */
643
+ const actionRunnerContext = writable(null);
644
+ /**
645
+ * アクション実行時のコンテキストを取得する
646
+ *
647
+ * @internal
648
+ */
649
+ function getActionRunnerContext() {
650
+ return get(actionRunnerContext);
651
+ }
652
+ /**
653
+ * アクション実行時のコンテキストを保存する
654
+ *
655
+ * @internal
656
+ */
657
+ function setActionRunnerContext(value) {
658
+ return actionRunnerContext.set(value);
659
+ }
638
660
  /**
639
661
  * Store to handle current state ID
640
662
  *
@@ -1569,6 +1591,7 @@ function createModal(App, options = {
1569
1591
  variables: {},
1570
1592
  localVariablesQuery: undefined,
1571
1593
  karteTemplate: {},
1594
+ context: { api_key: '' },
1572
1595
  }) {
1573
1596
  let app = null;
1574
1597
  const data = {
@@ -1795,6 +1818,7 @@ function createApp(App, options = {
1795
1818
  props: {},
1796
1819
  variables: {},
1797
1820
  localVariablesQuery: undefined,
1821
+ context: { api_key: '' },
1798
1822
  }) {
1799
1823
  let app = null;
1800
1824
  const close = () => {
@@ -1874,6 +1898,7 @@ async function runScript$1(options = {
1874
1898
  variables: {},
1875
1899
  localVariablesQuery: undefined,
1876
1900
  karteTemplate: {},
1901
+ context: { api_key: '' },
1877
1902
  }) {
1878
1903
  if (!options.onCreate)
1879
1904
  return;
@@ -1984,6 +2009,7 @@ function create(App, options = {
1984
2009
  variables: {},
1985
2010
  localVariablesQuery: undefined,
1986
2011
  karteTemplate: {},
2012
+ context: { api_key: '' },
1987
2013
  }) {
1988
2014
  const data = {
1989
2015
  ...options.props,
@@ -2015,6 +2041,7 @@ function create(App, options = {
2015
2041
  shortenId: data.shorten_id || null,
2016
2042
  campaignId: data.campaign_id || null,
2017
2043
  });
2044
+ setActionRunnerContext(options.context);
2018
2045
  window.addEventListener(ACTION_DESTROY_EVENT, handleDestroy);
2019
2046
  window.addEventListener('beforeunload', dispatchDestroyEvent, false);
2020
2047
  let modalCleanup = NOOP;
@@ -2819,6 +2846,7 @@ const moveTo = (to) => () => {
2819
2846
  };
2820
2847
  /** @internal */
2821
2848
  const linkTo = (to, targetBlank = true) => () => {
2849
+ const { target } = getActionRunnerContext() ?? {};
2822
2850
  async function sleep(ms) {
2823
2851
  return new Promise(resolve => setTimeout(resolve, ms));
2824
2852
  }
@@ -2827,11 +2855,12 @@ const linkTo = (to, targetBlank = true) => () => {
2827
2855
  // # edge.js の retransmitter が送るのを待つ
2828
2856
  await sleep(450);
2829
2857
  }
2830
- if (targetBlank) {
2858
+ const isRequiredWindowOpen = target === 'native' || targetBlank;
2859
+ if (isRequiredWindowOpen) {
2831
2860
  window.open(to);
2832
2861
  }
2833
2862
  Promise.race([_send(), sleep(650)]).then(() => {
2834
- if (!targetBlank) {
2863
+ if (!isRequiredWindowOpen) {
2835
2864
  location.href = to;
2836
2865
  }
2837
2866
  });
@@ -5594,10 +5623,10 @@ function create_fragment$j(ctx) {
5594
5623
  m(target, anchor) {
5595
5624
  insert(target, div1, anchor);
5596
5625
  append(div1, div0);
5597
- /*div0_binding*/ ctx[7](div0);
5626
+ /*div0_binding*/ ctx[26](div0);
5598
5627
  },
5599
- p(ctx, [dirty]) {
5600
- if (dirty & /*_style*/ 1) {
5628
+ p(ctx, dirty) {
5629
+ if (dirty[0] & /*_style*/ 1) {
5601
5630
  attr(div1, "style", /*_style*/ ctx[0]);
5602
5631
  }
5603
5632
  },
@@ -5605,26 +5634,55 @@ function create_fragment$j(ctx) {
5605
5634
  o: noop,
5606
5635
  d(detaching) {
5607
5636
  if (detaching) detach(div1);
5608
- /*div0_binding*/ ctx[7](null);
5637
+ /*div0_binding*/ ctx[26](null);
5609
5638
  }
5610
5639
  };
5611
5640
  }
5612
5641
 
5642
+ function _bton(value) {
5643
+ return value ? 1 : 0;
5644
+ }
5645
+
5646
+ function _setValue(obj, key, value) {
5647
+ if (value) {
5648
+ obj[key] = value;
5649
+ }
5650
+ }
5651
+
5613
5652
  function instance$j($$self, $$props, $$invalidate) {
5614
5653
  let $system;
5615
- component_subscribe($$self, system, $$value => $$invalidate(12, $system = $$value));
5616
- let { videoId = "wt0OjOeX-JA" } = $$props;
5654
+ component_subscribe($$self, system, $$value => $$invalidate(31, $system = $$value));
5655
+ let { videoId = 'wt0OjOeX-JA' } = $$props;
5617
5656
  let { sendEvent = true } = $$props;
5618
5657
  let { autoplay = false } = $$props;
5658
+ let { cc_lang_pref = '' } = $$props;
5659
+ let { cc_load_policy = '' } = $$props;
5660
+ let { color = '' } = $$props;
5661
+ let { controls = true } = $$props;
5662
+ let { disablekb = false } = $$props;
5663
+ let { enablejsapi = false } = $$props;
5664
+ let { end = -1 } = $$props;
5665
+ let { fs = true } = $$props;
5666
+ let { hl = '' } = $$props;
5667
+ let { iv_load_policy = 1 } = $$props;
5668
+ let { list = '' } = $$props;
5669
+ let { listType = '' } = $$props;
5619
5670
  let { loop = false } = $$props;
5671
+ let { modestbranding = false } = $$props;
5672
+ let { origin = '' } = $$props;
5673
+ let { playlist = '' } = $$props;
5674
+ let { playsinline = false } = $$props;
5675
+ let { rel = true } = $$props;
5676
+ let { start = -1 } = $$props;
5677
+ let { widget_referrer = '' } = $$props;
5620
5678
  let { mute = false } = $$props;
5621
- let { _style = "" } = $$props;
5679
+ let { _style = '' } = $$props;
5622
5680
 
5623
5681
  // @ts-ignore
5624
5682
  if (!window.YT) {
5625
- const tag = document.createElement("script");
5626
- tag.src = "https://www.youtube.com/iframe_api";
5627
- const firstScriptTag = document.getElementsByTagName("script")[0];
5683
+ const tag = document.createElement('script');
5684
+ tag.src = 'https://www.youtube.com/iframe_api';
5685
+ const firstScriptTag = document.getElementsByTagName('script')[0];
5628
5686
  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
5629
5687
  }
5630
5688
 
@@ -5657,7 +5715,7 @@ function instance$j($$self, $$props, $$invalidate) {
5657
5715
  const playSeconds = Math.round((currentDate - startDate) / 1000);
5658
5716
  totalPlaySeconds += playSeconds;
5659
5717
 
5660
- sendMovieEvent("_movie_playtime", {
5718
+ sendMovieEvent('_movie_playtime', {
5661
5719
  seconds: playSeconds,
5662
5720
  total_seconds: totalPlaySeconds
5663
5721
  });
@@ -5675,7 +5733,7 @@ function instance$j($$self, $$props, $$invalidate) {
5675
5733
 
5676
5734
  if (!alreadyPlay) {
5677
5735
  alreadyPlay = true;
5678
- sendMovieEvent("_movie_play");
5736
+ sendMovieEvent('_movie_play');
5679
5737
  }
5680
5738
  }
5681
5739
 
@@ -5685,7 +5743,7 @@ function instance$j($$self, $$props, $$invalidate) {
5685
5743
  }
5686
5744
 
5687
5745
  function onFinish() {
5688
- sendMovieEvent("_movie_finish");
5746
+ sendMovieEvent('_movie_finish');
5689
5747
  sendPlaytime();
5690
5748
  startDate = null;
5691
5749
  }
@@ -5713,14 +5771,40 @@ function instance$j($$self, $$props, $$invalidate) {
5713
5771
  }
5714
5772
 
5715
5773
  const playerVars = {
5716
- autoplay: autoplay ? 1 : 0,
5717
- loop: loop ? 1 : 0,
5718
- rel: 0,
5719
- playlist: null
5774
+ autoplay: _bton(autoplay),
5775
+ controls: _bton(controls),
5776
+ disablekb: _bton(disablekb),
5777
+ enablejsapi: _bton(enablejsapi),
5778
+ fs: _bton(fs),
5779
+ iv_load_policy,
5780
+ loop: _bton(loop),
5781
+ modestbranding: _bton(modestbranding),
5782
+ playsinline: _bton(playsinline),
5783
+ rel: _bton(rel)
5720
5784
  };
5721
5785
 
5786
+ _setValue(playerVars, 'cc_lang_pref', cc_lang_pref);
5787
+ _setValue(playerVars, 'cc_load_policy', cc_load_policy);
5788
+ _setValue(playerVars, 'color', color);
5789
+ _setValue(playerVars, 'hl', hl);
5790
+ _setValue(playerVars, 'list', list);
5791
+ _setValue(playerVars, 'listType', listType);
5792
+ _setValue(playerVars, 'origin', origin);
5793
+ _setValue(playerVars, 'playlist', playlist);
5794
+ _setValue(playerVars, 'widget_referrer', widget_referrer);
5795
+
5722
5796
  if (loop) {
5723
- playerVars.playlist = videoId;
5797
+ if (!playlist) {
5798
+ playerVars.playlist = videoId;
5799
+ }
5800
+ }
5801
+
5802
+ if (end >= 0) {
5803
+ playerVars.end = end;
5804
+ }
5805
+
5806
+ if (start >= 0) {
5807
+ playerVars.start = start;
5724
5808
  }
5725
5809
 
5726
5810
  // @ts-ignore
@@ -5749,8 +5833,8 @@ function instance$j($$self, $$props, $$invalidate) {
5749
5833
 
5750
5834
  onDestroy$1(() => {
5751
5835
  if (player) {
5752
- player.stopVideo();
5753
- player.destroy();
5836
+ player.stopVideo?.();
5837
+ player.destroy?.();
5754
5838
  }
5755
5839
  });
5756
5840
 
@@ -5759,7 +5843,7 @@ function instance$j($$self, $$props, $$invalidate) {
5759
5843
  createPlayer();
5760
5844
  };
5761
5845
 
5762
- window.addEventListener("beforeunload", () => {
5846
+ window.addEventListener('beforeunload', () => {
5763
5847
  sendPlaytime();
5764
5848
  });
5765
5849
 
@@ -5774,12 +5858,59 @@ function instance$j($$self, $$props, $$invalidate) {
5774
5858
  if ('videoId' in $$props) $$invalidate(2, videoId = $$props.videoId);
5775
5859
  if ('sendEvent' in $$props) $$invalidate(3, sendEvent = $$props.sendEvent);
5776
5860
  if ('autoplay' in $$props) $$invalidate(4, autoplay = $$props.autoplay);
5777
- if ('loop' in $$props) $$invalidate(5, loop = $$props.loop);
5778
- if ('mute' in $$props) $$invalidate(6, mute = $$props.mute);
5861
+ if ('cc_lang_pref' in $$props) $$invalidate(5, cc_lang_pref = $$props.cc_lang_pref);
5862
+ if ('cc_load_policy' in $$props) $$invalidate(6, cc_load_policy = $$props.cc_load_policy);
5863
+ if ('color' in $$props) $$invalidate(7, color = $$props.color);
5864
+ if ('controls' in $$props) $$invalidate(8, controls = $$props.controls);
5865
+ if ('disablekb' in $$props) $$invalidate(9, disablekb = $$props.disablekb);
5866
+ if ('enablejsapi' in $$props) $$invalidate(10, enablejsapi = $$props.enablejsapi);
5867
+ if ('end' in $$props) $$invalidate(11, end = $$props.end);
5868
+ if ('fs' in $$props) $$invalidate(12, fs = $$props.fs);
5869
+ if ('hl' in $$props) $$invalidate(13, hl = $$props.hl);
5870
+ if ('iv_load_policy' in $$props) $$invalidate(14, iv_load_policy = $$props.iv_load_policy);
5871
+ if ('list' in $$props) $$invalidate(15, list = $$props.list);
5872
+ if ('listType' in $$props) $$invalidate(16, listType = $$props.listType);
5873
+ if ('loop' in $$props) $$invalidate(17, loop = $$props.loop);
5874
+ if ('modestbranding' in $$props) $$invalidate(18, modestbranding = $$props.modestbranding);
5875
+ if ('origin' in $$props) $$invalidate(19, origin = $$props.origin);
5876
+ if ('playlist' in $$props) $$invalidate(20, playlist = $$props.playlist);
5877
+ if ('playsinline' in $$props) $$invalidate(21, playsinline = $$props.playsinline);
5878
+ if ('rel' in $$props) $$invalidate(22, rel = $$props.rel);
5879
+ if ('start' in $$props) $$invalidate(23, start = $$props.start);
5880
+ if ('widget_referrer' in $$props) $$invalidate(24, widget_referrer = $$props.widget_referrer);
5881
+ if ('mute' in $$props) $$invalidate(25, mute = $$props.mute);
5779
5882
  if ('_style' in $$props) $$invalidate(0, _style = $$props._style);
5780
5883
  };
5781
5884
 
5782
- return [_style, domRef, videoId, sendEvent, autoplay, loop, mute, div0_binding];
5885
+ return [
5886
+ _style,
5887
+ domRef,
5888
+ videoId,
5889
+ sendEvent,
5890
+ autoplay,
5891
+ cc_lang_pref,
5892
+ cc_load_policy,
5893
+ color,
5894
+ controls,
5895
+ disablekb,
5896
+ enablejsapi,
5897
+ end,
5898
+ fs,
5899
+ hl,
5900
+ iv_load_policy,
5901
+ list,
5902
+ listType,
5903
+ loop,
5904
+ modestbranding,
5905
+ origin,
5906
+ playlist,
5907
+ playsinline,
5908
+ rel,
5909
+ start,
5910
+ widget_referrer,
5911
+ mute,
5912
+ div0_binding
5913
+ ];
5783
5914
  }
5784
5915
 
5785
5916
  class MovieYouTubeElement extends SvelteComponent {
@@ -5796,11 +5927,31 @@ class MovieYouTubeElement extends SvelteComponent {
5796
5927
  videoId: 2,
5797
5928
  sendEvent: 3,
5798
5929
  autoplay: 4,
5799
- loop: 5,
5800
- mute: 6,
5930
+ cc_lang_pref: 5,
5931
+ cc_load_policy: 6,
5932
+ color: 7,
5933
+ controls: 8,
5934
+ disablekb: 9,
5935
+ enablejsapi: 10,
5936
+ end: 11,
5937
+ fs: 12,
5938
+ hl: 13,
5939
+ iv_load_policy: 14,
5940
+ list: 15,
5941
+ listType: 16,
5942
+ loop: 17,
5943
+ modestbranding: 18,
5944
+ origin: 19,
5945
+ playlist: 20,
5946
+ playsinline: 21,
5947
+ rel: 22,
5948
+ start: 23,
5949
+ widget_referrer: 24,
5950
+ mute: 25,
5801
5951
  _style: 0
5802
5952
  },
5803
- add_css$i
5953
+ add_css$i,
5954
+ [-1, -1]
5804
5955
  );
5805
5956
  }
5806
5957
  }
@@ -5951,7 +6102,7 @@ function instance$i($$self, $$props, $$invalidate) {
5951
6102
 
5952
6103
  onDestroy$1(() => {
5953
6104
  if (player) {
5954
- player.destroy();
6105
+ player.destroy?.();
5955
6106
  }
5956
6107
  });
5957
6108
 
@@ -100,7 +100,7 @@ import { props, localVariablesQuery, karteTemplate } from './gen';
100
100
  import App from './App.svelte';
101
101
  import onCreate from './customScript';
102
102
  ${script}
103
- const action = (options: { send: Send; publish: Publish, props: Props; variables: Variables }): KarteAction => {
103
+ const action = (options: { send: Send; publish: Publish, props: Props; variables: Variables, context: any }): KarteAction => {
104
104
  return create(App, {
105
105
  props,
106
106
  send: options.send,
@@ -109,6 +109,7 @@ const action = (options: { send: Send; publish: Publish, props: Props; variables
109
109
  localVariablesQuery,
110
110
  karteTemplate,
111
111
  onCreate,
112
+ context: options.context,
112
113
  });
113
114
  };
114
115
 
package/dist/templates.js CHANGED
@@ -98,7 +98,7 @@ import { props, localVariablesQuery, karteTemplate } from './gen';
98
98
  import App from './App.svelte';
99
99
  import onCreate from './customScript';
100
100
  ${script}
101
- const action = (options: { send: Send; publish: Publish, props: Props; variables: Variables }): KarteAction => {
101
+ const action = (options: { send: Send; publish: Publish, props: Props; variables: Variables, context: any }): KarteAction => {
102
102
  return create(App, {
103
103
  props,
104
104
  send: options.send,
@@ -107,6 +107,7 @@ const action = (options: { send: Send; publish: Publish, props: Props; variables
107
107
  localVariablesQuery,
108
108
  karteTemplate,
109
109
  onCreate,
110
+ context: options.context,
110
111
  });
111
112
  };
112
113
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaidev/karte-action-sdk",
3
- "version": "1.1.184",
3
+ "version": "1.1.185",
4
4
  "author": "Plaid Inc.",
5
5
  "license": "Apache-2.0",
6
6
  "module": "./dist/index.es.js",