__( 'Accepted a privacy notice', 'ai-eshop-optimizer' ), 'contract' => __( 'Placed an order', 'ai-eshop-optimizer' ), 'implied' => __( 'Typed their address into a form', 'ai-eshop-optimizer' ), ); $aieo_chosen = ! empty( $settings['sources'] ) ? (array) $settings['sources'] : array_keys( $sources ); $aieo_tot = isset( $last['total'] ) ? $last['total'] : array(); $aieo_cd_scanmsg = ''; if ( ! empty( $last['scanned_at'] ) ) { $aieo_cd_scanmsg = sprintf( __( 'Last scanned %s ago', 'ai-eshop-optimizer' ), human_time_diff( strtotime( $last['scanned_at'] . ' UTC' ) ) ); } if ( function_exists( 'rooster_admin_band_open' ) ) { rooster_admin_band_open( array( 'cols' => 1 ) ); } list( $aieo_cd_open, $aieo_cd_close ) = AIEO_DMM_UI::card( array( 'anchor' => 'contact-discovery-contacts-2', 'icon' => 'search', 'title' => __( 'Scan', 'ai-eshop-optimizer' ), 'description' => __( 'Every email the shop holds — from competitions, forms, waitlists, events, surveys, checkouts and push prompts — swept into one de-duplicated list.', 'ai-eshop-optimizer' ), 'class' => 'aieo-cd', 'footer' => ' ' . '' . esc_html( $aieo_cd_scanmsg ) . '', ) ); echo $aieo_cd_open; $aieo_cd_stat_tpl = \Rooster\Admin\Ui::stat( '{label}', '{value}' ); $aieo_cd_fail_tpl = \Rooster\Admin\Ui::notice( '{text}', 'destructive', array( 'title' => '{title}', 'inline' => true ) ); ?>
__( 'Not scanned yet.', 'ai-eshop-optimizer' ) ) ); ?>
$aieo_src ) { $aieo_row = isset( $last['sources'][ $aieo_id ] ) ? $last['sources'][ $aieo_id ] : array(); $aieo_cd_rows[] = array( 'id' => (string) $aieo_id, 'label' => (string) $aieo_src['label'], 'note' => (string) $aieo_src['note'], 'basis' => (string) $aieo_src['basis'], 'basis_label' => isset( $aieo_basis_label[ $aieo_src['basis'] ] ) ? $aieo_basis_label[ $aieo_src['basis'] ] : $aieo_src['basis'], 'chosen' => in_array( $aieo_id, $aieo_chosen, true ), 'people' => isset( $aieo_row['people'] ) ? number_format_i18n( (int) $aieo_row['people'] ) : '', 'new' => isset( $aieo_row['new'] ) ? number_format_i18n( (int) $aieo_row['new'] ) : '', ); } AIEO_Table::card( array( 'anchor' => 'contact-discovery-where-they-came-from', 'icon' => 'door-open', 'heading' => 'h2', 'title' => __( 'Where they came from', 'ai-eshop-optimizer' ), 'description' => __( 'Tick the sources to include. The evidence column says what the shop actually recorded when the address was captured — a competition entry that required a privacy checkbox is stronger evidence than a “notify me” box that did not.', 'ai-eshop-optimizer' ), 'class' => 'aieo-cd-src', 'columns' => array( array( 'key' => 'chosen', 'label' => '', 'sr_label' => __( 'Include', 'ai-eshop-optimizer' ), 'type' => 'control', 'width' => '34px', 'format' => array( 'render' => static function ( $row ) { return ''; }, ), ), array( 'key' => 'label', 'label' => __( 'Source', 'ai-eshop-optimizer' ), 'type' => 'text', 'subline' => 'note', ), array( 'key' => 'basis', 'label' => __( 'Evidence', 'ai-eshop-optimizer' ), 'type' => 'control', 'format' => array( 'render' => static function ( $row ) { $tones = array( 'explicit' => 'success', 'contract' => 'info', 'implied' => 'warning' ); return \Rooster\Admin\Ui::badge( $row['basis_label'], $tones[ $row['basis'] ] ?? 'mono', array( 'sm' => true ) ); }, ), ), array( 'key' => 'people', 'label' => __( 'People', 'ai-eshop-optimizer' ), 'type' => 'control', 'align' => 'right', 'format' => array( 'render' => static function ( $row ) { return '' . ( '' === $row['people'] ? '—' : esc_html( $row['people'] ) ) . ''; }, ), ), array( 'key' => 'new', 'label' => __( 'No account', 'ai-eshop-optimizer' ), 'type' => 'control', 'align' => 'right', 'format' => array( 'render' => static function ( $row ) { return '' . ( '' === $row['new'] ? '—' : esc_html( $row['new'] ) ) . ''; }, ), ), ), 'rows' => $aieo_cd_rows, 'row_key' => 'id', 'page_id' => 'contact_discovery', ) ); list( $aieo_cd_open, $aieo_cd_close ) = AIEO_DMM_UI::card( array( 'anchor' => 'contact-discovery-turn-contacts-into-accounts', 'icon' => 'user-plus', 'title' => __( 'Turn contacts into accounts', 'ai-eshop-optimizer' ), 'description' => __( 'Optional. Detecting contacts is always available; creating accounts for them is a decision each shop makes for itself, so nothing here runs until you switch it on. Creating an account never changes anyone’s marketing consent — that stays exactly as it is.', 'ai-eshop-optimizer' ), ) ); echo $aieo_cd_open; $aieo_cd_save = \Rooster\Admin\States::save_attrs( admin_url( 'admin-ajax.php' ) ) + array( 'data-aieo-cd-setting' => '' ); $aieo_cd_row_enabled = \Rooster\Admin\Ui::field_row( array( 'id' => 'aieo-cd-enabled', 'label' => __( 'Create accounts for detected contacts', 'ai-eshop-optimizer' ), 'control' => \Rooster\Admin\Ui::toggle( 'conversion_enabled', ! empty( $settings['conversion_enabled'] ), array( 'id' => 'aieo-cd-enabled', 'hidden' => false, 'label' => __( 'Enabled', 'ai-eshop-optimizer' ), 'attrs' => $aieo_cd_save ) ), ) ); $aieo_cd_row_notify = \Rooster\Admin\Ui::field_row( array( 'id' => 'aieo-cd-notify', 'label' => __( 'Email each person that an account was created', 'ai-eshop-optimizer' ), 'control' => \Rooster\Admin\Ui::toggle( 'notify', ! empty( $settings['notify'] ), array( 'id' => 'aieo-cd-notify', 'hidden' => false, 'label' => __( 'Enabled', 'ai-eshop-optimizer' ), 'attrs' => $aieo_cd_save ) ), 'help' => __( 'Off by default. Turning this on sends a “your account” email to everyone converted, including people who never asked for a login — a large one-off send that affects how mailboxes treat your domain.', 'ai-eshop-optimizer' ), 'attrs' => \Rooster\Admin\Guidance::role( 'essential' ), ) ); echo '
' . $aieo_cd_row_enabled . $aieo_cd_row_notify . '
'; $aieo_cd_run_on = ! empty( $settings['conversion_enabled'] ); ?>
'aieo-cd-preview-head', 'attrs' => array( 'hidden' => true ) ) ); ?> ' . esc_html( number_format_i18n( isset( $aieo_tot['new'] ) ? (int) $aieo_tot['new'] : 0 ) ) . '' ), array( 'confirm' => __( 'Create accounts', 'ai-eshop-optimizer' ) ) ); $aieo_cd_job = \Rooster\Admin\States::job( array( 'id' => 'aieo-cd-job', 'state' => empty( $job ) ? 'not-run' : 'idle', 'run' => __( 'Create accounts', 'ai-eshop-optimizer' ), 'run_attrs' => array( 'id' => 'aieo-cd-run' ), 'confirm' => 'aieo-cd-run-ask', 'disabled' => ! $aieo_cd_run_on, 'reason' => $aieo_cd_run_on ? '' : __( 'Switch on “Create accounts for detected contacts” first.', 'ai-eshop-optimizer' ), ) ); echo $aieo_cd_job; ?>