@plaidev/karte-action-sdk 1.1.141 → 1.1.142-27971078.b5c55d5c
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.
- package/dist/hydrate/index.es.js +5 -80
- package/dist/index.es.js +6 -2
- package/package.json +1 -1
package/dist/hydrate/index.es.js
CHANGED
@@ -1089,58 +1089,6 @@ function showOnTime(props, show = NOOP) {
|
|
1089
1089
|
? onTime(props.show_on_time_count * 1000, () => show())
|
1090
1090
|
: null;
|
1091
1091
|
}
|
1092
|
-
/** @internal */
|
1093
|
-
function and(fn, ...conditionFns) {
|
1094
|
-
return checkAndDo((conditions, idx) => {
|
1095
|
-
conditions[idx] = true;
|
1096
|
-
return conditions.every(t => t == null || t);
|
1097
|
-
}, fn, ...conditionFns);
|
1098
|
-
}
|
1099
|
-
/** @internal */
|
1100
|
-
function or(fn, ...conditionFns) {
|
1101
|
-
return checkAndDo((conditions, idx) => {
|
1102
|
-
if (conditions.some(t => t)) {
|
1103
|
-
return conditions[idx]; // this is true when show_on_scroll_reenter is true
|
1104
|
-
}
|
1105
|
-
conditions[idx] = true;
|
1106
|
-
return true;
|
1107
|
-
}, fn, ...conditionFns);
|
1108
|
-
}
|
1109
|
-
function checkAndDo(checkFn, fn, ...conditionFns) {
|
1110
|
-
let initialized = false;
|
1111
|
-
const checkBeforeInitialized = [];
|
1112
|
-
let haveCondition = true;
|
1113
|
-
const conditions = Array(conditionFns.length).fill(null);
|
1114
|
-
const checkAndDos = Array(conditionFns.length).fill(() => { });
|
1115
|
-
const cleanups = Array(conditionFns.length).fill(null);
|
1116
|
-
const generageCheckAndDo = (idx) => () => {
|
1117
|
-
if (!initialized) {
|
1118
|
-
checkBeforeInitialized.push(idx);
|
1119
|
-
return;
|
1120
|
-
}
|
1121
|
-
if (!haveCondition || !checkFn(conditions, idx))
|
1122
|
-
return;
|
1123
|
-
fn && fn();
|
1124
|
-
};
|
1125
|
-
conditionFns.forEach((conditionFn, i) => {
|
1126
|
-
const checkAndDo = generageCheckAndDo(i);
|
1127
|
-
checkAndDos[i] = checkAndDo;
|
1128
|
-
const cleanup = conditionFn(checkAndDo);
|
1129
|
-
cleanups[i] = cleanup;
|
1130
|
-
if (cleanup != null)
|
1131
|
-
conditions[i] = false;
|
1132
|
-
});
|
1133
|
-
haveCondition = conditions.some(c => c !== null);
|
1134
|
-
const cleanupAll = () => {
|
1135
|
-
cleanups.forEach((cleanup, i) => {
|
1136
|
-
cleanup && cleanup();
|
1137
|
-
cleanups[i] = null;
|
1138
|
-
});
|
1139
|
-
};
|
1140
|
-
initialized = true;
|
1141
|
-
checkBeforeInitialized.forEach(i => checkAndDos[i]());
|
1142
|
-
return haveCondition ? cleanupAll : null;
|
1143
|
-
}
|
1144
1092
|
|
1145
1093
|
/** @internal */
|
1146
1094
|
const PropTypes = [
|
@@ -1635,35 +1583,9 @@ function create(App, options = {
|
|
1635
1583
|
const trigger = event?.detail?.trigger ? event.detail.trigger : 'none';
|
1636
1584
|
show(trigger);
|
1637
1585
|
};
|
1638
|
-
const currying = (conditionFn, options) => (fn) => conditionFn(options.props, fn);
|
1639
1586
|
const autoShow = () => {
|
1640
1587
|
return show('auto');
|
1641
1588
|
};
|
1642
|
-
const autoClose = () => {
|
1643
|
-
return close('auto');
|
1644
|
-
};
|
1645
|
-
const listenCloseTrigger = () => {
|
1646
|
-
const cleanups = [];
|
1647
|
-
const curried = fn => hideOnScroll(options.props, fn, autoShow);
|
1648
|
-
if (options.props.hide_and_condition) {
|
1649
|
-
cleanups.push(and(autoClose, curried, currying(hideOnTime, options)) || NOOP);
|
1650
|
-
}
|
1651
|
-
else {
|
1652
|
-
cleanups.push(or(autoClose, curried, currying(hideOnTime, options)) || NOOP);
|
1653
|
-
}
|
1654
|
-
return cleanups;
|
1655
|
-
};
|
1656
|
-
const listenShowTrigger = () => {
|
1657
|
-
const cleanups = [];
|
1658
|
-
const curried = fn => showOnScroll(options.props, fn, autoClose);
|
1659
|
-
if (options.props.show_and_condition) {
|
1660
|
-
cleanups.push(and(autoShow, curried, currying(showOnTime, options)) || NOOP);
|
1661
|
-
}
|
1662
|
-
else {
|
1663
|
-
cleanups.push(or(autoShow, curried, currying(showOnTime, options)) || NOOP);
|
1664
|
-
}
|
1665
|
-
return cleanups;
|
1666
|
-
};
|
1667
1589
|
// ここからメインの処理
|
1668
1590
|
initialize({ send: options.send, initialState: data.initial_state });
|
1669
1591
|
setSystem({
|
@@ -1686,8 +1608,11 @@ function create(App, options = {
|
|
1686
1608
|
window.addEventListener(ACTION_CHANGE_STATE_EVENT, handleState);
|
1687
1609
|
window.addEventListener(ACTION_DESTROY_EVENT, handleDestroy);
|
1688
1610
|
window.addEventListener('beforeunload', dispatchDestroyEvent, false);
|
1689
|
-
|
1690
|
-
|
1611
|
+
let showTriggerCleanups = [];
|
1612
|
+
let closeTriggerCleanups = [];
|
1613
|
+
{
|
1614
|
+
autoShow();
|
1615
|
+
}
|
1691
1616
|
const loggerCleanup = listenConsoleLogger() ;
|
1692
1617
|
// 旧Widget API IFの処理
|
1693
1618
|
const { onCreateHandlers } = getInternalHandlers();
|
package/dist/index.es.js
CHANGED
@@ -1717,8 +1717,12 @@ function create(App, options = {
|
|
1717
1717
|
window.addEventListener(ACTION_CHANGE_STATE_EVENT, handleState);
|
1718
1718
|
window.addEventListener(ACTION_DESTROY_EVENT, handleDestroy);
|
1719
1719
|
window.addEventListener('beforeunload', dispatchDestroyEvent, false);
|
1720
|
-
|
1721
|
-
|
1720
|
+
let showTriggerCleanups = [];
|
1721
|
+
let closeTriggerCleanups = [];
|
1722
|
+
{
|
1723
|
+
showTriggerCleanups = listenShowTrigger();
|
1724
|
+
closeTriggerCleanups = listenCloseTrigger();
|
1725
|
+
}
|
1722
1726
|
// 旧Widget API IFの処理
|
1723
1727
|
const { onCreateHandlers } = getInternalHandlers();
|
1724
1728
|
if (onCreateHandlers) {
|