### Initialize and Auto-Start Feature Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate Initializes a feature, checks for auto-start configuration, and either auto-starts the feature or listens for a manual start event. It imports an aggregator if the feature is enabled and auto-started. ```javascript this.featureName,".autoStart"))&&(this.auto=!1),this.auto?(0,l.RP)(e,r):this.ee.on("manual-start-all",(0,v.Z)((()=>{(0,l.RP)(this.agentIdentifier,this.featureName),this.auto=!0,this.importAggregator()})))}importAggregator(){let t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.featAggregate||!this.auto)return;this.onAggregateImported=new Promise((e=>{t=e}));const n=async()=>{let n;try{if((0,m.H)(this.agentIdentifier)){const{setupAgentSession:e}=await i.e(111).then(i.bind(i,9446));n=e(this.agentIdentifier)}}catch(t){(0,e.Z)("A problem occurred when starting up session manager. This page will not start or extend any session.",t),this.featureName===a.D.sessionReplay&&this.abortHandler?.()}try{if(!this.#t(this.agentIdentifier,n))return(0,l.LP)(this.agentIdentifier,this.featureName),void t(!1);const{lazyFeatureLoader:e}=await i.e(111).then(i.bind(i,8582)),{Aggregate:o}=await e(this.featureName,"aggregate");this.featAggregate=new o(this.agentIdentifier,this.aggregator,r),t(!0)}catch(r){(0,e.Z)("Downloading and initializing ".concat(this.featureName," failed..."),r),this.abortHandler?.(),(0,l.LP)(this.agentIdentifier,this.featureName,!0),t(!1),this.ee&&this.ee.abort()}};p.il?(0,h.b2)((()=>n()),!0):n()}#t(e,t){return e!==a.D.sessionReplay||(0,g.HM)(this.agentIdentifier,t)}}var y=i(7633);class A extends b{static featureName=y.t;constructor(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];super(e,t,y.t,r),this.importAggregator()}} ``` -------------------------------- ### Postman Analytics SDK Initialization Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate This script initializes the Postman Tech analytics SDK. It sets the analytics event URL and conditionally enables the SDK based on the domain and route. It also includes utility functions for logging, getting the current URL, and managing publisher IDs. ```javascript window.pmTechUrl="https://bi.pst.tech/events";(window.IS_PUBLIC_DOMAIN||route.match("/onboarding/"))&&(window.pmt=function(){var t="*".split(",");return"*"===t[0]||-1!==t.indexOf(window.location.pathname)}()&&function(){var t={version:"v2.1.8",log:function(e){t.output=t.output||[],t.output.push(e)},url:function(){return window.location.href.startsWith("http")&&window.location.href||""},set:function(e,n){t[e]=n},getPubId:function(){return(document.cookie.match("(^|;) ?_PUB_ID=([^;]*)(;|$) ")||[])[2]},drivePubId:function(e){const n=t.url(),o="pub_id=";let a,i;if(n.match(o)){if(i=n.split(o).pop().split("&").shift(),a="_PUB_ID="+i+"; path=/",document.cookie=a,e){let t=n.replace(o+i,"");t=t.replace("?&","?"),t=t.replace("&&","&"),t.split("?").pop()||""===(t=t.split("?").shift());const e=t.length-1;"&"===t.charAt(e)&&(t=t.substring(0,e)),window.location.replace(t)}return a}return t.getPubId()}} ``` -------------------------------- ### Instrument Fetch API for Request Monitoring Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate This snippet instruments the Fetch API to monitor request and response details. It captures 'before-start', 'start', and 'end' events for requests and responses, providing insights into request timings and payload sizes. It requires the `fetch-` namespace for event emission and uses the `ee` (event emitter) from the `n` object. ```javascript var A="fetch-",w=A+"body-",E=["arrayBuffer","blob","json","text","formData"],_=f._A.Request,x=f._A.Response,R="prototype";const S={};function T(e){const t=function(e){return(e||n.ee).get("fetch")}(e);if(!(_&&x&&f._A.fetch))return t;if(S[t.debugId]++)return t;function r(e,r,i){var o=e[r];"function"==typeof o&&(e[r]=function(){var e,r=[...arguments],a={};t.emit(i+"before-start",[r],a),a[n.A]&&a[n.A].dt&&(e=a[n.A].dt);var s=o.apply(this,r);return t.emit(i+"start",[r,e],s),s.then((function(e){return t.emit(i+"end",[null,e],s),e}),(function(e){throw t.emit(i+"end",[e],s),e}))})}return S[t.debugId]=1,E.forEach((e=>{r(_[R],e,w),r(x[R],e,w)})),r(f._A,"fetch",A),t.on(A+"end",(function(e,r){var n=this;if(r){var i=r.headers.get("content-length");null!==i&&(n.rxSize=i),t.emit(A+"done",[null,r],n)}else t.emit(A+"done",[e],n)})),t} ``` -------------------------------- ### Session Trace and Performance Observation Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate This code snippet initializes a feature related to session tracing. It sets up event listeners for start and end times, and potentially for capturing browser performance metrics like navigation timings and resource timings. It utilizes `PerformanceObserver` to capture performance entries. ```javascript class extends b { static featureName = le; constructor(e, t) { super(e, t, le, !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2]); if (!(0, m.H)(this.agentIdentifier)) return void(0, l.o5)(this.agentIdentifier, this.featureName); const r = this.ee; let n; (0, W.QU)(r), this.eventsEE = (0, W.em)(r), this.eventsEE.on(he, (function(e, t) { this.bstStart = (0, P.z)() })), this.eventsEE.on(fe, (function(e, t) { (0, N.p)("bst", [e[0], t, this.bstStart, (0, P.z)()], void 0, a.D.sessionTrace, r) })), r.on(pe + ue, (function(e) { this.time = (0, P.z)(), this.startPath = location.pathname + location.hash })), r.on(pe + de, (function(e) { (0, N.p)("bstHist", [location.pathname + location.hash, this.startPath, this.time], void 0, a.D.sessionTrace, r) })); try { n = new PerformanceObserver((e => { const t = e.getEntries(); (0, N.p)(se, [t], void 0, a.D.sessionTrace, r) })), n.observe({ type: ce, buffered: !0 }) } catch (e) {} this.importAggregator({resourceObserver: n}) } } ``` -------------------------------- ### Session Trace Constants and Feature Name (JavaScript) Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate Defines constants and the feature name for session tracing. This includes identifiers for different trace events like resource loading, function calls, and state changes, along with constants for start and end markers. ```javascript r.d(t,{BST_RESOURCE:()=>i,END:()=>s,FEATURE_NAME:()=>n,FN_END:()=>u,FN_START:()=>c,PUSH_STATE:()=>d,RESOURCE:()=>o,START:()=>a,c:()=>l});const n=r(3325).D.sessionTrace,i="bstResource",o="resource",a="-start",s="-end",c="fn"+a,u="fn"+s,d="pushState",l=1e3 ``` -------------------------------- ### XHR Request Function (JavaScript) Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate This function performs an XMLHttpRequest (XHR) GET request. It appends a timestamp to the URL to ensure a fresh request and includes a `readystatechange` event listener to handle the response. The response text is passed to a callback function upon completion. ```javascript function(t,e){const n=new XMLHttpRequest,o="t="+(new Date).getTime(),a=-1===t.indexOf("?")?"?":"&";i=t+a+o;n.withCredentials=!0,n.addEventListener("readystatechange",(function(){4===this.readyState&&e(this.responseText)})),n.open("GET",i),n.send()} ``` -------------------------------- ### Get Current Timestamp (JavaScript) Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate Returns the current high-resolution time in milliseconds using performance.now(). This is useful for precise timing measurements. ```javascript function n(){return Math.floor(performance.now())} ``` -------------------------------- ### Get Trace ID from Cookie (JavaScript) Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate This function retrieves a trace ID stored in a cookie. It specifically looks for a cookie named `_pmt`. If the cookie exists, it returns its value; otherwise, it returns an empty string. ```javascript function(){return(document.cookie.match("(^|;) ?_pmt=([^;]*)(;|$)")||[])[2]} ``` -------------------------------- ### Get Detected Fonts (JavaScript) Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate This function attempts to detect available fonts on the user's system. It initializes an array with common font families and then proceeds to check for specific font names. The current implementation seems incomplete, as it only defines the initial array and doesn't show the logic for checking font availability. ```javascript function(){const t=["monospace","sans-serif","serif"],e=["Academy Engraved LET","American Typewriter","Andale Mono","Arial","Athelas","Avenir","Ayuthaya","Bangla MN","Baskerville","Big Caslon","Bodoni Ornaments","Bradley Hand","Brush Script MT","Chalkboard","Charter","Cochin","Comic Sans MS","Copperplate","Courier New","Didot","Futura","Galvji","Geneva","Georgia","Gill Sans","Helvetica Neue","Herculanum","Hiragino Sans W9","Hoefler Text","Impact","InaiMathi","Kannada Sangam MN","Kefa","Khmer MN ``` -------------------------------- ### Get User ID (JavaScript) Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate This function retrieves a user ID. It first attempts to extract it from the trace ID by splitting it and taking the last part. If that fails, it falls back to a user ID stored in cookies or a globally available `userId`. The retrieved user ID is optionally added to a provided object. ```javascript function(e){const n=t.getTraceId().split("|").pop()||t.store().userId||t.userId||"";return n&&e&&(e.userId=n),n} ``` -------------------------------- ### Get Trace ID from URL (JavaScript) Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate This function extracts a trace ID from the current URL. It looks for a `_pmt=` parameter. If found, it decodes the trace ID, stores it using `t.store`, and then removes the trace ID parameter from the URL before replacing the current location with the cleaned URL. It returns the extracted trace ID. ```javascript function(){const e="_pmt=",n=t.url(),o=n.match(e)&&n.split(e).pop().split("&").shift(),a=o&&decodeURI(o);if(a){t.store("traceId",a);let i=n.replace(e+o,"");i=i.replace("?&", "?"),i=i.replace("&&", "&"),i.split("?").pop()||"(i=i.split("?").shift())";const r=i.length-1;"&"===i.charAt(r)&&(i=i.substring(0,r)),window.location.replace(i)}return a} ``` -------------------------------- ### Get Unified Trace ID (JavaScript) Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate This function aims to retrieve a trace ID from multiple sources in order of preference: URL, cookie, stored data, or a fallback value. It prioritizes fetching the trace ID from the URL, then the cookie, then from stored data, and finally uses a provided default or fallback value. The retrieved trace ID is optionally added to a provided object. ```javascript function(e,n){const o=t.getTraceIdFromUrl()||t.getTraceIdFromCookie()||t.store().traceId||t.traceId||n&&n._traceId||"";return o&&e&&(e.traceId=o),o} ``` -------------------------------- ### New Relic Initialization and Configuration (JavaScript) Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate Contains functions for initializing and configuring the New Relic agent. It sets up agent information, initializes features, and retrieves configuration details. This snippet is crucial for integrating New Relic monitoring into a web application. ```javascript r.d(t,{EZ:()=>d,ce:()=>o,ek:()=>u,fP:()=>a,gG:()=>l,h5:()=>c,mF:()=>s});var n=r(385),i=r(7894);const o={beacon:"bam.nr-data.net",errorBeacon:"bam.nr-data.net"};function a(){return n._A.NREUM||(n._A.NREUM={}),void 0===n._A.newrelic&&(n._A.newrelic=n._A.NREUM),n._A.NREUM}function s(){let e=a();return e.o||(e.o={ST:n._A.setTimeout,SI:n._A.setImmediate,CT:n._A.clearTimeout,XHR:n._A.XMLHttpRequest,REQ:n._A.Request,EV:n._A.Event,PR:n._A.Promise,MO:n._A.MutationObserver,FETCH:n._A.fetch}),e}function c(e,t){let r=a();r.initializedAgents??={},t.initializedAt={ms:(0,i.z)(),date:new Date},r.initializedAgents[e]=t}function u(e){let t=a();return t.initializedAgents?.[e]}function d(e,t){a()[e]=t}function l(){return function(){let e=a();const t=e.info||{};e.info={beacon:o.beacon,errorBeacon:o.errorBeacon,...t}}(),function(){let e=a();const t=e.init||{};e.init={...t}}(),s(),function(){let e=a();const t=e.loader_config||{};e.loader_config={...t}}(),a()}} ``` -------------------------------- ### Postman SDK Initialization (JavaScript) Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate This snippet initializes the Postman SDK by setting up various tracking and driving functionalities based on attributes found on a 'pmtSDK' element. It configures click tracking, campaign IDs, publish IDs, and load tracking. It dynamically enables or disables these features based on data attributes. ```javascript setTimeout((function(){const t=document.getElementById("pmtSDK"),e=t&&t.getAttribute("data-track-category")||"pm-analytics",n=t&&t.getAttribute("data-track-property"),o=t&&t.getAttribute("data-track-url"),a=t&&"false"!==t.getAttribute("data-track-disable-do-not-track"),i=t&&"true"===t.getAttribute("data-drive-track"),r=t&&"false"!==t.getAttribute("data-drive-campaign-id"),c=t&&"false"!==t.getAttribute("data-drive-pub-id"),s=t&&"false"!==t.getAttribute("data-track-load"),d=t&&"false"!==t.getAttribute("data-track-clicks"),l=d&&t.getAttribute("data-track-clicks-attribute")||"null"}),1e3) ``` -------------------------------- ### Full Page Load and Initialization Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate This snippet initializes various features of the agent, including session replay, AJAX monitoring, and page view events. It ensures that dependent features are loaded before others and logs warnings if dependencies are missing. It also handles the aborting of the agent if initialization fails. ```javascript class extends b { static featureName = Ae; constructor(e, t) { var r; if (super(e, t, Ae, !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2]), r = this, !p.il) return; try { this.removeOnAbort = new AbortController } catch (e) {} let n, i = 0; const o = this.ee.get("tracer"), a = (0, W._L)(this.ee), s = (0, W.Lg)(this.ee), c = (0, W.BV)(this.ee), u = (0, W.Kf)(this.ee), d = this.ee.get("events"), l = (0, W.u5)(this.ee), f = (0, W.QU)(this.ee), h = (0, W.Gm)(this.ee); function g(e, t) { f.em ``` -------------------------------- ### API Initialization and Plan Detection (JavaScript) Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate This function initializes the API by potentially assigning properties from an object to the global scope. It then checks for billing plan information and determines the user's plan (free, paid, or enterprise) based on feature flags. This plan information is then stored. ```javascript function(e){"object"==typeof e&&Object.keys(e).forEach((function(t){window[t]=e[t]}));const n=window.pm,o=n&&n.billing,a=o&&o.plan,i=a&&a.features;if(i){const e=i&&i.is_paid_plan_growth,n=e&&e.value,o=i&&i.is_enterprise_plan_growth,a=(o&&o.value?"enterprise":n&&"paid")||"free";t.store("plan",a)}}return t} ``` -------------------------------- ### Handle Full Mode Initialization and Recording Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate Initializes recording in full mode if `featAggregate` is available and in a different mode, or sets the mode and calls initialization functions. It also handles the `recorder`'s mode and starts/stops recording accordingly. ```javascript o(){ this.featAggregate ? this.featAggregate.mode !== ge.IK.FULL && this.featAggregate.initializeRecording(ge.IK.FULL, !0) : (this.#i = ge.IK.FULL, this.#s(t.pB.API), this.recorder && this.recorder.parent.mode !== ge.IK.FULL && (this.recorder.parent.mode = ge.IK.FULL, this.recorder.stopRecording(), this.recorder.startRecording(), this.abortHandler = this.recorder.stopRecording)) } ``` -------------------------------- ### JavaScript Agent Initialization and Configuration Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate This snippet initializes a New Relic Browser agent (NRBA). It includes a configuration object with details like the agent identifier and production settings. It also sets up various internal modules and defines constants for different event types used by the agent. ```javascript (() => { "use strict"; i(8993); var e = i(50), t = i(7144), r = i(4402), n = i(8325); class o { agentIdentifier; constructor() { let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : (0, r.ky)(16); this.agentIdentifier = e, this.ee = n.ee.get(e) } #e(t) { for (var r = arguments.length, n = new Array(r > 1 ? r - 1 : 0), i = 1; i < r; i++) n[i - 1] = arguments[i]; if ("function" == typeof this.api?.[t]) return this.api[t](...n); (0, e.Z)("Call to agent api ".concat(t, " failed. The API is not currently initialized.")) } addPageAction(e, t) { return this.#e("addPageAction", e, t) } setPageViewName(e, t) { return this.#e("setPageViewName", e, t) } setCustomAttribute(e, t, r) { return this.#e("setCustomAttribute", e, t, r) } noticeError(e, t) { return this.#e("noticeError", e, t) } setUserId(e) { return this.#e("setUserId", e) } setApplicationVersion(e) { return this.#e("setApplicationVersion", e) } setErrorHandler(e) { return this.#e("setErrorHandler", e) } finished(e) { return this.#e("finished", e) } addRelease(e, t) { return this.#e("addRelease", e, t) } start(e) { return this.#e("start", e) } recordReplay() { return this.#e(t.Ef.RECORD) } pauseReplay() { return this.#e(t.Ef.PAUSE) } addToTrace(e) { return this.#e("addToTrace", e) } setCurrentRouteName(e) { return this.#e("setCurrentRouteName", e) } interaction() { return this.#e("interaction") } } var a = i(3325), s = i(234); const c = Object.values(a.D); function u(e) { const t = {}; return c.forEach((r => { t[r] = function(e, t) { return !0 === (0, s.Mt)(t, "".concat(e, ".enabled")) }(r, e) })), t } var d = i(2758); var l = i(8e3), f = i(5938), h = i(3960), p = i(385), g = i(3112), m = i(8488), v = i(7872); class b extends f.W { constructor(e, t, r) { let n = !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3]; super(e, t, r), this.auto = n, this.abortHandler = void 0, this.featAggregate = void 0, this.onAggregateImported = void 0, !1 === (0, s.Mt)(this.agentIdentifier, "".concat( ``` -------------------------------- ### Initialize Agent and Features Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate Initializes the agent with specified features and handles potential dependencies between them. It sorts features by priority and logs warnings if dependent features are not initialized. The agent initialization can be aborted if an error occurs. ```javascript new class extends o{ constructor(t,r){ super(r), p._A ? (this.sharedAggregator = new _({agentIdentifier: this.agentIdentifier}), this.features = {}, (0, S.h5)(this.agentIdentifier, this), this.desiredFeatures = new Set(t.features || []), this.desiredFeatures.add(A), this.runSoftNavOverSpa = [...this.desiredFeatures].some(e => e.featureName === a.D.softNav), (0, d.j)(this, t, t.loaderType || "agent"), this.run()) : (0, e.Z)("Failed to initialize the agent. Could not determine the runtime environment.") } get config() { return { info: this.info, init: this.init, loader_config: this.loader_config, runtime: this.runtime } } run() { try { const t = u(this.agentIdentifier), r = [...this.desiredFeatures]; r.sort(((e, t) => a.p[e.featureName] - a.p[t.featureName])), r.forEach((r => { if (!t[r.featureName] && r.featureName !== a.D.pageViewEvent) return; if (this.runSoftNavOverSpa && r.featureName === a.D.spa) return; if (!this.runSoftNavOverSpa && r.featureName === a.D.softNav) return; const n = function(e) { switch (e) { case a.D.ajax: return [a.D.jserrors]; case a.D.sessionTrace: return [a.D.ajax, a.D.pageViewEvent]; case a.D.sessionReplay: return [a.D.sessionTrace]; case a.D.pageViewTiming: return [a.D.pageViewEvent]; default: return [] } }(r.featureName); n.every((e => e in this.features)) || (0, e.Z)("".concat(r.featureName, " is enabled but one or more dependent features has not been initialized (").concat((0, T.P)(n), "). This may cause unintended consequences or missing data...")); this.features[r.featureName] = new r(this.agentIdentifier, this.sharedAggregator) })) } catch (t) { (0, e.Z)("Failed to initialize all enabled instrument classes (agent aborted) -", t); for (const e in this.features) this.features[e].abortHandler?.(); const r = (0, S.fP)(); delete r.initializedAgents[this.agentIdentifier]?.api, delete r.initializedAgents[this.agentIdentifier]?.features, delete this.sharedAggregator; return r.ee.get(this.agentIdentifier).abort(), !1 } } } ``` -------------------------------- ### Session Replay Feature Initialization Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate Initializes the Session Replay feature. It handles event listeners for document visibility and page hide events, and imports the aggregator. ```javascript var S=i(8632),T=i(4351);var N=i(5546),O=i(7956),I=i(3239),D=i(9251),P=i(7894);class C extends b{static featureName=D.t;constructor(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];super(e,t,D.t,r),p.il&&((0,O.N)((()=>(0,N.p)("docHidden",[(0,P.z)()],void 0,D.t,this.ee)),!0),(0,I.bP)("pagehide",(()=>(0,N.p)("winPagehide",[(0,P.z)()],void 0,D.t,this.ee))),this.importAggregator())}} ``` -------------------------------- ### Error Handling and Feature Initialization (JavaScript) Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate This snippet includes various functions related to error handling, feature initialization, and data collection for monitoring. It defines methods for setting error handlers, marking features as finished, and adding data to traces. ```javascript r.d(t,{j:()=>_});var n=r(3325),i=r(234),o=r(5546),a=r(8325),s=r(8e3),c=r(3960),u=r(385),d=r(50),l=r(3081),f=r(8632),h=r(7144);const p=["setErrorHandler","finished","addToTrace","addRelease","addPageActi ``` -------------------------------- ### JavaScript Module Loader and Initialization Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate This snippet demonstrates a dynamic module loading system using Webpack's `i` function. It handles loading specific chunks of code (e.g., 'nr-spa', 'nr-spa-compressor') and applies them to the global scope. It includes error handling for chunk loading failures and ensures modules are registered correctly. ```javascript i.f.j = (t, r) => { var n = i.o(e, t) ? e[t] : void 0; if (0 !== n) if (n) r.push(n[2]); else { var o = new Promise(((r, i) => n = e[t] = [r, i])); r.push(n[2] = o); var a = i.p + i.u(t), s = new Error; i.l(a, (r => { if (i.o(e, t) && (0 !== (n = e[t]) && (e[t] = void 0), n)) { var o = r && ("load" === r.type ? "missing" : r.type), a = r && r.target && r.target.src; s.message = "Loading chunk " + t + " failed.\n(" + o + ": " + a + ")", s.name = "ChunkLoadError", s.type = o, s.request = a, n[1](s) } }), "chunk-" + t, t) } }; var t = (t, r) => { var n, o, [a, s, c] = r, u = 0; if (a.some((t => 0 !== e[t]))) { for (n in s) i.o(s, n) && (i.m[n] = s[n]); if (c) c(i) } for (; u < a.length; u++) o = a[u], i.o(e, o) && e[o] && e[o][0](), e[o] = 0 }, r = self["webpackChunk:NRBA-1.260.1.PROD"] = self["webpackChunk:NRBA-1.260.1.PROD"] || []; r.forEach(t.bind(null, 0)), r.push = t.bind(null, r.push.bind(r)) ``` -------------------------------- ### New Relic Initialization Script Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate Initializes the New Relic JavaScript agent with core configuration. It sets up distributed tracing, privacy settings (disabling cookies), and defines a deny list for AJAX requests. This script is crucial for performance monitoring and error reporting. ```javascript window.NREUM||(NREUM={});NREUM.init={distributed_tracing:{enabled:true,cors_use_newrelic_header:false,cors_use_tracecontext_headers:true,allowed_origins:['https://bifrost-public-https-v4.gw.postman.com','https://bifrost-web-https-v4.gw.postman.co','https://bifrost-web-https-v4.gw.postman.com']},privacy:{cookies_enabled:false},ajax:{deny_list:["bam.nr-data.net"]}}; window.NREUM.loader_config={accountID:"2665918",trustKey:"4241503",agentID:"771436762",licenseKey:"NRJS-8482e4e3e1750395f5d",applicationID:"771436762"}; window.NREUM.info={beacon:"bam.nr-data.net",errorBeacon:"bam.nr-data.net",licenseKey:"NRJS-8482e4e3e1750395f5d",applicationID:"771436762",sa:1}; ``` -------------------------------- ### Session Replay Initialization Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate Initializes and manages the session replay functionality. It loads the recorder, handles replay modes (full or error), and sets up an error listener for replay-related issues. Dependencies include specific modules for recorder functionality. ```javascript var ae=i(3614);const{BST_RESOURCE:se,RESOURCE:ce,START:ue,END:de,FEATURE_NAME:le,FN_END:fe,FN_START:he,PUSH_STATE:pe}=ae;var ge=i(7056);class me extends b{static featureName=t.t9;#i;constructor(e,r){let n,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];super(e,r,t.t9,i),this.replayRunning=!1;try{n=JSON.parse(localStorage.getItem("".concat(ge.Bq,"_"concat(ge.K4)))}catch(e){}(0,g.Rc)(e)&&this.ee.on("recordReplay",(()=>this.#o())),this.#a(n)?(this.#i=n?.sessionReplayMode,this.#s()):this.importAggregator(),this.ee.on("err",(e=>{this.replayRunning&&(this.errorNoticed=!0,(0,N.p)(t.Ef.ERROR_DURING_REPLAY,[e],void 0,this.featureName,this.ee))})),this.ee.on(t.Ef.REPLAY_RUNNING,(e=>{this.replayRunning=e}))}#a(e){return e&&(e.sessionReplayMode===ge.IK.FULL||e.sessionReplayMode===ge.IK.ERROR)||(0,g.rU)(this.agentIdentifier)}#c=!1;async#s(e){if(!this.#c){this.#c=!0;try{const{Recorder:t}=await Promise.all([i.e(111),i.e(433)]).then(i.bind(i,4345));this.recorder??=new t({mode:this.#i,agentIdentifier:this.agentIdentifier,trigger:e,ee:this.ee}),this.recorder.startRecording(),this.abortHandler=this.recorder.stopRecording}catch(e){}this.importAggregator({recorder:this.recorder,errorNoticed:th ``` -------------------------------- ### Runtime Agent Configuration and Management Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate Manages runtime objects and their configurations. It allows setting up runtime environments for specific agent identifiers, handling initial configurations, and retrieving runtime objects. It ensures that an agent identifier is provided and that a runtime for that identifier has been previously set. ```javascript function O(e){if(!e)throw new Error("All runtime objects require an agent identifier!");if(!N[e])throw new Error("Runtime for ".concat(e," was never set"));return N[e]}function I(e,t){if(!e)throw new Error("All runtime objects require an agent identifier!");N[e]={...(0,i.D)(t,T),...S};const r=(0,n.ek)(e);r&&(r.runtime=N[e])} ``` -------------------------------- ### URL Filtering and Whitelisting Logic Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate Implements logic for filtering URLs based on a provided list of hostnames and pathnames. It supports wildcard hostnames and ensures that URLs are only allowed if they do not match any of the blocked patterns. The function `a` initializes the list of blocked patterns. ```javascript function a(e){if(n=[],e&&e.length)for(var t=0;t0?(o=r.substring(0,i),a=r.substring(i)):(o=r,a="");let[s]=o.split(":");n.push({hostname:s,pathname:a})}}} ``` -------------------------------- ### DOM Ready and Load Event Handling (JavaScript) Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate Provides functions to execute callbacks when the DOM is ready or when the entire page has loaded. `KB` executes a callback immediately if the DOM is ready, otherwise it waits for the `DOMContentLoaded` event. `b2` executes a callback immediately if the page is loaded, otherwise it waits for the `load` event. ```javascript function i(){return"undefined"==typeof document||"complete"===document.readyState}function o(e,t){if(i())return e();(0,n.bP)("load",e,t)}function a(e){if(i())return e();(0,n.iz)("DOMContentLoaded",e)}r.d(t,{KB:()=>a,b2:()=>o}) ``` -------------------------------- ### Configuration Model Initialization Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate Initializes a configuration object based on a provided model, merging properties from the model into the new configuration. It handles nested objects and arrays, ensuring properties are correctly updated or merged. Errors during the process are caught and logged. ```javascript function i(e,t){try{if(!e||"object"!=typeof e)return(0,n.Z)("Setting a Configurable requires an object as input");if(!t||"object"!=typeof t)return(0,n.Z)("Setting a Configurable requires a model to set its initial properties");const r=Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t)),o=0===Object.keys(r).length?e:r;for(let a in o)if(void 0!==e[a])try{if(null===e[a]){r[a]=null;continue}Array.isArray(e[a])&&Array.isArray(t[a])?r[a]=Array.from(new Set([...e[a],...t[a]])):"object"==typeof e[a]&&"object"==typeof t[a]?r[a]=i(e[a],t[a]):r[a]=e[a]}catch(e){(0,n.Z)("An error occurred while setting a property of a Configurable",e)}return r}catch(e){(0,n.Z)("An error occured while setting a Configurable",e)}}} ``` -------------------------------- ### Theme Management from Local Storage (JavaScript) Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate This script manages the application's theme by checking local storage for user preferences and system settings. It determines the theme ('dark' or 'light') and dynamically loads a corresponding theme script if necessary. ```javascript try{ const e=Object.keys(localStorage).filter((e=>e.includes("settings")))[0]; const a=window.matchMedia("(prefers-color-scheme: dark)")?.matches?"dark":"light"; const t=JSON.parse("[]"); const r="/_ar-assets"; const s="d72OB6fVOuaMZgY9/F4ixA=="; let l; if(e){ const t=JSON.parse(localStorage.getItem(e))?.postmanTheme, r=JSON.parse(localStorage.getItem("settings"))?.shouldUseSystemTheme; l=t?r?a:t:a }else l=a; const c=t.find((e=>e.toLowerCase().replaceAll("_","-").indexOf(l)>=0)); let o="",i="",d="",n=""; if(!["dark","light"].includes(l)&&c){ const e=document.createElement("link"); e.setAttribute("rel","preload"); e.setAttribute("as","script"); e.setAttribute("href",`${r}/${c}`); e.setAttribute("nonce",s); docume ``` -------------------------------- ### Pre-fetch Extensible Collection Sidebar List (JavaScript) Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate This JavaScript function, `fetchExtensibleCollectionSidebarList`, pre-fetches an extensible version of the collection sidebar list. It sends a POST request to the `/ws/proxy` endpoint with specific headers and a JSON body containing the service, method, and path for fetching collections. It includes error handling and logging. ```javascript async function fetchExtensibleCollectionSidebarList(){try{window.extensibleSidebarFetchedForWorkspaceId=workspaceId;return fetch(`${window.HTTP_GATEWAY_URL}/ws/proxy`,{method:"POST",headers:{"Content-Type":"application/json","x-access-token":accessToken,"x-app-version":window.APP_VERSION,"x-mode":"prefetch"},body:JSON.stringify({service:"collection",method:"GET",path:`/collections/?workspace=${workspaceId}&fields=children`})}).then((async e=>{if(!e||200!==e.status)throw new Error(`Failed to fetch extensible ollection sidebar list with status ${e.status}`);return console.log("Extensible collection sidebar list successfully pre fetched"),e})).catch((e=>{throw console.warn("Failed to fetch extensible collection sidebar list",e),e}))}catch(e){window.preFetchMeta={...window.preFetchMeta,fetchExtensibleCollectionSidebarListFailed:true,fetchExtensibleCollectionSidebarListFailedMessage:`Failed to fetch extensible collection sidebar list with error: ${e}`},console.warn("Error ``` -------------------------------- ### JavaScript Agent API Initialization and Interaction Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate This snippet defines a class `o` that acts as an interface for agent API calls. It includes methods for common actions like adding page actions, setting view names, custom attributes, and handling errors. It relies on internal modules like `e`, `t`, `r`, and `n` for core functionality and initializes the agent with an identifier. ```javascript class o { agentIdentifier; constructor() { let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : (0, r.ky)(16); this.agentIdentifier = e, this.ee = n.ee.get(e) } #e(t) { for (var r = arguments.length, n = new Array(r > 1 ? r - 1 : 0), i = 1; i < r; i++) n[i - 1] = arguments[i]; if ("function" == typeof this.api?.[t]) return this.api[t](...n); (0, e.Z)("Call to agent api ".concat(t, " failed. The API is not currently initialized.")) } addPageAction(e, t) { return this.#e("addPageAction", e, t) } setPageViewName(e, t) { return this.#e("setPageViewName", e, t) } setCustomAttribute(e, t, r) { return this.#e("setCustomAttribute", e, t, r) } noticeError(e, t) { return this.#e("noticeError", e, t) } setUserId(e) { return this.#e("setUserId", e) } setApplicationVersion(e) { return this.#e("setApplicationVersion", e) } setErrorHandler(e) { return this.#e("setErrorHandler", e) } finished(e) { return this.#e("finished", e) } addRelease(e, t) { return this.#e("addRelease", e, t) } start(e) { return this.#e("start", e) } recordReplay() { return this.#e(t.Ef.RECORD) } pauseReplay() { return this.#e(t.Ef.PAUSE) } addToTrace(e) { return this.#e("addToTrace", e) } setCurrentRouteName(e) { return this.#e("setCurrentRouteName", e) } interaction() { return this.#e("interaction") } } ``` -------------------------------- ### SPA Routing and Event Handling Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate This snippet manages Single Page Application (SPA) routing by listening to browser events like hash changes, page loads, and popstate events. It utilizes functions like `g` for navigation and updates internal state based on URL changes. Dependencies include internal Postman modules like `P`, `N`, and `I`. ```javascript it("newURL",[""+window.location,t])}function m(){i++,n=window.location.hash,this[Te]=(0,P.z)()}function v(){i--,window.location.hash!==n&&g(0,!0);var e=(0,P.z)();this[Re]=~~this[Re]+e-this[Te],this[Oe]=e}function b(e,t){e.on(t,(function(){this[t]=(0,P.z)()}))}this.ee.on(Te,m),s.on(Ne,m),a.on(Ne,m),this.ee.on(Oe,v),s.on(xe,v),a.on(xe,v),this.ee.on("fn-err",(function(){for(var t=arguments.length,n=new Array(t),i=0;i1)}),(0,I.m$)(!0,this.removeOnAbort?.signal)),this.abortHandler=this.#n,this.importAggregator()}#n(){this.removeOnAbort?.abort(),this.abortHandler=void 0}} ``` -------------------------------- ### Console Warning Utility (JavaScript) Source: https://www.postman.com/solar-astronaut-399171/adivaha-travel-technology/documentation/f8307tn/viator-partner-api-v2-full-access-affiliate Provides a utility function to log warnings to the console, prefixed with 'New Relic:'. It can optionally log a secondary message. ```javascript function n(e,t){"function"==typeof console.warn&&(console.warn("New Relic: ".concat(e)),t&&console.warn(t))} ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.