react-stickerpipe
Advanced tools
Comparing version 1.5.0 to 1.5.1
@@ -66,2 +66,10 @@ 'use strict'; | ||
storage.storePack(pack.pack_name, pack.title, pack.stickers); | ||
var storedPacks = storage.getMyPacks(); | ||
if (storedPacks.length > 0) { | ||
storedPacks.unshift(pack); | ||
storage.storeMyPacks(storedPacks); | ||
} | ||
onPurchase(); | ||
@@ -68,0 +76,0 @@ |
@@ -96,2 +96,16 @@ 'use strict'; | ||
var storedPacks = this.storage.getMyPacks(); | ||
if (storedPacks && storedPacks.length > 0) { | ||
if (callback) { | ||
callback(storedPacks[0].pack_name); | ||
} | ||
this.setState({ | ||
stickerPacks: storedPacks | ||
}); | ||
return false; | ||
} | ||
this.client.getMyPacks(function (err, res) { | ||
@@ -110,2 +124,4 @@ if (err) { | ||
_this2.storage.storeMyPacks(stickerPacks); | ||
_this2.setState({ | ||
@@ -117,2 +133,4 @@ stickerPacks: stickerPacks | ||
}); | ||
return false; | ||
} | ||
@@ -119,0 +137,0 @@ }, { |
@@ -58,2 +58,36 @@ 'use strict'; | ||
} | ||
}, { | ||
key: 'storeMyPacks', | ||
value: function storeMyPacks(packs) { | ||
try { | ||
var key = this.userId + '-sticker-packs'; | ||
var data = packs.map(function (pack) { | ||
return { | ||
pack_name: pack.pack_name, | ||
main_icon: pack.main_icon | ||
}; | ||
}); | ||
var value = JSON.stringify(data); | ||
localStorage.setItem(key, value); | ||
} catch (err) { | ||
console.warn('Error while saving to localStorage.', err); | ||
} | ||
} | ||
}, { | ||
key: 'getMyPacks', | ||
value: function getMyPacks() { | ||
try { | ||
var key = this.userId + '-sticker-packs'; | ||
var storedPacks = JSON.parse(localStorage.getItem(key)); | ||
return storedPacks; | ||
} catch (err) { | ||
console.warn('Error while retrieving item from localStorage.', err); | ||
} | ||
return null; | ||
} | ||
}]); | ||
@@ -60,0 +94,0 @@ |
{ | ||
"name": "react-stickerpipe", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "React Component for StickerPipe API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
40171
831
0