Config

Members

(inner, constant) excludeFromGeneratedIndex :Array.<string>

Description:
  • Exported functions that are excluded from index generation.
Source:
Exported functions that are excluded from index generation.
Type:
  • Array.<string>

Methods

(static) initializeService(config)

Description:
  • Initializes the service with the given configuration. This function must be called before using any other functions in this library.
Source:
Example
// Initialize the service in your app.js
initializeService({
  sanityConfig: {
    token: 'your-sanity-api-token',
    projectId: 'your-sanity-project-id',
    dataset: 'your-dataset-name',
    version: '2021-06-07',
    debug: true,
    useCachedAPI: false,
  },
  railcontentConfig: {
    token: 'your-user-api-token',
    userId: 'current-user-id',
    baseUrl: 'https://web-staging-one.musora.com',
    authToken: 'your-auth-token',
  },
  recommendationsConfig: {
    token: 'your-user-api-token',
    baseUrl: 'https://MusoraProductDepartment-PWGenerator.hf.space',
  },
  localStorage: localStorage,
  isMA: false,
});
Parameters:
Name Type Description
config Object Configuration object containing API settings.
Properties
Name Type Description
sanityConfig Object Configuration for Sanity API.
Properties
Name Type Attributes Default Description
token string The API token for authenticating with Sanity.
projectId string The project ID in Sanity.
dataset string The dataset name in Sanity.
version string The API version to use.
debug boolean <optional>
false Optional flag to enable debug mode.
useCachedAPI boolean <optional>
true Optional flag to enable or disable the use of the cached API.
useDummyRailContentMethods boolean <optional>
false Optional flag to use test harness for railcontent methods. Should only be used by jest tests.
railcontentConfig Object Configuration for user services.
Properties
Name Type Description
token string The token for authenticating user-specific requests.
userId string The user ID for fetching user-specific data.
baseUrl string The url for the environment.
authToken string The bearer authorization token.
recommendationsConfig.token string The token for authenticating recommendation requests.
recommendationsConfig.baseUrl string The url for the recommendation server.
searchEngineConfig.applicationId string The application ID for the search engine (e.g., Algolia).
searchEngineConfig.apiKey string The API key for the search engine.
localStorage Object Cache to use for localStorage
isMA boolean Variable that tells if the library is used by MA or FEW
localTimezoneString string The local timezone string in format: America/Vancouver