diff --git a/assets/css/admin.css b/assets/css/admin.css new file mode 100644 index 0000000..04403c2 --- /dev/null +++ b/assets/css/admin.css @@ -0,0 +1,733 @@ +/* Import fonts */ +@import url('../fonts/Means/fonts.css'); +@import url('../fonts/graphik/fonts.css'); + +:root { + --mailchimp-color-text: #241c15; + --mailchimp-color-white: #fff; + --mailchimp-color-border: #ffe01b; + --mailchimp-color-header-bg: #fbeeca; + --mailchimp-color-link: #007c89; + --mailchimp-color-text-light: #373737; + --mailchimp-color-text-lightest: #5d5c5d; + --mailchimp-max-width: 56.25rem; /* 900 pixels */ +} + +.error_msg, +.success_msg, +.notes_msg, +table.mc-user, +.mc-list-row, +.mc-list-note, +.mc-section { + max-width: 900px; + width: 100%; +} + +/* Header */ +.mailchimp-header { + align-items: center; + background-color: var(--mailchimp-color-white); + border-top: 2px solid var(--mailchimp-color-border); + box-sizing: border-box; + display: flex; + gap: 1rem; + justify-content: space-between; + max-width: var(--mailchimp-max-width); + padding: 0.75rem 1rem; +} + +/* Sections */ +table.mc-widefat { + background: var(--mailchimp-color-white); + border: 2px solid var(--mailchimp-color-header-bg) !important; + border-radius: 6px; + margin: 2.75rem 0 2.25rem; +} + +table.mc-widefat tr:first-child { + background: var(--mailchimp-color-header-bg); +} + +table.mc-widefat tr:first-child th { + color: var(--mailchimp-color-text); + font-weight: 500; +} + +/* Buttons */ +#wpbody .button-secondary { + border-color: var(--mailchimp-color-link); + color: var(--mailchimp-color-link); +} + +.error_msg { + --mailchimp-error-bg: #fadbd5; + --mailchimp-error-border: #db3a1b; + background: var(--mailchimp-error-bg); + border: 1px solid var(--mailchimp-error-border); + border-radius: 6px; + box-sizing: border-box; + color: var(--mailchimp-color-text); + font-size: 0.75rem; + line-height: 1; + margin: 12px 0; + padding: 9px; +} + +.success_msg, +.notes_msg { + background: var(--mailchimp-color-header-bg); + border-radius: 6px; + box-sizing: border-box; + color: var(--mailchimp-color-text-light); + font-size: 0.75rem; + line-height: 1; + margin: 12px 0; + padding: 9px; +} + +/* User */ +table.mc-user { + margin-top: 19px; +} + +table.mc-user tr { + border: 1px solid var(--mailchimp-color-link); + border-radius: 38px; + float: right; + padding: 0px 11px; +} + +.mc-user td:first-of-type { + font-weight: 400 !important; + padding-right: 1rem; +} + +.mc-user td:last-of-type { + min-width: 75px; +} + +.mc-user h3 { + font-weight: 400; + text-indent: 9px; +} + +/* List Selection */ +.mc-list-row { + margin-bottom: 12px; +} + +.mc-list-row td:first-of-type { + min-width: 200px; + padding: 12px 12px 12px 0; +} + +.mc-list-row td:last-of-type { + padding: 12px 12px 12px 0; + width: 80px; +} + +.mc-list-note { + border-bottom: 2px solid var(--mailchimp-color-text); + color: var(--mailchimp-color-text-lightest); + font-size: 0.8125rem; + font-weight: 400; + margin-bottom: 8px; + margin-top: 7px; + padding: 0 0 18px; +} + +table.mc-list-select { + margin-bottom: -40px; +} + +/* Headings */ +.mailchimp-header h1 { + font-weight: 600; + margin: 0.75em 0; + padding: 0; +} + +.mailchimp-header h1, +.mc-h2, +.mc-h3, +.mc-p { + color: var(--mailchimp-color-text); +} + +.mc-h2 { + font-size: 1.625rem; + margin-bottom: 0; + font-weight: 400; +} + +.mc-h3 { + border-bottom: 2px solid var(--mailchimp-color-text); + font-size: 1.125rem; + margin-bottom: 12px; + margin-top: 36px; + padding-bottom: 12px; +} + +.mc-p { + font-size: 1rem; + font-weight: 400; + margin-bottom: 0; +} + +.mc-p a { + color: var(--mailchimp-color-link); + font-weight: 400; +} + +/* Table */ +table.mc-widefat td, +table.mc-widefat th { + padding: 18px; + text-align: left; + text-shadow: none; +} + +table.mc-widefat .last-row td, +table.mc-widefat .last-row th { + border-bottom: none !important; +} + +table.mc-widefat th { + color: var(--mailchimp-color-text-light) !important; + font-weight: 500; + width: 130px; +} + +table.mc-widefat td label { + display: block; + font-size: 0.75rem; + font-style: normal; + margin-top: -17px; + padding-left: 24px; +} + +table.mc-widefat td { + color: var(--mailchimp-color-text-lightest) !important; + font-size: 0.75rem; + line-height: 1.125 !important; +} + +table.mc-widefat td input { + display: inline-block; + font-style: normal; +} + +table.mc-widefat.mc-api { + border-radius: 6px; + margin-bottom: 19px; + margin-top: 19px; +} + +table.mc-widefat.mc-api td, +table.mc-widefat.mc-api th { + border-bottom: none !important; +} + +table.mc-widefat.mc-api tr:first-child { + background: var(--mailchimp-color-header-bg) !important; +} + +a.mc-api-key { + color: var(--mailchimp-color-white); + display: block; + margin-top: 3px; +} + +a.mc-api-key:hover { + color: var(--mailchimp-color-white); + text-decoration: underline; +} + +.mc-api-submit { + margin-bottom: 19px; +} + +.mc-submit { + clear: both; + float: right; +} + +th.mailchimp-connect { + width: 100% !important; +} + +#mc-message { + margin-top: 26px; +} + +/** + * Mailchimp OAuth CSS + */ +.mailchimp-sf-oauth-error { + color: #a73205; + margin-bottom: 0px; + font-size: 14px; + font-weight: 500; +} + +.mailchimp-sf-oauth-connect-wrapper { + display: flex; + gap: 16px; +} + +#mailchimp-sf-settings-page { + font-family: 'Graphik Mailchimp Web', ui-sans-serif, system-ui, sans-serif; +} + +#mailchimp-sf-settings-page .flex { + display:flex; +} + +#mailchimp-sf-settings-page .gap-x-6 { + column-gap: 32px; +} + +#mailchimp-sf-settings-page .gap-x-2 { + column-gap: 8px; +} + +#mailchimp-sf-settings-page .justify-between { + justify-content: space-between; +} + +#mailchimp-sf-settings-page .items-center { + align-items: center; +} + +#mailchimp-sf-settings-page .opacity-25 { + opacity: 0.25; +} + +#mailchimp-sf-settings-page .opacity-75 { + opacity: 0.75; +} + +#mailchimp-sf-settings-page .mailchimp-sf-loading { + animation: spin 1s linear infinite; +} + +#mailchimp-sf-settings-page .mailchimp-sf-loading svg { + display: block; +} + +#mailchimp-sf-settings-page .wizard-steps { + color: rgba(36, 28, 21); + font-size: 13px; + line-height: 18px; + margin-top: 4px; +} + +#mailchimp-sf-settings-page .wizard-steps .deselected { + color: rgba(36, 28, 21, 0.3); +} + +#mailchimp-sf-settings-page .wizard-steps .current { + color: rgba(36, 28, 21); + border-bottom: 2px solid rgb(0, 124, 137); +} + +#mailchimp-sf-settings-page .wizard-steps .chevron { + margin: 0 5px; +} + +#mailchimp-sf-settings-page .wizard-steps .chevron svg { + display: block; +} + +@keyframes spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} + +.mailchimp-sf-header { + padding: 14px 12px; + background: #fff; + border-top: 4px solid var(--mailchimp-color-border); + border-bottom: 1px solid rgba(36, 28, 21, 0.15); + column-gap: 34px; + margin-left: -20px; +} + +.mailchimp-sf-header h3 { + font-family: "Means Web", serif; + margin-bottom: 0px; + margin-top: 0px; + font-weight: 400; + font-size: 20px; + line-height: 1.2em; +} + +.mailchimp-sf-header .logo { + margin: 2px 0px; +} + +.mailchimp-sf-header .mailchimp-sf-create-account-plus { + margin: 0px 10px; + font-family: "Means Web", serif; + font-size: 44px; + color: #8C8C8C; + font-weight: 300; +} + +body.admin_page_mailchimp_sf_create_account, +body.toplevel_page_mailchimp_sf_options { + background-color: #F6F6F4; + font-family: 'Graphik Mailchimp Web', ui-sans-serif, system-ui, sans-serif; +} + +body.admin_page_mailchimp_sf_create_account a, +body.toplevel_page_mailchimp_sf_options a { + color: var(--mailchimp-color-link); +} + +body.admin_page_mailchimp_sf_create_account #footer-upgrade, +body.toplevel_page_mailchimp_sf_options #footer-upgrade { + display: none; +} + +.mailchimp-sf-create-account__body-inner { + max-width: 600px; + margin: 0 auto; + padding: 70px 12px 120px 12px; +} + +.mailchimp-sf-content-box-wrapper { + width: 100%; + max-width: 504px; + margin: 0 auto; + padding-top: 48px; + padding-bottom: 120px; +} + +.mailchimp-sf-content-box { + background-color: #ffffff; + border-radius: 12px; + border: 1px solid rgba(36, 28, 21, 0.15); + padding: 52px 64px; +} + +#mailchimp-sf-settings-page .email-opener { + font-size: 16px; + line-height: 24px; + font-weight: 500; + text-decoration: underline; +} + +#mailchimp-sf-settings-page .h4 { + font-size: 16px; + margin: 0; + margin-bottom: 32px; + font-weight: 400; +} + +#mailchimp-sf-settings-page .mailchimp-sf-email { + font-weight: 500; +} + +#mailchimp-sf-settings-page .title { + font-family: "Means Web", serif; + font-size: 32px; + font-weight: 400; + line-height: 1.25em; + margin-bottom: 32px; +} + +#mailchimp-sf-settings-page .mailchimp-sf-content-box .title { + margin-bottom: 16px; +} + +#mailchimp-sf-settings-page .subtitle { + font-family: "Means Web", serif; + font-size: 20px; + line-height: 1.2em; + font-weight: 400; + padding-left: 0; + margin-bottom: 16px; + color: #000; +} + +.mailchimp-sf-create-account-step { + padding: 4px 0px 10px 0px; +} + +#mailchimp-sf-business-address { + margin-top: 36px; +} + +.button.mailchimp-sf-button { + all: unset; + box-sizing: border-box; + display: inline-flex; + align-items: center; + gap: 10px; + padding: 12px 32px; + position: relative; + background-color: var(--mailchimp-color-link); + border-radius: 38px; + font-weight: 500; + color: #ffffff; + font-size: 13px; + text-align: center; + letter-spacing: 0; + line-height: 20px; + white-space: nowrap; + cursor: pointer; +} + +.button.mailchimp-sf-button.button-secondary { + color: var(--mailchimp-color-link); + background-color: #fff; + border: 1px solid var(--mailchimp-color-link); +} + +.button.mailchimp-sf-button:hover, +.button.mailchimp-sf-button:focus, +.button.mailchimp-sf-button:active { + color: #ffffff; + background-color: #006570; + text-decoration: none; +} + +.button.mailchimp-sf-button:focus { + box-shadow: 0 0 0 1px #fff, 0 0 0 3px #006570; +} + +.button.mailchimp-sf-button.button-secondary:hover, +.button.mailchimp-sf-button.button-secondary:focus, +.button.mailchimp-sf-button.button-secondary:active, +.button.mailchimp-sf-button.button-secondary.small:hover, +.button.mailchimp-sf-button.button-secondary.small:focus, +.button.mailchimp-sf-button.button-secondary.small:active { + color: var(--mailchimp-color-link); + background-color: #f6f7f7; +} + +.button.mailchimp-sf-button[disabled] { + cursor: not-allowed; +} + +.button.mailchimp-sf-button.small { + padding: 8px 16px; + line-height: 14px; + float: right; + clear: both; +} + +.button.mailchimp-sf-button.button-secondary.small { + background-color: transparent; +} + +.mailchimp-sf-create-account__body .mailchimp-sf-confirm-email a { + color: var(--mailchimp-color-link); +} + +.mailchimp-sf-create-account__body .terms a { + color: var(--mailchimp-color-link); + font-weight: 500; + text-decoration: none; +} + +.mailchimp-sf-create-account__body .terms p { + font-size: 16px; + line-height: 1.25em; + font-weight: 400; + color: var(--mailchimp-color-text); +} + +.mailchimp-sf-create-account__body .terms p:last-child { + margin-bottom: 32px; +} + +.mailchimp-sf-create-account__body .terms a:hover { + text-decoration: underline; +} + +.mailchimp-sf-form-wrapper fieldset{ + background: transparent; + width: 100%; +} + +.mailchimp-sf-form-wrapper span.optional, +.mailchimp-sf-form-wrapper p.help-text { + font-size: 16px; + line-height: 1.5em; + font-weight: 400; + color: rgba(36, 28, 21, 0.65); + margin-bottom: 0px; +} + +.mailchimp-sf-form-wrapper label { + display: block; + font-family: 'Graphik Mailchimp Web', ui-sans-serif, system-ui, sans-serif; + font-size: 16px; + font-weight: 500; + line-height: 1.5em; + width: 100%; + color: var(--mailchimp-color-text); + margin-bottom: 8px; +} + +.mailchimp-sf-form-wrapper .box.box-half { + float: left; + clear: none; + width: 50%; +} + +.mailchimp-sf-form-wrapper .form-row { + display: flex; + column-gap: 16px; +} + +.mailchimp-sf-form-wrapper .form-row:not(:last-child) { + margin-bottom: 16px; +} + +.mailchimp-sf-form-wrapper .form-row .box { + width: 100%; +} + +.mailchimp-sf-form-wrapper .form-row .box-half { + width: calc(50% - 8px); +} + +.mailchimp-sf-form-wrapper fieldset input[type="text"], +.mailchimp-sf-form-wrapper fieldset input[type="password"], +.mailchimp-sf-form-wrapper fieldset input[type="email"], +.mailchimp-sf-form-wrapper fieldset textarea { + box-sizing: border-box; + height: 44px; + border: 1px solid rgba(36, 28, 21, 0.65); + border-radius: 4px; + padding: 10px 16px; + width: 100%; + font-family: 'Graphik Mailchimp Web', ui-sans-serif, system-ui, sans-serif; + font-size: 16px; + color: #000; + line-height: 1.5em; + font-weight: 400; +} + +.mailchimp-sf-form-wrapper fieldset input[type="text"]:focus, +.mailchimp-sf-form-wrapper fieldset input[type="password"]:focus, +.mailchimp-sf-form-wrapper fieldset input[type="email"]:focus, +.mailchimp-sf-form-wrapper fieldset textarea:focus { + border-color: var(--mailchimp-color-link); + box-shadow: inset 0 0 0 1px var(--mailchimp-color-link); +} + +.mailchimp-sf-form-wrapper .mailchimp-select-wrapper select { + font-size: 16px; + line-height: 1.5em; + font-family: 'Graphik Mailchimp Web', ui-sans-serif, system-ui, sans-serif; + font-weight: 400; + -webkit-appearance: none; + box-shadow: none; + outline: none; + width: 100% !important; + max-width: 100%; + border: 1px solid rgba(36, 28, 21, 0.65); + color: #000; + padding: 10px 14px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + background-color: white; + height: 44px; + background-size: auto; +} + +.mailchimp-sf-form-wrapper .mailchimp-select-wrapper select option{ + outline: none; +} + +.mailchimp-sf-form-wrapper fieldset select:focus { + outline: none; +} + + +.mailchimp-sf-form-wrapper .box.form-error label, +.mailchimp-sf-form-wrapper .box.form-error { + color: #a73205; +} +.mailchimp-sf-form-wrapper .box.form-error p.error-field { + margin-bottom: 0px; + font-size: 14px; + font-weight: 500; +} + +.mailchimp-sf-form-wrapper .box.form-error input, +.mailchimp-sf-form-wrapper .box.form-error select { + border-color: #a73205; + box-shadow: inset 0 0 0 1px #a73205; +} + +.mailchimp-sf-form-wrapper .error-field:empty, #mailchimp-sf-settings-page p.error-message:empty { + display: none !important; +} + +.mailchimp-sf-confirm-email .email-opener-wrapper { + margin-bottom: 120px; +} + +.mailchimp-sf-confirm-email .mailchimp-sf-confirm-email-footer p{ + font-size: 16px; + font-weight: 500; + line-height: 24px; + color: var(--mailchimp-color-text); +} + +#mailchimp-sf-popup-blocked-modal { + padding: 10px 28px; +} + +#mailchimp-sf-popup-blocked-modal p { + font-size: 16px; + font-weight: 400; + line-height: 24px; + color: var(--mailchimp-color-text); + font-family: 'Graphik Mailchimp Web', ui-sans-serif, system-ui, sans-serif; +} + +.mailchimp-sf-ui-dialog { + border-radius: 12px; + border: 1px solid rgba(36, 28, 21, 0.15); +} + +.mailchimp-sf-ui-dialog-titlebar { + font-family: "Means Web", serif; + font-weight: 500; + padding: 10px 28px; + font-size: 24px; + height: auto; +} + +@media screen and (max-width: 782px) { + .mailchimp-sf-header { + margin-left: -10px; + } +} + +@media screen and (max-width: 480px) { + .mailchimp-sf-form-wrapper .form-row { + flex-flow: column; + row-gap: 16px; + } + + .mailchimp-sf-form-wrapper .form-row .box.box-half { + width: 100%; + } + + .mailchimp-sf-header { + column-gap: 16px; + } +} diff --git a/css/flick/flick.css b/assets/css/flick/flick.css similarity index 100% rename from css/flick/flick.css rename to assets/css/flick/flick.css diff --git a/css/flick/images/ui-bg_flat_0_aaaaaa_40x100.png b/assets/css/flick/images/ui-bg_flat_0_aaaaaa_40x100.png similarity index 100% rename from css/flick/images/ui-bg_flat_0_aaaaaa_40x100.png rename to assets/css/flick/images/ui-bg_flat_0_aaaaaa_40x100.png diff --git a/css/flick/images/ui-bg_flat_0_eeeeee_40x100.png b/assets/css/flick/images/ui-bg_flat_0_eeeeee_40x100.png similarity index 100% rename from css/flick/images/ui-bg_flat_0_eeeeee_40x100.png rename to assets/css/flick/images/ui-bg_flat_0_eeeeee_40x100.png diff --git a/css/flick/images/ui-bg_flat_55_ffffff_40x100.png b/assets/css/flick/images/ui-bg_flat_55_ffffff_40x100.png similarity index 100% rename from css/flick/images/ui-bg_flat_55_ffffff_40x100.png rename to assets/css/flick/images/ui-bg_flat_55_ffffff_40x100.png diff --git a/css/flick/images/ui-bg_flat_75_ffffff_40x100.png b/assets/css/flick/images/ui-bg_flat_75_ffffff_40x100.png similarity index 100% rename from css/flick/images/ui-bg_flat_75_ffffff_40x100.png rename to assets/css/flick/images/ui-bg_flat_75_ffffff_40x100.png diff --git a/css/flick/images/ui-bg_glass_65_ffffff_1x400.png b/assets/css/flick/images/ui-bg_glass_65_ffffff_1x400.png similarity index 100% rename from css/flick/images/ui-bg_glass_65_ffffff_1x400.png rename to assets/css/flick/images/ui-bg_glass_65_ffffff_1x400.png diff --git a/css/flick/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png b/assets/css/flick/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png similarity index 100% rename from css/flick/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png rename to assets/css/flick/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png diff --git a/css/flick/images/ui-bg_highlight-soft_25_0073ea_1x100.png b/assets/css/flick/images/ui-bg_highlight-soft_25_0073ea_1x100.png similarity index 100% rename from css/flick/images/ui-bg_highlight-soft_25_0073ea_1x100.png rename to assets/css/flick/images/ui-bg_highlight-soft_25_0073ea_1x100.png diff --git a/css/flick/images/ui-bg_highlight-soft_50_dddddd_1x100.png b/assets/css/flick/images/ui-bg_highlight-soft_50_dddddd_1x100.png similarity index 100% rename from css/flick/images/ui-bg_highlight-soft_50_dddddd_1x100.png rename to assets/css/flick/images/ui-bg_highlight-soft_50_dddddd_1x100.png diff --git a/css/flick/images/ui-icons_0073ea_256x240.png b/assets/css/flick/images/ui-icons_0073ea_256x240.png similarity index 100% rename from css/flick/images/ui-icons_0073ea_256x240.png rename to assets/css/flick/images/ui-icons_0073ea_256x240.png diff --git a/css/flick/images/ui-icons_454545_256x240.png b/assets/css/flick/images/ui-icons_454545_256x240.png similarity index 100% rename from css/flick/images/ui-icons_454545_256x240.png rename to assets/css/flick/images/ui-icons_454545_256x240.png diff --git a/css/flick/images/ui-icons_666666_256x240.png b/assets/css/flick/images/ui-icons_666666_256x240.png similarity index 100% rename from css/flick/images/ui-icons_666666_256x240.png rename to assets/css/flick/images/ui-icons_666666_256x240.png diff --git a/css/flick/images/ui-icons_ff0084_256x240.png b/assets/css/flick/images/ui-icons_ff0084_256x240.png similarity index 100% rename from css/flick/images/ui-icons_ff0084_256x240.png rename to assets/css/flick/images/ui-icons_ff0084_256x240.png diff --git a/css/flick/images/ui-icons_ffffff_256x240.png b/assets/css/flick/images/ui-icons_ffffff_256x240.png similarity index 100% rename from css/flick/images/ui-icons_ffffff_256x240.png rename to assets/css/flick/images/ui-icons_ffffff_256x240.png diff --git a/css/images/mailchimp-header.png b/assets/css/images/mailchimp-header.png similarity index 100% rename from css/images/mailchimp-header.png rename to assets/css/images/mailchimp-header.png diff --git a/assets/fonts/Means/Means-Bold-Web.woff b/assets/fonts/Means/Means-Bold-Web.woff new file mode 100644 index 0000000..43c9bb9 Binary files /dev/null and b/assets/fonts/Means/Means-Bold-Web.woff differ diff --git a/assets/fonts/Means/Means-Bold-Web.woff2 b/assets/fonts/Means/Means-Bold-Web.woff2 new file mode 100644 index 0000000..9744467 Binary files /dev/null and b/assets/fonts/Means/Means-Bold-Web.woff2 differ diff --git a/assets/fonts/Means/Means-BoldItalic-Web.woff b/assets/fonts/Means/Means-BoldItalic-Web.woff new file mode 100644 index 0000000..d2c69ba Binary files /dev/null and b/assets/fonts/Means/Means-BoldItalic-Web.woff differ diff --git a/assets/fonts/Means/Means-BoldItalic-Web.woff2 b/assets/fonts/Means/Means-BoldItalic-Web.woff2 new file mode 100644 index 0000000..f0a4f17 Binary files /dev/null and b/assets/fonts/Means/Means-BoldItalic-Web.woff2 differ diff --git a/assets/fonts/Means/Means-Light-Web.woff b/assets/fonts/Means/Means-Light-Web.woff new file mode 100644 index 0000000..17be1cc Binary files /dev/null and b/assets/fonts/Means/Means-Light-Web.woff differ diff --git a/assets/fonts/Means/Means-Light-Web.woff2 b/assets/fonts/Means/Means-Light-Web.woff2 new file mode 100644 index 0000000..10a17f0 Binary files /dev/null and b/assets/fonts/Means/Means-Light-Web.woff2 differ diff --git a/assets/fonts/Means/Means-LightItalic-Web.woff b/assets/fonts/Means/Means-LightItalic-Web.woff new file mode 100644 index 0000000..47954ef Binary files /dev/null and b/assets/fonts/Means/Means-LightItalic-Web.woff differ diff --git a/assets/fonts/Means/Means-LightItalic-Web.woff2 b/assets/fonts/Means/Means-LightItalic-Web.woff2 new file mode 100644 index 0000000..6b68f7c Binary files /dev/null and b/assets/fonts/Means/Means-LightItalic-Web.woff2 differ diff --git a/assets/fonts/Means/Means-Medium-Web.woff b/assets/fonts/Means/Means-Medium-Web.woff new file mode 100644 index 0000000..58c44e1 Binary files /dev/null and b/assets/fonts/Means/Means-Medium-Web.woff differ diff --git a/assets/fonts/Means/Means-MediumItalic-Web.woff2 b/assets/fonts/Means/Means-MediumItalic-Web.woff2 new file mode 100644 index 0000000..657b818 Binary files /dev/null and b/assets/fonts/Means/Means-MediumItalic-Web.woff2 differ diff --git a/assets/fonts/Means/Means-Regular-Web.woff b/assets/fonts/Means/Means-Regular-Web.woff new file mode 100644 index 0000000..31d70b1 Binary files /dev/null and b/assets/fonts/Means/Means-Regular-Web.woff differ diff --git a/assets/fonts/Means/Means-Regular-Web.woff2 b/assets/fonts/Means/Means-Regular-Web.woff2 new file mode 100644 index 0000000..cb4b65b Binary files /dev/null and b/assets/fonts/Means/Means-Regular-Web.woff2 differ diff --git a/assets/fonts/Means/Means-RegularItalic-Web.woff b/assets/fonts/Means/Means-RegularItalic-Web.woff new file mode 100644 index 0000000..d0945b9 Binary files /dev/null and b/assets/fonts/Means/Means-RegularItalic-Web.woff differ diff --git a/assets/fonts/Means/Means-RegularItalic-Web.woff2 b/assets/fonts/Means/Means-RegularItalic-Web.woff2 new file mode 100644 index 0000000..cff47d9 Binary files /dev/null and b/assets/fonts/Means/Means-RegularItalic-Web.woff2 differ diff --git a/assets/fonts/Means/fonts.css b/assets/fonts/Means/fonts.css new file mode 100644 index 0000000..f77fb6b --- /dev/null +++ b/assets/fonts/Means/fonts.css @@ -0,0 +1,132 @@ +/* + This font software is the property of Commercial Type. + + You may not modify the font software, use it on another website, or install it on a computer. + + License information is available at http://commercialtype.com/eula + For more information please visit Commercial Type at http://commercialtype.com or email us at info[at]commercialtype.com + + Copyright (C) 2016 Schwartzco Inc. + +*/ + + +.Means-Light-Web { + font-family: "Means Web"; + font-weight: 300; + font-style: normal; + font-stretch: normal; +} + +.Means-LightItalic-Web { + font-family: "Means Web"; + font-weight: 300; + font-style: italic; + font-stretch: normal; +} + +.Means-Regular-Web { + font-family: "Means Web"; + font-weight: 400; + font-style: normal; + font-stretch: normal; +} + +.Means-RegularItalic-Web { + font-family: "Means Web"; + font-weight: 400; + font-style: italic; + font-stretch: normal; +} + +.Means-Medium-Web { + font-family: "Means Web"; + font-weight: 500; + font-style: normal; + font-stretch: normal; +} + +.Means-MediumItalic-Web { + font-family: "Means Web"; + font-weight: 500; + font-style: italic; + font-stretch: normal; +} + +.Means-Bold-Web { + font-family: "Means Web"; + font-weight: 700; + font-style: normal; + font-stretch: normal; +} + +.Means-BoldItalic-Web { + font-family: "Means Web"; + font-weight: 700; + font-style: italic; + font-stretch: normal; +} + +@font-face { + font-family: "Means Web"; + src: url("Means-Light-Web.woff2") format("woff2"), + url("Means-Light-Web.woff") format("woff"); + font-weight: 300; + font-style: normal; + } + +@font-face { + font-family: "Means Web"; + src: url("Means-LightItalic-Web.woff2") format("woff2"), + url("Means-LightItalic-Web.woff") format("woff"); + font-weight: 300; + font-style: italic; + } + +@font-face { + font-family: "Means Web"; + src: url("Means-Regular-Web.woff2") format("woff2"), + url("Means-Regular-Web.woff") format("woff"); + font-weight: 400; + font-style: normal; + } + +@font-face { + font-family: "Means Web"; + src: url("Means-RegularItalic-Web.woff2") format("woff2"), + url("Means-RegularItalic-Web.woff") format("woff"); + font-weight: 400; + font-style: italic; + } + +@font-face { + font-family: "Means Web"; + src: url("Means-Medium-Web.woff2") format("woff2"), + url("Means-Medium-Web.woff") format("woff"); + font-weight: 500; + font-style: normal; + } + +@font-face { + font-family: "Means Web"; + src: url("Means-MediumItalic-Web.woff2") format("woff2"), + url("Means-MediumItalic-Web.woff") format("woff"); + font-weight: 500; + font-style: italic; + } + +@font-face { + font-family: "Means Web"; + src: url("Means-Bold-Web.woff2") format("woff2"), + url("Means-Bold-Web.woff") format("woff"); + font-weight: 700; + font-style: normal; + } + +@font-face { + font-family: "Means Web"; + src: url("Means-BoldItalic-Web.woff2") format("woff2"), + url("Means-BoldItalic-Web.woff") format("woff"); + font-weight: 700; + font-style: italic; + } \ No newline at end of file diff --git a/assets/fonts/graphik/GraphikMailchimp-Black-Web.woff b/assets/fonts/graphik/GraphikMailchimp-Black-Web.woff new file mode 100644 index 0000000..63e0e3a Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-Black-Web.woff differ diff --git a/assets/fonts/graphik/GraphikMailchimp-Black-Web.woff2 b/assets/fonts/graphik/GraphikMailchimp-Black-Web.woff2 new file mode 100644 index 0000000..105e798 Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-Black-Web.woff2 differ diff --git a/assets/fonts/graphik/GraphikMailchimp-BlackItalic-Web.woff b/assets/fonts/graphik/GraphikMailchimp-BlackItalic-Web.woff new file mode 100644 index 0000000..d9ec814 Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-BlackItalic-Web.woff differ diff --git a/assets/fonts/graphik/GraphikMailchimp-BlackItalic-Web.woff2 b/assets/fonts/graphik/GraphikMailchimp-BlackItalic-Web.woff2 new file mode 100644 index 0000000..eebf6ad Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-BlackItalic-Web.woff2 differ diff --git a/assets/fonts/graphik/GraphikMailchimp-Bold-Web.woff b/assets/fonts/graphik/GraphikMailchimp-Bold-Web.woff new file mode 100644 index 0000000..0e533df Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-Bold-Web.woff differ diff --git a/assets/fonts/graphik/GraphikMailchimp-Bold-Web.woff2 b/assets/fonts/graphik/GraphikMailchimp-Bold-Web.woff2 new file mode 100644 index 0000000..cf7f3d6 Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-Bold-Web.woff2 differ diff --git a/assets/fonts/graphik/GraphikMailchimp-BoldItalic-Web.woff b/assets/fonts/graphik/GraphikMailchimp-BoldItalic-Web.woff new file mode 100644 index 0000000..8e83d85 Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-BoldItalic-Web.woff differ diff --git a/assets/fonts/graphik/GraphikMailchimp-BoldItalic-Web.woff2 b/assets/fonts/graphik/GraphikMailchimp-BoldItalic-Web.woff2 new file mode 100644 index 0000000..6638fbb Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-BoldItalic-Web.woff2 differ diff --git a/assets/fonts/graphik/GraphikMailchimp-Extralight-Web.woff b/assets/fonts/graphik/GraphikMailchimp-Extralight-Web.woff new file mode 100644 index 0000000..2afd56b Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-Extralight-Web.woff differ diff --git a/assets/fonts/graphik/GraphikMailchimp-Extralight-Web.woff2 b/assets/fonts/graphik/GraphikMailchimp-Extralight-Web.woff2 new file mode 100644 index 0000000..0e40a65 Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-Extralight-Web.woff2 differ diff --git a/assets/fonts/graphik/GraphikMailchimp-ExtralightItalic-Web.woff b/assets/fonts/graphik/GraphikMailchimp-ExtralightItalic-Web.woff new file mode 100644 index 0000000..25a3035 Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-ExtralightItalic-Web.woff differ diff --git a/assets/fonts/graphik/GraphikMailchimp-ExtralightItalic-Web.woff2 b/assets/fonts/graphik/GraphikMailchimp-ExtralightItalic-Web.woff2 new file mode 100644 index 0000000..246811a Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-ExtralightItalic-Web.woff2 differ diff --git a/assets/fonts/graphik/GraphikMailchimp-Light-Web.woff b/assets/fonts/graphik/GraphikMailchimp-Light-Web.woff new file mode 100644 index 0000000..e84dba0 Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-Light-Web.woff differ diff --git a/assets/fonts/graphik/GraphikMailchimp-Light-Web.woff2 b/assets/fonts/graphik/GraphikMailchimp-Light-Web.woff2 new file mode 100644 index 0000000..81da217 Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-Light-Web.woff2 differ diff --git a/assets/fonts/graphik/GraphikMailchimp-LightItalic-Web.woff b/assets/fonts/graphik/GraphikMailchimp-LightItalic-Web.woff new file mode 100644 index 0000000..bfbdc38 Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-LightItalic-Web.woff differ diff --git a/assets/fonts/graphik/GraphikMailchimp-LightItalic-Web.woff2 b/assets/fonts/graphik/GraphikMailchimp-LightItalic-Web.woff2 new file mode 100644 index 0000000..3dc64c4 Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-LightItalic-Web.woff2 differ diff --git a/assets/fonts/graphik/GraphikMailchimp-Medium-Web.woff b/assets/fonts/graphik/GraphikMailchimp-Medium-Web.woff new file mode 100644 index 0000000..9363ba5 Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-Medium-Web.woff differ diff --git a/assets/fonts/graphik/GraphikMailchimp-Medium-Web.woff2 b/assets/fonts/graphik/GraphikMailchimp-Medium-Web.woff2 new file mode 100644 index 0000000..b5ca200 Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-Medium-Web.woff2 differ diff --git a/assets/fonts/graphik/GraphikMailchimp-MediumItalic-Web.woff b/assets/fonts/graphik/GraphikMailchimp-MediumItalic-Web.woff new file mode 100644 index 0000000..1a4462e Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-MediumItalic-Web.woff differ diff --git a/assets/fonts/graphik/GraphikMailchimp-MediumItalic-Web.woff2 b/assets/fonts/graphik/GraphikMailchimp-MediumItalic-Web.woff2 new file mode 100644 index 0000000..6658900 Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-MediumItalic-Web.woff2 differ diff --git a/assets/fonts/graphik/GraphikMailchimp-Regular-Web.woff b/assets/fonts/graphik/GraphikMailchimp-Regular-Web.woff new file mode 100644 index 0000000..267a260 Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-Regular-Web.woff differ diff --git a/assets/fonts/graphik/GraphikMailchimp-Regular-Web.woff2 b/assets/fonts/graphik/GraphikMailchimp-Regular-Web.woff2 new file mode 100644 index 0000000..6d43b11 Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-Regular-Web.woff2 differ diff --git a/assets/fonts/graphik/GraphikMailchimp-RegularItalic-Web.woff b/assets/fonts/graphik/GraphikMailchimp-RegularItalic-Web.woff new file mode 100644 index 0000000..f117e28 Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-RegularItalic-Web.woff differ diff --git a/assets/fonts/graphik/GraphikMailchimp-RegularItalic-Web.woff2 b/assets/fonts/graphik/GraphikMailchimp-RegularItalic-Web.woff2 new file mode 100644 index 0000000..1fdcc90 Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-RegularItalic-Web.woff2 differ diff --git a/assets/fonts/graphik/GraphikMailchimp-Semibold-Web.woff b/assets/fonts/graphik/GraphikMailchimp-Semibold-Web.woff new file mode 100644 index 0000000..7956bfa Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-Semibold-Web.woff differ diff --git a/assets/fonts/graphik/GraphikMailchimp-Semibold-Web.woff2 b/assets/fonts/graphik/GraphikMailchimp-Semibold-Web.woff2 new file mode 100644 index 0000000..7b5fa1a Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-Semibold-Web.woff2 differ diff --git a/assets/fonts/graphik/GraphikMailchimp-SemiboldItalic-Web.woff b/assets/fonts/graphik/GraphikMailchimp-SemiboldItalic-Web.woff new file mode 100644 index 0000000..8867ee4 Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-SemiboldItalic-Web.woff differ diff --git a/assets/fonts/graphik/GraphikMailchimp-SemiboldItalic-Web.woff2 b/assets/fonts/graphik/GraphikMailchimp-SemiboldItalic-Web.woff2 new file mode 100644 index 0000000..24dc12a Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-SemiboldItalic-Web.woff2 differ diff --git a/assets/fonts/graphik/GraphikMailchimp-Super-Web.woff b/assets/fonts/graphik/GraphikMailchimp-Super-Web.woff new file mode 100644 index 0000000..6e4f942 Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-Super-Web.woff differ diff --git a/assets/fonts/graphik/GraphikMailchimp-Super-Web.woff2 b/assets/fonts/graphik/GraphikMailchimp-Super-Web.woff2 new file mode 100644 index 0000000..287f296 Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-Super-Web.woff2 differ diff --git a/assets/fonts/graphik/GraphikMailchimp-SuperItalic-Web.woff b/assets/fonts/graphik/GraphikMailchimp-SuperItalic-Web.woff new file mode 100644 index 0000000..10c69a3 Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-SuperItalic-Web.woff differ diff --git a/assets/fonts/graphik/GraphikMailchimp-SuperItalic-Web.woff2 b/assets/fonts/graphik/GraphikMailchimp-SuperItalic-Web.woff2 new file mode 100644 index 0000000..2745287 Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-SuperItalic-Web.woff2 differ diff --git a/assets/fonts/graphik/GraphikMailchimp-Thin-Web.woff b/assets/fonts/graphik/GraphikMailchimp-Thin-Web.woff new file mode 100644 index 0000000..640e38b Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-Thin-Web.woff differ diff --git a/assets/fonts/graphik/GraphikMailchimp-Thin-Web.woff2 b/assets/fonts/graphik/GraphikMailchimp-Thin-Web.woff2 new file mode 100644 index 0000000..95e34dd Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-Thin-Web.woff2 differ diff --git a/assets/fonts/graphik/GraphikMailchimp-ThinItalic-Web.woff b/assets/fonts/graphik/GraphikMailchimp-ThinItalic-Web.woff new file mode 100644 index 0000000..b233822 Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-ThinItalic-Web.woff differ diff --git a/assets/fonts/graphik/GraphikMailchimp-ThinItalic-Web.woff2 b/assets/fonts/graphik/GraphikMailchimp-ThinItalic-Web.woff2 new file mode 100644 index 0000000..260441d Binary files /dev/null and b/assets/fonts/graphik/GraphikMailchimp-ThinItalic-Web.woff2 differ diff --git a/assets/fonts/graphik/fonts.css b/assets/fonts/graphik/fonts.css new file mode 100644 index 0000000..26cf332 --- /dev/null +++ b/assets/fonts/graphik/fonts.css @@ -0,0 +1,263 @@ +/* + This font software is the property of Commercial Type. + + You may not modify the font software, use it on another website, or install it on a computer. + + License information is available at http://commercialtype.com/eula + For more information please visit Commercial Type at http://commercialtype.com or email us at info[at]commercialtype.com + + Copyright (C) 2016 Schwartzco Inc. + +*/ + +.GraphikMailchimp-Thin-Web { + font-family: 'Graphik Mailchimp Web'; + font-weight: 100; + font-style: normal; +} + +.GraphikMailchimp-ThinItalic-Web { + font-family: 'Graphik Mailchimp Web'; + font-weight: 100; + font-style: italic; +} + +.GraphikMailchimp-Extralight-Web { + font-family: 'Graphik Mailchimp Web'; + font-weight: 200; + font-style: normal; +} + +.GraphikMailchimp-ExtralightItalic-Web { + font-family: 'Graphik Mailchimp Web'; + font-weight: 200; + font-style: italic; +} + +.GraphikMailchimp-Light-Web { + font-family: 'Graphik Mailchimp Web'; + font-weight: 300; + font-style: normal; +} + +.GraphikMailchimp-LightItalic-Web { + font-family: 'Graphik Mailchimp Web'; + font-weight: 300; + font-style: italic; +} + +.GraphikMailchimp-Regular-Web { + font-family: 'Graphik Mailchimp Web'; + font-weight: 400; + font-style: normal; +} + +.GraphikMailchimp-RegularItalic-Web { + font-family: 'Graphik Mailchimp Web'; + font-weight: 400; + font-style: italic; +} + +.GraphikMailchimp-Medium-Web { + font-family: 'Graphik Mailchimp Web'; + font-weight: 500; + font-style: normal; +} + +.GraphikMailchimp-MediumItalic-Web { + font-family: 'Graphik Mailchimp Web'; + font-weight: 500; + font-style: italic; +} + +.GraphikMailchimp-Semibold-Web { + font-family: 'Graphik Mailchimp Web'; + font-weight: 600; + font-style: normal; +} + +.GraphikMailchimp-SemiboldItalic-Web { + font-family: 'Graphik Mailchimp Web'; + font-weight: 600; + font-style: italic; +} + +.GraphikMailchimp-Bold-Web { + font-family: 'Graphik Mailchimp Web'; + font-weight: 700; + font-style: normal; +} + +.GraphikMailchimp-BoldItalic-Web { + font-family: 'Graphik Mailchimp Web'; + font-weight: 700; + font-style: italic; +} + +.GraphikMailchimp-Black-Web { + font-family: 'Graphik Mailchimp Web'; + font-weight: 800; + font-style: normal; +} + +.GraphikMailchimp-BlackItalic-Web { + font-family: 'Graphik Mailchimp Web'; + font-weight: 800; + font-style: italic; +} + +.GraphikMailchimp-Super-Web { + font-family: 'Graphik Mailchimp Web'; + font-weight: 900; + font-style: normal; +} + +.GraphikMailchimp-SuperItalic-Web { + font-family: 'Graphik Mailchimp Web'; + font-weight: 900; + font-style: italic; +} + +@font-face { + font-family: 'Graphik Mailchimp Web'; + src: url('GraphikMailchimp-Thin-Web.woff2') format('woff2'), + url('GraphikMailchimp-Thin-Web.woff') format('woff'); + font-weight: 100; + font-style: normal; +} + +@font-face { + font-family: 'Graphik Mailchimp Web'; + src: url('GraphikMailchimp-ThinItalic-Web.woff2') format('woff2'), + url('GraphikMailchimp-ThinItalic-Web.woff') format('woff'); + font-weight: 100; + font-style: italic; +} + +@font-face { + font-family: 'Graphik Mailchimp Web'; + src: url('GraphikMailchimp-Extralight-Web.woff2') format('woff2'), + url('GraphikMailchimp-Extralight-Web.woff') format('woff'); + font-weight: 200; + font-style: normal; +} + +@font-face { + font-family: 'Graphik Mailchimp Web'; + src: url('GraphikMailchimp-ExtralightItalic-Web.woff2') format('woff2'), + url('GraphikMailchimp-ExtralightItalic-Web.woff') format('woff'); + font-weight: 200; + font-style: italic; +} + +@font-face { + font-family: 'Graphik Mailchimp Web'; + src: url('GraphikMailchimp-Light-Web.woff2') format('woff2'), + url('GraphikMailchimp-Light-Web.woff') format('woff'); + font-weight: 300; + font-style: normal; +} + +@font-face { + font-family: 'Graphik Mailchimp Web'; + src: url('GraphikMailchimp-LightItalic-Web.woff2') format('woff2'), + url('GraphikMailchimp-LightItalic-Web.woff') format('woff'); + font-weight: 300; + font-style: italic; +} + +@font-face { + font-family: 'Graphik Mailchimp Web'; + src: url('GraphikMailchimp-Regular-Web.woff2') format('woff2'), + url('GraphikMailchimp-Regular-Web.woff') format('woff'); + font-weight: 400; + font-style: normal; +} + +@font-face { + font-family: 'Graphik Mailchimp Web'; + src: url('GraphikMailchimp-RegularItalic-Web.woff2') format('woff2'), + url('GraphikMailchimp-RegularItalic-Web.woff') format('woff'); + font-weight: 400; + font-style: italic; +} + +@font-face { + font-family: 'Graphik Mailchimp Web'; + src: url('GraphikMailchimp-Medium-Web.woff2') format('woff2'), + url('GraphikMailchimp-Medium-Web.woff') format('woff'); + font-weight: 500; + font-style: normal; +} + +@font-face { + font-family: 'Graphik Mailchimp Web'; + src: url('GraphikMailchimp-MediumItalic-Web.woff2') format('woff2'), + url('GraphikMailchimp-MediumItalic-Web.woff') format('woff'); + font-weight: 500; + font-style: italic; +} + +@font-face { + font-family: 'Graphik Mailchimp Web'; + src: url('GraphikMailchimp-Semibold-Web.woff2') format('woff2'), + url('GraphikMailchimp-Semibold-Web.woff') format('woff'); + font-weight: 600; + font-style: normal; +} + +@font-face { + font-family: 'Graphik Mailchimp Web'; + src: url('GraphikMailchimp-SemiboldItalic-Web.woff2') format('woff2'), + url('GraphikMailchimp-SemiboldItalic-Web.woff') format('woff'); + font-weight: 600; + font-style: italic; +} + +@font-face { + font-family: 'Graphik Mailchimp Web'; + src: url('GraphikMailchimp-Bold-Web.woff2') format('woff2'), + url('GraphikMailchimp-Bold-Web.woff') format('woff'); + font-weight: 700; + font-style: normal; +} + +@font-face { + font-family: 'Graphik Mailchimp Web'; + src: url('GraphikMailchimp-BoldItalic-Web.woff2') format('woff2'), + url('GraphikMailchimp-BoldItalic-Web.woff') format('woff'); + font-weight: 700; + font-style: italic; +} + +@font-face { + font-family: 'Graphik Mailchimp Web'; + src: url('GraphikMailchimp-Black-Web.woff2') format('woff2'), + url('GraphikMailchimp-Black-Web.woff') format('woff'); + font-weight: 800; + font-style: normal; +} + +@font-face { + font-family: 'Graphik Mailchimp Web'; + src: url('GraphikMailchimp-BlackItalic-Web.woff2') format('woff2'), + url('GraphikMailchimp-BlackItalic-Web.woff') format('woff'); + font-weight: 800; + font-style: italic; +} + +@font-face { + font-family: 'Graphik Mailchimp Web'; + src: url('GraphikMailchimp-Super-Web.woff2') format('woff2'), + url('GraphikMailchimp-Super-Web.woff') format('woff'); + font-weight: 900; + font-style: normal; +} + +@font-face { + font-family: 'Graphik Mailchimp Web'; + src: url('GraphikMailchimp-SuperItalic-Web.woff2') format('woff2'), + url('GraphikMailchimp-SuperItalic-Web.woff') format('woff'); + font-weight: 900; + font-style: italic; +} diff --git a/assets/js/admin.js b/assets/js/admin.js new file mode 100644 index 0000000..663c6ad --- /dev/null +++ b/assets/js/admin.js @@ -0,0 +1,416 @@ +/* eslint-disable prefer-template, no-console */ +(function ($) { + const params = window.mailchimp_sf_admin_params || {}; + const spinner = '#mailchimp_sf_oauth_connect .mailchimp-sf-loading'; + const errorSelector = '.mailchimp-sf-oauth-error'; + + /** + * Set connect button loading state. + */ + function setConnectButtonLoading() { + $(spinner).removeClass('hidden'); + $('#mailchimp_sf_oauth_connect').attr('disabled', true); + } + + /** + * Set connect button normal state. + */ + function setConnectButtonNormal() { + $(spinner).addClass('hidden'); + $('#mailchimp_sf_oauth_connect').attr('disabled', false); + } + + /** + * Open Mailchimp OAuth popup. + * + * @param {string} token - Token from the Oauth service. + */ + function openMailchimpOauthPopup(token) { + const startUrl = params.oauth_url + '/auth/start/' + token; + const width = 800; + const height = 600; + const screenSizes = window.screen || { width: 1024, height: 768 }; + const left = (screenSizes.width - width) / 2; + const top = (screenSizes.height - height) / 4; + const windowOptions = + 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + + width + + ', height=' + + height + + ', top=' + + top + + ', left=' + + left + + ', domain=' + + params.oauth_url.replace('https://', ''); + + // Open Mailchimp OAuth popup. + const popup = window.open(startUrl, params.oauth_window_name, windowOptions); + + if (popup == null) { + // Show modal if popup is blocked. + $('#mailchimp-sf-popup-blocked-modal').dialog({ + modal: true, + title: params.modal_title, + width: 480, + buttons: [ + { + text: params.modal_button_cancel, + class: 'button mailchimp-sf-button button-secondary', + click() { + $(this).dialog('close'); + }, + }, + { + text: params.modal_button_try_again, + class: 'button mailchimp-sf-button', + click() { + $(this).dialog('close'); + setConnectButtonLoading(); + openMailchimpOauthPopup(token); + }, + style: 'margin-left: 10px;', + }, + ], + classes: { + 'ui-dialog': 'mailchimp-sf-ui-dialog', + 'ui-dialog-titlebar': 'mailchimp-sf-ui-dialog-titlebar', + }, + }); + setConnectButtonNormal(); + } else { + // Handle popup opened. + const oauthInterval = window.setInterval(function () { + if (popup.closed) { + // Clear interval. + window.clearInterval(oauthInterval); + + // Check status of OAuth connection. + const statusUrl = params.oauth_url + '/api/status/' + token; + $.post(statusUrl, function (statusData) { + if (statusData && statusData.status === 'accepted') { + const finishData = { + action: 'mailchimp_sf_oauth_finish', + nonce: params.oauth_finish_nonce, + token, + }; + + // Finish OAuth connection and save token. + $.post(params.ajax_url, finishData, function (finishResponse) { + if (finishResponse.success) { + // Token is saved in the database, redirect to the settings page to reflect the changes. + window.location.href = params.admin_settings_url; + } else { + console.log( + 'Error calling OAuth finish endpoint. Data:', + finishResponse, + ); + if (finishResponse.data && finishResponse.data.message) { + $(errorSelector).html(finishResponse.data.message); + } else { + $(errorSelector).html(params.generic_error); + } + $(errorSelector).show(); + } + setConnectButtonNormal(); + }).fail(function () { + console.error('Error calling OAuth finish endpoint.'); + $(errorSelector).html(params.generic_error); + $(errorSelector).show(); + setConnectButtonNormal(); + }); + } else { + console.log( + 'Error calling OAuth status endpoint. No credentials provided at login popup? Data:', + statusData, + ); + setConnectButtonNormal(); + } + }).fail(function () { + $(errorSelector).html(params.generic_error); + $(errorSelector).show(); + console.error('Error calling OAuth status endpoint.'); + setConnectButtonNormal(); + }); + } + }, 250); + } + } + + $(window).on('load', function () { + // Mailchimp OAuth connection. + $('#mailchimp_sf_oauth_connect').click(function () { + $(errorSelector).hide(); + $(errorSelector).html(''); + setConnectButtonLoading(); + + $.post( + params.ajax_url, + { + action: 'mailchimp_sf_oauth_start', + nonce: params.oauth_start_nonce, + }, + function (response) { + if (response.success && response.data && response.data.token) { + // Open Mailchimp OAuth popup. + openMailchimpOauthPopup(response.data.token); + } else { + if (response.data && response.data.message) { + $(errorSelector).html(response.data.message); + } else { + $(errorSelector).html(params.generic_error); + } + $(errorSelector).show(); + setConnectButtonNormal(); + } + }, + ).fail(function () { + $(errorSelector).html(params.generic_error); + $(errorSelector).show(); + setConnectButtonNormal(); + }); + }); + }); + + /** + * Create Mailchimp account Handler. + */ + // Waiting for login. + const waitingForMailchimpAccountLogin = () => { + const intervalId = window.setInterval(function () { + $.post( + params.ajax_url, + { + action: 'mailchimp_sf_check_login_session', + nonce: params.check_login_session_nonce, + }, + function (response) { + if (response.success && response.data && response.data.logged_in) { + window.clearInterval(intervalId); + window.location.href = response.data.redirect; + } else { + console.log(response); + } + }, + ); + }, 10000); + }; + + $(window).on('load', function () { + const isCreateAccountPage = $('.mailchimp-sf-create-account').length > 0; + if (!isCreateAccountPage) { + return; + } + + // Check if signup initiated. + if ($('.mailchimp-sf-create-account input[name=signup_initiated]').val() === '1') { + waitingForMailchimpAccountLogin(); + } + + // Validate inputs. + const validateFormInput = (input) => { + let inputLabel = ''; + if ( + $('label[for="' + input.id + '"] span').length > 0 && + $('label[for="' + input.id + '"] span').text() + ) { + inputLabel = $('label[for="' + input.id + '"] span') + .text() + .trim(); + inputLabel = inputLabel.split('/')[0]; + inputLabel = inputLabel.split('(')[0]; + } + const requiredError = (params.required_error || '').replace('%s', inputLabel); + const requiredInputs = [ + 'first_name', + 'last_name', + 'business_name', + 'email', + 'address', + 'country', + 'city', + 'state', + 'zip', + ]; + if (requiredInputs.includes(input.name) && input.value === '') { + return requiredError; + } + + if (input.name === 'email') { + if (!input.value.includes('@') || !input.value.includes('.')) + return params.invalid_email_error; + if (input.value !== $('#mailchimp-sf-profile-details input#confirm_email').val()) + return params.confirm_email_match; + } + if (input.name === 'confirm_email') { + if (input.value !== $('#mailchimp-sf-profile-details input#email').val()) + return params.confirm_email_match2; + } + + return null; + }; + + // Display errors and disable button in case of errors + const validateAccountForm = (errors, wrapperId, displayErrors = false) => { + const inputIds = Object.keys(errors); + + inputIds.forEach((key) => { + const inputElementId = `${wrapperId} #${key}`; + const errorElementId = `${wrapperId} #mailchimp-sf-${key}-error`; + + if (errors[key] !== null) { + if (displayErrors) { + $(inputElementId).closest('.box').addClass('form-error'); + $(errorElementId).text(errors[key]); + } + } else { + $(inputElementId).closest('.box').removeClass('form-error'); + $(errorElementId).text(''); + } + }); + return Object.values(errors).filter((error) => error !== null).length === 0; + }; + + // Get form Errors. + const getFormErrors = (inputs) => { + const errors = {}; + inputs.each((index, input) => { + errors[input.name] = validateFormInput(input); + }); + + return errors; + }; + + // Validate profile details + let profileDetailsInputs = $('#mailchimp-sf-profile-details input'); + profileDetailsInputs.on('input', (e) => { + const input = e.target; + + $(input).closest('.box').removeClass('form-error'); + $(input).closest('.box').find('.error-field').text(''); + + if (input.name === 'email' || input.name === 'confirm_email') { + $('input#confirm_email, input#email').closest('.box').removeClass('form-error'); + $('input#confirm_email, input#email').closest('.box').find('.error-field').text(''); + } + }); + + // validate business address + let businessAddressInputs = $( + '#mailchimp-sf-business-address input, #mailchimp-sf-business-address select', + ); + businessAddressInputs.on('input', (e) => { + const input = e.target; + + $(input).closest('.box').removeClass('form-error'); + $(input).closest('.box').find('.error-field').text(''); + }); + + // Handle create account button click. + $('#mailchimp-sf-create-activate-account').click((e) => { + e.preventDefault(); + + profileDetailsInputs = $('#mailchimp-sf-profile-details input'); + const profileErrors = getFormErrors(profileDetailsInputs); + const profileDetailsValid = validateAccountForm( + profileErrors, + '#mailchimp-sf-profile-details', + true, + ); + + businessAddressInputs = $( + '#mailchimp-sf-business-address input, #mailchimp-sf-business-address select', + ); + const businessAddressErrors = getFormErrors(businessAddressInputs); + const businessAddressValid = validateAccountForm( + businessAddressErrors, + '#mailchimp-sf-business-address', + true, + ); + + if (profileDetailsValid && businessAddressValid) { + $('.mailchimp-sf-activate-account').submit(); + } + }); + + $('.mailchimp-sf-activate-account').submit((e) => { + e.preventDefault(); + $('#mailchimp-sf-create-activate-account').attr('disabled', true); + $('#mailchimp-sf-create-activate-account .mailchimp-sf-loading').removeClass('hidden'); + + const errorSelector = '.mailchimp-sf-create-account .general-error p'; + $(errorSelector).html(''); + const formData = $(e.target).serializeArray(); + const formDataObject = {}; + formData.forEach((obj) => { + formDataObject[obj.name] = obj.value; + }); + + const postData = { + email: formDataObject.email, + username: formDataObject.email, + business_name: formDataObject.business_name, + first_name: formDataObject.first_name, + last_name: formDataObject.last_name, + org: formDataObject.org, + phone_number: formDataObject.phone_number, + timezone: formDataObject.timezone, + address: { + address1: formDataObject.address, + city: formDataObject.city, + state: formDataObject.state, + zip: formDataObject.zip, + country: formDataObject.country, + }, + }; + + // Add address2 if available. + if (formDataObject.address2 !== '') { + postData.address.address2 = formDataObject.address2; + } + + $.post( + params.ajax_url, + { + action: 'mailchimp_sf_create_account', + data: postData, + nonce: params.create_account_nonce, + }, + function (response) { + $('.mailchimp-sf-email').text(formDataObject.email); + $('#mailchimp-sf-create-activate-account').attr('disabled', false); + $('#mailchimp-sf-create-activate-account .mailchimp-sf-loading').addClass( + 'hidden', + ); + + if (response.success && response.data) { + $('.mailchimp-sf-create-account__body-inner').addClass('hidden'); + $('.mailchimp-sf-confirm-email-wrapper').removeClass('hidden'); + + // Update wizard steps. + $('.wizard-steps .step-1').removeClass('current'); + $('.wizard-steps .step-2').removeClass('deselected'); + $('.wizard-steps .step-2').addClass('current'); + + // Waiting for login. + waitingForMailchimpAccountLogin(); + } else if (response.data && response.data.suggest_login) { + $('.mailchimp-sf-create-account__body-inner').addClass('hidden'); + $('.mailchimp-sf-suggest-to-login').removeClass('hidden'); + } else if (response.data && response.data.message) { + $(errorSelector).html(response.data.message); + window.scrollTo({ top: 0, behavior: 'smooth' }); + } else { + $(errorSelector).html(params.generic_error); + window.scrollTo({ top: 0, behavior: 'smooth' }); + } + }, + ).fail(function () { + $(errorSelector).html(params.generic_error); + window.scrollTo({ top: 0, behavior: 'smooth' }); + $('#mailchimp-sf-create-activate-account').attr('disabled', false); + $('#mailchimp-sf-create-activate-account .mailchimp-sf-loading').addClass('hidden'); + }); + }); + }); +})(jQuery); // eslint-disable-line no-undef diff --git a/js/hidecss.js b/assets/js/hidecss.js similarity index 100% rename from js/hidecss.js rename to assets/js/hidecss.js diff --git a/js/mailchimp.js b/assets/js/mailchimp.js similarity index 100% rename from js/mailchimp.js rename to assets/js/mailchimp.js diff --git a/css/admin.css b/css/admin.css deleted file mode 100644 index cfb42fc..0000000 --- a/css/admin.css +++ /dev/null @@ -1,268 +0,0 @@ -:root { - --mailchimp-color-text: #241c15; - --mailchimp-color-white: #fff; - --mailchimp-color-border: #ffe01b; - --mailchimp-color-header-bg: #fbeeca; - --mailchimp-color-link: #007c89; - --mailchimp-color-text-light: #373737; - --mailchimp-color-text-lightest: #5d5c5d; - --mailchimp-max-width: 56.25rem; /* 900 pixels */ -} - -.error_msg, -.success_msg, -.notes_msg, -table.mc-user, -.mc-list-row, -.mc-list-note, -.mc-section { - max-width: 900px; - width: 100%; -} - -/* Header */ -.mailchimp-header { - align-items: center; - background-color: var(--mailchimp-color-white); - border-top: 2px solid var(--mailchimp-color-border); - box-sizing: border-box; - display: flex; - gap: 1rem; - justify-content: space-between; - max-width: var(--mailchimp-max-width); - padding: 0.75rem 1rem; -} - -/* Sections */ -table.mc-widefat { - background: var(--mailchimp-color-white); - border: 2px solid var(--mailchimp-color-header-bg) !important; - border-radius: 6px; - margin: 2.75rem 0 2.25rem; -} - -table.mc-widefat tr:first-child { - background: var(--mailchimp-color-header-bg); -} - -table.mc-widefat tr:first-child th { - color: var(--mailchimp-color-text); - font-weight: 500; -} - -/* Buttons */ -#wpbody .button { - border-color: var(--mailchimp-color-link); - color: var(--mailchimp-color-link); -} - -.error_msg { - --mailchimp-error-bg: #fadbd5; - --mailchimp-error-border: #db3a1b; - background: var(--mailchimp-error-bg); - border: 1px solid var(--mailchimp-error-border); - border-radius: 6px; - box-sizing: border-box; - color: var(--mailchimp-color-text); - font-size: 0.75rem; - line-height: 1; - margin: 12px 0; - padding: 9px; -} - -.success_msg, -.notes_msg { - background: var(--mailchimp-color-header-bg); - border-radius: 6px; - box-sizing: border-box; - color: var(--mailchimp-color-text-light); - font-size: 0.75rem; - line-height: 1; - margin: 12px 0; - padding: 9px; -} - -/* User */ -table.mc-user { - margin-top: 19px; -} - -table.mc-user tr { - border: 1px solid var(--mailchimp-color-link); - border-radius: 6px; - float: right; -} - -.mc-user td:first-of-type { - font-weight: 400 !important; - padding-right: 1rem; -} - -.mc-user td:last-of-type { - min-width: 75px; -} - -.mc-user h3 { - font-weight: 400; - text-indent: 9px; -} - -/* List Selection */ -.mc-list-row { - margin-bottom: 12px; -} - -.mc-list-row td:first-of-type { - min-width: 200px; - padding: 12px 12px 12px 0; -} - -.mc-list-row td:last-of-type { - padding: 12px 12px 12px 0; - width: 80px; -} - -.mc-list-note { - border-bottom: 2px solid var(--mailchimp-color-text); - color: var(--mailchimp-color-text-lightest); - font-size: 0.8125rem; - font-weight: 400; - margin-bottom: 8px; - margin-top: 7px; - padding: 0 0 18px; -} - -table.mc-list-select { - margin-bottom: -40px; -} - -/* Headings */ -.mailchimp-header h1 { - font-weight: 600; - margin: 0.75em 0; - padding: 0; -} - -.mailchimp-header h1, -.mc-h2, -.mc-h3, -.mc-p { - color: var(--mailchimp-color-text); -} - -.mc-h2 { - font-size: 1.625rem; - margin-bottom: 0; -} - -.mc-h3 { - border-bottom: 2px solid var(--mailchimp-color-text); - font-size: 1.125rem; - margin-bottom: 12px; - margin-top: 36px; - padding-bottom: 12px; -} - -.mc-p { - font-size: 1rem; - font-weight: 400; - margin-bottom: 0; -} - -.mc-p a { - color: var(--mailchimp-color-link); - font-weight: 400; -} - -/* Table */ -table.mc-widefat td, -table.mc-widefat th { - padding: 18px; - text-align: left; - text-shadow: none; -} - -table.mc-widefat .last-row td, -table.mc-widefat .last-row th { - border-bottom: none !important; -} - -table.mc-widefat th { - color: var(--mailchimp-color-text-light) !important; - font-weight: 700 !important; - width: 130px; -} - -table.mc-widefat td label { - display: block; - font-size: 0.75rem; - font-style: normal; - margin-top: -17px; - padding-left: 24px; -} - -table.mc-widefat td { - color: var(--mailchimp-color-text-lightest) !important; - font-size: 0.75rem; - line-height: 1.125 !important; -} - -table.mc-widefat td input { - display: inline-block; - font-style: normal; -} - -table.mc-widefat.mc-api { - border-radius: 6px; - margin-bottom: 19px; - margin-top: 19px; -} - -table.mc-widefat.mc-api td, -table.mc-widefat.mc-api th { - border-bottom: none !important; -} - -table.mc-widefat.mc-api tr:first-child { - background: var(--mailchimp-color-header-bg) !important; -} - -a.mc-api-key { - color: var(--mailchimp-color-white); - display: block; - margin-top: 3px; -} - -a.mc-api-key:hover { - color: var(--mailchimp-color-white); - text-decoration: underline; -} - -.mc-api-submit { - margin-bottom: 19px; -} - -.mc-submit { - clear: both; - float: right; -} - -th.mailchimp-connect { - width: 100% !important; -} - -#mc-message { - margin-top: 26px; -} - -/** - * Mailchimp OAuth CSS - */ -.mailchimp-sf-oauth-section .oauth-error { - display: block; - color: #db3a1b; -} - -.mailchimp-sf-oauth-connect-wrapper { - display: flex; -} diff --git a/includes/admin/templates/activate-account.php b/includes/admin/templates/activate-account.php new file mode 100644 index 0000000..ac642ce --- /dev/null +++ b/includes/admin/templates/activate-account.php @@ -0,0 +1,98 @@ + +
+
+
+

+ ' . esc_html( $email ) . '' + ), + array( + 'span' => array( + 'class' => array(), + ), + ) + ); + ?> +

+ + + +
+
diff --git a/includes/admin/templates/create-account-page.php b/includes/admin/templates/create-account-page.php new file mode 100644 index 0000000..6852d10 --- /dev/null +++ b/includes/admin/templates/create-account-page.php @@ -0,0 +1,286 @@ +user_email ?? ''; +$waiting_login = get_option( 'mailchimp_sf_waiting_for_login' ); +$api = mailchimp_sf_get_api(); +$screen = get_current_screen(); +$is_create_account_page = $screen && 'admin_page_mailchimp_sf_create_account' === $screen->id; +$is_retrying = isset( $_GET['retry'] ) && '1' === sanitize_text_field( wp_unslash( $_GET['retry'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended +$signup_initiated = $waiting_login && 'waiting' === $waiting_login && ! $is_retrying; + +if ( ! empty( $api ) ) { + $profile = $api->get( '' ); + if ( ! is_wp_error( $profile ) ) { + $email = $profile['email'] ?? $email; + } +} + +// Prepare data for prefilling the form. +$data = array( + 'first_name' => $user->first_name ?? '', + 'last_name' => $user->last_name ?? '', + 'business_name' => get_bloginfo( 'name' ), + 'phone_number' => '', + 'email' => $email, + 'address' => '', + 'address2' => '', + 'city' => '', + 'state' => '', + 'zip' => '', + 'country' => '', + 'timezone' => wp_timezone_string(), +); + +// Update prefill data if the user has already filled the form earlier and retrying. +if ( $is_retrying && ! empty( $profile ) ) { + $contact = $profile['contact'] ?? array(); + $data = array( + 'first_name' => $profile['first_name'] ?? $data['first_name'], + 'last_name' => $profile['last_name'] ?? $data['last_name'], + 'business_name' => $profile['account_name'] ?? $data['business_name'], + 'phone_number' => $data['phone_number'], + 'email' => $profile['email'] ?? $data['email'], + 'address' => $contact['addr1'] ?? $data['address'], + 'address2' => $contact['addr2'] ?? $data['address2'], + 'city' => $contact['city'] ?? $data['city'], + 'state' => $contact['state'] ?? $data['state'], + 'zip' => $contact['zip'] ?? $data['zip'], + 'country' => $contact['country'] ?? $data['country'], + 'timezone' => $profile['account_timezone'] ?? $data['timezone'], + ); +} + +?> +
+ +
+
+ +
+ + +
+
diff --git a/includes/admin/templates/header.php b/includes/admin/templates/header.php new file mode 100644 index 0000000..a90dc56 --- /dev/null +++ b/includes/admin/templates/header.php @@ -0,0 +1,53 @@ + +
+ +
+

+ +
+
+ + + + + +
+ + + + + +
+
+ +
+
diff --git a/includes/admin/templates/login.php b/includes/admin/templates/login.php new file mode 100644 index 0000000..f7e3338 --- /dev/null +++ b/includes/admin/templates/login.php @@ -0,0 +1,38 @@ + +
+ +
+
+
+

+ +

+ +
+ + +
+ + +
+
+
diff --git a/includes/admin/templates/settings.php b/includes/admin/templates/settings.php new file mode 100644 index 0000000..c549e9a --- /dev/null +++ b/includes/admin/templates/settings.php @@ -0,0 +1,23 @@ + +
+ +
diff --git a/includes/admin/templates/suggest-to-login.php b/includes/admin/templates/suggest-to-login.php new file mode 100644 index 0000000..63e5b67 --- /dev/null +++ b/includes/admin/templates/suggest-to-login.php @@ -0,0 +1,43 @@ + + diff --git a/includes/class-mailchimp-admin.php b/includes/class-mailchimp-admin.php index 13c5b78..b405917 100644 --- a/includes/class-mailchimp-admin.php +++ b/includes/class-mailchimp-admin.php @@ -32,8 +32,12 @@ public function init() { add_action( 'admin_notices', array( $this, 'admin_notices' ) ); add_action( 'wp_ajax_mailchimp_sf_oauth_start', array( $this, 'start_oauth_process' ) ); add_action( 'wp_ajax_mailchimp_sf_oauth_finish', array( $this, 'finish_oauth_process' ) ); + add_action( 'wp_ajax_mailchimp_sf_create_account', array( $this, 'mailchimp_create_account' ) ); + add_action( 'wp_ajax_mailchimp_sf_check_login_session', array( $this, 'check_login_session' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_page_scripts' ) ); + add_action( 'admin_menu', array( $this, 'add_create_account_page' ) ); + add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ) ); } /** @@ -149,6 +153,126 @@ public function finish_oauth_process() { } } + /** + * Create a new Mailchimp account. + * + * This function is called via AJAX. + * + * This function creates a new Mailchimp account by sending the user data to the middleware server. + */ + public function mailchimp_create_account() { + // Validate the nonce and permissions. + if ( + ! current_user_can( 'manage_options' ) || + ! isset( $_POST['nonce'] ) || + ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'mailchimp_sf_create_account_nonce' ) + ) { + wp_send_json_error( array( 'message' => esc_html__( 'You do not have permission to perform this action.', 'mailchimp' ) ) ); + } + + $data = isset( $_POST['data'] ) ? $this->sanitize_data( wp_unslash( $_POST['data'] ) ) : array(); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Data is sanitized in the sanitize_data method. + if ( empty( $data ) ) { + wp_send_json_error( array( 'message' => esc_html__( 'No data provided.', 'mailchimp' ) ) ); + } + + // Get the IP address. + if ( isset( $_SERVER['REMOTE_ADDR'] ) && ( '::1' === $_SERVER['REMOTE_ADDR'] || '127.0.0.1' === $_SERVER['REMOTE_ADDR'] ) ) { + $data['ip_address'] = '127.0.0.1'; + } elseif ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { + $data['ip_address'] = sanitize_text_field( wp_unslash( $_SERVER['HTTP_CLIENT_IP'] ) ); + } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { + $data['ip_address'] = sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ); + } else { + $data['ip_address'] = sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ); + } + + $request_data = array( + 'headers' => array( + 'Content-type' => 'application/json', + 'Accept' => 'application/json', + ), + 'body' => wp_json_encode( $data ), + 'timeout' => 30, + ); + + $response = wp_remote_post( $this->oauth_url . '/api/signup/', $request_data ); + // Return the error if there is one. + if ( $response instanceof WP_Error ) { + wp_send_json_error( array( 'message' => $response->get_error_message() ) ); + } + + $response_body = json_decode( $response['body'] ); + if ( 200 === $response['response']['code'] && true === $response_body->success ) { + $result = json_decode( $response['body'], true ); + + // Verify and save the token. + $verify = $this->verify_and_save_oauth_token( $result['data']['oauth_token'], $result['data']['dc'] ); + + if ( is_wp_error( $verify ) ) { + // If there is an error, send it back to the front-end. + wp_send_json_error( array( 'message' => $verify->get_error_message() ) ); + } + update_option( 'mailchimp_sf_waiting_for_login', 'waiting' ); + wp_send_json_success( true ); + + } elseif ( 404 === $response['response']['code'] ) { + wp_send_json_error( array( 'success' => false ) ); + + } else { + $username = isset( $_POST['data']['username'] ) ? sanitize_email( wp_unslash( $_POST['data']['username'] ) ) : ''; + $username = preg_replace( '/[^A-Za-z0-9\-\@\.]/', '', $username ); + $suggestion = wp_remote_get( $this->oauth_url . '/api/usernames/suggestions/' . $username ); + $suggested_username = json_decode( $suggestion['body'] )->data; + wp_send_json_error( + array( + 'success' => false, + 'suggest_login' => true, + 'suggested_username' => $suggested_username, + ) + ); + } + } + + /** + * Check the login session. + * + * This function is called via AJAX. + * + * This function checks if the user is logged in to Mailchimp which confirms the account activation. + */ + public function check_login_session() { + // Validate the nonce and permissions. + if ( + ! current_user_can( 'manage_options' ) || + ! isset( $_POST['nonce'] ) || + ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'mailchimp_sf_check_login_session_nonce' ) + ) { + wp_send_json_error( array( 'message' => esc_html__( 'You do not have permission to perform this action.', 'mailchimp' ) ) ); + } + + $api = mailchimp_sf_get_api(); + if ( $api ) { + $profile = $api->get( '' ); + if ( is_wp_error( $profile ) ) { + wp_send_json_error( array( 'message' => $profile->get_error_message() ) ); + } + + $logged_in = ( ! empty( $profile['last_login'] ) ); + if ( $logged_in ) { + delete_option( 'mailchimp_sf_waiting_for_login' ); + } + wp_send_json_success( + array( + 'success' => true, + 'logged_in' => $logged_in, + 'redirect' => admin_url( 'admin.php?page=mailchimp_sf_options' ), + ) + ); + } else { + wp_send_json_error( array( 'success' => false ) ); + } + } + /** * Verify and save the OAuth token. * @@ -208,7 +332,7 @@ public function admin_notices() { tag, %2$s - tag */ - __( 'Heads up! It looks like you\'re using an API key to connect with Mailchimp, which is now deprecated. Please log out and reconnect your Mailchimp account using the new OAuth authentication by clicking the "Connect Account" button on the %1$splugin settings%2$s page.', 'mailchimp' ), + __( 'Heads up! It looks like you\'re using an API key to connect with Mailchimp, which is now deprecated. Please log out and reconnect your Mailchimp account using the new OAuth authentication by clicking the "Log in" button on the %1$splugin settings%2$s page.', 'mailchimp' ), '', '' ); @@ -220,6 +344,31 @@ public function admin_notices() { id ) { + $api = mailchimp_sf_get_api(); + if ( $api && 'waiting' === get_option( 'mailchimp_sf_waiting_for_login' ) ) { + $profile = $api->get( '' ); + if ( ! is_wp_error( $profile ) ) { + if ( ! empty( $profile['last_login'] ) ) { + // Clear the waiting flag if the user is logged in. + delete_option( 'mailchimp_sf_waiting_for_login' ); + } else { + ?> +
+

+ +

+
+ esc_url( admin_url( 'admin-ajax.php' ) ), + 'oauth_url' => esc_url( $this->oauth_url ), + 'oauth_start_nonce' => wp_create_nonce( 'mailchimp_sf_oauth_start_nonce' ), + 'oauth_finish_nonce' => wp_create_nonce( 'mailchimp_sf_oauth_finish_nonce' ), + 'oauth_window_name' => esc_html__( 'Mailchimp For WordPress OAuth', 'mailchimp' ), + 'generic_error' => esc_html__( 'An error occurred. Please try again.', 'mailchimp' ), + 'modal_title' => esc_html__( 'Login Popup is blocked!', 'mailchimp' ), + 'modal_button_try_again' => esc_html__( 'Try again', 'mailchimp' ), + 'modal_button_cancel' => esc_html__( 'No, cancel!', 'mailchimp' ), + 'admin_settings_url' => esc_url( admin_url( 'admin.php?page=mailchimp_sf_options' ) ), + ); + + // Create account page specific data. + if ( 'admin_page_mailchimp_sf_create_account' === $hook_suffix ) { + $data['create_account_nonce'] = wp_create_nonce( 'mailchimp_sf_create_account_nonce' ); + $data['check_login_session_nonce'] = wp_create_nonce( 'mailchimp_sf_check_login_session_nonce' ); + /* translators: %s is field name. */ + $data['required_error'] = esc_html__( '%s can\'t be blank.', 'mailchimp' ); + $data['invalid_email_error'] = esc_html__( 'Insert correct email.', 'mailchimp' ); + $data['confirm_email_match'] = esc_html__( 'Email confirmation must match confirmation email.', 'mailchimp' ); + $data['confirm_email_match2'] = esc_html__( 'Email confirmation must match the field above.', 'mailchimp' ); + } wp_localize_script( 'mailchimp_sf_admin', 'mailchimp_sf_admin_params', + $data + ); + } + + /** + * Add the create account page. + * + * @since x.x.x + */ + public function add_create_account_page() { + add_submenu_page( + 'admin.php', + esc_html__( 'Create Mailchimp Account', 'mailchimp' ), + esc_html__( 'Create Mailchimp Account', 'mailchimp' ), + 'manage_options', + 'mailchimp_sf_create_account', + array( $this, 'create_account_page' ) + ); + } + + /** + * Create account page. + * + * @since x.x.x + * + * @return void + */ + public function create_account_page() { + $countries = $this->get_countries(); + $timezones = $this->get_timezones(); + ?> +
+ +
+ __( 'Afghanistan', 'mailchimp' ), + 'AX' => __( 'Åland Islands', 'mailchimp' ), + 'AL' => __( 'Albania', 'mailchimp' ), + 'DZ' => __( 'Algeria', 'mailchimp' ), + 'AS' => __( 'American Samoa', 'mailchimp' ), + 'AD' => __( 'Andorra', 'mailchimp' ), + 'AO' => __( 'Angola', 'mailchimp' ), + 'AI' => __( 'Anguilla', 'mailchimp' ), + 'AQ' => __( 'Antarctica', 'mailchimp' ), + 'AG' => __( 'Antigua and Barbuda', 'mailchimp' ), + 'AR' => __( 'Argentina', 'mailchimp' ), + 'AM' => __( 'Armenia', 'mailchimp' ), + 'AW' => __( 'Aruba', 'mailchimp' ), + 'AU' => __( 'Australia', 'mailchimp' ), + 'AT' => __( 'Austria', 'mailchimp' ), + 'AZ' => __( 'Azerbaijan', 'mailchimp' ), + 'BS' => __( 'Bahamas', 'mailchimp' ), + 'BH' => __( 'Bahrain', 'mailchimp' ), + 'BD' => __( 'Bangladesh', 'mailchimp' ), + 'BB' => __( 'Barbados', 'mailchimp' ), + 'BY' => __( 'Belarus', 'mailchimp' ), + 'BE' => __( 'Belgium', 'mailchimp' ), + 'PW' => __( 'Belau', 'mailchimp' ), + 'BZ' => __( 'Belize', 'mailchimp' ), + 'BJ' => __( 'Benin', 'mailchimp' ), + 'BM' => __( 'Bermuda', 'mailchimp' ), + 'BT' => __( 'Bhutan', 'mailchimp' ), + 'BO' => __( 'Bolivia', 'mailchimp' ), + 'BQ' => __( 'Bonaire, Saint Eustatius and Saba', 'mailchimp' ), + 'BA' => __( 'Bosnia and Herzegovina', 'mailchimp' ), + 'BW' => __( 'Botswana', 'mailchimp' ), + 'BV' => __( 'Bouvet Island', 'mailchimp' ), + 'BR' => __( 'Brazil', 'mailchimp' ), + 'IO' => __( 'British Indian Ocean Territory', 'mailchimp' ), + 'BN' => __( 'Brunei', 'mailchimp' ), + 'BG' => __( 'Bulgaria', 'mailchimp' ), + 'BF' => __( 'Burkina Faso', 'mailchimp' ), + 'BI' => __( 'Burundi', 'mailchimp' ), + 'KH' => __( 'Cambodia', 'mailchimp' ), + 'CM' => __( 'Cameroon', 'mailchimp' ), + 'CA' => __( 'Canada', 'mailchimp' ), + 'CV' => __( 'Cape Verde', 'mailchimp' ), + 'KY' => __( 'Cayman Islands', 'mailchimp' ), + 'CF' => __( 'Central African Republic', 'mailchimp' ), + 'TD' => __( 'Chad', 'mailchimp' ), + 'CL' => __( 'Chile', 'mailchimp' ), + 'CN' => __( 'China', 'mailchimp' ), + 'CX' => __( 'Christmas Island', 'mailchimp' ), + 'CC' => __( 'Cocos (Keeling) Islands', 'mailchimp' ), + 'CO' => __( 'Colombia', 'mailchimp' ), + 'KM' => __( 'Comoros', 'mailchimp' ), + 'CG' => __( 'Congo (Brazzaville)', 'mailchimp' ), + 'CD' => __( 'Congo (Kinshasa)', 'mailchimp' ), + 'CK' => __( 'Cook Islands', 'mailchimp' ), + 'CR' => __( 'Costa Rica', 'mailchimp' ), + 'HR' => __( 'Croatia', 'mailchimp' ), + 'CU' => __( 'Cuba', 'mailchimp' ), + 'CW' => __( 'Curaçao', 'mailchimp' ), + 'CY' => __( 'Cyprus', 'mailchimp' ), + 'CZ' => __( 'Czech Republic', 'mailchimp' ), + 'DK' => __( 'Denmark', 'mailchimp' ), + 'DJ' => __( 'Djibouti', 'mailchimp' ), + 'DM' => __( 'Dominica', 'mailchimp' ), + 'DO' => __( 'Dominican Republic', 'mailchimp' ), + 'EC' => __( 'Ecuador', 'mailchimp' ), + 'EG' => __( 'Egypt', 'mailchimp' ), + 'SV' => __( 'El Salvador', 'mailchimp' ), + 'GQ' => __( 'Equatorial Guinea', 'mailchimp' ), + 'ER' => __( 'Eritrea', 'mailchimp' ), + 'EE' => __( 'Estonia', 'mailchimp' ), + 'ET' => __( 'Ethiopia', 'mailchimp' ), + 'FK' => __( 'Falkland Islands', 'mailchimp' ), + 'FO' => __( 'Faroe Islands', 'mailchimp' ), + 'FJ' => __( 'Fiji', 'mailchimp' ), + 'FI' => __( 'Finland', 'mailchimp' ), + 'FR' => __( 'France', 'mailchimp' ), + 'GF' => __( 'French Guiana', 'mailchimp' ), + 'PF' => __( 'French Polynesia', 'mailchimp' ), + 'TF' => __( 'French Southern Territories', 'mailchimp' ), + 'GA' => __( 'Gabon', 'mailchimp' ), + 'GM' => __( 'Gambia', 'mailchimp' ), + 'GE' => __( 'Georgia', 'mailchimp' ), + 'DE' => __( 'Germany', 'mailchimp' ), + 'GH' => __( 'Ghana', 'mailchimp' ), + 'GI' => __( 'Gibraltar', 'mailchimp' ), + 'GR' => __( 'Greece', 'mailchimp' ), + 'GL' => __( 'Greenland', 'mailchimp' ), + 'GD' => __( 'Grenada', 'mailchimp' ), + 'GP' => __( 'Guadeloupe', 'mailchimp' ), + 'GU' => __( 'Guam', 'mailchimp' ), + 'GT' => __( 'Guatemala', 'mailchimp' ), + 'GG' => __( 'Guernsey', 'mailchimp' ), + 'GN' => __( 'Guinea', 'mailchimp' ), + 'GW' => __( 'Guinea-Bissau', 'mailchimp' ), + 'GY' => __( 'Guyana', 'mailchimp' ), + 'HT' => __( 'Haiti', 'mailchimp' ), + 'HM' => __( 'Heard Island and McDonald Islands', 'mailchimp' ), + 'HN' => __( 'Honduras', 'mailchimp' ), + 'HK' => __( 'Hong Kong', 'mailchimp' ), + 'HU' => __( 'Hungary', 'mailchimp' ), + 'IS' => __( 'Iceland', 'mailchimp' ), + 'IN' => __( 'India', 'mailchimp' ), + 'ID' => __( 'Indonesia', 'mailchimp' ), + 'IR' => __( 'Iran', 'mailchimp' ), + 'IQ' => __( 'Iraq', 'mailchimp' ), + 'IE' => __( 'Ireland', 'mailchimp' ), + 'IM' => __( 'Isle of Man', 'mailchimp' ), + 'IL' => __( 'Israel', 'mailchimp' ), + 'IT' => __( 'Italy', 'mailchimp' ), + 'CI' => __( 'Ivory Coast', 'mailchimp' ), + 'JM' => __( 'Jamaica', 'mailchimp' ), + 'JP' => __( 'Japan', 'mailchimp' ), + 'JE' => __( 'Jersey', 'mailchimp' ), + 'JO' => __( 'Jordan', 'mailchimp' ), + 'KZ' => __( 'Kazakhstan', 'mailchimp' ), + 'KE' => __( 'Kenya', 'mailchimp' ), + 'KI' => __( 'Kiribati', 'mailchimp' ), + 'KW' => __( 'Kuwait', 'mailchimp' ), + 'KG' => __( 'Kyrgyzstan', 'mailchimp' ), + 'LA' => __( 'Laos', 'mailchimp' ), + 'LV' => __( 'Latvia', 'mailchimp' ), + 'LB' => __( 'Lebanon', 'mailchimp' ), + 'LS' => __( 'Lesotho', 'mailchimp' ), + 'LR' => __( 'Liberia', 'mailchimp' ), + 'LY' => __( 'Libya', 'mailchimp' ), + 'LI' => __( 'Liechtenstein', 'mailchimp' ), + 'LT' => __( 'Lithuania', 'mailchimp' ), + 'LU' => __( 'Luxembourg', 'mailchimp' ), + 'MO' => __( 'Macao', 'mailchimp' ), + 'MK' => __( 'North Macedonia', 'mailchimp' ), + 'MG' => __( 'Madagascar', 'mailchimp' ), + 'MW' => __( 'Malawi', 'mailchimp' ), + 'MY' => __( 'Malaysia', 'mailchimp' ), + 'MV' => __( 'Maldives', 'mailchimp' ), + 'ML' => __( 'Mali', 'mailchimp' ), + 'MT' => __( 'Malta', 'mailchimp' ), + 'MH' => __( 'Marshall Islands', 'mailchimp' ), + 'MQ' => __( 'Martinique', 'mailchimp' ), + 'MR' => __( 'Mauritania', 'mailchimp' ), + 'MU' => __( 'Mauritius', 'mailchimp' ), + 'YT' => __( 'Mayotte', 'mailchimp' ), + 'MX' => __( 'Mexico', 'mailchimp' ), + 'FM' => __( 'Micronesia', 'mailchimp' ), + 'MD' => __( 'Moldova', 'mailchimp' ), + 'MC' => __( 'Monaco', 'mailchimp' ), + 'MN' => __( 'Mongolia', 'mailchimp' ), + 'ME' => __( 'Montenegro', 'mailchimp' ), + 'MS' => __( 'Montserrat', 'mailchimp' ), + 'MA' => __( 'Morocco', 'mailchimp' ), + 'MZ' => __( 'Mozambique', 'mailchimp' ), + 'MM' => __( 'Myanmar', 'mailchimp' ), + 'NA' => __( 'Namibia', 'mailchimp' ), + 'NR' => __( 'Nauru', 'mailchimp' ), + 'NP' => __( 'Nepal', 'mailchimp' ), + 'NL' => __( 'Netherlands', 'mailchimp' ), + 'NC' => __( 'New Caledonia', 'mailchimp' ), + 'NZ' => __( 'New Zealand', 'mailchimp' ), + 'NI' => __( 'Nicaragua', 'mailchimp' ), + 'NE' => __( 'Niger', 'mailchimp' ), + 'NG' => __( 'Nigeria', 'mailchimp' ), + 'NU' => __( 'Niue', 'mailchimp' ), + 'NF' => __( 'Norfolk Island', 'mailchimp' ), + 'MP' => __( 'Northern Mariana Islands', 'mailchimp' ), + 'KP' => __( 'North Korea', 'mailchimp' ), + 'NO' => __( 'Norway', 'mailchimp' ), + 'OM' => __( 'Oman', 'mailchimp' ), + 'PK' => __( 'Pakistan', 'mailchimp' ), + 'PS' => __( 'Palestinian Territory', 'mailchimp' ), + 'PA' => __( 'Panama', 'mailchimp' ), + 'PG' => __( 'Papua New Guinea', 'mailchimp' ), + 'PY' => __( 'Paraguay', 'mailchimp' ), + 'PE' => __( 'Peru', 'mailchimp' ), + 'PH' => __( 'Philippines', 'mailchimp' ), + 'PN' => __( 'Pitcairn', 'mailchimp' ), + 'PL' => __( 'Poland', 'mailchimp' ), + 'PT' => __( 'Portugal', 'mailchimp' ), + 'PR' => __( 'Puerto Rico', 'mailchimp' ), + 'QA' => __( 'Qatar', 'mailchimp' ), + 'RE' => __( 'Reunion', 'mailchimp' ), + 'RO' => __( 'Romania', 'mailchimp' ), + 'RU' => __( 'Russia', 'mailchimp' ), + 'RW' => __( 'Rwanda', 'mailchimp' ), + 'BL' => __( 'Saint Barthélemy', 'mailchimp' ), + 'SH' => __( 'Saint Helena', 'mailchimp' ), + 'KN' => __( 'Saint Kitts and Nevis', 'mailchimp' ), + 'LC' => __( 'Saint Lucia', 'mailchimp' ), + 'MF' => __( 'Saint Martin (French part)', 'mailchimp' ), + 'SX' => __( 'Saint Martin (Dutch part)', 'mailchimp' ), + 'PM' => __( 'Saint Pierre and Miquelon', 'mailchimp' ), + 'VC' => __( 'Saint Vincent and the Grenadines', 'mailchimp' ), + 'SM' => __( 'San Marino', 'mailchimp' ), + 'ST' => __( 'São Tomé and Príncipe', 'mailchimp' ), + 'SA' => __( 'Saudi Arabia', 'mailchimp' ), + 'SN' => __( 'Senegal', 'mailchimp' ), + 'RS' => __( 'Serbia', 'mailchimp' ), + 'SC' => __( 'Seychelles', 'mailchimp' ), + 'SL' => __( 'Sierra Leone', 'mailchimp' ), + 'SG' => __( 'Singapore', 'mailchimp' ), + 'SK' => __( 'Slovakia', 'mailchimp' ), + 'SI' => __( 'Slovenia', 'mailchimp' ), + 'SB' => __( 'Solomon Islands', 'mailchimp' ), + 'SO' => __( 'Somalia', 'mailchimp' ), + 'ZA' => __( 'South Africa', 'mailchimp' ), + 'GS' => __( 'South Georgia/Sandwich Islands', 'mailchimp' ), + 'KR' => __( 'South Korea', 'mailchimp' ), + 'SS' => __( 'South Sudan', 'mailchimp' ), + 'ES' => __( 'Spain', 'mailchimp' ), + 'LK' => __( 'Sri Lanka', 'mailchimp' ), + 'SD' => __( 'Sudan', 'mailchimp' ), + 'SR' => __( 'Suriname', 'mailchimp' ), + 'SJ' => __( 'Svalbard and Jan Mayen', 'mailchimp' ), + 'SZ' => __( 'Eswatini', 'mailchimp' ), + 'SE' => __( 'Sweden', 'mailchimp' ), + 'CH' => __( 'Switzerland', 'mailchimp' ), + 'SY' => __( 'Syria', 'mailchimp' ), + 'TW' => __( 'Taiwan', 'mailchimp' ), + 'TJ' => __( 'Tajikistan', 'mailchimp' ), + 'TZ' => __( 'Tanzania', 'mailchimp' ), + 'TH' => __( 'Thailand', 'mailchimp' ), + 'TL' => __( 'Timor-Leste', 'mailchimp' ), + 'TG' => __( 'Togo', 'mailchimp' ), + 'TK' => __( 'Tokelau', 'mailchimp' ), + 'TO' => __( 'Tonga', 'mailchimp' ), + 'TT' => __( 'Trinidad and Tobago', 'mailchimp' ), + 'TN' => __( 'Tunisia', 'mailchimp' ), + 'TR' => __( 'Turkey', 'mailchimp' ), + 'TM' => __( 'Turkmenistan', 'mailchimp' ), + 'TC' => __( 'Turks and Caicos Islands', 'mailchimp' ), + 'TV' => __( 'Tuvalu', 'mailchimp' ), + 'UG' => __( 'Uganda', 'mailchimp' ), + 'UA' => __( 'Ukraine', 'mailchimp' ), + 'AE' => __( 'United Arab Emirates', 'mailchimp' ), + 'GB' => __( 'United Kingdom (UK)', 'mailchimp' ), + 'US' => __( 'United States (US)', 'mailchimp' ), + 'UM' => __( 'United States (US) Minor Outlying Islands', 'mailchimp' ), + 'UY' => __( 'Uruguay', 'mailchimp' ), + 'UZ' => __( 'Uzbekistan', 'mailchimp' ), + 'VU' => __( 'Vanuatu', 'mailchimp' ), + 'VA' => __( 'Vatican', 'mailchimp' ), + 'VE' => __( 'Venezuela', 'mailchimp' ), + 'VN' => __( 'Vietnam', 'mailchimp' ), + 'VG' => __( 'Virgin Islands (British)', 'mailchimp' ), + 'VI' => __( 'Virgin Islands (US)', 'mailchimp' ), + 'WF' => __( 'Wallis and Futuna', 'mailchimp' ), + 'EH' => __( 'Western Sahara', 'mailchimp' ), + 'WS' => __( 'Samoa', 'mailchimp' ), + 'YE' => __( 'Yemen', 'mailchimp' ), + 'ZM' => __( 'Zambia', 'mailchimp' ), + 'ZW' => __( 'Zimbabwe', 'mailchimp' ), + ); + } + + /** + * Display the Mailchimp footer text on the Mailchimp admin pages. + * + * @since x.x.x + * + * @param string $text The current footer text. + * @return string The modified footer text. + */ + public function admin_footer_text( $text ) { + $current_screen = get_current_screen(); + $current_screen_id = $current_screen ? $current_screen->id : ''; + if ( ! in_array( $current_screen_id, array( 'toplevel_page_mailchimp_sf_options', 'admin_page_mailchimp_sf_create_account' ), true ) ) { + return $text; + } + + return wp_kses( + sprintf( + /* translators: %d - Current year, %s - Mailchimp legal links */ + __( '©%1$d Intuit Inc. All rights reserved. Mailchimp® is a registered trademark of The Rocket Science Group, Cookie Preferences, Privacy, and Terms.', 'mailchimp' ), + gmdate( 'Y' ), + esc_url( 'https://mailchimp.com/legal/cookies/#optanon-toggle-display/' ), + esc_url( 'https://www.intuit.com/privacy/statement/' ), + esc_url( 'https://mailchimp.com/legal/terms' ) + ), array( - 'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), - 'oauth_url' => esc_url( $this->oauth_url ), - 'oauth_start_nonce' => wp_create_nonce( 'mailchimp_sf_oauth_start_nonce' ), - 'oauth_finish_nonce' => wp_create_nonce( 'mailchimp_sf_oauth_finish_nonce' ), - 'oauth_window_name' => esc_html__( 'Mailchimp For WordPress OAuth', 'mailchimp' ), - 'generic_error' => esc_html__( 'An error occurred. Please try again.', 'mailchimp' ), - 'modal_title' => esc_html__( 'Login Popup is blocked!', 'mailchimp' ), - 'modal_button_try_again' => esc_html__( 'Try again', 'mailchimp' ), - 'modal_button_cancel' => esc_html__( 'No, cancel!', 'mailchimp' ), + 'a' => array( + 'href' => array(), + 'target' => array(), + 'rel' => array(), + ), ) ); } diff --git a/js/admin.js b/js/admin.js deleted file mode 100644 index 6e24563..0000000 --- a/js/admin.js +++ /dev/null @@ -1,155 +0,0 @@ -/* eslint-disable prefer-template, no-console */ -(function ($) { - const params = window.mailchimp_sf_admin_params || {}; - const spinner = '.mailchimp-sf-oauth-connect-wrapper .spinner'; - const errorSelector = '.mailchimp-sf-oauth-section .oauth-error'; - - /** - * Open Mailchimp OAuth popup. - * - * @param {string} token - Token from the Oauth service. - */ - function openMailchimpOauthPopup(token) { - const startUrl = params.oauth_url + '/auth/start/' + token; - const width = 800; - const height = 600; - const screenSizes = window.screen || { width: 1024, height: 768 }; - const left = (screenSizes.width - width) / 2; - const top = (screenSizes.height - height) / 4; - const windowOptions = - 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + - width + - ', height=' + - height + - ', top=' + - top + - ', left=' + - left + - ', domain=' + - params.oauth_url.replace('https://', ''); - - // Open Mailchimp OAuth popup. - const popup = window.open(startUrl, params.oauth_window_name, windowOptions); - - if (popup == null) { - // Show modal if popup is blocked. - $('#login-popup-blocked-modal').dialog({ - modal: true, - title: params.modal_title, - width: 480, - buttons: [ - { - text: params.modal_button_cancel, - class: 'button-secondary', - click() { - $(this).dialog('close'); - }, - }, - { - text: params.modal_button_try_again, - class: 'button-primary', - click() { - $(this).dialog('close'); - $(spinner).addClass('is-active'); - openMailchimpOauthPopup(token); - }, - style: 'margin-left: 10px;', - }, - ], - }); - $(spinner).removeClass('is-active'); - } else { - // Handle popup opened. - const oauthInterval = window.setInterval(function () { - if (popup.closed) { - // Clear interval. - window.clearInterval(oauthInterval); - - // Check status of OAuth connection. - const statusUrl = params.oauth_url + '/api/status/' + token; - $.post(statusUrl, function (statusData) { - if (statusData && statusData.status === 'accepted') { - const finishData = { - action: 'mailchimp_sf_oauth_finish', - nonce: params.oauth_finish_nonce, - token, - }; - - // Finish OAuth connection and save token. - $.post(params.ajax_url, finishData, function (finishResponse) { - if (finishResponse.success) { - // Token is saved in the database, reload the page to reflect the changes. - window.location.reload(); - } else { - console.log( - 'Error calling OAuth finish endpoint. Data:', - finishResponse, - ); - if (finishResponse.data && finishResponse.data.message) { - $(errorSelector).html(finishResponse.data.message); - } else { - $(errorSelector).html(params.generic_error); - } - $(errorSelector).show(); - } - $(spinner).removeClass('is-active'); - }).fail(function () { - console.error('Error calling OAuth finish endpoint.'); - $(errorSelector).html(params.generic_error); - $(errorSelector).show(); - $(spinner).removeClass('is-active'); - }); - } else { - console.log( - 'Error calling OAuth status endpoint. No credentials provided at login popup? Data:', - statusData, - ); - $(spinner).removeClass('is-active'); - } - }).fail(function () { - $(errorSelector).html(params.generic_error); - $(errorSelector).show(); - console.error('Error calling OAuth status endpoint.'); - $(spinner).removeClass('is-active'); - }); - } - }, 250); - } - } - - $(window).on('load', function () { - // Mailchimp OAuth connection. - $('#mailchimp_sf_oauth_connect').click(function () { - $(errorSelector).hide(); - $(errorSelector).html(''); - $(spinner).addClass('is-active'); - - $.post( - params.ajax_url, - { - action: 'mailchimp_sf_oauth_start', - nonce: params.oauth_start_nonce, - }, - function (response) { - if (response.success && response.data && response.data.token) { - // Open Mailchimp OAuth popup. - openMailchimpOauthPopup(response.data.token); - } else { - if (response.data && response.data.message) { - $(errorSelector).html(response.data.message); - } else { - $(errorSelector).html(params.generic_error); - } - $(errorSelector).show(); - $(spinner).removeClass('is-active'); - } - }, - ).fail(function () { - $(errorSelector).html(params.generic_error); - $(errorSelector).show(); - $(spinner).removeClass('is-active'); - }); - }); - }); - // eslint-disable-next-line no-undef -})(jQuery); diff --git a/mailchimp.php b/mailchimp.php index 8150397..36f3091 100644 --- a/mailchimp.php +++ b/mailchimp.php @@ -112,7 +112,7 @@ function mailchimp_sf_load_resources() { // JS if ( get_option( 'mc_use_javascript' ) === 'on' ) { if ( ! is_admin() ) { - wp_enqueue_script( 'mailchimp_sf_main_js', MCSF_URL . 'js/mailchimp.js', array( 'jquery', 'jquery-form' ), MCSF_VER, true ); + wp_enqueue_script( 'mailchimp_sf_main_js', MCSF_URL . 'assets/js/mailchimp.js', array( 'jquery', 'jquery-form' ), MCSF_VER, true ); // some javascript to get ajax version submitting to the proper location global $wp_scripts; $wp_scripts->localize( @@ -127,7 +127,7 @@ function mailchimp_sf_load_resources() { if ( get_option( 'mc_use_datepicker' ) === 'on' && ! is_admin() ) { // Datepicker theme - wp_enqueue_style( 'flick', MCSF_URL . 'css/flick/flick.css', array(), MCSF_VER ); + wp_enqueue_style( 'flick', MCSF_URL . 'assets/css/flick/flick.css', array(), MCSF_VER ); // Datepicker JS wp_enqueue_script( 'jquery-ui-datepicker' ); @@ -217,7 +217,7 @@ function mailchimp_sf_request_handler() { } // erase auth information - $options = array( 'mc_api_key', 'mailchimp_sf_access_token', 'mc_datacenter', 'mailchimp_sf_auth_error', 'mc_sopresto_user', 'mc_sopresto_public_key', 'mc_sopresto_secret_key' ); + $options = array( 'mc_api_key', 'mailchimp_sf_access_token', 'mc_datacenter', 'mailchimp_sf_auth_error', 'mailchimp_sf_waiting_for_login', 'mc_sopresto_user', 'mc_sopresto_public_key', 'mc_sopresto_secret_key' ); mailchimp_sf_delete_options( $options ); break; case 'change_form_settings': @@ -775,7 +775,7 @@ function mailchimp_sf_get_interest_categories( $list_id, $new_list ) { */ function mailchimp_sf_setup_page() { $path = plugin_dir_path( __FILE__ ); - require_once $path . '/views/setup_page.php'; + require_once $path . '/includes/admin/templates/settings.php'; } /** diff --git a/tests/cypress/e2e/admin.test.js b/tests/cypress/e2e/admin.test.js index 65d5f4a..e7ba13c 100644 --- a/tests/cypress/e2e/admin.test.js +++ b/tests/cypress/e2e/admin.test.js @@ -17,6 +17,44 @@ describe('Admin can login and make sure plugin is activated', () => { // Check Heading cy.get('#adminmenu li#toplevel_page_mailchimp_sf_options').click(); - cy.get('#wpbody .mailchimp-header h1').contains('Mailchimp List Subscribe Form'); + cy.get('#wpbody .mailchimp-sf-header h3').contains('Mailchimp List Subscribe Form'); + }); + + it('Admin can see "Create account" button and Can visit "Create account" settings page.', () => { + cy.visit('/wp-admin/admin.php?page=mailchimp_sf_options'); + + // Check Create account button. + cy.get('.button.mailchimp-sf-button.button-secondary').should('be.visible'); + cy.get('.button.mailchimp-sf-button.button-secondary').contains('Create an account'); + + cy.get('.button.mailchimp-sf-button.button-secondary').click(); + cy.get('.mailchimp-sf-create-account .title').contains('Confirm your information'); + cy.get('#mailchimp-sf-create-activate-account').should('be.visible'); + }); + + it("Admin shouldn't able to submit create account form with invalid data", () => { + cy.visit('/wp-admin/admin.php?page=mailchimp_sf_create_account'); + + // Submit form without filling any data. + cy.get('#mailchimp-sf-create-activate-account').click(); + + // Check error messages. + cy.get('#mailchimp-sf-first_name-error').contains("First name can't be blank."); + cy.get('#mailchimp-sf-last_name-error').contains("Last name can't be blank."); + cy.get('#mailchimp-sf-email-error').contains( + 'Email confirmation must match confirmation email.', + ); + cy.get('#mailchimp-sf-confirm_email-error').contains( + 'Email confirmation must match the field above.', + ); + cy.get('#mailchimp-sf-address-error').contains("Address line 1 can't be blank."); + cy.get('#mailchimp-sf-city-error').contains("City can't be blank."); + cy.get('#mailchimp-sf-state-error').contains("State can't be blank."); + cy.get('#mailchimp-sf-zip-error').contains("Zip can't be blank."); + + cy.get('#email').clear().type('test'); + cy.get('#confirm_email').clear().type('test'); + cy.get('#mailchimp-sf-create-activate-account').click(); + cy.get('#mailchimp-sf-email-error').contains('Insert correct email.'); }); }); diff --git a/views/setup_page.php b/views/setup_page.php index 63f3677..65a4ea8 100644 --- a/views/setup_page.php +++ b/views/setup_page.php @@ -5,544 +5,443 @@ * @package Mailchimp */ -?> -
-
-
- - - - -

-
- -
- -
-

-

-

- Connect Account button to connect this WordPress site with your Mailchimp account. Once you complete the Mailchimp login in the pop-up window that appears, this page will refresh to show the Mailchimp List Subscribe Form settings.', - 'mailchimp' - ), - [ - 'strong' => [], - ] - ); - ?> -

-

- %2$s', - esc_html__( 'Don\'t have a Mailchimp account?', 'mailchimp' ), - esc_html__( 'Try one for Free!', 'mailchimp' ) - ); - ?> -

-
- - - - - -
-
- - -
-
- - -
-
- -
+?> +
+
- +
- - - - - -

:

-
-
- - - -
-
+ + + + + +

:

+
+
+ + + +
+

-
- -

-

- -
- get( 'lists', 100, array( 'fields' => 'lists.id,lists.name,lists.email_type_option' ) ); +
+

+

- if ( is_wp_error( $lists ) ) { - ?> -
+ + get( 'lists', 100, array( 'fields' => 'lists.id,lists.name,lists.email_type_option' ) ); + if ( is_wp_error( $lists ) ) { + ?> +
+ get_error_message() ) + ); + ?> +
get_error_message() ) - ); + } elseif ( isset( $lists['lists'] ) && count( $lists['lists'] ) === 0 ) { ?> -
-
- -
+
+ Mailchimp" + ); + ?> +
Mailchimp" - ); + } else { + $lists = $lists['lists']; ?> -
- + + + + + + + + + + + + - - - - - -
- - - - - -
- -
-
- -
+ +
- +
-

-

- - - -
-

-

:

-

:

- -
-
-
- - - - - - - - - - - - - - - - - - - -
- - -
- -
- - -
-
- -
- - - -
- -
- - - - -
onclick="showMe('mc-custom-styling')"/>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - /> - -
- - - - px -
- - - # - - # -
- - - # - - # -
- - - # - - # -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
id="mc_use_javascript" class="code" /> - -
id="mc_use_datepicker" class="code" /> - -
id="mc_double_optin" class="code" /> - -
id="mc_update_existing" class="code" /> - -
id="mc_use_unsub_link" class="code" /> - -
- -
- -
+ // Just get out if nothing else matters... + if ( get_option( 'mc_list_id' ) === '' ) { + return; + } -
+ // The main Settings form + ?> +
+ +
+ + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+ + +
+
+ +
+ + + +
+
+ + + + + +
onclick="showMe('mc-custom-styling')"/>
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + /> + +
+ + + + px +
+ + + # + + # +
+ + + # + + # +
+ + + # + + # +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
id="mc_use_javascript" class="code" /> + +
id="mc_use_datepicker" class="code" /> + +
id="mc_double_optin" class="code" /> + +
id="mc_update_existing" class="code" /> + +
id="mc_use_unsub_link" class="code" /> + +
+
+
- - - - - - - - - - - - - - - - + + + +
- + +
+ + + +
+
- - -
+ } else { + ?> +
+ + + + + + + + + + - - /> - -  —  - - - - -
+ +
-
-
- - -
-

-
- - +
- - - - - - - - - - - - - - - -
- - - /> -
-
    - -
  • + + /> + +  —  -
- +
+
+
+ + +
+

+
+ + + + + + + + + + + + + + + + + + + +
+ + + /> +
+
    + +
  • + +
+
+ -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
.widget_mailchimpsf_widget
.widget-title - Modifying this class will affect your other widget titles.', 'mailchimp' ), - [ - 'i' => [], - ] - ); - ?> -
#mc_signup
#mc_subheader
.mc_form_inside
.mc_header
.mc_input
.mc_header_address
.mc_radio_label
#mc-indicates-required
#mc_signup_submit
-
- -
+ } + ?> + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
.widget_mailchimpsf_widget
.widget-title + Modifying this class will affect your other widget titles.', 'mailchimp' ), + [ + 'i' => [], + ] + ); + ?> +
#mc_signup
#mc_subheader
.mc_form_inside
.mc_header
.mc_input
.mc_header_address
.mc_radio_label
#mc-indicates-required
#mc_signup_submit
+
+ +
+