diff options
Diffstat (limited to 'StoneIsland')
22 files changed, 720 insertions, 62 deletions
diff --git a/StoneIsland/platforms/ios/www/css/cart.css b/StoneIsland/platforms/ios/www/css/cart.css index ee074f0d..5a5efcd6 100644 --- a/StoneIsland/platforms/ios/www/css/cart.css +++ b/StoneIsland/platforms/ios/www/css/cart.css @@ -2,12 +2,31 @@ .cart #cart { display: block; } .cart #footer .cancel { display: block } .cart #footer .checkout { display: block } +/* .cart #footer .checkout_proceed { display: block } + */ #cart { display: none; } +#cart .steps { + width: 100%; + border-bottom: 1px solid #bbb; + font-size: 0; +} +#cart .steps span { + display: inline-block; + font-size: 13px; + text-align: center; + padding: 5px 0; + color: #bbb; + width: 33%; +} +#cart .steps span.active { + color: #888; +} + #summary { display: none; } diff --git a/StoneIsland/platforms/ios/www/css/index.css b/StoneIsland/platforms/ios/www/css/index.css index 3c2a4d10..db803fa9 100644 --- a/StoneIsland/platforms/ios/www/css/index.css +++ b/StoneIsland/platforms/ios/www/css/index.css @@ -12,7 +12,7 @@ body { -webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */ -webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */ -webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */ - background: white; + background: #eeeeee; font-family: pfd, sans-serif; font-size: 12px; } @@ -27,7 +27,7 @@ body { margin-top: -40px; margin-left: -40px; display: none; -} +} .loader:before { content: ''; border-radius: 50%; @@ -35,10 +35,13 @@ body { border-right: 3px solid transparent; animation: loading .5s linear infinite; -webkit-animation: loading .5s linear infinite; + width: 80px; + height: 80px; + display: block; } @keyframes loading { to {transform: rotate(360deg)} } @-webkit-keyframes loading { to {-webkit-transform: rotate(360deg)} -}
\ No newline at end of file +} diff --git a/StoneIsland/platforms/ios/www/css/nav.css b/StoneIsland/platforms/ios/www/css/nav.css index 8842e6e1..2463d123 100644 --- a/StoneIsland/platforms/ios/www/css/nav.css +++ b/StoneIsland/platforms/ios/www/css/nav.css @@ -4,9 +4,10 @@ #nav { position: absolute; top: 0; left: 0; - width: 300px; - -webkit-transform: translateZ(0) translateX(-300px); + width: 249px; + -webkit-transform: translateZ(0) translateX(-249px); -webkit-transition: -webkit-transform 0.3s; + background: #eeeeee; } #content { position: absolute; @@ -25,9 +26,52 @@ -webkit-transform: translateZ(0) translateX(0); } .nav #content { - -webkit-transform: translateZ(0) translateX(300px); + -webkit-transform: translateZ(0) translateX(249px); +} +.nav .logo { + background-image: url(../img/wide-logo.png); + background-repeat: no-repeat; + background-position: center center; + background-size: contain; + width: 120px; + height: 80px; + margin-left: 20px; +} +#nav .menu span { + display: block; + font-size: 14px; + color: #000; + padding: 15px 0 15px 20px; +} +#nav .submenu { + position: absolute; + width: 100%; + padding: 20px 0; + bottom: 33px; + border-top: 1px solid #ddd; +} +#nav .submenu span { + display: block; + font-size: 14px; + color: #bbb; + padding: 4px 0 5px 20px +} +#nav .social { + position: absolute; + bottom: 0; + left: 0; + border-top: 1px solid #ddd; +} +#nav .social span { + display: block; + float: left; + width: 82px; + border-left: 1px solid #ddd; + color: #bbb; + font-size: 18px; + padding: 5px 0; + text-align: center; } - /* INTRO PAGE WITH SPINNING COMPASS */ @@ -51,23 +95,26 @@ } #intro #compass { pointer-events: none; - width: 300px; - height: 300px; - background: black; + background-image: url(../img/compass-logo.png); + background-repeat: no-repeat; + background-position: center center; + background-size: 250px 250px; + width: 250px; + height: 250px; padding: 0px; border-radius: 50%; } #intro .store { - -webkit-transform: translateX(-50%) translateY(-50%) translateY(170px) rotateZ(0deg); + -webkit-transform: translateX(-50%) translateY(-50%) translateY(145px) rotateZ(0deg); } #intro .hub { - -webkit-transform: translateX(-50%) translateY(-50%) translateX(170px) rotateZ(90deg); + -webkit-transform: translateX(-50%) translateY(-50%) translateX(140px) rotateZ(90deg); } #intro .story { - -webkit-transform: translateX(-50%) translateY(-50%) translateY(-170px) rotateZ(0deg); + -webkit-transform: translateX(-50%) translateY(-50%) translateY(-145px) rotateZ(0deg); } #intro .archive { - -webkit-transform: translateX(-50%) translateY(-50%) translateX(-170px) rotateZ(270deg); + -webkit-transform: translateX(-50%) translateY(-50%) translateX(-140px) rotateZ(270deg); } #intro .latlng { position: absolute; @@ -83,10 +130,28 @@ display: block; position: absolute; top: 0; left: 0; width: 100%; + height: 42px; background: white; } -.burger { +#header .logo { + background-image: url(../img/wide-logo.png); + background-repeat: no-repeat; + background-position: center center; + position: absolute; + background-size: contain; + width: 80px; height: 38px; + left: 50%; top: 2px; + margin-left: -40px; +} +#header .burger { + display: inline-block; font-size: 24px; + padding: 6px 10px; +} +#header .cart { + display: inline-block; + padding: 6px 10px; + float: right; } @@ -99,17 +164,39 @@ } #footer span { display: none; + padding: 10px 0; + color: #bbb; +} +#footer .filter { + float: right; + padding: 10px; +} +#footer .buynow, +#footer .addtocart, +#footer .cancel, +#footer .checkout, +#footer .checkout_proceed { + width: 50%; + text-align: center; + float: left; } /* CURTAIN FOR LOGIN AND SELECTOR VIEWS */ #curtain { - display: none; + pointer-events: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; - background: rgba(238,238,238,0.9); + background: rgba(72,72,72,0.8); + opacity: 0; + -webkit-transition: opacity 0.4s; + transition: opacity 0.4s; +} +#curtain.visible { + pointer-events: auto; + opacity: 1; } @@ -128,5 +215,27 @@ #selector { display: none; + height: 100%; width: 100%; + position: absolute; top: 0; left: 0; + background: #eeeeee; } +/* CONTENT */ + +#story, #hub, #archive, #collection, #product, #cart { + position: absolute; + top: 40px; + height: -webkit-calc(100% - 40px); + height: calc(100% - 40px); + width: 100%; +} +h1 { + text-align: center; + margin: 0; + padding: 15px 10px 10px 10px; + border-bottom: 1px solid #ccc; + font-size: 18px; + color: #ccc; + letter-spacing: 2px; + font-weight: 100; +} diff --git a/StoneIsland/platforms/ios/www/img/compass-logo.png b/StoneIsland/platforms/ios/www/img/compass-logo.png Binary files differnew file mode 100644 index 00000000..d280a7fa --- /dev/null +++ b/StoneIsland/platforms/ios/www/img/compass-logo.png diff --git a/StoneIsland/platforms/ios/www/img/wide-logo.png b/StoneIsland/platforms/ios/www/img/wide-logo.png Binary files differnew file mode 100644 index 00000000..a7f4a2ac --- /dev/null +++ b/StoneIsland/platforms/ios/www/img/wide-logo.png diff --git a/StoneIsland/platforms/ios/www/index.html b/StoneIsland/platforms/ios/www/index.html index 2cbe762b..b2f89a28 100644 --- a/StoneIsland/platforms/ios/www/index.html +++ b/StoneIsland/platforms/ios/www/index.html @@ -29,7 +29,7 @@ <div id="nav"> <span class="menu"> - <span class="logo"></span> + <div class="logo"></div> <span class="store">STORE</span> <span class="hub">HUB</span> <span class="story">STORY</span> @@ -375,7 +375,14 @@ <script src="js/lib/_router.js"></script> -<script src="js/sdk/sdk.js"></script> +<script src="js/sdk/_sdk.js"></script> +<script src="js/sdk/account.js"></script> +<script src="js/sdk/address.js"></script> +<script src="js/sdk/auth.js"></script> +<script src="js/sdk/cart.js"></script> +<script src="js/sdk/payment.js"></script> +<script src="js/sdk/product.js"></script> +<script src="js/sdk/shipping.js"></script> <script src="js/index.js"></script> </html> diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js index 31dfd743..34e8b109 100644 --- a/StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js +++ b/StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js @@ -21,10 +21,10 @@ var ArchiveView = View.extend({ this.$loader.hide() this.$content.empty() this.data.forEach(function(row){ - var t = this.template.replace({{image}}, row.image.url) - .replace({{code}}, row.code) - .replace({{title}}, row.title) - .replace({{body}}, row.body) + var t = this.template.replace(/{{image}}/, row.image.url) + .replace(/{{code}}/, row.code) + .replace(/{{title}}/, row.title) + .replace(/{{body}}/, row.body) this.$content.append(t) }.bind(this)) }, diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js index 88ae6f1f..ea9b3048 100644 --- a/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js +++ b/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js @@ -21,13 +21,13 @@ var HubView = View.extend({ this.$loader.hide() this.$content.empty() this.data.forEach(function(row){ - var t = this.template.replace({{image}}, row.image.url) - .replace({{date}}, row.date) - .replace({{code}}, row.code) - .replace({{title}}, row.title) - .replace({{subtitle}}, row.subtitle) - .replace({{link}}, row.link) - .replace({{body}}, row.body) + var t = this.template.replace(/{{image}}/, row.image.url) + .replace(/{{date}}/, row.date) + .replace(/{{code}}/, row.code) + .replace(/{{title}}/, row.title) + .replace(/{{subtitle}}/, row.subtitle) + .replace(/{{link}}/, row.link) + .replace(/{{body}}/, row.body) this.$content.append(t) }.bind(this)) }, diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js index 0f03a518..7f9b30a1 100644 --- a/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js +++ b/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js @@ -21,10 +21,10 @@ var StoryView = View.extend({ this.$loader.hide() this.$content.empty() this.data.forEach(function(row){ - var t = this.template.replace({{image}}, row.image.url) - .replace({{date}}, row.date) - .replace({{title}}, row.title) - .replace({{body}}, row.body) + var t = this.template.replace(/{{image}}/, row.image.url) + .replace(/{{date}}/, row.date) + .replace(/{{title}}/, row.title) + .replace(/{{body}}/, row.body) this.$content.append(t) }.bind(this)) }, diff --git a/StoneIsland/platforms/ios/www/js/lib/nav/CurtainView.js b/StoneIsland/platforms/ios/www/js/lib/nav/CurtainView.js index 30c3190e..ba10e232 100644 --- a/StoneIsland/platforms/ios/www/js/lib/nav/CurtainView.js +++ b/StoneIsland/platforms/ios/www/js/lib/nav/CurtainView.js @@ -9,6 +9,14 @@ var CurtainView = View.extend({ initialize: function(){ }, + show: function(){ + this.$el.addClass("visible") + }, + + hide: function(){ + this.$el.removeClass("visible") + }, + click: function(){ if (document.body.classList.contains("nav")) { app.nav.hide() diff --git a/StoneIsland/platforms/ios/www/js/lib/nav/LoginView.js b/StoneIsland/platforms/ios/www/js/lib/nav/LoginView.js index de534e32..60f6263e 100644 --- a/StoneIsland/platforms/ios/www/js/lib/nav/LoginView.js +++ b/StoneIsland/platforms/ios/www/js/lib/nav/LoginView.js @@ -21,10 +21,12 @@ var LoginView = View.extend({ this.$form.hide() this.$email.val("") this.$password.val("") + app.curtain.show() document.body.classList.add("login") }, hide: function(){ + app.curtain.hide() document.body.classList.remove("login") }, diff --git a/StoneIsland/platforms/ios/www/js/lib/nav/NavView.js b/StoneIsland/platforms/ios/www/js/lib/nav/NavView.js index c9eb2d4e..3949c3c5 100644 --- a/StoneIsland/platforms/ios/www/js/lib/nav/NavView.js +++ b/StoneIsland/platforms/ios/www/js/lib/nav/NavView.js @@ -22,12 +22,12 @@ var NavView = View.extend({ show: function(){ $("body").addClass("nav") - $("#curtain").show() + app.curtain.show() }, hide: function(){ $("body").removeClass("nav") - $("#curtain").hide() + app.curtain.hide() }, store: function(){ diff --git a/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js b/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js index 5d4e45f2..71d07723 100644 --- a/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js +++ b/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js @@ -26,7 +26,7 @@ var CollectionView = View.extend({ fetch: function(){ this.$loader.show() - sdk.fetch_collection({ + sdk.product.fetch_collection({ gallery_id: 31483, // FOCUS ON CAMO success: this.populate.bind(this) }) diff --git a/StoneIsland/platforms/ios/www/js/sdk/sdk.js b/StoneIsland/platforms/ios/www/js/sdk/_sdk.js index 893d3fae..ce68da62 100644 --- a/StoneIsland/platforms/ios/www/js/sdk/sdk.js +++ b/StoneIsland/platforms/ios/www/js/sdk/_sdk.js @@ -3,23 +3,19 @@ var sdk = (function(){ // var endpoint = "https://secure.api.yoox.biz/" var endpoint = "https://sandbox.api.yoox.biz/" - + sdk.path = function(api, path){ return endpoint + api + "/STONEISLAND_US/" + path } - sdk.fetch_collection = function(opt){ - $.ajax({ - method: "GET", - url: sdk.path("Search.API/1.2", "search.json"), - data: { format: "full", gallery: opt.gallery_id }, - success: opt.success, - }) - } - sdk.image = function(code){ return "http://cdn.yoox.biz/" + code.substr(0,2) + "/" + code + "_11_f.jpg" } + $.ajaxSetup({ + // possibly: application/json; charset=utf-8" + contentType: "application/json", + }) + return sdk -})() +})()
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/www/js/sdk/account.js b/StoneIsland/platforms/ios/www/js/sdk/account.js new file mode 100644 index 00000000..a1498e76 --- /dev/null +++ b/StoneIsland/platforms/ios/www/js/sdk/account.js @@ -0,0 +1,54 @@ +sdk.account = (function(){ + + var user_id, access_token + + // https://gist.github.com/fanfare/d18498e7fa25acbd4486 + var account = {} + account.signup = function(opt){ + $.ajax({ + method: "POST", + url: sdk.path("Account.API/1.5", "users.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-api-key": auth.apikey, + }, + data: opt.data, + success: function(data){ + console.log(data) + user_id = data['UserAccount']['UserId'] + access_token = data['UserAccount']['AccessToken'] + + auth.set_user(user_id, access_token, name) + + opt.success(data) + }, + error: opt.error, + }) + } + + account.login = function(opt){ + $.ajax({ + method: "POST", + url: sdk.path("Account.API/1.5", "authfull.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-account-token": auth.access_token, + }, + data: opt.data, + success: function(data){ + console.log(data) + auth.user_id = data['UserAccount']['UserId'] + auth.access_token = data['UserAccount']['AccessToken'] + + // why bother? + // auth.set_user(user_id, access_token, name) + + opt.success(data) + }, + error: opt.error, + }) + } + + return account + +})() diff --git a/StoneIsland/platforms/ios/www/js/sdk/address.js b/StoneIsland/platforms/ios/www/js/sdk/address.js new file mode 100644 index 00000000..16fc2dc4 --- /dev/null +++ b/StoneIsland/platforms/ios/www/js/sdk/address.js @@ -0,0 +1,38 @@ +sdk.address = (function(){ + var address = {} + + address.add = function(opt){ + $.ajax({ + method: "POST", + url: sdk.path("Account.API/1.5", "users/" + auth.user_id + "/addressBook/item.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-account-token": auth.access_token, + }, + data: opt.data, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + + address.list = function(opt){ + $.ajax({ + method: "GET", + url: sdk.path("Account.API/1.5", "users/" + auth.user_id + "/addressBook.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-account-token": auth.access_token, + }, + data: opt.data, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + +})()
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/www/js/sdk/auth.js b/StoneIsland/platforms/ios/www/js/sdk/auth.js new file mode 100644 index 00000000..911da902 --- /dev/null +++ b/StoneIsland/platforms/ios/www/js/sdk/auth.js @@ -0,0 +1,35 @@ +/* + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-account-token": auth.access_token, + "x-yoox-device": auth.device, + "x-yoox-api-key": auth.apikey, + }, +*/ + +var auth = (function(){ + var auth = {} + + auth.appname = "{API-TEST}" + auth.apikey = "{API-KEY}" + auth.device = "smartphone" + + auth.access_token = "" + auth.user_id = -1 + auth.name = name + + // ios: integrate keychain api + // android: cordova.file.externalRootDirectory api + + auth.set_user = function(user_id, access_token, name){ + // persist user data + auth.user_id = user_id + auth.access_token = access_token + auth.name = name + } + auth.get_user = function(cb){ + // fetch user data + } + + return auth +})()
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/www/js/sdk/cart.js b/StoneIsland/platforms/ios/www/js/sdk/cart.js new file mode 100644 index 00000000..3c16feae --- /dev/null +++ b/StoneIsland/platforms/ios/www/js/sdk/cart.js @@ -0,0 +1,204 @@ +sdk.cart = (function(){ + var cart = {} + + cart.id = "" + cart.token = "" + + // https://gist.github.com/fanfare/9a50c524aea417d0bf3e + cart.initialize = function(opt){ + $.ajax({ + method: "POST", + url: sdk.path("Cart.API/1.6", "carts.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-device": auth.device, + }, + data: opt.data, + success: function(data){ + console.log(data) + cart.id = data["CartSession"]["CartId"] + cart.token = data["CartSession"]["CartToken"] + opt.success(data) + }, + error: opt.error, + }) + } + + cart.set_user = function(opt){ + $.ajax({ + method: "PUT", + url: sdk.path("Cart.API/1.6", "carts.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-cart-token": cart.token, + }, + data: { + "UserId": auth.user_id, + "UserToken": auth.access_token, + }, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + + // Code10, Size, Section + cart.add_item = function(opt){ + $.ajax({ + method: "POST", + url: sdk.path("Cart.API/1.6", "carts/" + cart.id + "/items.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-cart-token": cart.token, + }, + data: opt.data, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + + cart.delete_item = function(opt){ + $.ajax({ + method: "DELETE", + url: sdk.path("Cart.API/1.6", "carts/" + cart.id + + "/items/" + opt.code10 + + "/" + opt.size + ".json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-cart-token": cart.token, + }, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + + cart.get_status = function(opt){ + $.ajax({ + method: "GET", + url: sdk.path("Cart.API/1.6", "carts/" + cart.id), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-cart-token": cart.token, + "x-yoox-device": auth.device, + }, + data: { + "UserId": auth.user_id, + "UserToken": auth.access_token, + }, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + + // NOTE: data might be wrapped in a Receiver object + cart.set_shipping_address = function(opt){ + $.ajax({ + method: "PUT", + url: sdk.path("Cart.API/1.6", "receiver.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-cart-token": cart.token, + }, + data: opt.data, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + + // NB: Payment type may simply be 1 (credit card) + cart.set_payment_type = function(opt){ + $.ajax({ + method: "PUT", + url: sdk.path("Cart.API/1.6", "carts/" + cart.id + "/paymentType.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-cart-token": cart.token, + }, + data: opt.data, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + + // use with full CC data if not storing it in wallet + cart.set_credit_card = function(opt){ + $.ajax({ + method: "PUT", + url: sdk.path("Cart.API/1.6", "carts/" + cart.id + "/creditCard.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-cart-token": cart.token, + }, + data: opt.data, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + + // use with a stored GUID + // NB: if "verification number" is 1, use CVV/CID/CVC security code + // if "verification number" is 2, use "Issue Number" + cart.use_stored_credit_card = function(opt){ + $.ajax({ + method: "PUT", + url: sdk.path("Cart.API/1.6", "carts/" + cart.id + "/userCreditCard.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-cart-token": cart.token, + }, + data: { // NB may be wrapped in UserCreditCard object + "Guid": opt.guid, + "UserId": auth.user_id, + "AccessToken": auth.access_token, + "Cvv": opt.cvv, + "Issue": opt.issue, + }, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + + cart.finalize = function(opt){ + $.ajax({ + method: "PUT", + url: sdk.path("Cart.API/1.6", "carts/" + cart.id + "/secureFinalizer.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-cart-token": cart.token, + "x-yoox-device": auth.device, + }, + data: opt.data, + success: function(data){ + console.log(data) + // order number is: + // "Info": "2905Y07FA13020" + opt.success(data) + }, + error: opt.error, + }) + } + return cart +})()
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/www/js/sdk/payment.js b/StoneIsland/platforms/ios/www/js/sdk/payment.js new file mode 100644 index 00000000..048cde4b --- /dev/null +++ b/StoneIsland/platforms/ios/www/js/sdk/payment.js @@ -0,0 +1,72 @@ +sdk.payment = (function(){ + var payment = {} + + payment.list_credit_cards = function(opt){ + $.ajax({ + method: "GET", + url: sdk.path("Account.API/1.5", "users/" + auth.user_id + "/cards.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-account-token": auth.access_token, + }, + data: opt.data, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + + payment.add_credit_card = function(opt){ + $.ajax({ + method: "POST", + url: sdk.path("Account.API/1.5", "users/" + auth.user_id + "/cards.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-account-token": auth.access_token, + }, + data: opt.data, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + + payment.delete_credit_card = function(opt){ + $.ajax({ + method: "DELETE", + url: sdk.path("Account.API/1.5", "users/" + auth.user_id + "/cards/" + opt.guid + ".json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-account-token": auth.access_token, + }, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + + payment.get_payment_types = function(opt){ + $.ajax({ + method: "GET", + url: sdk.path("Cart.API/1.6", "availablePaymentTypes.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-device": auth.device, + }, + data: opt.data, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + + return payment +})()
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/www/js/sdk/product.js b/StoneIsland/platforms/ios/www/js/sdk/product.js new file mode 100644 index 00000000..c904eb32 --- /dev/null +++ b/StoneIsland/platforms/ios/www/js/sdk/product.js @@ -0,0 +1,25 @@ +sdk.product = (function(){ + var product = {} + + product.fetch_collection = function(opt){ + $.ajax({ + method: "GET", + url: sdk.path("Search.API/1.2", "search.json"), + data: { format: "full", gallery: opt.gallery_id }, + success: opt.success, + error: opt.error, + }) + } + + // https://gist.github.com/fanfare/2d25d1b36944188948ff + product.item = function(opt){ + $.ajax({ + method: "GET", + url: sdk.path("Item.API/1.0", "item/" + data.code + ".json"), + success: opt.success, + error: opt.error, + }) + } + + return product +})()
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/www/js/sdk/shipping.js b/StoneIsland/platforms/ios/www/js/sdk/shipping.js new file mode 100644 index 00000000..400d3199 --- /dev/null +++ b/StoneIsland/platforms/ios/www/js/sdk/shipping.js @@ -0,0 +1,82 @@ +sdk.shipping = (function(){ + var shipping = {} + + // https://gist.github.com/fanfare/edb524128461b573d833 + + // BOX TYPE + + shipping.get_box_types = function(opt){ + $.ajax({ + method: "GET", + url: sdk.path("Cart.API/1.6", "carts/" + cart.id + "/availableBoxTypes.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-cart-token": cart.token, + }, + success: function(data){ + console.log(data) + opt.success(data['BoxTypes']['Types']) + }, + error: opt.error, + }) + } + + shipping.set_box_type = function(opt){ + $.ajax({ + method: "PUT", + url: sdk.path("Cart.API/1.6", "carts/" + cart.id + "/boxType.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-cart-token": cart.token, + }, + data: { + "Type": opt.type, + }, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + + + // DELIVERY TYPES + + shipping.get_delivery_types = function(opt){ + $.ajax({ + method: "GET", + url: sdk.path("Cart.API/1.6", "carts/" + cart.id + "/availableDeliveryTypes.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-cart-token": cart.token, + }, + success: function(data){ + console.log(data) + opt.success(data['DeliveryTypes']['Types']) + }, + error: opt.error, + }) + } + + shipping.set_delivery_type = function(opt){ + $.ajax({ + method: "PUT", + url: sdk.path("Cart.API/1.6", "carts/" + cart.id + "/availableBoxTypes.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-cart-token": cart.token, + }, + data: { + "Id": opt.id, + }, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + + return shipping +})()
\ No newline at end of file diff --git a/StoneIsland/www/js/index.js b/StoneIsland/www/js/index.js index 31e78c92..82766082 100644 --- a/StoneIsland/www/js/index.js +++ b/StoneIsland/www/js/index.js @@ -1,7 +1,24 @@ var app = (function(){ var app = {} - app.init = function(){ + app.init = function(){ + app.bind() + app.build() + + if (window.cordova) { + document.addEventListener('deviceready', app.ready, false) + } + else { + app.ready() + } + } + + app.bind = function(){ + document.addEventListener('touchmove', function(e){ e.preventDefault() }) + FastClick.attach(document.body) + } + + app.build = function(){ app.blog = new BlogView () app.archive = new ArchiveView () app.hub = new HubView () @@ -21,17 +38,6 @@ var app = (function(){ app.collection = new CollectionView () app.selector = new Selector () - - app.bind() - } - - app.bind = function(){ - if (window.cordova) { - document.addEventListener('deviceready', app.ready, false) - } - else { - app.ready() - } } app.ready = function(){ @@ -39,8 +45,6 @@ var app = (function(){ // cordova.plugins.Keyboard.disableScroll(true) } - document.addEventListener('touchmove', function(e){ e.preventDefault() }) - app.view = null app.router = new SiteRouter () app.router.route() |
