Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
correction templateUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
ipatate committed Feb 9, 2021
1 parent 918265a commit 63eaef6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
7 changes: 5 additions & 2 deletions components/Snipcart.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ var Snipcart = function Snipcart(_ref) {
currency = _ref.currency,
innerHTML = _ref.innerHTML,
openCartOnAdd = _ref.openCartOnAdd,
useSideCart = _ref.useSideCart;
useSideCart = _ref.useSideCart,
templatesUrl = _ref.templatesUrl;
return /*#__PURE__*/React.createElement("div", {
hidden: true,
id: "snipcart",
"data-api-key": publicApiKey,
"data-currency": currency,
"data-config-add-product-behavior": openCartOnAdd === false ? "none" : null,
"data-config-modal-style": useSideCart === true ? "side" : null,
"data-templates-url": {},
dangerouslySetInnerHTML: {
__html: "\n " + innerHTML + "\n "
}
Expand All @@ -25,6 +27,7 @@ Snipcart.defaultProps = {
currency: "usd",
innerHTML: "",
openCartOnAdd: true,
useSideCart: false
useSideCart: false,
templatesUrl: null
};
module.exports = Snipcart;
6 changes: 4 additions & 2 deletions gatsby-ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ exports.onRenderBody = function (_ref, pluginOptions) {
version: "3.0.19",
innerHTML: "",
openCartOnAdd: true,
useSideCart: false
useSideCart: false,
templatesUrl: null
}, pluginOptions); // find public api key in options plugin or environment variable


Expand All @@ -50,7 +51,8 @@ exports.onRenderBody = function (_ref, pluginOptions) {
,
currency: provideDefaultCurrency ? _options.currency : null,
openCartOnAdd: _options.openCartOnAdd,
useSideCart: _options.useSideCart
useSideCart: _options.useSideCart,
templatesUrl: _options.templatesUrl
}),
/*#__PURE__*/
// insert style
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gatsby-plugin-snipcart-advanced",
"main": "gatsby-ssr.js",
"version": "1.0.2-beta",
"version": "1.0.4-beta",
"description": "Gatsby JS Plugin for Snipcart V3",
"keywords": [
"gatsby",
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module.exports = {
},
},
templatesUrl:
"path on your template file. Set file in the static folder",
"path on your template file. Set file in the static folder, ex: '/snipcart/index.html'", // not work on dev. Gatsby not serve html file in dev https://github.com/gatsbyjs/gatsby/issues/13072
innerHTML: `
<billing section="bottom">
<!-- Customization goes here -->
Expand Down
2 changes: 1 addition & 1 deletion src/components/Snipcart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const Snipcart = ({
data-currency={currency}
data-config-add-product-behavior={openCartOnAdd === false ? "none" : null}
data-config-modal-style={useSideCart === true ? "side" : null}
data-templates-url={{}}
data-templates-url={templatesUrl}
dangerouslySetInnerHTML={{
__html: `
${innerHTML}
Expand Down

0 comments on commit 63eaef6

Please sign in to comment.