@micromag/element-call-to-action 0.3.164 → 0.3.169
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/es/index.js +24 -22
- package/lib/index.js +23 -21
- package/package.json +6 -6
package/es/index.js
CHANGED
|
@@ -172,30 +172,32 @@ function CallToAction(_ref) {
|
|
|
172
172
|
if (trackEvent !== null) {
|
|
173
173
|
trackEvent('call_to_action', isString(action) ? action : 'click', url);
|
|
174
174
|
}
|
|
175
|
-
}, [url, onClick, trackEvent, inWebView]);
|
|
176
|
-
var
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
if (
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
onClickLink(null, 'swipe');
|
|
196
|
-
}
|
|
175
|
+
}, [url, onClick, trackEvent, inWebView, openWebView]);
|
|
176
|
+
var onDrag = useCallback(function (_ref5) {
|
|
177
|
+
var event = _ref5.event;
|
|
178
|
+
// fix firefox https://use-gesture.netlify.app/docs/faq/#why-cant-i-properly-drag-an-image-or-a-link
|
|
179
|
+
event.preventDefault();
|
|
180
|
+
}, []);
|
|
181
|
+
var onDragEnd = useCallback(function (_ref6) {
|
|
182
|
+
var _ref6$movement = _slicedToArray(_ref6.movement, 2),
|
|
183
|
+
my = _ref6$movement[1];
|
|
184
|
+
|
|
185
|
+
if (my < -dragAmount) {
|
|
186
|
+
if (inWebView) {
|
|
187
|
+
onClickLink(null, 'swipe');
|
|
188
|
+
} else if (isIos() && selfTargetLinkRef.current !== null) {
|
|
189
|
+
selfTargetLinkRef.current.click();
|
|
190
|
+
setLeaving(true);
|
|
191
|
+
onClickLink(null, 'swipe');
|
|
192
|
+
} else if (buttonRef.current) {
|
|
193
|
+
buttonRef.current.click();
|
|
194
|
+
onClickLink(null, 'swipe');
|
|
197
195
|
}
|
|
198
196
|
}
|
|
197
|
+
}, [dragAmount, inWebView, onClickLink, setLeaving]);
|
|
198
|
+
var bind = useGesture({
|
|
199
|
+
onDrag: onDrag,
|
|
200
|
+
onDragEnd: onDragEnd
|
|
199
201
|
});
|
|
200
202
|
useEffect(function () {
|
|
201
203
|
var onPageHide = function onPageHide() {
|
package/lib/index.js
CHANGED
|
@@ -186,30 +186,32 @@ function CallToAction(_ref) {
|
|
|
186
186
|
if (trackEvent !== null) {
|
|
187
187
|
trackEvent('call_to_action', isString__default["default"](action) ? action : 'click', url);
|
|
188
188
|
}
|
|
189
|
-
}, [url, onClick, trackEvent, inWebView]);
|
|
190
|
-
var
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
my = _ref6$movement[1];
|
|
189
|
+
}, [url, onClick, trackEvent, inWebView, openWebView]);
|
|
190
|
+
var onDrag = React.useCallback(function (_ref5) {
|
|
191
|
+
var event = _ref5.event;
|
|
192
|
+
// fix firefox https://use-gesture.netlify.app/docs/faq/#why-cant-i-properly-drag-an-image-or-a-link
|
|
193
|
+
event.preventDefault();
|
|
194
|
+
}, []);
|
|
195
|
+
var onDragEnd = React.useCallback(function (_ref6) {
|
|
196
|
+
var _ref6$movement = _slicedToArray__default["default"](_ref6.movement, 2),
|
|
197
|
+
my = _ref6$movement[1];
|
|
199
198
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}
|
|
199
|
+
if (my < -dragAmount) {
|
|
200
|
+
if (inWebView) {
|
|
201
|
+
onClickLink(null, 'swipe');
|
|
202
|
+
} else if (utils.isIos() && selfTargetLinkRef.current !== null) {
|
|
203
|
+
selfTargetLinkRef.current.click();
|
|
204
|
+
setLeaving(true);
|
|
205
|
+
onClickLink(null, 'swipe');
|
|
206
|
+
} else if (buttonRef.current) {
|
|
207
|
+
buttonRef.current.click();
|
|
208
|
+
onClickLink(null, 'swipe');
|
|
211
209
|
}
|
|
212
210
|
}
|
|
211
|
+
}, [dragAmount, inWebView, onClickLink, setLeaving]);
|
|
212
|
+
var bind = react.useGesture({
|
|
213
|
+
onDrag: onDrag,
|
|
214
|
+
onDragEnd: onDragEnd
|
|
213
215
|
});
|
|
214
216
|
React.useEffect(function () {
|
|
215
217
|
var onPageHide = function onPageHide() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-call-to-action",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.169",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"@fortawesome/fontawesome-svg-core": "^1.2.32",
|
|
53
53
|
"@fortawesome/free-solid-svg-icons": "^5.15.1",
|
|
54
54
|
"@fortawesome/react-fontawesome": "^0.1.13",
|
|
55
|
-
"@micromag/core": "^0.3.
|
|
56
|
-
"@micromag/element-button": "^0.3.
|
|
57
|
-
"@micromag/element-text": "^0.3.
|
|
58
|
-
"@micromag/element-webview": "^0.3.
|
|
55
|
+
"@micromag/core": "^0.3.169",
|
|
56
|
+
"@micromag/element-button": "^0.3.169",
|
|
57
|
+
"@micromag/element-text": "^0.3.169",
|
|
58
|
+
"@micromag/element-webview": "^0.3.169",
|
|
59
59
|
"@react-spring/core": "^9.1.1",
|
|
60
60
|
"@react-spring/web": "^9.1.1",
|
|
61
61
|
"@use-gesture/react": "^10.2.4",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "0c1d21566e76943b0d1548cfe7f0e95380cf017c"
|
|
72
72
|
}
|