From dcfa27e4b0cee0f5634842ef087563896880ef7a Mon Sep 17 00:00:00 2001 From: DemetriousWilson Date: Thu, 29 Dec 2016 18:17:29 -0800 Subject: [PATCH 1/9] Add Analytics to api-js --- src/api/analytics.js | 55 ++++++++++++++++++++++++++++++++++++++++++++ src/endpoints.js | 3 +++ src/index.js | 5 ++++ 3 files changed, 63 insertions(+) create mode 100644 src/api/analytics.js diff --git a/src/api/analytics.js b/src/api/analytics.js new file mode 100644 index 0000000..54b0bf7 --- /dev/null +++ b/src/api/analytics.js @@ -0,0 +1,55 @@ +// @class Analytics +// Accessible via [analytics](#foxapi-analytics) property of [FoxApi](#foxapi) instance. + +import * as endpoints from '../endpoints'; +import querystring from 'querystring'; + +function randomSalt(maxRand = 100000) { + return Math.floor(Math.random() * maxRand); +} + +function sphexTrackerUrl(tracker, saltFunction = randomSalt) { + const { channel, subject, verb, obj, objId } = tracker; + const queryParams = { + ch: channel, + sub: subject, + v: verb, + ob: obj, + id: objId, + salt: saltFunction(), + }; + const query = querystring.stringify(queryParams); + + return `${endpoints.hal}?${query}`; +} + +export default class Analytics { + constructor(api) { + this.api = api; + } + + /** + * @method trackEvent(tracker: Object, saltFunction?: Function): Promise + * Enables the tracking of UI specific events. The optional salt function must + * be a random number generator. + */ + trackEvent(tracker, saltFunction = randomSalt) { + return this.api.get(sphexTrackerUrl(tracker, saltFunction)); + } +} + +// @miniclass SphexTracker (Analytics) +// @field channel: Number +// Unique Channel ID number +// +// @field subject: Number +// Unique Subject ID number +// +// @field obj: String +// Name of the object type you are tracking the event for +// +// @field verb: String +// A single word that describes the event +// +// @field objId: Number +// Unique number that can trace the object being tracked diff --git a/src/endpoints.js b/src/endpoints.js index 2dda342..a06106a 100644 --- a/src/endpoints.js +++ b/src/endpoints.js @@ -54,3 +54,6 @@ export const changePassword = '/v1/my/account/change-password'; // orders endpoints export const orders = '/search/admin/orders_search_view/_search'; export const order = referenceNumber => `/v1/my/orders/${referenceNumber}`; + +// analytics endpoints +export const hal = '/api/v1/hal'; diff --git a/src/index.js b/src/index.js index 317c817..89bebe0 100644 --- a/src/index.js +++ b/src/index.js @@ -20,6 +20,7 @@ import Cart from './api/cart'; import Account from './api/account'; import Orders from './api/orders'; import jwtDecode from 'jwt-decode'; +import Analytics from './api/analytics'; export default class Api { constructor(args) { @@ -62,6 +63,10 @@ export default class Api { // @property orders: Orders // Orders instance this.orders = new Orders(this); + + // @property analytics: Analytics + // Analytics instance + this.analytics = new Analytics(this); } // @method addAuth(jwt: String): FoxApi From 8e7556bfcc8967fb33a680d6dd925937030f9f1a Mon Sep 17 00:00:00 2001 From: DemetriousWilson Date: Fri, 30 Dec 2016 16:25:03 -0800 Subject: [PATCH 2/9] Remove extra 'api' from analytics hal endpoint --- src/endpoints.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/endpoints.js b/src/endpoints.js index a06106a..2be47da 100644 --- a/src/endpoints.js +++ b/src/endpoints.js @@ -56,4 +56,4 @@ export const orders = '/search/admin/orders_search_view/_search'; export const order = referenceNumber => `/v1/my/orders/${referenceNumber}`; // analytics endpoints -export const hal = '/api/v1/hal'; +export const hal = '/v1/hal'; From 60ced12b8f4085ea68a40cce1a80a01743a89d44 Mon Sep 17 00:00:00 2001 From: DemetriousWilson Date: Mon, 23 Jan 2017 10:51:14 -0800 Subject: [PATCH 3/9] Add 'count' to tracking analytics, update gitignore to include vscode --- .gitignore | 1 + src/api/analytics.js | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 69efb3d..0f8a87f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /node_modules /.idea +/.vscode /lib *.log diff --git a/src/api/analytics.js b/src/api/analytics.js index 54b0bf7..07917e8 100644 --- a/src/api/analytics.js +++ b/src/api/analytics.js @@ -8,15 +8,20 @@ function randomSalt(maxRand = 100000) { return Math.floor(Math.random() * maxRand); } +// Add a count argument function sphexTrackerUrl(tracker, saltFunction = randomSalt) { - const { channel, subject, verb, obj, objId } = tracker; + const { channel, subject, verb, obj, objId, count } = tracker; + + const realCount = (typeof count !== 'undefined') ? count : 1; + const queryParams = { ch: channel, sub: subject, v: verb, ob: obj, id: objId, - salt: saltFunction(), + c: realCount, + slt: saltFunction(), }; const query = querystring.stringify(queryParams); @@ -53,3 +58,6 @@ export default class Analytics { // // @field objId: Number // Unique number that can trace the object being tracked +// +// @field count: Number +// Quantity \ No newline at end of file From 78ab79f27117f9526776a9c8186c75e4fbfa913b Mon Sep 17 00:00:00 2001 From: DemetriousWilson Date: Thu, 26 Jan 2017 10:02:26 -0800 Subject: [PATCH 4/9] Add lodash to api-js --- package.json | 5 +-- src/api/analytics.js | 3 +- yarn.lock | 85 +++++++++++++++++++++++++------------------- 3 files changed, 53 insertions(+), 40 deletions(-) diff --git a/package.json b/package.json index f52e62c..2bbf011 100644 --- a/package.json +++ b/package.json @@ -28,9 +28,10 @@ "homepage": "https://github.com/FoxComm/api-js#readme", "dependencies": { "debug": "^2.2.0", + "jwt-decode": "^2.0.1", + "lodash": "^4.17.4", "postinstall-build": "^0.2.1", - "superagent": "^3.2.1", - "jwt-decode": "^2.0.1" + "superagent": "^3.2.1" }, "devDependencies": { "babel-cli": "^6.9.0", diff --git a/src/api/analytics.js b/src/api/analytics.js index 07917e8..b5d2d84 100644 --- a/src/api/analytics.js +++ b/src/api/analytics.js @@ -2,6 +2,7 @@ // Accessible via [analytics](#foxapi-analytics) property of [FoxApi](#foxapi) instance. import * as endpoints from '../endpoints'; +import _ from 'lodash'; import querystring from 'querystring'; function randomSalt(maxRand = 100000) { @@ -12,7 +13,7 @@ function randomSalt(maxRand = 100000) { function sphexTrackerUrl(tracker, saltFunction = randomSalt) { const { channel, subject, verb, obj, objId, count } = tracker; - const realCount = (typeof count !== 'undefined') ? count : 1; + const realCount = _.isNil(count) ? 1 : count; const queryParams = { ch: channel, diff --git a/yarn.lock b/yarn.lock index a5af14d..fe7f6fe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -799,6 +799,10 @@ commander@^2.8.1, commander@^2.9.0: dependencies: graceful-readlink ">= 1.0.0" +component-emitter@^1.2.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6" + concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" @@ -811,6 +815,10 @@ convert-source-map@^1.1.0: version "1.3.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.3.0.tgz#e9f3e9c6e2728efc2676696a70eb382f73106a67" +cookiejar@^2.0.6: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.0.tgz#86549689539b6d0e269b6637a304be508194d898" + core-js@^2.4.0: version "2.4.1" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e" @@ -881,12 +889,6 @@ ecc-jsbn@~0.1.1: dependencies: jsbn "~0.1.0" -encoding@^0.1.11: - version "0.1.12" - resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" - dependencies: - iconv-lite "~0.4.13" - es6-promise@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-2.3.0.tgz#96edb9f2fdb01995822b263dd8aadab6748181bc" @@ -915,7 +917,7 @@ expand-range@^1.8.1: dependencies: fill-range "^2.1.0" -extend@~3.0.0: +extend@^3.0.0, extend@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.0.tgz#5a474353b9f3353ddd8176dfd37b91c83a46f1d4" @@ -957,7 +959,7 @@ forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" -form-data@~2.1.1: +form-data@^2.1.1, form-data@~2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.1.2.tgz#89c3534008b97eada4cbb157d58f6f5df025eae4" dependencies: @@ -965,6 +967,10 @@ form-data@~2.1.1: combined-stream "^1.0.5" mime-types "^2.1.12" +formidable@^1.0.17: + version "1.1.1" + resolved "https://registry.yarnpkg.com/formidable/-/formidable-1.1.1.tgz#96b8886f7c3c3508b932d6bd70c4d3a88f35f1a9" + fs-readdir-recursive@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.0.0.tgz#8cd1745c8b4f8a29c8caec392476921ba195f560" @@ -1146,10 +1152,6 @@ http-signature@~1.1.0: jsprim "^1.2.2" sshpk "^1.7.0" -iconv-lite@~0.4.13: - version "0.4.15" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.15.tgz#fe265a218ac6a57cfe854927e9d04c19825eddeb" - inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -1244,10 +1246,6 @@ is-property@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" -is-stream@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" - is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" @@ -1262,13 +1260,6 @@ isobject@^2.0.0: dependencies: isarray "1.0.0" -isomorphic-fetch@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" - dependencies: - node-fetch "^1.0.1" - whatwg-fetch ">=0.10.0" - isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" @@ -1347,7 +1338,11 @@ kind-of@^3.0.2: unicode-7.0.0 "^0.1.5" xregexp "^2.0.0" -lodash@^4.13.1, lodash@^4.2.0: +lodash@^4.17.4: + version "4.17.4" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" + +lodash@^4.2.0: version "4.17.2" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.2.tgz#34a3055babe04ce42467b607d700072c7ff6bf42" @@ -1369,6 +1364,10 @@ marked@^0.3.5: version "0.3.6" resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.6.tgz#b2c6c618fccece4ef86c4fc6cb8a7cbf5aeda8d7" +methods@^1.1.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" + micromatch@^2.1.5: version "2.3.11" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" @@ -1397,6 +1396,10 @@ mime-types@^2.1.12, mime-types@~2.1.7: dependencies: mime-db "~1.25.0" +mime@^1.3.4: + version "1.3.4" + resolved "https://registry.yarnpkg.com/mime/-/mime-1.3.4.tgz#115f9e3b6b3daf2959983cb38f149a2d40eb5d53" + minimatch@0.3: version "0.3.0" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-0.3.0.tgz#275d8edaac4f1bb3326472089e7949c8394699dd" @@ -1472,13 +1475,6 @@ nock@^8.0.0: propagate "0.4.0" qs "^6.0.2" -node-fetch@^1.0.1: - version "1.6.3" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.6.3.tgz#dc234edd6489982d58e8f0db4f695029abcd8c04" - dependencies: - encoding "^0.1.11" - is-stream "^1.0.1" - node-pre-gyp@^0.6.29: version "0.6.32" resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.32.tgz#fc452b376e7319b3d255f5f34853ef6fd8fe1fd5" @@ -1595,6 +1591,10 @@ pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" +postinstall-build@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/postinstall-build/-/postinstall-build-0.2.1.tgz#132e95029ba6ee5229a8802b90a7adbf3f46875d" + preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" @@ -1615,7 +1615,7 @@ punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" -qs@^6.0.2, qs@~6.3.0: +qs@^6.0.2, qs@^6.1.0, qs@~6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.0.tgz#f403b264f23bc01228c74131b407f18d5ea5d442" @@ -1635,7 +1635,7 @@ rc@~1.1.6: minimist "^1.2.0" strip-json-comments "~1.0.4" -"readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.2: +"readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.2, readable-stream@^2.0.5: version "2.2.2" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.2.tgz#a9e6fec3c7dda85f8bb1b3ba7028604556fc825e" dependencies: @@ -1850,6 +1850,21 @@ strip-json-comments@~1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-1.0.4.tgz#1e15fbcac97d3ee99bf2d73b4c656b082bbafb91" +superagent@^3.2.1: + version "3.4.0" + resolved "https://registry.yarnpkg.com/superagent/-/superagent-3.4.0.tgz#cf8e40b303d5b2949c0fb036ddc30927e14958c7" + dependencies: + component-emitter "^1.2.0" + cookiejar "^2.0.6" + debug "^2.2.0" + extend "^3.0.0" + form-data "^2.1.1" + formidable "^1.0.17" + methods "^1.1.1" + mime "^1.3.4" + qs "^6.1.0" + readable-stream "^2.0.5" + supports-color@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-1.2.0.tgz#ff1ed1e61169d06b3cf2d588e188b18d8847e17e" @@ -1953,10 +1968,6 @@ verror@1.3.6: dependencies: extsprintf "1.0.2" -whatwg-fetch@>=0.10.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.1.tgz#078b9461bbe91cea73cbce8bb122a05f9e92b772" - wide-align@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.0.tgz#40edde802a71fea1f070da3e62dcda2e7add96ad" From 3bbe1477119edd39531a55dc0d52de9dedc96d2c Mon Sep 17 00:00:00 2001 From: Maxim Khailo Date: Tue, 31 Jan 2017 13:45:10 -0800 Subject: [PATCH 5/9] Added a new function so we can use api-js in a non-browser setting Checkout can now work in a non-browser setting. --- src/api/credit-cards.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/api/credit-cards.js b/src/api/credit-cards.js index 6076e1c..3fe48f0 100644 --- a/src/api/credit-cards.js +++ b/src/api/credit-cards.js @@ -36,13 +36,21 @@ export default class CreditCards { if (response.error) { reject([response.error.message]); } else { - var payload = creditCardFromStripePayload(response, billingAddress, addressIsNew); + return createCardFromStripeToken(response, billingAddress, addressIsNew) + .then(response => resolve(response)) + .catch(err => reject(err)); + } + }); + }); + } + + createCardFromStripeToken(token, billingAddress, addressIsNew) { + return new Promise((resolve, reject) => { + var payload = creditCardFromStripePayload(token, billingAddress, addressIsNew); return this.api.post(endpoints.creditCards, payload) .then(response => resolve(response)) .catch(err => !!err.responseJson.errors ? reject(err.responseJson.errors) : reject([err.message])); - } - }); }); } From 0443f326a21ab17c574e64a22b2790b2349128b5 Mon Sep 17 00:00:00 2001 From: DemetriousWilson Date: Fri, 17 Feb 2017 11:04:47 -0800 Subject: [PATCH 6/9] Remove lodash from analytics.js, update default count --- src/api/analytics.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/api/analytics.js b/src/api/analytics.js index b5d2d84..2f2a0ab 100644 --- a/src/api/analytics.js +++ b/src/api/analytics.js @@ -2,7 +2,6 @@ // Accessible via [analytics](#foxapi-analytics) property of [FoxApi](#foxapi) instance. import * as endpoints from '../endpoints'; -import _ from 'lodash'; import querystring from 'querystring'; function randomSalt(maxRand = 100000) { @@ -11,9 +10,7 @@ function randomSalt(maxRand = 100000) { // Add a count argument function sphexTrackerUrl(tracker, saltFunction = randomSalt) { - const { channel, subject, verb, obj, objId, count } = tracker; - - const realCount = _.isNil(count) ? 1 : count; + const { channel, subject, verb, obj, objId, count = 1 } = tracker; const queryParams = { ch: channel, @@ -21,7 +18,7 @@ function sphexTrackerUrl(tracker, saltFunction = randomSalt) { v: verb, ob: obj, id: objId, - c: realCount, + c: count, slt: saltFunction(), }; const query = querystring.stringify(queryParams); From d5aa1412cf9e343b562eb83744db742fbe5aadea Mon Sep 17 00:00:00 2001 From: DemetriousWilson Date: Fri, 17 Feb 2017 11:38:09 -0800 Subject: [PATCH 7/9] Add babel-plugin-lodash dev dependency --- .babelrc | 1 + package.json | 1 + yarn.lock | 11 +++++++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.babelrc b/.babelrc index 36ef793..1a2920f 100644 --- a/.babelrc +++ b/.babelrc @@ -1,3 +1,4 @@ { + "plugins": ["lodash"], "presets": ["es2015", "stage-1"] } diff --git a/package.json b/package.json index 03306c0..483d572 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ }, "devDependencies": { "babel-cli": "^6.9.0", + "babel-plugin-lodash": "^3.2.11", "babel-preset-es2015": "^6.9.0", "babel-preset-stage-1": "^6.5.0", "escape-html": "^1.0.3", diff --git a/yarn.lock b/yarn.lock index 74e0746..e05b9ad 100644 --- a/yarn.lock +++ b/yarn.lock @@ -285,6 +285,13 @@ babel-plugin-check-es2015-constants@^6.3.13: dependencies: babel-runtime "^6.0.0" +babel-plugin-lodash@^3.2.11: + version "3.2.11" + resolved "https://registry.yarnpkg.com/babel-plugin-lodash/-/babel-plugin-lodash-3.2.11.tgz#21c8fdec9fe1835efaa737873e3902bdd66d5701" + dependencies: + glob "^7.1.1" + lodash "^4.17.2" + babel-plugin-syntax-async-functions@^6.8.0: version "6.13.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz#cad9cad1191b5ad634bf30ae0872391e0647be95" @@ -1063,7 +1070,7 @@ glob@^5.0.5: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.5: +glob@^7.0.5, glob@^7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" dependencies: @@ -1338,7 +1345,7 @@ kind-of@^3.0.2: unicode-7.0.0 "^0.1.5" xregexp "^2.0.0" -lodash@^4.17.4, lodash@^4.2.0: +lodash@^4.17.2, lodash@^4.17.4, lodash@^4.2.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" From fb14ee0a583ce3b0b29ee94dc86ae9b6aedba384 Mon Sep 17 00:00:00 2001 From: DemetriousWilson Date: Fri, 17 Feb 2017 12:02:06 -0800 Subject: [PATCH 8/9] Update API docs index.html --- index.html | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 114 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 49d64f0..99a0531 100644 --- a/index.html +++ b/index.html @@ -228,6 +228,11 @@

