import {
createElement,
Component,
useEffect,
useState,
useMemo,
useReducer,
Fragment,
} from '@wordpress/element'
import classnames from 'classnames'
import { __, sprintf } from 'ct-i18n'
import ListPicker from './ListPicker'
import Overlay from '../../../../../static/js/helpers/Overlay'
import { Select } from 'blocksy-options'
import useProExtensionInFree from '../../../../../static/js/dashboard/helpers/useProExtensionInFree'
const freeProviders = ['mailchimp', 'demo']
const EditCredentials = ({ extension, onCredentialsValidated }) => {
const [provider, setProvider] = useState(extension.data.provider)
const [apiKey, setApiKey] = useState(extension.data.api_key)
const [listId, setListId] = useState(extension.data.list_id)
const [isLoading, setIsLoading] = useState(false)
const { isPro, showNotice, content } = useProExtensionInFree(extension, {
strategy: 'pro',
})
useEffect(() => {
if (
extension.data &&
!freeProviders.includes(extension.data.provider) &&
!isPro
) {
setProvider(freeProviders[0])
}
}, [])
const attemptToSaveCredentials = async () => {
const body = new FormData()
body.append('provider', provider)
body.append('api_key', apiKey)
body.append('list_id', listId)
body.append(
'action',
'blocksy_ext_newsletter_subscribe_maybe_save_credentials'
)
setIsLoading(true)
try {
const response = await fetch(ctDashboardLocalizations.ajax_url, {
method: 'POST',
body,
})
if (response.status === 200) {
const body = await response.json()
if (body.success) {
if (body.data.result !== 'api_key_invalid') {
onCredentialsValidated()
}
}
}
} catch (e) {}
await new Promise((r) => setTimeout(() => r(), 1000))
setIsLoading(false)
}
return (
{__('Connect Newsletter Provider', 'blocksy-companion')}
-1 ? 4 : 3}>
{__('Provider', 'blocksy-companion')}
{
if (!isPro && !freeProviders.includes(copy)) {
setProvider(copy)
setTimeout(() => {
setProvider(freeProviders[0])
})
showNotice()
return
}
setProvider(copy)
}}
option={{
placeholder: __(
'Pick Mailing Service',
'blocksy-companion'
),
choices: [
{
key: 'mailchimp',
value: 'Mailchimp',
},
{
key: 'mailerlite',
value: 'Mailerlite',
},
{
key: 'brevo',
value: 'Brevo (Sendinblue)',
},
{
key: 'campaignmonitor',
value: 'Campaign Monitor',
},
{
key: 'convertkit',
value: 'ConvertKit',
},
{
key: 'demo',
value: 'Demo',
},
],
}}
value={
provider.indexOf('mailerlite') > -1
? 'mailerlite'
: provider
}
/>
{provider.indexOf('mailerlite') > -1 && (
{__('Version', 'blocksy-companion')}
{
setProvider(
copy === 'new'
? 'mailerlite-new'
: 'mailerlite'
)
}}
option={{
placeholder: __(
'Pick Mailing Service',
'blocksy-companion'
),
choices: [
{
key: 'classic',
value: 'Classic',
},
{
key: 'new',
value: 'New',
},
],
}}
value={
provider === 'mailerlite-new'
? 'new'
: 'classic'
}
/>
)}
{(freeProviders.includes(provider) ||
ctDashboardLocalizations.plugin_data.is_pro) && (
{__('List ID', 'blocksy-companion')}
setListId(id)}
provider={provider}
apiKey={apiKey}
/>
)}
{provider === 'mailchimp' && (
',
''
),
}}
/>
)}
{ctDashboardLocalizations.plugin_data.is_pro &&
provider.indexOf('mailerlite') > -1 && (
',
'',
'',
' '
),
}}
/>
)}
{provider.indexOf('demo') > -1 && (
)}
{ctDashboardLocalizations.plugin_data.is_pro &&
provider === 'brevo' && (
',
''
),
}}
/>
)}
{ctDashboardLocalizations.plugin_data.is_pro &&
provider === 'convertkit' && (
',
''
),
}}
/>
)}
{ctDashboardLocalizations.plugin_data.is_pro &&
provider === 'campaignmonitor' && (
',
''
),
}}
/>
)}
attemptToSaveCredentials()}>
{isLoading
? __('Loading...', 'blocksy-companion')
: __('Save Settings', 'blocksy-companion')}
{content}
)
}
export default EditCredentials
Teflon® Bags, Kapton® Film, Teflon® Coatings, Roll Covers, TEFZEL® Films and Fabrication - American Durafilm
Fabrication Ideas Take Shape We work with scientists, engineers, and designers to create innovative fabrications techniques to meet the most stringent specifications.
Capabilities
Fabrication
We work closely with scientists, engineers, and designers to create innovative fabrication techniques to meet the most stringent specifications.
Learn More >
Film Distribution
As an experienced distributor and converter of high-performance films, American Durafilm Co., Inc. carries DuPont™ Kapton®, and Teflon® FEP and PFA.
Learn More >
Polyimide Tubing
American Durafilm Co., Inc. Tubing Division is a custom manufacturer of seamless, heat resistant, and chemically inert thermo-set polyimide tubing.
Learn More >
High Performance Coating
Fluoropolymer (Teflon®) coatings are used extensively in a wide variety of applications because of their many desirable properties: non-stick, low friction, non-wetting, thermal stability.
Learn More >
Coated Wire
Custom wire and mandrel coating capabilities to meet the most demanding customer specifications.
Learn More >
About Us
With over 75 years of experience, American Durafilm Co., Inc. has the expertise and engineering knowledge to solve the most difficult problems using high-performance materials from DuPont®, Saint-Gobain Performance Plastics, and Chemours®. In addition to being one of the oldest DuPont-Licensed Industrial Applicators of Teflon® coatings, American Durafilm Co., Inc. is the leading distributor and fabricator of Kapton®, Teflon®, Tefzel®, and Tedlar® films.
Top 10 Reasons To Choose Polyimide Tubing
Polyimide tubing is used so often in such a wide range of applications—from medical devices and industrial applications to the electrical and aerospace industries. It is chosen across various industries for its many desirable properties. Learn more from our informative whitepaper, “Top 10 Reasons to Choose Polyimide Tubing.”
Fri, 24 Oct 2025 17:29:59 GMT
Introducing PureShield, a Greener Surface Solution for Coated Parts
Learn more
Wed, 19 Feb 2025 05:08:12 GMT
American Durafilm Hosts Onsite Coatings Training with Fluorogistx Team
Learn more
Mon, 15 Apr 2024 10:00:00 GMT
A Case for Cavero Coatings
Learn more
Buy High Performance Materials Online
The nation’s largest stocking distributor of high performance materials. Order now for Kapton®, Tedlar®, FEP, PFA, and ETFE films.