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 n(i,
|
|
1
|
+
!function n(r,i,c){function l(o,e){if(!i[o]){if(!r[o]){var t="function"==typeof require&&require;if(!e&&t)return t(o,!0);if(a)return a(o,!0);throw(e=new Error("Cannot find module '"+o+"'")).code="MODULE_NOT_FOUND",e}t=i[o]={exports:{}},r[o][0].call(t.exports,function(e){return l(r[o][1][e]||e)},t,t.exports,n,r,i,c)}return i[o].exports}for(var a="function"==typeof require&&require,e=0;e<c.length;e++)l(c[e]);return l}({1:[function(e,o,t){"use strict";var n=e("./utils/copy-to-clipboard"),r=e("./utils/helpers"),i=window.Wick||{};i.MyAccount={el:{$clipboardCode:$(".clipboard-code"),appInfo:".app-info",hideAppInfo:"app-info--hide"},clipboardCodes:{tradeProId:{titleEl:".clipboard-code.trade-pro-id .title",subtitleEl:".clipboard-code.trade-pro-id .subtitle",btnCopy:".btn--trade-pro-id"},discountCode:{titleEl:".clipboard-code.discount-code .title",subtitleEl:".clipboard-code.discount-code .subtitle",btnCopy:".btn--discount-code"}},copyCode:function(e){var e=i.MyAccount.clipboardCodes[e],o=e.titleEl,t=e.subtitleEl,e=e.btnCopy,t=$(t).text().trim(),o=$(o).text().trim();(0,n.copyToClipboard)(t,e),i.SnackBar.show({text:"".concat(o," copied to clipboard"),type:i.SnackBar.types.SUCCESS,withCloseButton:!1,autoClose:!0,delayBeforeClose:1500})},init:function(){Object.keys(i.MyAccount.clipboardCodes).forEach(function(e){var o=i.MyAccount.clipboardCodes[e].btnCopy;$(o).on("click",function(){return i.MyAccount.copyCode(e)})}),$(i.MyAccount.el.appInfo).length&&(0,r.isApp)()&&$(i.MyAccount.el.appInfo).addClass(i.MyAccount.el.hideAppInfo)}},$(document).ready(function(){i.MyAccount.el.$clipboardCode.length&&i.MyAccount.init()})},{"./utils/copy-to-clipboard":2,"./utils/helpers":3}],2:[function(e,o,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.copyToClipboard=function(e,o){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},e=function(e,o){e=null==e?"":e+"";return(o.noUpperCase?e:e.replace(/(^\w|\s\w)/g,function(e){return e.toUpperCase()})).split(" ").filter(function(e){return""!==e}).join(" ").trim()}(e,t);if(!e)return Promise.reject(new Error("Empty text"));if(null!=(t=window.webkit)&&null!=(t=t.messageHandlers)&&t.copy)try{return window.webkit.messageHandlers.copy.postMessage(e),Promise.resolve(!0)}catch(e){console.error(e)}if(null!=(t=window.Android)&&t.copyToClipboard&&"function"==typeof window.Android.copyToClipboard)try{return window.Android.copyToClipboard(e),Promise.resolve(!0)}catch(e){console.error(e)}if(null!=(t=navigator.clipboard)&&t.writeText)return navigator.clipboard.writeText(e).then(function(){return!0});return function(a,u){return new Promise(function(e,o){try{var t,n=$(u).parent(),r=$("<textarea>").val(a).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(r),r.get(0)),c=(i.focus(),(i.value||"").length),l=("function"==typeof i.setSelectionRange?i.setSelectionRange(0,c):r.select(),document.execCommand("copy"));r.remove(),window.getSelection&&(t=window.getSelection())&&t.removeAllRanges&&t.removeAllRanges(),l?e(!0):o(new Error("execCommand failed"))}catch(e){o(e)}})}(e,o)}},{}],3:[function(e,o,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.countLetters=function(e){e=e.match(/[a-zA-Z]/g);return e?e.length:0},t.createImageElements=function(e,o){return e.map(function(e){return $("<img>").attr("src",e).attr("alt",o)})},t.highlightCharacter=function(e,o,t){return e.includes(o)?(o=new RegExp("\\".concat(o,"+"),"g"),t='<span class="'.concat(t,'">$&</span>'),e.replace(o,t)):e},t.isApp=function(){return navigator.userAgent.match(/TradeProMobile_iOS|TradeProMobile_Android|DIYMobile_iOS|DIYMobile_Android|DIYApp_Guest_Mobile_iOS|DIYApp_Guest_Mobile_Android|AGENT_PLACEHOLDER/i)},t.isHasSymbol=function(e,o){return e.includes(o)},t.isKeyboardOpen=function(){var e=window.innerHeight,o=window.visualViewport.height;return e!==o},t.isTouchDevice=function(){return"ontouchstart"in window},t.scrollToElement=function(e){var o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:20,e=$(e);0<e.length&&$("html, body").animate({scrollTop:e.offset().top-o},300)},t.scrollToTop=function(e){e.scrollTop(0)},t.trimFields=function(){Wick.AddressBook.getFieldsConfigurations().forEach(function(e){var o=e.input.val().trim();e.input.val(o)})}},{}]},{},[1]);
|
|
@@ -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
|
}
|