@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.
@@ -7,12 +7,17 @@ import { cubicOut, elasticOut, linear } from "svelte/easing";
7
7
 
8
8
  //#region rolldown:runtime
9
9
  var __defProp = Object.defineProperty;
10
- var __export = (all) => {
10
+ var __export = (all, symbols) => {
11
11
  let target = {};
12
- for (var name in all) __defProp(target, name, {
13
- get: all[name],
14
- enumerable: true
15
- });
12
+ for (var name in all) {
13
+ __defProp(target, name, {
14
+ get: all[name],
15
+ enumerable: true
16
+ });
17
+ }
18
+ if (symbols) {
19
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
20
+ }
16
21
  return target;
17
22
  };
18
23
 
@@ -191,17 +196,13 @@ function onScroll(rate, fn) {
191
196
  html.scrollHeight,
192
197
  html.clientHeight
193
198
  ]);
194
- const viewHeight = Math.min(...[html.clientHeight, body.clientHeight]);
195
- const scrollRate = (scrollTop + viewHeight) / pageHeight;
199
+ const scrollRate = (scrollTop + Math.min(...[html.clientHeight, body.clientHeight])) / pageHeight;
196
200
  contexts.forEach((ctx) => {
197
201
  ctx.scrollRate = scrollRate;
198
202
  ctx.deltaRate = ctx.scrollRate - ctx.previousRate;
199
203
  ctx.previousRate = ctx.scrollRate;
200
204
  ctx.scrollTop = scrollTop;
201
- if (canCall(ctx)) {
202
- const repeat = !!_fn(Object.assign({ direction: direction(ctx) }, ctx));
203
- updateStates(ctx, repeat);
204
- }
205
+ if (canCall(ctx)) updateStates(ctx, !!_fn(Object.assign({ direction: direction(ctx) }, ctx)));
205
206
  });
206
207
  };
207
208
  window.addEventListener("scroll", onScroll$1);
