Skip to content

Instantly share code, notes, and snippets.

@fditrapani
Created July 24, 2020 02:32
Show Gist options
  • Save fditrapani/cc9c86f18ff53d088840f7680dc39a41 to your computer and use it in GitHub Desktop.
Save fditrapani/cc9c86f18ff53d088840f7680dc39a41 to your computer and use it in GitHub Desktop.
This file has been truncated, but you can view the full file.
(window.webpackJsonp = window.webpackJsonp || []).push([[152, 333, 388], {
"../node_modules/flag-icon-css/flags/4x3 sync recursive ^\\.\\/.*\\.svg$": function(e, t, a) {
var n = {
"./ad.svg": "../node_modules/flag-icon-css/flags/4x3/ad.svg",
"./ae.svg": "../node_modules/flag-icon-css/flags/4x3/ae.svg",
"./af.svg": "../node_modules/flag-icon-css/flags/4x3/af.svg",
"./ag.svg": "../node_modules/flag-icon-css/flags/4x3/ag.svg",
"./ai.svg": "../node_modules/flag-icon-css/flags/4x3/ai.svg",
"./al.svg": "../node_modules/flag-icon-css/flags/4x3/al.svg",
"./am.svg": "../node_modules/flag-icon-css/flags/4x3/am.svg",
"./ao.svg": "../node_modules/flag-icon-css/flags/4x3/ao.svg",
"./aq.svg": "../node_modules/flag-icon-css/flags/4x3/aq.svg",
"./ar.svg": "../node_modules/flag-icon-css/flags/4x3/ar.svg",
"./as.svg": "../node_modules/flag-icon-css/flags/4x3/as.svg",
"./at.svg": "../node_modules/flag-icon-css/flags/4x3/at.svg",
"./au.svg": "../node_modules/flag-icon-css/flags/4x3/au.svg",
"./aw.svg": "../node_modules/flag-icon-css/flags/4x3/aw.svg",
"./ax.svg": "../node_modules/flag-icon-css/flags/4x3/ax.svg",
"./az.svg": "../node_modules/flag-icon-css/flags/4x3/az.svg",
"./ba.svg": "../node_modules/flag-icon-css/flags/4x3/ba.svg",
"./bb.svg": "../node_modules/flag-icon-css/flags/4x3/bb.svg",
"./bd.svg": "../node_modules/flag-icon-css/flags/4x3/bd.svg",
"./be.svg": "../node_modules/flag-icon-css/flags/4x3/be.svg",
"./bf.svg": "../node_modules/flag-icon-css/flags/4x3/bf.svg",
"./bg.svg": "../node_modules/flag-icon-css/flags/4x3/bg.svg",
"./bh.svg": "../node_modules/flag-icon-css/flags/4x3/bh.svg",
"./bi.svg": "../node_modules/flag-icon-css/flags/4x3/bi.svg",
"./bj.svg": "../node_modules/flag-icon-css/flags/4x3/bj.svg",
"./bl.svg": "../node_modules/flag-icon-css/flags/4x3/bl.svg",
"./bm.svg": "../node_modules/flag-icon-css/flags/4x3/bm.svg",
"./bn.svg": "../node_modules/flag-icon-css/flags/4x3/bn.svg",
"./bo.svg": "../node_modules/flag-icon-css/flags/4x3/bo.svg",
"./bq.svg": "../node_modules/flag-icon-css/flags/4x3/bq.svg",
"./br.svg": "../node_modules/flag-icon-css/flags/4x3/br.svg",
"./bs.svg": "../node_modules/flag-icon-css/flags/4x3/bs.svg",
"./bt.svg": "../node_modules/flag-icon-css/flags/4x3/bt.svg",
"./bv.svg": "../node_modules/flag-icon-css/flags/4x3/bv.svg",
"./bw.svg": "../node_modules/flag-icon-css/flags/4x3/bw.svg",
"./by.svg": "../node_modules/flag-icon-css/flags/4x3/by.svg",
"./bz.svg": "../node_modules/flag-icon-css/flags/4x3/bz.svg",
"./ca.svg": "../node_modules/flag-icon-css/flags/4x3/ca.svg",
"./cc.svg": "../node_modules/flag-icon-css/flags/4x3/cc.svg",
"./cd.svg": "../node_modules/flag-icon-css/flags/4x3/cd.svg",
"./cf.svg": "../node_modules/flag-icon-css/flags/4x3/cf.svg",
"./cg.svg": "../node_modules/flag-icon-css/flags/4x3/cg.svg",
"./ch.svg": "../node_modules/flag-icon-css/flags/4x3/ch.svg",
"./ci.svg": "../node_modules/flag-icon-css/flags/4x3/ci.svg",
"./ck.svg": "../node_modules/flag-icon-css/flags/4x3/ck.svg",
"./cl.svg": "../node_modules/flag-icon-css/flags/4x3/cl.svg",
"./cm.svg": "../node_modules/flag-icon-css/flags/4x3/cm.svg",
"./cn.svg": "../node_modules/flag-icon-css/flags/4x3/cn.svg",
"./co.svg": "../node_modules/flag-icon-css/flags/4x3/co.svg",
"./cr.svg": "../node_modules/flag-icon-css/flags/4x3/cr.svg",
"./cu.svg": "../node_modules/flag-icon-css/flags/4x3/cu.svg",
"./cv.svg": "../node_modules/flag-icon-css/flags/4x3/cv.svg",
"./cw.svg": "../node_modules/flag-icon-css/flags/4x3/cw.svg",
"./cx.svg": "../node_modules/flag-icon-css/flags/4x3/cx.svg",
"./cy.svg": "../node_modules/flag-icon-css/flags/4x3/cy.svg",
"./cz.svg": "../node_modules/flag-icon-css/flags/4x3/cz.svg",
"./de.svg": "../node_modules/flag-icon-css/flags/4x3/de.svg",
"./dj.svg": "../node_modules/flag-icon-css/flags/4x3/dj.svg",
"./dk.svg": "../node_modules/flag-icon-css/flags/4x3/dk.svg",
"./dm.svg": "../node_modules/flag-icon-css/flags/4x3/dm.svg",
"./do.svg": "../node_modules/flag-icon-css/flags/4x3/do.svg",
"./dz.svg": "../node_modules/flag-icon-css/flags/4x3/dz.svg",
"./ec.svg": "../node_modules/flag-icon-css/flags/4x3/ec.svg",
"./ee.svg": "../node_modules/flag-icon-css/flags/4x3/ee.svg",
"./eg.svg": "../node_modules/flag-icon-css/flags/4x3/eg.svg",
"./eh.svg": "../node_modules/flag-icon-css/flags/4x3/eh.svg",
"./er.svg": "../node_modules/flag-icon-css/flags/4x3/er.svg",
"./es-ca.svg": "../node_modules/flag-icon-css/flags/4x3/es-ca.svg",
"./es.svg": "../node_modules/flag-icon-css/flags/4x3/es.svg",
"./et.svg": "../node_modules/flag-icon-css/flags/4x3/et.svg",
"./eu.svg": "../node_modules/flag-icon-css/flags/4x3/eu.svg",
"./fi.svg": "../node_modules/flag-icon-css/flags/4x3/fi.svg",
"./fj.svg": "../node_modules/flag-icon-css/flags/4x3/fj.svg",
"./fk.svg": "../node_modules/flag-icon-css/flags/4x3/fk.svg",
"./fm.svg": "../node_modules/flag-icon-css/flags/4x3/fm.svg",
"./fo.svg": "../node_modules/flag-icon-css/flags/4x3/fo.svg",
"./fr.svg": "../node_modules/flag-icon-css/flags/4x3/fr.svg",
"./ga.svg": "../node_modules/flag-icon-css/flags/4x3/ga.svg",
"./gb-eng.svg": "../node_modules/flag-icon-css/flags/4x3/gb-eng.svg",
"./gb-nir.svg": "../node_modules/flag-icon-css/flags/4x3/gb-nir.svg",
"./gb-sct.svg": "../node_modules/flag-icon-css/flags/4x3/gb-sct.svg",
"./gb-wls.svg": "../node_modules/flag-icon-css/flags/4x3/gb-wls.svg",
"./gb.svg": "../node_modules/flag-icon-css/flags/4x3/gb.svg",
"./gd.svg": "../node_modules/flag-icon-css/flags/4x3/gd.svg",
"./ge.svg": "../node_modules/flag-icon-css/flags/4x3/ge.svg",
"./gf.svg": "../node_modules/flag-icon-css/flags/4x3/gf.svg",
"./gg.svg": "../node_modules/flag-icon-css/flags/4x3/gg.svg",
"./gh.svg": "../node_modules/flag-icon-css/flags/4x3/gh.svg",
"./gi.svg": "../node_modules/flag-icon-css/flags/4x3/gi.svg",
"./gl.svg": "../node_modules/flag-icon-css/flags/4x3/gl.svg",
"./gm.svg": "../node_modules/flag-icon-css/flags/4x3/gm.svg",
"./gn.svg": "../node_modules/flag-icon-css/flags/4x3/gn.svg",
"./gp.svg": "../node_modules/flag-icon-css/flags/4x3/gp.svg",
"./gq.svg": "../node_modules/flag-icon-css/flags/4x3/gq.svg",
"./gr.svg": "../node_modules/flag-icon-css/flags/4x3/gr.svg",
"./gs.svg": "../node_modules/flag-icon-css/flags/4x3/gs.svg",
"./gt.svg": "../node_modules/flag-icon-css/flags/4x3/gt.svg",
"./gu.svg": "../node_modules/flag-icon-css/flags/4x3/gu.svg",
"./gw.svg": "../node_modules/flag-icon-css/flags/4x3/gw.svg",
"./gy.svg": "../node_modules/flag-icon-css/flags/4x3/gy.svg",
"./hk.svg": "../node_modules/flag-icon-css/flags/4x3/hk.svg",
"./hm.svg": "../node_modules/flag-icon-css/flags/4x3/hm.svg",
"./hn.svg": "../node_modules/flag-icon-css/flags/4x3/hn.svg",
"./hr.svg": "../node_modules/flag-icon-css/flags/4x3/hr.svg",
"./ht.svg": "../node_modules/flag-icon-css/flags/4x3/ht.svg",
"./hu.svg": "../node_modules/flag-icon-css/flags/4x3/hu.svg",
"./id.svg": "../node_modules/flag-icon-css/flags/4x3/id.svg",
"./ie.svg": "../node_modules/flag-icon-css/flags/4x3/ie.svg",
"./il.svg": "../node_modules/flag-icon-css/flags/4x3/il.svg",
"./im.svg": "../node_modules/flag-icon-css/flags/4x3/im.svg",
"./in.svg": "../node_modules/flag-icon-css/flags/4x3/in.svg",
"./io.svg": "../node_modules/flag-icon-css/flags/4x3/io.svg",
"./iq.svg": "../node_modules/flag-icon-css/flags/4x3/iq.svg",
"./ir.svg": "../node_modules/flag-icon-css/flags/4x3/ir.svg",
"./is.svg": "../node_modules/flag-icon-css/flags/4x3/is.svg",
"./it.svg": "../node_modules/flag-icon-css/flags/4x3/it.svg",
"./je.svg": "../node_modules/flag-icon-css/flags/4x3/je.svg",
"./jm.svg": "../node_modules/flag-icon-css/flags/4x3/jm.svg",
"./jo.svg": "../node_modules/flag-icon-css/flags/4x3/jo.svg",
"./jp.svg": "../node_modules/flag-icon-css/flags/4x3/jp.svg",
"./ke.svg": "../node_modules/flag-icon-css/flags/4x3/ke.svg",
"./kg.svg": "../node_modules/flag-icon-css/flags/4x3/kg.svg",
"./kh.svg": "../node_modules/flag-icon-css/flags/4x3/kh.svg",
"./ki.svg": "../node_modules/flag-icon-css/flags/4x3/ki.svg",
"./km.svg": "../node_modules/flag-icon-css/flags/4x3/km.svg",
"./kn.svg": "../node_modules/flag-icon-css/flags/4x3/kn.svg",
"./kp.svg": "../node_modules/flag-icon-css/flags/4x3/kp.svg",
"./kr.svg": "../node_modules/flag-icon-css/flags/4x3/kr.svg",
"./kw.svg": "../node_modules/flag-icon-css/flags/4x3/kw.svg",
"./ky.svg": "../node_modules/flag-icon-css/flags/4x3/ky.svg",
"./kz.svg": "../node_modules/flag-icon-css/flags/4x3/kz.svg",
"./la.svg": "../node_modules/flag-icon-css/flags/4x3/la.svg",
"./lb.svg": "../node_modules/flag-icon-css/flags/4x3/lb.svg",
"./lc.svg": "../node_modules/flag-icon-css/flags/4x3/lc.svg",
"./li.svg": "../node_modules/flag-icon-css/flags/4x3/li.svg",
"./lk.svg": "../node_modules/flag-icon-css/flags/4x3/lk.svg",
"./lr.svg": "../node_modules/flag-icon-css/flags/4x3/lr.svg",
"./ls.svg": "../node_modules/flag-icon-css/flags/4x3/ls.svg",
"./lt.svg": "../node_modules/flag-icon-css/flags/4x3/lt.svg",
"./lu.svg": "../node_modules/flag-icon-css/flags/4x3/lu.svg",
"./lv.svg": "../node_modules/flag-icon-css/flags/4x3/lv.svg",
"./ly.svg": "../node_modules/flag-icon-css/flags/4x3/ly.svg",
"./ma.svg": "../node_modules/flag-icon-css/flags/4x3/ma.svg",
"./mc.svg": "../node_modules/flag-icon-css/flags/4x3/mc.svg",
"./md.svg": "../node_modules/flag-icon-css/flags/4x3/md.svg",
"./me.svg": "../node_modules/flag-icon-css/flags/4x3/me.svg",
"./mf.svg": "../node_modules/flag-icon-css/flags/4x3/mf.svg",
"./mg.svg": "../node_modules/flag-icon-css/flags/4x3/mg.svg",
"./mh.svg": "../node_modules/flag-icon-css/flags/4x3/mh.svg",
"./mk.svg": "../node_modules/flag-icon-css/flags/4x3/mk.svg",
"./ml.svg": "../node_modules/flag-icon-css/flags/4x3/ml.svg",
"./mm.svg": "../node_modules/flag-icon-css/flags/4x3/mm.svg",
"./mn.svg": "../node_modules/flag-icon-css/flags/4x3/mn.svg",
"./mo.svg": "../node_modules/flag-icon-css/flags/4x3/mo.svg",
"./mp.svg": "../node_modules/flag-icon-css/flags/4x3/mp.svg",
"./mq.svg": "../node_modules/flag-icon-css/flags/4x3/mq.svg",
"./mr.svg": "../node_modules/flag-icon-css/flags/4x3/mr.svg",
"./ms.svg": "../node_modules/flag-icon-css/flags/4x3/ms.svg",
"./mt.svg": "../node_modules/flag-icon-css/flags/4x3/mt.svg",
"./mu.svg": "../node_modules/flag-icon-css/flags/4x3/mu.svg",
"./mv.svg": "../node_modules/flag-icon-css/flags/4x3/mv.svg",
"./mw.svg": "../node_modules/flag-icon-css/flags/4x3/mw.svg",
"./mx.svg": "../node_modules/flag-icon-css/flags/4x3/mx.svg",
"./my.svg": "../node_modules/flag-icon-css/flags/4x3/my.svg",
"./mz.svg": "../node_modules/flag-icon-css/flags/4x3/mz.svg",
"./na.svg": "../node_modules/flag-icon-css/flags/4x3/na.svg",
"./nc.svg": "../node_modules/flag-icon-css/flags/4x3/nc.svg",
"./ne.svg": "../node_modules/flag-icon-css/flags/4x3/ne.svg",
"./nf.svg": "../node_modules/flag-icon-css/flags/4x3/nf.svg",
"./ng.svg": "../node_modules/flag-icon-css/flags/4x3/ng.svg",
"./ni.svg": "../node_modules/flag-icon-css/flags/4x3/ni.svg",
"./nl.svg": "../node_modules/flag-icon-css/flags/4x3/nl.svg",
"./no.svg": "../node_modules/flag-icon-css/flags/4x3/no.svg",
"./np.svg": "../node_modules/flag-icon-css/flags/4x3/np.svg",
"./nr.svg": "../node_modules/flag-icon-css/flags/4x3/nr.svg",
"./nu.svg": "../node_modules/flag-icon-css/flags/4x3/nu.svg",
"./nz.svg": "../node_modules/flag-icon-css/flags/4x3/nz.svg",
"./om.svg": "../node_modules/flag-icon-css/flags/4x3/om.svg",
"./pa.svg": "../node_modules/flag-icon-css/flags/4x3/pa.svg",
"./pe.svg": "../node_modules/flag-icon-css/flags/4x3/pe.svg",
"./pf.svg": "../node_modules/flag-icon-css/flags/4x3/pf.svg",
"./pg.svg": "../node_modules/flag-icon-css/flags/4x3/pg.svg",
"./ph.svg": "../node_modules/flag-icon-css/flags/4x3/ph.svg",
"./pk.svg": "../node_modules/flag-icon-css/flags/4x3/pk.svg",
"./pl.svg": "../node_modules/flag-icon-css/flags/4x3/pl.svg",
"./pm.svg": "../node_modules/flag-icon-css/flags/4x3/pm.svg",
"./pn.svg": "../node_modules/flag-icon-css/flags/4x3/pn.svg",
"./pr.svg": "../node_modules/flag-icon-css/flags/4x3/pr.svg",
"./ps.svg": "../node_modules/flag-icon-css/flags/4x3/ps.svg",
"./pt.svg": "../node_modules/flag-icon-css/flags/4x3/pt.svg",
"./pw.svg": "../node_modules/flag-icon-css/flags/4x3/pw.svg",
"./py.svg": "../node_modules/flag-icon-css/flags/4x3/py.svg",
"./qa.svg": "../node_modules/flag-icon-css/flags/4x3/qa.svg",
"./re.svg": "../node_modules/flag-icon-css/flags/4x3/re.svg",
"./ro.svg": "../node_modules/flag-icon-css/flags/4x3/ro.svg",
"./rs.svg": "../node_modules/flag-icon-css/flags/4x3/rs.svg",
"./ru.svg": "../node_modules/flag-icon-css/flags/4x3/ru.svg",
"./rw.svg": "../node_modules/flag-icon-css/flags/4x3/rw.svg",
"./sa.svg": "../node_modules/flag-icon-css/flags/4x3/sa.svg",
"./sb.svg": "../node_modules/flag-icon-css/flags/4x3/sb.svg",
"./sc.svg": "../node_modules/flag-icon-css/flags/4x3/sc.svg",
"./sd.svg": "../node_modules/flag-icon-css/flags/4x3/sd.svg",
"./se.svg": "../node_modules/flag-icon-css/flags/4x3/se.svg",
"./sg.svg": "../node_modules/flag-icon-css/flags/4x3/sg.svg",
"./sh.svg": "../node_modules/flag-icon-css/flags/4x3/sh.svg",
"./si.svg": "../node_modules/flag-icon-css/flags/4x3/si.svg",
"./sj.svg": "../node_modules/flag-icon-css/flags/4x3/sj.svg",
"./sk.svg": "../node_modules/flag-icon-css/flags/4x3/sk.svg",
"./sl.svg": "../node_modules/flag-icon-css/flags/4x3/sl.svg",
"./sm.svg": "../node_modules/flag-icon-css/flags/4x3/sm.svg",
"./sn.svg": "../node_modules/flag-icon-css/flags/4x3/sn.svg",
"./so.svg": "../node_modules/flag-icon-css/flags/4x3/so.svg",
"./sr.svg": "../node_modules/flag-icon-css/flags/4x3/sr.svg",
"./ss.svg": "../node_modules/flag-icon-css/flags/4x3/ss.svg",
"./st.svg": "../node_modules/flag-icon-css/flags/4x3/st.svg",
"./sv.svg": "../node_modules/flag-icon-css/flags/4x3/sv.svg",
"./sx.svg": "../node_modules/flag-icon-css/flags/4x3/sx.svg",
"./sy.svg": "../node_modules/flag-icon-css/flags/4x3/sy.svg",
"./sz.svg": "../node_modules/flag-icon-css/flags/4x3/sz.svg",
"./tc.svg": "../node_modules/flag-icon-css/flags/4x3/tc.svg",
"./td.svg": "../node_modules/flag-icon-css/flags/4x3/td.svg",
"./tf.svg": "../node_modules/flag-icon-css/flags/4x3/tf.svg",
"./tg.svg": "../node_modules/flag-icon-css/flags/4x3/tg.svg",
"./th.svg": "../node_modules/flag-icon-css/flags/4x3/th.svg",
"./tj.svg": "../node_modules/flag-icon-css/flags/4x3/tj.svg",
"./tk.svg": "../node_modules/flag-icon-css/flags/4x3/tk.svg",
"./tl.svg": "../node_modules/flag-icon-css/flags/4x3/tl.svg",
"./tm.svg": "../node_modules/flag-icon-css/flags/4x3/tm.svg",
"./tn.svg": "../node_modules/flag-icon-css/flags/4x3/tn.svg",
"./to.svg": "../node_modules/flag-icon-css/flags/4x3/to.svg",
"./tr.svg": "../node_modules/flag-icon-css/flags/4x3/tr.svg",
"./tt.svg": "../node_modules/flag-icon-css/flags/4x3/tt.svg",
"./tv.svg": "../node_modules/flag-icon-css/flags/4x3/tv.svg",
"./tw.svg": "../node_modules/flag-icon-css/flags/4x3/tw.svg",
"./tz.svg": "../node_modules/flag-icon-css/flags/4x3/tz.svg",
"./ua.svg": "../node_modules/flag-icon-css/flags/4x3/ua.svg",
"./ug.svg": "../node_modules/flag-icon-css/flags/4x3/ug.svg",
"./um.svg": "../node_modules/flag-icon-css/flags/4x3/um.svg",
"./un.svg": "../node_modules/flag-icon-css/flags/4x3/un.svg",
"./us.svg": "../node_modules/flag-icon-css/flags/4x3/us.svg",
"./uy.svg": "../node_modules/flag-icon-css/flags/4x3/uy.svg",
"./uz.svg": "../node_modules/flag-icon-css/flags/4x3/uz.svg",
"./va.svg": "../node_modules/flag-icon-css/flags/4x3/va.svg",
"./vc.svg": "../node_modules/flag-icon-css/flags/4x3/vc.svg",
"./ve.svg": "../node_modules/flag-icon-css/flags/4x3/ve.svg",
"./vg.svg": "../node_modules/flag-icon-css/flags/4x3/vg.svg",
"./vi.svg": "../node_modules/flag-icon-css/flags/4x3/vi.svg",
"./vn.svg": "../node_modules/flag-icon-css/flags/4x3/vn.svg",
"./vu.svg": "../node_modules/flag-icon-css/flags/4x3/vu.svg",
"./wf.svg": "../node_modules/flag-icon-css/flags/4x3/wf.svg",
"./ws.svg": "../node_modules/flag-icon-css/flags/4x3/ws.svg",
"./xk.svg": "../node_modules/flag-icon-css/flags/4x3/xk.svg",
"./ye.svg": "../node_modules/flag-icon-css/flags/4x3/ye.svg",
"./yt.svg": "../node_modules/flag-icon-css/flags/4x3/yt.svg",
"./za.svg": "../node_modules/flag-icon-css/flags/4x3/za.svg",
"./zm.svg": "../node_modules/flag-icon-css/flags/4x3/zm.svg",
"./zw.svg": "../node_modules/flag-icon-css/flags/4x3/zw.svg"
};
function s(e) {
var t = r(e);
return a(t)
}
function r(e) {
if (!a.o(n, e)) {
var t = new Error("Cannot find module '" + e + "'");
throw t.code = "MODULE_NOT_FOUND",
t
}
return n[e]
}
s.keys = function() {
return Object.keys(n)
}
,
s.resolve = r,
e.exports = s,
s.id = "../node_modules/flag-icon-css/flags/4x3 sync recursive ^\\.\\/.*\\.svg$"
},
"../packages/components/dist/esm/product-icon/index.js": function(e, t, a) {
"use strict";
var n = a("../node_modules/react/index.js")
, s = a.n(n)
, r = a("../node_modules/prop-types/index.js")
, i = a.n(r)
, o = a("../node_modules/classnames/index.js")
, c = a.n(o)
, l = a("../node_modules/lodash-es/findKey.js")
, d = a("../node_modules/@babel/runtime/helpers/toConsumableArray.js")
, u = "/calypso/images/jetpack-backup-a5adb7d10cc442d19f9b24b4541bc1e1.svg"
, p = "/calypso/images/jetpack-search-45c9a662b22709cb514351313329aa23.svg"
, m = {
"jetpack-scan": "/calypso/images/jetpack-scan-7935956200af22932207966dcf605a6c.svg",
"jetpack-backup-daily": u,
"jetpack-backup-realtime": u,
"jetpack-free": "/calypso/images/jetpack-free-44df53d327c1bd1a398ed53effdcb296.svg",
"jetpack-personal": "/calypso/images/jetpack-personal-db67581ec6621cabbe3aa1a32167b521.svg",
"jetpack-premium": "/calypso/images/jetpack-premium-a2cd099cefe19078e7034dbcdfa0e580.svg",
"jetpack-professional": "/calypso/images/jetpack-professional-2b66b1c5cc0d544101d5a0579679be94.svg",
"jetpack-search": p,
"jetpack-anti-spam": "/calypso/images/jetpack-anti-spam-b118b4c6a814c557be29797c60df3d33.svg",
"wpcom-blogger": "/calypso/images/wpcom-blogger-dda7d9d51abfb03c2bf4265bb5634fb8.svg",
"wpcom-business": "/calypso/images/wpcom-business-12b92201de1ad0bd052f4a3affb7c82c.svg",
"wpcom-ecommerce": "/calypso/images/wpcom-ecommerce-469d904d4dfb0cf3540d7bfa200ccff2.svg",
"wpcom-free": "/calypso/images/wpcom-free-c26bd117f464670d89b2168207bf9939.svg",
"wpcom-personal": "/calypso/images/wpcom-personal-af68afffe22447c06bbb3c20c94db1a3.svg",
"wpcom-premium": "/calypso/images/wpcom-premium-38838ffe196a3ad6ba3784059707ee25.svg",
"wpcom-search": p
}
, h = {
"wpcom-free": ["free_plan"],
"wpcom-blogger": ["blogger-bundle", "blogger-bundle-2y"],
"wpcom-personal": ["personal-bundle", "personal-bundle-2y", "personal-bundle-monthly"],
"wpcom-premium": ["value_bundle", "value_bundle-2y", "value_bundle-monthly"],
"wpcom-ecommerce": ["ecommerce-bundle", "ecommerce-bundle-2y", "ecommerce-bundle-monthly"],
"wpcom-business": ["business-bundle", "business-bundle-2y", "business-bundle-monthly"],
"jetpack-free": ["jetpack_free"],
"jetpack-personal": ["jetpack_personal", "jetpack_personal_monthly"],
"jetpack-premium": ["jetpack_premium", "jetpack_premium_monthly"],
"jetpack-professional": ["jetpack_business", "jetpack_business_monthly"],
"jetpack-backup-daily": ["jetpack_backup_daily", "jetpack_backup_daily_monthly"],
"jetpack-backup-realtime": ["jetpack_backup_realtime", "jetpack_backup_realtime_monthly"],
"jetpack-scan": ["jetpack_scan", "jetpack_scan_monthly"],
"jetpack-search": ["jetpack_search", "jetpack_search_monthly", "wpcom_search"],
"jetpack-anti-spam": ["jetpack_anti_spam", "jetpack_anti_spam_monthly"]
}
, g = a.n(d)()(Object.values(h)).flat();
a("../packages/components/dist/esm/product-icon/style.scss");
function b(e) {
var t = e.className
, a = e.slug;
if (!a)
return null;
var n = Object(l.a)(h, (function(e) {
return e.includes(a)
}
))
, r = m[n];
return r ? s.a.createElement("img", {
src: r,
className: c()("product-icon", "is-".concat(n), t),
role: "presentation",
alt: ""
}) : null
}
b.propTypes = {
classNames: i.a.string,
slug: i.a.oneOf(g).isRequired
};
t.a = b
},
"../packages/components/dist/esm/product-icon/style.scss": function(e, t, a) {},
"../packages/components/dist/esm/root-child/index.js": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return y
}
));
var n = a("../node_modules/@babel/runtime/helpers/classCallCheck.js")
, s = a.n(n)
, r = a("../node_modules/@babel/runtime/helpers/createClass.js")
, i = a.n(r)
, o = a("../node_modules/@babel/runtime/helpers/assertThisInitialized.js")
, c = a.n(o)
, l = a("../node_modules/@babel/runtime/helpers/inherits.js")
, d = a.n(l)
, u = a("../node_modules/@babel/runtime/helpers/createSuper.js")
, p = a.n(u)
, m = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, h = a.n(m)
, g = a("../node_modules/react/index.js")
, b = a.n(g)
, f = a("../node_modules/react-dom/index.js")
, _ = a.n(f)
, y = function(e) {
d()(a, e);
var t = p()(a);
function a() {
var e;
s()(this, a);
for (var n = arguments.length, r = new Array(n), i = 0; i < n; i++)
r[i] = arguments[i];
return e = t.call.apply(t, [this].concat(r)),
h()(c()(e), "state", {
containerEl: null
}),
e
}
return i()(a, [{
key: "componentDidMount",
value: function() {
var e = document.createElement("div");
document.body.appendChild(e),
this.setState({
containerEl: e
})
}
}, {
key: "componentWillUnmount",
value: function() {
this.state.containerEl && document.body.removeChild(this.state.containerEl)
}
}, {
key: "render",
value: function() {
return this.state.containerEl ? _.a.createPortal(this.props.children, this.state.containerEl) : null
}
}]),
a
}(b.a.Component)
},
"./assets/images/illustrations/jetpack-concierge.svg": function(e, t, a) {
"use strict";
t.a = "/calypso/images/jetpack-concierge-6942c2490530e6e2badb8c8578316f1f.svg"
},
"./assets/images/upgrades/cc-amex.svg": function(e, t, a) {
"use strict";
t.a = "/calypso/images/cc-amex-e0efd56e1d108c8eb960592bf385f785.svg"
},
"./assets/images/upgrades/cc-diners.svg": function(e, t, a) {
"use strict";
t.a = "/calypso/images/cc-diners-16ca93315c92bf5c0000d63300e5cd85.svg"
},
"./assets/images/upgrades/cc-discover.svg": function(e, t, a) {
"use strict";
t.a = "/calypso/images/cc-discover-a6fa89112e1e7ed8b1fe78f82d29b76a.svg"
},
"./assets/images/upgrades/cc-jcb.svg": function(e, t, a) {
"use strict";
t.a = "/calypso/images/cc-jcb-331d1b39baf9a992bfdbacc7412570f4.svg"
},
"./assets/images/upgrades/cc-mastercard.svg": function(e, t, a) {
"use strict";
t.a = "/calypso/images/cc-mastercard-6bc029da438b0bfb21e65c8b9f3a9519.svg"
},
"./assets/images/upgrades/cc-unionpay.svg": function(e, t, a) {
"use strict";
t.a = "/calypso/images/cc-unionpay-bf0d855ed117f2f9bdae37cd43f09a95.svg"
},
"./assets/images/upgrades/cc-visa.svg": function(e, t, a) {
"use strict";
t.a = "/calypso/images/cc-visa-38e66f6095eb4fbf1eaa3baa9cb7ede3.svg"
},
"./blocks/credit-card-form/helpers.js": function(e, t, a) {
"use strict";
a.d(t, "g", (function() {
return d
}
)),
a.d(t, "h", (function() {
return u
}
)),
a.d(t, "f", (function() {
return p
}
)),
a.d(t, "a", (function() {
return m
}
)),
a.d(t, "e", (function() {
return h
}
)),
a.d(t, "c", (function() {
return g
}
)),
a.d(t, "b", (function() {
return b
}
)),
a.d(t, "d", (function() {
return f
}
));
var n = a("../node_modules/react/index.js")
, s = a("../node_modules/lodash-es/debounce.js")
, r = a("../node_modules/lodash-es/kebabCase.js")
, i = a("../node_modules/lodash-es/camelCase.js")
, o = a("./notices/index.js")
, c = a("./lib/purchases/index.js");
const l = a("./lib/wp/browser.js").a.undocumented();
async function d({createCardToken: e, saveStoredCard: t, translate: a, apiParams: n, purchase: s, siteSlug: r, formFieldValues: i, stripeConfiguration: d, parseTokenFromResponse: u}) {
const p = await async function({formFieldValues: e, createCardToken: t, parseTokenFromResponse: a, translate: n}) {
const s = h(e)
, r = await t(s)
, i = a(r);
if (!i)
throw new Error(n("Failed to add card."));
return i
}({
formFieldValues: i,
createCardToken: e,
parseTokenFromResponse: u,
translate: a
});
return t ? async function({token: e, translate: t, saveStoredCard: a, stripeConfiguration: n}) {
const s = n ? {
payment_partner: n.processor_id
} : {};
await a({
token: e,
additionalData: s
}),
o.a.success(t("Card added successfully"), {
persistent: !0
})
}({
token: p,
translate: a,
saveStoredCard: t,
stripeConfiguration: d
}) : async function({formFieldValues: e, apiParams: t, purchase: a, siteSlug: n, token: s, translate: r, stripeConfiguration: i}) {
const d = function(e, t, a, n={}) {
return {
...n,
country: e.country,
zip: e["postal-code"],
month: e["expiration-date"].split("/")[0],
year: e["expiration-date"].split("/")[1],
name: e.name,
document: e.document,
street_number: e["street-number"],
address_1: e["address-1"],
address_2: e["address-2"],
city: e.city,
state: e.state,
phone_number: e["phone-number"],
payment_partner: a ? a.processor_id : "",
paygate_token: t
}
}(h(e), s, i, t)
, u = await l.updateCreditCard(d);
if (u.error)
throw new Error(u);
if (a && n && Object(c.F)(a)) {
let e = ""
, t = {};
return Object(c.M)(a) ? (e = r("Your credit card details were successfully updated."),
t = {
persistent: !0
}) : (e = r("Your credit card details were successfully updated, but your subscription has not been renewed yet."),
t = {
button: r("Renew Now"),
onClick: function(e, t) {
Object(c.n)(a, n),
t()
},
persistent: !0
}),
void o.a.info(e, t)
}
o.a.success(u.success, {
persistent: !0
})
}({
formFieldValues: i,
apiParams: n,
purchase: s,
siteSlug: r,
token: p,
translate: a,
stripeConfiguration: d
})
}
function u(e, t) {
const [a,r] = Object(n.useState)(e)
, i = Object(n.useRef)(Object(s.a)(e=>r(e), t));
return Object(n.useEffect)(()=>i.current(e), [e]),
[a, r]
}
function p(e) {
return t=>new Promise((a,n)=>{
e(t, (e,t)=>{
!e && t.token ? a(t) : n(e || new Error("No card token returned"))
}
)
}
)
}
function m(e) {
return Object.keys(e).reduce((t,a)=>!e[a].length && t, !0)
}
function h(e) {
return Object.keys(e).reduce((t,a)=>(t[Object(r.a)(a)] = e[a],
t), {})
}
function g(e) {
return Object.keys(e).reduce((t,a)=>(t[Object(i.default)(a)] = e[a],
t), {})
}
function b(e, t) {
return Object.keys(e).reduce((e,a)=>(e[a] = t,
e), {})
}
function f(e={}) {
return ["name", "number", "cvv", "expirationDate", "country", "postalCode", "streetNumber", "address1", "address2", "phoneNumber", "streetNumber", "city", "state", "document", "brand"].reduce((t,a)=>({
...t,
[a]: e[a] || ""
}), {})
}
},
"./blocks/credit-card-form/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/react/index.js")
, s = a.n(n)
, r = a("../node_modules/prop-types/index.js")
, i = a.n(r)
, o = a("../packages/i18n-calypso/dist/esm/index.js")
, c = a("../node_modules/lodash-es/camelCase.js")
, l = a("../node_modules/lodash-es/values.js")
, d = a("../node_modules/react-redux/es/index.js")
, u = a("./components/gridicon/index.tsx")
, p = a("../node_modules/debug/src/browser.js")
, m = a.n(p)
, h = a("../packages/components/dist/esm/card/index.js")
, g = a("../packages/components/dist/esm/card/compact.js")
, b = a("./components/credit-card-form-fields/index.jsx")
, f = a("./components/forms/form-button/index.jsx")
, _ = a("./notices/index.js")
, y = a("./lib/checkout/index.js")
, j = a("./notices/validation-error-list.jsx")
, v = a("./lib/url/support.js")
, E = a("./state/selectors/get-countries.js")
, $ = a("./components/data/query-countries/payments.jsx")
, C = a("./lib/i18n-utils/browser.js")
, x = a("./lib/stripe/index.js")
, P = a("./blocks/credit-card-form/helpers.js");
a("./blocks/credit-card-form/style.scss");
const O = m()("calypso:credit-card-form");
function S({apiParams: e={}, createCardToken: t, countriesList: a, initialValues: r, purchase: i, recordFormSubmitEvent: o, saveStoredCard: d=null, siteSlug: p, successCallback: m, showUsedForExistingPurchasesInfo: v=!1, autoFocus: E=!0, heading: C, onCancel: S, translate: T}) {
const {stripe: I, stripeConfiguration: R, setStripeError: A} = Object(x.g)()
, [F,L] = Object(n.useState)(!1)
, [U,M] = Object(n.useState)(Object(P.d)(r))
, [q,B] = Object(n.useState)({})
, [G,V] = Object(n.useState)(Object(P.c)(Object(y.e)(Object(P.e)(U), I ? "stripe" : "credit-card").errors))
, [H,W] = Object(P.h)(G, 1e3);
return s.a.createElement("form", {
onSubmit: async a=>{
if (a.preventDefault(),
!F) {
L(!0);
try {
if (B(G),
!Object(P.a)(G))
throw new Error(T("Your credit card information is not valid"));
o();
const a = Object(P.f)(t)
, n = async e=>{
const {name: t, country: a, "postal-code": n} = e
, s = {
name: t,
address: {
country: a,
postal_code: n
}
};
return Object(x.f)(I, R, s)
}
, s = e=>e.payment_method
, r = e=>e.token;
await Object(P.g)({
createCardToken: I ? n : a,
saveStoredCard: d,
translate: T,
apiParams: e,
purchase: i,
siteSlug: p,
formFieldValues: U,
stripeConfiguration: R,
parseTokenFromResponse: I ? s : r
}),
m()
} catch (e) {
O("Error while submitting", e),
L(!1),
e && A && A(e),
e && function({translate: e, error: t}) {
if (t instanceof x.b || t instanceof x.c)
return void _.a.error(s.a.createElement(N, {
translate: e
}));
if ("object" == typeof t.message)
return void _.a.error(s.a.createElement(j.a, {
messages: Object(l.a)(t.message)
}));
_.a.error(t.message)
}({
translate: T,
error: e
})
}
}
}
}, s.a.createElement(h.a, {
className: "credit-card-form__content"
}, C && s.a.createElement("div", {
className: "credit-card-form__heading"
}, C), s.a.createElement($.a, null), s.a.createElement(b.a, {
card: Object(P.e)(U),
countriesList: a,
eventFormName: "Edit Card Details Form",
onFieldChange: e=>{
const t = {
...U,
...Object(P.c)(e)
};
M(t),
B({
...q,
...Object(P.c)(e)
});
const a = Object(P.b)(Object(P.c)(e), []);
W({
...H,
...a
}),
V(Object(P.c)(Object(y.e)(Object(P.e)(t), I ? "stripe" : "credit-card").errors))
}
,
getErrorMessage: e=>{
const t = Object(c.default)(e);
return (q[t] || U[t]) && H[t]
}
,
autoFocus: E
}), s.a.createElement("div", {
className: "credit-card-form__card-terms"
}, s.a.createElement(u.a, {
icon: "info-outline",
size: 18
}), s.a.createElement("p", null, s.a.createElement(k, {
translate: T
}))), s.a.createElement(D, {
translate: T,
showUsedForExistingPurchasesInfo: v
})), s.a.createElement(g.a, {
className: "credit-card-form__footer"
}, s.a.createElement("em", null, T("All fields required")), S && s.a.createElement(f.a, {
type: "button",
isPrimary: !1,
onClick: S
}, T("Cancel")), s.a.createElement(w, {
translate: T,
formSubmitting: F
})))
}
function w({translate: e, formSubmitting: t}) {
return s.a.createElement(f.a, {
disabled: t,
type: "submit"
}, e(t ? "Saving card…" : "Save card", {
context: "Button label",
comment: "Credit card"
}))
}
function k({translate: e}) {
return e("By saving a credit card, you agree to our {{tosLink}}Terms of Service{{/tosLink}}, and if you use it to pay for a subscription or plan, you authorize your credit card to be charged on a recurring basis until you cancel, which you can do at any time. You understand {{autoRenewalSupportPage}}how your subscription works{{/autoRenewalSupportPage}} and {{managePurchasesSupportPage}}how to cancel{{/managePurchasesSupportPage}}.", {
components: {
tosLink: s.a.createElement("a", {
href: Object(C.l)("https://wordpress.com/tos/"),
target: "_blank",
rel: "noopener noreferrer"
}),
autoRenewalSupportPage: s.a.createElement("a", {
href: v.b,
target: "_blank",
rel: "noopener noreferrer"
}),
managePurchasesSupportPage: s.a.createElement("a", {
href: v.J,
target: "_blank",
rel: "noopener noreferrer"
})
}
})
}
function D({translate: e, showUsedForExistingPurchasesInfo: t}) {
return t ? s.a.createElement("div", {
className: "credit-card-form__card-terms"
}, s.a.createElement(u.a, {
icon: "info-outline",
size: 18
}), s.a.createElement("p", null, e("This card will be used for future renewals of existing purchases."))) : null
}
function N({translate: e}) {
return s.a.createElement("div", null, e("There was a problem with your credit card. Please check your information and try again."))
}
S.propTypes = {
apiParams: i.a.object,
createCardToken: i.a.func.isRequired,
countriesList: i.a.array.isRequired,
initialValues: i.a.object,
purchase: i.a.object,
recordFormSubmitEvent: i.a.func.isRequired,
saveStoredCard: i.a.func,
siteSlug: i.a.string,
successCallback: i.a.func.isRequired,
showUsedForExistingPurchasesInfo: i.a.bool,
autoFocus: i.a.bool,
heading: i.a.string,
onCancel: i.a.func,
translate: i.a.func.isRequired
},
t.a = Object(d.c)(e=>({
countriesList: Object(E.a)(e, "payments")
}))(Object(o.c)(S))
},
"./blocks/credit-card-form/style.scss": function(e, t, a) {},
"./blocks/edit-gravatar/style.scss": function(e, t, a) {},
"./blocks/get-apps/apps-badge.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, s = a.n(n)
, r = a("../node_modules/prop-types/index.js")
, i = a.n(r)
, o = a("../node_modules/react/index.js")
, c = a.n(o)
, l = a("../node_modules/react-redux/es/index.js")
, d = a("../node_modules/lodash-es/startsWith.js")
, u = a("../packages/i18n-calypso/dist/esm/index.js")
, p = a("../node_modules/classnames/index.js")
, m = a.n(p)
, h = a("./lib/i18n-utils/browser.js")
, g = a("./state/analytics/actions/record.js")
, b = a("./components/translatable/proptype.js");
a("./blocks/get-apps/apps-badge.scss");
const f = {
ios: {
defaultSrc: "/calypso/images/me/get-apps-ios-store.svg",
src: "https://linkmaker.itunes.apple.com/assets/shared/badges/{localeSlug}/appstore-lrg.svg",
tracksEvent: "calypso_app_download_ios_click",
getStoreLink: e=>`https://apps.apple.com/app/apple-store/id335703880?pt=299112&ct=${e}&mt=8`,
getTitleText: ()=>Object(u.f)("Download the WordPress iOS mobile app."),
getAltText: ()=>Object(u.f)("Apple App Store download badge"),
getLocaleSlug: function() {
const e = Object(h.g)().split("-")[0];
return "en" === e ? "en-us" : `${e}-${e}`
}
},
android: {
defaultSrc: "/calypso/images/me/get-apps-google-play.png",
src: "https://play.google.com/intl/en_us/badges/images/generic/{localeSlug}_badge_web_generic.png",
tracksEvent: "calypso_app_download_android_click",
getStoreLink: (e,t="web",a="mobile-download-promo-pages")=>`https://play.google.com/store/apps/details?id=org.wordpress.android&referrer=utm_source%3D%${e}%26utm_medium%3D${t}%26utm_campaign%3D${a}`,
getTitleText: ()=>Object(u.f)("Download the WordPress Android mobile app."),
getAltText: ()=>Object(u.f)("Google Play Store download badge"),
getLocaleSlug: h.g
}
};
class _ extends o.PureComponent {
constructor(e) {
super(e),
s()(this, "onLoadImageComplete", ()=>{
this.setState({
hasExternalImageLoaded: !0
})
}
),
s()(this, "onLoadImageError", ()=>{
this.setState({
hasExternalImageLoaded: !1,
imageSrc: f[this.props.storeName].defaultSrc
})
}
),
s()(this, "onLinkClick", ()=>{
const {storeName: e} = this.props;
this.props.recordTracksEvent(f[e].tracksEvent)
}
);
const t = f[e.storeName].getLocaleSlug().toLowerCase()
, a = !Object(d.a)(t, "en");
this.state = {
shouldLoadExternalImage: a,
imageSrc: a ? f[e.storeName].src.replace("{localeSlug}", t) : f[e.storeName].defaultSrc
},
a && (this.image = null,
this.loadImage())
}
loadImage() {
this.image = new globalThis.Image,
this.image.src = this.state.imageSrc,
this.image.onload = this.onLoadImageComplete,
this.image.onerror = this.onLoadImageError
}
render() {
const {altText: e, titleText: t, storeLink: a, storeName: n, utm_source: s, utm_medium: r, utm_campaign: i} = this.props
, {imageSrc: o, hasExternalImageLoaded: l} = this.state
, d = m()("get-apps__app-badge", {
[n + "-app-badge"]: !0,
"is-external-image": l
})
, u = f[n];
return c.a.createElement("figure", {
className: d
}, c.a.createElement("a", {
href: a || u.getStoreLink(s, r, i),
onClick: this.onLinkClick,
target: "_blank",
rel: "noopener noreferrer"
}, c.a.createElement("img", {
src: o,
title: t || u.getTitleText(),
alt: e || u.getAltText()
})))
}
}
s()(_, "propTypes", {
altText: b.a,
storeLink: i.a.string,
storeName: i.a.oneOf(["ios", "android"]).isRequired,
titleText: b.a,
utm_source: i.a.string.isRequired,
utm_campaign: i.a.string,
utm_medium: i.a.string
}),
s()(_, "defaultProps", {
altText: "",
storeLink: null,
titleText: ""
}),
t.a = Object(l.c)(null, {
recordTracksEvent: g.e
})(_)
},
"./blocks/get-apps/apps-badge.scss": function(e, t, a) {},
"./blocks/get-apps/style.scss": function(e, t, a) {},
"./components/action-card/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/react/index.js")
, s = a.n(n)
, r = a("./components/gridicon/index.tsx")
, i = a("../node_modules/prop-types/index.js")
, o = a.n(i)
, c = a("../node_modules/classnames/index.js")
, l = a.n(c)
, d = a("../packages/components/dist/esm/card/index.js")
, u = a("../packages/components/dist/esm/button/index.js");
a("./components/action-card/style.scss");
const p = ({headerText: e, mainText: t, buttonPrimary: a, buttonText: n, buttonIcon: i, buttonTarget: o, buttonHref: c, buttonOnClick: p, children: m, compact: h, classNames: g, buttonDisabled: b, illustration: f})=>s.a.createElement(d.a, {
className: l()("action-card", g),
compact: h
}, f && s.a.createElement("img", {
className: "action-card__illustration",
alt: "concierge session signup form header",
src: f
}), s.a.createElement("div", {
className: "action-card__main"
}, s.a.createElement("h2", {
className: "action-card__heading"
}, e), s.a.createElement("p", null, t)), s.a.createElement("div", {
className: "action-card__button-container"
}, m || s.a.createElement(u.a, {
primary: a,
href: c,
target: o,
onClick: p,
disabled: b
}, n, " ", i && s.a.createElement(r.a, {
icon: i
}))));
p.propTypes = {
headerText: o.a.string.isRequired,
mainText: o.a.string.isRequired,
buttonPrimary: o.a.bool,
buttonText: o.a.string,
buttonIcon: o.a.string,
buttonOnClick: o.a.func,
buttonHref: o.a.string,
buttonTarget: o.a.string,
buttonDisabled: o.a.bool,
children: o.a.any,
compact: o.a.bool,
illustration: o.a.string
},
p.defaultProps = {
compact: !0,
buttonDisabled: !1
},
t.a = p
},
"./components/action-card/style.scss": function(e, t, a) {},
"./components/badge/index.jsx": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return u
}
));
var n = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../node_modules/prop-types/index.js")
, c = a.n(o)
, l = a("../node_modules/classnames/index.js")
, d = a.n(l);
a("./components/badge/style.scss");
class u extends i.a.Component {
render() {
const {className: e, type: t} = this.props;
return i.a.createElement("div", {
className: d()("badge badge--" + t, e)
}, this.props.children)
}
}
s()(u, "propTypes", {
type: c.a.oneOf(["warning", "success", "info", "info-blue", "error"]).isRequired
}),
s()(u, "defaultProps", {
type: "warning"
})
},
"./components/badge/style.scss": function(e, t, a) {},
"./components/card-heading/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/prop-types/index.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../node_modules/lodash-es/includes.js")
, c = a("../node_modules/classnames/index.js")
, l = a.n(c)
, d = a("./lib/formatting/prevent-widows.js");
a("./components/card-heading/style.scss");
const u = [54, 48, 47, 36, 32, 24, 21, 20, 16, 14, 12, 11];
function p({tagName: e="h1", size: t=20, children: a}) {
const n = {};
n["card-heading-" + t] = Object(o.a)(u, t);
const s = l()("card-heading", n);
return i.a.createElement(e, {
className: s
}, Object(d.a)(a, 2))
}
p.propTypes = {
tagName: s.a.string,
size: s.a.number
},
t.a = p
},
"./components/card-heading/style.scss": function(e, t, a) {},
"./components/clipboard-button-input/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/extends.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../node_modules/prop-types/index.js")
, c = a.n(o)
, l = a("../node_modules/classnames/index.js")
, d = a.n(l)
, u = a("../packages/i18n-calypso/dist/esm/index.js")
, p = a("../node_modules/react-redux/es/index.js")
, m = a("./lib/url/http-utils.ts")
, h = a("./components/forms/clipboard-button/index.jsx")
, g = a("./components/forms/form-text-input/index.jsx")
, b = a("./state/analytics/actions/record.js");
a("./components/clipboard-button-input/style.scss");
function f({value: e="", className: t, disabled: a, hideHttp: n, dispatch: r, ...o}) {
const c = Object(u.h)()
, [l,p] = i.a.useState(!1);
i.a.useEffect(()=>{
if (l) {
const e = setTimeout(()=>p(!1), 4e3);
return ()=>clearTimeout(e)
}
}
, [l]);
return i.a.createElement("span", {
className: d()("clipboard-button-input", t)
}, i.a.createElement(g.a, s()({}, o, {
disabled: a,
value: n ? Object(m.c)(e) : e,
type: "text",
selectOnFocus: !0,
readOnly: !0
})), i.a.createElement(h.a, {
text: e,
onCopy: ()=>{
p(!0),
r(Object(b.e)("calypso_editor_clipboard_url_button_click"))
}
,
disabled: a,
compact: !0
}, l ? c("Copied!") : c("Copy", {
context: "verb"
})))
}
f.propTypes = {
value: c.a.string,
disabled: c.a.bool,
className: c.a.string,
hideHttp: c.a.bool
},
t.a = Object(p.c)()(f)
},
"./components/clipboard-button-input/style.scss": function(e, t, a) {},
"./components/credit-card-form-fields/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, s = a.n(n)
, r = a("../node_modules/@babel/runtime/helpers/extends.js")
, i = a.n(r)
, o = a("../node_modules/prop-types/index.js")
, c = a.n(o)
, l = a("../node_modules/react/index.js")
, d = a.n(l)
, u = a("../packages/i18n-calypso/dist/esm/index.js")
, p = a("../node_modules/classnames/index.js")
, m = a.n(p)
, h = a("../node_modules/lodash-es/isEmpty.js")
, g = a("../node_modules/lodash-es/noop.js")
, b = a("./notices/index.js")
, f = a("../node_modules/react-stripe-elements/es/index.js")
, _ = a("./lib/checkout/index.js")
, y = a("./my-sites/domains/components/form/input.jsx");
class j extends d.a.Component {
render() {
return d.a.createElement("div", {
className: "credit-card-number-input"
}, d.a.createElement(y.a, i()({}, this.props, {
classes: Object(_.a)(this.props.value)
})))
}
}
var v = j
, E = a("./components/payment-country-select/index.jsx")
, $ = a("./my-sites/checkout/checkout/country-specific-payment-fields.jsx")
, C = a("./my-sites/domains/components/form/index.jsx")
, x = a("./components/info-popover/index.jsx")
, P = a("./lib/checkout/processor-specific.js")
, O = a("./components/forms/form-input-validation/index.jsx")
, S = a("./lib/stripe/index.js");
a("./components/credit-card-form-fields/style.scss");
const w = T(f.CardNumberElement)
, k = T(f.CardExpiryElement)
, D = T(f.CardCvcElement);
function N({translate: e, card: t}) {
const a = Object(_.a)(t.number);
let n = e("This is the 3-digit number printed on the signature panel on the back of your card.")
, s = "/calypso/images/cc-cvv-back-67cda83685f941def4636c44100c5d1b.svg";
return "amex" === a && (n = e("This is the 4-digit number printed above the account number on the front of your card."),
s = "/calypso/images/cc-cvv-front-94cafb6b9473eedc156a03cfbb268d1c.svg"),
d.a.createElement(x.a, {
position: "top",
className: "credit-card-form-fields__cvv-info"
}, d.a.createElement("img", {
className: "credit-card-form-fields__cvv-illustration",
src: s,
width: "42",
height: "30",
alt: e("Credit card Security Code illustration")
}), n)
}
function T(e) {
return ({getErrorMessage: t, fieldName: a, ...n})=>{
const [s,r] = Object(l.useState)();
return d.a.createElement(d.a.Fragment, null, d.a.createElement(e, i()({
onChange: ({error: e})=>r(e ? e.message : null)
}, n)), d.a.createElement(I, {
errorMessage: s,
getErrorMessage: t,
fieldName: a
}))
}
}
function I({errorMessage: e, getErrorMessage: t, fieldName: a}) {
if (!e) {
const n = t(a) || [];
e = n.length ? n[0] : null
}
if (!e)
return null;
const n = "validation-field-" + a;
return d.a.createElement(O.a, {
id: n,
isError: !0,
text: e
})
}
function R({translate: e, createField: t, getErrorMessage: a, card: n}) {
const {stripe: s, isStripeLoading: r, stripeLoadingError: i} = Object(S.g)()
, o = e("Card Number", {
comment: "Card number label on credit card form"
});
if (s && !Object(P.e)(n.country)) {
const e = {
base: "credit-card-form-fields__element",
invalid: "is-error",
focus: "has-focus"
};
return d.a.createElement("div", {
className: "credit-card-form-fields__field number"
}, d.a.createElement("label", {
className: "credit-card-form-fields__label form-label"
}, o, d.a.createElement(w, {
fieldName: "card_number",
getErrorMessage: a,
classes: e
})))
}
const c = !(!r && !i) && !Object(P.e)(n.country);
return t("number", v, {
inputMode: "numeric",
label: o,
placeholder: "•••• •••• •••• ••••",
disabled: c
})
}
function A({translate: e, createField: t, getErrorMessage: a, card: n}) {
const {stripe: s, isStripeLoading: r, stripeLoadingError: i} = Object(S.g)();
i && !Object(P.e)(n.country) && b.a.error(i.message || "Error loading Stripe");
const o = e('Security Code {{span}}("CVC" or "CVV"){{/span}}', {
components: {
span: d.a.createElement("span", {
className: "credit-card-form-fields__explainer"
})
}
})
, c = e("Expiry Date", {
comment: "Expiry label on credit card form"
});
if (s && !Object(P.e)(n.country)) {
const e = {
base: "credit-card-form-fields__element",
invalid: "is-error",
focus: "has-focus"
};
return d.a.createElement(d.a.Fragment, null, d.a.createElement("div", {
className: "credit-card-form-fields__field expiration-date"
}, d.a.createElement("label", {
className: "credit-card-form-fields__label form-label"
}, c, d.a.createElement(k, {
fieldName: "card_expiry",
getErrorMessage: a,
classes: e
}))), d.a.createElement("div", {
className: "credit-card-form-fields__field cvv"
}, d.a.createElement("label", {
className: "credit-card-form-fields__label form-label"
}, o, d.a.createElement(D, {
fieldName: "card_cvc",
getErrorMessage: a,
classes: e
}))))
}
const l = !(!r && !i) && !Object(P.e)(n.country);
return d.a.createElement(d.a.Fragment, null, t("expiration-date", C.c, {
inputMode: "numeric",
label: c,
disabled: l,
placeholder: e("MM/YY", {
comment: "Expiry placeholder for Expiry date on credit card form"
})
}), t("cvv", C.c, {
inputMode: "numeric",
disabled: l,
placeholder: " ",
label: e('Security Code {{span}}("CVC" or "CVV"){{/span}} {{infoPopover/}}', {
components: {
infoPopover: d.a.createElement(N, {
translate: e,
card: n
}),
span: d.a.createElement("span", {
className: "credit-card-form-fields__explainer"
})
}
})
}))
}
N.propTypes = {
translate: c.a.func.isRequired,
card: c.a.object.isRequired
},
I.propTypes = {
errorMessage: c.a.string,
getErrorMessage: c.a.func.isRequired,
fieldName: c.a.string.isRequired
},
R.propTypes = {
translate: c.a.func.isRequired,
createField: c.a.func.isRequired,
getErrorMessage: c.a.func.isRequired,
card: c.a.object.isRequired
},
A.propTypes = {
translate: c.a.func.isRequired,
createField: c.a.func.isRequired,
getErrorMessage: c.a.func.isRequired,
card: c.a.object.isRequired
};
class F extends d.a.Component {
constructor(...e) {
super(...e),
s()(this, "createField", (e,t,a)=>{
const n = this.props.getErrorMessage(e) || [];
return d.a.createElement(t, Object.assign({}, {
additionalClasses: "credit-card-form-fields__field",
eventFormName: this.props.eventFormName,
isError: !Object(h.a)(n),
errorMessage: n[0],
name: e,
onBlur: this.handleFieldChange,
onChange: this.handleFieldChange,
value: this.getFieldValue(e),
autoComplete: "off"
}, a))
}
),
s()(this, "getFieldValue", e=>this.props.card[e] || ""),
s()(this, "updateFieldValues", (e,t)=>{
const a = this.getFieldValue(e);
if (a === t)
return;
const {onFieldChange: n} = this.props
, s = {
[e]: Object(_.d)(e, a, t)
}
, r = {
[e]: Object(_.c)(e, a, t)
};
"number" === e && (s.brand = Object(_.a)(s[e])),
n(s, r)
}
),
s()(this, "handleFieldChange", e=>{
this.updateFieldValues(e.target.name, e.target.value)
}
)
}
shouldRenderCountrySpecificFields() {
return this.props.isNewTransaction && Object(P.e)(this.getFieldValue("country"))
}
render() {
const {translate: e, countriesList: t, autoFocus: a} = this.props
, n = this.shouldRenderCountrySpecificFields()
, s = m()({
"credit-card-form-fields__extras": !0,
"ebanx-details-required": n
});
return d.a.createElement("div", {
className: "credit-card-form-fields"
}, this.createField("name", C.c, {
autoFocus: a,
label: e("Cardholder Name {{span}}(as written on card){{/span}}", {
comment: "Cardholder name label on credit card form",
components: {
span: d.a.createElement("span", {
className: "credit-card-form-fields__explainer"
})
}
}),
placeholder: " "
}), d.a.createElement("div", {
className: "credit-card-form-fields__field number"
}, d.a.createElement(R, {
translate: this.props.translate,
createField: this.createField,
getErrorMessage: this.props.getErrorMessage,
card: this.props.card
})), d.a.createElement("div", {
className: s
}, d.a.createElement(A, {
translate: this.props.translate,
createField: this.createField,
getErrorMessage: this.props.getErrorMessage,
card: this.props.card
}), this.createField("country", E.a, {
label: e("Country"),
placeholder: " ",
countriesList: t,
onChange: g.a,
onCountrySelected: this.updateFieldValues
}), n ? d.a.createElement($.a, {
countryCode: this.getFieldValue("country"),
countriesList: t,
getErrorMessage: this.props.getErrorMessage,
getFieldValue: this.getFieldValue,
handleFieldChange: this.updateFieldValues
}) : this.createField("postal-code", C.c, {
label: e("Postal Code", {
comment: "Postal code on credit card form"
}),
placeholder: " "
})))
}
}
s()(F, "propTypes", {
card: c.a.object.isRequired,
countriesList: c.a.array.isRequired,
eventFormName: c.a.string,
onFieldChange: c.a.func,
getErrorMessage: c.a.func,
autoFocus: c.a.bool,
isNewTransaction: c.a.bool
}),
s()(F, "defaultProps", {
eventFormName: "Credit card input",
onFieldChange: g.a,
getErrorMessage: g.a,
autoFocus: !1,
isNewTransaction: !1
});
t.a = Object(u.c)(F)
},
"./components/credit-card-form-fields/style.scss": function(e, t, a) {},
"./components/credit-card/index.tsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/extends.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../node_modules/classnames/index.js")
, c = a.n(o)
, l = a("./components/credit-card/stored-card.tsx");
a("./components/credit-card/style.scss");
t.a = ({card: e, selected: t, onSelect: a, className: n, children: o})=>{
const d = Object(r.useCallback)(e=>{
"Enter" !== e.key && " " !== e.key || a(e)
}
, [a])
, u = c()("credit-card", n, {
"is-selected": t,
"is-selectable": a
})
, p = a && {
tabIndex: -1,
role: "radio",
"aria-checked": t,
onClick: a,
onKeyPress: d
};
return i.a.createElement("div", s()({
className: u
}, p), e ? i.a.createElement(l.a, s()({}, e, {
selected: t
})) : o)
}
},
"./components/credit-card/stored-card.scss": function(e, t, a) {},
"./components/credit-card/stored-card.tsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/react/index.js")
, s = a.n(n)
, r = a("../packages/i18n-calypso/dist/esm/index.js")
, i = a("./components/localized-moment/index.js")
, o = a("./lib/checkout/payment-methods.ts");
a("./components/credit-card/stored-card.scss");
t.a = ({cardType: e, expiry: t, lastDigits: a, name: n, selected: c, email: l, paymentPartner: d})=>{
const u = Object(r.h)()
, p = Object(i.a)()
, m = t ? p(t, p.ISO_8601, !0) : null
, h = (null == m ? void 0 : m.isValid()) ? m.format("MM/YY") : null
, g = (null == e ? void 0 : e.toLocaleLowerCase()) || d || ""
, b = {
backgroundImage: Object(o.b)(g, c)
};
return s.a.createElement("div", {
className: "credit-card__stored-card",
style: b
}, s.a.createElement("span", {
className: "credit-card__stored-card-number"
}, Object(o.c)({
translate: u,
type: g,
digits: a,
email: l
})), s.a.createElement("span", {
className: "credit-card__stored-card-name"
}, n), s.a.createElement("span", {
className: "credit-card__stored-card-expiration-date"
}, h && u("Expires %(date)s", {
args: {
date: h
},
context: "date is of the form MM/YY"
})))
}
},
"./components/credit-card/style.scss": function(e, t, a) {},
"./components/data/query-canonical-theme/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/prop-types/index.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../node_modules/react-redux/es/index.js")
, c = a("./components/data/query-theme/index.jsx")
, l = a("./state/themes/selectors/is-wpcom-theme.js")
, d = a("./state/themes/selectors/is-wporg-theme.js");
const u = ({siteId: e, themeId: t, isWpcom: a, isWporg: n})=>i.a.createElement(r.Fragment, null, i.a.createElement(c.a, {
themeId: t,
siteId: "wpcom"
}), !a && i.a.createElement(c.a, {
themeId: t,
siteId: "wporg"
}), !a && !n && e && i.a.createElement(c.a, {
themeId: t,
siteId: e
}));
u.propTypes = {
siteId: s.a.number,
themeId: s.a.string.isRequired,
isWpcom: s.a.bool.isRequired,
isWporg: s.a.bool.isRequired
},
t.a = Object(o.c)((e,{themeId: t})=>({
isWpcom: Object(l.a)(e, t),
isWporg: Object(d.a)(e, t)
}))(u)
},
"./components/data/query-concierge-initial/index.js": function(e, t, a) {
"use strict";
var n = a("../node_modules/react/index.js")
, s = a("../node_modules/react-redux/es/index.js")
, r = a("./state/concierge/actions.js");
class i extends n.Component {
componentDidMount() {
const {siteId: e} = this.props;
this.props.requestConciergeInitial(e)
}
render() {
return null
}
}
t.a = Object(s.c)(e=>e, {
requestConciergeInitial: r.d
})(i)
},
"./components/data/query-countries/payments.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/react-redux/es/index.js")
, s = a("./components/data/query-countries/index.jsx")
, r = a("./state/countries/actions.js");
t.a = Object(n.c)(null, {
requestCountries: r.b
})(s.a)
},
"./components/data/query-plans/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/prop-types/index.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a("../node_modules/react-redux/es/index.js")
, o = a("./state/plans/selectors.js")
, c = a("./state/plans/actions.js");
class l extends r.Component {
UNSAFE_componentWillMount() {
this.props.requestingPlans || this.props.requestPlans()
}
render() {
return null
}
}
l.propTypes = {
requestingPlans: s.a.bool,
requestPlans: s.a.func
},
l.defaultProps = {
requestPlans: ()=>{}
},
t.a = Object(i.c)(e=>({
requestingPlans: Object(o.f)(e)
}), {
requestPlans: c.d
})(l)
},
"./components/data/query-plugin-keys/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/prop-types/index.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a("../node_modules/react-redux/es/index.js")
, o = a("./state/plugins/premium/actions.js")
, c = a("./state/plugins/premium/selectors.js");
class l extends r.Component {
UNSAFE_componentWillMount() {
this.props.siteId && !this.props.hasRequested && this.props.fetchInstallInstructions(this.props.siteId)
}
UNSAFE_componentWillReceiveProps(e) {
e.siteId !== this.props.siteId && this.refresh(e.hasRequested, e.siteId)
}
refresh(e, t) {
e || this.props.fetchInstallInstructions(t)
}
render() {
return null
}
}
l.propTypes = {
siteId: s.a.number.isRequired,
hasRequested: s.a.bool,
fetchInstallInstructions: s.a.func
},
l.defaultProps = {
fetchInstallInstructions: ()=>{}
},
t.a = Object(i.c)((e,t)=>{
const a = t.siteId;
return {
hasRequested: Object(c.d)(e, a)
}
}
, {
fetchInstallInstructions: o.a
})(l)
},
"./components/data/query-site-plans/index.jsx": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return l
}
));
var n = a("../node_modules/prop-types/index.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a("../node_modules/react-redux/es/index.js")
, o = a("./state/sites/plans/selectors/is-requesting-site-plans.js")
, c = a("./state/sites/plans/actions.js");
function l({siteId: e}) {
const t = Object(i.d)();
return Object(r.useEffect)(()=>{
t((e=>(t,a)=>{
e && !Object(o.a)(a(), e) && t(Object(c.b)(e))
}
)(e))
}
, [t, e]),
null
}
l.propTypes = {
siteId: s.a.number
}
},
"./components/data/query-stored-cards/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/prop-types/index.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a("../node_modules/react-redux/es/index.js")
, o = a("./state/stored-cards/selectors.js")
, c = a("./state/stored-cards/actions.js");
class l extends r.Component {
UNSAFE_componentWillMount() {
this.props.isRequesting || this.props.fetchStoredCards()
}
render() {
return null
}
}
l.propTypes = {
fetchStoredCards: s.a.func.isRequired,
isRequesting: s.a.bool.isRequired
},
t.a = Object(i.c)(e=>({
isRequesting: Object(o.f)(e)
}), {
fetchStoredCards: c.c
})(l)
},
"./components/data/query-theme/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, s = a.n(n)
, r = a("../node_modules/prop-types/index.js")
, i = a.n(r)
, o = a("../node_modules/react/index.js")
, c = a("../node_modules/react-redux/es/index.js")
, l = a("./state/themes/actions/request-theme.js");
a("./state/themes/init.js");
function d(e, t, a) {
var n, s;
return null !== (n = null === (s = e.themes.themeRequests[t]) || void 0 === s ? void 0 : s[a]) && void 0 !== n && n
}
class u extends o.Component {
componentDidMount() {
this.request(this.props)
}
UNSAFE_componentWillReceiveProps(e) {
this.props.siteId === e.siteId && this.props.themeId === e.themeId || this.request(e)
}
request(e) {
e.isRequesting || e.requestTheme(e.themeId, e.siteId)
}
render() {
return null
}
}
s()(u, "propTypes", {
siteId: i.a.oneOfType([i.a.number, i.a.oneOf(["wpcom", "wporg"])]).isRequired,
themeId: i.a.string.isRequired,
isRequesting: i.a.bool.isRequired,
requestTheme: i.a.func.isRequired
});
t.a = Object(c.c)((e,{siteId: t, themeId: a})=>({
isRequesting: d(e, t, a)
}), {
requestTheme: l.a
})(u)
},
"./components/data/query-user-purchases/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/prop-types/index.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a("../node_modules/react-redux/es/index.js")
, o = a("./state/purchases/selectors.js")
, c = a("./state/purchases/actions.js");
class l extends r.Component {
requestUserPurchases(e) {
const t = e && this.props.userId !== e.userId
, a = e || this.props;
(!a.isFetchingUserPurchases && !a.hasLoadedUserPurchasesFromServer || t) && this.props.fetchUserPurchases(a.userId)
}
UNSAFE_componentWillMount() {
this.requestUserPurchases()
}
UNSAFE_componentWillReceiveProps(e) {
this.requestUserPurchases(e)
}
render() {
return null
}
}
l.propTypes = {
userId: s.a.number.isRequired,
hasLoadedUserPurchasesFromServer: s.a.bool.isRequired,
isFetchingUserPurchases: s.a.bool.isRequired,
fetchUserPurchases: s.a.func.isRequired
},
t.a = Object(i.c)(e=>({
hasLoadedUserPurchasesFromServer: Object(o.j)(e),
isFetchingUserPurchases: Object(o.l)(e)
}), {
fetchUserPurchases: c.c
})(l)
},
"./components/email-verification/email-verification-dialog/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, s = a.n(n)
, r = a("../node_modules/prop-types/index.js")
, i = a.n(r)
, o = a("../node_modules/react/index.js")
, c = a.n(o)
, l = a("../node_modules/lodash-es/includes.js")
, d = a("../node_modules/lodash-es/noop.js")
, u = a("../node_modules/lodash-es/get.js")
, p = a("../packages/i18n-calypso/dist/esm/index.js")
, m = a("../node_modules/react-redux/es/index.js")
, h = a("../packages/components/dist/esm/button/index.js")
, g = a("../packages/components/dist/esm/dialog/index.js")
, b = a("./components/spinner/index.jsx")
, f = a("./state/current-user/selectors.js")
, _ = a("./state/current-user/email-verification/actions.js");
a("./components/email-verification/email-verification-dialog/style.scss");
class y extends o.Component {
constructor(...e) {
super(...e),
s()(this, "handleClose", ()=>{
this.props.resetVerifyEmailState(),
this.props.onClose()
}
)
}
getResendButtonLabel() {
return "sent" === this.props.emailVerificationStatus || "error" === this.props.emailVerificationStatus ? this.props.translate("Email Sent") : "requesting" === this.props.emailVerificationStatus ? c.a.createElement(b.a, {
className: "email-verification-dialog__confirmation-dialog-spinner"
}) : this.props.translate("Resend Email")
}
getDialogButtons() {
return [c.a.createElement(h.a, {
key: "resend",
primary: !1,
disabled: Object(l.a)(["requesting", "sent", "error"], this.props.emailVerificationStatus),
onClick: this.props.verifyEmail
}, this.getResendButtonLabel()), c.a.createElement(h.a, {
key: "close",
primary: !0,
onClick: this.handleClose
}, this.props.translate("OK"))]
}
render() {
const e = {
confirmHeading: this.props.translate("Please verify your email address:"),
confirmExplanation: this.props.translate("When you first signed up for a WordPress.com account we sent you an email. Please open it and click on the blue button to verify your email address."),
confirmReasoning: this.props.translate("Verifying your email allows us to assist you if you ever lose access to your account in the future."),
confirmEmail: this.props.translate("{{wrapper}}%(email)s{{/wrapper}} {{emailPreferences}}change{{/emailPreferences}}", {
components: {
wrapper: c.a.createElement("span", {
className: "email-verification-dialog__confirmation-dialog-email-wrapper"
}),
emailPreferences: c.a.createElement("a", {
href: "/me/account"
})
},
args: {
email: this.props.email
}
})
};
return c.a.createElement(g.a, {
isVisible: !0,
buttons: this.getDialogButtons(),
additionalClassNames: "email-verification-dialog__confirmation-dialog is-narrow"
}, c.a.createElement("h1", {
className: "email-verification-dialog__confirmation-dialog-heading is-variable-height"
}, e.confirmHeading), c.a.createElement("p", {
className: "email-verification-dialog__confirmation-dialog-email"
}, e.confirmEmail), c.a.createElement("p", {
className: "email-verification-dialog__confirmation-dialog-explanation"
}, e.confirmExplanation), c.a.createElement("p", {
className: "email-verification-dialog__confirmation-dialog-reasoning"
}, e.confirmReasoning))
}
}
y.propTypes = {
onClose: i.a.func,
translate: i.a.func,
email: i.a.string,
emailVerificationStatus: i.a.string
},
y.defaultProps = {
onClose: d.a
},
t.a = Object(m.c)(e=>({
email: Object(f.g)(e),
emailVerificationStatus: Object(u.a)(e, "currentUser.emailVerification.status")
}), {
verifyEmail: _.b,
resetVerifyEmailState: _.a
})(Object(p.c)(y))
},
"./components/email-verification/email-verification-dialog/style.scss": function(e, t, a) {},
"./components/forms/clipboard-button/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/extends.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../node_modules/prop-types/index.js")
, c = a.n(o)
, l = a("../node_modules/react-dom/index.js")
, d = a.n(l)
, u = a("../node_modules/clipboard/dist/clipboard.js")
, p = a.n(u)
, m = a("../node_modules/lodash-es/noop.js")
, h = a("../node_modules/classnames/index.js")
, g = a.n(h)
, b = a("../packages/components/dist/esm/button/index.js");
function f({className: e, text: t, onCopy: a=m.a, ...n}) {
const r = i.a.useRef()
, o = i.a.useRef()
, c = i.a.useRef();
return i.a.useEffect(()=>{
o.current = ()=>t,
c.current = a
}
, [t, a]),
i.a.useEffect(()=>{
const e = d.a.findDOMNode(r.current)
, t = new p.a(e,{
text: ()=>o.current()
});
return t.on("success", ()=>c.current()),
()=>t.destroy()
}
, []),
i.a.createElement(b.a, s()({}, n, {
ref: r,
className: g()("clipboard-button", e)
}))
}
f.propTypes = {
className: c.a.string,
text: c.a.string,
onCopy: c.a.func
},
t.a = f
},
"./components/forms/form-buttons-bar/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/extends.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../node_modules/classnames/index.js")
, c = a.n(o);
a("./components/forms/form-buttons-bar/style.scss");
t.a = ({className: e, children: t, ...a})=>i.a.createElement("div", s()({}, a, {
className: c()(e, "form-buttons-bar")
}), t)
},
"./components/forms/form-buttons-bar/style.scss": function(e, t, a) {},
"./components/forms/form-legend/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/extends.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../node_modules/classnames/index.js")
, c = a.n(o);
t.a = ({className: e, children: t, ...a})=>i.a.createElement("legend", s()({}, a, {
className: c()(e, "form-legend")
}), t)
},
"./components/forms/form-phone-media-input/index.jsx": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return d
}
));
var n = a("../node_modules/react/index.js")
, s = a.n(n)
, r = a("../node_modules/classnames/index.js")
, i = a.n(r)
, o = a("./components/phone-input/index.jsx")
, c = a("./components/forms/form-label/index.tsx")
, l = a("./components/forms/form-input-validation/index.jsx");
function d({additionalClasses: e, label: t, name: a, value: n, countryCode: r, className: d, disabled: u, errorMessage: p, isError: m, onChange: h, countriesList: g, enableStickyCountry: b, inputRef: f, children: _}) {
return s.a.createElement("div", {
className: i()(e, "phone")
}, s.a.createElement("div", null, s.a.createElement(c.a, {
htmlFor: a
}, t), s.a.createElement(o.a, {
inputRef: f,
name: a,
onChange: h,
value: n,
countriesList: g,
enableStickyCountry: b,
countryCode: r.toUpperCase(),
className: d,
isError: m,
disabled: u
}), _), p && s.a.createElement(l.a, {
text: p,
isError: !0
}))
}
},
"./components/forms/form-radio/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/extends.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../node_modules/classnames/index.js")
, c = a.n(o);
t.a = ({className: e, ...t})=>i.a.createElement("input", s()({}, t, {
type: "radio",
className: c()(e, "form-radio")
}))
},
"./components/forms/form-section-heading/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/extends.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../node_modules/classnames/index.js")
, c = a.n(o);
a("./components/forms/form-section-heading/style.scss");
t.a = ({className: e, children: t, ...a})=>i.a.createElement("h3", s()({}, a, {
className: c()(e, "form-section-heading")
}), t)
},
"./components/forms/form-section-heading/style.scss": function(e, t, a) {},
"./components/forms/form-select/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/extends.js")
, s = a.n(n)
, r = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, i = a.n(r)
, o = a("../node_modules/react/index.js")
, c = a.n(o)
, l = a("../node_modules/classnames/index.js")
, d = a.n(l);
a("./components/forms/form-select/style.scss");
class u extends c.a.Component {
render() {
const {inputRef: e, className: t, isError: a, ...n} = this.props
, r = d()(t, "form-select", {
"is-error": a
});
return c.a.createElement("select", s()({}, n, {
ref: e,
className: r
}), this.props.children)
}
}
i()(u, "defaultProps", {
isError: !1
}),
t.a = u
},
"./components/forms/form-select/style.scss": function(e, t, a) {},
"./components/forms/form-setting-explanation/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/extends.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../node_modules/prop-types/index.js")
, c = a.n(o)
, l = a("../node_modules/classnames/index.js")
, d = a.n(l);
a("./components/forms/form-setting-explanation/style.scss");
function u({className: e, noValidate: t, isIndented: a, ...n}) {
const r = d()("form-setting-explanation", e, {
"no-validate": t,
"is-indented": a
});
return i.a.createElement("p", s()({}, n, {
className: r
}))
}
u.propTypes = {
className: c.a.string,
noValidate: c.a.bool,
isIndented: c.a.bool
},
t.a = u
},
"./components/forms/form-setting-explanation/style.scss": function(e, t, a) {},
"./components/forms/form-toggle/compact.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/extends.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../node_modules/classnames/index.js")
, c = a.n(o)
, l = a("./components/forms/form-toggle/index.jsx");
a("./components/forms/form-toggle/compact.scss");
t.a = ({className: e, children: t, ...a})=>i.a.createElement(l.a, s()({}, a, {
className: c()(e, "is-compact")
}), t)
},
"./components/forms/form-toggle/compact.scss": function(e, t, a) {},
"./components/forms/form-toggle/index.jsx": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return p
}
));
var n = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../node_modules/prop-types/index.js")
, c = a.n(o)
, l = a("../node_modules/classnames/index.js")
, d = a.n(l)
, u = a("../node_modules/lodash-es/noop.js");
a("./components/forms/form-toggle/style.scss");
class p extends r.PureComponent {
constructor(...e) {
super(...e),
s()(this, "onKeyDown", e=>{
this.props.disabled || ("Enter" !== e.key && " " !== e.key || (e.preventDefault(),
this.props.onChange(!this.props.checked)),
this.props.onKeyDown(e))
}
),
s()(this, "onClick", e=>{
e && e.stopPropagation && e.stopPropagation(),
this.props.disabled || this.props.onChange(!this.props.checked)
}
),
s()(this, "onLabelClick", e=>{
if (this.props.disabled)
return;
const t = e.target.nodeName.toLowerCase();
"a" !== t && "input" !== t && "select" !== t && (e.preventDefault(),
this.props.onChange(!this.props.checked))
}
)
}
UNSAFE_componentWillMount() {
this.id = this.constructor.idNum++
}
render() {
const e = this.props.id || "toggle-" + this.id
, t = d()("form-toggle__wrapper", this.props.wrapperClassName, {
"is-disabled": this.props.disabled
})
, a = d()("form-toggle", this.props.className, {
"is-toggling": this.props.toggling
});
return i.a.createElement("span", {
className: t
}, i.a.createElement("input", {
id: e,
className: a,
type: "checkbox",
checked: this.props.checked,
readOnly: !0,
disabled: this.props.disabled
}), i.a.createElement("label", {
className: "form-toggle__label",
htmlFor: e
}, i.a.createElement("span", {
className: "form-toggle__switch",
onClick: this.onClick,
onKeyDown: this.onKeyDown,
role: "checkbox",
"aria-checked": this.props.checked,
"aria-label": this.props["aria-label"],
tabIndex: this.props.disabled ? -1 : 0
}), this.props.children && i.a.createElement("span", {
className: "form-toggle__label-content",
onClick: this.onLabelClick
}, this.props.children)))
}
}
s()(p, "propTypes", {
onChange: c.a.func,
onKeyDown: c.a.func,
checked: c.a.bool,
disabled: c.a.bool,
id: c.a.string,
className: c.a.string,
wrapperClassName: c.a.string,
toggling: c.a.bool,
"aria-label": c.a.string
}),
s()(p, "defaultProps", {
checked: !1,
disabled: !1,
onKeyDown: u.a,
onChange: u.a
}),
s()(p, "idNum", 0)
},
"./components/forms/form-toggle/style.scss": function(e, t, a) {},
"./components/gsuite/gsuite-features/index.jsx": function(e, t, a) {
"use strict";
var n = a("../packages/i18n-calypso/dist/esm/index.js")
, s = a("../node_modules/prop-types/index.js")
, r = a.n(s)
, i = a("../node_modules/react/index.js")
, o = a.n(i)
, c = a("./lib/gsuite/constants.js");
const l = ({compact: e, description: t, imagePath: a, imageAlt: n, title: s})=>o.a.createElement("div", {
className: e ? "gsuite-features__compact-feature" : "gsuite-features__feature"
}, o.a.createElement("div", {
className: "gsuite-features__feature-image"
}, o.a.createElement("img", {
alt: n,
src: a
})), o.a.createElement("div", {
className: "gsuite-features__feature-block"
}, o.a.createElement("h5", {
className: "gsuite-features__feature-header"
}, s), t && o.a.createElement("p", null, t)));
l.propTypes = {
compact: r.a.bool.isRequired,
description: r.a.string,
imageAlt: r.a.string.isRequired,
imagePath: r.a.string.isRequired,
title: r.a.string.isRequired
};
var d = l;
a("./components/gsuite/gsuite-features/style.scss");
const u = ({compact: e, domainName: t, productSlug: a, type: s})=>{
const r = Object(n.h)();
return o.a.createElement("div", {
className: "grid" === s ? "gsuite-features__grid" : "gsuite-features__list"
}, o.a.createElement(d, {
title: r("A custom @%(domain)s email address", {
args: {
domain: t
}
}),
description: e ? void 0 : r("Professional ad-free email that works with most email clients."),
imagePath: "/calypso/images/g-suite/logo_gmail_48dp.svg",
imageAlt: "Gmail Logo",
compact: e
}), o.a.createElement(d, {
title: r("Docs, spreadsheets and more"),
description: e ? void 0 : r("Collaborate in real-time with documents, spreadsheets and slides."),
imagePath: "/calypso/images/g-suite/logo_docs_48dp.svg",
imageAlt: "Google Docs Logo",
compact: e
}), o.a.createElement(d, {
title: e ? c.a === a ? r("30GB of cloud storage") : c.b === a ? r("Unlimited cloud storage (or 1TB per user if fewer than 5 users)") : r("30GB or unlimited cloud storage") : r("Keep all your files secure"),
description: (()=>{
if (!e)
return c.a === a ? r("Get 30GB of storage for all your files synced across devices.") : c.b === a ? r("Get unlimited storage for all your files synced across devices.") : r("Get 30GB or unlimited storage for all your files synced across devices.")
}
)(),
imagePath: "/calypso/images/g-suite/logo_drive_48dp.svg",
imageAlt: "Google Drive Logo",
compact: e
}), o.a.createElement(d, {
title: r(e ? "Video calls" : "Connect with your team"),
description: e ? void 0 : r("Use text chats or video calls, with built in screen sharing."),
imagePath: "/calypso/images/g-suite/logo_hangouts_48dp.svg",
imageAlt: "Google Hangouts Logo",
compact: e
}))
}
;
u.propTypes = {
compact: r.a.bool.isRequired,
domainName: r.a.string.isRequired,
productSlug: r.a.string,
type: r.a.oneOf(["grid", "list"]).isRequired
},
u.defaultProps = {
compact: !1,
type: "grid"
};
t.a = u
},
"./components/gsuite/gsuite-features/style.scss": function(e, t, a) {},
"./components/gsuite/gsuite-learn-more/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/lodash-es/noop.js")
, s = a("../node_modules/prop-types/index.js")
, r = a.n(s)
, i = a("../node_modules/react/index.js")
, o = a.n(i)
, c = a("../packages/i18n-calypso/dist/esm/index.js")
, l = a("./lib/url/support.js");
a("./components/gsuite/gsuite-learn-more/style.scss");
const d = ({onLearnMoreClick: e})=>{
const t = Object(c.h)();
return o.a.createElement("div", {
className: "gsuite-learn-more"
}, o.a.createElement("p", null, t("{{strong}}No setup or software required.{{/strong}} {{a}}Learn more about integrating G Suite with your site.{{/a}}", {
components: {
strong: o.a.createElement("strong", null),
a: o.a.createElement("a", {
className: "gsuite-learn-more__link",
href: l.a,
target: "_blank",
rel: "noopener noreferrer",
onClick: e
})
}
})))
}
;
d.propTypes = {
onLearnMoreClick: r.a.func
},
d.defaultProps = {
onLearnMoreClick: n.a
},
t.a = d
},
"./components/gsuite/gsuite-learn-more/style.scss": function(e, t, a) {},
"./components/happychat/button.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, s = a.n(n)
, r = a("../packages/viewport/dist/esm/index.js")
, i = a("../node_modules/prop-types/index.js")
, o = a.n(i)
, c = a("../node_modules/react/index.js")
, l = a.n(c)
, d = a("../node_modules/page/page.js")
, u = a.n(d)
, p = a("../node_modules/lodash-es/noop.js")
, m = a("../node_modules/lodash-es/identity.js")
, h = a("../node_modules/react-redux/es/index.js")
, g = a("../packages/i18n-calypso/dist/esm/index.js")
, b = a("./components/gridicon/index.tsx")
, f = a("../node_modules/classnames/index.js")
, _ = a.n(f)
, y = a("./state/happychat/utils.js")
, j = a("../node_modules/lodash-es/get.js")
, v = a("../node_modules/lodash-es/last.js")
, E = a("./lib/create-selector/index.js")
, $ = a("./state/happychat/selectors/get-happychat-timeline.js")
, C = e=>Object(j.a)(e, "happychat.ui.lostFocusAt")
, x = Object(E.a)(e=>{
const t = Object(j.a)(Object(v.a)(Object($.a)(e)), "timestamp")
, a = C(e);
return "number" == typeof t && "number" == typeof a && 1e3 * t >= a
}
, [$.a, C])
, P = a("./state/happychat/selectors/has-active-happychat-session.js")
, O = a("./state/happychat/selectors/is-happychat-available.js")
, S = a("./state/happychat/selectors/is-happychat-connection-uninitialized.js")
, w = a("./state/happychat/connection/actions.js")
, k = a("./state/happychat/ui/actions.js")
, D = a("../packages/components/dist/esm/button/index.js");
class N extends c.Component {
constructor(...e) {
super(...e),
s()(this, "onClick", e=>{
this.props.allowMobileRedirect && Object(r.e)() ? u()("/me/chat") : this.props.openChat(),
this.props.onClick(e)
}
)
}
componentDidMount() {
this.props.isConnectionUninitialized && this.props.initConnection(this.props.getAuth())
}
render() {
const {translate: e, children: t, className: a, primary: n, borderless: s, hasUnread: r, isChatAvailable: i, isChatActive: o} = this.props
, c = i || o
, d = _()("happychat__button", a, {
"has-unread": r
});
return c ? l.a.createElement(D.a, {
className: d,
primary: n,
borderless: s,
onClick: this.onClick,
title: e("Support Chat")
}, t || l.a.createElement(b.a, {
icon: "chat"
})) : null
}
}
s()(N, "propTypes", {
allowMobileRedirect: o.a.bool,
borderless: o.a.bool,
primary: o.a.bool,
getAuth: o.a.func,
initConnection: o.a.func,
isChatActive: o.a.bool,
isChatAvailable: o.a.bool,
isConnectionUninitialized: o.a.bool,
onClick: o.a.func,
openChat: o.a.func,
translate: o.a.func
}),
s()(N, "defaultProps", {
allowMobileRedirect: !1,
borderless: !0,
getAuth: p.a,
initConnection: p.a,
isChatActive: !1,
isChatAvailable: !1,
isConnectionUninitialized: !1,
onClick: p.a,
openChat: p.a,
translate: m.a
});
t.a = Object(h.c)(e=>({
hasUnread: x(e),
getAuth: Object(y.a)(e),
isChatAvailable: Object(O.a)(e),
isChatActive: Object(P.a)(e),
isConnectionUninitialized: Object(S.a)(e)
}), {
openChat: k.f,
initConnection: w.a
})(Object(g.c)(N))
},
"./components/header-cake/index.jsx": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return v
}
));
var n = a("../node_modules/prop-types/index.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../node_modules/classnames/index.js")
, c = a.n(o)
, l = a("../packages/components/dist/esm/card/index.js")
, d = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, u = a.n(d)
, p = a("../packages/viewport/dist/esm/index.js")
, m = a("../packages/i18n-calypso/dist/esm/index.js")
, h = a("./components/gridicon/index.tsx")
, g = a("../node_modules/lodash-es/throttle.js")
, b = a("../packages/components/dist/esm/button/index.js");
a("./components/header-cake/style.scss");
const f = 480
, _ = 8;
class y extends r.Component {
constructor(...e) {
super(...e),
u()(this, "state", {
windowWidth: Object(p.c)()
}),
u()(this, "handleWindowResize", ()=>{
this.setState({
windowWidth: Object(p.c)()
})
}
)
}
componentDidMount() {
this.resizeThrottled = Object(g.a)(this.handleWindowResize, 100),
window.addEventListener("resize", this.resizeThrottled)
}
componentWillUnmount() {
window.removeEventListener("resize", this.resizeThrottled)
}
hideText(e) {
return !this.props.alwaysShowActionText && (this.state.windowWidth <= f && e.length >= _ || this.state.windowWidth <= 300)
}
render() {
const {href: e, icon: t, onClick: a, spacer: n, text: s, translate: r} = this.props
, o = void 0 === s ? r("Back") : s
, l = c()({
"header-cake__back": !0,
"is-spacer": n,
"is-action": !!t
});
return i.a.createElement(b.a, {
compact: !0,
borderless: !0,
className: l,
href: e,
onClick: a,
disabled: n
}, i.a.createElement(h.a, {
icon: t || "arrow-left",
size: 18
}), !this.hideText(o) && o)
}
}
u()(y, "propTypes", {
onClick: s.a.func,
href: s.a.string,
text: s.a.string,
spacer: s.a.bool,
alwaysShowActionText: s.a.bool
}),
u()(y, "defaultProps", {
spacer: !1,
disabled: !1,
alwaysShowActionText: !1
});
var j = Object(m.c)(y);
class v extends r.Component {
render() {
const {backText: e, backHref: t, actionButton: a, actionText: n, actionIcon: s, actionHref: r, actionOnClick: o, alwaysShowActionText: d} = this.props
, u = c()("header-cake", this.props.className, {
"is-compact": this.props.isCompact
});
return i.a.createElement(l.a, {
className: u
}, i.a.createElement(j, {
text: e,
href: t,
onClick: this.props.onClick
}), i.a.createElement("div", {
className: "header-cake__title",
role: "presentation",
onClick: this.props.onTitleClick
}, this.props.children), a || i.a.createElement(j, {
text: n || e,
href: r || t,
onClick: o,
icon: s,
alwaysShowActionText: d,
spacer: !o
}))
}
}
v.displayName = "HeaderCake",
v.propTypes = {
onClick: s.a.func,
onTitleClick: s.a.func,
backText: s.a.string,
backHref: s.a.string,
actionButton: s.a.element,
actionText: s.a.string,
actionHref: s.a.string,
actionIcon: s.a.string,
actionOnClick: s.a.func,
alwaysShowActionText: s.a.bool
},
v.defaultProps = {
isCompact: !1,
alwaysShowActionText: !1
}
},
"./components/header-cake/style.scss": function(e, t, a) {},
"./components/info-popover/index.jsx": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return g
}
));
var n = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../node_modules/prop-types/index.js")
, c = a.n(o)
, l = a("../node_modules/classnames/index.js")
, d = a.n(l)
, u = a("../packages/i18n-calypso/dist/esm/index.js")
, p = a("./components/gridicon/index.tsx")
, m = a("./components/popover/index.jsx")
, h = a("./lib/analytics/ga.js");
a("./components/info-popover/style.scss");
class g extends r.Component {
constructor(...e) {
super(...e),
s()(this, "iconRef", i.a.createRef()),
s()(this, "state", {
showPopover: !1
}),
s()(this, "handleClick", e=>{
e.preventDefault(),
e.stopPropagation(),
this.setState({
showPopover: !this.state.showPopover
}, this.recordStats)
}
),
s()(this, "handleClose", ()=>this.setState({
showPopover: !1
}, this.recordStats)),
s()(this, "recordStats", ()=>{
const {gaEventCategory: e, popoverName: t} = this.props;
if (e && t) {
const a = this.state.showPopover ? " Opened" : " Closed";
Object(h.a)(e, "InfoPopover: " + t + a)
}
}
)
}
render() {
return i.a.createElement(r.Fragment, null, i.a.createElement("button", {
type: "button",
"aria-haspopup": !0,
"aria-expanded": this.state.showPopover,
"aria-label": Object(u.f)("More information"),
onClick: this.handleClick,
ref: this.iconRef,
className: d()("info-popover", this.props.className, {
"is-active": this.state.showPopover
})
}, i.a.createElement(p.a, {
icon: this.props.icon,
size: this.props.iconSize
})), this.state.showPopover && i.a.createElement(m.a, {
autoRtl: this.props.autoRtl,
id: this.props.id,
isVisible: !0,
context: this.iconRef.current,
ignoreContext: this.props.ignoreContext,
position: this.props.position,
onClose: this.handleClose,
className: d()("info-popover__tooltip", this.props.className)
}, this.props.children))
}
}
s()(g, "propTypes", {
autoRtl: c.a.bool,
className: c.a.string,
gaEventCategory: c.a.string,
icon: c.a.string,
iconSize: c.a.number,
id: c.a.string,
ignoreContext: c.a.shape({
getDOMNode: c.a.func
}),
popoverName: c.a.string,
position: c.a.oneOf(["top", "top right", "right", "bottom right", "bottom", "bottom left", "left", "top left"])
}),
s()(g, "defaultProps", {
autoRtl: !0,
icon: "info-outline",
iconSize: 18,
position: "bottom"
})
},
"./components/info-popover/style.scss": function(e, t, a) {},
"./components/localized-moment/index.js": function(e, t, a) {
"use strict";
a.d(t, "b", (function() {
return l
}
)),
a.d(t, "a", (function() {
return d
}
));
var n = a("../node_modules/@babel/runtime/helpers/extends.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../node_modules/@wordpress/compose/build-module/utils/create-higher-order-component/index.js")
, c = a("./components/localized-moment/context.js");
const l = Object(o.a)(e=>function(t) {
return i.a.createElement(c.a.Consumer, null, a=>i.a.createElement(e, s()({}, t, a)))
}
, "WithLocalizedMoment")
, d = ()=>{
const {moment: e} = i.a.useContext(c.a);
return e
}
},
"./components/marketing-survey/cancel-auto-renewal-form/style.scss": function(e, t, a) {},
"./components/marketing-survey/cancel-purchase-form/constants.js": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return n
}
));
const n = {
REMOVE: "remove",
CANCEL_WITH_REFUND: "cancel_with_refund",
CANCEL_AUTORENEW: "cancel_autorenew"
}
},
"./components/marketing-survey/cancel-purchase-form/enriched-survey-data.js": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return s
}
));
var n = a("../node_modules/lodash-es/get.js");
function s(e, t, a=new Date) {
const s = Object(n.a)(t, "subscribedDate", null)
, r = Object(n.a)(t, "blogCreatedDate", null)
, i = Object(n.a)(t, "id", null);
return {
purchase: Object(n.a)(t, "productSlug", null),
purchaseId: i,
...s && {
daysSincePurchase: (new Date(a) - new Date(s)) / 864e5
},
...r && {
daysSinceSiteCreation: (new Date(a) - new Date(r)) / 864e5
},
...e
}
}
},
"./components/marketing-survey/cancel-purchase-form/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, s = a.n(n)
, r = a("../node_modules/prop-types/index.js")
, i = a.n(r)
, o = a("../node_modules/react/index.js")
, c = a.n(o)
, l = a("../node_modules/lodash-es/shuffle.js")
, d = a("../node_modules/react-redux/es/index.js")
, u = a("../packages/i18n-calypso/dist/esm/index.js")
, p = a("../packages/format-currency/dist/esm/currencies.js")
, m = a("./config/index.js")
, h = a("./lib/purchases/actions.js")
, g = a("../packages/components/dist/esm/button/index.js")
, b = a("../packages/components/dist/esm/dialog/index.js")
, f = a("./components/forms/form-fieldset/index.jsx")
, _ = a("./components/forms/form-legend/index.jsx")
, y = a("./components/forms/form-label/index.tsx")
, j = a("./components/forms/form-textarea/index.jsx")
, v = a("./components/forms/form-section-heading/index.jsx")
, E = a("./state/analytics/actions/record.js")
, $ = a("../node_modules/lodash-es/get.js");
function C(e, t) {
return Object($.a)(e, ["sites", "items", t, "options", "import_engine"], null)
}
var x = a("./state/happychat/selectors/has-active-happychat-session.js")
, P = a("./state/happychat/selectors/is-happychat-available.js");
function O(e) {
return Object($.a)(e, "happychat.user.isPresalesPrecancellationEligible.precancellation", !1)
}
var S = a("./state/selectors/is-site-automated-transfer.js")
, w = a("./components/happychat/button.jsx");
const k = ["initial_step", "happychat_step", "final_step"];
var D = a("../node_modules/lodash-es/noop.js")
, N = a("./lib/i18n-utils/browser.js");
class T extends o.Component {
constructor(...e) {
super(...e),
s()(this, "onClickPluginSupport", ()=>{
this.props.recordTracksEvent("calypso_cancellation_business_at_plugin_support_click")
}
),
s()(this, "onClickThemeSupport", ()=>{
this.props.recordTracksEvent("calypso_cancellation_business_at_theme_support_click")
}
)
}
render() {
const {translate: e} = this.props
, t = c.a.createElement("a", {
onClick: this.onClickPluginSupport,
target: "_blank",
rel: "noopener noreferrer",
href: Object(N.l)("https://wordpress.com/support/plugins/")
})
, a = c.a.createElement("a", {
onClick: this.onClickThemeSupport,
target: "_blank",
rel: "noopener noreferrer",
href: Object(N.l)("https://wordpress.com/support/themes/adding-new-themes/")
});
return c.a.createElement("div", null, c.a.createElement(v.a, null, e("New! Install Custom Plugins and Themes")), c.a.createElement(f.a, null, c.a.createElement("p", null, e("Have a theme or plugin you need to install to build the site you want? Now you can! Learn more about {{pluginLink}}installing plugins{{/pluginLink}} and {{themeLink}}uploading themes{{/themeLink}} today.", {
components: {
pluginLink: t,
themeLink: a
}
})), c.a.createElement("p", null, e("Are you sure you want to cancel your subscription and lose access to these new features?"))))
}
}
s()(T, "propTypes", {
recordTracksEvent: i.a.func.isRequired,
translate: i.a.func.isRequired
}),
s()(T, "defaultProps", {
translate: D.a
});
const I = {
recordTracksEvent: E.e
};
var R = Object(d.c)(null, I)(Object(u.c)(T))
, A = a("./state/ui/selectors/get-selected-site.js");
class F extends o.Component {
constructor(...e) {
super(...e),
s()(this, "onClick", ()=>{
this.props.recordTracksEvent("calypso_cancellation_upgrade_at_step_upgrade_click")
}
)
}
render() {
const {translate: e, selectedSite: t} = this.props
, a = `/checkout/${t.slug}/business?coupon=BIZC25`;
return c.a.createElement("div", null, c.a.createElement(v.a, null, e("New! Install Custom Plugins and Themes")), c.a.createElement(f.a, null, c.a.createElement("p", null, e("Did you know that you can now use third-party plugins and themes on the WordPress.com Business plan? Claim a 25% discount when you upgrade your site today - {{b}}enter the code BIZC25 at checkout{{/b}}.", {
components: {
b: c.a.createElement("strong", null)
}
})), c.a.createElement(g.a, {
primary: !0,
href: a,
onClick: this.onClick
}, e("Upgrade My Site"))))
}
}
s()(F, "propTypes", {
recordTracksEvent: i.a.func.isRequired,
selectedSite: i.a.object.isRequired,
translate: i.a.func.isRequired
}),
s()(F, "defaultProps", {
translate: D.a
});
const L = {
recordTracksEvent: E.e
};
var U = Object(d.c)(e=>({
selectedSite: Object(A.a)(e)
}), L)(Object(u.c)(F))
, M = a("./components/marketing-survey/cancel-purchase-form/precancellation-chat-button/index.jsx")
, q = a("./lib/user/utils.js");
class B extends o.Component {
constructor(...e) {
super(...e),
s()(this, "onClick", ()=>{
this.props.recordTracksEvent("calypso_cancellation_downgrade_step_click")
}
)
}
render() {
const {translate: e, refundAmount: t, planCost: a, currencySymbol: n} = this.props
, s = !!parseFloat(t)
, r = n + (s ? t : a)
, i = ["en", "en-gb"].indexOf(q.a.getLocaleSlug()) >= 0
, o = e("If you choose to downgrade, your plan will be downgraded immediately.");
let l, d, u;
return i ? (d = e("Would you rather switch to a more affordable plan?"),
u = c.a.createElement("p", null, e("WordPress.com Personal still gives you access to email and chat support, removal of ads, and more — and for 50% of the cost of your current plan.")),
l = e(s ? "You can downgrade and get a partial refund of %(amount)s or continue to the next step and cancel the plan." : "You can downgrade and the new plan will renew at only %(amount)s.", {
args: {
amount: r
}
})) : (d = e("Would you rather switch to a lower-tier plan?"),
l = e(s ? "You can downgrade to Personal and get a partial refund of %(amount)s or continue to the next step and cancel the plan." : "You can downgrade to Personal and the new plan will renew at only %(amount)s.", {
args: {
amount: r
}
})),
c.a.createElement("div", null, c.a.createElement(v.a, null, d), c.a.createElement(f.a, null, u, c.a.createElement("p", null, l, " ", o)))
}
}
s()(B, "propTypes", {
recordTracksEvent: i.a.func.isRequired,
refundAmount: i.a.string,
planCost: i.a.string,
translate: i.a.func.isRequired
}),
s()(B, "defaultProps", {
translate: D.a
});
const G = {
recordTracksEvent: E.e
};
var V = Object(d.c)(e=>({
selectedSite: Object(A.a)(e)
}), G)(Object(u.c)(B))
, H = a("./lib/purchases/index.js")
, W = a("./lib/products-values/index.js")
, Y = a("./components/forms/form-radio/index.jsx")
, z = a("./components/forms/form-text-input/index.jsx");
const K = (e,t,a,n,s,r,i)=>{
const o = e + "Input"
, l = i && c.a.createElement(z.a, {
className: "cancel-purchase-form__reason-input",
name: o,
id: o,
value: a,
onChange: s,
placeholder: i
});
return c.a.createElement(y.a, {
key: e
}, c.a.createElement(Y.a, {
name: e,
value: e,
checked: e === t,
onChange: n
}), c.a.createElement("span", null, r), e === t && l)
}
;
function Q(e, t) {
const a = t.indexOf(e);
return a >= 0 && a < t.length - 1 ? t[a + 1] : t[t.length - 1]
}
function J(e, t) {
const a = t.indexOf(e);
return a > 0 ? t[a - 1] : t[0]
}
function X(e, t=!1) {
const a = e.questionOneRadio && e.questionTwoRadio;
return ("anotherReasonOne" !== e.questionOneRadio || "" !== e.questionOneText) && (("anotherReasonTwo" !== e.questionTwoRadio || "" !== e.questionTwoText) && (!(t && !e.importQuestionRadio) && (!(!e.questionOneRadio || !e.questionTwoOrder || 0 !== e.questionTwoOrder.length) || !!a)))
}
var Z = a("./lib/plans/constants.js")
, ee = a("./lib/plans/index.js")
, te = a("./lib/abtest/index.js");
const ae = Object(ee.e)({
group: Z.mc,
type: Z.Rc
})
, ne = Object(ee.e)({
group: Z.mc,
type: Z.Vc
})
, se = [].concat(Object(ee.e)({
group: Z.mc,
type: Z.Uc
})).concat(Object(ee.e)({
group: Z.mc,
type: Z.Vc
}))
, re = [].concat(Object(ee.e)({
group: Z.lc,
type: Z.Uc
})).concat(Object(ee.e)({
group: Z.lc,
type: Z.Vc
})).concat(Object(ee.e)({
group: Z.lc,
type: Z.Rc
}));
var ie = a("./components/marketing-survey/cancel-purchase-form/enriched-survey-data.js")
, oe = a("./components/marketing-survey/cancel-purchase-form/constants.js")
, ce = a("./state/purchases/selectors.js")
, le = a("./components/data/query-plans/index.jsx")
, de = a("./components/data/query-site-plans/index.jsx");
a("./components/marketing-survey/cancel-purchase-form/style.scss");
class ue extends c.a.Component {
initSurveyState() {
const [e] = this.getAllSurveySteps();
this.setState({
surveyStep: e,
questionOneRadio: null,
questionTwoRadio: null
})
}
constructor(e) {
super(e),
s()(this, "getAllSurveySteps", ()=>{
const {purchase: e, isChatAvailable: t, isChatActive: a, precancellationChatAvailable: n, downgradeClick: s} = this.props
, r = !!s;
return function(e, t, a, n, s) {
if (e && "couldNotInstall" === e.questionOneRadio) {
if (Object(W.i)(ae, t) && "show" === Object(te.a)("ATPromptOnCancel"))
return ["initial_step", "business_at_step", "final_step"];
if (Object(W.i)(se, t))
return ["initial_step", "upgrade_at_step", "final_step"]
}
return e && "onlyNeedFree" === e.questionOneRadio && Object(W.i)(ne, t) && s ? ["initial_step", "downgrade_step", "final_step"] : a && (Object(W.i)(ae, t) || Object(W.i)(se, t)) && n || a && Object(W.i)(re, t) ? k : t && Object(W.X)(t) ? ["initial_step", "final_step"] : ["final_step"]
}(this.state, e, t || a, n, r)
}
),
s()(this, "recordEvent", (e,t={})=>{
const {purchase: a, flowType: n, isAtomicSite: s} = this.props;
this.props.recordTracksEvent(e, {
cancellation_flow: n,
product_slug: a.productSlug,
is_atomic: s,
...t
})
}
),
s()(this, "recordClickRadioEvent", (e,t)=>this.props.recordTracksEvent("calypso_purchases_cancel_form_select_radio_option", {
option: e,
value: t
})),
s()(this, "onRadioOneChange", e=>{
this.recordClickRadioEvent("radio_1", e.currentTarget.value);
const t = {
...this.state,
questionOneRadio: e.currentTarget.value,
questionOneText: ""
};
this.setState(t),
this.props.onInputChange(t)
}
),
s()(this, "onTextOneChange", e=>{
const t = {
...this.state,
questionOneText: e.currentTarget.value
};
this.setState(t),
this.props.onInputChange(t)
}
),
s()(this, "onRadioTwoChange", e=>{
this.recordClickRadioEvent("radio_2", e.currentTarget.value);
const t = {
...this.state,
questionTwoRadio: e.currentTarget.value,
questionTwoText: ""
};
this.setState(t),
this.props.onInputChange(t)
}
),
s()(this, "onTextTwoChange", e=>{
const t = {
...this.state,
questionTwoText: e.currentTarget.value
};
this.setState(t),
this.props.onInputChange(t)
}
),
s()(this, "onTextThreeChange", e=>{
const t = {
...this.state,
questionThreeText: e.currentTarget.value
};
this.setState(t),
this.props.onInputChange(t)
}
),
s()(this, "onImportRadioChange", e=>{
this.recordClickRadioEvent("import_radio", e.currentTarget.value);
const t = {
...this.state,
importQuestionRadio: e.currentTarget.value,
importQuestionText: ""
};
this.setState(t),
this.props.onInputChange(t)
}
),
s()(this, "onImportTextChange", e=>{
const t = {
...this.state,
importQuestionText: e.currentTarget.value
};
this.setState(t),
this.props.onInputChange(t)
}
),
s()(this, "getSurveyDataType", ()=>{
switch (this.props.flowType) {
case oe.a.REMOVE:
return "remove";
case oe.a.CANCEL_WITH_REFUND:
return "refund";
case oe.a.CANCEL_AUTORENEW:
return "cancel-autorenew";
default:
return "general"
}
}
),
s()(this, "onSubmit", ()=>{
const {purchase: e} = this.props;
if (!Object(W.G)(e)) {
this.setState({
isSubmitting: !0
});
const t = {
"why-cancel": {
response: this.state.questionOneRadio,
text: this.state.questionOneText
},
"next-adventure": {
response: this.state.questionTwoRadio,
text: this.state.questionTwoText
},
"what-better": {
text: this.state.questionThreeText
},
"import-satisfaction": {
response: this.state.importQuestionRadio
},
type: this.getSurveyDataType()
};
Object(h.e)("calypso-remove-purchase", e.siteId, Object(ie.a)(t, e)).then(()=>{
this.setState({
isSubmitting: !1
})
}
)
}
this.props.onClickFinalConfirm(),
this.recordEvent("calypso_purchases_cancel_form_submit")
}
),
s()(this, "downgradeClick", ()=>{
this.state.isSubmitting || (this.props.downgradeClick(),
this.recordEvent("calypso_purchases_downgrade_form_submit"),
this.setState({
isSubmitting: !0
}))
}
),
s()(this, "renderQuestionOne", ()=>{
const e = {}
, {translate: t} = this.props
, {questionOneOrder: a, questionOneRadio: n, questionOneText: s} = this.state
, r = (t,a,r)=>e[t] = K(t, n, s, this.onRadioOneChange, this.onTextOneChange, a, r);
return r("couldNotInstall", t("I couldn't install a plugin/theme I wanted."), t("What plugin/theme were you trying to install?")),
r("tooHard", t("It was too hard to set up my site."), t("Where did you run into problems?")),
r("didNotInclude", t("This upgrade didn't include what I needed."), t("What are we missing that you need?")),
r("onlyNeedFree", t("The plan was too expensive."), t("How can we improve our upgrades?")),
r("couldNotActivate", t("I was unable to activate or use the product."), t("Where did you run into problems?")),
r("noLongerWantToTransfer", t("I no longer want to transfer my domain.")),
r("couldNotCompleteTransfer", t("Something went wrong and I could not complete the transfer.")),
r("useDomainWithoutTransferring", t("I’m going to use my domain with WordPress.com without transferring it.")),
r("anotherReasonOne", t("Another reason…"), " "),
c.a.createElement("div", {
className: "cancel-purchase-form__question"
}, c.a.createElement(_.a, null, t("Please tell us why you are canceling:")), a.map(t=>e[t]))
}
),
s()(this, "renderQuestionTwo", ()=>{
const e = {}
, {translate: t} = this.props
, {questionTwoOrder: a, questionTwoRadio: n, questionTwoText: s} = this.state;
if (0 === a.length)
return null;
const r = (t,a,r)=>e[t] = K(t, n, s, this.onRadioTwoChange, this.onTextTwoChange, a, r);
return r("stayingHere", t("I'm staying here and using the free plan.")),
r("otherWordPress", t("I'm going to use WordPress somewhere else."), t("Mind telling us where?")),
r("differentService", t("I'm going to use a different service for my website or blog."), t("Mind telling us which one?")),
r("noNeed", t("I no longer need a website or blog."), t("What will you do instead?")),
r("otherPlugin", t("I found a better plugin or service."), t("Mind telling us which one(s)?")),
r("leavingWP", t("I'm moving my site off of WordPress."), t("Any particular reason(s)?")),
r("anotherReasonTwo", t("Another reason…"), " "),
c.a.createElement("div", {
className: "cancel-purchase-form__question"
}, c.a.createElement(_.a, null, t("Where is your next adventure taking you?")), a.map(t=>e[t]))
}
),
s()(this, "renderImportQuestion", ()=>{
const e = []
, {translate: t} = this.props
, {importQuestionRadio: a, importQuestionText: n} = this.state
, s = (t,s,r)=>e.push(K(t, a, n, this.onImportRadioChange, this.onImportTextChange, s, r));
return s("happy", t("I was happy.")),
s("look", t("Most of my content was imported, but it was too hard to get things looking right.")),
s("content", t("Not enough of my content was imported.")),
s("functionality", t("I didn't have the functionality I have on my existing site.")),
c.a.createElement("div", {
className: "cancel-purchase-form__question"
}, c.a.createElement(_.a, null, t("You imported from another site. How did the import go?")), e)
}
),
s()(this, "renderFreeformQuestion", ()=>{
const {translate: e} = this.props;
return c.a.createElement(f.a, null, c.a.createElement(y.a, null, e("What's one thing we could have done better? (optional)"), c.a.createElement(j.a, {
name: "improvementInput",
id: "improvementInput",
value: this.state.questionThreeText,
onChange: this.onTextThreeChange
})))
}
),
s()(this, "recordClickConciergeEvent", ()=>this.props.recordTracksEvent("calypso_purchases_cancel_form_concierge_click")),
s()(this, "openConcierge", ()=>{
if (this.props.selectedSite)
return this.recordClickConciergeEvent(),
window.open(`/me/concierge/${this.props.selectedSite.slug}/book`)
}
),
s()(this, "renderConciergeOffer", ()=>{
const {selectedSite: e, translate: t} = this.props;
return e && c.a.createElement(f.a, null, c.a.createElement("p", null, t("Schedule a 30 minute orientation with one of our Happiness Engineers. We'll help you to set up your site and answer any questions you have!")), c.a.createElement(g.a, {
onClick: this.openConcierge,
primary: !0
}, t("Schedule a session")))
}
),
s()(this, "onChatInitiated", ()=>{
this.recordEvent("calypso_purchases_cancel_form_chat_initiated"),
this.closeDialog()
}
),
s()(this, "renderLiveChat", ()=>{
const {purchase: e, translate: t} = this.props
, a = Object(H.h)(e);
return c.a.createElement(f.a, null, c.a.createElement("p", null, t("As a %(productName)s user, you have instant access to our team of Happiness Engineers who can answer your questions and get your site up and running just as you like! Click the button below to start a chat now.", {
args: {
productName: a
}
})), c.a.createElement(w.a, {
primary: !0,
borderless: !1,
onClick: this.onChatInitiated
}, t("Start a Live chat")))
}
),
s()(this, "getRefundAmount", ()=>{
const {purchase: e} = this.props
, {refundOptions: t, currencyCode: a} = e
, {precision: n} = Object(p.b)(a)
, s = Object(H.D)(e) && t[0] && t[0].refund_amount ? t[0].refund_amount : 0;
return parseFloat(s).toFixed(n)
}
),
s()(this, "closeDialog", ()=>{
this.props.onClose(),
this.initSurveyState(),
this.recordEvent("calypso_purchases_cancel_form_close")
}
),
s()(this, "changeSurveyStep", e=>{
const t = this.getAllSurveySteps()
, a = e(this.state.surveyStep, t);
this.setState({
surveyStep: a
}),
this.recordEvent("calypso_purchases_cancel_survey_step", {
new_step: a
})
}
),
s()(this, "clickNext", ()=>{
const {isImport: e} = this.props;
!this.state.isRemoving && X(this.state, e) && this.changeSurveyStep(Q)
}
),
s()(this, "clickPrevious", ()=>{
this.state.isRemoving || this.changeSurveyStep(J)
}
),
s()(this, "getStepButtons", ()=>{
const {flowType: e, translate: t, disableButtons: a, purchase: n, isImport: s} = this.props
, {surveyStep: r} = this.state
, i = a || this.state.isSubmitting
, o = {
action: "close",
disabled: i,
label: t("I'll Keep It")
}
, l = c.a.createElement(M.a, {
purchase: n,
onClick: this.closeDialog,
surveyStep: r
})
, d = {
action: "next",
disabled: i || !X(this.state, s),
label: t("Next Step"),
onClick: this.clickNext
}
, u = {
action: "prev",
disabled: i,
label: t("Previous Step"),
onClick: this.clickPrevious
}
, p = {
action: "cancel",
disabled: i,
label: t("Cancel Now"),
onClick: this.onSubmit,
isPrimary: !0
}
, h = {
action: "downgrade",
disabled: this.state.isSubmitting,
label: t("Switch to Personal"),
onClick: this.downgradeClick,
isPrimary: !0
}
, g = {
action: "remove",
disabled: i,
label: t("Remove Now"),
onClick: this.onSubmit,
isPrimary: !0
}
, b = m.a.isEnabled("upgrades/precancellation-chat") && "happychat_step" !== r ? [l, o] : [o];
if ("final_step" === r) {
const t = this.getAllSurveySteps().length > 1 ? [u] : [];
switch (e) {
case oe.a.REMOVE:
return b.concat([...t, g]);
default:
return b.concat([...t, p])
}
}
return "downgrade_step" === this.state.surveyStep ? b.concat([u, h, d]) : b.concat("initial_step" === this.state.surveyStep ? [d] : [u, d])
}
);
const {purchase: t} = e
, a = Object(l.a)((n = t,
Object(W.O)(n) ? ["couldNotActivate", "didNotInclude", "onlyNeedFree"] : Object(W.x)(n) ? ["noLongerWantToTransfer", "couldNotCompleteTransfer", "useDomainWithoutTransferring"] : ["couldNotInstall", "tooHard", "didNotInclude", "onlyNeedFree"]));
var n;
const r = Object(l.a)((e=>Object(W.O)(e) ? ["stayingHere", "otherPlugin", "leavingWP", "noNeed"] : Object(W.x)(e) ? [] : ["stayingHere", "otherWordPress", "differentService", "noNeed"])(t));
a.push("anotherReasonOne"),
r.length > 0 && r.push("anotherReasonTwo"),
this.state = {
questionOneText: "",
questionOneOrder: a,
questionTwoText: "",
questionTwoOrder: r,
questionThreeText: "",
importQuestionText: "",
isSubmitting: !1
}
}
surveyContent() {
const {translate: e, isImport: t, showSurvey: a, purchase: n} = this.props
, {surveyStep: s} = this.state;
if (a) {
if ("initial_step" === s)
return c.a.createElement("div", null, c.a.createElement(v.a, null, e("Your thoughts are needed.")), c.a.createElement("p", null, e("Before you go, please answer a few quick questions to help us improve WordPress.com.")), this.renderQuestionOne(), t && this.renderImportQuestion(), this.renderQuestionTwo());
if ("concierge_step" === s)
return c.a.createElement("div", null, c.a.createElement(v.a, null, e("Let us help you set up your site!")), this.renderConciergeOffer());
if ("happychat_step" === s)
return c.a.createElement("div", null, c.a.createElement(v.a, null, e("How can we help?")), this.renderLiveChat());
if ("business_at_step" === s)
return c.a.createElement(R, null);
if ("upgrade_at_step" === s)
return c.a.createElement(U, null);
if ("downgrade_step" === s) {
const {precision: e} = Object(p.b)(n.currencyCode)
, t = parseFloat(this.props.downgradePlanPrice).toFixed(e);
return c.a.createElement(V, {
currencySymbol: n.currencySymbol,
planCost: t,
refundAmount: this.getRefundAmount()
})
}
return c.a.createElement("div", null, c.a.createElement(v.a, null, e("One more question before you go.")), this.renderFreeformQuestion(), this.props.defaultContent)
}
return c.a.createElement("div", null, this.props.defaultContent)
}
componentDidUpdate(e) {
!e.isVisible && this.props.isVisible && "initial_step" === this.state.surveyStep && this.recordEvent("calypso_purchases_cancel_form_start")
}
componentDidMount() {
this.initSurveyState()
}
render() {
const {selectedSite: e} = this.props;
return c.a.createElement(b.a, {
isVisible: this.props.isVisible,
onClose: this.closeDialog,
buttons: this.getStepButtons(),
className: "cancel-purchase-form__dialog"
}, this.surveyContent(), c.a.createElement(le.a, null), e && c.a.createElement(de.a, {
siteId: e.ID
}))
}
}
s()(ue, "propTypes", {
defaultContent: i.a.node.isRequired,
disableButtons: i.a.bool,
purchase: i.a.object.isRequired,
selectedSite: i.a.shape({
slug: i.a.string.isRequired
}),
isVisible: i.a.bool,
onInputChange: i.a.func.isRequired,
onClose: i.a.func.isRequired,
onClickFinalConfirm: i.a.func.isRequired,
flowType: i.a.string.isRequired,
showSurvey: i.a.bool.isRequired,
translate: i.a.func
}),
s()(ue, "defaultProps", {
defaultContent: "",
onInputChange: ()=>{}
,
showSurvey: !0,
isVisible: !1
});
t.a = Object(d.c)((e,{purchase: t})=>({
isChatAvailable: Object(P.a)(e),
isChatActive: Object(x.a)(e),
isAtomicSite: Object(S.a)(e, t.siteId),
isImport: !!C(e, t.siteId),
precancellationChatAvailable: O(e),
downgradePlanPrice: Object(ce.c)(e, t)
}), {
recordTracksEvent: E.e
})(Object(u.c)(ue))
},
"./components/marketing-survey/cancel-purchase-form/precancellation-chat-button/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../node_modules/prop-types/index.js")
, c = a.n(o)
, l = a("../node_modules/react-redux/es/index.js")
, d = a("../packages/i18n-calypso/dist/esm/index.js")
, u = a("./components/happychat/button.jsx")
, p = a("./state/analytics/actions/record.js")
, m = a("./lib/purchases/index.js")
, h = a("./lib/products-values/index.js");
a("./components/marketing-survey/cancel-purchase-form/precancellation-chat-button/style.scss");
class g extends r.Component {
constructor(...e) {
super(...e),
s()(this, "handleClick", ()=>{
const {purchase: e, surveyStep: t, onClick: a} = this.props;
this.props.recordTracksEvent("calypso_precancellation_chat_click", {
survey_step: t,
purchase: e.productSlug,
is_plan: Object(h.X)(e),
is_domain_registration: Object(h.w)(e),
has_included_domain: Object(m.p)(e)
}),
a()
}
)
}
render() {
const {translate: e} = this.props;
return i.a.createElement(u.a, {
className: "precancellation-chat-button__main-button",
onClick: this.handleClick
}, e("Need help? Chat with us"))
}
}
s()(g, "propTypes", {
purchase: c.a.object.isRequired,
surveyStep: c.a.string,
onClick: c.a.func.isRequired,
translate: c.a.func.isRequired
}),
s()(g, "defaultProps", {
surveyStep: ""
}),
t.a = Object(l.c)(null, {
recordTracksEvent: p.e
})(Object(d.c)(g))
},
"./components/marketing-survey/cancel-purchase-form/precancellation-chat-button/style.scss": function(e, t, a) {},
"./components/marketing-survey/cancel-purchase-form/style.scss": function(e, t, a) {},
"./components/marketing-survey/gsuite-cancel-purchase-dialog/style.scss": function(e, t, a) {},
"./components/material-icon/index.tsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/extends.js")
, s = a.n(n)
, r = a("../node_modules/classnames/index.js")
, i = a.n(r)
, o = a("../node_modules/react/index.js")
, c = a.n(o);
t.a = c.a.memo((function(e) {
const {size: t=24, style: a="outline", icon: n, onClick: r, className: o, ...l} = e
, d = "material-icon-" + n
, u = i()("material-icon", d, o)
, p = `icon-${a}-${n}-${t}px`;
return c.a.createElement("svg", s()({
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
className: u,
height: t,
width: t,
onClick: r
}, l), c.a.createElement("use", {
xlinkHref: "/calypso/images/material-icons-908614cad631f984f9e1c27fb1d0581a.svg#" + p
}))
}
))
},
"./components/multiple-choice-question/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/react/index.js")
, s = a.n(n)
, r = a("../node_modules/lodash-es/memoize.js")
, i = a("../node_modules/lodash-es/shuffle.js")
, o = a("../node_modules/lodash-es/values.js")
, c = a("../node_modules/lodash-es/pick.js")
, l = a("../node_modules/prop-types/index.js")
, d = a.n(l)
, u = a("./components/forms/form-label/index.tsx")
, p = a("./components/forms/form-radio/index.jsx")
, m = a("./components/forms/form-text-input/index.jsx");
const h = ({disabled: e, answer: {id: t, answerText: a, textInput: r, textInputPrompt: i, children: o}, isSelected: c, onAnswerChange: l, selectedAnswerText: d})=>{
const [h,g] = Object(n.useState)(d);
return s.a.createElement(u.a, null, s.a.createElement(p.a, {
value: t,
onChange: ()=>{
l(t, h)
}
,
checked: c,
disabled: e
}), s.a.createElement("span", null, a), c && s.a.createElement("div", {
className: "multiple-choice-question__answer-item-content"
}, r && s.a.createElement(m.a, {
className: "multiple-choice-question__answer-item-text-input",
value: h,
onChange: ({target: {value: e}})=>{
l(t, e),
g(e)
}
,
placeholder: i || "",
disabled: e
}), o))
}
;
h.propTypes = {
disabled: d.a.bool,
isSelected: d.a.bool,
onAnswerChange: d.a.func,
answer: d.a.shape({
id: d.a.string.isRequired,
answerText: d.a.string.isRequired,
textInput: d.a.bool,
textInputPrompt: d.a.string,
children: d.a.object
}).isRequired,
selectedAnswerText: d.a.string
},
h.defaultProps = {
disabled: !1,
selectedAnswerText: ""
};
var g = h
, b = a("./components/forms/form-fieldset/index.jsx")
, f = a("./components/forms/form-legend/index.jsx");
a("./components/multiple-choice-question/style.scss");
const _ = Object(r.a)(e=>{
const t = Object(i.a)(e.filter(({doNotShuffle: e})=>!e));
return e.map(e=>e.doNotShuffle ? e : t.pop())
}
, e=>e.map(e=>Object(o.a)(Object(c.a)(e, "id", "doNotShuffle")).join("_")).join("-"))
, y = ({disabled: e, answers: t, onAnswerChange: a, question: r, selectedAnswerId: i, selectedAnswerText: o})=>{
const [c,l] = Object(n.useState)(i)
, d = _(t);
return s.a.createElement(b.a, {
className: "multiple-choice-question"
}, s.a.createElement(f.a, null, r), d.map(t=>s.a.createElement(g, {
key: t.id,
answer: t,
disabled: e,
isSelected: c === t.id,
onAnswerChange: (e,t)=>{
a(e, t),
l(e)
}
,
selectedAnswerText: c === t.id ? o : ""
})))
}
;
y.propTypes = {
answers: d.a.arrayOf(d.a.shape({
id: d.a.string.isRequired,
answerText: d.a.string.isRequired,
doNotShuffle: d.a.bool,
textInput: d.a.bool,
textInputPrompt: d.a.string,
children: d.a.object
})).isRequired,
disabled: d.a.bool,
onAnswerChange: d.a.func.isRequired,
question: d.a.string.isRequired,
selectedAnswerId: d.a.string,
selectedAnswerText: d.a.string
},
y.defaultProps = {
disabled: !1,
selectedAnswerId: null,
selectedAnswerText: ""
};
t.a = y
},
"./components/multiple-choice-question/style.scss": function(e, t, a) {},
"./components/notice/notice-action.jsx": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return d
}
));
var n = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, s = a.n(n)
, r = a("../node_modules/prop-types/index.js")
, i = a.n(r)
, o = a("../node_modules/react/index.js")
, c = a.n(o)
, l = a("./components/gridicon/index.tsx");
a("./components/notice/style.scss");
class d extends c.a.Component {
render() {
const e = {
"aria-label": this.props["aria-label"],
className: "notice__action",
href: this.props.href,
onClick: this.props.onClick
};
return this.props.external && (e.target = "_blank",
e.rel = "noopener noreferrer"),
c.a.createElement("a", e, c.a.createElement("span", null, this.props.children), this.props.icon && c.a.createElement(l.a, {
icon: this.props.icon,
size: 24
}), this.props.external && c.a.createElement(l.a, {
icon: "external",
size: 24
}))
}
}
s()(d, "displayName", "NoticeAction"),
s()(d, "propTypes", {
"aria-label": i.a.string,
href: i.a.string,
onClick: i.a.func,
external: i.a.bool,
icon: i.a.string
}),
s()(d, "defaultProps", {
external: !1
})
},
"./components/pagination/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, s = a.n(n)
, r = a("../node_modules/prop-types/index.js")
, i = a.n(r)
, o = a("../node_modules/react/index.js")
, c = a.n(o)
, l = a("../node_modules/classnames/index.js")
, d = a.n(l)
, u = a("./components/gridicon/index.tsx")
, p = a("../packages/i18n-calypso/dist/esm/index.js")
, m = a("../packages/components/dist/esm/button/index.js");
class h extends o.Component {
constructor(...e) {
super(...e),
s()(this, "clickHandler", e=>{
e.stopPropagation();
const {currentPage: t, pageClick: a, pageNumber: n, totalPages: s} = this.props;
switch (n) {
case "previous":
if (t - 1 < 1)
return;
a(t - 1);
break;
case "next":
if (t + 1 > s)
return;
a(t + 1);
break;
default:
if (t === n)
return;
a(n)
}
}
)
}
render() {
const {translate: e, currentPage: t, nextLabel: a, numberFormat: n, pageNumber: s, prevLabel: r, totalPages: i, compact: o} = this.props;
switch (s) {
case "more":
return c.a.createElement("li", {
className: "pagination__list-item pagination__ellipsis",
"aria-hidden": "true"
}, c.a.createElement("span", null, "…"));
case "previous":
{
const a = d()("pagination__list-item pagination__arrow", "is-left", {
"is-active": t > 1
});
return c.a.createElement("li", {
className: a
}, c.a.createElement(m.a, {
className: "pagination__list-button",
borderless: !0,
onClick: this.clickHandler,
disabled: t <= 1
}, c.a.createElement(u.a, {
icon: "arrow-left",
size: 18
}), !o && (r || e("Previous"))))
}
case "next":
{
const n = d()("pagination__list-item pagination__arrow", "is-right", {
"is-active": t < i
});
return c.a.createElement("li", {
className: n
}, c.a.createElement(m.a, {
className: "pagination__list-button",
borderless: !0,
onClick: this.clickHandler,
disabled: t >= i
}, !o && (a || e("Next")), c.a.createElement(u.a, {
icon: "arrow-right",
size: 18
})))
}
default:
{
const e = d()("pagination__list-item pagination__page-number", {
"is-selected": t === s
});
return c.a.createElement("li", {
className: e
}, c.a.createElement(m.a, {
className: "pagination__list-button",
borderless: !0,
onClick: this.clickHandler
}, n(s)))
}
}
}
}
s()(h, "propTypes", {
compact: i.a.bool,
currentPage: i.a.number.isRequired,
nextLabel: i.a.string,
pageClick: i.a.func.isRequired,
pageNumber: i.a.node.isRequired,
prevLabel: i.a.string,
totalPages: i.a.number.isRequired
});
var g = Object(p.c)(h);
a("./components/pagination/style.scss");
class b extends o.Component {
constructor(...e) {
super(...e),
s()(this, "getPageList", (e,t)=>{
let a = [1, e - 2, e - 1, e, e + 1, e + 2, t];
a.sort((e,t)=>e - t),
a = a.filter((e,a,n)=>e >= 1 && e <= t && n.lastIndexOf(e) === a);
for (let e = a.length - 2; e >= 0; e--)
2 == a[e + 1] - a[e] ? a.splice(e + 1, 0, a[e + 1] - 1) : a[e + 1] - a[e] > 1 && a.splice(e + 1, 0, "more");
return a.unshift("previous"),
a.push("next"),
a
}
)
}
render() {
const {className: e, compact: t, nextLabel: a, page: n, pageClick: s, perPage: r, prevLabel: i, total: o} = this.props
, l = Math.ceil(o / r);
if (l <= 1)
return null;
const u = this.getPageList(n, l).map((e,r)=>c.a.createElement(g, {
key: r,
compact: t,
currentPage: n,
nextLabel: a,
pageClick: s,
pageNumber: e,
prevLabel: i,
totalPages: l
}));
return c.a.createElement("div", {
className: d()("pagination", e, {
"is-compact": t
})
}, c.a.createElement("ul", {
className: "pagination__list"
}, u))
}
}
s()(b, "propTypes", {
compact: i.a.bool,
nextLabel: i.a.string,
page: i.a.number.isRequired,
pageClick: i.a.func.isRequired,
perPage: i.a.number.isRequired,
prevLabel: i.a.string,
total: i.a.number
});
t.a = b
},
"./components/pagination/style.scss": function(e, t, a) {},
"./components/payment-country-select/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/extends.js")
, s = a.n(n)
, r = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, i = a.n(r)
, o = a("../node_modules/react/index.js")
, c = a.n(o)
, l = a("../node_modules/prop-types/index.js")
, d = a.n(l)
, u = a("../node_modules/react-redux/es/index.js")
, p = a("../node_modules/lodash-es/some.js")
, m = a("../node_modules/lodash-es/isFunction.js")
, h = a("../node_modules/lodash-es/omit.js")
, g = a("../node_modules/lodash-es/noop.js")
, b = a("./my-sites/domains/components/form/country-select.jsx")
, f = a("../node_modules/lodash-es/get.js")
, _ = a("./state/redux-store.ts")
, y = a("../node_modules/lodash-es/has.js")
, j = a("./state/utils/schema-utils.js")
, v = a("./state/utils/reducer-utils.js")
, E = a("./state/utils/with-storage-key.js");
var $ = a("./state/payment/util.js")
, C = a("./lib/redux-bridge/index.js");
Object(C.d)("TRANSACTION_NEW_CREDIT_CARD_DETAILS_SET"),
Object(C.d)("TRANSACTION_PAYMENT_SET");
const x = Object(j.a)({
type: ["string", "null"]
}, (e=null,t)=>{
switch (t.type) {
case "PAYMENT_COUNTRY_CODE_SET":
return t.countryCode;
case "FLUX_TRANSACTION_NEW_CREDIT_CARD_DETAILS_SET":
return Object(y.a)(t, "rawDetails.country") ? Object(f.a)(t, "rawDetails.country", null) : e;
case "FLUX_TRANSACTION_PAYMENT_SET":
{
const {payment: a} = t;
return Object(y.a)(a, "newCardDetails") ? Object(f.a)(a, "newCardDetails.country", null) : Object(y.a)(a, "storedCard") ? Object($.a)(t, "country_code") || null : e
}
}
return e
}
)
, P = Object(j.a)({
type: ["string", "null"]
}, (e=null,t)=>{
switch (t.type) {
case "PAYMENT_POSTAL_CODE_SET":
return t.postalCode;
case "FLUX_TRANSACTION_NEW_CREDIT_CARD_DETAILS_SET":
return Object(y.a)(t, "rawDetails.postal-code") ? Object(f.a)(t, "rawDetails.postal-code", null) : e;
case "FLUX_TRANSACTION_PAYMENT_SET":
{
const {payment: a} = t;
return Object(y.a)(a, "newCardDetails") ? Object(f.a)(a, "newCardDetails.postal-code", null) : Object(y.a)(a, "storedCard") ? Object($.a)(t, "card_zip") || null : e
}
}
return e
}
)
, O = Object(v.a)({
countryCode: x,
postalCode: P
});
var S = Object(E.a)("payment", O);
function w(e) {
return Object(f.a)(e, ["payment", "countryCode"], null)
}
Object(_.a)(["payment"], S);
var k = a("./lib/cart/actions.js");
class D extends o.Component {
constructor(...e) {
super(...e),
i()(this, "getValidCountryCode", (e,t)=>Object(p.a)(t, ["code", e]) ? e : ""),
i()(this, "handleFieldChange", e=>{
this.props.updateGlobalCountryCode(e.target.value),
this.props.updateCartStore(e.target.value),
this.props.onCountrySelected(e.target.name, e.target.value),
Object(m.a)(this.props.onChange) && this.props.onChange(e)
}
)
}
componentDidMount() {
if (this.props.countriesList.length) {
const e = this.getValidCountryCode(this.props.countryCode, this.props.countriesList);
this.props.onCountrySelected(this.props.name, e)
}
}
componentDidUpdate(e) {
if (!e.countriesList.length && this.props.countriesList.length) {
const e = this.getValidCountryCode(this.props.countryCode, this.props.countriesList);
this.props.onCountrySelected(this.props.name, e)
}
}
render() {
return c.a.createElement(b.a, s()({}, Object(h.a)(this.props, ["countryCode", "updateGlobalCountryCode", "updateCartStore", "onCountrySelected", "value", "onChange"]), {
value: this.props.countryCode,
onChange: this.handleFieldChange
}))
}
}
i()(D, "propTypes", {
name: d.a.string.isRequired,
countriesList: d.a.array.isRequired,
onCountrySelected: d.a.func,
countryCode: d.a.string,
updateGlobalCountryCode: d.a.func
}),
i()(D, "defaultProps", {
onCountrySelected: g.a,
countryCode: "",
updateGlobalCountryCode: g.a,
updateCartStore: k.l
});
t.a = Object(u.c)(e=>({
countryCode: w(e)
}), e=>({
updateGlobalCountryCode: t=>{
e({
type: "PAYMENT_COUNTRY_CODE_SET",
countryCode: t
})
}
}))(D)
},
"./components/payment-logo/index.jsx": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return E
}
));
var n = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, s = a.n(n)
, r = a("../node_modules/classnames/index.js")
, i = a.n(r)
, o = a("../node_modules/prop-types/index.js")
, c = a.n(o)
, l = a("../node_modules/react/index.js")
, d = a.n(l)
, u = a("../node_modules/lodash-es/keys.js")
, p = a("../packages/i18n-calypso/dist/esm/index.js")
, m = (a("./components/payment-logo/style.scss"),
a("./assets/images/upgrades/cc-amex.svg"))
, h = a("./assets/images/upgrades/cc-diners.svg")
, g = a("./assets/images/upgrades/cc-discover.svg")
, b = a("./assets/images/upgrades/cc-jcb.svg")
, f = a("./assets/images/upgrades/cc-mastercard.svg")
, _ = a("./assets/images/upgrades/cc-unionpay.svg")
, y = a("./assets/images/upgrades/cc-visa.svg");
const j = {
amex: m.a,
diners: h.a,
discover: g.a,
jcb: b.a,
mastercard: f.a,
unionpay: _.a,
visa: y.a
}
, v = {
alipay: "Alipay",
amex: "American Express",
"apple-pay": "Apple Pay",
bancontact: "Bancontact",
"brazil-tef": "Transferência bancária",
diners: "Diners Club",
discover: "Discover",
eps: "eps",
giropay: "Giropay",
id_wallet: "OVO",
ideal: "iDEAL",
jcb: "JCB",
mastercard: "Mastercard",
netbanking: "Net Banking",
p24: "Przelewy24",
paypal: "PayPal",
placeholder: "",
unionpay: "UnionPay",
visa: "Visa",
wechat: p.a.translate("WeChat Pay", {
comment: "Name for WeChat Pay - https://pay.weixin.qq.com/"
}),
sofort: "Sofort"
}
, E = Object(u.a)(v);
class $extends d.a.Component {
render() {
const {altText: e, className: t, isCompact: a, type: n} = this.props
, s = i()("payment-logo", "is-" + n, {
"is-compact": a
}, t)
, r = j[n]
, o = r ? {
backgroundImage: `url(${r})`
} : void 0;
return d.a.createElement("div", {
className: s,
style: o,
"aria-label": e || v[n] || ""
})
}
}
s()($, "propTypes", {
className: c.a.string,
type: c.a.oneOf(E),
altText: c.a.string,
isCompact: c.a.bool
}),
t.b = $
},
"./components/payment-logo/style.scss": function(e, t, a) {},
"./components/phone-input/data.js": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return n
}
)),
a.d(t, "b", (function() {
return s
}
));
const n = {
KV: {
isoCode: "KV",
dialCode: "383",
nationalPrefix: "0"
},
UM: {
isoCode: "UM",
dialCode: "1",
nationalPrefix: "",
patternRegion: "US",
priority: -99
},
BV: {
isoCode: "BV",
dialCode: "47",
nationalPrefix: "",
priority: -99
},
TF: {
isoCode: "TF",
dialCode: "262",
nationalPrefix: "0"
},
HM: {
isoCode: "HM",
dialCode: "61",
nationalPrefix: "0",
priority: -99
},
PN: {
isoCode: "PN",
dialCode: "64",
nationalPrefix: "0",
priority: -99
},
GS: {
isoCode: "GS",
nationalPrefix: "",
dialCode: "500",
priority: -99
},
AC: {
isoCode: "AC",
dialCode: "247"
},
AD: {
isoCode: "AD",
dialCode: "376",
patterns: [{
match: "(\\d{3})(\\d{3})",
replace: "$1 $2",
leadingDigitPattern: "[137-9]|6[0-8]"
}, {
match: "(\\d{4})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "180[02]"
}, {
match: "(\\d{3})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "690"
}]
},
AE: {
isoCode: "AE",
dialCode: "971",
nationalPrefix: "0",
patterns: [{
match: "([2-4679])(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[2-4679][2-8]"
}, {
match: "(5\\d)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "5"
}, {
match: "([479]00)(\\d)(\\d{5})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "[479]0"
}, {
match: "([68]00)(\\d{2,9})",
replace: "$1 $2",
nationalFormat: "$1",
leadingDigitPattern: "60|8"
}]
},
AF: {
isoCode: "AF",
dialCode: "93",
nationalPrefix: "0",
patterns: [{
match: "([2-7]\\d)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[2-7]"
}]
},
AG: {
isoCode: "AG",
dialCode: "1268",
countryDialCode: "1",
regionCode: "268",
nationalPrefix: "1"
},
AI: {
isoCode: "AI",
dialCode: "1264",
countryDialCode: "1",
regionCode: "264",
nationalPrefix: "1"
},
AL: {
isoCode: "AL",
dialCode: "355",
nationalPrefix: "0",
patterns: [{
match: "(4)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "4[0-6]"
}, {
match: "(6\\d)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "6"
}, {
match: "(\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[2358][2-5]|4[7-9]"
}, {
match: "(\\d{3})(\\d{3,5})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "[235][16-9]|[79]|8[016-9]"
}]
},
AM: {
isoCode: "AM",
dialCode: "374",
nationalPrefix: "0",
patterns: [{
match: "(\\d{2})(\\d{6})",
replace: "$1 $2",
nationalFormat: "(0$1)",
leadingDigitPattern: "1|47"
}, {
match: "(\\d{2})(\\d{6})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "4[1349]|[5-7]|88|9[1-9]"
}, {
match: "(\\d{3})(\\d{5})",
replace: "$1 $2",
nationalFormat: "(0$1)",
leadingDigitPattern: "[23]"
}, {
match: "(\\d{3})(\\d{2})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0 $1",
leadingDigitPattern: "8|90"
}]
},
AO: {
isoCode: "AO",
dialCode: "244",
patterns: [{
match: "(\\d{3})(\\d{3})(\\d{3})",
replace: "$1 $2 $3"
}]
},
AR: {
isoCode: "AR",
dialCode: "54",
nationalPrefix: "0",
patterns: [{
match: "([68]\\d{2})(\\d{3})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "[68]"
}, {
match: "(\\d{2})(\\d{4})",
replace: "$1-$2",
nationalFormat: "$1",
leadingDigitPattern: "[2-9]"
}, {
match: "(\\d{3})(\\d{4})",
replace: "$1-$2",
nationalFormat: "$1",
leadingDigitPattern: "[2-9]"
}, {
match: "(\\d{4})(\\d{4})",
replace: "$1-$2",
nationalFormat: "$1",
leadingDigitPattern: "[2-9]"
}, {
match: "(9)(11)(\\d{4})(\\d{4})",
replace: "$2 15-$3-$4",
nationalFormat: "0$1",
leadingDigitPattern: "911"
}, {
match: "(9)(\\d{3})(\\d{3})(\\d{4})",
replace: "$2 15-$3-$4",
nationalFormat: "0$1",
leadingDigitPattern: "9(?:2(?:2(?:0[013-9]|[13])|3(?:0[013-9]|[67])|49|6(?:[0136]|4[0-59])|8|9(?:[19]|44|7[013-9]|8[14]))|3(?:36|4(?:[12]|3(?:4|5[014]|6[1-39])|[58]4)|5(?:1|3[0-24-689]|8[46])|6|7[069]|8(?:[01]|34|[578][45])))"
}, {
match: "(9)(\\d{4})(\\d{2})(\\d{4})",
replace: "$2 15-$3-$4",
nationalFormat: "0$1",
leadingDigitPattern: "9[23]"
}, {
match: "(11)(\\d{4})(\\d{4})",
replace: "$1 $2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "1"
}, {
match: "(\\d{3})(\\d{3})(\\d{4})",
replace: "$1 $2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "2(?:2(?:0[013-9]|[13])|3(?:0[013-9]|[67])|49|6(?:[0136]|4[0-59])|8|9(?:[19]|44|7[013-9]|8[14]))|3(?:36|4(?:[12]|3(?:4|5[014]|6[1-39])|[58]4)|5(?:1|3[0-24-689]|8[46])|6|7[069]|8(?:[01]|34|[578][45]))"
}, {
match: "(\\d{4})(\\d{2})(\\d{4})",
replace: "$1 $2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "[23]"
}, {
match: "(\\d{3})",
replace: "$1",
nationalFormat: "$1",
leadingDigitPattern: "1[0-2]|911"
}],
internationalPatterns: [{
match: "([68]\\d{2})(\\d{3})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "[68]"
}, {
match: "(9)(11)(\\d{4})(\\d{4})",
replace: "$1 $2 $3-$4",
leadingDigitPattern: "911"
}, {
match: "(9)(\\d{3})(\\d{3})(\\d{4})",
replace: "$1 $2 $3-$4",
leadingDigitPattern: "9(?:2(?:2(?:0[013-9]|[13])|3(?:0[013-9]|[67])|49|6(?:[0136]|4[0-59])|8|9(?:[19]|44|7[013-9]|8[14]))|3(?:36|4(?:[12]|3(?:4|5[014]|6[1-39])|[58]4)|5(?:1|3[0-24-689]|8[46])|6|7[069]|8(?:[01]|34|[578][45])))"
}, {
match: "(9)(\\d{4})(\\d{2})(\\d{4})",
replace: "$1 $2 $3-$4",
leadingDigitPattern: "9[23]"
}, {
match: "(11)(\\d{4})(\\d{4})",
replace: "$1 $2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "1"
}, {
match: "(\\d{3})(\\d{3})(\\d{4})",
replace: "$1 $2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "2(?:2(?:0[013-9]|[13])|3(?:0[013-9]|[67])|49|6(?:[0136]|4[0-59])|8|9(?:[19]|44|7[013-9]|8[14]))|3(?:36|4(?:[12]|3(?:4|5[014]|6[1-39])|[58]4)|5(?:1|3[0-24-689]|8[46])|6|7[069]|8(?:[01]|34|[578][45]))"
}, {
match: "(\\d{4})(\\d{2})(\\d{4})",
replace: "$1 $2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "[23]"
}]
},
AS: {
isoCode: "AS",
dialCode: "1684",
countryDialCode: "1",
regionCode: "684",
nationalPrefix: "1"
},
AT: {
isoCode: "AT",
dialCode: "43",
nationalPrefix: "0",
patterns: [{
match: "(116\\d{3})",
replace: "$1",
nationalFormat: "$1",
leadingDigitPattern: "116"
}, {
match: "(1)(\\d{3,12})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "1"
}, {
match: "(5\\d)(\\d{3,5})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "5[079]"
}, {
match: "(5\\d)(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "5[079]"
}, {
match: "(5\\d)(\\d{4})(\\d{4,7})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "5[079]"
}, {
match: "(\\d{3})(\\d{3,10})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "(?:31|4)6|51|6(?:5[0-3579]|[6-9])|7(?:[28]0|32)|[89]"
}, {
match: "(\\d{4})(\\d{3,9})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "2|3(?:1[1-578]|[3-8])|4[2378]|5[2-6]|6(?:[12]|4[1-9]|5[468])|7(?:[24][1-8]|35|[5-79])"
}]
},
AU: {
isoCode: "AU",
dialCode: "61",
nationalPrefix: "0",
patterns: [{
match: "([2378])(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "(0$1)",
leadingDigitPattern: "[2378]"
}, {
match: "(\\d{3})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "14|[45]"
}, {
match: "(16)(\\d{3,4})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "16"
}, {
match: "(16)(\\d{3})(\\d{2,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "16"
}, {
match: "(1[389]\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "1(?:[38]0|9)0"
}, {
match: "(180)(2\\d{3})",
replace: "$1 $2",
nationalFormat: "$1",
leadingDigitPattern: "1802"
}, {
match: "(19\\d)(\\d{3})",
replace: "$1 $2",
nationalFormat: "$1",
leadingDigitPattern: "19[13]"
}, {
match: "(19\\d{2})(\\d{4})",
replace: "$1 $2",
nationalFormat: "$1",
leadingDigitPattern: "19[679]"
}, {
match: "(13)(\\d{2})(\\d{2})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "13[1-9]"
}],
priority: 10
},
AW: {
isoCode: "AW",
dialCode: "297",
patterns: [{
match: "(\\d{3})(\\d{4})",
replace: "$1 $2"
}]
},
AX: {
isoCode: "AX",
dialCode: "358",
nationalPrefix: "0",
priority: 1,
patternRegion: "FI"
},
AZ: {
isoCode: "AZ",
dialCode: "994",
nationalPrefix: "0",
patterns: [{
match: "(\\d{2})(\\d{3})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "(0$1)",
leadingDigitPattern: "1[28]|2(?:[0-36]|[45]2)|365"
}, {
match: "(\\d{2})(\\d{3})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "[4-8]"
}, {
match: "(\\d{3})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "9"
}]
},
BA: {
isoCode: "BA",
dialCode: "387",
nationalPrefix: "0",
patterns: [{
match: "(\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "[3-5]"
}, {
match: "(\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "6[1-356]|[7-9]"
}, {
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{3})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "6[047]"
}]
},
BB: {
isoCode: "BB",
dialCode: "1246",
countryDialCode: "1",
regionCode: "246",
nationalPrefix: "1"
},
BD: {
isoCode: "BD",
dialCode: "880",
nationalPrefix: "0",
patterns: [{
match: "(2)(\\d{7,8})",
replace: "$1-$2",
nationalFormat: "0$1",
leadingDigitPattern: "2"
}, {
match: "(\\d{2})(\\d{4,6})",
replace: "$1-$2",
nationalFormat: "0$1",
leadingDigitPattern: "[3-79]1"
}, {
match: "(\\d{4})(\\d{3,6})",
replace: "$1-$2",
nationalFormat: "0$1",
leadingDigitPattern: "1|3(?:0|[2-58]2)|4(?:0|[25]2|3[23]|[4689][25])|5(?:[02-578]2|6[25])|6(?:[0347-9]2|[26][25])|7[02-9]2|8(?:[023][23]|[4-7]2)|9(?:[02][23]|[458]2|6[016])"
}, {
match: "(\\d{3})(\\d{3,7})",
replace: "$1-$2",
nationalFormat: "0$1",
leadingDigitPattern: "[3-79][2-9]|8"
}]
},
BE: {
isoCode: "BE",
dialCode: "32",
nationalPrefix: "0",
patterns: [{
match: "(\\d{3})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "4[6-9]"
}, {
match: "(\\d)(\\d{3})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "[23]|4[23]|9[2-4]"
}, {
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "[156]|7[018]|8(?:0[1-9]|[1-79])"
}, {
match: "(\\d{3})(\\d{2})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "(?:80|9)0"
}]
},
BF: {
isoCode: "BF",
dialCode: "226",
patterns: [{
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4"
}]
},
BG: {
isoCode: "BG",
dialCode: "359",
nationalPrefix: "0",
patterns: [{
match: "(2)(\\d)(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "2"
}, {
match: "(2)(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "2"
}, {
match: "(\\d{3})(\\d{4})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "43[124-7]|70[1-9]"
}, {
match: "(\\d{3})(\\d{3})(\\d{2})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "43[124-7]|70[1-9]"
}, {
match: "(\\d{3})(\\d{2})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[78]00"
}, {
match: "(\\d{3})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "99[69]"
}, {
match: "(\\d{2})(\\d{3})(\\d{2,3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"
}, {
match: "(\\d{2})(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "48|8[7-9]|9[08]"
}]
},
BH: {
isoCode: "BH",
dialCode: "973",
patterns: [{
match: "(\\d{4})(\\d{4})",
replace: "$1 $2"
}]
},
BI: {
isoCode: "BI",
dialCode: "257",
patterns: [{
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4"
}]
},
BJ: {
isoCode: "BJ",
dialCode: "229",
patterns: [{
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "[2689]"
}]
},
BL: {
isoCode: "BL",
dialCode: "590",
nationalPrefix: "0",
priority: 1,
patternRegion: "GP"
},
BM: {
isoCode: "BM",
dialCode: "1441",
countryDialCode: "1",
regionCode: "441",
nationalPrefix: "1"
},
BN: {
isoCode: "BN",
dialCode: "673",
patterns: [{
match: "([2-578]\\d{2})(\\d{4})",
replace: "$1 $2"
}]
},
BO: {
isoCode: "BO",
dialCode: "591",
nationalPrefix: "0",
patterns: [{
match: "([234])(\\d{7})",
replace: "$1 $2",
leadingDigitPattern: "[2-4]"
}, {
match: "([67]\\d{7})",
replace: "$1",
leadingDigitPattern: "[67]"
}, {
match: "(800)(\\d{2})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "800"
}]
},
BQ: {
isoCode: "BQ",
dialCode: "599",
priority: 1,
patternRegion: "CW"
},
BR: {
isoCode: "BR",
dialCode: "55",
nationalPrefix: "0",
patterns: [{
match: "(\\d{4})(\\d{4})",
replace: "$1-$2",
leadingDigitPattern: "300|40(?:0|20)"
}, {
match: "([3589]00)(\\d{2,3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[3589]00"
}, {
match: "(\\d{3,5})",
replace: "$1",
nationalFormat: "$1",
leadingDigitPattern: "1[125689]"
}, {
match: "(\\d{4})(\\d{4})",
replace: "$1-$2",
nationalFormat: "$1",
leadingDigitPattern: "[2-9](?:0[1-9]|[1-9])"
}, {
match: "(\\d{5})(\\d{4})",
replace: "$1-$2",
nationalFormat: "$1",
leadingDigitPattern: "9(?:0[1-9]|[1-9])"
}, {
match: "(\\d{2})(\\d{4})(\\d{4})",
replace: "$1 $2-$3",
nationalFormat: "($1)",
leadingDigitPattern: "[1-9][1-9]"
}, {
match: "(\\d{2})(\\d{5})(\\d{4})",
replace: "$1 $2-$3",
nationalFormat: "($1)",
leadingDigitPattern: "[1-9][1-9]9"
}],
internationalPatterns: [{
match: "(\\d{4})(\\d{4})",
replace: "$1-$2",
leadingDigitPattern: "300|40(?:0|20)"
}, {
match: "([3589]00)(\\d{2,3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[3589]00"
}, {
match: "(\\d{2})(\\d{4})(\\d{4})",
replace: "$1 $2-$3",
nationalFormat: "($1)",
leadingDigitPattern: "[1-9][1-9]"
}, {
match: "(\\d{2})(\\d{5})(\\d{4})",
replace: "$1 $2-$3",
nationalFormat: "($1)",
leadingDigitPattern: "[1-9][1-9]9"
}]
},
BS: {
isoCode: "BS",
dialCode: "1242",
countryDialCode: "1",
regionCode: "242",
nationalPrefix: "1"
},
BT: {
isoCode: "BT",
dialCode: "975",
patterns: [{
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "1|77"
}, {
match: "([2-8])(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "[2-68]|7[246]"
}]
},
BW: {
isoCode: "BW",
dialCode: "267",
patterns: [{
match: "(\\d{3})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "[2-6]"
}, {
match: "(7\\d)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "7"
}, {
match: "(90)(\\d{5})",
replace: "$1 $2",
leadingDigitPattern: "9"
}]
},
BY: {
isoCode: "BY",
dialCode: "375",
nationalPrefix: "8",
patterns: [{
match: "(\\d{2})(\\d{3})(\\d{2})(\\d{2})",
replace: "$1 $2-$3-$4",
nationalFormat: "8 0$1",
leadingDigitPattern: "17(?:[02358]|1[0-2]|9[0189])|2[4-9]|[34]"
}, {
match: "(\\d{3})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2-$3-$4",
nationalFormat: "8 0$1",
leadingDigitPattern: "1(?:5[24]|6(?:2|3[04-9]|5[0346-9])|7(?:[46]|7[37-9]))|2(?:1[246]|2[25]|3[26])"
}, {
match: "(\\d{4})(\\d{2})(\\d{3})",
replace: "$1 $2-$3",
nationalFormat: "8 0$1",
leadingDigitPattern: "1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"
}, {
match: "([89]\\d{2})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "8 $1",
leadingDigitPattern: "8[01]|9"
}, {
match: "(82\\d)(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "8 $1",
leadingDigitPattern: "82"
}, {
match: "(800)(\\d{3})",
replace: "$1 $2",
nationalFormat: "8 $1",
leadingDigitPattern: "800"
}, {
match: "(800)(\\d{2})(\\d{2,4})",
replace: "$1 $2 $3",
nationalFormat: "8 $1",
leadingDigitPattern: "800"
}]
},
BZ: {
isoCode: "BZ",
dialCode: "501",
patterns: [{
match: "(\\d{3})(\\d{4})",
replace: "$1-$2",
leadingDigitPattern: "[2-8]"
}, {
match: "(0)(800)(\\d{4})(\\d{3})",
replace: "$1-$2-$3-$4",
leadingDigitPattern: "0"
}]
},
CA: {
isoCode: "CA",
dialCode: "1",
areaCodes: ["204", "236", "249", "250", "289", "306", "343", "365", "387", "403", "416", "418", "431", "437", "438", "450", "506", "514", "519", "548", "579", "581", "587", "604", "613", "639", "647", "672", "705", "709", "742", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905"],
nationalPrefix: "1",
priority: 5,
patternRegion: "US"
},
CC: {
isoCode: "CC",
dialCode: "61",
nationalPrefix: "0",
priority: 1,
patternRegion: "AU"
},
CD: {
isoCode: "CD",
dialCode: "243",
nationalPrefix: "0",
patterns: [{
match: "(\\d{2})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "12"
}, {
match: "([89]\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "8[0-2459]|9"
}, {
match: "(\\d{2})(\\d{2})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "88"
}, {
match: "(\\d{2})(\\d{5})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "[1-6]"
}]
},
CF: {
isoCode: "CF",
dialCode: "236",
patterns: [{
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4"
}]
},
CG: {
isoCode: "CG",
dialCode: "242",
patterns: [{
match: "(\\d{3})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "801"
}, {
match: "(\\d{2})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "[02]"
}, {
match: "(\\d)(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "800"
}]
},
CH: {
isoCode: "CH",
dialCode: "41",
nationalPrefix: "0",
patterns: [{
match: "([2-9]\\d)(\\d{3})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "[2-7]|[89]1"
}, {
match: "([89]\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "8[047]|90"
}, {
match: "(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4 $5",
nationalFormat: "0$1",
leadingDigitPattern: "860"
}]
},
CI: {
isoCode: "CI",
dialCode: "225",
patterns: [{
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4"
}]
},
CK: {
isoCode: "CK",
dialCode: "682",
patterns: [{
match: "(\\d{2})(\\d{3})",
replace: "$1 $2"
}]
},
CL: {
isoCode: "CL",
dialCode: "56",
nationalPrefix: "0",
patterns: [{
match: "(\\d)(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "($1)",
leadingDigitPattern: "2[23]"
}, {
match: "(\\d{2})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "($1)",
leadingDigitPattern: "[357]|4[1-35]|6[13-57]"
}, {
match: "(9)(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "9"
}, {
match: "(44)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "44"
}, {
match: "([68]00)(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "60|8"
}, {
match: "(600)(\\d{3})(\\d{2})(\\d{3})",
replace: "$1 $2 $3 $4",
nationalFormat: "$1",
leadingDigitPattern: "60"
}, {
match: "(1230)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "1"
}, {
match: "(\\d{5})(\\d{4})",
replace: "$1 $2",
nationalFormat: "($1)",
leadingDigitPattern: "219"
}, {
match: "(\\d{4,5})",
replace: "$1",
nationalFormat: "$1",
leadingDigitPattern: "[1-9]"
}],
internationalPatterns: [{
match: "(\\d)(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "($1)",
leadingDigitPattern: "2[23]"
}, {
match: "(\\d{2})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "($1)",
leadingDigitPattern: "[357]|4[1-35]|6[13-57]"
}, {
match: "(9)(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "9"
}, {
match: "(44)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "44"
}, {
match: "([68]00)(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "60|8"
}, {
match: "(600)(\\d{3})(\\d{2})(\\d{3})",
replace: "$1 $2 $3 $4",
nationalFormat: "$1",
leadingDigitPattern: "60"
}, {
match: "(1230)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "1"
}, {
match: "(\\d{5})(\\d{4})",
replace: "$1 $2",
nationalFormat: "($1)",
leadingDigitPattern: "219"
}]
},
CM: {
isoCode: "CM",
dialCode: "237",
patterns: [{
match: "([26])(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4 $5",
leadingDigitPattern: "[26]"
}, {
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "[23]|88"
}]
},
CN: {
isoCode: "CN",
dialCode: "86",
nationalPrefix: "0",
patterns: [{
match: "(80\\d{2})(\\d{4})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "80[26-8]"
}, {
match: "([48]00)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "[48]00"
}, {
match: "(\\d{5,6})",
replace: "$1",
leadingDigitPattern: "100|95"
}, {
match: "(\\d{2})(\\d{5,6})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "(?:10|2\\d)(?:100|9[56])"
}, {
match: "(\\d{3})(\\d{5,6})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "[3-9]\\d\\d(?:10|9[56])"
}, {
match: "(\\d{3,4})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "[2-9]"
}, {
match: "(21)(\\d{4})(\\d{4,6})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "21"
}, {
match: "([12]\\d)(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "10(?:[1-79]|8(?:0[1-9]|[1-9]))|2[02-9]"
}, {
match: "(\\d{3})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "3(?:1[02-9]|35|49|5|7[02-68]|9[1-68])|4(?:1[02-9]|2[179]|[35][2-9]|6[47-9]|7|8[23])|5(?:3[03-9]|4[36]|5[02-9]|6[1-46]|7[028]|80|9[2-46-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[04-9]|4[3-6]|6[2368])|8(?:1[236-8]|2[5-7]|3|5[1-9]|7[02-9]|8[36-8]|9[1-7])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])"
}, {
match: "(\\d{3})(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "3(?:11|7[179])|4(?:[15]1|3[1-35])|5(?:1|2[37]|3[12]|51|7[13-79]|9[15])|7(?:[39]1|5[457]|6[09])|8(?:[57]1|98)"
}, {
match: "(\\d{4})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "8078"
}, {
match: "(\\d{3})(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "1(?:[3-57-9]|66)"
}, {
match: "(10800)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "10800"
}, {
match: "(\\d{3})(\\d{7,8})",
replace: "$1 $2",
leadingDigitPattern: "950"
}],
internationalPatterns: [{
match: "(80\\d{2})(\\d{4})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "80[26-8]"
}, {
match: "([48]00)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "[48]00"
}, {
match: "(\\d{2})(\\d{5,6})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "(?:10|2\\d)(?:100|9[56])"
}, {
match: "(\\d{3})(\\d{5,6})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "[3-9]\\d\\d(?:10|9[56])"
}, {
match: "(21)(\\d{4})(\\d{4,6})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "21"
}, {
match: "([12]\\d)(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "10(?:[1-79]|8(?:0[1-9]|[1-9]))|2[02-9]"
}, {
match: "(\\d{3})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "3(?:1[02-9]|35|49|5|7[02-68]|9[1-68])|4(?:1[02-9]|2[179]|[35][2-9]|6[47-9]|7|8[23])|5(?:3[03-9]|4[36]|5[02-9]|6[1-46]|7[028]|80|9[2-46-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[04-9]|4[3-6]|6[2368])|8(?:1[236-8]|2[5-7]|3|5[1-9]|7[02-9]|8[36-8]|9[1-7])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])"
}, {
match: "(\\d{3})(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "3(?:11|7[179])|4(?:[15]1|3[1-35])|5(?:1|2[37]|3[12]|51|7[13-79]|9[15])|7(?:[39]1|5[457]|6[09])|8(?:[57]1|98)"
}, {
match: "(\\d{4})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "8078"
}, {
match: "(\\d{3})(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "1(?:[3-57-9]|66)"
}, {
match: "(10800)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "10800"
}, {
match: "(\\d{3})(\\d{7,8})",
replace: "$1 $2",
leadingDigitPattern: "950"
}]
},
CO: {
isoCode: "CO",
dialCode: "57",
nationalPrefix: "0",
patterns: [{
match: "(\\d)(\\d{7})",
replace: "$1 $2",
nationalFormat: "($1)",
leadingDigitPattern: "1(?:[2-7]|8[2-9]|9(?:09|[1-3]))|[24-8]"
}, {
match: "(\\d{3})(\\d{7})",
replace: "$1 $2",
leadingDigitPattern: "3"
}, {
match: "(1)(\\d{3})(\\d{7})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "1(?:800|9(?:0[01]|4[78]))"
}],
internationalPatterns: [{
match: "(\\d)(\\d{7})",
replace: "$1 $2",
nationalFormat: "($1)",
leadingDigitPattern: "1(?:[2-7]|8[2-9]|9(?:09|[1-3]))|[24-8]"
}, {
match: "(\\d{3})(\\d{7})",
replace: "$1 $2",
leadingDigitPattern: "3"
}, {
match: "(1)(\\d{3})(\\d{7})",
replace: "$1 $2 $3",
leadingDigitPattern: "1(?:800|9(?:0[01]|4[78]))"
}]
},
CR: {
isoCode: "CR",
dialCode: "506",
patterns: [{
match: "(\\d{4})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "[24-7]|8[3-9]"
}, {
match: "(\\d{3})(\\d{3})(\\d{4})",
replace: "$1-$2-$3",
leadingDigitPattern: "[89]0"
}]
},
CU: {
isoCode: "CU",
dialCode: "53",
nationalPrefix: "0",
patterns: [{
match: "(\\d)(\\d{6,7})",
replace: "$1 $2",
nationalFormat: "(0$1)",
leadingDigitPattern: "7"
}, {
match: "(\\d{2})(\\d{4,6})",
replace: "$1 $2",
nationalFormat: "(0$1)",
leadingDigitPattern: "[2-4]"
}, {
match: "(\\d)(\\d{7})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "5"
}]
},
CV: {
isoCode: "CV",
dialCode: "238",
patterns: [{
match: "(\\d{3})(\\d{2})(\\d{2})",
replace: "$1 $2 $3"
}]
},
CW: {
isoCode: "CW",
dialCode: "599",
patterns: [{
match: "(\\d{3})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "[13-7]"
}, {
match: "(9)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "9"
}],
priority: 10
},
CX: {
isoCode: "CX",
dialCode: "61",
nationalPrefix: "0",
priority: 5,
patternRegion: "AU"
},
CY: {
isoCode: "CY",
dialCode: "357",
patterns: [{
match: "(\\d{2})(\\d{6})",
replace: "$1 $2"
}]
},
CZ: {
isoCode: "CZ",
dialCode: "420",
patterns: [{
match: "([2-9]\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "[2-8]|9[015-7]"
}, {
match: "(96\\d)(\\d{3})(\\d{3})(\\d{3})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "96"
}, {
match: "(9\\d)(\\d{3})(\\d{3})(\\d{3})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "9[36]"
}]
},
DE: {
isoCode: "DE",
dialCode: "49",
nationalPrefix: "0",
patterns: [{
match: "(1\\d{2})(\\d{7,8})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "1[67]"
}, {
match: "(15\\d{3})(\\d{6})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "15[0568]"
}, {
match: "(1\\d{3})(\\d{7})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "15"
}, {
match: "(\\d{2})(\\d{3,11})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "3[02]|40|[68]9"
}, {
match: "(\\d{3})(\\d{3,11})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "2(?:0[1-389]|1[124]|2[18]|3[14]|[4-9]1)|3(?:[35-9][15]|4[015])|[4-8][1-9]1|9(?:06|[1-9]1)"
}, {
match: "(\\d{4})(\\d{2,11})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|[46][1246]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|3[1357]|4[13578]|6[1246]|7[1356]|9[1346])|5(?:0[14]|2[1-3589]|3[1357]|[49][1246]|6[1-4]|7[1346]|8[13568])|6(?:0[356]|2[1-489]|3[124-6]|4[1347]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|3[1357]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|4[1347]|6[0135-9]|7[1467]|8[136])|9(?:0[12479]|2[1358]|3[1357]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|[7-9](?:0[1-9]|[1-9])"
}, {
match: "(3\\d{4})(\\d{1,10})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "3"
}, {
match: "(800)(\\d{7,12})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "800"
}, {
match: "(\\d{3})(\\d)(\\d{4,10})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "1(?:37|80)|900[1359]"
}, {
match: "(1\\d{2})(\\d{5,11})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "181"
}, {
match: "(18\\d{3})(\\d{6})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "18500"
}, {
match: "(18\\d{2})(\\d{7})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "18[68]"
}, {
match: "(18\\d)(\\d{8})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "18[2-579]"
}, {
match: "(700)(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "700"
}, {
match: "(138)(\\d{4})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "138"
}, {
match: "(15[013-68])(\\d{2})(\\d{8})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "15[013-68]"
}, {
match: "(15[279]\\d)(\\d{2})(\\d{7})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "15[279]"
}, {
match: "(1[67]\\d)(\\d{2})(\\d{7,8})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "1(?:6[023]|7)"
}]
},
DJ: {
isoCode: "DJ",
dialCode: "253",
patterns: [{
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4"
}]
},
DK: {
isoCode: "DK",
dialCode: "45",
patterns: [{
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4"
}]
},
DM: {
isoCode: "DM",
dialCode: "1767",
countryDialCode: "1",
regionCode: "767",
nationalPrefix: "1"
},
DO: {
isoCode: "DO",
dialCode: "18[024]9",
countryDialCode: "1",
regionCode: "8[024]9",
areaCodes: ["809", "829", "849"],
nationalPrefix: "1",
priority: 3,
patternRegion: "DO"
},
DZ: {
isoCode: "DZ",
dialCode: "213",
nationalPrefix: "0",
patterns: [{
match: "([1-4]\\d)(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "[1-4]"
}, {
match: "([5-8]\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "[5-8]"
}, {
match: "(9\\d)(\\d{3})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "9"
}]
},
EC: {
isoCode: "EC",
dialCode: "593",
nationalPrefix: "0",
patterns: [{
match: "(\\d)(\\d{3})(\\d{4})",
replace: "$1 $2-$3",
nationalFormat: "(0$1)",
leadingDigitPattern: "[247]|[356][2-8]"
}, {
match: "(\\d{2})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "9"
}, {
match: "(1800)(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "1"
}],
internationalPatterns: [{
match: "(\\d)(\\d{3})(\\d{4})",
replace: "$1-$2-$3",
leadingDigitPattern: "[247]|[356][2-8]"
}, {
match: "(\\d{2})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "9"
}, {
match: "(1800)(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "1"
}]
},
EE: {
isoCode: "EE",
dialCode: "372",
patterns: [{
match: "([3-79]\\d{2})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]"
}, {
match: "(70)(\\d{2})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "70"
}, {
match: "(8000)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "8000"
}, {
match: "([458]\\d{3})(\\d{3,4})",
replace: "$1 $2",
leadingDigitPattern: "40|5|8(?:00[1-9]|[1-5])"
}]
},
EG: {
isoCode: "EG",
dialCode: "20",
nationalPrefix: "0",
patterns: [{
match: "(\\d)(\\d{7,8})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "[23]"
}, {
match: "(\\d{2})(\\d{6,7})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "1(?:3|5[239])|[4-6]|[89][2-9]"
}, {
match: "(\\d{3})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "1[0-25]|[89]00"
}]
},
EH: {
isoCode: "EH",
dialCode: "212528[89]",
countryDialCode: "212",
regionCode: "528[89]",
nationalPrefix: "0"
},
ER: {
isoCode: "ER",
dialCode: "291",
nationalPrefix: "0",
patterns: [{
match: "(\\d)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1"
}]
},
ES: {
isoCode: "ES",
dialCode: "34",
patterns: [{
match: "([89]00)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "[89]00"
}, {
match: "([5-9]\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "[568]|[79][0-8]"
}]
},
ET: {
isoCode: "ET",
dialCode: "251",
nationalPrefix: "0",
patterns: [{
match: "([1-59]\\d)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1"
}]
},
FI: {
isoCode: "FI",
dialCode: "358",
nationalPrefix: "0",
patterns: [{
match: "(\\d{3})(\\d{3,7})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "(?:[1-3]0|[6-8])0"
}, {
match: "(116\\d{3})",
replace: "$1",
nationalFormat: "$1",
leadingDigitPattern: "116"
}, {
match: "(\\d{2})(\\d{3,9})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "1(?:0[1-9]|[3-9])|2(?:0[1-9]|9)|30[1-9]|4|50|7(?:[13]|5[03-9])"
}, {
match: "(75\\d{3})",
replace: "$1",
nationalFormat: "0$1",
leadingDigitPattern: "75[12]"
}, {
match: "(\\d)(\\d{4})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "9[1-8]"
}, {
match: "(\\d)(\\d{5,9})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "[235689][1-8]"
}, {
match: "(39\\d)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "39"
}],
internationalPatterns: [{
match: "(\\d{3})(\\d{3,7})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "(?:[1-3]0|[6-8])0"
}, {
match: "(116\\d{3})",
replace: "$1",
nationalFormat: "$1",
leadingDigitPattern: "116"
}, {
match: "(\\d{2})(\\d{3,9})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "1(?:0[1-9]|[3-9])|2(?:0[1-9]|9)|30[1-9]|4|50|7(?:[13]|5[03-9])"
}, {
match: "(\\d)(\\d{4})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "9[1-8]"
}, {
match: "(\\d)(\\d{5,9})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "[235689][1-8]"
}, {
match: "(39\\d)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "39"
}],
priority: 10
},
FJ: {
isoCode: "FJ",
dialCode: "679",
patterns: [{
match: "(\\d{3})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "[2-9]"
}, {
match: "(\\d{4})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "0"
}]
},
FK: {
isoCode: "FK",
dialCode: "500",
priority: 10,
patternRegion: "FK"
},
FM: {
isoCode: "FM",
dialCode: "691",
patterns: [{
match: "(\\d{3})(\\d{4})",
replace: "$1 $2"
}]
},
FO: {
isoCode: "FO",
dialCode: "298",
patterns: [{
match: "(\\d{6})",
replace: "$1"
}]
},
FR: {
isoCode: "FR",
dialCode: "33",
nationalPrefix: "0",
patterns: [{
match: "([1-79])(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4 $5",
nationalFormat: "0$1",
leadingDigitPattern: "[1-79]"
}, {
match: "(1\\d{2})(\\d{3})",
replace: "$1 $2",
nationalFormat: "$1",
leadingDigitPattern: "11"
}, {
match: "(8\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0 $1",
leadingDigitPattern: "8"
}],
internationalPatterns: [{
match: "([1-79])(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4 $5",
nationalFormat: "0$1",
leadingDigitPattern: "[1-79]"
}, {
match: "(8\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0 $1",
leadingDigitPattern: "8"
}]
},
GA: {
isoCode: "GA",
dialCode: "241",
patterns: [{
match: "(\\d)(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "[2-7]"
}, {
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "0"
}]
},
GB: {
isoCode: "GB",
dialCode: "44",
nationalPrefix: "0",
patterns: [{
match: "(7\\d{3})(\\d{6})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "7(?:[1-57-9]|624)"
}, {
match: "(\\d{2})(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "2|5[56]|7[06]"
}, {
match: "(\\d{3})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "1(?:[02-9]1|1)|3|9[018]"
}, {
match: "(\\d{5})(\\d{4,5})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"
}, {
match: "(1\\d{3})(\\d{5,6})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "1"
}, {
match: "(800)(\\d{4})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "8001111"
}, {
match: "(845)(46)(4\\d)",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "845464"
}, {
match: "(8\\d{2})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "8(?:4[2-5]|7[0-3])"
}, {
match: "(80\\d)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "80"
}, {
match: "([58]00)(\\d{6})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "[58]00"
}],
priority: 10
},
GD: {
isoCode: "GD",
dialCode: "1473",
countryDialCode: "1",
regionCode: "473",
nationalPrefix: "1"
},
GE: {
isoCode: "GE",
dialCode: "995",
nationalPrefix: "0",
patterns: [{
match: "(\\d{3})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "[348]"
}, {
match: "(\\d{3})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "7"
}, {
match: "(\\d{3})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "$1",
leadingDigitPattern: "5"
}]
},
GF: {
isoCode: "GF",
dialCode: "594",
nationalPrefix: "0",
patterns: [{
match: "(\\d{3})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1"
}]
},
GG: {
isoCode: "GG",
dialCode: "44",
nationalPrefix: "0",
priority: 1,
patternRegion: "GB"
},
GH: {
isoCode: "GH",
dialCode: "233",
nationalPrefix: "0",
patterns: [{
match: "(\\d{2})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[235]"
}, {
match: "(\\d{3})(\\d{5})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "8"
}]
},
GI: {
isoCode: "GI",
dialCode: "350",
patterns: [{
match: "(\\d{3})(\\d{5})",
replace: "$1 $2",
leadingDigitPattern: "2"
}]
},
GL: {
isoCode: "GL",
dialCode: "299",
patterns: [{
match: "(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3"
}]
},
GM: {
isoCode: "GM",
dialCode: "220",
patterns: [{
match: "(\\d{3})(\\d{4})",
replace: "$1 $2"
}]
},
GN: {
isoCode: "GN",
dialCode: "224",
patterns: [{
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "3"
}, {
match: "(\\d{3})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "[67]"
}]
},
GP: {
isoCode: "GP",
dialCode: "590",
nationalPrefix: "0",
patterns: [{
match: "([56]90)(\\d{2})(\\d{4})",
replace: "$1 $2-$3",
nationalFormat: "0$1"
}],
priority: 10
},
GQ: {
isoCode: "GQ",
dialCode: "240",
patterns: [{
match: "(\\d{3})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "[235]"
}, {
match: "(\\d{3})(\\d{6})",
replace: "$1 $2",
leadingDigitPattern: "[89]"
}]
},
GR: {
isoCode: "GR",
dialCode: "30",
patterns: [{
match: "([27]\\d)(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "21|7"
}, {
match: "(\\d{3})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "2[2-9]1|[689]"
}, {
match: "(2\\d{3})(\\d{6})",
replace: "$1 $2",
leadingDigitPattern: "2[2-9][02-9]"
}]
},
GT: {
isoCode: "GT",
dialCode: "502",
patterns: [{
match: "(\\d{4})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "[2-7]"
}, {
match: "(\\d{4})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "1"
}]
},
GU: {
isoCode: "GU",
dialCode: "1671",
countryDialCode: "1",
regionCode: "671",
nationalPrefix: "1"
},
GW: {
isoCode: "GW",
dialCode: "245",
patterns: [{
match: "(\\d{3})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "44|9[5-7]"
}, {
match: "(\\d{3})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "40"
}]
},
GY: {
isoCode: "GY",
dialCode: "592",
patterns: [{
match: "(\\d{3})(\\d{4})",
replace: "$1 $2"
}]
},
HK: {
isoCode: "HK",
dialCode: "852",
patterns: [{
match: "(\\d{4})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "[235-7]|[89](?:0[1-9]|[1-9])"
}, {
match: "(800)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "800"
}, {
match: "(900)(\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "900"
}, {
match: "(900)(\\d{2,5})",
replace: "$1 $2",
leadingDigitPattern: "900"
}]
},
HN: {
isoCode: "HN",
dialCode: "504",
patterns: [{
match: "(\\d{4})(\\d{4})",
replace: "$1-$2"
}]
},
HR: {
isoCode: "HR",
dialCode: "385",
nationalPrefix: "0",
patterns: [{
match: "(1)(\\d{4})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "1"
}, {
match: "([2-5]\\d)(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[2-5]"
}, {
match: "(9\\d)(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "9"
}, {
match: "(6[01])(\\d{2})(\\d{2,3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "6[01]"
}, {
match: "([67]\\d)(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[67]"
}, {
match: "(80[01])(\\d{2})(\\d{2,3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "8"
}, {
match: "(80[01])(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "8"
}]
},
HT: {
isoCode: "HT",
dialCode: "509",
patterns: [{
match: "(\\d{2})(\\d{2})(\\d{4})",
replace: "$1 $2 $3"
}]
},
HU: {
isoCode: "HU",
dialCode: "36",
nationalPrefix: "06",
patterns: [{
match: "(1)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "($1)",
leadingDigitPattern: "1"
}, {
match: "(\\d{2})(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "($1)",
leadingDigitPattern: "[2-9]"
}]
},
ID: {
isoCode: "ID",
dialCode: "62",
nationalPrefix: "0",
patterns: [{
match: "(\\d{2})(\\d{5,8})",
replace: "$1 $2",
nationalFormat: "(0$1)",
leadingDigitPattern: "2[124]|[36]1"
}, {
match: "(\\d{3})(\\d{5,8})",
replace: "$1 $2",
nationalFormat: "(0$1)",
leadingDigitPattern: "2[035-9]|[36][02-9]|[4579]"
}, {
match: "(8\\d{2})(\\d{3,4})(\\d{3})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "8[1-35-9]"
}, {
match: "(8\\d{2})(\\d{4})(\\d{4,5})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "8[1-35-9]"
}, {
match: "(1)(500)(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "15"
}, {
match: "(177)(\\d{6,8})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "17"
}, {
match: "(800)(\\d{5,7})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "800"
}, {
match: "(804)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "804"
}, {
match: "(80\\d)(\\d)(\\d{3})(\\d{3})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "80[79]"
}]
},
IE: {
isoCode: "IE",
dialCode: "353",
nationalPrefix: "0",
patterns: [{
match: "(1)(\\d{3,4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "(0$1)",
leadingDigitPattern: "1"
}, {
match: "(\\d{2})(\\d{5})",
replace: "$1 $2",
nationalFormat: "(0$1)",
leadingDigitPattern: "2[24-9]|47|58|6[237-9]|9[35-9]"
}, {
match: "(\\d{3})(\\d{5})",
replace: "$1 $2",
nationalFormat: "(0$1)",
leadingDigitPattern: "40[24]|50[45]"
}, {
match: "(48)(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "(0$1)",
leadingDigitPattern: "48"
}, {
match: "(818)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "(0$1)",
leadingDigitPattern: "81"
}, {
match: "(\\d{2})(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "(0$1)",
leadingDigitPattern: "[24-69]|7[14]"
}, {
match: "(\\d{2})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "76|8[35-9]"
}, {
match: "(8\\d)(\\d)(\\d{3})(\\d{4})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "8[35-9]5"
}, {
match: "(700)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "70"
}, {
match: "(\\d{4})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "1(?:5|8[059]0)"
}]
},
IL: {
isoCode: "IL",
dialCode: "972",
nationalPrefix: "0",
patterns: [{
match: "([2-489])(\\d{3})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "[2-489]"
}, {
match: "([57]\\d)(\\d{3})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "[57]"
}, {
match: "(153)(\\d{1,2})(\\d{3})(\\d{4})",
replace: "$1 $2 $3 $4",
nationalFormat: "$1",
leadingDigitPattern: "153"
}, {
match: "(1)([7-9]\\d{2})(\\d{3})(\\d{3})",
replace: "$1-$2-$3-$4",
nationalFormat: "$1",
leadingDigitPattern: "1[7-9]"
}, {
match: "(1255)(\\d{3})",
replace: "$1-$2",
nationalFormat: "$1",
leadingDigitPattern: "125"
}, {
match: "(1200)(\\d{3})(\\d{3})",
replace: "$1-$2-$3",
nationalFormat: "$1",
leadingDigitPattern: "120"
}, {
match: "(1212)(\\d{2})(\\d{2})",
replace: "$1-$2-$3",
nationalFormat: "$1",
leadingDigitPattern: "121"
}, {
match: "(1599)(\\d{6})",
replace: "$1-$2",
nationalFormat: "$1",
leadingDigitPattern: "1599"
}, {
match: "(151)(\\d{1,2})(\\d{3})(\\d{4})",
replace: "$1-$2 $3-$4",
nationalFormat: "$1",
leadingDigitPattern: "151"
}, {
match: "(\\d{4})",
replace: "*$1",
nationalFormat: "$1",
leadingDigitPattern: "[2-689]"
}]
},
IM: {
isoCode: "IM",
dialCode: "44",
nationalPrefix: "0",
priority: 3,
patternRegion: "GB"
},
IN: {
isoCode: "IN",
dialCode: "91",
nationalPrefix: "0",
patterns: [{
match: "(\\d{8})",
replace: "$1",
nationalFormat: "$1",
leadingDigitPattern: "56161"
}, {
match: "(\\d{5})(\\d{5})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "600|7(?:0|19[0-5]|2(?:[0235-79]|[14][017-9]|8(?:[0-69]|[78][089]))|3(?:[05-8]|1(?:[0189]|7[5-9])|2(?:[0-49][089]|[5-8])|3[017-9]|4(?:[07-9]|11)|9(?:[01689]|[2-5][089]|7[0189]))|4(?:[056]|1(?:[0135-9]|[24][089])|[29](?:[0-7][089]|[89])|3(?:[0-8][089]|9)|[47](?:[089]|11|7[02-8])|8(?:[0-24-7][089]|[389]))|5(?:[0346-9]|[15][017-9]|2(?:[03-9]|[12][089]))|6(?:[0346-9]|1[0-257-9]|2(?:[0-4]|[5-9][089])|5(?:[0-367][089]|[4589]))|7(?:0(?:[02-9]|1[089])|[1-9])|8(?:[0-79]|8(?:0[0189]|11|8[013-9]|9))|9(?:[089]|313|7(?:[02-8]|9[07-9])))|8(?:0(?:[01589]|6[67]|7(?:[02-8]|9[05-9]))|1(?:[02-57-9]|1(?:[0-35-9]|4[0-46-9])|6(?:[089]|7[02-8]))|2(?:0(?:[089]|7[02])|[14](?:[089]|7[02-8])|[235-9])|3(?:[0357-9]|1(?:[089]|7[02-6])|2(?:[09]|77|8[0-689])|4(?:0[1-7]|[1-9])|6(?:[089]|7[02-7]))|[45]|6(?:[02457-9]|[136](?:[089]|7[02-8]))|7(?:0[07-9]|[1-69]|[78](?:[089]|7[02-8]))|8(?:[0-25-9]|3(?:[089]|7[02-8])|4(?:[0489]|7[02-68]))|9(?:[02-9]|1(?:[0289]|7[2-6])))|9"
}, {
match: "(\\d{2})(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "11|2[02]|33|4[04]|79[1-9]|80[2-46]"
}, {
match: "(\\d{3})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "1(?:2[0-249]|3[0-25]|4[145]|[59][14]|[68][1-9]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1|9[15])|6(?:12|[2-4]1|5[17]|6[13]|7[14]|80)|7(?:12|2[14]|3[134]|4[47]|5[15]|[67]1|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)"
}, {
match: "(\\d{4})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "1(?:[23579]|[468][1-9])|[2-8]"
}, {
match: "(\\d{2})(\\d{3})(\\d{4})(\\d{3})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "008"
}, {
match: "(\\d{3})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "140"
}, {
match: "(\\d{4})(\\d{2})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "1600"
}, {
match: "(\\d{4})(\\d{4,5})",
replace: "$1 $2",
nationalFormat: "$1",
leadingDigitPattern: "1800"
}, {
match: "(\\d{4})(\\d{2,4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "1800"
}, {
match: "(\\d{4})(\\d{3,4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "1860"
}, {
match: "(\\d{4})(\\d{3})(\\d{3})(\\d{3})",
replace: "$1 $2 $3 $4",
nationalFormat: "$1",
leadingDigitPattern: "18[06]"
}]
},
IO: {
isoCode: "IO",
dialCode: "246",
patterns: [{
match: "(\\d{3})(\\d{4})",
replace: "$1 $2"
}]
},
IQ: {
isoCode: "IQ",
dialCode: "964",
nationalPrefix: "0",
patterns: [{
match: "(1)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "1"
}, {
match: "([2-6]\\d)(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[2-6]"
}, {
match: "(7\\d{2})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "7"
}]
},
IR: {
isoCode: "IR",
dialCode: "98",
nationalPrefix: "0",
patterns: [{
match: "(\\d{2})(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[1-8]"
}, {
match: "(\\d{2})(\\d{4,5})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "[1-8]"
}, {
match: "(\\d{4,5})",
replace: "$1",
nationalFormat: "0$1",
leadingDigitPattern: "96"
}, {
match: "(\\d{3})(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "9"
}]
},
IS: {
isoCode: "IS",
dialCode: "354",
patterns: [{
match: "(\\d{3})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "[4-9]"
}, {
match: "(3\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "3"
}]
},
IT: {
isoCode: "IT",
dialCode: "39",
patterns: [{
match: "(\\d{2})(\\d{3,4})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "0[26]|55"
}, {
match: "(0[26])(\\d{4})(\\d{5})",
replace: "$1 $2 $3",
leadingDigitPattern: "0[26]"
}, {
match: "(0[26])(\\d{4,6})",
replace: "$1 $2",
leadingDigitPattern: "0[26]"
}, {
match: "(0\\d{2})(\\d{3,4})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "0[13-57-9][0159]"
}, {
match: "(\\d{3})(\\d{3,6})",
replace: "$1 $2",
leadingDigitPattern: "0[13-57-9][0159]|8(?:03|4[17]|9(?:2|[45][0-4]))"
}, {
match: "(0\\d{3})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "0[13-57-9][2-46-8]"
}, {
match: "(0\\d{3})(\\d{2,6})",
replace: "$1 $2",
leadingDigitPattern: "0[13-57-9][2-46-8]"
}, {
match: "(\\d{3})(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
leadingDigitPattern: "[13]|8(?:00|4[08]|9(?:5[5-9]|9))"
}, {
match: "(\\d{4})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "894[5-9]"
}, {
match: "(\\d{3})(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "3"
}],
priority: 10
},
JE: {
isoCode: "JE",
dialCode: "44",
nationalPrefix: "0",
priority: 5,
patternRegion: "GB"
},
JM: {
isoCode: "JM",
dialCode: "1876",
countryDialCode: "1",
regionCode: "876",
nationalPrefix: "1"
},
JO: {
isoCode: "JO",
dialCode: "962",
nationalPrefix: "0",
patterns: [{
match: "(\\d)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "(0$1)",
leadingDigitPattern: "[2356]|87"
}, {
match: "(7)(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "7[457-9]"
}, {
match: "(\\d{2})(\\d{7})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "70"
}, {
match: "(\\d{3})(\\d{5,6})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "8[0158]|9"
}]
},
JP: {
isoCode: "JP",
dialCode: "81",
nationalPrefix: "0",
patterns: [{
match: "(\\d{3})(\\d{3})(\\d{3})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "(?:12|57|99)0"
}, {
match: "(\\d{3})(\\d{3})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "800"
}, {
match: "(\\d{4})(\\d{4})",
replace: "$1-$2",
nationalFormat: "$1",
leadingDigitPattern: "0077"
}, {
match: "(\\d{4})(\\d{2})(\\d{3,4})",
replace: "$1-$2-$3",
nationalFormat: "$1",
leadingDigitPattern: "0077"
}, {
match: "(\\d{4})(\\d{2})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "$1",
leadingDigitPattern: "0088"
}, {
match: "(\\d{4})(\\d{3})(\\d{3,4})",
replace: "$1-$2-$3",
nationalFormat: "$1",
leadingDigitPattern: "00(?:37|66)"
}, {
match: "(\\d{4})(\\d{4})(\\d{4,5})",
replace: "$1-$2-$3",
nationalFormat: "$1",
leadingDigitPattern: "00(?:37|66)"
}, {
match: "(\\d{4})(\\d{5})(\\d{5,6})",
replace: "$1-$2-$3",
nationalFormat: "$1",
leadingDigitPattern: "00(?:37|66)"
}, {
match: "(\\d{4})(\\d{6})(\\d{6,7})",
replace: "$1-$2-$3",
nationalFormat: "$1",
leadingDigitPattern: "00(?:37|66)"
}, {
match: "(\\d{2})(\\d{4})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "[2579]0|80[1-9]"
}, {
match: "(\\d{4})(\\d)(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "1(?:267|3(?:7[247]|9[278])|4(?:5[67]|66)|5(?:47|58|64|8[67])|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[78]|96[2457-9])|477|51[24]|636[2-57-9])|9(?:496|802|9(?:1[23]|69))"
}, {
match: "(\\d{3})(\\d{2})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "1(?:2[3-6]|3[3-9]|4[2-6]|5(?:[236-8]|[45][2-69])|[68][2-7]|7[2-689]|9[1-578])|2(?:2(?:[04-689]|3[23])|3[3-58]|4[0-468]|5(?:[0468][2-9]|5[78]|7[2-4])|6(?:[0135-8]|4[2-5])|7(?:[0679]|8[2-7])|8(?:[024578]|3[25-9]|9[6-9])|9(?:11|3[2-4]))|4(?:2(?:2[2-9]|8[237-9])|3[689]|6[035-7]|7(?:[059][2-8]|[68])|80|9[3-5])|5(?:3[1-36-9]|4[4578]|5[013-8]|6[1-9]|7[2-8]|8[14-7]|9(?:[4-7]|[89][2-8]))|7(?:2[15]|3[5-9]|4[02-9]|6[135-8]|7[0-4689]|9(?:[017-9]|4[6-8]|5[2-478]|6[2-589]))|8(?:2(?:4[4-8]|9(?:20|[3578]|4[04-9]|6(?:5[25]|60)))|3(?:[3-6][2-9]|7(?:[2-5]|6[0-59])|8[2-5])|4[5-8]|5[2-9]|6(?:[37]|5(?:[467]|5[014-9])|6(?:[2-8]|9[02-69])|8[2-8]|9(?:[236-8]|9[23]))|7[579]|8[03-579]|9[2-8])|9(?:[23]0|4[02-46-9]|5[024-79]|6[4-9]|7[2-47-9]|8[02-7]|9(?:3(?:3[02-9]|4[0-24689])|4[2-69]|[5-7]))"
}, {
match: "(\\d{2})(\\d{3})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "1|2(?:2[37]|5(?:[57]|[68]0|9(?:17|99))|64|78|8[39]|917)|4(?:2(?:20|[68]|9[178])|64|7[347])|5[2-589]|60|8(?:2[124589]|3[279]|[46-9])|9(?:[235-8]|93(?:31|4))"
}, {
match: "(\\d{3})(\\d{2})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "2(?:[34]7|[56]9|74|9[14-79])|82|993"
}, {
match: "(\\d)(\\d{4})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "3|4(?:2[09]|7[01])|6[1-9]"
}, {
match: "(\\d{2})(\\d{3})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "[2479][1-9]"
}],
internationalPatterns: [{
match: "(\\d{3})(\\d{3})(\\d{3})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "(?:12|57|99)0"
}, {
match: "(\\d{3})(\\d{3})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "800"
}, {
match: "(\\d{2})(\\d{4})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "[2579]0|80[1-9]"
}, {
match: "(\\d{4})(\\d)(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "1(?:267|3(?:7[247]|9[278])|4(?:5[67]|66)|5(?:47|58|64|8[67])|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[78]|96[2457-9])|477|51[24]|636[2-57-9])|9(?:496|802|9(?:1[23]|69))"
}, {
match: "(\\d{3})(\\d{2})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "1(?:2[3-6]|3[3-9]|4[2-6]|5(?:[236-8]|[45][2-69])|[68][2-7]|7[2-689]|9[1-578])|2(?:2(?:[04-689]|3[23])|3[3-58]|4[0-468]|5(?:[0468][2-9]|5[78]|7[2-4])|6(?:[0135-8]|4[2-5])|7(?:[0679]|8[2-7])|8(?:[024578]|3[25-9]|9[6-9])|9(?:11|3[2-4]))|4(?:2(?:2[2-9]|8[237-9])|3[689]|6[035-7]|7(?:[059][2-8]|[68])|80|9[3-5])|5(?:3[1-36-9]|4[4578]|5[013-8]|6[1-9]|7[2-8]|8[14-7]|9(?:[4-7]|[89][2-8]))|7(?:2[15]|3[5-9]|4[02-9]|6[135-8]|7[0-4689]|9(?:[017-9]|4[6-8]|5[2-478]|6[2-589]))|8(?:2(?:4[4-8]|9(?:20|[3578]|4[04-9]|6(?:5[25]|60)))|3(?:[3-6][2-9]|7(?:[2-5]|6[0-59])|8[2-5])|4[5-8]|5[2-9]|6(?:[37]|5(?:[467]|5[014-9])|6(?:[2-8]|9[02-69])|8[2-8]|9(?:[236-8]|9[23]))|7[579]|8[03-579]|9[2-8])|9(?:[23]0|4[02-46-9]|5[024-79]|6[4-9]|7[2-47-9]|8[02-7]|9(?:3(?:3[02-9]|4[0-24689])|4[2-69]|[5-7]))"
}, {
match: "(\\d{2})(\\d{3})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "1|2(?:2[37]|5(?:[57]|[68]0|9(?:17|99))|64|78|8[39]|917)|4(?:2(?:20|[68]|9[178])|64|7[347])|5[2-589]|60|8(?:2[124589]|3[279]|[46-9])|9(?:[235-8]|93(?:31|4))"
}, {
match: "(\\d{3})(\\d{2})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "2(?:[34]7|[56]9|74|9[14-79])|82|993"
}, {
match: "(\\d)(\\d{4})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "3|4(?:2[09]|7[01])|6[1-9]"
}, {
match: "(\\d{2})(\\d{3})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "[2479][1-9]"
}]
},
KE: {
isoCode: "KE",
dialCode: "254",
nationalPrefix: "0",
patterns: [{
match: "(\\d{2})(\\d{5,7})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "[24-6]"
}, {
match: "(\\d{3})(\\d{6})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "7"
}, {
match: "(\\d{3})(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[89]"
}]
},
KG: {
isoCode: "KG",
dialCode: "996",
nationalPrefix: "0",
patterns: [{
match: "(\\d{3})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[25-7]|31[25]"
}, {
match: "(\\d{4})(\\d{5})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "3(?:1[36]|[2-9])"
}, {
match: "(\\d{3})(\\d{3})(\\d)(\\d{3})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "8"
}]
},
KH: {
isoCode: "KH",
dialCode: "855",
nationalPrefix: "0",
patterns: [{
match: "(\\d{2})(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "1\\d[1-9]|[2-9]"
}, {
match: "(1[89]00)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "1[89]0"
}]
},
KI: {
isoCode: "KI",
dialCode: "686"
},
KM: {
isoCode: "KM",
dialCode: "269",
patterns: [{
match: "(\\d{3})(\\d{2})(\\d{2})",
replace: "$1 $2 $3"
}]
},
KN: {
isoCode: "KN",
dialCode: "1869",
countryDialCode: "1",
regionCode: "869",
nationalPrefix: "1"
},
KP: {
isoCode: "KP",
dialCode: "850",
nationalPrefix: "0",
patterns: [{
match: "(\\d{3})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "1"
}, {
match: "(\\d)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "2"
}, {
match: "(\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "8"
}]
},
KR: {
isoCode: "KR",
dialCode: "82",
nationalPrefix: "0",
patterns: [{
match: "(\\d{2})(\\d{3,4})",
replace: "$1-$2",
nationalFormat: "0$1",
leadingDigitPattern: "(?:3[1-3]|[46][1-4]|5[1-5])1"
}, {
match: "(\\d{4})(\\d{4})",
replace: "$1-$2",
nationalFormat: "$1",
leadingDigitPattern: "1(?:5(?:22|44|66|77|88|99)|6(?:[07]0|44|6[16]|88)|8(?:00|33|55|77|99))"
}, {
match: "(\\d{5})",
replace: "$1",
nationalFormat: "0$1",
leadingDigitPattern: "1[016-9]114"
}, {
match: "(\\d)(\\d{3,4})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "2[1-9]"
}, {
match: "(\\d{2})(\\d{3})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "60[2-9]|80"
}, {
match: "(\\d{2})(\\d{3,4})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "1[0-25-9]|(?:3[1-3]|[46][1-4]|5[1-5])[1-9]"
}, {
match: "(\\d{2})(\\d{4})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "[57]0"
}, {
match: "(\\d{5})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "00308"
}, {
match: "(\\d{5})(\\d{3,4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "00(?:36|79)8"
}, {
match: "(\\d{5})(\\d{2})(\\d{3})(\\d{4})",
replace: "$1 $2 $3 $4",
nationalFormat: "$1",
leadingDigitPattern: "00798"
}],
internationalPatterns: [{
match: "(\\d{2})(\\d{3,4})",
replace: "$1-$2",
nationalFormat: "0$1",
leadingDigitPattern: "(?:3[1-3]|[46][1-4]|5[1-5])1"
}, {
match: "(\\d{4})(\\d{4})",
replace: "$1-$2",
nationalFormat: "$1",
leadingDigitPattern: "1(?:5(?:22|44|66|77|88|99)|6(?:[07]0|44|6[16]|88)|8(?:00|33|55|77|99))"
}, {
match: "(\\d{5})",
replace: "$1",
nationalFormat: "0$1",
leadingDigitPattern: "1[016-9]114"
}, {
match: "(\\d)(\\d{3,4})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "2[1-9]"
}, {
match: "(\\d{2})(\\d{3})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "60[2-9]|80"
}, {
match: "(\\d{2})(\\d{3,4})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "1[0-25-9]|(?:3[1-3]|[46][1-4]|5[1-5])[1-9]"
}, {
match: "(\\d{2})(\\d{4})(\\d{4})",
replace: "$1-$2-$3",
nationalFormat: "0$1",
leadingDigitPattern: "[57]0"
}]
},
KW: {
isoCode: "KW",
dialCode: "965",
patterns: [{
match: "(\\d{4})(\\d{3,4})",
replace: "$1 $2",
leadingDigitPattern: "[16]|2(?:[0-35-9]|4[0-35-9])|52[25]|9[024-9]"
}, {
match: "(\\d{3})(\\d{5})",
replace: "$1 $2",
leadingDigitPattern: "244|5(?:[015]|6[56])"
}]
},
KY: {
isoCode: "KY",
dialCode: "1345",
countryDialCode: "1",
regionCode: "345",
nationalPrefix: "1"
},
KZ: {
isoCode: "KZ",
dialCode: "7",
nationalPrefix: "8",
priority: 1,
patternRegion: "RU"
},
LA: {
isoCode: "LA",
dialCode: "856",
nationalPrefix: "0",
patterns: [{
match: "(20)(\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "20"
}, {
match: "([2-8]\\d)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "2[13]|3[14]|[4-8]"
}, {
match: "(30)(\\d{2})(\\d{2})(\\d{3})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "30"
}]
},
LB: {
isoCode: "LB",
dialCode: "961",
nationalPrefix: "0",
patterns: [{
match: "(\\d)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[13-69]|7(?:[2-57]|62|8[0-7]|9[04-9])|8[02-9]"
}, {
match: "([7-9]\\d)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "7(?:[01]|6[013-9]|8[89]|9[1-3])|[89][01]"
}]
},
LC: {
isoCode: "LC",
dialCode: "1758",
countryDialCode: "1",
regionCode: "758",
nationalPrefix: "1"
},
LI: {
isoCode: "LI",
dialCode: "423",
nationalPrefix: "0",
patterns: [{
match: "(\\d{3})(\\d{2})(\\d{2})",
replace: "$1 $2 $3",
leadingDigitPattern: "[237-9]"
}, {
match: "(\\d{3})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "6[56]"
}, {
match: "(69)(7\\d{2})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "697"
}]
},
LK: {
isoCode: "LK",
dialCode: "94",
nationalPrefix: "0",
patterns: [{
match: "(\\d{2})(\\d{1})(\\d{6})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[1-689]"
}, {
match: "(\\d{2})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "7"
}]
},
LR: {
isoCode: "LR",
dialCode: "231",
nationalPrefix: "0",
patterns: [{
match: "(2\\d)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "2"
}, {
match: "([4-5])(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[45]"
}, {
match: "(\\d{2})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[23578]"
}]
},
LS: {
isoCode: "LS",
dialCode: "266",
patterns: [{
match: "(\\d{4})(\\d{4})",
replace: "$1 $2"
}]
},
LT: {
isoCode: "LT",
dialCode: "370",
nationalPrefix: "8",
patterns: [{
match: "([34]\\d)(\\d{6})",
replace: "$1 $2",
nationalFormat: "(8-$1)",
leadingDigitPattern: "37|4(?:1|5[45]|6[2-4])"
}, {
match: "([3-6]\\d{2})(\\d{5})",
replace: "$1 $2",
nationalFormat: "(8-$1)",
leadingDigitPattern: "3[148]|4(?:[24]|6[09])|528|6"
}, {
match: "([7-9]\\d{2})(\\d{2})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "8 $1",
leadingDigitPattern: "[7-9]"
}, {
match: "(5)(2\\d{2})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "(8-$1)",
leadingDigitPattern: "52[0-79]"
}]
},
LU: {
isoCode: "LU",
dialCode: "352",
patterns: [{
match: "(\\d{2})(\\d{3})",
replace: "$1 $2",
leadingDigitPattern: "[2-5]|7[1-9]|[89](?:0[2-9]|[1-9])"
}, {
match: "(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3",
leadingDigitPattern: "[2-5]|7[1-9]|[89](?:0[2-9]|[1-9])"
}, {
match: "(\\d{2})(\\d{2})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "20"
}, {
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "2(?:[0367]|4[3-8])"
}, {
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{3})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "20"
}, {
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})",
replace: "$1 $2 $3 $4 $5",
leadingDigitPattern: "2(?:[0367]|4[3-8])"
}, {
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{1,4})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "2(?:[12589]|4[12])|[3-5]|7[1-9]|8(?:0[2-9]|[1-9])|9(?:0[2-46-9]|[1-9])"
}, {
match: "(\\d{3})(\\d{2})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "70|80[01]|90[015]"
}, {
match: "(\\d{3})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "6"
}]
},
LV: {
isoCode: "LV",
dialCode: "371",
patterns: [{
match: "([2689]\\d)(\\d{3})(\\d{3})",
replace: "$1 $2 $3"
}]
},
LY: {
isoCode: "LY",
dialCode: "218",
nationalPrefix: "0",
patterns: [{
match: "([25679]\\d)(\\d{7})",
replace: "$1-$2",
nationalFormat: "0$1"
}]
},
MA: {
isoCode: "MA",
dialCode: "212",
nationalPrefix: "0",
patterns: [{
match: "([5-7]\\d{2})(\\d{6})",
replace: "$1-$2",
nationalFormat: "0$1",
leadingDigitPattern: "5(?:2[015-7]|3[0-4])|[67]"
}, {
match: "([58]\\d{3})(\\d{5})",
replace: "$1-$2",
nationalFormat: "0$1",
leadingDigitPattern: "5(?:2(?:[2-48]|9[0-7])|3(?:[5-79]|8[0-7])|924)|892"
}, {
match: "(5\\d{4})(\\d{4})",
replace: "$1-$2",
nationalFormat: "0$1",
leadingDigitPattern: "5(?:29|38)[89]"
}, {
match: "([5]\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "5(?:4[067]|5[03])"
}, {
match: "(8[09])(\\d{7})",
replace: "$1-$2",
nationalFormat: "0$1",
leadingDigitPattern: "8(?:0|9[013-9])"
}]
},
MC: {
isoCode: "MC",
dialCode: "377",
nationalPrefix: "0",
patterns: [{
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "$1",
leadingDigitPattern: "[39]"
}, {
match: "(\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "4"
}, {
match: "(6)(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4 $5",
nationalFormat: "0$1",
leadingDigitPattern: "6"
}, {
match: "(\\d{3})(\\d{3})(\\d{2})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "8"
}]
},
MD: {
isoCode: "MD",
dialCode: "373",
nationalPrefix: "0",
patterns: [{
match: "(\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "22|3"
}, {
match: "([25-7]\\d{2})(\\d{2})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "2[13-9]|[5-7]"
}, {
match: "([89]\\d{2})(\\d{5})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "[89]"
}]
},
ME: {
isoCode: "ME",
dialCode: "382",
nationalPrefix: "0",
patterns: [{
match: "(\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[2-57-9]|6[036-9]"
}]
},
MF: {
isoCode: "MF",
dialCode: "590",
nationalPrefix: "0",
priority: 5,
patternRegion: "GP"
},
MG: {
isoCode: "MG",
dialCode: "261",
nationalPrefix: "0",
patterns: [{
match: "([23]\\d)(\\d{2})(\\d{3})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1"
}]
},
MH: {
isoCode: "MH",
dialCode: "692",
nationalPrefix: "1",
patterns: [{
match: "(\\d{3})(\\d{4})",
replace: "$1-$2"
}]
},
MK: {
isoCode: "MK",
dialCode: "389",
nationalPrefix: "0",
patterns: [{
match: "(2)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "2"
}, {
match: "([347]\\d)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[347]"
}, {
match: "([58]\\d{2})(\\d)(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "[58]"
}]
},
ML: {
isoCode: "ML",
dialCode: "223",
patterns: [{
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "[246-9]"
}, {
match: "(\\d{4})",
replace: "$1",
leadingDigitPattern: "67|74"
}],
internationalPatterns: [{
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "[246-9]"
}]
},
MM: {
isoCode: "MM",
dialCode: "95",
nationalPrefix: "0",
patterns: [{
match: "(\\d)(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "1|2[245]"
}, {
match: "(2)(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "251"
}, {
match: "(\\d)(\\d{2})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "16|2"
}, {
match: "(\\d{2})(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "432|67|81"
}, {
match: "(\\d{2})(\\d{2})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[4-8]"
}, {
match: "(9)(\\d{3})(\\d{4,6})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "9(?:2[0-4]|[35-9]|4[137-9])"
}, {
match: "(9)([34]\\d{4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "9(?:3[0-36]|4[0-57-9])"
}, {
match: "(9)(\\d{3})(\\d{3})(\\d{3})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "92[56]"
}, {
match: "(9)(\\d{3})(\\d{3})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "93"
}]
},
MN: {
isoCode: "MN",
dialCode: "976",
nationalPrefix: "0",
patterns: [{
match: "([12]\\d)(\\d{2})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[12]1"
}, {
match: "([12]2\\d)(\\d{5,6})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "[12]2[1-3]"
}, {
match: "([12]\\d{3})(\\d{5})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "[12](?:27|[3-5]\\d)2"
}, {
match: "(\\d{4})(\\d{4})",
replace: "$1 $2",
nationalFormat: "$1",
leadingDigitPattern: "[57-9]"
}, {
match: "([12]\\d{4})(\\d{4,5})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "[12](?:27|[3-5]\\d)[4-9]"
}]
},
MO: {
isoCode: "MO",
dialCode: "853",
patterns: [{
match: "([268]\\d{3})(\\d{4})",
replace: "$1 $2"
}]
},
MP: {
isoCode: "MP",
dialCode: "1670",
countryDialCode: "1",
regionCode: "670",
nationalPrefix: "1"
},
MQ: {
isoCode: "MQ",
dialCode: "596",
nationalPrefix: "0",
patterns: [{
match: "(\\d{3})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1"
}]
},
MR: {
isoCode: "MR",
dialCode: "222",
patterns: [{
match: "([2-48]\\d)(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4"
}]
},
MS: {
isoCode: "MS",
dialCode: "1664",
countryDialCode: "1",
regionCode: "664",
nationalPrefix: "1"
},
MT: {
isoCode: "MT",
dialCode: "356",
patterns: [{
match: "(\\d{4})(\\d{4})",
replace: "$1 $2"
}]
},
MU: {
isoCode: "MU",
dialCode: "230",
patterns: [{
match: "([2-46-9]\\d{2})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "[2-46-9]"
}, {
match: "(5\\d{3})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "5"
}]
},
MV: {
isoCode: "MV",
dialCode: "960",
patterns: [{
match: "(\\d{3})(\\d{4})",
replace: "$1-$2",
leadingDigitPattern: "[3467]|9(?:0[1-9]|[1-9])"
}, {
match: "(\\d{3})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "[89]00"
}]
},
MW: {
isoCode: "MW",
dialCode: "265",
nationalPrefix: "0",
patterns: [{
match: "(\\d)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "1"
}, {
match: "(2\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "2"
}, {
match: "(\\d{3})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "[17-9]"
}]
},
MX: {
isoCode: "MX",
dialCode: "52",
nationalPrefix: "01",
patterns: [{
match: "([358]\\d)(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "01 $1",
leadingDigitPattern: "33|55|81"
}, {
match: "(\\d{3})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "01 $1",
leadingDigitPattern: "[2467]|3[0-2457-9]|5[089]|8[02-9]|9[0-35-9]"
}, {
match: "(1)([358]\\d)(\\d{4})(\\d{4})",
replace: "044 $2 $3 $4",
nationalFormat: "$1",
leadingDigitPattern: "1(?:33|55|81)"
}, {
match: "(1)(\\d{3})(\\d{3})(\\d{4})",
replace: "044 $2 $3 $4",
nationalFormat: "$1",
leadingDigitPattern: "1(?:[2467]|3[0-2457-9]|5[089]|8[2-9]|9[1-35-9])"
}],
internationalPatterns: [{
match: "([358]\\d)(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "01 $1",
leadingDigitPattern: "33|55|81"
}, {
match: "(\\d{3})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "01 $1",
leadingDigitPattern: "[2467]|3[0-2457-9]|5[089]|8[02-9]|9[0-35-9]"
}, {
match: "(1)([358]\\d)(\\d{4})(\\d{4})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "1(?:33|55|81)"
}, {
match: "(1)(\\d{3})(\\d{3})(\\d{4})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "1(?:[2467]|3[0-2457-9]|5[089]|8[2-9]|9[1-35-9])"
}]
},
MY: {
isoCode: "MY",
dialCode: "60",
nationalPrefix: "0",
patterns: [{
match: "([4-79])(\\d{3})(\\d{4})",
replace: "$1-$2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[4-79]"
}, {
match: "(3)(\\d{4})(\\d{4})",
replace: "$1-$2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "3"
}, {
match: "([18]\\d)(\\d{3})(\\d{3,4})",
replace: "$1-$2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "1[02-46-9][1-9]|8"
}, {
match: "(1)([36-8]00)(\\d{2})(\\d{4})",
replace: "$1-$2-$3-$4",
leadingDigitPattern: "1[36-8]0"
}, {
match: "(11)(\\d{4})(\\d{4})",
replace: "$1-$2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "11"
}, {
match: "(15[49])(\\d{3})(\\d{4})",
replace: "$1-$2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "15"
}]
},
MZ: {
isoCode: "MZ",
dialCode: "258",
patterns: [{
match: "([28]\\d)(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
leadingDigitPattern: "2|8[2-7]"
}, {
match: "(80\\d)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "80"
}]
},
NA: {
isoCode: "NA",
dialCode: "264",
nationalPrefix: "0",
patterns: [{
match: "(8\\d)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "8[1-35]"
}, {
match: "(6\\d)(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "6"
}, {
match: "(88)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "88"
}, {
match: "(870)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "870"
}]
},
NC: {
isoCode: "NC",
dialCode: "687",
patterns: [{
match: "(\\d{2})(\\d{2})(\\d{2})",
replace: "$1.$2.$3",
leadingDigitPattern: "[2-46-9]|5[0-4]"
}]
},
NE: {
isoCode: "NE",
dialCode: "227",
patterns: [{
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "09|[289]"
}, {
match: "(08)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "08"
}]
},
NF: {
isoCode: "NF",
dialCode: "672",
patterns: [{
match: "(\\d{2})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "1"
}, {
match: "(\\d)(\\d{5})",
replace: "$1 $2",
leadingDigitPattern: "3"
}]
},
NG: {
isoCode: "NG",
dialCode: "234",
nationalPrefix: "0",
patterns: [{
match: "(\\d)(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[12]|9(?:0[3-9]|[1-9])"
}, {
match: "(\\d{2})(\\d{3})(\\d{2,3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[3-6]|7(?:0[1-9]|[1-79])|8[2-9]"
}, {
match: "(\\d{3})(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "70|8[01]|90[235-9]"
}, {
match: "([78]00)(\\d{4})(\\d{4,5})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[78]00"
}, {
match: "([78]00)(\\d{5})(\\d{5,6})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[78]00"
}, {
match: "(78)(\\d{2})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "78"
}]
},
NI: {
isoCode: "NI",
dialCode: "505",
patterns: [{
match: "(\\d{4})(\\d{4})",
replace: "$1 $2"
}]
},
NL: {
isoCode: "NL",
dialCode: "31",
nationalPrefix: "0",
patterns: [{
match: "([1-578]\\d)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "1[035]|2[0346]|3[03568]|4[0356]|5[0358]|7|8[4578]"
}, {
match: "([1-5]\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"
}, {
match: "(6)(\\d{8})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "6[0-57-9]"
}, {
match: "(66)(\\d{7})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "66"
}, {
match: "(14)(\\d{3,4})",
replace: "$1 $2",
nationalFormat: "$1",
leadingDigitPattern: "14"
}, {
match: "([89]0\\d)(\\d{4,7})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "80|9"
}]
},
NO: {
isoCode: "NO",
dialCode: "47",
patterns: [{
match: "([489]\\d{2})(\\d{2})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "[489]"
}, {
match: "([235-7]\\d)(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "[235-7]"
}],
priority: 10
},
NP: {
isoCode: "NP",
dialCode: "977",
nationalPrefix: "0",
patterns: [{
match: "(1)(\\d{7})",
replace: "$1-$2",
nationalFormat: "0$1",
leadingDigitPattern: "1[2-6]"
}, {
match: "(\\d{2})(\\d{6})",
replace: "$1-$2",
nationalFormat: "0$1",
leadingDigitPattern: "1[01]|[2-8]|9(?:[1-69]|7[15-9])"
}, {
match: "(9\\d{2})(\\d{7})",
replace: "$1-$2",
nationalFormat: "$1",
leadingDigitPattern: "9(?:6[013]|7[245]|8)"
}]
},
NR: {
isoCode: "NR",
dialCode: "674",
patterns: [{
match: "(\\d{3})(\\d{4})",
replace: "$1 $2"
}]
},
NU: {
isoCode: "NU",
dialCode: "683"
},
NZ: {
isoCode: "NZ",
dialCode: "64",
nationalPrefix: "0",
patterns: [{
match: "(\\d)(\\d{3})(\\d{4})",
replace: "$1-$2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "240|[346]|7[2-57-9]|9[1-9]"
}, {
match: "(\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "21"
}, {
match: "(\\d{2})(\\d{3})(\\d{3,5})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "2(?:1[1-9]|[69]|7[0-35-9])|70|86"
}, {
match: "(2\\d)(\\d{3,4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "2[028]"
}, {
match: "(\\d{3})(\\d{2})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "90"
}, {
match: "(\\d{3})(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "2(?:10|74)|5|[89]0"
}],
priority: 10
},
OM: {
isoCode: "OM",
dialCode: "968",
patterns: [{
match: "(2\\d)(\\d{6})",
replace: "$1 $2",
leadingDigitPattern: "2"
}, {
match: "([79]\\d{3})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "[79]"
}, {
match: "([58]00)(\\d{4,6})",
replace: "$1 $2",
leadingDigitPattern: "[58]"
}]
},
PA: {
isoCode: "PA",
dialCode: "507",
patterns: [{
match: "(\\d{3})(\\d{4})",
replace: "$1-$2",
leadingDigitPattern: "[1-57-9]"
}, {
match: "(\\d{4})(\\d{4})",
replace: "$1-$2",
leadingDigitPattern: "6"
}]
},
PE: {
isoCode: "PE",
dialCode: "51",
nationalPrefix: "0",
patterns: [{
match: "(1)(\\d{7})",
replace: "$1 $2",
nationalFormat: "(0$1)",
leadingDigitPattern: "1"
}, {
match: "([4-8]\\d)(\\d{6})",
replace: "$1 $2",
nationalFormat: "(0$1)",
leadingDigitPattern: "[4-7]|8[2-4]"
}, {
match: "(\\d{3})(\\d{5})",
replace: "$1 $2",
nationalFormat: "(0$1)",
leadingDigitPattern: "80"
}, {
match: "(9\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "9"
}]
},
PF: {
isoCode: "PF",
dialCode: "689",
patterns: [{
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "4[09]|8[79]"
}, {
match: "(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3",
leadingDigitPattern: "44"
}]
},
PG: {
isoCode: "PG",
dialCode: "675",
patterns: [{
match: "(\\d{3})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "[13-689]|27"
}, {
match: "(\\d{4})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "20|7"
}]
},
PH: {
isoCode: "PH",
dialCode: "63",
nationalPrefix: "0",
patterns: [{
match: "(2)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "(0$1)",
leadingDigitPattern: "2"
}, {
match: "(2)(\\d{5})",
replace: "$1 $2",
nationalFormat: "(0$1)",
leadingDigitPattern: "2"
}, {
match: "(\\d{4})(\\d{4,6})",
replace: "$1 $2",
nationalFormat: "(0$1)",
leadingDigitPattern: "3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"
}, {
match: "(\\d{5})(\\d{4})",
replace: "$1 $2",
nationalFormat: "(0$1)",
leadingDigitPattern: "3469|4(?:279|9(?:30|56))|8834"
}, {
match: "([3-8]\\d)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "(0$1)",
leadingDigitPattern: "[3-8]"
}, {
match: "(\\d{3})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "81|9"
}, {
match: "(1800)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "1"
}, {
match: "(1800)(\\d{1,2})(\\d{3})(\\d{4})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "1"
}]
},
PK: {
isoCode: "PK",
dialCode: "92",
nationalPrefix: "0",
patterns: [{
match: "([89]00)(\\d{3})(\\d{2})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[89]00"
}, {
match: "(1\\d{3})(\\d{5})",
replace: "$1 $2",
nationalFormat: "$1",
leadingDigitPattern: "1"
}, {
match: "(\\d{2})(\\d{7,8})",
replace: "$1 $2",
nationalFormat: "(0$1)",
leadingDigitPattern: "(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"
}, {
match: "(\\d{3})(\\d{6,7})",
replace: "$1 $2",
nationalFormat: "(0$1)",
leadingDigitPattern: "(?:2[349]|45|54|60|72|8[2-5]|9[2-469])\\d[2-9]"
}, {
match: "(58\\d{3})(\\d{5})",
replace: "$1 $2",
nationalFormat: "(0$1)",
leadingDigitPattern: "58[126]"
}, {
match: "(3\\d{2})(\\d{7})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "3"
}, {
match: "(\\d{2})(111)(\\d{3})(\\d{3})",
replace: "$1 $2 $3 $4",
nationalFormat: "(0$1)",
leadingDigitPattern: "(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)111"
}, {
match: "(\\d{3})(111)(\\d{3})(\\d{3})",
replace: "$1 $2 $3 $4",
nationalFormat: "(0$1)",
leadingDigitPattern: "(?:2[349]|45|54|60|72|8[2-5]|9[2-9])\\d111"
}]
},
PL: {
isoCode: "PL",
dialCode: "48",
patterns: [{
match: "(\\d{3})(\\d{3})",
replace: "$1 $2",
leadingDigitPattern: "11[68]|64"
}, {
match: "(\\d{5})",
replace: "$1",
leadingDigitPattern: "19"
}, {
match: "(\\d{2})(\\d{2})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145]"
}, {
match: "(\\d{3})(\\d{2})(\\d{2,3})",
replace: "$1 $2 $3",
leadingDigitPattern: "64"
}, {
match: "(\\d{3})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "26|39|45|5[0137]|6[0469]|7[02389]|8[08]"
}, {
match: "(\\d{2})(\\d{3})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "[14]|2[0-57-9]|3[2-4]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145]"
}]
},
PM: {
isoCode: "PM",
dialCode: "508",
nationalPrefix: "0",
patterns: [{
match: "([45]\\d)(\\d{2})(\\d{2})",
replace: "$1 $2 $3",
nationalFormat: "0$1"
}]
},
PR: {
isoCode: "PR",
dialCode: "1787|939",
countryDialCode: "1",
regionCode: "787|939",
areaCodes: ["787", "939"],
nationalPrefix: "1",
priority: 1,
patternRegion: "PR"
},
PS: {
isoCode: "PS",
dialCode: "970",
nationalPrefix: "0",
patterns: [{
match: "([2489])(2\\d{2})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[2489]"
}, {
match: "(5[69]\\d)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "5"
}, {
match: "(1[78]00)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "1"
}]
},
PT: {
isoCode: "PT",
dialCode: "351",
patterns: [{
match: "(2\\d)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "2[12]"
}, {
match: "([2-46-9]\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "2[3-9]|[346-9]"
}]
},
PW: {
isoCode: "PW",
dialCode: "680",
patterns: [{
match: "(\\d{3})(\\d{4})",
replace: "$1 $2"
}]
},
PY: {
isoCode: "PY",
dialCode: "595",
nationalPrefix: "0",
patterns: [{
match: "(\\d{2})(\\d{5})",
replace: "$1 $2",
nationalFormat: "(0$1)",
leadingDigitPattern: "[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36]"
}, {
match: "(\\d{2})(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "(0$1)",
leadingDigitPattern: "[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36]"
}, {
match: "(\\d{3})(\\d{3,6})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "[2-9]0"
}, {
match: "(\\d{3})(\\d{6})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "9[1-9]"
}, {
match: "(\\d{2})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "8700"
}, {
match: "(\\d{3})(\\d{4,5})",
replace: "$1 $2",
nationalFormat: "(0$1)",
leadingDigitPattern: "[2-8][1-9]"
}, {
match: "(\\d{3})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[2-8][1-9]"
}]
},
QA: {
isoCode: "QA",
dialCode: "974",
patterns: [{
match: "([28]\\d{2})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "[28]"
}, {
match: "([3-7]\\d{3})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "[3-7]"
}]
},
RE: {
isoCode: "RE",
dialCode: "262262|69|8",
countryDialCode: "262",
regionCode: "262|69|8",
nationalPrefix: "0",
patterns: [{
match: "([268]\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1"
}]
},
RO: {
isoCode: "RO",
dialCode: "40",
nationalPrefix: "0",
patterns: [{
match: "(\\d{2})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[23]1"
}, {
match: "(\\d{2})(\\d{4})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "[23]1"
}, {
match: "(\\d{3})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[23][3-7]|[7-9]"
}, {
match: "(2\\d{2})(\\d{3})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "2[3-6]"
}]
},
RS: {
isoCode: "RS",
dialCode: "381",
nationalPrefix: "0",
patterns: [{
match: "([23]\\d{2})(\\d{4,9})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "(?:2[389]|39)0"
}, {
match: "([1-3]\\d)(\\d{5,10})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "1|2(?:[0-24-7]|[389][1-9])|3(?:[0-8]|9[1-9])"
}, {
match: "(6\\d)(\\d{6,8})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "6"
}, {
match: "([89]\\d{2})(\\d{3,9})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "[89]"
}, {
match: "(7[26])(\\d{4,9})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "7[26]"
}, {
match: "(7[08]\\d)(\\d{4,9})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "7[08]"
}]
},
RU: {
isoCode: "RU",
dialCode: "7",
nationalPrefix: "8",
patterns: [{
match: "(\\d{3})(\\d{2})(\\d{2})",
replace: "$1-$2-$3",
nationalFormat: "$1",
leadingDigitPattern: "[1-79]"
}, {
match: "([3489]\\d{2})(\\d{3})(\\d{2})(\\d{2})",
replace: "$1 $2-$3-$4",
nationalFormat: "8 ($1)",
leadingDigitPattern: "[34689]"
}, {
match: "(7\\d{2})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "8 ($1)",
leadingDigitPattern: "7"
}],
internationalPatterns: [{
match: "([3489]\\d{2})(\\d{3})(\\d{2})(\\d{2})",
replace: "$1 $2-$3-$4",
nationalFormat: "8 ($1)",
leadingDigitPattern: "[34689]"
}, {
match: "(7\\d{2})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "8 ($1)",
leadingDigitPattern: "7"
}],
priority: 10
},
RW: {
isoCode: "RW",
dialCode: "250",
nationalPrefix: "0",
patterns: [{
match: "(2\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "2"
}, {
match: "([7-9]\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[7-9]"
}, {
match: "(0\\d)(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "0"
}]
},
SA: {
isoCode: "SA",
dialCode: "966",
nationalPrefix: "0",
patterns: [{
match: "([1-467])(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[1-467]"
}, {
match: "(1\\d)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "1[1-467]"
}, {
match: "(5\\d)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "5"
}, {
match: "(92\\d{2})(\\d{5})",
replace: "$1 $2",
nationalFormat: "$1",
leadingDigitPattern: "92"
}, {
match: "(800)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "80"
}, {
match: "(811)(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "81"
}]
},
SB: {
isoCode: "SB",
dialCode: "677",
patterns: [{
match: "(\\d{2})(\\d{5})",
replace: "$1 $2",
leadingDigitPattern: "[7-9]"
}]
},
SC: {
isoCode: "SC",
dialCode: "248",
patterns: [{
match: "(\\d)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "[246]"
}]
},
SD: {
isoCode: "SD",
dialCode: "249",
nationalPrefix: "0",
patterns: [{
match: "(\\d{2})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1"
}]
},
SE: {
isoCode: "SE",
dialCode: "46",
nationalPrefix: "0",
patterns: [{
match: "(8)(\\d{2,3})(\\d{2,3})(\\d{2})",
replace: "$1-$2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "8"
}, {
match: "([1-69]\\d)(\\d{2,3})(\\d{2})(\\d{2})",
replace: "$1-$2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "1[013689]|2[0136]|3[1356]|4[0246]|54|6[03]|90"
}, {
match: "([1-469]\\d)(\\d{3})(\\d{2})",
replace: "$1-$2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[12][136]|3[356]|4[0246]|6[03]|90"
}, {
match: "(\\d{3})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1-$2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[0-5]|4[0-3])"
}, {
match: "(\\d{3})(\\d{2,3})(\\d{2})",
replace: "$1-$2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[0-5]|4[0-3])"
}, {
match: "(7\\d)(\\d{3})(\\d{2})(\\d{2})",
replace: "$1-$2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "7"
}, {
match: "(77)(\\d{2})(\\d{2})",
replace: "$1-$2$3",
nationalFormat: "0$1",
leadingDigitPattern: "7"
}, {
match: "(20)(\\d{2,3})(\\d{2})",
replace: "$1-$2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "20"
}, {
match: "(9[034]\\d)(\\d{2})(\\d{2})(\\d{3})",
replace: "$1-$2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "9[034]"
}, {
match: "(9[034]\\d)(\\d{4})",
replace: "$1-$2",
nationalFormat: "0$1",
leadingDigitPattern: "9[034]"
}, {
match: "(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})",
replace: "$1-$2 $3 $4 $5",
nationalFormat: "0$1",
leadingDigitPattern: "25[245]|67[3-6]"
}],
internationalPatterns: [{
match: "(8)(\\d{2,3})(\\d{2,3})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "8"
}, {
match: "([1-69]\\d)(\\d{2,3})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "1[013689]|2[0136]|3[1356]|4[0246]|54|6[03]|90"
}, {
match: "([1-469]\\d)(\\d{3})(\\d{2})",
replace: "$1 $2 $3",
leadingDigitPattern: "[12][136]|3[356]|4[0246]|6[03]|90"
}, {
match: "(\\d{3})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[0-5]|4[0-3])"
}, {
match: "(\\d{3})(\\d{2,3})(\\d{2})",
replace: "$1 $2 $3",
leadingDigitPattern: "1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[0-5]|4[0-3])"
}, {
match: "(7\\d)(\\d{3})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "7"
}, {
match: "(77)(\\d{2})(\\d{2})",
replace: "$1 $2 $3",
leadingDigitPattern: "7"
}, {
match: "(20)(\\d{2,3})(\\d{2})",
replace: "$1 $2 $3",
leadingDigitPattern: "20"
}, {
match: "(9[034]\\d)(\\d{2})(\\d{2})(\\d{3})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "9[034]"
}, {
match: "(9[034]\\d)(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "9[034]"
}, {
match: "(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4 $5",
leadingDigitPattern: "25[245]|67[3-6]"
}]
},
SG: {
isoCode: "SG",
dialCode: "65",
patterns: [{
match: "([3689]\\d{3})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "[369]|8[1-9]"
}, {
match: "(1[89]00)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "1[89]"
}, {
match: "(7000)(\\d{4})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "70"
}, {
match: "(800)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "80"
}]
},
SH: {
isoCode: "SH",
dialCode: "290",
priority: 10,
patternRegion: "SH"
},
SI: {
isoCode: "SI",
dialCode: "386",
nationalPrefix: "0",
patterns: [{
match: "(\\d)(\\d{3})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "(0$1)",
leadingDigitPattern: "[12]|[34][24-8]|5[2-8]|7[3-8]"
}, {
match: "([3-7]\\d)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[37][01]|4[0139]|51|6"
}, {
match: "([89][09])(\\d{3,6})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "[89][09]"
}, {
match: "([58]\\d{2})(\\d{5})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "59|8[1-3]"
}]
},
SJ: {
isoCode: "SJ",
dialCode: "47",
priority: 1,
patternRegion: "NO"
},
SK: {
isoCode: "SK",
dialCode: "421",
nationalPrefix: "0",
patterns: [{
match: "(2)(1[67])(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "21[67]"
}, {
match: "([3-5]\\d)(1[67])(\\d{2,3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[3-5]"
}, {
match: "(2)(\\d{3})(\\d{3})(\\d{2})",
replace: "$1/$2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "2"
}, {
match: "([3-5]\\d)(\\d{3})(\\d{2})(\\d{2})",
replace: "$1/$2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "[3-5]"
}, {
match: "([689]\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[689]"
}, {
match: "(9090)(\\d{3})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "9090"
}]
},
SL: {
isoCode: "SL",
dialCode: "232",
nationalPrefix: "0",
patterns: [{
match: "(\\d{2})(\\d{6})",
replace: "$1 $2",
nationalFormat: "(0$1)"
}]
},
SM: {
isoCode: "SM",
dialCode: "378",
patterns: [{
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "[5-7]"
}, {
match: "(0549)(\\d{6})",
replace: "$1 $2",
leadingDigitPattern: "0"
}, {
match: "(\\d{6})",
replace: "0549 $1",
leadingDigitPattern: "[89]"
}],
internationalPatterns: [{
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "[5-7]"
}, {
match: "(0549)(\\d{6})",
replace: "($1) $2",
leadingDigitPattern: "0"
}, {
match: "(\\d{6})",
replace: "(0549) $1",
leadingDigitPattern: "[89]"
}]
},
SN: {
isoCode: "SN",
dialCode: "221",
patterns: [{
match: "(\\d{2})(\\d{3})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "[379]"
}, {
match: "(\\d{3})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "8"
}]
},
SO: {
isoCode: "SO",
dialCode: "252",
nationalPrefix: "0",
patterns: [{
match: "(\\d{6})",
replace: "$1",
leadingDigitPattern: "[134]"
}, {
match: "(\\d)(\\d{6})",
replace: "$1 $2",
leadingDigitPattern: "[13-5]|2[0-79]"
}, {
match: "(\\d)(\\d{7})",
replace: "$1 $2",
leadingDigitPattern: "24|[67]"
}, {
match: "(\\d{2})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "8[125]"
}, {
match: "(\\d{2})(\\d{5,7})",
replace: "$1 $2",
leadingDigitPattern: "15|28|6[1-35-9]|799|9[2-9]"
}, {
match: "(\\d{3})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "3[59]|4[89]|6[24-6]|79|8[08]|90"
}]
},
SR: {
isoCode: "SR",
dialCode: "597",
patterns: [{
match: "(\\d{3})(\\d{3})",
replace: "$1-$2",
leadingDigitPattern: "[2-4]|5[2-58]"
}, {
match: "(\\d{2})(\\d{2})(\\d{2})",
replace: "$1-$2-$3",
leadingDigitPattern: "56"
}, {
match: "(\\d{3})(\\d{4})",
replace: "$1-$2",
leadingDigitPattern: "[6-8]"
}]
},
SS: {
isoCode: "SS",
dialCode: "211",
nationalPrefix: "0",
patterns: [{
match: "(\\d{3})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1"
}]
},
ST: {
isoCode: "ST",
dialCode: "239",
patterns: [{
match: "(\\d{3})(\\d{4})",
replace: "$1 $2"
}]
},
SV: {
isoCode: "SV",
dialCode: "503",
patterns: [{
match: "(\\d{4})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "[267]"
}, {
match: "(\\d{3})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "[89]"
}, {
match: "(\\d{3})(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
leadingDigitPattern: "[89]"
}]
},
SX: {
isoCode: "SX",
dialCode: "1721",
countryDialCode: "1",
regionCode: "721",
nationalPrefix: "1"
},
SY: {
isoCode: "SY",
dialCode: "963",
nationalPrefix: "0",
patterns: [{
match: "(\\d{2})(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[1-5]"
}, {
match: "(9\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "9"
}]
},
SZ: {
isoCode: "SZ",
dialCode: "268",
patterns: [{
match: "(\\d{4})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "[027]"
}]
},
TA: {
isoCode: "TA",
dialCode: "290",
priority: 1,
patternRegion: "SH"
},
TC: {
isoCode: "TC",
dialCode: "1649",
countryDialCode: "1",
regionCode: "649",
nationalPrefix: "1"
},
TD: {
isoCode: "TD",
dialCode: "235",
patterns: [{
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4"
}]
},
TG: {
isoCode: "TG",
dialCode: "228",
patterns: [{
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
leadingDigitPattern: "[29]"
}]
},
TH: {
isoCode: "TH",
dialCode: "66",
nationalPrefix: "0",
patterns: [{
match: "(2)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "2"
}, {
match: "([13-9]\\d)(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "14|[3-9]"
}, {
match: "(1[89]00)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "1"
}]
},
TJ: {
isoCode: "TJ",
dialCode: "992",
nationalPrefix: "8",
patterns: [{
match: "([349]\\d{2})(\\d{2})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "[34]7|91[78]"
}, {
match: "([457-9]\\d)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "4[148]|[578]|9(?:[0235-9]|1[59])"
}, {
match: "(331700)(\\d)(\\d{2})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "331700"
}, {
match: "(\\d{4})(\\d)(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "$1",
leadingDigitPattern: "3(?:[1245]|3(?:[02-9]|1[0-589]))"
}]
},
TK: {
isoCode: "TK",
dialCode: "690"
},
TL: {
isoCode: "TL",
dialCode: "670",
patterns: [{
match: "(\\d{3})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "[2-489]|70"
}, {
match: "(\\d{4})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "7[3-8]"
}]
},
TM: {
isoCode: "TM",
dialCode: "993",
nationalPrefix: "8",
patterns: [{
match: "(\\d{2})(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2-$3-$4",
nationalFormat: "(8 $1)",
leadingDigitPattern: "12"
}, {
match: "(\\d{2})(\\d{6})",
replace: "$1 $2",
nationalFormat: "8 $1",
leadingDigitPattern: "6"
}, {
match: "(\\d{3})(\\d)(\\d{2})(\\d{2})",
replace: "$1 $2-$3-$4",
nationalFormat: "(8 $1)",
leadingDigitPattern: "13|[2-5]"
}]
},
TN: {
isoCode: "TN",
dialCode: "216",
patterns: [{
match: "(\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3"
}]
},
TO: {
isoCode: "TO",
dialCode: "676",
patterns: [{
match: "(\\d{2})(\\d{3})",
replace: "$1-$2",
leadingDigitPattern: "[1-6]|7[0-4]|8[05]"
}, {
match: "(\\d{3})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "7[5-9]|8[47-9]"
}, {
match: "(\\d{4})(\\d{3})",
replace: "$1 $2",
leadingDigitPattern: "0"
}]
},
TR: {
isoCode: "TR",
dialCode: "90",
nationalPrefix: "0",
patterns: [{
match: "(\\d{3})(\\d{3})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "(0$1)",
leadingDigitPattern: "[23]|4(?:[0-35-9]|4[0-35-9])"
}, {
match: "(\\d{3})(\\d{3})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "5[02-69]"
}, {
match: "(\\d{3})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "51|[89]"
}, {
match: "(444)(\\d{1})(\\d{3})",
replace: "$1 $2 $3",
leadingDigitPattern: "444"
}]
},
TT: {
isoCode: "TT",
dialCode: "1868",
countryDialCode: "1",
regionCode: "868",
nationalPrefix: "1"
},
TV: {
isoCode: "TV",
dialCode: "688"
},
TW: {
isoCode: "TW",
dialCode: "886",
nationalPrefix: "0",
patterns: [{
match: "(20)(\\d)(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "202"
}, {
match: "([258]0)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "20[013-9]|50[0-46-9]|80[0-79]"
}, {
match: "([2-8])(\\d{3,4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[25][2-8]|[346]|[78][1-9]"
}, {
match: "(9\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "9"
}, {
match: "(70)(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "70"
}]
},
TZ: {
isoCode: "TZ",
dialCode: "255",
nationalPrefix: "0",
patterns: [{
match: "([24]\\d)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[24]"
}, {
match: "([67]\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[67]"
}, {
match: "([89]\\d{2})(\\d{2})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[89]"
}]
},
UA: {
isoCode: "UA",
dialCode: "380",
nationalPrefix: "0",
patterns: [{
match: "([3-9]\\d)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[38]9|4(?:[45][0-5]|87)|5(?:0|6(?:3[14-7]|7)|7[37])|6[36-8]|7|9[1-9]"
}, {
match: "([3-689]\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "3(?:[1-46-8]2[013-9]|52)|4(?:[1378]2|62[013-9])|5(?:[12457]2|6[24])|6(?:[12][29]|[49]2|5[24])|8[0-8]|90"
}, {
match: "([3-6]\\d{3})(\\d{5})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "3(?:[1-46-8](?:[013-9]|22)|5[013-9])|4(?:[137][013-9]|[45][6-9]|6(?:[013-9]|22)|8[4-6])|5(?:[1245][013-9]|3|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][13-8]|[49][013-9]|5[0135-9])"
}]
},
UG: {
isoCode: "UG",
dialCode: "256",
nationalPrefix: "0",
patterns: [{
match: "(\\d{3})(\\d{6})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "20(?:[013-8]|2[5-9])|4(?:6[45]|[7-9])|[7-9]"
}, {
match: "(\\d{2})(\\d{7})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "3|4(?:[1-5]|6[0-36-9])"
}, {
match: "(2024)(\\d{5})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "2024"
}]
},
US: {
isoCode: "US",
dialCode: "1",
nationalPrefix: "1",
patterns: [{
match: "(\\d{3})(\\d{4})",
replace: "$1-$2"
}, {
match: "(\\d{3})(\\d{3})(\\d{4})",
replace: "($1) $2-$3"
}],
internationalPatterns: [{
match: "(\\d{3})(\\d{3})(\\d{4})",
replace: "$1-$2-$3"
}],
priority: 10
},
UY: {
isoCode: "UY",
dialCode: "598",
nationalPrefix: "0",
patterns: [{
match: "(\\d{4})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "[24]"
}, {
match: "(\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "9[1-9]"
}, {
match: "(\\d{3})(\\d{4})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "[89]0"
}]
},
UZ: {
isoCode: "UZ",
dialCode: "998",
nationalPrefix: "8",
patterns: [{
match: "([679]\\d)(\\d{3})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "8 $1"
}]
},
VA: {
isoCode: "VA",
dialCode: "39",
priority: 1,
patternRegion: "IT"
},
VC: {
isoCode: "VC",
dialCode: "1784",
countryDialCode: "1",
regionCode: "784",
nationalPrefix: "1"
},
VE: {
isoCode: "VE",
dialCode: "58",
nationalPrefix: "0",
patterns: [{
match: "(\\d{3})(\\d{7})",
replace: "$1-$2",
nationalFormat: "0$1"
}]
},
VG: {
isoCode: "VG",
dialCode: "1284",
countryDialCode: "1",
regionCode: "284",
nationalPrefix: "1"
},
VI: {
isoCode: "VI",
dialCode: "1340",
countryDialCode: "1",
regionCode: "340",
nationalPrefix: "1"
},
VN: {
isoCode: "VN",
dialCode: "84",
nationalPrefix: "0",
patterns: [{
match: "([17]99)(\\d{4})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "[17]99"
}, {
match: "(\\d{2})(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "2[48]"
}, {
match: "(80)(\\d{5})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "80"
}, {
match: "(69\\d)(\\d{4,5})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "69"
}, {
match: "(\\d{3})(\\d{4})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "2[0-35-79]"
}, {
match: "([89]\\d)(\\d{3})(\\d{2})(\\d{2})",
replace: "$1 $2 $3 $4",
nationalFormat: "0$1",
leadingDigitPattern: "8(?:8|9[89])|9"
}, {
match: "(1[2689]\\d)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "1(?:[26]|8[68]|99)"
}, {
match: "(86[89])(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "86[89]"
}, {
match: "(1[89]00)(\\d{4,6})",
replace: "$1 $2",
nationalFormat: "$1",
leadingDigitPattern: "1[89]0"
}]
},
VU: {
isoCode: "VU",
dialCode: "678",
patterns: [{
match: "(\\d{3})(\\d{4})",
replace: "$1 $2",
leadingDigitPattern: "[579]"
}]
},
WF: {
isoCode: "WF",
dialCode: "681",
patterns: [{
match: "(\\d{2})(\\d{2})(\\d{2})",
replace: "$1 $2 $3"
}]
},
WS: {
isoCode: "WS",
dialCode: "685",
patterns: [{
match: "(8\\d{2})(\\d{3,4})",
replace: "$1 $2",
leadingDigitPattern: "8"
}, {
match: "(7\\d)(\\d{5})",
replace: "$1 $2",
leadingDigitPattern: "7"
}, {
match: "(\\d{5})",
replace: "$1",
leadingDigitPattern: "[2-6]"
}]
},
YE: {
isoCode: "YE",
dialCode: "967",
nationalPrefix: "0",
patterns: [{
match: "([1-7])(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[1-6]|7[24-68]"
}, {
match: "(7\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "7[0137]"
}]
},
YT: {
isoCode: "YT",
dialCode: "262269|63",
countryDialCode: "262",
regionCode: "269|63",
nationalPrefix: "0"
},
ZA: {
isoCode: "ZA",
dialCode: "27",
nationalPrefix: "0",
patterns: [{
match: "(860)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "860"
}, {
match: "(\\d{2})(\\d{3,4})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "8[1-4]"
}, {
match: "(\\d{2})(\\d{3})(\\d{2,3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "8[1-4]"
}, {
match: "(\\d{2})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[1-79]|8(?:[0-57]|6[1-9])"
}]
},
ZM: {
isoCode: "ZM",
dialCode: "260",
nationalPrefix: "0",
patterns: [{
match: "([29]\\d)(\\d{7})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "[29]"
}, {
match: "(800)(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "8"
}]
},
ZW: {
isoCode: "ZW",
dialCode: "263",
nationalPrefix: "0",
patterns: [{
match: "([49])(\\d{3})(\\d{2,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "4|9[2-9]"
}, {
match: "(7\\d)(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "7"
}, {
match: "(86\\d{2})(\\d{3})(\\d{3})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "86[24]"
}, {
match: "([2356]\\d{2})(\\d{3,5})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "2(?:0[45]|2[278]|[49]8|[78])|3(?:[09]8|17|3[78]|7[1569]|8[37])|5[15][78]|6(?:[29]8|37|[68][78]|75)"
}, {
match: "(\\d{3})(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "2(?:1[39]|2[0157]|31|[56][14]|7[35]|84)|329"
}, {
match: "([1-356]\\d)(\\d{3,5})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "1[3-9]|2[02569]|3[0-69]|5[05689]|6"
}, {
match: "([235]\\d)(\\d{3})(\\d{3,4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "[23]9|54"
}, {
match: "([25]\\d{3})(\\d{3,5})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "258[23]|5483"
}, {
match: "(8\\d{3})(\\d{6})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "86"
}, {
match: "(80\\d)(\\d{4})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "80"
}]
},
UK: {
isoCode: "GB",
dialCode: "44",
nationalPrefix: "0",
patterns: [{
match: "(7\\d{3})(\\d{6})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "7(?:[1-57-9]|624)"
}, {
match: "(\\d{2})(\\d{4})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "2|5[56]|7[06]"
}, {
match: "(\\d{3})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "1(?:[02-9]1|1)|3|9[018]"
}, {
match: "(\\d{5})(\\d{4,5})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"
}, {
match: "(1\\d{3})(\\d{5,6})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "1"
}, {
match: "(800)(\\d{4})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "8001111"
}, {
match: "(845)(46)(4\\d)",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "845464"
}, {
match: "(8\\d{2})(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "8(?:4[2-5]|7[0-3])"
}, {
match: "(80\\d)(\\d{3})(\\d{4})",
replace: "$1 $2 $3",
nationalFormat: "0$1",
leadingDigitPattern: "80"
}, {
match: "([58]00)(\\d{6})",
replace: "$1 $2",
nationalFormat: "0$1",
leadingDigitPattern: "[58]00"
}],
priority: 10
}
}
, s = {
1: ["US", "CA", "UM"],
7: ["RU", "KZ"],
20: ["EG"],
27: ["ZA"],
30: ["GR"],
31: ["NL"],
32: ["BE"],
33: ["FR"],
34: ["ES"],
36: ["HU"],
39: ["IT", "VA"],
40: ["RO"],
41: ["CH"],
43: ["AT"],
44: ["GB", "JE", "IM", "GG"],
45: ["DK"],
46: ["SE"],
47: ["NO", "SJ", "BV"],
48: ["PL"],
49: ["DE"],
51: ["PE"],
52: ["MX"],
53: ["CU"],
54: ["AR"],
55: ["BR"],
56: ["CL"],
57: ["CO"],
58: ["VE"],
60: ["MY"],
61: ["AU", "CX", "CC", "HM"],
62: ["ID"],
63: ["PH"],
64: ["NZ", "PN"],
65: ["SG"],
66: ["TH"],
81: ["JP"],
82: ["KR"],
84: ["VN"],
86: ["CN"],
90: ["TR"],
91: ["IN"],
92: ["PK"],
93: ["AF"],
94: ["LK"],
95: ["MM"],
98: ["IR"],
211: ["SS"],
212: ["MA"],
213: ["DZ"],
216: ["TN"],
218: ["LY"],
220: ["GM"],
221: ["SN"],
222: ["MR"],
223: ["ML"],
224: ["GN"],
225: ["CI"],
226: ["BF"],
227: ["NE"],
228: ["TG"],
229: ["BJ"],
230: ["MU"],
231: ["LR"],
232: ["SL"],
233: ["GH"],
234: ["NG"],
235: ["TD"],
236: ["CF"],
237: ["CM"],
238: ["CV"],
239: ["ST"],
240: ["GQ"],
241: ["GA"],
242: ["CG"],
243: ["CD"],
244: ["AO"],
245: ["GW"],
246: ["IO"],
247: ["AC"],
248: ["SC"],
249: ["SD"],
250: ["RW"],
251: ["ET"],
252: ["SO"],
253: ["DJ"],
254: ["KE"],
255: ["TZ"],
256: ["UG"],
257: ["BI"],
258: ["MZ"],
260: ["ZM"],
261: ["MG"],
262: ["TF"],
263: ["ZW"],
264: ["NA"],
265: ["MW"],
266: ["LS"],
267: ["BW"],
268: ["SZ"],
269: ["KM"],
290: ["SH", "TA"],
291: ["ER"],
297: ["AW"],
298: ["FO"],
299: ["GL"],
350: ["GI"],
351: ["PT"],
352: ["LU"],
353: ["IE"],
354: ["IS"],
355: ["AL"],
356: ["MT"],
357: ["CY"],
358: ["FI", "AX"],
359: ["BG"],
370: ["LT"],
371: ["LV"],
372: ["EE"],
373: ["MD"],
374: ["AM"],
375: ["BY"],
376: ["AD"],
377: ["MC"],
378: ["SM"],
380: ["UA"],
381: ["RS"],
382: ["ME"],
383: ["KV"],
385: ["HR"],
386: ["SI"],
387: ["BA"],
389: ["MK"],
420: ["CZ"],
421: ["SK"],
423: ["LI"],
500: ["FK", "GS"],
501: ["BZ"],
502: ["GT"],
503: ["SV"],
504: ["HN"],
505: ["NI"],
506: ["CR"],
507: ["PA"],
508: ["PM"],
509: ["HT"],
590: ["GP", "MF", "BL"],
591: ["BO"],
592: ["GY"],
593: ["EC"],
594: ["GF"],
595: ["PY"],
596: ["MQ"],
597: ["SR"],
598: ["UY"],
599: ["CW", "BQ"],
670: ["TL"],
672: ["NF"],
673: ["BN"],
674: ["NR"],
675: ["PG"],
676: ["TO"],
677: ["SB"],
678: ["VU"],
679: ["FJ"],
680: ["PW"],
681: ["WF"],
682: ["CK"],
683: ["NU"],
685: ["WS"],
686: ["KI"],
687: ["NC"],
688: ["TV"],
689: ["PF"],
690: ["TK"],
691: ["FM"],
692: ["MH"],
850: ["KP"],
852: ["HK"],
853: ["MO"],
855: ["KH"],
856: ["LA"],
880: ["BD"],
886: ["TW"],
960: ["MV"],
961: ["LB"],
962: ["JO"],
963: ["SY"],
964: ["IQ"],
965: ["KW"],
966: ["SA"],
967: ["YE"],
968: ["OM"],
970: ["PS"],
971: ["AE"],
972: ["IL"],
973: ["BH"],
974: ["QA"],
975: ["BT"],
976: ["MN"],
977: ["NP"],
992: ["TJ"],
993: ["TM"],
994: ["AZ"],
995: ["GE"],
996: ["KG"],
998: ["UZ"],
1204: ["CA"],
1236: ["CA"],
1242: ["BS"],
1246: ["BB"],
1249: ["CA"],
1250: ["CA"],
1264: ["AI"],
1268: ["AG"],
1284: ["VG"],
1289: ["CA"],
1306: ["CA"],
1340: ["VI"],
1343: ["CA"],
1345: ["KY"],
1365: ["CA"],
1387: ["CA"],
1403: ["CA"],
1416: ["CA"],
1418: ["CA"],
1431: ["CA"],
1437: ["CA"],
1438: ["CA"],
1441: ["BM"],
1450: ["CA"],
1473: ["GD"],
1506: ["CA"],
1514: ["CA"],
1519: ["CA"],
1548: ["CA"],
1579: ["CA"],
1581: ["CA"],
1587: ["CA"],
1604: ["CA"],
1613: ["CA"],
1639: ["CA"],
1647: ["CA"],
1649: ["TC"],
1664: ["MS"],
1670: ["MP"],
1671: ["GU"],
1672: ["CA"],
1684: ["AS"],
1705: ["CA"],
1709: ["CA"],
1721: ["SX"],
1742: ["CA"],
1758: ["LC"],
1767: ["DM"],
1778: ["CA"],
1780: ["CA"],
1782: ["CA"],
1784: ["VC"],
1807: ["CA"],
1819: ["CA"],
1825: ["CA"],
1867: ["CA"],
1868: ["TT"],
1869: ["KN"],
1873: ["CA"],
1876: ["JM"],
1902: ["CA"],
1905: ["CA"]
}
},
"./components/phone-input/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/react/index.js")
, s = a.n(n)
, r = a("../node_modules/lodash-es/find.js")
, i = a("../node_modules/classnames/index.js")
, o = a.n(i)
, c = a("../packages/i18n-calypso/dist/esm/index.js")
, l = a("../node_modules/prop-types/index.js")
, d = a.n(l)
, u = a("../node_modules/debug/src/browser.js")
, p = a.n(u)
, m = a("./components/forms/form-country-select/index.jsx")
, h = a("./components/phone-input/phone-number.js")
, g = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, b = a.n(g)
, f = a("./components/gridicon/index.tsx")
, _ = a("./components/spinner/index.jsx")
, y = a("./lib/flags/index.js");
class j extends s.a.Component {
constructor(...e) {
super(...e),
b()(this, "state", {
ready: !1,
error: !1
}),
b()(this, "renderSpinner", ()=>{
if (!(this.props.countryCode && this.state.ready || this.state.error))
return s.a.createElement(_.a, {
size: 16,
className: "phone-input__flag-spinner"
})
}
),
b()(this, "handleImageLoad", ()=>{
this.setState({
ready: !0,
error: !1
})
}
),
b()(this, "handleImageError", ()=>{
this.setState({
ready: !1,
error: !0
})
}
),
b()(this, "renderFlag", ()=>{
const e = this.state.ready ? {} : {
visibility: "hidden"
}
, {countryCode: t} = this.props;
if (t)
return this.state.error ? s.a.createElement(f.a, {
icon: "globe",
size: 24,
className: "phone-input__flag-icon"
}) : s.a.createElement("img", {
alt: "",
onLoad: this.handleImageLoad,
onError: this.handleImageError,
src: Object(y.a)(t),
className: "phone-input__flag-icon",
style: e
})
}
)
}
componentDidUpdate(e) {
this.props.countryCode && this.props.countryCode !== e.countryCode && this.setState({
ready: !1,
error: !1
})
}
render() {
return s.a.createElement("div", {
className: "phone-input__flag-container"
}, this.renderSpinner(), this.renderFlag(), s.a.createElement(f.a, {
icon: "chevron-down",
size: 12,
className: "phone-input__flag-selector-icon"
}))
}
}
b()(j, "displayName", "PhoneInputCountryFlag"),
b()(j, "propTypes", {
countryCode: d.a.string.isRequired
});
var v = a("./components/phone-input/data.js");
a("./components/phone-input/style.scss");
const E = p()("calypso:phone-input");
function $({translate: e, inputRef: t, onChange: a, className: r, isError: i, disabled: c, name: l, value: d, countryCode: u, countriesList: p, enableStickyCountry: g=!0}) {
const [b,f] = Object(n.useState)(g)
, [_,y] = function(e, t, a, s) {
const r = Object(n.useRef)(e)
, i = Object(n.useRef)(t)
, [o,c] = Object(n.useState)(()=>C(e, t, a, s))
, {rawValue: l, displayValue: d} = o;
return Object(n.useEffect)(()=>{
if (r.current === e && i.current === t)
return void E("props change did not change value or country");
const n = Object(h.f)(d, v.a[t]);
if (i.current === t && (e === l || e === d || e === n))
return void E("props change did not change normalized value", e);
r.current = e,
i.current = t;
const o = C(e, t, a, s);
E("props changed, updating value; ", {
rawValue: l,
displayValue: d,
icannValue: n,
value: e,
countryCode: t,
oldCountry: i.current,
newState: o
}),
c(o)
}
, [l, d, e, t, a, s]),
[o, c]
}(d, u, p, b)
, {displayValue: $} = _
, w = function(e) {
const t = Object(n.useRef)();
return Object(n.useEffect)(()=>{
e && ("function" == typeof e ? e(t.current) : e.current = t.current)
}
, [e]),
t
}(t)
, k = Object(n.useRef)([]);
!function(e, t, a, s) {
const r = Object(n.useRef)(e)
, i = Object(n.useRef)(t);
Object(n.useEffect)(()=>{
const n = function(e) {
const t = e.length;
let a = t - 1;
if (0 === t)
return 0;
t >= 2 ? a = t - 2 : t >= 1 && (a = t - 1);
return e[a]
}(s.current);
if (!a.current)
return;
if (e === r.current && t === i.current)
return;
const o = Object(h.d)(r.current, e, n);
r.current = e,
i.current = t,
E("moving cursor from", n, "to", o),
s.current.push(o),
a.current.setSelectionRange(o, o)
}
, [e, a, t, s])
}($, u, w, k);
const D = function(e, t, a, n, s, r) {
return function(i) {
i.preventDefault();
const o = i.target.value;
x(r, i.target.selectionStart);
const {countryCode: c, value: l} = P(o, a, n, s);
e(e=>(E("changing value from", e.displayValue, "to", l),
{
rawValue: o,
displayValue: l
})),
t({
value: l,
countryCode: c
})
}
}(y, a, u, p, b, k)
, N = e=>{
x(k, e.target.selectionStart)
}
, T = function(e, t, a, n, s, r) {
return function(i) {
const o = i.target.value;
if (o === t)
return;
let c = e;
const {nationalNumber: l} = Object(h.e)(e, S(t, a));
c = "+" !== e[0] ? l : "+" + S(o, a).dialCode + l,
n({
countryCode: o,
value: O(c, o, a)
}),
E("setting freeze to", r),
s(r)
}
}($, u, p, a, f, g);
return s.a.createElement("div", {
className: o()(r, "phone-input")
}, s.a.createElement("input", {
placeholder: e("Phone"),
onChange: D,
onClick: N,
onKeyUp: N,
name: l,
value: $,
ref: w,
type: "tel",
disabled: c,
className: o()("phone-input__number-input", {
"is-error": i
})
}), s.a.createElement("div", {
className: "phone-input__select-container"
}, s.a.createElement("div", {
className: "phone-input__select-inner-container"
}, s.a.createElement(m.b, {
tabIndex: -1,
className: "phone-input__country-select",
onChange: T,
value: S(u, p).isoCode,
countriesList: p,
disabled: c
}), s.a.createElement(j, {
countryCode: S(u, p).isoCode.toLowerCase()
}))))
}
function C(e, t, a, n) {
const {value: s} = P(e, t, a, n);
return {
rawValue: e,
displayValue: s
}
}
function x(e, t) {
e.current.push(t),
e.current = e.current.slice(-3),
E("updating oldCursorPosition to", e.current)
}
function P(e, t, a, n) {
const s = function(e, t, a, n) {
if (function(e, t, a, n) {
if (!e || e.length < h.a || n)
return !1;
const s = S(t, a).countryDialCode || S(t, a).dialCode;
return "+" === e[0] || "1" === e[0] && "1" === s
}(e, t, a, n))
return Object(h.b)(e) || S("world", a);
return S(t, a)
}(e, t, a, n);
return {
value: O(e, s.isoCode, a),
countryCode: s.isoCode
}
}
function O(e, t, a) {
return Object(h.c)(e, S(t, a))
}
function S(e, t) {
let a = v.a[e];
if (!a) {
const n = Object(r.a)(t || [], ({code: t})=>t === e);
a = {
isoCode: e,
dialCode: (n && n.numeric_code || "").replace("+", ""),
nationalPrefix: ""
}
}
return a
}
$.propTypes = {
translate: d.a.func.isRequired,
inputRef: d.a.oneOfType([d.a.func, d.a.object]),
onChange: d.a.func.isRequired,
className: d.a.string,
isError: d.a.bool,
disabled: d.a.bool,
name: d.a.string,
value: d.a.string.isRequired,
countryCode: d.a.string.isRequired,
countriesList: d.a.array.isRequired,
enableStickyCountry: d.a.bool
};
t.a = Object(c.c)($)
},
"./components/phone-input/phone-number.js": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return g
}
)),
a.d(t, "b", (function() {
return _
}
)),
a.d(t, "e", (function() {
return y
}
)),
a.d(t, "c", (function() {
return j
}
)),
a.d(t, "f", (function() {
return v
}
)),
a.d(t, "d", (function() {
return E
}
));
var n = a("../node_modules/lodash-es/flatten.js")
, s = a("../node_modules/lodash-es/startsWith.js")
, r = a("../node_modules/lodash-es/map.js")
, i = a("../node_modules/lodash-es/find.js")
, o = a("../node_modules/lodash-es/includes.js")
, c = a("../node_modules/debug/src/browser.js")
, l = a.n(c)
, d = a("./components/phone-input/data.js");
const u = l()("phone-input:metadata")
, p = /\d(?=[^,}][^,}])/g
, m = /\[([^[\]])*]/g
, h = /9/g
, g = 3
, b = e=>e.replace(/\D/g, "");
function f(e) {
return Object(n.a)(Object.keys(d.b).filter(t=>Object(s.a)(e, t)).map(e=>d.b[e]))
}
function _(e) {
let t;
for (let a = 1; a <= 6; a++) {
const n = b(e).replace(/^0+/, "").substr(0, a);
if (Object.prototype.hasOwnProperty.call(d.b, n)) {
const e = d.b[n];
if (1 === e.length)
return d.a[e[0]];
e.length > 1 && (t = e)
}
const s = f(n);
if (!s.length && t)
return Object(r.a)(t, e=>d.a[e])[0];
if (1 === s.length)
return d.a[s[0]]
}
return t ? Object(r.a)(t, e=>d.a[e])[0] : null
}
function y(e, t) {
let a = t.nationalPrefix || ""
, n = b(e).replace(new RegExp("^(0*" + t.dialCode + ")?(" + t.nationalPrefix + ")?"), "");
return "0" === t.nationalPrefix && (n = n.replace(/^0+/, "")),
u(`National Number: ${n} for ${e} in ${t.isoCode}`),
"+" === e[0] ? a = "+" + t.dialCode + " " : "1" === t.dialCode && (a = "1" === b(e)[0] ? "1 " : ""),
{
nationalNumber: n,
prefix: a
}
}
function j(e, t) {
const a = b(e).length;
if (a < g || a < (t.dialCode || "").length)
return "+" === e[0] ? "+" + b(e.substr(1)) : b(e);
t.patternRegion && (t = d.a[t.patternRegion]);
const {nationalNumber: n, prefix: s} = y(e, t)
, r = Object(o.a)(["+", "1"], e[0]) && t.internationalPatterns || t.patterns || []
, c = ((e,t)=>Object(i.a)(t, ({match: t, leadingDigitPattern: a})=>(!a || 0 === e.search(a)) && new RegExp("^(?:" + t + ")$").test(e)))(n, r);
if (c)
return u(`Will replace "${n}" with "${c.match}" and "${c.replace}" with prefix "${s}"`),
s + n.replace(new RegExp(c.match), c.replace);
u(`Couldn't find a ${t.isoCode} pattern for ${e}`);
const l = function(e, t) {
const a = Object(i.a)(t, t=>{
if (Object(o.a)(t.format, "|"))
return !1;
if (t.leadingDigitPattern && 0 !== e.search(t.leadingDigitPattern))
return !1;
u("pattern.match = ", t);
const a = t.match.replace(m, "\\d").replace(p, "\\d");
return "999999999999999".match(new RegExp(a))[0].length >= e.length
}
);
if (!a)
return e.replace(/./g, "瀃");
const n = a.match.replace(m, "\\d").replace(p, "\\d");
return "999999999999999".match(new RegExp(n))[0].replace(new RegExp(n,"g"), a.replace).replace(h, "瀃")
}(n, r);
return l ? (u(`Will replace "${n}" with "${l}" with prefix "${s}"`),
s + function(e, t, a={
pos: 0
}) {
let n = ""
, s = 0;
const r = a.pos;
for (let i = 0; i < t.length && s < e.length; i++) {
"瀃" === t[i] ? n += e[s++] : (n += t[i],
s <= r && a.pos++)
}
return n
}(n, l)) : e
}
function v(e, t) {
if (!t)
return e;
const {nationalNumber: a} = y(e, t);
return "+" + (t.countryDialCode || t.dialCode) + "." + (t.countryDialCode && t.regionCode ? t.regionCode : "") + a
}
function E(e, t, a) {
const n = e=>e.split("")
, s = e=>e.filter(e=>/\d/.test(e));
if (t.match(/^\+$/))
return 1;
const [r,i] = function e(t, a) {
if (0 === t.length || 0 === a.length)
return [t.length, a.length];
const n = t.pop()
, s = a.pop();
if (n !== s)
return [1 + t.length, 1 + a.length];
return e(t, a)
}(s(n(e)), s(n(t)))
, o = (c = n(e),
l = a,
c.slice(0, l).filter(e=>/\d/.test(e)).length);
var c, l;
const d = Math.max(0, o - r)
, u = s(n(t))
, [p] = function(e, t) {
const a = (e,t,n)=>{
if (0 === e.length)
return [n, t];
if (0 === t.length)
return [n, t];
const s = e.shift();
return s !== t.shift() && e.unshift(s),
a(e, t, 1 + n)
}
;
return a(e, t, 0)
}(u.slice(0, i + d), n(t));
return p
}
},
"./components/phone-input/style.scss": function(e, t, a) {},
"./components/popover/menu-item.jsx": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return f
}
));
var n = a("../node_modules/@babel/runtime/helpers/extends.js")
, s = a.n(n)
, r = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, i = a.n(r)
, o = a("../node_modules/prop-types/index.js")
, c = a.n(o)
, l = a("../node_modules/react/index.js")
, d = a.n(l)
, u = a("../node_modules/classnames/index.js")
, p = a.n(u)
, m = a("../node_modules/lodash-es/omit.js")
, h = a("../node_modules/lodash-es/noop.js")
, g = a("./components/gridicon/index.tsx")
, b = a("./components/external-link/index.jsx");
class f extends l.Component {
constructor(...e) {
super(...e),
i()(this, "handleMouseOver", e=>{
const {focusOnHover: t} = this.props;
t && e.target.focus(),
this.props.onMouseOver()
}
)
}
render() {
const {children: e, className: t, href: a, icon: n, isSelected: r, isExternalLink: i} = this.props
, o = Object(m.a)(this.props, "icon", "focusOnHover", "isSelected", "isExternalLink", "className", "itemComponent")
, c = p()("popover__menu-item", t, {
"is-selected": r
});
let l = this.props.itemComponent;
return i && a ? (l = b.a,
o.icon = !0) : a && (l = "a"),
d.a.createElement(l, s()({
role: "menuitem",
onMouseOver: this.handleMouseOver,
tabIndex: "-1",
className: c
}, o), n && d.a.createElement(g.a, {
icon: n,
size: 18
}), e)
}
}
i()(f, "propTypes", {
href: c.a.string,
className: c.a.string,
isSelected: c.a.bool,
icon: c.a.string,
focusOnHover: c.a.bool,
onMouseOver: c.a.func,
isExternalLink: c.a.bool,
itemComponent: c.a.oneOfType([c.a.func, c.a.string])
}),
i()(f, "defaultProps", {
isSelected: !1,
focusOnHover: !0,
onMouseOver: h.a,
itemComponent: "button"
})
},
"./components/search-card/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/extends.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../node_modules/classnames/index.js")
, c = a.n(o)
, l = a("../packages/components/dist/esm/card/index.js")
, d = a("./components/search/index.jsx");
a("./components/search-card/style.scss");
t.a = i.a.forwardRef(({className: e, ...t},a)=>i.a.createElement(l.a, {
className: c()("search-card", e)
}, i.a.createElement(d.a, s()({
ref: a
}, t))))
},
"./components/search-card/style.scss": function(e, t, a) {},
"./components/section-header/index.jsx": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return h
}
));
var n = a("../node_modules/@babel/runtime/helpers/extends.js")
, s = a.n(n)
, r = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, i = a.n(r)
, o = a("../node_modules/react/index.js")
, c = a.n(o)
, l = a("../node_modules/classnames/index.js")
, d = a.n(l)
, u = a("../packages/components/dist/esm/card/compact.js")
, p = a("./components/count/index.jsx")
, m = a("./components/support-info/index.jsx");
a("./components/section-header/style.scss");
class h extends o.PureComponent {
render() {
const e = "number" == typeof this.props.count
, t = !(this.props.label || e || this.props.children)
, a = d()(this.props.className, "section-header", {
"is-empty": t,
"is-placeholder": this.props.isPlaceholder
})
, {id: n, popoverText: r} = this.props
, i = {
id: n
};
return c.a.createElement(u.a, s()({
className: a,
href: this.props.href
}, i), c.a.createElement("div", {
className: "section-header__label"
}, c.a.createElement("span", {
className: "section-header__label-text"
}, this.props.label), e && c.a.createElement(p.a, {
count: this.props.count
}), r && !this.props.isPlaceholder && c.a.createElement(m.a, {
position: "right",
text: r
})), c.a.createElement("div", {
className: "section-header__actions"
}, this.props.children))
}
}
i()(h, "defaultProps", {
label: "",
popoverText: "",
href: null,
isPlaceholder: !1
})
},
"./components/section-header/style.scss": function(e, t, a) {},
"./components/sidebar-navigation/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/prop-types/index.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../node_modules/react-redux/es/index.js")
, c = a("./components/gridicon/index.tsx")
, l = a("./state/ui/layout-focus/actions.js")
, d = a("./components/translatable/proptype.js");
a("./components/sidebar-navigation/style.scss");
function u({sectionTitle: e, children: t, toggleSidebar: a}) {
return i.a.createElement("header", {
className: "current-section"
}, i.a.createElement("button", {
onClick: a
}, i.a.createElement(c.a, {
icon: "menu"
}), t, i.a.createElement("h1", {
className: "current-section__site-title"
}, e)))
}
u.propTypes = {
sectionTitle: d.a,
toggleSidebar: s.a.func.isRequired
},
t.a = Object(o.c)(null, {
toggleSidebar: ()=>Object(l.b)("sidebar")
})(u)
},
"./components/sidebar-navigation/style.scss": function(e, t, a) {},
"./components/support-info/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, s = a.n(n)
, r = a("../node_modules/prop-types/index.js")
, i = a.n(r)
, o = a("../node_modules/react/index.js")
, c = a.n(o)
, l = a("../packages/i18n-calypso/dist/esm/index.js")
, d = a("./components/info-popover/index.jsx")
, u = a("./components/external-link/index.jsx");
a("./components/support-info/style.scss");
class p extends o.Component {
render() {
const {text: e, link: t, position: a, privacyLink: n, translate: s} = this.props
, r = !n && !1 !== n && t ? t + "#privacy" : n;
return c.a.createElement("div", {
className: "support-info"
}, c.a.createElement(d.a, {
position: a || "left",
screenReaderText: s("Learn more")
}, e + " ", t && c.a.createElement("span", {
className: "support-info__learn-more"
}, c.a.createElement(u.a, {
href: t,
target: "_blank",
rel: "noopener noreferrer"
}, s("Learn more"))), r && c.a.createElement("span", {
className: "support-info__privacy"
}, c.a.createElement(u.a, {
href: r,
target: "_blank",
rel: "noopener noreferrer"
}, s("Privacy Information")))))
}
}
s()(p, "propTypes", {
text: i.a.string,
link: i.a.string,
position: i.a.string,
privacyLink: i.a.oneOfType([i.a.string, i.a.bool])
}),
s()(p, "defaultProps", {
text: "",
link: "",
privacyLink: ""
}),
t.a = Object(l.c)(p)
},
"./components/support-info/style.scss": function(e, t, a) {},
"./components/textarea-autosize/index.jsx": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return g
}
));
var n = a("../node_modules/@babel/runtime/helpers/extends.js")
, s = a.n(n)
, r = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, i = a.n(r)
, o = a("../node_modules/react/index.js")
, c = a.n(o)
, l = a("../node_modules/prop-types/index.js")
, d = a.n(l)
, u = a("../node_modules/classnames/index.js")
, p = a.n(u)
, m = a("../node_modules/autosize/dist/autosize.js")
, h = a.n(m);
a("./components/textarea-autosize/style.scss");
class g extends o.Component {
componentDidMount() {
h()(this.refs.textarea)
}
componentWillUnmount() {
h.a.destroy(this.refs.textarea)
}
componentDidUpdate(e) {
this.props.value !== e.value && this.resize()
}
resize() {
h.a.update(this.refs.textarea)
}
render() {
const e = p()("textarea-autosize", this.props.className);
return c.a.createElement("textarea", s()({
ref: "textarea"
}, this.props, {
className: e
}))
}
}
i()(g, "propTypes", {
className: d.a.string
})
},
"./components/textarea-autosize/style.scss": function(e, t, a) {},
"./components/user/index.jsx": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return d
}
));
var n = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../node_modules/prop-types/index.js")
, c = a.n(o)
, l = a("./components/gravatar/index.jsx");
a("./components/user/style.scss");
class d extends r.Component {
render() {
const e = this.props.user || null
, t = e ? e.display_name || e.name : "";
return i.a.createElement("div", {
className: "user",
title: t
}, i.a.createElement(l.a, {
size: 26,
user: e
}), i.a.createElement("span", {
className: "user__name"
}, t))
}
}
s()(d, "displayName", "User"),
s()(d, "propTypes", {
user: c.a.object
})
},
"./components/user/style.scss": function(e, t, a) {},
"./components/vertical-nav/item/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../node_modules/prop-types/index.js")
, c = a.n(o)
, l = a("../node_modules/lodash-es/noop.js")
, d = a("../node_modules/classnames/index.js")
, u = a.n(d)
, p = a("../packages/components/dist/esm/card/compact.js")
, m = a("./components/gridicon/index.tsx");
a("./components/vertical-nav/item/style.scss");
class h extends r.Component {
constructor(...e) {
super(...e),
s()(this, "placeholder", ()=>{
const e = u()("vertical-nav-item is-placeholder", this.props.className);
return i.a.createElement(p.a, {
className: e
}, i.a.createElement("span", null), i.a.createElement("span", null))
}
),
s()(this, "getIcon", ()=>this.props.external ? i.a.createElement(m.a, {
icon: "external"
}) : i.a.createElement(m.a, {
icon: "chevron-right"
}))
}
render() {
if (this.props.isPlaceholder)
return this.placeholder();
const e = u()("vertical-nav-item", this.props.className);
return i.a.createElement("a", {
href: this.props.path,
onClick: this.props.onClick,
target: this.props.external ? "_blank" : null
}, i.a.createElement(p.a, {
className: e
}, this.getIcon(), i.a.createElement("span", null, this.props.children)))
}
}
s()(h, "propTypes", {
external: c.a.bool,
isPlaceholder: c.a.bool,
onClick: c.a.func,
path: c.a.string
}),
s()(h, "defaultProps", {
external: !1,
isPlaceholder: !1,
onClick: l.a
}),
t.a = h
},
"./components/vertical-nav/item/style.scss": function(e, t, a) {},
"./layout/sidebar/footer.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/react/index.js")
, s = a.n(n);
t.a = ({children: e})=>e ? s.a.createElement("div", {
className: "sidebar__footer"
}, e) : null
},
"./layout/sidebar/heading.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/extends.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r);
t.a = ({children: e, onClick: t, ...a})=>{
const n = t ? 0 : -1;
let r = null;
return t && (r = e=>{
13 === e.keyCode && (e.preventDefault(),
t())
}
),
i.a.createElement("h2", s()({
tabIndex: n,
className: "sidebar__heading",
onKeyDown: r,
onClick: t
}, a), e)
}
},
"./layout/sidebar/index.jsx": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return c
}
));
var n = a("../node_modules/react/index.js")
, s = a.n(n)
, r = a("../node_modules/classnames/index.js")
, i = a.n(r)
, o = a("./layout/sidebar/region.jsx");
a("./layout/sidebar/style.scss");
function c({children: e, onClick: t, className: a}) {
const n = s.a.Children.toArray(e).some(e=>e.type === o.a)
, r = i()("sidebar", a, {
"has-regions": n
});
return s.a.createElement("div", {
role: "presentation",
className: r,
onClick: t,
"data-tip-target": "sidebar"
}, e)
}
},
"./layout/sidebar/item.jsx": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return b
}
));
var n = a("../node_modules/react/index.js")
, s = a.n(n)
, r = a("../node_modules/prop-types/index.js")
, i = a.n(r)
, o = a("../node_modules/classnames/index.js")
, c = a.n(o)
, l = a("./components/gridicon/index.tsx")
, d = a("../node_modules/lodash-es/isFunction.js")
, u = a("./lib/url/is-external.ts")
, p = a("./components/material-icon/index.tsx")
, m = a("./components/count/index.jsx")
, h = a("./sections-helper.js")
, g = a("./components/translatable/proptype.js");
function b(e) {
const t = Object(u.a)(e.link)
, a = t && !e.forceInternalLink
, r = c()(e.className, e.tipTarget, {
selected: e.selected,
"has-unseen": e.hasUnseen
})
, {materialIcon: i, materialIconStyle: o, icon: g, customIcon: b, count: f} = e;
let _ = !1;
return Object(n.useEffect)(()=>{
const {expandSection: t, selected: a} = e;
a && Object(d.a)(t) && t()
}
, [e.selected]),
s.a.createElement("li", {
className: r,
"data-tip-target": e.tipTarget,
"data-post-type": e.postType
}, s.a.createElement("a", {
className: "sidebar__menu-link",
onClick: e.onNavigate,
href: e.link,
target: a ? "_blank" : null,
rel: t ? "noopener noreferrer" : null,
onMouseEnter: ()=>{
!_ && e.preloadSectionName && (_ = !0,
Object(h.c)())
}
}, g && s.a.createElement(l.a, {
className: "sidebar__menu-icon",
icon: g,
size: 24
}), i && s.a.createElement(p.a, {
className: "sidebar__menu-icon",
icon: i,
style: o
}), b && b, s.a.createElement("span", {
className: "sidebar__menu-link-text menu-link-text",
"data-e2e-sidebar": e.label
}, e.label, !!f && s.a.createElement(m.a, {
count: f
})), a && s.a.createElement(l.a, {
icon: "external",
size: 24
}), e.children))
}
b.propTypes = {
label: g.a.isRequired,
className: i.a.string,
link: i.a.string.isRequired,
onNavigate: i.a.func,
icon: i.a.string,
customIcon: i.a.object,
materialIcon: i.a.string,
materialIconStyle: i.a.string,
selected: i.a.bool,
expandSection: i.a.func,
preloadSectionName: i.a.string,
forceInternalLink: i.a.bool,
testTarget: i.a.string,
tipTarget: i.a.string,
count: i.a.number
}
},
"./layout/sidebar/menu.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/react/index.js")
, s = a.n(n)
, r = a("../node_modules/classnames/index.js")
, i = a.n(r);
t.a = ({children: e, className: t})=>s.a.createElement("ul", {
className: i()("sidebar__menu", t)
}, e)
},
"./layout/sidebar/region.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/react/index.js")
, s = a.n(n)
, r = a("../node_modules/classnames/index.js")
, i = a.n(r)
, o = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, c = a.n(o)
, l = a("../node_modules/prop-types/index.js")
, d = a.n(l)
, u = a("../packages/i18n-calypso/dist/esm/index.js")
, p = a("../packages/components/dist/esm/button/index.js");
class m extends s.a.Component {
constructor(...e) {
super(...e),
c()(this, "onClick", e=>{
e.preventDefault();
const t = document.getElementById(this.props.skipToElementId);
/^(?:a|select|input|button|textarea)$/i.test(t.tagName) || (t.tabIndex = -1),
t.focus()
}
)
}
render() {
return s.a.createElement(p.a, {
onClick: this.onClick,
className: "sidebar__skip-navigation"
}, this.props.translate("Skip navigation"))
}
}
c()(m, "propTypes", {
skipToElementId: d.a.string
});
var h = Object(u.c)(m);
t.a = ({children: e, className: t})=>s.a.createElement("div", {
className: i()("sidebar__region", t)
}, s.a.createElement(h, {
skipToElementId: "primary"
}), e)
},
"./layout/sidebar/style.scss": function(e, t, a) {},
"./lib/analytics/track-component-view/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, s = a.n(n)
, r = a("../node_modules/debug/src/browser.js")
, i = a.n(r)
, o = a("../node_modules/prop-types/index.js")
, c = a.n(o)
, l = a("../node_modules/react/index.js")
, d = a("../node_modules/react-redux/es/index.js")
, u = a("./state/analytics/actions/bump-stat.js")
, p = a("./state/analytics/actions/record.js");
const m = i()("calypso:analytics:TrackComponentView");
class h extends l.Component {
UNSAFE_componentWillMount() {
m("Component will mount.");
const {eventName: e, eventProperties: t} = this.props;
e && (m(`Recording Tracks event "${e}".`),
this.props.recordTracksEvent(e, t));
const {statGroup: a, statName: n} = this.props;
a && (m(`Bumping stat "${n}".`),
this.props.bumpStat(a, n))
}
render() {
return null
}
}
s()(h, "propTypes", {
eventName: c.a.string,
eventProperties: c.a.object,
recordTracksEvent: c.a.func,
bumpStat: c.a.func
}),
s()(h, "defaultProps", {
recordTracksEvent: ()=>{}
,
bumpStat: ()=>{}
}),
t.a = Object(d.c)(null, {
bumpStat: u.a,
recordTracksEvent: p.e
})(h)
},
"./lib/checkout/constants.js": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return n
}
)),
a.d(t, "d", (function() {
return s
}
)),
a.d(t, "b", (function() {
return r
}
)),
a.d(t, "e", (function() {
return i
}
)),
a.d(t, "c", (function() {
return o
}
));
const n = {
BR: {
fields: ["document", "street-number", "address-1", "address-2", "state", "city", "phone-number", "postal-code"]
},
MX: {
fields: ["phone-number", "postal-code"]
},
IN: {
fields: ["name", "pan", "gstin", "street-number", "address-1", "address-2", "state", "city", "postal-code"]
},
ID: {
fields: ["name", "nik", "phone-number"]
}
}
, s = "plugins"
, r = "install_plugin"
, i = "themes"
, o = "install_theme"
},
"./lib/checkout/index.js": function(e, t, a) {
"use strict";
a.d(t, "b", (function() {
return I
}
)),
a.d(t, "a", (function() {
return O
}
)),
a.d(t, "e", (function() {
return P
}
)),
a.d(t, "c", (function() {
return k
}
)),
a.d(t, "d", (function() {
return D
}
));
var n = a("../node_modules/url/url.js")
, s = a("./lib/cart-values/cart-items.js")
, r = a("./me/purchases/paths.js")
, i = a("./lib/checkout/constants.js")
, o = a("./lib/url/decode-utils.ts")
, c = a("./lib/url/is-external.ts")
, l = a("./my-sites/domains/paths.js")
, d = a("./lib/products-values/index.js")
, u = a("../node_modules/creditcards/index.js")
, p = a.n(u)
, m = a("../node_modules/lodash-es/mergeWith.js")
, h = a("../node_modules/lodash-es/isArray.js")
, g = a("../node_modules/lodash-es/union.js")
, b = a("../node_modules/lodash-es/capitalize.js")
, f = a("../node_modules/lodash-es/isEmpty.js")
, _ = a("../node_modules/lodash-es/isString.js")
, y = a("../node_modules/lodash-es/compact.js")
, j = a("../packages/i18n-calypso/dist/esm/index.js")
, v = a("./lib/postal-code/index.jsx")
, E = a("./lib/checkout/processor-specific.js");
function $(e, t) {
switch (t) {
case "credit-card":
return function(...e) {
return Object(m.a)({}, ...e, (e,t)=>Object(h.a)(e) && Object(h.a)(t) ? Object(g.a)(e, t) : void 0)
}({
name: {
description: j.a.translate("Cardholder Name", {
comment: "Cardholder name label on credit card form"
}),
rules: ["required"]
},
number: {
description: j.a.translate("Card Number", {
comment: "Card number label on credit card form"
}),
rules: ["validCreditCardNumber"]
},
"expiration-date": {
description: j.a.translate("Credit Card Expiration Date"),
rules: ["validExpirationDate"]
},
cvv: {
description: j.a.translate("Credit Card CVV Code"),
rules: ["validCvvNumber"]
},
country: {
description: j.a.translate("Country"),
rules: ["required"]
},
"postal-code": {
description: j.a.translate("Postal Code", {
comment: "Postal code on credit card form"
}),
rules: ["required"]
}
}, function({country: e}) {
switch (e) {
case "US":
return {
"postal-code": {
description: j.a.translate("Postal Code", {
comment: "Postal code on credit card form"
}),
rules: ["required", "validPostalCodeUS"]
}
}
}
return null
}(e), function({country: e}) {
return e && Object(E.b)(e) && Object(E.a)(e)
}(e));
case "brazil-tef":
return Object.assign({
name: {
description: j.a.translate("Your Name"),
rules: ["required"]
},
"tef-bank": {
description: j.a.translate("Bank"),
rules: ["required"]
}
}, Object(E.a)("BR"));
case "id_wallet":
return Object(E.a)("ID");
case "netbanking":
return Object(E.a)("IN");
case "token":
return {
name: {
description: j.a.translate("Cardholder Name", {
comment: "Cardholder name label on credit card form"
}),
rules: ["required"]
},
tokenized_payment_data: {
description: j.a.translate("Tokenized Payment Data", {
comment: "Tokenized payment data from the token provider"
}),
rules: ["required"]
}
};
case "stripe":
return {
name: {
description: j.a.translate("Cardholder Name", {
comment: "Cardholder name label on credit card form"
}),
rules: ["required"]
},
country: {
description: j.a.translate("Country"),
rules: ["required"]
},
"postal-code": {
description: j.a.translate("Postal Code", {
comment: "Postal code on credit card form"
}),
rules: ["required"]
}
};
default:
return null
}
}
function C(e) {
return j.a.translate("%(description)s is invalid", {
args: {
description: Object(b.a)(e)
}
})
}
const x = {};
function P(e, t="credit-card") {
const a = $(e, t) || {};
return {
errors: Object.keys(a).reduce((function(t, n) {
const s = function(e, t, a) {
return Object(y.a)(e.rules.map((function(n) {
const s = function(e) {
if (Object(h.a)(e))
return x[e[0]].apply(null, e.slice(1));
return x[e]
}(n);
if (!s.isValid(t, a))
return s.error(e.description)
}
)))
}(a[n], e[n], e);
return s.length && (t[n] = s),
t
}
), {})
}
}
function O(e) {
if (e) {
e = e.replace(/ /g, "");
let t = p.a.card.type(e, !0);
return void 0 === t ? null : ("American Express" === t && (t = "amex"),
"Diners Club" === t && (t = "diners"),
t.toLowerCase())
}
return null
}
x.required = {
isValid: e=>!Object(f.a)(e),
error: function(e) {
return j.a.translate("Missing required %(description)s field", {
args: {
description: e
}
})
}
},
x.validCreditCardNumber = {
isValid: e=>!!e && p.a.card.isValid(e),
error: C
},
x.validCvvNumber = {
isValid: e=>!!e && p.a.cvc.isValid(e),
error: C
},
x.validExpirationDate = {
isValid: function(e) {
if (!e)
return !1;
const t = function(e) {
const [t,a] = e.split("/");
return {
month: p.a.expiration.month.parse(t),
year: p.a.expiration.year.parse(a, !0)
}
}(e);
return p.a.expiration.month.isValid(t.month) && p.a.expiration.year.isValid(t.year) && !p.a.expiration.isPast(t.month, t.year)
},
error: C
},
x.validBrazilTaxId = {
isValid: e=>!!e && (Object(E.d)(e) || Object(E.c)(e)),
error: function(e) {
return j.a.translate("%(description)s is invalid. Must be in format: 111.444.777-XX or 11.444.777/0001-XX", {
args: {
description: e
}
})
}
},
x.validIndiaPan = {
isValid: e=>!!e && /^([a-zA-Z]){5}([0-9]){4}([a-zA-Z]){1}?$/.test(e),
error: function(e) {
return j.a.translate("%(description)s is invalid", {
args: {
description: e
}
})
}
},
x.validIndonesiaNik = {
isValid: e=>16 === (Object(_.a)(e) ? e.replace(/[^0-9]/g, "") : "").length,
error: function(e) {
return j.a.translate("%(description)s is invalid", {
args: {
description: Object(b.a)(e)
}
})
}
},
x.validIndiaGstin = {
isValid: e=>!e || /^([0-2][0-9]|[3][0-7])[A-Z]{3}[ABCFGHLJPTK][A-Z]\d{4}[A-Z][A-Z0-9][Z][A-Z0-9]$/i.test(e),
error: function(e) {
return j.a.translate("%(description)s is invalid", {
args: {
description: e
}
})
}
},
x.validPostalCodeUS = {
isValid: e=>Object(v.a)(e, "US"),
error: function(e) {
return j.a.translate("%(description)s is invalid. Must be a 5 digit number", {
args: {
description: e
}
})
}
},
x.validStreetNumber = {
isValid: e=>"0" !== e,
error: C
};
var S = a("../node_modules/lodash-es/identity.js");
const w = {};
function k(e, t, a) {
const n = w[e];
return n ? n.mask(t, a) : a
}
function D(e, t, a) {
const n = w[e];
return n ? n.unmask(n.mask(t, a)) : a
}
w["expiration-date"] = {
mask: function(e, t) {
return e && e.length > t.length || e && 2 === e.length && 3 === t.length && "/" === t[2] || (t = t.replace(/[^\d]/g, "")).length <= 2 ? t : t.substring(0, 2) + "/" + t.substring(2, 4)
},
unmask: S.a
},
w.number = {
mask: function(e, t) {
return function(e) {
if ("amex" === O(e))
return function(e) {
const t = e.replace(/[^0-9]/g, "").slice(0, 15);
return `${t.slice(0, 4)} ${t.slice(4, 10)} ${t.slice(10, 15)}`.trim()
}(e);
const t = e.replace(/[^0-9]/g, "").slice(0, 19);
return `${t.slice(0, 4)} ${t.slice(4, 8)} ${t.slice(8, 12)} ${t.slice(12)}`.trim()
}(t)
},
unmask: function(e) {
return e.replace(/ /g, "")
}
},
w.cvv = {
mask: function(e, t) {
return t.replace(/[^\d]/g, "").substring(0, 4)
},
unmask: S.a
},
w.document = {
mask: function(e, t) {
let a = t;
const n = t.replace(/[^0-9]/g, "");
return a = n.length > 11 ? n.slice(0, 2) + "." + n.slice(2, 5) + "." + n.slice(5, 8) + "/" + n.slice(8, 12) + "-" + n.slice(12, 14) : n.slice(0, 3) + "." + n.slice(3, 6) + "." + n.slice(6, 9) + "-" + n.slice(9, 11),
a.replace(/^[\s\.\-]+|[\s\.\-]+$/g, "")
},
unmask: S.a
};
const N = e=>"string" == typeof e && e;
function T(e) {
const t = function(e, t=!0) {
const a = []
, s = Object(o.a)(e);
t && N(s) && a.push(s);
const r = e=>{
const {query: {redirect_to: t}} = Object(n.parse)(e, !0);
N(t) && (a.push(t),
r(Object(o.a)(t)))
}
;
return r(s),
a
}(e);
if (Array.isArray(t) && t.length && !Object(c.a)(t[t.length - 1]))
return t[t.length - 1]
}
function I(e, t, a, n, o, c, u) {
let p = "/plans/";
if (o)
return `/block-editor/page/${t}/home`;
if (c)
return "/home/" + t;
if (Object(s.T)(e)) {
const a = Object(s.s)(e)[0]
, {purchaseId: n, purchaseDomain: i} = a.extra
, o = t || i;
if (Object(d.w)(a)) {
const e = Object(l.g)(o, a.meta);
if (u && u.startsWith(e))
return e
}
return Object(r.h)(o, n)
}
if (function(e) {
switch (e) {
case i.d:
case i.b:
case i.e:
case i.c:
return !0
}
return !1
}(a)) {
const e = T(n);
if (e)
return e
}
return Object(s.D)(e) ? p = "/domains/add/" : Object(s.C)(e) ? p = "/domains/add/mapping/" : Object(s.R)(e, "offsite_redirect") ? p = "/domains/add/site-redirect/" : Object(s.R)(e, "premium_theme") && (p = "/themes/"),
t ? p + t : p
}
},
"./lib/checkout/payment-methods.ts": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return p
}
)),
a.d(t, "e", (function() {
return h
}
)),
a.d(t, "d", (function() {
return g
}
)),
a.d(t, "b", (function() {
return _
}
)),
a.d(t, "c", (function() {
return y
}
));
var n = a("./assets/images/upgrades/cc-amex.svg")
, s = a("./assets/images/upgrades/cc-diners.svg")
, r = a("./assets/images/upgrades/cc-discover.svg")
, i = a("./assets/images/upgrades/cc-jcb.svg")
, o = a("./assets/images/upgrades/cc-mastercard.svg")
, c = a("./assets/images/upgrades/cc-unionpay.svg")
, l = a("./assets/images/upgrades/cc-visa.svg")
, d = "/calypso/images/paypal-disabled-f226367cf27eb982f516cfee6e10b9db.svg"
, u = "/calypso/images/paypal-2eb3d1cc02d313edd857775a0e4b78ae.svg";
const p = "paypal_express"
, m = [p]
, h = e=>m.includes(e.payment_partner)
, g = e=>!h(e)
, b = {
amex: n.a,
diners: s.a,
discover: r.a,
jcb: i.a,
mastercard: o.a,
unionpay: c.a,
visa: l.a,
paypal_express: u,
paypal: u
}
, f = {
amex: "/calypso/images/cc-amex-disabled-dd5d25268af9141b19f8972434afaca5.svg",
diners: "/calypso/images/cc-diners-disabled-77354f45dec61719e0ed4032ab703ece.svg",
discover: "/calypso/images/cc-discover-disabled-b81c2bb5dfc291ecc16d9cbaa0ac68e3.svg",
jcb: "/calypso/images/cc-jcb-disabled-6786a8cebe2985976fcb931be69b14de.svg",
mastercard: "/calypso/images/cc-mastercard-disabled-7862d5743556fdc97373a5f0d6023fac.svg",
unionpay: "/calypso/images/cc-unionpay-disabled-214bf9306eb59136bbce28094d4e75a5.svg",
visa: "/calypso/images/cc-visa-disabled-f2831f14128e70a1e16d3cc119d51a62.svg",
paypal_express: d,
paypal: d
}
, _ = (e,t)=>`url(${(t ? b : f)[e] || "/calypso/images/cc-placeholder-fcba44a8630a13bd8b5e6eb012dba5f1.svg"})`
, y = ({translate: e, type: t, digits: a, email: n})=>{
if (t === p)
return n || "";
let s;
switch (t && t.toLocaleLowerCase()) {
case "american express":
case "amex":
s = e("American Express");
break;
case "diners":
s = e("Diners Club");
break;
case "discover":
s = e("Discover");
break;
case "jcb":
s = e("JCB");
break;
case "mastercard":
s = e("Mastercard");
break;
case "unionpay":
s = e("UnionPay");
break;
case "visa":
s = e("VISA");
break;
default:
s = t
}
return a ? e("%(displayType)s ****%(digits)s", {
args: {
displayType: s,
digits: a
}
}) : s
}
},
"./lib/checkout/processor-specific.js": function(e, t, a) {
"use strict";
a.d(t, "b", (function() {
return u
}
)),
a.d(t, "e", (function() {
return p
}
)),
a.d(t, "d", (function() {
return m
}
)),
a.d(t, "c", (function() {
return h
}
)),
a.d(t, "a", (function() {
return g
}
)),
a.d(t, "f", (function() {
return b
}
));
var n = a("../packages/i18n-calypso/dist/esm/index.js")
, s = a("../node_modules/lodash-es/isUndefined.js")
, r = a("../node_modules/lodash-es/isEmpty.js")
, i = a("../node_modules/lodash-es/pick.js")
, o = a("../node_modules/cpf_cnpj/index.js")
, c = a("./lib/checkout/constants.js")
, l = a("./lib/cart-values/index.js")
, d = a("./lib/cart/store/index.js");
function u(e="") {
return !Object(s.a)(c.a[e]) && Object(l.m)(d.a.get(), "ebanx")
}
function p(e="") {
return u(e) && !Object(r.a)(c.a[e].fields)
}
function m(e="") {
return o.CPF.isValid(e)
}
function h(e="") {
return o.CNPJ.isValid(e)
}
function g(e) {
const t = c.a[e].fields || [];
return Object(i.a)(Object.assign({
document: {
description: n.a.translate("Taxpayer Identification Number"),
rules: ["validBrazilTaxId"]
},
"phone-number": {
description: n.a.translate("Phone Number"),
rules: ["required"]
},
name: {
description: n.a.translate("Your Name"),
rules: ["required"]
},
nik: {
description: n.a.translate("NIK - Indonesia Identity Card Number", {
comment: "NIK - Indonesia Identity Card Number required for Indonesian payment methods."
}),
rules: ["validIndonesiaNik"]
},
pan: {
description: n.a.translate("PAN - Permanent account number"),
rules: ["validIndiaPan"]
},
gstin: {
description: n.a.translate("GSTIN - GST identification number", {
comment: "GSTIN: India specific tax id number"
}),
rules: ["validIndiaGstin"]
},
"postal-code": {
description: n.a.translate("Postal Code"),
rules: ["required"]
}
}, {
"street-number": {
description: n.a.translate("Street Number"),
rules: ["required", "validStreetNumber"]
},
"address-1": {
description: n.a.translate("Address"),
rules: ["required"]
},
state: {
description: n.a.translate("State"),
rules: ["required"]
},
city: {
description: n.a.translate("City"),
rules: ["required"]
},
"postal-code": {
description: n.a.translate("Postal Code"),
rules: ["required"]
}
}), t)
}
function b(e) {
let t = n.a.translate("Your payment was not processed this time due to an error, please try to submit it again.");
switch (e.status_code) {
case "BP-DR-55":
t = {
message: {
cvv: n.a.translate("Invalid credit card CVV number")
}
};
break;
case "BP-DR-51":
case "BP-DR-95":
t = {
message: {
name: n.a.translate("Please enter your name.")
}
}
}
return t
}
},
"./lib/flags/index.js": function(e, t, a) {
"use strict";
function n(e) {
try {
const t = a("../node_modules/flag-icon-css/flags/4x3 sync recursive ^\\.\\/.*\\.svg$")(`./${e}.svg`);
return t.default ? t.default : t
} catch (e) {
return "data:image/svg+xml;utf8," + '\n\t\t\t<svg\n\t\t\t\tclass="gridicon gridicons-globe"\n\t\t\t\theight="24"\n\t\t\t\twidth="24"\n\t\t\t\txmlns="http://www.w3.org/2000/svg"\n\t\t\t\tviewBox="0 3 24 18"\n\t\t\t>\n\t\t\t\t<g>\n\t\t\t\t\t<path d="M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm0 18l2-2 1-1v-2h-2v-1l-1-1H9v3l2 2v1.93c-3.94-.494-7-3.858-7-7.93l1 1h2v-2h2l3-3V6h-2L9 5v-.41C9.927 4.21 10.94 4 12 4s2.073.212 3 .59V6l-1 1v2l1 1 3.13-3.13c.752.897 1.304 1.964 1.606 3.13H18l-2 2v2l1 1h2l.286.286C18.03 18.06 15.24 20 12 20z" />\n\t\t\t\t</g>\n\t\t\t</svg>'
}
}
a.d(t, "a", (function() {
return n
}
))
},
"./lib/i18n-utils/guess-timezone.ts": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return r
}
));
const n = {
"Africa/Asmera": "Africa/Nairobi",
"Africa/Timbuktu": "Africa/Abidjan",
"America/Argentina/ComodRivadavia": "America/Argentina/Catamarca",
"America/Atka": "America/Adak",
"America/Buenos_Aires": "America/Argentina/Buenos_Aires",
"America/Catamarca": "America/Argentina/Catamarca",
"America/Coral_Harbour": "America/Atikokan",
"America/Cordoba": "America/Argentina/Cordoba",
"America/Ensenada": "America/Tijuana",
"America/Fort_Wayne": "America/Indiana/Indianapolis",
"America/Indianapolis": "America/Indiana/Indianapolis",
"America/Jujuy": "America/Argentina/Jujuy",
"America/Knox_IN": "America/Indiana/Knox",
"America/Louisville": "America/Kentucky/Louisville",
"America/Mendoza": "America/Argentina/Mendoza",
"America/Montreal": "America/Toronto",
"America/Porto_Acre": "America/Rio_Branco",
"America/Rosario": "America/Argentina/Cordoba",
"America/Santa_Isabel": "America/Tijuana",
"America/Shiprock": "America/Denver",
"America/Virgin": "America/Port_of_Spain",
"Antarctica/South_Pole": "Pacific/Auckland",
"Asia/Ashkhabad": "Asia/Ashgabat",
"Asia/Calcutta": "Asia/Kolkata",
"Asia/Chongqing": "Asia/Shanghai",
"Asia/Chungking": "Asia/Shanghai",
"Asia/Dacca": "Asia/Dhaka",
"Asia/Harbin": "Asia/Shanghai",
"Asia/Kashgar": "Asia/Urumqi",
"Asia/Katmandu": "Asia/Kathmandu",
"Asia/Macao": "Asia/Macau",
"Asia/Rangoon": "Asia/Yangon",
"Asia/Saigon": "Asia/Ho_Chi_Minh",
"Asia/Tel_Aviv": "Asia/Jerusalem",
"Asia/Thimbu": "Asia/Thimphu",
"Asia/Ujung_Pandang": "Asia/Makassar",
"Asia/Ulan_Bator": "Asia/Ulaanbaatar",
"Atlantic/Faeroe": "Atlantic/Faroe",
"Atlantic/Jan_Mayen": "Europe/Oslo",
"Australia/ACT": "Australia/Sydney",
"Australia/Canberra": "Australia/Sydney",
"Australia/LHI": "Australia/Lord_Howe",
"Australia/NSW": "Australia/Sydney",
"Australia/North": "Australia/Darwin",
"Australia/Queensland": "Australia/Brisbane",
"Australia/South": "Australia/Adelaide",
"Australia/Tasmania": "Australia/Hobart",
"Australia/Victoria": "Australia/Melbourne",
"Australia/West": "Australia/Perth",
"Australia/Yancowinna": "Australia/Broken_Hill",
"Europe/Belfast": "Europe/London",
"Europe/Tiraspol": "Europe/Chisinau",
"Pacific/Johnston": "Pacific/Honolulu",
"Pacific/Ponape": "Pacific/Pohnpei",
"Pacific/Samoa": "Pacific/Pago_Pago",
"Pacific/Truk": "Pacific/Chuuk",
"Pacific/Yap": "Pacific/Chuuk"
};
function s(e) {
return function(e) {
return e in n
}(e) ? n[e] : e
}
function r() {
try {
return s(Intl.DateTimeFormat().resolvedOptions().timeZone)
} catch (e) {
return
}
}
},
"./lib/media/utils/get-file-extension.js": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return o
}
));
var n = a("./node_modules/path-browserify/index.js")
, s = a.n(n)
, r = a("../node_modules/valid-url/index.js")
, i = a("./lib/url/url-parts.ts");
function o(e) {
let t;
if (!e)
return;
const a = "string" == typeof e
, n = "File"in window && e instanceof window.File;
if (a) {
let a;
a = Object(r.isUri)(e) ? Object(i.b)(e).pathname : e,
t = s.a.extname(a).slice(1)
} else if (n)
t = s.a.extname(e.name).slice(1);
else if (e.extension)
t = e.extension;
else {
const a = Object(i.b)(e.URL || e.file || e.guid || "").pathname || "";
t = s.a.extname(a).slice(1)
}
return t
}
},
"./lib/media/utils/get-mime-type.js": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return r
}
));
var n = a("./lib/media/constants.js")
, s = a("./lib/media/utils/get-file-extension.js");
function r(e) {
if (!e)
return;
if (e.mime_type)
return e.mime_type;
if ("File"in window && e instanceof window.File)
return e.type;
let t = Object(s.a)(e);
return t ? (t = t.toLowerCase(),
n.f.hasOwnProperty(t) ? n.f[t] : void 0) : void 0
}
},
"./lib/postal-code/index.jsx": function(e, t, a) {
"use strict";
a.d(t, "b", (function() {
return i
}
)),
a.d(t, "a", (function() {
return c
}
));
var n = a("../node_modules/lodash-es/get.js")
, s = a("../node_modules/lodash-es/replace.js")
, r = a("../node_modules/lodash-es/includes.js");
function i(e, t) {
if (!t)
return e;
const a = Object(n.a)({
BR: {
length: [8],
delimiter: "-",
partLength: 5
},
CA: {
length: [6],
delimiter: " ",
partLength: 3
},
GB: {
length: [5, 6, 7],
delimiter: " ",
formatter: (e,t)=>e.substring(0, e.length - 3) + t + e.substring(e.length - 3)
},
IE: {
length: [7],
delimiter: " ",
partLength: 3
},
JP: {
length: [7],
delimiter: "-",
partLength: 3
},
KY: {
length: [7],
delimiter: "-",
partLength: 3
},
NL: {
length: [6],
delimiter: " ",
partLength: 4
},
PL: {
length: [5],
delimiter: "-",
partLength: 2
},
PT: {
length: [7],
delimiter: "-",
partLength: 4
},
SE: {
length: [5],
delimiter: " ",
partLength: 3
}
}, t, !1);
if (!a)
return e;
const i = Object(s.a)(e, /[\s-]/g, "");
return Object(r.a)(a.length, i.length) ? a.formatter ? a.formatter(i, a.delimiter) : function(e, t, a) {
return e.substring(0, a) + t + e.substring(a)
}(i, a.delimiter, a.partLength) : e
}
const o = {
US: /^\d{5}$/
};
function c(e, t="US") {
if (!e)
return !1;
const a = o[t];
return !a || a.test(e)
}
},
"./lib/purchases/actions.js": function(e, t, a) {
"use strict";
a.d(t, "b", (function() {
return c
}
)),
a.d(t, "a", (function() {
return l
}
)),
a.d(t, "e", (function() {
return d
}
)),
a.d(t, "c", (function() {
return u
}
)),
a.d(t, "d", (function() {
return p
}
));
var n = a("../node_modules/debug/src/browser.js")
, s = a.n(n)
, r = a("./lib/wp/browser.js")
, i = a("./notices/index.js");
const o = s()("calypso:purchases:actions");
function c(e, t) {
r.a.undocumented().cancelPurchase(e, (e,a)=>{
o(e, a);
const n = !e && a.success;
t(n)
}
)
}
function l(e, t, a) {
r.a.undocumented().cancelAndRefundPurchase(e, t, a)
}
function d(e, t, a) {
const n = r.a.marketing().survey(e, t);
return n.addResponses(a),
o("Survey responses", n),
n.submit().then(e=>{
o("Survey submit response", e),
e.success || i.a.error(e.err)
}
).catch(e=>o(e))
}
function u(e, t) {
r.a.undocumented().disableAutoRenew(e, (e,a)=>{
o(e, a);
const n = !e && a.success;
t(n)
}
)
}
function p(e, t) {
r.a.undocumented().enableAutoRenew(e, (e,a)=>{
o(e, a);
const n = !e && a.success;
t(n)
}
)
}
},
"./lib/react-helpers/index.js": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return l
}
)),
a.d(t, "b", (function() {
return d
}
));
var n = a("../node_modules/react-dom/index.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../node_modules/react-redux/es/index.js")
, c = a("./components/localized-moment/context.js");
function l(...e) {
return e.join(" › ")
}
function d(e, t, a) {
const n = "string" == typeof t ? document.getElementById(t) : t;
return s.a.render(i.a.createElement(o.a, {
store: a
}, i.a.createElement(c.b, null, e)), n)
}
},
"./lib/safe-protocol-url/index.js": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return s
}
));
var n = a("./lib/url/url-parts.ts");
function s(e) {
if (null === e || "" === e || void 0 === e)
return null;
if (/^\/[^/]/.test(e))
return e;
const {protocol: t, host: a, hash: s, search: r, pathname: i} = Object(n.b)(e);
return "http:" === t || "https:" === t ? e : a ? Object(n.a)({
host: a,
hash: s,
search: r,
pathname: i,
protocol: "http"
}).href : "http:"
}
},
"./lib/store-transactions/index.js": function(e, t, a) {
"use strict";
a.d(t, "c", (function() {
return j
}
)),
a.d(t, "a", (function() {
return C
}
)),
a.d(t, "b", (function() {
return x
}
));
var n = a("../node_modules/lodash-es/isEmpty.js")
, s = a("../node_modules/lodash-es/omit.js")
, r = a("../node_modules/debug/src/browser.js")
, i = a.n(r)
, o = a("../node_modules/inherits/inherits_browser.js")
, c = a.n(o)
, l = a("../packages/load-script/dist/esm/index.js");
const d = i()("calypso:payment-gateway");
function u() {
if (!(this instanceof u))
return new u
}
u.prototype.ready = function(e, t) {
return new Promise((a,n)=>{
window[t] ? a(window[t]) : Object(l.a)(e, (function(e) {
e ? n(e) : (d("Payment gateway " + t + " loaded for the first time"),
a(window[t]))
}
))
}
)
}
;
var p = new u
, m = a("./lib/checkout/index.js")
, h = a("./lib/store-transactions/step-types.js")
, g = a("./lib/wp/browser.js")
, b = a("./lib/checkout/processor-specific.js")
, f = a("./lib/stripe/index.js");
const _ = i()("calypso:store-transactions")
, y = g.a.undocumented();
function j(e, t) {
return new E(e,t)
}
function v(e, t) {
this.code = e,
this.message = t
}
function E(e, t) {
this._initialData = e,
this._onStep = t;
const a = this._initialData.payment.paymentMethod
, n = this._paymentHandlers[a];
if (!n)
throw new Error("Invalid payment method: " + a);
n.call(this)
}
function $(e, t) {
return _("creating token with ebanx"),
new Promise((function(a, n) {
y.ebanxConfiguration({
request_type: e
}, (function(e, s) {
return e && n(e),
p.ready(s.js_url, "EBANX", !1).then(e=>{
e.config.setMode(s.environment),
e.config.setPublishableKey(s.public_key),
e.config.setCountry(t.country.toLowerCase());
const r = function(e) {
return {
card_name: e.name,
card_number: e.number,
card_cvv: e.cvv,
card_due_date: e["expiration-date"].substring(0, 2) + "/20" + e["expiration-date"].substring(3, 5)
}
}(t);
e.card.createToken(r, (function(t) {
e.deviceFingerprint.setup((function(e) {
return t.data.deviceId = e,
function(e, t, a) {
if (e.error.hasOwnProperty("err"))
return a(Object(b.f)(e.error.err));
return e.data.paymentMethod = "WPCOM_Billing_Ebanx",
t(e.data)
}(t, a, n)
}
))
}
))
}
).catch(e=>{
n(e)
}
)
}
))
}
))
}
function C(e, t, a) {
return Object(b.b)(t.country) ? $(e, t).then(e=>a(null, e), (function(e) {
return a(new Error(e))
}
)) : function(e, t, a) {
function n(e) {
if (e.is_error)
return a(new Error("Paygate Response Error: " + e.error_msg));
e.paymentMethod = "WPCOM_Billing_MoneyPress_Paygate",
a(null, e)
}
function s() {
a(new Error("Paygate Request Error"))
}
_("creating token with Paygate"),
y.paygateConfiguration({
request_type: e,
country: t.country,
card_brand: t.brand
}, (function(e, r) {
e ? a(e) : p.ready(r.js_url, "Paygate").then(e=>{
e.setProcessor(r.processor),
e.setApiUrl(r.api_url),
e.setPublicKey(r.public_key),
e.setEnvironment(r.environment);
const a = function(e) {
if (e.tokenized_payment_data)
return {
token: {
name: e.name,
zip: e["postal-code"],
country: e.country,
card_display_name: e.card_display_name,
...e.tokenized_payment_data
}
};
return {
name: e.name,
number: e.number,
cvc: e.cvv,
zip: e["postal-code"],
country: e.country,
exp_month: e["expiration-date"].substring(0, 2),
exp_year: "20" + e["expiration-date"].substring(3, 5)
}
}(t);
e.createToken(a, n, s)
}
).catch(e=>{
a(e)
}
)
}
))
}(e, t, a)
}
async function x(e) {
const t = await y.stripeConfiguration(e);
return _("Stripe configuration", t),
t
}
c()(v, Error),
E.prototype._pushStep = function(e) {
const t = {
first: !1,
last: !1,
timestamp: Date.now()
};
this._onStep(Object.assign(t, e))
}
,
E.prototype._paymentHandlers = {
WPCOM_Billing_MoneyPress_Stored: async function() {
const {mp_ref: e, stored_details_id: t, payment_partner: a} = this._initialData.payment.storedCard
, {successUrl: n, cancelUrl: s, stripeConfiguration: r} = this._initialData;
this._pushStep({
name: h.b,
first: !0
}),
_("submitting transaction with stored card");
const i = await this._submitWithPayment({
payment_method: "WPCOM_Billing_MoneyPress_Stored",
payment_key: e,
payment_partner: a,
stored_details_id: t,
successUrl: n,
cancelUrl: s
});
i && i.message && i.message.payment_intent_client_secret && await this.stripeModalAuth(r, i)
},
WPCOM_Billing_MoneyPress_Paygate: function() {
const {newCardDetails: e} = this._initialData.payment
, {successUrl: t, cancelUrl: a} = this._initialData
, s = e.tokenized_payment_data ? "token" : void 0
, r = Object(m.e)(e, s);
Object(n.a)(r.errors) ? (this._pushStep({
name: h.b,
first: !0
}),
_("submitting transaction with new card"),
this._createCardToken(function(n) {
const {name: s, country: r, "postal-code": i} = e;
let o = {
payment_method: n.paymentMethod,
payment_key: n.token,
name: s,
zip: i,
country: r,
successUrl: t,
cancelUrl: a
};
if (Object(b.b)(r)) {
const t = {
state: e.state,
city: e.city,
address_1: e["address-1"],
address_2: e["address-2"],
street_number: e["street-number"],
phone_number: e["phone-number"],
document: e.document,
device_id: n.deviceId
};
o = {
...o,
...t
}
}
this._submitWithPayment(o)
}
.bind(this))) : this._pushStep({
name: h.b,
error: new v("invalid-card-details",r.errors),
first: !0,
last: !0
})
},
WPCOM_Billing_Ebanx: function() {
const {newCardDetails: e} = this._initialData.payment
, {successUrl: t, cancelUrl: a} = this._initialData
, s = e.tokenized_payment_data ? "token" : void 0
, r = Object(m.e)(e, s);
Object(n.a)(r.errors) ? (this._pushStep({
name: h.b,
first: !0
}),
_("submitting transaction with new card (ebanx)"),
this._createCardToken(n=>{
const {name: s, country: r, "postal-code": i} = e
, o = {
payment_method: n.paymentMethod,
payment_key: n.token,
name: s,
zip: i,
country: r,
successUrl: t,
cancelUrl: a,
state: e.state,
city: e.city,
address_1: e["address-1"],
address_2: e["address-2"],
street_number: e["street-number"],
phone_number: e["phone-number"],
document: e.document,
device_id: n.deviceId
};
this._submitWithPayment(o)
}
)) : this._pushStep({
name: h.b,
error: new v("invalid-card-details",r.errors),
first: !0,
last: !0
})
},
WPCOM_Billing_WPCOM: function() {
this._pushStep({
name: h.b,
first: !0
}),
this._submitWithPayment({
payment_method: "WPCOM_Billing_WPCOM"
})
},
WPCOM_Billing_Stripe_Payment_Method: async function() {
const {newCardDetails: e} = this._initialData.payment
, {successUrl: t, cancelUrl: a, stripe: s, stripeConfiguration: r} = this._initialData;
_("validating transaction with new stripe elements card");
const i = Object(m.e)(e, "stripe");
if (!Object(n.a)(i.errors))
return void this._pushStep({
name: h.b,
error: new v("invalid-card-details",i.errors),
first: !0,
last: !0
});
this._pushStep({
name: h.b,
first: !0
}),
_("submitting transaction with new stripe elements card");
const {name: o, country: c, "postal-code": l, "phone-number": d} = e
, u = {
name: o,
address: {
country: c,
postal_code: l
}
};
d && (u.phone = d);
try {
const e = await Object(f.e)(s, u);
this._pushStep({
name: h.e
});
const n = await this._submitWithPayment({
payment_method: "WPCOM_Billing_Stripe_Payment_Method",
payment_key: e.id,
payment_partner: r.processor_id,
name: o,
zip: l,
country: c,
successUrl: t,
cancelUrl: a
});
n && n.message && n.message.payment_intent_client_secret && await this.stripeModalAuth(r, n)
} catch (e) {
if (e instanceof f.c)
return _("There was a validation error:", e),
void this._pushStep({
name: h.b,
error: new v("invalid-card-details",e.messagesByField),
first: !0,
last: !0
});
this._pushStep({
name: h.e,
error: e.message,
last: !0
})
}
},
WPCOM_Billing_Web_Payment: async function() {
const {newCardDetails: e} = this._initialData.payment
, {successUrl: t, cancelUrl: a, stripeConfiguration: n} = this._initialData
, {name: s, country: r, "postal-code": i, payment_key: o} = e;
_("submitting transaction with new stripe elements web payment", this._initialData);
try {
if (!o)
throw new Error("Payment failed. Please try again.");
const e = await this._submitWithPayment({
payment_method: "WPCOM_Billing_Stripe_Payment_Method",
payment_key: o,
payment_partner: n.processor_id,
name: s,
zip: i,
country: r,
successUrl: t,
cancelUrl: a
});
_("received web payment transaction response", e),
e && e.message && e.message.payment_intent_client_secret && await this.stripeModalAuth(n, e)
} catch (e) {
this._pushStep({
name: h.e,
error: e,
last: !0
})
}
}
},
E.prototype._createCardToken = function(e) {
this._pushStep({
name: h.h
}),
C("new_purchase", this._initialData.payment.newCardDetails, function(t, a) {
if (t)
return this._pushStep({
name: h.e,
error: t,
last: !0
});
this._pushStep({
name: h.e
}),
e(a)
}
.bind(this))
}
,
E.prototype._submitWithPayment = function(e) {
const t = {
cart: Object(s.a)(this._initialData.cart, ["messages"]),
domain_details: this._initialData.domainDetails,
payment: e
};
return this._pushStep({
name: h.i
}),
g.a.undocumented().transactions(t).then(e=>(e.message ? this._pushStep({
name: h.c,
data: e,
last: !1
}) : e.redirect_url ? this._pushStep({
name: h.g,
data: e,
last: !0
}) : this._pushStep({
name: h.f,
data: e,
last: !0
}),
e)).catch(e=>{
this._pushStep({
name: h.f,
error: e,
last: !0
})
}
)
}
,
E.prototype.stripeModalAuth = async function(e, t) {
try {
const a = await Object(f.d)(e, t.message.payment_intent_client_secret);
a && this._pushStep({
name: h.d,
data: {
status: a.status,
orderId: t.order_id
},
last: !0
})
} catch (e) {
_("error during stripeModalAuth", e),
this._pushStep({
name: h.d,
error: e.stripeError ? e.stripeError : e.message,
last: !0
})
}
}
},
"./lib/store-transactions/step-types.js": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return n
}
)),
a.d(t, "b", (function() {
return s
}
)),
a.d(t, "e", (function() {
return r
}
)),
a.d(t, "f", (function() {
return i
}
)),
a.d(t, "g", (function() {
return o
}
)),
a.d(t, "c", (function() {
return c
}
)),
a.d(t, "d", (function() {
return l
}
)),
a.d(t, "h", (function() {
return d
}
)),
a.d(t, "i", (function() {
return u
}
));
const n = "before-submit"
, s = "input-validation"
, r = "received-payment-key-response"
, i = "received-wpcom-response"
, o = "redirecting-for-authorization"
, c = "modal-authorization"
, l = "received-authorization-response"
, d = "submitting-payment-key-request"
, u = "submitting-wpcom-request"
},
"./lib/stripe/index.js": function(e, t, a) {
"use strict";
a.d(t, "c", (function() {
return h
}
)),
a.d(t, "b", (function() {
return g
}
)),
a.d(t, "e", (function() {
return f
}
)),
a.d(t, "f", (function() {
return _
}
)),
a.d(t, "d", (function() {
return y
}
)),
a.d(t, "a", (function() {
return E
}
)),
a.d(t, "g", (function() {
return $
}
)),
a.d(t, "h", (function() {
return C
}
));
var n = a("../node_modules/debug/src/browser.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../packages/load-script/dist/esm/index.js")
, c = a("../node_modules/react-stripe-elements/es/index.js")
, l = a("../node_modules/react-redux/es/index.js")
, d = a("./lib/store-transactions/index.js")
, u = a("./state/current-user/selectors.js");
const p = s()("calypso:stripe")
, m = Object(r.createContext)();
function h(e, t) {
const a = Object.keys(t)
, n = a.length ? t[a[0]] : e;
this.message = n,
this.code = e,
this.messagesByField = t
}
function g(e) {
this.stripeError = e,
this.message = e.message
}
function b(e) {
this.stripeError = e,
this.message = e.message
}
async function f(e, t) {
p("creating payment method...", t);
const {paymentMethod: a, error: n} = await e.createPaymentMethod("card", {
billing_details: t
});
if (p("payment method creation complete", a, n),
n) {
if ("validation_error" === n.type)
throw new h(n.code,j(n) || {});
throw new Error(n.message)
}
return a
}
async function _(e, t, a) {
p("creating setup intent...", a);
let n = {};
try {
n = await e.handleCardSetup(t.setup_intent_id, {
payment_method_data: {
billing_details: a
}
})
} catch (r) {
throw new g(r)
}
const {setupIntent: s, error: r} = n;
if (p("setup intent creation complete", s, r),
r || !s) {
if ("validation_error" === r.type)
throw new h(r.code,j(r) || {});
throw new g(r)
}
return s
}
async function y(e, t) {
p("Confirming paymentIntent...", t);
const a = window.Stripe(e.public_key)
, {paymentIntent: n, error: s} = await a.handleCardPayment(t, {});
if (s)
throw p("Confirming paymentIntent failed", s),
new b(s);
return n
}
function j(e) {
if ("validation_error" !== e.type || !e.code)
return null;
switch (e.code) {
case "incomplete_number":
case "invalid_number":
return {
card_number: [e.message]
};
case "incomplete_cvc":
case "invalid_cvc":
return {
card_cvc: [e.message]
};
case "incomplete_expiry":
case "invalid_expiry":
return {
card_expiry: [e.message]
}
}
return null
}
h.prototype = new Error,
g.prototype = new Error,
b.prototype = new Error;
const v = Object(c.injectStripe)((function({stripe: e, stripeData: t, children: a}) {
const n = {
...t,
stripe: e
};
return i.a.createElement(m.Provider, {
value: n
}, a)
}
));
function E({children: e, configurationArgs: t, fetchStripeConfiguration: a}) {
p("rendering StripeHookProvider");
const {stripeConfiguration: n, setStripeError: s} = function(e, t) {
const [a,n] = Object(r.useState)()
, [s,i] = Object(r.useState)();
return Object(r.useEffect)(()=>{
const a = t || d.b;
p("loading stripe configuration");
let n = !0;
return a(e || {}).then(e=>n && i(e)),
()=>n = !1
}
, [e, a, t]),
{
stripeConfiguration: s,
setStripeError: n
}
}(t, a)
, {stripeJs: m, isStripeLoading: h, stripeLoadingError: g} = function(e) {
const [t,a] = Object(r.useState)(null)
, [n,s] = Object(r.useState)(!0)
, [i,c] = Object(r.useState)()
, d = function(e) {
if (!e)
return "auto";
if ("pt-br" === e.toLowerCase())
return "pt-BR";
const t = e.toLowerCase().substring(0, 2);
if (!["ar", "bg", "cs", "da", "de", "el", "et", "en", "es", "fi", "fr", "he", "id", "it", "ja", "lt", "lv", "ms", "nb", "nl", "pl", "pt", "ru", "sk", "sl", "sv", "zh"].includes(t))
return "auto";
return t
}(Object(l.e)(e=>Object(u.j)(e)));
return Object(r.useEffect)(()=>{
let n = !0;
return async function() {
if (e) {
if (window.Stripe)
return p("stripe.js already loaded"),
s(!1),
void (t || (c(),
a(window.Stripe(e.public_key, {
locale: d
}))));
p("loading stripe.js..."),
await Object(o.a)(e.js_url),
p("stripe.js loaded!"),
n && s(!1),
n && c(),
n && a(window.Stripe(e.public_key, {
locale: d
}))
}
}().catch(e=>{
p("error while loading stripeJs", e),
n && s(!1),
n && c(e)
}
),
()=>n = !1
}
, [e, t, d]),
{
stripeJs: t,
isStripeLoading: n,
stripeLoadingError: i
}
}(n)
, b = {
stripe: null,
stripeConfiguration: n,
isStripeLoading: h,
stripeLoadingError: g,
setStripeError: s
};
return i.a.createElement(c.StripeProvider, {
stripe: m
}, i.a.createElement(c.Elements, null, i.a.createElement(v, {
stripeData: b
}, e)))
}
function $() {
return Object(r.useContext)(m) || {
stripe: null,
stripeConfiguration: null,
isStripeLoading: !1,
stripeLoadingError: null,
setStripeError: ()=>{}
}
}
function C(e) {
return t=>{
const a = {
...t,
...$()
};
return i.a.createElement(e, a)
}
}
},
"./lib/url/decode-utils.ts": function(e, t, a) {
"use strict";
function n(e, t) {
const a = e && e.toString ? e.toString() : "";
try {
return t(a)
} catch (e) {
return a
}
}
function s(e) {
return n(e, decodeURI)
}
function r(e) {
return n(e, decodeURIComponent)
}
a.d(t, "b", (function() {
return s
}
)),
a.d(t, "a", (function() {
return r
}
))
},
"./lib/url/support.js": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return r
}
)),
a.d(t, "b", (function() {
return i
}
)),
a.d(t, "d", (function() {
return o
}
)),
a.d(t, "e", (function() {
return c
}
)),
a.d(t, "f", (function() {
return l
}
)),
a.d(t, "g", (function() {
return d
}
)),
a.d(t, "c", (function() {
return u
}
)),
a.d(t, "h", (function() {
return p
}
)),
a.d(t, "i", (function() {
return m
}
)),
a.d(t, "p", (function() {
return h
}
)),
a.d(t, "q", (function() {
return g
}
)),
a.d(t, "j", (function() {
return b
}
)),
a.d(t, "k", (function() {
return f
}
)),
a.d(t, "l", (function() {
return _
}
)),
a.d(t, "m", (function() {
return y
}
)),
a.d(t, "o", (function() {
return j
}
)),
a.d(t, "n", (function() {
return v
}
)),
a.d(t, "r", (function() {
return E
}
)),
a.d(t, "D", (function() {
return $
}
)),
a.d(t, "E", (function() {
return C
}
)),
a.d(t, "z", (function() {
return x
}
)),
a.d(t, "C", (function() {
return P
}
)),
a.d(t, "B", (function() {
return O
}
)),
a.d(t, "A", (function() {
return S
}
)),
a.d(t, "s", (function() {
return w
}
)),
a.d(t, "t", (function() {
return k
}
)),
a.d(t, "u", (function() {
return D
}
)),
a.d(t, "v", (function() {
return N
}
)),
a.d(t, "w", (function() {
return T
}
)),
a.d(t, "x", (function() {
return I
}
)),
a.d(t, "y", (function() {
return R
}
)),
a.d(t, "I", (function() {
return A
}
)),
a.d(t, "F", (function() {
return F
}
)),
a.d(t, "H", (function() {
return L
}
)),
a.d(t, "G", (function() {
return U
}
)),
a.d(t, "J", (function() {
return M
}
)),
a.d(t, "K", (function() {
return q
}
)),
a.d(t, "L", (function() {
return B
}
)),
a.d(t, "N", (function() {
return G
}
)),
a.d(t, "O", (function() {
return V
}
)),
a.d(t, "P", (function() {
return H
}
)),
a.d(t, "M", (function() {
return W
}
)),
a.d(t, "Q", (function() {
return Y
}
)),
a.d(t, "R", (function() {
return z
}
)),
a.d(t, "S", (function() {
return K
}
)),
a.d(t, "T", (function() {
return Q
}
)),
a.d(t, "U", (function() {
return J
}
)),
a.d(t, "V", (function() {
return X
}
)),
a.d(t, "W", (function() {
return Z
}
)),
a.d(t, "X", (function() {
return ee
}
)),
a.d(t, "Y", (function() {
return te
}
)),
a.d(t, "Z", (function() {
return ae
}
)),
a.d(t, "ab", (function() {
return ne
}
)),
a.d(t, "bb", (function() {
return se
}
)),
a.d(t, "cb", (function() {
return re
}
));
var n = a("./lib/i18n-utils/browser.js");
const s = Object(n.l)("https://wordpress.com/support/").replace(/\/$/, "")
, r = s + "/adding-g-suite-to-your-site"
, i = s + "/auto-renewal"
, o = s + "/domains/custom-dns/#changing-name-servers-to-point-to-wordpress-com"
, c = s + "/domains/change-name-servers/#finding-out-your-new-name-server"
, l = s + "/concierge-support"
, d = s + "/contact"
, u = "/help/contact"
, p = s + "/domains/custom-dns"
, m = s + "/designated-agent/"
, h = s + "/domain-registration-agreements/"
, g = s + "/domains/register-domain/#waiting-for-domain-changes"
, b = s + "/domains"
, f = s + "/domains/#cancel-a-domain-name"
, _ = s + "/domains/domain-expiration/"
, y = s + "/domains/domain-expiration/#renewing-a-domain-in-the-redemption-period"
, j = s + "/domains/register-domain/#waiting-for-domain-changes"
, v = s + "/domains/domain-pricing-and-available-tlds"
, E = s + "/ecommerce"
, $ = s + "/move-domain/incoming-domain-transfer/#checking-your-transfer-status-and-failed-transfers"
, C = s + "/incoming-domain-transfer/status-and-failed-transfers/#pending"
, x = s + "/incoming-domain-transfer/"
, P = s + "/incoming-domain-transfer/prepare-domain-for-transfer/#unlock"
, O = s + "/incoming-domain-transfer/prepare-domain-for-transfer/#auth-code"
, S = s + "/incoming-domain-transfer/#auth-code-invalid"
, w = s + "/email-forwarding"
, k = s + "/domains/register-domain/#email-validation-and-verification"
, D = s + "/empty-site/"
, N = s + "/forms"
, T = "https://gsuite.google.com/learning-center/"
, I = s + "/guided-transfer"
, R = s + "/https-ssl"
, A = "https://jetpack.com/support/"
, F = "https://jetpack.com/contact-support/?rel=support"
, L = "https://help.vaultpress.com/install-vaultpress/"
, U = "https://akismet.com/support/"
, M = s + "/manage-purchases"
, q = s + "/manage-purchases/#automatic-renewal"
, B = s + "/manage-purchases/#faq-cancelling-your-plans-and-domains"
, G = s + "/domains/map-existing-domain"
, V = s + "/domains/map-existing-domain#2-ask-your-domain-provider-to-update-your-dns-settings"
, H = s + "/domains/map-subdomain"
, W = s + "/domains/map-existing-domain/#change-your-domains-name-servers"
, Y = s + "/domains/#move-a-domain-name"
, z = s + "/domains/register-domain/#public-versus-private-registration-and-gdpr"
, K = s + "/manage-purchases/#refund-policy"
, Q = s + "/domains/register-domain/"
, J = s + "/domains/#set-a-primary-address"
, X = s + "/setting-up-premium-services"
, Z = s + "/site-redirect"
, ee = s + "/"
, te = s + "/transfer-domain-registration"
, ae = s + "/transfer-domain-registration#starting-the-transfer-with-your-new-registrar"
, ne = s + "/update-contact-information/#email-or-name-changes"
, se = s + "/domains/domain-management/#update-nameservers"
, re = s + "/wpcc-faq"
},
"./lib/user-agent/index.js": function(e, t, a) {
"use strict";
var n = a("../node_modules/express-useragent/index.js")
, s = a.n(n);
t.a = s.a.parse(navigator.userAgent)
},
"./lib/version-compare/index.js": function(e, t, a) {
"use strict";
t.a = function(e, t, a) {
let n = 0
, s = 0
, r = 0
, i = {
dev: -6,
alpha: -5,
a: -5,
beta: -4,
b: -4,
RC: -3,
rc: -3,
"#": -2,
p: 1,
pl: 1
}
, o = function(e) {
return (e = (e = ("" + e).replace(/[_\-+]/g, ".")).replace(/([^.\d]+)/g, ".$1.").replace(/\.{2,}/g, ".")).length ? e.split(".") : [-8]
};
const c = function(e) {
return e ? isNaN(e) ? i[e] || -7 : parseInt(e, 10) : 0
};
for (e = o(e),
t = o(t),
s = Math.max(e.length, t.length),
n = 0; n < s; n++)
if (e[n] != t[n]) {
if (e[n] = c(e[n]),
t[n] = c(t[n]),
e[n] < t[n]) {
r = -1;
break
}
if (e[n] > t[n]) {
r = 1;
break
}
}
if (!a)
return r;
switch (a) {
case ">":
case "gt":
return r > 0;
case ">=":
case "ge":
return r >= 0;
case "<=":
case "le":
return r <= 0;
case "==":
case "=":
case "eq":
return 0 === r;
case "<>":
case "!=":
case "ne":
return 0 !== r;
case "":
case "<":
case "lt":
return r < 0;
default:
return null
}
}
},
"./lib/wporg/index.js": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return b
}
)),
a.d(t, "b", (function() {
return f
}
)),
a.d(t, "c", (function() {
return _
}
)),
a.d(t, "d", (function() {
return y
}
));
var n = a("../node_modules/debug/src/browser.js")
, s = a.n(n)
, r = a("../packages/i18n-calypso/dist/esm/index.js")
, i = a("../node_modules/lodash-es/find.js")
, o = a("../node_modules/qs/lib/index.js");
const c = s()("jsonp");
var l = function(e, t, a) {
let n, s, r, i = encodeURIComponent, l = document.getElementsByTagName("script")[0] || document.head;
r = "__jp" + d++,
s = setTimeout((function() {
p(),
a && a(new Error("Timeout"))
}
), 6e4);
function p() {
n.parentNode && n.parentNode.removeChild(n),
window[r] = u,
s && clearTimeout(s)
}
return window[r] = function(e) {
c("jsonp got", e),
p(),
a && a(null, e)
}
,
e += "=" + i(r) + "?" + Object(o.stringify)(t),
c('jsonp req "%s"', e),
n = document.createElement("script"),
n.src = e,
l.parentNode.insertBefore(n, l),
function() {
window[r] && p()
}
};
let d = 0;
function u() {}
var p = a("./languages.js");
const m = s()("wporg");
function h() {
const e = r.a.getLocaleSlug();
let t = Object(i.a)(p.a, {
langSlug: e
}).wpLocale;
return "" === t && (t = e),
t
}
async function g(e, t) {
const a = await fetch(`${e}?${Object(o.stringify)(t)}`, {
method: "GET",
headers: {
Accept: "application/json"
}
});
if (a.ok)
return await a.json();
throw new Error(await a.body)
}
function b(e) {
const t = {
fields: "icons,banners,compatibility,ratings,-contributors",
locale: h()
}
, a = "https://api.wordpress.org/plugins/info/1.0/" + (e = e.replace(new RegExp(".php$"), "")) + ".jsonp";
return new Promise((e,n)=>{
l(a, t, (function(t, a) {
return t ? (m("error downloading plugin details from .org: %s", t),
void n(t)) : a && a.slug ? void e(a) : (m("unrecognized format fetching plugin details from .org: %s", a),
void n(new Error("Unrecognized response format")))
}
))
}
)
}
function f(e, t) {
let a;
const n = e.page || 1
, s = e.pageSize || 24
, r = e.category || "all"
, i = e.search;
a = "request[page]=" + n + "&request[per_page]=" + s + "&request[fields][icons]=1&request[fields][banners]=1&request[fields][compatibility]=1&request[fields][tested]=0&request[fields][requires]=0&request[fields][sections]=0",
a += i ? "&request[search]=" + i : "&request[browse]=" + r,
async function(e, t) {
try {
const a = await fetch(e, {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/x-www-form-urlencoded"
},
body: t
});
return a.ok ? [null, await a.json()] : [new Error(await a.body), null]
} catch (e) {
return [e, null]
}
}("https://api.wordpress.org/plugins/info/1.1/?action=query_plugins", encodeURI(a)).then(([e,a])=>{
t(e, a)
}
)
}
function _(e) {
return g("https://api.wordpress.org/themes/info/1.1/", {
action: "theme_information",
"request[fields][extended_author]": !0,
"request[slug]": e
})
}
function y(e={}) {
const {search: t, page: a, number: n} = e;
return g("https://api.wordpress.org/themes/info/1.1/", {
action: "query_themes",
"request[fields][extended_author]": !0,
"request[search]": t,
"request[page]": a,
"request[per_page]:": n
})
}
},
"./me/billing-history/style.scss": function(e, t, a) {},
"./me/concierge/constants.js": function(e, t, a) {
"use strict";
a.d(t, "f", (function() {
return n
}
)),
a.d(t, "g", (function() {
return s
}
)),
a.d(t, "h", (function() {
return r
}
)),
a.d(t, "i", (function() {
return i
}
)),
a.d(t, "j", (function() {
return o
}
)),
a.d(t, "k", (function() {
return c
}
)),
a.d(t, "b", (function() {
return l
}
)),
a.d(t, "a", (function() {
return d
}
)),
a.d(t, "m", (function() {
return u
}
)),
a.d(t, "n", (function() {
return p
}
)),
a.d(t, "e", (function() {
return m
}
)),
a.d(t, "c", (function() {
return h
}
)),
a.d(t, "d", (function() {
return g
}
)),
a.d(t, "l", (function() {
return b
}
));
const n = "booked"
, s = "booking"
, r = "booking_error"
, i = "cancelled"
, o = "cancelling"
, c = "cancelling_error"
, l = "rest_concierge_no_available_staff"
, d = "rest_concierge_already_has_appointment"
, u = 1
, p = 2
, m = "has-upcoming-appointment"
, h = "has-available-included-session"
, g = "has-available-purchased-session"
, b = "suggest-purchase-concierge"
},
"./me/controller.js": function(e, t, a) {
"use strict";
a.d(t, "e", (function() {
return _e
}
)),
a.d(t, "c", (function() {
return ye
}
)),
a.d(t, "a", (function() {
return je
}
)),
a.d(t, "d", (function() {
return ve
}
)),
a.d(t, "f", (function() {
return Ee
}
)),
a.d(t, "b", (function() {
return $e
}
));
var n = a("../node_modules/react/index.js")
, s = a.n(n)
, r = a("../node_modules/page/page.js")
, i = a.n(r)
, o = a("../packages/i18n-calypso/dist/esm/index.js")
, c = a("./lib/user-settings/index.js")
, l = a("./state/document-head/actions.js")
, d = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, u = a.n(d)
, p = a("../node_modules/react-redux/es/index.js")
, m = a("../node_modules/lodash-es/flow.js")
, h = a("../packages/components/dist/esm/button/index.js")
, g = a("./config/index.js")
, b = a("./components/animate/index.jsx")
, f = a("./components/gravatar/index.jsx")
, _ = a("./state/analytics/actions/record.js");
a("./me/profile-gravatar/style.scss");
var y = Object(p.c)(null, {
recordGravatarMisclick: function() {
return Object(_.c)("Me", "Clicked on Unclickable Gravatar Image in Sidebar")
}
})((function(e) {
const t = ["profile-gravatar", e.inSidebar ? "is-in-sidebar" : ""].join(" ");
return s.a.createElement("div", {
className: t
}, s.a.createElement("div", {
role: "presentation",
onClick: e.recordGravatarMisclick
}, s.a.createElement(b.a, {
type: "appear"
}, s.a.createElement(f.a, {
user: e.user,
size: 150,
imgSize: 400
}))), s.a.createElement("h2", {
className: "profile-gravatar__user-display-name"
}, e.user.display_name), s.a.createElement("div", {
className: "profile-gravatar__user-secondary-info"
}, "@", e.user.username))
}
))
, j = a("./me/purchases/paths.js")
, v = a("./layout/sidebar/index.jsx")
, E = a("./layout/sidebar/footer.jsx")
, $ = a("./layout/sidebar/heading.jsx")
, C = a("./layout/sidebar/item.jsx")
, x = a("./layout/sidebar/menu.jsx")
, P = a("./layout/sidebar/region.jsx")
, O = a("./lib/user/index.js")
, S = a("./lib/user/utils.js")
, w = a("./state/current-user/selectors.js")
, k = a("../node_modules/lodash-es/get.js")
, D = a("./state/login/utils.js");
var N = a("./state/ui/layout-focus/actions.js");
a("./me/sidebar/style.scss");
class T extends s.a.Component {
constructor(...e) {
super(...e),
u()(this, "onNavigate", ()=>{
this.props.setNextLayoutFocus("content"),
window.scrollTo(0, 0)
}
),
u()(this, "onSignOut", async()=>{
const {currentUser: e} = this.props;
let t = null;
if (e && "en" === e.localeSlug && !g.a.isEnabled("desktop") && (t = "/?apppromo"),
g.a.isEnabled("login/wp-login"))
try {
const {redirect_to: e} = await this.props.logoutUser(t);
await Object(O.default)().clear(),
window.location.href = e || "/"
} catch {
S.a.logout(t)
}
else
S.a.logout(t);
this.props.recordGoogleEvent("Me", "Clicked on Sidebar Sign Out Link")
}
)
}
render() {
const {context: e, translate: t} = this.props
, a = {
"/me": "profile",
"/me/security/account-recovery": "security",
"/me/security/connected-applications": "security",
"/me/security/password": "security",
"/me/security/social-login": "security",
"/me/security/two-step": "security",
"me/privacy": "privacy",
"/me/notifications/comments": "notifications",
"/me/notifications/updates": "notifications",
"/me/notifications/subscriptions": "notifications",
"/help/contact": "help",
[j.k]: "purchases",
[j.c]: "purchases",
[j.b]: "purchases",
[j.l]: "purchases",
[j.j]: "purchases",
[j.i]: "purchases",
"/me/chat": "happychat",
"/me/site-blocks": "site-blocks"
}
, n = e.path.replace(/\/\d+$/, "");
let r;
return r = a[n] ? a[n] : e.path.split("/").pop(),
s.a.createElement(v.a, null, s.a.createElement(P.a, null, s.a.createElement(y, {
inSidebar: !0,
user: this.props.currentUser
}), s.a.createElement("div", {
className: "sidebar__me-signout"
}, s.a.createElement(h.a, {
compact: !0,
className: "sidebar__me-signout-button",
onClick: this.onSignOut,
title: t("Log out of WordPress.com")
}, t("Log out"))), s.a.createElement(x.a, null, s.a.createElement($.a, null, t("Profile")), s.a.createElement("ul", null, s.a.createElement(C.a, {
selected: "profile" === r,
link: g.a.isEnabled("me/my-profile") ? "/me" : "//wordpress.com/me/public-profile",
label: t("My Profile"),
materialIcon: "person",
onNavigate: this.onNavigate
}), s.a.createElement(C.a, {
selected: "account" === r,
link: g.a.isEnabled("me/account") ? "/me/account" : "//wordpress.com/me/account",
label: t("Account Settings"),
materialIcon: "settings",
onNavigate: this.onNavigate,
preloadSectionName: "account"
}), s.a.createElement(C.a, {
selected: "purchases" === r,
link: j.k,
label: t("Manage Purchases"),
materialIcon: "credit_card",
onNavigate: this.onNavigate,
preloadSectionName: "purchases"
}), s.a.createElement(C.a, {
selected: "security" === r,
link: "/me/security",
label: t("Security"),
materialIcon: "lock",
onNavigate: this.onNavigate,
preloadSectionName: "security"
}), s.a.createElement(C.a, {
selected: "privacy" === r,
link: "/me/privacy",
label: t("Privacy"),
materialIcon: "visibility",
onNavigate: this.onNavigate,
preloadSectionName: "privacy"
}), s.a.createElement(C.a, {
selected: "notifications" === r,
link: g.a.isEnabled("me/notifications") ? "/me/notifications" : "//wordpress.com/me/notifications",
label: t("Notification Settings"),
materialIcon: "notifications",
onNavigate: this.onNavigate,
preloadSectionName: "notification-settings"
}), s.a.createElement(C.a, {
selected: "site-blocks" === r,
link: "/me/site-blocks",
label: t("Blocked Sites"),
materialIcon: "block",
onNavigate: this.onNavigate,
preloadSectionName: "site-blocks"
}))), s.a.createElement(x.a, null, s.a.createElement($.a, null, t("Special")), s.a.createElement("ul", null, s.a.createElement(C.a, {
selected: "get-apps" === r,
link: "/me/get-apps",
label: t("Get Apps"),
icon: "my-sites",
onNavigate: this.onNavigate
})))), s.a.createElement(E.a, null))
}
}
var I = Object(m.a)(o.c, Object(p.c)(e=>({
currentUser: Object(w.b)(e)
}), {
logoutUser: e=>(t,a)=>{
const n = (Object(w.b)(a()).logout_URL || "").match(/_wpnonce=([^&]*)/)
, s = n && n[1];
return Object(D.g)("logout-endpoint", {
redirect_to: e,
client_id: Object(g.a)("wpcom_signup_id"),
client_secret: Object(g.a)("wpcom_signup_key"),
logout_nonce: s
}).then(e=>Object(k.a)(e, "body.data", {})).catch(e=>Promise.reject(Object(D.b)(e)))
}
,
recordGoogleEvent: _.c,
setNextLayoutFocus: N.c
}))(T)
, R = a("./me/sidebar-navigation/index.jsx")
, A = a("./components/main/index.jsx")
, F = a("./lib/analytics/page-view-tracker/index.jsx");
var L = Object(o.c)(({translate: e})=>s.a.createElement("div", {
className: "get-apps__illustration"
}, s.a.createElement("img", {
src: "/calypso/images/get-apps-banner-2984dff352a6d0b174c9c87de7116f75.svg",
alt: e("Groups of people looking at WordPress mobile apps.")
}), s.a.createElement("h2", {
className: "get-apps__illustration-heading"
}, e("Inspiration strikes any time, anywhere.")), s.a.createElement("p", {
className: "get-apps__illustration-tagline"
}, e("Get WordPress apps for all your screens."))))
, U = a("../node_modules/prop-types/index.js")
, M = a.n(U)
, q = a("../node_modules/lodash-es/identity.js")
, B = a("../node_modules/lodash-es/noop.js")
, G = a("../packages/components/dist/esm/card/index.js");
const V = "https://apps.wordpress.com/d/windows?ref=getapps"
, H = "https://apps.wordpress.com/d/osx?ref=getapps"
, W = "https://apps.wordpress.com/d/linux?ref=getapps"
, Y = "https://apps.wordpress.com/d/linux-deb?ref=getapps";
class z extends n.Component {
getDescription(e) {
const {translate: t} = this.props;
switch (e) {
case "MacIntel":
case "Linux i686":
case "Linux i686 on x86_64":
return t("A desktop app that gives WordPress a permanent home in your dock.");
default:
return t("A desktop app that gives WordPress a permanent home in your taskbar.")
}
}
getRequirementsText(e) {
const {translate: t} = this.props;
switch (e) {
case "MacIntel":
return t("Requires Mac OS X 10.11+. ");
case "Linux i686":
case "Linux i686 on x86_64":
return t("Requires a 64-bit kernel. ");
default:
return t("Requires Windows 7+. ")
}
}
getTranslateComponents(e) {
switch (e) {
case "MacIntel":
return {
firstAvailableLink: this.getLinkAnchorTag(V),
secondAvailableLink: this.getLinkAnchorTag(W),
thirdAvailableLink: this.getLinkAnchorTag(Y)
};
case "Linux i686":
case "Linux i686 on x86_64":
return {
firstAvailableLink: this.getLinkAnchorTag(Y),
secondAvailableLink: this.getLinkAnchorTag(V),
thirdAvailableLink: this.getLinkAnchorTag(H)
};
default:
return {
firstAvailableLink: this.getLinkAnchorTag(H),
secondAvailableLink: this.getLinkAnchorTag(W),
thirdAvailableLink: this.getLinkAnchorTag(Y)
}
}
}
getAlsoAvailableText(e) {
const {translate: t} = this.props;
switch (e) {
case "MacIntel":
return t("Also available for: {{firstAvailableLink}}Windows{{/firstAvailableLink}}, {{secondAvailableLink}}Linux (.tar.gz){{/secondAvailableLink}}, {{thirdAvailableLink}}Linux (.deb){{/thirdAvailableLink}}.", {
components: this.getTranslateComponents(e)
});
case "Linux i686":
case "Linux i686 on x86_64":
return t("Also available for: {{firstAvailableLink}}Linux (.deb){{/firstAvailableLink}}, {{secondAvailableLink}}Windows{{/secondAvailableLink}}, {{thirdAvailableLink}}Mac{{/thirdAvailableLink}}.", {
components: this.getTranslateComponents(e)
});
default:
return t("Also available for: {{firstAvailableLink}}MacOS{{/firstAvailableLink}}, {{secondAvailableLink}}Linux (.tar.gz){{/secondAvailableLink}}, {{thirdAvailableLink}}Linux (.deb){{/thirdAvailableLink}}.", {
components: this.getTranslateComponents(e)
})
}
}
getButtonClickHandler(e) {
const {trackWindowsClick: t, trackMacClick: a, trackLinuxTarClick: n, trackLinuxDebClick: s} = this.props;
switch (e) {
case "MacIntel":
return a;
case "Linux i686":
return n;
case "Linux i686 on x86_64":
return s;
default:
return t
}
}
getButtonLink(e) {
switch (e) {
case "MacIntel":
return H;
case "Linux i686":
case "Linux i686 on x86_64":
return W;
default:
return V
}
}
getCardTitle(e) {
const {translate: t} = this.props;
switch (e) {
case "MacIntel":
return t("Desktop App for Mac");
case "Linux i686":
case "Linux i686 on x86_64":
return t("Desktop App for Linux");
default:
return t("Desktop App for Windows")
}
}
getLinkAnchorTag(e) {
const {trackWindowsClick: t, trackMacClick: a, trackLinuxTarClick: n, trackLinuxDebClick: r} = this.props;
switch (e) {
case H:
return s.a.createElement("a", {
href: e,
onClick: a
});
case W:
return s.a.createElement("a", {
href: e,
onClick: n
});
case Y:
return s.a.createElement("a", {
href: e,
onClick: r
});
default:
return s.a.createElement("a", {
href: e,
onClick: t
})
}
}
render() {
const {translate: e} = this.props
, t = !!(navigator.platform && navigator.platform.length > 0) && navigator.platform;
return s.a.createElement(G.a, {
className: "get-apps__desktop"
}, s.a.createElement("div", {
className: "get-apps__card-text"
}, s.a.createElement("h3", {
className: "get-apps__card-title"
}, this.getCardTitle(t)), s.a.createElement("p", {
className: "get-apps__description"
}, this.getDescription(t)), s.a.createElement("p", {
className: "get-apps__also-available"
}, this.getRequirementsText(t), this.getAlsoAvailableText(t))), s.a.createElement(h.a, {
className: "get-apps__desktop-button",
href: this.getButtonLink(t),
onClick: this.getButtonClickHandler(t)
}, e("Download")))
}
}
u()(z, "propTypes", {
translate: M.a.func,
trackWindowsClick: M.a.func,
trackMacClick: M.a.func,
trackLinuxTarClick: M.a.func,
trackLinuxDebClick: M.a.func
}),
u()(z, "defaultProps", {
translate: q.a,
trackWindowsClick: B.a,
trackMacClick: B.a,
trackLinuxTarClick: B.a,
trackLinuxDebClick: B.a
});
const K = {
trackWindowsClick: ()=>Object(_.e)("calypso_app_download_windows_click"),
trackMacClick: ()=>Object(_.e)("calypso_app_download_mac_click"),
trackLinuxTarClick: ()=>Object(_.e)("calypso_app_download_linux_tar_click"),
trackLinuxDebClick: ()=>Object(_.e)("calypso_app_download_linux_deb_click")
};
var Q = Object(p.c)(null, K)(Object(o.c)(z))
, J = a("./blocks/get-apps/apps-badge.jsx")
, X = a("./me/reauth-required/index.jsx")
, Z = a("./components/data/query-countries/sms.jsx")
, ee = a("./components/forms/form-phone-input/index.jsx")
, te = a("./state/selectors/get-countries.js")
, ae = a("./state/notices/actions.js")
, ne = a("./state/user-settings/actions.js")
, se = a("./state/account-recovery/settings/actions.js")
, re = a("./state/account-recovery/settings/selectors.js")
, ie = a("./state/selectors/get-user-settings.js")
, oe = a("./state/selectors/has-user-settings.js")
, ce = a("./state/data-layer/wpcom-http/actions.js")
, le = a("./lib/phone-validation/index.jsx")
, de = a("./lib/user-agent/index.js")
, ue = a("./lib/two-step-authorization/index.js")
, pe = a("./state/analytics/actions/with-analytics.js")
, me = a("./state/auth/actions.js");
class he extends s.a.Component {
constructor(...e) {
super(...e),
u()(this, "state", {
phoneNumber: null
}),
u()(this, "maybeFetchAccountRecoverySettings", ()=>{
!1 === (!!!ue.a.data || ue.a.isReauthRequired()) && (this.props.fetchUserSettings(),
this.props.accountRecoverySettingsFetch())
}
),
u()(this, "getPreferredNumber", ()=>{
const e = {
countryCode: null,
countryNumericCode: null,
number: null,
numberFull: null,
isValid: !1
};
if (!this.userSettingsHaveBeenLoadedWithAccountRecoveryPhone())
return e;
const t = null != this.props.userSettings ? this.props.userSettings.two_step_sms_phone_number : null
, a = null != this.props.userSettings ? this.props.userSettings.two_step_sms_country : null
, n = null != this.props.userSettings ? this.props.userSettings.two_step_sms_enabled : null
, s = this.props.accountRecoveryPhone;
if (null !== this.state.phoneNumber)
return this.state.phoneNumber;
if (null !== t && null !== a && n) {
const e = this.numericCountryCodeForCountryCode(a)
, n = e + t;
return {
countryCode: a,
countryNumericCode: e,
number: t,
numberFull: n,
isValid: this.phoneNumberIsValid(n)
}
}
if (null !== s) {
const e = this.phoneNumberIsValid(s.numberFull);
return s.isValid = e,
s
}
return e
}
),
u()(this, "onChange", e=>{
this.setState({
phoneNumber: {
countryCode: e.countryData.code,
countryNumericCode: e.countryData.numeric_code,
number: e.phoneNumber,
numberFull: e.phoneNumberFull,
isValid: e.isValid
}
})
}
),
u()(this, "onKeyUp", e=>{
"Enter" === e.key && this.onSubmit(e)
}
),
u()(this, "onSubmit", ()=>{
const e = this.getPreferredNumber().numberFull;
this.props.sendSMS(e)
}
),
u()(this, "onSubmitLink", ()=>{
const e = this.props.userSettings.user_email;
this.props.sendMagicLink(e)
}
)
}
componentDidMount() {
ue.a.on("change", this.maybeFetchAccountRecoverySettings),
this.maybeFetchAccountRecoverySettings()
}
componentWillUnmount() {
ue.a.off("change", this.maybeFetchAccountRecoverySettings)
}
phoneNumberIsValid(e) {
return !Object(le.a)(e).error
}
numericCountryCodeForCountryCode(e) {
const t = this.props.countriesList.find(t=>t.code === e);
return void 0 !== t ? t.numeric_code : null
}
userSettingsHaveBeenLoadedWithAccountRecoveryPhone() {
return this.props.hasUserSettings && this.props.hasLoadedAccountRecoveryPhone
}
render() {
const {translate: e} = this.props
, t = this.userSettingsHaveBeenLoadedWithAccountRecoveryPhone()
, {countryCode: a, number: n, isValid: r} = this.getPreferredNumber()
, {isMobile: i} = de.a
, o = !i;
return s.a.createElement(G.a, {
className: "get-apps__mobile"
}, s.a.createElement(X.a, {
twoStepAuthorization: ue.a
}), s.a.createElement("div", {
className: "get-apps__store-subpanel"
}, s.a.createElement("div", {
className: "get-apps__card-text"
}, s.a.createElement("h3", {
className: "get-apps__card-title"
}, e("Mobile Apps")), s.a.createElement("p", {
className: "get-apps__description"
}, e("WordPress at your fingertips."))), s.a.createElement("div", {
className: "get-apps__badges"
}, s.a.createElement(J.a, {
storeName: "android",
utm_source: "calypso-get-apps"
}), s.a.createElement(J.a, {
storeName: "ios",
utm_source: "calypso-get-apps-button"
}))), o && s.a.createElement("div", {
className: "get-apps__sms-subpanel"
}, s.a.createElement("p", null, s.a.createElement("strong", null, e("Ready to WordPress on the go?")), s.a.createElement("br", null), e("We’ll send you an SMS message with a download link for the right app for your mobile device.")), s.a.createElement("div", {
className: "get-apps__sms-field-wrapper"
}, s.a.createElement(Z.a, null), t ? s.a.createElement(ee.a, {
countriesList: this.props.countriesList,
initialCountryCode: a,
initialPhoneNumber: n,
phoneInputProps: {
onKeyUp: this.onKeyUp
},
onChange: this.onChange
}) : s.a.createElement(s.a.Fragment, null, s.a.createElement(ee.a, {
countriesList: this.props.countriesList,
isDisabled: !0
}))), s.a.createElement("div", {
className: "get-apps__sms-button-wrapper"
}, s.a.createElement("p", null, e("Standard SMS rates may apply")), s.a.createElement(h.a, {
className: "get-apps__sms-button",
onClick: this.onSubmit,
disabled: !r
}, e("Text me a link")))), s.a.createElement("div", {
className: "get-apps__magic-link-subpanel"
}, s.a.createElement("div", {
className: "get-apps__card-text"
}, s.a.createElement("p", null, s.a.createElement("strong", null, e("Instantly log in to the mobile app")), s.a.createElement("br", null), e("Send yourself links to download the app and instantly log in on your mobile device."))), s.a.createElement("div", {
className: "get-apps__link-button-wrapper"
}, s.a.createElement(h.a, {
className: "get-apps__magic-link-button",
onClick: this.onSubmitLink
}, e("Email me a log in link")))))
}
}
u()(he, "propTypes", {
translate: M.a.func,
countriesList: M.a.array.isRequired,
storedPhone: M.a.shape({
countryCode: M.a.string,
countryNumericCode: M.a.string,
number: M.a.string,
numberFull: M.a.string,
isValid: M.a.bool
}),
hasLoadedStoredPhone: M.a.bool,
hasSendingError: M.a.bool
});
var ge = Object(p.c)(e=>({
countriesList: Object(te.a)(e, "sms"),
accountRecoveryPhone: Object(re.b)(e),
hasLoadedAccountRecoveryPhone: Object(re.i)(e),
userSettings: Object(ie.a)(e),
hasUserSettings: Object(oe.a)(e)
}), {
sendSMS: function(e) {
return Object(ce.a)({
method: "POST",
apiNamespace: "wpcom/v2",
path: "/me/get-apps/send-download-sms",
body: {
phone: e
},
onSuccess: function(e) {
e(Object(ae.f)(o.a.translate("SMS Sent. Go check your messages!")))
},
onFailure: function(e) {
e(Object(ae.b)(o.a.translate("We couldn’t send the SMS — double check your number.")))
}
})
},
sendMagicLink: e=>Object(pe.a)(Object(_.e)("calypso_get_apps_magic_link_button_click"), Object(me.a)(e, {
showGlobalNotices: !0,
isMobileAppLogin: !0
})),
fetchUserSettings: ne.b,
accountRecoverySettingsFetch: se.a,
recordTracksEvent: _.e
})(Object(o.c)(he));
a("./blocks/get-apps/style.scss");
var be = ()=>s.a.createElement("div", {
className: "get-apps__wrapper"
}, s.a.createElement(L, null), s.a.createElement(ge, null), !Object(g.a)("env_id").startsWith("desktop") && s.a.createElement(Q, null));
var fe = ()=>s.a.createElement(A.a, {
className: "get-apps"
}, s.a.createElement(F.a, {
path: "/me/get-apps",
title: "Me > Get Apps"
}), s.a.createElement(R.a, null), s.a.createElement(be, null));
function _e(e, t) {
e.secondary = s.a.createElement(I, {
context: e
}),
t()
}
function ye(e, t) {
e.store.dispatch(Object(l.c)(o.a.translate("My Profile", {
textOnly: !0
})));
const n = a("./me/profile/index.jsx").default;
e.primary = s.a.createElement(n, {
userSettings: c.a,
path: e.path
}),
t()
}
function je(e, t) {
e.store.dispatch(Object(l.c)(o.a.translate("Get Apps", {
textOnly: !0
}))),
e.primary = s.a.createElement(fe, {
userSettings: c.a,
path: e.path
}),
t()
}
function ve() {
i.a.redirect("/me")
}
function Ee() {
i.a.redirect("/me")
}
function $e() {
i.a.redirect("/me")
}
},
"./me/form-base/index.js": function(e, t, a) {
"use strict";
var n = a("../node_modules/debug/src/browser.js")
, s = a.n(n)
, r = a("./notices/index.js")
, i = a("./lib/user/index.js");
const o = s()("calypso:me:form-base");
t.a = {
componentDidMount: function() {
this.props.userSettings.getSettings()
},
componentWillUnmount: function() {
this.props.userSettings.unsavedSettings = {}
},
getDisabledState: function() {
return this.state.submittingForm
},
UNSAFE_componentWillReceiveProps: function(e) {
e.showNoticeInitially && this.setState({
showNotice: e.showNoticeInitially
})
},
UNSAFE_componentWillUpdate: function() {
this.showNotice()
},
getInitialState: function() {
return {
redirect: !1,
submittingForm: !1,
changingUsername: !1,
usernameAction: "new",
showNotice: !1
}
},
showNotice: function() {
this.props.userSettings.initialized && this.state.showNotice && (r.a.clearNotices("notices"),
r.a.success(this.props.translate("Settings saved successfully!")),
this.state.showNotice = !1)
},
getSetting: function(e) {
return this.props.userSettings.getSetting(e) || ""
},
toggleSetting: function(e) {
const {name: t} = e.currentTarget;
this.props.userSettings.updateSetting(t, !this.getSetting(t))
},
updateSetting: function(e) {
const {name: t, value: a} = e.currentTarget;
this.props.userSettings.updateSetting(t, a)
},
submitForm: function(e) {
e.preventDefault(),
o("Submitting form"),
this.setState({
submittingForm: !0
}),
this.props.userSettings.saveSettings(function(e, t) {
if (e)
o("Error saving settings: " + JSON.stringify(e)),
e.message ? r.a.error(e.message) : r.a.error(this.props.translate("There was a problem saving your changes.")),
this.setState({
submittingForm: !1
});
else {
if (this.props.markSaved && this.props.markSaved(),
this.state && this.state.redirect)
return void Object(i.default)().clear().then(()=>{
window.location = this.state.redirect + "?updated=success"
}
);
this.setState({
showNotice: !0,
submittingForm: !1
}),
this.showNotice(),
o("Settings saved successfully " + JSON.stringify(t))
}
}
.bind(this))
}
}
},
"./me/memberships/main.scss": function(e, t, a) {},
"./me/memberships/subscription.scss": function(e, t, a) {},
"./me/pending-payments/style.scss": function(e, t, a) {},
"./me/profile-gravatar/style.scss": function(e, t, a) {},
"./me/profile-link/style.scss": function(e, t, a) {},
"./me/profile-links-add-other/style.scss": function(e, t, a) {},
"./me/profile-links-add-wordpress/style.scss": function(e, t, a) {},
"./me/profile-links/style.scss": function(e, t, a) {},
"./me/profile/index.jsx": function(e, t, a) {
"use strict";
a.r(t);
var n = a("../node_modules/react/index.js")
, s = a.n(n)
, r = a("../node_modules/create-react-class/index.js")
, i = a.n(r)
, o = a("../node_modules/debug/src/browser.js")
, c = a.n(o)
, l = a("../node_modules/react-redux/es/index.js")
, d = a("../node_modules/lodash-es/flowRight.js")
, u = a("../packages/i18n-calypso/dist/esm/index.js")
, p = a("../packages/components/dist/esm/card/index.js")
, m = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, h = a.n(m)
, g = a("../node_modules/prop-types/index.js")
, b = a.n(g)
, f = a("../node_modules/classnames/index.js")
, _ = a.n(f)
, y = a("./node_modules/path-browserify/index.js")
, j = a.n(y)
, v = a("./components/gridicon/index.tsx");
const E = ["jpg", "jpeg", "png", "gif", "bmp"];
var $ = a("./state/editor/image-editor/constants.js")
, C = a("../packages/components/dist/esm/dialog/index.js")
, x = a("./components/file-picker/index.jsx")
, P = a("./state/current-user/selectors.js")
, O = a("./components/gravatar/index.jsx")
, S = a("./state/current-user/gravatar-status/selectors.js")
, w = a("./state/editor/image-editor/actions.js")
, k = a("./components/spinner/index.jsx")
, D = a("./state/analytics/actions/with-analytics.js")
, N = a("./state/analytics/actions/record.js")
, T = a("./state/analytics/actions/compose-analytics.js")
, I = a("./state/analytics/actions/bump-stat.js")
, R = a("./state/data-layer/wpcom-http/actions.js")
, A = a("./state/data-layer/wpcom-http/utils.js")
, F = a("./state/data-layer/handler-registry.js");
Object(F.b)("state/data-layer/wpcom/gravatar-upload/index.js", {
GRAVATAR_UPLOAD_REQUEST: [Object(A.a)({
fetch: function(e) {
const {email: t, file: a} = e;
return Object(R.a)({
method: "POST",
path: "/gravatar-upload",
body: {},
apiNamespace: "wpcom/v2",
formData: [["account", t], ["filedata", a]]
}, e)
},
onSuccess: function({file: e}) {
return t=>{
const a = new FileReader;
a.addEventListener("load", ()=>{
t({
type: "GRAVATAR_UPLOAD_RECEIVE",
src: a.result
}),
t(Object(D.a)(Object(N.e)("calypso_edit_gravatar_upload_success"), {
type: "GRAVATAR_UPLOAD_REQUEST_SUCCESS"
}))
}
),
a.readAsDataURL(e)
}
},
onError: function() {
return Object(D.a)(Object(T.a)(Object(N.e)("calypso_edit_gravatar_upload_failure"), Object(I.a)("calypso_gravatar_update_error", "unsuccessful_http_response")), {
type: "GRAVATAR_UPLOAD_REQUEST_FAILURE"
})
}
})]
});
var L = a("./blocks/image-editor/index.jsx")
, U = a("./components/info-popover/index.jsx")
, M = a("./components/external-link/index.jsx")
, q = a("./components/email-verification/email-verification-dialog/index.jsx")
, B = a("./components/drop-zone/index.jsx");
a("./blocks/edit-gravatar/style.scss");
class G extends n.Component {
constructor(...e) {
super(...e),
h()(this, "state", {
isEditingImage: !1,
image: !1,
showEmailVerificationNotice: !1
}),
h()(this, "onReceiveFile", e=>{
const {receiveGravatarImageFailed: t, translate: a, recordReceiveImageEvent: n} = this.props
, s = j.a.extname(e[0].name).toLowerCase().substring(1);
if (n(),
-1 === E.indexOf(s)) {
let e = "";
return e = s ? a("Sorry, %s files are not supported — please make sure your image is in JPG, GIF, or PNG format.", {
args: s
}) : a("Sorry, images of that filetype are not supported — please make sure your image is in JPG, GIF, or PNG format."),
void t({
errorMessage: e,
statName: "bad_filetype"
})
}
const r = URL.createObjectURL(e[0]);
this.setState({
isEditingImage: !0,
image: r
})
}
),
h()(this, "onImageEditorDone", (e,t)=>{
const {receiveGravatarImageFailed: a, translate: n, uploadGravatar: s, user: r} = this.props;
this.hideImageEditor(),
e ? a({
errorMessage: n("We couldn't save that image — please try another one."),
statName: "image_editor_error"
}) : s(t, r.email)
}
),
h()(this, "hideImageEditor", ()=>{
const {resetAllImageEditorState: e} = this.props;
e(),
URL.revokeObjectURL(this.state.image),
this.setState({
isEditingImage: !1,
image: !1
})
}
),
h()(this, "handleUnverifiedUserClick", ()=>{
this.props.recordClickButtonEvent({
isVerified: this.props.user.email_verified
}),
this.props.user.email_verified || this.setState({
showEmailVerificationNotice: !0
})
}
),
h()(this, "closeVerifyEmailDialog", ()=>{
this.setState({
showEmailVerificationNotice: !1
})
}
)
}
renderImageEditor() {
if (this.state.isEditingImage)
return s.a.createElement(C.a, {
additionalClassNames: "edit-gravatar-modal",
isVisible: !0
}, s.a.createElement(L.a, {
allowedAspectRatios: [$.a.ASPECT_1X1],
media: {
src: this.state.image
},
onDone: this.onImageEditorDone,
onCancel: this.hideImageEditor,
doneButtonText: this.props.translate("Change My Photo")
}))
}
render() {
const {isUploading: e, translate: t, user: a} = this.props
, n = "https://gravatar.com/" + (a.username || "")
, r = a.email_verified ? "cloud-upload" : "notice"
, i = a.email_verified ? t("Click to change photo") : t("Verify your email");
return s.a.createElement("div", {
className: _()("edit-gravatar", {
"is-unverified": !a.email_verified
}, {
"is-uploading": e
})
}, s.a.createElement("div", {
onClick: this.handleUnverifiedUserClick
}, s.a.createElement(x.a, {
accept: "image/*",
onPick: this.onReceiveFile
}, s.a.createElement("div", {
"data-tip-target": "edit-gravatar",
className: _()("edit-gravatar__image-container", {
"is-uploading": e
})
}, a.email_verified && s.a.createElement(B.a, {
textLabel: t("Drop to upload profile photo"),
onFilesDrop: this.onReceiveFile
}), s.a.createElement(O.a, {
imgSize: 400,
size: 150,
user: a
}), !e && s.a.createElement("div", {
className: "edit-gravatar__label-container"
}, s.a.createElement(v.a, {
icon: r,
size: 36
}), s.a.createElement("span", {
className: "edit-gravatar__label"
}, i)), e && s.a.createElement(k.a, {
className: "edit-gravatar__spinner"
})))), this.state.showEmailVerificationNotice && s.a.createElement(q.a, {
onClose: this.closeVerifyEmailDialog
}), this.renderImageEditor(), s.a.createElement("div", null, s.a.createElement("p", {
className: "edit-gravatar__explanation"
}, t("Your profile photo is public.")), s.a.createElement(U.a, {
className: "edit-gravatar__pop-over",
position: "left"
}, t('{{p}}The avatar you use on WordPress.com comes from {{ExternalLink}}Gravatar{{/ExternalLink}}, a universal avatar service (it stands for "Globally Recognized Avatar," get it?).{{/p}}{{p}}Your image may also appear on other sites using Gravatar whenever you\'re logged in with the email %(email)s.{{/p}}', {
components: {
ExternalLink: s.a.createElement(M.a, {
href: n,
target: "_blank",
rel: "noopener noreferrer",
icon: !0
}),
p: s.a.createElement("p", null)
},
args: {
email: a.email
}
}))))
}
}
h()(G, "propTypes", {
isUploading: b.a.bool,
translate: b.a.func,
receiveGravatarImageFailed: b.a.func,
resetAllImageEditorState: b.a.func,
uploadGravatar: b.a.func,
user: b.a.object,
recordClickButtonEvent: b.a.func,
recordReceiveImageEvent: b.a.func
});
var V = Object(l.c)(e=>({
user: Object(P.b)(e) || {},
isUploading: Object(S.b)(e)
}), {
resetAllImageEditorState: w.e,
receiveGravatarImageFailed: ({errorMessage: e, statName: t})=>Object(D.a)(Object(T.a)(Object(N.e)("calypso_edit_gravatar_file_receive_failure"), Object(I.a)("calypso_gravatar_update_error", t)), {
type: "GRAVATAR_RECEIVE_IMAGE_FAILURE",
errorMessage: e
}),
uploadGravatar: function(e, t) {
return Object(D.a)(Object(N.e)("calypso_edit_gravatar_upload_start"), {
type: "GRAVATAR_UPLOAD_REQUEST",
file: e,
email: t
})
},
recordClickButtonEvent: ({isVerified: e})=>Object(T.a)(Object(N.e)("calypso_edit_gravatar_click", {
user_verified: e
}), Object(N.c)("Me", "Clicked on Edit Gravatar Button in Profile")),
recordReceiveImageEvent: ()=>Object(N.e)("calypso_edit_gravatar_file_receive")
})(Object(u.c)(G))
, H = a("./me/form-base/index.js")
, W = a("./components/forms/form-button/index.jsx")
, Y = a("./components/forms/form-fieldset/index.jsx")
, z = a("./components/forms/form-label/index.tsx")
, K = a("./components/forms/form-textarea/index.jsx")
, Q = a("./components/forms/form-text-input/index.jsx")
, J = a("./components/main/index.jsx")
, X = a("./me/sidebar-navigation/index.jsx")
, Z = a("./lib/mixins/data-observe/index.js")
, ee = a("../node_modules/lodash-es/times.js")
, te = a("../packages/components/dist/esm/button/index.js")
, ae = a("./lib/safe-protocol-url/index.js")
, ne = a("./lib/url/http-utils.ts");
a("./me/profile-link/style.scss");
class se extends s.a.Component {
constructor(...e) {
super(...e),
h()(this, "recordClickEvent", e=>{
this.props.recordGoogleEvent("Me", "Clicked on " + e)
}
),
h()(this, "getClickHandler", e=>()=>this.recordClickEvent(e)),
h()(this, "handleRemoveButtonClick", ()=>{
this.recordClickEvent("Remove Link Next to Site"),
this.props.onRemoveLink()
}
)
}
renderRemove() {
return s.a.createElement(te.a, {
borderless: !0,
className: "profile-link__remove",
onClick: this.handleRemoveButtonClick
}, s.a.createElement(v.a, {
icon: "cross"
}))
}
render() {
const e = _()({
"profile-link": !0,
"is-placeholder": this.props.isPlaceholder
})
, t = "//s1.wp.com/mshots/v1/" + encodeURIComponent(this.props.url) + "?w=" + this.props.imageSize + "&h=64"
, a = this.props.isPlaceholder ? null : Object(ae.a)(this.props.url);
return s.a.createElement("li", {
className: e
}, this.props.isPlaceholder ? s.a.createElement("div", {
className: "profile-link__image-link"
}) : s.a.createElement("a", {
href: a,
className: "profile-link__image-link",
target: "_blank",
rel: "noopener noreferrer",
onClick: this.getClickHandler("Profile Links Site Images Link")
}, s.a.createElement("img", {
className: "profile-link__image",
src: t
})), s.a.createElement("a", {
href: a,
target: "_blank",
rel: "noopener noreferrer",
onClick: this.getClickHandler("Profile Links Site Link")
}, s.a.createElement("span", {
className: "profile-link__title"
}, this.props.title), s.a.createElement("span", {
className: "profile-link__url"
}, Object(ne.c)(this.props.url))), this.props.isPlaceholder ? null : this.renderRemove())
}
}
h()(se, "defaultProps", {
imageSize: 100,
title: "",
url: "",
slug: "",
isPlaceholder: !1
}),
h()(se, "propTypes", {
imageSize: b.a.number,
title: b.a.string.isRequired,
url: b.a.string.isRequired,
slug: b.a.string.isRequired
});
var re = Object(l.c)(null, {
recordGoogleEvent: N.c
})(se)
, ie = a("./state/profile-links/actions.js");
class oe extends n.Component {
componentDidMount() {
this.props.requestUserProfileLinks()
}
render() {
return null
}
}
h()(oe, "propTypes", {
requestUserProfileLinks: b.a.func
});
var ce = Object(l.c)(null, {
requestUserProfileLinks: ie.j
})(oe)
, le = a("./components/popover/menu.jsx")
, de = a("./components/popover/menu-item.jsx");
class ue extends s.a.Component {
constructor(...e) {
super(...e),
h()(this, "popoverContext", s.a.createRef()),
h()(this, "recordClickEvent", e=>{
this.props.recordGoogleEvent("Me", "Clicked on " + e)
}
),
h()(this, "handleAddWordPressSiteButtonClick", ()=>{
this.recordClickEvent("Add a WordPress Site Button"),
this.props.onShowAddWordPress()
}
),
h()(this, "handleOtherSiteButtonClick", ()=>{
this.recordClickEvent("Add Other Site Button"),
this.props.onShowAddOther()
}
)
}
render() {
const {translate: e} = this.props;
return s.a.createElement(n.Fragment, null, s.a.createElement(te.a, {
ref: this.popoverContext,
compact: !0,
disabled: !!this.props.showingForm,
onClick: this.props.onShowPopoverMenu
}, s.a.createElement(v.a, {
icon: "add-outline"
}), s.a.createElement("span", null, e("Add"))), this.props.showPopoverMenu && s.a.createElement(le.a, {
isVisible: !0,
onClose: this.props.onClosePopoverMenu,
context: this.popoverContext.current
}, s.a.createElement(de.a, {
onClick: this.handleAddWordPressSiteButtonClick
}, e("Add WordPress Site")), s.a.createElement(de.a, {
onClick: this.handleOtherSiteButtonClick
}, e("Add URL"))))
}
}
h()(ue, "propTypes", {
showingForm: b.a.string,
showPopoverMenu: b.a.bool,
onShowAddWordPress: b.a.func.isRequired,
onShowAddOther: b.a.func.isRequired
});
var pe = Object(l.c)(null, {
recordGoogleEvent: N.c
})(Object(u.c)(ue))
, me = a("./components/section-header/index.jsx")
, he = a("./components/notice/index.jsx")
, ge = a("../node_modules/lodash-es/pickBy.js")
, be = a("../node_modules/lodash-es/map.js")
, fe = a("../node_modules/lodash-es/find.js")
, _e = a("./config/index.js")
, ye = a("./blocks/site/index.jsx");
class je extends n.Component {
constructor(...e) {
super(...e),
h()(this, "onSelect", e=>{
this.props.onSelect(e, this.getInputName())
}
),
h()(this, "getCheckboxEventHandler", e=>t=>{
const a = "Clicked " + e + " checkbox"
, n = t.target.checked ? 1 : 0;
this.props.recordGoogleEvent("Me", a, "checked", n)
}
)
}
getInputName() {
return "site-" + this.props.site.ID
}
render() {
const {checked: e, onChange: t, site: a} = this.props;
return s.a.createElement("li", {
key: a.ID,
className: "profile-links-add-wordpress__item",
onClick: this.getCheckboxEventHandler("Add WordPress Site")
}, s.a.createElement("input", {
className: "profile-links-add-wordpress__checkbox",
type: "checkbox",
name: this.getInputName(),
onChange: t,
checked: e
}), s.a.createElement(ye.a, {
site: a,
indicator: !1,
onSelect: this.onSelect
}))
}
}
h()(je, "propTypes", {
onChange: b.a.func.isRequired,
onSelect: b.a.func.isRequired,
site: b.a.object.isRequired,
checked: b.a.bool
}),
h()(je, "defaultProps", {
checked: !1
});
var ve = Object(l.c)(null, {
recordGoogleEvent: N.c
})(je)
, Ee = a("./state/selectors/get-sites-items.js")
, $e = a("./state/sites/selectors/get-site.js")
, Ce = a("./lib/create-selector/index.js")
, xe = Object(Ce.a)(e=>Object.values(Object(Ee.a)(e)).filter(e=>!e.is_private).map(t=>Object($e.a)(e, t.ID)), e=>[Object(Ee.a)(e), e.currentUser.capabilities])
, Pe = a("./state/selectors/get-sites.js")
, Oe = a("../node_modules/lodash-es/some.js");
function Se(e) {
return e.userProfileLinks.items
}
var we = Object(Ce.a)((e,t)=>{
const a = Se(e);
return null === a ? null : Object(Oe.a)(a, e=>t === e.value.replace(/^.*:\/\//, ""))
}
, [Se]);
a("./me/profile-links-add-wordpress/style.scss");
class ke extends n.Component {
constructor(...e) {
super(...e),
h()(this, "state", {}),
h()(this, "handleCheckedChanged", e=>{
const t = {};
t[e.target.name] = e.target.checked,
this.setState(t)
}
),
h()(this, "recordClickEvent", e=>{
this.props.recordGoogleEvent("Me", "Clicked on " + e)
}
),
h()(this, "getClickHandler", e=>()=>this.recordClickEvent(e)),
h()(this, "handleCancelButtonClick", e=>{
this.recordClickEvent("Cancel Add WordPress Sites Button"),
this.onCancel(e)
}
),
h()(this, "handleJetpackLinkClick", e=>{
this.recordClickEvent("Jetpack Link in Profile Links"),
this.onJetpackMe(e)
}
),
h()(this, "handleCreateSiteButtonClick", e=>{
this.recordClickEvent("Create Sites Button in Profile Links"),
this.onCreateSite(e)
}
),
h()(this, "onSelect", (e,t)=>{
const a = {};
a[t] = !this.state[t],
this.setState(a)
}
),
h()(this, "onAddableSubmit", e=>{
e.preventDefault();
const {sites: t} = this.props
, a = Object(ge.a)(this.state, (e,t)=>"site-" === t.substr(0, 5) && e)
, n = Object(be.a)(a, (e,t)=>parseInt(t.substr(5), 10)).map(e=>Object(fe.a)(t, ["ID", e])).map(e=>({
title: e.name,
value: e.URL
}));
n.length && (this.props.addUserProfileLinks(n),
this.props.onSuccess())
}
),
h()(this, "onCancel", e=>{
e.preventDefault(),
this.props.onCancel()
}
),
h()(this, "onCreateSite", e=>{
e.preventDefault(),
window.open(Object(_e.a)("signup_url") + "?ref=me-profile-links"),
this.props.onCancel()
}
),
h()(this, "onJetpackMe", e=>{
e.preventDefault(),
window.open("http://jetpack.me/"),
this.props.onCancel()
}
)
}
getCheckedCount() {
let e, t = 0;
for (e in this.state)
this.state[e] && t++;
return t
}
renderAddableSites() {
return this.props.publicSitesNotInProfileLinks.map(e=>{
const t = "site-" + e.ID
, a = this.state[t];
return s.a.createElement(ve, {
key: t,
site: e,
checked: a,
onChange: this.handleCheckedChanged,
onSelect: this.onSelect
})
}
)
}
renderAddableSitesForm() {
const {translate: e} = this.props
, t = this.getCheckedCount();
return s.a.createElement("form", {
className: "profile-links-add-wordpress",
onSubmit: this.onAddableSubmit
}, s.a.createElement("p", null, e("Please select one or more sites to add to your profile.")), s.a.createElement("ul", {
className: "profile-links-add-wordpress__list"
}, this.renderAddableSites()), s.a.createElement(W.a, {
disabled: 0 === t,
onClick: this.getClickHandler("Add WordPress Sites Button")
}, e("Add Site", "Add Sites", {
count: t
})), s.a.createElement(W.a, {
className: "profile-links-add-wordpress__cancel",
isPrimary: !1,
onClick: this.handleCancelButtonClick
}, e("Cancel")))
}
renderInvitationForm() {
const {translate: e} = this.props;
return s.a.createElement("form", null, s.a.createElement("p", null, e("You have no public sites on WordPress.com yet, but if you like you can create one now. You may also add self-hosted WordPress sites here after installing {{jetpackLink}}Jetpack{{/jetpackLink}} on them.", {
components: {
jetpackLink: s.a.createElement("a", {
href: "#",
className: "profile-links-add-wordpress__jetpack-link",
onClick: this.handleJetpackLinkClick
})
}
})), s.a.createElement(W.a, {
onClick: this.handleCreateSiteButtonClick
}, e("Create Site")), s.a.createElement(W.a, {
className: "profile-links-add-wordpress__cancel",
isPrimary: !1,
onClick: this.handleCancelButtonClick
}, e("Cancel")))
}
render() {
return s.a.createElement("div", null, 0 === this.props.publicSites.length ? this.renderInvitationForm() : this.renderAddableSitesForm())
}
}
var De = Object(l.c)(e=>{
const t = xe(e)
, a = t.filter(t=>!we(e, t.domain));
return {
publicSites: t,
publicSitesNotInProfileLinks: a,
sites: Object(Pe.a)(e)
}
}
, {
addUserProfileLinks: ie.a,
recordGoogleEvent: N.c
})(Object(u.c)(ke));
a("./me/profile-links-add-other/style.scss");
class Ne extends s.a.Component {
constructor(...e) {
super(...e),
h()(this, "state", {
title: "",
value: ""
}),
h()(this, "recordClickEvent", e=>{
this.props.recordGoogleEvent("Me", "Clicked on " + e)
}
),
h()(this, "getClickHandler", e=>()=>this.recordClickEvent(e)),
h()(this, "getFocusHandler", e=>()=>this.props.recordGoogleEvent("Me", "Focused on " + e)),
h()(this, "handleCancelButtonClick", e=>{
e.preventDefault(),
this.recordClickEvent("Cancel Other Site Button"),
this.props.onCancel()
}
),
h()(this, "handleChange", e=>{
const {name: t, value: a} = e.currentTarget;
this.setState({
[t]: a
})
}
),
h()(this, "onSubmit", e=>{
e.preventDefault(),
this.getFormDisabled() || (this.props.addUserProfileLinks([{
title: this.state.title.trim(),
value: this.state.value.trim()
}]),
this.props.onSuccess())
}
)
}
getFormDisabled() {
const e = this.state.value.trim();
return !this.state.title.trim() || !e || (-1 !== e.indexOf(" ") || (!e.match(/[a-zA-z0-9]+\.[a-zA-z]{2,}/) || !(!e.match(/^.*:\/\//) || e.match(/^https?:\/\//))))
}
render() {
return s.a.createElement("form", {
className: "profile-links-add-other",
onSubmit: this.onSubmit
}, s.a.createElement("p", null, this.props.translate("Please enter the URL and description of the site you want to add to your profile.")), s.a.createElement(Y.a, null, s.a.createElement(Q.a, {
className: "profile-links-add-other__value",
placeholder: this.props.translate("Enter a URL"),
onFocus: this.getFocusHandler("Add Other Site URL Field"),
name: "value",
value: this.state.value,
onChange: this.handleChange
}), s.a.createElement(Q.a, {
className: "profile-links-add-other__title",
placeholder: this.props.translate("Enter a description"),
onFocus: this.getFocusHandler("Add Other Site Description Field"),
name: "title",
value: this.state.title,
onChange: this.handleChange
}), s.a.createElement(W.a, {
className: "profile-links-add-other__add",
disabled: this.getFormDisabled(),
onClick: this.getClickHandler("Save Other Site Button")
}, this.props.translate("Add Site")), s.a.createElement(W.a, {
className: "profile-links-add-other__cancel",
isPrimary: !1,
onClick: this.handleCancelButtonClick
}, this.props.translate("Cancel"))))
}
}
var Te = Object(l.c)(null, {
addUserProfileLinks: ie.a,
recordGoogleEvent: N.c
})(Object(u.c)(Ne))
, Ie = a("../node_modules/lodash-es/get.js");
function Re(e) {
return Object(Ie.a)(e, ["userProfileLinks", "errors", "duplicate"], !1) ? "duplicate" : Object(Ie.a)(e, ["userProfileLinks", "errors", "malformed"], !1) ? "malformed" : Object(Ie.a)(e, ["userProfileLinks", "errors", "error"], !1) ? "other" : null
}
a("./me/profile-links/style.scss");
class Ae extends s.a.Component {
constructor(...e) {
super(...e),
h()(this, "state", {
showingForm: null,
showPopoverMenu: !1
}),
h()(this, "showAddWordPress", ()=>{
this.setState({
showingForm: "wordpress",
showPopoverMenu: !1
})
}
),
h()(this, "showAddOther", ()=>{
this.setState({
showingForm: "other",
showPopoverMenu: !1
})
}
),
h()(this, "showPopoverMenu", ()=>{
this.setState({
showPopoverMenu: !this.state.showPopoverMenu
})
}
),
h()(this, "closePopoverMenu", ()=>{
this.setState({
showPopoverMenu: !1
})
}
),
h()(this, "hideForms", ()=>{
this.setState({
showingForm: null
})
}
),
h()(this, "onRemoveLink", e=>()=>this.props.deleteUserProfileLink(e.link_slug))
}
getErrorMessage() {
const {errorType: e, translate: t} = this.props;
return e ? t("duplicate" === e ? "That link is already in your profile links. No changes were made." : "An unexpected error occurred. Please try again later.") : null
}
possiblyRenderError() {
const e = this.getErrorMessage();
return e ? s.a.createElement(he.a, {
className: "profile-links__error",
status: "is-error",
onDismissClick: this.props.resetUserProfileLinkErrors
}, e) : null
}
renderProfileLinksList() {
return s.a.createElement("ul", {
className: "profile-links__list"
}, this.props.profileLinks.map(e=>s.a.createElement(re, {
key: e.link_slug,
title: e.title,
url: e.value,
slug: e.link_slug,
onRemoveLink: this.onRemoveLink(e)
})))
}
renderNoProfileLinks() {
return s.a.createElement("p", {
className: "profile-links__no-links"
}, this.props.translate("You have no sites in your profile links. You may add sites if you'd like."))
}
renderPlaceholders() {
return s.a.createElement("ul", {
className: "profile-links__list"
}, Object(ee.a)(2, e=>s.a.createElement(re, {
title: "Loading Profile Links",
url: "http://wordpress.com",
slug: "A placeholder profile link",
isPlaceholder: !0,
key: e
})))
}
renderProfileLinks() {
const e = null !== this.props.profileLinks
, t = e ? this.props.profileLinks.length : 0;
let a;
return a = e ? t > 0 ? this.renderProfileLinksList() : this.renderNoProfileLinks() : this.renderPlaceholders(),
s.a.createElement("div", null, s.a.createElement("p", null, this.props.translate("Manage which sites appear in your profile.")), this.possiblyRenderError(), a)
}
renderForm() {
return "wordpress" === this.state.showingForm ? s.a.createElement(De, {
onSuccess: this.hideForms,
onCancel: this.hideForms
}) : s.a.createElement(Te, {
onSuccess: this.hideForms,
onCancel: this.hideForms
})
}
render() {
return s.a.createElement(n.Fragment, null, s.a.createElement(ce, null), s.a.createElement(me.a, {
label: this.props.translate("Profile links")
}, s.a.createElement(pe, {
showingForm: this.state.showingForm,
onShowAddOther: this.showAddOther,
showPopoverMenu: this.state.showPopoverMenu,
onShowAddWordPress: this.showAddWordPress,
onShowPopoverMenu: this.showPopoverMenu,
onClosePopoverMenu: this.closePopoverMenu
})), s.a.createElement(p.a, null, this.state.showingForm ? this.renderForm() : this.renderProfileLinks()))
}
}
var Fe = Object(l.c)(e=>({
profileLinks: Se(e),
errorType: Re(e)
}), {
deleteUserProfileLink: ie.f,
resetUserProfileLinkErrors: ie.k
})(Object(u.c)(Ae))
, Le = a("./me/reauth-required/index.jsx")
, Ue = a("./lib/i18n-utils/browser.js")
, Me = a("./lib/two-step-authorization/index.js")
, qe = a("./lib/protect-form/index.tsx")
, Be = a("./lib/analytics/page-view-tracker/index.jsx");
a("./me/profile/style.scss");
const Ge = c()("calypso:me:profile")
, Ve = i()({
displayName: "Profile",
mixins: [H.a, Object(Z.a)("userSettings")],
componentDidMount() {
Ge(this.displayName + " component is mounted.")
},
componentWillUnmount() {
Ge(this.displayName + " component is unmounting.")
},
getClickHandler(e) {
return ()=>this.props.recordGoogleEvent("Me", "Clicked on " + e)
},
getFocusHandler(e) {
return ()=>this.props.recordGoogleEvent("Me", "Focused on " + e)
},
render() {
const e = "https://gravatar.com/" + this.props.userSettings.getSetting("user_login");
return s.a.createElement(J.a, {
className: "profile"
}, s.a.createElement(Be.a, {
path: "/me",
title: "Me > My Profile"
}), s.a.createElement(X.a, null), s.a.createElement(Le.a, {
twoStepAuthorization: Me.a
}), s.a.createElement(me.a, {
label: this.props.translate("Profile")
}), s.a.createElement(p.a, {
className: "profile__settings"
}, s.a.createElement(V, null), s.a.createElement("form", {
onSubmit: this.submitForm,
onChange: this.props.markChanged
}, s.a.createElement(Y.a, null, s.a.createElement(z.a, {
htmlFor: "first_name"
}, this.props.translate("First name")), s.a.createElement(Q.a, {
disabled: this.getDisabledState(),
id: "first_name",
name: "first_name",
onChange: this.updateSetting,
onFocus: this.getFocusHandler("First Name Field"),
value: this.getSetting("first_name")
})), s.a.createElement(Y.a, null, s.a.createElement(z.a, {
htmlFor: "last_name"
}, this.props.translate("Last name")), s.a.createElement(Q.a, {
disabled: this.getDisabledState(),
id: "last_name",
name: "last_name",
onChange: this.updateSetting,
onFocus: this.getFocusHandler("Last Name Field"),
value: this.getSetting("last_name")
})), s.a.createElement(Y.a, null, s.a.createElement(z.a, {
htmlFor: "display_name"
}, this.props.translate("Public display name")), s.a.createElement(Q.a, {
disabled: this.getDisabledState(),
id: "display_name",
name: "display_name",
onChange: this.updateSetting,
onFocus: this.getFocusHandler("Display Name Field"),
value: this.getSetting("display_name")
})), s.a.createElement(Y.a, null, s.a.createElement(z.a, {
htmlFor: "description"
}, this.props.translate("About me")), s.a.createElement(K.a, {
disabled: this.getDisabledState(),
id: "description",
name: "description",
onChange: this.updateSetting,
onFocus: this.getFocusHandler("About Me Field"),
value: this.getSetting("description")
})), s.a.createElement("p", null, s.a.createElement(W.a, {
disabled: !this.props.userSettings.hasUnsavedSettings() || this.getDisabledState(),
onClick: this.getClickHandler("Save Profile Details Button")
}, this.state.submittingForm ? this.props.translate("Saving…") : this.props.translate("Save profile details")))), s.a.createElement("p", {
className: "profile__info-text"
}, this.props.translate("This information will be displayed publicly on {{profilelink}}your profile{{/profilelink}} and in {{hovercardslink}}Gravatar Hovercards{{/hovercardslink}}.", {
components: {
profilelink: s.a.createElement("a", {
onClick: this.getClickHandler("My Profile Link"),
href: e,
target: "_blank",
rel: "noopener noreferrer"
}),
hovercardslink: s.a.createElement("a", {
onClick: this.getClickHandler("Gravatar Hovercards Link"),
href: Object(Ue.l)("https://wordpress.com/support/gravatar-hovercards/"),
target: "_blank",
rel: "noopener noreferrer"
})
}
}))), s.a.createElement(Fe, null))
}
})
, He = Object(l.c)(null, {
recordGoogleEvent: N.c
});
t.default = Object(d.a)(He, qe.c, u.c)(Ve)
},
"./me/profile/style.scss": function(e, t, a) {},
"./me/purchases/cancel-purchase/style.scss": function(e, t, a) {},
"./me/purchases/components/loading-placeholder/style.scss": function(e, t, a) {},
"./me/purchases/concierge-banner/style.scss": function(e, t, a) {},
"./me/purchases/confirm-cancel-domain/style.scss": function(e, t, a) {},
"./me/purchases/credit-cards/credit-card-delete.scss": function(e, t, a) {},
"./me/purchases/credit-cards/credit-cards.scss": function(e, t, a) {},
"./me/purchases/credit-cards/payment-method-delete-dialog/style.scss": function(e, t, a) {},
"./me/purchases/index.js": function(e, t, a) {
"use strict";
a.r(t);
var n = a("./config/index.js")
, s = a("../node_modules/page/page.js")
, r = a.n(s)
, i = a("../node_modules/react/index.js")
, o = a.n(i)
, c = a("../packages/i18n-calypso/dist/esm/index.js")
, l = a("../packages/components/dist/esm/card/index.js")
, d = a("./me/sidebar-navigation/index.jsx")
, u = a("../node_modules/react-redux/es/index.js")
, p = a("../packages/components/dist/esm/button/index.js")
, m = a("./components/credit-card/index.tsx")
, h = a("./state/stored-cards/actions.js")
, g = a("./state/notices/actions.js")
, b = a("./state/stored-cards/selectors.js")
, f = a("./lib/checkout/payment-methods.ts")
, _ = a("./components/credit-card/stored-card.tsx")
, y = a("../packages/components/dist/esm/dialog/index.js");
a("./me/purchases/credit-cards/payment-method-delete-dialog/style.scss");
var j = ({paymentMethodSummary: e, isVisible: t, onClose: a, onConfirm: n})=>{
const s = Object(c.h)();
return o.a.createElement(y.a, {
isVisible: t,
additionalClassNames: "payment-method-delete-dialog",
onClose: a
}, o.a.createElement("h2", {
className: "payment-method-delete-dialog__header"
}, s("Remove payment method")), o.a.createElement("p", null, s("The payment method {{paymentMethodSummary/}} will be removed from your account and from all the associated subscriptions.", {
components: {
paymentMethodSummary: o.a.createElement("strong", null, e)
}
})), o.a.createElement(p.a, {
onClick: a
}, s("Cancel")), o.a.createElement(p.a, {
onClick: n,
primary: !0
}, s("Delete")))
}
;
a("./me/purchases/credit-cards/credit-card-delete.scss");
var v = ({card: e})=>{
const t = Object(c.h)()
, a = Object(u.e)(t=>Object(b.e)(t, e.stored_details_id))
, n = Object(u.d)()
, [s,r] = Object(i.useState)(!1)
, l = Object(i.useCallback)(()=>r(!1), [])
, d = Object(i.useCallback)(()=>{
l(),
n(Object(h.b)(e)).then(()=>{
Object(f.e)(e) ? n(Object(g.f)(t("Payment method deleted successfully"))) : n(Object(g.f)(t("Card deleted successfully")))
}
).catch(e=>{
n(Object(g.b)(e.message))
}
)
}
, [l, e, t, n]);
return o.a.createElement("div", {
className: "credit-cards__credit-card-delete"
}, o.a.createElement(j, {
paymentMethodSummary: Object(f.c)({
translate: t,
type: e.card_type || e.payment_partner,
digits: e.card,
email: e.email
}),
isVisible: s,
onClose: l,
onConfirm: d
}), o.a.createElement(_.a, {
lastDigits: e.card,
email: e.email,
cardType: e.card_type || "",
paymentPartner: e.payment_partner,
name: e.name,
expiry: e.expiry
}), (()=>{
const e = t(a ? "Deleting…" : "Delete");
return o.a.createElement(p.a, {
className: "credit-cards__delete-button",
disabled: a,
onClick: ()=>r(!0)
}, e)
}
)())
}
, E = a("./components/data/query-stored-cards/index.jsx")
, $ = a("./me/purchases/paths.js")
, C = a("./components/section-header/index.jsx");
a("./me/purchases/credit-cards/credit-cards.scss");
class x extends i.Component {
renderCards(e) {
return this.props.isFetching && !this.props.hasLoadedFromServer ? o.a.createElement("div", {
className: "credit-cards__no-results"
}, this.props.translate("Loading…")) : e.length ? e.map(e=>o.a.createElement(m.a, {
key: e.stored_details_id
}, o.a.createElement(v, {
card: e
}))) : o.a.createElement("div", {
className: "credit-cards__no-results"
}, this.props.translate("You have no saved cards."))
}
goToAddCreditCard() {
r()($.b)
}
renderAddCreditCardButton() {
return n.a.isEnabled("manage/payment-methods") ? o.a.createElement(p.a, {
primary: !0,
compact: !0,
className: "credit-cards__add",
onClick: this.goToAddCreditCard
}, this.props.translate("Add credit card")) : null
}
render() {
return o.a.createElement("div", {
className: "credit-cards"
}, o.a.createElement(E.a, null), o.a.createElement(C.a, {
label: this.props.translate("Manage your credit cards")
}, this.renderAddCreditCardButton()), o.a.createElement(l.a, null, o.a.createElement("div", null, this.renderCards(this.props.cards))), this.props.hasLoadedFromServer && this.props.paymentAgreements.length > 0 && o.a.createElement(o.a.Fragment, null, o.a.createElement(C.a, {
label: this.props.translate("Manage Your Payment Agreements")
}), o.a.createElement(l.a, null, o.a.createElement("div", null, this.renderCards(this.props.paymentAgreements)))))
}
}
var P = Object(u.c)(e=>({
cards: Object(b.b)(e),
paymentAgreements: Object(b.c)(e),
hasLoadedFromServer: Object(b.d)(e),
isFetching: Object(b.f)(e)
}))(Object(c.c)(x))
, O = a("../node_modules/prop-types/index.js")
, S = a.n(O)
, w = a("./components/section-nav/item.jsx")
, k = a("./components/section-nav/tabs.jsx")
, D = a("./components/section-nav/index.jsx")
, N = a("../node_modules/lodash-es/get.js")
, T = a("./state/redux-store.ts")
, I = a("./state/utils/schema-utils.js")
, R = a("./state/utils/without-persistence.js")
, A = a("./state/utils/reducer-utils.js")
, F = a("./state/utils/with-storage-key.js");
var L = a("./state/utils/keyed-reducer.js");
const U = Object(R.a)((e=!1,t)=>{
switch (t.type) {
case "BILLING_TRANSACTION_REQUEST":
return !0;
case "BILLING_TRANSACTION_REQUEST_FAILURE":
case "BILLING_TRANSACTION_REQUEST_SUCCESS":
return !1
}
return e
}
)
, M = Object(R.a)((e=!1,t)=>{
switch (t.type) {
case "BILLING_TRANSACTION_REQUEST_FAILURE":
return !0;
case "BILLING_TRANSACTION_REQUEST_SUCCESS":
case "BILLING_TRANSACTION_ERROR_CLEAR":
return !1
}
return e
}
)
, q = Object(R.a)((e=null,t)=>{
switch (t.type) {
case "BILLING_TRANSACTION_RECEIVE":
{
const {receipt: e} = t;
return e
}
}
return e
}
);
var B = Object(L.a)("transactionId", Object(A.a)({
requesting: U,
error: M,
data: q
}));
var G = Object(L.a)("transactionType", Object(A.a)({
app: (e=null,t)=>"BILLING_TRANSACTIONS_FILTER_SET_APP" === t.type ? t.app : e,
date: (e={
month: null,
operator: null
},{type: t, month: a, operator: n})=>"BILLING_TRANSACTIONS_FILTER_SET_MONTH" === t ? {
month: a,
operator: n
} : e,
page: (e=1,t)=>{
switch (t.type) {
case "BILLING_TRANSACTIONS_FILTER_SET_PAGE":
return t.page;
case "BILLING_TRANSACTIONS_FILTER_SET_APP":
case "BILLING_TRANSACTIONS_FILTER_SET_MONTH":
case "BILLING_TRANSACTIONS_FILTER_SET_QUERY":
return 1;
default:
return e
}
}
,
query: (e="",t)=>"BILLING_TRANSACTIONS_FILTER_SET_QUERY" === t.type ? t.query : e
}));
const V = Object(I.a)({
type: "object",
additionalProperties: !1,
properties: {
past: {
type: "array",
items: {
type: "object",
properties: {
id: {
type: "string"
},
service: {
type: "string"
},
amount: {
type: "string"
},
tax_amount: {
type: "string"
},
icon: {
type: "string"
},
date: {
type: "string"
},
desc: {
type: "string"
},
org: {
type: "string"
},
url: {
type: "string"
},
support: {
type: "string"
},
pay_ref: {
type: "string"
},
pay_part: {
type: "string"
},
cc_type: {
type: "string"
},
cc_num: {
type: "string"
},
cc_name: {
type: "string"
},
cc_email: {
type: "string"
},
credit: {
type: "string"
},
items: {
type: "array",
items: {
type: "object"
}
}
}
}
},
upcoming: {
type: "array",
items: {
type: "object",
properties: {
id: {
type: "string"
},
blog_id: {
type: "string"
},
plan: {
type: "string"
},
amount: {
type: "string"
},
tax_amount: {
type: "string"
},
date: {
type: "string"
},
product: {
type: "string"
},
interval: {
type: "string"
},
icon: {
type: "string"
},
domain: {
type: ["string", "null"]
}
}
}
}
}
}, (e={},t)=>{
switch (t.type) {
case "BILLING_TRANSACTIONS_RECEIVE":
{
const {past: e, upcoming: a} = t;
return {
past: e,
upcoming: a
}
}
}
return e
}
)
, H = Object(R.a)((e=!1,t)=>{
switch (t.type) {
case "BILLING_TRANSACTIONS_REQUEST":
return !0;
case "BILLING_TRANSACTIONS_REQUEST_FAILURE":
case "BILLING_TRANSACTIONS_REQUEST_SUCCESS":
return !1
}
return e
}
)
, W = Object(R.a)((e={},t)=>{
switch (t.type) {
case "BILLING_RECEIPT_EMAIL_SEND":
{
const {receiptId: a} = t;
return {
...e,
[a]: !0
}
}
case "BILLING_RECEIPT_EMAIL_SEND_FAILURE":
{
const {receiptId: a} = t;
return {
...e,
[a]: !1
}
}
case "BILLING_RECEIPT_EMAIL_SEND_SUCCESS":
{
const {receiptId: a} = t;
return {
...e,
[a]: !1
}
}
}
return e
}
)
, Y = Object(A.a)({
items: V,
requesting: H,
sendingReceiptEmail: W,
individualTransactions: B,
ui: G
});
var z = Object(F.a)("billingTransactions", Y);
function K(e) {
return e.billingTransactions.items
}
function Q(e) {
return Object(N.a)(K(e), "past", null)
}
Object(T.a)(["billingTransactions"], z);
const J = ({section: e, translate: t})=>{
let a = t("Billing History");
return "purchases" === e ? a = t("Purchases") : "upcoming" === e ? a = t("Upcoming Charges") : "pending" === e ? a = t("Pending Payments") : "memberships" === e && (a = t("Other Sites")),
o.a.createElement(D.a, {
selectedText: a
}, o.a.createElement(k.a, null, o.a.createElement(w.a, {
path: $.k,
selected: "purchases" === e
}, t("Purchases")), o.a.createElement(w.a, {
path: $.c,
selected: "billing" === e
}, t("Billing History")), o.a.createElement(w.a, {
path: $.l,
selected: "upcoming" === e
}, t("Upcoming Charges")), n.a.isEnabled("async-payments") && o.a.createElement(w.a, {
path: $.j,
selected: "pending" === e
}, t("Pending Payments")), o.a.createElement(w.a, {
path: $.i,
selected: "memberships" === e
}, t("Other Sites"))))
}
;
J.propTypes = {
section: S.a.string.isRequired
};
var X = Object(u.c)(e=>({
pastTransactions: Q(e)
}))(Object(c.c)(J))
, Z = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, ee = a.n(Z)
, te = a("../node_modules/lodash-es/isEmpty.js")
, ae = a("../node_modules/to-title-case/index.js")
, ne = a.n(ae);
function se(e) {
if ("string" != typeof e)
throw new Error("capitalPDangit expects a string as input");
return e.replace(/Wordpress/g, "WordPress")
}
var re = a("../packages/components/dist/esm/card/compact.js")
, ie = a("./components/pagination/index.jsx")
, oe = a("../node_modules/component-closest/index.js")
, ce = a.n(oe)
, le = a("../node_modules/lodash-es/find.js")
, de = a("../node_modules/lodash-es/isEqual.js")
, ue = a("./components/select-dropdown/index.jsx")
, pe = a("./components/localized-moment/index.js")
, me = a("./state/analytics/actions/record.js");
var he = a("../node_modules/lodash-es/groupBy.js")
, ge = a("../node_modules/lodash-es/map.js")
, be = a("./lib/create-selector/index.js");
function fe(e) {
return Object(N.a)(K(e), "upcoming", null)
}
var _e = (e,t)=>"upcoming" === t ? fe(e) : Q(e)
, ye = Object(be.a)((e,t)=>{
const a = _e(e, t);
if (!a)
return [];
const n = Object(he.a)(a, "service");
return Object(ge.a)(n, (e,t)=>({
title: t,
value: t,
count: e.length
}))
}
, (e,t)=>[_e(e, t)])
, je = a("../node_modules/lodash-es/times.js")
, ve = a("../node_modules/lodash-es/last.js")
, Ee = a("../node_modules/moment/moment.js")
, $e = a.n(Ee)
, Ce = Object(be.a)((e,t)=>{
const a = _e(e, t);
if (!a)
return [];
const n = Object(je.a)(6, e=>{
const t = $e()().subtract(e, "months");
return {
dateString: $e()(t).startOf("month").format("YYYY-MM-DD"),
value: {
month: t.format("YYYY-MM"),
operator: "equal"
},
count: 0
}
}
)
, s = Object(ve.a)(n).value.month;
return n.push({
older: !0,
value: {
month: s,
operator: "before"
},
count: 0
}),
a.forEach(e=>{
const t = $e()(e.date).startOf("month").format("YYYY-MM-DD")
, a = n && n.find(e=>e.dateString && e.dateString === t);
a ? a.count++ : Object(ve.a)(n).count++
}
),
n
}
, (e,t)=>[_e(e, t)])
, xe = (e,t)=>({
app: "",
date: {
month: null,
operator: null
},
page: 1,
query: "",
...Object(N.a)(e, ["billingTransactions", "ui", t], {})
});
class Pe extends o.a.Component {
constructor(...e) {
super(...e),
ee()(this, "state", {
activePopover: "",
searchValue: ""
}),
ee()(this, "preventEnterKeySubmission", e=>{
e.preventDefault()
}
),
ee()(this, "recordClickEvent", e=>{
this.props.recordGoogleEvent("Me", "Clicked on " + e)
}
),
ee()(this, "handleDatePopoverLinkClick", ()=>{
this.recordClickEvent("Toggle Date Popover in Billing History"),
this.togglePopover("date")
}
),
ee()(this, "handleAppsPopoverLinkClick", ()=>{
this.recordClickEvent("Toggle Apps Popover in Billing History"),
this.togglePopover("apps")
}
),
ee()(this, "closePopoverIfClickedOutside", e=>{
ce()(e.target, "thead") || this.setState({
activePopover: ""
})
}
)
}
componentDidMount() {
document.body.addEventListener("click", this.closePopoverIfClickedOutside)
}
componentWillUnmount() {
document.body.removeEventListener("click", this.closePopoverIfClickedOutside)
}
getDatePopoverItemClickHandler(e, t) {
return ()=>{
const {transactionType: a} = this.props;
this.recordClickEvent("Date Popover Item: " + e),
this.props.setDate(a, t.month, t.operator),
this.setState({
activePopover: ""
})
}
}
getAppPopoverItemClickHandler(e, t) {
return ()=>{
this.recordClickEvent("App Popover Item: " + e),
this.props.setApp(this.props.transactionType, t),
this.setState({
activePopover: ""
})
}
}
render() {
return o.a.createElement("thead", null, o.a.createElement("tr", {
className: "billing-history__header-row"
}, o.a.createElement("th", {
className: "billing-history__date billing-history__trans-app billing-history__header-column",
colSpan: "3"
}, this.renderDatePopover(), this.renderAppsPopover())))
}
getFilterTitle(e) {
return e ? e.older ? this.props.translate("Older") : this.props.moment(e.dateString).format("MMM YYYY") : this.props.translate("Date")
}
renderDatePopover() {
const {dateFilters: e, filter: t, translate: a} = this.props
, n = Object(le.a)(e, {
value: t.date
})
, s = this.getFilterTitle(n);
return o.a.createElement(ue.a, {
selectedText: s,
onClick: this.handleAppsPopoverLinkClick,
className: "billing-history__transactions-header-select-dropdown"
}, o.a.createElement(ue.a.Label, null, a("Recent Transactions")), this.renderDatePicker("Newest", a("Newest"), {
month: null,
operator: null
}, null), o.a.createElement(ue.a.Separator, null), o.a.createElement(ue.a.Label, null, a("By Month")), e.map((e,t)=>{
let a = "Current Month";
return 1 === t ? a = "1 Month Before" : 1 < t && (a = t + " Months Before"),
this.renderDatePicker(t, this.getFilterTitle(e), e.value, e.count, a)
}
))
}
togglePopover(e) {
let t;
t = this.state.activePopover === e ? "" : e,
this.setState({
activePopover: t
})
}
renderDatePicker(e, t, a, n, s) {
const r = this.props.filter.date
, i = Object(de.a)(r, a);
return s = void 0 === s ? e : s,
o.a.createElement(ue.a.Item, {
key: e,
selected: i,
onClick: this.getDatePopoverItemClickHandler(s, a),
count: n
}, t)
}
renderAppsPopover() {
const {appFilters: e, filter: t, translate: a} = this.props
, n = Object(le.a)(e, {
value: t.app
})
, s = n ? n.title : a("All apps");
return o.a.createElement(ue.a, {
selectedText: s,
onClick: this.handleAppsPopoverLinkClick,
className: "billing-history__transactions-header-select-dropdown"
}, o.a.createElement(ue.a.Label, null, a("App name")), this.renderAppPicker(a("All apps"), "all"), e.map((function({title: e, value: t, count: a}) {
return this.renderAppPicker(e, t, a, "Specific App")
}
), this))
}
renderAppPicker(e, t, a, n) {
const s = t === this.props.filter.app;
return o.a.createElement(ue.a.Item, {
key: t,
selected: s,
onClick: this.getAppPopoverItemClickHandler(n, t),
count: a
}, e)
}
}
Pe.propTypes = {
appFilters: S.a.array.isRequired,
dateFilters: S.a.array.isRequired,
filter: S.a.object.isRequired,
transactionType: S.a.string.isRequired
};
var Oe = Object(u.c)((e,{transactionType: t})=>({
appFilters: ye(e, t),
dateFilters: Ce(e, t),
filter: xe(e, t)
}), {
recordGoogleEvent: me.c,
setApp: (e,t)=>({
type: "BILLING_TRANSACTIONS_FILTER_SET_APP",
transactionType: e,
app: t
}),
setDate: (e,t,a)=>({
type: "BILLING_TRANSACTIONS_FILTER_SET_MONTH",
transactionType: e,
month: t,
operator: a
})
})(Object(c.c)(Object(pe.b)(Pe)))
, Se = a("../node_modules/lodash-es/partition.js")
, we = a("../node_modules/lodash-es/reduce.js")
, ke = a("../node_modules/lodash-es/some.js")
, De = a("../packages/format-currency/dist/esm/index.js");
const Ne = (e,t)=>{
const a = Object.keys(e).map(t=>Object.assign({}, e[t]))
, [n,s] = Object(Se.a)(a, {
product_slug: "wp-domains"
})
, r = Object(we.a)(n, (e,t)=>(e[t.domain] ? (e[t.domain].raw_amount += t.raw_amount,
e[t.domain].groupCount++) : (e[t.domain] = t,
e[t.domain].groupCount = 1),
e), {});
return [...s, ...Object(ge.a)(r, e=>1 === e.groupCount ? Object(le.a)(n, {
domain: e.domain
}) : {
...e,
amount: Object(De.a)(e.raw_amount, e.currency),
variation: t("Domain Registration")
})]
}
;
function Te(e, {translate: t, addingTax: a=!1}) {
if (!function(e) {
return !(!e || !e.tax) && Object(ke.a)(e.items, "raw_tax")
}(e))
return e.amount;
const n = t(a ? "(+%(taxAmount)s tax)" : "(includes %(taxAmount)s tax)", {
args: {
taxAmount: e.tax
},
comment: "taxAmount is a localized price, like $12.34"
});
return o.a.createElement(i.Fragment, null, o.a.createElement("div", null, e.amount), o.a.createElement("div", {
className: "billing-history__transaction-tax-amount"
}, n))
}
var Ie = a("./components/search-card/index.jsx")
, Re = a("../node_modules/lodash-es/values.js")
, Ae = a("../node_modules/lodash-es/omit.js")
, Fe = a("../node_modules/lodash-es/flatMap.js")
, Le = a("../node_modules/lodash-es/compact.js")
, Ue = a("../node_modules/lodash-es/slice.js")
, Me = a("./state/selectors/get-current-locale-slug.js");
function qe(e) {
const t = Object(Re.a)(Object(Ae.a)(e, ["date", "items"]))
, a = e.date ? function(e) {
const t = Object(c.b)();
return $e()(e).locale(t).format("ll")
}(e.date) : null
, n = Object(Fe.a)(e.items, Re.a);
return Object(Le.a)([...t, a, ...n])
}
var Be = Object(be.a)((e,t)=>{
const a = _e(e, t);
if (!a)
return {
transactions: a,
total: 0,
pageSize: 5
};
const {app: n, date: s, page: r, query: i} = xe(e, t);
let o = i ? function(e, t) {
const a = t.toLowerCase();
return e.filter(e=>Object(ke.a)(qe(e), e=>e.toString().toLowerCase().includes(a)))
}(a, i) : a;
s && s.month && s.operator && (o = o.filter(e=>{
const t = $e()(e.date);
return "equal" === s.operator ? t.isSame(s.month, "month") : "before" === s.operator ? t.isBefore(s.month, "month") : void 0
}
)),
n && "all" !== n && (o = o.filter(e=>e.service === n));
const c = o.length
, l = r - 1;
return o = Object(Ue.a)(o, 5 * l, 5 * l + 5),
{
transactions: o,
total: c,
pageSize: 5
}
}
, (e,t)=>[Object(Me.a)(e), _e(e, t), ...Object(Re.a)(xe(e, t))])
, Ge = a("./lib/plans/index.js");
class Ve extends o.a.Component {
constructor(...e) {
super(...e),
ee()(this, "onPageClick", e=>{
this.props.setPage(this.props.transactionType, e)
}
),
ee()(this, "onSearch", e=>{
this.props.setQuery(this.props.transactionType, e)
}
),
ee()(this, "serviceName", e=>{
if (!e.items)
return this.serviceNameDescription(e);
const [t,...a] = Ne(e.items, this.props.translate);
return a.length > 0 ? o.a.createElement("strong", null, this.props.translate("Multiple items")) : t.product === t.variation ? t.product : this.serviceNameDescription({
...t,
plan: se(ne()(t.variation))
})
}
),
ee()(this, "serviceNameDescription", e=>{
let t;
if (e.domain) {
const a = Object(Ge.m)(e.wpcom_product_slug, this.props.translate);
t = o.a.createElement("div", null, o.a.createElement("strong", null, e.plan), o.a.createElement("small", null, e.domain), a ? o.a.createElement("small", null, a) : null)
} else
t = o.a.createElement("strong", null, e.product, " ", e.plan);
return t
}
),
ee()(this, "renderPlaceholder", ()=>o.a.createElement("tr", {
className: "billing-history__transaction is-placeholder"
}, o.a.createElement("td", null, o.a.createElement("div", {
className: "billing-history__transaction-text"
})), o.a.createElement("td", {
className: "billing-history__trans-app"
}, o.a.createElement("div", {
className: "billing-history__transaction-text"
})), o.a.createElement("td", {
className: "billing-history__amount"
}, o.a.createElement("div", {
className: "billing-history__transaction-text"
})))),
ee()(this, "renderPagination", ()=>this.props.total <= this.props.pageSize ? null : o.a.createElement(re.a, null, o.a.createElement(ie.a, {
page: this.props.page,
perPage: this.props.pageSize,
total: this.props.total,
pageClick: this.onPageClick
}))),
ee()(this, "renderRows", ()=>{
const {transactions: e, date: t, app: a, query: n, transactionType: s, translate: r} = this.props;
if (!e)
return this.renderPlaceholder();
if (Object(te.a)(e)) {
let e;
return e = t.newest && "" === a && "" === n ? this.props.emptyTableText : this.props.noFilterResultsText,
o.a.createElement("tr", {
className: "billing-history__no-results"
}, o.a.createElement("td", {
className: "billing-history__no-results-cell",
colSpan: "3"
}, e))
}
return e.map(e=>{
const t = this.props.moment(e.date).format("ll");
return o.a.createElement("tr", {
key: e.id,
className: "billing-history__transaction"
}, o.a.createElement("td", {
className: "billing-history__date"
}, t), o.a.createElement("td", {
className: "billing-history__trans-app"
}, o.a.createElement("div", {
className: "billing-history__trans-wrap"
}, o.a.createElement("div", {
className: "billing-history__service-description"
}, o.a.createElement("div", {
className: "billing-history__service-name"
}, this.serviceName(e)), this.props.transactionRenderer(e)))), o.a.createElement("td", {
className: "billing-history__amount"
}, Te(e, {
addingTax: "upcoming" === s,
translate: r
})))
}
, this)
}
)
}
render() {
let e;
return !1 !== this.props.header && (e = o.a.createElement(Oe, {
transactionType: this.props.transactionType
})),
o.a.createElement("div", null, o.a.createElement(Ie.a, {
placeholder: this.props.translate("Search all receipts…", {
textOnly: !0
}),
onSearch: this.onSearch
}), o.a.createElement("table", {
className: "billing-history__transactions"
}, e, o.a.createElement("tbody", null, this.renderRows())), this.renderPagination())
}
}
ee()(Ve, "displayName", "TransactionsTable"),
ee()(Ve, "defaultProps", {
header: !1
}),
Ve.propTypes = {
app: S.a.string,
date: S.a.object,
page: S.a.number,
pageSize: S.a.number.isRequired,
query: S.a.string.isRequired,
total: S.a.number.isRequired,
transactions: S.a.array,
transactionType: S.a.string.isRequired,
emptyTableText: S.a.oneOfType([S.a.string, S.a.array]).isRequired,
noFilterResultsText: S.a.oneOfType([S.a.string, S.a.array]).isRequired,
transactionRenderer: S.a.func.isRequired,
header: S.a.bool
};
var He = Object(u.c)((e,{transactionType: t})=>{
const a = Be(e, t)
, n = xe(e, t);
return {
app: n.app,
date: n.date,
page: n.page,
pageSize: a.pageSize,
query: n.query,
total: a.total,
transactions: a.transactions
}
}
, {
setPage: (e,t)=>({
type: "BILLING_TRANSACTIONS_FILTER_SET_PAGE",
transactionType: e,
page: t
}),
setQuery: (e,t)=>({
type: "BILLING_TRANSACTIONS_FILTER_SET_QUERY",
transactionType: e,
query: t
})
})(Object(c.c)(Object(pe.b)(Ve)));
var We = a("./lib/wp/browser.js");
class Ye extends o.a.Component {
constructor(...e) {
super(...e),
ee()(this, "recordClickEvent", e=>{
this.props.recordGoogleEvent("Me", e)
}
),
ee()(this, "handleReceiptLinkClick", ()=>this.recordClickEvent("View Receipt in Billing History")),
ee()(this, "getEmailReceiptLinkClickHandler", e=>{
const {sendBillingReceiptEmail: t} = this.props;
return a=>{
a.preventDefault(),
this.recordClickEvent("Email Receipt in Billing History"),
t(e)
}
}
),
ee()(this, "renderEmailAction", e=>{
const {translate: t} = this.props;
return this.props.sendingBillingReceiptEmail(e) ? t("Emailing receipt…") : o.a.createElement("a", {
href: "#",
onClick: this.getEmailReceiptLinkClickHandler(e)
}, t("Email receipt"))
}
),
ee()(this, "renderTransaction", e=>{
const {translate: t} = this.props;
return o.a.createElement("div", {
className: "billing-history__transaction-links"
}, o.a.createElement("a", {
className: "billing-history__view-receipt",
href: Object($.d)(e.id),
onClick: this.handleReceiptLinkClick
}, t("View receipt")), this.renderEmailAction(e.id))
}
)
}
render() {
const {translate: e} = this.props
, t = e("You do not currently have any upgrades. To see what upgrades we offer visit our {{link}}Plans page{{/link}}.", {
components: {
link: o.a.createElement("a", {
href: "/plans"
})
}
})
, a = e("No receipts found.");
return o.a.createElement(He, {
transactionType: "past",
header: !0,
emptyTableText: t,
noFilterResultsText: a,
transactionRenderer: this.renderTransaction
})
}
}
var ze = Object(u.c)(e=>({
sendingBillingReceiptEmail: t=>function(e, t) {
return Object(N.a)(e, ["billingTransactions", "sendingReceiptEmail", t], null)
}(e, t)
}), {
recordGoogleEvent: me.c,
sendBillingReceiptEmail: e=>t=>(t({
type: "BILLING_RECEIPT_EMAIL_SEND",
receiptId: e
}),
We.a.undocumented().me().billingHistoryEmailReceipt(e).then(()=>{
t({
type: "BILLING_RECEIPT_EMAIL_SEND_SUCCESS",
receiptId: e
})
}
).catch(a=>{
t({
type: "BILLING_RECEIPT_EMAIL_SEND_FAILURE",
receiptId: e,
error: a
})
}
))
})(Object(c.c)(Ye))
, Ke = a("./components/main/index.jsx")
, Qe = a("./components/data/document-head/index.jsx")
, Je = a("./lib/analytics/page-view-tracker/index.jsx");
function Xe(e) {
return Object(N.a)(e, "billingTransactions.requesting", !1)
}
class Ze extends i.Component {
componentDidMount() {
this.props.requestingBillingTransactions || this.props.requestBillingTransactions()
}
render() {
return null
}
}
ee()(Ze, "propTypes", {
requestingBillingTransactions: S.a.bool,
requestBillingTransactions: S.a.func
});
var et = Object(u.c)(e=>({
requestingBillingTransactions: Xe(e)
}), {
requestBillingTransactions: ()=>e=>(e({
type: "BILLING_TRANSACTIONS_REQUEST"
}),
We.a.undocumented().me().billingHistory().then(({billing_history: t, upcoming_charges: a})=>{
e({
type: "BILLING_TRANSACTIONS_RECEIVE",
past: t,
upcoming: a
}),
e({
type: "BILLING_TRANSACTIONS_REQUEST_SUCCESS"
})
}
).catch(t=>{
e({
type: "BILLING_TRANSACTIONS_REQUEST_FAILURE",
error: t
})
}
))
})(Ze);
a("./me/billing-history/style.scss");
var tt = Object(c.c)(({translate: e})=>o.a.createElement(Ke.a, {
className: "billing-history"
}, o.a.createElement(Qe.a, {
title: e("Billing History")
}), o.a.createElement(Je.a, {
path: "/me/purchases/billing",
title: "Me > Billing History"
}), o.a.createElement(d.a, null), o.a.createElement(et, null), o.a.createElement(X, {
section: "billing"
}), o.a.createElement(l.a, {
className: "billing-history__receipts"
}, o.a.createElement(ze, null)), n.a.isEnabled("upgrades/credit-cards") && o.a.createElement(P, null)))
, at = a("../node_modules/lodash-es/uniq.js")
, nt = a("./state/sites/selectors/get-site-slug.js");
var st = Object(be.a)(e=>Object(Le.a)(Object(at.a)(Object(ge.a)(fe(e), "blog_id"))).map(Number).reduce((t,a)=>{
const n = {
...t
}
, s = Object(nt.a)(e, a);
return s && (n[a] = s),
n
}
, {}), e=>[fe(e), e.sites.items]);
class rt extends i.Component {
constructor(...e) {
super(...e),
ee()(this, "renderTransaction", e=>{
const {translate: t} = this.props
, a = this.props.siteSlugs[Number(e.blog_id)];
return a ? o.a.createElement("div", {
className: "billing-history__transaction-links"
}, o.a.createElement("a", {
href: Object($.h)(a, e.id)
}, t("Manage purchase"))) : null
}
)
}
render() {
const {translate: e} = this.props
, t = e("The upgrades on your account will not renew automatically. To manage your upgrades or enable Auto Renew visit {{link}}My Upgrades{{/link}}.", {
components: {
link: o.a.createElement("a", {
href: $.k
})
}
})
, a = e("No upcoming charges found.");
return o.a.createElement(He, {
transactionType: "upcoming",
emptyTableText: t,
noFilterResultsText: a,
transactionRenderer: this.renderTransaction
})
}
}
ee()(rt, "propTypes", {
siteSlugs: S.a.object.isRequired
});
var it = Object(u.c)(e=>({
siteSlugs: st(e)
}))(Object(c.c)(rt));
var ot = Object(c.c)(({translate: e})=>o.a.createElement(Ke.a, null, o.a.createElement(Qe.a, {
title: e("Upcoming Charges")
}), o.a.createElement(Je.a, {
path: "/me/purchases/upcoming",
title: "Me > Upcoming Charges"
}), o.a.createElement(d.a, null), o.a.createElement(et, null), o.a.createElement(X, {
section: "upcoming"
}), o.a.createElement(l.a, {
className: "billing-history__upcoming-charges"
}, o.a.createElement(it, null))))
, ct = a("./components/textarea-autosize/index.jsx")
, lt = a("./components/header-cake/index.jsx");
const dt = (e,t)=>Object(N.a)(e, ["billingTransactions", "individualTransactions", t, "data"], null);
var ut = Object(be.a)((e,t)=>Object(le.a)(Q(e), {
id: t
}) || dt(e, t), (e,t)=>[Q(e), dt(e, t)])
, pt = (e,t)=>Xe(e) || Object(N.a)(e, ["billingTransactions", "individualTransactions", t, "requesting"], !1);
const mt = e=>t=>(t({
type: "BILLING_TRANSACTION_REQUEST",
transactionId: e
}),
We.a.undocumented().me().getReceipt(e, {
format: "display"
}).then(a=>{
t({
type: "BILLING_TRANSACTION_REQUEST_SUCCESS",
transactionId: e
}),
t({
type: "BILLING_TRANSACTION_RECEIVE",
transactionId: e,
receipt: a
})
}
).catch(a=>{
t({
type: "BILLING_TRANSACTION_REQUEST_FAILURE",
transactionId: e,
error: a
})
}
));
class ht extends i.Component {
fetch(e) {
const {transaction: t, transactionId: a, requestingBillingTransaction: n} = e;
t || n || e.requestBillingTransaction(a)
}
componentDidMount() {
this.fetch(this.props)
}
UNSAFE_componentWillReceiveProps(e) {
this.fetch(e)
}
render() {
return null
}
}
ht.propTypes = {
transactionId: S.a.string.isRequired
};
var gt = Object(u.c)((e,{transactionId: t})=>({
transaction: ut(e, t),
requestingBillingTransaction: pt(e, t)
}), {
requestBillingTransaction: mt
})(ht)
, bt = (e,t)=>Object(N.a)(e, ["billingTransactions", "individualTransactions", t, "error"], !1);
class ft extends o.a.Component {
constructor(...e) {
super(...e),
ee()(this, "recordClickEvent", e=>{
this.props.recordGoogleEvent("Me", "Clicked on " + e)
}
),
ee()(this, "handlePrintLinkClick", ()=>{
this.recordClickEvent("Print Receipt Button in Billing History Receipt"),
window.print()
}
)
}
componentDidMount() {
this.redirectIfInvalidTransaction()
}
componentDidUpdate() {
this.redirectIfInvalidTransaction()
}
redirectIfInvalidTransaction() {
const {transactionFetchError: e, transactionId: t} = this.props;
e && (this.props.clearBillingTransactionError(t),
r.a.redirect($.c))
}
ref() {
const {transaction: e, translate: t} = this.props;
return e.pay_ref ? o.a.createElement("li", null, o.a.createElement("strong", null, t("Transaction ID")), o.a.createElement("span", null, e.pay_ref)) : null
}
paymentMethod() {
const {transaction: e, translate: t} = this.props;
let a;
if (e.pay_part === f.a)
a = t("PayPal");
else {
if ("XXXX" === e.cc_num)
return null;
a = t("%(cardType)s ending in %(cardNum)s", {
args: {
cardType: e.cc_type.toUpperCase(),
cardNum: e.cc_num
}
})
}
return o.a.createElement("li", null, o.a.createElement("strong", null, t("Payment Method")), o.a.createElement("span", null, a))
}
renderTitle() {
const {translate: e} = this.props;
return o.a.createElement(lt.a, {
backHref: $.c
}, e("Billing History"))
}
renderPlaceholder() {
return o.a.createElement(l.a, {
compact: !0,
className: "billing-history__receipt-card is-placeholder"
}, o.a.createElement("div", {
className: "billing-history__app-overview"
}, o.a.createElement("div", {
className: "billing-history__placeholder-image"
}), o.a.createElement("div", {
className: "billing-history__placeholder-title"
})), o.a.createElement("div", {
className: "billing-history__receipt-links"
}, o.a.createElement("div", {
className: "billing-history__placeholder-link"
}), o.a.createElement("div", {
className: "billing-history__placeholder-link"
})))
}
renderBillingDetailsLabels() {
const {translate: e} = this.props;
return o.a.createElement("div", null, o.a.createElement("label", {
htmlFor: "billing-history__billing-details-textarea"
}, o.a.createElement("strong", null, e("Billing Details"))), o.a.createElement("div", {
className: "billing-history__billing-details-description",
id: "billing-history__billing-details-description"
}, e("Use this field to add your billing information (eg. VAT number, business address) before printing.")))
}
renderBillingDetails() {
const {transaction: e} = this.props;
return e.cc_name || e.cc_email ? o.a.createElement("li", {
className: "billing-history__billing-details"
}, this.renderBillingDetailsLabels(), o.a.createElement(ct.a, {
className: "billing-history__billing-details-editable",
"aria-labelledby": "billing-history__billing-details-description",
id: "billing-history__billing-details-textarea",
rows: "1",
defaultValue: e.cc_name + "\n" + e.cc_email
})) : null
}
renderEmptyBillingDetails() {
return o.a.createElement("li", {
className: "billing-history__billing-details"
}, this.renderBillingDetailsLabels(), o.a.createElement(ct.a, {
className: "billing-history__billing-details-editable",
"aria-labelledby": "billing-history__billing-details-description",
id: "billing-history__billing-details-textarea",
rows: "1"
}))
}
renderLineItems() {
const {transaction: e, translate: t} = this.props
, a = Ne(e.items, t).map(a=>{
const n = Object(Ge.m)(a.wpcom_product_slug, t);
return o.a.createElement("tr", {
key: a.id
}, o.a.createElement("td", {
className: "billing-history__receipt-item-name"
}, o.a.createElement("span", null, a.variation), o.a.createElement("small", null, "(", a.type_localized, ")"), n ? o.a.createElement("em", null, n) : null, o.a.createElement("br", null), o.a.createElement("em", null, a.domain)), o.a.createElement("td", {
className: "billing-history__receipt-amount " + e.credit
}, a.amount, e.credit && o.a.createElement("span", {
className: "billing-history__credit-badge"
}, t("Refund"))))
}
);
return o.a.createElement("div", {
className: "billing-history__receipt"
}, o.a.createElement("h4", null, t("Order summary")), o.a.createElement("table", {
className: "billing-history__receipt-line-items"
}, o.a.createElement("thead", null, o.a.createElement("tr", null, o.a.createElement("th", {
className: "billing-history__receipt-desc"
}, t("Description")), o.a.createElement("th", {
className: "billing-history__receipt-amount"
}, t("Amount")))), o.a.createElement("tfoot", null, o.a.createElement("tr", null, o.a.createElement("td", {
className: "billing-history__receipt-desc"
}, o.a.createElement("strong", null, t("Total"), ":")), o.a.createElement("td", {
className: "billing-history__receipt-amount billing-history__total-amount " + e.credit
}, Te(e, {
translate: t
})))), o.a.createElement("tbody", null, a)))
}
renderBillingHistory() {
const {transaction: e, translate: t, moment: a} = this.props
, n = t("Visit %(url)s", {
args: {
url: e.url
}
})
, s = o.a.createElement("a", {
href: e.url,
title: n
});
return o.a.createElement("div", null, o.a.createElement(l.a, {
compact: !0,
className: "billing-history__receipt-card"
}, o.a.createElement("div", {
className: "billing-history__app-overview"
}, o.a.createElement("img", {
src: e.icon,
title: e.service,
alt: e.service
}), o.a.createElement("h2", null, " ", t("{{link}}%(service)s{{/link}} {{small}}by %(organization)s{{/small}}", {
components: {
link: s,
small: o.a.createElement("small", null)
},
args: {
service: e.service,
organization: e.org
},
comment: 'This string is "Service by Organization". The {{link}} and {{small}} add html styling and attributes. Screenshot: https://cloudup.com/isX-WEFYlOs'
}), o.a.createElement("div", {
className: "billing-history__transaction-date"
}, a(e.date).format("ll")))), o.a.createElement("ul", {
className: "billing-history__receipt-details group"
}, o.a.createElement("li", null, o.a.createElement("strong", null, t("Receipt ID")), o.a.createElement("span", null, e.id)), this.ref(), this.paymentMethod(), "XXXX" !== e.cc_num ? this.renderBillingDetails() : this.renderEmptyBillingDetails()), this.renderLineItems()), o.a.createElement(l.a, {
compact: !0,
className: "billing-history__receipt-links"
}, o.a.createElement(p.a, {
primary: !0,
onClick: this.handlePrintLinkClick
}, t("Print Receipt"))))
}
render() {
const {transaction: e, transactionId: t, translate: a} = this.props;
return o.a.createElement(Ke.a, null, o.a.createElement(Qe.a, {
title: a("Billing History")
}), o.a.createElement(Je.a, {
path: "/me/purchases/billing/:receipt",
title: "Me > Billing History > Receipt"
}), o.a.createElement(gt, {
transactionId: t
}), this.renderTitle(), e ? this.renderBillingHistory() : this.renderPlaceholder())
}
}
var _t = Object(u.c)((e,{transactionId: t})=>({
transaction: ut(e, t),
transactionFetchError: bt(e, t)
}), {
clearBillingTransactionError: e=>({
type: "BILLING_TRANSACTION_ERROR_CLEAR",
transactionId: e
}),
recordGoogleEvent: me.c,
requestBillingTransaction: mt
})(Object(c.c)(Object(pe.b)(ft)));
function yt(e, t) {
e.primary = o.a.createElement(tt),
t()
}
function jt(e, t) {
e.primary = o.a.createElement(ot),
t()
}
function vt(e, t) {
const a = e.params.receiptId;
a && (e.primary = o.a.createElement(_t, {
transactionId: a
})),
t()
}
var Et = a("../node_modules/@babel/runtime/helpers/extends.js")
, $t = a.n(Et)
, Ct = a("./components/empty-content/index.jsx")
, xt = a("./components/gridicon/index.tsx")
, Pt = a("./state/sites/selectors/get-site.js")
, Ot = a("./state/sites/selectors/get-site-title.js")
, St = a("./state/sites/selectors/get-site-domain.js")
, wt = a("./components/data/query-sites/index.jsx")
, kt = a("./blocks/site/index.jsx")
, Dt = a("./blocks/site/placeholder.jsx");
a("./me/purchases/purchases-site/header.scss");
class Nt extends i.Component {
renderFauxSite() {
const {name: e, domain: t} = this.props;
return o.a.createElement("div", {
className: "site is-disconnected"
}, o.a.createElement("div", {
className: "site__content"
}, o.a.createElement("div", {
className: "site-icon is-blank"
}, o.a.createElement(xt.a, {
icon: "notice"
})), o.a.createElement("div", {
className: "site__info"
}, o.a.createElement("div", {
className: "site__title"
}, e), o.a.createElement("div", {
className: "site__domain"
}, t))))
}
render() {
const {isPlaceholder: e, siteId: t, site: a, name: n, domain: s} = this.props;
let r;
return r = e ? o.a.createElement(Dt.a, null) : a ? o.a.createElement(kt.a, {
isCompact: !0,
site: a,
indicator: !1
}) : this.renderFauxSite(n, s),
o.a.createElement(re.a, {
className: "purchases-site__header"
}, o.a.createElement(wt.a, {
siteId: t
}), r)
}
}
ee()(Nt, "propTypes", {
isPlaceholder: S.a.bool,
siteId: S.a.number,
name: S.a.string,
domain: S.a.string
});
var Tt = Object(u.c)((e,{siteId: t})=>({
site: Object(Pt.a)(e, t)
}))(Nt)
, It = a("./lib/purchases/index.js")
, Rt = a("./lib/cart-values/index.js");
function At({paymentType: e, totalCost: t, currency: a, siteId: n, siteTitle: s, siteDomain: r, dateCreated: i, products: d}) {
const u = Object(c.h)()
, m = Object(pe.a)()
, h = Object(N.a)(d, "0", {});
let g = Object(It.h)(h) || ""
, b = Object(It.L)(h) || "";
return d.length > 1 && (g = u("Multiple items"),
b = u("Various")),
o.a.createElement(o.a.Fragment, null, o.a.createElement(Tt, {
siteId: n,
name: s,
domain: r
}), o.a.createElement(l.a, {
className: "pending-payments__list-item is-compact"
}, o.a.createElement("span", {
className: "pending-payments__list-item-wrapper"
}, o.a.createElement("div", {
className: "pending-payments__list-item-details"
}, o.a.createElement("div", {
className: "pending-payments__list-item-title"
}, g), o.a.createElement("div", {
className: "pending-payments__list-item-product"
}, b), o.a.createElement("div", {
className: "pending-payments__list-item-payment"
}, u("Payment of %(totalCost)s was initiated on %(dateCreated)s via %(paymentType)s.", {
args: {
totalCost: Object(De.a)(t, a),
dateCreated: m(i).format("LLL"),
paymentType: Object(Rt.o)(e)
}
})), o.a.createElement("div", {
className: "pending-payments__list-item-actions"
}, o.a.createElement(p.a, {
primary: !1,
compact: !0,
href: "/help/contact"
}, o.a.createElement(xt.a, {
icon: "help"
}), o.a.createElement("span", null, u("Contact Support"))))))))
}
At.propTypes = {
translate: S.a.func.isRequired,
paymentType: S.a.string.isRequired,
totalCost: S.a.string.isRequired,
currency: S.a.string.isRequired,
siteId: S.a.number.isRequired,
siteTitle: S.a.string.isRequired,
siteDomain: S.a.string.isRequired,
dateCreated: S.a.string.isRequired,
products: S.a.array.isRequired
};
var Ft = Object(u.c)((e,t)=>({
site: Object(Pt.a)(e, t.siteId),
siteTitle: Object(Ot.a)(e, t.siteId),
siteDomain: Object(St.a)(e, t.siteId)
}))(At)
, Lt = a("../node_modules/classnames/index.js")
, Ut = a.n(Lt)
, Mt = a("./components/async-load/index.jsx")
, qt = a("./state/sites/selectors/is-requesting-site.js")
, Bt = a("./lib/products-values/index.js")
, Gt = a("./lib/plans/constants.js")
, Vt = a("./lib/products-values/constants.js")
, Ht = a("../packages/components/dist/esm/product-icon/index.js")
, Wt = a("./components/notice/index.jsx")
, Yt = a("./lib/analytics/track-component-view/index.jsx");
a("./me/purchases/purchase-item/style.scss");
const zt = e=>({
warning: e,
position: "purchase-list"
});
class Kt extends i.Component {
trackImpression(e) {
return o.a.createElement(Yt.a, {
eventName: "calypso_subscription_warning_impression",
eventProperties: zt(e)
})
}
renewsOrExpiresOn() {
const {purchase: e, translate: t, moment: a} = this.props;
if (Object(It.O)(e))
return o.a.createElement(Wt.a, {
isCompact: !0,
status: "is-error",
icon: "notice"
}, t("Credit card expiring soon"), this.trackImpression("credit-card-expiring"));
if (Object(It.G)(e) && e.renewDate) {
return t("Renews on %s", {
args: a(e.renewDate).format("LL")
})
}
const n = a(e.expiryDate);
if (Object(It.u)(e)) {
if (n < a().add(30, "days")) {
const a = Object(It.B)(e) ? "is-info" : "is-error";
return o.a.createElement(Wt.a, {
isCompact: !0,
status: a,
icon: "notice"
}, t("Expires %(timeUntilExpiry)s", {
args: {
timeUntilExpiry: n.fromNow()
},
context: 'timeUntilExpiry is of the form "[number] [time-period] ago" i.e. "3 days ago"'
}), this.trackImpression("purchase-expiring"))
}
return t("Expires on %s", {
args: n.format("LL")
})
}
if (Object(It.t)(e)) {
if (Object(Bt.o)(e))
return t("Session used on %s", {
args: n.format("LL")
});
const s = a().diff(n, "hours") < 24 ? n.format("[today]") : n.fromNow();
return o.a.createElement(Wt.a, {
isCompact: !0,
status: "is-error",
icon: "notice"
}, t("Expired %(timeSinceExpiry)s", {
args: {
timeSinceExpiry: s
},
context: 'timeSinceExpiry is of the form "[number] [time-period] ago" i.e. "3 days ago"'
}), this.trackImpression("purchase-expired"))
}
return Object(It.v)(e) ? t("Included with Plan") : Object(It.w)(e) && !Object(Bt.x)(e) ? t("Never Expires") : null
}
placeholder() {
return o.a.createElement("span", {
className: "purchase-item__wrapper"
}, o.a.createElement("div", {
className: "purchase-item__plan-icon"
}), o.a.createElement("div", {
className: "purchase-item__details"
}, o.a.createElement("div", {
className: "purchase-item__title"
}), o.a.createElement("div", {
className: "purchase-item__purchase-type"
}), o.a.createElement("div", {
className: "purchase-item__purchase-date"
})))
}
scrollToTop() {
window.scrollTo(0, 0)
}
renderIcon() {
const {purchase: e} = this.props;
if (!e)
return null;
if (Object(Bt.X)(e) || Object(Bt.Q)(e))
return o.a.createElement("div", {
className: "purchase-item__plan-icon"
}, o.a.createElement(Ht.a, {
slug: e.productSlug,
className: Object(Ge.k)(e.productSlug)
}));
let t;
return Object(Bt.u)(e) || Object(Bt.x)(e) ? t = "domains" : Object(Bt.bb)(e) ? t = "themes" : Object(Bt.G)(e) && (t = "mail"),
t ? o.a.createElement("div", {
className: "purchase-item__plan-icon"
}, o.a.createElement(xt.a, {
icon: t,
size: 24
})) : null
}
getLabelText() {
const {purchase: e, translate: t} = this.props;
return e && Object(It.A)(e) ? t("This plan is managed by %(partnerName)s", {
args: {
partnerName: Object(It.i)(e)
}
}) : e && e.productSlug ? Object(Ge.m)(e.productSlug, t) : null
}
render() {
const {isPlaceholder: e, isDisconnectedSite: t, purchase: a, isJetpack: n} = this.props
, s = Ut()("purchase-item", {
"is-expired": a && "expired" === a.expiryStatus
}, {
"is-placeholder": e
}, {
"is-included-with-plan": a && Object(It.v)(a)
})
, r = this.getLabelText();
let i, c, l;
return i = e ? this.placeholder() : o.a.createElement("span", {
className: "purchase-item__wrapper"
}, this.renderIcon(), o.a.createElement("div", {
className: "purchase-item__details"
}, o.a.createElement("div", {
className: "purchase-item__title"
}, Object(It.e)(a)), o.a.createElement("div", {
className: "purchase-item__purchase-type"
}, Object(It.L)(a)), r && o.a.createElement("div", {
className: "purchase-item__term-label"
}, r), !Object(It.A)(a) && o.a.createElement("div", {
className: "purchase-item__purchase-date"
}, this.renewsOrExpiresOn()))),
e || t && !n || (c = this.scrollToTop,
l = Object($.h)(this.props.slug, this.props.purchase.id)),
o.a.createElement(re.a, {
className: s,
"data-e2e-connected-site": !t,
href: l,
onClick: c
}, i)
}
}
Kt.propTypes = {
isPlaceholder: S.a.bool,
isDisconnectedSite: S.a.bool,
purchase: S.a.object,
slug: S.a.string,
isJetpack: S.a.bool
};
var Qt = Object(c.c)(Object(pe.b)(Kt))
, Jt = a("./components/notice/notice-action.jsx")
, Xt = a("./lib/url/support.js");
class Zt extends i.Component {
render() {
const {translate: e, name: t, isJetpack: a} = this.props
, n = e(a ? "%(site)s has been disconnected from WordPress.com." : "You are no longer a user on %(site)s and cannot manage this purchase.", {
args: {
site: t
}
});
return o.a.createElement(Wt.a, {
showDismiss: !1,
status: "is-error",
text: n
}, !a && o.a.createElement(Jt.a, {
href: Xt.c
}, e("Contact Support")))
}
}
ee()(Zt, "propTypes", {
name: S.a.string,
translate: S.a.func.isRequired
});
var ea = Object(c.c)(Zt)
, ta = (a("./me/purchases/purchases-site/style.scss"),
function(e) {
a.e(343).then(a.bind(null, "./blocks/product-plan-overlap-notices/index.jsx")).then((function(t) {
e(t.default)
}
))
}
);
const aa = ({hasLoadedSite: e, isPlaceholder: t, site: a, siteId: n, purchases: s, name: r, domain: i, slug: c})=>{
let l;
const d = !t && Object(ke.a)(s, e=>Object(Bt.O)(e));
return l = t ? Object(je.a)(2, e=>o.a.createElement(Qt, {
isPlaceholder: !0,
key: e
})) : s.map(e=>o.a.createElement(Qt, {
key: e.id,
slug: c,
isDisconnectedSite: !a,
purchase: e,
isJetpack: d
})),
o.a.createElement("div", {
className: Ut()("purchases-site", {
"is-placeholder": t
})
}, o.a.createElement(wt.a, {
siteId: n
}), o.a.createElement(Tt, {
siteId: n,
name: r,
domain: i,
isPlaceholder: t
}), l, o.a.createElement(Mt.a, {
require: ta,
placeholder: null,
plans: Gt.nc,
products: Vt.c,
siteId: n
}), !t && e && !a && o.a.createElement(ea, {
isJetpack: d,
name: r
}))
}
;
aa.propTypes = {
isPlaceholder: S.a.bool,
siteId: S.a.number,
purchases: S.a.array,
name: S.a.string,
domain: S.a.string,
slug: S.a.string
};
var na = Object(u.c)((e,{siteId: t})=>({
site: Object(Pt.a)(e, t),
hasLoadedSite: !Object(qt.a)(e, t)
}))(aa)
, sa = a("./state/current-user/selectors.js")
, ra = a("./state/data-layer/http-data.ts")
, ia = a("./state/data-layer/wpcom-http/actions.js")
, oa = a("./components/banner/index.jsx")
, ca = a("./state/data-layer/utils.js")
, la = a("./state/ui/selectors/get-selected-site-id.js")
, da = a("./state/selectors/get-primary-site-id.js")
, ua = a("./lib/route/path.ts");
a("./me/pending-payments/style.scss");
const pa = e=>"pending-payments:" + e;
class ma extends i.Component {
constructor(...e) {
super(...e),
ee()(this, "componentDidMount", ()=>{
var e;
e = this.props.userId,
Object(ra.h)(pa(e), Object(ia.a)({
path: "/me/pending-payments",
apiVersion: "1",
method: "GET"
}), {
fromApi: ()=>t=>[[pa(e), Object(ca.b)(t)]],
freshness: -1 / 0
})
}
)
}
componentDidUpdate(e) {
const t = e.response
, {showErrorNotice: a, response: n, translate: s} = this.props;
t && "failure" !== t.state && "failure" === n.state && a(s("We've encountered a problem. Please try again later."))
}
render() {
const {response: e, pendingPayments: t, translate: a, siteSlug: n} = this.props;
let s;
return "success" !== e.state ? s = o.a.createElement(na, {
isPlaceholder: !0
}) : 0 === t.length ? s = o.a.createElement(re.a, {
className: "pending-payments__no-content"
}, o.a.createElement(Ct.a, {
title: a("Looking to upgrade?"),
line: a("Our plans give your site the power to thrive. Find the plan that works for you."),
action: a("Upgrade now"),
actionURL: "/plans",
illustration: "/calypso/images/illustrations/illustration-nosites.svg"
})) : t.length > 0 && (s = o.a.createElement(o.a.Fragment, null, o.a.createElement(oa.a, {
callToAction: a("Back to My Sites"),
description: a("Your payment initiation has been confirmed. We are currently waiting for the funds to clear, this transfer process can take up to one week to complete."),
event: "pending-payment-confirmation",
icon: "star",
href: Object(ua.f)("day", n),
title: a("Thank you! Your payment is being processed.")
}), o.a.createElement("div", null, t.map(e=>o.a.createElement(Ft, $t()({
key: e.orderId
}, e)))))),
o.a.createElement(Ke.a, {
className: "pending-payments"
}, o.a.createElement(Je.a, {
path: "/me/purchases/pending",
title: "Pending Payments"
}), o.a.createElement(d.a, null), o.a.createElement(X, {
section: "pending"
}), s)
}
}
ma.propTypes = {
userId: S.a.number.isRequired,
pendingPayments: S.a.array.isRequired,
response: S.a.object,
showErrorNotice: S.a.func
};
var ha = Object(u.c)(e=>{
const t = Object(sa.h)(e)
, a = Object(ra.e)(pa(t))
, n = Object(la.a)(e) || Object(da.a)(e);
return {
userId: t,
pendingPayments: Object.values(a.data || []),
response: a,
siteSlug: Object(nt.a)(e, n)
}
}
, e=>({
showErrorNotice: (t,a)=>e(Object(g.b)(t, Object.assign({}, a, {
id: "pending-payments-tab"
})))
}))(Object(c.c)(ma));
function ga(e, t) {
e.primary = o.a.createElement(ha),
t()
}
var ba = a("../node_modules/lodash-es/noop.js")
, fa = a("./state/data-layer/wpcom-http/utils.js")
, _a = a("./state/data-layer/handler-registry.js");
const ya = Object(fa.a)({
fetch: e=>Object(ia.a)({
method: "GET",
path: "/me/memberships/subscriptions"
}, e),
onSuccess: (e,{subscriptions: t, total: a})=>({
type: "MEMBERSHIPS_SUBSCRIPTIONS_RECEIVE",
subscriptions: t,
total: a
}),
onError: ba.a
});
Object(_a.b)("state/data-layer/wpcom/sites/memberships/subscriptions/index.js", {
MEMBERSHIPS_SUBSCRIPTIONS_LIST_REQUEST: [ya]
});
a("./state/memberships/init.js");
class ja extends i.Component {
componentDidMount() {
this.props.requestSubscriptionsList()
}
render() {
return null
}
}
var va = Object(u.c)(null, {
requestSubscriptionsList: ()=>({
type: "MEMBERSHIPS_SUBSCRIPTIONS_LIST_REQUEST"
})
})(ja);
function Ea(e) {
return Object(N.a)(e, ["memberships", "subscriptions", "items"])
}
function $a(e, t) {
var a;
return (null !== (a = Ea(e)) && void 0 !== a ? a : []).filter(e=>e.ID === t).pop()
}
function Ca(e, t) {
return Object(N.a)(e, ["memberships", "subscriptions", "stoppingSubscription", t], !1)
}
a("./me/memberships/main.scss");
const xa = ({translate: e, subscription: t, moment: a})=>o.a.createElement(re.a, {
key: t.ID,
href: "/me/purchases/other/" + t.ID
}, o.a.createElement("div", {
className: "memberships__list-subscription"
}, o.a.createElement("div", {
className: "memberships__list-date"
}, o.a.createElement("div", null, ((e,t,a)=>t ? a(t).format("ll") : e("Never Expires"))(e, t.end_date, a)), o.a.createElement("div", {
className: "memberships__list-sub"
}, ((e,t,a)=>t ? e("Renews %s", {
args: a(t).fromNow()
}) : "-")(e, t.end_date, a))), o.a.createElement("div", {
className: "memberships__service-description"
}, o.a.createElement("div", {
className: "memberships__service-name"
}, t.title), o.a.createElement("div", {
className: "memberships__list-sub"
}, e("On %s", {
args: t.site_title
}))), o.a.createElement("div", {
className: "memberships__list-renewal-price"
}, o.a.createElement("div", {
className: "memberships__list-amount"
}, Object(De.a)(t.renewal_price, t.currency)), o.a.createElement("div", {
className: "memberships__list-sub"
}, ((e,t)=>t ? e("Every %s", {
args: t
}) : "-")(e, t.renew_interval)))));
var Pa = Object(u.c)(e=>({
subscriptions: Ea(e)
}))(Object(c.c)(Object(pe.b)(({translate: e, subscriptions: t, moment: a})=>{
let s;
return s = t && t.length ? o.a.createElement(o.a.Fragment, null, o.a.createElement(C.a, {
label: Object(n.c)("earn/rename-payment-blocks") ? e("Active payments plans") : e("Active Recurring Payments plans")
}), t.map(t=>o.a.createElement(xa, {
key: t.ID,
translate: e,
subscription: t,
moment: a
}), void 0)) : o.a.createElement(re.a, {
className: "memberships__no-content"
}, o.a.createElement(Ct.a, {
title: Object(n.c)("earn/rename-payment-blocks") ? e("No payments found.") : e("No Recurring Payments found."),
illustration: "/calypso/images/no-memberships-da928d9201b85c2f3395d0a53dfaca56.svg"
})),
o.a.createElement(Ke.a, {
className: "memberships"
}, o.a.createElement(Qe.a, {
title: e("Other Sites")
}), o.a.createElement(Je.a, {
path: "/me/purchases/other",
title: "Me > Other Sites"
}), o.a.createElement(d.a, null), o.a.createElement(va, null), o.a.createElement(X, {
section: "memberships"
}), s)
}
)));
a("./me/memberships/subscription.scss");
class Oa extends o.a.Component {
constructor(...e) {
super(...e),
ee()(this, "stopSubscription", ()=>this.props.requestSubscriptionStop(this.props.subscription.ID))
}
render() {
const {translate: e, subscription: t, moment: a, stoppingStatus: n} = this.props;
return o.a.createElement(Ke.a, {
className: "memberships__subscription"
}, o.a.createElement(Qe.a, {
title: e("Other Sites")
}), o.a.createElement(d.a, null), o.a.createElement(va, null), o.a.createElement(X, {
section: "memberships"
}), o.a.createElement(lt.a, {
backHref: $.k + "/other"
}, t ? t.title : e("All subscriptions")), "start" === n && o.a.createElement(Wt.a, {
status: "is-info",
isLoading: !0,
text: e("Stopping this subscription")
}), "fail" === n && o.a.createElement(Wt.a, {
status: "is-error",
text: e("There was a problem while stopping your subscription")
}), "success" === n && o.a.createElement(Wt.a, {
status: "is-success",
text: e("This subscription has been stopped. You will not be charged.")
}), t && o.a.createElement("div", null, o.a.createElement(l.a, {
className: "memberships__subscription-meta"
}, o.a.createElement(kt.a, {
siteId: parseInt(t.site_id),
href: t.site_url
}), o.a.createElement("div", {
className: "memberships__subscription-title"
}, t.title), o.a.createElement(i.Fragment, null, o.a.createElement("ul", {
className: "memberships__subscription-inner-meta"
}, o.a.createElement("li", null, o.a.createElement("em", {
className: "memberships__subscription-inner-detail-label"
}, e("Price")), o.a.createElement("span", {
className: "memberships__subscription-inner-detail"
}, Object(De.a)(t.renewal_price, t.currency))), o.a.createElement("li", null, o.a.createElement("em", {
className: "memberships__subscription-inner-detail-label"
}, e("Renew interval")), o.a.createElement("span", {
className: "memberships__subscription-inner-detail"
}, t.renew_interval || "-")), o.a.createElement("li", null, o.a.createElement("em", {
className: "memberships__subscription-inner-detail-label"
}, e("Subscribed On")), o.a.createElement("span", {
className: "memberships__subscription-inner-detail"
}, a(t.start_date).format("ll"))), o.a.createElement("li", null, o.a.createElement("em", {
className: "memberships__subscription-inner-detail-label"
}, e("Renews on")), o.a.createElement("span", {
className: "memberships__subscription-inner-detail"
}, t.end_date ? a(t.end_date).format("ll") : e("Never Expires")))))), o.a.createElement(re.a, {
tagName: "button",
className: "memberships__subscription-remove",
onClick: this.stopSubscription
}, o.a.createElement(xt.a, {
icon: "trash"
}), e("Stop %s subscription.", {
args: t.title
}))))
}
}
var Sa = Object(u.c)((e,t)=>({
subscription: $a(e, t.subscriptionId),
stoppingStatus: Ca(e, t.subscriptionId)
}), {
requestSubscriptionStop: e=>t=>(t({
type: "MEMBERSHIPS_SUBSCRIPTION_STOP",
subscriptionId: e
}),
We.a.req.post(`/me/memberships/subscriptions/${e}/cancel`).then(()=>{
t({
type: "MEMBERSHIPS_SUBSCRIPTION_STOP_SUCCESS",
subscriptionId: e
})
}
).catch(a=>{
t({
type: "MEMBERSHIPS_SUBSCRIPTION_STOP_FAILURE",
subscriptionId: e,
error: a
})
}
))
})(Object(c.c)(Object(pe.b)(Oa)));
function wa(e, t) {
e.primary = o.a.createElement(Pa),
t()
}
function ka(e, t) {
const a = e.params.subscriptionId;
a && (e.primary = o.a.createElement(Sa, {
subscriptionId: a
})),
t()
}
var Da = a("./blocks/credit-card-form/index.jsx")
, Na = a("./components/forms/form-text-input/index.jsx")
, Ta = a("./components/forms/form-select/index.jsx");
var Ia = ()=>o.a.createElement("div", {
className: "credit-card-form-fields__loading-placeholder"
}, o.a.createElement("div", {
className: "credit-card-form-fields__field"
}, o.a.createElement(Na.a, null)), o.a.createElement("div", {
className: "credit-card-form-fields__field"
}, o.a.createElement(Na.a, null)), o.a.createElement("div", {
className: "credit-card-form-fields__extras"
}, o.a.createElement("div", {
className: "credit-card-form-fields__field expiration-date"
}, o.a.createElement(Na.a, null)), o.a.createElement("div", {
className: "credit-card-form-fields__field cvv"
}, o.a.createElement(Na.a, null)), o.a.createElement("div", {
className: "credit-card-form-fields__field country"
}, o.a.createElement(Ta.a, null)), o.a.createElement("div", {
className: "credit-card-form-fields__field postal-code"
}, o.a.createElement(Na.a, null))))
, Ra = a("./components/forms/form-button/index.jsx");
a("./me/purchases/components/loading-placeholder/style.scss");
class Aa extends o.a.Component {
constructor(...e) {
super(...e),
ee()(this, "goBack", ()=>{
r.a.back(this.props.path || "/")
}
)
}
render() {
return o.a.createElement(Ke.a, {
className: "loading-placeholder"
}, o.a.createElement(lt.a, {
className: "loading-placeholder__header",
onClick: this.goBack
}, this.props.title), this.props.children)
}
}
ee()(Aa, "propTypes", {
path: S.a.string,
title: S.a.string.isRequired
});
var Fa = Aa;
var La = ({title: e})=>o.a.createElement(Fa, {
title: e
}, o.a.createElement(l.a, {
className: "credit-card-form__content"
}, o.a.createElement(Ia, null)), o.a.createElement(re.a, {
className: "credit-card-form__footer"
}, o.a.createElement(Ra.a, {
isPrimary: !1
})))
, Ua = a("./components/data/query-user-purchases/index.jsx")
, Ma = {
addCreditCard: c.a.translate("Add Credit Card"),
cancelPurchase: c.a.translate("Cancel Purchase"),
confirmCancelDomain: c.a.translate("Cancel Domain"),
editCardDetails: c.a.translate("Change Credit Card", {
comment: "Credit card"
}),
addCardDetails: c.a.translate("Add Credit Card", {
comment: "Credit card"
}),
managePurchase: c.a.translate("Manage Purchase"),
purchases: c.a.translate("Purchases")
}
, qa = a("./state/purchases/selectors.js");
class Ba extends i.Component {
track() {
this.props.productSlug && this.props.eventName && this.props.recordTracksEvent(this.props.eventName, {
product_slug: this.props.productSlug
})
}
componentDidMount() {
this.track()
}
componentDidUpdate(e) {
this.props.eventName === e.eventName && this.props.productSlug === e.productSlug || this.track()
}
render() {
return null
}
}
ee()(Ba, "propTypes", {
purchaseId: S.a.number.isRequired,
productSlug: S.a.string,
recordTracksEvent: S.a.func.isRequired,
eventName: S.a.string.isRequired
});
var Ga = Object(u.c)((e,{purchaseId: t})=>{
const a = Object(qa.a)(e, t);
return {
productSlug: a ? a.productSlug : null
}
}
, {
recordTracksEvent: me.e
})(Ba)
, Va = a("./state/purchases/actions.js")
, Ha = a("./lib/store-transactions/index.js")
, Wa = a("./state/ui/selectors/get-selected-site.js")
, Ya = a("./state/sites/selectors/is-requesting-sites.js")
, za = a("./lib/stripe/index.js");
function Ka(e) {
const t = !e.hasLoadedSites || !e.hasLoadedUserPurchasesFromServer;
if (t || (({purchase: e, selectedSite: t})=>e && t)(e) || r()($.k),
t)
return o.a.createElement(i.Fragment, null, o.a.createElement(Ua.a, {
userId: e.userId
}), o.a.createElement(La, {
title: Ma.addCardDetails
}));
return o.a.createElement(Ke.a, null, o.a.createElement(Ga, {
eventName: "calypso_add_card_details_purchase_view",
purchaseId: e.purchaseId
}), o.a.createElement(Je.a, {
path: "/me/purchases/:site/:purchaseId/payment/add",
title: "Purchases > Add Card Details"
}), o.a.createElement(lt.a, {
backHref: Object($.h)(e.siteSlug, e.purchaseId)
}, Ma.addCardDetails), o.a.createElement(za.a, {
configurationArgs: {
needs_intent: !0
}
}, o.a.createElement(Da.a, {
apiParams: {
purchaseId: e.purchase.id
},
createCardToken: (...e)=>Object(Ha.a)("card_update", ...e),
purchase: e.purchase,
recordFormSubmitEvent: ()=>{
e.recordTracksEvent("calypso_purchases_credit_card_form_submit", {
product_slug: e.purchase.productSlug
})
}
,
siteSlug: e.siteSlug,
successCallback: ()=>{
const {id: t} = e.purchase;
e.clearPurchases(),
r()(Object($.h)(e.siteSlug, t))
}
})))
}
Ka.propTypes = {
clearPurchases: S.a.func.isRequired,
hasLoadedSites: S.a.bool.isRequired,
hasLoadedUserPurchasesFromServer: S.a.bool.isRequired,
purchaseId: S.a.number.isRequired,
purchase: S.a.object,
selectedSite: S.a.object,
siteSlug: S.a.string.isRequired,
userId: S.a.number
};
var Qa = Object(u.c)((e,{purchaseId: t})=>({
hasLoadedSites: !Object(Ya.a)(e),
hasLoadedUserPurchasesFromServer: Object(qa.j)(e),
purchase: Object(qa.a)(e, t),
selectedSite: Object(Wa.a)(e),
userId: Object(sa.h)(e)
}), {
clearPurchases: Va.a,
recordTracksEvent: me.e
})(Ka)
, Ja = a("./lib/analytics/tracks.js")
, Xa = a("./lib/react-helpers/index.js");
function Za(e) {
const t = ()=>r()($.c);
return o.a.createElement(Ke.a, null, o.a.createElement(Je.a, {
path: "/me/purchases/add-credit-card",
title: "Purchases > Add Credit Card"
}), o.a.createElement(Qe.a, {
title: Object(Xa.a)(Ma.purchases, Ma.addCreditCard)
}), o.a.createElement(lt.a, {
onClick: t
}, Ma.addCreditCard), o.a.createElement(za.a, {
configurationArgs: {
needs_intent: !0
}
}, o.a.createElement(Da.a, {
createCardToken: (...e)=>Object(Ha.a)("card_add", ...e),
recordFormSubmitEvent: ()=>Object(Ja.recordTracksEvent)("calypso_add_credit_card_form_submit"),
saveStoredCard: e.addStoredCard,
successCallback: t,
showUsedForExistingPurchasesInfo: !0
})))
}
Za.propTypes = {
addStoredCard: S.a.func.isRequired
};
const en = {
addStoredCard: h.a
};
var tn = Object(u.c)(null, en)(Za)
, an = a("../packages/format-currency/dist/esm/currencies.js")
, nn = a("./lib/purchases/actions.js")
, sn = a("./components/marketing-survey/cancel-purchase-form/index.jsx")
, rn = a("./components/marketing-survey/cancel-purchase-form/constants.js")
, on = a("./notices/index.js")
, cn = a("./state/sites/plans/actions.js");
function ln(e, t, a={}) {
return Object(It.D)(e) ? function(e, t, a) {
const n = a.refundText || e.refundText;
return Object(Bt.bb)(e) ? t("Your site's appearance will revert to its previously selected theme and you will be refunded %(cost)s.", {
args: {
cost: n
}
}) : Object(Bt.G)(e) ? t("You will be refunded %(cost)s, but your G Suite account will continue working without interruption. You will be able to manage your G Suite billing directly through Google.", {
args: {
cost: n
}
}) : Object(Bt.O)(e) ? t("All plan features - spam filtering, backups, and security screening - will be removed from your site and you will be refunded %(cost)s.", {
args: {
cost: n
}
}) : Object(Bt.z)(e) ? t("All plan features and custom changes will be removed from your site and you will be refunded %(cost)s.", {
args: {
cost: n
}
}) : t("You will be refunded %(cost)s.", {
args: {
cost: n
}
})
}(e, t, a) : function(e, t) {
const a = Object(It.l)(e);
return Object(Bt.G)(e) ? t("Your G Suite account remains active until it expires on %(subscriptionEndDate)s.", {
args: {
subscriptionEndDate: a
}
}) : Object(Bt.t)(e) ? t("Your domain mapping remains active until it expires on %(subscriptionEndDate)s.", {
args: {
subscriptionEndDate: a
}
}) : Object(Bt.X)(e) ? t("Your plan's features remain active until your subscription expires on %(subscriptionEndDate)s.", {
args: {
subscriptionEndDate: a
}
}) : ""
}(e, t)
}
class dn extends i.Component {
constructor(...e) {
super(...e),
ee()(this, "state", {
disabled: !1,
showDialog: !1,
survey: {}
}),
ee()(this, "getCancellationFlowType", ()=>Object(It.o)(this.props.purchase) ? rn.a.CANCEL_WITH_REFUND : rn.a.CANCEL_AUTORENEW),
ee()(this, "handleCancelPurchaseClick", ()=>{
if (Object(Bt.w)(this.props.purchase))
return this.goToCancelConfirmation();
this.setState({
showDialog: !0
})
}
),
ee()(this, "closeDialog", ()=>{
this.setState({
showDialog: !1
})
}
),
ee()(this, "onSurveyChange", e=>{
this.setState({
survey: e
})
}
),
ee()(this, "goToCancelConfirmation", ()=>{
const {id: e} = this.props.purchase
, t = this.props.siteSlug;
r()(Object($.f)(t, e))
}
),
ee()(this, "cancelPurchase", ()=>{
const {purchase: e, translate: t} = this.props;
this.setDisabled(!0),
Object(nn.b)(e.id, a=>{
const n = Object(It.h)(e)
, s = Object(It.l)(e);
this.props.refreshSitePlans(e.siteId),
this.props.clearPurchases(),
a ? (on.a.success(t("%(purchaseName)s was successfully cancelled. It will be available for use until it expires on %(subscriptionEndDate)s.", {
args: {
purchaseName: n,
subscriptionEndDate: s
}
}), {
persistent: !0
}),
r()($.k)) : (on.a.error(t("There was a problem canceling %(purchaseName)s. Please try again later or contact support.", {
args: {
purchaseName: n
}
})),
this.cancellationFailed())
}
)
}
),
ee()(this, "cancellationFailed", ()=>{
this.closeDialog(),
this.setDisabled(!1)
}
),
ee()(this, "setDisabled", e=>{
this.setState({
disabled: e
})
}
),
ee()(this, "handleSubmit", (e,t)=>{
if (e)
return on.a.error(e.message),
void this.cancellationFailed();
on.a.success(t.message, {
persistent: !0
}),
this.props.refreshSitePlans(this.props.purchase.siteId),
this.props.clearPurchases(),
r.a.redirect($.k)
}
),
ee()(this, "cancelAndRefund", ()=>{
const {purchase: e, cancelBundledDomain: t} = this.props;
this.setDisabled(!0),
Object(nn.a)(e.id, {
product_id: e.productId,
cancel_bundled_domain: t ? 1 : 0
}, (t,a)=>{
if (this.setDisabled(!1),
t)
return on.a.error(t.message),
void this.cancellationFailed();
on.a.success(a.message, {
persistent: !0
}),
this.props.refreshSitePlans(e.siteId),
this.props.clearPurchases(),
r.a.redirect($.k)
}
)
}
),
ee()(this, "downgradeClick", ()=>{
const {purchase: e} = this.props
, t = Object(qa.b)(e);
this.setDisabled(!0),
Object(nn.a)(e.id, {
product_id: e.productId,
type: "downgrade",
to_product_id: t.getProductId()
}, (t,a)=>{
if (this.setDisabled(!1),
t)
return on.a.error(t.message),
void this.cancellationFailed();
on.a.success(a.message, {
persistent: !0
}),
this.props.refreshSitePlans(e.siteId),
this.props.clearPurchases(),
r.a.redirect($.k)
}
)
}
),
ee()(this, "submitCancelAndRefundPurchase", ()=>{
Object(It.o)(this.props.purchase) ? this.cancelAndRefund() : this.cancelPurchase()
}
),
ee()(this, "renderCancellationEffect", ()=>{
const {purchase: e, translate: t, includedDomainPurchase: a, cancelBundledDomain: n} = this.props
, s = {};
if (n && a && Object(Bt.w)(a)) {
const {precision: t} = Object(an.b)(e.currencyCode);
s.refundText = e.currencySymbol + parseFloat(e.refundAmount + a.amount).toFixed(t)
}
return o.a.createElement("p", null, function(e, t) {
const {domain: a} = e
, n = Object(It.h)(e);
return Object(It.D)(e) ? t("Are you sure you want to cancel and remove %(purchaseName)s from {{em}}%(domain)s{{/em}}? ", {
args: {
purchaseName: n,
domain: a
},
components: {
em: o.a.createElement("em", null)
}
}) : t("Are you sure you want to cancel %(purchaseName)s for {{em}}%(domain)s{{/em}}? ", {
args: {
purchaseName: n,
domain: a
},
components: {
em: o.a.createElement("em", null)
}
})
}(e, t), ln(e, t, s))
}
)
}
render() {
const {purchase: e, selectedSite: t, translate: a} = this.props;
let n, s;
Object(It.o)(e) ? (s = this.handleCancelPurchaseClick,
Object(Bt.w)(e) && (n = a("Cancel Domain and Refund")),
Object(It.H)(e) && (n = a("Cancel Subscription")),
Object(It.w)(e) && (n = a("Cancel and Refund"))) : (s = this.cancelPurchase,
Object(Bt.w)(e) && (n = a("Cancel Domain")),
Object(It.H)(e) && (s = this.handleCancelPurchaseClick,
n = a("Cancel Subscription")));
const r = this.state.disabled || this.props.disabled;
return o.a.createElement("div", null, o.a.createElement(p.a, {
className: "cancel-purchase__button",
disabled: r,
onClick: s,
primary: !0
}, n), o.a.createElement(sn.a, {
disableButtons: r,
defaultContent: this.renderCancellationEffect(),
onInputChange: this.onSurveyChange,
purchase: e,
selectedSite: t,
isVisible: this.state.showDialog,
onClose: this.closeDialog,
onClickFinalConfirm: this.submitCancelAndRefundPurchase,
downgradeClick: this.downgradeClick,
flowType: this.getCancellationFlowType()
}))
}
}
ee()(dn, "propTypes", {
purchase: S.a.object.isRequired,
selectedSite: S.a.object,
siteSlug: S.a.string.isRequired,
cancelBundledDomain: S.a.bool.isRequired,
includedDomainPurchase: S.a.object,
disabled: S.a.bool
});
var un = Object(u.c)(null, {
clearPurchases: Va.a,
refreshSitePlans: cn.c
})(Object(c.c)(dn));
const pn = ({purchaseId: e, siteSlug: t})=>{
let a;
return t && (a = Object($.h)(t, e)),
o.a.createElement(Fa, {
title: Ma.cancelPurchase,
path: a
}, o.a.createElement(l.a, {
className: "cancel-purchase-loading-placeholder__card"
}, o.a.createElement("h2", {
className: "loading-placeholder__content cancel-purchase-loading-placeholder__header"
}), o.a.createElement("div", {
className: "loading-placeholder__content cancel-purchase-loading-placeholder__subheader"
}), o.a.createElement("div", {
className: "loading-placeholder__content cancel-purchase-loading-placeholder__reason"
}), o.a.createElement("div", {
className: "loading-placeholder__content cancel-purchase-loading-placeholder__reason"
})), o.a.createElement(re.a, null, o.a.createElement(p.a, {
className: "cancel-purchase-loading-placeholder__cancel-button"
})))
}
;
pn.propTypes = {
purchaseId: S.a.number.isRequired,
siteSlug: S.a.string.isRequired
};
var mn = pn
, hn = a("./components/forms/form-label/index.tsx")
, gn = a("./components/forms/form-radio/index.jsx")
, bn = a("./components/forms/form-checkbox/index.jsx");
const fn = ({purchase: e, includedDomainPurchase: t, cancelBundledDomain: a, confirmCancelBundledDomain: n, onCancelConfirmationStateChange: s})=>{
const {refundPeriodInDays: r} = e;
let i, l = !0;
const d = e=>{
const t = "cancel" === e.currentTarget.value;
s({
cancelBundledDomain: t,
confirmCancelBundledDomain: t && n
})
}
, u = e=>{
s({
cancelBundledDomain: a,
confirmCancelBundledDomain: e.target.checked
})
}
;
if (Object(It.D)(e)) {
if (Object(Bt.w)(e) && (i = c.a.translate("When you cancel your domain within %(refundPeriodInDays)d days of purchasing, you'll receive a refund and it will be removed from your site immediately.", {
args: {
refundPeriodInDays: r
}
})),
Object(It.H)(e))
if (i = [c.a.translate("We're sorry to hear the %(productName)s plan didn't fit your current needs, but thank you for giving it a try.", {
args: {
productName: Object(It.h)(e)
}
})],
t && Object(Bt.t)(t))
i.push(c.a.translate("This plan includes mapping for the domain %(mappedDomain)s. Cancelling will remove all the plan's features from your site, including the domain.", {
args: {
mappedDomain: t.meta
}
}), c.a.translate("Your site will no longer be available at %(mappedDomain)s. Instead, it will be at %(wordpressSiteUrl)s", {
args: {
mappedDomain: t.meta,
wordpressSiteUrl: e.domain
}
}), c.a.translate("The domain %(mappedDomain)s itself is not canceled. Only the connection between WordPress.com and your domain is removed. %(mappedDomain)s is registered elsewhere and you can still use it with other sites.", {
args: {
mappedDomain: t.meta
}
})),
l = !1;
else if (t && Object(Bt.w)(t)) {
const s = e.totalRefundText;
Object(It.D)(t) ? (i.push(c.a.translate("Your plan included the custom domain %(domain)s. You can cancel your domain as well as the plan, but keep in mind that when you cancel a domain you risk losing it forever, and visitors to your site may experience difficulties accessing it.", {
args: {
domain: t.meta
}
}), c.a.translate("We'd like to offer you two options to choose from:"), o.a.createElement(hn.a, {
key: "keep_bundled_domain"
}, o.a.createElement(gn.a, {
name: "keep_bundled_domain_false",
value: "keep",
checked: !a,
onChange: d
}), o.a.createElement("span", null, c.a.translate("Cancel the plan, but keep %(domain)s.", {
args: {
domain: t.meta
}
}), o.a.createElement("br", null), c.a.translate("You'll receive a partial refund of %(refundAmount)s -- the cost of the %(productName)s plan, minus %(domainCost)s for the domain. There will be no change to your domain registration, and you're free to use it on WordPress.com or transfer it elsewhere.", {
args: {
productName: Object(It.h)(e),
domainCost: t.costToUnbundleText,
refundAmount: e.refundText
}
}))), o.a.createElement(hn.a, {
key: "cancel_bundled_domain"
}, o.a.createElement(gn.a, {
name: "cancel_bundled_domain_false",
value: "cancel",
checked: a,
onChange: d
}), o.a.createElement("span", null, c.a.translate('Cancel the plan {{em}}and{{/em}} the domain "%(domain)s."', {
args: {
domain: t.meta
},
components: {
em: o.a.createElement("em", null)
}
}), o.a.createElement("br", null), c.a.translate("You'll receive a full refund of %(planCost)s. The domain will be cancelled, and it's possible you'll lose it permanently.", {
args: {
planCost: s
}
})))),
a && i.push(c.a.translate("When you cancel a domain, it becomes unavailable for a while. Anyone may register it once it's available again, so it's possible you won't have another chance to register it in the future. If you'd like to use your domain on a site hosted elsewhere, consider {{a}}updating your name servers{{/a}} instead.", {
components: {
a: o.a.createElement("a", {
href: Xt.bb,
target: "_blank",
rel: "noopener noreferrer"
})
}
}), o.a.createElement(hn.a, null, o.a.createElement(bn.a, {
checked: n,
onChange: u
}), o.a.createElement("span", null, c.a.translate("I understand that canceling my domain means I might {{strong}}never be able to register it again{{/strong}}.", {
components: {
strong: o.a.createElement("strong", null)
}
}))))) : i.push(c.a.translate("This plan includes the custom domain, %(domain)s, normally a %(domainCost)s purchase. The domain will not be removed along with the plan, to avoid any interruptions for your visitors. ", {
args: {
domain: t.meta,
domainCost: t.priceText
}
}), c.a.translate("You will receive a partial refund of %(refundAmount)s which is %(planCost)s for the plan minus %(domainCost)s for the domain.", {
args: {
domainCost: t.priceText,
planCost: s,
refundAmount: e.refundText
}
})),
l = !1
} else
i = c.a.translate("When you cancel your subscription within %(refundPeriodInDays)d days of purchasing, you'll receive a refund and it will be removed from your site immediately.", {
args: {
refundPeriodInDays: r
}
});
Object(It.w)(e) && (i = c.a.translate("When you cancel this purchase within %(refundPeriodInDays)d days of purchasing, you'll receive a refund and it will be removed from your site immediately.", {
args: {
refundPeriodInDays: r
}
}))
} else
i = Object(Bt.w)(e) ? c.a.translate("When you cancel your domain, it will remain registered and active until the registration expires, at which point it will be automatically removed from your site.") : Object(It.H)(e) && t && Object(Bt.t)(t) ? c.a.translate("This plan includes the custom domain mapping for %(mappedDomain)s. The domain will not be removed along with the plan, to avoid any interruptions for your visitors. ", {
args: {
mappedDomain: t.meta,
mappingCost: t.priceText
}
}) : Object(It.H)(e) && t && Object(Bt.w)(t) ? c.a.translate("This plan includes the custom domain, %(domain)s. The domain will not be removed along with the plan, to avoid any interruptions for your visitors. ", {
args: {
domain: t.meta,
domainCost: t.priceText
}
}) : c.a.translate("When you cancel your subscription, you'll be able to use %(productName)s until your subscription expires. Once it expires, it will be automatically removed from your site.", {
args: {
productName: Object(It.h)(e)
}
});
return o.a.createElement("div", {
className: "cancel-purchase__info"
}, Array.isArray(i) ? i.map((t,a)=>o.a.createElement("p", {
key: e.id + "_refund_p_" + a,
className: "cancel-purchase__refund-information"
}, t)) : o.a.createElement("p", {
className: "cancel-purchase__refund-information"
}, i), l && o.a.createElement("strong", {
className: "cancel-purchase__support-information"
}, !Object(It.D)(e) && Object(It.I)(e) ? c.a.translate("Have a question? Want to request a refund? {{contactLink}}Ask a Happiness Engineer!{{/contactLink}}", {
components: {
contactLink: o.a.createElement("a", {
href: Xt.c
})
}
}) : c.a.translate("Have a question? {{contactLink}}Ask a Happiness Engineer!{{/contactLink}}", {
components: {
contactLink: o.a.createElement("a", {
href: Xt.c
})
}
})))
}
;
fn.propTypes = {
purchase: S.a.object.isRequired,
includedDomainPurchase: S.a.object,
cancelBundledDomain: S.a.bool,
confirmCancelBundledDomain: S.a.bool,
onCancelConfirmationStateChange: S.a.func
};
var _n = Object(u.c)((e,t)=>({
includedDomainPurchase: Object(qa.d)(e, t.purchase)
}))(fn)
, yn = a("./me/purchases/utils.js")
, jn = a("./my-sites/domains/paths.js")
, vn = a("./my-sites/email/paths.js")
, En = a("./state/themes/selectors/get-theme-details-url.js");
const $n = ({productUrl: e, purchase: t, selectedSite: a})=>{
let s, r, i = {};
return a ? (Object(Bt.X)(t) && (s = "/plans/my-plan/" + a.slug,
r = c.a.translate("View Plan Features")),
(Object(Bt.u)(t) || Object(Bt.Z)(t)) && (s = Object(jn.g)(a.slug, t.meta),
r = c.a.translate("Domain Settings")),
Object(Bt.G)(t) && (s = Object(vn.a)(a.slug, t.meta),
r = c.a.translate("Email Settings")),
Object(Bt.bb)(t) && (s = e,
r = c.a.translate("Theme Details"),
n.a.isEnabled("manage/themes/details") || (i = {
target: "_blank"
})),
s && r ? o.a.createElement("a", $t()({
className: "product-link",
href: s
}, i), r) : o.a.createElement("span", null)) : o.a.createElement("span", null)
}
;
$n.propTypes = {
purchase: S.a.object.isRequired,
selectedSite: S.a.oneOfType([S.a.bool, S.a.object])
};
var Cn = Object(u.c)((e,{purchase: t})=>Object(Bt.bb)(t) ? {
productUrl: Object(En.a)(e, t.meta, t.siteId)
} : {})($n);
a("./me/purchases/cancel-purchase/style.scss");
class xn extends o.a.Component {
constructor(...e) {
super(...e),
ee()(this, "state", {
cancelBundledDomain: !1,
confirmCancelBundledDomain: !1
}),
ee()(this, "isDataValid", (e=this.props)=>{
if (Object(yn.c)(e))
return !0;
const {purchase: t} = e
, a = Object(It.D)(t) || !Object(Bt.x)(t);
return t && Object(It.r)(t) && a
}
),
ee()(this, "redirect", e=>{
const {purchase: t, siteSlug: a} = e;
let n = $.k;
a && t && (!Object(It.r)(t) || Object(Bt.x)(t)) && (n = Object($.h)(a, t.id)),
r.a.redirect(n)
}
),
ee()(this, "onCancelConfirmationStateChange", e=>{
this.setState(e)
}
),
ee()(this, "renderFooterText", ()=>{
const {purchase: e} = this.props
, {refundText: t, expiryDate: a, totalRefundText: n} = e;
if (Object(It.o)(e))
return this.state.cancelBundledDomain && this.props.includedDomainPurchase ? this.props.translate("%(refundText)s to be refunded", {
args: {
refundText: n
},
context: 'refundText is of the form "[currency-symbol][amount]" i.e. "$20"'
}) : this.props.translate("%(refundText)s to be refunded", {
args: {
refundText: t
},
context: 'refundText is of the form "[currency-symbol][amount]" i.e. "$20"'
});
const s = this.props.moment(a).format("LL");
return Object(Bt.w)(e) ? this.props.translate("After you confirm this change, the domain will be removed on %(expirationDate)s", {
args: {
expirationDate: s
}
}) : this.props.translate("After you confirm this change, the subscription will be removed on %(expirationDate)s", {
args: {
expirationDate: s
}
})
}
)
}
UNSAFE_componentWillMount() {
this.isDataValid() || this.redirect(this.props)
}
UNSAFE_componentWillReceiveProps(e) {
!this.isDataValid() || this.isDataValid(e) || this.redirect(e)
}
render() {
if (!this.isDataValid())
return null;
if (Object(yn.c)(this.props))
return o.a.createElement("div", null, o.a.createElement(Ua.a, {
userId: this.props.userId
}), o.a.createElement(mn, {
purchaseId: this.props.purchaseId,
siteSlug: this.props.siteSlug
}));
const {purchase: e} = this.props
, t = Object(It.h)(e)
, {siteName: a, domain: n} = e;
let s;
return (Object(Bt.w)(e) || Object(It.w)(e)) && (s = this.props.translate("Cancel %(purchaseName)s", {
args: {
purchaseName: t
}
})),
Object(It.H)(e) && (s = this.props.translate("Cancel Your %(purchaseName)s Subscription", {
args: {
purchaseName: t
}
})),
o.a.createElement(Ke.a, {
className: "cancel-purchase"
}, o.a.createElement(Ga, {
eventName: "calypso_cancel_purchase_purchase_view",
purchaseId: this.props.purchaseId
}), o.a.createElement(lt.a, {
backHref: Object($.h)(this.props.siteSlug, this.props.purchaseId)
}, Ma.cancelPurchase), o.a.createElement(l.a, {
className: "cancel-purchase__card"
}, o.a.createElement("h2", null, s), o.a.createElement(_n, {
purchase: e,
includedDomainPurchase: this.props.includedDomainPurchase,
confirmBundledDomain: this.state.confirmCancelBundledDomain,
cancelBundledDomain: this.state.cancelBundledDomain,
onCancelConfirmationStateChange: this.onCancelConfirmationStateChange
})), o.a.createElement(re.a, {
className: "cancel-purchase__product-information"
}, o.a.createElement("div", {
className: "cancel-purchase__purchase-name"
}, t), o.a.createElement("div", {
className: "cancel-purchase__site-title"
}, a || n), o.a.createElement(Cn, {
purchase: e,
selectedSite: this.props.site
})), o.a.createElement(re.a, {
className: "cancel-purchase__footer"
}, o.a.createElement("div", {
className: "cancel-purchase__refund-amount"
}, this.renderFooterText(this.props)), o.a.createElement(un, {
purchase: e,
includedDomainPurchase: this.props.includedDomainPurchase,
disabled: this.state.cancelBundledDomain && !this.state.confirmCancelBundledDomain,
selectedSite: this.props.site,
siteSlug: this.props.siteSlug,
cancelBundledDomain: this.state.cancelBundledDomain
})))
}
}
ee()(xn, "propTypes", {
hasLoadedSites: S.a.bool.isRequired,
hasLoadedUserPurchasesFromServer: S.a.bool.isRequired,
includedDomainPurchase: S.a.object,
purchase: S.a.object,
purchaseId: S.a.number.isRequired,
site: S.a.object,
siteSlug: S.a.string.isRequired,
userId: S.a.number
});
var Pn = Object(u.c)((e,t)=>{
const a = Object(qa.a)(e, t.purchaseId);
return {
hasLoadedSites: !Object(Ya.a)(e),
hasLoadedUserPurchasesFromServer: Object(qa.j)(e),
purchase: a,
includedDomainPurchase: Object(qa.d)(e, a),
site: Object(Pt.a)(e, a ? a.siteId : null),
userId: Object(sa.h)(e)
}
}
)(Object(c.c)(Object(pe.b)(xn)))
, On = [{
value: "misspelled",
label: c.a.translate("I misspelled the domain"),
helpMessage: c.a.translate("If you misspelled the domain name you were attempting to purchase, it’s likely that others will as well, and you might want to consider keeping the misspelled domain.")
}, {
value: "other_host",
label: c.a.translate("I want to use the domain with another service or host"),
helpMessage: c.a.translate("Canceling a domain name causes the domain to become unavailable for a brief period. Afterward, anyone can repurchase. If you wish to use the domain with another service, you’ll want to {{a}}update your name servers{{/a}} instead.", {
components: {
a: o.a.createElement("a", {
href: Xt.bb,
target: "_blank",
rel: "noopener noreferrer"
})
}
})
}, {
value: "transfer",
label: c.a.translate("I want to transfer my domain to another registrar"),
helpMessage: c.a.translate("Canceling a domain name may cause the domain to become unavailable for a long time before it can be purchased again, and someone may purchase it before you get a chance. Instead, please {{a}}use our transfer out feature{{/a}} if you want to use this domain again in the future.", {
components: {
a: o.a.createElement("a", {
href: Xt.Y,
target: "_blank",
rel: "noopener noreferrer"
})
}
})
}, {
value: "expectations",
label: c.a.translate("The service isn’t what I expected"),
helpMessage: c.a.translate("If you misspelled the domain name you were attempting to purchase, it’s likely that others will as well, and you might want to consider keeping the misspelled domain.")
}, {
value: "wanted_free",
label: c.a.translate("I meant to get a free blog"),
helpMessage: c.a.translate("Please provide a brief description of your reasons for canceling:"),
showTextarea: !0
}, {
value: "other",
label: c.a.translate("Something not listed here"),
helpMessage: c.a.translate("Please provide a brief description of your reasons for canceling:"),
showTextarea: !0
}];
const Sn = ({purchaseId: e, selectedSite: t})=>{
let a;
return t && (a = Object($.e)(t.slug, e)),
o.a.createElement(Fa, {
title: Ma.confirmCancelDomain,
path: a
}, o.a.createElement(l.a, {
className: "confirm-cancel-domain__loading-placeholder-card"
}, o.a.createElement("h2", {
className: "loading-placeholder__content confirm-cancel-domain__loading-placeholder-header"
}), o.a.createElement("div", {
className: "loading-placeholder__content confirm-cancel-domain__loading-placeholder-subheader"
}), o.a.createElement("div", {
className: "loading-placeholder__content confirm-cancel-domain__loading-placeholder-reason"
}), o.a.createElement("div", {
className: "loading-placeholder__content confirm-cancel-domain__loading-placeholder-reason"
})), o.a.createElement(re.a, null, o.a.createElement(p.a, {
className: "confirm-cancel-domain__loading-placeholder-cancel-button"
})))
}
;
Sn.propTypes = {
purchaseId: S.a.number.isRequired,
selectedSite: S.a.oneOfType([S.a.bool, S.a.object])
};
var wn = Sn
, kn = a("./components/forms/form-section-heading/index.jsx")
, Dn = a("./components/forms/form-textarea/index.jsx")
, Nn = a("./state/selectors/is-domain-only-site.js")
, Tn = a("./state/sites/actions.js")
, In = a("./state/ui/actions/index.js");
a("./me/purchases/confirm-cancel-domain/style.scss");
class Rn extends o.a.Component {
constructor(...e) {
super(...e),
ee()(this, "state", {
selectedReason: null,
message: "",
confirmed: !1,
submitting: !1
}),
ee()(this, "redirectIfDataIsInvalid", e=>{
if (Object(yn.c)(e) || this.state.submitting)
return null;
const {purchase: t} = e;
t && Object(Bt.w)(t) && e.selectedSite || r.a.redirect($.k)
}
),
ee()(this, "isValidReasonToCancel", ()=>{
const e = this.state.selectedReason;
return !!e && -1 === ["other_host", "transfer"].indexOf(e.value)
}
),
ee()(this, "onSubmit", e=>{
e.preventDefault();
const {purchase: t} = this.props
, a = Object(It.h)(t)
, n = {
domain_cancel_reason: this.state.selectedReason.value,
domain_cancel_message: this.state.message,
confirm: !0,
product_id: t.productId,
blog_id: t.siteId,
domain: a
};
this.setState({
submitting: !0
}),
Object(nn.a)(t.id, n, e=>{
this.setState({
submitting: !1
});
const {isDomainOnlySite: n, translate: s, selectedSite: i} = this.props;
n && (this.props.receiveDeletedSite(i.ID),
this.props.setAllSitesSelected()),
e ? on.a.error(e.message || s("Unable to cancel your purchase. Please try again later or contact support.")) : (on.a.success(s("%(purchaseName)s was successfully cancelled and refunded.", {
args: {
purchaseName: a
}
}), {
persistent: !0
}),
this.props.refreshSitePlans(t.siteId),
this.props.clearPurchases(),
Object(Ja.recordTracksEvent)("calypso_domain_cancel_form_submit", {
product_slug: t.productSlug
}),
r.a.redirect($.k))
}
)
}
),
ee()(this, "onReasonChange", e=>{
const t = e.currentTarget;
this.setState({
selectedReason: Object(le.a)(On, {
value: t[t.selectedIndex].value
})
})
}
),
ee()(this, "onConfirmationChange", ()=>{
this.setState({
confirmed: !this.state.confirmed
})
}
),
ee()(this, "onMessageChange", e=>{
this.setState({
message: e.target.value
})
}
),
ee()(this, "renderHelpMessage", ()=>{
const e = this.state.selectedReason;
if (e)
return o.a.createElement("div", {
className: "confirm-cancel-domain__help-message"
}, o.a.createElement("p", null, e.helpMessage), e.showTextarea && o.a.createElement(Dn.a, {
className: "confirm-cancel-domain__reason-details",
onChange: this.onMessageChange
}))
}
),
ee()(this, "renderConfirmationCheckbox", ()=>{
if (this.isValidReasonToCancel())
return o.a.createElement("div", {
className: "confirm-cancel-domain__confirm-container"
}, o.a.createElement(hn.a, null, o.a.createElement(bn.a, {
checked: this.state.confirmed,
onChange: this.onConfirmationChange
}), o.a.createElement("span", null, this.props.translate("I understand that canceling means that I may {{strong}}lose this domain forever{{/strong}}.", {
components: {
strong: o.a.createElement("strong", null)
}
}))))
}
),
ee()(this, "renderSubmitButton", ()=>{
if (!this.isValidReasonToCancel())
return;
if (this.state.submitting)
return o.a.createElement(Ra.a, {
isPrimary: !0,
disabled: !0
}, this.props.translate("Cancelling Domain…"));
const e = this.state.selectedReason
, t = this.state.confirmed;
return e && "misspelled" === e.value ? o.a.createElement(Ra.a, {
isPrimary: !0,
onClick: this.onSubmit,
disabled: !t
}, this.props.translate("Cancel Anyway")) : o.a.createElement(Ra.a, {
isPrimary: !0,
onClick: this.onSubmit,
disabled: !t
}, this.props.translate("Cancel Domain"))
}
)
}
componentDidMount() {
this.redirectIfDataIsInvalid(this.props)
}
UNSAFE_componentWillReceiveProps(e) {
this.redirectIfDataIsInvalid(e)
}
render() {
if (Object(yn.c)(this.props))
return o.a.createElement("div", null, o.a.createElement(Ua.a, {
userId: this.props.userId
}), o.a.createElement(wn, {
purchaseId: this.props.purchaseId,
selectedSite: this.props.selectedSite
}));
const {purchase: e} = this.props
, t = Object(It.h)(e);
return o.a.createElement(Ke.a, {
className: "confirm-cancel-domain"
}, o.a.createElement(Ga, {
eventName: "calypso_confirm_cancel_domain_purchase_view",
purchaseId: this.props.purchaseId
}), o.a.createElement(Je.a, {
path: "/me/purchases/:site/:purchaseId/confirm-cancel-domain",
title: "Purchases > Confirm Cancel Domain"
}), o.a.createElement(lt.a, {
backHref: Object($.e)(this.props.siteSlug, this.props.purchaseId)
}, Ma.confirmCancelDomain), o.a.createElement(l.a, null, o.a.createElement(kn.a, null, this.props.translate("Canceling %(domain)s", {
args: {
domain: t
}
})), o.a.createElement("p", null, this.props.translate("Since domain cancellation can cause your site to stop working, we’d like to make sure we help you take the right action. Please select the best option below.")), o.a.createElement(Ta.a, {
className: "confirm-cancel-domain__reasons-dropdown",
onChange: this.onReasonChange,
defaultValue: "disabled"
}, o.a.createElement("option", {
disabled: "disabled",
value: "disabled",
key: "disabled"
}, this.props.translate("Please let us know why you wish to cancel.")), Object(ge.a)(On, ({value: e, label: t})=>o.a.createElement("option", {
value: e,
key: e
}, t))), this.renderHelpMessage(), this.renderConfirmationCheckbox(), this.renderSubmitButton()))
}
}
ee()(Rn, "propTypes", {
hasLoadedUserPurchasesFromServer: S.a.bool.isRequired,
isDomainOnlySite: S.a.bool,
purchaseId: S.a.number.isRequired,
receiveDeletedSite: S.a.func.isRequired,
purchase: S.a.object,
selectedSite: S.a.oneOfType([S.a.bool, S.a.object]),
setAllSitesSelected: S.a.func.isRequired,
siteSlug: S.a.string.isRequired,
userId: S.a.number
});
var An = Object(u.c)((e,t)=>{
const a = Object(Wa.a)(e);
return {
hasLoadedSites: !Object(Ya.a)(e),
hasLoadedUserPurchasesFromServer: Object(qa.j)(e),
isDomainOnlySite: Object(Nn.a)(e, a && a.ID),
purchase: Object(qa.a)(e, t.purchaseId),
selectedSite: a,
userId: Object(sa.h)(e)
}
}
, {
clearPurchases: Va.a,
refreshSitePlans: cn.c,
receiveDeletedSite: Tn.b,
setAllSitesSelected: In.e
})(Object(c.c)(Rn));
function Fn(e) {
const t = !e.hasLoadedSites || !e.hasLoadedUserPurchasesFromServer;
if (t || (({purchase: e, selectedSite: t})=>e && t)(e) || r()($.k),
t || !e.hasLoadedStoredCardsFromServer)
return o.a.createElement(i.Fragment, null, o.a.createElement(E.a, null), o.a.createElement(Ua.a, {
userId: e.userId
}), o.a.createElement(La, {
title: Ma.editCardDetails
}));
return o.a.createElement(Ke.a, null, o.a.createElement(Ga, {
eventName: "calypso_edit_card_details_purchase_view",
purchaseId: e.purchaseId
}), o.a.createElement(Je.a, {
path: "/me/purchases/:site/:purchaseId/payment/edit/:cardId",
title: "Purchases > Edit Card Details"
}), o.a.createElement(lt.a, {
backHref: Object($.h)(e.siteSlug, e.purchaseId)
}, Ma.editCardDetails), o.a.createElement(za.a, {
configurationArgs: {
needs_intent: !0
}
}, o.a.createElement(Da.a, {
apiParams: {
purchaseId: e.purchase.id
},
createCardToken: (...e)=>Object(Ha.a)("card_update", ...e),
initialValues: e.card,
purchase: e.purchase,
recordFormSubmitEvent: ()=>{
e.recordTracksEvent("calypso_purchases_credit_card_form_submit", {
product_slug: e.purchase.productSlug
})
}
,
siteSlug: e.siteSlug,
successCallback: ()=>{
const {id: t} = e.purchase;
e.clearPurchases(),
r()(Object($.h)(e.siteSlug, t))
}
})))
}
Fn.propTypes = {
card: S.a.object,
clearPurchases: S.a.func.isRequired,
hasLoadedSites: S.a.bool.isRequired,
hasLoadedStoredCardsFromServer: S.a.bool.isRequired,
hasLoadedUserPurchasesFromServer: S.a.bool.isRequired,
purchaseId: S.a.number.isRequired,
purchase: S.a.object,
selectedSite: S.a.object,
siteSlug: S.a.string.isRequired,
userId: S.a.number
};
var Ln = Object(u.c)((e,{cardId: t, purchaseId: a})=>({
card: Object(b.a)(e, t),
hasLoadedSites: !Object(Ya.a)(e),
hasLoadedStoredCardsFromServer: Object(b.d)(e),
hasLoadedUserPurchasesFromServer: Object(qa.j)(e),
purchase: Object(qa.a)(e, a),
selectedSite: Object(Wa.a)(e),
userId: Object(sa.h)(e)
}), {
clearPurchases: Va.a,
recordTracksEvent: me.e
})(Fn)
, Un = a("./lib/abtest/index.js")
, Mn = a("./state/themes/selectors/get-canonical-theme.js")
, qn = a("./state/selectors/is-site-automated-transfer.js")
, Bn = a("./my-sites/plan-price/index.jsx")
, Gn = a("./state/users/selectors.js")
, Vn = a("./me/purchases/manage-purchase/auto-renew-toggle/index.jsx")
, Hn = a("./components/payment-logo/index.jsx")
, Wn = a("./components/user/index.jsx");
class Yn extends i.Component {
renderPrice() {
const {purchase: e, translate: t} = this.props
, {priceText: a, currencyCode: n, productSlug: s} = e
, r = Object(Ge.i)(s) || Object(Bt.h)(s);
let i = t("year");
if (Object(It.w)(e) || Object(Bt.x)(e))
return t("%(priceText)s %(currencyCode)s {{period}}(one-time){{/period}}", {
args: {
priceText: a,
currencyCode: n
},
components: {
period: o.a.createElement("span", {
className: "manage-purchase__time-period"
})
}
});
if (Object(It.v)(e))
return t("Free with Plan");
if (r && r.term)
switch (r.term) {
case Gt.Oc:
i = t("two years");
break;
case Gt.Pc:
i = t("month")
}
return t("%(priceText)s %(currencyCode)s {{period}}/ %(period)s{{/period}}", {
args: {
priceText: a,
currencyCode: n,
period: i
},
components: {
period: o.a.createElement("span", {
className: "manage-purchase__time-period"
})
}
})
}
renderRenewsOrExpiresOnLabel() {
const {purchase: e, translate: t} = this.props;
if (Object(It.u)(e)) {
if (Object(Bt.w)(e))
return t("Domain expires on");
if (Object(It.H)(e))
return t("Subscription expires on");
if (Object(It.w)(e))
return t("Expires on")
}
if (Object(It.t)(e)) {
if (Object(Bt.w)(e))
return t("Domain expired on");
if (Object(Bt.o)(e))
return t("Session used on");
if (Object(It.H)(e))
return t("Subscription expired on");
if (Object(It.w)(e))
return t("Expired on")
}
return Object(Bt.w)(e) ? t("Domain renews on") : Object(It.H)(e) ? t("Subscription renews on") : Object(It.w)(e) ? t("Renews on") : null
}
renderRenewsOrExpiresOn() {
const {moment: e, purchase: t, siteSlug: a, translate: n} = this.props;
if (Object(It.v)(t)) {
const e = Object($.h)(a, t.attachedToPurchaseId);
return o.a.createElement("span", null, o.a.createElement("a", {
href: e
}, n("Renews with Plan")))
}
return Object(It.u)(t) || Object(It.t)(t) ? e(t.expiryDate).format("LL") : Object(It.G)(t) ? e(t.renewDate).format("LL") : Object(It.w)(t) ? n("Never Expires") : void 0
}
renderPaymentInfo() {
const {purchase: e, translate: t, moment: a} = this.props
, n = null == e ? void 0 : e.payment;
if (Object(It.v)(e))
return t("Included with plan");
if (Object(It.q)(e)) {
let s = null;
return Object(It.y)(e) ? t("Credits") : (Object(It.x)(e) ? s = n.creditCard.number : Object(It.z)(e) && (s = t("expiring %(cardExpiry)s", {
args: {
cardExpiry: a(n.expiryDate, "MM/YY").format("MMMM YYYY")
}
})),
o.a.createElement(o.a.Fragment, null, o.a.createElement(Hn.b, {
type: Object(It.K)(e)
}), s))
}
return t("None")
}
renderPaymentDetails() {
const {purchase: e, translate: t} = this.props;
if (Object(It.w)(e) || Object(Bt.x)(e))
return null;
const a = o.a.createElement("span", null, o.a.createElement("em", {
className: "manage-purchase__detail-label"
}, t("Payment method")), o.a.createElement("span", {
className: "manage-purchase__detail"
}, this.renderPaymentInfo()));
return Object(yn.a)(e) && Object(It.x)(e) && Object(It.b)(e) && this.props.site ? o.a.createElement("li", null, o.a.createElement("a", {
href: Object(yn.b)(this.props.siteSlug, e)
}, a)) : o.a.createElement("li", null, a)
}
renderRenewErrorMessage() {
const {isJetpack: e, purchase: t, translate: a} = this.props;
return this.props.site ? null : e ? o.a.createElement("div", {
className: "manage-purchase__footnotes"
}, a("%(purchaseName)s expired on %(siteSlug)s, and the site is no longer connected to WordPress.com. To renew this purchase, please reconnect %(siteSlug)s to your WordPress.com account, then complete your purchase. Now sure how to reconnect? {{supportPageLink}}Here are the instructions{{/supportPageLink}}.", {
args: {
purchaseName: Object(It.h)(t),
siteSlug: this.props.purchase.domain
},
components: {
supportPageLink: o.a.createElement("a", {
href: Xt.I + "reconnecting-reinstalling-jetpack/#reconnecting-jetpack"
})
}
})) : o.a.createElement("div", {
className: "manage-purchase__footnotes"
}, a("You are the owner of %(purchaseName)s but because you are no longer a user on %(siteSlug)s, renewing it will require staff assistance. Please {{contactSupportLink}}contact support{{/contactSupportLink}}, and consider transferring this purchase to another active user on %(siteSlug)s to avoid this issue in the future.", {
args: {
purchaseName: Object(It.h)(t),
siteSlug: this.props.purchase.domain
},
components: {
contactSupportLink: o.a.createElement("a", {
href: Xt.c
})
}
}))
}
renderOwner() {
const {translate: e, owner: t} = this.props;
return t ? o.a.createElement("li", null, o.a.createElement("em", {
className: "manage-purchase__detail-label"
}, e("Owner")), o.a.createElement("span", {
className: "manage-purchase__detail"
}, o.a.createElement(Wn.a, {
user: {
...t,
name: t.display_name
}
}))) : null
}
renderExpiration() {
const {purchase: e, site: t, translate: a, moment: n, isAutorenewalEnabled: s} = this.props;
if (Object(Bt.x)(e))
return null;
if ((Object(Bt.w)(e) || Object(Bt.X)(e) || Object(Bt.G)(e)) && !Object(It.t)(e)) {
const r = o.a.createElement("span", {
className: "manage-purchase__detail-date-span"
})
, i = a(s ? "Auto-renew is ON" : "Auto-renew is OFF")
, c = s ? a("You will be billed on {{dateSpan}}%(renewDate)s{{/dateSpan}}", {
args: {
renewDate: e.renewDate && n(e.renewDate).format("LL")
},
components: {
dateSpan: r
}
}) : a("Expires on {{dateSpan}}%(expireDate)s{{/dateSpan}}", {
args: {
expireDate: n(e.expiryDate).format("LL")
},
components: {
dateSpan: r
}
});
return o.a.createElement("li", null, o.a.createElement("em", {
className: "manage-purchase__detail-label"
}, a("Subscription Renewal")), o.a.createElement("span", {
className: "manage-purchase__detail"
}, i), o.a.createElement("span", {
className: "manage-purchase__detail"
}, c), t && o.a.createElement("span", {
className: "manage-purchase__detail"
}, o.a.createElement(Vn.a, {
planName: t.plan.product_name_short,
siteDomain: t.domain,
siteSlug: t.slug,
purchase: e,
toggleSource: "manage-purchase"
})))
}
return o.a.createElement("li", null, o.a.createElement("em", {
className: "manage-purchase__detail-label"
}, this.renderRenewsOrExpiresOnLabel()), o.a.createElement("span", {
className: "manage-purchase__detail"
}, this.renderRenewsOrExpiresOn()))
}
renderPlaceholder() {
return o.a.createElement("ul", {
className: "manage-purchase__meta"
}, Object(je.a)(4, e=>o.a.createElement("li", {
key: e
}, o.a.createElement("em", {
className: "manage-purchase__detail-label"
}), o.a.createElement("span", {
className: "manage-purchase__detail"
}))))
}
render() {
const {translate: e, purchaseId: t} = this.props;
return Object(yn.c)(this.props) || !t ? this.renderPlaceholder() : o.a.createElement(o.a.Fragment, null, o.a.createElement("ul", {
className: "manage-purchase__meta"
}, this.renderOwner(), o.a.createElement("li", null, o.a.createElement("em", {
className: "manage-purchase__detail-label"
}, e("Price")), o.a.createElement("span", {
className: "manage-purchase__detail"
}, this.renderPrice())), this.renderExpiration(), this.renderPaymentDetails()), this.renderRenewErrorMessage())
}
}
ee()(Yn, "propTypes", {
hasLoadedSites: S.a.bool.isRequired,
hasLoadedUserPurchasesFromServer: S.a.bool.isRequired,
purchaseId: S.a.oneOfType([S.a.number, S.a.bool]).isRequired,
purchase: S.a.object,
site: S.a.object,
siteSlug: S.a.string.isRequired
}),
ee()(Yn, "defaultProps", {
hasLoadedSites: !1,
hasLoadedUserPurchasesFromServer: !1,
purchaseId: !1
});
var zn = Object(u.c)((e,{purchaseId: t})=>{
const a = Object(qa.a)(e, t);
return {
hasLoadedSites: !Object(Ya.a)(e),
hasLoadedUserPurchasesFromServer: Object(qa.j)(e),
purchase: a,
site: a ? Object(Pt.a)(e, a.siteId) : null,
owner: a ? Object(Gn.a)(e, a.userId) : null,
isAutorenewalEnabled: a ? !Object(It.u)(a) : null,
isJetpack: a && (Object(Bt.O)(a) || Object(Bt.Q)(a))
}
}
)(Object(c.c)(Object(pe.b)(Yn)))
, Kn = a("../node_modules/lodash-es/minBy.js")
, Qn = a("../node_modules/lodash-es/merge.js")
, Jn = a("./me/purchases/upcoming-renewals/upcoming-renewals-dialog.tsx");
a("./me/purchases/manage-purchase/notices.scss");
const Xn = e=>({
warning: e,
position: "individual-purchase"
});
class Zn extends i.Component {
constructor(...e) {
super(...e),
ee()(this, "state", {
showUpcomingRenewalsDialog: !1
}),
ee()(this, "handleExpiringNoticeRenewal", ()=>{
this.trackClick("purchase-expiring"),
this.props.handleRenew && this.props.handleRenew()
}
),
ee()(this, "handleExpiringNoticeRenewAll", ()=>{
const {renewableSitePurchases: e} = this.props;
this.trackClick("other-purchases-expiring-renew-all"),
this.props.handleRenewMultiplePurchases && this.props.handleRenewMultiplePurchases(e)
}
),
ee()(this, "handleExpiringCardNoticeUpdateAll", ()=>{
this.trackClick("other-purchases-expiring-card-update-all")
}
),
ee()(this, "handleExpiringNoticeRenewSelection", e=>{
const {renewableSitePurchases: t} = this.props;
this.props.recordTracksEvent("calypso_subscription_upcoming_renewals_dialog_submit", {
selected: e.length,
available: t.length
}),
this.props.handleRenewMultiplePurchases && this.props.handleRenewMultiplePurchases(e)
}
),
ee()(this, "openUpcomingRenewalsDialog", ()=>{
this.trackClick("other-purchases-expiring-upcoming-renewals-dialog"),
this.setState({
showUpcomingRenewalsDialog: !0
})
}
),
ee()(this, "closeUpcomingRenewalsDialog", ()=>{
this.setState({
showUpcomingRenewalsDialog: !1
})
}
),
ee()(this, "onClickUpdateCreditCardDetails", ()=>{
this.trackClick("credit-card-expiring")
}
),
ee()(this, "creditCardDetails", e=>{
const {moment: t} = this.props
, {payment: {creditCard: a}} = e;
return {
cardType: a.type.toUpperCase(),
cardNumber: parseInt(a.number, 10),
cardExpiry: t(a.expiryDate, "MM/YY").format("MMMM YYYY")
}
}
),
ee()(this, "handleExpiredNoticeRenewal", ()=>{
this.trackClick("purchase-expired"),
this.props.handleRenew && this.props.handleRenew()
}
)
}
getExpiringText(e) {
const {translate: t, moment: a, selectedSite: n} = this.props
, s = a(e.expiryDate);
if (n && "manualRenew" === e.expiryStatus)
return this.getExpiringLaterText(e);
if (Object(Gt.Yc)(e.productSlug)) {
const n = a(s.diff(a())).format("D");
return t("%(purchaseName)s will expire and be removed from your site %(expiry)s days. ", {
args: {
purchaseName: Object(It.h)(e),
expiry: n
}
})
}
return t("%(purchaseName)s will expire and be removed from your site %(expiry)s.", {
args: {
purchaseName: Object(It.h)(e),
expiry: s.fromNow()
}
})
}
getExpiringLaterText(e, t=null) {
const {translate: a, moment: n} = this.props
, s = n(e.expiryDate)
, r = {
args: {
purchaseName: Object(It.h)(e),
expiry: s.fromNow()
}
};
return t && (r.components = {
link: t
}),
Object(It.y)(e) ? a(t ? "You purchased %(purchaseName)s with credits – please add a credit card before your plan expires %(expiry)s so that you don't lose out on your paid features! You also have {{link}}other upgrades{{/link}} on this site that are scheduled to renew soon." : "You purchased %(purchaseName)s with credits. Please add a credit card before your plan expires %(expiry)s so that you don't lose out on your paid features!", r) : Object(It.q)(e) ? Object(It.C)(e) ? a(t ? "%(purchaseName)s will expire and be removed from your site %(expiry)s – please enable auto-renewal so you don't lose out on your paid features! You also have {{link}}other upgrades{{/link}} on this site that are scheduled to renew soon." : "%(purchaseName)s will expire and be removed from your site %(expiry)s. Please enable auto-renewal so you don't lose out on your paid features!", r) : a(t ? "%(purchaseName)s will expire and be removed from your site %(expiry)s – please renew before expiry so you don't lose out on your paid features! You also have {{link}}other upgrades{{/link}} on this site that are scheduled to renew soon." : "%(purchaseName)s will expire and be removed from your site %(expiry)s. Please renew before expiry so you don't lose out on your paid features!", r) : a(t ? "%(purchaseName)s will expire and be removed from your site %(expiry)s – add a credit card so you don't lose out on your paid features! You also have {{link}}other upgrades{{/link}} on this site that are scheduled to renew soon." : "%(purchaseName)s will expire and be removed from your site %(expiry)s. Add a credit card so you don't lose out on your paid features!", r)
}
renderRenewNoticeAction(e) {
const {editCardDetailsPath: t, purchase: a, translate: s} = this.props;
return n.a.isEnabled("upgrades/checkout") && this.props.selectedSite ? Object(It.q)(a) || Object(It.a)(a) && !Object(It.M)(a) ? !Object(It.C)(a) && o.a.createElement(Jt.a, {
onClick: e
}, s("Renew Now")) : o.a.createElement(Jt.a, {
href: t
}, s("Add Credit Card")) : null
}
trackImpression(e) {
return o.a.createElement(Yt.a, {
eventName: "calypso_subscription_warning_impression",
eventProperties: Xn(e)
})
}
trackClick(e) {
this.props.recordTracksEvent("calypso_subscription_warning_click", Xn(e))
}
renderPurchaseExpiringNotice() {
const {moment: e, purchase: t, purchaseAttachedTo: a, selectedSite: s, translate: r} = this.props
, i = Boolean(n.a.isEnabled("upgrades/upcoming-renewals-notices") && Object(It.v)(t) && a && Object(Bt.X)(a))
, c = i ? a : t
, l = t;
if (!Object(It.u)(c))
return null;
let d = "is-info";
Object(It.s)(c) && !Object(It.B)(c) && (d = "is-error");
let u = ""
, p = !1;
return i ? (u = r("Your {{managePurchase}}%(purchaseName)s plan{{/managePurchase}} (which includes your %(includedPurchaseName)s subscription) will expire and be removed from your site %(expiry)s.", {
args: {
purchaseName: Object(It.h)(c),
includedPurchaseName: Object(It.h)(l),
expiry: e(c.expiryDate).fromNow()
},
components: {
managePurchase: o.a.createElement("a", {
href: Object($.h)(s.slug, c.id)
})
}
}),
p = !1) : (u = this.getExpiringText(c),
p = !0),
o.a.createElement(Wt.a, {
className: "manage-purchase__purchase-expiring-notice",
showDismiss: !1,
status: d,
text: u
}, p && this.renderRenewNoticeAction(this.handleExpiringNoticeRenewal), this.trackImpression("purchase-expiring"))
}
renderOtherRenewablePurchasesNotice() {
const {translate: e, moment: t, purchase: a, purchaseAttachedTo: s, selectedSite: r, renewableSitePurchases: i} = this.props;
if (!n.a.isEnabled("upgrades/upcoming-renewals-notices"))
return null;
if (!r)
return null;
const c = Boolean(Object(It.v)(a) && s && Object(Bt.X)(s))
, l = c ? s : a
, d = a
, u = i.filter(e=>e.id !== l.id);
if (Object(te.a)(u))
return null;
const p = Object(It.J)(l)
, m = Object(It.G)(l) && Object(It.c)(l)
, h = Object(It.u)(l) || Object(It.t)(l)
, g = u.some(e=>Object(It.u)(e) || Object(It.t)(e))
, b = Object(It.B)(l) && !Object(It.t)(l)
, f = u.every(e=>Object(It.B)(e) && !Object(It.t)(e))
, _ = u.some(e=>t(e.expiryDate).diff(Date.now(), "months") < 1)
, y = u.some(It.t)
, j = Object(Kn.a)(u.filter(e=>Object(It.u)(e) || Object(It.t)(e)), e=>t(e.expiryDate).format("X"))
, v = t(l.expiryDate)
, E = {
args: {
purchaseName: Object(It.h)(l),
includedPurchaseName: Object(It.h)(d),
expiry: v.fromNow(),
earliestOtherExpiry: j ? t(j.expiryDate).fromNow() : null
},
components: {
link: o.a.createElement("button", {
className: "manage-purchase__other-upgrades-button",
onClick: this.openUpcomingRenewalsDialog
}),
managePurchase: o.a.createElement("a", {
href: Object($.h)(r.slug, l.id)
})
}
};
let C = null
, x = null
, P = null
, O = null
, S = ""
, w = ""
, k = "";
return p && h && g && (C = b && f ? "is-info" : "is-error",
O = this.handleExpiringNoticeRenewAll,
S = e("Renew all"),
w = "current-expires-soon-others-expire-soon",
k = Object(It.t)(l) ? Object(Bt.w)(l) ? e("Your %(purchaseName)s domain expired %(expiry)s, and you have {{link}}other upgrades{{/link}} on this site that will also be removed soon unless you take action.", E) : Object(Bt.X)(l) ? e(c ? "Your {{managePurchase}}%(purchaseName)s plan{{/managePurchase}} (which includes your %(includedPurchaseName)s subscription) expired %(expiry)s, and you have {{link}}other upgrades{{/link}} on this site that will also be removed soon unless you take action." : "Your %(purchaseName)s plan expired %(expiry)s, and you have {{link}}other upgrades{{/link}} on this site that will also be removed soon unless you take action.", E) : e("Your %(purchaseName)s subscription expired %(expiry)s, and you have {{link}}other upgrades{{/link}} on this site that will also be removed soon unless you take action.", E) : _ ? Object(Bt.w)(l) ? e("Your %(purchaseName)s domain will expire %(expiry)s, and you have {{link}}other upgrades{{/link}} on this site that will also be removed soon unless you take action.", E) : Object(Bt.X)(l) ? e(c ? "Your {{managePurchase}}%(purchaseName)s plan{{/managePurchase}} (which includes your %(includedPurchaseName)s subscription) will expire %(expiry)s, and you have {{link}}other upgrades{{/link}} on this site that will also be removed soon unless you take action." : "Your %(purchaseName)s plan will expire %(expiry)s, and you have {{link}}other upgrades{{/link}} on this site that will also be removed soon unless you take action.", E) : e("Your %(purchaseName)s subscription will expire %(expiry)s, and you have {{link}}other upgrades{{/link}} on this site that will also be removed soon unless you take action.", E) : Object(Bt.w)(l) ? e("Your %(purchaseName)s domain will expire %(expiry)s, and you have {{link}}other upgrades{{/link}} on this site that will also be removed unless you take action.", E) : Object(Bt.X)(l) ? e(c ? "Your {{managePurchase}}%(purchaseName)s plan{{/managePurchase}} (which includes your %(includedPurchaseName)s subscription) will expire %(expiry)s, and you have {{link}}other upgrades{{/link}} on this site that will also be removed unless you take action." : "Your %(purchaseName)s plan will expire %(expiry)s, and you have {{link}}other upgrades{{/link}} on this site that will also be removed unless you take action.", E) : e("Your %(purchaseName)s subscription will expire %(expiry)s, and you have {{link}}other upgrades{{/link}} on this site that will also be removed unless you take action.", E)),
p && h && !g && (C = b ? "is-info" : "is-error",
w = "current-expires-soon-others-renew-soon",
k = Object(It.t)(l) ? Object(Bt.w)(l) ? e("Your %(purchaseName)s domain expired %(expiry)s and will be removed soon unless you take action. You also have {{link}}other upgrades{{/link}} on this site that are scheduled to renew soon.", E) : Object(Bt.X)(l) ? e(c ? "Your {{managePurchase}}%(purchaseName)s plan{{/managePurchase}} (which includes your %(includedPurchaseName)s subscription) expired %(expiry)s and will be removed soon unless you take action. You also have {{link}}other upgrades{{/link}} on this site that are scheduled to renew soon." : "Your %(purchaseName)s plan expired %(expiry)s and will be removed soon unless you take action. You also have {{link}}other upgrades{{/link}} on this site that are scheduled to renew soon.", E) : e("Your %(purchaseName)s subscription expired %(expiry)s and will be removed soon unless you take action. You also have {{link}}other upgrades{{/link}} on this site that are scheduled to renew soon.", E) : Object(Bt.w)(l) ? e("Your %(purchaseName)s domain will expire %(expiry)s unless you take action. You also have {{link}}other upgrades{{/link}} on this site that are scheduled to renew soon.", E) : Object(Bt.X)(l) ? e(c ? "Your {{managePurchase}}%(purchaseName)s plan{{/managePurchase}} (which includes your %(includedPurchaseName)s subscription) will expire %(expiry)s unless you take action. You also have {{link}}other upgrades{{/link}} on this site that are scheduled to renew soon." : "Your %(purchaseName)s plan will expire %(expiry)s unless you take action. You also have {{link}}other upgrades{{/link}} on this site that are scheduled to renew soon.", E) : e("Your %(purchaseName)s subscription will expire %(expiry)s unless you take action. You also have {{link}}other upgrades{{/link}} on this site that are scheduled to renew soon.", E)),
p && !h && g && (C = f ? "is-info" : "is-error",
O = this.handleExpiringNoticeRenewAll,
S = e("Renew all"),
w = "current-renews-soon-others-expire-soon",
k = y ? Object(Bt.w)(l) ? e("Your %(purchaseName)s domain is scheduled to renew, but you have {{link}}other upgrades{{/link}} on this site that expired %(earliestOtherExpiry)s and will be removed soon unless you take action.", E) : Object(Bt.X)(l) ? e(c ? "Your {{managePurchase}}%(purchaseName)s plan{{/managePurchase}} (which includes your %(includedPurchaseName)s subscription) is scheduled to renew, but you have {{link}}other upgrades{{/link}} on this site that expired %(earliestOtherExpiry)s and will be removed soon unless you take action." : "Your %(purchaseName)s plan is scheduled to renew, but you have {{link}}other upgrades{{/link}} on this site that expired %(earliestOtherExpiry)s and will be removed soon unless you take action.", E) : e("Your %(purchaseName)s subscription is scheduled to renew, but you have {{link}}other upgrades{{/link}} on this site that expired %(earliestOtherExpiry)s and will be removed soon unless you take action.", E) : Object(Bt.w)(l) ? e("Your %(purchaseName)s domain is scheduled to renew, but you have {{link}}other upgrades{{/link}} on this site that will expire %(earliestOtherExpiry)s unless you take action.", E) : Object(Bt.X)(l) ? e(c ? "Your {{managePurchase}}%(purchaseName)s plan{{/managePurchase}} (which includes your %(includedPurchaseName)s subscription) is scheduled to renew, but you have {{link}}other upgrades{{/link}} on this site that will expire %(earliestOtherExpiry)s unless you take action." : "Your %(purchaseName)s plan is scheduled to renew, but you have {{link}}other upgrades{{/link}} on this site that will expire %(earliestOtherExpiry)s unless you take action.", E) : e("Your %(purchaseName)s subscription is scheduled to renew, but you have {{link}}other upgrades{{/link}} on this site that will expire %(earliestOtherExpiry)s unless you take action.", E)),
!p || h || g || (m ? (C = Object(It.O)(l) ? "is-error" : "is-info",
P = "/me/purchases/add-credit-card",
O = this.handleExpiringCardNoticeUpdateAll,
S = e("Update all"),
w = "current-renews-soon-others-renew-soon-cc-expiring",
k = e("Your %(cardType)s ending in %(cardNumber)d expires %(cardExpiry)s – before the next renewal. You have {{link}}other upgrades{{/link}} on this site that are scheduled to renew soon and may also be affected. Please update the payment information for all your subscriptions.", Object(Qn.a)(E, {
args: this.creditCardDetails(l)
}))) : (C = "is-success",
x = "info",
w = "current-renews-soon-others-renew-soon",
k = e("You have {{link}}other upgrades{{/link}} on this site that are scheduled to renew soon.", E))),
!p && h && g && (C = f ? "is-info" : "is-error",
O = this.handleExpiringNoticeRenewAll,
S = e("Renew now"),
w = "current-expires-later-others-expire-soon",
k = e(y ? "You have {{link}}other upgrades{{/link}} on this site that expired %(earliestOtherExpiry)s and will be removed soon unless you take action." : "You have {{link}}other upgrades{{/link}} on this site that will expire %(earliestOtherExpiry)s unless you take action.", E)),
p || !h || g || (C = "is-info",
w = "current-expires-later-others-renew-soon",
k = Object(Bt.X)(l) && c ? e("You have {{link}}other upgrades{{/link}} on this site that are scheduled to renew soon.", E) : this.getExpiringLaterText(l, E.components.link)),
p || h || !g || (C = f ? "is-info" : "is-error",
O = this.handleExpiringNoticeRenewAll,
S = e("Renew now"),
w = "current-renews-later-others-expire-soon",
k = e(y ? "You have {{link}}other upgrades{{/link}} on this site that expired %(earliestOtherExpiry)s and will be removed soon unless you take action." : "You have {{link}}other upgrades{{/link}} on this site that will expire %(earliestOtherExpiry)s unless you take action.", E)),
p || h || g || (m ? (C = "is-info",
P = "/me/purchases/add-credit-card",
O = this.handleExpiringCardNoticeUpdateAll,
S = e("Update all"),
w = "current-renews-later-others-renew-soon-cc-expiring",
k = e("Your %(cardType)s ending in %(cardNumber)d expires %(cardExpiry)s – before the next renewal. You have {{link}}other upgrades{{/link}} on this site that are scheduled to renew soon and may also be affected. Please update the payment information for all your subscriptions.", Object(Qn.a)(E, {
args: this.creditCardDetails(l)
}))) : (C = "is-success",
x = "info",
w = "current-renews-later-others-renew-soon",
k = e("You have {{link}}other upgrades{{/link}} on this site that are scheduled to renew soon.", E))),
k ? o.a.createElement(o.a.Fragment, null, o.a.createElement(Jn.a, {
isVisible: this.state.showUpcomingRenewalsDialog,
purchases: i,
site: r,
onConfirm: this.handleExpiringNoticeRenewSelection,
onClose: this.closeUpcomingRenewalsDialog
}), o.a.createElement(Wt.a, {
className: "manage-purchase__other-renewable-purchases-notice",
showDismiss: !1,
status: C,
icon: x,
text: k
}, (P || O) && o.a.createElement(Jt.a, {
href: P,
onClick: O
}, S), w && this.trackImpression(w))) : null
}
renderCreditCardExpiringNotice() {
const {editCardDetailsPath: e, purchase: t, translate: a} = this.props;
if (Object(It.t)(t) || Object(It.w)(t) || Object(It.v)(t) || !this.props.selectedSite)
return null;
if (Object(It.c)(t)) {
const n = e ? o.a.createElement("a", {
onClick: this.onClickUpdateCreditCardDetails,
href: e
}) : o.a.createElement("span", null);
return o.a.createElement(Wt.a, {
className: "manage-purchase__expiring-credit-card-notice",
showDismiss: !1,
status: Object(It.O)(t) ? "is-error" : "is-info"
}, a("Your %(cardType)s ending in %(cardNumber)d expires %(cardExpiry)s – before the next renewal. Please {{a}}update your payment information{{/a}}.", {
args: this.creditCardDetails(t),
components: {
a: n
}
}), this.trackImpression("credit-card-expiring"))
}
}
renderExpiredRenewNotice() {
const {purchase: e, purchaseAttachedTo: t, selectedSite: a, translate: s} = this.props
, r = Boolean(n.a.isEnabled("upgrades/upcoming-renewals-notices") && Object(It.v)(e) && t && Object(Bt.X)(t))
, i = r ? t : e
, c = e;
if (!Object(It.t)(i))
return null;
let l = ""
, d = !1;
if (Object(It.F)(e))
l = s("This purchase has expired and is no longer in use."),
d = !0;
else {
if (!r)
return null;
l = s("Your {{managePurchase}}%(purchaseName)s plan{{/managePurchase}} (which includes your %(includedPurchaseName)s subscription) has expired and is no longer in use.", {
args: {
purchaseName: Object(It.h)(i),
includedPurchaseName: Object(It.h)(c)
},
components: {
managePurchase: o.a.createElement("a", {
href: Object($.h)(a.slug, i.id)
})
}
}),
d = !1
}
return o.a.createElement(Wt.a, {
showDismiss: !1,
status: "is-error",
text: l
}, d && this.renderRenewNoticeAction(this.handleExpiredNoticeRenewal), this.trackImpression("purchase-expired"))
}
renderConciergeConsumedNotice() {
const {purchase: e, translate: t} = this.props;
return Object(Bt.o)(e) && Object(It.t)(e) ? o.a.createElement(Wt.a, {
showDismiss: !1,
status: "is-info",
text: t("This session has been used.")
}, this.trackImpression("concierge-session-used")) : null
}
render() {
if (this.props.isDataLoading)
return null;
if (Object(Bt.x)(this.props.purchase) || Object(It.A)(this.props.purchase))
return null;
const e = this.renderConciergeConsumedNotice();
if (e)
return e;
const t = this.renderOtherRenewablePurchasesNotice();
if (t)
return t;
const a = this.renderExpiredRenewNotice();
if (a)
return a;
const n = this.renderPurchaseExpiringNotice();
if (n)
return n;
const s = this.renderCreditCardExpiringNotice();
return s || null
}
}
ee()(Zn, "propTypes", {
isDataLoading: S.a.bool,
handleRenew: S.a.func,
handleRenewMultiplePurchases: S.a.func,
purchase: S.a.object,
purchaseAttachedTo: S.a.object,
renewableSitePurchases: S.a.arrayOf(S.a.object),
selectedSite: S.a.object,
editCardDetailsPath: S.a.oneOfType([S.a.string, S.a.bool])
});
var es = Object(u.c)(null, {
recordTracksEvent: me.e
})(Object(c.c)(Object(pe.b)(Zn)))
, ts = a("./components/clipboard-button-input/index.jsx")
, as = a("./components/forms/form-fieldset/index.jsx")
, ns = a("./components/data/query-plugin-keys/index.jsx")
, ss = a("./components/forms/form-setting-explanation/index.jsx")
, rs = a("./lib/cart-values/cart-items.js")
, is = a("./lib/cart/actions.js");
class os extends i.Component {
constructor(...e) {
super(...e),
ee()(this, "handleMonthlyToYearlyButtonClick", ()=>{
const {purchase: e} = this.props
, t = Object(Ge.o)(e.productSlug);
this.props.recordTracksEvent("calypso_purchase_details_plan_upgrade_click", {
current_plan: e.productSlug,
upgrading_to: t
}),
Object(is.b)(Object(rs.fb)(t)),
r()("/checkout/" + e.domain)
}
)
}
renderYearlyBillingInformation() {
const {purchase: e, translate: t, moment: a} = this.props;
if (Object(It.O)(e))
return t("Billed yearly, credit card expiring soon");
if (Object(It.G)(e) && e.renewDate) {
return t("Billed yearly, renews on %s", {
args: a(e.renewDate).format("LL"),
comment: "%s is the renewal date in format M DD, Y, for example: June 10, 2019"
})
}
return Object(It.u)(e) && e.expiryDate ? t("Billed yearly, expires on %s", {
args: a(e.expiryDate).format("LL"),
comment: "%s is the expiration date in format M DD, Y, for example: June 10, 2019"
}) : Object(It.t)(e) && e.expiryDate ? t("Billed yearly, expired %(timeSinceExpiry)s", {
args: {
timeSinceExpiry: a(e.expiryDate).fromNow()
},
comment: 'timeSinceExpiry is of the form "[number] [time-period] ago" i.e. "3 days ago"'
}) : t("Billed yearly")
}
renderBillingPeriod() {
const {purchase: e, site: t, translate: a} = this.props;
if (e)
return Object(Gt.Yc)(e.productSlug) ? Object(Ge.o)(e.productSlug) ? o.a.createElement(o.a.Fragment, null, o.a.createElement(ss.a, null, a("Billed monthly"), t && o.a.createElement(p.a, {
onClick: this.handleMonthlyToYearlyButtonClick,
primary: !0,
compact: !0
}, a("Upgrade to yearly billing"))), !t && o.a.createElement(ss.a, null, a("To manage your plan, please {{supportPageLink}}reconnect{{/supportPageLink}} your site.", {
components: {
supportPageLink: o.a.createElement("a", {
href: Xt.I + "reconnecting-reinstalling-jetpack/#reconnecting-jetpack"
})
}
}))) : void 0 : o.a.createElement(ss.a, null, this.renderYearlyBillingInformation())
}
render() {
const {translate: e} = this.props;
return o.a.createElement(as.a, null, o.a.createElement(hn.a, {
htmlFor: "plan-billing-period"
}, e("Billing period")), this.renderBillingPeriod())
}
}
ee()(os, "propTypes", {
purchase: S.a.object,
site: S.a.object
});
var cs = Object(u.c)(null, {
recordTracksEvent: me.e
})(Object(c.c)(Object(pe.b)(os)))
, ls = a("./state/plugins/premium/selectors.js");
a("./me/purchases/manage-purchase/plan-details/style.scss");
class ds extends i.Component {
renderPlaceholder() {
return o.a.createElement("div", {
className: "plan-details__wrapper is-placeholder"
}, o.a.createElement(C.a, null), o.a.createElement(l.a, null, o.a.createElement("div", {
className: "plan-details__plugin-key"
}), o.a.createElement("div", {
className: "plan-details__plugin-key"
})))
}
renderPluginLabel(e) {
switch (e) {
case "vaultpress":
return this.props.translate("Backups and security scanning API key");
case "akismet":
return this.props.translate("Anti-spam API key")
}
}
render() {
const {pluginList: e, purchase: t, site: a, siteId: n, translate: s} = this.props;
if (t && (!Object(Bt.O)(t) || Object(Bt.C)(t)))
return null;
if (Object(yn.c)(this.props) || this.props.isPlaceholder)
return this.renderPlaceholder();
if (Object(It.t)(t))
return null;
const r = s("%(planName)s Plan", {
args: {
planName: Object(It.h)(t)
}
});
return o.a.createElement("div", {
className: "plan-details"
}, n && o.a.createElement(ns.a, {
siteId: n
}), o.a.createElement(C.a, {
label: r
}), o.a.createElement(l.a, null, !Object(It.A)(t) && o.a.createElement(cs, {
purchase: t,
site: a
}), e.map((e,t)=>o.a.createElement(as.a, {
key: t
}, o.a.createElement(hn.a, {
htmlFor: "plugin-" + e.slug
}, this.renderPluginLabel(e.slug)), o.a.createElement(ts.a, {
id: "plugin-" + e.slug,
value: e.key
})))))
}
}
ee()(ds, "propTypes", {
purchaseId: S.a.number,
isPlaceholder: S.a.bool,
purchase: S.a.object,
hasLoadedSites: S.a.bool,
hasLoadedUserPurchasesFromServer: S.a.bool,
pluginList: S.a.arrayOf(S.a.shape({
slug: S.a.string.isRequired,
key: S.a.string
}).isRequired).isRequired,
site: S.a.object,
siteId: S.a.number
});
var us = Object(u.c)((e,t)=>{
const a = Object(qa.a)(e, t.purchaseId)
, n = a ? a.siteId : null;
return {
hasLoadedSites: !Object(Ya.a)(e),
site: a ? Object(Pt.a)(e, a.siteId) : null,
hasLoadedUserPurchasesFromServer: Object(qa.j)(e),
purchase: a,
pluginList: Object(ls.c)(e, n),
siteId: n
}
}
)(Object(c.c)(ds))
, ps = a("./components/data/query-canonical-theme/index.jsx")
, ms = a("./components/data/query-site-domains/index.jsx")
, hs = a("./me/purchases/remove-purchase/index.jsx")
, gs = a("./components/vertical-nav/item/index.jsx")
, bs = a("./lib/cart/store/index.js")
, fs = a("./state/current-user/constants.js")
, _s = a("./lib/site/utils.js")
, ys = a("./state/sites/domains/selectors.js")
, js = a("./me/purchases/non-primary-domain-dialog/index.jsx")
, vs = (a("./me/purchases/manage-purchase/style.scss"),
function(e) {
a.e(343).then(a.bind(null, "./blocks/product-plan-overlap-notices/index.jsx")).then((function(t) {
e(t.default)
}
))
}
);
class Es extends i.Component {
constructor(...e) {
super(...e),
ee()(this, "state", {
showNonPrimaryDomainWarningDialog: !1,
cancelLink: null
}),
ee()(this, "handleRenew", ()=>{
Object(It.n)(this.props.purchase, this.props.siteSlug)
}
),
ee()(this, "handleRenewMultiplePurchases", e=>{
Object(It.m)(e, this.props.siteSlug)
}
),
ee()(this, "closeDialog", ()=>{
this.setState({
showNonPrimaryDomainWarningDialog: !1,
cancelLink: null
})
}
),
ee()(this, "goToCancelLink", ()=>{
const e = this.state.cancelLink;
this.closeDialog(),
r()(e)
}
)
}
UNSAFE_componentWillMount() {
this.isDataValid() || r.a.redirect($.k)
}
componentDidMount() {
this.props.siteId && bs.a.setSelectedSiteId(this.props.siteId)
}
UNSAFE_componentWillReceiveProps(e) {
!this.isDataValid() || this.isDataValid(e) || r.a.redirect($.k)
}
componentDidUpdate({siteId: e}) {
this.props.siteId && e !== this.props.siteId && bs.a.setSelectedSiteId(this.props.siteId)
}
isDataValid(e=this.props) {
return !!Object(yn.c)(e) || Boolean(e.purchase)
}
shouldShowNonPrimaryDomainWarning() {
const {hasNonPrimaryDomainsFlag: e, hasCustomPrimaryDomain: t, purchase: a} = this.props;
return e && Object(Bt.X)(a) && t
}
renderRenewButton() {
const {purchase: e, translate: t} = this.props;
return n.a.isEnabled("upgrades/checkout") && !Object(It.A)(e) && Object(It.F)(e) && this.props.site ? o.a.createElement(p.a, {
className: "manage-purchase__renew-button",
onClick: this.handleRenew,
compact: !0
}, t("Renew now")) : null
}
renderRenewNowNavItem() {
const {purchase: e, translate: t} = this.props;
return n.a.isEnabled("upgrades/checkout") && Object(It.F)(e) && this.props.site ? Object(It.A)(e) ? null : o.a.createElement(re.a, {
tagName: "button",
displayAsLink: !0,
onClick: this.handleRenew
}, t("Renew Now")) : null
}
renderEditPaymentMethodNavItem() {
const {purchase: e, translate: t} = this.props;
if (!this.props.site)
return null;
if (Object(It.A)(e))
return null;
if (Object(yn.a)(e)) {
const a = Object(yn.b)(this.props.siteSlug, e);
return Object(It.G)(e) && Object(It.x)(e) && !Object(It.b)(e) ? null : o.a.createElement(re.a, {
href: a
}, Object(It.q)(e) ? t("Change Payment Method") : t("Add Credit Card"))
}
return null
}
renderRemovePurchaseNavItem() {
return Object(It.A)(this.props.purchase) ? null : o.a.createElement(hs.a, {
hasLoadedSites: this.props.hasLoadedSites,
hasLoadedUserPurchasesFromServer: this.props.hasLoadedUserPurchasesFromServer,
hasNonPrimaryDomainsFlag: this.props.hasNonPrimaryDomainsFlag,
hasCustomPrimaryDomain: this.props.hasCustomPrimaryDomain,
site: this.props.site,
purchase: this.props.purchase
})
}
showNonPrimaryDomainWarningDialog(e) {
this.setState({
showNonPrimaryDomainWarningDialog: !0,
cancelLink: e
})
}
renderNonPrimaryDomainWarningDialog(e, t) {
return this.state.showNonPrimaryDomainWarningDialog ? o.a.createElement(js.a, {
isDialogVisible: this.state.showNonPrimaryDomainWarningDialog,
closeDialog: this.closeDialog,
removePlan: this.goToCancelLink,
planName: Object(It.h)(t),
oldDomainName: e.domain,
newDomainName: e.wpcom_url
}) : null
}
renderCancelPurchaseNavItem() {
const {isAtomicSite: e, purchase: t, translate: a} = this.props
, {id: n} = t;
if (!Object(It.r)(t) || Object(It.A)(t))
return null;
let s, r = Object($.e)(this.props.siteSlug, n);
if (e && Object(It.H)(t))
s = a("Contact Support to Cancel your Subscription"),
r = Xt.c;
else if (Object(It.o)(t))
Object(Bt.w)(t) && (s = a("Cancel Domain and Refund")),
Object(It.H)(t) && (s = a("Cancel Subscription and Refund")),
Object(It.w)(t) && (s = a("Cancel and Refund"));
else {
if (Object(Bt.x)(t))
return null;
Object(Bt.w)(t) && (s = a("Cancel Domain")),
Object(It.H)(t) && (s = a("Cancel Subscription"))
}
return o.a.createElement(re.a, {
href: r,
onClick: a=>{
Object(Ja.recordTracksEvent)("calypso_purchases_manage_purchase_cancel_click", {
product_slug: t.productSlug,
is_atomic: e,
link_text: s
}),
this.shouldShowNonPrimaryDomainWarning() && (a.preventDefault(),
this.showNonPrimaryDomainWarningDialog(r))
}
}, s)
}
renderPlanIcon() {
const {purchase: e} = this.props;
return Object(Bt.X)(e) || Object(Bt.Q)(e) ? o.a.createElement("div", {
className: "manage-purchase__plan-icon"
}, o.a.createElement(Ht.a, {
slug: e.productSlug
})) : Object(Bt.u)(e) || Object(Bt.x)(e) ? o.a.createElement("div", {
className: "manage-purchase__plan-icon"
}, o.a.createElement(xt.a, {
icon: "domains",
size: 54
})) : Object(Bt.bb)(e) ? o.a.createElement("div", {
className: "manage-purchase__plan-icon"
}, o.a.createElement(xt.a, {
icon: "themes",
size: 54
})) : null
}
renderPlanDescription() {
const {plan: e, purchase: t, site: a, theme: n, translate: s} = this.props;
let r = Object(It.L)(t);
Object(Bt.X)(t) ? r = e.getDescription() : Object(Bt.bb)(t) && n ? r = n.description : Object(Bt.o)(t) ? r = t.description : Object(Bt.t)(t) || Object(Bt.w)(t) ? r = s("Replaces your site's free address, %(domain)s, with the domain, making it easier to remember and easier to share.", {
args: {
domain: t.domain
}
}) : Object(Bt.x)(t) && (r = s("Transfers an existing domain from another provider to WordPress.com, helping you manage your site and domain in one place."));
const i = Object(It.f)(t)
, c = s("Domain Registration Agreement");
return o.a.createElement("div", {
className: "manage-purchase__content"
}, o.a.createElement("span", {
className: "manage-purchase__description"
}, r), o.a.createElement("span", {
className: "manage-purchase__settings-link"
}, !Object(It.A)(t) && a && o.a.createElement(Cn, {
purchase: t,
selectedSite: a
})), i && o.a.createElement("a", {
href: i,
target: "_blank",
rel: "noopener noreferrer"
}, c))
}
renderPlaceholder() {
return o.a.createElement(i.Fragment, null, o.a.createElement(Tt, {
isPlaceholder: !0
}), o.a.createElement(l.a, {
className: "manage-purchase__info is-placeholder"
}, o.a.createElement("header", {
className: "manage-purchase__header"
}, o.a.createElement("div", {
className: "manage-purchase__plan-icon"
}), o.a.createElement("strong", {
className: "manage-purchase__title"
}), o.a.createElement("span", {
className: "manage-purchase__subtitle"
})), o.a.createElement("div", {
className: "manage-purchase__content"
}, o.a.createElement("span", {
className: "manage-purchase__description"
}), o.a.createElement("span", {
className: "manage-purchase__settings-link"
})), o.a.createElement(zn, {
purchaseId: !1,
siteSlug: this.props.siteSlug
})), o.a.createElement(us, {
isPlaceholder: !0
}), o.a.createElement(gs.a, {
isPlaceholder: !0
}), o.a.createElement(gs.a, {
isPlaceholder: !0
}))
}
isDomainsLoading(e) {
const {purchase: t, hasLoadedDomains: a} = e;
return !(t && (!Object(Bt.u)(t) || Object(Bt.x)(t))) && !a
}
renderPurchaseDetail() {
if (Object(yn.c)(this.props) || this.isDomainsLoading(this.props))
return this.renderPlaceholder();
const {purchase: e, siteId: t, translate: a} = this.props
, n = Ut()("manage-purchase__info", {
"is-expired": e && Object(It.t)(e),
"is-personal": Object(Bt.W)(e),
"is-premium": Object(Bt.Y)(e),
"is-business": Object(Bt.m)(e),
"is-jetpack-product": Object(Bt.Q)(e)
})
, s = e.siteName
, r = e.domain;
return o.a.createElement(i.Fragment, null, o.a.createElement(Tt, {
siteId: t,
name: s,
domain: r
}), o.a.createElement(l.a, {
className: n
}, o.a.createElement("header", {
className: "manage-purchase__header"
}, this.renderPlanIcon(), o.a.createElement("h2", {
className: "manage-purchase__title"
}, Object(It.e)(e)), o.a.createElement("div", {
className: "manage-purchase__description"
}, Object(It.L)(e)), o.a.createElement("div", {
className: "manage-purchase__price"
}, Object(It.A)(e) ? o.a.createElement("div", {
className: "manage-purchase__contact-partner"
}, a("Please contact your site host %(partnerName)s for details", {
args: {
partnerName: Object(It.i)(e)
}
})) : o.a.createElement(Bn.a, {
rawPrice: Object(It.k)(e),
currencyCode: e.currencyCode,
taxText: e.taxText,
isOnSale: !!e.saleAmount
}))), this.renderPlanDescription(), !Object(It.A)(e) && o.a.createElement(zn, {
purchaseId: e.id,
siteSlug: this.props.siteSlug
}), this.renderRenewButton()), o.a.createElement(us, {
purchaseId: this.props.purchaseId
}), this.renderRenewNowNavItem(), this.renderEditPaymentMethodNavItem(), this.renderCancelPurchaseNavItem(), this.renderRemovePurchaseNavItem())
}
render() {
if (!this.isDataValid())
return null;
const {site: e, siteId: t, siteSlug: a, renewableSitePurchases: n, purchase: s, purchaseAttachedTo: r, isPurchaseTheme: c} = this.props;
let l = !1;
return !Object(yn.c)(this.props) && e && Object(yn.a)(s) && (l = Object(yn.b)(a, s)),
o.a.createElement(i.Fragment, null, o.a.createElement(Ga, {
eventName: "calypso_manage_purchase_view",
purchaseId: this.props.purchaseId
}), o.a.createElement(Je.a, {
path: "/me/purchases/:site/:purchaseId",
title: "Purchases > Manage Purchase"
}), o.a.createElement(Ua.a, {
userId: this.props.userId
}), t && o.a.createElement(ms.a, {
siteId: t
}), c && o.a.createElement(ps.a, {
siteId: t,
themeId: s.meta
}), o.a.createElement(Ke.a, {
className: "manage-purchase"
}, o.a.createElement(lt.a, {
backHref: $.k
}, Ma.managePurchase), o.a.createElement(es, {
isDataLoading: Object(yn.c)(this.props),
handleRenew: this.handleRenew,
handleRenewMultiplePurchases: this.handleRenewMultiplePurchases,
selectedSite: e,
purchase: s,
purchaseAttachedTo: r,
renewableSitePurchases: n,
editCardDetailsPath: l
}), o.a.createElement(Mt.a, {
require: vs,
placeholder: null,
plans: Gt.nc,
products: Vt.c,
siteId: t,
currentPurchase: s
}), this.renderPurchaseDetail(), e && this.renderNonPrimaryDomainWarningDialog(e, s)))
}
}
ee()(Es, "propTypes", {
hasLoadedDomains: S.a.bool,
hasLoadedSites: S.a.bool.isRequired,
hasLoadedUserPurchasesFromServer: S.a.bool.isRequired,
hasNonPrimaryDomainsFlag: S.a.bool,
isAtomicSite: S.a.bool,
purchase: S.a.object,
purchaseAttachedTo: S.a.object,
renewableSitePurchases: S.a.arrayOf(S.a.object),
site: S.a.object,
siteId: S.a.number,
siteSlug: S.a.string.isRequired,
userId: S.a.number
});
var $s = Object(u.c)((e,t)=>{
const a = Object(qa.a)(e, t.purchaseId)
, n = a && a.attachedToPurchaseId ? Object(qa.a)(e, a.attachedToPurchaseId) : null
, s = a ? a.siteId : null
, r = Object(qa.f)(e, s)
, i = a && Object(Bt.X)(a)
, o = a && Object(Bt.bb)(a)
, c = Object(Pt.a)(e, s)
, l = !Object(Ya.a)(e);
return {
hasLoadedDomains: Object(ys.e)(e, s),
hasLoadedSites: l,
hasLoadedUserPurchasesFromServer: Object(qa.j)(e),
hasNonPrimaryDomainsFlag: !!Object(sa.b)(e) && Object(sa.a)(e, fs.b),
hasCustomPrimaryDomain: Object(_s.d)(c),
purchase: a,
purchaseAttachedTo: n,
siteId: s,
site: c,
renewableSitePurchases: r,
plan: i && Object(Ge.a)(a.productSlug, Un.a),
isPurchaseTheme: o,
theme: o && Object(Mn.a)(e, s, a.meta),
isAtomicSite: Object(qn.a)(e, s),
userId: Object(sa.h)(e)
}
}
)(Object(c.c)(Es))
, Cs = a("./components/empty-content/no-sites-message/index.jsx")
, xs = a("./components/action-card/index.jsx")
, Ps = a("./assets/images/illustrations/jetpack-concierge.svg")
, Os = a("./me/concierge/constants.js");
a("./me/purchases/concierge-banner/style.scss");
class Ss extends i.Component {
placeholder() {
return o.a.createElement(l.a, {
compact: !1
}, o.a.createElement("div", {
className: "concierge-banner__placeholders is-placeholder"
}, o.a.createElement("div", {
className: "concierge-banner__placeholder-row-container is-placeholder"
}, o.a.createElement("div", {
className: "concierge-banner__placeholder-row is-placeholder"
}), o.a.createElement("div", {
className: "concierge-banner__placeholder-row is-placeholder"
}), o.a.createElement("div", {
className: "concierge-banner__placeholder-row is-placeholder"
})), o.a.createElement("div", {
className: "concierge-banner__placeholder-button-container"
}, o.a.createElement("div", {
className: "concierge-banner__placeholder-button is-placeholder"
}))))
}
getBannerContent() {
const {bannerType: e, translate: t} = this.props;
let a, n, s, r, i;
switch (e) {
case Os.e:
a = t("Your appointment is coming up!"),
n = t("Get ready with your questions for your upcoming Quick Start session appointment.", {
comment: "Quick Start Session is a one-on-one video session between the user and our support staff."
}),
s = t("Session dashboard"),
r = "/me/concierge",
i = Ps.a;
break;
case Os.c:
a = t("Looking for Expert Help?"),
n = t("Get 30 minutes dedicated to the success of your site. Schedule your free 1-1 Quick Start Session with a Happiness Engineer!", {
comment: "Quick Start Session is a one-on-one video session between the user and our support staff."
}),
s = t("Schedule now"),
r = "/me/concierge",
i = Ps.a;
break;
case Os.d:
a = t("Our experts are waiting to help you"),
n = t("Schedule your 45-minute 1-1 Quick Start Session with a Happiness Engineer!", {
comment: "Quick Start Session is a one-on-one video session between the user and our support staff."
}),
s = t("Schedule now"),
r = "/me/concierge",
i = Ps.a;
break;
case Os.l:
a = t("Need an expert by your side?"),
n = t("We offer one-on-one Quick Start sessions dedicated to your site’s success. Click the button to learn how we can help you during these 45 minute calls.", {
comment: "Quick Start Session is a one-on-one video session between the user and our support staff."
}),
s = t("Learn more"),
r = "/checkout/offer-quickstart-session",
i = "/calypso/images/illustrations/illustration-start.svg"
}
return {
headerText: a,
mainText: n,
buttonText: s,
buttonHref: r,
illustrationUrl: i
}
}
render() {
const {bannerType: e, showPlaceholder: t} = this.props;
if (t)
return this.placeholder();
const {headerText: a, mainText: n, buttonText: s, buttonHref: r, illustrationUrl: i} = this.getBannerContent()
, c = Ut()("concierge-banner", {
"purchase-concierge": Os.l === e
});
return o.a.createElement(o.a.Fragment, null, o.a.createElement(Yt.a, {
eventName: "calypso_purchases_concierge_banner_view"
}), o.a.createElement(xs.a, {
headerText: a,
mainText: n,
buttonText: s,
buttonIcon: null,
buttonPrimary: !0,
buttonHref: r,
buttonTarget: null,
buttonOnClick: ()=>{
this.props.recordTracksEvent("calypso_purchases_concierge_banner_click", {
referer: "/me/purchases"
})
}
,
compact: !1,
illustration: i,
classNames: c
}))
}
}
ee()(Ss, "propTypes", {
bannerType: S.a.oneOf([Os.e, Os.c, Os.d, Os.l]).isRequired
});
var ws = Object(c.c)(Ss)
, ks = e=>{
const t = Object(sa.h)(e);
if (!t)
return !1;
const a = Object(qa.h)(e, t);
return !(!a || 0 === a.length) && a.some(e=>Object(Ge.E)(e.productSlug, {
group: Gt.mc,
type: Gt.Rc
}))
}
, Ds = a("./state/selectors/get-sites.js")
, Ns = a("./state/selectors/get-concierge-next-appointment.js")
, Ts = (a("./state/concierge/init.js"),
e=>Object(N.a)(e, "concierge.hasAvailableConciergeSessions", null))
, Is = a("./state/selectors/get-concierge-schedule-id.js")
, Rs = a("./components/data/query-concierge-initial/index.js");
class As extends i.Component {
isDataLoading() {
return !(!this.props.isFetchingUserPurchases || this.props.hasLoadedUserPurchasesFromServer) || !this.props.sites.length
}
renderConciergeBanner() {
const {nextAppointment: e, scheduleId: t, hasAvailableConciergeSessions: a} = this.props;
if (null === a)
return o.a.createElement(ws, {
bannerType: Os.d,
showPlaceholder: !0
});
let n;
if (e)
n = Os.e;
else if (a)
switch (t) {
case Os.m:
n = Os.c;
break;
case Os.n:
n = Os.d;
break;
default:
n = Os.d
}
else
n = Os.l;
return o.a.createElement(ws, {
bannerType: n,
recordTracksEvent: this.props.recordTracksEvent
})
}
render() {
let e;
if (this.isDataLoading() && (e = o.a.createElement(na, {
isPlaceholder: !0
})),
this.props.hasLoadedUserPurchasesFromServer && this.props.purchases.length && (e = o.a.createElement("div", null, this.renderConciergeBanner(), Object(It.j)(this.props.purchases, this.props.sites).map(e=>o.a.createElement(na, {
key: e.id,
siteId: e.id,
name: e.name,
domain: e.domain,
slug: e.slug,
purchases: e.purchases
})))),
this.props.hasLoadedUserPurchasesFromServer && !this.props.purchases.length) {
if (!this.props.sites.length)
return o.a.createElement(Ke.a, null, o.a.createElement(Je.a, {
path: "/me/purchases",
title: "Purchases > No Sites"
}), o.a.createElement(X, {
section: "purchases"
}), o.a.createElement(Cs.a, null));
e = o.a.createElement(o.a.Fragment, null, this.renderConciergeBanner(), o.a.createElement(re.a, {
className: "purchases-list__no-content"
}, o.a.createElement(Ct.a, {
title: this.props.translate("Looking to upgrade?"),
line: this.props.translate("Our plans give your site the power to thrive. Find the plan that works for you."),
action: this.props.translate("Upgrade now"),
actionURL: "/plans",
illustration: "/calypso/images/illustrations/illustration-nosites.svg"
})))
}
return o.a.createElement(Ke.a, {
className: "purchases-list"
}, o.a.createElement(Ua.a, {
userId: this.props.userId
}), o.a.createElement(Je.a, {
path: "/me/purchases",
title: "Purchases"
}), o.a.createElement(d.a, null), o.a.createElement(X, {
section: "purchases"
}), e, o.a.createElement(Rs.a, null))
}
}
As.propTypes = {
isBusinessPlanUser: S.a.bool.isRequired,
noticeType: S.a.string,
purchases: S.a.oneOfType([S.a.array, S.a.bool]),
sites: S.a.array.isRequired,
userId: S.a.number.isRequired
};
var Fs = Object(u.c)(e=>{
const t = Object(sa.h)(e);
return {
hasLoadedUserPurchasesFromServer: Object(qa.j)(e),
isBusinessPlanUser: ks(e),
isFetchingUserPurchases: Object(qa.l)(e),
purchases: Object(qa.h)(e, t),
sites: Object(Ds.a)(e),
nextAppointment: Object(Ns.a)(e),
hasAvailableConciergeSessions: Ts(e),
scheduleId: Object(Is.a)(e),
userId: t
}
}
, {
recordTracksEvent: me.e
})(Object(c.c)(As))
, Ls = a("./state/document-head/actions.js")
, Us = a("./controller/index.web.js");
function Ms(e, ...t) {
e.store.dispatch(Object(Ls.c)(Object(Xa.a)(Ma.purchases, ...t)))
}
const qs = e=>Object(sa.l)(e) <= 0;
function Bs(e, t) {
Ms(e),
e.primary = o.a.createElement(Ke.a, null, o.a.createElement(Je.a, {
path: t,
title: "Purchases > No Sites"
}), o.a.createElement(X, {
section: "purchases"
}), o.a.createElement(Cs.a, null)),
Object(Us.c)(e, ba.a),
Object(Us.f)(e)
}
function Gs(e, t) {
const a = e.store.getState();
if (qs(a))
return Bs(e, "/me/purchases/:site/:purchaseId/payment/add");
Ms(e, Ma.addCardDetails),
e.primary = o.a.createElement(Qa, {
purchaseId: parseInt(e.params.purchaseId, 10),
siteSlug: e.params.site
}),
t()
}
function Vs(e, t) {
e.primary = o.a.createElement(tn, null),
t()
}
function Hs(e, t) {
Ms(e, Ma.cancelPurchase),
e.primary = o.a.createElement(Pn, {
purchaseId: parseInt(e.params.purchaseId, 10),
siteSlug: e.params.site
}),
t()
}
function Ws(e, t) {
const a = e.store.getState();
if (qs(a))
return Bs(e, "/me/purchases/:site/:purchaseId/confirm-cancel-domain");
Ms(e, Ma.confirmCancelDomain),
e.primary = o.a.createElement(An, {
purchaseId: parseInt(e.params.purchaseId, 10),
siteSlug: e.params.site
}),
t()
}
function Ys(e, t) {
const a = e.store.getState();
if (qs(a))
return Bs(e, "/me/purchases/:site/:purchaseId/payment/edit/:cardId");
Ms(e, Ma.editCardDetails),
e.primary = o.a.createElement(Ln, {
cardId: e.params.cardId,
purchaseId: parseInt(e.params.purchaseId, 10),
siteSlug: e.params.site
}),
t()
}
function zs(e, t) {
Ms(e),
e.primary = o.a.createElement(Fs, {
noticeType: e.params.noticeType
}),
t()
}
function Ks(e, t) {
Ms(e, Ma.managePurchase),
e.primary = o.a.createElement($s, {
purchaseId: parseInt(e.params.purchaseId, 10),
siteSlug: e.params.site
}),
t()
}
var Qs = a("./me/controller.js")
, Js = a("./my-sites/controller.js");
t.default = e=>{
n.a.isEnabled("manage/payment-methods") && (e($.b, Qs.e, Vs, Us.c, Us.f),
e("/payment-methods/add-credit-card", ()=>r.a.redirect($.b))),
e($.c, Qs.e, yt, Us.c, Us.f),
e($.l, Qs.e, jt, Us.c, Us.f),
n.a.isEnabled("async-payments") && e($.k + "/pending", Qs.e, ga, Us.c, Us.f),
e($.k + "/other", Qs.e, wa, Us.c, Us.f),
e($.k + "/other/:subscriptionId", Qs.e, ka, Us.c, Us.f),
e($.k + "/memberships/:subscriptionId", ({params: {subscriptionId: e}})=>{
r.a.redirect($.k + "/other/" + e)
}
),
e($.k + "/memberships", ()=>r.a.redirect($.k + "/other")),
e($.d(":receiptId"), Qs.e, vt, Us.c, Us.f),
e($.k, Qs.e, zs, Us.c, Us.f),
e($.h(":site", ":purchaseId"), Qs.e, Ks, Us.c, Us.f),
e($.e(":site", ":purchaseId"), Qs.e, Hs, Us.c, Us.f),
e($.f(":site", ":purchaseId"), Qs.e, Js.e, Ws, Us.c, Us.f),
e($.a(":site", ":purchaseId"), Qs.e, Js.e, Gs, Us.c, Us.f),
e($.g(":site", ":purchaseId", ":cardId"), Qs.e, Js.e, Ys, Us.c, Us.f),
e("/purchases", ()=>r.a.redirect($.k)),
e("/purchases/:siteName/:purchaseId", ({params: {siteName: e, purchaseId: t}})=>r.a.redirect($.h(e, t))),
e("/purchases/:siteName/:purchaseId/cancel", ({params: {siteName: e, purchaseId: t}})=>r.a.redirect($.e(e, t))),
e("/purchases/:siteName/:purchaseId/confirm-cancel-domain", ({params: {siteName: e, purchaseId: t}})=>r.a.redirect($.f(e, t))),
e("/purchases/:siteName/:purchaseId/payment/add", ({params: {siteName: e, purchaseId: t}})=>r.a.redirect($.a(e, t))),
e("/purchases/:siteName/:purchaseId/payment/edit/:cardId", ({params: {siteName: e, purchaseId: t, cardId: a}})=>r.a.redirect($.g(e, t, a))),
e("/me/billing", ()=>r.a.redirect($.c)),
e("/me/billing/:receiptId", ({params: {receiptId: e}})=>r.a.redirect($.d(e)))
}
},
"./me/purchases/manage-purchase/auto-renew-toggle/auto-renew-disabling-dialog/style.scss": function(e, t, a) {},
"./me/purchases/manage-purchase/auto-renew-toggle/auto-renew-payment-method-dialog/style.scss": function(e, t, a) {},
"./me/purchases/manage-purchase/auto-renew-toggle/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, s = a.n(n)
, r = a("../node_modules/prop-types/index.js")
, i = a.n(r)
, o = a("../node_modules/react/index.js")
, c = a.n(o)
, l = a("../node_modules/react-redux/es/index.js")
, d = a("../packages/i18n-calypso/dist/esm/index.js")
, u = a("../node_modules/page/page.js")
, p = a.n(u)
, m = a("./lib/purchases/index.js")
, h = a("./lib/purchases/actions.js")
, g = a("./state/current-user/selectors.js")
, b = a("./state/purchases/selectors.js")
, f = a("./state/purchases/actions.js")
, _ = a("./state/analytics/actions/record.js")
, y = a("./state/selectors/is-site-automated-transfer.js")
, j = a("./state/notices/actions.js")
, v = a("../packages/components/dist/esm/dialog/index.js")
, E = a("../packages/components/dist/esm/button/index.js")
, $ = a("../node_modules/lodash-es/shuffle.js")
, C = a("./components/forms/form-section-heading/index.jsx")
, x = a("./components/forms/form-button/index.jsx")
, P = a("./components/forms/form-buttons-bar/index.jsx")
, O = a("./components/forms/form-fieldset/index.jsx")
, S = a("./components/forms/form-label/index.tsx")
, w = a("./components/forms/form-radio/index.jsx")
, k = a("./lib/products-values/index.js")
, D = a("./components/marketing-survey/cancel-purchase-form/enriched-survey-data.js")
, N = a("./components/marketing-survey/cancel-purchase-form/precancellation-chat-button/index.jsx");
a("./components/marketing-survey/cancel-auto-renewal-form/style.scss");
class T extends o.Component {
constructor(e) {
super(e),
s()(this, "state", {
response: ""
}),
s()(this, "radioButtons", {}),
s()(this, "getProductTypeString", ()=>{
const {purchase: e, translate: t} = this.props;
return Object(k.w)(e) ? t("domain") : Object(k.X)(e) ? t("plan") : t("subscription")
}
),
s()(this, "onSubmit", ()=>{
const {purchase: e, selectedSite: t} = this.props
, {response: a} = this.state
, n = {
response: a
};
Object(h.e)("calypso-cancel-auto-renewal", t.ID, Object(D.a)(n, e)),
this.props.onClose()
}
),
s()(this, "onRadioChange", e=>{
this.setState({
response: e.currentTarget.value
})
}
),
s()(this, "createRadioButton", (e,t)=>c.a.createElement(S.a, {
key: e
}, c.a.createElement(w.a, {
value: e,
onChange: this.onRadioChange,
checked: this.state.response === e
}), c.a.createElement("span", null, t)));
const {translate: t} = e
, a = this.getProductTypeString();
this.radioButtons = Object($.a)([["let-it-expire", t("I'm going to let this %(productType)s expire.", {
args: {
productType: a
}
})], ["manual-renew", t("I'm going to renew the %(productType)s, but will do it manually.", {
args: {
productType: a
}
})], ["not-sure", t("I'm not sure.")]])
}
render() {
const {translate: e, isVisible: t, purchase: a, onClose: n} = this.props
, {response: s} = this.state
, r = !s
, i = this.getProductTypeString();
return c.a.createElement(v.a, {
className: "cancel-auto-renewal-form__dialog",
isVisible: t,
onClose: n
}, c.a.createElement(C.a, {
className: "cancel-auto-renewal-form__header"
}, e("Your thoughts are needed.")), c.a.createElement(O.a, null, c.a.createElement("p", null, e("Auto-renewal is now off. Before you go, we'd love to know: are you letting this %(productType)s expire completely, or do you think you'll renew it manually?", {
args: {
productType: i
},
comment: '%(productType)s will be either "plan", "domain", or "subscription".'
})), this.radioButtons.map(e=>this.createRadioButton(e[0], e[1]))), c.a.createElement(P.a, null, c.a.createElement(x.a, {
onClick: this.onSubmit,
disabled: r
}, e("Submit")), c.a.createElement(x.a, {
isPrimary: !1,
onClick: n
}, e("Skip")), c.a.createElement(N.a, {
purchase: a,
onClick: n
})))
}
}
s()(T, "propTypes", {
purchase: i.a.object.isRequired,
selectedSite: i.a.object.isRequired,
isVisible: i.a.bool,
onClose: i.a.func.isRequired,
translate: i.a.func.isRequired
});
var I = Object(l.c)()(Object(d.c)(T))
, R = a("./components/localized-moment/index.js")
, A = a("./state/sites/selectors/get-site.js");
a("./me/purchases/manage-purchase/auto-renew-toggle/auto-renew-disabling-dialog/style.scss");
const F = "general"
, L = "atomic"
, U = "survey";
class M extends o.Component {
constructor(...e) {
super(...e),
s()(this, "state", {
dialogType: F,
surveyHasShown: !1
}),
s()(this, "onClickAtomicFollowUpConfirm", ()=>{
this.props.onConfirm(),
this.setState({
dialogType: U
})
}
),
s()(this, "closeAndCleanup", ()=>{
this.props.onClose(),
this.setState({
dialogType: F
})
}
),
s()(this, "renderAtomicFollowUpDialog", ()=>{
const {siteDomain: e, isVisible: t, translate: a} = this.props
, n = "//" + e + "/wp-admin/export.php";
return c.a.createElement(v.a, {
isVisible: t,
additionalClassNames: "auto-renew-disabling-dialog atomic-follow-up",
onClose: this.closeAndCleanup
}, c.a.createElement("p", null, a("Before you continue, we recommend downloading a backup of your site – that way, you'll have your content to use on any future websites you create.")), c.a.createElement("ul", null, c.a.createElement("li", null, c.a.createElement(E.a, {
href: n,
primary: !0
}, a("Download a current backup"))), c.a.createElement("li", null, c.a.createElement(E.a, {
onClick: this.onClickAtomicFollowUpConfirm
}, a("I don't need a backup OR I already have a backup. Cancel my auto-renewal.")))))
}
),
s()(this, "onClickGeneralConfirm", ()=>{
if ("atomic" !== this.getVariation()) {
if (this.props.onConfirm(),
this.state.surveyHasShown)
return this.closeAndCleanup();
this.setState({
dialogType: U,
surveyHasShown: !0
})
} else
this.setState({
dialogType: L
})
}
),
s()(this, "renderGeneralDialog", ()=>{
const {isVisible: e, translate: t} = this.props
, a = this.getCopy(this.getVariation())
, n = [{
action: "close",
label: t("I'll keep it"),
onClick: this.closeAndCleanup
}, {
action: "confirm",
label: t("Confirm cancellation"),
onClick: this.onClickGeneralConfirm,
isPrimary: !0
}];
return c.a.createElement(v.a, {
isVisible: e,
additionalClassNames: "auto-renew-disabling-dialog",
onClose: this.closeAndCleanup,
buttons: n
}, c.a.createElement("h2", {
className: "auto-renew-disabling-dialog__header"
}, t("Before you go…")), c.a.createElement("p", null, a))
}
),
s()(this, "renderSurvey", ()=>{
const {purchase: e, isVisible: t, selectedSite: a} = this.props;
return c.a.createElement(I, {
purchase: e,
selectedSite: a,
isVisible: t,
onClose: this.closeAndCleanup
})
}
)
}
getVariation() {
const {purchase: e, isAtomicSite: t} = this.props;
return Object(k.w)(e) ? "domain" : Object(k.X)(e) && t ? "atomic" : Object(k.X)(e) ? "plan" : null
}
getCopy(e) {
const {planName: t, siteDomain: a, purchase: n, translate: s, moment: r} = this.props
, i = r(n.expiryDate).format("LL");
switch (e) {
case "plan":
return s("By canceling auto-renewal, your %(planName)s plan for %(siteDomain)s will expire on %(expiryDate)s. When it does, you'll lose access to key features you may be using on your site. To avoid that, turn auto-renewal back on or manually renew your plan before the expiration date.", {
args: {
planName: t,
siteDomain: a,
expiryDate: i
},
comment: "%(planName)s is the name of a WordPress.com plan, e.g. Personal, Premium, Business. %(siteDomain)s is a domain name, e.g. example.com, example.wordpress.com. %(expiryDate)s is a date string, e.g. May 14, 2020"
});
case "domain":
return s("By canceling auto-renewal, your domain %(domain)s will expire on %(expiryDate)s. Once your domain expires, there is no guarantee that you'll be able to get it back – it could become unavailable and be impossible to purchase here, or at any other domain registrar. To avoid that, turn auto-renewal back on or manually renew your domain before the expiration date.", {
args: {
domain: n.meta,
expiryDate: i
},
comment: "%(domain)s is a domain name, e.g. example.com, example.wordpress.com. %(expiryDate)s is a date string, e.g. May 14, 2020"
});
case "atomic":
return s("By canceling auto-renewal, your %(planName)s plan for %(siteDomain)s will expire on %(expiryDate)s. When it does, you will lose plugins, themes, design customizations, and possibly some content. To avoid that, turn auto-renewal back on or manually renew your plan before the expiration date.", {
args: {
planName: t,
siteDomain: a,
expiryDate: i
},
comment: "%(planName)s is the name of a WordPress.com plan, e.g. Personal, Premium, Business. %(siteDomain)s is a domain name, e.g. example.com, example.wordpress.com. %(expiryDate)s is a date string, e.g. May 14, 2020"
})
}
}
render() {
switch (this.state.dialogType) {
case F:
return this.renderGeneralDialog();
case L:
return this.renderAtomicFollowUpDialog();
case U:
return this.renderSurvey()
}
}
}
s()(M, "propTypes", {
isVisible: i.a.bool,
translate: i.a.func.isRequired,
planName: i.a.string.isRequired,
siteDomain: i.a.string.isRequired,
purchase: i.a.object.isRequired
});
var q = Object(l.c)((e,{purchase: t})=>({
isAtomicSite: Object(y.a)(e, t.siteId),
selectedSite: Object(A.a)(e, t.siteId)
}))(Object(d.c)(Object(R.b)(M)));
a("./me/purchases/manage-purchase/auto-renew-toggle/auto-renew-payment-method-dialog/style.scss");
class B extends o.Component {
render() {
const {isVisible: e, translate: t} = this.props
, a = [{
action: "close",
label: t("Cancel"),
onClick: this.props.onClose
}, {
action: "add",
label: t("Add a payment method"),
onClick: this.props.onAddClick,
isPrimary: !0
}];
return c.a.createElement(v.a, {
isVisible: e,
additionalClassNames: "auto-renew-payment-method-dialog",
onClose: this.props.onClose,
buttons: a
}, c.a.createElement("h2", {
className: "auto-renew-payment-method-dialog__header"
}, t("Turn on auto-renew")), c.a.createElement("p", null, t("We currently don't have any payment details on file for this purchase to automatically renew it for you. Please add a payment method so we can continue your service without interruptions.")))
}
}
s()(B, "propTypes", {
isVisible: i.a.bool,
translate: i.a.func.isRequired,
purchase: i.a.object.isRequired,
onClose: i.a.func.isRequired,
onAddClick: i.a.func.isRequired
});
var G = Object(d.c)(B)
, V = a("./components/forms/form-toggle/index.jsx")
, H = a("./components/forms/form-toggle/compact.jsx")
, W = a("./me/purchases/utils.js")
, Y = a("./state/ui/selectors/get-selected-site-slug.js");
class z extends o.Component {
constructor(...e) {
super(...e),
s()(this, "state", {
showAutoRenewDisablingDialog: !1,
showPaymentMethodDialog: !1,
isTogglingToward: null,
isRequesting: !1
}),
s()(this, "onCloseAutoRenewDisablingDialog", ()=>{
this.setState({
showAutoRenewDisablingDialog: !1
})
}
),
s()(this, "goToUpdatePaymentMethod", ()=>{
const {purchase: e, siteSlug: t, productSlug: a, isAtomicSite: n, toggleSource: s} = this.props;
this.closeAutoRenewPaymentMethodDialog(),
this.props.recordTracksEvent("calypso_auto_renew_no_payment_method_dialog_add_click", {
product_slug: a,
is_atomic: n,
toggle_source: s
}),
p()(Object(W.b)(t, e))
}
),
s()(this, "onCloseAutoRenewPaymentMethodDialog", ()=>{
const {productSlug: e, isAtomicSite: t, toggleSource: a} = this.props;
this.closeAutoRenewPaymentMethodDialog(),
this.props.recordTracksEvent("calypso_auto_renew_no_payment_method_dialog_close", {
product_slug: e,
is_atomic: t,
toggle_source: a
})
}
),
s()(this, "toggleAutoRenew", ()=>{
const {purchase: {id: e, productSlug: t}, currentUserId: a, isEnabled: n, isAtomicSite: s, translate: r} = this.props
, i = n ? h.c : h.d
, o = !n
, c = ()=>{
this.props.recordTracksEvent("calypso_purchases_manage_purchase_toggle_auto_renew", {
product_slug: t,
is_atomic: s,
is_toggling_toward: o,
toggle_source: this.props.toggleSource
})
}
;
if (o && !Object(m.C)(this.props.purchase))
return this.setState({
showPaymentMethodDialog: !0
}),
void c();
this.setState({
isTogglingToward: o,
isRequesting: !0
}),
i(e, e=>{
if (this.setState({
isRequesting: !1
}),
e)
return this.props.fetchUserPurchases(a),
void (!1 === o && this.setState({
pendingNotice: ["is-success", r("Auto-renewal has been turned off successfully."), {
duration: 4e3
}]
}));
this.setState({
pendingNotice: ["is-error", r(o ? "We've failed to enable auto-renewal for you. Please try again." : "We've failed to disable auto-renewal for you. Please try again.")]
})
}
),
c()
}
),
s()(this, "onToggleAutoRenew", ()=>{
const {isEnabled: e} = this.props;
e ? this.setState({
showAutoRenewDisablingDialog: !0
}) : this.toggleAutoRenew()
}
),
s()(this, "isUpdatingAutoRenew", ()=>this.state.isRequesting || this.props.fetchingUserPurchases)
}
componentDidUpdate() {
!this.state.showAutoRenewDisablingDialog && this.state.pendingNotice && (this.props.createNotice(...this.state.pendingNotice),
this.setState({
pendingNotice: null
}))
}
closeAutoRenewPaymentMethodDialog() {
this.setState({
showPaymentMethodDialog: !1
})
}
getToggleUiStatus() {
return this.props.isEnabled
}
renderTextStatus() {
const {translate: e, isEnabled: t} = this.props;
return this.isUpdatingAutoRenew() ? e("Auto-renew (…)") : e(t ? "Auto-renew (on)" : "Auto-renew (off)")
}
shouldRender(e) {
return !Object(m.t)(e) && !Object(m.w)(e)
}
render() {
const {planName: e, siteDomain: t, purchase: a, compact: n, withTextStatus: s} = this.props;
if (!this.shouldRender(a))
return null;
const r = n ? H.a : V.a;
return c.a.createElement(c.a.Fragment, null, c.a.createElement(r, {
checked: this.getToggleUiStatus(),
disabled: this.isUpdatingAutoRenew(),
toggling: this.isUpdatingAutoRenew(),
onChange: this.onToggleAutoRenew
}, s && this.renderTextStatus()), c.a.createElement(q, {
isVisible: this.state.showAutoRenewDisablingDialog,
planName: e,
purchase: a,
siteDomain: t,
onClose: this.onCloseAutoRenewDisablingDialog,
onConfirm: this.toggleAutoRenew
}), c.a.createElement(G, {
isVisible: this.state.showPaymentMethodDialog,
purchase: a,
onClose: this.onCloseAutoRenewPaymentMethodDialog,
onAddClick: this.goToUpdatePaymentMethod
}))
}
}
s()(z, "propTypes", {
purchase: i.a.object.isRequired,
siteDomain: i.a.string.isRequired,
planName: i.a.string.isRequired,
isEnabled: i.a.bool.isRequired,
isAtomicSite: i.a.bool.isRequired,
fetchingUserPurchases: i.a.bool,
recordTracksEvent: i.a.func.isRequired,
compact: i.a.bool,
withTextStatus: i.a.bool,
toggleSource: i.a.string,
siteSlug: i.a.string
}),
s()(z, "defaultProps", {
fetchingUserPurchases: !1
});
t.a = Object(l.c)((e,{purchase: t, siteSlug: a})=>({
fetchingUserPurchases: Object(b.l)(e),
isEnabled: !Object(m.u)(t),
currentUserId: Object(g.h)(e),
isAtomicSite: Object(y.a)(e, t.siteId),
siteSlug: a || Object(Y.a)(e)
}), {
fetchUserPurchases: f.c,
recordTracksEvent: _.e,
createNotice: j.a
})(Object(d.c)(z))
},
"./me/purchases/manage-purchase/notices.scss": function(e, t, a) {},
"./me/purchases/manage-purchase/plan-details/style.scss": function(e, t, a) {},
"./me/purchases/manage-purchase/style.scss": function(e, t, a) {},
"./me/purchases/non-primary-domain-dialog/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, s = a.n(n)
, r = a("../packages/i18n-calypso/dist/esm/index.js")
, i = a("../node_modules/prop-types/index.js")
, o = a.n(i)
, c = a("../node_modules/react/index.js")
, l = a.n(c)
, d = a("../packages/components/dist/esm/dialog/index.js")
, u = a("./components/forms/form-section-heading/index.jsx");
a("./me/purchases/non-primary-domain-dialog/style.scss");
class p extends c.Component {
constructor(...e) {
super(...e),
s()(this, "close", ()=>{
this.props.closeDialog()
}
),
s()(this, "removePlan", ()=>{
this.props.removePlan()
}
)
}
render() {
const {planName: e, oldDomainName: t, newDomainName: a, translate: n} = this.props
, s = [{
action: "cancel",
label: n("Cancel")
}, {
action: "remove",
isPrimary: !0,
label: n("Remove Plan"),
onClick: this.removePlan
}];
return l.a.createElement(d.a, {
buttons: s,
className: "non-primary-domain-dialog",
isVisible: this.props.isDialogVisible,
onClose: this.close
}, l.a.createElement(c.Fragment, null, l.a.createElement(u.a, null, n("Remove %(plan)s", {
args: {
plan: e
}
})), l.a.createElement("p", null, n("When you downgrade your plan, {{strong}}%(oldDomain)s{{/strong}} will immediately start forwarding to {{strong}}%(newDomain)s{{/strong}}.", {
args: {
oldDomain: t,
newDomain: a
},
components: {
strong: l.a.createElement("strong", null)
}
}), l.a.createElement("br", null), n("{{strong}}%(newDomain)s{{/strong}} will be the address that people see when they visit your site. Would you still like to downgrade your plan?", {
args: {
newDomain: a
},
components: {
strong: l.a.createElement("strong", null)
}
}))))
}
}
s()(p, "propTypes", {
planName: o.a.string.isRequired,
oldDomainName: o.a.string.isRequired,
newDomainName: o.a.string.isRequired
}),
t.a = Object(r.c)(p)
},
"./me/purchases/non-primary-domain-dialog/style.scss": function(e, t, a) {},
"./me/purchases/purchase-item/style.scss": function(e, t, a) {},
"./me/purchases/purchases-site/header.scss": function(e, t, a) {},
"./me/purchases/purchases-site/style.scss": function(e, t, a) {},
"./me/purchases/remove-purchase/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, s = a.n(n)
, r = a("../node_modules/react-redux/es/index.js")
, i = a("../node_modules/page/page.js")
, o = a.n(i)
, c = a("../node_modules/prop-types/index.js")
, l = a.n(c)
, d = a("../node_modules/react/index.js")
, u = a.n(d)
, p = a("./components/gridicon/index.tsx")
, m = a("../packages/i18n-calypso/dist/esm/index.js")
, h = a("../node_modules/classnames/index.js")
, g = a.n(h)
, b = a("../packages/components/dist/esm/button/index.js")
, f = a("../packages/components/dist/esm/dialog/index.js")
, _ = a("../packages/components/dist/esm/card/compact.js")
, y = a("./config/index.js")
, j = a("./components/marketing-survey/cancel-purchase-form/index.jsx")
, v = a("./components/marketing-survey/cancel-purchase-form/precancellation-chat-button/index.jsx")
, E = a("./components/marketing-survey/cancel-purchase-form/constants.js");
var $ = a("./components/marketing-survey/cancel-purchase-form/enriched-survey-data.js")
, C = a("./state/current-user/selectors.js")
, x = a("./lib/purchases/index.js")
, P = a("./state/purchases/selectors.js")
, O = a("./components/card-heading/index.jsx")
, S = a("./components/gsuite/gsuite-features/index.jsx")
, w = a("./components/gsuite/gsuite-learn-more/index.jsx")
, k = a("./state/analytics/actions/record.js");
class D extends d.Component {
constructor(...e) {
super(...e),
s()(this, "handleLearnMoreClick", ()=>{
this.props.recordTracksEvent("calypso_purchases_gsuite_remove_purchase_learn_more_click")
}
)
}
componentDidMount() {
this.props.recordTracksEvent("calypso_purchases_gsuite_remove_purchase_features_view")
}
render() {
const {purchase: e, translate: t} = this.props
, a = Object(x.L)(e)
, {productSlug: n} = e;
return u.a.createElement("div", {
className: "gsuite-cancel-purchase-dialog__features"
}, u.a.createElement(O.a, {
tagName: "h3",
size: 24
}, t("Are you sure? Here's what you'll be missing:")), u.a.createElement("p", null, t("If you cancel and remove G Suite from {{siteName/}} you will lose access to the following: ", {
components: {
siteName: u.a.createElement("em", null, a)
}
})), u.a.createElement(S.a, {
productSlug: n,
domainName: a,
type: "list"
}), u.a.createElement(w.a, {
onClick: this.handleLearnMoreClick
}))
}
}
D.propTypes = {
purchase: l.a.object.isRequired,
recordTracksEvent: l.a.func.isRequired,
translate: l.a.func.isRequired
};
var N = Object(r.c)(null, {
recordTracksEvent: k.e
})(Object(m.c)(D))
, T = a("./components/multiple-choice-question/index.jsx");
class I extends d.Component {
componentDidMount() {
this.props.recordTracksEvent("calypso_purchases_gsuite_remove_purchase_survey_view")
}
render() {
const {disabled: e, onSurveyAnswerChange: t, surveyAnswerId: a, surveyAnswerText: n, translate: s} = this.props;
return u.a.createElement(T.a, {
answers: [{
id: "too-expensive",
answerText: s("It's too expensive."),
textInput: !0,
textInputPrompt: s("How can we improve G Suite?")
}, {
id: "do-not-need-it",
answerText: s("I don't need it."),
textInput: !0,
textInputPrompt: s("What are we missing that you need?")
}, {
id: "purchased-by-mistake",
answerText: s("I purchased it by mistake.")
}, {
id: "it-did-not-work",
answerText: s("I was unable to activate or use it."),
textInput: !0,
textInputPrompt: s("Where did you run into problems?")
}, {
id: "another-reason",
answerText: s("Another reason…"),
textInput: !0,
doNotShuffle: !0
}],
question: s("Please tell us why you are cancelling G Suite:"),
onAnswerChange: t,
disabled: e,
selectedAnswerId: a,
selectedAnswerText: n
})
}
}
I.propTypes = {
disabled: l.a.bool.isRequired,
onSurveyAnswerChange: l.a.func.isRequired,
translate: l.a.func.isRequired,
surveyAnswerId: l.a.string,
surveyAnswerText: l.a.string
};
var R = Object(r.c)(null, {
recordTracksEvent: k.e
})(Object(m.c)(I))
, A = a("./notices/index.js")
, F = a("./me/purchases/paths.js")
, L = a("./state/purchases/actions.js")
, U = a("./lib/wp/browser.js");
a("./components/marketing-survey/gsuite-cancel-purchase-dialog/style.scss");
class M extends d.Component {
constructor(e) {
super(e),
s()(this, "resetState", ()=>{
this.setState(this.initialState)
}
),
s()(this, "nextStepButtonClick", ()=>{
const {step: e} = this.state;
this.props.recordTracksEvent("calypso_purchases_gsuite_remove_purchase_next_step_click", {
step: e,
next_step: "gsuite_survey_step"
}),
this.setState({
step: "gsuite_survey_step"
})
}
),
s()(this, "previousStepButtonClick", ()=>{
const {step: e} = this.state;
this.props.recordTracksEvent("calypso_purchases_gsuite_remove_purchase_prev_step_click", {
step: e,
prev_step: "gsuite_initial_step"
}),
this.setState({
step: "gsuite_initial_step"
})
}
),
s()(this, "cancelButtonClick", e=>{
this.props.recordTracksEvent("calypso_purchases_gsuite_remove_purchase_keep_it_click"),
e(),
this.resetState()
}
),
s()(this, "removeButtonClick", async e=>{
this.props.recordTracksEvent("calypso_purchases_gsuite_remove_purchase_click"),
this.setState({
isRemoving: !0
}),
await this.saveSurveyResults(),
await this.removePurchase() ? (e(),
this.resetState(),
o()(F.k)) : this.setState({
isRemoving: !1
})
}
),
s()(this, "saveSurveyResults", async()=>{
const {purchase: e} = this.props
, {surveyAnswerId: t, surveyAnswerText: a} = this.state
, n = U.a.marketing().survey("calypso-gsuite-remove-purchase", e.siteId)
, s = {
"why-cancel": {
response: t,
text: a
},
type: "remove"
};
n.addResponses(Object($.a)(s, e));
const r = await n.submit();
r.success || A.a.error(r.err)
}
),
s()(this, "removePurchase", async()=>{
const {domain: e, productName: t, purchase: a, translate: n, userId: s} = this.props;
await this.props.removePurchase(a.id, s);
const {purchasesError: r} = this.props;
return r ? (A.a.error(r),
!1) : (A.a.success(n("%(productName)s was removed from {{domain/}}.", {
args: {
productName: t
},
components: {
domain: u.a.createElement("em", null, e)
}
}), {
persistent: !0
}),
!0)
}
),
s()(this, "onSurveyAnswerChange", (e,t)=>{
e !== this.state.surveyAnswerId && this.props.recordTracksEvent("calypso_purchases_gsuite_remove_purchase_survey_answer_change", {
answer_id: e
}),
this.setState({
surveyAnswerId: e,
surveyAnswerText: t
})
}
),
s()(this, "getStepButtons", ()=>{
const {translate: e} = this.props
, {step: t, surveyAnswerId: a, isRemoving: n} = this.state;
return "gsuite_initial_step" === t ? [{
action: "cancel",
disabled: n,
isPrimary: !0,
label: e("I'll Keep It"),
onClick: this.cancelButtonClick
}, {
action: "next",
disabled: n,
label: e("Next Step"),
onClick: this.nextStepButtonClick
}] : [{
action: "cancel",
disabled: n,
label: e("I'll Keep It"),
onClick: this.cancelButtonClick
}, {
action: "prev",
disabled: n,
label: e("Previous Step"),
onClick: this.previousStepButtonClick
}, {
action: "remove",
additionalClassNames: n ? ["is-busy"] : void 0,
disabled: n || null === a,
isPrimary: !0,
label: e(n ? "Removing…" : "Remove Now"),
onClick: this.removeButtonClick
}]
}
),
this.state = this.initialState
}
get initialState() {
return {
step: "gsuite_initial_step",
surveyAnswerId: null,
surveyAnswerText: "",
isRemoving: !1
}
}
render() {
const {isVisible: e, onClose: t, purchase: a} = this.props
, {surveyAnswerId: n, surveyAnswerText: s, isRemoving: r} = this.state;
return e && u.a.createElement(f.a, {
buttons: this.getStepButtons(),
className: "gsuite-cancel-purchase-dialog__dialog",
isVisible: e,
onClose: t
}, "gsuite_initial_step" === this.state.step ? u.a.createElement(N, {
purchase: a
}) : u.a.createElement(R, {
disabled: r,
onSurveyAnswerChange: this.onSurveyAnswerChange,
surveyAnswerId: n,
surveyAnswerText: s
}))
}
}
M.propTypes = {
domain: l.a.string.isRequired,
isVisible: l.a.bool.isRequired,
onClose: l.a.func.isRequired,
productName: l.a.string.isRequired,
purchase: l.a.object.isRequired,
purchasesError: l.a.string,
site: l.a.object.isRequired,
translate: l.a.func.isRequired
};
var q = Object(r.c)((e,{purchase: t})=>({
productName: Object(x.h)(t),
domain: Object(x.L)(t),
purchasesError: Object(P.e)(e),
userId: Object(C.h)(e)
}), {
recordTracksEvent: k.e,
removePurchase: L.d
})(Object(m.c)(M))
, B = a("./me/purchases/utils.js")
, G = a("./lib/products-values/index.js")
, V = a("./lib/products-values/constants.js")
, H = a("./state/happychat/selectors/is-happychat-available.js")
, W = a("./components/forms/form-section-heading/index.jsx")
, Y = a("./state/selectors/is-domain-only-site.js")
, z = a("./state/selectors/is-site-automated-transfer.js")
, K = a("./state/sites/actions.js")
, Q = a("./state/ui/actions/index.js")
, J = a("./components/forms/form-fieldset/index.jsx")
, X = a("./components/forms/form-label/index.tsx")
, Z = a("./components/forms/form-text-input/index.jsx")
, ee = a("./components/forms/form-input-validation/index.jsx")
, te = a("./components/forms/form-checkbox/index.jsx")
, ae = a("./lib/url/support.js");
class ne extends d.Component {
constructor(...e) {
super(...e),
s()(this, "state", {
step: 1,
domainValidated: !1,
userAgreed: !1,
showErrors: !1
}),
s()(this, "onDomainChange", e=>{
const t = Object(x.h)(this.props.purchase);
this.setState({
domainValidated: e.currentTarget.value === t
})
}
),
s()(this, "onAgreeChange", e=>{
this.setState({
userAgreed: e.target.checked
})
}
),
s()(this, "nextStep", e=>{
if (!this.props.isRemoving)
switch (this.state.step) {
case 1:
this.setState({
step: 2
});
break;
case 2:
this.state.domainValidated && this.state.userAgreed ? this.props.removePurchase(e) : this.setState({
showErrors: !0
})
}
}
),
s()(this, "close", ()=>{
this.props.isRemoving || (this.props.closeDialog(),
this.setState({
step: 1
}))
}
)
}
renderDomainDeletionWarning(e) {
const {translate: t} = this.props;
return u.a.createElement("p", null, t("Deleting {{strong}}%(domain)s{{/strong}} is {{strong}}permanent{{/strong}}. You will no longer own it, and it could be registered by someone else.", {
args: {
domain: e
},
components: {
strong: u.a.createElement("strong", null)
}
}))
}
renderFirstStep(e) {
const {translate: t} = this.props;
return u.a.createElement(d.Fragment, null, u.a.createElement(W.a, null, t("{{strong}}Delete{{/strong}} %(domain)s and remove it from your account.", {
args: {
domain: e
},
components: {
strong: u.a.createElement("strong", null)
}
})), this.renderDomainDeletionWarning(e), u.a.createElement("p", null, t("If you want to use this domain with another service, DO NOT delete it."), " ", t("Instead, keep the domain. You can then {{a}}move or point your domain to a different service.{{/a}}", {
components: {
a: u.a.createElement("a", {
target: "_blank",
rel: "noopener noreferrer",
href: ae.Q
})
}
})))
}
renderSecondStep(e) {
const {translate: t} = this.props;
return u.a.createElement(d.Fragment, null, u.a.createElement(W.a, null, t("{{strong}}Delete{{/strong}} this domain by typing “%(domain)s” into the field below:", {
args: {
domain: e
},
components: {
strong: u.a.createElement("strong", null)
}
})), u.a.createElement(J.a, null, u.a.createElement(X.a, {
htmlFor: "remove-domain-dialog__form-domain"
}, t("Type your domain name to proceed", {
context: "Domain name"
})), u.a.createElement(Z.a, {
name: "domain",
id: "remove-domain-dialog__form-domain",
isError: this.state.showErrors && !this.state.domainValidated,
onChange: this.onDomainChange
}), this.state.showErrors && !this.state.domainValidated && u.a.createElement(ee.a, {
text: t("The domain name you entered does not match."),
isError: !0
})), u.a.createElement(J.a, null, u.a.createElement(X.a, null, u.a.createElement(te.a, {
name: "agree",
value: "true",
onChange: this.onAgreeChange
}), u.a.createElement("span", null, t("I understand that this is permanent and irreversible.", {
context: "Domain name"
}))), this.state.showErrors && !this.state.userAgreed && u.a.createElement(ee.a, {
text: t("You need to confirm that you understand the action you're performing."),
isError: !0
})), this.renderDomainDeletionWarning(e))
}
render() {
const {purchase: e, translate: t, chatButton: a} = this.props
, n = Object(x.h)(e)
, s = [{
action: "cancel",
disabled: this.props.isRemoving,
isPrimary: !0,
label: t("Keep this Domain")
}, {
action: "remove",
additionalClassNames: [this.props.isRemoving ? "is-busy" : "", "is-scary"],
label: t("Delete this Domain"),
onClick: this.nextStep
}];
return a && s.unshift(a),
u.a.createElement(f.a, {
buttons: s,
className: "remove-domain-dialog__dialog",
isVisible: this.props.isDialogVisible,
onClose: this.close
}, 1 === this.state.step && this.renderFirstStep(n), 2 === this.state.step && this.renderSecondStep(n))
}
}
s()(ne, "propTypes", {
isRemoving: l.a.bool.isRequired,
isDialogVisible: l.a.bool.isRequired,
removePurchase: l.a.func.isRequired,
closeDialog: l.a.func.isRequired,
purchase: l.a.object
});
var se = Object(m.c)(ne)
, re = a("./me/purchases/non-primary-domain-dialog/index.jsx")
, ie = a("./components/vertical-nav/item/index.jsx");
a("./me/purchases/remove-purchase/style.scss");
class oe extends d.Component {
constructor(...e) {
super(...e),
s()(this, "state", {
isDialogVisible: !1,
isRemoving: !1,
isShowingNonPrimaryDomainWarning: !1,
survey: {}
}),
s()(this, "closeDialog", ()=>{
this.setState({
isDialogVisible: !1,
isShowingNonPrimaryDomainWarning: !1
})
}
),
s()(this, "showRemovePlanDialog", ()=>{
this.setState({
isShowingNonPrimaryDomainWarning: !1,
isDialogVisible: !0
})
}
),
s()(this, "openDialog", e=>{
e.preventDefault(),
this.props.onClickTracks && this.props.onClickTracks(e),
this.shouldShowNonPrimaryDomainWarning() && !this.state.isShowingNonPrimaryDomainWarning ? this.setState({
isShowingNonPrimaryDomainWarning: !0,
isDialogVisible: !1
}) : this.setState({
isShowingNonPrimaryDomainWarning: !1,
isDialogVisible: !0
})
}
),
s()(this, "onClickChatButton", ()=>{
this.setState({
isDialogVisible: !1
})
}
),
s()(this, "onSurveyChange", e=>{
this.setState({
survey: e
})
}
),
s()(this, "removePurchase", e=>{
this.setState({
isRemoving: !0
});
const {isDomainOnlySite: t, purchase: a, translate: n} = this.props;
this.props.removePurchase(a.id, this.props.userId).then(()=>{
const s = Object(x.h)(a)
, {purchasesError: r} = this.props;
r ? (this.setState({
isRemoving: !1
}),
e(),
A.a.error(r)) : (Object(G.w)(a) ? (t && (this.props.receiveDeletedSite(a.siteId),
this.props.setAllSitesSelected()),
A.a.success(n("The domain {{domain/}} was removed from your account.", {
components: {
domain: u.a.createElement("em", null, s)
}
}), {
persistent: !0
})) : A.a.success(n("%(productName)s was removed from {{siteName/}}.", {
args: {
productName: s
},
components: {
siteName: u.a.createElement("em", null, a.domain)
}
}), {
persistent: !0
}),
o()(F.k))
}
)
}
),
s()(this, "getChatButton", ()=>u.a.createElement(v.a, {
onClick: this.onClickChatButton,
purchase: this.props.purchase
})),
s()(this, "getContactUsButton", ()=>u.a.createElement(b.a, {
className: "remove-purchase__support-link-button",
href: "/help/contact/"
}, this.props.translate("Contact Us")))
}
shouldShowNonPrimaryDomainWarning() {
const {hasNonPrimaryDomainsFlag: e, isAtomicSite: t, hasCustomPrimaryDomain: a, purchase: n} = this.props;
return e && Object(G.X)(n) && !t && a
}
renderNonPrimaryDomainWarningDialog() {
const {purchase: e, site: t} = this.props;
return u.a.createElement(re.a, {
isDialogVisible: this.state.isShowingNonPrimaryDomainWarning,
closeDialog: this.closeDialog,
removePlan: this.showRemovePlanDialog,
planName: Object(x.h)(e),
oldDomainName: t.domain,
newDomainName: t.wpcom_url
})
}
renderDomainDialog() {
let e = null;
return y.a.isEnabled("upgrades/precancellation-chat") && "happychat_step" !== this.state.surveyStep && (e = this.getChatButton()),
u.a.createElement(se, {
isRemoving: this.state.isRemoving,
isDialogVisible: this.state.isDialogVisible,
removePurchase: this.removePurchase,
closeDialog: this.closeDialog,
chatButton: e,
purchase: this.props.purchase
})
}
renderPlanDialog() {
const {purchase: e, site: t} = this.props;
return u.a.createElement(j.a, {
disableButtons: this.state.isRemoving,
defaultContent: this.renderPlanDialogText(),
onInputChange: this.onSurveyChange,
purchase: e,
selectedSite: t,
isVisible: this.state.isDialogVisible,
onClose: this.closeDialog,
onClickFinalConfirm: this.removePurchase,
flowType: E.a.REMOVE
})
}
renderPlanDialogText() {
const {purchase: e, translate: t} = this.props
, a = Object(x.h)(e)
, n = u.a.createElement("p", null, t("The domain associated with this plan, {{domain/}}, will not be removed. It will remain active on your site, unless also removed.", {
components: {
domain: u.a.createElement("em", null, Object(x.g)(e))
}
}));
return u.a.createElement("div", null, u.a.createElement("p", null, t("Are you sure you want to remove %(productName)s from {{domain/}}?", {
args: {
productName: a
},
components: {
domain: u.a.createElement("em", null, e.domain)
}
}), " ", Object(G.G)(e) ? t("Your G Suite account will continue working without interruption. You will be able to manage your G Suite billing directly through Google.") : t("You will not be able to reuse it again without purchasing a new subscription.", {
comment: "'it' refers to a product purchased by a user"
})), Object(G.X)(e) && Object(x.p)(e) && n)
}
renderAtomicDialog(e) {
const {translate: t} = this.props
, a = [this.props.isChatAvailable ? this.getChatButton() : this.getContactUsButton(), {
action: "cancel",
disabled: this.state.isRemoving,
isPrimary: !0,
label: t("I'll Keep It")
}]
, n = Object(x.h)(e);
return u.a.createElement(f.a, {
buttons: a,
className: "remove-purchase__dialog",
isVisible: this.state.isDialogVisible,
onClose: this.closeDialog
}, u.a.createElement(W.a, null), u.a.createElement("p", null, t("To cancel your %(productName)s plan, please contact our support team — a Happiness Engineer will take care of it.", {
args: {
productName: n
}
})))
}
renderDialog() {
const {purchase: e} = this.props;
return Object(G.w)(e) ? this.renderDomainDialog() : Object(G.t)(e) || Object(G.x)(e) ? this.renderPlanDialog() : Object(G.G)(e) ? u.a.createElement(q, {
isVisible: this.state.isDialogVisible,
onClose: this.closeDialog,
purchase: e,
site: this.props.site
}) : this.props.isAtomicSite && !Object(V.w)(e.productSlug) ? this.renderAtomicDialog(e) : this.renderPlanDialog()
}
render() {
if (Object(B.c)(this.props))
return null;
if (!this.props.site && !this.props.isJetpack)
return null;
const {purchase: e, className: t, useVerticalNavItem: a, translate: n} = this.props
, s = Object(x.h)(e);
if (!Object(x.E)(e))
return null;
const r = u.a.createElement(u.a.Fragment, null, u.a.createElement(p.a, {
icon: "trash"
}), n("Remove %(productName)s", {
args: {
productName: s
}
}))
, i = g()("remove-purchase__card", t)
, o = a ? ie.a : _.a;
return u.a.createElement(u.a.Fragment, null, u.a.createElement(o, {
tagName: "button",
className: i,
onClick: this.openDialog
}, this.props.children ? this.props.children : r), this.shouldShowNonPrimaryDomainWarning() && this.renderNonPrimaryDomainWarningDialog(), this.renderDialog())
}
}
s()(oe, "propTypes", {
hasLoadedUserPurchasesFromServer: l.a.bool.isRequired,
hasNonPrimaryDomainsFlag: l.a.bool,
isDomainOnlySite: l.a.bool,
hasCustomPrimaryDomain: l.a.bool,
receiveDeletedSite: l.a.func.isRequired,
removePurchase: l.a.func.isRequired,
purchase: l.a.object,
site: l.a.object,
setAllSitesSelected: l.a.func.isRequired,
userId: l.a.number.isRequired,
useVerticalNavItem: l.a.bool,
onClickTracks: l.a.func
});
t.a = Object(r.c)((e,{purchase: t})=>{
const a = t && (Object(G.O)(t) || Object(G.Q)(t));
return {
isDomainOnlySite: t && Object(Y.a)(e, t.siteId),
isAtomicSite: Object(z.a)(e, t.siteId),
isChatAvailable: Object(H.a)(e),
isJetpack: a,
purchasesError: Object(P.e)(e),
userId: Object(C.h)(e)
}
}
, {
receiveDeletedSite: K.b,
recordTracksEvent: k.e,
removePurchase: L.d,
setAllSitesSelected: Q.e
})(Object(m.c)(oe))
},
"./me/purchases/remove-purchase/style.scss": function(e, t, a) {},
"./me/purchases/upcoming-renewals/style.scss": function(e, t, a) {},
"./me/purchases/upcoming-renewals/upcoming-renewals-dialog.tsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/react/index.js")
, s = a.n(n)
, r = a("../packages/i18n-calypso/dist/esm/index.js")
, i = a("../packages/format-currency/dist/esm/index.js")
, o = a("../node_modules/lodash-es/capitalize.js")
, c = a("./lib/purchases/index.js")
, l = a("./components/forms/form-label/index.tsx")
, d = a("./components/forms/form-checkbox/index.jsx")
, u = a("../packages/components/dist/esm/dialog/index.js")
, p = a("../packages/components/dist/esm/button/index.js")
, m = a("./components/localized-moment/index.js")
, h = a("./me/purchases/paths.js");
a("./me/purchases/upcoming-renewals/style.scss");
t.a = ({site: e, purchases: t, isVisible: a, onClose: g, onConfirm: b, submitButtonText: f="", showManagePurchaseLinks: _=!0})=>{
const y = Object(r.h)()
, j = Object(m.a)()
, [v,E] = Object(n.useState)([])
, $ = Object(n.useMemo)(()=>[...t].sort((e,t)=>{
var a;
const n = Object(c.G)(e) ? e.renewDate : e.expiryDate
, s = Object(c.G)(t) ? t.renewDate : t.expiryDate;
return null == n || null === (a = n.localeCompare) || void 0 === a ? void 0 : a.call(n, s)
}
), [t]);
Object(n.useEffect)(()=>{
a && E(t.map(e=>e.id))
}
, [a, t]);
const C = Object(n.useCallback)(()=>{
b(t.filter(e=>v.includes(e.id)))
}
, [t, v, b]);
return s.a.createElement(u.a, {
isVisible: a,
leaveTimeout: 0,
additionalClassNames: "upcoming-renewals-dialog",
onClose: g
}, s.a.createElement("h2", {
className: "upcoming-renewals-dialog__header"
}, y("Upcoming renewals")), s.a.createElement("h3", {
className: "upcoming-renewals-dialog__subheader"
}, y("Site: %(siteName)s", {
args: {
siteName: e.domain
}
})), s.a.createElement("hr", null), $.map(t=>{
const a = function(e, t, a) {
return Object(c.G)(a) ? e("renews %(renewDate)s", {
comment: '"renewDate" is relative to the present time and it is already localized, eg. "in a year", "in a month"',
args: {
renewDate: t(a.renewDate).fromNow()
}
}) : Object(c.t)(a) ? e("expired %(expiry)s", {
comment: '"expiry" is relative to the present time and it is already localized, eg. "in a year", "in a month", "a week ago"',
args: {
expiry: t(a.expiryDate).fromNow()
}
}) : e("expires %(expiry)s", {
comment: '"expiry" is relative to the present time and it is already localized, eg. "in a year", "in a month", "a week ago"',
args: {
expiry: t(a.expiryDate).fromNow()
}
})
}(y, j, t)
, r = Object(c.L)(t);
return s.a.createElement(n.Fragment, {
key: t.id
}, s.a.createElement("div", {
className: "upcoming-renewals-dialog__row"
}, s.a.createElement(l.a, {
optional: !1,
required: !1,
className: "upcoming-renewals-dialog__label"
}, s.a.createElement("div", {
className: "upcoming-renewals-dialog__checkbox"
}, s.a.createElement(d.a, {
className: "upcoming-renewals-dialog__checkbox-input",
name: `${t.productSlug}-${t.id}`,
checked: v.includes(t.id),
onChange: ()=>{
v.includes(t.id) ? E(v.filter(e=>e !== t.id)) : E(v.concat([t.id]))
}
})), s.a.createElement("div", {
className: "upcoming-renewals-dialog__name"
}, Object(c.h)(t), s.a.createElement("div", {
className: "upcoming-renewals-dialog__detail"
}, r ? r + ": " : "", s.a.createElement("span", {
className: Object(c.t)(t) ? "expired" : ""
}, r ? a : Object(o.a)(a))))), s.a.createElement("div", {
className: "upcoming-renewals-dialog__side"
}, s.a.createElement("div", {
className: "upcoming-renewals-dialog__price"
}, Object(i.a)(Object(c.k)(t), t.currencyCode, {
stripZeros: !0
})), _ && s.a.createElement("div", {
className: "upcoming-renewals-dialog__renewal-settings-link"
}, s.a.createElement("a", {
onClick: g,
href: Object(h.h)(e.slug, t.id)
}, y("Manage purchase"))))), s.a.createElement("hr", null))
}
), s.a.createElement("div", {
className: "upcoming-renewals-dialog__actions"
}, s.a.createElement(p.a, {
onClick: g
}, y("Cancel")), s.a.createElement(p.a, {
disabled: 0 === v.length,
onClick: C,
primary: !0
}, f || y("Renew now"))))
}
},
"./me/purchases/utils.js": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return c
}
)),
a.d(t, "b", (function() {
return l
}
)),
a.d(t, "c", (function() {
return o
}
));
var n = a("./config/index.js")
, s = a("./me/purchases/paths.js")
, r = a("./lib/purchases/index.js")
, i = a("./lib/products-values/index.js");
function o(e) {
return !e.hasLoadedSites || !e.hasLoadedUserPurchasesFromServer
}
function c(e) {
return !!n.a.isEnabled("upgrades/credit-cards") && !(Object(r.t)(e) || Object(r.w)(e) || Object(r.v)(e) || Object(i.x)(e))
}
function l(e, t) {
if (Object(r.x)(t)) {
const {payment: {creditCard: a}} = t;
return Object(s.g)(e, t.id, a.id)
}
return Object(s.a)(e, t.id)
}
},
"./me/sidebar-navigation/index.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/react/index.js")
, s = a.n(n)
, r = a("../node_modules/react-redux/es/index.js")
, i = a("../packages/i18n-calypso/dist/esm/index.js")
, o = a("./components/sidebar-navigation/index.jsx")
, c = a("./components/gravatar/index.jsx")
, l = a("./state/current-user/selectors.js");
a("./me/sidebar-navigation/style.scss");
t.a = Object(r.c)(e=>({
currentUser: Object(l.b)(e)
}))((function({currentUser: e}) {
const t = Object(i.h)();
return s.a.createElement(o.a, {
sectionTitle: t("Me")
}, s.a.createElement(c.a, {
user: e,
size: 30,
imgSize: 400
}))
}
))
},
"./me/sidebar-navigation/style.scss": function(e, t, a) {},
"./me/sidebar/style.scss": function(e, t, a) {},
"./my-sites/checkout/checkout/country-specific-payment-fields.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../node_modules/prop-types/index.js")
, c = a.n(o)
, l = a("../node_modules/classnames/index.js")
, d = a.n(l)
, u = a("../packages/i18n-calypso/dist/esm/index.js")
, p = a("../node_modules/lodash-es/isEmpty.js")
, m = a("../node_modules/lodash-es/includes.js")
, h = a("../node_modules/lodash-es/get.js")
, g = a("../node_modules/lodash-es/find.js")
, b = a("./components/forms/form-phone-media-input/index.jsx")
, f = a("./my-sites/domains/components/form/index.jsx")
, _ = a("./lib/checkout/constants.js")
, y = a("./components/info-popover/index.jsx")
, j = a("./lib/cart-values/index.js");
class v extends r.Component {
constructor(e) {
super(e),
s()(this, "createField", (e,t,a)=>{
const n = this.props.getErrorMessage(e) || []
, s = !Object(p.a)(n)
, r = Object.assign({}, {
additionalClasses: "checkout__checkout-field " + this.props.fieldClassName,
isError: s,
errorMessage: n[0],
name: e,
onBlur: this.onFieldChange,
onChange: this.onFieldChange,
value: this.props.getFieldValue(e) || "",
autoComplete: "off",
labelClass: "checkout__form-label",
disabled: this.props.disableFields
}, a);
return Object(m.a)(this.state.fields, e) ? i.a.createElement(t, r) : null
}
),
s()(this, "handlePhoneFieldChange", ({value: e, countryCode: t})=>{
this.props.handleFieldChange("phone-number", e),
this.setState({
userSelectedPhoneCountryCode: t
})
}
),
s()(this, "getPanNumberPopover", ()=>{
const {translate: e} = this.props
, t = e("Paying with %(indiaPaymentMethods)s requires a PAN number.", {
comment: "indiaPaymentMethods are local payment methods in India.",
args: {
indiaPaymentMethods: Object(j.o)("netbanking")
}
});
return i.a.createElement(y.a, {
position: "right",
className: "checkout__pan-number-popover"
}, t)
}
),
s()(this, "onFieldChange", e=>this.props.handleFieldChange(e.target.name, e.target.value)),
this.state = {
userSelectedPhoneCountryCode: "",
fields: Object(h.a)(_.a[e.countryCode], "fields", null)
}
}
componentDidUpdate(e) {
e.countryCode !== this.props.countryCode && this.setFieldsState(this.props.countryCode)
}
setFieldsState(e) {
this.setState({
fields: Object(h.a)(_.a[e], "fields", null)
})
}
render() {
const {translate: e, countriesList: t, countryCode: a} = this.props
, {userSelectedPhoneCountryCode: n} = this.state
, s = Object(g.a)(t, {
code: a
})
, r = s && s.name ? s.name : ""
, o = d()("checkout__country-payment-fields", "checkout__country-" + a.toLowerCase());
return i.a.createElement("div", {
className: o
}, i.a.createElement("span", {
key: "country-required-fields",
className: "checkout__form-info-text"
}, r && e("The following fields are also required for payments in %(countryName)s", {
args: {
countryName: r
}
})), this.createField("document", f.c, {
label: e("Taxpayer Identification Number", {
comment: "Individual taxpayer registry identification required for Brazilian payment methods on credit card form"
})
}), this.createField("nik", f.c, {
label: e("NIK - Indonesia Identity Card Number", {
comment: "NIK - Indonesia Identity Card Number required for Indonesian payment methods."
})
}), this.createField("pan", f.c, {
placeholder: " ",
label: e("PAN Number {{panNumberPopover/}}", {
comment: "India PAN number ",
components: {
panNumberPopover: this.getPanNumberPopover()
}
})
}), this.createField("gstin", f.c, {
placeholder: " ",
label: e("GSTIN (optional)", {
comment: "India PAN number "
})
}), this.createField("phone-number", b.a, {
onChange: this.handlePhoneFieldChange,
countriesList: t,
countryCode: n || a,
label: e("Phone")
}), this.createField("address-1", f.c, {
maxLength: 40,
label: e("Address")
}), this.createField("street-number", f.c, {
inputMode: "numeric",
label: e("Street Number", {
comment: "Street number associated with address on credit card form"
})
}), this.createField("address-2", f.b, {
maxLength: 40,
label: e("Address Line 2"),
text: e("+ Add Address Line 2")
}), this.createField("city", f.c, {
label: e("City")
}), i.a.createElement("div", {
className: "checkout__form-state-field"
}, this.createField("state", f.e, {
countryCode: a,
label: e("State")
})), this.createField("postal-code", f.c, {
label: e("Postal Code")
}))
}
}
s()(v, "propTypes", {
countryCode: c.a.string.isRequired,
countriesList: c.a.array.isRequired,
getErrorMessage: c.a.func.isRequired,
getFieldValue: c.a.func.isRequired,
handleFieldChange: c.a.func.isRequired,
fieldClassName: c.a.string,
disableFields: c.a.bool
}),
s()(v, "defaultProps", {
fieldClassName: "",
disableFields: !1
}),
t.a = Object(u.c)(v)
},
"./my-sites/domains/components/form/country-select.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, s = a.n(n)
, r = a("../node_modules/react/index.js")
, i = a.n(r)
, o = a("../packages/i18n-calypso/dist/esm/index.js")
, c = a("../node_modules/classnames/index.js")
, l = a.n(c)
, d = a("../node_modules/lodash-es/isEmpty.js")
, u = a("./lib/analytics/ga.js")
, p = a("./components/forms/form-label/index.tsx")
, m = a("./components/forms/form-input-validation/index.jsx")
, h = a("./components/forms/form-select/index.jsx");
class g extends i.a.PureComponent {
constructor(...e) {
super(...e),
s()(this, "recordCountrySelectClick", ()=>{
this.props.eventFormName && Object(u.a)("Upgrades", `Clicked ${this.props.eventFormName} Country Select`)
}
)
}
render() {
const {countriesList: e, value: t, additionalClasses: a} = this.props
, n = l()(a, "country")
, s = function(e) {
if (Object(d.a)(e))
return [{
key: "loading",
label: Object(o.f)("Loading…")
}];
const t = [{
key: "select-country",
label: Object(o.f)("Select Country"),
value: ""
}, {
key: "divider1",
label: "",
disabled: "disabled",
value: "-"
}]
, a = e.reduce((e,t,a)=>{
if (Object(d.a)(t.code))
return [...e, {
key: "inner-divider" + a,
label: "",
disabled: "disabled",
value: "-"
}];
const n = e.filter(e=>e.value === t.code);
return [...e, {
key: `${t.code}-${n.length}`,
label: t.name,
value: t.code
}]
}
, []);
return [...t, ...a]
}(e)
, r = "validation-field-" + this.props.name;
return i.a.createElement("div", {
className: n
}, i.a.createElement("div", null, i.a.createElement(p.a, {
htmlFor: this.props.name
}, this.props.label), i.a.createElement(h.a, {
"aria-invalid": this.props.isError,
"aria-describedby": r,
name: this.props.name,
id: this.props.name,
value: t || "",
disabled: this.props.disabled,
inputRef: this.props.inputRef,
onChange: this.props.onChange,
onClick: this.recordCountrySelectClick,
isError: this.props.isError
}, s.map(e=>i.a.createElement("option", {
key: e.key,
value: e.value,
disabled: e.disabled
}, e.label)))), this.props.errorMessage && i.a.createElement(m.a, {
id: r,
text: this.props.errorMessage,
isError: !0
}))
}
}
t.a = Object(o.c)(g)
},
"./my-sites/domains/components/form/index.jsx": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return n.a
}
)),
a.d(t, "b", (function() {
return m
}
)),
a.d(t, "c", (function() {
return u.a
}
)),
a.d(t, "e", (function() {
return k
}
)),
a.d(t, "d", (function() {
return N
}
));
var n = a("./my-sites/domains/components/form/country-select.jsx")
, s = a("../node_modules/@babel/runtime/helpers/extends.js")
, r = a.n(s)
, i = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, o = a.n(i)
, c = a("../node_modules/react/index.js")
, l = a.n(c)
, d = a("../node_modules/lodash-es/isEmpty.js")
, u = a("./my-sites/domains/components/form/input.jsx");
class p extends c.PureComponent {
constructor(e, t) {
super(e, t),
o()(this, "handleClick", e=>{
e.preventDefault(),
this.setState({
toggled: !0
}, ()=>{
this.inputField && this.inputField.focus()
}
)
}
),
o()(this, "assignInputFieldRef", e=>{
this.inputField = e,
this.props.inputRef && this.props.inputRef(e)
}
),
this.state = {
toggled: !Object(d.a)(e.value)
},
this.inputField = null
}
render() {
return this.state.toggled ? l.a.createElement(u.a, r()({
ref: this.assignInputFieldRef
}, this.props)) : l.a.createElement("div", {
className: "form__hidden-input"
}, l.a.createElement("a", {
href: "",
onClick: this.handleClick
}, this.props.text))
}
}
var m = p
, h = a("../node_modules/prop-types/index.js")
, g = a.n(h)
, b = a("../node_modules/classnames/index.js")
, f = a.n(b)
, _ = a("../node_modules/react-redux/es/index.js")
, y = a("../packages/i18n-calypso/dist/esm/index.js")
, j = a("./components/forms/form-label/index.tsx")
, v = a("./components/forms/form-select/index.jsx")
, E = a("./components/forms/form-input-validation/index.jsx")
, $ = a("./state/country-states/selectors.js")
, C = a("./lib/wp/browser.js");
a("./state/country-states/init.js");
class x extends c.Component {
UNSAFE_componentWillMount() {
this.request(this.props)
}
UNSAFE_componentWillReceiveProps(e) {
this.props.countryCode !== e.countryCode && this.request(e)
}
request(e) {
e.isRequesting || e.requestCountryStates(e.countryCode)
}
render() {
return null
}
}
x.propTypes = {
countryCode: g.a.string.isRequired,
isRequesting: g.a.bool,
requestCountryStates: g.a.func
};
var P = Object(_.c)((e,{countryCode: t})=>({
isRequesting: Object($.b)(e, t)
}), {
requestCountryStates: function(e) {
return e = e.toLowerCase(),
t=>(t({
type: "COUNTRY_STATES_REQUEST",
countryCode: e
}),
C.a.undocumented().getDomainRegistrationSupportedStates(e).then(a=>{
t(function(e, t) {
return {
type: "COUNTRY_STATES_RECEIVE",
countryCode: t = t.toLowerCase(),
countryStates: e
}
}(a, e)),
t({
type: "COUNTRY_STATES_REQUEST_SUCCESS",
countryCode: e
})
}
).catch(a=>t({
type: "COUNTRY_STATES_REQUEST_FAILURE",
countryCode: e,
error: a
})))
}
})(x)
, O = a("./state/analytics/actions/record.js")
, S = a("./lib/scroll-into-viewport/index.js");
class w extends c.PureComponent {
constructor(...e) {
super(...e),
o()(this, "inputRef", e=>{
this.inputElement = e,
this.props.inputRef && ("function" == typeof inputRef ? this.props.inputRef(e) : this.props.inputRef.current = e)
}
),
o()(this, "recordStateSelectClick", ()=>{
const {eventFormName: e, recordGoogleEvent: t} = this.props;
e && t("Upgrades", `Clicked ${e} State Select`)
}
)
}
UNSAFE_componentWillMount() {
this.instance = ++this.constructor.instances
}
focus() {
const e = this.inputElement;
e && (e.focus(),
Object(S.a)(e, {
behavior: "smooth",
scrollMode: "if-needed"
}))
}
render() {
const e = f()(this.props.additionalClasses, "state")
, {countryCode: t, countryStates: a, errorMessage: n, name: s, value: i, disabled: o, onBlur: c, onChange: p, isError: m, selectText: h} = this.props
, g = "validation-field-" + this.props.name;
return l.a.createElement(l.a.Fragment, null, t && l.a.createElement(P, {
countryCode: t
}), Object(d.a)(a) ? l.a.createElement(u.a, r()({
inputRef: this.inputRef
}, this.props)) : l.a.createElement("div", {
className: e
}, l.a.createElement(j.a, {
htmlFor: `${this.constructor.name}-${this.instance}`
}, this.props.label), l.a.createElement(v.a, {
"aria-invalid": m,
"aria-describedby": g,
id: `${this.constructor.name}-${this.instance}`,
name: s,
value: i,
disabled: o,
onBlur: c,
onChange: p,
onClick: this.recordStateSelectClick,
isError: m,
inputRef: this.inputRef
}, l.a.createElement("option", {
key: "--",
value: "",
disabled: "disabled"
}, h || this.props.translate("Select State")), a.map(e=>l.a.createElement("option", {
key: e.code,
value: e.code
}, e.name))), n && l.a.createElement(E.a, {
id: g,
text: n,
isError: !0
})))
}
}
o()(w, "instances", 0),
w.propTypes = {
additionalClasses: g.a.string,
countryCode: g.a.string,
countryStates: g.a.array,
disabled: g.a.bool,
errorMessage: g.a.string,
eventFormName: g.a.string,
isError: g.a.bool,
label: g.a.string,
name: g.a.string,
onChange: g.a.func,
value: g.a.string,
selectText: g.a.string,
inputRef: g.a.func
};
var k = Object(_.c)((e,{countryCode: t})=>({
countryStates: t ? Object($.a)(e, t) : []
}), {
recordGoogleEvent: O.c
})(Object(y.c)(w))
, D = a("./lib/analytics/ga.js");
class N extends c.PureComponent {
constructor(...e) {
super(...e),
o()(this, "recordFieldClick", ()=>{
this.props.eventFormName && Object(D.a)("Upgrades", `Clicked ${this.props.eventFormName} Field`, this.props.name)
}
)
}
render() {
const e = f()(this.props.additionalClasses, this.props.name)
, t = "validation-field-" + this.props.name;
return l.a.createElement("div", {
className: e
}, l.a.createElement(j.a, {
htmlFor: this.props.name
}, this.props.label), l.a.createElement(v.a, {
"aria-invalid": this.props.isError,
"aria-describedby": t,
name: this.props.name,
id: this.props.name,
value: this.props.value,
disabled: this.props.disabled,
inputRef: this.props.inputRef,
onChange: this.props.onChange,
onClick: this.recordFieldClick,
isError: this.props.isError
}, this.props.options.map(e=>l.a.createElement("option", {
key: e.value,
value: e.value,
disabled: e.disabled
}, e.label))), this.props.errorMessage && l.a.createElement(E.a, {
id: t,
text: this.props.errorMessage,
isError: !0
}))
}
}
o()(N, "propTypes", {
label: g.a.string.isRequired,
name: g.a.string.isRequired,
onChange: g.a.func.isRequired,
options: g.a.array.isRequired,
value: g.a.string.isRequired,
additionalClasses: g.a.string,
errorMessage: g.a.string,
disabled: g.a.bool
}),
o()(N, "defaultProps", {
additionalClasses: "",
errorMessage: "",
disabled: !1
})
},
"./my-sites/domains/components/form/input.jsx": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return b
}
));
var n = a("../node_modules/@babel/runtime/helpers/extends.js")
, s = a.n(n)
, r = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, i = a.n(r)
, o = a("../node_modules/react/index.js")
, c = a.n(o)
, l = a("../node_modules/classnames/index.js")
, d = a.n(l)
, u = a("./components/forms/form-label/index.tsx")
, p = a("./components/forms/form-text-input/index.jsx")
, m = a("./components/forms/form-input-validation/index.jsx")
, h = a("./lib/analytics/ga.js")
, g = a("./lib/scroll-into-viewport/index.js");
class b extends c.a.Component {
constructor(...e) {
super(...e),
i()(this, "inputRef", e=>{
this.inputElement = e,
this.props.inputRef && ("function" == typeof inputRef ? this.props.inputRef(e) : this.props.inputRef.current = e)
}
),
i()(this, "setupInputModeHandlers", ()=>{
const e = this.inputRef.current;
e && "numeric" === this.props.inputMode && (e.addEventListener("touchstart", ()=>e.pattern = "\\d*"),
["keydown", "blur"].forEach(t=>e.addEventListener(t, ()=>e.pattern = ".*")))
}
),
i()(this, "focus", ()=>{
const e = this.inputElement;
e && (e.focus(),
Object(g.a)(e, {
behavior: "smooth",
scrollMode: "if-needed"
}))
}
),
i()(this, "autoFocusInput", ()=>{
this.props.autoFocus && this.focus()
}
),
i()(this, "recordFieldClick", ()=>{
this.props.eventFormName && Object(h.a)("Upgrades", `Clicked ${this.props.eventFormName} Field`, this.props.name)
}
)
}
componentDidMount() {
this.setupInputModeHandlers(),
this.autoFocusInput()
}
componentDidUpdate(e) {
e.disabled && !this.props.disabled && this.autoFocusInput()
}
render() {
const e = d()(this.props.additionalClasses, this.props.name, this.props.labelClass, this.props.classes)
, t = "validation-field-" + this.props.name;
return c.a.createElement("div", {
className: e
}, c.a.createElement(u.a, s()({
htmlFor: this.props.name
}, this.props.labelProps), this.props.label), c.a.createElement(p.a, {
"aria-invalid": this.props.isError,
"aria-describedby": t,
placeholder: this.props.placeholder ? this.props.placeholder : this.props.label,
id: this.props.name,
value: this.props.value,
name: this.props.name,
autoFocus: this.props.autoFocus,
autoComplete: this.props.autoComplete,
disabled: this.props.disabled,
maxLength: this.props.maxLength,
onBlur: this.props.onBlur,
onChange: this.props.onChange,
onClick: this.recordFieldClick,
isError: this.props.isError,
inputRef: this.inputRef
}), this.props.errorMessage && c.a.createElement(m.a, {
id: t,
text: this.props.errorMessage,
isError: !0
}))
}
}
i()(b, "defaultProps", {
autoFocus: !1,
autoComplete: "on"
})
},
"./notices/validation-error-list.jsx": function(e, t, a) {
"use strict";
var n = a("../node_modules/@babel/runtime/helpers/defineProperty.js")
, s = a.n(n)
, r = a("../node_modules/lodash-es/map.js")
, i = a("../packages/i18n-calypso/dist/esm/index.js")
, o = a("../node_modules/prop-types/index.js")
, c = a.n(o)
, l = a("../node_modules/react/index.js")
, d = a.n(l);
class u extends d.a.Component {
render() {
return d.a.createElement("div", null, d.a.createElement("p", null, this.props.translate("Please correct the issue below and try again.", "Please correct the issues listed below and try again.", {
count: this.props.messages.length
})), d.a.createElement("ul", null, Object(r.a)(this.props.messages, (function(e, t) {
return d.a.createElement("li", {
key: t
}, e)
}
))))
}
}
s()(u, "displayName", "ValidationErrorList"),
s()(u, "propTypes", {
messages: c.a.array.isRequired
}),
t.a = Object(i.c)(u)
},
"./state/account-recovery/settings/actions.js": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return r
}
)),
a.d(t, "g", (function() {
return d
}
)),
a.d(t, "c", (function() {
return u
}
)),
a.d(t, "f", (function() {
return p
}
)),
a.d(t, "b", (function() {
return m
}
)),
a.d(t, "d", (function() {
return h
}
)),
a.d(t, "e", (function() {
return g
}
)),
a.d(t, "h", (function() {
return b
}
));
var n = a("../node_modules/lodash-es/replace.js")
, s = a("./lib/wp/browser.js");
a("./state/account-recovery/init.js");
const r = ()=>e=>(e({
type: "ACCOUNT_RECOVERY_SETTINGS_FETCH"
}),
s.a.undocumented().me().getAccountRecovery().then(t=>e({
type: "ACCOUNT_RECOVERY_SETTINGS_FETCH_SUCCESS",
settings: t
})).catch(t=>e((e=>({
type: "ACCOUNT_RECOVERY_SETTINGS_FETCH_FAILED",
error: e
}))(t))))
, i = (e,t)=>({
type: "ACCOUNT_RECOVERY_SETTINGS_UPDATE_SUCCESS",
target: e,
value: t
})
, o = (e,t)=>({
type: "ACCOUNT_RECOVERY_SETTINGS_UPDATE_FAILED",
target: e,
error: t
})
, c = e=>({
type: "ACCOUNT_RECOVERY_SETTINGS_DELETE_SUCCESS",
target: e
})
, l = (e,t)=>({
type: "ACCOUNT_RECOVERY_SETTINGS_DELETE_FAILED",
target: e,
error: t
})
, d = e=>t=>(t({
type: "ACCOUNT_RECOVERY_SETTINGS_UPDATE",
target: "phone"
}),
s.a.undocumented().me().updateAccountRecoveryPhone(e.countryCode, e.number).then(()=>t(i("phone", e))).catch(e=>t((e=>o("phone", e))(e))))
, u = ()=>e=>(e({
type: "ACCOUNT_RECOVERY_SETTINGS_DELETE",
target: "phone"
}),
s.a.undocumented().me().deleteAccountRecoveryPhone().then(()=>e(c("phone"))).catch(t=>e((e=>l("phone", e))(t))))
, p = e=>t=>(t({
type: "ACCOUNT_RECOVERY_SETTINGS_UPDATE",
target: "email"
}),
s.a.undocumented().me().updateAccountRecoveryEmail(e).then(()=>t(i("email", e))).catch(e=>t((e=>o("email", e))(e))))
, m = ()=>e=>(e({
type: "ACCOUNT_RECOVERY_SETTINGS_DELETE",
target: "email"
}),
s.a.undocumented().me().deleteAccountRecoveryEmail().then(()=>e(c("email"))).catch(t=>e((e=>l("email", e))(t))))
, h = ()=>e=>(e({
type: "ACCOUNT_RECOVERY_SETTINGS_RESEND_VALIDATION",
target: "email"
}),
s.a.undocumented().me().newValidationAccountRecoveryEmail().then(()=>e({
type: "ACCOUNT_RECOVERY_SETTINGS_RESEND_VALIDATION_SUCCESS",
target: "email"
})).catch(t=>e((e=>({
type: "ACCOUNT_RECOVERY_SETTINGS_RESEND_VALIDATION_FAILED",
target: "email",
error: e
}))(t))))
, g = ()=>e=>(e({
type: "ACCOUNT_RECOVERY_SETTINGS_RESEND_VALIDATION",
target: "phone"
}),
s.a.undocumented().me().newValidationAccountRecoveryPhone().then(()=>e({
type: "ACCOUNT_RECOVERY_SETTINGS_RESEND_VALIDATION_SUCCESS",
target: "phone"
})).catch(t=>e((e=>({
type: "ACCOUNT_RECOVERY_SETTINGS_RESEND_VALIDATION_FAILED",
target: "phone",
error: e
}))(t))))
, b = e=>t=>(t({
type: "ACCOUNT_RECOVERY_SETTINGS_VALIDATE_PHONE"
}),
s.a.undocumented().me().validateAccountRecoveryPhone(Object(n.a)(e, /\s/g, "")).then(()=>t({
type: "ACCOUNT_RECOVERY_SETTINGS_VALIDATE_PHONE_SUCCESS"
})).catch(e=>t((e=>({
type: "ACCOUNT_RECOVERY_SETTINGS_VALIDATE_PHONE_FAILED",
error: e
}))(e))))
},
"./state/auth/actions.js": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return u
}
));
var n = a("./lib/i18n-utils/browser.js")
, s = a("../packages/i18n-calypso/dist/esm/index.js")
, r = a("./state/data-layer/wpcom-http/actions.js")
, i = a("./state/data-layer/wpcom-http/utils.js")
, o = a("./state/data-layer/handler-registry.js")
, c = a("./state/notices/actions.js")
, l = a("./state/analytics/actions/record-with-client-id.js")
, d = a("./config/index.js");
Object(o.b)("state/data-layer/wpcom/auth/send-login-email/index.js", {
LOGIN_EMAIL_SEND: [Object(i.a)({
fetch: e=>{
const {email: t, lang_id: a, locale: n, redirect_to: i, showGlobalNotices: o, loginFormFlow: u, requestLoginEmailFormFlow: p, isMobileAppLogin: m} = e
, h = o ? Object(c.c)(Object(s.f)("Sending email"), {
duration: 4e3
}) : null;
return [...o ? [h] : [], ...u || p ? [{
type: "MAGIC_LOGIN_REQUEST_LOGIN_EMAIL_FETCH"
}] : [], ...p ? [Object(l.b)("calypso_login_email_link_submit")] : [], ...u ? [Object(l.b)("calypso_login_block_login_form_send_magic_link")] : [], Object(r.a)({
path: "/auth/send-login-email",
method: "POST",
apiVersion: "1.2",
body: {
client_id: Object(d.a)("wpcom_signup_id"),
client_secret: Object(d.a)("wpcom_signup_key"),
...m && {
infer: !0
},
...m && {
scheme: "wordpress"
},
locale: n,
lang_id: a,
email: t,
...i && {
redirect_to: i
}
}
}, {
...e,
infoNoticeId: h ? h.notice.noticeId : null
})]
}
,
onSuccess: ({email: e, showGlobalNotices: t, infoNoticeId: a=null, loginFormFlow: n, requestLoginEmailFormFlow: r})=>[...n || r ? [{
type: "MAGIC_LOGIN_REQUEST_LOGIN_EMAIL_SUCCESS"
}, {
type: "MAGIC_LOGIN_SHOW_CHECK_YOUR_EMAIL_PAGE",
email: e
}] : [], ...r ? [Object(l.b)("calypso_login_email_link_success")] : [], ...n ? [Object(l.b)("calypso_login_block_login_form_send_magic_link_success")] : [], ...t ? [Object(c.e)(a), Object(c.f)(Object(s.f)("Email Sent. Check your mail app!"), {
duration: 4e3
})] : []],
onError: ({showGlobalNotices: e, infoNoticeId: t=null, loginFormFlow: a, requestLoginEmailFormFlow: n},r)=>[...a || n ? [{
type: "MAGIC_LOGIN_REQUEST_LOGIN_EMAIL_ERROR",
error: r.message
}] : [], ...n ? [Object(l.b)("calypso_login_email_link_failure", {
error_code: r.error,
error_message: r.message
})] : [], ...a ? [Object(l.b)("calypso_login_block_login_form_send_magic_link_failure", {
error_code: r.error,
error_message: r.message
})] : [], ...e ? [Object(c.e)(t), Object(c.b)(Object(s.f)("Sorry, we couldn’t send the email."), {
duration: 4e3
})] : []]
})]
});
const u = (e,{redirectTo: t, showGlobalNotices: a=!1, loginFormFlow: s=!1, requestLoginEmailFormFlow: r=!1, isMobileAppLogin: i=!1})=>{
const o = Object(n.g)();
return {
type: "LOGIN_EMAIL_SEND",
email: e,
locale: o,
lang_id: Object(n.c)(o).value,
redirect_to: t,
isMobileAppLogin: i,
showGlobalNotices: a,
loginFormFlow: s,
requestLoginEmailFormFlow: r
}
}
},
"./state/concierge/actions.js": function(e, t, a) {
"use strict";
a.d(t, "c", (function() {
return w
}
)),
a.d(t, "f", (function() {
return k
}
)),
a.d(t, "d", (function() {
return D
}
)),
a.d(t, "h", (function() {
return N
}
)),
a.d(t, "i", (function() {
return T
}
)),
a.d(t, "g", (function() {
return I
}
)),
a.d(t, "a", (function() {
return R
}
)),
a.d(t, "e", (function() {
return A
}
)),
a.d(t, "b", (function() {
return F
}
));
var n = a("./state/action-watchers/utils.js")
, s = a("../packages/i18n-calypso/dist/esm/index.js")
, r = a("./state/data-layer/wpcom-http/actions.js")
, i = a("./state/data-layer/wpcom-http/utils.js")
, o = a("./state/notices/actions.js")
, c = a("./me/concierge/constants.js")
, l = a("./lib/make-json-schema-parser/index.js")
, d = a("./state/data-layer/wpcom/concierge/schedules/appointments/book/schema.json")
, u = Object(l.c)(d)
, p = ({beginTimestamp: e, customerId: t, siteId: a, meta: n})=>({
begin_timestamp: Math.ceil(e / 1e3),
customer_id: t,
site_id: a,
meta: JSON.stringify(n)
})
, m = a("./state/analytics/actions/with-analytics.js")
, h = a("./state/analytics/actions/record.js")
, g = a("./state/data-layer/handler-registry.js");
const b = e=>{
switch (e) {
case c.b:
return Object(s.f)("This session is no longer available. Please select a different time.");
case c.a:
return Object(s.f)("You already have an upcoming appointment. A second can not be scheduled yet.");
default:
return Object(s.f)("We could not book your appointment. Please try again later.")
}
}
, f = ({type: e})=>{
const t = "CONCIERGE_APPOINTMENT_RESCHEDULE" === e ? "calypso_concierge_appointment_rescheduling_successful" : "calypso_concierge_appointment_booking_successful";
return Object(m.a)(Object(h.e)(t), I(c.f))
}
, _ = ({type: e},t)=>{
const a = "CONCIERGE_APPOINTMENT_RESCHEDULE" === e ? "calypso_concierge_appointment_rescheduling_error" : "calypso_concierge_appointment_booking_error";
return [Object(m.a)(Object(h.e)(a), I(c.h)), Object(o.b)(b(t.code))]
}
;
Object(g.b)("state/data-layer/wpcom/concierge/schedules/appointments/book/index.js", {
CONCIERGE_APPOINTMENT_CREATE: [Object(i.a)({
fetch: e=>[I(c.g), Object(r.a)({
method: "POST",
path: `/concierge/schedules/${e.scheduleId}/appointments`,
apiNamespace: "wpcom/v2",
body: p(e)
}, e)],
onSuccess: f,
onError: _,
fromApi: u
})]
});
var y = a("./state/data-layer/wpcom/concierge/schedules/appointments/cancel/schema.json")
, j = Object(l.c)(y);
Object(g.b)("state/data-layer/wpcom/concierge/schedules/appointments/cancel/index.js", {
CONCIERGE_APPOINTMENT_CANCEL: [Object(i.a)({
fetch: e=>[I(c.j), Object(r.a)({
method: "POST",
path: `/concierge/schedules/${e.scheduleId}/appointments/${e.appointmentId}/cancel`,
apiNamespace: "wpcom/v2",
body: {}
}, e)],
onSuccess: ()=>Object(m.a)(Object(h.e)("calypso_concierge_appointment_cancellation_successful"), I(c.i)),
onError: ()=>[Object(o.b)("We couldn't cancel your session, please try again later."), Object(m.a)(Object(h.e)("calypso_concierge_appointment_cancellation_error"), I(c.k))],
fromApi: j
})]
});
var v = a("./state/data-layer/wpcom-http/pipeline/retry-on-failure/policies.js")
, E = a("./state/data-layer/wpcom/concierge/schedules/appointments/detail/schema.json");
const $ = ({begin_timestamp: e, end_timestamp: t, schedule_id: a, ...n})=>({
beginTimestamp: 1e3 * e,
endTimestamp: 1e3 * t,
scheduleId: a,
...n
});
var C = Object(l.c)(E, $);
Object(g.b)("state/data-layer/wpcom/concierge/schedules/appointments/detail/index.js", {
CONCIERGE_APPOINTMENT_DETAILS_REQUEST: [Object(i.a)({
fetch: e=>{
const {appointmentId: t, scheduleId: a} = e;
return Object(r.a)({
method: "GET",
path: `/concierge/schedules/${a}/appointments/${t}/detail`,
apiNamespace: "wpcom/v2",
retryPolicy: Object(v.b)()
}, e)
}
,
onSuccess: ({appointmentId: e},t)=>k(e, t),
onError: ()=>Object(o.b)(Object(s.f)("We could not find your appointment. Please try again later.")),
fromApi: C
})]
});
var x = ({appointmentDetails: e, beginTimestamp: t})=>({
begin_timestamp: Math.ceil(t / 1e3),
meta: JSON.stringify(e.meta)
});
Object(g.b)("state/data-layer/wpcom/concierge/schedules/appointments/reschedule/index.js", {
CONCIERGE_APPOINTMENT_RESCHEDULE: [Object(i.a)({
fetch: e=>[I(c.g), Object(r.a)({
method: "POST",
path: `/concierge/schedules/${e.scheduleId}/appointments/${e.appointmentId}/reschedule`,
apiNamespace: "wpcom/v2",
body: x(e)
}, e)],
onSuccess: f,
onError: _,
fromApi: u
})]
});
Object(g.b)("state/data-layer/wpcom/concierge/schedules/appointments/index.js", Object(n.a)({}, {}, {}, {}));
Object(g.b)("state/data-layer/wpcom/concierge/schedules/index.js", Object(n.a)({}));
Object(g.b)("state/data-layer/wpcom/concierge/index.js", Object(n.a)({}));
var P = a("./state/data-layer/wpcom/concierge/initial/schema.json");
const O = e=>1e3 * e;
var S = Object(l.c)(P, e=>{
const t = null === e.next_appointment ? null : $(e.next_appointment);
return {
availableTimes: e.available_times.map(O),
appointmentTimespan: e.appointment_timespan,
nextAppointment: t,
scheduleId: e.schedule_id,
hasAvailableConciergeSessions: e.has_available_concierge_sessions
}
}
);
Object(g.b)("state/data-layer/wpcom/concierge/schedules/initial/index.js", {
CONCIERGE_INITIAL_REQUEST: [Object(i.a)({
fetch: e=>Object(r.a)({
method: "GET",
path: "/concierge/initial",
apiNamespace: "wpcom/v2",
query: {
site_id: e.siteId
}
}, e),
onSuccess: (e,t)=>N(t),
onError: ()=>Object(o.b)(Object(s.f)("We couldn't load our Concierge schedule. Please try again later.")),
fromApi: S
})]
});
a("./state/concierge/init.js");
const w = (e,t)=>({
type: "CONCIERGE_APPOINTMENT_DETAILS_REQUEST",
scheduleId: e,
appointmentId: t
})
, k = (e,t)=>({
type: "CONCIERGE_APPOINTMENT_DETAILS_UPDATE",
appointmentId: e,
appointmentDetails: t
})
, D = e=>({
type: "CONCIERGE_INITIAL_REQUEST",
siteId: e
})
, N = e=>({
type: "CONCIERGE_INITIAL_UPDATE",
initial: e
})
, T = e=>({
type: "CONCIERGE_SIGNUP_FORM_UPDATE",
signupForm: e
})
, I = e=>({
type: "CONCIERGE_UPDATE_BOOKING_STATUS",
status: e
})
, R = (e,t,a,n,s)=>({
type: "CONCIERGE_APPOINTMENT_CREATE",
scheduleId: e,
beginTimestamp: t,
customerId: a,
siteId: n,
meta: s
})
, A = (e,t,a,n)=>({
type: "CONCIERGE_APPOINTMENT_RESCHEDULE",
scheduleId: e,
appointmentId: t,
beginTimestamp: a,
appointmentDetails: n
})
, F = (e,t)=>({
type: "CONCIERGE_APPOINTMENT_CANCEL",
scheduleId: e,
appointmentId: t
})
},
"./state/concierge/init.js": function(e, t, a) {
"use strict";
var n = a("./state/redux-store.ts")
, s = a("./state/utils/reducer-utils.js")
, r = a("./state/utils/with-storage-key.js")
, i = a("./state/utils/without-persistence.js")
, o = a("./state/utils/keyed-reducer.js");
const c = Object(i.a)((e=null,t)=>{
switch (t.type) {
case "CONCIERGE_APPOINTMENT_DETAILS_REQUEST":
return null;
case "CONCIERGE_APPOINTMENT_DETAILS_UPDATE":
return t.appointmentDetails
}
return e
}
);
var l = Object(o.a)("appointmentId", c);
var d = Object(i.a)((e=null,t)=>{
switch (t.type) {
case "CONCIERGE_INITIAL_REQUEST":
return null;
case "CONCIERGE_INITIAL_UPDATE":
{
const {initial: e} = t;
return e.appointmentTimespan
}
}
return e
}
);
var u = Object(i.a)((e=null,t)=>{
switch (t.type) {
case "CONCIERGE_INITIAL_REQUEST":
return null;
case "CONCIERGE_INITIAL_UPDATE":
return t.initial.availableTimes
}
return e
}
);
var p = Object(i.a)((e=null,t)=>{
switch (t.type) {
case "CONCIERGE_INITIAL_REQUEST":
return null;
case "CONCIERGE_INITIAL_UPDATE":
return t.initial.nextAppointment
}
return e
}
)
, m = a("./lib/i18n-utils/guess-timezone.ts");
const h = Object(i.a)((e="",t)=>{
switch (t.type) {
case "CONCIERGE_SIGNUP_FORM_UPDATE":
return t.signupForm.message
}
return e
}
)
, g = Object(i.a)((e=Object(m.a)() || "UTC",t)=>{
switch (t.type) {
case "CONCIERGE_SIGNUP_FORM_UPDATE":
return t.signupForm.timezone
}
return e
}
)
, b = Object(i.a)((e=!1,t)=>{
switch (t.type) {
case "CONCIERGE_SIGNUP_FORM_UPDATE":
return t.signupForm.isRebrandCitiesSite
}
return e
}
)
, f = Object(i.a)((e="",t)=>{
switch (t.type) {
case "CONCIERGE_SIGNUP_FORM_UPDATE":
return t.signupForm.firstname
}
return e
}
)
, _ = Object(i.a)((e="",t)=>{
switch (t.type) {
case "CONCIERGE_SIGNUP_FORM_UPDATE":
return t.signupForm.lastname
}
return e
}
)
, y = Object(i.a)((e="",t)=>{
switch (t.type) {
case "CONCIERGE_SIGNUP_FORM_UPDATE":
return t.signupForm.phoneNumber
}
return e
}
)
, j = Object(i.a)((e="",t)=>{
switch (t.type) {
case "CONCIERGE_SIGNUP_FORM_UPDATE":
return t.signupForm.countryCode
}
return e
}
)
, v = Object(i.a)((e="",t)=>{
switch (t.type) {
case "CONCIERGE_SIGNUP_FORM_UPDATE":
return t.signupForm.phoneNumberWithoutCountryCode
}
return e
}
)
, E = Object(i.a)((e=null,t)=>{
switch (t.type) {
case "CONCIERGE_UPDATE_BOOKING_STATUS":
return t.status
}
return e
}
);
var $ = Object(s.a)({
firstname: f,
lastname: _,
message: h,
timezone: g,
status: E,
isRebrandCitiesSite: b,
phoneNumber: y,
countryCode: j,
phoneNumberWithoutCountryCode: v
});
var C = Object(i.a)((e=null,t)=>{
switch (t.type) {
case "CONCIERGE_INITIAL_REQUEST":
return null;
case "CONCIERGE_INITIAL_UPDATE":
{
const {initial: e} = t;
return e.scheduleId
}
}
return e
}
);
var x = Object(i.a)((e=null,t)=>{
switch (t.type) {
case "CONCIERGE_INITIAL_REQUEST":
return null;
case "CONCIERGE_INITIAL_UPDATE":
{
const {initial: e} = t;
return e.hasAvailableConciergeSessions
}
}
return e
}
);
const P = Object(s.a)({
appointmentDetails: l,
appointmentTimespan: d,
availableTimes: u,
nextAppointment: p,
signupForm: $,
scheduleId: C,
hasAvailableConciergeSessions: x
});
var O = Object(r.a)("concierge", P);
Object(n.a)(["concierge"], O)
},
"./state/country-states/init.js": function(e, t, a) {
"use strict";
var n = a("./state/redux-store.ts")
, s = a("./state/utils/schema-utils.js")
, r = a("./state/utils/without-persistence.js")
, i = a("./state/utils/reducer-utils.js")
, o = a("./state/utils/with-storage-key.js");
const c = Object(s.a)({
type: "object",
additionalProperties: !1,
patternProperties: {
"^[a-z]{2}$": {
type: "array",
items: {
type: "object",
properties: {
code: {
type: "string"
},
name: {
type: "string"
}
},
required: ["code", "name"]
}
}
}
}, (e={},t)=>{
switch (t.type) {
case "COUNTRY_STATES_RECEIVE":
return {
...e,
[t.countryCode]: t.countryStates
}
}
return e
}
)
, l = Object(r.a)((e={},t)=>{
switch (t.type) {
case "COUNTRY_STATES_REQUEST":
{
const {countryCode: a} = t;
return {
...e,
[a]: !0
}
}
case "COUNTRY_STATES_REQUEST_SUCCESS":
{
const {countryCode: a} = t;
return {
...e,
[a]: !1
}
}
case "COUNTRY_STATES_REQUEST_FAILURE":
{
const {countryCode: a} = t;
return {
...e,
[a]: !1
}
}
}
return e
}
)
, d = Object(i.a)({
isFetching: l,
items: c
});
var u = Object(o.a)("countryStates", d);
Object(n.a)(["countryStates"], u)
},
"./state/country-states/selectors.js": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return s
}
)),
a.d(t, "b", (function() {
return r
}
));
var n = a("../node_modules/lodash-es/get.js");
a("./state/country-states/init.js");
function s(e, t) {
return Object(n.a)(e.countryStates, ["items", t.toLowerCase()], null)
}
function r(e, t) {
return Object(n.a)(e.countryStates, ["isFetching", t.toLowerCase()], !1)
}
},
"./state/current-user/constants.js": function(e, t, a) {
"use strict";
a.d(t, "a", (function() {
return n
}
)),
a.d(t, "b", (function() {
return s
}
));
const n = "calypso_domains_with_plans_only"
, s = "calypso_allow_nonprimary_domains_without_plan"
},
"./state/current-user/email-verification/actions.js": function(e, t, a) {
"use strict";
a.d(t, "b", (function() {
return d
}
)),
a.d(t, "a", (function() {
return u
}
));
var n = a("./state/data-layer/wpcom-http/actions.js")
, s = a("./state/data-layer/wpcom-http/utils.js")
, r = a("./state/data-layer/handler-registry.js")
, i = a("../packages/i18n-calypso/dist/esm/index.js")
, o = a("./state/notices/actions.js");
const c = "email-verification-info-notice"
, l = Object(s.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment