wickes-css2 2.117.0-gift-cards.2 → 2.117.1-develop.1

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.
Files changed (102) hide show
  1. package/Readme.md +1 -0
  2. package/build/css/category-main.css +1 -1
  3. package/build/css/components/checkout-payment-details-v2.css +1 -1
  4. package/build/css/homepage-main.css +1 -1
  5. package/build/css/kitchen-plp-main.css +1 -1
  6. package/build/css/main.css +1 -1
  7. package/build/css/my-account-main-v2.css +1 -1
  8. package/build/css/my-account-main.css +1 -1
  9. package/build/css/pages/checkout-new.css +1 -1
  10. package/build/css/pages/checkout.css +1 -1
  11. package/build/css/pages/page_my-order.css +1 -1
  12. package/build/css/pages/page_wismo-details.css +1 -1
  13. package/build/css/pdp-main-before-combine.css +1 -1
  14. package/build/css/pdp-main-critical.css +1 -1
  15. package/build/css/pdp-main-non-critical.css +1 -1
  16. package/build/css/pdp-main.css +1 -1
  17. package/build/css/plp-main.css +1 -1
  18. package/build/css/store-locator-main.css +1 -1
  19. package/build/js/account-members.min.js +1 -1
  20. package/build/js/add-project-list-id.min.js +1 -1
  21. package/build/js/address-book.min.js +1 -1
  22. package/build/js/basket.min.js +2 -2
  23. package/build/js/bundle.min.js +1 -1
  24. package/build/js/change-password.min.js +1 -1
  25. package/build/js/checkout.min.js +2 -2
  26. package/build/js/emulation.min.js +83 -425
  27. package/build/js/general.bundle.min.js +1 -1
  28. package/build/js/gift-cards.min.js +1 -1
  29. package/build/js/merged-checkout.min.js +2 -2
  30. package/build/js/page/bloomreach-widget/bloomreach-widget-core.js +3 -1
  31. package/build/js/page/checkout-payment-details.js +10 -114
  32. package/build/js/page/components/gift-cards.js +115 -524
  33. package/build/js/page/ripple/bulk-add.js +2 -2
  34. package/build/js/page/ripple/thumb-gallery.js +8 -14
  35. package/build/js/page/utils/validation.js +1 -54
  36. package/build/js/pdp.bundle.min.js +2 -2
  37. package/build/js/personal-details.min.js +1 -1
  38. package/build/js/plp.bundle.min.js +1 -1
  39. package/build/js/postcode-checker.min.js +1 -1
  40. package/build/js/project-list.min.js +2 -57
  41. package/build/js/quiz.min.js +1 -1
  42. package/build/js/track-my-order.min.js +1 -1
  43. package/package.json +1 -5
  44. package/src/components/checkout-payment-details-v2.hbs +0 -1
  45. package/src/components/checkout_order-summary-new.hbs +0 -6
  46. package/src/components/checkout_payment-new.hbs +8 -35
  47. package/src/components/gift-cards.hbs +15 -8
  48. package/src/components/payments.hbs +6 -7
  49. package/src/components/wismo-payment.hbs +0 -10
  50. package/src/data/data_delivery-address-v2.json +0 -4
  51. package/src/data/data_payments-checkout.json +0 -4
  52. package/src/data/data_wismo.json +1 -46
  53. package/src/data/footer_menu.json +0 -4
  54. package/src/elements/input.hbs +1 -3
  55. package/src/js/components/general/footer.js +56 -63
  56. package/src/js/emulation/checkout-payment-details.js +0 -2
  57. package/src/js/emulation/gift-cards.js +1 -23
  58. package/src/js/emulation/mock.js +20 -21
  59. package/src/js/emulation/postcode-checker.js +1 -1
  60. package/src/js/page/bloomreach-widget/bloomreach-widget-core.js +3 -1
  61. package/src/js/page/checkout-payment-details.js +10 -114
  62. package/src/js/page/components/gift-cards.js +115 -524
  63. package/src/js/page/ripple/bulk-add.js +2 -2
  64. package/src/js/page/ripple/thumb-gallery.js +8 -14
  65. package/src/js/page/utils/validation.js +1 -54
  66. package/src/page_product-details-billie.html +0 -2
  67. package/src/page_product-details-clearpay.html +0 -1
  68. package/src/scss/common/_CTAs.scss +0 -4
  69. package/src/scss/components/_gift-cards.scss +9 -66
  70. package/src/scss/components/_payments-checkout.scss +2 -2
  71. package/src/scss/components/_payments-v2.scss +7 -5
  72. package/src/scss/components/checkout-payment-details-v2.scss +0 -1
  73. package/src/scss/helpers/_CTAs.scss +0 -26
  74. package/src/scss/helpers/_variables.scss +0 -2
  75. package/src/scss/pages/_checkout-confirmation-new.scss +3 -96
  76. package/src/scss/pages/page_wismo-details.scss +0 -29
  77. package/src/sitemap.html +0 -24
  78. package/build/img/payment/checkout/giftcard.svg +0 -28
  79. package/build/img/payment/footer/giftcard.svg +0 -28
  80. package/build/js/page/components/postcode-lookup/postcode-lookup-api.js +0 -56
  81. package/build/js/page/components/postcode-lookup/postcode-lookup-render.js +0 -98
  82. package/build/js/page/components/postcode-lookup/postcode-lookup-validation.js +0 -81
  83. package/build/js/page/components/postcode-lookup.js +0 -503
  84. package/build/js/page/utils/address-utils.js +0 -32
  85. package/src/components/order-address.hbs +0 -28
  86. package/src/components/postcode-lookup-v2.hbs +0 -85
  87. package/src/components/wismo-giftcard-payment-item.hbs +0 -29
  88. package/src/data/data_checkout-giftcards.json +0 -7
  89. package/src/data/data_postcode-lookup.json +0 -200
  90. package/src/img/payment/checkout/giftcard.svg +0 -28
  91. package/src/img/payment/footer/giftcard.svg +0 -28
  92. package/src/js/emulation/postcode-lookup.js +0 -122
  93. package/src/js/page/components/postcode-lookup/postcode-lookup-api.js +0 -56
  94. package/src/js/page/components/postcode-lookup/postcode-lookup-render.js +0 -98
  95. package/src/js/page/components/postcode-lookup/postcode-lookup-validation.js +0 -81
  96. package/src/js/page/components/postcode-lookup.js +0 -503
  97. package/src/js/page/utils/address-utils.js +0 -32
  98. package/src/page_checkout_confirmation-gift-card-split-payment.html +0 -339
  99. package/src/page_checkout_confirmation-gift-card.html +0 -339
  100. package/src/page_my_account_payment_info_gift_cards.html +0 -96
  101. package/src/page_my_account_payment_info_gift_cards_split_payment.html +0 -96
  102. package/src/scss/components/_postcode-lookup-v2.scss +0 -164
