{"version":3,"file":"q_ajax_3-D6qRHMWm.js","sources":["../../../app/assets/javascripts/app/utils/q_ajax/q_ajax_3.ts"],"sourcesContent":["import Promise from \"plugins/bluebird/index\"\nimport log from \"plugins/loglevel/index\"\nimport * as retry from \"retry\"\nimport param from \"jquery-param\"\n\nimport {captureMessage} from \"app/error_reporting\"\nimport Google_event from \"app/tracking/google/event\"\n\nimport DataRetriever from \"app/data_retriever\"\nimport WindowState from \"app/window_state/index\"\nimport {\n  getNetworkLatencyToSpacious,\n  NetworkLatencyToSpaciousStatues,\n} from \"app/network_latency_to_spacious/index\"\n\n\n/* eslint-disable no-unused-vars */\nenum ERROR_HANDLER_ACTIONS {\n  // Default\n  CONTINUE_RETRY = \"CONTINUE_RETRY\",\n  // For status codes like 401, 403, 422\n  // which is either expected or handled differently\n  STOP_RETRY = \"STOP_RETRY\",\n}\n/* eslint-enable no-unused-vars */\n\n// Subset of `JQueryAjaxSettings`\ninterface JQueryAjaxSettingsCustomized {\n  // According to jQuery.ajax source code, ajax's option actually allows contentType to set to \"false\"\n  // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/742\n  /**\n   * When sending data to the server, use this content type. Default is \"application/x-www-form-urlencoded; charset=UTF-8\", which is fine for most cases. If you explicitly pass in a content-type to $.ajax(), then it is always sent to the server (even if no data is sent). The W3C XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset will not force the browser to change the encoding.\n   */\n  contentType?: any\n  // Header values on request\n  // If set, default values are gone\n  headers?: {[key: string]: any}\n  /**\n   * Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be key-value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of the traditional setting (described below).\n   */\n  data?: any\n  /**\n   * The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string).\n   */\n  dataType?: string\n  /**\n   * The HTTP method to use for the request (e.g. \"POST\", \"GET\", \"PUT\"). (version added: 1.9.0)\n   */\n  method?: string\n  /**\n   * The type of request to make (\"POST\" or \"GET\"), default is \"GET\". Note: Other HTTP request methods, such as PUT and DELETE, can also be used here, but they are not supported by all browsers.\n   */\n  type?: string\n  /**\n   * A string containing the URL to which the request is sent.\n   */\n  url: string\n}\ninterface RetryOptions {\n  min_interval_ms?: number,\n  max_interval_ms?: number,\n  backoff_factor?: number,\n  max_no_of_retries?: number,\n  randomize_interval?: boolean,\n}\ninterface CompleteRetryOptions {\n  min_interval_ms: number,\n  max_interval_ms: number,\n  backoff_factor: number,\n  max_no_of_retries: number,\n  randomize_interval: boolean,\n}\ntype CustomErrorHandlerFunc = (options: {http_status_code: number}) => ERROR_HANDLER_ACTIONS\ninterface ErrorTrackingOptions {\n  endpoint_identifier?: string,\n}\ninterface CompleteErrorTrackingOptions {\n  endpoint_identifier: string,\n}\ninterface QAjaxOptions {\n  retry_options?: RetryOptions,\n  error_tracking_options?: ErrorTrackingOptions,\n  custom_error_handler?: CustomErrorHandlerFunc,\n}\ninterface ResolvedPromisePayload<T> {\n  data:     T\n  response: Response\n}\nexport type ResolvedPromise<T> = Promise<ResolvedPromisePayload<T>>\n\n\nconst LOCAL_DEBUG_ENABLED = false\n\nconst local_log_debug_msg = (msg: any) => {\n  if (LOCAL_DEBUG_ENABLED) { log.debug(msg) }\n}\n\nconst DEFAULT_AJAX_SETTINGS: JQueryAjaxSettings = {\n}\nconst DEFAULT_RETRY_OPTIONS: CompleteRetryOptions = {\n  min_interval_ms:    30 * 1000,\n  max_interval_ms:    30 * 1000,\n  backoff_factor:     2,\n  // `max_total_retry_time_ms` is not simple to be implemented\n  // Implement it when really needed\n  // max_total_retry_time_ms: Infinity,\n  max_no_of_retries:  0,\n  randomize_interval: false,\n}\nconst DEFAULT_ERROR_HANDLER: CustomErrorHandlerFunc = () => {\n  return ERROR_HANDLER_ACTIONS.CONTINUE_RETRY\n}\nconst DEFAULT_ENDPOINT_IDENTIFIER = \"unknown\"\nconst DEFAULT_ERROR_TRACKING_OPTIONS: CompleteErrorTrackingOptions = {\n  endpoint_identifier: DEFAULT_ENDPOINT_IDENTIFIER,\n}\n\n// From JQUERY\nconst ACCEPTS: {[key: string]: string} = {\n  \"*\":    \"*/*\",\n  \"text\": \"text/plain\",\n  \"html\": \"text/html\",\n  \"xml\":  \"application/xml, text/xml\",\n  \"json\": \"application/json, text/javascript\",\n}\n\n\nconst generate_network_latency_tag = (latency_value_in_ms: number): string => {\n  const latency_value_in_s = latency_value_in_ms / 1000\n\n  if (latency_value_in_ms <= 0) {\n    return \"<= 0\"\n  }\n  if (latency_value_in_ms > 10000) {\n    return \"> 10000ms\"\n  }\n  if (latency_value_in_ms <= 1000) {\n    return \"0ms-1000ms\"\n  }\n  if (Math.floor(latency_value_in_s) === Math.ceil(latency_value_in_s)) {\n    return `${Math.floor(latency_value_in_s) - 1}000ms-${Math.floor(latency_value_in_s)}000ms`\n  }\n\n  return `${Math.floor(latency_value_in_s)}000ms-${Math.ceil(latency_value_in_s)}000ms`\n}\n\n/*\n# Our own extended version of jQuery's AJAX.\n# It is compatible with normal Promise.resolve($.ajax(...)) promise, but has some\n# helpful features:\n#\n# 1. In the resolved promise, there will be one object with multiple properties\n#    so that meta-data of the response can be processed. Note that this can\n#    be a security hole when used to fetch remote origin API: so use it with\n#    only API from Spacious.\n# 2. You can call `promise.abort()` on the returned promise to abort the XHR\n#    request.\n#\n*/\nfunction q_ajax<T = any>(ajax_settings: JQueryAjaxSettingsCustomized, options: QAjaxOptions = {}): Promise<ResolvedPromisePayload<T>> {\n  const ajax_settings_with_defaults: JQueryAjaxSettingsCustomized =\n    Object.assign({}, DEFAULT_AJAX_SETTINGS, ajax_settings)\n  const retry_options_with_defaults: CompleteRetryOptions =\n    Object.assign({}, DEFAULT_RETRY_OPTIONS, (options.retry_options || {}))\n  const custom_error_handler: CustomErrorHandlerFunc =\n    ((typeof options.custom_error_handler === \"function\") ? options.custom_error_handler : DEFAULT_ERROR_HANDLER)\n\n  const error_tracking_options_with_defaults: CompleteErrorTrackingOptions =\n    Object.assign({}, DEFAULT_ERROR_TRACKING_OPTIONS, (options.error_tracking_options || {}))\n  const endpoint_identifier: string = error_tracking_options_with_defaults.endpoint_identifier\n\n  // region contentType processing/auto fixing\n  // It's quite common to have missing semi-colon in `contentType`\n  // e.g. `application/json charset=utf-8` instead of `application/json; charset=utf-8`\n\n  if (typeof ajax_settings_with_defaults.contentType === \"string\" && /^(\\w+\\/([^;].)+) charset=utf-8$/.test(ajax_settings_with_defaults.contentType)) {\n    const old_value = ajax_settings_with_defaults.contentType\n    const new_value = ajax_settings_with_defaults.contentType\n    .replace(/(\\w+\\/.+) charset=utf-8/, \"$1; charset=utf-8\")\n    ajax_settings_with_defaults.contentType = new_value\n\n    captureMessage(\n      `Common Invalid contentType detected when using q_ajax on endpoint <${endpoint_identifier}>`,\n      {\n        old_value: old_value,\n        new_value: new_value,\n      },\n    )\n  }\n\n  // endregion contentType processing/auto fixing\n\n  const timeout_options = {\n    retries:    retry_options_with_defaults.max_no_of_retries,\n    factor:     retry_options_with_defaults.backoff_factor,\n    minTimeout: retry_options_with_defaults.min_interval_ms,\n    maxTimeout: retry_options_with_defaults.max_interval_ms,\n    randomize:  retry_options_with_defaults.randomize_interval,\n  }\n\n  // We are not waiting locally, only having different timeout values on AJAX\n  const retry_operation = retry.operation({\n    retries:    retry_options_with_defaults.max_no_of_retries,\n    factor:     1,\n    minTimeout: 0,\n    maxTimeout: 0,\n    randomize:  false,\n  })\n\n  return new Promise((resolve, reject, onCancel) => {\n    // currentAttempt is 1-based, tested manually\n    retry_operation.attempt((currentAttempt) => {\n      local_log_debug_msg(\n        `q_ajax running at attempt #${currentAttempt}`,\n      )\n      local_log_debug_msg(\n        `url: ${ajax_settings_with_defaults.url}`,\n      )\n      local_log_debug_msg(\n        `endpoint_identifier: ${endpoint_identifier}`,\n      )\n\n      // `attempt` is zero-indexed in `createTimeout` but `currentAttempt` is 1 based\n      const current_timeout_ms = retry.createTimeout(currentAttempt - 1, timeout_options)\n      const ajax_settings_with_timeout: JQueryAjaxSettingsCustomized =\n        Object.assign({}, ajax_settings_with_defaults, {timeout: current_timeout_ms})\n\n      const fetch_headers: {[key: string]: any} = (\n        typeof ajax_settings_with_defaults.headers === \"object\" ?\n          ajax_settings_with_defaults.headers :\n          {\n            // AJAX simulation\n            \"X-Requested-With\": \"XMLHttpRequest\",\n          }\n      )\n      const fetch_options: RequestInit = {\n        method:         (ajax_settings_with_defaults.method || ajax_settings_with_defaults.type || \"GET\").toUpperCase(),\n        // No error thrown if redirected\n        // We will reject with custom code\n        redirect:       \"manual\" as \"manual\",\n        // Safer default, update to other value is required\n        referrerPolicy: \"same-origin\" as \"same-origin\",\n        // Safer default, update to other value is required\n        credentials:    \"same-origin\" as \"same-origin\",\n        // Just explicitly stating the default\n        cache:          \"default\" as \"default\",\n      }\n      // region CSRF\n      if (fetch_options.method !== \"GET\") {\n        const meta = document.querySelector<HTMLMetaElement>(\"meta[name=csrf-token]\")\n        if (meta) {\n          fetch_headers[ \"X-CSRF-Token\" ] = meta.content\n        }\n      }\n      // endregion CSRF\n      // region contentType\n      // region Accept\n      const dataType: string = ajax_settings_with_defaults.dataType?.toLowerCase() || \"*\"\n      if (dataType !== \"*\") {\n        fetch_headers.Accept = `${ACCEPTS[ dataType ]}, ${ACCEPTS[ \"*\" ]}; q=0.01`\n      }\n      // endregion Accept\n      // default value from jquery\n      let contentType = \"application/x-www-form-urlencoded; charset=UTF-8\"\n      if (typeof ajax_settings_with_defaults.contentType === \"string\") {\n        contentType = ajax_settings_with_defaults.contentType\n      }\n      fetch_headers[ \"Content-Type\" ] = contentType\n      // endregion contentType\n      // region body\n      if (ajax_settings_with_defaults.data != null &&\n        ![\"GET\", \"HEAD\"].includes(fetch_options.method || \"\")) {\n\n        if (contentType.includes(\"application/x-www-form-urlencoded\")) {\n          if (typeof ajax_settings_with_defaults.data !== \"object\") {\n            throw new Error(\"ajax_settings_with_defaults.data is not an object\")\n          }\n          fetch_options.body = new URLSearchParams(param(ajax_settings_with_defaults.data))\n        }\n        else {\n          fetch_options.body = ajax_settings_with_defaults.data\n        }\n\n      }\n      // endregion body\n      // region cancel\n      let abort_reason = \"\"\n      const abort_controller = new AbortController()\n      fetch_options.signal = abort_controller.signal\n      if (typeof onCancel === \"function\") {\n        onCancel(() => {\n          local_log_debug_msg(\"aborting JQuery XHR in onCancel\")\n          abort_reason = \"cancel\"\n          abort_controller.abort()\n        })\n      }\n      // endregion cancel\n\n      fetch_options.headers = fetch_headers\n      const fetch_promise = window.fetch(\n        ajax_settings_with_defaults.url,\n        fetch_options,\n      )\n\n      // https://stackoverflow.com/a/50101022/838346\n      const timeoutId = setTimeout(() => {\n        local_log_debug_msg(\"aborting JQuery XHR on timeout\")\n        abort_reason = \"timeout\"\n        abort_controller.abort()\n      }, current_timeout_ms)\n\n      const context: {[key: string]: any} = {\n        ajax_settings:                ajax_settings_with_timeout,\n        endpoint_identifier:          endpoint_identifier,\n        network_latency_to_spacious:  \"unknown\",\n        current_attempt:              currentAttempt,\n      }\n\n      // Even it's null we want to know\n      if (typeof ajax_settings_with_timeout.data !== \"undefined\") {\n        context.ajax_data = ajax_settings_with_timeout.data\n      }\n\n      const network_latency_to_spacious = getNetworkLatencyToSpacious()\n      if (network_latency_to_spacious.status === NetworkLatencyToSpaciousStatues.LATENCY_DETECTED) {\n        context.network_latency_to_spacious =\n          `${network_latency_to_spacious.latency_value_in_ms}ms`\n      }\n\n      return fetch_promise\n      .then((response) => {\n        clearTimeout(timeoutId)\n        context.http_status_code = response.status\n\n        // `opaqueredirect` is strange stuff from `fetch` response\n        // when `redirect` is `manual`\n        if (response.type === \"opaqueredirect\") {\n          reject({\n            reason: \"redirected\",\n          })\n          return\n        }\n\n        // region response ok\n        if (response.ok) {\n          if (dataType === \"json\" || (response.headers.get(\"content-type\") || \"\").includes(\"application/json\")) {\n            const response_2 = response.clone()\n            response.json()\n            .then((data) => {\n              resolve({\n                data,\n                response: response,\n              })\n            })\n            .catch((err) => {\n              response_2.text()\n              .then((data) => {\n                log.debug(\"response.json() errored\")\n                log.debug(err)\n                log.debug(data)\n              })\n              throw err\n            })\n            return\n          }\n\n          response.text()\n          .then((data: any) => {\n            resolve({\n              data,\n              response: response,\n            })\n          })\n          return\n        }\n        // endregion response ok\n        // region response not ok\n\n        // No error should be reported for AJAX errors\n        // caused by page being unloaded\n        if (WindowState.isUnloaded()) {\n          reject({\n            response,\n          })\n          return\n        }\n\n        if (custom_error_handler({http_status_code: response.status || 0}) === ERROR_HANDLER_ACTIONS.STOP_RETRY) {\n          reject({\n            response,\n          })\n          return\n        }\n\n        if (retry_operation.retry(new Error(response.statusText))) {\n          local_log_debug_msg(\n            `q_ajax going to retry after attempt #${currentAttempt} with current_timeout_ms ${current_timeout_ms}`,\n          )\n\n          return\n        }\n\n        // Status Code 0 Could be caused by:\n        // - Illegal CORS (We don't use it anyway)\n        // - Firewall blocking/filtering (We can't fix)\n        // - Request is cancelled (not `abort()`) (Expected)\n        // - Browser extension (any Adblocker) (We can't fix)\n        //\n        // https://stackoverflow.com/a/14507670/838346\n        //\n        // So we don't report status code 0\n        //\n        // Some clients got strange response codes\n        if (response.status !== 0 && isSaneUserAgent() && isSaneLocation()) {\n          captureMessage(\n            `Error occurred when using q_ajax with status <${response.status || 0}> on endpoint <${endpoint_identifier}>`,\n            context as any,\n          )\n        }\n\n        reject({\n          response,\n        })\n        // endregion response not ok\n      })\n      .catch((err) => {\n        // Manual abort is expected and should not be reported\n        if (abort_reason === \"cancel\") {\n          reject({\n            reason: \"cancel\",\n          })\n          return\n        }\n\n        if (abort_reason === \"timeout\") {\n          if (network_latency_to_spacious.status !== NetworkLatencyToSpaciousStatues.LATENCY_DETECTED) {\n            // Timeout error don't need to be reported if we can't get network latency measured\n            // Assume network related issue and ignore\n            //\n            // Do nothing\n          }\n          else if (network_latency_to_spacious.latency_value_in_ms > current_timeout_ms) {\n            // If latency is bigger than timeout value, it's network issue anyway\n            //\n            // Do nothing\n          }\n          // Ignore some agents\n          else if (isSaneUserAgent()) {\n            // Do nothing\n            captureMessage(\n              `Timeout occurred when using q_ajax with timeout ${current_timeout_ms} on endpoint <${endpoint_identifier}>`,\n              context as any,\n              {\n                tags: {\n                  \"network.latency_to_spacious\":\n                    generate_network_latency_tag(\n                      network_latency_to_spacious.latency_value_in_ms,\n                    ),\n                },\n                level: \"warning\",\n              },\n            )\n\n            Google_event.track({\n              category: \"Performance Tracking\",\n              action:   \"Timeout happened when using AJAX\",\n\n              options: {\n                eventLabel:     \"timeout option value (ms)\",\n                eventValue:     current_timeout_ms,\n                nonInteraction: true,\n              },\n            })\n          }\n        }\n\n        throw err\n      })\n    })\n  })\n}\n\n// Not reporting errors from \"insane\" user agents\nfunction isSaneUserAgent(): boolean {\n  return [\n    /Baiduspider-render/i,\n    /YandexBot/i,\n  ].every((regex) => !regex.test(window.navigator.userAgent))\n}\n\n// Not reporting errors from \"insane\" locations\nfunction isSaneLocation(): boolean {\n  return !DataRetriever.get(\"current-location-country-code-is-china\")\n}\n\n\nexport default q_ajax\nexport {\n  q_ajax as q_ajax_3,\n  ERROR_HANDLER_ACTIONS,\n}\n\n"],"names":["ERROR_HANDLER_ACTIONS","local_log_debug_msg","msg","DEFAULT_AJAX_SETTINGS","DEFAULT_RETRY_OPTIONS","DEFAULT_ERROR_HANDLER","DEFAULT_ENDPOINT_IDENTIFIER","DEFAULT_ERROR_TRACKING_OPTIONS","ACCEPTS","generate_network_latency_tag","latency_value_in_ms","latency_value_in_s","q_ajax","ajax_settings","options","ajax_settings_with_defaults","retry_options_with_defaults","custom_error_handler","endpoint_identifier","old_value","new_value","captureMessage","timeout_options","retry_operation","retry.operation","Promise","resolve","reject","onCancel","currentAttempt","current_timeout_ms","retry.createTimeout","ajax_settings_with_timeout","fetch_headers","fetch_options","meta","dataType","_a","contentType","param","abort_reason","abort_controller","fetch_promise","timeoutId","context","network_latency_to_spacious","getNetworkLatencyToSpacious","NetworkLatencyToSpaciousStatues","response","response_2","data","err","log","WindowState","isSaneUserAgent","isSaneLocation","Google_event","regex","DataRetriever"],"mappings":"oVAiBK,IAAAA,GAAAA,IAEHA,EAAA,eAAiB,iBAGjBA,EAAA,WAAa,aALVA,IAAAA,GAAA,CAAA,CAAA,EA4EL,MAAMC,EAAuBC,GAAa,CAE1C,EAEMC,EAA4C,CAClD,EACMC,EAA8C,CAClD,gBAAoB,GAAK,IACzB,gBAAoB,GAAK,IACzB,eAAoB,EAIpB,kBAAoB,EACpB,mBAAoB,EACtB,EACMC,EAAgD,IAC7C,iBAEHC,EAA8B,UAC9BC,EAA+D,CACnE,oBAAqBD,CACvB,EAGME,EAAmC,CACvC,IAAQ,MACR,KAAQ,aACR,KAAQ,YACR,IAAQ,4BACR,KAAQ,mCACV,EAGMC,EAAgCC,GAAwC,CAC5E,MAAMC,EAAqBD,EAAsB,IAEjD,OAAIA,GAAuB,EAClB,OAELA,EAAsB,IACjB,YAELA,GAAuB,IAClB,aAEL,KAAK,MAAMC,CAAkB,IAAM,KAAK,KAAKA,CAAkB,EAC1D,GAAG,YAAK,MAAMA,CAAkB,EAAI,EAAC,UAAS,YAAK,MAAMA,CAAkB,EAAC,SAG9E,GAAG,YAAK,MAAMA,CAAkB,EAAC,UAAS,YAAK,KAAKA,CAAkB,EAAC,QAChF,EAeA,SAASC,GAAgBC,EAA6CC,EAAwB,GAAwC,CACpI,MAAMC,EACJ,OAAO,OAAO,CAAA,EAAIZ,EAAuBU,CAAa,EAClDG,EACJ,OAAO,OAAO,CAAA,EAAIZ,EAAwBU,EAAQ,eAAiB,EAAG,EAClEG,EACF,OAAOH,EAAQ,sBAAyB,WAAcA,EAAQ,qBAAuBT,EAInFa,EADJ,OAAO,OAAO,CAAA,EAAIX,EAAiCO,EAAQ,wBAA0B,EAAG,EACjB,oBAMrE,GAAA,OAAOC,EAA4B,aAAgB,UAAY,kCAAkC,KAAKA,EAA4B,WAAW,EAAG,CAClJ,MAAMI,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