@plaidev/karte-action-sdk 1.1.270-29410070.b86a3f94e → 1.1.270-29419384.246a50882

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.
@@ -5,12 +5,17 @@ import { cubicOut, elasticOut, linear } from "svelte/easing";
5
5
 
6
6
  //#region rolldown:runtime
7
7
  var __defProp = Object.defineProperty;
8
- var __export = (all) => {
8
+ var __export = (all, symbols) => {
9
9
  let target = {};
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
10
+ for (var name in all) {
11
+ __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ }
16
+ if (symbols) {
17
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
18
+ }
14
19
  return target;
15
20
  };
16
21
 
@@ -188,17 +193,13 @@ function onScroll(rate, fn) {
188
193
  html.scrollHeight,
189
194
  html.clientHeight
190
195
  ]);
191
- const viewHeight = Math.min(...[html.clientHeight, body.clientHeight]);
192
- const scrollRate = (scrollTop + viewHeight) / pageHeight;
196
+ const scrollRate = (scrollTop + Math.min(...[html.clientHeight, body.clientHeight])) / pageHeight;
193
197
  contexts.forEach((ctx) => {
194
198
  ctx.scrollRate = scrollRate;
195
199
  ctx.deltaRate = ctx.scrollRate - ctx.previousRate;
196
200
  ctx.previousRate = ctx.scrollRate;
197
201
  ctx.scrollTop = scrollTop;
198
- if (canCall(ctx)) {
199
- const repeat = !!_fn(Object.assign({ direction: direction(ctx) }, ctx));
200
- updateStates(ctx, repeat);
201
- }
202
+ if (canCall(ctx)) updateStates(ctx, !!_fn(Object.assign({ direction: direction(ctx) }, ctx)));
202
203
  });
203
204
  };
204
205
  window.addEventListener("scroll", onScroll$1);
