<commit_before>const article = require("../component/article");
const runClient = require("../lib/run-client");

if (window.nuk && window.nuk.ssr && window.nuk.article) {
  const {
    rootTag,
    makeArticleUrl,
    makeTopicUrl,
    mapArticleToAdConfig
  } = window.nuk.ssr;
  const {
    articleId,
    debounceTimeMs,
    navigationMode,
    spotAccountId,
    paidContentClassName,
    userState
  } = window.nuk.article;
  const { getCookieValue } = window.nuk;

  const data = {
    articleId,
    debounceTimeMs,
    makeArticleUrl,
    makeTopicUrl,
    navigationMode,
    getCookieValue,
    mapArticleToAdConfig,
    spotAccountId,
    paidContentClassName,
    userState
  };

  const clientOptions = {
    rootTag,
    useGET: false
  };

  runClient(article, clientOptions, data);
}
<commit_msg>feat: client side newskit feature flag (#2309)<commit_after>/* eslint-disable no-useless-escape */

const article = require("../component/article");
const runClient = require("../lib/run-client");

if (window.nuk && window.nuk.ssr && window.nuk.article) {
  const {
    rootTag,
    makeArticleUrl,
    makeTopicUrl,
    mapArticleToAdConfig
  } = window.nuk.ssr;
  const {
    articleId,
    debounceTimeMs,
    navigationMode,
    spotAccountId,
    paidContentClassName,
    userState
  } = window.nuk.article;
  const { getCookieValue } = window.nuk;

  const enableNewskit = decodeURIComponent(
    window.location.search.replace(
      new RegExp(
        `^(?:.*[&\\?]${encodeURIComponent("newskit").replace(
          /[\.\+\*]/g,
          "\\$&"
        )}(?:\\=([^&]*))?)?.*$`,
        "i"
      ),
      "$1"
    )
  );

  const data = {
    articleId,
    debounceTimeMs,
    enableNewskit,
    makeArticleUrl,
    makeTopicUrl,
    navigationMode,
    getCookieValue,
    mapArticleToAdConfig,
    spotAccountId,
    paidContentClassName,
    userState
  };

  const clientOptions = {
    rootTag,
    useGET: false
  };

  runClient(article, clientOptions, data);
}

{'fraction_non_alphanumeric': 0.13196186653286504, 'fraction_numerical': 0.002508780732563974, 'mean_word_length': 2.76937618147448, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2995789', 'n_tokens_mistral': 681, 'n_tokens_neox': 663, 'n_words': 114}