Skip to content

Commit

Permalink
fix(storefront): BCTHEME-1378 fix add product to cart on iphone x (ip…
Browse files Browse the repository at this point in the history
…hone version 11)
  • Loading branch information
yurytut1993 committed Jul 3, 2023
1 parent 576d5a3 commit 2446f7a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Bump Stencil utils to 6.15.1 [#2365][https://github.com/bigcommerce/cornerstone/pull/2365]
- Added ACH payment method section to My Account -> Payment Methods page [#2362](https://github.com/bigcommerce/cornerstone/pull/2362)
- Remove data_tag_enabled check from everywhere [#2369][https://github.com/bigcommerce/cornerstone/pull/2369]
- Fix add product to cart on iphone x (iphone version 11) [#2370][https://github.com/bigcommerce/cornerstone/pull/2370]

## 6.11.0 (05-24-2023)
- Reverted fix for sold-out badge appearance [#2354](https://github.com/bigcommerce/cornerstone/pull/2354)
Expand Down
3 changes: 0 additions & 3 deletions assets/js/polyfills.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import 'core-js/stable';
import 'regenerator-runtime/runtime';
import 'whatwg-fetch';
import objectFitImages from 'object-fit-images';

require('formdata-polyfill');

document.addEventListener('DOMContentLoaded', () => {
objectFitImages();
});
17 changes: 17 additions & 0 deletions templates/layout/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,23 @@
{{!-- Exported in app.js --}}
function onThemeBundleMain() {
window.stencilBootstrap("{{page_type}}", {{jsContext}}).load();

function browserSupportsFormData() {
return typeof FormData !== 'undefined'
&& !!FormData.prototype.keys;
}
function loadFormDataPolyfillScript(src) {
var formDataPolyfillScript = document.createElement('script');
formDataPolyfillScript.src = src;
formDataPolyfillScript.onerror = function () {
console.error('Failed to load formData polyfill script ' + src);
};
document.body.appendChild(formDataPolyfillScript);
}

if (!browserSupportsFormData()) {
loadFormDataPolyfillScript('{{cdn 'assets/dist/theme-bundle.polyfill_form_data.js'}}');
}
}
</script>
<script async defer src="{{cdn 'assets/dist/theme-bundle.main.js' resourceHint='preload' as='script'}}" onload="onThemeBundleMain()"></script>
Expand Down
1 change: 1 addition & 0 deletions webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = {
head_async: ['lazysizes'],
font: './assets/js/theme/common/font.js',
polyfills: './assets/js/polyfills.js',
polyfill_form_data: ['formdata-polyfill'],
},
module: {
rules: [
Expand Down

0 comments on commit 2446f7a

Please sign in to comment.