Properties

Orders Orders instance + + analytics + Analytics + Analytics instance + @@ -1461,6 +1466,103 @@

UpdateAddressPayload

+ + + +

Analytics

Accessible via analytics property of FoxApi instance.

+ +
+

Methods

+ +
+ + + +
+ + + + + + + + + + + + + +
MethodReturnsDescription
trackEvent(<Object<SphexTracker>> tracker, <Function> saltFunction?)PromiseEnables the tracking of UI specific events. The optional salt function must +be a random number generator.
+ +
+ +
+ + +
+

SphexTracker

+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FieldTypeRequiredExampleDescription
channelNumber +
Unique Channel ID number
subjectNumber +
Unique Subject ID number
objString +
Name of the object type you are tracking the event for
verbString +
A single word that describes the event
objIdNumber +
Unique number that can trace the object being tracked
countNumber +
+ +
@@ -1503,6 +1605,12 @@

Methods

Promse Removes JWT cookie. + + restorePassword(<String> email) + Promise + requests email instructions to reset password +creates new password + @@ -1687,11 +1795,15 @@

Methods

Adds a gift card as payment method for the cart.

Creates payment method with a given amount using store credit.

+ + removeGiftCard(<string> giftCardCode) + Promise<FullOrder> + Removes gift card with provided code payment method from the cart. + removeGiftCards() Promise<FullOrder> - Removes all gift cards payment methods of the cart. -

Removes all store credits payment methods of the cart.

+ Removes all store credits payment methods of the cart. addCoupon(<Number> code) From df19196c7c34c7b97c11d1c2307875cb284ac698 Mon Sep 17 00:00:00 2001 From: Andrey Rublev Date: Sat, 18 Feb 2017 04:56:07 +0700 Subject: [PATCH 9/9] fix apidoc --- index.html | 4 ++-- src/api/cart.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 99a0531..de55f8b 100644 --- a/index.html +++ b/index.html @@ -1800,8 +1800,8 @@

Methods

Promise<FullOrder> Removes gift card with provided code payment method from the cart. - - removeGiftCards() + + removeStoreCredits() Promise<FullOrder> Removes all store credits payment methods of the cart. diff --git a/src/api/cart.js b/src/api/cart.js index 3109865..a56ee66 100644 --- a/src/api/cart.js +++ b/src/api/cart.js @@ -187,10 +187,10 @@ export default class Cart { } /** - * @method removeGiftCards(): Promise + * @method removeStoreCredits(): Promise * Removes all store credits payment methods of the cart. */ - removeStoreCrdits() { + removeStoreCredits() { return this.api.delete(endpoints.cartPaymentStoreCredits).then(normalizeResponse); }