@@ -1,200 +0,0 @@
1
- {
2
- "postcode-lookup": {
3
- "autocompleteResponse": {
4
- "result": {
5
- "hits": [
6
- {
7
- "id": "paf_5692124",
8
- "suggestion": "Lo Lo, 129 Enbrook Valley, Folkestone, CT20",
9
- "udprn": 5692124,
10
- "urls": {
11
- "udprn": "/v1/udprn/5692124"
12
- }
13
- },
14
- {
15
- "id": "paf_15567850",
16
- "suggestion": "Lo Lo Nails, 8 South Mall, London, N9",
17
- "udprn": 15567850,
18
- "urls": {
19
- "udprn": "/v1/udprn/15567850"
20
- }
21
- },
22
- {
23
- "id": "paf_51482484",
24
- "suggestion": "1 Lo Grove, Wakefield, WF1",
25
- "udprn": 51482484,
26
- "urls": {
27
- "udprn": "/v1/udprn/51482484"
28
- }
29
- },
30
- {
31
- "id": "paf_51482485",
32
- "suggestion": "2 Lo Grove, Wakefield, WF1",
33
- "udprn": 51482485,
34
- "urls": {
35
- "udprn": "/v1/udprn/51482485"
36
- }
37
- },
38
- {
39
- "id": "paf_51482486",
40
- "suggestion": "3 Lo Grove, Wakefield, WF1",
41
- "udprn": 51482486,
42
- "urls": {
43
- "udprn": "/v1/udprn/51482486"
44
- }
45
- },
46
- {
47
- "id": "paf_51482487",
48
- "suggestion": "4 Lo Grove, Wakefield, WF1",
49
- "udprn": 51482487,
50
- "urls": {
51
- "udprn": "/v1/udprn/51482487"
52
- }
53
- },
54
- {
55
- "id": "paf_52933093",
56
- "suggestion": "5 Lo Grove, Wakefield, WF1",
57
- "udprn": 52933093,
58
- "urls": {
59
- "udprn": "/v1/udprn/52933093"
60
- }
61
- },
62
- {
63
- "id": "paf_5859369",
64
- "suggestion": "High Lo, Dalehouse Lane, Kenilworth, CV8",
65
- "udprn": 5859369,
66
- "urls": {
67
- "udprn": "/v1/udprn/5859369"
68
- }
69
- },
70
- {
71
- "id": "paf_24383125",
72
- "suggestion": "Kwai Lo, Winterhay Lane, Ilminster, TA19",
73
- "udprn": 24383125,
74
- "urls": {
75
- "udprn": "/v1/udprn/24383125"
76
- }
77
- },
78
- {
79
- "id": "paf_18377899",
80
- "suggestion": "Lo Dore, Park Road, Kilmacolm, PA13",
81
- "udprn": 18377899,
82
- "urls": {
83
- "udprn": "/v1/udprn/18377899"
84
- }
85
- }
86
- ]
87
- },
88
- "code": 2000,
89
- "message": "Success"
90
- },
91
- "addresses": {
92
- "paf_5692124": {
93
- "postcode": "CT20 3NE",
94
- "postcode_inward": "3NE",
95
- "postcode_outward": "CT20",
96
- "post_town": "Folkestone",
97
- "dependant_locality": "",
98
- "double_dependant_locality": "",
99
- "thoroughfare": "Enbrook Valley",
100
- "dependant_thoroughfare": "",
101
- "building_number": "129",
102
- "building_name": "",
103
- "sub_building_name": "",
104
- "po_box": "",
105
- "department_name": "",
106
- "organisation_name": "Lo Lo",
107
- "udprn": 5692124,
108
- "postcode_type": "S",
109
- "su_organisation_indicator": "Y",
110
- "delivery_point_suffix": "1T",
111
- "line_1": "Lo Lo",
112
- "line_2": "129 Enbrook Valley",
113
- "line_3": "",
114
- "premise": "129",
115
- "longitude": 1.1460375,
116
- "latitude": 51.0818226,
117
- "eastings": 620445,
118
- "northings": 136097,
119
- "country": "England",
120
- "traditional_county": "Kent",
121
- "administrative_county": "Kent",
122
- "postal_county": "Kent",
123
- "county": "Kent",
124
- "district": "Folkestone and Hythe",
125
- "ward": "Sandgate & West Folkestone",
126
- "uprn": "50027401",
127
- "id": "paf_5692124",
128
- "country_iso": "GBR",
129
- "country_iso_2": "GB",
130
- "county_code": "",
131
- "language": "en",
132
- "umprn": "",
133
- "dataset": "paf"
134
- },
135
- "paf_15567850": {
136
- "line_1": "Lo Lo Nails",
137
- "line_2": "8 South Mall",
138
- "line_3": "Edmonton Green Shopping Centre",
139
- "post_town": "London",
140
- "postcode": "N9 0TN"
141
- },
142
- "paf_51482484": {
143
- "line_1": "1 Lo Grove",
144
- "line_2": "",
145
- "line_3": "",
146
- "post_town": "Wakefield",
147
- "postcode": "WF1 4HA"
148
- },
149
- "paf_51482485": {
150
- "line_1": "2 Lo Grove",
151
- "line_2": "",
152
- "line_3": "",
153
- "post_town": "Wakefield",
154
- "postcode": "WF1 4HA"
155
- },
156
- "paf_51482486": {
157
- "line_1": "3 Lo Grove",
158
- "line_2": "",
159
- "line_3": "",
160
- "post_town": "Wakefield",
161
- "postcode": "WF1 4HA"
162
- },
163
- "paf_51482487": {
164
- "line_1": "4 Lo Grove",
165
- "line_2": "",
166
- "line_3": "",
167
- "post_town": "Wakefield",
168
- "postcode": "WF1 4HA"
169
- },
170
- "paf_52933093": {
171
- "line_1": "5 Lo Grove",
172
- "line_2": "",
173
- "line_3": "",
174
- "post_town": "Wakefield",
175
- "postcode": "WF1 4HA"
176
- },
177
- "paf_5859369": {
178
- "line_1": "High Lo",
179
- "line_2": "Dalehouse Lane",
180
- "line_3": "",
181
- "post_town": "Kenilworth",
182
- "postcode": "CV8 2EB"
183
- },
184
- "paf_24383125": {
185
- "line_1": "Kwai Lo",
186
- "line_2": "Winterhay Lane",
187
- "line_3": "",
188
- "post_town": "Ilminster",
189
- "postcode": "TA19 9PH"
190
- },
191
- "paf_18377899": {
192
- "line_1": "Lo Dore",
193
- "line_2": "Park Road",
194
- "line_3": "",
195
- "post_town": "Kilmacolm",
196
- "postcode": "PA13 4EE"
197
- }
198
- }
199
- }
200
- }
@@ -1,28 +0,0 @@
1
- <svg width="36" height="23" viewBox="0 0 36 23" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g clip-path="url(#clip0_9103_110194)">
3
- <rect width="36" height="22.5" rx="2.25" fill="white"/>
4
- <path d="M31.875 19.5C29.625 19.125 27.375 15.75 27.375 15.75C27.375 15.75 25.5 18.75 23.25 19.5" stroke="#004587" stroke-width="1.35"/>
5
- <path d="M22.3396 13.7778C23.0733 14.7513 24.6901 15.0189 26.4425 15.3385C26.4181 13.8977 26.0629 12.4876 25.3293 11.514C24.5957 10.5405 23.4966 10.1294 22.523 10.863C21.5495 11.5966 21.606 12.8042 22.3396 13.7778Z" fill="white" stroke="#004587" stroke-width="1.35"/>
6
- <path d="M32.3733 13.7778C31.6396 14.7513 30.0228 15.0189 28.2703 15.3385C28.2948 13.8977 28.65 12.4876 29.3836 11.514C30.1172 10.5405 31.2163 10.1294 32.1899 10.863C33.1634 11.5966 33.1069 12.8042 32.3733 13.7778Z" fill="white" stroke="#004587" stroke-width="1.35"/>
7
- <g clip-path="url(#clip1_9103_110194)">
8
- <path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 0V9.15602L12.3866 11.2286L22.532 9.13257V0H2.25Z" fill="white"/>
9
- <path fill-rule="evenodd" clip-rule="evenodd" d="M2.92773 0.664062V8.61365L12.3876 10.5436L21.8607 8.61276V0.664062H2.92773Z" fill="#004587"/>
10
- <path fill-rule="evenodd" clip-rule="evenodd" d="M11.8332 5.78902C11.8267 5.56557 11.6264 5.40914 11.4047 5.40914C10.9115 5.40914 10.8341 5.82081 10.8341 6.18699C10.8341 6.52756 10.9838 6.87855 11.3563 6.87855C11.6619 6.87855 11.8167 6.70611 11.8583 6.42585H12.7143C12.6351 7.13387 12.0747 7.53996 11.3623 7.53996C10.5538 7.53996 9.95312 6.99672 9.95312 6.18699C9.95312 5.34674 10.4972 4.74609 11.3623 4.74609C12.0287 4.74609 12.6251 5.09351 12.686 5.78902H11.8332Z" fill="white"/>
11
- <path fill-rule="evenodd" clip-rule="evenodd" d="M12.8652 3.83203H13.7461V5.70404L14.5498 4.82462H15.5691L14.5857 5.82161L15.6932 7.46473H14.6312L13.9753 6.40141L13.7461 6.61964V7.46473H12.8652V3.83203Z" fill="white"/>
12
- <path fill-rule="evenodd" clip-rule="evenodd" d="M16.3009 6.35415C16.3162 6.71482 16.5282 6.95472 16.9022 6.95472C17.1135 6.95472 17.3203 6.85867 17.4044 6.66523H18.2271C18.0667 7.2766 17.491 7.53988 16.8903 7.53988C16.0166 7.53988 15.4199 7.02211 15.4199 6.13711C15.4199 5.32686 16.079 4.74609 16.8697 4.74609C17.8325 4.74609 18.3146 5.45947 18.2734 6.35415H16.3009ZM17.3928 5.87166C17.3778 5.57584 17.1651 5.33177 16.8697 5.33177C16.5594 5.33177 16.3526 5.55068 16.301 5.87166H17.3928Z" fill="white"/>
13
- <path fill-rule="evenodd" clip-rule="evenodd" d="M19.1879 6.59204C19.1879 6.72636 19.2428 6.82286 19.3324 6.88801C19.4145 6.94929 19.5336 6.98048 19.6585 6.98048C19.8295 6.98048 20.0734 6.91005 20.0734 6.69971C20.0734 6.49599 19.798 6.45675 19.6436 6.42071C19.0882 6.28297 18.3948 6.26592 18.3948 5.55634C18.3948 4.92099 19.0939 4.74609 19.6225 4.74609C20.2134 4.74609 20.8282 4.91504 20.86 5.60265H20.0463C20.0463 5.48933 20.0061 5.41889 19.9327 5.37154C19.8592 5.32679 19.7627 5.30482 19.6537 5.30482C19.5079 5.30482 19.276 5.32128 19.276 5.50489C19.276 5.75387 19.8658 5.79967 20.2703 5.88522C20.8122 5.99281 20.9534 6.37909 20.9534 6.59882C20.9534 7.30713 20.2703 7.53988 19.6638 7.53988C19.026 7.53988 18.3737 7.3323 18.3477 6.59204H19.1879Z" fill="white"/>
14
- <path fill-rule="evenodd" clip-rule="evenodd" d="M7.78099 7.46473H6.81584L6.30981 4.96222H6.29784L5.79173 7.46473H4.81408L3.81445 3.83203H4.77611L5.30124 6.48651H5.31011L5.85305 3.83203H6.75878L7.30308 6.48651H7.31323L7.83632 3.83203H8.79896L7.78099 7.46473Z" fill="white"/>
15
- <path fill-rule="evenodd" clip-rule="evenodd" d="M8.86499 4.49387H9.74677V3.83202H8.86499V4.49387ZM8.86499 7.46479H9.74677V4.82461H8.86499V7.46479Z" fill="white"/>
16
- </g>
17
- <path d="M27.375 0V16.125M27.375 22.5V16.125M27.375 16.125H35.625M27.375 16.125H0.75" stroke="#004587" stroke-width="1.35"/>
18
- </g>
19
- <rect x="0.375" y="0.375" width="35.25" height="21.75" rx="1.875" stroke="#CCCCCC" stroke-width="0.75"/>
20
- <defs>
21
- <clipPath id="clip0_9103_110194">
22
- <rect width="36" height="22.5" rx="2.25" fill="white"/>
23
- </clipPath>
24
- <clipPath id="clip1_9103_110194">
25
- <rect width="20.25" height="11.2277" fill="white" transform="translate(2.25)"/>
26
- </clipPath>
27
- </defs>
28
- </svg>
@@ -1,28 +0,0 @@
1
- <svg width="36" height="23" viewBox="0 0 36 23" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g clip-path="url(#clip0_9103_110194)">
3
- <rect width="36" height="22.5" rx="2.25" fill="white"/>
4
- <path d="M31.875 19.5C29.625 19.125 27.375 15.75 27.375 15.75C27.375 15.75 25.5 18.75 23.25 19.5" stroke="#004587" stroke-width="1.35"/>
5
- <path d="M22.3396 13.7778C23.0733 14.7513 24.6901 15.0189 26.4425 15.3385C26.4181 13.8977 26.0629 12.4876 25.3293 11.514C24.5957 10.5405 23.4966 10.1294 22.523 10.863C21.5495 11.5966 21.606 12.8042 22.3396 13.7778Z" fill="white" stroke="#004587" stroke-width="1.35"/>
6
- <path d="M32.3733 13.7778C31.6396 14.7513 30.0228 15.0189 28.2703 15.3385C28.2948 13.8977 28.65 12.4876 29.3836 11.514C30.1172 10.5405 31.2163 10.1294 32.1899 10.863C33.1634 11.5966 33.1069 12.8042 32.3733 13.7778Z" fill="white" stroke="#004587" stroke-width="1.35"/>
7
- <g clip-path="url(#clip1_9103_110194)">
8
- <path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 0V9.15602L12.3866 11.2286L22.532 9.13257V0H2.25Z" fill="white"/>
9
- <path fill-rule="evenodd" clip-rule="evenodd" d="M2.92773 0.664062V8.61365L12.3876 10.5436L21.8607 8.61276V0.664062H2.92773Z" fill="#004587"/>
10
- <path fill-rule="evenodd" clip-rule="evenodd" d="M11.8332 5.78902C11.8267 5.56557 11.6264 5.40914 11.4047 5.40914C10.9115 5.40914 10.8341 5.82081 10.8341 6.18699C10.8341 6.52756 10.9838 6.87855 11.3563 6.87855C11.6619 6.87855 11.8167 6.70611 11.8583 6.42585H12.7143C12.6351 7.13387 12.0747 7.53996 11.3623 7.53996C10.5538 7.53996 9.95312 6.99672 9.95312 6.18699C9.95312 5.34674 10.4972 4.74609 11.3623 4.74609C12.0287 4.74609 12.6251 5.09351 12.686 5.78902H11.8332Z" fill="white"/>
11
- <path fill-rule="evenodd" clip-rule="evenodd" d="M12.8652 3.83203H13.7461V5.70404L14.5498 4.82462H15.5691L14.5857 5.82161L15.6932 7.46473H14.6312L13.9753 6.40141L13.7461 6.61964V7.46473H12.8652V3.83203Z" fill="white"/>
12
- <path fill-rule="evenodd" clip-rule="evenodd" d="M16.3009 6.35415C16.3162 6.71482 16.5282 6.95472 16.9022 6.95472C17.1135 6.95472 17.3203 6.85867 17.4044 6.66523H18.2271C18.0667 7.2766 17.491 7.53988 16.8903 7.53988C16.0166 7.53988 15.4199 7.02211 15.4199 6.13711C15.4199 5.32686 16.079 4.74609 16.8697 4.74609C17.8325 4.74609 18.3146 5.45947 18.2734 6.35415H16.3009ZM17.3928 5.87166C17.3778 5.57584 17.1651 5.33177 16.8697 5.33177C16.5594 5.33177 16.3526 5.55068 16.301 5.87166H17.3928Z" fill="white"/>
13
- <path fill-rule="evenodd" clip-rule="evenodd" d="M19.1879 6.59204C19.1879 6.72636 19.2428 6.82286 19.3324 6.88801C19.4145 6.94929 19.5336 6.98048 19.6585 6.98048C19.8295 6.98048 20.0734 6.91005 20.0734 6.69971C20.0734 6.49599 19.798 6.45675 19.6436 6.42071C19.0882 6.28297 18.3948 6.26592 18.3948 5.55634C18.3948 4.92099 19.0939 4.74609 19.6225 4.74609C20.2134 4.74609 20.8282 4.91504 20.86 5.60265H20.0463C20.0463 5.48933 20.0061 5.41889 19.9327 5.37154C19.8592 5.32679 19.7627 5.30482 19.6537 5.30482C19.5079 5.30482 19.276 5.32128 19.276 5.50489C19.276 5.75387 19.8658 5.79967 20.2703 5.88522C20.8122 5.99281 20.9534 6.37909 20.9534 6.59882C20.9534 7.30713 20.2703 7.53988 19.6638 7.53988C19.026 7.53988 18.3737 7.3323 18.3477 6.59204H19.1879Z" fill="white"/>
14
- <path fill-rule="evenodd" clip-rule="evenodd" d="M7.78099 7.46473H6.81584L6.30981 4.96222H6.29784L5.79173 7.46473H4.81408L3.81445 3.83203H4.77611L5.30124 6.48651H5.31011L5.85305 3.83203H6.75878L7.30308 6.48651H7.31323L7.83632 3.83203H8.79896L7.78099 7.46473Z" fill="white"/>
15
- <path fill-rule="evenodd" clip-rule="evenodd" d="M8.86499 4.49387H9.74677V3.83202H8.86499V4.49387ZM8.86499 7.46479H9.74677V4.82461H8.86499V7.46479Z" fill="white"/>
16
- </g>
17
- <path d="M27.375 0V16.125M27.375 22.5V16.125M27.375 16.125H35.625M27.375 16.125H0.75" stroke="#004587" stroke-width="1.35"/>
18
- </g>
19
- <rect x="0.375" y="0.375" width="35.25" height="21.75" rx="1.875" stroke="#CCCCCC" stroke-width="0.75"/>
20
- <defs>
21
- <clipPath id="clip0_9103_110194">
22
- <rect width="36" height="22.5" rx="2.25" fill="white"/>
23
- </clipPath>
24
- <clipPath id="clip1_9103_110194">
25
- <rect width="20.25" height="11.2277" fill="white" transform="translate(2.25)"/>
26
- </clipPath>
27
- </defs>
28
- </svg>
@@ -1,122 +0,0 @@
1
- import data from '../../data/data_postcode-lookup.json';
2
-
3
- const { autocompleteResponse, addresses } = data['postcode-lookup'];
4
-
5
- window.Wick = window.Wick || {};
6
-
7
- const MOCK_DELAY_MS = 300;
8
- const MAX_HITS = 10;
9
- const API_MODES = ['real', 'mock', 'block'];
10
- const CHECK_KEY_UNAVAILABLE = 'unavailable';
11
- const EMPTY_RESULT_ID = 'mock-empty';
12
-
13
- const DEFAULT_MODES = {
14
- checkKey: 'mock',
15
- autocomplete: 'mock',
16
- resolve: 'mock',
17
- };
18
-
19
- const EMPTY_RESULT_HIT = {
20
- id: EMPTY_RESULT_ID,
21
- suggestion: 'Empty result (resolve returns no address)',
22
- };
23
-
24
- function delay(value) {
25
- return new Promise((resolve) => setTimeout(() => resolve(value), MOCK_DELAY_MS));
26
- }
27
-
28
- function matchesQuery(suggestion, query) {
29
- const text = suggestion.toLowerCase();
30
- return query
31
- .toLowerCase()
32
- .split(/[\s,]+/)
33
- .filter(Boolean)
34
- .every((word) => text.includes(word));
35
- }
36
-
37
- function addressFromSuggestionText(text) {
38
- const parts = String(text || '')
39
- .split(',')
40
- .map((part) => part.trim())
41
- .filter(Boolean);
42
- const postcode = parts.length > 2 ? parts.pop() : '';
43
- const town = parts.length > 1 ? parts.pop() : '';
44
-
45
- return {
46
- line_1: parts[0] || '',
47
- line_2: parts[1] || '',
48
- line_3: parts.slice(2).join(', '),
49
- post_town: town,
50
- postcode,
51
- };
52
- }
53
-
54
- const mocks = {
55
- checkKey() {
56
- return delay({ available: true });
57
- },
58
-
59
- autocomplete(query) {
60
- const hits = autocompleteResponse.result.hits
61
- .concat(/empty/i.test(query) ? [EMPTY_RESULT_HIT] : [])
62
- .filter((hit) => matchesQuery(hit.suggestion, query))
63
- .slice(0, MAX_HITS);
64
-
65
- return delay(hits);
66
- },
67
-
68
- resolve(suggestion) {
69
- if (suggestion.id === EMPTY_RESULT_ID) return delay(null);
70
-
71
- const found = addresses[suggestion.id];
72
- const address = found
73
- ? Object.assign({ id: suggestion.id }, found)
74
- : addressFromSuggestionText(suggestion.suggestion);
75
-
76
- return delay(address);
77
- },
78
- };
79
-
80
- function blocked(name) {
81
- return function () {
82
- return Promise.reject(new Error(`[PostcodeLookup emulation] ${name} blocked`));
83
- };
84
- }
85
-
86
- function readModes() {
87
- const modes = Object.assign({}, DEFAULT_MODES);
88
- const param = new URLSearchParams(window.location.search).get('postcodeLookup');
89
- if (!param) return modes;
90
-
91
- if (API_MODES.includes(param)) {
92
- Object.keys(modes).forEach((name) => {
93
- modes[name] = param;
94
- });
95
- return modes;
96
- }
97
-
98
- param.split(',').forEach((pair) => {
99
- const [name, mode] = pair.split(':').map((part) => part.trim());
100
- const isValid =
101
- API_MODES.includes(mode) || (name === 'checkKey' && mode === CHECK_KEY_UNAVAILABLE);
102
- if (Object.prototype.hasOwnProperty.call(modes, name) && isValid) modes[name] = mode;
103
- });
104
-
105
- return modes;
106
- }
107
-
108
- function buildOverrides(modes) {
109
- const overrides = {};
110
-
111
- Object.keys(modes).forEach((name) => {
112
- const mode = modes[name];
113
-
114
- if (mode === 'mock') overrides[name] = mocks[name];
115
- if (mode === 'block') overrides[name] = blocked(name);
116
- if (mode === CHECK_KEY_UNAVAILABLE) overrides[name] = () => delay({ available: false });
117
- });
118
-
119
- return overrides;
120
- }
121
-
122
- window.Wick.PostcodeLookupApi = buildOverrides(readModes());
@@ -1,56 +0,0 @@
1
- import { resolvePostcodeToAddress } from '../../utils/address-utils';
2
-
3
- const DEFAULT_OPTIONS = {
4
- apiKey: 'ak_ksfw10yaf8TFYw3IA6alHPLQatQsY',
5
- baseUrl: 'https://api.ideal-postcodes.co.uk/v1',
6
- country: 'GBR',
7
- };
8
-
9
- export function createPostcodeLookupApi(options = {}) {
10
- const { apiKey, baseUrl, country } = { ...DEFAULT_OPTIONS, ...options };
11
-
12
- const requests = {
13
- async checkKey() {
14
- const res = await fetch(`${baseUrl}/keys/${apiKey}`);
15
- if (!res.ok) throw new Error(`Key check failed with status ${res.status}`);
16
-
17
- const data = await res.json();
18
- return { available: !!data.result?.available };
19
- },
20
-
21
- async autocomplete(query) {
22
- const params = new URLSearchParams({
23
- api_key: apiKey,
24
- query,
25
- context: country,
26
- });
27
- const res = await fetch(`${baseUrl}/autocomplete/addresses?${params}`);
28
- if (!res.ok) throw new Error(`Autocomplete failed with status ${res.status}`);
29
-
30
- const data = await res.json();
31
- return data.result?.hits || [];
32
- },
33
-
34
- async resolve(suggestion) {
35
- const id = encodeURIComponent(suggestion.id);
36
- const res = await fetch(
37
- `${baseUrl}/autocomplete/addresses/${id}/${country.toLowerCase()}?api_key=${apiKey}`
38
- );
39
- if (!res.ok) throw new Error(`Resolve failed with status ${res.status}`);
40
-
41
- const data = await res.json();
42
- return data.result || null;
43
- },
44
- };
45
-
46
- Object.assign(requests, (window.Wick && window.Wick.PostcodeLookupApi) || {});
47
-
48
- return {
49
- checkKey: () => requests.checkKey(),
50
- autocomplete: (query) => requests.autocomplete(query),
51
- async resolve(suggestion) {
52
- const result = await requests.resolve(suggestion);
53
- return result ? resolvePostcodeToAddress(result) : null;
54
- },
55
- };
56
- }
@@ -1,98 +0,0 @@
1
- export const MODES = {
2
- LOOKUP: 'lookup',
3
- MANUAL: 'manual',
4
- UNAVAILABLE: 'unavailable',
5
- };
6
-
7
- export const classes = {
8
- item: 'address-suggestion',
9
- highlighted: 'is-highlighted',
10
- match: 'text-match',
11
- hidden: 'd-none',
12
- };
13
-
14
- const MANUAL_PLACEHOLDERS = {
15
- line1: 'Type address line 1',
16
- line2: 'Type address line 2',
17
- town: 'Type town/city',
18
- postcode: 'Type postcode',
19
- };
20
-
21
- function renderSuggestionParts(text, query) {
22
- const index = query ? text.toLowerCase().indexOf(query.toLowerCase()) : -1;
23
- if (index === -1) return [$('<span>', { text })];
24
-
25
- return [
26
- { text: text.slice(0, index), isMatch: false },
27
- { text: text.slice(index, index + query.length), isMatch: true },
28
- { text: text.slice(index + query.length), isMatch: false },
29
- ]
30
- .filter((part) => part.text)
31
- .map((part) => $('<span>', { text: part.text }).toggleClass(classes.match, part.isMatch));
32
- }
33
-
34
- export function renderDropdown(lookup) {
35
- const { state, $search, $dropdown, $hint, $manual, $list } = lookup;
36
-
37
- $dropdown.toggleClass(classes.hidden, !state.isOpen);
38
- if (!state.isOpen) return;
39
-
40
- const isEmptyQuery = !$search.val();
41
-
42
- $hint.toggleClass(classes.hidden, !isEmptyQuery);
43
- $manual.toggleClass(classes.hidden, isEmptyQuery);
44
- $list.find('.' + classes.item).remove();
45
-
46
- if (isEmptyQuery) return;
47
-
48
- const query = $search.val().trim();
49
- const $items = state.suggestions.map((item, index) =>
50
- $('<li>', {
51
- class: classes.item,
52
- role: 'option',
53
- tabindex: -1,
54
- 'data-index': index,
55
- })
56
- .append(renderSuggestionParts(item.suggestion, query))
57
- .toggleClass(classes.highlighted, index === state.highlightedIndex)
58
- );
59
-
60
- $manual.before($items);
61
- }
62
-
63
- export function renderHighlight(lookup) {
64
- const { state, $list } = lookup;
65
-
66
- $list.find('.' + classes.item).each(function () {
67
- $(this).toggleClass(classes.highlighted, $(this).data('index') === state.highlightedIndex);
68
- });
69
- }
70
-
71
- export function renderMode(lookup) {
72
- const { state, $searchWrap, $expand } = lookup;
73
-
74
- $searchWrap.toggleClass(classes.hidden, state.mode !== MODES.LOOKUP);
75
- $expand.toggleClass(classes.hidden, state.mode !== MODES.MANUAL);
76
- autoGrow(lookup);
77
- }
78
-
79
- export function toggleManualPlaceholders(lookup, isShown) {
80
- const { $fields } = lookup;
81
-
82
- Object.keys(MANUAL_PLACEHOLDERS).forEach((key) => {
83
- $fields[key].attr('placeholder', isShown ? MANUAL_PLACEHOLDERS[key] : '');
84
- });
85
- }
86
-
87
- export function autoGrow(lookup) {
88
- const { $search } = lookup;
89
-
90
- if (!$search.is(':visible')) return;
91
-
92
- const el = $search[0];
93
- const { placeholder } = el;
94
- el.placeholder = '';
95
- el.style.height = 'auto';
96
- el.style.height = `${el.scrollHeight}px`;
97
- el.placeholder = placeholder;
98
- }
@@ -1,81 +0,0 @@
1
- import {
2
- isAntiXssValid,
3
- isElementInViewport,
4
- isFieldRowVisible,
5
- isValidLookupPostcode,
6
- updateStylingErrorForElement,
7
- validateFieldByRule,
8
- } from '../../utils/validation';
9
- import errorMessages from '../../utils/errorMesages';
10
- import { scrollToElement } from '../../utils/helpers';
11
- import { toCanonicalPostcode } from '../../utils/address-utils';
12
-
13
- const SCROLL_OFFSET = 100;
14
- const FORM_ROW_SELECTOR = '.form-row';
15
-
16
- export const ADDRESS_FIELDS = ['line1', 'line2', 'town', 'postcode'];
17
-
18
- const isPostcodeValid = (value) => isValidLookupPostcode(toCanonicalPostcode(value));
19
-
20
- const fieldRules = {
21
- line1: {
22
- required: true,
23
- validate: isAntiXssValid,
24
- message: errorMessages.errorAddressLine1,
25
- },
26
- line2: {
27
- required: false,
28
- validate: isAntiXssValid,
29
- message: errorMessages.errorAddressLine2,
30
- },
31
- town: {
32
- required: true,
33
- validate: isAntiXssValid,
34
- message: errorMessages.errorTown,
35
- },
36
- postcode: {
37
- required: true,
38
- validate: isPostcodeValid,
39
- message: errorMessages.errorPostcode,
40
- },
41
- };
42
-
43
- export function validateField(lookup, key) {
44
- const { $fields } = lookup;
45
-
46
- return validateFieldByRule($fields[key], fieldRules[key]);
47
- }
48
-
49
- export function validateSearch(lookup) {
50
- const { state, $search, $fields } = lookup;
51
-
52
- if (!isFieldRowVisible($search)) return true;
53
-
54
- const hasAddressFields = ADDRESS_FIELDS.some((key) => $fields[key].val());
55
- const isValid = !!$search.val() && (state.isOpen || hasAddressFields);
56
-
57
- updateStylingErrorForElement($search, isValid, errorMessages.errorAddress);
58
- return isValid;
59
- }
60
-
61
- export function validateAddressInputs(lookup) {
62
- ADDRESS_FIELDS.forEach((key) => validateField(lookup, key));
63
- }
64
-
65
- export function validate(lookup, { shouldScroll = true } = {}) {
66
- const { $search, $fields } = lookup;
67
- const checks = [
68
- { $field: $search, isValid: validateSearch(lookup) },
69
- ...ADDRESS_FIELDS.map((key) => ({
70
- $field: $fields[key],
71
- isValid: validateField(lookup, key),
72
- })),
73
- ];
74
- const firstInvalid = checks.find((check) => !check.isValid);
75
-
76
- if (firstInvalid && shouldScroll) {
77
- const $row = firstInvalid.$field.closest(FORM_ROW_SELECTOR);
78
- if (!isElementInViewport($row)) scrollToElement($row, SCROLL_OFFSET);
79
- }
80
- return !firstInvalid;
81
- }