This repository has been archived by the owner on Aug 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added country support * Extended connector * Removed yarn.lock * feat(release 1.0.1): make the connector compitible with shopify template latest release Updated Shopify connector for improvements * fix(usecart/index.ts): fixed per page cookie creation fixed cart bug * fix(updated connector version to 1.0.2): updated connector version to 1.0.2 Updated connector version to 1.0.2 * fix(fixed cart reset on successful checkour): fixed cart reset bug On successful order placement cart was not resetting #63
- Loading branch information
1 parent
04af884
commit adeb6cf
Showing
12 changed files
with
139 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// callback - the function to run after onLoad | ||
// delay - wait X milliseconds after onLoad | ||
export const afterLoad = (callback, delay = 10) => { | ||
// missed the load event, run now | ||
if (document.readyState === 'complete') { | ||
setTimeout(() => callback(), delay); | ||
} else { | ||
// eslint-disable-next-line func-names | ||
window.addEventListener('load', () => { | ||
setTimeout(() => callback(), delay); | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export default async({ $cookies, $config }) => { | ||
if ('serviceWorker' in navigator) { | ||
if ($config.appVersion !== $cookies.get('AppVer')) { | ||
await navigator.serviceWorker.getRegistrations().then((registrations) => { | ||
for (const registration of registrations) { | ||
registration.unregister(); | ||
} | ||
}).catch((err) => { | ||
console.log('Service Worker registration failed: ', err); | ||
}); | ||
caches.keys().then(cacheNames => { | ||
cacheNames.forEach(cacheName => { | ||
caches.delete(cacheName); | ||
}); | ||
}).then(() => { | ||
$cookies.set('AppVer', $config.appVersion, { maxAge: 60 * 60 * 24 * 365 }); | ||
// register service worker | ||
navigator.serviceWorker.register('/sw.js'); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { resolve, join } from 'path'; | ||
import { readdirSync, statSync } from 'fs'; | ||
|
||
// eslint-disable-next-line func-names | ||
export default function () { | ||
this.nuxt.hook('build:before', () => { | ||
const folder = resolve(__dirname, '../integrations'); | ||
const files = readdirSync(folder); | ||
|
||
files.forEach((file) => { | ||
const filename = resolve(folder, file); | ||
const stat = statSync(filename); | ||
|
||
if (stat.isFile()) { | ||
const { dst } = this.addTemplate(filename); | ||
this.options.plugins.push(join(this.options.buildDir, dst)); | ||
} | ||
}); | ||
}); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const bodyParser = require('body-parser'); | ||
const app = require('express')(); | ||
const axios = require('axios'); | ||
module.exports = { | ||
path: '/', | ||
handler: app | ||
}; | ||
app.use(bodyParser.json()); | ||
|
||
app.get('/cart.js', (req, res) => { | ||
const options = { | ||
method: 'GET', | ||
url: `https://${process.env.SHOPIFY_DOMAIN}` + req.originalUrl | ||
}; | ||
axios.request(options).then((response) => { | ||
res.status(200).send(response.data); | ||
}).catch((error) => { | ||
console.error(error); | ||
}); | ||
}); |