Skip to content

Commit 298697c

Browse files
committed
Update to 5.1.0
1 parent 8e4ab8c commit 298697c

File tree

5 files changed

+54
-8
lines changed

5 files changed

+54
-8
lines changed

src/css/utilities/colors.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,19 @@
103103
.color__border-transparent {
104104
border-color: transparent;
105105
}
106+
/* .color__border-transparent-sides {
107+
border-left-color: transparent;
108+
border-right-color: transparent;
109+
} */
106110

107111
/* - divider 1 */
108112
.color__border-divider-1 {
109113
border-color: var(--color__border-divider-light-1);
110114
}
115+
/* .color__border-divider-1-sides {
116+
border-left-color: var(--color__border-divider-light-1);
117+
border-right-color: var(--color__border-divider-light-1);
118+
} */
111119

112120
/* - divider 2 */
113121
.color__border-divider-2 {
@@ -123,6 +131,10 @@
123131
.color__border-selected-1 {
124132
border-color: var(--color__border-selected-light-1);
125133
}
134+
/* .color__border-selected-1-sides {
135+
border-left-color: var(--color__border-selected-light-1);
136+
border-right-color: var(--color__border-selected-light-1);
137+
} */
126138

127139
/* - selected 2 */
128140
.color__border-selected-2 {

src/entrypoints/styles.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,4 +208,4 @@ html {
208208
}
209209
.shopify-payment-button__more-options {
210210
@apply !color__bg-overlay-1 px-6 py-2;
211-
}
211+
}

src/ts/bsl.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ declare global {
1414
Shopify: IShopify;
1515
app: () => AppInterface;
1616
__initialData: AppInterface;
17+
webkitAudioContext: any
1718
}
1819
}
1920

src/ts/cart/cart.ts

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,9 @@ export const cart = {
152152
sellingPlanId: number,
153153
quantity: number,
154154
openCart: boolean,
155-
properties: HTMLCollectionOf<HTMLInputElement>
156-
) {
155+
giftCardRecipient: boolean,
156+
productHandle: string
157+
) {
157158
if(this.enable_audio) {
158159
this.playSound(this.click_audio);
159160
}
@@ -163,6 +164,8 @@ export const cart = {
163164
let propertiesArr = [];
164165
let propertiesObj;
165166

167+
let properties = document.getElementsByClassName(`custom-input_${productHandle}`) as HTMLCollectionOf<HTMLInputElement>;
168+
166169
if (properties) {
167170
for (const property of properties) {
168171
propertiesArr.push([property.name, property.value]);
@@ -172,14 +175,43 @@ export const cart = {
172175
}
173176
}
174177

178+
// gift card recipient
179+
let recipientCheckbox = document.querySelector(`#recipient-checkbox`) as HTMLInputElement;
180+
let recipientObj;
181+
if(giftCardRecipient && recipientCheckbox.checked) {
182+
let recipientName = document.querySelector(`#recipient-name`) as HTMLInputElement;
183+
let recipientEmail = document.querySelector(`#recipient-email`) as HTMLInputElement;
184+
let recipientMessage = document.querySelector(`#recipient-message`) as HTMLInputElement;
185+
186+
// throw error if name or email are empty
187+
if(!recipientName.value || !recipientEmail.value) {
188+
this.error_title = "Error",
189+
this.error_message = "Please fill out name and email of gift card recepient",
190+
this.show_alert = true;
191+
this.cart_loading = false;
192+
return;
193+
}
194+
195+
recipientObj = {
196+
"Recipient email": recipientEmail.value,
197+
"Recipient name": recipientName.value,
198+
"Message": recipientMessage.value,
199+
"__shopify_send_gift_card_to_recipient": "on",
200+
}
201+
202+
}
203+
175204
// Update formData if sellingPlanId is available
176205
if (sellingPlanId == 0) {
177206
formData = {
178207
items: [
179208
{
180209
id: variantID,
181210
quantity: quantity,
182-
properties: propertiesObj,
211+
properties: {
212+
...propertiesObj,
213+
...recipientObj
214+
},
183215
},
184216
],
185217
};

src/ts/collections/collections.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,11 @@ export const collections = {
128128
// Call section render API with data from filter
129129
fetchAndRenderCollection: function (filterData: FormData) {
130130
// Go back to top
131-
var element = document.getElementById("js:top");
132-
if (element) {
133-
element.scrollIntoView();
134-
}
131+
var collectionTop = document.getElementById("js:top").offsetTop;
132+
window.scrollTo({ top: collectionTop, behavior: 'smooth'});
133+
134+
// close filters
135+
this.filter_popup = false;
135136

136137
// Loop through form data and build url
137138
let filterUrl = this.buildUrlFilter(filterData);

0 commit comments

Comments
 (0)