wickes-css2 2.105.0-develop.4 → 2.105.0-develop.6
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/build/css/pages/tradePro-rewards.css +1 -1
- package/build/js/basket.min.js +1 -1
- package/build/js/bundle.min.js +1 -1
- package/build/js/checkout.min.js +1 -1
- package/build/js/emulation.min.js +3 -2
- package/build/js/general.bundle.min.js +1 -1
- package/build/js/merged-checkout.min.js +1 -1
- package/build/js/my-account.min.js +1 -1
- package/build/js/page/share-project-list.js +57 -0
- package/build/js/page/tradePro-rewards.js +69 -39
- package/build/js/page/utils/copy-to-clipboard.js +79 -47
- package/build/js/pdp.bundle.min.js +1 -1
- package/build/js/plp.bundle.min.js +1 -1
- package/build/js/project-list.min.js +143 -85
- package/build/js/tradePro-rewards.min.js +1 -1
- package/package.json +1 -1
- package/src/components/.DS_Store +0 -0
- package/src/js/components/general/accordion.js +5 -3
- package/src/js/emulation/project-list-pdp.js +2 -3
- package/src/js/page/share-project-list.js +57 -0
- package/src/js/page/tradePro-rewards.js +69 -39
- package/src/js/page/utils/copy-to-clipboard.js +79 -47
- package/src/page_empty-shared-project-list-bicester-hub.html +1 -0
- package/src/page_empty-shopping-list_guest.html +1 -0
- package/src/page_my-shopping-list-add-notes.html +1 -0
- package/src/page_my-shopping-list-energy.html +1 -0
- package/src/page_my-shopping-list-hide-download.html +2 -1
- package/src/page_my-shopping-list-pdf.html +2 -0
- package/src/page_my-shopping-list-saved-ref.html +1 -0
- package/src/page_my-shopping-list-wisdom-oos-registered.html +1 -0
- package/src/page_my-shopping-list-wisdom-oos.html +1 -0
- package/src/page_my-shopping-list-wisdom-partial-registered.html +1 -0
- package/src/page_my-shopping-list-wisdom-registered.html +1 -0
- package/src/page_my-shopping-list-wisdom.html +1 -0
- package/src/page_my-shopping-list.html +1 -0
- package/src/page_my-shopping-list_not-register.html +3 -0
- package/src/page_project-list-generate-project-list-ID.html +3 -0
- package/src/page_project-list-vat.html +4 -0
- package/src/page_project-list-with-new-share-popup-android.html +2 -1
- package/src/page_project-list-with-new-share-popup-ios.html +2 -1
- package/src/page_project-list-with-new-share-popup.html +1 -1
- package/src/page_shared-project-list-bicester-hub.html +2 -1
- package/src/scss/pages/tradePro-rewards.scss +1 -1
- package/build/js/plp-filters.min.js +0 -9
- package/build/js/search-filter.min.js +0 -1
- package/src/js/components/share-project-list.js +0 -53
|
@@ -1 +1 @@
|
|
|
1
|
-
!function o(n,a,i){function d(t,e){if(!a[t]){if(!n[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(c)return c(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}r=a[t]={exports:{}},n[t][0].call(r.exports,function(e){return d(n[t][1][e]||e)},r,r.exports,o,n,a,i)}return a[t].exports}for(var c="function"==typeof require&&require,e=0;e<i.length;e++)d(i[e]);return d}({1:[function(e,t,r){"use strict";var o=e("./utils/copy-to-clipboard"),n=window.Wick||{};n.TradeProRewards={el:{$tradeProRewards:$(".page_tradePro-rewards"),buttonSelector:".copy-tradePro-barcode"},message:"Code copied to clipboard",copyToClipboardInit:function(){n.SnackBar.init(),$(n.TradeProRewards.el.buttonSelector).on("click",function(e){e.preventDefault(),e.stopPropagation();var t=$(this).parent().find("input"),r=t.val().trim();return t.removeAttr("disabled").attr("readonly","readonly"),(0,o.copyToClipboard)(r,e.currentTarget,{noUpperCase:!0}),t.attr("disabled","disabled").removeAttr("readonly"),window.getSelection().removeAllRanges(),n.SnackBar.show({text:n.TradeProRewards.message,type:n.SnackBar.types.SUCCESS,withCloseButton:!1,autoClose:!0,delayBeforeClose:3e3}),!1})},init:function(){n.TradeProRewards.copyToClipboardInit()}},$(document).ready(function(){n.TradeProRewards.el.$tradeProRewards.length&&n.TradeProRewards.init()})},{"./utils/copy-to-clipboard":2}],2:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.copyToClipboard=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},o=$("<textarea>").css({position:"absolute",top:0,left:0,opacity:0});$(t).parent().append(o),t=r.noUpperCase?e:e.replace(/(^\w|\s\w)/g,function(e){return e.toUpperCase()});r=t.split(" ").filter(function(e){return""!==e}).join(" ");o.val(r),navigator.userAgent.match(/TradeProMobile_iOS|DIYMobile_iOS/i)?function(e){var e=e.get(0),t=e.contentEditable,r=e.readOnly,o=document.createRange(),n=window.getSelection();e.contentEditable=!0,e.readOnly=!1,o.selectNodeContents(e),n.removeAllRanges(),n.addRange(o),e.setSelectionRange(0,999999),e.contentEditable=t,e.readOnly=r}(o):navigator.userAgent.match(/ipad|ipod|iphone/i)?(o.select(),o[0].setSelectionRange(0,999999)):o.select();document.execCommand("copy"),o.remove()}},{}]},{},[1]);
|
|
1
|
+
!function n(o,i,a){function c(e,t){if(!i[e]){if(!o[e]){var r="function"==typeof require&&require;if(!t&&r)return r(e,!0);if(u)return u(e,!0);throw(t=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",t}r=i[e]={exports:{}},o[e][0].call(r.exports,function(t){return c(o[e][1][t]||t)},r,r.exports,n,o,i,a)}return i[e].exports}for(var u="function"==typeof require&&require,t=0;t<a.length;t++)c(a[t]);return c}({1:[function(t,e,r){"use strict";function L(t){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var u=t("./utils/copy-to-clipboard");function S(){S=function(){return a};var a={},t=Object.prototype,u=t.hasOwnProperty,l=Object.defineProperty||function(t,e,r){t[e]=r.value},e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(t){i=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o,i,a,c,e=e&&e.prototype instanceof p?e:p,e=Object.create(e.prototype),n=new x(n||[]);return l(e,"_invoke",{value:(o=t,i=r,a=n,c="suspendedStart",function(t,e){if("executing"===c)throw new Error("Generator is already running");if("completed"===c){if("throw"===t)throw e;return{value:void 0,done:!0}}for(a.method=t,a.arg=e;;){var r=a.delegate;if(r){r=function t(e,r){var n=r.method,o=e.iterator[n];if(void 0===o)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=void 0,t(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;n=s(o,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,f;o=n.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,f):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}(r,a);if(r){if(r===f)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===c)throw c="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c="executing";r=s(o,i,a);if("normal"===r.type){if(c=a.done?"completed":"suspendedYield",r.arg===f)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(c="completed",a.method="throw",a.arg=r.arg)}})}),e}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=c;var f={};function p(){}function d(){}function h(){}var e={},y=(i(e,n,function(){return this}),Object.getPrototypeOf),y=y&&y(y(E([]))),v=(y&&y!==t&&u.call(y,n)&&(e=y),h.prototype=p.prototype=Object.create(e));function g(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function w(a,c){var e;l(this,"_invoke",{value:function(r,n){function t(){return new c(function(t,e){!function e(t,r,n,o){var i,t=s(a[t],a,r);if("throw"!==t.type)return(r=(i=t.arg).value)&&"object"==L(r)&&u.call(r,"__await")?c.resolve(r.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):c.resolve(r).then(function(t){i.value=t,n(i)},function(t){return e("throw",t,n,o)});o(t.arg)}(r,n,t,e)})}return e=e?e.then(t,t):t()}})}function m(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function b(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(m,this),this.reset(!0)}function E(e){if(e||""===e){var r,t=e[n];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return r=-1,(t=function t(){for(;++r<e.length;)if(u.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}throw new TypeError(L(e)+" is not iterable")}return l(v,"constructor",{value:d.prototype=h,configurable:!0}),l(h,"constructor",{value:d,configurable:!0}),d.displayName=i(h,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,i(t,o,"GeneratorFunction")),t.prototype=Object.create(v),t},a.awrap=function(t){return{__await:t}},g(w.prototype),i(w.prototype,r,function(){return this}),a.AsyncIterator=w,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new w(c(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},g(v),i(v,o,"Generator"),i(v,n,function(){return this}),i(v,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,r=Object(t),n=[];for(e in r)n.push(e);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=E,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!t)for(var e in this)"t"===e.charAt(0)&&u.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function t(t,e){return i.type="throw",i.arg=r,n.next=t,e&&(n.method="next",n.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=u.call(o,"catchLoc"),c=u.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&u.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}var i=(o=o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc?null:o)?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),b(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r,n,o=this.tryEntries[e];if(o.tryLoc===t)return"throw"===(r=o.completion).type&&(n=r.arg,b(o)),n}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},a}function l(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}var s=window.Wick||{};s.TradeProRewards={el:{$tradeProRewards:$(".page_tradePro-rewards"),buttonSelector:".copy-tradePro-barcode"},message:"Code copied to clipboard",errorMessage:"Unable to copy. Please copy manually",copyToClipboardInit:function(){s.SnackBar.init(),$(document).on("click",s.TradeProRewards.el.buttonSelector,function(){c=S().mark(function t(e){var r,n,o,i,a;return S().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e.preventDefault(),e.stopPropagation(),o=$(this),(o=o.parent().find("input")).length){t.next=6;break}return t.abrupt("return",!1);case 6:if(i=(o.val()||"").trim()){t.next=9;break}return t.abrupt("return",!1);case 9:return o.removeAttr("disabled").attr("readonly","readonly"),t.prev=10,t.next=13,(0,u.copyToClipboard)(i,e.currentTarget,{noUpperCase:!0});case 13:s.SnackBar.show({text:s.TradeProRewards.message,type:s.SnackBar.types.SUCCESS,withCloseButton:!1,autoClose:!0,delayBeforeClose:3e3}),t.next=20;break;case 16:t.prev=16,t.t0=t.catch(10);try{(a=o.get(0)).focus(),a.select(),a.setSelectionRange(0,999999)}catch(t){console.error(t)}s.SnackBar.show({text:s.TradeProRewards.errorMessage,type:s.SnackBar.types.ERROR,withCloseButton:!1,autoClose:!0,delayBeforeClose:4e3});case 20:return o.attr("disabled","disabled").removeAttr("readonly"),null!=(r=window.getSelection())&&null!=(n=r.removeAllRanges)&&n.call(r),t.abrupt("return",!1);case 23:case"end":return t.stop()}},t,this,[[10,16]])});var c,e=function(){var t=this,a=arguments;return new Promise(function(e,r){var n=c.apply(t,a);function o(t){l(n,e,r,o,i,"next",t)}function i(t){l(n,e,r,o,i,"throw",t)}o(void 0)})};return function(t){return e.apply(this,arguments)}}())},init:function(){s.TradeProRewards.copyToClipboardInit()}},$(document).ready(function(){s.TradeProRewards.el.$tradeProRewards.length&&s.TradeProRewards.init()})},{"./utils/copy-to-clipboard":2}],2:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.copyToClipboard=function(t,e){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},t=function(t,e){t=null==t?"":t+"";return(e.noUpperCase?t:t.replace(/(^\w|\s\w)/g,function(t){return t.toUpperCase()})).split(" ").filter(function(t){return""!==t}).join(" ").trim()}(t,r);if(!t)return Promise.reject(new Error("Empty text"));if(null!=(r=window.webkit)&&null!=(r=r.messageHandlers)&&r.copy)try{return window.webkit.messageHandlers.copy.postMessage(t),Promise.resolve(!0)}catch(t){console.error(t)}if(null!=(r=window.Android)&&r.copyToClipboard&&"function"==typeof window.Android.copyToClipboard)try{return window.Android.copyToClipboard(t),Promise.resolve(!0)}catch(t){console.error(t)}if(null!=(r=navigator.clipboard)&&r.writeText)return navigator.clipboard.writeText(t).then(function(){return!0});return function(u,l){return new Promise(function(t,e){try{var r,n=$(l).parent(),o=$("<textarea>").val(u).attr("readonly","readonly").css({position:"fixed",top:0,left:"-9999px",opacity:0,width:"1px",height:"1px",padding:0,border:0,margin:0}),i=(n.append(o),o.get(0)),a=(i.focus(),(i.value||"").length),c=("function"==typeof i.setSelectionRange?i.setSelectionRange(0,a):o.select(),document.execCommand("copy"));o.remove(),window.getSelection&&(r=window.getSelection())&&r.removeAllRanges&&r.removeAllRanges(),c?t(!0):e(new Error("execCommand failed"))}catch(t){e(t)}})}(t,e)}},{}]},{},[1]);
|
package/package.json
CHANGED
package/src/components/.DS_Store
CHANGED
|
Binary file
|
|
@@ -12,11 +12,13 @@ Wick.Accordion = (function () {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
function onAccordionClick(e) {
|
|
15
|
-
var $
|
|
15
|
+
var $trigger = $(e.currentTarget);
|
|
16
|
+
var $acc = $trigger.closest(accordionRoot);
|
|
16
17
|
if (!$acc.length) return;
|
|
17
18
|
|
|
18
|
-
var
|
|
19
|
-
|
|
19
|
+
var triggerSel = getTriggerSelector($acc);
|
|
20
|
+
|
|
21
|
+
if (!$trigger.is(triggerSel)) return;
|
|
20
22
|
|
|
21
23
|
$acc.toggleClass(collapsed);
|
|
22
24
|
$acc.children(accordionContent).stop(true, true).slideToggle(200);
|
|
@@ -307,11 +307,10 @@ function returnSuccessGetPayload(currentPage) {
|
|
|
307
307
|
|
|
308
308
|
$(document).ready(function () {
|
|
309
309
|
function init() {
|
|
310
|
-
if (!$('.shop-list-modal').length) {
|
|
310
|
+
if (!$('.shop-list-modal').length || !Wick.SavingShoppingList) {
|
|
311
311
|
return;
|
|
312
312
|
}
|
|
313
|
-
|
|
314
|
-
$(Wick.SavingShoppingList.el.modalSavingToShopList).on(
|
|
313
|
+
$(Wick.SavingShoppingList?.el.modalSavingToShopList).on(
|
|
315
314
|
'show.bs.modal',
|
|
316
315
|
Wick.SavingShoppingList.init
|
|
317
316
|
);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { copyToClipboard } from './utils/copy-to-clipboard';
|
|
2
|
+
|
|
3
|
+
var Wick = Wick || {};
|
|
4
|
+
Wick.ShareProjectList = (function () {
|
|
5
|
+
function init() {
|
|
6
|
+
var $input = $('#share-list-modal #shopping-list-link');
|
|
7
|
+
var linkContainer = $('#copy-link');
|
|
8
|
+
var $actualLink = linkContainer.find('a');
|
|
9
|
+
var copyClass = 'copy-link_hovered';
|
|
10
|
+
|
|
11
|
+
$actualLink.on('click', function (e) {
|
|
12
|
+
e.preventDefault();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
function focusAndSelectInput() {
|
|
16
|
+
if (!$input.length) return;
|
|
17
|
+
|
|
18
|
+
var el = $input.get(0);
|
|
19
|
+
|
|
20
|
+
$input.removeAttr('disabled');
|
|
21
|
+
|
|
22
|
+
el.focus();
|
|
23
|
+
|
|
24
|
+
var len = (el.value || '').length;
|
|
25
|
+
if (typeof el.setSelectionRange === 'function') {
|
|
26
|
+
el.setSelectionRange(0, len);
|
|
27
|
+
} else if (typeof el.select === 'function') {
|
|
28
|
+
el.select();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
linkContainer.on('click', function (e) {
|
|
33
|
+
e.preventDefault();
|
|
34
|
+
|
|
35
|
+
focusAndSelectInput();
|
|
36
|
+
|
|
37
|
+
var value = ($input.val() || '').trim();
|
|
38
|
+
if (!value) return;
|
|
39
|
+
|
|
40
|
+
copyToClipboard(value, linkContainer[0], { noUpperCase: true })
|
|
41
|
+
.then(function () {
|
|
42
|
+
$actualLink.addClass(copyClass);
|
|
43
|
+
})
|
|
44
|
+
.catch(function (e) {
|
|
45
|
+
console.error(e);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
$input.on('click', function (e) {
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
focusAndSelectInput();
|
|
52
|
+
$actualLink.removeClass(copyClass);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
init();
|
|
57
|
+
})();
|
|
@@ -1,46 +1,76 @@
|
|
|
1
|
-
import {copyToClipboard} from
|
|
1
|
+
import { copyToClipboard } from './utils/copy-to-clipboard';
|
|
2
2
|
|
|
3
3
|
var Wick = window.Wick || {};
|
|
4
4
|
|
|
5
5
|
Wick.TradeProRewards = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
6
|
+
el: {
|
|
7
|
+
$tradeProRewards: $('.page_tradePro-rewards'),
|
|
8
|
+
buttonSelector: '.copy-tradePro-barcode',
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
message: 'Code copied to clipboard',
|
|
12
|
+
errorMessage: 'Unable to copy. Please copy manually',
|
|
13
|
+
|
|
14
|
+
copyToClipboardInit() {
|
|
15
|
+
Wick.SnackBar.init();
|
|
16
|
+
|
|
17
|
+
$(document).on('click', Wick.TradeProRewards.el.buttonSelector, async function (e) {
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
e.stopPropagation();
|
|
20
|
+
|
|
21
|
+
const $btn = $(this);
|
|
22
|
+
const $input = $btn.parent().find('input');
|
|
23
|
+
|
|
24
|
+
if (!$input.length) return false;
|
|
25
|
+
|
|
26
|
+
const discountCodeValue = ($input.val() || '').trim();
|
|
27
|
+
if (!discountCodeValue) return false;
|
|
28
|
+
|
|
29
|
+
$input.removeAttr('disabled').attr('readonly', 'readonly');
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
await copyToClipboard(discountCodeValue, e.currentTarget, { noUpperCase: true });
|
|
33
|
+
|
|
34
|
+
Wick.SnackBar.show({
|
|
35
|
+
text: Wick.TradeProRewards.message,
|
|
36
|
+
type: Wick.SnackBar.types.SUCCESS,
|
|
37
|
+
withCloseButton: false,
|
|
38
|
+
autoClose: true,
|
|
39
|
+
delayBeforeClose: 3000,
|
|
40
|
+
});
|
|
41
|
+
} catch (err) {
|
|
42
|
+
try {
|
|
43
|
+
const el = $input.get(0);
|
|
44
|
+
el.focus();
|
|
45
|
+
el.select();
|
|
46
|
+
el.setSelectionRange(0, 999999);
|
|
47
|
+
} catch (e) {
|
|
48
|
+
console.error(e);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
Wick.SnackBar.show({
|
|
52
|
+
text: Wick.TradeProRewards.errorMessage,
|
|
53
|
+
type: Wick.SnackBar.types.ERROR,
|
|
54
|
+
withCloseButton: false,
|
|
55
|
+
autoClose: true,
|
|
56
|
+
delayBeforeClose: 4000,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
$input.attr('disabled', 'disabled').removeAttr('readonly');
|
|
61
|
+
window.getSelection()?.removeAllRanges?.();
|
|
62
|
+
|
|
63
|
+
return false;
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
init() {
|
|
68
|
+
Wick.TradeProRewards.copyToClipboardInit();
|
|
69
|
+
},
|
|
70
|
+
};
|
|
41
71
|
|
|
42
72
|
$(document).ready(function () {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
73
|
+
if (Wick.TradeProRewards.el.$tradeProRewards.length) {
|
|
74
|
+
Wick.TradeProRewards.init();
|
|
75
|
+
}
|
|
46
76
|
});
|
|
@@ -1,56 +1,88 @@
|
|
|
1
1
|
export function copyToClipboard(copyValue, currentSelector, options = {}) {
|
|
2
|
-
|
|
3
|
-
position: 'absolute',
|
|
4
|
-
top: 0,
|
|
5
|
-
left: 0,
|
|
6
|
-
opacity: 0
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
$(currentSelector).parent().append($temp);
|
|
10
|
-
|
|
11
|
-
let str;
|
|
12
|
-
if (options.noUpperCase) {
|
|
13
|
-
str = copyValue;
|
|
14
|
-
} else {
|
|
15
|
-
str = copyValue.replace(/(^\w|\s\w)/g, function (m) {
|
|
16
|
-
return m.toUpperCase()
|
|
17
|
-
});
|
|
18
|
-
}
|
|
2
|
+
const textTrimmed = normalizeCopyText(copyValue, options);
|
|
19
3
|
|
|
20
|
-
|
|
21
|
-
return value !== ''
|
|
22
|
-
});
|
|
4
|
+
if (!textTrimmed) return Promise.reject(new Error('Empty text'));
|
|
23
5
|
|
|
24
|
-
|
|
6
|
+
// 1) iOS app bridge (WKWebView)
|
|
7
|
+
if (window.webkit?.messageHandlers?.copy) {
|
|
8
|
+
try {
|
|
9
|
+
window.webkit.messageHandlers.copy.postMessage(textTrimmed);
|
|
10
|
+
return Promise.resolve(true);
|
|
11
|
+
} catch (e) {
|
|
12
|
+
console.error(e);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
25
15
|
|
|
26
|
-
|
|
16
|
+
// 2) Android app bridge
|
|
17
|
+
if (window.Android?.copyToClipboard && typeof window.Android.copyToClipboard === 'function') {
|
|
18
|
+
try {
|
|
19
|
+
window.Android.copyToClipboard(textTrimmed);
|
|
20
|
+
return Promise.resolve(true);
|
|
21
|
+
} catch (e) {
|
|
22
|
+
console.error(e);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
$temp.select();
|
|
32
|
-
$temp[0].setSelectionRange(0, 999999);
|
|
33
|
-
} else {
|
|
34
|
-
$temp.select();
|
|
35
|
-
}
|
|
26
|
+
if (navigator.clipboard?.writeText) {
|
|
27
|
+
return navigator.clipboard.writeText(textTrimmed).then(() => true);
|
|
28
|
+
}
|
|
36
29
|
|
|
37
|
-
|
|
38
|
-
$temp.remove();
|
|
30
|
+
return legacyExecCommandCopy(textTrimmed, currentSelector);
|
|
39
31
|
}
|
|
40
32
|
|
|
41
|
-
function
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
33
|
+
function normalizeCopyText(copyValue, options) {
|
|
34
|
+
let raw = copyValue == null ? '' : copyValue + '';
|
|
35
|
+
|
|
36
|
+
const str = options.noUpperCase ? raw : raw.replace(/(^\w|\s\w)/g, (m) => m.toUpperCase());
|
|
37
|
+
|
|
38
|
+
return str
|
|
39
|
+
.split(' ')
|
|
40
|
+
.filter((v) => v !== '')
|
|
41
|
+
.join(' ')
|
|
42
|
+
.trim();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function legacyExecCommandCopy(text, currentSelector) {
|
|
46
|
+
return new Promise(function (resolve, reject) {
|
|
47
|
+
try {
|
|
48
|
+
let $parent = $(currentSelector).parent();
|
|
49
|
+
|
|
50
|
+
let $temp = $('<textarea>').val(text).attr('readonly', 'readonly').css({
|
|
51
|
+
position: 'fixed',
|
|
52
|
+
top: 0,
|
|
53
|
+
left: '-9999px',
|
|
54
|
+
opacity: 0,
|
|
55
|
+
width: '1px',
|
|
56
|
+
height: '1px',
|
|
57
|
+
padding: 0,
|
|
58
|
+
border: 0,
|
|
59
|
+
margin: 0,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
$parent.append($temp);
|
|
63
|
+
|
|
64
|
+
let el = $temp.get(0);
|
|
65
|
+
|
|
66
|
+
el.focus();
|
|
67
|
+
let len = (el.value || '').length;
|
|
68
|
+
if (typeof el.setSelectionRange === 'function') {
|
|
69
|
+
el.setSelectionRange(0, len);
|
|
70
|
+
} else {
|
|
71
|
+
$temp.select();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
let ok = document.execCommand('copy');
|
|
75
|
+
|
|
76
|
+
$temp.remove();
|
|
77
|
+
|
|
78
|
+
if (window.getSelection) {
|
|
79
|
+
let sel = window.getSelection();
|
|
80
|
+
if (sel && sel.removeAllRanges) sel.removeAllRanges();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
ok ? resolve(true) : reject(new Error('execCommand failed'));
|
|
84
|
+
} catch (e) {
|
|
85
|
+
reject(e);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
56
88
|
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
</main>
|
|
8
8
|
{{/content}}
|
|
9
9
|
{{#content "foot" mode="append"}}
|
|
10
|
-
<script src="./js/project-list
|
|
10
|
+
<script defer src="./js/project-list.min.js"></script>
|
|
11
|
+
<script defer src="./js/share-project-list.min.js"></script>
|
|
11
12
|
{{/content}}
|
|
12
13
|
{{/extend}}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
{{> shopping-list emptyShopList=false isUserRegister=true pagination=true ref=true wisdom=true available=0}}
|
|
7
7
|
</main>
|
|
8
8
|
<script defer src="./js/page/project-list.js"></script>
|
|
9
|
+
<script defer src="./js/share-project-list.min.js"></script>
|
|
9
10
|
{{/content}}
|
|
10
11
|
{{#content "foot" mode="append"}}
|
|
11
12
|
{{> wisdom-modal available=0 current=5}}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
{{> shopping-list emptyShopList=false isUserRegister=false pagination=true ref=true wisdom=true available=0}}
|
|
7
7
|
</main>
|
|
8
8
|
<script defer src="./js/page/project-list.js"></script>
|
|
9
|
+
<script defer src="./js/share-project-list.min.js"></script>
|
|
9
10
|
{{/content}}
|
|
10
11
|
{{#content "foot" mode="append"}}
|
|
11
12
|
{{> wisdom-modal available=0 current=5}}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
{{> shopping-list emptyShopList=false isUserRegister=true pagination=true ref=true wisdom=true available=10}}
|
|
7
7
|
</main>
|
|
8
8
|
<script defer src="./js/page/project-list.js"></script>
|
|
9
|
+
<script defer src="./js/share-project-list.min.js"></script>
|
|
9
10
|
{{/content}}
|
|
10
11
|
{{#content "foot" mode="append"}}
|
|
11
12
|
{{> wisdom-modal available=12 current=15}}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
{{> shopping-list emptyShopList=false isUserRegister=true pagination=true ref=true wisdom=true available=10}}
|
|
7
7
|
</main>
|
|
8
8
|
<script defer src="./js/page/project-list.js"></script>
|
|
9
|
+
<script defer src="./js/share-project-list.min.js"></script>
|
|
9
10
|
{{/content}}
|
|
10
11
|
{{#content "foot" mode="append"}}
|
|
11
12
|
{{> wisdom-modal available=12 current=5}}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
{{> shopping-list emptyShopList=false isUserRegister=false pagination=true ref=true wisdom=true available=10}}
|
|
7
7
|
</main>
|
|
8
8
|
<script defer src="./js/page/project-list.js"></script>
|
|
9
|
+
<script defer src="./js/share-project-list.min.js"></script>
|
|
9
10
|
{{/content}}
|
|
10
11
|
{{#content "foot" mode="append"}}
|
|
11
12
|
{{> wisdom-modal available=12 current=5}}
|
|
@@ -9,5 +9,6 @@
|
|
|
9
9
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.9.1/html2pdf.bundle.min.js"
|
|
10
10
|
integrity="sha512-1qLXyA3x0VSWeM+8vOotn6+KIRGdcQ8QMzsNeDXmdJsUAnoDGjzlxzqAuUGJGrGkGrtOrq4buDoAHxR89D9PWA=="
|
|
11
11
|
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
|
12
|
+
<script defer src="./js/share-project-list.min.js"></script>
|
|
12
13
|
{{/content}}
|
|
13
14
|
{{/extend}}
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
<main>
|
|
6
6
|
{{> shopping-list emptyShopList=false pagination=true}}
|
|
7
7
|
</main>
|
|
8
|
+
{{/content}}
|
|
9
|
+
{{#content "foot" mode="append"}}
|
|
8
10
|
<script defer src="./js/page/project-list.js"></script>
|
|
11
|
+
<script defer src="./js/share-project-list.min.js"></script>
|
|
9
12
|
{{/content}}
|
|
10
13
|
{{/extend}}
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
</main>
|
|
9
9
|
{{/content}}
|
|
10
10
|
{{#content "foot" mode="append"}}
|
|
11
|
-
<script src="./js/project-list
|
|
11
|
+
<script src="./js/project-list.min.js"></script>
|
|
12
|
+
<script defer src="./js/share-project-list.min.js"></script>
|
|
12
13
|
<script async src="https://static.addtoany.com/menu/page.js"></script>
|
|
13
14
|
<script defer src="./js/saving-shopping-list.min.js"></script>
|
|
14
15
|
{{/content}}
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
</main>
|
|
9
9
|
{{/content}}
|
|
10
10
|
{{#content "foot" mode="append"}}
|
|
11
|
-
<script src="./js/project-list
|
|
11
|
+
<script src="./js/project-list.min.js"></script>
|
|
12
|
+
<script defer src="./js/share-project-list.min.js"></script>
|
|
12
13
|
<script async src="https://static.addtoany.com/menu/page.js"></script>
|
|
13
14
|
<script defer src="./js/saving-shopping-list.min.js"></script>
|
|
14
15
|
{{/content}}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
</main>
|
|
9
9
|
{{/content}}
|
|
10
10
|
{{#content "foot" mode="append"}}
|
|
11
|
-
<script src="./js/project-list
|
|
11
|
+
<script defer src="./js/project-list.min.js"></script>
|
|
12
12
|
<script async src="https://static.addtoany.com/menu/page.js"></script>
|
|
13
13
|
<script defer src="./js/saving-shopping-list.min.js"></script>
|
|
14
14
|
{{/content}}
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
</main>
|
|
10
10
|
{{/content}}
|
|
11
11
|
{{#content "foot" mode="append"}}
|
|
12
|
-
<script src="./js/project-list
|
|
12
|
+
<script defer src="./js/project-list.min.js"></script>
|
|
13
|
+
<script defer src="./js/share-project-list.min.js"></script>
|
|
13
14
|
<script defer src="./js/global-search.min.js"></script>
|
|
14
15
|
<script defer src="./js/saving-shopping-list.min.js"></script>
|
|
15
16
|
{{/content}}
|