@@ -1445,6 +1446,9 @@ function dispatchDestroyEvent() {
1445
1446
 
1446
1447
  //#endregion
1447
1448
  //#region src/display-logic.ts
1449
+ /**
1450
+ * モーダル(ポップアップ)のロジックを管理する
1451
+ */
1448
1452
  function doPresent({ direction, deltaRate }, downFn, upFn, condition = false) {
1449
1453
  if (direction === "down" && deltaRate > 0) downFn();
1450
1454
  else if (condition && direction === "up" && deltaRate < 0) upFn();
@@ -1578,6 +1582,9 @@ function checkAndDo(checkFn, fn, ...conditionFns) {
1578
1582
 
1579
1583
  //#endregion
1580
1584
  //#region src/collection.ts
1585
+ /**
1586
+ * アクションテーブルに関連するコードの管理
1587
+ */
1581
1588
  const DEFAULT_COLLECTION_ENDPOINT = "https://action-table.karte.io/collection";
1582
1589
  /**
1583
1590
  * アクションテーブルを管理するメソッドを取得する
@@ -1794,12 +1801,16 @@ function closeAction$1(trigger = "none") {
1794
1801
 
1795
1802
  //#endregion
1796
1803
  //#region src/modal.svelte5.tsx
1804
+ /**
1805
+ * モーダル(ポップアップ)に関連するコードの管理
1806
+ *
1807
+ * アクションのShow, Close, ChangeStateの状態はここで管理する。
1808
+ */
1797
1809
  /** @internal */
1798
1810
  const handleState = (event) => {
1799
1811
  if (event.detail.actionId === actionId || event.detail.actionId === ALL_ACTION_ID) {
1800
1812
  const nextState = event.detail.to;
1801
- const currentState = getState();
1802
- send_event("_message_state_changed", toStateChangedData(nextState, currentState));
1813
+ send_event("_message_state_changed", toStateChangedData(nextState, getState()));
1803
1814
  setState(event.detail.to, { disableInPreview: event.detail.disableInPreview });
1804
1815
  }
1805
1816
  };
@@ -2011,8 +2022,7 @@ function createModal(App, options = {
2011
2022
  return NOOP;
2012
2023
  };
2013
2024
  const handleClose = (event) => {
2014
- const trigger = event?.detail?.trigger ? event.detail.trigger : "none";
2015
- close$1(trigger);
2025
+ close$1(event?.detail?.trigger ? event.detail.trigger : "none");
2016
2026
  };
2017
2027
  const show$1 = async (trigger = "none") => {
2018
2028
  if (app) return;
@@ -2033,20 +2043,20 @@ function createModal(App, options = {
2033
2043
  setOpened(true);
2034
2044
  setClosed(false);
2035
2045
  if (app) return;
2036
- const props = {
2046
+ app = mount(App, {
2037
2047
  target: ensureActionRoot(isOnSite()),
2038
2048
  props: {
2039
2049
  send: options.send,
2040
2050
  publish: options.publish,
2041
2051
  data,
2042
- onShow: (props$1) => {
2052
+ onShow: (props) => {
2043
2053
  const { onShowHandlers } = getInternalHandlers();
2044
2054
  if (onShowHandlers) onShowHandlers.forEach((h$1) => {
2045
2055
  console.info(`${ACTION_HOOK_LABEL}:${JSON.stringify({ name: "onShow" })}`);
2046
- h$1(props$1);
2056
+ h$1(props);
2047
2057
  });
2048
2058
  },
2049
- onChangeState: (props$1, newState) => {
2059
+ onChangeState: (props, newState) => {
2050
2060
  const { onChangeStateHandlers } = getInternalHandlers();
2051
2061
  if (onChangeStateHandlers) onChangeStateHandlers.forEach((h$1) => {
2052
2062
  const actionHookLog = {
@@ -2054,18 +2064,16 @@ function createModal(App, options = {
2054
2064
  values: { newState }
2055
2065
  };
2056
2066
  console.info(`${ACTION_HOOK_LABEL}:${JSON.stringify(actionHookLog)}`);
2057
- h$1(props$1, newState);
2067
+ h$1(props, newState);
2058
2068
  });
2059
2069
  const { onChangeStateHandlers: onChangeWidgetStateHandlers } = getWidgetHandlers();
2060
- if (onChangeWidgetStateHandlers) onChangeStateHandlers.forEach((h$1) => h$1(props$1, newState));
2070
+ if (onChangeWidgetStateHandlers) onChangeStateHandlers.forEach((h$1) => h$1(props, newState));
2061
2071
  }
2062
2072
  }
2063
- };
2064
- app = mount(App, props);
2073
+ });
2065
2074
  };
2066
2075
  const handleShow = (event) => {
2067
- const trigger = event?.detail?.trigger ? event.detail.trigger : "none";
2068
- show$1(trigger);
2076
+ show$1(event?.detail?.trigger ? event.detail.trigger : "none");
2069
2077
  };
2070
2078
  const currying = (conditionFn, options$1) => (fn) => conditionFn(options$1.props, fn);
2071
2079
  const autoShow = () => {
@@ -2251,6 +2259,9 @@ function createFog({ color = "#000", opacity = "50%", zIndex = 999, onclick }) {
2251
2259
 
2252
2260
  //#endregion
2253
2261
  //#region src/script.ts
2262
+ /**
2263
+ * スクリプト接客が利用するコードの管理
2264
+ */
2254
2265
  /** @internal */
2255
2266
  async function runScript$1(options = {
2256
2267
  send: () => {},
@@ -2354,6 +2365,11 @@ async function loadGlobalStyle(href) {
2354
2365
 
2355
2366
  //#endregion
2356
2367
  //#region src/action.ts
2368
+ /**
2369
+ * Edgeが起動するアクションに関連するコードを管理する
2370
+ *
2371
+ * アクションのCreate, Destroyの状態はここで管理する。
2372
+ */
2357
2373
  const emptyOptions = {
2358
2374
  send: () => {},
2359
2375
  publish: () => {},
@@ -2554,8 +2570,7 @@ function formDataToEventValues$1(campaignId, formData$1) {
2554
2570
  }
2555
2571
  function formDataToIdentifyEventValues$1(formData$1) {
2556
2572
  return Object.fromEntries(Object.entries(formData$1).map(([name, dataItem]) => {
2557
- const value = dataItem.value;
2558
- return [name, value];
2573
+ return [name, dataItem.value];
2559
2574
  }));
2560
2575
  }
2561
2576
  /** @internal */
@@ -2676,6 +2691,9 @@ function sendAnswers() {
2676
2691
 
2677
2692
  //#endregion
2678
2693
  //#region src/widget.ts
2694
+ /**
2695
+ * エディタv1のWidget API 互換のインターフェース
2696
+ */
2679
2697
  var widget_exports = /* @__PURE__ */ __export({
2680
2698
  collection: () => collection$1,
2681
2699
  getState: () => getState$1,
@@ -3374,12 +3392,10 @@ const useBrandKit = () => {
3374
3392
  function createComponentRawCss(layerId, define) {
3375
3393
  const rootSelector = `[data-layer-id="${layerId}"]`;
3376
3394
  const gen = (selector, styles) => {
3377
- const childSelector = selector.startsWith("&") ? selector.slice(1) : ` ${selector}`;
3378
- const body = Object.entries(styles).map(([k, v]) => {
3395
+ return `${rootSelector}${selector.startsWith("&") ? selector.slice(1) : ` ${selector}`} {\n${Object.entries(styles).map(([k, v]) => {
3379
3396
  if (!v) return "";
3380
3397
  return `${k.replace(/[A-Z]/g, (m) => "-" + m.toLowerCase())}: ${v};`;
3381
- }).filter((v) => v !== "").join("\n");
3382
- return `${rootSelector}${childSelector} {\n${body}\n}`;
3398
+ }).filter((v) => v !== "").join("\n")}\n}`;
3383
3399
  };
3384
3400
  return define(gen).join("\n");
3385
3401
  }
@@ -3578,10 +3594,12 @@ function useResponsiveProps(props) {
3578
3594
 
3579
3595
  //#endregion
3580
3596
  //#region src/functions.ts
3597
+ /**
3598
+ * モーダル(ポップアップ)のコンポーネントが利用するコードの管理
3599
+ */
3581
3600
  function _moveTo(to) {
3582
- const currentState = getState();
3583
3601
  dispatchActionEvent(ACTION_CHANGE_STATE_EVENT, { detail: {
3584
- from: currentState,
3602
+ from: getState(),
3585
3603
  to,
3586
3604
  actionId
3587
3605
  } });
@@ -3746,36 +3764,12 @@ const execOnClickOperation = (onClickOperation) => {
3746
3764
  function getAnimation(animation) {
3747
3765
  switch (animation.type) {
3748
3766
  case "fade": return `opacity: ${animation.progress}`;
3749
- case "bounce": {
3750
- const translateX = animation.x;
3751
- const translateY = animation.y;
3752
- return `transform: translate3d(${translateX}%, ${translateY}%, 0) scale(${animation.progress});`;
3753
- }
3754
- case "slide-down": {
3755
- const translateX = animation.x;
3756
- const translateY = animation.y - 100 * (1 - animation.progress);
3757
- return `transform: translate3d(${translateX}%, ${translateY}%, 0);`;
3758
- }
3759
- case "slide-up": {
3760
- const translateX = animation.x;
3761
- const translateY = animation.y + 100 * (1 - animation.progress);
3762
- return `transform: translate3d(${translateX}%, ${translateY}%, 0);`;
3763
- }
3764
- case "slide-left": {
3765
- const translateX = animation.x + 100 * (1 - animation.progress);
3766
- const translateY = animation.y;
3767
- return `transform: translate3d(${translateX}%, ${translateY}%, 0);`;
3768
- }
3769
- case "slide-right": {
3770
- const translateX = animation.x - 100 * (1 - animation.progress);
3771
- const translateY = animation.y;
3772
- return `transform: translate3d(${translateX}%, ${translateY}%, 0);`;
3773
- }
3774
- case "none": {
3775
- const translateX = animation.x;
3776
- const translateY = animation.y;
3777
- return `transform: translate3d(${translateX}%, ${translateY}%, 0);`;
3778
- }
3767
+ case "bounce": return `transform: translate3d(${animation.x}%, ${animation.y}%, 0) scale(${animation.progress});`;
3768
+ case "slide-down": return `transform: translate3d(${animation.x}%, ${animation.y - 100 * (1 - animation.progress)}%, 0);`;
3769
+ case "slide-up": return `transform: translate3d(${animation.x}%, ${animation.y + 100 * (1 - animation.progress)}%, 0);`;
3770
+ case "slide-left": return `transform: translate3d(${animation.x + 100 * (1 - animation.progress)}%, ${animation.y}%, 0);`;
3771
+ case "slide-right": return `transform: translate3d(${animation.x - 100 * (1 - animation.progress)}%, ${animation.y}%, 0);`;
3772
+ case "none": return `transform: translate3d(${animation.x}%, ${animation.y}%, 0);`;
3779
3773
  default:
3780
3774
  console.warn(`[action-sdk] invalid '${animation}', so we use 'transform: none' instead`);
3781
3775
  return "transform: none";
@@ -4904,8 +4898,7 @@ function Icon($$anchor, $$props) {
4904
4898
  //#region src/components-flex/styles.ts
4905
4899
  const getPropStyles = (callback$5) => {
4906
4900
  return (customBrandKit) => {
4907
- const brandKit = getBrandKit(customBrandKit);
4908
- return callback$5({ brandKit });
4901
+ return callback$5({ brandKit: getBrandKit(customBrandKit) });
4909
4902
  };
4910
4903
  };
4911
4904
 
@@ -7059,8 +7052,7 @@ function Modal($$anchor, $$props) {
7059
7052
  $.get(backgroundClickPC)?.apply(this, $$args);
7060
7053
  } }
7061
7054
  });
7062
- var node_2 = $.sibling(node_1, 2);
7063
- BackgroundOverlay(node_2, {
7055
+ BackgroundOverlay($.sibling(node_1, 2), {
7064
7056
  class: "background-bp-sp ",
7065
7057
  get zIndex() {
7066
7058
  return props().zIndex;
@@ -7596,15 +7588,11 @@ function CountDown($$anchor, $$props) {
7596
7588
  return limit - (/* @__PURE__ */ new Date()).getTime();
7597
7589
  }
7598
7590
  function formatTimeDiff(ms) {
7599
- const diffDay = Math.floor(ms / 1e3 / 60 / 60 / 24);
7600
- const diffHour = Math.floor(ms / 1e3 / 60 / 60) % 24;
7601
- const diffMin = Math.floor(ms / 1e3 / 60) % 60;
7602
- const diffSec = Math.floor(ms / 1e3) % 60;
7603
7591
  return {
7604
- day: diffDay,
7605
- hour: diffHour,
7606
- min: diffMin,
7607
- sec: diffSec
7592
+ day: Math.floor(ms / 1e3 / 60 / 60 / 24),
7593
+ hour: Math.floor(ms / 1e3 / 60 / 60) % 24,
7594
+ min: Math.floor(ms / 1e3 / 60) % 60,
7595
+ sec: Math.floor(ms / 1e3) % 60
7608
7596
  };
7609
7597
  }
7610
7598
  function onEachSecond() {
@@ -7696,24 +7684,22 @@ const useText = (props, layerId) => {
7696
7684
  fontWeight: getFontWeight()
7697
7685
  };
7698
7686
  };
7699
- const escapedHTML = props.content.replace(/&/g, "&lt;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;").replace(/\n/g, "<br />");
7700
- const style = objToStyle({
7701
- position: props?.position ?? "static",
7702
- textAlign: props.align,
7703
- width: props.width,
7704
- fontFamily: `"${fontFamily}"`,
7705
- color: getColor(),
7706
- ...getCssSize(),
7707
- ...toCssRadius(props),
7708
- ...toCssBackground(props),
7709
- ...toCssCommon(props),
7710
- ...toCssPosition(props),
7711
- ...toCssPadding(props),
7712
- ...toCssBorder(props)
7713
- });
7714
7687
  return {
7715
- escapedHTML,
7716
- style
7688
+ escapedHTML: props.content.replace(/&/g, "&lt;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;").replace(/\n/g, "<br />"),
7689
+ style: objToStyle({
7690
+ position: props?.position ?? "static",
7691
+ textAlign: props.align,
7692
+ width: props.width,
7693
+ fontFamily: `"${fontFamily}"`,
7694
+ color: getColor(),
7695
+ ...getCssSize(),
7696
+ ...toCssRadius(props),
7697
+ ...toCssBackground(props),
7698
+ ...toCssCommon(props),
7699
+ ...toCssPosition(props),
7700
+ ...toCssPadding(props),
7701
+ ...toCssBorder(props)
7702
+ })
7717
7703
  };
7718
7704
  };
7719
7705
 
@@ -9437,8 +9423,7 @@ function ThumbnailPreview($$anchor, $$props) {
9437
9423
  var node_3 = $.first_child(fragment_3);
9438
9424
  $.each(node_3, 1, () => option().children, $.index, ($$anchor$5, child) => {
9439
9425
  var fragment_4 = $.comment();
9440
- var node_4 = $.first_child(fragment_4);
9441
- ThumbnailPreview(node_4, {
9426
+ ThumbnailPreview($.first_child(fragment_4), {
9442
9427
  get option() {
9443
9428
  return $.get(child);
9444
9429
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaidev/karte-action-sdk",
3
- "version": "1.1.270-29410070.b86a3f94e",
3
+ "version": "1.1.270-29419384.246a50882",
4
4
  "author": "Plaid Inc.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -93,7 +93,7 @@
93
93
  "picocolors": "^1.0.0",
94
94
  "playwright": "1.52.0",
95
95
  "preact": "10.5.7",
96
- "rolldown": "1.0.0-beta.41",
96
+ "rolldown": "1.0.0-beta.53",
97
97
  "rollup-plugin-svelte": "^7.2.2",
98
98
  "serve": "^14.0.1",
99
99
  "serve-static": "^1.15.0",