Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
import { absoluteUrl, studioId, readyApiUrl } from '../ENV'

// base urls
// for whatever reason absoluteUrl fails in https.
export const baseUrl = absoluteUrl
// written as baseUrl because consistency with all other URL constants
// export const baseURL = baseUrl

const cartAndCheckoutBaseUrl = `${readyApiUrl}:7008`

const urls = {
  getPagesBaseUrl: `${baseUrl}/api/getPages/${studioId}/prod`,
  getCatalogBaseUrl: `${baseUrl}/api/getCatalog/${studioId}/prod`,
  categoryBaseUrl: `${baseUrl}/api/category`,
  productListBaseUrl: `${baseUrl}/api/productlist`,
  searchBaseUrl: `${baseUrl}/api/search`,
  searchsuggestionBaseUrl: `${baseUrl}/api/searchsuggestion`,
  productBaseUrl: `${baseUrl}/api/product`,
  userBaseUrl: `${baseUrl}/api/profile`,
  getProfileUrl: `${baseUrl}/api/profile/get`,
  updateProfileUrl: `${baseUrl}/api/profile/update`,
  viewBagBaseUrl: `${baseUrl}/api/viewbag`,
  getListBaseUrl: `${baseUrl}/api/getlists`,
  productGetReviewBaseUrl: `${baseUrl}/api/reviews`,
  productSubmitReviewBaseUrl: `${baseUrl}/api/submitreview`,
  orderLookUpBaseUrl: `${baseUrl}/api/orderdetails`,
  orderStatusChangeBaseUrl: `${baseUrl}/api/submitorder`,
  getStoreBaseUrl: `${baseUrl}/api/getstores`,
  logoutBaseUrl: `${baseUrl}/api/logout`,
  loginBaseURL: `${baseUrl}/api/login`,
  registerBaseUrl: `${baseUrl}/api/register`,
  createListBaseUrl: `${baseUrl}/api/createlist/_wishlist_template_`,
  saveforlaterBaseUrl: `${baseUrl}/api/createlist/_saveforlater_template_`,
  addItemBaseUrl: `${baseUrl}/api/additem`,
  deleteItemBaseUrl: `${baseUrl}/api/deleteitem`,
  getItemBaseUrl: `${baseUrl}/api/getitems`,
  // storeCreditURL: `${baseUrl}/api/user/get`,

  addaddressBaseUrl: `${baseUrl}/api/setshippingaddress/update`,
  addcardBaseUrl: `${baseUrl}/api/setpaymentmethod`,

  deletecardBaseUrl: `${baseUrl}/api/deletecard`,

  resetPasswordUrl: `${baseUrl}/api/resetpassword`,
  resetPasswordBySQUrl: `${baseUrl}/api/resetpassword/bysecurityquestion`,
  validateResetSMSUrl: `${baseUrl}/api/resetpassword/validateresetsms`,
  resetPasswordByMailUrl: `${baseUrl}/api/resetpassword/byemail`,
  validateResetEmailUrl: `${baseUrl}/api/resetpassword/validateresetemail`,
  updatePasswordUrl: `${baseUrl}/api/updatepassword`,
  addSecurityQuestionUrl: `${baseUrl}/api/profile/update`,
  getSecurityQuestionUrl: `${baseUrl}/api/profile/getsecurityquestion`,

  addToBagBaseUrl: `${baseUrl}/api/addtobag`,
  deleteFromBagBaseUrl: `${baseUrl}/api/deletefrombag`,
  shippingAndTaxBaseUrl: `${baseUrl}/api/estimate`,
  updateBagBaseUrl: `${baseUrl}/api/updatebag`,
  setShippingAddressBaseUrl: `${baseUrl}/api/setshippingaddress`,
  updateShippingMethodsBaseUrl: `${baseUrl}/api/updateshippingmethods`,
  paymentBaseUrl: `${baseUrl}/api/payment`,
  submitOrderBaseUrl: `${baseUrl}/api/submitorder`,
  suspendCartBaseUrl: `${baseUrl}/api/suspendcart`,
  loyaltyBaseURL: `${baseUrl}/api/createtransactionforuser`,
  googleBaseUrl: `https://maps.googleapis.com/maps/api/geocode/json`,

  getKeyForToken: `${baseUrl}/api/getKeyForToken`,

  getLoyaltyPointsUrl: `${baseUrl}/api/loyalty/user/get`,
  getLoyaltyTransactionUrl: `${baseUrl}/api/loyalty/gettransactions`,
  loyaltyCreateTransactionUrl: `${baseUrl}/api/loyalty/createtransactionforuser`,

  getTokenForTwitterUrl: `${baseUrl}/api/checkoutauth`,

  resetByMailUrl: `${baseUrl}/api/resetpasswordbyemail`,
  validatePasswordResetUrl: `${baseUrl}/api/validateresetpassword`,
  resetPasswordBySecurityQuestionUrl: `${baseUrl}/api/resetpasswordbysecurityquestion`,
  updateUserProfileUrl: `${baseUrl}/api/updateprofile`,
  userAddressesBaseUrl: `${baseUrl}/api/useraddresses`,
  customerActivationBaseUrl: `${baseUrl}/api/useractivation`,

  accountRegisterBaseUrl: `${baseUrl}/api/accountregister`,
  getAccountBaseUrl: `${baseUrl}/api/accountprofile`,
  getInviteTeamBaseUrl: `${baseUrl}/api/accountinvite`,
}