@@ -1457,6 +1458,9 @@ function dispatchDestroyEvent() {
1457
1458
 
1458
1459
  //#endregion
1459
1460
  //#region src/display-logic.ts
1461
+ /**
1462
+ * モーダル(ポップアップ)のロジックを管理する
1463
+ */
1460
1464
  function doPresent({ direction, deltaRate }, downFn, upFn, condition = false) {
1461
1465
  if (direction === "down" && deltaRate > 0) downFn();
1462
1466
  else if (condition && direction === "up" && deltaRate < 0) upFn();
@@ -1542,6 +1546,9 @@ function showOnTime(props, show$2 = NOOP) {
1542
1546
 
1543
1547
  //#endregion
1544
1548
  //#region src/collection.ts
1549
+ /**
1550
+ * アクションテーブルに関連するコードの管理
1551
+ */
1545
1552
  const DEFAULT_COLLECTION_ENDPOINT = "https://action-table.karte.io/collection";
1546
1553
  /**
1547
1554
  * アクションテーブルを管理するメソッドを取得する
@@ -1735,6 +1742,11 @@ function initActionTable(localVariablesQuery) {
1735
1742
 
1736
1743
  //#endregion
1737
1744
  //#region src/modal.tsx
1745
+ /**
1746
+ * モーダル(ポップアップ)に関連するコードの管理
1747
+ *
1748
+ * アクションのShow, Close, ChangeStateの状態はここで管理する。
1749
+ */
1738
1750
  /** @internal */
1739
1751
  const handleState = (event) => {
1740
1752
  if (event.detail.actionId === actionId || event.detail.actionId === ALL_ACTION_ID) {
@@ -1953,8 +1965,7 @@ function createModal(App, options = {
1953
1965
  return NOOP;
1954
1966
  };
1955
1967
  const handleClose = (event) => {
1956
- const trigger = event?.detail?.trigger ? event.detail.trigger : "none";
1957
- close$2(trigger);
1968
+ close$2(event?.detail?.trigger ? event.detail.trigger : "none");
1958
1969
  };
1959
1970
  const show$2 = async (trigger = "none") => {
1960
1971
  if (app) return;
@@ -1976,21 +1987,21 @@ function createModal(App, options = {
1976
1987
  setOpened(true);
1977
1988
  setClosed(false);
1978
1989
  if (app) return;
1979
- const props = {
1990
+ app = new App({
1980
1991
  target: ensureActionRoot$1(false),
1981
1992
  hydrate: true,
1982
1993
  props: {
1983
1994
  send: options.send,
1984
1995
  publish: options.publish,
1985
1996
  data,
1986
- onShow: (props$1) => {
1997
+ onShow: (props) => {
1987
1998
  const { onShowHandlers } = getInternalHandlers();
1988
1999
  if (onShowHandlers) onShowHandlers.forEach((h$1) => {
1989
2000
  console.info(`${ACTION_HOOK_LABEL}:${JSON.stringify({ name: "onShow" })}`);
1990
- h$1(props$1);
2001
+ h$1(props);
1991
2002
  });
1992
2003
  },
1993
- onChangeState: (props$1, newState) => {
2004
+ onChangeState: (props, newState) => {
1994
2005
  const { onChangeStateHandlers } = getInternalHandlers();
1995
2006
  if (onChangeStateHandlers) onChangeStateHandlers.forEach((h$1) => {
1996
2007
  const actionHookLog = {
@@ -1998,18 +2009,16 @@ function createModal(App, options = {
1998
2009
  values: { newState }
1999
2010
  };
2000
2011
  console.info(`${ACTION_HOOK_LABEL}:${JSON.stringify(actionHookLog)}`);
2001
- h$1(props$1, newState);
2012
+ h$1(props, newState);
2002
2013
  });
2003
2014
  const { onChangeStateHandlers: onChangeWidgetStateHandlers } = getWidgetHandlers();
2004
- if (onChangeWidgetStateHandlers) onChangeStateHandlers.forEach((h$1) => h$1(props$1, newState));
2015
+ if (onChangeWidgetStateHandlers) onChangeStateHandlers.forEach((h$1) => h$1(props, newState));
2005
2016
  }
2006
2017
  }
2007
- };
2008
- app = new App(props);
2018
+ });
2009
2019
  };
2010
2020
  const handleShow = (event) => {
2011
- const trigger = event?.detail?.trigger ? event.detail.trigger : "none";
2012
- show$2(trigger);
2021
+ show$2(event?.detail?.trigger ? event.detail.trigger : "none");
2013
2022
  };
2014
2023
  const autoShow = () => {
2015
2024
  return show$2("auto");
@@ -2174,6 +2183,11 @@ function createFog({ color = "#000", opacity = "50%", zIndex = 999, onclick }) {
2174
2183
  //#endregion
2175
2184
  //#region src/modal.svelte5.tsx
2176
2185
  /**
2186
+ * モーダル(ポップアップ)に関連するコードの管理
2187
+ *
2188
+ * アクションのShow, Close, ChangeStateの状態はここで管理する。
2189
+ */
2190
+ /**
2177
2191
  * アクションが表示 (show) された後にフックする関数
2178
2192
  *
2179
2193
  * @param fn - 呼び出されるフック関数
@@ -2442,6 +2456,9 @@ function createFog$1({ color = "#000", opacity = "50%", zIndex = 999, onclick })
2442
2456
 
2443
2457
  //#endregion
2444
2458
  //#region src/script.ts
2459
+ /**
2460
+ * スクリプト接客が利用するコードの管理
2461
+ */
2445
2462
  /** @internal */
2446
2463
  async function runScript$1(options = {
2447
2464
  send: () => {},
@@ -2545,6 +2562,11 @@ async function loadGlobalStyle(href) {
2545
2562
 
2546
2563
  //#endregion
2547
2564
  //#region src/action.ts
2565
+ /**
2566
+ * Edgeが起動するアクションに関連するコードを管理する
2567
+ *
2568
+ * アクションのCreate, Destroyの状態はここで管理する。
2569
+ */
2548
2570
  const emptyOptions = {
2549
2571
  send: () => {},
2550
2572
  publish: () => {},
@@ -2731,8 +2753,7 @@ function validateFormData(formData$1, statePath) {
2731
2753
  /** @internal */
2732
2754
  const getValuesAreValidReadable = (statePath) => ({ subscribe(callback$5) {
2733
2755
  return formData.subscribe((formData$1) => identifyFormData.subscribe((identifyFormData$1) => {
2734
- const valuesAreValid = validateFormData(formData$1, statePath) && validateFormData(identifyFormData$1, statePath);
2735
- callback$5(valuesAreValid);
2756
+ callback$5(validateFormData(formData$1, statePath) && validateFormData(identifyFormData$1, statePath));
2736
2757
  }));
2737
2758
  } });
2738
2759
  function createAnswerValue$1(value) {
@@ -2755,8 +2776,7 @@ function formDataToEventValues$1(campaignId, formData$1) {
2755
2776
  }
2756
2777
  function formDataToIdentifyEventValues$1(formData$1) {
2757
2778
  return Object.fromEntries(Object.entries(formData$1).map(([name, dataItem]) => {
2758
- const value = dataItem.value;
2759
- return [name, value];
2779
+ return [name, dataItem.value];
2760
2780
  }));
2761
2781
  }
2762
2782
  /** @internal */
@@ -2877,6 +2897,9 @@ function sendAnswers() {
2877
2897
 
2878
2898
  //#endregion
2879
2899
  //#region src/widget.ts
2900
+ /**
2901
+ * エディタv1のWidget API 互換のインターフェース
2902
+ */
2880
2903
  var widget_exports = /* @__PURE__ */ __export({
2881
2904
  collection: () => collection$1,
2882
2905
  getState: () => getState$1,
@@ -3846,10 +3869,12 @@ function onSubmitForm(fn) {
3846
3869
 
3847
3870
  //#endregion
3848
3871
  //#region src/functions.ts
3872
+ /**
3873
+ * モーダル(ポップアップ)のコンポーネントが利用するコードの管理
3874
+ */
3849
3875
  function _moveTo(to) {
3850
- const currentState = getState();
3851
3876
  dispatchActionEvent(ACTION_CHANGE_STATE_EVENT, { detail: {
3852
- from: currentState,
3877
+ from: getState(),
3853
3878
  to,
3854
3879
  actionId
3855
3880
  } });
@@ -4018,36 +4043,12 @@ const haveFunction = (onClickOperation) => {
4018
4043
  function getAnimation(animation) {
4019
4044
  switch (animation.type) {
4020
4045
  case "fade": return `opacity: ${animation.progress}`;
4021
- case "bounce": {
4022
- const translateX = animation.x;
4023
- const translateY = animation.y;
4024
- return `transform: translate3d(${translateX}%, ${translateY}%, 0) scale(${animation.progress});`;
4025
- }
4026
- case "slide-down": {
4027
- const translateX = animation.x;
4028
- const translateY = animation.y - 100 * (1 - animation.progress);
4029
- return `transform: translate3d(${translateX}%, ${translateY}%, 0);`;
4030
- }
4031
- case "slide-up": {
4032
- const translateX = animation.x;
4033
- const translateY = animation.y + 100 * (1 - animation.progress);
4034
- return `transform: translate3d(${translateX}%, ${translateY}%, 0);`;
4035
- }
4036
- case "slide-left": {
4037
- const translateX = animation.x + 100 * (1 - animation.progress);
4038
- const translateY = animation.y;
4039
- return `transform: translate3d(${translateX}%, ${translateY}%, 0);`;
4040
- }
4041
- case "slide-right": {
4042
- const translateX = animation.x - 100 * (1 - animation.progress);
4043
- const translateY = animation.y;
4044
- return `transform: translate3d(${translateX}%, ${translateY}%, 0);`;
4045
- }
4046
- case "none": {
4047
- const translateX = animation.x;
4048
- const translateY = animation.y;
4049
- return `transform: translate3d(${translateX}%, ${translateY}%, 0);`;
4050
- }
4046
+ case "bounce": return `transform: translate3d(${animation.x}%, ${animation.y}%, 0) scale(${animation.progress});`;
4047
+ case "slide-down": return `transform: translate3d(${animation.x}%, ${animation.y - 100 * (1 - animation.progress)}%, 0);`;
4048
+ case "slide-up": return `transform: translate3d(${animation.x}%, ${animation.y + 100 * (1 - animation.progress)}%, 0);`;
4049
+ case "slide-left": return `transform: translate3d(${animation.x + 100 * (1 - animation.progress)}%, ${animation.y}%, 0);`;
4050
+ case "slide-right": return `transform: translate3d(${animation.x - 100 * (1 - animation.progress)}%, ${animation.y}%, 0);`;
4051
+ case "none": return `transform: translate3d(${animation.x}%, ${animation.y}%, 0);`;
4051
4052
  default:
4052
4053
  console.warn(`[action-sdk] invalid '${animation}', so we use 'transform: none' instead`);
4053
4054
  return "transform: none";
@@ -4198,6 +4199,10 @@ var BackgroundOverlay_default$1 = BackgroundOverlay$1;
4198
4199
 
4199
4200
  //#endregion
4200
4201
  //#region src/enhancedStopPropagation.ts
4202
+ /**
4203
+ * data属性とカスタムのイベントハンドラによるstopPropagation。
4204
+ * デフォルトのstopPropagationだと伝播先のpreventDefaultも無効化されてしまうため、それの対策。
4205
+ */
4201
4206
  function createDataAttrKey(eventName) {
4202
4207
  return `data-stop-propagation-${eventName}-${actionId}`;
4203
4208
  }
@@ -5266,10 +5271,7 @@ function instance$103($$self, $$props, $$invalidate) {
5266
5271
  let elasticStyle = ElasticityStyle[isPreview() ? "none" : elasticity];
5267
5272
  if (!useBreakPoint) modalStyles.add(elasticStyle);
5268
5273
  DEVICE_IDS.forEach((deviceId) => {
5269
- if (!isPreview() && useBreakPoint) {
5270
- const elasticityWithBp = breakPoint[deviceId]?.elasticity;
5271
- elasticStyle = ElasticityStyle[elasticityWithBp];
5272
- }
5274
+ if (!isPreview() && useBreakPoint) elasticStyle = ElasticityStyle[breakPoint[deviceId]?.elasticity];
5273
5275
  const elasticityVariables = stringifyStyleObj(formatObjectKey({
5274
5276
  obj: parseStyle(elasticStyle),
5275
5277
  prefix: "--modal-bp-",
@@ -6823,12 +6825,11 @@ function instance$93($$self, $$props, $$invalidate) {
6823
6825
  let domRef = null;
6824
6826
  function sendMovieEvent(event_name, values = {}) {
6825
6827
  if (!sendEvent) return;
6826
- const sentValues = {
6828
+ send_event(event_name, {
6827
6829
  campaign_id: $system.campaignId,
6828
6830
  shorten_id: $system.shortenId,
6829
6831
  ...values
6830
- };
6831
- send_event(event_name, sentValues);
6832
+ });
6832
6833
  }
6833
6834
  function sendPlaytime() {
6834
6835
  if (!startDate) return;
@@ -7091,12 +7092,11 @@ function instance$92($$self, $$props, $$invalidate) {
7091
7092
  let domRef = null;
7092
7093
  function sendMovieEvent(event_name, values = {}) {
7093
7094
  if (!sendEvent) return;
7094
- const sentValues = {
7095
+ send_event(event_name, {
7095
7096
  campaign_id: $system.campaignId,
7096
7097
  shorten_id: $system.shortenId,
7097
7098
  ...values
7098
- };
7099
- send_event(event_name, sentValues);
7099
+ });
7100
7100
  }
7101
7101
  function sendPlaytime() {
7102
7102
  if (!startDate) return;
@@ -9439,8 +9439,7 @@ function instance$83($$self, $$props, $$invalidate) {
9439
9439
  if (!moving) return;
9440
9440
  if (previousMove) {
9441
9441
  const dx = clientX - previousMove.clientX;
9442
- const dt = timeStamp - previousMove.timeStamp;
9443
- moveSpeed = dx / dt;
9442
+ moveSpeed = dx / (timeStamp - previousMove.timeStamp);
9444
9443
  const updatedSlidePosition = slidePosition + dx;
9445
9444
  window.requestAnimationFrame(() => {
9446
9445
  $$invalidate(28, slidePosition = updatedSlidePosition);
@@ -11541,12 +11540,10 @@ const toCssOverflow = (p) => {
11541
11540
  function createComponentRawCss(layerId, define) {
11542
11541
  const rootSelector = `[data-layer-id="${layerId}"]`;
11543
11542
  const gen = (selector, styles) => {
11544
- const childSelector = selector.startsWith("&") ? selector.slice(1) : ` ${selector}`;
11545
- const body = Object.entries(styles).map(([k, v]) => {
11543
+ return `${rootSelector}${selector.startsWith("&") ? selector.slice(1) : ` ${selector}`} {\n${Object.entries(styles).map(([k, v]) => {
11546
11544
  if (!v) return "";
11547
11545
  return `${k.replace(/[A-Z]/g, (m) => "-" + m.toLowerCase())}: ${v};`;
11548
- }).filter((v) => v !== "").join("\n");
11549
- return `${rootSelector}${childSelector} {\n${body}\n}`;
11546
+ }).filter((v) => v !== "").join("\n")}\n}`;
11550
11547
  };
11551
11548
  return define(gen).join("\n");
11552
11549
  }
@@ -14448,8 +14445,7 @@ var Icon_default = Icon;
14448
14445
  //#region src/components-flex/styles.ts
14449
14446
  const getPropStyles = (callback$5) => {
14450
14447
  return (customBrandKit) => {
14451
- const brandKit = getBrandKit(customBrandKit);
14452
- return callback$5({ brandKit });
14448
+ return callback$5({ brandKit: getBrandKit(customBrandKit) });
14453
14449
  };
14454
14450
  };
14455
14451
 
@@ -19843,15 +19839,11 @@ function calcRemainingTime(limit) {
19843
19839
  return limit - (/* @__PURE__ */ new Date()).getTime();
19844
19840
  }
19845
19841
  function formatTimeDiff(ms) {
19846
- const diffDay = Math.floor(ms / 1e3 / 60 / 60 / 24);
19847
- const diffHour = Math.floor(ms / 1e3 / 60 / 60) % 24;
19848
- const diffMin = Math.floor(ms / 1e3 / 60) % 60;
19849
- const diffSec = Math.floor(ms / 1e3) % 60;
19850
19842
  return {
19851
- day: diffDay,
19852
- hour: diffHour,
19853
- min: diffMin,
19854
- sec: diffSec
19843
+ day: Math.floor(ms / 1e3 / 60 / 60 / 24),
19844
+ hour: Math.floor(ms / 1e3 / 60 / 60) % 24,
19845
+ min: Math.floor(ms / 1e3 / 60) % 60,
19846
+ sec: Math.floor(ms / 1e3) % 60
19855
19847
  };
19856
19848
  }
19857
19849
  function instance$16($$self, $$props, $$invalidate) {
@@ -19948,24 +19940,22 @@ const useText = (props, layerId) => {
19948
19940
  fontWeight: getFontWeight()
19949
19941
  };
19950
19942
  };
19951
- const escapedHTML = props.content.replace(/&/g, "&lt;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;").replace(/\n/g, "<br />");
19952
- const style = objToStyle({
19953
- position: props?.position ?? "static",
19954
- textAlign: props.align,
19955
- width: props.width,
19956
- fontFamily: `"${fontFamily}"`,
19957
- color: getColor(),
19958
- ...getCssSize(),
19959
- ...toCssRadius(props),
19960
- ...toCssBackground(props),
19961
- ...toCssCommon(props),
19962
- ...toCssPosition(props),
19963
- ...toCssPadding(props),
19964
- ...toCssBorder(props)
19965
- });
19966
19943
  return {
19967
- escapedHTML,
19968
- style
19944
+ escapedHTML: props.content.replace(/&/g, "&lt;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;").replace(/\n/g, "<br />"),
19945
+ style: objToStyle({
19946
+ position: props?.position ?? "static",
19947
+ textAlign: props.align,
19948
+ width: props.width,
19949
+ fontFamily: `"${fontFamily}"`,
19950
+ color: getColor(),
19951
+ ...getCssSize(),
19952
+ ...toCssRadius(props),
19953
+ ...toCssBackground(props),
19954
+ ...toCssCommon(props),
19955
+ ...toCssPosition(props),
19956
+ ...toCssPadding(props),
19957
+ ...toCssBorder(props)
19958
+ })
19969
19959
  };
19970
19960
  };
19971
19961