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A,+DACJD,GAAGqE,UAAUD,EACf,CACF,GACF,IAEA,IAAME,EAAoB3D,EAAE,wBAAwB4D,MAwBpD,SAASC,IACP,OAAO,IAAIC,gBAAgB,CACzBC,UAAW/D,EAAE,8BAA8B4D,MAC3CI,WACEhE,EAAE,gBAAgBiE,KAAK,wBAAwBb,KAAK,cAAgB,IAG1E,CA9BIO,GAAqB3D,EAAE,kBAAkBf,QAE3Ce,EAAE,2BAA2B8C,GAAG,UAAU,WACpC9C,EAAE,6BAA6B4D,QAAUD,EAC3C3D,EAAE,kBAAkBkE,YAAY,YAEhClE,EAAE,kBAAkBmE,SAAS,WAEjC,IAGFnE,EAAE,gBAAgB8C,GAAG,QAAS,eAAe,SAAC9B,GAC5ChB,EAAE,iBAAiB4D,IAAI,SACvB5D,EAAE,eAAekE,YAAY,YAC7BlE,EAAEgB,EAAEoD,eAAeD,SAAS,WAC9B,IAEAnE,EAAE,gBAAgB8C,GAAG,QAAS,eAAe,SAAC9B,GAC5ChB,EAAE,iBAAiB4D,IAAI,QACvB5D,EAAE,eAAekE,YAAY,YAC7BlE,EAAEgB,EAAEoD,eAAeD,SAAS,WAC9B,IAWAnE,EAAE,qBAAqBqE,OAAM,SAAoBrD,GAC/CA,EAAEC,iBACF,IAAMqD,EAAST,IACfS,EAAOC,OAAO,SAAU,kBACxB7B,OAAOa,SAASC,OAAO,GAAD3B,OAAIX,KAAKsD,KAAI,KAAA3C,OAAIyC,GACzC,IAEAtE,EAAE,iBAAiBqE,OAAM,SAAoBrD,GAC3CA,EAAEC,iBACF,IAAMqD,EAAST,IACfnB,OAAOa,SAASC,OAAO,GAAD3B,OAAIX,KAAKsD,KAAI,KAAA3C,OAAIyC,GACzC,GACF,I,eCjJAtE,GAAE,YACAyE,EAAAA,EAAAA,IACF,G","sources":["webpack://suicidegirls/./frontend/legacy/join/memberJoin.js","webpack://suicidegirls/./frontend/legacy/join/index.js"],"sourcesContent":["import 'core-js/stable';\n\nimport { FormUtils } from './FormUtils';\n\nclass JoinFormUtils extends FormUtils {\n  constructor(form = '#join-form', validators = {}) {\n    // DOM must be ready to init, due to plan check\n    const lang = SG.userLang();\n    const passwordValidator = new FormUtils.ValidateMatches(\n      'password',\n      lang === 'es' ? 'Las contraseñas no coinciden' : \"Passwords don't match\",\n    );\n    super(form, { confirm_password: passwordValidator });\n    this.lang = lang;\n\n    const notBlankNames = ['email', 'password', 'username'];\n\n    // Check if has a plan input to validate\n    if (this.hasInput('plan')) {\n      notBlankNames.push('plan');\n    }\n\n    // Check if has a promo code input to validate (might need to subclass for\n    // this one)\n    if (this.hasInput('promo_code')) {\n      notBlankNames.push('promo_code');\n    }\n\n    this.updateValidators(FormUtils.ValidateNotBlank.create(notBlankNames));\n    this.updateValidators(validators);\n\n    this.isSpecialOffer = $('.special-offer').length > 0;\n\n    this.onAltSubmit = this.onAltSubmit.bind(this);\n  }\n\n  static showInterstitial({\n    message = 'Please wait while we redirect you to our payment processor...',\n    delay = 0,\n  }) {\n    return new Promise((resolve) => {\n      $('body').messageSpinner({ message });\n      if (delay) {\n        window.setTimeout(resolve, delay * 1000);\n      } else {\n        resolve();\n      }\n    });\n  }\n\n  handleResponseRedir(redir) {\n    // Add support for interstitial\n    if (typeof redir === 'object' && redir.interstitial) {\n      JoinFormUtils.showInterstitial(redir.interstitial).then(\n        () => super.handleResponseRedir(redir),\n      );\n      return true;\n    }\n    return super.handleResponseRedir(redir);\n  }\n\n  // Bind to this to use a diff source from the one selected as primary for\n  // this session\n  onAltSubmit(e) {\n    e.preventDefault();\n    this.submit({ extraData: { use_alt_payment_source: 1 } });\n  }\n\n  submit(...args) {\n    // Adds spinners. Otherwise, should be covered by default handlers.\n    $('BODY').spinner();\n    super.submit(...args).catch((error) => {\n      $('BODY').clearSpinner();\n      SG.debug(error);\n    });\n  }\n}\n\n$(document).ready(() => {\n  /* eslint-disable no-new */\n  new JoinFormUtils();\n\n  $(document).on('click', '.alt-source-link', (e) => {\n    e.preventDefault();\n    const ajaxArgs = {\n      url: e.target.dataset.url,\n      dataType: 'json',\n      data: { 'alt-source': e.target.dataset.source || 'auto' },\n    };\n\n    SG.apiPost(ajaxArgs).then((data) => {\n      if (data.redir) {\n        window.location.assign(data.redir);\n      } else {\n        const msg = SG.userLang() === 'es'\n          ? 'El intento de obtener un enlace al procesador de pago alternativo'\n          + ' falló.'\n          : 'Attempt to get a link to alternate payment processor failed.';\n        SG.userError(msg);\n      }\n    });\n  });\n\n  const offerExchangeCode = $('#offer-exchange-code').val();\n  if (offerExchangeCode && $('.special-offer').length) {\n    // Disable the special offer banner if no longer applicable.\n    $('label input[type=radio]').on('change', () => {\n      if ($('input[type=radio]:checked').val() === offerExchangeCode) {\n        $('.special-offer').removeClass('disabled');\n      } else {\n        $('.special-offer').addClass('disabled');\n      }\n    });\n  }\n\n  $('#member-join').on('click', '#new-member', (e) => {\n    $('#id_is_member').val('False');\n    $('#old-member').removeClass('selected');\n    $(e.currentTarget).addClass('selected');\n  });\n\n  $('#member-join').on('click', '#old-member', (e) => {\n    $('#id_is_member').val('True');\n    $('#new-member').removeClass('selected');\n    $(e.currentTarget).addClass('selected');\n  });\n\n  function getSocialAuthParams() {\n    return new URLSearchParams({\n      plan_code: $('input[name=\"plan\"]:checked').val(),\n      offer_code: (\n        $('#member-join').find('.social-auth-buttons').data('offerCode') || ''\n      ),\n    });\n  }\n\n  $('#google-oidc-join').click(function googleJoin(e) {\n    e.preventDefault();\n    const params = getSocialAuthParams();\n    params.append('prompt', 'select_account');\n    window.location.assign(`${this.href}?${params}`);\n  });\n\n  $('#twitter-join').click(function socialJoin(e) {\n    e.preventDefault();\n    const params = getSocialAuthParams();\n    window.location.assign(`${this.href}?${params}`);\n  });\n});\n","import './memberJoin';\nimport initProcessPayment from './processPayment';\n\n$(() => {\n  initProcessPayment();\n});\n"],"names":["JoinFormUtils","_FormUtils","_inherits","_super","_createSuper","_this","form","arguments","length","undefined","validators","lang","SG","userLang","passwordValidator","FormUtils","call","confirm_password","notBlankNames","hasInput","push","updateValidators","isSpecialOffer","$","onAltSubmit","bind","_assertThisInitialized","_createClass","key","value","redir","_this2","_typeof","interstitial","showInterstitial","then","_get","_getPrototypeOf","prototype","e","preventDefault","this","submit","extraData","use_alt_payment_source","_get2","spinner","_len","args","Array","_key","apply","concat","catch","error","clearSpinner","debug","_ref","_ref$message","message","_ref$delay","delay","Promise","resolve","messageSpinner","window","setTimeout","document","ready","on","ajaxArgs","url","target","dataset","dataType","data","source","apiPost","location","assign","msg","userError","offerExchangeCode","val","getSocialAuthParams","URLSearchParams","plan_code","offer_code","find","removeClass","addClass","currentTarget","click","params","append","href","initProcessPayment"],"sourceRoot":""}