console.log('urlconfig', process.env.DEBUG_CLIENT_REQUEST_APIS)

/**
 * @todo @anto
 */
if (process.env.DEBUG_CLIENT_REQUEST_APIS) {
  Object.keys(urls).forEach(key => {
    const url = urls[key]
    if (url.includes('/api/')) {
      const afterApi = url.split('/api').pop()
      const methodCallType = callDetails[afterApi]
      const proxyApi = getURL(afterApi, methodCallType)
      console.log({ afterApi, proxyApi, methodCallType })
    }
  })
}

export const {
  getPagesBaseUrl,
  getCatalogBaseUrl,
  categoryBaseUrl,
  productListBaseUrl,
  searchBaseUrl,
  searchsuggestionBaseUrl,
  productBaseUrl,
  userBaseUrl,
  getProfileUrl,
  updateProfileUrl,
  viewBagBaseUrl,
  getListBaseUrl,
  productGetReviewBaseUrl,
  productSubmitReviewBaseUrl,
  orderLookUpBaseUrl,
  orderStatusChangeBaseUrl,
  getStoreBaseUrl,
  logoutBaseUrl,
  loginBaseURL,
  registerBaseUrl,
  createListBaseUrl,
  saveforlaterBaseUrl,
  addItemBaseUrl,
  deleteItemBaseUrl,
  getItemBaseUrl,
  // storeCreditURL,
  addaddressBaseUrl,
  userAddressesBaseUrl,
  addcardBaseUrl,
  deletecardBaseUrl,
  resetPasswordUrl,
  resetPasswordBySQUrl,
  validateResetSMSUrl,
  resetPasswordByMailUrl,
  validateResetEmailUrl,
  updatePasswordUrl,
  addSecurityQuestionUrl,
  getSecurityQuestionUrl,
  addToBagBaseUrl,
  deleteFromBagBaseUrl,
  shippingAndTaxBaseUrl,
  updateBagBaseUrl,
  setShippingAddressBaseUrl,
  updateShippingMethodsBaseUrl,
  paymentBaseUrl,
  submitOrderBaseUrl,
  suspendCartBaseUrl,
  loyaltyBaseURL,
  googleBaseUrl,
  getKeyForToken,
  getLoyaltyPointsUrl,
  getLoyaltyTransactionUrl,
  loyaltyCreateTransactionUrl,
  getTokenForTwitterUrl,
  resetByMailUrl,
  validatePasswordResetUrl,
  resetPasswordBySecurityQuestionUrl,
  updateUserProfileUrl,
  customerActivationBaseUrl,
  accountRegisterBaseUrl,
  getAccountBaseUrl,
  getInviteTeamBaseUrl,
} = urls