@unite-us/app-create-referral 0.15.25 → 0.15.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/config.js +2 -1
- package/dist/api/config.js.map +1 -1
- package/package.json +1 -1
package/dist/api/config.js
CHANGED
|
@@ -20,9 +20,10 @@ function setupAxiosInstanceDefaults(url) {
|
|
|
20
20
|
var instance = axios.create({
|
|
21
21
|
baseURL: url
|
|
22
22
|
});
|
|
23
|
+
var applicationSource = APP_ENVIRONMENT.source === 'emr' ? 'smart_app' : 'web';
|
|
23
24
|
instance.defaults.headers['X-EMPLOYEE-ID'] = APP_ENVIRONMENT.employeeId;
|
|
24
25
|
instance.defaults.headers['X-PROVIDER-ID'] = APP_ENVIRONMENT.providerId;
|
|
25
|
-
instance.defaults.headers['X-Application-Source'] =
|
|
26
|
+
instance.defaults.headers['X-Application-Source'] = applicationSource;
|
|
26
27
|
instance.interceptors.request.use(function (config) {
|
|
27
28
|
config.headers.Authorization = "Bearer ".concat(APP_ENVIRONMENT.getAuthToken());
|
|
28
29
|
return config;
|
package/dist/api/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":["axios","buildSerializer","buildJSONAPIDeserializerInterceptor","JSONAPIAdapter","APP_ENVIRONMENT","CALLBACKS","COMPONENTS","FEATURE_FLAGS","INITIAL_ADDRESSES","coreAxiosInstance","coreApi","setupAxiosInstanceDefaults","url","instance","create","baseURL","defaults","headers","employeeId","providerId","interceptors","request","use","config","Authorization","concat","getAuthToken","error","Promise","reject","initApp","appSettings","callbacks","components","env","feature_flags","initialAddresses","_objectSpread","trackEventCallback","Error","notify","trackEvent","onReferralCompleted","onReferralReload","onNavigateBack","onNavigateToAddResources","onClearDraftReferral","onSaveDraftReferral","onDeselectProgram","onSubmitConsent","consent","Consent","ShareDrawer","coreUrl","serializer","JSONAPIDeserializerInterceptor","response"],"sources":["../../src/api/config.js"],"sourcesContent":["/* eslint-disable import/no-mutable-exports */\n/* eslint-disable no-param-reassign */\n// eslint-disable import/no-mutable-exports\nimport axios from 'axios';\nimport {\n buildSerializer,\n buildJSONAPIDeserializerInterceptor,\n JSONAPIAdapter,\n} from '@unite-us/json-api-resources';\n\nlet APP_ENVIRONMENT = {};\
|
|
1
|
+
{"version":3,"file":"config.js","names":["axios","buildSerializer","buildJSONAPIDeserializerInterceptor","JSONAPIAdapter","APP_ENVIRONMENT","CALLBACKS","COMPONENTS","FEATURE_FLAGS","INITIAL_ADDRESSES","coreAxiosInstance","coreApi","setupAxiosInstanceDefaults","url","instance","create","baseURL","applicationSource","source","defaults","headers","employeeId","providerId","interceptors","request","use","config","Authorization","concat","getAuthToken","error","Promise","reject","initApp","appSettings","callbacks","components","env","feature_flags","initialAddresses","_objectSpread","trackEventCallback","Error","notify","trackEvent","onReferralCompleted","onReferralReload","onNavigateBack","onNavigateToAddResources","onClearDraftReferral","onSaveDraftReferral","onDeselectProgram","onSubmitConsent","consent","Consent","ShareDrawer","coreUrl","serializer","JSONAPIDeserializerInterceptor","response"],"sources":["../../src/api/config.js"],"sourcesContent":["/* eslint-disable import/no-mutable-exports */\n/* eslint-disable no-param-reassign */\n// eslint-disable import/no-mutable-exports\nimport axios from 'axios';\nimport {\n buildSerializer,\n buildJSONAPIDeserializerInterceptor,\n JSONAPIAdapter,\n} from '@unite-us/json-api-resources';\n\nlet APP_ENVIRONMENT = {};\nlet CALLBACKS = {};\nlet COMPONENTS = {};\nlet FEATURE_FLAGS = {};\nlet INITIAL_ADDRESSES = {};\nlet coreAxiosInstance;\nlet coreApi;\n\nfunction setupAxiosInstanceDefaults(url) {\n const instance = axios.create({ baseURL: url });\n const applicationSource = APP_ENVIRONMENT.source === 'emr' ? 'smart_app' : 'web';\n\n instance.defaults.headers['X-EMPLOYEE-ID'] = APP_ENVIRONMENT.employeeId;\n instance.defaults.headers['X-PROVIDER-ID'] = APP_ENVIRONMENT.providerId;\n instance.defaults.headers['X-Application-Source'] = applicationSource;\n\n instance.interceptors.request.use(\n (config) => {\n config.headers.Authorization = `Bearer ${APP_ENVIRONMENT.getAuthToken()}`;\n return config;\n },\n (error) => Promise.reject(error),\n );\n\n return instance;\n}\n\nconst initApp = (appSettings, callbacks, components) => {\n const {\n env,\n feature_flags,\n initialAddresses\n } = appSettings;\n // SETTING UP APP ENVIRONMENT\n // {\n // getAuthToken: function, used for setting the Authorization header on requests\n // employeeId: string, used for setting the X-EMPLOYEE-ID header on requests\n // providerId: string, used for setting the X-PROVIDER-ID header on requests\n // isEmr: boolean: used for determining if the app is running is EMR\n // },\n APP_ENVIRONMENT = { ...env };\n\n if (!callbacks.trackEventCallback) {\n throw new Error('trackEventCallback is required in order to run APP-CREATE-REFERRAL');\n }\n CALLBACKS = {\n // notify callback is used to display notifications to the user,\n // usually toasts\n // expect the following shape for the 'notify' object:\n // {\n // success: PropTypes.func,\n // error: PropTypes.func,\n // warn: PropTypes.func,\n // }\n notify: callbacks.notify,\n // TrackEvent to send analytics event\n trackEvent: callbacks.trackEvent,\n // Function called after the referral is created (Review step)\n onReferralCompleted: callbacks.onReferralCompleted,\n // Function called after the referral is created and the user reload the page\n onReferralReload: callbacks.onReferralReload,\n // Called on Add Resources step and back button to navigate back to Search\n onNavigateBack: callbacks.onNavigateBack,\n // Called on Referral Builder step to navigate to Add Resources\n onNavigateToAddResources: callbacks.onNavigateToAddResources,\n // Function called to redirect after saving a draft referral\n onClearDraftReferral: callbacks.onClearDraftReferral,\n // Function called to redirect after saving a draft referral\n onSaveDraftReferral: callbacks.onSaveDraftReferral,\n // Update Search shopping cart when removing a program.\n onDeselectProgram: callbacks.onDeselectProgram,\n // Function called after the consent form is submitted (Review step)\n onSubmitConsent: callbacks.onSubmitConsent,\n // Functions called in ConsentDialog\n consent: callbacks.consent,\n };\n\n COMPONENTS = {\n Consent: components?.consent,\n ShareDrawer: components?.ShareDrawer,\n };\n\n FEATURE_FLAGS = { ...feature_flags };\n\n coreAxiosInstance = setupAxiosInstanceDefaults(env.coreUrl);\n\n // SETTING UP CORE ENDPOINT\n // creates a new serializer object using the buildSerializer() function.\n // Serializers are used to convert JavaScript objects into JSON API format and vice versa\n const serializer = buildSerializer();\n // creates a new interceptor object that deserializes JSON API responses.\n // Interceptors are used to modify HTTP requests and responses.\n const JSONAPIDeserializerInterceptor = buildJSONAPIDeserializerInterceptor(serializer);\n // adds the interceptor to the Axios instance's response interceptors.\n // This means that the JSONAPIDeserializerInterceptor\n // will be applied to all responses received by the instance.\n coreAxiosInstance.interceptors.response.use(JSONAPIDeserializerInterceptor);\n // This line creates a new JSONAPIAdapter object using the Axios instance and serializer objects.\n // The JSONAPIAdapter object is used to make HTTP requests\n // and handle the serialization/deserialization of data in the JSON API format.\n coreApi = new JSONAPIAdapter(coreAxiosInstance, serializer);\n\n INITIAL_ADDRESSES = initialAddresses;\n\n return true;\n};\n\nexport {\n initApp,\n coreAxiosInstance,\n coreApi,\n APP_ENVIRONMENT,\n CALLBACKS,\n COMPONENTS,\n FEATURE_FLAGS,\n INITIAL_ADDRESSES\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACEC,eAAe,EACfC,mCAAmC,EACnCC,cAAc,QACT,8BAA8B;AAErC,IAAIC,eAAe,GAAG,CAAC,CAAC;AACxB,IAAIC,SAAS,GAAG,CAAC,CAAC;AAClB,IAAIC,UAAU,GAAG,CAAC,CAAC;AACnB,IAAIC,aAAa,GAAG,CAAC,CAAC;AACtB,IAAIC,iBAAiB,GAAG,CAAC,CAAC;AAC1B,IAAIC,iBAAiB;AACrB,IAAIC,OAAO;AAEX,SAASC,0BAA0BA,CAACC,GAAG,EAAE;EACvC,IAAMC,QAAQ,GAAGb,KAAK,CAACc,MAAM,CAAC;IAAEC,OAAO,EAAEH;EAAI,CAAC,CAAC;EAC/C,IAAMI,iBAAiB,GAAGZ,eAAe,CAACa,MAAM,KAAK,KAAK,GAAG,WAAW,GAAG,KAAK;EAEhFJ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