@como/como-client
Advanced tools
Comparing version 0.1.3-2.4 to 0.1.3-2.5
{ | ||
"name": "@como/como-client", | ||
"version": "0.1.32.4", | ||
"version": "0.1.32.5", | ||
"description": "Client module for Como's loaylty API", | ||
@@ -5,0 +5,0 @@ "main": "src/como.js", |
@@ -22,3 +22,3 @@ const moment = require('moment-timezone'); | ||
module.exports = class Como { | ||
class Como { | ||
@@ -87,3 +87,3 @@ constructor() { | ||
const updateCredentials = (creds, isNew = false) => { | ||
updateLocalCreds(creds); | ||
this.updateLocalCreds(creds); | ||
if (refreshCallback && isNew) { | ||
@@ -96,3 +96,3 @@ refreshCallback(creds); | ||
const { service, refresher } = APIService | ||
.getService(gateway, installationId, getCredentials, updateCredentials); | ||
.getService(gateway, installationId, this.getCredentials, updateCredentials); | ||
this.comoData.api = service; | ||
@@ -105,6 +105,6 @@ this.comoData.refresher = refresher; | ||
if (enableSignon && (credsNotExist || isExpired)) { | ||
await signon(); | ||
await this.signon(); | ||
} | ||
return getCredentials(); | ||
return this.getCredentials(); | ||
}; | ||
@@ -133,3 +133,3 @@ | ||
const url = possibleWebViews && possibleWebViews[0] && possibleWebViews[0].url; | ||
return translateExternalUrl(url, gpsData, assetID, accessibilityData); | ||
return this.translateExternalUrl(url, gpsData, assetID, accessibilityData); | ||
} | ||
@@ -140,3 +140,3 @@ return null; | ||
async translateExternalUrl(url, gpsData, assetID, accessibilityData) { | ||
const legacyUrl = await getAppModulesLegacyBaseUrl(); | ||
const legacyUrl = await this.getAppModulesLegacyBaseUrl(); | ||
let externalUrl = url; | ||
@@ -189,3 +189,3 @@ if (externalUrl && externalUrl.startsWith(legacyUrl)) { | ||
async registerVerify(verificationCode, type, form){ | ||
const { api } = comoData; | ||
const { api } = this.comoData; | ||
try { | ||
@@ -305,3 +305,3 @@ const data = await api.registerVerify(verificationCode, type, form); | ||
api, locationId, token, env_params: env, | ||
} = comoData; | ||
} = this.comoData; | ||
@@ -319,3 +319,3 @@ return api.openApp(env.zapp_root, token, locationId, data); | ||
api, locationId, token, env_params: env, | ||
} = comoData; | ||
} = this.comoData; | ||
@@ -337,3 +337,3 @@ return api.clientUpdateMembership(env.services_root, token, locationId, pushEnable, locationEnable); | ||
const { env_params: env, api } = comoData; | ||
const { env_params: env, api } = this.comoData; | ||
const responseJson = await api.getLoyaltyResource( | ||
@@ -355,3 +355,3 @@ env.services_root_temp, | ||
async reloadLocationState() { | ||
const { api } = comoData; | ||
const { api } = this.comoData; | ||
const state = await api.getLocationState(this.comoData.env_params.zapp_root, this.comoData.locationId); | ||
@@ -373,3 +373,3 @@ this.comoData.locationState = state; | ||
env_params: env, locationId, api, | ||
} = comoData; | ||
} = this.comoData; | ||
const responseJson = await api.getShortUserId(env.zapp_root, locationId); | ||
@@ -385,3 +385,3 @@ return responseJson.ID; | ||
env_params: env, locationId, api, | ||
} = comoData; | ||
} = this.comoData; | ||
const responseJson = await api.getPaymentCode(env.zapp_root, locationId); | ||
@@ -395,3 +395,3 @@ return responseJson.VerificationCode; | ||
async logout() { | ||
const { api } = comoData; | ||
const { api } = this.comoData; | ||
try { | ||
@@ -416,3 +416,3 @@ const response = await api.logOut(); | ||
env_params: env, locationId, api, | ||
} = comoData; | ||
} = this.comoData; | ||
const responseJson = await api.redeemAsset(env.zapp_root, locationId, assetKey); | ||
@@ -429,3 +429,3 @@ return responseJson; | ||
env_params: env, token, locationId, api, | ||
} = comoData; | ||
} = this.comoData; | ||
const responseJson = await api.purchaseAsset(env.zapp_root, locationId, token, itemId); | ||
@@ -442,3 +442,3 @@ return responseJson; | ||
env_params: env, locationId, api, | ||
} = comoData; | ||
} = this.comoData; | ||
const responseJson = await api.memberAssets(env.services_root, locationId); | ||
@@ -485,3 +485,3 @@ | ||
env_params: env, locationId, api, | ||
} = comoData; | ||
} = this.comoData; | ||
const responseJson = await api.memberAssets(env.services_root, locationId, true); | ||
@@ -528,5 +528,5 @@ this.comoData.redeemedAssets = responseJson; | ||
]; | ||
const downloads = resources.map(downloadMainResource); | ||
const downloads = resources.map(this.downloadMainResource); | ||
await Promise.all(downloads); | ||
mergeTexts(); | ||
this.mergeTexts(); | ||
}; | ||
@@ -539,3 +539,3 @@ | ||
loadForm(type) { | ||
const { api, locationId } = comoData; | ||
const { api, locationId } = this.comoData; | ||
@@ -550,4 +550,4 @@ return api.getForm(type, locationId); | ||
getConfigration(type) { | ||
const { api, locationId } = comoData; | ||
const { PublishVersion: version } = getLocationState(); | ||
const { api, locationId } = this.comoData; | ||
const { PublishVersion: version } = this.getLocationState(); | ||
@@ -562,3 +562,3 @@ return api.getConfiguration(type, locationId, version); | ||
getResource(type) { | ||
const { api, locationId } = comoData; | ||
const { api, locationId } = this.comoData; | ||
return api.getResource(type, locationId); | ||
@@ -573,3 +573,3 @@ }; | ||
api, locationId, token, env_params: env, | ||
} = comoData; | ||
} = this.comoData; | ||
@@ -624,6 +624,6 @@ return api.generateReferralCode(env.services_root, token, locationId); | ||
async getRegistrationUrl(overrides) { | ||
await refreshTokenIfNeeded(); | ||
await this.refreshTokenIfNeeded(); | ||
const { | ||
token, installationId, locationId, env_params: env, | ||
} = comoData; | ||
} = this.comoData; | ||
@@ -645,6 +645,6 @@ return urlsUtils.appendQuery( | ||
async getProfileUrl(overrides){ | ||
await refreshTokenIfNeeded(); | ||
await this.refreshTokenIfNeeded(); | ||
const { | ||
token, installationId, locationId, env_params: env, | ||
} = comoData; | ||
} = this.comoData; | ||
@@ -654,3 +654,3 @@ return urlsUtils.appendQuery( | ||
{ | ||
...getCredentials(), | ||
...this.getCredentials(), | ||
installationId, | ||
@@ -667,4 +667,4 @@ disableSuccessScreen: 'true', | ||
async getLoginUrl() { | ||
await refreshTokenIfNeeded(); | ||
const { token, locationId, env_params: env } = comoData; | ||
await this.refreshTokenIfNeeded(); | ||
const { token, locationId, env_params: env } = this.comoData; | ||
return `${env.app_modules_root}/login?token=${token}&locationid=${locationId}`; | ||
@@ -677,4 +677,4 @@ }; | ||
async getAppModulesLegacyBaseUrl() { | ||
await refreshTokenIfNeeded(); | ||
const { env_params: env } = comoData; | ||
await this.refreshTokenIfNeeded(); | ||
const { env_params: env } = this.comoData; | ||
return `${env.app_modules_legacy_root}`; | ||
@@ -851,1 +851,3 @@ }; | ||
} | ||
module.exports = Como; |
Sorry, the diff of this file is too big to display
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
179142
3889